From 46d01000cec1b209941569645c2231acb1cb4a2c Mon Sep 17 00:00:00 2001 From: Lorraine Sposto Date: Mon, 16 Jul 2018 13:03:13 -0700 Subject: [PATCH] Preparation for 1.1.0 release --- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ ait/gui/static/build/ait.bundle.js | 14 +++++++------- ait/gui/static/package.json | 2 +- doc/source/conf.py | 4 ++-- setup.py | 2 +- 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f79c84d6..c8e19f8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,33 @@ # Change Log +## [1.1.0](https://github.com/NASA-AMMOS/AIT-GUI/tree/1.1.0) (2018-07-16) +[Full Changelog](https://github.com/NASA-AMMOS/AIT-GUI/compare/1.0.0...1.1.0) + +**Closed issues:** + +- Better handle KeyboardInterrupts in optional service greenlets [\#80](https://github.com/NASA-AMMOS/AIT-GUI/issues/80) +- Add database write integration [\#79](https://github.com/NASA-AMMOS/AIT-GUI/issues/79) +- Update out-of-limit message to include time [\#78](https://github.com/NASA-AMMOS/AIT-GUI/issues/78) +- Limit monitoring disables after limit trip [\#76](https://github.com/NASA-AMMOS/AIT-GUI/issues/76) +- Clean up messy widget docs [\#73](https://github.com/NASA-AMMOS/AIT-GUI/issues/73) +- Plots: title and y-title do not work [\#70](https://github.com/NASA-AMMOS/AIT-GUI/issues/70) +- Update package versions so npm ci is usable [\#68](https://github.com/NASA-AMMOS/AIT-GUI/issues/68) +- Add documentation for GUI widgets [\#47](https://github.com/NASA-AMMOS/AIT-GUI/issues/47) +- Update README with default contributing and community information [\#43](https://github.com/NASA-AMMOS/AIT-GUI/issues/43) +- Remove Contributing Guide from Sphinx docs [\#42](https://github.com/NASA-AMMOS/AIT-GUI/issues/42) +- Update CHANGELOG [\#40](https://github.com/NASA-AMMOS/AIT-GUI/issues/40) + +**Merged pull requests:** + +- Issue \#79 and \#80 - Data archiving and better interrupt handling [\#81](https://github.com/NASA-AMMOS/AIT-GUI/pull/81) ([MJJoyce](https://github.com/MJJoyce)) +- Issue \#76 - Remove greenlet exception raise bug in limit monitoring [\#77](https://github.com/NASA-AMMOS/AIT-GUI/pull/77) ([MJJoyce](https://github.com/MJJoyce)) +- Issue \#73 - Component docstring cleanup [\#74](https://github.com/NASA-AMMOS/AIT-GUI/pull/74) ([MJJoyce](https://github.com/MJJoyce)) +- Issue \#47 - Add GUI widget docs [\#71](https://github.com/NASA-AMMOS/AIT-GUI/pull/71) ([MJJoyce](https://github.com/MJJoyce)) +- Issue \#68 - Update Sinon package version so npm ci works [\#69](https://github.com/NASA-AMMOS/AIT-GUI/pull/69) ([MJJoyce](https://github.com/MJJoyce)) +- Issue \#43 - Update README with default contributing/community info [\#45](https://github.com/NASA-AMMOS/AIT-GUI/pull/45) ([MJJoyce](https://github.com/MJJoyce)) +- Issue \#42 - Remove contributing guide from Sphinx docs [\#44](https://github.com/NASA-AMMOS/AIT-GUI/pull/44) ([MJJoyce](https://github.com/MJJoyce)) +- Issue \#40 - Fix missing CHANGELOG releases [\#41](https://github.com/NASA-AMMOS/AIT-GUI/pull/41) ([MJJoyce](https://github.com/MJJoyce)) + ## [1.0.0](https://github.com/NASA-AMMOS/AIT-GUI/tree/1.0.0) (2018-05-08) [Full Changelog](https://github.com/NASA-AMMOS/AIT-GUI/compare/0.24.0...1.0.0) diff --git a/ait/gui/static/build/ait.bundle.js b/ait/gui/static/build/ait.bundle.js index c49f2adf..16c019e2 100644 --- a/ait/gui/static/build/ait.bundle.js +++ b/ait/gui/static/build/ait.bundle.js @@ -147,13 +147,13 @@ this.attrs_.labels=["X"],e=1;e0;--e)t.removeChild(t.firstChild);return t}function n(t,n){return e(t).appendChild(n)}function i(t,e,n,i){var r=document.createElement(t);if(n&&(r.className=n),i&&(r.style.cssText=i),"string"==typeof e)r.appendChild(document.createTextNode(e));else if(e)for(var o=0;o=e)return a+(e-o);a+=s-o,a+=n-a%n,o=s+1}}function d(t,e){for(var n=0;n=e)return i+Math.min(a,e-r);if(r+=o-i,r+=n-r%n,i=o+1,r>=e)return i}}function p(t){for(;Ga.length<=t;)Ga.push(g(Ga)+" ");return Ga[t]}function g(t){return t[t.length-1]}function v(t,e){for(var n=[],i=0;i"€"&&(t.toUpperCase()!=t.toLowerCase()||Za.test(t))}function x(t,e){return e?!!(e.source.indexOf("\\w")>-1&&_(t))||e.test(t):_(t)}function w(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}function S(t){return t.charCodeAt(0)>=768&&Ka.test(t)}function C(t,e,n){for(;(n<0?e>0:en?-1:1;;){if(e==n)return e;var r=(e+n)/2,o=i<0?Math.ceil(r):Math.floor(r);if(o==e)return t(o)?e:n;t(o)?n=o:e=o+i}}function k(t,e,n){var o=this;this.input=n,o.scrollbarFiller=i("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=i("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=r("div",null,"CodeMirror-code"),o.selectionDiv=i("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=i("div",null,"CodeMirror-cursors"),o.measure=i("div",null,"CodeMirror-measure"),o.lineMeasure=i("div",null,"CodeMirror-measure"),o.lineSpace=r("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var a=r("div",[o.lineSpace],"CodeMirror-lines");o.mover=i("div",[a],null,"position: relative"),o.sizer=i("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=i("div",null,null,"position: absolute; height: "+Ya+"px; width: 1px;"),o.gutters=i("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=i("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=i("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),_a&&xa<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),wa||va&&Ea||(o.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(o.wrapper):t(o.wrapper)),o.viewFrom=o.viewTo=e.first,o.reportedViewFrom=o.reportedViewTo=e.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,n.init(o)}function A(t,e){if(e-=t.first,e<0||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");for(var n=t;!n.lines;)for(var i=0;;++i){var r=n.children[i],o=r.chunkSize();if(e=t.first&&en?I(n,A(t,n).text.length):$(e,A(t,e.line).text.length)}function $(t,e){var n=t.ch;return null==n||n>e?I(t.line,e):n<0?I(t.line,0):t}function Y(t,e){for(var n=[],i=0;i=e:o.to>e);(i||(i=[])).push(new U(a,o.from,l?null:o.to))}}return i}function Q(t,e,n){var i;if(t)for(var r=0;r=e:o.to>e);if(s||o.from==e&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=e:o.from0&&s)for(var x=0;x0)){var c=[l,1],h=F(u.from,s.from),f=F(u.to,s.to);(h<0||!a.inclusiveLeft&&!h)&&c.push({from:u.from,to:s.from}),(f>0||!a.inclusiveRight&&!f)&&c.push({from:s.to,to:u.to}),r.splice.apply(r,c),l+=c.length-3}}return r}function nt(t){var e=t.markedSpans;if(e){for(var n=0;n=0&&h<=0||c<=0&&h>=0)&&(c<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?F(u.to,n)>=0:F(u.to,n)>0)||c>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?F(u.from,i)<=0:F(u.from,i)<0)))return!0}}}function ht(t){for(var e;e=lt(t);)t=e.find(-1,!0).line;return t}function dt(t){for(var e;e=ut(t);)t=e.find(1,!0).line;return t}function ft(t){for(var e,n;e=ut(t);)t=e.find(1,!0).line,(n||(n=[])).push(t);return n}function pt(t,e){var n=A(t,e),i=ht(n);return n==i?e:E(i)}function gt(t,e){if(e>t.lastLine())return e;var n,i=A(t,e);if(!vt(t,i))return e;for(;n=ut(i);)i=n.find(1,!0).line;return E(i)+1}function vt(t,e){var n=Ja&&e.markedSpans;if(n)for(var i=void 0,r=0;re.maxLineLength&&(e.maxLineLength=n,e.maxLine=t)})}function xt(t,e,n,i){if(!t)return i(e,n,"ltr",0);for(var r=!1,o=0;oe||e==n&&a.to==e)&&(i(Math.max(a.from,e),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),r=!0)}r||i(e,n,"ltr")}function wt(t,e,n){var i;ts=null;for(var r=0;re)return r;o.to==e&&(o.from!=o.to&&"before"==n?i=r:ts=r),o.from==e&&(o.from!=o.to&&"before"!=n?i=r:ts=r)}return null!=i?i:ts}function St(t,e){var n=t.order;return null==n&&(n=t.order=es(t.text,e)),n}function Ct(t,e){return t._handlers&&t._handlers[e]||ns}function Tt(t,e,n){if(t.removeEventListener)t.removeEventListener(e,n,!1);else if(t.detachEvent)t.detachEvent("on"+e,n);else{var i=t._handlers,r=i&&i[e];if(r){var o=d(r,n);o>-1&&(i[e]=r.slice(0,o).concat(r.slice(o+1)))}}}function kt(t,e){var n=Ct(t,e);if(n.length)for(var i=Array.prototype.slice.call(arguments,2),r=0;r0}function Lt(t){t.prototype.on=function(t,e){is(this,t,e)},t.prototype.off=function(t,e){Tt(this,t,e)}}function Et(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function Mt(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function Nt(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function Pt(t){Et(t),Mt(t)}function It(t){return t.target||t.srcElement}function Ft(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),Ma&&t.ctrlKey&&1==e&&(e=3),e}function Rt(t){if(null==Ba){var e=i("span","​");n(t,i("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Ba=e.offsetWidth<=1&&e.offsetHeight>2&&!(_a&&xa<8))}var r=Ba?i("span","​"):i("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Ht(t){if(null!=$a)return $a;var i=n(t,document.createTextNode("AخA")),r=Fa(i,0,1).getBoundingClientRect(),o=Fa(i,1,2).getBoundingClientRect();return e(t),!(!r||r.left==r.right)&&($a=o.right-r.right<3)}function jt(t){if(null!=ls)return ls;var e=n(t,i("span","x")),r=e.getBoundingClientRect(),o=Fa(e,0,1).getBoundingClientRect();return ls=Math.abs(r.left-o.left)>1}function Wt(t,e){arguments.length>2&&(e.dependencies=Array.prototype.slice.call(arguments,2)),us[t]=e}function zt(t,e){cs[t]=e}function Bt(t){if("string"==typeof t&&cs.hasOwnProperty(t))t=cs[t];else if(t&&"string"==typeof t.name&&cs.hasOwnProperty(t.name)){var e=cs[t.name];"string"==typeof e&&(e={name:e}),t=b(e,t),t.name=e.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return Bt("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return Bt("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function $t(t,e){e=Bt(e);var n=us[e.name];if(!n)return $t(t,"text/plain");var i=n(t,e);if(hs.hasOwnProperty(e.name)){var r=hs[e.name];for(var o in r)r.hasOwnProperty(o)&&(i.hasOwnProperty(o)&&(i["_"+o]=i[o]),i[o]=r[o])}if(i.name=e.name,e.helperType&&(i.helperType=e.helperType),e.modeProps)for(var a in e.modeProps)i[a]=e.modeProps[a];return i}function Yt(t,e){var n=hs.hasOwnProperty(t)?hs[t]:hs[t]={};c(e,n)}function qt(t,e){if(e===!0)return e;if(t.copyState)return t.copyState(e);var n={};for(var i in e){var r=e[i];r instanceof Array&&(r=r.concat([])),n[i]=r}return n}function Vt(t,e){for(var n;t.innerMode&&(n=t.innerMode(e),n&&n.mode!=t);)e=n.state,t=n.mode;return n||{mode:t,state:e}}function Ut(t,e,n){return!t.startState||t.startState(e,n)}function Xt(t,e,n,i){var r=[t.state.modeGen],o={};ne(t,e.text,t.doc.mode,n,function(t,e){return r.push(t,e)},o,i);for(var a=n.state,s=function(i){n.baseTokens=r;var s=t.state.overlays[i],l=1,u=0;n.state=!0,ne(t,e.text,s.mode,n,function(t,e){for(var n=l;ut&&r.splice(l,1,t,r[l+1],i),l+=2,u=Math.min(t,i)}if(e)if(s.opaque)r.splice(n,l-n,t,"overlay "+e),l=n+2;else for(;nt.options.maxHighlightLength&&qt(t.doc.mode,i.state),o=Xt(t,e,i);r&&(i.state=r),e.stateAfter=i.save(!r),e.styles=o.styles,o.classes?e.styleClasses=o.classes:e.styleClasses&&(e.styleClasses=null),n===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return e.styles}function Zt(t,e,n){var i=t.doc,r=t.display;if(!i.mode.startState)return new ps(i,!0,e);var o=ie(t,e,n),a=o>i.first&&A(i,o-1).stateAfter,s=a?ps.fromSaved(i,a,o):new ps(i,Ut(i.mode),o);return i.iter(o,e,function(n){Kt(t,n.text,s);var i=s.line;n.stateAfter=i==e-1||i%5==0||i>=r.viewFrom&&ie.start)return o}throw new Error("Mode "+t.name+" failed to advance stream.")}function te(t,e,n,i){var r,o=t.doc,a=o.mode;e=B(o,e);var s,l=A(o,e.line),u=Zt(t,e.line,n),c=new ds(l.text,t.options.tabSize,u);for(i&&(s=[]);(i||c.post.options.maxHighlightLength?(s=!1,a&&Kt(t,e,i,h.pos),h.pos=e.length,l=null):l=ee(Jt(n,h,i.state,d),o),d){var f=d[0].name;f&&(l="m-"+(l?f+" "+l:f))}if(!s||c!=l){for(;ua;--s){if(s<=o.first)return o.first;var l=A(o,s-1),u=l.stateAfter;if(u&&(!n||s+(u instanceof fs?u.lookAhead:0)<=o.modeFrontier))return s;var c=h(l.text,null,t.options.tabSize);(null==r||i>c)&&(r=s-1,i=c)}return r}function re(t,e){if(t.modeFrontier=Math.min(t.modeFrontier,e),!(t.highlightFrontiern;i--){var r=A(t,i).stateAfter;if(r&&(!(r instanceof fs)||i+r.lookAhead1&&!/ /.test(t))return t;for(var n=e,i="",r=0;ru&&h.from<=u));d++);if(h.to>=c)return t(n,i,r,o,a,s,l);t(n,i.slice(0,h.to-u),r,o,null,s,l),o=null,i=i.slice(h.to-u),u=h.to}}}function fe(t,e,n,i){var r=!i&&n.widgetNode;r&&t.map.push(t.pos,t.pos+e,r),!i&&t.cm.display.input.needsContentAttribute&&(r||(r=t.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",n.id)),r&&(t.cm.display.input.setUneditable(r),t.content.appendChild(r)),t.pos+=e,t.trailingSpace=!1}function pe(t,e,n){var i=t.markedSpans,r=t.text,o=0;if(i)for(var a,s,l,u,c,h,d,f=r.length,p=0,g=1,v="",m=0;;){if(m==p){l=u=c=h=s="",d=null,m=1/0;for(var y=[],b=void 0,_=0;_p||w.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&m>x.to&&(m=x.to, -u=""),w.className&&(l+=" "+w.className),w.css&&(s=(s?s+";":"")+w.css),w.startStyle&&x.from==p&&(c+=" "+w.startStyle),w.endStyle&&x.to==m&&(b||(b=[])).push(w.endStyle,x.to),w.title&&!h&&(h=w.title),w.collapsed&&(!d||at(d.marker,w)<0)&&(d=x)):x.from>p&&m>x.from&&(m=x.from)}if(b)for(var S=0;S=f)break;for(var T=Math.min(f,m);;){if(v){var k=p+v.length;if(!d){var A=k>T?v.slice(0,T-p):v;e.addToken(e,A,a?a+l:l,c,p+A.length==m?u:"",h,s)}if(k>=T){v=v.slice(T-p),p=T;break}p=k,c=""}v=r.slice(o,o=n[g++]),a=se(n[g++],e.cm.options)}}else for(var D=1;D2&&o.push((l.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function $e(t,e,n){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};for(var i=0;in)return{map:t.measure.maps[r],cache:t.measure.caches[r],before:!0}}function Ye(t,e){e=ht(e);var i=E(e),r=t.display.externalMeasured=new ge(t.doc,e,i);r.lineN=i;var o=r.built=le(t,r);return r.text=o.pre,n(t.display.lineMeasure,o.pre),r}function qe(t,e,n,i){return Xe(t,Ue(t,e),n,i)}function Ve(t,e){if(e>=t.display.viewFrom&&e=n.lineN&&ee)&&(o=l-s,r=o-1,e>=l&&(a="right")),null!=r){if(i=t[u+2],s==l&&n==(i.insertLeft?"left":"right")&&(a=n),"left"==n&&0==r)for(;u&&t[u-2]==t[u-3]&&t[u-1].insertLeft;)i=t[(u-=3)+2],a="left";if("right"==n&&r==l-s)for(;u=0&&(n=t[r]).left==n.right;r--);return n}function Ke(t,e,n,i){var r,o=Ge(e.map,n,i),a=o.node,s=o.start,l=o.end,u=o.collapse;if(3==a.nodeType){for(var c=0;c<4;c++){for(;s&&S(e.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+l0&&(u=i="right");var h;r=t.options.lineWrapping&&(h=a.getClientRects()).length>1?h["right"==i?h.length-1:0]:a.getBoundingClientRect()}if(_a&&xa<9&&!s&&(!r||!r.left&&!r.right)){var d=a.parentNode.getClientRects()[0];r=d?{left:d.left,right:d.left+_n(t.display),top:d.top,bottom:d.bottom}:ws}for(var f=r.top-e.rect.top,p=r.bottom-e.rect.top,g=(f+p)/2,v=e.view.measure.heights,m=0;m=i.text.length?(u=i.text.length,c="before"):u<=0&&(u=0,c="after"),!l)return a("before"==c?u-1:u,"before"==c);var h=wt(l,u,c),d=ts,f=s(u,h,"before"==c);return null!=d&&(f.other=s(u,d,"before"!=c)),f}function cn(t,e){var n=0;e=B(t.doc,e),t.options.lineWrapping||(n=_n(t.display)*e.ch);var i=A(t.doc,e.line),r=yt(i)+Fe(t.display);return{left:n,right:n,top:r,bottom:r+i.height}}function hn(t,e,n,i,r){var o=I(t,e,n);return o.xRel=r,i&&(o.outside=!0),o}function dn(t,e,n){var i=t.doc;if(n+=t.display.viewOffset,n<0)return hn(i.first,0,null,!0,-1);var r=M(i,n),o=i.first+i.size-1;if(r>o)return hn(i.first+i.size-1,A(i,o).text.length,null,!0,1);e<0&&(e=0);for(var a=A(i,r);;){var s=vn(t,a,r,e,n),l=ut(a),u=l&&l.find(0,!0);if(!l||!(s.ch>u.from.ch||s.ch==u.from.ch&&s.xRel>0))return s;r=E(a=u.to.line)}}function fn(t,e,n,i){i-=on(e);var r=e.text.length,o=T(function(e){return Xe(t,n,e-1).bottom<=i},r,0);return r=T(function(e){return Xe(t,n,e).top>i},o,r),{begin:o,end:r}}function pn(t,e,n,i){n||(n=Ue(t,e));var r=an(t,e,Xe(t,n,i),"line").top;return fn(t,e,n,r)}function gn(t,e,n,i){return!(t.bottom<=n)&&(t.top>n||(i?t.left:t.right)>e)}function vn(t,e,n,i,r){r-=yt(e);var o=Ue(t,e),a=on(e),s=0,l=e.text.length,u=!0,c=St(e,t.doc.direction);if(c){var h=(t.options.lineWrapping?yn:mn)(t,e,n,o,c,i,r);u=1!=h.level,s=u?h.from:h.to-1,l=u?h.to:h.from-1}var d,f,p=null,g=null,v=T(function(e){var n=Xe(t,o,e);return n.top+=a,n.bottom+=a,!!gn(n,i,r,!1)&&(n.top<=r&&n.left<=i&&(p=e,g=n),!0)},s,l),m=!1;if(g){var y=i-g.left=_.bottom}return v=C(e.text,v,1),hn(n,v,f,m,i-d)}function mn(t,e,n,i,r,o,a){var s=T(function(s){var l=r[s],u=1!=l.level;return gn(un(t,I(n,u?l.to:l.from,u?"before":"after"),"line",e,i),o,a,!0)},0,r.length-1),l=r[s];if(s>0){var u=1!=l.level,c=un(t,I(n,u?l.from:l.to,u?"after":"before"),"line",e,i);gn(c,o,a,!0)&&c.top>a&&(l=r[s-1])}return l}function yn(t,e,n,i,r,o,a){var s=fn(t,e,i,a),l=s.begin,u=s.end;/\s/.test(e.text.charAt(u-1))&&u--;for(var c=null,h=null,d=0;d=u||f.to<=l)){var p=1!=f.level,g=Xe(t,i,p?Math.min(u,f.to)-1:Math.max(l,f.from)).right,v=gv)&&(c=f,h=v)}}return c||(c=r[r.length-1]),c.fromu&&(c={from:c.from,to:u,level:c.level}),c}function bn(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==ms){ms=i("pre");for(var r=0;r<49;++r)ms.appendChild(document.createTextNode("x")),ms.appendChild(i("br"));ms.appendChild(document.createTextNode("x"))}n(t.measure,ms);var o=ms.offsetHeight/50;return o>3&&(t.cachedTextHeight=o),e(t.measure),o||1}function _n(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=i("span","xxxxxxxxxx"),r=i("pre",[e]);n(t.measure,r);var o=e.getBoundingClientRect(),a=(o.right-o.left)/10;return a>2&&(t.cachedCharWidth=a),a||10}function xn(t){for(var e=t.display,n={},i={},r=e.gutters.clientLeft,o=e.gutters.firstChild,a=0;o;o=o.nextSibling,++a)n[t.options.gutters[a]]=o.offsetLeft+o.clientLeft+r,i[t.options.gutters[a]]=o.clientWidth;return{fixedPos:wn(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:e.wrapper.clientWidth}}function wn(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function Sn(t){var e=bn(t.display),n=t.options.lineWrapping,i=n&&Math.max(5,t.display.scroller.clientWidth/_n(t.display)-3);return function(r){if(vt(t.doc,r))return 0;var o=0;if(r.widgets)for(var a=0;a=t.display.viewTo)return null;if(e-=t.display.viewFrom,e<0)return null;for(var n=t.display.view,i=0;i=t.display.viewTo||s.to().line0?e.blinker=setInterval(function(){return e.cursorDiv.style.visibility=(n=!n)?"":"hidden"},t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function Nn(t){t.state.focused||(t.display.input.focus(),In(t))}function Pn(t){t.state.delayingBlurEvent=!0,setTimeout(function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,Fn(t))},100)}function In(t,e){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(kt(t,"focus",t,e),t.state.focused=!0,s(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),wa&&setTimeout(function(){return t.display.input.reset(!0)},20)),t.display.input.receivedFocus()),Mn(t))}function Fn(t,e){t.state.delayingBlurEvent||(t.state.focused&&(kt(t,"blur",t,e),t.state.focused=!1,ja(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout(function(){t.state.focused||(t.display.shift=!1)},150))}function Rn(t){for(var e=t.display,n=e.lineDiv.offsetTop,i=0;i.005||l<-.005)&&(L(r.line,o),Hn(r.line),r.rest))for(var u=0;u=a&&(o=M(e,yt(A(e,l))-t.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function Wn(t){var e=t.display,n=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var i=wn(e)-e.scroller.scrollLeft+t.doc.scrollLeft,r=e.gutters.offsetWidth,o=i+"px",a=0;a(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),null!=o&&!Da){var a=i("div","​",null,"position: absolute;\n top: "+(e.top-n.viewOffset-Fe(t.display))+"px;\n height: "+(e.bottom-e.top+je(t)+n.barHeight)+"px;\n left: "+e.left+"px; width: "+Math.max(2,e.right-e.left)+"px;");t.display.lineSpace.appendChild(a),a.scrollIntoView(o),t.display.lineSpace.removeChild(a)}}}function $n(t,e,n,i){null==i&&(i=0);var r;t.options.lineWrapping||e!=n||(e=e.ch?I(e.line,"before"==e.sticky?e.ch-1:e.ch,"after"):e,n="before"==e.sticky?I(e.line,e.ch+1,"before"):e);for(var o=0;o<5;o++){var a=!1,s=un(t,e),l=n&&n!=e?un(t,n):s;r={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-i,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+i};var u=qn(t,r),c=t.doc.scrollTop,h=t.doc.scrollLeft;if(null!=u.scrollTop&&(Qn(t,u.scrollTop),Math.abs(t.doc.scrollTop-c)>1&&(a=!0)),null!=u.scrollLeft&&(ti(t,u.scrollLeft),Math.abs(t.doc.scrollLeft-h)>1&&(a=!0)),!a)break}return r}function Yn(t,e){var n=qn(t,e);null!=n.scrollTop&&Qn(t,n.scrollTop),null!=n.scrollLeft&&ti(t,n.scrollLeft)}function qn(t,e){var n=t.display,i=bn(t.display);e.top<0&&(e.top=0);var r=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:n.scroller.scrollTop,o=ze(t),a={};e.bottom-e.top>o&&(e.bottom=e.top+o);var s=t.doc.height+Re(n),l=e.tops-i;if(e.topr+o){var c=Math.min(e.top,(u?s:e.bottom)-o);c!=r&&(a.scrollTop=c)}var h=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:n.scroller.scrollLeft,d=We(t)-(t.options.fixedGutter?n.gutters.offsetWidth:0),f=e.right-e.left>d;return f&&(e.right=e.left+d),e.left<10?a.scrollLeft=0:e.leftd+h-3&&(a.scrollLeft=e.right+(f?0:10)-d),a}function Vn(t,e){null!=e&&(Zn(t),t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+e)}function Un(t){Zn(t);var e=t.getCursor();t.curOp.scrollToPos={from:e,to:e,margin:t.options.cursorScrollMargin}}function Xn(t,e,n){null==e&&null==n||Zn(t),null!=e&&(t.curOp.scrollLeft=e),null!=n&&(t.curOp.scrollTop=n)}function Gn(t,e){Zn(t),t.curOp.scrollToPos=e}function Zn(t){var e=t.curOp.scrollToPos;if(e){t.curOp.scrollToPos=null;var n=cn(t,e.from),i=cn(t,e.to);Kn(t,n,i,e.margin)}}function Kn(t,e,n,i){var r=qn(t,{left:Math.min(e.left,n.left),top:Math.min(e.top,n.top)-i,right:Math.max(e.right,n.right),bottom:Math.max(e.bottom,n.bottom)+i});Xn(t,r.scrollLeft,r.scrollTop)}function Qn(t,e){Math.abs(t.doc.scrollTop-e)<2||(va||Li(t,{top:e}),Jn(t,e,!0),va&&Li(t),Si(t,100))}function Jn(t,e,n){e=Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,e),(t.display.scroller.scrollTop!=e||n)&&(t.doc.scrollTop=e,t.display.scrollbars.setScrollTop(e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e))}function ti(t,e,n,i){e=Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth),(n?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)&&!i||(t.doc.scrollLeft=e,Wn(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbars.setScrollLeft(e))}function ei(t){var e=t.display,n=e.gutters.offsetWidth,i=Math.round(t.doc.height+Re(t.display));return{clientHeight:e.scroller.clientHeight,viewHeight:e.wrapper.clientHeight,scrollWidth:e.scroller.scrollWidth,clientWidth:e.scroller.clientWidth,viewWidth:e.wrapper.clientWidth,barLeft:t.options.fixedGutter?n:0,docHeight:i,scrollHeight:i+je(t)+e.barHeight,nativeBarWidth:e.nativeBarWidth,gutterWidth:n}}function ni(t,e){e||(e=ei(t));var n=t.display.barWidth,i=t.display.barHeight;ii(t,e);for(var r=0;r<4&&n!=t.display.barWidth||i!=t.display.barHeight;r++)n!=t.display.barWidth&&t.options.lineWrapping&&Rn(t),ii(t,ei(t)),n=t.display.barWidth,i=t.display.barHeight}function ii(t,e){var n=t.display,i=n.scrollbars.update(e);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=e.gutterWidth+"px"):n.gutterFiller.style.display=""}function ri(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&ja(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new Ts[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),is(e,"mousedown",function(){t.state.focused&&setTimeout(function(){return t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,n){"horizontal"==n?ti(t,e):Qn(t,e)},t),t.display.scrollbars.addClass&&s(t.display.wrapper,t.display.scrollbars.addClass)}function oi(t){t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++ks},me(t.curOp)}function ai(t){var e=t.curOp;be(e,function(t){for(var e=0;e=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping,t.update=t.mustUpdate&&new As(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function ui(t){t.updatedDisplay=t.mustUpdate&&Di(t.cm,t.update)}function ci(t){var e=t.cm,n=e.display;t.updatedDisplay&&Rn(e),t.barMeasure=ei(e),n.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=qe(e,n.maxLine,n.maxLine.text.length).left+3,e.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+t.adjustWidthTo+je(e)+e.display.barWidth),t.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+t.adjustWidthTo-We(e))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=n.input.prepareSelection())}function hi(t){var e=t.cm;null!=t.adjustWidthTo&&(e.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLefte)&&(r.updateLineNumbers=e),t.curOp.viewChanged=!0,e>=r.viewTo)Ja&&pt(t.doc,e)r.viewFrom?bi(t):(r.viewFrom+=i,r.viewTo+=i);else if(e<=r.viewFrom&&n>=r.viewTo)bi(t);else if(e<=r.viewFrom){var o=_i(t,n,n+i,1);o?(r.view=r.view.slice(o.index),r.viewFrom=o.lineN,r.viewTo+=i):bi(t)}else if(n>=r.viewTo){var a=_i(t,e,e,-1);a?(r.view=r.view.slice(0,a.index),r.viewTo=a.lineN):bi(t)}else{var s=_i(t,e,e,-1),l=_i(t,n,n+i,1);s&&l?(r.view=r.view.slice(0,s.index).concat(ve(t,s.lineN,l.lineN)).concat(r.view.slice(l.index)),r.viewTo+=i):bi(t)}var u=r.externalMeasured;u&&(n=r.lineN&&e=i.viewTo)){var o=i.view[kn(t,e)];if(null!=o.node){var a=o.changes||(o.changes=[]);d(a,n)==-1&&a.push(n)}}}function bi(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function _i(t,e,n,i){var r,o=kn(t,e),a=t.display.view;if(!Ja||n==t.doc.first+t.doc.size)return{index:o,lineN:n};for(var s=t.display.viewFrom,l=0;l0){if(o==a.length-1)return null;r=s+a[o].size-e,o++}else r=s-e;e+=r,n+=r}for(;pt(t.doc,n)!=n;){if(o==(i<0?0:a.length-1))return null;n+=i*a[o-(i<0?1:0)].size,o+=i}return{index:o,lineN:n}}function xi(t,e,n){var i=t.display,r=i.view;0==r.length||e>=i.viewTo||n<=i.viewFrom?(i.view=ve(t,e,n),i.viewFrom=e):(i.viewFrom>e?i.view=ve(t,e,i.viewFrom).concat(i.view):i.viewFromn&&(i.view=i.view.slice(0,kn(t,n)))),i.viewTo=n}function wi(t){for(var e=t.display.view,n=0,i=0;i=t.display.viewTo)){var n=+new Date+t.options.workTime,i=Zt(t,e.highlightFrontier),r=[];e.iter(i.line,Math.min(e.first+e.size,t.display.viewTo+500),function(o){if(i.line>=t.display.viewFrom){var a=o.styles,s=o.text.length>t.options.maxHighlightLength?qt(e.mode,i.state):null,l=Xt(t,o,i,!0);s&&(i.state=s),o.styles=l.styles;var u=o.styleClasses,c=l.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var h=!a||a.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),d=0;!h&&dn)return Si(t,t.options.workDelay),!0}),e.highlightFrontier=i.line,e.modeFrontier=Math.max(e.modeFrontier,i.line),r.length&&fi(t,function(){for(var e=0;e=i.viewFrom&&n.visible.to<=i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&0==wi(t))return!1;zn(t)&&(bi(t),n.dims=xn(t));var o=r.first+r.size,a=Math.max(n.visible.from-t.options.viewportMargin,r.first),s=Math.min(o,n.visible.to+t.options.viewportMargin);i.viewFroms&&i.viewTo-s<20&&(s=Math.min(o,i.viewTo)),Ja&&(a=pt(t.doc,a),s=gt(t.doc,s));var l=a!=i.viewFrom||s!=i.viewTo||i.lastWrapHeight!=n.wrapperHeight||i.lastWrapWidth!=n.wrapperWidth;xi(t,a,s),i.viewOffset=yt(A(t.doc,i.viewFrom)),t.display.mover.style.top=i.viewOffset+"px";var u=wi(t);if(!l&&0==u&&!n.force&&i.renderedView==i.view&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo))return!1;var c=ki(t);return u>4&&(i.lineDiv.style.display="none"),Ei(t,i.updateLineNumbers,n.dims),u>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,Ai(c),e(i.cursorDiv),e(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,l&&(i.lastWrapHeight=n.wrapperHeight,i.lastWrapWidth=n.wrapperWidth,Si(t,400)),i.updateLineNumbers=null,!0}function Oi(t,e){for(var n=e.viewport,i=!0;(i&&t.options.lineWrapping&&e.oldDisplayWidth!=We(t)||(n&&null!=n.top&&(n={top:Math.min(t.doc.height+Re(t.display)-ze(t),n.top)}),e.visible=jn(t.display,t.doc,n),!(e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)))&&Di(t,e);i=!1){Rn(t);var r=ei(t);An(t),ni(t,r),Ni(t,r),e.force=!1}e.signal(t,"update",t),t.display.viewFrom==t.display.reportedViewFrom&&t.display.viewTo==t.display.reportedViewTo||(e.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function Li(t,e){var n=new As(t,e);if(Di(t,n)){Rn(t),Oi(t,n);var i=ei(t);An(t),ni(t,i),Ni(t,i),n.finish()}}function Ei(t,n,i){function r(e){var n=e.nextSibling;return wa&&Ma&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),n}for(var o=t.display,a=t.options.lineNumbers,s=o.lineDiv,l=s.firstChild,u=o.view,c=o.viewFrom,h=0;h-1&&(p=!1),we(t,f,c,i)),p&&(e(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(P(t.options,c)))),l=f.node.nextSibling}else{var g=Le(t,f,c,i);s.insertBefore(g,l)}c+=f.size}for(;l;)l=r(l)}function Mi(t){var e=t.display.gutters.offsetWidth;t.display.sizer.style.marginLeft=e+"px"}function Ni(t,e){t.display.sizer.style.minHeight=e.docHeight+"px",t.display.heightForcer.style.top=e.docHeight+"px",t.display.gutters.style.height=e.docHeight+t.display.barHeight+je(t)+"px"}function Pi(t){var n=t.display.gutters,r=t.options.gutters;e(n);for(var o=0;o-1&&!t.lineNumbers&&(t.gutters=t.gutters.slice(0),t.gutters.splice(e,1))}function Fi(t){var e=t.wheelDeltaX,n=t.wheelDeltaY;return null==e&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(e=t.detail),null==n&&t.detail&&t.axis==t.VERTICAL_AXIS?n=t.detail:null==n&&(n=t.wheelDelta),{x:e,y:n}}function Ri(t){var e=Fi(t);return e.x*=Os,e.y*=Os,e}function Hi(t,e){var n=Fi(e),i=n.x,r=n.y,o=t.display,a=o.scroller,s=a.scrollWidth>a.clientWidth,l=a.scrollHeight>a.clientHeight;if(i&&s||r&&l){if(r&&Ma&&wa)t:for(var u=e.target,c=o.view;u!=a;u=u.parentNode)for(var h=0;h=0){var a=W(o.from(),r.from()),s=j(o.to(),r.to()),l=o.empty()?r.from()==r.head:o.from()==o.head;i<=e&&--e,t.splice(--i,2,new Es(l?s:a,l?a:s))}}return new Ls(t,e)}function Wi(t,e){return new Ls([new Es(t,e||t)],0)}function zi(t){return t.text?I(t.from.line+t.text.length-1,g(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function Bi(t,e){if(F(t,e.from)<0)return t;if(F(t,e.to)<=0)return zi(e);var n=t.line+e.text.length-(e.to.line-e.from.line)-1,i=t.ch;return t.line==e.to.line&&(i+=zi(e).ch-e.to.ch),I(n,i)}function $i(t,e){for(var n=[],i=0;i1&&t.remove(s.line+1,p-1),t.insert(s.line+1,y)}_e(t,"change",t,e)}function Zi(t,e,n){function i(t,r,o){if(t.linked)for(var a=0;a1&&!t.done[t.done.length-2].ranges?(t.done.pop(),g(t.done)):void 0}function rr(t,e,n,i){var r=t.history;r.undone.length=0;var o,a,s=+new Date;if((r.lastOp==i||r.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&r.lastModTime>s-(t.cm?t.cm.options.historyEventDelay:500)||"*"==e.origin.charAt(0)))&&(o=ir(r,r.lastOp==i)))a=g(o.changes),0==F(e.from,e.to)&&0==F(e.from,a.to)?a.to=zi(e):o.changes.push(er(t,e));else{var l=g(r.done);for(l&&l.ranges||sr(t.sel,r.done),o={changes:[er(t,e)],generation:r.generation},r.done.push(o);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(n),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=s,r.lastOp=r.lastSelOp=i,r.lastOrigin=r.lastSelOrigin=e.origin,a||kt(t,"historyAdded")}function or(t,e,n,i){var r=e.charAt(0);return"*"==r||"+"==r&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}function ar(t,e,n,i){var r=t.history,o=i&&i.origin;n==r.lastSelOp||o&&r.lastSelOrigin==o&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==o||or(t,o,g(r.done),e))?r.done[r.done.length-1]=e:sr(e,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=o,r.lastSelOp=n,i&&i.clearRedo!==!1&&nr(r.undone)}function sr(t,e){var n=g(e);n&&n.ranges&&n.equals(t)||e.push(t)}function lr(t,e,n,i){var r=e["spans_"+t.id],o=0;t.iter(Math.max(t.first,n),Math.min(t.first+t.size,i),function(n){n.markedSpans&&((r||(r=e["spans_"+t.id]={}))[o]=n.markedSpans),++o})}function ur(t){if(!t)return null;for(var e,n=0;n-1&&(g(s)[h]=u[h],delete u[h])}}}return i}function fr(t,e,n,i){if(i){var r=t.anchor;if(n){var o=F(e,r)<0;o!=F(n,r)<0?(r=e,e=n):o!=F(e,n)<0&&(e=n)}return new Es(r,e)}return new Es(n||e,e)}function pr(t,e,n,i,r){null==r&&(r=t.cm&&(t.cm.display.shift||t.extend)),_r(t,new Ls([fr(t.sel.primary(),e,n,r)],0),i)}function gr(t,e,n){for(var i=[],r=t.cm&&(t.cm.display.shift||t.extend),o=0;o=e.ch:s.to>e.ch))){if(r&&(kt(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!l.atomic)continue;if(n){var u=l.find(i<0?1:-1),c=void 0;if((i<0?l.inclusiveRight:l.inclusiveLeft)&&(u=Ar(t,u,-i,u&&u.line==e.line?o:null)),u&&u.line==e.line&&(c=F(u,n))&&(i<0?c<0:c>0))return Tr(t,u,e,i,r)}var h=l.find(i<0?-1:1);return(i<0?l.inclusiveLeft:l.inclusiveRight)&&(h=Ar(t,h,i,h.line==e.line?o:null)),h?Tr(t,h,e,i,r):null}}return e}function kr(t,e,n,i,r){var o=i||1,a=Tr(t,e,n,o,r)||!r&&Tr(t,e,n,o,!0)||Tr(t,e,n,-o,r)||!r&&Tr(t,e,n,-o,!0);return a?a:(t.cantEdit=!0,I(t.first,0))}function Ar(t,e,n,i){return n<0&&0==e.ch?e.line>t.first?B(t,I(e.line-1)):null:n>0&&e.ch==(i||A(t,e.line)).text.length?e.line=0;--r)Er(t,{from:i[r].from,to:i[r].to,text:r?[""]:e.text,origin:e.origin});else Er(t,e)}}function Er(t,e){if(1!=e.text.length||""!=e.text[0]||0!=F(e.from,e.to)){var n=$i(t,e);rr(t,e,n,t.cm?t.cm.curOp.id:NaN),Pr(t,e,n,J(t,e));var i=[];Zi(t,function(t,n){n||d(i,t.history)!=-1||(jr(t.history,e),i.push(t.history)),Pr(t,e,null,J(t,e))})}}function Mr(t,e,n){var i=t.cm&&t.cm.state.suppressEdits;if(!i||n){for(var r,o=t.history,a=t.sel,s="undo"==e?o.done:o.undone,l="undo"==e?o.undone:o.done,u=0;u=0;--p){var v=f(p);if(v)return v.v}}}}function Nr(t,e){if(0!=e&&(t.first+=e,t.sel=new Ls(v(t.sel.ranges,function(t){return new Es(I(t.anchor.line+e,t.anchor.ch),I(t.head.line+e,t.head.ch))}),t.sel.primIndex),t.cm)){mi(t.cm,t.first,t.first-e,e);for(var n=t.cm.display,i=n.viewFrom;it.lastLine())){if(e.from.lineo&&(e={from:e.from,to:I(o,A(t,o).text.length),text:[e.text[0]],origin:e.origin}),e.removed=D(t,e.from,e.to),n||(n=$i(t,e)),t.cm?Ir(t.cm,e,i):Gi(t,e,i),xr(t,n,Va)}}function Ir(t,e,n){var i=t.doc,r=t.display,o=e.from,a=e.to,s=!1,l=o.line;t.options.lineWrapping||(l=E(ht(A(i,o.line))),i.iter(l,a.line+1,function(t){if(t==r.maxLine)return s=!0,!0})),i.sel.contains(e.from,e.to)>-1&&Dt(t),Gi(i,e,n,Sn(t)),t.options.lineWrapping||(i.iter(l,o.line+e.text.length,function(t){var e=bt(t);e>r.maxLineLength&&(r.maxLine=t,r.maxLineLength=e,r.maxLineChanged=!0,s=!1)}),s&&(t.curOp.updateMaxLine=!0)),re(i,o.line),Si(t,400);var u=e.text.length-(a.line-o.line)-1;e.full?mi(t):o.line!=a.line||1!=e.text.length||Xi(t.doc,e)?mi(t,o.line,a.line+1,u):yi(t,o.line,"text");var c=Ot(t,"changes"),h=Ot(t,"change");if(h||c){var d={from:o,to:a,text:e.text,removed:e.removed,origin:e.origin};h&&_e(t,"change",t,d),c&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(d)}t.display.selForContextMenu=null}function Fr(t,e,n,i,r){if(i||(i=n),F(i,n)<0){var o;o=[i,n],n=o[0],i=o[1]}"string"==typeof e&&(e=t.splitLines(e)),Lr(t,{from:n,to:i,text:e,origin:r})}function Rr(t,e,n,i){n0||0==s&&a.clearWhenEmpty!==!1)return a;if(a.replacedWith&&(a.collapsed=!0,a.widgetNode=r("span",[a.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||a.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(a.widgetNode.insertLeft=!0)),a.collapsed){if(ct(t,e.line,e,n,a)||e.line!=n.line&&ct(t,n.line,e,n,a))throw new Error("Inserting collapsed marker partially overlapping an existing one");V()}a.addToHistory&&rr(t,{from:e,to:n,origin:"markText"},t.sel,NaN);var l,u=e.line,h=t.cm;if(t.iter(u,n.line+1,function(t){h&&a.collapsed&&!h.options.lineWrapping&&ht(t)==h.display.maxLine&&(l=!0),a.collapsed&&u!=e.line&&L(t,0),Z(t,new U(a,u==e.line?e.ch:null,u==n.line?n.ch:null)),++u}),a.collapsed&&t.iter(e.line,n.line+1,function(e){vt(t,e)&&L(e,0)}),a.clearOnEnter&&is(a,"beforeCursorEnter",function(){return a.clear()}),a.readOnly&&(q(),(t.history.done.length||t.history.undone.length)&&t.clearHistory()),a.collapsed&&(a.id=++Ns,a.atomic=!0),h){if(l&&(h.curOp.updateMaxLine=!0),a.collapsed)mi(h,e.line,n.line+1);else if(a.className||a.title||a.startStyle||a.endStyle||a.css)for(var d=e.line;d<=n.line;d++)yi(h,d,"text");a.atomic&&Sr(h.doc),_e(h,"markerAdded",h,a)}return a}function Vr(t,e,n,i,r){i=c(i),i.shared=!1;var o=[qr(t,e,n,i,r)],a=o[0],s=i.widgetNode;return Zi(t,function(t){s&&(i.widgetNode=s.cloneNode(!0)),o.push(qr(t,B(t,e),B(t,n),i,r));for(var l=0;l-1)return e.state.draggingText(t),void setTimeout(function(){return e.display.input.focus()},20);try{var u=t.dataTransfer.getData("Text");if(u){var c;if(e.state.draggingText&&!e.state.draggingText.copy&&(c=e.listSelections()),xr(e.doc,Wi(n,n)),c)for(var h=0;h=0;e--)Fr(t.doc,"",i[e].from,i[e].to,"+delete");Un(t)})}function fo(t,e,n){var i=C(t.text,e+n,n);return i<0||i>t.text.length?null:i}function po(t,e,n){var i=fo(t,e.ch,n);return null==i?null:new I(e.line,i,n<0?"after":"before")}function go(t,e,n,i,r){if(t){var o=St(n,e.doc.direction);if(o){var a,s=r<0?g(o):o[0],l=r<0==(1==s.level),u=l?"after":"before";if(s.level>0||"rtl"==e.doc.direction){var c=Ue(e,n);a=r<0?n.text.length-1:0;var h=Xe(e,c,a).top;a=T(function(t){return Xe(e,c,t).top==h},r<0==(1==s.level)?s.from:s.to-1,a),"before"==u&&(a=fo(n,a,1))}else a=r<0?s.to:s.from;return new I(i,a,u)}}return new I(i,r<0?n.text.length:0,r<0?"before":"after")}function vo(t,e,n,i){var r=St(e,t.doc.direction);if(!r)return po(e,n,i);n.ch>=e.text.length?(n.ch=e.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=wt(r,n.ch,n.sticky),a=r[o];if("ltr"==t.doc.direction&&a.level%2==0&&(i>0?a.to>n.ch:a.from=a.from&&d>=c.begin)){var f=h?"before":"after";return new I(n.line,d,f)}}var p=function(t,e,i){for(var o=function(t,e){return e?new I(n.line,l(t,1),"before"):new I(n.line,t,"after")};t>=0&&t0==(1!=a.level),u=s?i.begin:l(i.end,-1);if(a.from<=u&&u0?c.end:l(c.begin,-1);return null==v||i>0&&v==e.text.length||!(g=p(i>0?0:r.length-1,i,u(v)))?null:g}function mo(t,e){var n=A(t.doc,e),i=ht(n);return i!=n&&(e=E(i)),go(!0,t,i,e,1)}function yo(t,e){var n=A(t.doc,e),i=dt(n);return i!=n&&(e=E(i)),go(!0,t,n,e,-1)}function bo(t,e){var n=mo(t,e.line),i=A(t.doc,n.line),r=St(i,t.doc.direction);if(!r||0==r[0].level){var o=Math.max(0,i.text.search(/\S/)),a=e.line==n.line&&e.ch<=o&&e.ch;return I(n.line,a?0:o,n.sticky)}return n}function _o(t,e,n){if("string"==typeof e&&(e=qs[e],!e))return!1;t.display.input.ensurePolled();var i=t.display.shift,r=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),n&&(t.display.shift=!1),r=e(t)!=qa}finally{t.display.shift=i,t.state.suppressEdits=!1}return r}function xo(t,e,n){for(var i=0;i-1&&(F((r=s.ranges[r]).from(),e)<0||e.xRel>0)&&(F(r.to(),e)>0||e.xRel<0)?Io(t,i,e,o):Ro(t,i,e,o)}function Io(t,e,n,i){var r=t.display,o=!1,a=pi(t,function(e){wa&&(r.scroller.draggable=!1),t.state.draggingText=!1,Tt(r.wrapper.ownerDocument,"mouseup",a),Tt(r.wrapper.ownerDocument,"mousemove",s),Tt(r.scroller,"dragstart",l),Tt(r.scroller,"drop",a),o||(Et(e),i.addNew||pr(t.doc,n,null,null,i.extend),wa||_a&&9==xa?setTimeout(function(){r.wrapper.ownerDocument.body.focus(),r.input.focus()},20):r.input.focus())}),s=function(t){o=o||Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)>=10},l=function(){return o=!0};wa&&(r.scroller.draggable=!0),t.state.draggingText=a,a.copy=!i.moveOnDrag,r.scroller.dragDrop&&r.scroller.dragDrop(),is(r.wrapper.ownerDocument,"mouseup",a),is(r.wrapper.ownerDocument,"mousemove",s),is(r.scroller,"dragstart",l),is(r.scroller,"drop",a),Pn(t),setTimeout(function(){return r.input.focus()},20)}function Fo(t,e,n){if("char"==n)return new Es(e,e);if("word"==n)return t.findWordAt(e);if("line"==n)return new Es(I(e.line,0),B(t.doc,I(e.line+1,0)));var i=n(t,e);return new Es(i.from,i.to)}function Ro(t,e,n,i){function r(e){if(0!=F(m,e))if(m=e,"rectangle"==i.unit){for(var r=[],o=t.options.tabSize,a=h(A(u,n.line).text,n.ch,o),s=h(A(u,e.line).text,e.ch,o),l=Math.min(a,s),g=Math.max(a,s),v=Math.min(n.line,e.line),y=Math.min(t.lastLine(),Math.max(n.line,e.line));v<=y;v++){var b=A(u,v).text,_=f(b,l,o);l==g?r.push(new Es(I(v,_),I(v,_))):b.length>_&&r.push(new Es(I(v,_),I(v,f(b,g,o))))}r.length||r.push(new Es(n,n)),_r(u,ji(p.ranges.slice(0,d).concat(r),d),{origin:"*mouse",scroll:!1}),t.scrollIntoView(e)}else{var x,w=c,S=Fo(t,e,i.unit),C=w.anchor;F(S.anchor,C)>0?(x=S.head,C=W(w.from(),S.anchor)):(x=S.anchor,C=j(w.to(),S.head));var T=p.ranges.slice(0);T[d]=Ho(t,new Es(B(u,C),x)),_r(u,ji(T,d),Ua)}}function o(e){var n=++b,s=Tn(t,e,!0,"rectangle"==i.unit);if(s)if(0!=F(s,m)){t.curOp.focus=a(),r(s);var c=jn(l,u);(s.line>=c.to||s.liney.bottom?20:0;h&&setTimeout(pi(t,function(){b==n&&(l.scroller.scrollTop+=h,o(e))}),50)}}function s(e){t.state.selectingText=!1,b=1/0,Et(e),l.input.focus(),Tt(l.wrapper.ownerDocument,"mousemove",_),Tt(l.wrapper.ownerDocument,"mouseup",x),u.history.lastSelOrigin=null}var l=t.display,u=t.doc;Et(e);var c,d,p=u.sel,g=p.ranges;if(i.addNew&&!i.extend?(d=u.sel.contains(n),c=d>-1?g[d]:new Es(n,n)):(c=u.sel.primary(),d=u.sel.primIndex),"rectangle"==i.unit)i.addNew||(c=new Es(n,n)),n=Tn(t,e,!0,!0),d=-1;else{var v=Fo(t,n,i.unit);c=i.extend?fr(c,v.anchor,v.head,i.extend):v}i.addNew?d==-1?(d=g.length,_r(u,ji(g.concat([c]),d),{scroll:!1,origin:"*mouse"})):g.length>1&&g[d].empty()&&"char"==i.unit&&!i.extend?(_r(u,ji(g.slice(0,d).concat(g.slice(d+1)),0),{scroll:!1,origin:"*mouse"}),p=u.sel):vr(u,d,c,Ua):(d=0,_r(u,new Ls([c],0),Ua),p=u.sel);var m=n,y=l.wrapper.getBoundingClientRect(),b=0,_=pi(t,function(t){Ft(t)?o(t):s(t)}),x=pi(t,s);t.state.selectingText=x,is(l.wrapper.ownerDocument,"mousemove",_),is(l.wrapper.ownerDocument,"mouseup",x)}function Ho(t,e){var n=e.anchor,i=e.head,r=A(t.doc,n.line);if(0==F(n,i)&&n.sticky==i.sticky)return e;var o=St(r);if(!o)return e;var a=wt(o,n.ch,n.sticky),s=o[a];if(s.from!=n.ch&&s.to!=n.ch)return e;var l=a+(s.from==n.ch==(1!=s.level)?0:1);if(0==l||l==o.length)return e;var u;if(i.line!=n.line)u=(i.line-n.line)*("ltr"==t.doc.direction?1:-1)>0;else{var c=wt(o,i.ch,i.sticky),h=c-a||(i.ch-n.ch)*(1==s.level?-1:1);u=c==l-1||c==l?h<0:h>0}var d=o[l+(u?-1:0)],f=u==(1==d.level),p=f?d.from:d.to,g=f?"after":"before";return n.ch==p&&n.sticky==g?e:new Es(new I(n.line,p,g),i)}function jo(t,e,n,i){var r,o;if(e.touches)r=e.touches[0].clientX,o=e.touches[0].clientY;else try{r=e.clientX,o=e.clientY}catch(t){return!1}if(r>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;i&&Et(e);var a=t.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!Ot(t,n))return Nt(e);o-=s.top-a.viewOffset;for(var l=0;l=r){var c=M(t.doc,o),h=t.options.gutters[l];return kt(t,n,t,c,h,e),Nt(e)}}}function Wo(t,e){return jo(t,e,"gutterClick",!0)}function zo(t,e){Ie(t.display,e)||Bo(t,e)||At(t,e,"contextmenu")||t.display.input.onContextMenu(e)}function Bo(t,e){return!!Ot(t,"gutterContextMenu")&&jo(t,e,"gutterContextMenu",!1)}function $o(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),en(t)}function Yo(t){function e(e,i,r,o){t.defaults[e]=i,r&&(n[e]=o?function(t,e,n){n!=Qs&&r(t,e,n)}:r)}var n=t.optionHandlers;t.defineOption=e,t.Init=Qs,e("value","",function(t,e){return t.setValue(e)},!0),e("mode",null,function(t,e){t.doc.modeOption=e,Vi(t)},!0),e("indentUnit",2,Vi,!0),e("indentWithTabs",!1),e("smartIndent",!0),e("tabSize",4,function(t){Ui(t),en(t),mi(t)},!0),e("lineSeparator",null,function(t,e){if(t.doc.lineSep=e,e){var n=[],i=t.doc.first;t.doc.iter(function(t){for(var r=0;;){var o=t.text.indexOf(e,r);if(o==-1)break;r=o+e.length,n.push(I(i,o))}i++});for(var r=n.length-1;r>=0;r--)Fr(t.doc,e,n[r],I(n[r].line,n[r].ch+e.length))}}),e("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,e,n){t.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g"),n!=Qs&&t.refresh()}),e("specialCharPlaceholder",ue,function(t){return t.refresh()},!0),e("electricChars",!0),e("inputStyle",Ea?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),e("spellcheck",!1,function(t,e){return t.getInputField().spellcheck=e},!0),e("rtlMoveVisually",!Pa),e("wholeLineUpdateBefore",!0),e("theme","default",function(t){$o(t),qo(t)},!0),e("keyMap","default",function(t,e,n){var i=co(e),r=n!=Qs&&co(n);r&&r.detach&&r.detach(t,i),i.attach&&i.attach(t,r||null)}),e("extraKeys",null),e("configureMouse",null),e("lineWrapping",!1,Uo,!0),e("gutters",[],function(t){Ii(t.options),qo(t)},!0),e("fixedGutter",!0,function(t,e){t.display.gutters.style.left=e?wn(t.display)+"px":"0",t.refresh()},!0),e("coverGutterNextToScrollbar",!1,function(t){return ni(t)},!0),e("scrollbarStyle","native",function(t){ri(t),ni(t),t.display.scrollbars.setScrollTop(t.doc.scrollTop),t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)},!0),e("lineNumbers",!1,function(t){Ii(t.options),qo(t)},!0),e("firstLineNumber",1,qo,!0),e("lineNumberFormatter",function(t){return t},qo,!0),e("showCursorWhenSelecting",!1,An,!0),e("resetSelectionOnContextMenu",!0),e("lineWiseCopyCut",!0),e("pasteLinesPerSelection",!0),e("readOnly",!1,function(t,e){"nocursor"==e&&(Fn(t),t.display.input.blur()),t.display.input.readOnlyChanged(e)}),e("disableInput",!1,function(t,e){e||t.display.input.reset()},!0),e("dragDrop",!0,Vo),e("allowDropFileTypes",null),e("cursorBlinkRate",530),e("cursorScrollMargin",0),e("cursorHeight",1,An,!0),e("singleCursorHeightPerLine",!0,An,!0),e("workTime",100),e("workDelay",100),e("flattenSpans",!0,Ui,!0),e("addModeClass",!1,Ui,!0),e("pollInterval",100),e("undoDepth",200,function(t,e){return t.doc.history.undoDepth=e}),e("historyEventDelay",1250),e("viewportMargin",10,function(t){return t.refresh()},!0),e("maxHighlightLength",1e4,Ui,!0),e("moveInputWithCursor",!0,function(t,e){e||t.display.input.resetPosition()}),e("tabindex",null,function(t,e){return t.display.input.getField().tabIndex=e||""}),e("autofocus",null),e("direction","ltr",function(t,e){return t.doc.setDirection(e)},!0)}function qo(t){Pi(t),mi(t),Wn(t)}function Vo(t,e,n){var i=n&&n!=Qs;if(!e!=!i){var r=t.display.dragFunctions,o=e?is:Tt;o(t.display.scroller,"dragstart",r.start),o(t.display.scroller,"dragenter",r.enter),o(t.display.scroller,"dragover",r.over),o(t.display.scroller,"dragleave",r.leave),o(t.display.scroller,"drop",r.drop)}}function Uo(t){t.options.lineWrapping?(s(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(ja(t.display.wrapper,"CodeMirror-wrap"),_t(t)),Cn(t),mi(t),en(t),setTimeout(function(){return ni(t)},100)}function Xo(t,e){var n=this;if(!(this instanceof Xo))return new Xo(t,e);this.options=e=e?c(e):{},c(Js,e,!1),Ii(e);var i=e.value;"string"==typeof i&&(i=new Rs(i,e.mode,null,e.lineSeparator,e.direction)),this.doc=i;var r=new Xo.inputStyles[e.inputStyle](this),o=this.display=new k(t,i,r);o.wrapper.CodeMirror=this,Pi(this),$o(this),e.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),ri(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new za,keySeq:null,specialChars:null},e.autofocus&&!Ea&&o.input.focus(),_a&&xa<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Go(this),eo(),oi(this),this.curOp.forceUpdate=!0,Ki(this,i),e.autofocus&&!Ea||this.hasFocus()?setTimeout(u(In,this),20):Fn(this);for(var a in tl)tl.hasOwnProperty(a)&&tl[a](n,e[a],Qs);zn(this),e.finishInit&&e.finishInit(this);for(var s=0;s400}var r=t.display;is(r.scroller,"mousedown",pi(t,Eo)),_a&&xa<11?is(r.scroller,"dblclick",pi(t,function(e){if(!At(t,e)){var n=Tn(t,e);if(n&&!Wo(t,e)&&!Ie(t.display,e)){Et(e);var i=t.findWordAt(n);pr(t.doc,i.anchor,i.head)}}})):is(r.scroller,"dblclick",function(e){return At(t,e)||Et(e)}),Ha||is(r.scroller,"contextmenu",function(e){return zo(t,e)});var o,a={end:0};is(r.scroller,"touchstart",function(e){if(!At(t,e)&&!n(e)&&!Wo(t,e)){r.input.ensurePolled(),clearTimeout(o);var i=+new Date;r.activeTouch={start:i,moved:!1,prev:i-a.end<=300?a:null},1==e.touches.length&&(r.activeTouch.left=e.touches[0].pageX,r.activeTouch.top=e.touches[0].pageY)}}),is(r.scroller,"touchmove",function(){r.activeTouch&&(r.activeTouch.moved=!0)}),is(r.scroller,"touchend",function(n){var o=r.activeTouch;if(o&&!Ie(r,n)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,s=t.coordsChar(r.activeTouch,"page");a=!o.prev||i(o,o.prev)?new Es(s,s):!o.prev.prev||i(o,o.prev.prev)?t.findWordAt(s):new Es(I(s.line,0),B(t.doc,I(s.line+1,0))),t.setSelection(a.anchor,a.head),t.focus(),Et(n)}e()}),is(r.scroller,"touchcancel",e),is(r.scroller,"scroll",function(){r.scroller.clientHeight&&(Qn(t,r.scroller.scrollTop),ti(t,r.scroller.scrollLeft,!0),kt(t,"scroll",t))}),is(r.scroller,"mousewheel",function(e){return Hi(t,e)}),is(r.scroller,"DOMMouseScroll",function(e){return Hi(t,e)}),is(r.wrapper,"scroll",function(){return r.wrapper.scrollTop=r.wrapper.scrollLeft=0}),r.dragFunctions={enter:function(e){At(t,e)||Pt(e)},over:function(e){At(t,e)||(Qr(t,e),Pt(e))},start:function(e){return Kr(t,e)},drop:pi(t,Zr),leave:function(e){At(t,e)||Jr(t)}};var s=r.input.getField();is(s,"keyup",function(e){return Do.call(t,e)}),is(s,"keydown",pi(t,ko)),is(s,"keypress",pi(t,Oo)),is(s,"focus",function(e){return In(t,e)}),is(s,"blur",function(e){return Fn(t,e)})}function Zo(t,e,n,i){var r,o=t.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?r=Zt(t,e).state:n="prev");var a=t.options.tabSize,s=A(o,e),l=h(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(i||/\S/.test(s.text)){if("smart"==n&&(u=o.mode.indent(r,s.text.slice(c.length),s.text),u==qa||u>150)){if(!i)return;n="prev"}}else u=0,n="not";"prev"==n?u=e>o.first?h(A(o,e-1).text,null,a):0:"add"==n?u=l+t.options.indentUnit:"subtract"==n?u=l-t.options.indentUnit:"number"==typeof n&&(u=l+n),u=Math.max(0,u);var d="",f=0;if(t.options.indentWithTabs)for(var g=Math.floor(u/a);g;--g)f+=a,d+="\t";if(f1)if(nl&&nl.text.join("\n")==e){if(i.ranges.length%nl.text.length==0){l=[];for(var u=0;u=0;h--){var d=i.ranges[h],f=d.from(),p=d.to();d.empty()&&(n&&n>0?f=I(f.line,f.ch-n):t.state.overwrite&&!a?p=I(p.line,Math.min(A(o,p.line).text.length,p.ch+g(s).length)):nl&&nl.lineWise&&nl.text.join("\n")==e&&(f=p=I(f.line,0))),c=t.curOp.updateInput;var m={from:f,to:p,text:l?l[h%l.length]:s,origin:r||(a?"paste":t.state.cutIncoming?"cut":"+input")};Lr(t.doc,m),_e(t,"inputRead",t,m)}e&&!a&&ta(t,e),Un(t),t.curOp.updateInput=c,t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=!1}function Jo(t,e){var n=t.clipboardData&&t.clipboardData.getData("Text");if(n)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||fi(e,function(){return Qo(e,n,0,null,"paste")}),!0}function ta(t,e){if(t.options.electricChars&&t.options.smartIndent)for(var n=t.doc.sel,i=n.ranges.length-1;i>=0;i--){var r=n.ranges[i];if(!(r.head.ch>100||i&&n.ranges[i-1].head.line==r.head.line)){var o=t.getModeAt(r.head),a=!1;if(o.electricChars){for(var s=0;s-1){a=Zo(t,r.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(A(t.doc,r.head.line).text.slice(0,r.head.ch))&&(a=Zo(t,r.head.line,"smart"));a&&_e(t,"electricInput",t,r.head.line)}}}function ea(t){for(var e=[],n=[],i=0;i=t.first+t.size)&&(e=new I(i,e.ch,e.sticky),u=A(t,i))}function a(i){var a;if(a=r?vo(t.cm,u,e,n):po(u,e,n),null==a){if(i||!o())return!1;e=go(r,t.cm,u,e.line,n)}else e=a;return!0}var s=e,l=n,u=A(t,e.line);if("char"==i)a();else if("column"==i)a(!0);else if("word"==i||"group"==i)for(var c=null,h="group"==i,d=t.cm&&t.cm.getHelper(e,"wordChars"),f=!0;!(n<0)||a(!f);f=!1){var p=u.text.charAt(e.ch)||"\n",g=x(p,d)?"w":h&&"\n"==p?"n":!h||/\s/.test(p)?null:"p";if(!h||f||g||(g="s"),c&&c!=g){n<0&&(n=1,a(),e.sticky="after");break}if(g&&(c=g),n>0&&!a(!f))break}var v=kr(t,e,s,l,!0);return R(s,v)&&(v.hitSide=!0),v}function oa(t,e,n,i){var r,o=t.doc,a=e.left;if("page"==i){var s=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),l=Math.max(s-.5*bn(t.display),3);r=(n>0?e.bottom:e.top)+n*l}else"line"==i&&(r=n>0?e.bottom+3:e.top-3);for(var u;u=dn(t,a,r),u.outside;){if(n<0?r<=0:r>=o.height){u.hitSide=!0;break}r+=5*n}return u}function aa(t,e){var n=Ve(t,e.line);if(!n||n.hidden)return null;var i=A(t.doc,e.line),r=$e(n,i,e.line),o=St(i,t.doc.direction),a="left";if(o){var s=wt(o,e.ch);a=s%2?"right":"left"}var l=Ge(r.map,e.ch,a);return l.offset="right"==l.collapse?l.end:l.start,l}function sa(t){for(var e=t;e;e=e.parentNode)if(/CodeMirror-gutter-wrapper/.test(e.className))return!0;return!1}function la(t,e){return e&&(t.bad=!0),t}function ua(t,e,n,i,r){function o(t){return function(e){return e.id==t}}function a(){c&&(u+=h,c=!1)}function s(t){t&&(a(),u+=t)}function l(e){if(1==e.nodeType){var n=e.getAttribute("cm-text");if(null!=n)return void s(n||e.textContent.replace(/\u200b/g,""));var u,d=e.getAttribute("cm-marker");if(d){var f=t.findMarks(I(i,0),I(r+1,0),o(+d));return void(f.length&&(u=f[0].find(0))&&s(D(t.doc,u.from,u.to).join(h)))}if("false"==e.getAttribute("contenteditable"))return;var p=/^(pre|div|p)$/i.test(e.nodeName);p&&a();for(var g=0;g=15&&(Ta=!1,wa=!0);var Fa,Ra=Ma&&(Sa||Ta&&(null==Ia||Ia<12.11)),Ha=va||_a&&xa>=9,ja=function(e,n){var i=e.className,r=t(n).exec(i);if(r){var o=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(o?r[1]+o:"")}};Fa=document.createRange?function(t,e,n,i){var r=document.createRange();return r.setEnd(i||t,n),r.setStart(t,e),r}:function(t,e,n){var i=document.body.createTextRange();try{i.moveToElementText(t.parentNode)}catch(t){return i}return i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",e),i};var Wa=function(t){t.select()};Oa?Wa=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:_a&&(Wa=function(t){try{t.select()}catch(t){}});var za=function(){this.id=null};za.prototype.set=function(t,e){clearTimeout(this.id),this.id=setTimeout(e,t)};var Ba,$a,Ya=30,qa={toString:function(){return"CodeMirror.Pass"}},Va={scroll:!1},Ua={origin:"*mouse"},Xa={origin:"+move"},Ga=[""],Za=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ka=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,Qa=!1,Ja=!1,ts=null,es=function(){function t(t){return t<=247?n.charAt(t):1424<=t&&t<=1524?"R":1536<=t&&t<=1785?i.charAt(t-1536):1774<=t&&t<=2220?"r":8192<=t&&t<=8203?"w":8204==t?"b":"L"}function e(t,e,n){this.level=t,this.from=e,this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",i="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,s=/[Lb1n]/,l=/[1n]/;return function(n,i){var u="ltr"==i?"L":"R";if(0==n.length||"ltr"==i&&!r.test(n))return!1;for(var c=n.length,h=[],d=0;d=this.string.length},ds.prototype.sol=function(){return this.pos==this.lineStart},ds.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},ds.prototype.next=function(){if(this.pose},ds.prototype.eatSpace=function(){for(var t=this,e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++t.pos;return this.pos>e},ds.prototype.skipToEnd=function(){this.pos=this.string.length},ds.prototype.skipTo=function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0},ds.prototype.backUp=function(t){this.pos-=t},ds.prototype.column=function(){return this.lastColumnPos0?null:(i&&e!==!1&&(this.pos+=i[0].length),i)}var r=function(t){return n?t.toLowerCase():t},o=this.string.substr(this.pos,t.length);if(r(o)==r(t))return e!==!1&&(this.pos+=t.length),!0},ds.prototype.current=function(){return this.string.slice(this.start,this.pos)},ds.prototype.hideFirstChars=function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}},ds.prototype.lookAhead=function(t){var e=this.lineOracle;return e&&e.lookAhead(t)},ds.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};var fs=function(t,e){this.state=t,this.lookAhead=e},ps=function(t,e,n,i){this.state=e,this.doc=t,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};ps.prototype.lookAhead=function(t){var e=this.doc.getLine(this.line+t);return null!=e&&t>this.maxLookAhead&&(this.maxLookAhead=t),e},ps.prototype.baseToken=function(t){var e=this;if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=t;)e.baseTokenPos+=2;var n=this.baseTokens[this.baseTokenPos+1];return{type:n&&n.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},ps.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ps.fromSaved=function(t,e,n){return e instanceof fs?new ps(t,qt(t.mode,e.state),n,e.lookAhead):new ps(t,qt(t.mode,e),n)},ps.prototype.save=function(t){var e=t!==!1?qt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new fs(e,this.maxLookAhead):e};var gs=function(t,e,n){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=e||null,this.state=n},vs=function(t,e,n){this.text=t,it(this,e),this.height=n?n(this):1};vs.prototype.lineNo=function(){return E(this)},Lt(vs);var ms,ys={},bs={},_s=null,xs=null,ws={left:0,right:0,top:0,bottom:0},Ss=function(t,e,n){this.cm=n;var r=this.vert=i("div",[i("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=i("div",[i("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");t(r),t(o),is(r,"scroll",function(){r.clientHeight&&e(r.scrollTop,"vertical")}),is(o,"scroll",function(){ -o.clientWidth&&e(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,_a&&xa<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Ss.prototype.update=function(t){var e=t.scrollWidth>t.clientWidth+1,n=t.scrollHeight>t.clientHeight+1,i=t.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=e?i+"px":"0";var r=t.viewHeight-(e?i:0);this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+r)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(e){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=t.barLeft+"px";var o=t.viewWidth-t.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,t.scrollWidth-t.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&t.clientHeight>0&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:e?i:0}},Ss.prototype.setScrollLeft=function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Ss.prototype.setScrollTop=function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Ss.prototype.zeroWidthHack=function(){var t=Ma&&!Aa?"12px":"18px";this.horiz.style.height=this.vert.style.width=t,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new za,this.disableVert=new za},Ss.prototype.enableZeroWidthBar=function(t,e,n){function i(){var r=t.getBoundingClientRect(),o="vert"==n?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1);o!=t?t.style.pointerEvents="none":e.set(1e3,i)}t.style.pointerEvents="auto",e.set(1e3,i)},Ss.prototype.clear=function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)};var Cs=function(){};Cs.prototype.update=function(){return{bottom:0,right:0}},Cs.prototype.setScrollLeft=function(){},Cs.prototype.setScrollTop=function(){},Cs.prototype.clear=function(){};var Ts={native:Ss,null:Cs},ks=0,As=function(t,e,n){var i=t.display;this.viewport=e,this.visible=jn(i,t.doc,e),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=We(t),this.force=n,this.dims=xn(t),this.events=[]};As.prototype.signal=function(t,e){Ot(t,e)&&this.events.push(arguments)},As.prototype.finish=function(){for(var t=this,e=0;e=0&&F(t,r.to())<=0)return i}return-1};var Es=function(t,e){this.anchor=t,this.head=e};Es.prototype.from=function(){return W(this.anchor,this.head)},Es.prototype.to=function(){return j(this.anchor,this.head)},Es.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},zr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,e){for(var n=this,i=t,r=t+e;i1||!(this.children[0]instanceof zr))){var l=[];this.collapse(l),this.children=[new zr(l)],this.children[0].parent=this}},collapse:function(t){for(var e=this,n=0;n50){for(var s=o.lines.length%25+25,l=s;l10);t.parent.maybeSpill()}},iterN:function(t,e,n){for(var i=this,r=0;re.display.maxLineLength&&(e.display.maxLine=c,e.display.maxLineLength=h,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&mi(e,r,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Sr(e.doc)),e&&_e(e,"markerCleared",e,this,r,o),n&&ai(e),this.parent&&this.parent.clear()}},Ps.prototype.find=function(t,e){var n=this;null==t&&"bookmark"==this.type&&(t=1);for(var i,r,o=0;o=0;u--)Lr(i,r[u]);l?br(this,l):this.cm&&Un(this.cm)}),undo:vi(function(){Mr(this,"undo")}),redo:vi(function(){Mr(this,"redo")}),undoSelection:vi(function(){Mr(this,"undo",!0)}),redoSelection:vi(function(){Mr(this,"redo",!0)}),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,n=0,i=0;i=t.ch)&&e.push(r.marker.parent||r.marker)}return e},findMarks:function(t,e,n){t=B(this,t),e=B(this,e);var i=[],r=t.line;return this.iter(t.line,e.line+1,function(o){var a=o.markedSpans;if(a)for(var s=0;s=l.to||null==l.from&&r!=t.line||null!=l.from&&r==e.line&&l.from>=e.ch||n&&!n(l.marker)||i.push(l.marker.parent||l.marker)}++r}),i},getAllMarks:function(){var t=[];return this.iter(function(e){var n=e.markedSpans;if(n)for(var i=0;it?(e=t,!0):(t-=o,void++n)}),B(this,I(n,e))},indexFromPos:function(t){t=B(this,t);var e=t.ch;if(t.linee&&(e=t.from),null!=t.to&&t.to0)r=new I(r.line,r.ch+1),t.replaceRange(o.charAt(r.ch-1)+o.charAt(r.ch-2),I(r.line,r.ch-2),r,"+transpose");else if(r.line>t.doc.first){var a=A(t.doc,r.line-1).text;a&&(r=new I(r.line,1),t.replaceRange(o.charAt(0)+t.doc.lineSeparator()+a.charAt(a.length-1),I(r.line-1,a.length-1),r,"+transpose"))}n.push(new Es(r,r))}t.setSelections(n)})},newlineAndIndent:function(t){return fi(t,function(){for(var e=t.listSelections(),n=e.length-1;n>=0;n--)t.replaceRange(t.doc.lineSeparator(),e[n].anchor,e[n].head,"+input");e=t.listSelections();for(var i=0;it&&0==F(e,this.pos)&&n==this.button};var Zs,Ks,Qs={toString:function(){return"CodeMirror.Init"}},Js={},tl={};Xo.defaults=Js,Xo.optionHandlers=tl;var el=[];Xo.defineInitHook=function(t){return el.push(t)};var nl=null,il=function(t){var e=t.optionHandlers,n=t.helpers={};t.prototype={constructor:t,focus:function(){window.focus(),this.display.input.focus()},setOption:function(t,n){var i=this.options,r=i[t];i[t]==n&&"mode"!=t||(i[t]=n,e.hasOwnProperty(t)&&pi(this,e[t])(this,n,r),kt(this,"optionChange",this,t))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](co(t))},removeKeyMap:function(t){for(var e=this.state.keyMaps,n=0;ni&&(Zo(e,o.head.line,t,!0),i=o.head.line,r==e.doc.sel.primIndex&&Un(e));else{var a=o.from(),s=o.to(),l=Math.max(i,a.line);i=Math.min(e.lastLine(),s.line-(s.ch?0:1))+1;for(var u=l;u0&&vr(e.doc,r,new Es(a,c[r].to()),Va)}}}),getTokenAt:function(t,e){return te(this,t,e)},getLineTokens:function(t,e){return te(this,I(t),e,!0)},getTokenTypeAt:function(t){t=B(this.doc,t);var e,n=Gt(this,A(this.doc,t.line)),i=0,r=(n.length-1)/2,o=t.ch;if(0==o)e=n[2];else for(;;){var a=i+r>>1;if((a?n[2*a-1]:0)>=o)r=a;else{if(!(n[2*a+1]o&&(t=o,r=!0),i=A(this.doc,t)}else i=t;return an(this,i,{top:0,left:0},e||"page",n||r).top+(r?this.doc.height-yt(i):0)},defaultTextHeight:function(){return bn(this.display)},defaultCharWidth:function(){return _n(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,n,i,r){var o=this.display;t=un(this,B(this.doc,t));var a=t.bottom,s=t.left;if(e.style.position="absolute",e.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(e),o.sizer.appendChild(e),"over"==i)a=t.top;else if("above"==i||"near"==i){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==i||t.bottom+e.offsetHeight>l)&&t.top>e.offsetHeight?a=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=l&&(a=t.bottom),s+e.offsetWidth>u&&(s=u-e.offsetWidth)}e.style.top=a+"px",e.style.left=e.style.right="","right"==r?(s=o.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==r?s=0:"middle"==r&&(s=(o.sizer.clientWidth-e.offsetWidth)/2),e.style.left=s+"px"),n&&Yn(this,{left:s,top:a,right:s+e.offsetWidth,bottom:a+e.offsetHeight})},triggerOnKeyDown:gi(ko),triggerOnKeyPress:gi(Oo),triggerOnKeyUp:Do,triggerOnMouseDown:gi(Eo),execCommand:function(t){if(qs.hasOwnProperty(t))return qs[t].call(null,this)},triggerElectric:gi(function(t){ta(this,t)}),findPosH:function(t,e,n,i){var r=this,o=1;e<0&&(o=-1,e=-e);for(var a=B(this.doc,t),s=0;s0&&s(n.charAt(i-1));)--i;for(;r.5)&&Cn(this),kt(this,"refresh",this)}),swapDoc:gi(function(t){var e=this.doc;return e.cm=null,Ki(this,t),en(this),this.display.input.reset(),Xn(this,t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,_e(this,"swapDoc",this,e),e}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Lt(t),t.registerHelper=function(e,i,r){n.hasOwnProperty(e)||(n[e]=t[e]={_global:[]}),n[e][i]=r},t.registerGlobalHelper=function(e,i,r,o){t.registerHelper(e,i,o),n[e]._global.push({pred:r,val:o})}},rl=function(t){this.cm=t,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new za,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};rl.prototype.init=function(t){function e(t){if(!At(r,t)){if(r.somethingSelected())Ko({lineWise:!1,text:r.getSelections()}),"cut"==t.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var e=ea(r);Ko({lineWise:!0,text:e.text}),"cut"==t.type&&r.operation(function(){r.setSelections(e.ranges,0,Va),r.replaceSelection("",null,"cut")})}if(t.clipboardData){t.clipboardData.clearData();var n=nl.text.join("\n");if(t.clipboardData.setData("Text",n),t.clipboardData.getData("Text")==n)return void t.preventDefault()}var a=ia(),s=a.firstChild;r.display.lineSpace.insertBefore(a,r.display.lineSpace.firstChild),s.value=nl.text.join("\n");var l=document.activeElement;Wa(s),setTimeout(function(){r.display.lineSpace.removeChild(a),l.focus(),l==o&&i.showPrimarySelection()},50)}}var n=this,i=this,r=i.cm,o=i.div=t.lineDiv;na(o,r.options.spellcheck),is(o,"paste",function(t){At(r,t)||Jo(t,r)||xa<=11&&setTimeout(pi(r,function(){return n.updateFromDOM()}),20)}),is(o,"compositionstart",function(t){n.composing={data:t.data,done:!1}}),is(o,"compositionupdate",function(t){n.composing||(n.composing={data:t.data,done:!1})}),is(o,"compositionend",function(t){n.composing&&(t.data!=n.composing.data&&n.readFromDOMSoon(),n.composing.done=!0)}),is(o,"touchstart",function(){return i.forceCompositionEnd()}),is(o,"input",function(){n.composing||n.readFromDOMSoon()}),is(o,"copy",e),is(o,"cut",e)},rl.prototype.prepareSelection=function(){var t=Dn(this.cm,!1);return t.focus=this.cm.state.focused,t},rl.prototype.showSelection=function(t,e){t&&this.cm.display.view.length&&((t.focus||e)&&this.showPrimarySelection(),this.showMultipleSelections(t))},rl.prototype.showPrimarySelection=function(){var t=window.getSelection(),e=this.cm,n=e.doc.sel.primary(),i=n.from(),r=n.to();if(e.display.viewTo==e.display.viewFrom||i.line>=e.display.viewTo||r.line=e.display.viewFrom&&aa(e,i)||{node:s[0].measure.map[2],offset:0},u=r.linet.firstLine()&&(i=I(i.line-1,A(t.doc,i.line-1).length)),r.ch==A(t.doc,r.line).text.length&&r.linee.viewTo-1)return!1;var o,a,s;i.line==e.viewFrom||0==(o=kn(t,i.line))?(a=E(e.view[0].line),s=e.view[0].node):(a=E(e.view[o].line),s=e.view[o-1].node.nextSibling);var l,u,c=kn(t,r.line);if(c==e.view.length-1?(l=e.viewTo-1,u=e.lineDiv.lastChild):(l=E(e.view[c+1].line)-1,u=e.view[c+1].node.previousSibling),!s)return!1;for(var h=t.doc.splitLines(ua(t,s,u,a,l)),d=D(t.doc,I(a,0),I(l,A(t.doc,l).text.length));h.length>1&&d.length>1;)if(g(h)==g(d))h.pop(),d.pop(),l--;else{if(h[0]!=d[0])break;h.shift(),d.shift(),a++}for(var f=0,p=0,v=h[0],m=d[0],y=Math.min(v.length,m.length);fi.ch&&b.charCodeAt(b.length-p-1)==_.charCodeAt(_.length-p-1);)f--,p++;h[h.length-1]=b.slice(0,b.length-p).replace(/^\u200b+/,""),h[0]=h[0].slice(f).replace(/\u200b+$/,"");var w=I(a,f),S=I(l,d.length?g(d).length-p:0);return h.length>1||h[0]||F(w,S)?(Fr(t.doc,h,w,S,"+input"),!0):void 0},rl.prototype.ensurePolled=function(){this.forceCompositionEnd()},rl.prototype.reset=function(){this.forceCompositionEnd()},rl.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},rl.prototype.readFromDOMSoon=function(){var t=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(t.readDOMTimeout=null,t.composing){if(!t.composing.done)return;t.composing=null}t.updateFromDOM()},80))},rl.prototype.updateFromDOM=function(){var t=this;!this.cm.isReadOnly()&&this.pollContent()||fi(this.cm,function(){return mi(t.cm)})},rl.prototype.setUneditable=function(t){t.contentEditable="false"},rl.prototype.onKeyPress=function(t){0==t.charCode||this.composing||(t.preventDefault(),this.cm.isReadOnly()||pi(this.cm,Qo)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0))},rl.prototype.readOnlyChanged=function(t){this.div.contentEditable=String("nocursor"!=t)},rl.prototype.onContextMenu=function(){},rl.prototype.resetPosition=function(){},rl.prototype.needsContentAttribute=!0;var ol=function(t){this.cm=t,this.prevInput="",this.pollingFast=!1,this.polling=new za,this.hasSelection=!1,this.composing=null};ol.prototype.init=function(t){function e(t){if(!At(r,t)){if(r.somethingSelected())Ko({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var e=ea(r);Ko({lineWise:!0,text:e.text}),"cut"==t.type?r.setSelections(e.ranges,null,Va):(i.prevInput="",o.value=e.text.join("\n"),Wa(o))}"cut"==t.type&&(r.state.cutIncoming=!0)}}var n=this,i=this,r=this.cm;this.createField(t);var o=this.textarea;t.wrapper.insertBefore(this.wrapper,t.wrapper.firstChild),Oa&&(o.style.width="0px"),is(o,"input",function(){_a&&xa>=9&&n.hasSelection&&(n.hasSelection=null),i.poll()}),is(o,"paste",function(t){At(r,t)||Jo(t,r)||(r.state.pasteIncoming=!0,i.fastPoll())}),is(o,"cut",e),is(o,"copy",e),is(t.scroller,"paste",function(e){Ie(t,e)||At(r,e)||(r.state.pasteIncoming=!0,i.focus())}),is(t.lineSpace,"selectstart",function(e){Ie(t,e)||Et(e)}),is(o,"compositionstart",function(){var t=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:t,range:r.markText(t,r.getCursor("to"),{className:"CodeMirror-composing"})}}),is(o,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},ol.prototype.createField=function(t){this.wrapper=ia(),this.textarea=this.wrapper.firstChild},ol.prototype.prepareSelection=function(){var t=this.cm,e=t.display,n=t.doc,i=Dn(t);if(t.options.moveInputWithCursor){var r=un(t,n.sel.primary().head,"div"),o=e.wrapper.getBoundingClientRect(),a=e.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,r.top+a.top-o.top)),i.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,r.left+a.left-o.left))}return i},ol.prototype.showSelection=function(t){var e=this.cm,i=e.display;n(i.cursorDiv,t.cursors),n(i.selectionDiv,t.selection),null!=t.teTop&&(this.wrapper.style.top=t.teTop+"px",this.wrapper.style.left=t.teLeft+"px")},ol.prototype.reset=function(t){if(!this.contextMenuPending&&!this.composing){var e=this.cm;if(e.somethingSelected()){this.prevInput="";var n=e.getSelection();this.textarea.value=n,e.state.focused&&Wa(this.textarea),_a&&xa>=9&&(this.hasSelection=n)}else t||(this.prevInput=this.textarea.value="",_a&&xa>=9&&(this.hasSelection=null))}},ol.prototype.getField=function(){return this.textarea},ol.prototype.supportsTouch=function(){return!1},ol.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Ea||a()!=this.textarea))try{this.textarea.focus()}catch(t){}},ol.prototype.blur=function(){this.textarea.blur()},ol.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ol.prototype.receivedFocus=function(){this.slowPoll()},ol.prototype.slowPoll=function(){var t=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){t.poll(),t.cm.state.focused&&t.slowPoll()})},ol.prototype.fastPoll=function(){function t(){var i=n.poll();i||e?(n.pollingFast=!1,n.slowPoll()):(e=!0,n.polling.set(60,t))}var e=!1,n=this;n.pollingFast=!0,n.polling.set(20,t)},ol.prototype.poll=function(){var t=this,e=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!e.state.focused||as(n)&&!i&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var r=n.value;if(r==i&&!e.somethingSelected())return!1;if(_a&&xa>=9&&this.hasSelection===r||Ma&&/[\uf700-\uf7ff]/.test(r))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var o=r.charCodeAt(0);if(8203!=o||i||(i="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var a=0,s=Math.min(i.length,r.length);a1e3||r.indexOf("\n")>-1?n.value=t.prevInput="":t.prevInput=r,t.composing&&(t.composing.range.clear(),t.composing.range=e.markText(t.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ol.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ol.prototype.onKeyPress=function(){_a&&xa>=9&&(this.hasSelection=null),this.fastPoll()},ol.prototype.onContextMenu=function(t){function e(){if(null!=a.selectionStart){var t=r.somethingSelected(),e="​"+(t?a.value:"");a.value="⇚",a.value=e,i.prevInput=t?"":"​",a.selectionStart=1,a.selectionEnd=e.length,o.selForContextMenu=r.doc.sel}}function n(){if(i.contextMenuPending=!1,i.wrapper.style.cssText=h,a.style.cssText=c,_a&&xa<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=l),null!=a.selectionStart){(!_a||_a&&xa<9)&&e();var t=0,n=function(){o.selForContextMenu==r.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&"​"==i.prevInput?pi(r,Dr)(r):t++<10?o.detectingSelectAll=setTimeout(n,500):(o.selForContextMenu=null,o.input.reset())};o.detectingSelectAll=setTimeout(n,200)}}var i=this,r=i.cm,o=r.display,a=i.textarea,s=Tn(r,t),l=o.scroller.scrollTop;if(s&&!Ta){var u=r.options.resetSelectionOnContextMenu;u&&r.doc.sel.contains(s)==-1&&pi(r,_r)(r.doc,Wi(s),Va);var c=a.style.cssText,h=i.wrapper.style.cssText;i.wrapper.style.cssText="position: absolute";var d=i.wrapper.getBoundingClientRect();a.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(t.clientY-d.top-5)+"px; left: "+(t.clientX-d.left-5)+"px;\n z-index: 1000; background: "+(_a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var f;if(wa&&(f=window.scrollY),o.input.focus(),wa&&window.scrollTo(null,f),o.input.reset(),r.somethingSelected()||(a.value=i.prevInput=" "),i.contextMenuPending=!0,o.selForContextMenu=r.doc.sel,clearTimeout(o.detectingSelectAll),_a&&xa>=9&&e(),Ha){Pt(t);var p=function(){Tt(window,"mouseup",p),setTimeout(n,20)};is(window,"mouseup",p)}else setTimeout(n,50)}},ol.prototype.readOnlyChanged=function(t){t||this.reset(),this.textarea.disabled="nocursor"==t},ol.prototype.setUneditable=function(){},ol.prototype.needsContentAttribute=!1,Yo(Xo),il(Xo);var al="iter insert remove copy getEditor constructor".split(" ");for(var sl in Rs.prototype)Rs.prototype.hasOwnProperty(sl)&&d(al,sl)<0&&(Xo.prototype[sl]=function(t){return function(){return t.apply(this.doc,arguments)}}(Rs.prototype[sl]));return Lt(Rs),Xo.inputStyles={textarea:ol,contenteditable:rl},Xo.defineMode=function(t){Xo.defaults.mode||"null"==t||(Xo.defaults.mode=t),Wt.apply(this,arguments)},Xo.defineMIME=zt,Xo.defineMode("null",function(){return{token:function(t){return t.skipToEnd()}}}),Xo.defineMIME("text/plain","null"),Xo.defineExtension=function(t,e){Xo.prototype[t]=e},Xo.defineDocExtension=function(t,e){Rs.prototype[t]=e},Xo.fromTextArea=da,fa(Xo),Xo.version="5.37.0",Xo})},function(t,e,n){var i=n(191),r=n(210),o=r(function(t,e,n){i(t,e,n)});t.exports=o},function(t,e,n){function i(t,e,n,h,d){t!==e&&a(e,function(a,u){if(l(a))d||(d=new r),s(t,e,u,n,i,h,d);else{var f=h?h(c(t,u),a,u+"",t,e,d):void 0;void 0===f&&(f=a),o(t,u,f)}},u)}var r=n(61),o=n(192),a=n(22),s=n(193),l=n(51),u=n(207),c=n(203);t.exports=i},function(t,e,n){function i(t,e,n){(void 0===n||o(t[e],n))&&(void 0!==n||e in t)||r(t,e,n)}var r=n(149),o=n(66);t.exports=i},function(t,e,n){function i(t,e,n,i,b,_,x){var w=m(t,n),S=m(e,n),C=x.get(S);if(C)return void r(t,n,C);var T=_?_(w,S,n+"",t,e,x):void 0,k=void 0===T;if(k){var A=c(S),D=!A&&d(S),O=!A&&!D&&v(S);T=S,A||D||O?c(w)?T=w:h(w)?T=s(w):D?(k=!1,T=o(S,!0)):O?(k=!1,T=a(S,!0)):T=[]:g(S)||u(S)?(T=w,u(w)?T=y(w):(!p(w)||i&&f(w))&&(T=l(S))):k=!1}k&&(x.set(S,T),b(T,S,i,_,x),x.delete(S)),r(t,n,T)}var r=n(192),o=n(194),a=n(195),s=n(197),l=n(198),u=n(27),c=n(36),h=n(201),d=n(37),f=n(50),p=n(51),g=n(202),v=n(40),m=n(203),y=n(204);t.exports=i},function(t,e,n){(function(t){function i(t,e){if(e)return t.slice();var n=t.length,i=u?u(n):new t.constructor(n);return t.copy(i),i}var r=n(31),o="object"==typeof e&&e&&!e.nodeType&&e,a=o&&"object"==typeof t&&t&&!t.nodeType&&t,s=a&&a.exports===o,l=s?r.Buffer:void 0,u=l?l.allocUnsafe:void 0;t.exports=i}).call(e,n(5)(t))},function(t,e,n){function i(t,e){var n=e?r(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var r=n(196);t.exports=i},function(t,e,n){function i(t){var e=new t.constructor(t.byteLength);return new r(e).set(new r(t)),e}var r=n(106);t.exports=i},function(t,e){function n(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++n1?n[r-1]:void 0,s=r>2?n[2]:void 0;for(a=t.length>3&&"function"==typeof a?(r--,a):void 0,s&&o(n[0],n[1],s)&&(a=r<3?void 0:a,r=1),e=Object(e);++i0){if(++e>=i)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var i=800,r=16,o=Date.now;t.exports=n},function(t,e,n){function i(t,e,n){if(!s(n))return!1;var i=typeof e;return!!("number"==i?o(n)&&a(e,n.length):"string"==i&&e in n)&&r(n[e],t)}var r=n(66),o=n(49),a=n(39),s=n(51);t.exports=i},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.TelemetryQuery=void 0;var r=n(146),o=i(r),a={_data_paths:{},_packet:null,_fields:[],_querying:!1,_validation_errors:{},_tlm_dict:null,oninit:function(t){var e=this;m.request({method:"GET",url:"/data"}).then(function(t){e._data_paths=t}),ait.tlm.promise.then(function(){"packet"in t.attrs&&(e._packet=t.attrs.packet)})},view:function(t){var e=this,n=void 0;"data-dir"in t.attrs?n=m("input",{type:"hidden",name:"dataDir",value:t.attrs["data-dir"]}):(n=m("div",{class:"form-group"},[m("label","Data Directory"),m("select",{class:"form-control",name:"dataDir"},[m("option",{disabled:"disabled",selected:"selected"},"Select an option ...")].concat((0,o.default)(Object.keys(this._data_paths),function(t){return m("option",{value:t},t+": "+e._data_paths[t])}))),m("p",{class:"help-block"},"The archive data directory containing the relevant telemetry data over which to search")]),this._validation_errors.dataDir&&(n.attrs.className+=" has-error"));var i=void 0;i="packet"in t.attrs?m("input",{type:"hidden",name:"packet",value:t.attrs.packet}):m("div",{class:"form-group"},[m("label","Telemetry Packet"),m("select",{class:"form-control",name:"packet",onchange:function(t){e._packet=t.currentTarget.value}},[m("option",{disabled:"disabled",selected:"selected"},"Select an option ...")].concat((0,o.default)(Object.keys(ait.tlm.dict),function(t){return m("option",{value:t},t)}))),m("p",{class:"help-block"},"The telemetry packet that contains the fields to be queried")]),this._validation_errors.packet&&(i.attrs.className+=" has-error");var r=null;r=null===this._packet?[]:[m("option",{disabled:"disabled",selected:"selected",value:"bogusDefaultSelectOption"},"Select an option ...")].concat((0,o.default)(Object.keys(ait.tlm.dict[this._packet].fields).sort(),function(t){return m("option",{value:t},t)}));var a=void 0;"time-field"in t.attrs?a=m("input",{type:"hidden",name:"timeField",value:t.attrs["time-field"]}):(a=m("div",{class:"form-group"},[m("label","Telemetry Time Field"),m("select",{class:"form-control",name:"timeField"},r),m("p",{class:"help-block"},"Select and add the telemetry time field to use as a basis for the query")]),this._validation_errors.timeField&&(a.attrs.className+=" has-error"));var s=m("div",{class:"form-group"},[m("label","Telemetry Fields"),m("div",{class:"input-group"},m("select",{class:"form-control",name:"fields"},r),m("div",{class:"input-group-btn"},m("button",{class:"btn btn-default",type:"button",onmousedown:function(t){t.preventDefault();var n=t.currentTarget.parentElement.parentElement.children[0];e._fields.push(n.value),n.value="bogusDefaultSelectOption"}},"Add"))),m("p",{class:"help-block"},"Select and add the telemetry field(s) to query")]);this._validation_errors.fields&&(s.attrs.className+=" has-error");var l=m("span");0!==this._fields.length&&(l=m("div",{class:"form-group"},[m("label","Fields selected for query"),m("div",{class:"field_selection"},(0,o.default)(this._fields,function(t,n){return m("div",{class:"label label-default field_label",onmouseover:function(t){t.currentTarget.classList.add("label-danger")},onmouseout:function(t){t.currentTarget.classList.remove("label-danger")},onclick:function(t){e._fields.splice(n,1)}},t)})),m("p",{class:"help-block"},"The telemetry points that will be filtered from the selected data")]));var u=m("div",{class:"form-group"},[m("label","Start Time"),m("input",{class:"form-control",placeholder:"Start time YYYY-MM-DDTHH:MM:SSZ",name:"startTime"}),m("p",{class:"help-block"},"Start time for data filtering. Expected format: YYYY-MM-DDTHH:MM:SSZ")]);this._validation_errors.startTime&&(u.attrs.className+=" has-error");var c=m("div",{class:"form-group"},[m("label","End Time"),m("input",{class:"form-control",placeholder:"End time YYYY-MM-DDTHH:MM:SSZ",name:"endTime"}),m("p",{class:"help-block"},"End time for data filtering. Expected format: YYYY-MM-DDTHH:MM:SSZ")]);this._validation_errors.endTime&&(c.attrs.className+=" has-error");var h="Query",d={class:"btn btn-success pull-right",type:"submit"};this._querying&&(h=m("span",{class:"glyphicon glyphicon-refresh right-spin"}),d.disabled="disabled");var f=m("button",d,h),p=m("form",{onsubmit:function(n){n.preventDefault();var i=new FormData,r=n.currentTarget;return!!e._validate_form(r)&&(i.append("dataDir",e._data_paths[r.elements.dataDir.value]),i.append("timeField",r.elements.timeField.value),i.append("packet",r.elements.packet.value),i.append("fields",e._fields),i.append("startTime",r.elements.startTime.value),i.append("endTime",r.elements.endTime.value),e._querying=!0,m.request({url:"/tlm/query",method:"POST",data:i,extract:function(t){return t}}).then(function(n){e._querying=!1;var i=new Blob([n.response]),o=document.createElement("a");o.href=window.URL.createObjectURL(i),o.download="query_output.csv",o.click(),r.reset(),"data-dir"in t.attrs||(r.elements.dataDir.selectedIndex=0),"packet"in t.attrs?r.elements.fields.selectedIndex=0:(r.elements.packet.selectedIndex=0,e._packet=null),"time-field"in t.attrs||(r.elements.timeField.selectedIndex=-1),e._fields=[]}).catch(function(t){e._querying=!1}),!1)}},[n,i,a,s,l,u,c,f]);return m("ait-telemetryquery",t.attrs,p)},_validate_form:function(t){this._validation_errors={},0===t.elements.dataDir.selectedIndex&&(this._validation_errors.dataDir=!0),0===t.elements.packet.selectedIndex&&(this._validation_errors.packet=!0),t.elements.timeField.selectedIndex!==-1&&0!==t.elements.timeField.selectedIndex||(this._validation_errors.timeField=!0),0===this._fields.length&&(this._validation_errors.fields=!0);var e=/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\dZ/;return e.test(t.elements.startTime.value)||(this._validation_errors.startTime=!0),e.test(t.elements.endTime.value)||(this._validation_errors.endTime=!0),0===Object.keys(this._validation_errors).length}};e.default={TelemetryQuery:a},e.TelemetryQuery=a},function(t,e,n){(function(t){"use strict";function i(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.MnemonicSearch=void 0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a=n(146),s=r(a),l=n(221),u=r(l),c=n(11),h=i(c),d=n(158),f=(r(d),n(14)),p=(r(f),n(156),n(157)),g={_packet:null,_selection:null,oninit:function(t){this._packet=t.attrs.packet,ait.tlm.search={dict:{}}},oncreate:function(e){var n=this;ait.tlm.promise.then(function(i){(0,u.default)(e.attrs,{"result-count":20});var r=function(t){return t?t.split("_"):[]};ait.tlm.search.dict=new p({datumTokenizer:r,queryTokenizer:r,local:(0,s.default)(i[n._packet].fields,function(t,e){return t.name}).sort()}),t('input[name="tlmsearch"]',e.dom).typeahead({highlight:!0},{name:"tlm-mnemonics",limit:e.attrs["result-count"],source:ait.tlm.search.dict}).bind("typeahead:select",function(i,r){n._selection=r,i.target.blur(),t('input[name="tlmsearch"]',e.dom).typeahead("val",""),ait.events.emit("modal:show",n._generateModalContent()),m.redraw()}).bind("typeahead:autocomplete",function(i,r){n._selection=r,i.target.blur(),t('input[name="tlmsearch"]',e.dom).typeahead("val",""),ait.events.emit("modal:show",n._generateModalContent()),m.redraw()}).bind("typeahead:close",function(n,i){n.target.blur(),t('input[name="tlmsearch"]',e.dom).typeahead("val",""),m.redraw()})})},_generateModalContent:function(){var t=this,e="N/A",n="N/A",i=h.datetime(new Date,{utc:!0,gps:!1}),r=ait.packets[this._packet]?ait.packets[this._packet].get(0):null;null!==r&&(e=r.__get__(this._selection),n=r.__get__(this._selection,!0));var a={},l=ait.tlm.dict[this._packet]._fields,u=ait.limits.dict[this._packet+"."+this._selection];if(this._selection in l){var c=l[this._selection];a.header=c.name,a.body=[];var d=c.desc?c.desc:"None";a.body.push(m("div",[m("b","Description: "),d,m("br")]));var f=c.type?c.type._name:"Unknown";a.body.push(m("div",[m("b","Data Type: "),f,m("br")]));var p="object"==o(c.bytes)?c.bytes[0]+" - "+c.bytes[1]:c.bytes;a.body.push(m("div",[m("b","Byte(s) in Packet: "),p,m("br")]));var g=c.mask?c.mask:"None";if(a.body.push(m("div",[m("b","Bit Mask: "),g,m("br")])),c.enum&&a.body.push(m("div",[m("b","Enumerated Values: "),(0,s.default)(c.enum,function(t,e){return m("div",[m("b"," "+e+": "),m("span",t),m("br")])})])),c.dntoeu&&a.body.push(m("div",[m("b","DN-to-EU: "),(0,s.default)(c.dntoeu,function(t,e){return m("div",[m("b"," "+e+": "),m("span",t),m("br")])})])),c.aliases&&a.body.push(m("div",[m("b","Aliases: "),(0,s.default)(c.aliases,function(t,e){return m("div",[m("b"," "+e+": "),m("span",t),m("br")])})])),u){var v=[];if(u.value)for(var y=["warn","error"],b=0;b2?e[2]:void 0;for(u&&o(e[0],e[1],u)&&(i=1);++nt?"before":"after")},start:function(t,e){t.dataTransfer.effectAllowed="move",this._from=e}},g={_active:0,_drag:null,_pos:[],_uid:[],anchor:function(t,e){var n=this,i={href:"#",class:"",draggable:this.isActive(e),ondragstart:function(t){return n._drag.start(t,e)},ondragend:function(t){return n._drag.end(t,e)}},r=t.attrs.title;return this.tabs&&Object.keys(this.tabs[r].___limit_error).length>0?i.class+=" tab_title--out-of-limit--error":this.tabs&&Object.keys(this.tabs[r].___limit_warning).length>0&&(i.class+=" tab_title--out-of-limit--warning"),(0,s.default)("a",i,t.attrs.title)},content:function(t,e){var n={key:this._uid[e]},i=this.isActive(e)?".tab-pane.active":".tab-pane";return(0,s.default)(i,n,t.children||t.text)},filterTabs:function(t){return t.filter(function(t){return"ait-tab"===t.tag})},isActive:function(t){return t===this._active},move:function(t,e){var n=this;if(t!==e){var i=this._pos.length,r=(0,f.default)(i,function(t){return t===n._active});u.move(this._pos,t,e),u.move(this._uid,t,e),u.move(r,t,e),this._active=r.findIndex(function(t){return t})}},oninit:function(t){var e=this.filterTabs(t.children);this._pos=(0,h.default)(e.length),this._uid=(0,h.default)(e.length),this._drag=Object.create(p)},filterFields:function(t){var e=[];if(!t)return e;var n=!0,i=!1,r=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;l.instance&&l.instance.tag&&"ait-field"===l.instance.tag?e.push(l.attrs.packet+"_"+l.attrs.name):l.children&&"object"===o(l.children)&&l.children.length>0&&(e=e.concat(this.filterFields(l.children)))}}catch(t){i=!0,r=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw r}}return e},oncreate:function(t){var e=this;this.tabs={};var n=!0,i=!1,r=void 0;try{for(var o,a=this.filterTabs(t.children)[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var s=o.value,l=s.attrs.title;this.tabs[l]={___limit_warning:{},___limit_error:{}};var u=!0,c=!1,h=void 0;try{for(var d,f=this.filterFields(s.children)[Symbol.iterator]();!(u=(d=f.next()).done);u=!0){var p=d.value;this.tabs[l][p]=null}}catch(t){c=!0,h=t}finally{try{!u&&f.return&&f.return()}finally{if(c)throw h}}}}catch(t){i=!0,r=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw r}}ait.events.on("field:limitOut",function(t){var n=t.field,i="___limit_"+t.type,r="___limit_"+("warning"===t.type?"error":"warning");for(var o in e.tabs)n in e.tabs[o]&&(e.tabs[o][i][n]=null,delete e.tabs[o][r][n])}),ait.events.on("field:limitIn",function(t){for(var n in e.tabs)t in e.tabs[n]&&(delete e.tabs[n].___limit_warning[t],delete e.tabs[n].___limit_error[t])})},reorder:function(t){return this._pos.map(function(e){return t[e]})},tab:function(t,e){var n=this,i=g.move.bind(this),r={class:this.tabClass(e),key:this._uid[e],onclick:function(){return n._active=e,!1},ondragover:function(t){return n._drag.over(t,e)},ondrop:function(t){return n._drag.drop(t,e,i)}};return(0,s.default)("li",r,this.anchor(t,e))},tabClass:function(t){var e="";return this.isActive(t)?e="active":this._drag.isOver(t)&&(e=this._drag.overClass(t)),e},view:function(t){var e=this.reorder(this.filterTabs(t.children));return(0,s.default)("ait-tabset",[(0,s.default)("ul.nav",t.attrs,e.map(g.tab.bind(this))),(0,s.default)(".tab-content",e.map(g.content.bind(this)))])}};e.default=g,e.TabSet=g},function(t,e){"use strict";function n(t,e,n){t.splice(n,0,t.splice(e,1)[0])}Object.defineProperty(e,"__esModule",{value:!0});var i=Object.assign;e.merge=i,e.move=n},function(t,e,n){var i=n(227),r=i();t.exports=r},function(t,e,n){function i(t){return function(e,n,i){return i&&"number"!=typeof i&&o(e,n,i)&&(n=i=void 0),e=a(e),void 0===n?(n=e,e=0):n=a(n),i=void 0===i?es)return[];var n=l,i=u(t,l);e=o(e),t-=l;for(var c=r(i,e);++n>=1}return a(t,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=null;return this.type&&(n=this.type.decode(t,this.offset),void 0!==this.mask&&null!==this.mask&&(n&=this.mask),this.shift>0&&(n>>=this.shift),e||void 0===this.enum||(n=this.enum[n])),n}}]),t}(),c=function(){function t(){r(this,t)}return a(t,[{key:"__get__",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=void 0;if(this._data instanceof DataView){var i=this._defn.fields[t];i&&(e||this._raw||!i.dntoeu?n=i.decode(this._data,e):i.dntoeu&&i.dntoeu.equation&&(n=this._defn.scope.eval(this,i.dntoeu.equation)))}return n}},{key:"__clone__",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.create(this._defn,e,n)}}],[{key:"create",value:function(e,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.name,o=this[r];return void 0===o&&(o=t.createSubclass(e),this[r]=o),new o(n,i)}},{key:"createSubclass",value:function(e){var n=function(t,n){this._defn=e,this._data=t,this._raw=n};n.prototype=Object.create(t.prototype),n.prototype.constructor=n;var i=function(t){Object.defineProperty(n.prototype,t,{get:function(){return this.__get__(t)}})};for(var r in e.fields)i(r);return n}}]),t}(),h=function(){function t(e){r(this,t),this._constants=e.constants,this._desc=e.desc,this._fields={},this._functions=e.functions,this._history=e.history,this._name=e.name,this._scope=new d(this),this._uid=e.uid;for(var n in e.fields)this._fields[n]=new u(e.fields[n])}return a(t,[{key:"constants",get:function(){return this._constants}},{key:"fields",get:function(){return this._fields}},{key:"functions",get:function(){return this._functions}},{key:"name",get:function(){return this._name}},{key:"scope",get:function(){return this._scope}},{key:"uid",get:function(){return this._uid}}],[{key:"parse",value:function(e){return"string"==typeof e&&(e=JSON.parse(e)),new t(e)}}]),t}(),d=function(){function t(e){r(this,t),this._defn=e,this._scope=new Function("\n eval('"+this.toCode()+"')\n return {\n 'eval': function(packet, expr) {\n var raw = packet.__clone__(packet._data, true)\n try {\n return eval(expr)\n } catch (e) {\n return null\n }\n }\n }\n ").call()}return a(t,[{key:"_sanitize",value:function(t){return t.replace("≤","<=").replace("≥",">=")}},{key:"_toBinaryCond",value:function(t){var e=/==|!=|<=|>=|<|>/g,n=t.match(e),i=t.split(e);return 2===n.length&&3===i.length?"("+i[0]+" "+n[0]+" "+i[1]+") && ("+i[1]+" "+n[1]+" "+i[2]+")":t}},{key:"eval",value:function(t,e){return this._scope.eval(t,e)}},{key:"toCode",value:function(){var t="";for(var e in this._defn.constants)t+="var "+e+" = "+this._defn.constants[e]+"; ";for(var n in this._defn.functions){var i=this._defn.functions[n];if(t+="function "+n+" { ","string"==typeof i)t+="return ("+i+") ";else if("object"===("undefined"==typeof i?"undefined":o(i)))for(var r in i){var a=this._toBinaryCond(this._sanitize(r));t+="if ("+a+") { return ("+i[r]+") } "}t+="};"}return t}}]),t}(),f=function(){function t(){r(this,t)}return a(t,[{key:"add",value:function(t){t instanceof h&&(this[t.name]=t)}}],[{key:"parse",value:function(e){var n=new t;"string"==typeof e&&(e=JSON.parse(e));for(var i in e)n.add(new h(e[i]));return n}}]),t}(),p=function(){function t(e,n){var i=this;r(this,t),this._dict={},this._interval=0,this._socket=new WebSocket(e),this._stale=0,this._url=e;for(var o in n){var a=n[o];this._dict[a.uid]=a}this._socket.binaryType="arraybuffer",this._socket.onclose=function(t){return i.onClose(t)},this._socket.onmessage=function(t){return i.onMessage(t)},this._socket.onopen=function(t){return i.onOpen(t)}}return a(t,[{key:"_emit",value:function(t,e){ait.events.emit("ait:tlm:"+t,e)}},{key:"onClose",value:function(t){clearInterval(this._interval),this._emit("close",this)}},{key:"onMessage",value:function(t){if(t.data instanceof ArrayBuffer){var e=new DataView(t.data,1,4).getUint32(0),n=new DataView(t.data,5),i=this._dict[e];if((0!=e||0!=n.byteLength)&&i){var r=c.create(i,n);clearInterval(this._interval),this._stale=0,this._interval=setInterval(this.onStale.bind(this),5e3),ait.packets.insert(i.name,r),this._emit("packet",r)}}}},{key:"onOpen",value:function(t){this._interval=setInterval(this.onStale.bind(this),5e3),this._stale=0,this._emit("open",this)}},{key:"onStale",value:function(){this._stale++,this._emit("stale",this)}}]),t}();e.FieldDefinition=u,e.Packet=c,e.PacketDefinition=h,e.PacketScope=d,e.TelemetryDictionary=f,e.TelemetryStream=p},function(t,e){"use strict";function n(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){return n+e<=t.byteLength}function a(t){var e=void 0;return t in y?e=y[t]:t.startsWith("ArrayType")&&(e=new h(t)),e}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:0;if(!o(t,2,e))return null;var n=ait.cmd.dict,i=t.getUint16(e,!1);return n?n.getByOpcode(i):i}},{key:"isTime",get:function(){return!1}}]),t}(),c=function(){function t(e){r(this,t),this._name=e}return s(t,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!o(t,2,e))return null;var n=ait.evr.dict,i=t.getUint16(e,!1);return n?n.getByCode(i):i}},{key:"isTime",get:function(){return!1}}]),t}(),h=function(){function t(e){r(this,t),this._elem_type=e.slice(11,e.indexOf("[")),this._prim_type=y[this._elem_type],this._num_elems=parseInt(e.slice(e.indexOf("[")+1,e.indexOf("]"))),this._name=e.slice(11,e.length-2),this._nbytes=this._num_elems*this._prim_type._nbytes}return s(t,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!o(t,this._nbytes,e))return null;for(var n=[],i=0;i1&&void 0!==arguments[1]?arguments[1]:0;return this._decode&&o(t,this._nbytes,e)?this._decode(t,e):null}},{key:"isTime",get:function(){return!1}}]),t}(),f=function(){function t(e){r(this,t),this._name=e}return s(t,[{key:"isTime",get:function(){return!0}}]),t}(),p=function(t){function e(){return r(this,e),n(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),s(e,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return o(t,1,e)?t.getUint8(e,!1)/256:null}}]),e}(f),g=function(t){function e(){return r(this,e),n(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),s(e,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!o(t,4,e))return null;var n=t.getUint32(e,!1);return new Date(l+1e3*n)}}]),e}(f),v=function(t){function e(){return r(this,e),n(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),s(e,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!o(t,8,e))return null;var n=t.getUint32(e,!1),i=t.getUint32(e+4,!1);return new Date(l+1e3*n+i/1e6)}}]),e}(f),m={I8:function(t,e){return t.getUint8(e)},U8:function(t,e){return t.getUint8(e)},LSB_I16:function(t,e){return t.getInt16(e,!0)},MSB_I16:function(t,e){return t.getInt16(e,!1)},LSB_U16:function(t,e){return t.getUint16(e,!0)},MSB_U16:function(t,e){return t.getUint16(e,!1)},LSB_I32:function(t,e){return t.getInt32(e,!0)},MSB_I32:function(t,e){return t.getInt32(e,!1)},LSB_U32:function(t,e){return t.getUint32(e,!0)},MSB_U32:function(t,e){return t.getUint32(e,!1)},LSB_F32:function(t,e){return t.getFloat32(e,!0)},MSB_F32:function(t,e){return t.getFloat32(e,!1)},LSB_D64:function(t,e){return t.getFloat64(e,!0)},MSB_D64:function(t,e){return t.getFloat64(e,!1)}},y={};Object.keys(m).map(function(t){y[t]=new d(t)}),y.CMD16=new u("CMD16"),y.EVR16=new c("EVR16"),y.TIME8=new p("TIME8"),y.TIME32=new g("TIME32"),y.TIME64=new v("TIME64"),e.get=a},function(t,e){},,,,,,,,,,,,,,,,,,,,,,,,,function(t,e,n){(function(t){/*! +"use strict";function i(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var r=n(164),o=i(r),a=function(t){this.container=t};a.prototype.draw=function(t,e){this.container.innerHTML="","undefined"!=typeof this.date_graph&&this.date_graph.destroy(),this.date_graph=new o.default(this.container,t,e)},a.prototype.setSelection=function(t){var e=!1;t.length&&(e=t[0].row),this.date_graph.setSelection(e)},a.prototype.getSelection=function(){var t=[],e=this.date_graph.getSelection();if(e<0)return t;for(var n=this.date_graph.layout_.points,i=0;i0;--e)t.removeChild(t.firstChild);return t}function n(t,n){return e(t).appendChild(n)}function i(t,e,n,i){var r=document.createElement(t);if(n&&(r.className=n),i&&(r.style.cssText=i),"string"==typeof e)r.appendChild(document.createTextNode(e));else if(e)for(var o=0;o=e)return a+(e-o);a+=s-o,a+=n-a%n,o=s+1}}function d(t,e){for(var n=0;n=e)return i+Math.min(a,e-r);if(r+=o-i,r+=n-r%n,i=o+1,r>=e)return i}}function p(t){for(;Za.length<=t;)Za.push(g(Za)+" ");return Za[t]}function g(t){return t[t.length-1]}function v(t,e){for(var n=[],i=0;i"€"&&(t.toUpperCase()!=t.toLowerCase()||Ka.test(t))}function x(t,e){return e?!!(e.source.indexOf("\\w")>-1&&_(t))||e.test(t):_(t)}function w(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}function S(t){return t.charCodeAt(0)>=768&&Qa.test(t)}function C(t,e,n){for(;(n<0?e>0:en?-1:1;;){if(e==n)return e;var r=(e+n)/2,o=i<0?Math.ceil(r):Math.floor(r);if(o==e)return t(o)?e:n;t(o)?n=o:e=o+i}}function k(t,e,n){var o=this;this.input=n,o.scrollbarFiller=i("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=i("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=r("div",null,"CodeMirror-code"),o.selectionDiv=i("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=i("div",null,"CodeMirror-cursors"),o.measure=i("div",null,"CodeMirror-measure"),o.lineMeasure=i("div",null,"CodeMirror-measure"),o.lineSpace=r("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var a=r("div",[o.lineSpace],"CodeMirror-lines");o.mover=i("div",[a],null,"position: relative"),o.sizer=i("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=i("div",null,null,"position: absolute; height: "+qa+"px; width: 1px;"),o.gutters=i("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=i("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=i("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),xa&&wa<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),Sa||ma&&Ma||(o.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(o.wrapper):t(o.wrapper)),o.viewFrom=o.viewTo=e.first,o.reportedViewFrom=o.reportedViewTo=e.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,n.init(o)}function A(t,e){if(e-=t.first,e<0||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");for(var n=t;!n.lines;)for(var i=0;;++i){var r=n.children[i],o=r.chunkSize();if(e=t.first&&en?I(n,A(t,n).text.length):$(e,A(t,e.line).text.length)}function $(t,e){var n=t.ch;return null==n||n>e?I(t.line,e):n<0?I(t.line,0):t}function Y(t,e){for(var n=[],i=0;i=e:o.to>e);(i||(i=[])).push(new U(a,o.from,l?null:o.to))}}return i}function Q(t,e,n){var i;if(t)for(var r=0;r=e:o.to>e);if(s||o.from==e&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=e:o.from0&&s)for(var x=0;x0)){var c=[l,1],h=F(u.from,s.from),f=F(u.to,s.to);(h<0||!a.inclusiveLeft&&!h)&&c.push({from:u.from,to:s.from}),(f>0||!a.inclusiveRight&&!f)&&c.push({from:s.to,to:u.to}),r.splice.apply(r,c),l+=c.length-3}}return r}function nt(t){var e=t.markedSpans;if(e){for(var n=0;ne)&&(!n||at(n,o.marker)<0)&&(n=o.marker)}return n}function ht(t,e,n,i,r){var o=A(t,e),a=ts&&o.markedSpans;if(a)for(var s=0;s=0&&h<=0||c<=0&&h>=0)&&(c<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?F(u.to,n)>=0:F(u.to,n)>0)||c>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?F(u.from,i)<=0:F(u.from,i)<0)))return!0}}}function dt(t){for(var e;e=lt(t);)t=e.find(-1,!0).line;return t}function ft(t){for(var e;e=ut(t);)t=e.find(1,!0).line;return t}function pt(t){for(var e,n;e=ut(t);)t=e.find(1,!0).line,(n||(n=[])).push(t);return n}function gt(t,e){var n=A(t,e),i=dt(n);return n==i?e:E(i)}function vt(t,e){if(e>t.lastLine())return e;var n,i=A(t,e);if(!mt(t,i))return e;for(;n=ut(i);)i=n.find(1,!0).line;return E(i)+1}function mt(t,e){var n=ts&&e.markedSpans;if(n)for(var i=void 0,r=0;re.maxLineLength&&(e.maxLineLength=n,e.maxLine=t)})}function wt(t,e,n,i){if(!t)return i(e,n,"ltr",0);for(var r=!1,o=0;oe||e==n&&a.to==e)&&(i(Math.max(a.from,e),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),r=!0)}r||i(e,n,"ltr")}function St(t,e,n){var i;es=null;for(var r=0;re)return r;o.to==e&&(o.from!=o.to&&"before"==n?i=r:es=r),o.from==e&&(o.from!=o.to&&"before"!=n?i=r:es=r)}return null!=i?i:es}function Ct(t,e){var n=t.order;return null==n&&(n=t.order=ns(t.text,e)),n}function Tt(t,e){return t._handlers&&t._handlers[e]||is}function kt(t,e,n){if(t.removeEventListener)t.removeEventListener(e,n,!1);else if(t.detachEvent)t.detachEvent("on"+e,n);else{var i=t._handlers,r=i&&i[e];if(r){var o=d(r,n);o>-1&&(i[e]=r.slice(0,o).concat(r.slice(o+1)))}}}function At(t,e){var n=Tt(t,e);if(n.length)for(var i=Array.prototype.slice.call(arguments,2),r=0;r0}function Et(t){t.prototype.on=function(t,e){rs(this,t,e)},t.prototype.off=function(t,e){kt(this,t,e)}}function Mt(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function Nt(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function Pt(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function It(t){Mt(t),Nt(t)}function Ft(t){return t.target||t.srcElement}function Rt(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),Na&&t.ctrlKey&&1==e&&(e=3),e}function Ht(t){if(null==$a){var e=i("span","​");n(t,i("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&($a=e.offsetWidth<=1&&e.offsetHeight>2&&!(xa&&wa<8))}var r=$a?i("span","​"):i("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function jt(t){if(null!=Ya)return Ya;var i=n(t,document.createTextNode("AخA")),r=Ra(i,0,1).getBoundingClientRect(),o=Ra(i,1,2).getBoundingClientRect();return e(t),!(!r||r.left==r.right)&&(Ya=o.right-r.right<3)}function Wt(t){if(null!=us)return us;var e=n(t,i("span","x")),r=e.getBoundingClientRect(),o=Ra(e,0,1).getBoundingClientRect();return us=Math.abs(r.left-o.left)>1}function zt(t,e){arguments.length>2&&(e.dependencies=Array.prototype.slice.call(arguments,2)),cs[t]=e}function Bt(t,e){hs[t]=e}function $t(t){if("string"==typeof t&&hs.hasOwnProperty(t))t=hs[t];else if(t&&"string"==typeof t.name&&hs.hasOwnProperty(t.name)){var e=hs[t.name];"string"==typeof e&&(e={name:e}),t=b(e,t),t.name=e.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return $t("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return $t("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function Yt(t,e){e=$t(e);var n=cs[e.name];if(!n)return Yt(t,"text/plain");var i=n(t,e);if(ds.hasOwnProperty(e.name)){var r=ds[e.name];for(var o in r)r.hasOwnProperty(o)&&(i.hasOwnProperty(o)&&(i["_"+o]=i[o]),i[o]=r[o])}if(i.name=e.name,e.helperType&&(i.helperType=e.helperType),e.modeProps)for(var a in e.modeProps)i[a]=e.modeProps[a];return i}function qt(t,e){var n=ds.hasOwnProperty(t)?ds[t]:ds[t]={};c(e,n)}function Vt(t,e){if(e===!0)return e;if(t.copyState)return t.copyState(e);var n={};for(var i in e){var r=e[i];r instanceof Array&&(r=r.concat([])),n[i]=r}return n}function Ut(t,e){for(var n;t.innerMode&&(n=t.innerMode(e),n&&n.mode!=t);)e=n.state,t=n.mode;return n||{mode:t,state:e}}function Xt(t,e,n){return!t.startState||t.startState(e,n)}function Gt(t,e,n,i){var r=[t.state.modeGen],o={};ie(t,e.text,t.doc.mode,n,function(t,e){return r.push(t,e)},o,i);for(var a=n.state,s=function(i){n.baseTokens=r;var s=t.state.overlays[i],l=1,u=0;n.state=!0,ie(t,e.text,s.mode,n,function(t,e){for(var n=l;ut&&r.splice(l,1,t,r[l+1],i),l+=2,u=Math.min(t,i)}if(e)if(s.opaque)r.splice(n,l-n,t,"overlay "+e),l=n+2;else for(;nt.options.maxHighlightLength&&Vt(t.doc.mode,i.state),o=Gt(t,e,i);r&&(i.state=r),e.stateAfter=i.save(!r),e.styles=o.styles,o.classes?e.styleClasses=o.classes:e.styleClasses&&(e.styleClasses=null),n===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return e.styles}function Kt(t,e,n){var i=t.doc,r=t.display;if(!i.mode.startState)return new gs(i,!0,e);var o=re(t,e,n),a=o>i.first&&A(i,o-1).stateAfter,s=a?gs.fromSaved(i,a,o):new gs(i,Xt(i.mode),o);return i.iter(o,e,function(n){Qt(t,n.text,s);var i=s.line;n.stateAfter=i==e-1||i%5==0||i>=r.viewFrom&&ie.start)return o}throw new Error("Mode "+t.name+" failed to advance stream.")}function ee(t,e,n,i){var r,o=t.doc,a=o.mode;e=B(o,e);var s,l=A(o,e.line),u=Kt(t,e.line,n),c=new fs(l.text,t.options.tabSize,u);for(i&&(s=[]);(i||c.post.options.maxHighlightLength?(s=!1,a&&Qt(t,e,i,h.pos),h.pos=e.length,l=null):l=ne(te(n,h,i.state,d),o),d){var f=d[0].name;f&&(l="m-"+(l?f+" "+l:f))}if(!s||c!=l){for(;ua;--s){if(s<=o.first)return o.first;var l=A(o,s-1),u=l.stateAfter;if(u&&(!n||s+(u instanceof ps?u.lookAhead:0)<=o.modeFrontier))return s;var c=h(l.text,null,t.options.tabSize);(null==r||i>c)&&(r=s-1,i=c)}return r}function oe(t,e){if(t.modeFrontier=Math.min(t.modeFrontier,e),!(t.highlightFrontiern;i--){var r=A(t,i).stateAfter;if(r&&(!(r instanceof ps)||i+r.lookAhead1&&!/ /.test(t))return t;for(var n=e,i="",r=0;ru&&h.from<=u));d++);if(h.to>=c)return t(n,i,r,o,a,s,l);t(n,i.slice(0,h.to-u),r,o,null,s,l),o=null,i=i.slice(h.to-u),u=h.to}}}function pe(t,e,n,i){var r=!i&&n.widgetNode;r&&t.map.push(t.pos,t.pos+e,r),!i&&t.cm.display.input.needsContentAttribute&&(r||(r=t.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",n.id)),r&&(t.cm.display.input.setUneditable(r),t.content.appendChild(r)),t.pos+=e,t.trailingSpace=!1}function ge(t,e,n){var i=t.markedSpans,r=t.text,o=0;if(i)for(var a,s,l,u,c,h,d,f=r.length,p=0,g=1,v="",m=0;;){if(m==p){ +l=u=c=h=s="",d=null,m=1/0;for(var y=[],b=void 0,_=0;_p||w.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&m>x.to&&(m=x.to,u=""),w.className&&(l+=" "+w.className),w.css&&(s=(s?s+";":"")+w.css),w.startStyle&&x.from==p&&(c+=" "+w.startStyle),w.endStyle&&x.to==m&&(b||(b=[])).push(w.endStyle,x.to),w.title&&!h&&(h=w.title),w.collapsed&&(!d||at(d.marker,w)<0)&&(d=x)):x.from>p&&m>x.from&&(m=x.from)}if(b)for(var S=0;S=f)break;for(var T=Math.min(f,m);;){if(v){var k=p+v.length;if(!d){var A=k>T?v.slice(0,T-p):v;e.addToken(e,A,a?a+l:l,c,p+A.length==m?u:"",h,s)}if(k>=T){v=v.slice(T-p),p=T;break}p=k,c=""}v=r.slice(o,o=n[g++]),a=le(n[g++],e.cm.options)}}else for(var D=1;D2&&o.push((l.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Ye(t,e,n){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};for(var i=0;in)return{map:t.measure.maps[r],cache:t.measure.caches[r],before:!0}}function qe(t,e){e=dt(e);var i=E(e),r=t.display.externalMeasured=new ve(t.doc,e,i);r.lineN=i;var o=r.built=ue(t,r);return r.text=o.pre,n(t.display.lineMeasure,o.pre),r}function Ve(t,e,n,i){return Ge(t,Xe(t,e),n,i)}function Ue(t,e){if(e>=t.display.viewFrom&&e=n.lineN&&ee)&&(o=l-s,r=o-1,e>=l&&(a="right")),null!=r){if(i=t[u+2],s==l&&n==(i.insertLeft?"left":"right")&&(a=n),"left"==n&&0==r)for(;u&&t[u-2]==t[u-3]&&t[u-1].insertLeft;)i=t[(u-=3)+2],a="left";if("right"==n&&r==l-s)for(;u=0&&(n=t[r]).left==n.right;r--);return n}function Qe(t,e,n,i){var r,o=Ze(e.map,n,i),a=o.node,s=o.start,l=o.end,u=o.collapse;if(3==a.nodeType){for(var c=0;c<4;c++){for(;s&&S(e.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+l0&&(u=i="right");var h;r=t.options.lineWrapping&&(h=a.getClientRects()).length>1?h["right"==i?h.length-1:0]:a.getBoundingClientRect()}if(xa&&wa<9&&!s&&(!r||!r.left&&!r.right)){var d=a.parentNode.getClientRects()[0];r=d?{left:d.left,right:d.left+xn(t.display),top:d.top,bottom:d.bottom}:Ss}for(var f=r.top-e.rect.top,p=r.bottom-e.rect.top,g=(f+p)/2,v=e.view.measure.heights,m=0;m=i.text.length?(u=i.text.length,c="before"):u<=0&&(u=0,c="after"),!l)return a("before"==c?u-1:u,"before"==c);var h=St(l,u,c),d=es,f=s(u,h,"before"==c);return null!=d&&(f.other=s(u,d,"before"!=c)),f}function hn(t,e){var n=0;e=B(t.doc,e),t.options.lineWrapping||(n=xn(t.display)*e.ch);var i=A(t.doc,e.line),r=bt(i)+Re(t.display);return{left:n,right:n,top:r,bottom:r+i.height}}function dn(t,e,n,i,r){var o=I(t,e,n);return o.xRel=r,i&&(o.outside=!0),o}function fn(t,e,n){var i=t.doc;if(n+=t.display.viewOffset,n<0)return dn(i.first,0,null,!0,-1);var r=M(i,n),o=i.first+i.size-1;if(r>o)return dn(i.first+i.size-1,A(i,o).text.length,null,!0,1);e<0&&(e=0);for(var a=A(i,r);;){var s=mn(t,a,r,e,n),l=ct(a,s.ch+(s.xRel>0?1:0));if(!l)return s;var u=l.find(1);if(u.line==r)return u;a=A(i,r=u.line)}}function pn(t,e,n,i){i-=an(e);var r=e.text.length,o=T(function(e){return Ge(t,n,e-1).bottom<=i},r,0);return r=T(function(e){return Ge(t,n,e).top>i},o,r),{begin:o,end:r}}function gn(t,e,n,i){n||(n=Xe(t,e));var r=sn(t,e,Ge(t,n,i),"line").top;return pn(t,e,n,r)}function vn(t,e,n,i){return!(t.bottom<=n)&&(t.top>n||(i?t.left:t.right)>e)}function mn(t,e,n,i,r){r-=bt(e);var o=Xe(t,e),a=an(e),s=0,l=e.text.length,u=!0,c=Ct(e,t.doc.direction);if(c){var h=(t.options.lineWrapping?bn:yn)(t,e,n,o,c,i,r);u=1!=h.level,s=u?h.from:h.to-1,l=u?h.to:h.from-1}var d,f,p=null,g=null,v=T(function(e){var n=Ge(t,o,e);return n.top+=a,n.bottom+=a,!!vn(n,i,r,!1)&&(n.top<=r&&n.left<=i&&(p=e,g=n),!0)},s,l),m=!1;if(g){var y=i-g.left=_.bottom}return v=C(e.text,v,1),dn(n,v,f,m,i-d)}function yn(t,e,n,i,r,o,a){var s=T(function(s){var l=r[s],u=1!=l.level;return vn(cn(t,I(n,u?l.to:l.from,u?"before":"after"),"line",e,i),o,a,!0)},0,r.length-1),l=r[s];if(s>0){var u=1!=l.level,c=cn(t,I(n,u?l.from:l.to,u?"after":"before"),"line",e,i);vn(c,o,a,!0)&&c.top>a&&(l=r[s-1])}return l}function bn(t,e,n,i,r,o,a){var s=pn(t,e,i,a),l=s.begin,u=s.end;/\s/.test(e.text.charAt(u-1))&&u--;for(var c=null,h=null,d=0;d=u||f.to<=l)){var p=1!=f.level,g=Ge(t,i,p?Math.min(u,f.to)-1:Math.max(l,f.from)).right,v=gv)&&(c=f,h=v)}}return c||(c=r[r.length-1]),c.fromu&&(c={from:c.from,to:u,level:c.level}),c}function _n(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==ys){ys=i("pre");for(var r=0;r<49;++r)ys.appendChild(document.createTextNode("x")),ys.appendChild(i("br"));ys.appendChild(document.createTextNode("x"))}n(t.measure,ys);var o=ys.offsetHeight/50;return o>3&&(t.cachedTextHeight=o),e(t.measure),o||1}function xn(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=i("span","xxxxxxxxxx"),r=i("pre",[e]);n(t.measure,r);var o=e.getBoundingClientRect(),a=(o.right-o.left)/10;return a>2&&(t.cachedCharWidth=a),a||10}function wn(t){for(var e=t.display,n={},i={},r=e.gutters.clientLeft,o=e.gutters.firstChild,a=0;o;o=o.nextSibling,++a)n[t.options.gutters[a]]=o.offsetLeft+o.clientLeft+r,i[t.options.gutters[a]]=o.clientWidth;return{fixedPos:Sn(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:e.wrapper.clientWidth}}function Sn(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function Cn(t){var e=_n(t.display),n=t.options.lineWrapping,i=n&&Math.max(5,t.display.scroller.clientWidth/xn(t.display)-3);return function(r){if(mt(t.doc,r))return 0;var o=0;if(r.widgets)for(var a=0;a=t.display.viewTo)return null;if(e-=t.display.viewFrom,e<0)return null;for(var n=t.display.view,i=0;i=t.display.viewTo||s.to().line0?e.blinker=setInterval(function(){return e.cursorDiv.style.visibility=(n=!n)?"":"hidden"},t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function Pn(t){t.state.focused||(t.display.input.focus(),Fn(t))}function In(t){t.state.delayingBlurEvent=!0,setTimeout(function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,Rn(t))},100)}function Fn(t,e){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(At(t,"focus",t,e),t.state.focused=!0,s(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),Sa&&setTimeout(function(){return t.display.input.reset(!0)},20)),t.display.input.receivedFocus()),Nn(t))}function Rn(t,e){t.state.delayingBlurEvent||(t.state.focused&&(At(t,"blur",t,e),t.state.focused=!1,Wa(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout(function(){t.state.focused||(t.display.shift=!1)},150))}function Hn(t){for(var e=t.display,n=e.lineDiv.offsetTop,i=0;i.005||l<-.005)&&(L(r.line,o),jn(r.line),r.rest))for(var u=0;u=a&&(o=M(e,bt(A(e,l))-t.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function zn(t){var e=t.display,n=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var i=Sn(e)-e.scroller.scrollLeft+t.doc.scrollLeft,r=e.gutters.offsetWidth,o=i+"px",a=0;a(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),null!=o&&!Oa){var a=i("div","​",null,"position: absolute;\n top: "+(e.top-n.viewOffset-Re(t.display))+"px;\n height: "+(e.bottom-e.top+We(t)+n.barHeight)+"px;\n left: "+e.left+"px; width: "+Math.max(2,e.right-e.left)+"px;");t.display.lineSpace.appendChild(a),a.scrollIntoView(o),t.display.lineSpace.removeChild(a)}}}function Yn(t,e,n,i){null==i&&(i=0);var r;t.options.lineWrapping||e!=n||(e=e.ch?I(e.line,"before"==e.sticky?e.ch-1:e.ch,"after"):e,n="before"==e.sticky?I(e.line,e.ch+1,"before"):e);for(var o=0;o<5;o++){var a=!1,s=cn(t,e),l=n&&n!=e?cn(t,n):s;r={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-i,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+i};var u=Vn(t,r),c=t.doc.scrollTop,h=t.doc.scrollLeft;if(null!=u.scrollTop&&(Jn(t,u.scrollTop),Math.abs(t.doc.scrollTop-c)>1&&(a=!0)),null!=u.scrollLeft&&(ei(t,u.scrollLeft),Math.abs(t.doc.scrollLeft-h)>1&&(a=!0)),!a)break}return r}function qn(t,e){var n=Vn(t,e);null!=n.scrollTop&&Jn(t,n.scrollTop),null!=n.scrollLeft&&ei(t,n.scrollLeft)}function Vn(t,e){var n=t.display,i=_n(t.display);e.top<0&&(e.top=0);var r=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:n.scroller.scrollTop,o=Be(t),a={};e.bottom-e.top>o&&(e.bottom=e.top+o);var s=t.doc.height+He(n),l=e.tops-i;if(e.topr+o){var c=Math.min(e.top,(u?s:e.bottom)-o);c!=r&&(a.scrollTop=c)}var h=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:n.scroller.scrollLeft,d=ze(t)-(t.options.fixedGutter?n.gutters.offsetWidth:0),f=e.right-e.left>d;return f&&(e.right=e.left+d),e.left<10?a.scrollLeft=0:e.leftd+h-3&&(a.scrollLeft=e.right+(f?0:10)-d),a}function Un(t,e){null!=e&&(Kn(t),t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+e)}function Xn(t){Kn(t);var e=t.getCursor();t.curOp.scrollToPos={from:e,to:e,margin:t.options.cursorScrollMargin}}function Gn(t,e,n){null==e&&null==n||Kn(t),null!=e&&(t.curOp.scrollLeft=e),null!=n&&(t.curOp.scrollTop=n)}function Zn(t,e){Kn(t),t.curOp.scrollToPos=e}function Kn(t){var e=t.curOp.scrollToPos;if(e){t.curOp.scrollToPos=null;var n=hn(t,e.from),i=hn(t,e.to);Qn(t,n,i,e.margin)}}function Qn(t,e,n,i){var r=Vn(t,{left:Math.min(e.left,n.left),top:Math.min(e.top,n.top)-i,right:Math.max(e.right,n.right),bottom:Math.max(e.bottom,n.bottom)+i});Gn(t,r.scrollLeft,r.scrollTop)}function Jn(t,e){Math.abs(t.doc.scrollTop-e)<2||(ma||Ei(t,{top:e}),ti(t,e,!0),ma&&Ei(t),Ci(t,100))}function ti(t,e,n){e=Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,e),(t.display.scroller.scrollTop!=e||n)&&(t.doc.scrollTop=e,t.display.scrollbars.setScrollTop(e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e))}function ei(t,e,n,i){e=Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth),(n?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)&&!i||(t.doc.scrollLeft=e,zn(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbars.setScrollLeft(e))}function ni(t){var e=t.display,n=e.gutters.offsetWidth,i=Math.round(t.doc.height+He(t.display));return{clientHeight:e.scroller.clientHeight,viewHeight:e.wrapper.clientHeight,scrollWidth:e.scroller.scrollWidth,clientWidth:e.scroller.clientWidth,viewWidth:e.wrapper.clientWidth,barLeft:t.options.fixedGutter?n:0,docHeight:i,scrollHeight:i+We(t)+e.barHeight,nativeBarWidth:e.nativeBarWidth,gutterWidth:n}}function ii(t,e){e||(e=ni(t));var n=t.display.barWidth,i=t.display.barHeight;ri(t,e);for(var r=0;r<4&&n!=t.display.barWidth||i!=t.display.barHeight;r++)n!=t.display.barWidth&&t.options.lineWrapping&&Hn(t),ri(t,ni(t)),n=t.display.barWidth,i=t.display.barHeight}function ri(t,e){var n=t.display,i=n.scrollbars.update(e);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=e.gutterWidth+"px"):n.gutterFiller.style.display=""}function oi(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Wa(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new ks[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),rs(e,"mousedown",function(){t.state.focused&&setTimeout(function(){return t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,n){"horizontal"==n?ei(t,e):Jn(t,e)},t),t.display.scrollbars.addClass&&s(t.display.wrapper,t.display.scrollbars.addClass)}function ai(t){t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++As},ye(t.curOp)}function si(t){var e=t.curOp;_e(e,function(t){for(var e=0;e=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping,t.update=t.mustUpdate&&new Ds(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function ci(t){t.updatedDisplay=t.mustUpdate&&Oi(t.cm,t.update)}function hi(t){var e=t.cm,n=e.display;t.updatedDisplay&&Hn(e),t.barMeasure=ni(e),n.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=Ve(e,n.maxLine,n.maxLine.text.length).left+3,e.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+t.adjustWidthTo+We(e)+e.display.barWidth),t.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+t.adjustWidthTo-ze(e))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=n.input.prepareSelection())}function di(t){var e=t.cm;null!=t.adjustWidthTo&&(e.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLefte)&&(r.updateLineNumbers=e),t.curOp.viewChanged=!0,e>=r.viewTo)ts&>(t.doc,e)r.viewFrom?_i(t):(r.viewFrom+=i,r.viewTo+=i);else if(e<=r.viewFrom&&n>=r.viewTo)_i(t);else if(e<=r.viewFrom){var o=xi(t,n,n+i,1);o?(r.view=r.view.slice(o.index),r.viewFrom=o.lineN,r.viewTo+=i):_i(t)}else if(n>=r.viewTo){var a=xi(t,e,e,-1);a?(r.view=r.view.slice(0,a.index),r.viewTo=a.lineN):_i(t)}else{var s=xi(t,e,e,-1),l=xi(t,n,n+i,1);s&&l?(r.view=r.view.slice(0,s.index).concat(me(t,s.lineN,l.lineN)).concat(r.view.slice(l.index)), +r.viewTo+=i):_i(t)}var u=r.externalMeasured;u&&(n=r.lineN&&e=i.viewTo)){var o=i.view[An(t,e)];if(null!=o.node){var a=o.changes||(o.changes=[]);d(a,n)==-1&&a.push(n)}}}function _i(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function xi(t,e,n,i){var r,o=An(t,e),a=t.display.view;if(!ts||n==t.doc.first+t.doc.size)return{index:o,lineN:n};for(var s=t.display.viewFrom,l=0;l0){if(o==a.length-1)return null;r=s+a[o].size-e,o++}else r=s-e;e+=r,n+=r}for(;gt(t.doc,n)!=n;){if(o==(i<0?0:a.length-1))return null;n+=i*a[o-(i<0?1:0)].size,o+=i}return{index:o,lineN:n}}function wi(t,e,n){var i=t.display,r=i.view;0==r.length||e>=i.viewTo||n<=i.viewFrom?(i.view=me(t,e,n),i.viewFrom=e):(i.viewFrom>e?i.view=me(t,e,i.viewFrom).concat(i.view):i.viewFromn&&(i.view=i.view.slice(0,An(t,n)))),i.viewTo=n}function Si(t){for(var e=t.display.view,n=0,i=0;i=t.display.viewTo)){var n=+new Date+t.options.workTime,i=Kt(t,e.highlightFrontier),r=[];e.iter(i.line,Math.min(e.first+e.size,t.display.viewTo+500),function(o){if(i.line>=t.display.viewFrom){var a=o.styles,s=o.text.length>t.options.maxHighlightLength?Vt(e.mode,i.state):null,l=Gt(t,o,i,!0);s&&(i.state=s),o.styles=l.styles;var u=o.styleClasses,c=l.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var h=!a||a.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),d=0;!h&&dn)return Ci(t,t.options.workDelay),!0}),e.highlightFrontier=i.line,e.modeFrontier=Math.max(e.modeFrontier,i.line),r.length&&pi(t,function(){for(var e=0;e=i.viewFrom&&n.visible.to<=i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&0==Si(t))return!1;Bn(t)&&(_i(t),n.dims=wn(t));var o=r.first+r.size,a=Math.max(n.visible.from-t.options.viewportMargin,r.first),s=Math.min(o,n.visible.to+t.options.viewportMargin);i.viewFroms&&i.viewTo-s<20&&(s=Math.min(o,i.viewTo)),ts&&(a=gt(t.doc,a),s=vt(t.doc,s));var l=a!=i.viewFrom||s!=i.viewTo||i.lastWrapHeight!=n.wrapperHeight||i.lastWrapWidth!=n.wrapperWidth;wi(t,a,s),i.viewOffset=bt(A(t.doc,i.viewFrom)),t.display.mover.style.top=i.viewOffset+"px";var u=Si(t);if(!l&&0==u&&!n.force&&i.renderedView==i.view&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo))return!1;var c=Ai(t);return u>4&&(i.lineDiv.style.display="none"),Mi(t,i.updateLineNumbers,n.dims),u>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,Di(c),e(i.cursorDiv),e(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,l&&(i.lastWrapHeight=n.wrapperHeight,i.lastWrapWidth=n.wrapperWidth,Ci(t,400)),i.updateLineNumbers=null,!0}function Li(t,e){for(var n=e.viewport,i=!0;(i&&t.options.lineWrapping&&e.oldDisplayWidth!=ze(t)||(n&&null!=n.top&&(n={top:Math.min(t.doc.height+He(t.display)-Be(t),n.top)}),e.visible=Wn(t.display,t.doc,n),!(e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)))&&Oi(t,e);i=!1){Hn(t);var r=ni(t);Dn(t),ii(t,r),Pi(t,r),e.force=!1}e.signal(t,"update",t),t.display.viewFrom==t.display.reportedViewFrom&&t.display.viewTo==t.display.reportedViewTo||(e.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function Ei(t,e){var n=new Ds(t,e);if(Oi(t,n)){Hn(t),Li(t,n);var i=ni(t);Dn(t),ii(t,i),Pi(t,i),n.finish()}}function Mi(t,n,i){function r(e){var n=e.nextSibling;return Sa&&Na&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),n}for(var o=t.display,a=t.options.lineNumbers,s=o.lineDiv,l=s.firstChild,u=o.view,c=o.viewFrom,h=0;h-1&&(p=!1),Se(t,f,c,i)),p&&(e(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(P(t.options,c)))),l=f.node.nextSibling}else{var g=Ee(t,f,c,i);s.insertBefore(g,l)}c+=f.size}for(;l;)l=r(l)}function Ni(t){var e=t.display.gutters.offsetWidth;t.display.sizer.style.marginLeft=e+"px"}function Pi(t,e){t.display.sizer.style.minHeight=e.docHeight+"px",t.display.heightForcer.style.top=e.docHeight+"px",t.display.gutters.style.height=e.docHeight+t.display.barHeight+We(t)+"px"}function Ii(t){var n=t.display.gutters,r=t.options.gutters;e(n);for(var o=0;o-1&&!t.lineNumbers&&(t.gutters=t.gutters.slice(0),t.gutters.splice(e,1))}function Ri(t){var e=t.wheelDeltaX,n=t.wheelDeltaY;return null==e&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(e=t.detail),null==n&&t.detail&&t.axis==t.VERTICAL_AXIS?n=t.detail:null==n&&(n=t.wheelDelta),{x:e,y:n}}function Hi(t){var e=Ri(t);return e.x*=Ls,e.y*=Ls,e}function ji(t,e){var n=Ri(e),i=n.x,r=n.y,o=t.display,a=o.scroller,s=a.scrollWidth>a.clientWidth,l=a.scrollHeight>a.clientHeight;if(i&&s||r&&l){if(r&&Na&&Sa)t:for(var u=e.target,c=o.view;u!=a;u=u.parentNode)for(var h=0;h=0){var a=W(o.from(),r.from()),s=j(o.to(),r.to()),l=o.empty()?r.from()==r.head:o.from()==o.head;i<=e&&--e,t.splice(--i,2,new Ms(l?s:a,l?a:s))}}return new Es(t,e)}function zi(t,e){return new Es([new Ms(t,e||t)],0)}function Bi(t){return t.text?I(t.from.line+t.text.length-1,g(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function $i(t,e){if(F(t,e.from)<0)return t;if(F(t,e.to)<=0)return Bi(e);var n=t.line+e.text.length-(e.to.line-e.from.line)-1,i=t.ch;return t.line==e.to.line&&(i+=Bi(e).ch-e.to.ch),I(n,i)}function Yi(t,e){for(var n=[],i=0;i1&&t.remove(s.line+1,p-1),t.insert(s.line+1,y)}xe(t,"change",t,e)}function Ki(t,e,n){function i(t,r,o){if(t.linked)for(var a=0;a1&&!t.done[t.done.length-2].ranges?(t.done.pop(),g(t.done)):void 0}function or(t,e,n,i){var r=t.history;r.undone.length=0;var o,a,s=+new Date;if((r.lastOp==i||r.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&r.lastModTime>s-(t.cm?t.cm.options.historyEventDelay:500)||"*"==e.origin.charAt(0)))&&(o=rr(r,r.lastOp==i)))a=g(o.changes),0==F(e.from,e.to)&&0==F(e.from,a.to)?a.to=Bi(e):o.changes.push(nr(t,e));else{var l=g(r.done);for(l&&l.ranges||lr(t.sel,r.done),o={changes:[nr(t,e)],generation:r.generation},r.done.push(o);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(n),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=s,r.lastOp=r.lastSelOp=i,r.lastOrigin=r.lastSelOrigin=e.origin,a||At(t,"historyAdded")}function ar(t,e,n,i){var r=e.charAt(0);return"*"==r||"+"==r&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}function sr(t,e,n,i){var r=t.history,o=i&&i.origin;n==r.lastSelOp||o&&r.lastSelOrigin==o&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==o||ar(t,o,g(r.done),e))?r.done[r.done.length-1]=e:lr(e,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=o,r.lastSelOp=n,i&&i.clearRedo!==!1&&ir(r.undone)}function lr(t,e){var n=g(e);n&&n.ranges&&n.equals(t)||e.push(t)}function ur(t,e,n,i){var r=e["spans_"+t.id],o=0;t.iter(Math.max(t.first,n),Math.min(t.first+t.size,i),function(n){n.markedSpans&&((r||(r=e["spans_"+t.id]={}))[o]=n.markedSpans),++o})}function cr(t){if(!t)return null;for(var e,n=0;n-1&&(g(s)[h]=u[h],delete u[h])}}}return i}function pr(t,e,n,i){if(i){var r=t.anchor;if(n){var o=F(e,r)<0;o!=F(n,r)<0?(r=e,e=n):o!=F(e,n)<0&&(e=n)}return new Ms(r,e)}return new Ms(n||e,e)}function gr(t,e,n,i,r){null==r&&(r=t.cm&&(t.cm.display.shift||t.extend)),xr(t,new Es([pr(t.sel.primary(),e,n,r)],0),i)}function vr(t,e,n){for(var i=[],r=t.cm&&(t.cm.display.shift||t.extend),o=0;o=e.ch:s.to>e.ch))){if(r&&(At(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!l.atomic)continue;if(n){var u=l.find(i<0?1:-1),c=void 0;if((i<0?l.inclusiveRight:l.inclusiveLeft)&&(u=Dr(t,u,-i,u&&u.line==e.line?o:null)),u&&u.line==e.line&&(c=F(u,n))&&(i<0?c<0:c>0))return kr(t,u,e,i,r)}var h=l.find(i<0?-1:1);return(i<0?l.inclusiveLeft:l.inclusiveRight)&&(h=Dr(t,h,i,h.line==e.line?o:null)),h?kr(t,h,e,i,r):null}}return e}function Ar(t,e,n,i,r){var o=i||1,a=kr(t,e,n,o,r)||!r&&kr(t,e,n,o,!0)||kr(t,e,n,-o,r)||!r&&kr(t,e,n,-o,!0);return a?a:(t.cantEdit=!0,I(t.first,0))}function Dr(t,e,n,i){return n<0&&0==e.ch?e.line>t.first?B(t,I(e.line-1)):null:n>0&&e.ch==(i||A(t,e.line)).text.length?e.line=0;--r)Mr(t,{from:i[r].from,to:i[r].to,text:r?[""]:e.text,origin:e.origin});else Mr(t,e)}}function Mr(t,e){if(1!=e.text.length||""!=e.text[0]||0!=F(e.from,e.to)){var n=Yi(t,e);or(t,e,n,t.cm?t.cm.curOp.id:NaN),Ir(t,e,n,J(t,e));var i=[];Ki(t,function(t,n){n||d(i,t.history)!=-1||(Wr(t.history,e),i.push(t.history)),Ir(t,e,null,J(t,e))})}}function Nr(t,e,n){var i=t.cm&&t.cm.state.suppressEdits;if(!i||n){for(var r,o=t.history,a=t.sel,s="undo"==e?o.done:o.undone,l="undo"==e?o.undone:o.done,u=0;u=0;--p){var v=f(p);if(v)return v.v}}}}function Pr(t,e){if(0!=e&&(t.first+=e,t.sel=new Es(v(t.sel.ranges,function(t){return new Ms(I(t.anchor.line+e,t.anchor.ch),I(t.head.line+e,t.head.ch))}),t.sel.primIndex),t.cm)){yi(t.cm,t.first,t.first-e,e);for(var n=t.cm.display,i=n.viewFrom;it.lastLine())){if(e.from.lineo&&(e={from:e.from,to:I(o,A(t,o).text.length),text:[e.text[0]],origin:e.origin}),e.removed=D(t,e.from,e.to),n||(n=Yi(t,e)),t.cm?Fr(t.cm,e,i):Zi(t,e,i),wr(t,n,Ua)}}function Fr(t,e,n){var i=t.doc,r=t.display,o=e.from,a=e.to,s=!1,l=o.line;t.options.lineWrapping||(l=E(dt(A(i,o.line))),i.iter(l,a.line+1,function(t){if(t==r.maxLine)return s=!0,!0})),i.sel.contains(e.from,e.to)>-1&&Ot(t),Zi(i,e,n,Cn(t)),t.options.lineWrapping||(i.iter(l,o.line+e.text.length,function(t){var e=_t(t);e>r.maxLineLength&&(r.maxLine=t,r.maxLineLength=e,r.maxLineChanged=!0,s=!1)}),s&&(t.curOp.updateMaxLine=!0)),oe(i,o.line),Ci(t,400);var u=e.text.length-(a.line-o.line)-1;e.full?yi(t):o.line!=a.line||1!=e.text.length||Gi(t.doc,e)?yi(t,o.line,a.line+1,u):bi(t,o.line,"text");var c=Lt(t,"changes"),h=Lt(t,"change");if(h||c){var d={from:o,to:a,text:e.text,removed:e.removed,origin:e.origin};h&&xe(t,"change",t,d),c&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(d)}t.display.selForContextMenu=null}function Rr(t,e,n,i,r){if(i||(i=n),F(i,n)<0){var o;o=[i,n],n=o[0],i=o[1]}"string"==typeof e&&(e=t.splitLines(e)),Er(t,{from:n,to:i,text:e,origin:r})}function Hr(t,e,n,i){n0||0==s&&a.clearWhenEmpty!==!1)return a;if(a.replacedWith&&(a.collapsed=!0,a.widgetNode=r("span",[a.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||a.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(a.widgetNode.insertLeft=!0)),a.collapsed){if(ht(t,e.line,e,n,a)||e.line!=n.line&&ht(t,n.line,e,n,a))throw new Error("Inserting collapsed marker partially overlapping an existing one");V()}a.addToHistory&&or(t,{from:e,to:n,origin:"markText"},t.sel,NaN);var l,u=e.line,h=t.cm;if(t.iter(u,n.line+1,function(t){h&&a.collapsed&&!h.options.lineWrapping&&dt(t)==h.display.maxLine&&(l=!0),a.collapsed&&u!=e.line&&L(t,0),Z(t,new U(a,u==e.line?e.ch:null,u==n.line?n.ch:null)),++u}),a.collapsed&&t.iter(e.line,n.line+1,function(e){mt(t,e)&&L(e,0)}),a.clearOnEnter&&rs(a,"beforeCursorEnter",function(){return a.clear()}),a.readOnly&&(q(),(t.history.done.length||t.history.undone.length)&&t.clearHistory()),a.collapsed&&(a.id=++Ps,a.atomic=!0),h){if(l&&(h.curOp.updateMaxLine=!0),a.collapsed)yi(h,e.line,n.line+1);else if(a.className||a.title||a.startStyle||a.endStyle||a.css)for(var d=e.line;d<=n.line;d++)bi(h,d,"text");a.atomic&&Cr(h.doc),xe(h,"markerAdded",h,a)}return a}function Ur(t,e,n,i,r){i=c(i),i.shared=!1;var o=[Vr(t,e,n,i,r)],a=o[0],s=i.widgetNode;return Ki(t,function(t){s&&(i.widgetNode=s.cloneNode(!0)),o.push(Vr(t,B(t,e),B(t,n),i,r));for(var l=0;l-1)return e.state.draggingText(t),void setTimeout(function(){return e.display.input.focus()},20);try{var u=t.dataTransfer.getData("Text");if(u){var c;if(e.state.draggingText&&!e.state.draggingText.copy&&(c=e.listSelections()),wr(e.doc,zi(n,n)),c)for(var h=0;h=0;e--)Rr(t.doc,"",i[e].from,i[e].to,"+delete");Xn(t)})}function po(t,e,n){var i=C(t.text,e+n,n);return i<0||i>t.text.length?null:i}function go(t,e,n){var i=po(t,e.ch,n);return null==i?null:new I(e.line,i,n<0?"after":"before")}function vo(t,e,n,i,r){if(t){var o=Ct(n,e.doc.direction);if(o){var a,s=r<0?g(o):o[0],l=r<0==(1==s.level),u=l?"after":"before";if(s.level>0||"rtl"==e.doc.direction){var c=Xe(e,n);a=r<0?n.text.length-1:0;var h=Ge(e,c,a).top;a=T(function(t){return Ge(e,c,t).top==h},r<0==(1==s.level)?s.from:s.to-1,a),"before"==u&&(a=po(n,a,1))}else a=r<0?s.to:s.from;return new I(i,a,u)}}return new I(i,r<0?n.text.length:0,r<0?"before":"after")}function mo(t,e,n,i){var r=Ct(e,t.doc.direction);if(!r)return go(e,n,i);n.ch>=e.text.length?(n.ch=e.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=St(r,n.ch,n.sticky),a=r[o];if("ltr"==t.doc.direction&&a.level%2==0&&(i>0?a.to>n.ch:a.from=a.from&&d>=c.begin)){var f=h?"before":"after";return new I(n.line,d,f)}}var p=function(t,e,i){for(var o=function(t,e){return e?new I(n.line,l(t,1),"before"):new I(n.line,t,"after")};t>=0&&t0==(1!=a.level),u=s?i.begin:l(i.end,-1);if(a.from<=u&&u0?c.end:l(c.begin,-1);return null==v||i>0&&v==e.text.length||!(g=p(i>0?0:r.length-1,i,u(v)))?null:g}function yo(t,e){var n=A(t.doc,e),i=dt(n);return i!=n&&(e=E(i)),vo(!0,t,i,e,1)}function bo(t,e){var n=A(t.doc,e),i=ft(n);return i!=n&&(e=E(i)),vo(!0,t,n,e,-1)}function _o(t,e){var n=yo(t,e.line),i=A(t.doc,n.line),r=Ct(i,t.doc.direction);if(!r||0==r[0].level){var o=Math.max(0,i.text.search(/\S/)),a=e.line==n.line&&e.ch<=o&&e.ch;return I(n.line,a?0:o,n.sticky)}return n}function xo(t,e,n){if("string"==typeof e&&(e=Vs[e],!e))return!1;t.display.input.ensurePolled();var i=t.display.shift,r=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),n&&(t.display.shift=!1),r=e(t)!=Va}finally{t.display.shift=i,t.state.suppressEdits=!1}return r}function wo(t,e,n){for(var i=0;i-1&&(F((r=s.ranges[r]).from(),e)<0||e.xRel>0)&&(F(r.to(),e)>0||e.xRel<0)?Fo(t,i,e,o):Ho(t,i,e,o)}function Fo(t,e,n,i){var r=t.display,o=!1,a=gi(t,function(e){Sa&&(r.scroller.draggable=!1),t.state.draggingText=!1,kt(r.wrapper.ownerDocument,"mouseup",a),kt(r.wrapper.ownerDocument,"mousemove",s),kt(r.scroller,"dragstart",l),kt(r.scroller,"drop",a),o||(Mt(e),i.addNew||gr(t.doc,n,null,null,i.extend),Sa||xa&&9==wa?setTimeout(function(){r.wrapper.ownerDocument.body.focus(),r.input.focus()},20):r.input.focus())}),s=function(t){o=o||Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)>=10},l=function(){return o=!0};Sa&&(r.scroller.draggable=!0),t.state.draggingText=a,a.copy=!i.moveOnDrag,r.scroller.dragDrop&&r.scroller.dragDrop(),rs(r.wrapper.ownerDocument,"mouseup",a),rs(r.wrapper.ownerDocument,"mousemove",s),rs(r.scroller,"dragstart",l),rs(r.scroller,"drop",a),In(t),setTimeout(function(){return r.input.focus()},20)}function Ro(t,e,n){if("char"==n)return new Ms(e,e);if("word"==n)return t.findWordAt(e);if("line"==n)return new Ms(I(e.line,0),B(t.doc,I(e.line+1,0)));var i=n(t,e);return new Ms(i.from,i.to)}function Ho(t,e,n,i){function r(e){if(0!=F(m,e))if(m=e,"rectangle"==i.unit){for(var r=[],o=t.options.tabSize,a=h(A(u,n.line).text,n.ch,o),s=h(A(u,e.line).text,e.ch,o),l=Math.min(a,s),g=Math.max(a,s),v=Math.min(n.line,e.line),y=Math.min(t.lastLine(),Math.max(n.line,e.line));v<=y;v++){var b=A(u,v).text,_=f(b,l,o);l==g?r.push(new Ms(I(v,_),I(v,_))):b.length>_&&r.push(new Ms(I(v,_),I(v,f(b,g,o))))}r.length||r.push(new Ms(n,n)),xr(u,Wi(p.ranges.slice(0,d).concat(r),d),{origin:"*mouse",scroll:!1}),t.scrollIntoView(e)}else{var x,w=c,S=Ro(t,e,i.unit),C=w.anchor;F(S.anchor,C)>0?(x=S.head,C=W(w.from(),S.anchor)):(x=S.anchor,C=j(w.to(),S.head));var T=p.ranges.slice(0);T[d]=jo(t,new Ms(B(u,C),x)),xr(u,Wi(T,d),Xa)}}function o(e){var n=++b,s=kn(t,e,!0,"rectangle"==i.unit);if(s)if(0!=F(s,m)){t.curOp.focus=a(),r(s);var c=Wn(l,u);(s.line>=c.to||s.liney.bottom?20:0;h&&setTimeout(gi(t,function(){b==n&&(l.scroller.scrollTop+=h,o(e))}),50)}}function s(e){t.state.selectingText=!1,b=1/0,Mt(e),l.input.focus(),kt(l.wrapper.ownerDocument,"mousemove",_),kt(l.wrapper.ownerDocument,"mouseup",x),u.history.lastSelOrigin=null}var l=t.display,u=t.doc;Mt(e);var c,d,p=u.sel,g=p.ranges;if(i.addNew&&!i.extend?(d=u.sel.contains(n),c=d>-1?g[d]:new Ms(n,n)):(c=u.sel.primary(),d=u.sel.primIndex),"rectangle"==i.unit)i.addNew||(c=new Ms(n,n)),n=kn(t,e,!0,!0),d=-1;else{var v=Ro(t,n,i.unit);c=i.extend?pr(c,v.anchor,v.head,i.extend):v}i.addNew?d==-1?(d=g.length,xr(u,Wi(g.concat([c]),d),{scroll:!1,origin:"*mouse"})):g.length>1&&g[d].empty()&&"char"==i.unit&&!i.extend?(xr(u,Wi(g.slice(0,d).concat(g.slice(d+1)),0),{scroll:!1,origin:"*mouse"}),p=u.sel):mr(u,d,c,Xa):(d=0,xr(u,new Es([c],0),Xa),p=u.sel);var m=n,y=l.wrapper.getBoundingClientRect(),b=0,_=gi(t,function(t){0!==t.buttons&&Rt(t)?o(t):s(t)}),x=gi(t,s);t.state.selectingText=x,rs(l.wrapper.ownerDocument,"mousemove",_),rs(l.wrapper.ownerDocument,"mouseup",x)}function jo(t,e){var n=e.anchor,i=e.head,r=A(t.doc,n.line);if(0==F(n,i)&&n.sticky==i.sticky)return e;var o=Ct(r);if(!o)return e;var a=St(o,n.ch,n.sticky),s=o[a];if(s.from!=n.ch&&s.to!=n.ch)return e;var l=a+(s.from==n.ch==(1!=s.level)?0:1);if(0==l||l==o.length)return e;var u;if(i.line!=n.line)u=(i.line-n.line)*("ltr"==t.doc.direction?1:-1)>0;else{var c=St(o,i.ch,i.sticky),h=c-a||(i.ch-n.ch)*(1==s.level?-1:1);u=c==l-1||c==l?h<0:h>0}var d=o[l+(u?-1:0)],f=u==(1==d.level),p=f?d.from:d.to,g=f?"after":"before";return n.ch==p&&n.sticky==g?e:new Ms(new I(n.line,p,g),i)}function Wo(t,e,n,i){var r,o;if(e.touches)r=e.touches[0].clientX,o=e.touches[0].clientY;else try{r=e.clientX,o=e.clientY}catch(t){return!1}if(r>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;i&&Mt(e);var a=t.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!Lt(t,n))return Pt(e);o-=s.top-a.viewOffset;for(var l=0;l=r){var c=M(t.doc,o),h=t.options.gutters[l];return At(t,n,t,c,h,e),Pt(e)}}}function zo(t,e){return Wo(t,e,"gutterClick",!0)}function Bo(t,e){Fe(t.display,e)||$o(t,e)||Dt(t,e,"contextmenu")||t.display.input.onContextMenu(e)}function $o(t,e){return!!Lt(t,"gutterContextMenu")&&Wo(t,e,"gutterContextMenu",!1)}function Yo(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),nn(t)}function qo(t){function e(e,i,r,o){t.defaults[e]=i,r&&(n[e]=o?function(t,e,n){n!=Js&&r(t,e,n)}:r)}var n=t.optionHandlers;t.defineOption=e,t.Init=Js,e("value","",function(t,e){return t.setValue(e)},!0),e("mode",null,function(t,e){t.doc.modeOption=e,Ui(t)},!0),e("indentUnit",2,Ui,!0),e("indentWithTabs",!1),e("smartIndent",!0),e("tabSize",4,function(t){Xi(t),nn(t),yi(t)},!0),e("lineSeparator",null,function(t,e){if(t.doc.lineSep=e,e){var n=[],i=t.doc.first;t.doc.iter(function(t){for(var r=0;;){var o=t.text.indexOf(e,r);if(o==-1)break;r=o+e.length,n.push(I(i,o))}i++});for(var r=n.length-1;r>=0;r--)Rr(t.doc,e,n[r],I(n[r].line,n[r].ch+e.length))}}),e("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,e,n){t.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g"),n!=Js&&t.refresh()}),e("specialCharPlaceholder",ce,function(t){return t.refresh()},!0),e("electricChars",!0),e("inputStyle",Ma?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),e("spellcheck",!1,function(t,e){return t.getInputField().spellcheck=e},!0),e("rtlMoveVisually",!Ia),e("wholeLineUpdateBefore",!0),e("theme","default",function(t){Yo(t),Vo(t)},!0),e("keyMap","default",function(t,e,n){var i=ho(e),r=n!=Js&&ho(n);r&&r.detach&&r.detach(t,i),i.attach&&i.attach(t,r||null)}),e("extraKeys",null),e("configureMouse",null),e("lineWrapping",!1,Xo,!0),e("gutters",[],function(t){Fi(t.options),Vo(t)},!0),e("fixedGutter",!0,function(t,e){t.display.gutters.style.left=e?Sn(t.display)+"px":"0",t.refresh()},!0),e("coverGutterNextToScrollbar",!1,function(t){return ii(t)},!0),e("scrollbarStyle","native",function(t){oi(t),ii(t),t.display.scrollbars.setScrollTop(t.doc.scrollTop),t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)},!0),e("lineNumbers",!1,function(t){Fi(t.options),Vo(t)},!0),e("firstLineNumber",1,Vo,!0),e("lineNumberFormatter",function(t){return t},Vo,!0),e("showCursorWhenSelecting",!1,Dn,!0),e("resetSelectionOnContextMenu",!0),e("lineWiseCopyCut",!0),e("pasteLinesPerSelection",!0),e("readOnly",!1,function(t,e){"nocursor"==e&&(Rn(t),t.display.input.blur()),t.display.input.readOnlyChanged(e)}),e("disableInput",!1,function(t,e){e||t.display.input.reset()},!0),e("dragDrop",!0,Uo),e("allowDropFileTypes",null),e("cursorBlinkRate",530),e("cursorScrollMargin",0),e("cursorHeight",1,Dn,!0),e("singleCursorHeightPerLine",!0,Dn,!0),e("workTime",100),e("workDelay",100),e("flattenSpans",!0,Xi,!0),e("addModeClass",!1,Xi,!0),e("pollInterval",100),e("undoDepth",200,function(t,e){return t.doc.history.undoDepth=e}),e("historyEventDelay",1250),e("viewportMargin",10,function(t){return t.refresh()},!0),e("maxHighlightLength",1e4,Xi,!0),e("moveInputWithCursor",!0,function(t,e){e||t.display.input.resetPosition()}),e("tabindex",null,function(t,e){return t.display.input.getField().tabIndex=e||""}),e("autofocus",null),e("direction","ltr",function(t,e){return t.doc.setDirection(e)},!0)}function Vo(t){Ii(t),yi(t),zn(t)}function Uo(t,e,n){var i=n&&n!=Js;if(!e!=!i){var r=t.display.dragFunctions,o=e?rs:kt;o(t.display.scroller,"dragstart",r.start),o(t.display.scroller,"dragenter",r.enter),o(t.display.scroller,"dragover",r.over),o(t.display.scroller,"dragleave",r.leave),o(t.display.scroller,"drop",r.drop)}}function Xo(t){t.options.lineWrapping?(s(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(Wa(t.display.wrapper,"CodeMirror-wrap"),xt(t)),Tn(t),yi(t),nn(t),setTimeout(function(){return ii(t)},100)}function Go(t,e){var n=this;if(!(this instanceof Go))return new Go(t,e);this.options=e=e?c(e):{},c(tl,e,!1),Fi(e);var i=e.value;"string"==typeof i&&(i=new Hs(i,e.mode,null,e.lineSeparator,e.direction)),this.doc=i;var r=new Go.inputStyles[e.inputStyle](this),o=this.display=new k(t,i,r);o.wrapper.CodeMirror=this,Ii(this),Yo(this),e.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),oi(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Ba,keySeq:null,specialChars:null},e.autofocus&&!Ma&&o.input.focus(),xa&&wa<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zo(this),no(),ai(this),this.curOp.forceUpdate=!0,Qi(this,i),e.autofocus&&!Ma||this.hasFocus()?setTimeout(u(Fn,this),20):Rn(this);for(var a in el)el.hasOwnProperty(a)&&el[a](n,e[a],Js);Bn(this),e.finishInit&&e.finishInit(this);for(var s=0;s400}var r=t.display;rs(r.scroller,"mousedown",gi(t,Mo)),xa&&wa<11?rs(r.scroller,"dblclick",gi(t,function(e){if(!Dt(t,e)){var n=kn(t,e);if(n&&!zo(t,e)&&!Fe(t.display,e)){Mt(e);var i=t.findWordAt(n);gr(t.doc,i.anchor,i.head)}}})):rs(r.scroller,"dblclick",function(e){return Dt(t,e)||Mt(e)}),ja||rs(r.scroller,"contextmenu",function(e){return Bo(t,e)});var o,a={end:0};rs(r.scroller,"touchstart",function(e){if(!Dt(t,e)&&!n(e)&&!zo(t,e)){r.input.ensurePolled(),clearTimeout(o);var i=+new Date;r.activeTouch={start:i,moved:!1,prev:i-a.end<=300?a:null},1==e.touches.length&&(r.activeTouch.left=e.touches[0].pageX,r.activeTouch.top=e.touches[0].pageY)}}),rs(r.scroller,"touchmove",function(){r.activeTouch&&(r.activeTouch.moved=!0)}),rs(r.scroller,"touchend",function(n){var o=r.activeTouch;if(o&&!Fe(r,n)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,s=t.coordsChar(r.activeTouch,"page");a=!o.prev||i(o,o.prev)?new Ms(s,s):!o.prev.prev||i(o,o.prev.prev)?t.findWordAt(s):new Ms(I(s.line,0),B(t.doc,I(s.line+1,0))),t.setSelection(a.anchor,a.head),t.focus(),Mt(n)}e()}),rs(r.scroller,"touchcancel",e),rs(r.scroller,"scroll",function(){r.scroller.clientHeight&&(Jn(t,r.scroller.scrollTop),ei(t,r.scroller.scrollLeft,!0),At(t,"scroll",t))}),rs(r.scroller,"mousewheel",function(e){return ji(t,e)}),rs(r.scroller,"DOMMouseScroll",function(e){return ji(t,e)}),rs(r.wrapper,"scroll",function(){return r.wrapper.scrollTop=r.wrapper.scrollLeft=0}),r.dragFunctions={enter:function(e){Dt(t,e)||It(e)},over:function(e){Dt(t,e)||(Jr(t,e),It(e))},start:function(e){return Qr(t,e)},drop:gi(t,Kr),leave:function(e){Dt(t,e)||to(t)}};var s=r.input.getField();rs(s,"keyup",function(e){return Oo.call(t,e)}),rs(s,"keydown",gi(t,Ao)),rs(s,"keypress",gi(t,Lo)),rs(s,"focus",function(e){return Fn(t,e)}),rs(s,"blur",function(e){return Rn(t,e)})}function Ko(t,e,n,i){var r,o=t.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?r=Kt(t,e).state:n="prev");var a=t.options.tabSize,s=A(o,e),l=h(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(i||/\S/.test(s.text)){if("smart"==n&&(u=o.mode.indent(r,s.text.slice(c.length),s.text),u==Va||u>150)){if(!i)return;n="prev"}}else u=0,n="not";"prev"==n?u=e>o.first?h(A(o,e-1).text,null,a):0:"add"==n?u=l+t.options.indentUnit:"subtract"==n?u=l-t.options.indentUnit:"number"==typeof n&&(u=l+n),u=Math.max(0,u);var d="",f=0;if(t.options.indentWithTabs)for(var g=Math.floor(u/a);g;--g)f+=a,d+="\t";if(f1)if(il&&il.text.join("\n")==e){if(i.ranges.length%il.text.length==0){l=[];for(var u=0;u=0;h--){var d=i.ranges[h],f=d.from(),p=d.to();d.empty()&&(n&&n>0?f=I(f.line,f.ch-n):t.state.overwrite&&!a?p=I(p.line,Math.min(A(o,p.line).text.length,p.ch+g(s).length)):il&&il.lineWise&&il.text.join("\n")==e&&(f=p=I(f.line,0))),c=t.curOp.updateInput;var m={from:f,to:p,text:l?l[h%l.length]:s,origin:r||(a?"paste":t.state.cutIncoming?"cut":"+input")};Er(t.doc,m),xe(t,"inputRead",t,m)}e&&!a&&ea(t,e),Xn(t),t.curOp.updateInput=c,t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=!1}function ta(t,e){var n=t.clipboardData&&t.clipboardData.getData("Text");if(n)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||pi(e,function(){return Jo(e,n,0,null,"paste")}),!0}function ea(t,e){if(t.options.electricChars&&t.options.smartIndent)for(var n=t.doc.sel,i=n.ranges.length-1;i>=0;i--){var r=n.ranges[i];if(!(r.head.ch>100||i&&n.ranges[i-1].head.line==r.head.line)){var o=t.getModeAt(r.head),a=!1;if(o.electricChars){for(var s=0;s-1){a=Ko(t,r.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(A(t.doc,r.head.line).text.slice(0,r.head.ch))&&(a=Ko(t,r.head.line,"smart"));a&&xe(t,"electricInput",t,r.head.line)}}}function na(t){for(var e=[],n=[],i=0;i=t.first+t.size)&&(e=new I(i,e.ch,e.sticky),u=A(t,i))}function a(i){var a;if(a=r?mo(t.cm,u,e,n):go(u,e,n),null==a){if(i||!o())return!1;e=vo(r,t.cm,u,e.line,n)}else e=a;return!0}var s=e,l=n,u=A(t,e.line);if("char"==i)a();else if("column"==i)a(!0);else if("word"==i||"group"==i)for(var c=null,h="group"==i,d=t.cm&&t.cm.getHelper(e,"wordChars"),f=!0;!(n<0)||a(!f);f=!1){var p=u.text.charAt(e.ch)||"\n",g=x(p,d)?"w":h&&"\n"==p?"n":!h||/\s/.test(p)?null:"p";if(!h||f||g||(g="s"),c&&c!=g){n<0&&(n=1,a(),e.sticky="after");break}if(g&&(c=g),n>0&&!a(!f))break}var v=Ar(t,e,s,l,!0);return R(s,v)&&(v.hitSide=!0),v}function aa(t,e,n,i){var r,o=t.doc,a=e.left;if("page"==i){var s=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),l=Math.max(s-.5*_n(t.display),3);r=(n>0?e.bottom:e.top)+n*l}else"line"==i&&(r=n>0?e.bottom+3:e.top-3);for(var u;u=fn(t,a,r),u.outside;){if(n<0?r<=0:r>=o.height){u.hitSide=!0;break}r+=5*n}return u}function sa(t,e){var n=Ue(t,e.line);if(!n||n.hidden)return null;var i=A(t.doc,e.line),r=Ye(n,i,e.line),o=Ct(i,t.doc.direction),a="left";if(o){var s=St(o,e.ch);a=s%2?"right":"left"}var l=Ze(r.map,e.ch,a);return l.offset="right"==l.collapse?l.end:l.start,l}function la(t){for(var e=t;e;e=e.parentNode)if(/CodeMirror-gutter-wrapper/.test(e.className))return!0;return!1}function ua(t,e){return e&&(t.bad=!0),t}function ca(t,e,n,i,r){function o(t){return function(e){return e.id==t}}function a(){c&&(u+=h,d&&(u+=h),c=d=!1)}function s(t){t&&(a(),u+=t)}function l(e){if(1==e.nodeType){var n=e.getAttribute("cm-text");if(n)return void s(n);var u,f=e.getAttribute("cm-marker");if(f){var p=t.findMarks(I(i,0),I(r+1,0),o(+f));return void(p.length&&(u=p[0].find(0))&&s(D(t.doc,u.from,u.to).join(h)))}if("false"==e.getAttribute("contenteditable"))return;var g=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&0==e.textContent.length)return;g&&a();for(var v=0;v=15&&(ka=!1,Sa=!0);var Ra,Ha=Na&&(Ca||ka&&(null==Fa||Fa<12.11)),ja=ma||xa&&wa>=9,Wa=function(e,n){var i=e.className,r=t(n).exec(i);if(r){var o=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(o?r[1]+o:"")}};Ra=document.createRange?function(t,e,n,i){var r=document.createRange();return r.setEnd(i||t,n),r.setStart(t,e),r}:function(t,e,n){var i=document.body.createTextRange();try{i.moveToElementText(t.parentNode)}catch(t){return i}return i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",e),i};var za=function(t){t.select()};La?za=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:xa&&(za=function(t){try{t.select()}catch(t){}});var Ba=function(){this.id=null};Ba.prototype.set=function(t,e){clearTimeout(this.id),this.id=setTimeout(e,t)};var $a,Ya,qa=30,Va={toString:function(){return"CodeMirror.Pass"}},Ua={scroll:!1},Xa={origin:"*mouse"},Ga={origin:"+move"},Za=[""],Ka=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Qa=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,Ja=!1,ts=!1,es=null,ns=function(){function t(t){return t<=247?n.charAt(t):1424<=t&&t<=1524?"R":1536<=t&&t<=1785?i.charAt(t-1536):1774<=t&&t<=2220?"r":8192<=t&&t<=8203?"w":8204==t?"b":"L"}function e(t,e,n){this.level=t,this.from=e,this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",i="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,s=/[Lb1n]/,l=/[1n]/;return function(n,i){var u="ltr"==i?"L":"R";if(0==n.length||"ltr"==i&&!r.test(n))return!1;for(var c=n.length,h=[],d=0;d=this.string.length},fs.prototype.sol=function(){return this.pos==this.lineStart},fs.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},fs.prototype.next=function(){if(this.pose},fs.prototype.eatSpace=function(){for(var t=this,e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++t.pos;return this.pos>e},fs.prototype.skipToEnd=function(){this.pos=this.string.length},fs.prototype.skipTo=function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0},fs.prototype.backUp=function(t){this.pos-=t},fs.prototype.column=function(){return this.lastColumnPos0?null:(i&&e!==!1&&(this.pos+=i[0].length),i)}var r=function(t){return n?t.toLowerCase():t},o=this.string.substr(this.pos,t.length);if(r(o)==r(t))return e!==!1&&(this.pos+=t.length),!0},fs.prototype.current=function(){return this.string.slice(this.start,this.pos)},fs.prototype.hideFirstChars=function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}},fs.prototype.lookAhead=function(t){var e=this.lineOracle;return e&&e.lookAhead(t)},fs.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};var ps=function(t,e){this.state=t,this.lookAhead=e},gs=function(t,e,n,i){this.state=e,this.doc=t,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};gs.prototype.lookAhead=function(t){var e=this.doc.getLine(this.line+t);return null!=e&&t>this.maxLookAhead&&(this.maxLookAhead=t),e},gs.prototype.baseToken=function(t){var e=this;if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=t;)e.baseTokenPos+=2;var n=this.baseTokens[this.baseTokenPos+1];return{type:n&&n.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},gs.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},gs.fromSaved=function(t,e,n){return e instanceof ps?new gs(t,Vt(t.mode,e.state),n,e.lookAhead):new gs(t,Vt(t.mode,e),n)},gs.prototype.save=function(t){var e=t!==!1?Vt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ps(e,this.maxLookAhead):e};var vs=function(t,e,n){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=e||null,this.state=n},ms=function(t,e,n){this.text=t,it(this,e),this.height=n?n(this):1};ms.prototype.lineNo=function(){return E(this)},Et(ms);var ys,bs={},_s={},xs=null,ws=null,Ss={left:0,right:0,top:0, +bottom:0},Cs=function(t,e,n){this.cm=n;var r=this.vert=i("div",[i("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=i("div",[i("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=o.tabIndex=-1,t(r),t(o),rs(r,"scroll",function(){r.clientHeight&&e(r.scrollTop,"vertical")}),rs(o,"scroll",function(){o.clientWidth&&e(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,xa&&wa<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Cs.prototype.update=function(t){var e=t.scrollWidth>t.clientWidth+1,n=t.scrollHeight>t.clientHeight+1,i=t.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=e?i+"px":"0";var r=t.viewHeight-(e?i:0);this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+r)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(e){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=t.barLeft+"px";var o=t.viewWidth-t.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,t.scrollWidth-t.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&t.clientHeight>0&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:e?i:0}},Cs.prototype.setScrollLeft=function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Cs.prototype.setScrollTop=function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Cs.prototype.zeroWidthHack=function(){var t=Na&&!Da?"12px":"18px";this.horiz.style.height=this.vert.style.width=t,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Ba,this.disableVert=new Ba},Cs.prototype.enableZeroWidthBar=function(t,e,n){function i(){var r=t.getBoundingClientRect(),o="vert"==n?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1);o!=t?t.style.pointerEvents="none":e.set(1e3,i)}t.style.pointerEvents="auto",e.set(1e3,i)},Cs.prototype.clear=function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)};var Ts=function(){};Ts.prototype.update=function(){return{bottom:0,right:0}},Ts.prototype.setScrollLeft=function(){},Ts.prototype.setScrollTop=function(){},Ts.prototype.clear=function(){};var ks={native:Cs,null:Ts},As=0,Ds=function(t,e,n){var i=t.display;this.viewport=e,this.visible=Wn(i,t.doc,e),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=ze(t),this.force=n,this.dims=wn(t),this.events=[]};Ds.prototype.signal=function(t,e){Lt(t,e)&&this.events.push(arguments)},Ds.prototype.finish=function(){for(var t=this,e=0;e=0&&F(t,r.to())<=0)return i}return-1};var Ms=function(t,e){this.anchor=t,this.head=e};Ms.prototype.from=function(){return W(this.anchor,this.head)},Ms.prototype.to=function(){return j(this.anchor,this.head)},Ms.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},Br.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,e){for(var n=this,i=t,r=t+e;i1||!(this.children[0]instanceof Br))){var l=[];this.collapse(l),this.children=[new Br(l)],this.children[0].parent=this}},collapse:function(t){for(var e=this,n=0;n50){for(var s=o.lines.length%25+25,l=s;l10);t.parent.maybeSpill()}},iterN:function(t,e,n){for(var i=this,r=0;re.display.maxLineLength&&(e.display.maxLine=c,e.display.maxLineLength=h,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&yi(e,r,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Cr(e.doc)),e&&xe(e,"markerCleared",e,this,r,o),n&&si(e),this.parent&&this.parent.clear()}},Is.prototype.find=function(t,e){var n=this;null==t&&"bookmark"==this.type&&(t=1);for(var i,r,o=0;o=0;u--)Er(i,r[u]);l?_r(this,l):this.cm&&Xn(this.cm)}),undo:mi(function(){Nr(this,"undo")}),redo:mi(function(){Nr(this,"redo")}),undoSelection:mi(function(){Nr(this,"undo",!0)}),redoSelection:mi(function(){Nr(this,"redo",!0)}),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,n=0,i=0;i=t.ch)&&e.push(r.marker.parent||r.marker)}return e},findMarks:function(t,e,n){t=B(this,t),e=B(this,e);var i=[],r=t.line;return this.iter(t.line,e.line+1,function(o){var a=o.markedSpans;if(a)for(var s=0;s=l.to||null==l.from&&r!=t.line||null!=l.from&&r==e.line&&l.from>=e.ch||n&&!n(l.marker)||i.push(l.marker.parent||l.marker)}++r}),i},getAllMarks:function(){var t=[];return this.iter(function(e){var n=e.markedSpans;if(n)for(var i=0;it?(e=t,!0):(t-=o,void++n)}),B(this,I(n,e))},indexFromPos:function(t){t=B(this,t);var e=t.ch;if(t.linee&&(e=t.from),null!=t.to&&t.to0)r=new I(r.line,r.ch+1),t.replaceRange(o.charAt(r.ch-1)+o.charAt(r.ch-2),I(r.line,r.ch-2),r,"+transpose");else if(r.line>t.doc.first){var a=A(t.doc,r.line-1).text;a&&(r=new I(r.line,1),t.replaceRange(o.charAt(0)+t.doc.lineSeparator()+a.charAt(a.length-1),I(r.line-1,a.length-1),r,"+transpose"))}n.push(new Ms(r,r))}t.setSelections(n)})},newlineAndIndent:function(t){return pi(t,function(){for(var e=t.listSelections(),n=e.length-1;n>=0;n--)t.replaceRange(t.doc.lineSeparator(),e[n].anchor,e[n].head,"+input");e=t.listSelections();for(var i=0;it&&0==F(e,this.pos)&&n==this.button};var Ks,Qs,Js={toString:function(){return"CodeMirror.Init"}},tl={},el={};Go.defaults=tl,Go.optionHandlers=el;var nl=[];Go.defineInitHook=function(t){return nl.push(t)};var il=null,rl=function(t){var e=t.optionHandlers,n=t.helpers={};t.prototype={constructor:t,focus:function(){window.focus(),this.display.input.focus()},setOption:function(t,n){var i=this.options,r=i[t];i[t]==n&&"mode"!=t||(i[t]=n,e.hasOwnProperty(t)&&gi(this,e[t])(this,n,r),At(this,"optionChange",this,t))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](ho(t))},removeKeyMap:function(t){for(var e=this.state.keyMaps,n=0;ni&&(Ko(e,o.head.line,t,!0),i=o.head.line,r==e.doc.sel.primIndex&&Xn(e));else{var a=o.from(),s=o.to(),l=Math.max(i,a.line);i=Math.min(e.lastLine(),s.line-(s.ch?0:1))+1;for(var u=l;u0&&mr(e.doc,r,new Ms(a,c[r].to()),Ua)}}}),getTokenAt:function(t,e){return ee(this,t,e)},getLineTokens:function(t,e){return ee(this,I(t),e,!0)},getTokenTypeAt:function(t){t=B(this.doc,t);var e,n=Zt(this,A(this.doc,t.line)),i=0,r=(n.length-1)/2,o=t.ch;if(0==o)e=n[2];else for(;;){var a=i+r>>1;if((a?n[2*a-1]:0)>=o)r=a;else{if(!(n[2*a+1]o&&(t=o,r=!0),i=A(this.doc,t)}else i=t;return sn(this,i,{top:0,left:0},e||"page",n||r).top+(r?this.doc.height-bt(i):0)},defaultTextHeight:function(){return _n(this.display)},defaultCharWidth:function(){return xn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,n,i,r){var o=this.display;t=cn(this,B(this.doc,t));var a=t.bottom,s=t.left;if(e.style.position="absolute",e.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(e),o.sizer.appendChild(e),"over"==i)a=t.top;else if("above"==i||"near"==i){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==i||t.bottom+e.offsetHeight>l)&&t.top>e.offsetHeight?a=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=l&&(a=t.bottom),s+e.offsetWidth>u&&(s=u-e.offsetWidth)}e.style.top=a+"px",e.style.left=e.style.right="","right"==r?(s=o.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==r?s=0:"middle"==r&&(s=(o.sizer.clientWidth-e.offsetWidth)/2),e.style.left=s+"px"),n&&qn(this,{left:s,top:a,right:s+e.offsetWidth,bottom:a+e.offsetHeight})},triggerOnKeyDown:vi(Ao),triggerOnKeyPress:vi(Lo),triggerOnKeyUp:Oo,triggerOnMouseDown:vi(Mo),execCommand:function(t){if(Vs.hasOwnProperty(t))return Vs[t].call(null,this)},triggerElectric:vi(function(t){ea(this,t)}),findPosH:function(t,e,n,i){var r=this,o=1;e<0&&(o=-1,e=-e);for(var a=B(this.doc,t),s=0;s0&&s(n.charAt(i-1));)--i;for(;r.5)&&Tn(this),At(this,"refresh",this)}),swapDoc:vi(function(t){var e=this.doc;return e.cm=null,Qi(this,t),nn(this),this.display.input.reset(),Gn(this,t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,xe(this,"swapDoc",this,e),e}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Et(t),t.registerHelper=function(e,i,r){n.hasOwnProperty(e)||(n[e]=t[e]={_global:[]}),n[e][i]=r},t.registerGlobalHelper=function(e,i,r,o){t.registerHelper(e,i,o),n[e]._global.push({pred:r,val:o})}},ol=function(t){this.cm=t,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Ba,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};ol.prototype.init=function(t){function e(t){if(!Dt(r,t)){if(r.somethingSelected())Qo({lineWise:!1,text:r.getSelections()}),"cut"==t.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var e=na(r);Qo({lineWise:!0,text:e.text}),"cut"==t.type&&r.operation(function(){r.setSelections(e.ranges,0,Ua),r.replaceSelection("",null,"cut")})}if(t.clipboardData){t.clipboardData.clearData();var n=il.text.join("\n");if(t.clipboardData.setData("Text",n),t.clipboardData.getData("Text")==n)return void t.preventDefault()}var a=ra(),s=a.firstChild;r.display.lineSpace.insertBefore(a,r.display.lineSpace.firstChild),s.value=il.text.join("\n");var l=document.activeElement;za(s),setTimeout(function(){r.display.lineSpace.removeChild(a),l.focus(),l==o&&i.showPrimarySelection()},50)}}var n=this,i=this,r=i.cm,o=i.div=t.lineDiv;ia(o,r.options.spellcheck),rs(o,"paste",function(t){Dt(r,t)||ta(t,r)||wa<=11&&setTimeout(gi(r,function(){return n.updateFromDOM()}),20)}),rs(o,"compositionstart",function(t){n.composing={data:t.data,done:!1}}),rs(o,"compositionupdate",function(t){n.composing||(n.composing={data:t.data,done:!1})}),rs(o,"compositionend",function(t){n.composing&&(t.data!=n.composing.data&&n.readFromDOMSoon(),n.composing.done=!0)}),rs(o,"touchstart",function(){return i.forceCompositionEnd()}),rs(o,"input",function(){n.composing||n.readFromDOMSoon()}),rs(o,"copy",e),rs(o,"cut",e)},ol.prototype.prepareSelection=function(){var t=On(this.cm,!1);return t.focus=this.cm.state.focused,t},ol.prototype.showSelection=function(t,e){t&&this.cm.display.view.length&&((t.focus||e)&&this.showPrimarySelection(),this.showMultipleSelections(t))},ol.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},ol.prototype.showPrimarySelection=function(){var t=this.getSelection(),e=this.cm,n=e.doc.sel.primary(),i=n.from(),r=n.to();if(e.display.viewTo==e.display.viewFrom||i.line>=e.display.viewTo||r.line=e.display.viewFrom&&sa(e,i)||{node:s[0].measure.map[2],offset:0},u=r.linet.firstLine()&&(i=I(i.line-1,A(t.doc,i.line-1).length)),r.ch==A(t.doc,r.line).text.length&&r.linee.viewTo-1)return!1;var o,a,s;i.line==e.viewFrom||0==(o=An(t,i.line))?(a=E(e.view[0].line),s=e.view[0].node):(a=E(e.view[o].line),s=e.view[o-1].node.nextSibling);var l,u,c=An(t,r.line);if(c==e.view.length-1?(l=e.viewTo-1,u=e.lineDiv.lastChild):(l=E(e.view[c+1].line)-1,u=e.view[c+1].node.previousSibling),!s)return!1;for(var h=t.doc.splitLines(ca(t,s,u,a,l)),d=D(t.doc,I(a,0),I(l,A(t.doc,l).text.length));h.length>1&&d.length>1;)if(g(h)==g(d))h.pop(),d.pop(),l--;else{if(h[0]!=d[0])break;h.shift(),d.shift(),a++}for(var f=0,p=0,v=h[0],m=d[0],y=Math.min(v.length,m.length);fi.ch&&b.charCodeAt(b.length-p-1)==_.charCodeAt(_.length-p-1);)f--,p++;h[h.length-1]=b.slice(0,b.length-p).replace(/^\u200b+/,""),h[0]=h[0].slice(f).replace(/\u200b+$/,"");var w=I(a,f),S=I(l,d.length?g(d).length-p:0);return h.length>1||h[0]||F(w,S)?(Rr(t.doc,h,w,S,"+input"),!0):void 0},ol.prototype.ensurePolled=function(){this.forceCompositionEnd()},ol.prototype.reset=function(){this.forceCompositionEnd()},ol.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ol.prototype.readFromDOMSoon=function(){var t=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(t.readDOMTimeout=null,t.composing){if(!t.composing.done)return;t.composing=null}t.updateFromDOM()},80))},ol.prototype.updateFromDOM=function(){var t=this;!this.cm.isReadOnly()&&this.pollContent()||pi(this.cm,function(){return yi(t.cm)})},ol.prototype.setUneditable=function(t){t.contentEditable="false"},ol.prototype.onKeyPress=function(t){0==t.charCode||this.composing||(t.preventDefault(),this.cm.isReadOnly()||gi(this.cm,Jo)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0))},ol.prototype.readOnlyChanged=function(t){this.div.contentEditable=String("nocursor"!=t)},ol.prototype.onContextMenu=function(){},ol.prototype.resetPosition=function(){},ol.prototype.needsContentAttribute=!0;var al=function(t){this.cm=t,this.prevInput="",this.pollingFast=!1,this.polling=new Ba,this.hasSelection=!1,this.composing=null};al.prototype.init=function(t){function e(t){if(!Dt(r,t)){if(r.somethingSelected())Qo({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var e=na(r);Qo({lineWise:!0,text:e.text}),"cut"==t.type?r.setSelections(e.ranges,null,Ua):(i.prevInput="",o.value=e.text.join("\n"),za(o))}"cut"==t.type&&(r.state.cutIncoming=!0)}}var n=this,i=this,r=this.cm;this.createField(t);var o=this.textarea;t.wrapper.insertBefore(this.wrapper,t.wrapper.firstChild),La&&(o.style.width="0px"),rs(o,"input",function(){xa&&wa>=9&&n.hasSelection&&(n.hasSelection=null),i.poll()}),rs(o,"paste",function(t){Dt(r,t)||ta(t,r)||(r.state.pasteIncoming=!0,i.fastPoll())}),rs(o,"cut",e),rs(o,"copy",e),rs(t.scroller,"paste",function(e){Fe(t,e)||Dt(r,e)||(r.state.pasteIncoming=!0,i.focus())}),rs(t.lineSpace,"selectstart",function(e){Fe(t,e)||Mt(e)}),rs(o,"compositionstart",function(){var t=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:t,range:r.markText(t,r.getCursor("to"),{className:"CodeMirror-composing"})}}),rs(o,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},al.prototype.createField=function(t){this.wrapper=ra(),this.textarea=this.wrapper.firstChild},al.prototype.prepareSelection=function(){var t=this.cm,e=t.display,n=t.doc,i=On(t);if(t.options.moveInputWithCursor){var r=cn(t,n.sel.primary().head,"div"),o=e.wrapper.getBoundingClientRect(),a=e.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,r.top+a.top-o.top)),i.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,r.left+a.left-o.left))}return i},al.prototype.showSelection=function(t){var e=this.cm,i=e.display;n(i.cursorDiv,t.cursors),n(i.selectionDiv,t.selection),null!=t.teTop&&(this.wrapper.style.top=t.teTop+"px",this.wrapper.style.left=t.teLeft+"px")},al.prototype.reset=function(t){if(!this.contextMenuPending&&!this.composing){var e=this.cm;if(e.somethingSelected()){this.prevInput="";var n=e.getSelection();this.textarea.value=n,e.state.focused&&za(this.textarea),xa&&wa>=9&&(this.hasSelection=n)}else t||(this.prevInput=this.textarea.value="",xa&&wa>=9&&(this.hasSelection=null))}},al.prototype.getField=function(){return this.textarea},al.prototype.supportsTouch=function(){return!1},al.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Ma||a()!=this.textarea))try{this.textarea.focus()}catch(t){}},al.prototype.blur=function(){this.textarea.blur()},al.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},al.prototype.receivedFocus=function(){this.slowPoll()},al.prototype.slowPoll=function(){var t=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){t.poll(),t.cm.state.focused&&t.slowPoll()})},al.prototype.fastPoll=function(){function t(){var i=n.poll();i||e?(n.pollingFast=!1,n.slowPoll()):(e=!0,n.polling.set(60,t))}var e=!1,n=this;n.pollingFast=!0,n.polling.set(20,t)},al.prototype.poll=function(){var t=this,e=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!e.state.focused||ss(n)&&!i&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var r=n.value;if(r==i&&!e.somethingSelected())return!1;if(xa&&wa>=9&&this.hasSelection===r||Na&&/[\uf700-\uf7ff]/.test(r))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var o=r.charCodeAt(0);if(8203!=o||i||(i="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var a=0,s=Math.min(i.length,r.length);a1e3||r.indexOf("\n")>-1?n.value=t.prevInput="":t.prevInput=r,t.composing&&(t.composing.range.clear(),t.composing.range=e.markText(t.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},al.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},al.prototype.onKeyPress=function(){xa&&wa>=9&&(this.hasSelection=null),this.fastPoll()},al.prototype.onContextMenu=function(t){function e(){if(null!=a.selectionStart){var t=r.somethingSelected(),e="​"+(t?a.value:"");a.value="⇚",a.value=e,i.prevInput=t?"":"​",a.selectionStart=1,a.selectionEnd=e.length,o.selForContextMenu=r.doc.sel}}function n(){if(i.contextMenuPending=!1,i.wrapper.style.cssText=h,a.style.cssText=c,xa&&wa<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=l),null!=a.selectionStart){(!xa||xa&&wa<9)&&e();var t=0,n=function(){o.selForContextMenu==r.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&"​"==i.prevInput?gi(r,Or)(r):t++<10?o.detectingSelectAll=setTimeout(n,500):(o.selForContextMenu=null,o.input.reset())};o.detectingSelectAll=setTimeout(n,200)}}var i=this,r=i.cm,o=r.display,a=i.textarea,s=kn(r,t),l=o.scroller.scrollTop;if(s&&!ka){var u=r.options.resetSelectionOnContextMenu;u&&r.doc.sel.contains(s)==-1&&gi(r,xr)(r.doc,zi(s),Ua);var c=a.style.cssText,h=i.wrapper.style.cssText;i.wrapper.style.cssText="position: absolute";var d=i.wrapper.getBoundingClientRect();a.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(t.clientY-d.top-5)+"px; left: "+(t.clientX-d.left-5)+"px;\n z-index: 1000; background: "+(xa?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var f;if(Sa&&(f=window.scrollY),o.input.focus(),Sa&&window.scrollTo(null,f),o.input.reset(),r.somethingSelected()||(a.value=i.prevInput=" "),i.contextMenuPending=!0,o.selForContextMenu=r.doc.sel,clearTimeout(o.detectingSelectAll),xa&&wa>=9&&e(),ja){It(t);var p=function(){kt(window,"mouseup",p),setTimeout(n,20)};rs(window,"mouseup",p)}else setTimeout(n,50)}},al.prototype.readOnlyChanged=function(t){t||this.reset(),this.textarea.disabled="nocursor"==t},al.prototype.setUneditable=function(){},al.prototype.needsContentAttribute=!1,qo(Go),rl(Go);var sl="iter insert remove copy getEditor constructor".split(" ");for(var ll in Hs.prototype)Hs.prototype.hasOwnProperty(ll)&&d(sl,ll)<0&&(Go.prototype[ll]=function(t){return function(){return t.apply(this.doc,arguments)}}(Hs.prototype[ll]));return Et(Hs),Go.inputStyles={textarea:al,contenteditable:ol},Go.defineMode=function(t){Go.defaults.mode||"null"==t||(Go.defaults.mode=t),zt.apply(this,arguments)},Go.defineMIME=Bt,Go.defineMode("null",function(){return{token:function(t){return t.skipToEnd()}}}),Go.defineMIME("text/plain","null"),Go.defineExtension=function(t,e){Go.prototype[t]=e},Go.defineDocExtension=function(t,e){Hs.prototype[t]=e},Go.fromTextArea=fa,pa(Go),Go.version="5.39.0",Go})},function(t,e,n){var i=n(191),r=n(210),o=r(function(t,e,n){i(t,e,n)});t.exports=o},function(t,e,n){function i(t,e,n,h,d){t!==e&&a(e,function(a,u){if(l(a))d||(d=new r),s(t,e,u,n,i,h,d);else{var f=h?h(c(t,u),a,u+"",t,e,d):void 0;void 0===f&&(f=a),o(t,u,f)}},u)}var r=n(61),o=n(192),a=n(22),s=n(193),l=n(51),u=n(207),c=n(203);t.exports=i},function(t,e,n){function i(t,e,n){(void 0===n||o(t[e],n))&&(void 0!==n||e in t)||r(t,e,n)}var r=n(149),o=n(66);t.exports=i},function(t,e,n){function i(t,e,n,i,b,_,x){var w=m(t,n),S=m(e,n),C=x.get(S);if(C)return void r(t,n,C);var T=_?_(w,S,n+"",t,e,x):void 0,k=void 0===T;if(k){var A=c(S),D=!A&&d(S),O=!A&&!D&&v(S);T=S,A||D||O?c(w)?T=w:h(w)?T=s(w):D?(k=!1,T=o(S,!0)):O?(k=!1,T=a(S,!0)):T=[]:g(S)||u(S)?(T=w,u(w)?T=y(w):(!p(w)||i&&f(w))&&(T=l(S))):k=!1}k&&(x.set(S,T),b(T,S,i,_,x),x.delete(S)),r(t,n,T)}var r=n(192),o=n(194),a=n(195),s=n(197),l=n(198),u=n(27),c=n(36),h=n(201),d=n(37),f=n(50),p=n(51),g=n(202),v=n(40),m=n(203),y=n(204);t.exports=i},function(t,e,n){(function(t){function i(t,e){if(e)return t.slice();var n=t.length,i=u?u(n):new t.constructor(n);return t.copy(i),i}var r=n(31),o="object"==typeof e&&e&&!e.nodeType&&e,a=o&&"object"==typeof t&&t&&!t.nodeType&&t,s=a&&a.exports===o,l=s?r.Buffer:void 0,u=l?l.allocUnsafe:void 0;t.exports=i}).call(e,n(5)(t))},function(t,e,n){function i(t,e){var n=e?r(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var r=n(196);t.exports=i},function(t,e,n){function i(t){var e=new t.constructor(t.byteLength);return new r(e).set(new r(t)),e}var r=n(106);t.exports=i},function(t,e){function n(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++n1?n[r-1]:void 0,s=r>2?n[2]:void 0;for(a=t.length>3&&"function"==typeof a?(r--,a):void 0,s&&o(n[0],n[1],s)&&(a=r<3?void 0:a,r=1),e=Object(e);++i0){if(++e>=i)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var i=800,r=16,o=Date.now;t.exports=n},function(t,e,n){function i(t,e,n){if(!s(n))return!1;var i=typeof e;return!!("number"==i?o(n)&&a(e,n.length):"string"==i&&e in n)&&r(n[e],t)}var r=n(66),o=n(49),a=n(39),s=n(51);t.exports=i},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.TelemetryQuery=void 0;var r=n(146),o=i(r),a={_data_paths:{},_packet:null,_fields:[],_querying:!1,_validation_errors:{},_tlm_dict:null,oninit:function(t){var e=this;m.request({method:"GET",url:"/data"}).then(function(t){e._data_paths=t}),ait.tlm.promise.then(function(){"packet"in t.attrs&&(e._packet=t.attrs.packet)})},view:function(t){var e=this,n=void 0;"data-dir"in t.attrs?n=m("input",{type:"hidden",name:"dataDir",value:t.attrs["data-dir"]}):(n=m("div",{class:"form-group"},[m("label","Data Directory"),m("select",{class:"form-control",name:"dataDir"},[m("option",{disabled:"disabled",selected:"selected"},"Select an option ...")].concat((0,o.default)(Object.keys(this._data_paths),function(t){return m("option",{value:t},t+": "+e._data_paths[t])}))),m("p",{class:"help-block"},"The archive data directory containing the relevant telemetry data over which to search")]),this._validation_errors.dataDir&&(n.attrs.className+=" has-error"));var i=void 0;i="packet"in t.attrs?m("input",{type:"hidden",name:"packet",value:t.attrs.packet}):m("div",{class:"form-group"},[m("label","Telemetry Packet"),m("select",{class:"form-control",name:"packet",onchange:function(t){e._packet=t.currentTarget.value}},[m("option",{disabled:"disabled",selected:"selected"},"Select an option ...")].concat((0,o.default)(Object.keys(ait.tlm.dict),function(t){return m("option",{value:t},t)}))),m("p",{class:"help-block"},"The telemetry packet that contains the fields to be queried")]),this._validation_errors.packet&&(i.attrs.className+=" has-error");var r=null;r=null===this._packet?[]:[m("option",{disabled:"disabled",selected:"selected",value:"bogusDefaultSelectOption"},"Select an option ...")].concat((0,o.default)(Object.keys(ait.tlm.dict[this._packet].fields).sort(),function(t){return m("option",{value:t},t)}));var a=void 0;"time-field"in t.attrs?a=m("input",{type:"hidden",name:"timeField",value:t.attrs["time-field"]}):(a=m("div",{class:"form-group"},[m("label","Telemetry Time Field"),m("select",{class:"form-control",name:"timeField"},r),m("p",{class:"help-block"},"Select and add the telemetry time field to use as a basis for the query")]),this._validation_errors.timeField&&(a.attrs.className+=" has-error"));var s=m("div",{class:"form-group"},[m("label","Telemetry Fields"),m("div",{class:"input-group"},m("select",{class:"form-control",name:"fields"},r),m("div",{class:"input-group-btn"},m("button",{class:"btn btn-default",type:"button",onmousedown:function(t){t.preventDefault();var n=t.currentTarget.parentElement.parentElement.children[0];e._fields.push(n.value),n.value="bogusDefaultSelectOption"}},"Add"))),m("p",{class:"help-block"},"Select and add the telemetry field(s) to query")]);this._validation_errors.fields&&(s.attrs.className+=" has-error");var l=m("span");0!==this._fields.length&&(l=m("div",{class:"form-group"},[m("label","Fields selected for query"),m("div",{class:"field_selection"},(0,o.default)(this._fields,function(t,n){return m("div",{class:"label label-default field_label",onmouseover:function(t){t.currentTarget.classList.add("label-danger")},onmouseout:function(t){t.currentTarget.classList.remove("label-danger")},onclick:function(t){e._fields.splice(n,1)}},t)})),m("p",{class:"help-block"},"The telemetry points that will be filtered from the selected data")]));var u=m("div",{class:"form-group"},[m("label","Start Time"),m("input",{class:"form-control",placeholder:"Start time YYYY-MM-DDTHH:MM:SSZ",name:"startTime"}),m("p",{class:"help-block"},"Start time for data filtering. Expected format: YYYY-MM-DDTHH:MM:SSZ")]);this._validation_errors.startTime&&(u.attrs.className+=" has-error");var c=m("div",{class:"form-group"},[m("label","End Time"),m("input",{class:"form-control",placeholder:"End time YYYY-MM-DDTHH:MM:SSZ",name:"endTime"}),m("p",{class:"help-block"},"End time for data filtering. Expected format: YYYY-MM-DDTHH:MM:SSZ")]);this._validation_errors.endTime&&(c.attrs.className+=" has-error");var h="Query",d={class:"btn btn-success pull-right",type:"submit"};this._querying&&(h=m("span",{class:"glyphicon glyphicon-refresh right-spin"}),d.disabled="disabled");var f=m("button",d,h),p=m("form",{onsubmit:function(n){n.preventDefault();var i=new FormData,r=n.currentTarget;return!!e._validate_form(r)&&(i.append("dataDir",e._data_paths[r.elements.dataDir.value]),i.append("timeField",r.elements.timeField.value),i.append("packet",r.elements.packet.value),i.append("fields",e._fields),i.append("startTime",r.elements.startTime.value),i.append("endTime",r.elements.endTime.value),e._querying=!0,m.request({url:"/tlm/query",method:"POST",data:i,extract:function(t){return t}}).then(function(n){e._querying=!1;var i=new Blob([n.response]),o=document.createElement("a");o.href=window.URL.createObjectURL(i),o.download="query_output.csv",o.click(),r.reset(),"data-dir"in t.attrs||(r.elements.dataDir.selectedIndex=0),"packet"in t.attrs?r.elements.fields.selectedIndex=0:(r.elements.packet.selectedIndex=0,e._packet=null),"time-field"in t.attrs||(r.elements.timeField.selectedIndex=-1),e._fields=[]}).catch(function(t){e._querying=!1}),!1)}},[n,i,a,s,l,u,c,f]);return m("ait-telemetryquery",t.attrs,p)},_validate_form:function(t){this._validation_errors={},0===t.elements.dataDir.selectedIndex&&(this._validation_errors.dataDir=!0),0===t.elements.packet.selectedIndex&&(this._validation_errors.packet=!0),t.elements.timeField.selectedIndex!==-1&&0!==t.elements.timeField.selectedIndex||(this._validation_errors.timeField=!0),0===this._fields.length&&(this._validation_errors.fields=!0);var e=/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\dZ/;return e.test(t.elements.startTime.value)||(this._validation_errors.startTime=!0),e.test(t.elements.endTime.value)||(this._validation_errors.endTime=!0),0===Object.keys(this._validation_errors).length}};e.default={TelemetryQuery:a},e.TelemetryQuery=a},function(t,e,n){(function(t){"use strict";function i(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.MnemonicSearch=void 0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a=n(146),s=r(a),l=n(221),u=r(l),c=n(11),h=i(c),d=n(158),f=(r(d),n(14)),p=(r(f),n(156),n(157)),g={_packet:null,_selection:null,oninit:function(t){this._packet=t.attrs.packet,ait.tlm.search={dict:{}}},oncreate:function(e){var n=this;ait.tlm.promise.then(function(i){(0,u.default)(e.attrs,{"result-count":20});var r=function(t){return t?t.split("_"):[]};ait.tlm.search.dict=new p({datumTokenizer:r,queryTokenizer:r,local:(0,s.default)(i[n._packet].fields,function(t,e){return t.name}).sort()}),t('input[name="tlmsearch"]',e.dom).typeahead({highlight:!0},{name:"tlm-mnemonics",limit:e.attrs["result-count"],source:ait.tlm.search.dict}).bind("typeahead:select",function(i,r){n._selection=r,i.target.blur(),t('input[name="tlmsearch"]',e.dom).typeahead("val",""),ait.events.emit("modal:show",n._generateModalContent()),m.redraw()}).bind("typeahead:autocomplete",function(i,r){n._selection=r,i.target.blur(),t('input[name="tlmsearch"]',e.dom).typeahead("val",""),ait.events.emit("modal:show",n._generateModalContent()),m.redraw()}).bind("typeahead:close",function(n,i){n.target.blur(),t('input[name="tlmsearch"]',e.dom).typeahead("val",""),m.redraw()})})},_generateModalContent:function(){var t=this,e="N/A",n="N/A",i=h.datetime(new Date,{utc:!0,gps:!1}),r=ait.packets[this._packet]?ait.packets[this._packet].get(0):null;null!==r&&(e=r.__get__(this._selection),n=r.__get__(this._selection,!0));var a={},l=ait.tlm.dict[this._packet]._fields,u=ait.limits.dict[this._packet+"."+this._selection];if(this._selection in l){var c=l[this._selection];a.header=c.name,a.body=[];var d=c.desc?c.desc:"None";a.body.push(m("div",[m("b","Description: "),d,m("br")]));var f=c.type?c.type._name:"Unknown";a.body.push(m("div",[m("b","Data Type: "),f,m("br")]));var p="object"==o(c.bytes)?c.bytes[0]+" - "+c.bytes[1]:c.bytes;a.body.push(m("div",[m("b","Byte(s) in Packet: "),p,m("br")]));var g=c.mask?c.mask:"None";if(a.body.push(m("div",[m("b","Bit Mask: "),g,m("br")])),c.enum&&a.body.push(m("div",[m("b","Enumerated Values: "),(0,s.default)(c.enum,function(t,e){return m("div",[m("b"," "+e+": "),m("span",t),m("br")])})])),c.dntoeu&&a.body.push(m("div",[m("b","DN-to-EU: "),(0,s.default)(c.dntoeu,function(t,e){return m("div",[m("b"," "+e+": "),m("span",t),m("br")])})])),c.aliases&&a.body.push(m("div",[m("b","Aliases: "),(0,s.default)(c.aliases,function(t,e){return m("div",[m("b"," "+e+": "),m("span",t),m("br")])})])),u){var v=[];if(u.value)for(var y=["warn","error"],b=0;b2?e[2]:void 0;for(u&&o(e[0],e[1],u)&&(i=1);++nt?"before":"after")},start:function(t,e){t.dataTransfer.effectAllowed="move",this._from=e}},g={_active:0,_drag:null,_pos:[],_uid:[],anchor:function(t,e){var n=this,i={href:"#",class:"",draggable:this.isActive(e),ondragstart:function(t){return n._drag.start(t,e)},ondragend:function(t){return n._drag.end(t,e)}},r=t.attrs.title;return this.tabs&&Object.keys(this.tabs[r].___limit_error).length>0?i.class+=" tab_title--out-of-limit--error":this.tabs&&Object.keys(this.tabs[r].___limit_warning).length>0&&(i.class+=" tab_title--out-of-limit--warning"),(0,s.default)("a",i,t.attrs.title)},content:function(t,e){var n={key:this._uid[e]},i=this.isActive(e)?".tab-pane.active":".tab-pane";return(0,s.default)(i,n,t.children||t.text)},filterTabs:function(t){return t.filter(function(t){return"ait-tab"===t.tag})},isActive:function(t){return t===this._active},move:function(t,e){var n=this;if(t!==e){var i=this._pos.length,r=(0,f.default)(i,function(t){return t===n._active});u.move(this._pos,t,e),u.move(this._uid,t,e),u.move(r,t,e),this._active=r.findIndex(function(t){return t})}},oninit:function(t){var e=this.filterTabs(t.children);this._pos=(0,h.default)(e.length),this._uid=(0,h.default)(e.length),this._drag=Object.create(p)},filterFields:function(t){var e=[];if(!t)return e;var n=!0,i=!1,r=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;l.instance&&l.instance.tag&&"ait-field"===l.instance.tag?e.push(l.attrs.packet+"_"+l.attrs.name):l.children&&"object"===o(l.children)&&l.children.length>0&&(e=e.concat(this.filterFields(l.children)))}}catch(t){i=!0,r=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw r}}return e},oncreate:function(t){var e=this;this.tabs={};var n=!0,i=!1,r=void 0;try{for(var o,a=this.filterTabs(t.children)[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var s=o.value,l=s.attrs.title;this.tabs[l]={___limit_warning:{},___limit_error:{}};var u=!0,c=!1,h=void 0;try{for(var d,f=this.filterFields(s.children)[Symbol.iterator]();!(u=(d=f.next()).done);u=!0){var p=d.value;this.tabs[l][p]=null}}catch(t){c=!0,h=t}finally{try{!u&&f.return&&f.return()}finally{if(c)throw h}}}}catch(t){i=!0,r=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw r}}ait.events.on("field:limitOut",function(t){var n=t.field,i="___limit_"+t.type,r="___limit_"+("warning"===t.type?"error":"warning");for(var o in e.tabs)n in e.tabs[o]&&(e.tabs[o][i][n]=null,delete e.tabs[o][r][n])}),ait.events.on("field:limitIn",function(t){for(var n in e.tabs)t in e.tabs[n]&&(delete e.tabs[n].___limit_warning[t],delete e.tabs[n].___limit_error[t])})},reorder:function(t){return this._pos.map(function(e){return t[e]})},tab:function(t,e){var n=this,i=g.move.bind(this),r={class:this.tabClass(e),key:this._uid[e],onclick:function(){return n._active=e,!1},ondragover:function(t){return n._drag.over(t,e)},ondrop:function(t){return n._drag.drop(t,e,i)}};return(0,s.default)("li",r,this.anchor(t,e))},tabClass:function(t){var e="";return this.isActive(t)?e="active":this._drag.isOver(t)&&(e=this._drag.overClass(t)),e},view:function(t){var e=this.reorder(this.filterTabs(t.children));return(0,s.default)("ait-tabset",[(0,s.default)("ul.nav",t.attrs,e.map(g.tab.bind(this))),(0,s.default)(".tab-content",e.map(g.content.bind(this)))])}};e.default=g,e.TabSet=g},function(t,e){"use strict";function n(t,e,n){t.splice(n,0,t.splice(e,1)[0])}Object.defineProperty(e,"__esModule",{value:!0});var i=Object.assign;e.merge=i,e.move=n},function(t,e,n){var i=n(227),r=i();t.exports=r},function(t,e,n){function i(t){return function(e,n,i){return i&&"number"!=typeof i&&o(e,n,i)&&(n=i=void 0),e=a(e),void 0===n?(n=e,e=0):n=a(n),i=void 0===i?es)return[];var n=l,i=u(t,l);e=o(e),t-=l;for(var c=r(i,e);++n>=1}return a(t,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=null;return this.type&&(n=this.type.decode(t,this.offset),void 0!==this.mask&&null!==this.mask&&(n&=this.mask),this.shift>0&&(n>>=this.shift),e||void 0===this.enum||(n=this.enum[n])),n}}]),t}(),c=function(){function t(){r(this,t)}return a(t,[{key:"__get__",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=void 0;if(this._data instanceof DataView){var i=this._defn.fields[t];i&&(e||this._raw||!i.dntoeu?n=i.decode(this._data,e):i.dntoeu&&i.dntoeu.equation&&(n=this._defn.scope.eval(this,i.dntoeu.equation)))}return n}},{key:"__clone__",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.create(this._defn,e,n)}}],[{key:"create",value:function(e,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.name,o=this[r];return void 0===o&&(o=t.createSubclass(e),this[r]=o),new o(n,i)}},{key:"createSubclass",value:function(e){var n=function(t,n){this._defn=e,this._data=t,this._raw=n};n.prototype=Object.create(t.prototype),n.prototype.constructor=n;var i=function(t){Object.defineProperty(n.prototype,t,{get:function(){return this.__get__(t)}})};for(var r in e.fields)i(r);return n}}]),t}(),h=function(){function t(e){r(this,t),this._constants=e.constants,this._desc=e.desc,this._fields={},this._functions=e.functions,this._history=e.history,this._name=e.name,this._scope=new d(this),this._uid=e.uid;for(var n in e.fields)this._fields[n]=new u(e.fields[n])}return a(t,[{key:"constants",get:function(){return this._constants}},{key:"fields",get:function(){return this._fields}},{key:"functions",get:function(){return this._functions}},{key:"name",get:function(){return this._name}},{key:"scope",get:function(){return this._scope}},{key:"uid",get:function(){return this._uid}}],[{key:"parse",value:function(e){return"string"==typeof e&&(e=JSON.parse(e)),new t(e)}}]),t}(),d=function(){function t(e){r(this,t),this._defn=e,this._scope=new Function("\n eval('"+this.toCode()+"')\n return {\n 'eval': function(packet, expr) {\n var raw = packet.__clone__(packet._data, true)\n try {\n return eval(expr)\n } catch (e) {\n return null\n }\n }\n }\n ").call()}return a(t,[{key:"_sanitize",value:function(t){return t.replace("≤","<=").replace("≥",">=")}},{key:"_toBinaryCond",value:function(t){var e=/==|!=|<=|>=|<|>/g,n=t.match(e),i=t.split(e);return 2===n.length&&3===i.length?"("+i[0]+" "+n[0]+" "+i[1]+") && ("+i[1]+" "+n[1]+" "+i[2]+")":t}},{key:"eval",value:function(t,e){return this._scope.eval(t,e)}},{key:"toCode",value:function(){var t="";for(var e in this._defn.constants)t+="var "+e+" = "+this._defn.constants[e]+"; ";for(var n in this._defn.functions){var i=this._defn.functions[n];if(t+="function "+n+" { ","string"==typeof i)t+="return ("+i+") ";else if("object"===("undefined"==typeof i?"undefined":o(i)))for(var r in i){var a=this._toBinaryCond(this._sanitize(r));t+="if ("+a+") { return ("+i[r]+") } "}t+="};"}return t}}]),t}(),f=function(){function t(){r(this,t)}return a(t,[{key:"add",value:function(t){t instanceof h&&(this[t.name]=t)}}],[{key:"parse",value:function(e){var n=new t;"string"==typeof e&&(e=JSON.parse(e));for(var i in e)n.add(new h(e[i]));return n}}]),t}(),p=function(){function t(e,n){var i=this;r(this,t),this._dict={},this._interval=0,this._socket=new WebSocket(e),this._stale=0,this._url=e;for(var o in n){var a=n[o];this._dict[a.uid]=a}this._socket.binaryType="arraybuffer",this._socket.onclose=function(t){return i.onClose(t)},this._socket.onmessage=function(t){return i.onMessage(t)},this._socket.onopen=function(t){return i.onOpen(t)}}return a(t,[{key:"_emit",value:function(t,e){ait.events.emit("ait:tlm:"+t,e)}},{key:"onClose",value:function(t){clearInterval(this._interval),this._emit("close",this)}},{key:"onMessage",value:function(t){if(t.data instanceof ArrayBuffer){var e=new DataView(t.data,1,4).getUint32(0),n=new DataView(t.data,5),i=this._dict[e];if((0!=e||0!=n.byteLength)&&i){var r=c.create(i,n);clearInterval(this._interval),this._stale=0,this._interval=setInterval(this.onStale.bind(this),5e3),ait.packets.insert(i.name,r),this._emit("packet",r)}}}},{key:"onOpen",value:function(t){this._interval=setInterval(this.onStale.bind(this),5e3),this._stale=0,this._emit("open",this)}},{key:"onStale",value:function(){this._stale++,this._emit("stale",this)}}]),t}();e.FieldDefinition=u,e.Packet=c,e.PacketDefinition=h,e.PacketScope=d,e.TelemetryDictionary=f,e.TelemetryStream=p},function(t,e){"use strict";function n(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){return n+e<=t.byteLength}function a(t){var e=void 0;return t in y?e=y[t]:t.startsWith("ArrayType")&&(e=new h(t)),e}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:0;if(!o(t,2,e))return null;var n=ait.cmd.dict,i=t.getUint16(e,!1);return n?n.getByOpcode(i):i}},{key:"isTime",get:function(){return!1}}]),t}(),c=function(){function t(e){r(this,t),this._name=e}return s(t,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!o(t,2,e))return null;var n=ait.evr.dict,i=t.getUint16(e,!1);return n?n.getByCode(i):i}},{key:"isTime",get:function(){return!1}}]),t}(),h=function(){function t(e){r(this,t),this._elem_type=e.slice(11,e.indexOf("[")),this._prim_type=y[this._elem_type],this._num_elems=parseInt(e.slice(e.indexOf("[")+1,e.indexOf("]"))),this._name=e.slice(11,e.length-2),this._nbytes=this._num_elems*this._prim_type._nbytes}return s(t,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!o(t,this._nbytes,e))return null;for(var n=[],i=0;i1&&void 0!==arguments[1]?arguments[1]:0;return this._decode&&o(t,this._nbytes,e)?this._decode(t,e):null}},{key:"isTime",get:function(){return!1}}]),t}(),f=function(){function t(e){r(this,t),this._name=e}return s(t,[{key:"isTime",get:function(){return!0}}]),t}(),p=function(t){function e(){return r(this,e),n(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),s(e,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return o(t,1,e)?t.getUint8(e,!1)/256:null}}]),e}(f),g=function(t){function e(){return r(this,e),n(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),s(e,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!o(t,4,e))return null;var n=t.getUint32(e,!1);return new Date(l+1e3*n)}}]),e}(f),v=function(t){function e(){return r(this,e),n(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),s(e,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!o(t,8,e))return null;var n=t.getUint32(e,!1),i=t.getUint32(e+4,!1);return new Date(l+1e3*n+i/1e6)}}]),e}(f),m={I8:function(t,e){return t.getUint8(e)},U8:function(t,e){return t.getUint8(e)},LSB_I16:function(t,e){return t.getInt16(e,!0)},MSB_I16:function(t,e){return t.getInt16(e,!1)},LSB_U16:function(t,e){return t.getUint16(e,!0)},MSB_U16:function(t,e){return t.getUint16(e,!1)},LSB_I32:function(t,e){return t.getInt32(e,!0)},MSB_I32:function(t,e){return t.getInt32(e,!1)},LSB_U32:function(t,e){return t.getUint32(e,!0)},MSB_U32:function(t,e){return t.getUint32(e,!1)},LSB_F32:function(t,e){return t.getFloat32(e,!0)},MSB_F32:function(t,e){return t.getFloat32(e,!1)},LSB_D64:function(t,e){return t.getFloat64(e,!0)},MSB_D64:function(t,e){return t.getFloat64(e,!1)}},y={};Object.keys(m).map(function(t){y[t]=new d(t)}),y.CMD16=new u("CMD16"),y.EVR16=new c("EVR16"),y.TIME8=new p("TIME8"),y.TIME32=new g("TIME32"),y.TIME64=new v("TIME64"),e.get=a},function(t,e){},,,,,,,,,,,,,,,,,,,,,,,,,function(t,e,n){(function(t){/*! * Bootstrap v3.3.7 (http://getbootstrap.com) * Copyright 2011-2016 Twitter, Inc. * Licensed under the MIT license diff --git a/ait/gui/static/package.json b/ait/gui/static/package.json index 8e3acf11..f0bece2e 100644 --- a/ait/gui/static/package.json +++ b/ait/gui/static/package.json @@ -1,6 +1,6 @@ { "name": "ait-gui", - "version": "1.0.0", + "version": "1.1.0", "description": "AIT GUI", "main": "index.js", "scripts": { diff --git a/doc/source/conf.py b/doc/source/conf.py index c7cd6307..25fbfbda 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -70,9 +70,9 @@ # built documents. # # The short X.Y version. -version = u'1.0.0' +version = u'1.1.0' # The full version, including alpha/beta/rc tags. -release = u'1.0.0' +release = u'1.1.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index 8d1d5bed..cd30907e 100644 --- a/setup.py +++ b/setup.py @@ -85,7 +85,7 @@ def run(self): setup( name = 'ait-gui', - version = '1.0.0', + version = '1.1.0', description = description, long_description = long_description, long_description_content_type = 'text/x-rst',