(function(j){j.toJSON=function(w){if(typeof JSON=="object"&&JSON.stringify)return JSON.stringify(w);var u=typeof w;if(w===null)return"null";if(u!="undefined"){if(u=="number"||u=="boolean")return w+"";if(u=="string")return j.quoteString(w);if(u=="object"){if(typeof w.toJSON=="function")return j.toJSON(w.toJSON());if(w.constructor===Date){var g=w.getUTCMonth()+1;if(g<10)g="0"+g;var l=w.getUTCDate();if(l<10)l="0"+l;u=w.getUTCFullYear();var q=w.getUTCHours();if(q<10)q="0"+q;var v=w.getUTCMinutes();if(v<
10)v="0"+v;var A=w.getUTCSeconds();if(A<10)A="0"+A;w=w.getUTCMilliseconds();if(w<100)w="0"+w;if(w<10)w="0"+w;return'"'+u+"-"+g+"-"+l+"T"+q+":"+v+":"+A+"."+w+'Z"'}if(w.constructor===Array){g=[];for(l=0;l<w.length;l++)g.push(j.toJSON(w[l])||"null");return"["+g.join(",")+"]"}g=[];for(l in w){u=typeof l;if(u=="number")u='"'+l+'"';else if(u=="string")u=j.quoteString(l);else continue;if(typeof w[l]!="function"){q=j.toJSON(w[l]);g.push(u+":"+q)}}return"{"+g.join(", ")+"}"}}};j.evalJSON=function(w){if(typeof JSON==
"object"&&JSON.parse)return JSON.parse(w);return eval("("+w+")")};j.secureEvalJSON=function(w){if(typeof JSON=="object"&&JSON.parse)return JSON.parse(w);var u;u=w.replace(/\\["\\\/bfnrtu]/g,"@");u=u.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");u=u.replace(/(?:^|:|,)(?:\s*\[)+/g,"");if(/^[\],:{}\s]*$/.test(u))return eval("("+w+")");else throw new SyntaxError("Error parsing JSON, source is not valid.");};j.quoteString=function(w){if(w.match(ca))return'"'+w.replace(ca,
function(u){var g=X[u];if(typeof g==="string")return g;g=u.charCodeAt();return"\\u00"+Math.floor(g/16).toString(16)+(g%16).toString(16)})+'"';return'"'+w+'"'};var ca=/["\\\x00-\x1f\x7f-\x9f]/g,X={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"}})(jQuery);(function(j){function ca(){this._settings=[];this._extensions=[];this.regional=[];this.regional[""]={errorLoadingText:"Error loading"};this.local=this.regional[""];this._uuid=(new Date).getTime();this._ie=!!window.ActiveXObject}function X(g,l){this._svg=g;this._container=l;for(var q=0;q<j.svg._extensions.length;q++){var v=j.svg._extensions[q];this[v[0]]=new v[1](this)}}function w(){this._path=""}function u(){this._parts=[]}j.extend(ca.prototype,{markerClassName:"hasSVG",propertyName:"svgwrapper",
svgNS:"http://www.w3.org/2000/svg",xlinkNS:"http://www.w3.org/1999/xlink",_wrapperClass:X,_attrNames:{class_:"class",in_:"in",alignmentBaseline:"alignment-baseline",baselineShift:"baseline-shift",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorRendering:"color-rendering",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",
floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",
markerStart:"marker-start",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",underlinePosition:"underline-position",
underlineThickness:"underline-thickness",vertAdvY:"vert-adv-y",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode"},_attachSVG:function(g,l){var q=g.namespaceURI===this.svgNS?g:null;g=q?null:g;if(!j(g||q).hasClass(this.markerClassName)){if(typeof l==="string")l={loadURL:l};else if(typeof l==="function")l={onLoad:l};j(g||q).addClass(this.markerClassName);try{if(!q){q=document.createElementNS(this.svgNS,"svg");q.setAttribute("version","1.1");g.clientWidth>0&&q.setAttribute("width",
g.clientWidth);g.clientHeight>0&&q.setAttribute("height",g.clientHeight);g.appendChild(q)}this._afterLoad(g,q,l||{})}catch(v){j(g).html("<p>SVG is not supported natively on this browser</p>")}}},_afterLoad:function(g,l,q){q=q||this._settings[g.id];this._settings[g?g.id:""]=null;var v=new this._wrapperClass(l,g);j.data(g||l,j.svg.propertyName,v);try{q.loadURL&&v.load(q.loadURL,q);q.settings&&v.configure(q.settings);if(q.onLoad&&!q.loadURL)q.onLoad.apply(g||l,[v])}catch(A){alert(A)}},_getSVG:function(g){return j(g).data(this.propertyName)},
_destroySVG:function(g){g=j(g);if(g.hasClass(this.markerClassName)){g.removeClass(this.markerClassName).removeData(this.propertyName);g[0].namespaceURI!==this.svgNS&&g.empty()}},addExtension:function(g,l){this._extensions.push([g,l])},isSVGElem:function(g){return g.nodeType===1&&g.namespaceURI===j.svg.svgNS}});j.extend(X.prototype,{width:function(){return this._container?this._container.clientWidth:this._svg.width},height:function(){return this._container?this._container.clientHeight:this._svg.height},
root:function(){return this._svg},configure:function(g,l,q){if(!g.nodeName){q=l;l=g;g=this._svg}if(q)for(q=g.attributes.length-1;q>=0;q--){var v=g.attributes.item(q);v.nodeName==="onload"||v.nodeName==="version"||v.nodeName.substring(0,5)==="xmlns"||g.attributes.removeNamedItem(v.nodeName)}for(var A in l)g.setAttribute(j.svg._attrNames[A]||A,l[A]);return this},getElementById:function(g){return this._svg.ownerDocument.getElementById(g)},change:function(g,l){if(g)for(var q in l)l[q]==null?g.removeAttribute(j.svg._attrNames[q]||
q):g.setAttribute(j.svg._attrNames[q]||q,l[q]);return this},_args:function(g,l,q){l.splice(0,0,"parent");l.splice(l.length,0,"settings");var v={},A=0;if(g[0]!=null&&g[0].jquery)g[0]=g[0][0];if(g[0]!=null&&!(typeof g[0]==="object"&&g[0].nodeName)){v.parent=null;A=1}for(var M=0;M<g.length;M++)v[l[M+A]]=g[M];q&&j.each(q,function(x,J){if(typeof v[J]==="object"){v.settings=v[J];v[J]=null}});return v},title:function(){var g=this._args(arguments,["text"]),l=this._makeNode(g.parent,"title",g.settings||{});
l.appendChild(this._svg.ownerDocument.createTextNode(g.text));return l},describe:function(){var g=this._args(arguments,["text"]),l=this._makeNode(g.parent,"desc",g.settings||{});l.appendChild(this._svg.ownerDocument.createTextNode(g.text));return l},defs:function(){var g=this._args(arguments,["id"],["id"]);return this._makeNode(g.parent,"defs",j.extend(g.id?{id:g.id}:{},g.settings||{}))},symbol:function(){var g=this._args(arguments,["id","x1","y1","width","height"]);return this._makeNode(g.parent,
"symbol",j.extend({id:g.id,viewBox:g.x1+" "+g.y1+" "+g.width+" "+g.height},g.settings||{}))},marker:function(){var g=this._args(arguments,["id","refX","refY","mWidth","mHeight","orient"],["orient"]);return this._makeNode(g.parent,"marker",j.extend({id:g.id,refX:g.refX,refY:g.refY,markerWidth:g.mWidth,markerHeight:g.mHeight,orient:g.orient||"auto"},g.settings||{}))},style:function(){var g=this._args(arguments,["styles"]),l=this._makeNode(g.parent,"style",j.extend({type:"text/css"},g.settings||{}));
l.appendChild(this._svg.ownerDocument.createTextNode(g.styles));return l},script:function(){var g=this._args(arguments,["script","type"],["type"]),l=this._makeNode(g.parent,"script",j.extend({type:g.type||"text/javascript"},g.settings||{}));l.appendChild(this._svg.ownerDocument.createTextNode(g.script));j.svg._ie&&j.globalEval(g.script);return l},linearGradient:function(){var g=this._args(arguments,["id","stops","x1","y1","x2","y2"],["x1"]),l=j.extend({id:g.id},g.x1!=null?{x1:g.x1,y1:g.y1,x2:g.x2,
y2:g.y2}:{});return this._gradient(g.parent,"linearGradient",j.extend(l,g.settings||{}),g.stops)},radialGradient:function(){var g=this._args(arguments,["id","stops","cx","cy","r","fx","fy"],["cx"]),l=j.extend({id:g.id},g.cx!=null?{cx:g.cx,cy:g.cy,r:g.r,fx:g.fx,fy:g.fy}:{});return this._gradient(g.parent,"radialGradient",j.extend(l,g.settings||{}),g.stops)},_gradient:function(g,l,q,v){g=this._makeNode(g,l,q);for(l=0;l<v.length;l++){q=v[l];this._makeNode(g,"stop",j.extend({offset:q[0],stopColor:q[1]},
q[2]!=null?{stopOpacity:q[2]}:{}))}return g},pattern:function(){var g=this._args(arguments,["id","x","y","width","height","vx","vy","vwidth","vheight"],["vx"]),l=j.extend({id:g.id,x:g.x,y:g.y,width:g.width,height:g.height},g.vx!=null?{viewBox:g.vx+" "+g.vy+" "+g.vwidth+" "+g.vheight}:{});return this._makeNode(g.parent,"pattern",j.extend(l,g.settings||{}))},clipPath:function(){var g=this._args(arguments,["id","units"]);g.units=g.units||"userSpaceOnUse";return this._makeNode(g.parent,"clipPath",j.extend({id:g.id,
clipPathUnits:g.units},g.settings||{}))},mask:function(){var g=this._args(arguments,["id","x","y","width","height"]);return this._makeNode(g.parent,"mask",j.extend({id:g.id,x:g.x,y:g.y,width:g.width,height:g.height},g.settings||{}))},createPath:function(){return new w},createText:function(){return new u},svg:function(){var g=this._args(arguments,["x","y","width","height","vx","vy","vwidth","vheight"],["vx"]),l=j.extend({x:g.x,y:g.y,width:g.width,height:g.height},g.vx!=null?{viewBox:g.vx+" "+g.vy+
" "+g.vwidth+" "+g.vheight}:{});return this._makeNode(g.parent,"svg",j.extend(l,g.settings||{}))},group:function(){var g=this._args(arguments,["id"],["id"]);return this._makeNode(g.parent,"g",j.extend({id:g.id},g.settings||{}))},use:function(){var g=this._args(arguments,["x","y","width","height","ref"]);if(typeof g.x==="string"){g.ref=g.x;g.settings=g.y;g.x=g.y=g.width=g.height=null}var l=this._makeNode(g.parent,"use",j.extend({x:g.x,y:g.y,width:g.width,height:g.height},g.settings||{}));l.setAttributeNS(j.svg.xlinkNS,
"href",g.ref);return l},link:function(){var g=this._args(arguments,["ref"]),l=this._makeNode(g.parent,"a",g.settings);l.setAttributeNS(j.svg.xlinkNS,"href",g.ref);return l},image:function(){var g=this._args(arguments,["x","y","width","height","ref"]),l=this._makeNode(g.parent,"image",j.extend({x:g.x,y:g.y,width:g.width,height:g.height},g.settings||{}));l.setAttributeNS(j.svg.xlinkNS,"href",g.ref);return l},path:function(){var g=this._args(arguments,["path"]);return this._makeNode(g.parent,"path",
j.extend({d:g.path.path?g.path.path():g.path},g.settings||{}))},rect:function(){var g=this._args(arguments,["x","y","width","height","rx","ry"],["rx"]);return this._makeNode(g.parent,"rect",j.extend({x:g.x,y:g.y,width:g.width,height:g.height},g.rx?{rx:g.rx,ry:g.ry}:{},g.settings||{}))},circle:function(){var g=this._args(arguments,["cx","cy","r"]);return this._makeNode(g.parent,"circle",j.extend({cx:g.cx,cy:g.cy,r:g.r},g.settings||{}))},ellipse:function(){var g=this._args(arguments,["cx","cy","rx",
"ry"]);return this._makeNode(g.parent,"ellipse",j.extend({cx:g.cx,cy:g.cy,rx:g.rx,ry:g.ry},g.settings||{}))},line:function(){var g=this._args(arguments,["x1","y1","x2","y2"]);return this._makeNode(g.parent,"line",j.extend({x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2},g.settings||{}))},polyline:function(){var g=this._args(arguments,["points"]);return this._poly(g.parent,"polyline",g.points,g.settings)},polygon:function(){var g=this._args(arguments,["points"]);return this._poly(g.parent,"polygon",g.points,g.settings)},
_poly:function(g,l,q,v){for(var A="",M=0;M<q.length;M++)A+=q[M].join()+" ";return this._makeNode(g,l,j.extend({points:j.trim(A)},v||{}))},text:function(){var g=this._args(arguments,["x","y","value"]);if(typeof g.x==="string"&&arguments.length<4){g.value=g.x;g.settings=g.y;g.x=g.y=null}return this._text(g.parent,"text",g.value,j.extend({x:g.x&&j.isArray(g.x)?g.x.join(" "):g.x,y:g.y&&j.isArray(g.y)?g.y.join(" "):g.y},g.settings||{}))},textpath:function(){var g=this._args(arguments,["path","value"]),
l=this._text(g.parent,"textPath",g.value,g.settings||{});l.setAttributeNS(j.svg.xlinkNS,"href",g.path);return l},_text:function(g,l,q,v){g=this._makeNode(g,l,v);if(typeof q==="string")g.appendChild(g.ownerDocument.createTextNode(q));else for(l=0;l<q._parts.length;l++){v=q._parts[l];if(v[0]==="tspan"){var A=this._makeNode(g,v[0],v[2]);A.appendChild(g.ownerDocument.createTextNode(v[1]));g.appendChild(A)}else if(v[0]==="tref"){A=this._makeNode(g,v[0],v[2]);A.setAttributeNS(j.svg.xlinkNS,"href",v[1]);
g.appendChild(A)}else if(v[0]==="textpath"){A=j.extend({},v[2]);A.href=null;A=this._makeNode(g,v[0],A);A.setAttributeNS(j.svg.xlinkNS,"href",v[2].href);A.appendChild(g.ownerDocument.createTextNode(v[1]));g.appendChild(A)}else g.appendChild(g.ownerDocument.createTextNode(v[1]))}return g},other:function(){var g=this._args(arguments,["name"]);return this._makeNode(g.parent,g.name,g.settings||{})},_makeNode:function(g,l,q){g=g||this._svg;var v=this._svg.ownerDocument.createElementNS(j.svg.svgNS,l);for(l in q){var A=
q[l];if(A!=null&&(typeof A!=="string"||A!==""))v.setAttribute(j.svg._attrNames[l]||l,A)}g.appendChild(v);return v},add:function(g){var l=this._args(arguments.length===1?[null,g]:arguments,["node"]),q=this;l.parent=l.parent||this._svg;l.node=l.node.jquery?l.node:j(l.node);try{l.parent.appendChild(l.node.cloneNode(true))}catch(v){l.node.each(function(){var A=q._cloneAsSVG(this);A&&l.parent.appendChild(A)})}return this},clone:function(g){var l=this,q=this._args(arguments.length===1?[null,g]:arguments,
["node"]);q.parent=q.parent||this._svg;q.node=q.node.jquery?q.node:j(q.node);var v=[];q.node.each(function(){var A=l._cloneAsSVG(this);if(A){A.id="";q.parent.appendChild(A);v.push(A)}});return v},_cloneAsSVG:function(g){var l=null;if(g.nodeType===1){l=this._svg.ownerDocument.createElementNS(j.svg.svgNS,this._checkName(g.nodeName));for(var q=0;q<g.attributes.length;q++){var v=g.attributes.item(q);if(v.nodeName!=="xmlns"&&v.nodeValue)v.prefix==="xlink"?l.setAttributeNS(j.svg.xlinkNS,v.localName||v.baseName,
v.nodeValue):l.setAttribute(this._checkName(v.nodeName),v.nodeValue)}for(q=0;q<g.childNodes.length;q++)(v=this._cloneAsSVG(g.childNodes[q]))&&l.appendChild(v)}else if(g.nodeType===3){if(j.trim(g.nodeValue))l=this._svg.ownerDocument.createTextNode(g.nodeValue)}else if(g.nodeType===4)if(j.trim(g.nodeValue))try{l=this._svg.ownerDocument.createCDATASection(g.nodeValue)}catch(A){l=this._svg.ownerDocument.createTextNode(g.nodeValue.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"))}return l},
_checkName:function(g){g=g.substring(0,1)>="A"&&g.substring(0,1)<="Z"?g.toLowerCase():g;return g.substring(0,4)==="svg:"?g.substring(4):g},load:function(g,l){l=typeof l==="boolean"?{addTo:l}:typeof l==="function"?{onLoad:l}:typeof l==="string"?{parent:l}:typeof l==="object"&&l.nodeName?{parent:l}:typeof l==="object"&&l.jquery?{parent:l}:l||{};!l.parent&&!l.addTo&&this.clear(false);var q=[this._svg.getAttribute("width"),this._svg.getAttribute("height")],v=this,A=function(J){J=j.svg.local.errorLoadingText+
": "+J;l.onLoad?l.onLoad.apply(v._container||v._svg,[v,J]):v.text(null,10,20,J)},M=function(J){if(J)if(J.documentElement.nodeName!=="svg"){var H=J.getElementsByTagName("parsererror"),E=H.length?H[0].getElementsByTagName("div"):[];A(!H.length?"???":(E.length?E[0]:H[0]).firstChild.nodeValue)}else{H=l.parent?j(l.parent)[0]:v._svg;var B={};for(E=0;E<J.documentElement.attributes.length;E++){var z=J.documentElement.attributes.item(E);if(!(z.nodeName==="version"||z.nodeName.substring(0,5)==="xmlns"))B[z.nodeName]=
z.nodeValue}v.configure(H,B,!l.parent);J=J.documentElement.childNodes;for(E=0;E<J.length;E++)try{H.appendChild(v._svg.ownerDocument.importNode(J[E],true));J[E].nodeName==="script"&&j.globalEval(J[E].textContent)}catch(y){v.add(H,J[E])}if(!l.keepRelativeLinks&&g.match("/")){var Q=g.replace(/\/[^\/]*$/,"/");j("*",H).each(function(){var $=j(this).attr("xlink:href");$&&!$.match(/(^[a-z][-a-z0-9+.]*:.*$)|(^\/.*$)|(^#.*$)/i)&&j(this).attr("xlink:href",Q+$)})}l.changeSize||v.configure(H,{width:q[0],height:q[1]});
if(l.onLoad)l.onLoad.apply(v._container||v._svg,[v])}};if(g.match("<svg"))try{M((new DOMParser).parseFromString(g,"text/xml"))}catch(x){A(x)}else j.ajax({url:g,dataType:"xml",success:function(J){M(J)},error:function(J,H,E){A(H+(E?" "+E.message:""))}});return this},remove:function(g){g=g.jquery?g[0]:g;g.parentNode.removeChild(g);return this},clear:function(g){for(g&&this.configure({},true);this._svg.firstChild;)this._svg.removeChild(this._svg.firstChild);return this},toSVG:function(g){g=g||this._svg;
return typeof XMLSerializer==="undefined"?this._toSVG(g):(new XMLSerializer).serializeToString(g)},_toSVG:function(g){var l="";if(!g)return l;if(g.nodeType===3)l=g.nodeValue;else if(g.nodeType===4)l="<![CDATA["+g.nodeValue+"]]\>";else{l="<"+g.nodeName;if(g.attributes)for(var q=0;q<g.attributes.length;q++){var v=g.attributes.item(q);j.trim(v.nodeValue)===""||v.nodeValue.match(/^\[object/)||v.nodeValue.match(/^function/)||(l+=" "+(v.namespaceURI===j.svg.xlinkNS?"xlink:":"")+v.nodeName+'="'+v.nodeValue+
'"')}if(g.firstChild){l+=">";for(q=g.firstChild;q;){l+=this._toSVG(q);q=q.nextSibling}l+="</"+g.nodeName+">"}else l+="/>"}return l}});j.extend(w.prototype,{reset:function(){this._path="";return this},move:function(g,l,q){q=j.isArray(g)?l:q;return this._coords(q?"m":"M",g,l)},line:function(g,l,q){q=j.isArray(g)?l:q;return this._coords(q?"l":"L",g,l)},horiz:function(g,l){this._path+=(l?"h":"H")+(j.isArray(g)?g.join(" "):g);return this},vert:function(g,l){this._path+=(l?"v":"V")+(j.isArray(g)?g.join(" "):
g);return this},curveC:function(g,l,q,v,A,M,x){x=j.isArray(g)?l:x;return this._coords(x?"c":"C",g,l,q,v,A,M)},smoothC:function(g,l,q,v,A){A=j.isArray(g)?l:A;return this._coords(A?"s":"S",g,l,q,v)},curveQ:function(g,l,q,v,A){A=j.isArray(g)?l:A;return this._coords(A?"q":"Q",g,l,q,v)},smoothQ:function(g,l,q){q=j.isArray(g)?l:q;return this._coords(q?"t":"T",g,l)},_coords:function(g,l,q,v,A,M,x){if(j.isArray(l))for(q=0;q<l.length;q++){v=l[q];this._path+=(q===0?g:" ")+v[0]+","+v[1]+(v.length<4?"":" "+v[2]+
","+v[3]+(v.length<6?"":" "+v[4]+","+v[5]))}else this._path+=g+l+","+q+(v==null?"":" "+v+","+A+(M==null?"":" "+M+","+x));return this},arc:function(g,l,q,v,A,M,x,J){J=j.isArray(g)?l:J;this._path+=J?"a":"A";if(j.isArray(g))for(l=0;l<g.length;l++){q=g[l];this._path+=(l===0?"":" ")+q[0]+","+q[1]+" "+q[2]+" "+(q[3]?"1":"0")+","+(q[4]?"1":"0")+" "+q[5]+","+q[6]}else this._path+=g+","+l+" "+q+" "+(v?"1":"0")+","+(A?"1":"0")+" "+M+","+x;return this},close:function(){this._path+="z";return this},path:function(){return this._path}});
w.prototype.moveTo=w.prototype.move;w.prototype.lineTo=w.prototype.line;w.prototype.horizTo=w.prototype.horiz;w.prototype.vertTo=w.prototype.vert;w.prototype.curveCTo=w.prototype.curveC;w.prototype.smoothCTo=w.prototype.smoothC;w.prototype.curveQTo=w.prototype.curveQ;w.prototype.smoothQTo=w.prototype.smoothQ;w.prototype.arcTo=w.prototype.arc;j.extend(u.prototype,{reset:function(){this._parts=[];return this},string:function(g){this._parts.push(["text",g]);return this},span:function(g,l){this._parts.push(["tspan",
g,l]);return this},ref:function(g,l){this._parts.push(["tref",g,l]);return this},path:function(g,l,q){this._parts.push(["textpath",l,j.extend({href:g},q||{})]);return this}});j.fn.svg=function(g){var l=Array.prototype.slice.call(arguments,1);if(typeof g==="string"&&g==="get")return j.svg["_"+g+"SVG"].apply(j.svg,[this[0]].concat(l));return this.each(function(){typeof g==="string"?j.svg["_"+g+"SVG"].apply(j.svg,[this].concat(l)):j.svg._attachSVG(this,g||{})})};j.svg=new ca})(jQuery);(function(j){function ca(w){return(!j.svg.isSVGElem(w)?w.className:w.className?w.className.baseVal:w.getAttribute("class"))||""}function X(w,u){w.className?w.className.baseVal=u:w.setAttribute("class",u)}j.fn.addClass=function(w){return function(u){if(j.isFunction(u))return this.each(function(l){j(this).addClass(u.call(this,l,ca(this)))});var g=arguments;u=u||"";return this.each(function(){if(j.svg.isSVGElem(this)){var l=this;j.each(u.split(/\s+/),function(q,v){var A=ca(l);if(j.inArray(v,A.split(/\s+/))===
-1)X(l,A+((A?" ":"")+v))})}else w.apply(j(this),g)})}}(j.fn.addClass);j.fn.removeClass=function(w){return function(u){if(j.isFunction(u))return this.each(function(l){j(this).removeClass(u.call(this,l,ca(this)))});var g=arguments;u=u||"";return this.each(function(){if(j.svg.isSVGElem(this)){var l=this;j.each(u.split(/\s+/),function(q,v){var A=ca(l);A=j.grep(A.split(/\s+/),function(M){return M!==v}).join(" ");X(l,A)})}else w.apply(j(this),g)})}}(j.fn.removeClass);j.fn.toggleClass=function(w){return function(u,
g){if(j.isFunction(u))return this.each(function(v){j(this).toggleClass(u.call(this,v,ca(this),g),g)});var l=arguments,q=typeof g==="boolean";return this.each(function(){if(j.svg.isSVGElem(this))if(typeof u==="string"){var v=j(this);j.each(u.split(/\s+/),function(M,x){q||(g=!v.hasClass(x));v[(g?"add":"remove")+"Class"](x)})}else{var A=ca(this);A&&j._data(this,"__className__",A);X(this,A||u===false?"":j._data(this,"__className__")||"")}else w.apply(j(this),l)})}}(j.fn.toggleClass);j.fn.hasClass=function(w){return function(u){u=
u||"";var g=false;this.each(function(){g=j.svg.isSVGElem(this)?j.inArray(u,ca(this).split(/\s+/))>-1:w.apply(j(this),[u]);return!g});return g}}(j.fn.hasClass);j.fn.attr=function(w){return function(u,g,l){if(typeof u==="string"&&g===undefined){var q=w.apply(this,arguments);if(q&&q.baseVal&&q.baseVal.numberOfItems!=null){g="";q=q.baseVal;if(u==="transform"){for(var v=0;v<q.numberOfItems;v++){var A=q.getItem(v);switch(A.type){case 1:g+=" matrix("+A.matrix.a+","+A.matrix.b+","+A.matrix.c+","+A.matrix.d+
","+A.matrix.e+","+A.matrix.f+")";break;case 2:g+=" translate("+A.matrix.e+","+A.matrix.f+")";break;case 3:g+=" scale("+A.matrix.a+","+A.matrix.d+")";break;case 4:g+=" rotate("+A.angle+")";break;case 5:g+=" skewX("+A.angle+")";break;case 6:g+=" skewY("+A.angle+")"}}q=g.substring(1)}else q=q.getItem(0).valueAsString}return q&&q.baseVal?q.baseVal.valueAsString:q}var M=u;if(typeof u==="string"){M={};M[u]=g}if(j.isFunction(g))return j(this).each(function(J){j(this).attr(u,g.call(this,J,j(this).attr(u)))});
var x=arguments;return j(this).each(function(){if(j.svg.isSVGElem(this))for(var J in M)l?this.style[J]=M[J]:this.setAttribute(J,M[J]);else w.apply(j(this),x)})}}(j.fn.attr);j.fn.removeAttr=function(w){return function(u){var g=arguments;return this.each(function(){if(j.svg.isSVGElem(this)){var l=this;j.each(u.split(/\s+/),function(q,v){l[v]&&l[v].baseVal?l[v].baseVal.value=null:l.removeAttribute(v)})}else w.apply(j(this),g)})}}(j.fn.removeAttr);j.extend(j.cssNumber,{stopOpacity:true,strokeMitrelimit:true,
strokeOpacity:true});if(j.cssProps)j.css=function(w){return function(u,g,l,q){return(g.match(/^svg.*/)?j(u).attr(j.cssProps[g]||g):"")||w(u,g,l,q)}}(j.css)})(jQuery);(function(j){if(typeof exports=="object"&&typeof module=="object")module.exports=j();else if(typeof define=="function"&&define.amd)return define([],j);else this.CodeMirror=j()})(function(){function j(a,b){if(!(this instanceof j))return new j(a,b);this.options=b=b?zb(b):{};zb(wf,b,false);J(b);var c=b.value;if(typeof c=="string")c=new Ya(c,b.mode);this.doc=c;var d=this.display=new ca(a,c);d.wrapper.CodeMirror=this;v(this);l(this);if(b.lineWrapping)this.display.wrapper.className+=" CodeMirror-wrap";
b.autofocus&&!Gd&&$a(this);z(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,focused:false,suppressEdits:false,pasteIncoming:false,cutIncoming:false,draggingText:false,highlight:new Tc,keySeq:null};va&&Fa<11&&setTimeout(ob(gb,this,true),20);xf(this);if(!le){yf();le=true}Lb(this);this.curOp.forceUpdate=true;me(this,c);b.autofocus&&!Gd||Ab()==d.input?setTimeout(ob(Hd,this),20):Uc(this);for(var e in $b)if($b.hasOwnProperty(e))$b[e](this,b[e],ne);cb(this);for(c=0;c<Id.length;++c)Id[c](this);
Mb(this);if(Na&&b.lineWrapping&&getComputedStyle(d.lineDiv).textRendering=="optimizelegibility")d.lineDiv.style.textRendering="auto"}function ca(a,b){var c=this.input=ga("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");if(Na)c.style.width="1000px";else c.setAttribute("wrap","off");if(rc)c.style.border="1px solid black";c.setAttribute("autocorrect","off");c.setAttribute("autocapitalize","off");c.setAttribute("spellcheck","false");this.inputDiv=ga("div",
[c],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");this.scrollbarFiller=ga("div",null,"CodeMirror-scrollbar-filler");this.scrollbarFiller.setAttribute("not-content","true");this.gutterFiller=ga("div",null,"CodeMirror-gutter-filler");this.gutterFiller.setAttribute("not-content","true");this.lineDiv=ga("div",null,"CodeMirror-code");this.selectionDiv=ga("div",null,null,"position: relative; z-index: 1");this.cursorDiv=ga("div",null,"CodeMirror-cursors");this.measure=ga("div",null,
"CodeMirror-measure");this.lineMeasure=ga("div",null,"CodeMirror-measure");this.lineSpace=ga("div",[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");this.mover=ga("div",[ga("div",[this.lineSpace],"CodeMirror-lines")],null,"position: relative");this.sizer=ga("div",[this.mover],"CodeMirror-sizer");this.sizerWidth=null;this.heightForcer=ga("div",null,null,"position: absolute; height: "+oe+"px; width: 1px;");this.gutters=ga("div",null,
"CodeMirror-gutters");this.lineGutter=null;this.scroller=ga("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex","-1");this.wrapper=ga("div",[this.inputDiv,this.scrollbarFiller,this.gutterFiller,this.scroller],"CodeMirror");if(va&&Fa<8){this.gutters.style.zIndex=-1;this.scroller.style.paddingRight=0}if(rc)c.style.width="0px";if(!Na)this.scroller.draggable=true;if(Jd){this.inputDiv.style.height="1px";this.inputDiv.style.position="absolute"}if(a)a.appendChild?
a.appendChild(this.wrapper):a(this.wrapper);this.reportedViewFrom=this.reportedViewTo=this.viewFrom=this.viewTo=b.first;this.view=[];this.externalMeasured=this.renderedView=null;this.lastWrapHeight=this.lastWrapWidth=this.viewOffset=0;this.updateLineNumbers=null;this.nativeBarWidth=this.barHeight=this.barWidth=0;this.scrollbarsClipped=false;this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=null;this.prevInput="";this.pollingFast=this.alignWidgets=false;this.poll=new Tc;this.cachedCharWidth=
this.cachedTextHeight=this.cachedPaddingH=null;this.inaccurateSelection=false;this.maxLine=null;this.maxLineLength=0;this.maxLineChanged=false;this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null;this.shift=false;this.selForContextMenu=null}function X(a){a.doc.mode=j.getMode(a.options,a.doc.modeOption);w(a)}function w(a){a.doc.iter(function(b){if(b.stateAfter)b.stateAfter=null;if(b.styles)b.styles=null});a.doc.frontier=a.doc.first;db(a,100);a.state.modeGen++;a.curOp&&ab(a)}function u(a){var b=
vb(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/sc(a.display)-3);return function(e){if(Nb(a.doc,e))return 0;var f=0;if(e.widgets)for(var h=0;h<e.widgets.length;h++)if(e.widgets[h].height)f+=e.widgets[h].height;return c?f+(Math.ceil(e.text.length/d)||1)*b:f+b}}function g(a){var b=a.doc,c=u(a);b.iter(function(d){var e=c(d);e!=d.height&&pb(d,e)})}function l(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g,
" cm-s-");aa(a)}function q(a){v(a);ab(a);setTimeout(function(){Ga(a)},20)}function v(a){var b=a.display.gutters,c=a.options.gutters;Ob(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(ga("div",null,"CodeMirror-gutter "+e));if(e=="CodeMirror-linenumbers"){a.display.lineGutter=f;f.style.width=(a.display.lineNumWidth||1)+"px"}}b.style.display=d?"":"none";A(a)}function A(a){a.display.sizer.style.marginLeft=a.display.gutters.offsetWidth+"px"}function M(a){if(a.height==0)return 0;for(var b=a.text.length,
c,d=a;c=Pb(d,true);){c=c.find(0,true);d=c.from.line;b+=c.from.ch-c.to.ch}for(d=a;c=Pb(d,false);){c=c.find(0,true);b-=d.text.length-c.from.ch;d=c.to.line;b+=d.text.length-c.to.ch}return b}function x(a){var b=a.display;a=a.doc;b.maxLine=ha(a,a.first);b.maxLineLength=M(b.maxLine);b.maxLineChanged=true;a.iter(function(c){var d=M(c);if(d>b.maxLineLength){b.maxLineLength=d;b.maxLine=c}})}function J(a){var b=Ua(a.gutters,"CodeMirror-linenumbers");if(b==-1&&a.lineNumbers)a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]);
else if(b>-1&&!a.lineNumbers){a.gutters=a.gutters.slice(0);a.gutters.splice(b,1)}}function H(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+(a.display.mover.offsetHeight-a.display.lineSpace.offsetHeight));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+Za(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,
gutterWidth:c}}function E(a,b,c){this.cm=c;var d=this.vert=ga("div",[ga("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=ga("div",[ga("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a(d);a(e);qa(d,"scroll",function(){d.clientHeight&&b(d.scrollTop,"vertical")});qa(e,"scroll",function(){e.clientWidth&&b(e.scrollLeft,"horizontal")});this.checkedOverlay=false;if(va&&Fa<8)this.horiz.style.minHeight=this.vert.style.minWidth="18px"}function B(){}function z(a){if(a.display.scrollbars){a.display.scrollbars.clear();
a.display.scrollbars.addClass&&tc(a.display.wrapper,a.display.scrollbars.addClass)}a.display.scrollbars=new j.scrollbarModel[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller);qa(b,"mousedown",function(){a.state.focused&&setTimeout(ob($a,a),0)});b.setAttribute("not-content","true")},function(b,c){c=="horizontal"?ac(a,b):uc(a,b)},a);a.display.scrollbars.addClass&&vc(a.display.wrapper,a.display.scrollbars.addClass)}function y(a,b){b||(b=H(a));var c=a.display.barWidth,
d=a.display.barHeight;Q(a,b);for(var e=0;e<4&&c!=a.display.barWidth||d!=a.display.barHeight;e++){c!=a.display.barWidth&&a.options.lineWrapping&&G(a);Q(a,H(a));c=a.display.barWidth;d=a.display.barHeight}}function Q(a,b){var c=a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+"px";c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px";if(d.right&&d.bottom){c.scrollbarFiller.style.display="block";c.scrollbarFiller.style.height=d.bottom+"px";c.scrollbarFiller.style.width=
d.right+"px"}else c.scrollbarFiller.style.display="";if(d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter){c.gutterFiller.style.display="block";c.gutterFiller.style.height=d.bottom+"px";c.gutterFiller.style.width=b.gutterWidth+"px"}else c.gutterFiller.style.display=""}function $(a,b,c){var d=c&&c.top!=null?Math.max(0,c.top):a.scroller.scrollTop;d=Math.floor(d-a.lineSpace.offsetTop);var e=c&&c.bottom!=null?c.bottom:d+a.wrapper.clientHeight;d=Qb(b,d);e=Qb(b,e);if(c&&c.ensure){var f=
c.ensure.from.line;c=c.ensure.to.line;if(f<d){d=f;e=Qb(b,wb(ha(b,f))+a.wrapper.clientHeight)}else if(Math.min(c,b.lastLine())>=e){d=Qb(b,wb(ha(b,c))-a.wrapper.clientHeight);e=c}}return{from:d,to:Math.max(e,d+1)}}function Ga(a){var b=a.display,c=b.view;if(!(!b.alignWidgets&&(!b.gutters.firstChild||!a.options.fixedGutter))){for(var d=Va(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",h=0;h<c.length;h++)if(!c[h].hidden){if(a.options.fixedGutter&&c[h].gutter)c[h].gutter.style.left=
f;var i=c[h].alignable;if(i)for(var k=0;k<i.length;k++)i[k].style.left=f}if(a.options.fixedGutter)b.gutters.style.left=d+e+"px"}}function cb(a){if(!a.options.lineNumbers)return false;var b=a.doc;b=String(a.options.lineNumberFormatter(b.first+b.size-1+a.options.firstLineNumber));var c=a.display;if(b.length!=c.lineNumChars){var d=c.measure.appendChild(ga("div",[ga("div",b)],"CodeMirror-linenumber CodeMirror-gutter-elt")),e=d.firstChild.offsetWidth;d=d.offsetWidth-e;c.lineGutter.style.width="";c.lineNumInnerWidth=
Math.max(e,c.lineGutter.offsetWidth-d);c.lineNumWidth=c.lineNumInnerWidth+d;c.lineNumChars=c.lineNumInnerWidth?b.length:-1;c.lineGutter.style.width=c.lineNumWidth+"px";A(a);return true}return false}function Va(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function Ja(a,b,c){var d=a.display;this.viewport=b;this.visible=$(d,a.doc,b);this.editorIsHidden=!d.wrapper.offsetWidth;this.wrapperHeight=d.wrapper.clientHeight;this.wrapperWidth=d.wrapper.clientWidth;this.oldDisplayWidth=
hb(a);this.force=c;this.dims=ba(a)}function Ea(a,b){var c=a.display,d=a.doc;if(b.editorIsHidden){Bb(a);return false}if(!b.force&&b.visible.from>=c.viewFrom&&b.visible.to<=c.viewTo&&(c.updateLineNumbers==null||c.updateLineNumbers>=c.viewTo)&&c.renderedView==c.view&&pe(a)==0)return false;if(cb(a)){Bb(a);b.dims=ba(a)}var e=d.first+d.size,f=Math.max(b.visible.from-a.options.viewportMargin,d.first),h=Math.min(e,b.visible.to+a.options.viewportMargin);if(c.viewFrom<f&&f-c.viewFrom<20)f=Math.max(d.first,
c.viewFrom);if(c.viewTo>h&&c.viewTo-h<20)h=Math.min(e,c.viewTo);if(Cb){f=Kd(a.doc,f);h=qe(a.doc,h)}d=f!=c.viewFrom||h!=c.viewTo||c.lastWrapHeight!=b.wrapperHeight||c.lastWrapWidth!=b.wrapperWidth;e=a.display;if(e.view.length==0||f>=e.viewTo||h<=e.viewFrom){e.view=Vc(a,f,h);e.viewFrom=f}else{if(e.viewFrom>f)e.view=Vc(a,f,e.viewFrom).concat(e.view);else if(e.viewFrom<f)e.view=e.view.slice(wc(a,f));e.viewFrom=f;if(e.viewTo<h)e.view=e.view.concat(Vc(a,e.viewTo,h));else if(e.viewTo>h)e.view=e.view.slice(0,
wc(a,h))}e.viewTo=h;c.viewOffset=wb(ha(a.doc,c.viewFrom));a.display.mover.style.top=c.viewOffset+"px";h=pe(a);if(!d&&h==0&&!b.force&&c.renderedView==c.view&&(c.updateLineNumbers==null||c.updateLineNumbers>=c.viewTo))return false;f=Ab();if(h>4)c.lineDiv.style.display="none";wa(a,c.updateLineNumbers,b.dims);if(h>4)c.lineDiv.style.display="";c.renderedView=c.view;f&&Ab()!=f&&f.offsetHeight&&f.focus();Ob(c.cursorDiv);Ob(c.selectionDiv);c.gutters.style.height=0;if(d){c.lastWrapHeight=b.wrapperHeight;c.lastWrapWidth=
b.wrapperWidth;db(a,400)}c.updateLineNumbers=null;return true}function S(a,b){for(var c=b.viewport,d=true;;d=false){if(!(d&&a.options.lineWrapping&&b.oldDisplayWidth!=hb(a))){if(c&&c.top!=null)c={top:Math.min(a.doc.height+(a.display.mover.offsetHeight-a.display.lineSpace.offsetHeight)-Db(a),c.top)};b.visible=$(a.display,a.doc,c);if(b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break}if(!Ea(a,b))break;G(a);d=H(a);Rb(a);C(a,d);y(a,d)}Qa(a,"update",a);if(a.display.viewFrom!=a.display.reportedViewFrom||
a.display.viewTo!=a.display.reportedViewTo){Qa(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo);a.display.reportedViewFrom=a.display.viewFrom;a.display.reportedViewTo=a.display.viewTo}}function T(a,b){var c=new Ja(a,b);if(Ea(a,c)){G(a);S(a,c);c=H(a);Rb(a);C(a,c);y(a,c)}}function C(a,b){a.display.sizer.style.minHeight=b.docHeight+"px";var c=b.docHeight+a.display.barHeight;a.display.heightForcer.style.top=c+"px";a.display.gutters.style.height=Math.max(c+Za(a),b.clientHeight)+"px"}function G(a){a=
a.display;for(var b=a.lineDiv.offsetTop,c=0;c<a.view.length;c++){var d=a.view[c],e;if(!d.hidden){if(va&&Fa<8){var f=d.node.offsetTop+d.node.offsetHeight;e=f-b;b=f}else{e=d.node.getBoundingClientRect();e=e.bottom-e.top}f=d.line.height-e;if(e<2)e=vb(a);if(f>0.001||f<-0.001){pb(d.line,e);O(d.line);if(d.rest)for(e=0;e<d.rest.length;e++)O(d.rest[e])}}}}function O(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.offsetHeight}function ba(a){for(var b=a.display,c={},
d={},e=b.gutters.clientLeft,f=b.gutters.firstChild,h=0;f;f=f.nextSibling,++h){c[a.options.gutters[h]]=f.offsetLeft+f.clientLeft+e;d[a.options.gutters[h]]=f.clientWidth}return{fixedPos:Va(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function wa(a,b,c){function d(p){var D=p.nextSibling;if(Na&&ib&&a.display.currentWheelTarget==p)p.style.display="none";else p.parentNode.removeChild(p);return D}var e=a.display,f=a.options.lineNumbers,h=e.lineDiv,
i=h.firstChild,k=e.view;e=e.viewFrom;for(var m=0;m<k.length;m++){var o=k[m];if(!o.hidden)if(o.node){for(;i!=o.node;)i=d(i);i=f&&b!=null&&b<=e&&o.lineNumber;if(o.changes){if(Ua(o.changes,"gutter")>-1)i=false;ra(a,o,e,c)}if(i){Ob(o.lineNumber);o.lineNumber.appendChild(document.createTextNode(String(a.options.lineNumberFormatter(e+a.options.firstLineNumber))))}i=o.node.nextSibling}else{var t=ua(a,o,e,c);h.insertBefore(t,i)}e+=o.size}for(;i;)i=d(i)}function ra(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=
b.changes[e];if(f=="text"){f=b;var h=f.text.className,i=Z(a,f);if(f.text==f.node)f.node=i.pre;f.text.parentNode.replaceChild(i.pre,f.text);f.text=i.pre;if(i.bgClass!=f.bgClass||i.textClass!=f.textClass){f.bgClass=i.bgClass;f.textClass=i.textClass;ma(f)}else if(h)f.text.className=h}else if(f=="gutter")Aa(a,b,c,d);else if(f=="class")ma(b);else if(f=="widget"){f=b;h=d;if(f.alignable)f.alignable=null;i=f.node.firstChild;for(var k=void 0;i;i=k){k=i.nextSibling;i.className=="CodeMirror-linewidget"&&f.node.removeChild(i)}P(f,
h)}}b.changes=null}function la(a){if(a.node==a.text){a.node=ga("div",null,null,"position: relative");a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text);a.node.appendChild(a.text);if(va&&Fa<8)a.node.style.zIndex=2}return a.node}function Z(a,b){var c=a.display.externalMeasured;if(c&&c.line==b.line){a.display.externalMeasured=null;b.measure=c.measure;return c.built}return re(a,b)}function ma(a){var b=a.bgClass?a.bgClass+" "+(a.line.bgClass||""):a.line.bgClass;if(b)b+=" CodeMirror-linebackground";
if(a.background)if(b)a.background.className=b;else{a.background.parentNode.removeChild(a.background);a.background=null}else if(b){var c=la(a);a.background=c.insertBefore(ga("div",null,b),c.firstChild)}if(a.line.wrapClass)la(a).className=a.line.wrapClass;else if(a.node!=a.text)a.node.className="";a.text.className=(a.textClass?a.textClass+" "+(a.line.textClass||""):a.line.textClass)||""}function Aa(a,b,c,d){if(b.gutter){b.node.removeChild(b.gutter);b.gutter=null}var e=b.line.gutterMarkers;if(a.options.lineNumbers||
e){var f=la(b);f=b.gutter=f.insertBefore(ga("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px; width: "+d.gutterTotalWidth+"px"),b.text);if(b.line.gutterClass)f.className+=" "+b.line.gutterClass;if(a.options.lineNumbers&&(!e||!e["CodeMirror-linenumbers"]))b.lineNumber=f.appendChild(ga("div",String(a.options.lineNumberFormatter(c+a.options.firstLineNumber)),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+
"px; width: "+a.display.lineNumInnerWidth+"px"));if(e)for(b=0;b<a.options.gutters.length;++b){c=a.options.gutters[b];var h=e.hasOwnProperty(c)&&e[c];h&&f.appendChild(ga("div",[h],"CodeMirror-gutter-elt","left: "+d.gutterLeft[c]+"px; width: "+d.gutterWidth[c]+"px"))}}}function ua(a,b,c,d){var e=Z(a,b);b.text=b.node=e.pre;if(e.bgClass)b.bgClass=e.bgClass;if(e.textClass)b.textClass=e.textClass;ma(b);Aa(a,b,c,d);P(b,d);return b.node}function P(a,b){V(a.line,a,b,true);if(a.rest)for(var c=0;c<a.rest.length;c++)V(a.rest[c],
a,b,false)}function V(a,b,c,d){if(a.widgets){var e=la(b),f=0;for(a=a.widgets;f<a.length;++f){var h=a[f],i=ga("div",[h.node],"CodeMirror-linewidget");h.handleMouseEvents||i.setAttribute("cm-ignore-events","true");var k=h,m=i,o=c;if(k.noHScroll){(b.alignable||(b.alignable=[])).push(m);var t=o.wrapperWidth;m.style.left=o.fixedPos+"px";if(!k.coverGutter){t-=o.gutterTotalWidth;m.style.paddingLeft=o.gutterTotalWidth+"px"}m.style.width=t+"px"}if(k.coverGutter){m.style.zIndex=5;m.style.position="relative";
if(!k.noHScroll)m.style.marginLeft=-o.gutterTotalWidth+"px"}d&&h.above?e.insertBefore(i,b.gutter||b.text):e.appendChild(i);Qa(h,"redraw")}}}function R(a,b){return sa(a,b)<0?b:a}function r(a,b){return sa(a,b)<0?a:b}function F(a,b){this.ranges=a;this.primIndex=b}function s(a,b){this.anchor=a;this.head=b}function U(a,b){var c=a[b];a.sort(function(i,k){return sa(i.from(),k.from())});b=Ua(a,c);for(c=1;c<a.length;c++){var d=a[c],e=a[c-1];if(sa(e.to(),d.from())>=0){var f=r(e.from(),d.from()),h=R(e.to(),
d.to());d=e.empty()?d.from()==d.head:e.from()==e.head;c<=b&&--b;a.splice(--c,2,new s(d?h:f,d?f:h))}}return new F(a,b)}function ja(a,b){return new F([new s(a,b||a)],0)}function Y(a,b){if(b.line<a.first)return W(a.first,0);var c=a.first+a.size-1;if(b.line>c)return W(c,ha(a,c).text.length);c=ha(a,b.line).text.length;var d=b.ch;return d==null||d>c?W(b.line,c):d<0?W(b.line,0):b}function Ka(a,b){return b>=a.first&&b<a.first+a.size}function Ha(a,b,c,d){if(a.cm&&a.cm.display.shift||a.extend){a=b.anchor;if(d){b=
sa(c,a)<0;if(b!=sa(d,a)<0){a=c;c=d}else if(b!=sa(c,d)<0)c=d}return new s(a,c)}else return new s(d||c,c)}function xa(a,b,c,d){Ma(a,new F([Ha(a,a.sel.primary(),b,c)],0),d)}function eb(a,b,c){for(var d=[],e=0;e<a.sel.ranges.length;e++)d[e]=Ha(a,a.sel.ranges[e],b[e],null);b=U(d,a.sel.primIndex);Ma(a,b,c)}function Ba(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c;Ma(a,U(e,a.sel.primIndex),d)}function bc(a,b){var c={ranges:b.ranges,update:function(d){this.ranges=[];for(var e=0;e<d.length;e++)this.ranges[e]=
new s(Y(a,d[e].anchor),Y(a,d[e].head))}};Oa(a,"beforeSelectionChange",a,c);a.cm&&Oa(a.cm,"beforeSelectionChange",a.cm,c);return c.ranges!=b.ranges?U(c.ranges,c.ranges.length-1):b}function cc(a,b,c){var d=a.history.done,e=Ia(d);if(e&&e.ranges){d[d.length-1]=b;qb(a,b,c)}else Ma(a,b,c)}function Ma(a,b,c){qb(a,b,c);b=a.sel;var d=a.cm?a.cm.curOp.id:NaN,e=a.history,f=c&&c.origin,h;if(!(h=d==e.lastSelOp))if(h=f)if(h=e.lastSelOrigin==f)if(!(h=e.lastModTime==e.lastSelTime&&e.lastOrigin==f)){h=Ia(e.done);var i=
f.charAt(0);h=i=="*"||i=="+"&&h.ranges.length==b.ranges.length&&h.somethingSelected()==b.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}if(h)e.done[e.done.length-1]=b;else Wc(b,e.done);e.lastSelTime=+new Date;e.lastSelOrigin=f;e.lastSelOp=d;c&&c.clearRedo!==false&&se(e.undone)}function qb(a,b,c){if(jb(a,"beforeSelectionChange")||a.cm&&jb(a.cm,"beforeSelectionChange"))b=bc(a,b);var d=c&&c.bias||(sa(b.primary().head,a.sel.primary().head)<0?-1:1);Xc(a,
Yc(a,b,d,true));!(c&&c.scroll===false)&&a.cm&&dc(a.cm)}function Xc(a,b){if(!b.equals(a.sel)){a.sel=b;if(a.cm){a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=true;te(a.cm)}Qa(a,"cursorActivity",a)}}function Zc(a){Xc(a,Yc(a,a.sel,null,false),Eb)}function Yc(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var h=b.ranges[f],i=ec(a,h.anchor,c,d),k=ec(a,h.head,c,d);if(e||i!=h.anchor||k!=h.head){e||(e=b.ranges.slice(0,f));e[f]=new s(i,k)}}return e?U(e,b.primIndex):b}function ec(a,b,c,d){var e=false,f=
b,h=c||1;a.cantEdit=false;a:for(;;){var i=ha(a,f.line);if(i.markedSpans)for(var k=0;k<i.markedSpans.length;++k){var m=i.markedSpans[k],o=m.marker;if((m.from==null||(o.inclusiveLeft?m.from<=f.ch:m.from<f.ch))&&(m.to==null||(o.inclusiveRight?m.to>=f.ch:m.to>f.ch))){if(d){Oa(o,"beforeCursorEnter");if(o.explicitlyCleared)if(i.markedSpans){--k;continue}else break}if(o.atomic){k=o.find(h<0?-1:1);if(sa(k,f)==0){k.ch+=h;if(k.ch<0)k=k.line>a.first?Y(a,W(k.line-1)):null;else if(k.ch>i.text.length)k=k.line<
a.first+a.size-1?W(k.line+1,0):null;if(!k){if(e){if(!d)return ec(a,b,c,true);a.cantEdit=true;return W(a.first,0)}e=true;k=b;h=-h}}f=k;continue a}}}return f}}function xc(a){for(var b=a.display,c=a.doc,d={},e=d.cursors=document.createDocumentFragment(),f=d.selection=document.createDocumentFragment(),h=0;h<c.sel.ranges.length;h++){var i=c.sel.ranges[h],k=i.empty();if(k||a.options.showCursorWhenSelecting){var m=a,o=e,t=N(m,i.head,"div",null,null,!m.options.singleCursorHeightPerLine),p=o.appendChild(ga("div",
"\u00a0","CodeMirror-cursor"));p.style.left=t.left+"px";p.style.top=t.top+"px";p.style.height=Math.max(0,t.bottom-t.top)*m.options.cursorHeight+"px";if(t.other){m=o.appendChild(ga("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor"));m.style.display="";m.style.left=t.other.left+"px";m.style.top=t.other.top+"px";m.style.height=(t.other.bottom-t.other.top)*0.85+"px"}}k||Ld(a,i,f)}if(a.options.moveInputWithCursor){a=N(a,c.sel.primary().head,"div");c=b.wrapper.getBoundingClientRect();e=b.lineDiv.getBoundingClientRect();
d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+e.top-c.top));d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,a.left+e.left-c.left))}return d}function fc(a,b){rb(a.display.cursorDiv,b.cursors);rb(a.display.selectionDiv,b.selection);if(b.teTop!=null){a.display.inputDiv.style.top=b.teTop+"px";a.display.inputDiv.style.left=b.teLeft+"px"}}function Rb(a){fc(a,xc(a))}function Ld(a,b,c){function d(p,D,L,ea){if(D<0)D=0;D=Math.round(D);ea=Math.round(ea);i.appendChild(ga("div",null,"CodeMirror-selected",
"position: absolute; left: "+p+"px; top: "+D+"px; width: "+(L==null?o-p:L)+"px; height: "+(ea-D)+"px"))}function e(p,D,L){var ea=ha(h,p),fa=ea.text.length,na,ia;zf(sb(ea),D||0,L==null?fa:L,function(da,Ca,pa){var ya=I(a,W(p,da),"div",ea,"left"),ta,Da;if(da==Ca){ta=ya;pa=Da=ya.left}else{ta=I(a,W(p,Ca-1),"div",ea,"right");if(pa=="rtl"){pa=ya;ya=ta;ta=pa}pa=ya.left;Da=ta.right}if(D==null&&da==0)pa=m;if(ta.top-ya.top>3){d(pa,ya.top,null,ya.bottom);pa=m;ya.bottom<ta.top&&d(pa,ya.bottom,null,ta.top)}if(L==
null&&Ca==fa)Da=o;if(!na||ya.top<na.top||ya.top==na.top&&ya.left<na.left)na=ya;if(!ia||ta.bottom>ia.bottom||ta.bottom==ia.bottom&&ta.right>ia.right)ia=ta;if(pa<m+1)pa=m;d(pa,ta.top,Da-pa,ta.bottom)});return{start:na,end:ia}}var f=a.display,h=a.doc,i=document.createDocumentFragment(),k=yc(a.display),m=k.left,o=Math.max(f.sizerWidth,hb(a)-f.sizer.offsetLeft)-k.right;f=b.from();b=b.to();if(f.line==b.line)e(f.line,f.ch,b.ch);else{var t=ha(h,f.line);k=ha(h,b.line);k=tb(t)==tb(k);f=e(f.line,f.ch,k?t.text.length+
1:null).end;b=e(b.line,k?0:null,b.ch).start;if(k)if(f.top<b.top-2){d(f.right,f.top,null,f.bottom);d(m,b.top,b.left,b.bottom)}else d(f.right,f.top,b.left-f.right,f.bottom);f.bottom<b.top&&d(m,f.bottom,null,b.top)}c.appendChild(i)}function Fb(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=true;b.cursorDiv.style.visibility="";if(a.options.cursorBlinkRate>0)b.blinker=setInterval(function(){b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate);else if(a.options.cursorBlinkRate<
0)b.cursorDiv.style.visibility="hidden"}}function db(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.viewTo&&a.state.highlight.set(b,ob($c,a))}function $c(a){var b=a.doc;if(b.frontier<b.first)b.frontier=b.first;if(!(b.frontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=gc(b.mode,fb(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(b.frontier>=a.display.viewFrom){var h=f.styles,i=ue(a,f,d,true);f.styles=i.styles;var k=f.styleClasses;
if(i=i.classes)f.styleClasses=i;else if(k)f.styleClasses=null;k=!h||h.length!=f.styles.length||k!=i&&(!k||!i||k.bgClass!=i.bgClass||k.textClass!=i.textClass);for(i=0;!k&&i<h.length;++i)k=h[i]!=f.styles[i];k&&e.push(b.frontier);f.stateAfter=gc(b.mode,d)}else{Md(a,f.text,d);f.stateAfter=b.frontier%5==0?gc(b.mode,d):null}++b.frontier;if(+new Date>c){db(a,a.options.workDelay);return true}});e.length&&Gb(a,function(){for(var f=0;f<e.length;f++)xb(a,e[f],"text")})}}function hc(a,b,c){for(var d,e,f=a.doc,
h=c?-1:b-(a.doc.mode.innerMode?1E3:100);b>h;--b){if(b<=f.first)return f.first;var i=ha(f,b-1);if(i.stateAfter&&(!c||b<=f.frontier))return b;i=kb(i.text,null,a.options.tabSize);if(e==null||d>i){e=b-1;d=i}}return e}function fb(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return true;var f=hc(a,b,c),h=f>d.first&&ha(d,f-1).stateAfter;h=h?gc(d.mode,h):Af(d.mode);d.iter(f,b,function(i){Md(a,i.text,h);i.stateAfter=f==b-1||f%5==0||f>=e.viewFrom&&f<e.viewTo?gc(d.mode,h):null;++f});if(c)d.frontier=
f;return h}function yc(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=rb(a.measure,ga("pre","x"));b=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle;b={left:parseInt(b.paddingLeft),right:parseInt(b.paddingRight)};if(!isNaN(b.left)&&!isNaN(b.right))a.cachedPaddingH=b;return b}function Za(a){return oe-a.display.nativeBarWidth}function hb(a){return a.display.scroller.clientWidth-Za(a)-a.display.barWidth}function Db(a){return a.display.scroller.clientHeight-Za(a)-a.display.barHeight}
function ad(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[wc(a,b)];var c=a.display.externalMeasured;if(c&&b>=c.lineN&&b<c.lineN+c.size)return c}function ub(a,b){var c=La(b),d=ad(a,c);if(d&&!d.text)d=null;else d&&d.changes&&ra(a,d,c,ba(a));if(!d){var e;e=tb(b);d=La(e);e=a.display.externalMeasured=new ve(a.doc,e,d);e.lineN=d;d=e.built=re(a,e);e.text=d.pre;rb(a.display.lineMeasure,d.pre);d=e}a:{e=d;if(e.line==b)c={map:e.measure.map,cache:e.measure.cache};else{for(var f=0;f<
e.rest.length;f++)if(e.rest[f]==b){c={map:e.measure.maps[f],cache:e.measure.caches[f]};break a}for(f=0;f<e.rest.length;f++)if(La(e.rest[f])>c){c={map:e.measure.maps[f],cache:e.measure.caches[f],before:true};break a}c=void 0}}return{line:b,view:d,rect:null,map:c.map,cache:c.cache,before:c.before,hasHeights:false}}function Hb(a,b,c,d,e){if(b.before)c=-1;var f=c+(d||"");if(b.cache.hasOwnProperty(f))a=b.cache[f];else{if(!b.rect)b.rect=b.view.text.getBoundingClientRect();if(!b.hasHeights){var h=b.view,
i=b.rect,k=a.options.lineWrapping,m=k&&hb(a);if(!h.measure.heights||k&&h.measure.width!=m){var o=h.measure.heights=[];if(k){h.measure.width=m;h=h.text.firstChild.getClientRects();for(k=0;k<h.length-1;k++){m=h[k];var t=h[k+1];Math.abs(m.bottom-t.bottom)>2&&o.push((m.bottom+t.top)/2-i.top)}}o.push(i.bottom-i.top)}b.hasHeights=true}i=d;o=b.map;var p,D,L,ea;for(d=0;d<o.length;d+=3){var fa=o[d],na=o[d+1];if(c<fa){D=0;L=1;ea="left"}else if(c<na){D=c-fa;L=D+1}else if(d==o.length-3||c==na&&o[d+3]>c){L=na-
fa;D=L-1;if(c>=na)ea="right"}if(D!=null){p=o[d+2];if(fa==na&&i==(p.insertLeft?"left":"right"))ea=i;if(i=="left"&&D==0)for(;d&&o[d-2]==o[d-3]&&o[d-1].insertLeft;){p=o[(d-=3)+2];ea="left"}if(i=="right"&&D==na-fa)for(;d<o.length-3&&o[d+3]==o[d+4]&&!o[d+5].insertLeft;){p=o[(d+=3)+2];ea="right"}break}}var ia;if(p.nodeType==3){for(d=0;d<4;d++){for(;D&&zc(b.line.text.charAt(fa+D));)--D;for(;fa+L<na&&zc(b.line.text.charAt(fa+L));)++L;if(va&&Fa<9&&D==0&&L==na-fa)ia=p.parentNode.getBoundingClientRect();else if(va&&
a.options.lineWrapping){var da=ic(p,D,L).getClientRects();ia=da.length?da[i=="right"?da.length-1:0]:Nd}else ia=ic(p,D,L).getBoundingClientRect()||Nd;if(ia.left||ia.right||D==0)break;L=D;D-=1;ea="right"}if(va&&Fa<11){if(!(c=!window.screen))if(!(c=screen.logicalXDPI==null))if(!(c=screen.logicalXDPI==screen.deviceXDPI)){if(Od!=null)c=Od;else{L=rb(a.display.measure,ga("span","x"));c=L.getBoundingClientRect();L=ic(L,0,1).getBoundingClientRect();c=Od=Math.abs(c.left-L.left)>1}c=!c}if(!c){c=screen.logicalXDPI/
screen.deviceXDPI;L=screen.logicalYDPI/screen.deviceYDPI;ia={left:ia.left*c,right:ia.right*c,top:ia.top*L,bottom:ia.bottom*L}}}}else{if(D>0)ea=i="right";ia=a.options.lineWrapping&&(da=p.getClientRects()).length>1?da[i=="right"?da.length-1:0]:p.getBoundingClientRect()}if(va&&Fa<9&&!D&&(!ia||!ia.left&&!ia.right))ia=(p=p.parentNode.getClientRects()[0])?{left:p.left,right:p.left+sc(a.display),top:p.top,bottom:p.bottom}:Nd;p=ia.top-b.rect.top;D=ia.bottom-b.rect.top;c=(p+D)/2;L=b.view.measure.heights;for(d=
0;d<L.length-1;d++)if(c<L[d])break;ea={left:(ea=="right"?ia.right:ia.left)-b.rect.left,right:(ea=="left"?ia.left:ia.right)-b.rect.left,top:d?L[d-1]:0,bottom:L[d]};if(!ia.left&&!ia.right)ea.bogus=true;if(!a.options.singleCursorHeightPerLine){ea.rtop=p;ea.rbottom=D}a=ea;a.bogus||(b.cache[f]=a)}return{left:a.left,right:a.right,top:e?a.rtop:a.top,bottom:e?a.rbottom:a.bottom}}function bd(a){if(a.measure){a.measure.cache={};a.measure.heights=null;if(a.rest)for(var b=0;b<a.rest.length;b++)a.measure.caches[b]=
{}}}function cd(a){a.display.externalMeasure=null;Ob(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)bd(a.display.view[b])}function aa(a){cd(a);a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null;if(!a.options.lineWrapping)a.display.maxLineChanged=true;a.display.lineNumChars=null}function Ac(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=Bc(b.widgets[e]);c.top+=f;c.bottom+=f}if(d=="line")return c;d||(d="local");b=
wb(b);if(d=="local")b+=a.display.lineSpace.offsetTop;else b-=a.display.viewOffset;if(d=="page"||d=="window"){a=a.display.lineSpace.getBoundingClientRect();b+=a.top+(d=="window"?0:window.pageYOffset||(document.documentElement||document.body).scrollTop);d=a.left+(d=="window"?0:window.pageXOffset||(document.documentElement||document.body).scrollLeft);c.left+=d;c.right+=d}c.top+=b;c.bottom+=b;return c}function n(a,b,c){if(c=="div")return b;var d=b.left;b=b.top;if(c=="page"){d-=window.pageXOffset||(document.documentElement||
document.body).scrollLeft;b-=window.pageYOffset||(document.documentElement||document.body).scrollTop}else if(c=="local"||!c){c=a.display.sizer.getBoundingClientRect();d+=c.left;b+=c.top}a=a.display.lineSpace.getBoundingClientRect();return{left:d-a.left,top:b-a.top}}function I(a,b,c,d,e){d||(d=ha(a.doc,b.line));return Ac(a,d,Hb(a,ub(a,d),b.ch,e),c)}function N(a,b,c,d,e,f){function h(o,t){var p=Hb(a,e,o,t?"right":"left",f);if(t)p.left=p.right;else p.right=p.left;return Ac(a,d,p,c)}function i(o,t){var p=
k[t],D=p.level%2;if(o==(p.level%2?p.to:p.from)&&t&&p.level<k[t-1].level){p=k[--t];o=Pd(p)-(p.level%2?0:1);D=true}else if(o==Pd(p)&&t<k.length-1&&p.level<k[t+1].level){p=k[++t];o=(p.level%2?p.to:p.from)-p.level%2;D=false}if(D&&o==p.to&&o>p.from)return h(o-1);return h(o,D)}d=d||ha(a.doc,b.line);e||(e=ub(a,d));var k=sb(d);b=b.ch;if(!k)return h(b);var m=Qd(k,b);m=i(b,m);if(Cc!=null)m.other=i(b,Cc);return m}function K(a,b){var c=0;b=Y(a.doc,b);a.options.lineWrapping||(c=sc(a.display)*b.ch);var d=ha(a.doc,
b.line),e=wb(d)+a.display.lineSpace.offsetTop;return{left:c,right:c,top:e,bottom:e+d.height}}function ka(a,b,c,d){a=W(a,b);a.xRel=d;if(c)a.outside=true;return a}function za(a,b,c){var d=a.doc;c+=a.display.viewOffset;if(c<0)return ka(d.first,0,true,-1);var e=Qb(d,c),f=d.first+d.size-1;if(e>f)return ka(d.first+d.size-1,ha(d,f).text.length,true,1);if(b<0)b=0;for(d=ha(d,e);;){e=Ra(a,d,e,b,c);f=(d=Pb(d,false))&&d.find(0,true);if(d&&(e.ch>f.from.ch||e.ch==f.from.ch&&e.xRel>0))e=La(d=f.to.line);else return e}}
function Ra(a,b,c,d,e){function f(Ca){Ca=N(a,W(c,Ca),"line",b,m);i=true;if(h>Ca.bottom)return Ca.left-k;else if(h<Ca.top)return Ca.left+k;else i=false;return Ca.left}var h=e-wb(b),i=false,k=2*a.display.wrapper.clientWidth,m=ub(a,b),o=sb(b),t=b.text.length;e=dd(b);var p=ed(b),D=f(e),L=i,ea=f(p),fa=i;if(d>ea)return ka(c,p,fa,1);for(;;){if(o?p==e||p==Rd(b,e,1):p-e<=1){o=d<D||d-D<=ea-d?e:p;for(d-=o==e?D:ea;zc(b.text.charAt(o));)++o;return ka(c,o,o==e?L:fa,d<-1?-1:d>1?1:0)}var na=Math.ceil(t/2),ia=e+na;
if(o){ia=e;for(var da=0;da<na;++da)ia=Rd(b,ia,1)}da=f(ia);if(da>d){p=ia;ea=da;if(fa=i)ea+=1E3;t=na}else{e=ia;D=da;L=i;t-=na}}}function vb(a){if(a.cachedTextHeight!=null)return a.cachedTextHeight;if(Sb==null){Sb=ga("pre");for(var b=0;b<49;++b){Sb.appendChild(document.createTextNode("x"));Sb.appendChild(ga("br"))}Sb.appendChild(document.createTextNode("x"))}rb(a.measure,Sb);b=Sb.offsetHeight/50;if(b>3)a.cachedTextHeight=b;Ob(a.measure);return b||1}function sc(a){if(a.cachedCharWidth!=null)return a.cachedCharWidth;
var b=ga("span","xxxxxxxxxx"),c=ga("pre",[b]);rb(a.measure,c);b=b.getBoundingClientRect();b=(b.right-b.left)/10;if(b>2)a.cachedCharWidth=b;return b||10}function Lb(a){a.curOp={cm:a,viewChanged:false,startHeight:a.doc.height,forceUpdate:false,updateInput:null,typing:false,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:false,updateMaxLine:false,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++Bf};if(jc)jc.ops.push(a.curOp);else a.curOp.ownsGroup=jc={ops:[a.curOp],
delayedCallbacks:[]}}function Mb(a){if(a=a.curOp.ownsGroup)try{var b=a.delayedCallbacks,c=0;do{for(;c<b.length;c++)b[c]();for(var d=0;d<a.ops.length;d++){var e=a.ops[d];if(e.cursorActivityHandlers)for(;e.cursorActivityCalled<e.cursorActivityHandlers.length;)e.cursorActivityHandlers[e.cursorActivityCalled++](e.cm)}}while(c<b.length)}finally{jc=null;for(b=0;b<a.ops.length;b++)a.ops[b].cm.curOp=null;a=a.ops;for(b=0;b<a.length;b++){e=a[b];c=e.cm;d=c.display;var f=c,h=f.display;if(!h.scrollbarsClipped&&
h.scroller.offsetWidth){h.nativeBarWidth=h.scroller.offsetWidth-h.scroller.clientWidth;h.heightForcer.style.height=Za(f)+"px";h.sizer.style.marginBottom=-h.nativeBarWidth+"px";h.sizer.style.borderRightWidth=Za(f)+"px";h.scrollbarsClipped=true}e.updateMaxLine&&x(c);e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<d.viewFrom||e.scrollToPos.to.line>=d.viewTo)||d.maxLineChanged&&c.options.lineWrapping;e.update=e.mustUpdate&&new Ja(c,e.mustUpdate&&{top:e.scrollTop,
ensure:e.scrollToPos},e.forceUpdate)}for(b=0;b<a.length;b++){e=a[b];e.updatedDisplay=e.mustUpdate&&Ea(e.cm,e.update)}for(b=0;b<a.length;b++){e=a[b];c=e.cm;d=c.display;e.updatedDisplay&&G(c);e.barMeasure=H(c);if(d.maxLineChanged&&!c.options.lineWrapping){e.adjustWidthTo=Hb(c,ub(c,d.maxLine),d.maxLine.text.length,void 0).left+3;c.display.sizerWidth=e.adjustWidthTo;e.barMeasure.scrollWidth=Math.max(d.scroller.clientWidth,d.sizer.offsetLeft+e.adjustWidthTo+Za(c)+c.display.barWidth);e.maxScrollLeft=Math.max(0,
d.sizer.offsetLeft+e.adjustWidthTo-hb(c))}if(e.updatedDisplay||e.selectionChanged)e.newSelectionNodes=xc(c)}for(b=0;b<a.length;b++){e=a[b];c=e.cm;if(e.adjustWidthTo!=null){c.display.sizer.style.minWidth=e.adjustWidthTo+"px";e.maxScrollLeft<c.doc.scrollLeft&&ac(c,Math.min(c.display.scroller.scrollLeft,e.maxScrollLeft),true);c.display.maxLineChanged=false}e.newSelectionNodes&&fc(c,e.newSelectionNodes);e.updatedDisplay&&C(c,e.barMeasure);if(e.updatedDisplay||e.startHeight!=c.doc.height)y(c,e.barMeasure);
e.selectionChanged&&Fb(c);c.state.focused&&e.updateInput&&gb(c,e.typing)}for(b=0;b<a.length;b++){e=a[b];c=e.cm;d=c.display;f=c.doc;e.updatedDisplay&&S(c,e.update);if(d.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos))d.wheelStartX=d.wheelStartY=null;if(e.scrollTop!=null&&(d.scroller.scrollTop!=e.scrollTop||e.forceScroll)){f.scrollTop=Math.max(0,Math.min(d.scroller.scrollHeight-d.scroller.clientHeight,e.scrollTop));d.scrollbars.setScrollTop(f.scrollTop);d.scroller.scrollTop=
f.scrollTop}if(e.scrollLeft!=null&&(d.scroller.scrollLeft!=e.scrollLeft||e.forceScroll)){f.scrollLeft=Math.max(0,Math.min(d.scroller.scrollWidth-hb(c),e.scrollLeft));d.scrollbars.setScrollLeft(f.scrollLeft);d.scroller.scrollLeft=f.scrollLeft;Ga(c)}if(e.scrollToPos){var i=void 0;h=Y(f,e.scrollToPos.from);i=Y(f,e.scrollToPos.to);var k=e.scrollToPos.margin;if(k==null)k=0;for(var m=0;m<5;m++){var o=false,t=N(c,h),p=!i||i==h?t:N(c,i);p=fd(c,Math.min(t.left,p.left),Math.min(t.top,p.top)-k,Math.max(t.left,
p.left),Math.max(t.bottom,p.bottom)+k);var D=c.doc.scrollTop,L=c.doc.scrollLeft;if(p.scrollTop!=null){uc(c,p.scrollTop);if(Math.abs(c.doc.scrollTop-D)>1)o=true}if(p.scrollLeft!=null){ac(c,p.scrollLeft);if(Math.abs(c.doc.scrollLeft-L)>1)o=true}if(!o)break}i=t;if(e.scrollToPos.isCursor&&c.state.focused)if(!lb(c,"scrollCursorIntoView")){k=c.display;m=k.sizer.getBoundingClientRect();h=null;if(i.top+m.top<0)h=true;else if(i.bottom+m.top>(window.innerHeight||document.documentElement.clientHeight))h=false;
if(h!=null&&!Cf){i=ga("div","\u200b",null,"position: absolute; top: "+(i.top-k.viewOffset-c.display.lineSpace.offsetTop)+"px; height: "+(i.bottom-i.top+Za(c)+k.barHeight)+"px; left: "+i.left+"px; width: 2px;");c.display.lineSpace.appendChild(i);i.scrollIntoView(h);c.display.lineSpace.removeChild(i)}}}h=e.maybeHiddenMarkers;i=e.maybeUnhiddenMarkers;if(h)for(k=0;k<h.length;++k)h[k].lines.length||Oa(h[k],"hide");if(i)for(k=0;k<i.length;++k)i[k].lines.length&&Oa(i[k],"unhide");if(d.wrapper.offsetHeight)f.scrollTop=
c.display.scroller.scrollTop;e.changeObjs&&Oa(c,"changes",c,e.changeObjs)}}}function Gb(a,b){if(a.curOp)return b();Lb(a);try{return b()}finally{Mb(a)}}function Pa(a,b){return function(){if(a.curOp)return b.apply(a,arguments);Lb(a);try{return b.apply(a,arguments)}finally{Mb(a)}}}function Sa(a){return function(){if(this.curOp)return a.apply(this,arguments);Lb(this);try{return a.apply(this,arguments)}finally{Mb(this)}}}function Wa(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,
arguments);Lb(b);try{return a.apply(this,arguments)}finally{Mb(b)}}}function ve(a,b,c){for(var d=this.line=b,e;d=Pb(d,false);){d=d.find(1,true).line;(e||(e=[])).push(d)}this.size=(this.rest=e)?La(Ia(this.rest))-c+1:1;this.node=this.text=null;this.hidden=Nb(a,b)}function Vc(a,b,c){var d=[],e;for(e=b;e<c;){b=new ve(a.doc,ha(a.doc,e),e);e+=b.size;d.push(b)}return d}function ab(a,b,c,d){if(b==null)b=a.doc.first;if(c==null)c=a.doc.first+a.doc.size;d||(d=0);var e=a.display;if(d&&c<e.viewTo&&(e.updateLineNumbers==
null||e.updateLineNumbers>b))e.updateLineNumbers=b;a.curOp.viewChanged=true;if(b>=e.viewTo)Cb&&Kd(a.doc,b)<e.viewTo&&Bb(a);else if(c<=e.viewFrom)if(Cb&&qe(a.doc,c+d)>e.viewFrom)Bb(a);else{e.viewFrom+=d;e.viewTo+=d}else if(b<=e.viewFrom&&c>=e.viewTo)Bb(a);else if(b<=e.viewFrom){var f=gd(a,c,c+d,1);if(f){e.view=e.view.slice(f.index);e.viewFrom=f.lineN;e.viewTo+=d}else Bb(a)}else if(c>=e.viewTo)if(f=gd(a,b,b,-1)){e.view=e.view.slice(0,f.index);e.viewTo=f.lineN}else Bb(a);else{f=gd(a,b,b,-1);var h=gd(a,
c,c+d,1);if(f&&h){e.view=e.view.slice(0,f.index).concat(Vc(a,f.lineN,h.lineN)).concat(e.view.slice(h.index));e.viewTo+=d}else Bb(a)}if(a=e.externalMeasured)if(c<a.lineN)a.lineN+=d;else if(b<a.lineN+a.size)e.externalMeasured=null}function xb(a,b,c){a.curOp.viewChanged=true;var d=a.display,e=a.display.externalMeasured;if(e&&b>=e.lineN&&b<e.lineN+e.size)d.externalMeasured=null;if(!(b<d.viewFrom||b>=d.viewTo)){a=d.view[wc(a,b)];if(a.node!=null){a=a.changes||(a.changes=[]);Ua(a,c)==-1&&a.push(c)}}}function Bb(a){a.display.viewFrom=
a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function wc(a,b){if(b>=a.display.viewTo)return null;b-=a.display.viewFrom;if(b<0)return null;for(var c=a.display.view,d=0;d<c.length;d++){b-=c[d].size;if(b<0)return d}}function gd(a,b,c,d){var e=wc(a,b),f=a.display.view;if(!Cb||c==a.doc.first+a.doc.size)return{index:e,lineN:c};for(var h=0,i=a.display.viewFrom;h<e;h++)i+=f[h].size;if(i!=b){if(d>0){if(e==f.length-1)return null;b=i+f[e].size-b;e++}else b=i-b;c+=b}for(;Kd(a.doc,c)!=
c;){if(e==(d<0?0:f.length-1))return null;c+=d*f[e-(d<0?1:0)].size;e+=d}return{index:e,lineN:c}}function pe(a){a=a.display.view;for(var b=0,c=0;c<a.length;c++){var d=a[c];if(!d.hidden&&(!d.node||d.changes))++b}return b}function hd(a){a.display.pollingFast||a.display.poll.set(a.options.pollInterval,function(){id(a);a.state.focused&&hd(a)})}function jd(a){function b(){if(!id(a)&&!c){c=true;a.display.poll.set(60,b)}else{a.display.pollingFast=false;hd(a)}}var c=false;a.display.pollingFast=true;a.display.poll.set(20,
b)}function id(a){var b=a.display.input,c=a.display.prevInput,d=a.doc;if(!a.state.focused||Df(b)&&!c||kd(a)||a.options.disableInput||a.state.keySeq)return false;if(a.state.pasteIncoming&&a.state.fakedLastChar){b.value=b.value.substring(0,b.value.length-1);a.state.fakedLastChar=false}var e=b.value;if(e==c&&!a.somethingSelected())return false;if(va&&Fa>=9&&a.display.inputHasSelection===e||ib&&/[\uf700-\uf7ff]/.test(e)){gb(a);return false}var f=!a.curOp;f&&Lb(a);a.display.shift=false;if(e.charCodeAt(0)==
8203&&d.sel==a.display.selForContextMenu&&!c)c="\u200b";for(var h=0,i=Math.min(c.length,e.length);h<i&&c.charCodeAt(h)==e.charCodeAt(h);)++h;i=e.slice(h);var k=Tb(i),m=null;if(a.state.pasteIncoming&&d.sel.ranges.length>1)if(Ub&&Ub.join("\n")==i)m=d.sel.ranges.length%Ub.length==0&&Dc(Ub,Tb);else if(k.length==d.sel.ranges.length)m=Dc(k,function(ea){return[ea]});for(var o=d.sel.ranges.length-1;o>=0;o--){var t=d.sel.ranges[o],p=t.from(),D=t.to();if(h<c.length)p=W(p.line,p.ch-(c.length-h));else if(a.state.overwrite&&
t.empty()&&!a.state.pasteIncoming)D=W(D.line,Math.min(ha(d,D.line).text.length,D.ch+Ia(k).length));var L=a.curOp.updateInput;p={from:p,to:D,text:m?m[o%m.length]:k,origin:a.state.pasteIncoming?"paste":a.state.cutIncoming?"cut":"+input"};kc(a.doc,p);Qa(a,"inputRead",a,p);if(i&&!a.state.pasteIncoming&&a.options.electricChars&&a.options.smartIndent&&t.head.ch<100&&(!o||d.sel.ranges[o-1].head.line!=t.head.line)){t=a.getModeAt(t.head);p=Ib(p);if(t.electricChars)for(D=0;D<t.electricChars.length;D++){if(i.indexOf(t.electricChars.charAt(D))>
-1){Ec(a,p.line,"smart");break}}else t.electricInput&&t.electricInput.test(ha(d,p.line).text.slice(0,p.ch))&&Ec(a,p.line,"smart")}}dc(a);a.curOp.updateInput=L;a.curOp.typing=true;if(e.length>1E3||e.indexOf("\n")>-1)b.value=a.display.prevInput="";else a.display.prevInput=e;f&&Mb(a);a.state.pasteIncoming=a.state.cutIncoming=false;return true}function gb(a,b){if(!a.display.contextMenuPending){var c,d,e=a.doc;if(a.somethingSelected()){a.display.prevInput="";c=e.sel.primary();d=(c=we&&(c.to().line-c.from().line>
100||(d=a.getSelection()).length>1E3))?"-":d||a.getSelection();a.display.input.value=d;a.state.focused&&Fc(a.display.input);if(va&&Fa>=9)a.display.inputHasSelection=d}else if(!b){a.display.prevInput=a.display.input.value="";if(va&&Fa>=9)a.display.inputHasSelection=null}a.display.inaccurateSelection=c}}function $a(a){if(a.options.readOnly!="nocursor"&&(!Gd||Ab()!=a.display.input))a.display.input.focus()}function Sd(a){if(!a.state.focused){$a(a);Hd(a)}}function kd(a){return a.options.readOnly||a.doc.cantEdit}
function xf(a){function b(e){lb(a,e)||Td(e)}function c(e){if(a.somethingSelected()){Ub=a.getSelections();if(d.inaccurateSelection){d.prevInput="";d.inaccurateSelection=false;d.input.value=Ub.join("\n");Fc(d.input)}}else{for(var f=[],h=[],i=0;i<a.doc.sel.ranges.length;i++){var k=a.doc.sel.ranges[i].head.line;k={anchor:W(k,0),head:W(k+1,0)};h.push(k);f.push(a.getRange(k.anchor,k.head))}if(e.type=="cut")a.setSelections(h,null,Eb);else{d.prevInput="";d.input.value=f.join("\n");Fc(d.input)}Ub=f}if(e.type==
"cut")a.state.cutIncoming=true}var d=a.display;qa(d.scroller,"mousedown",Pa(a,xe));va&&Fa<11?qa(d.scroller,"dblclick",Pa(a,function(e){if(!lb(a,e)){var f=lc(a,e);if(!(!f||Ud(a,e,"gutterClick",true,Qa)||Vb(a.display,e))){Xa(e);e=a.findWordAt(f);xa(a.doc,e.anchor,e.head)}}})):qa(d.scroller,"dblclick",function(e){lb(a,e)||Xa(e)});qa(d.lineSpace,"selectstart",function(e){Vb(d,e)||Xa(e)});Vd||qa(d.scroller,"contextmenu",function(e){ye(a,e)});qa(d.scroller,"scroll",function(){if(d.scroller.clientHeight){uc(a,
d.scroller.scrollTop);ac(a,d.scroller.scrollLeft,true);Oa(a,"scroll",a)}});qa(d.scroller,"mousewheel",function(e){ze(a,e)});qa(d.scroller,"DOMMouseScroll",function(e){ze(a,e)});qa(d.wrapper,"scroll",function(){d.wrapper.scrollTop=d.wrapper.scrollLeft=0});qa(d.input,"keyup",function(e){Ae.call(a,e)});qa(d.input,"input",function(){if(va&&Fa>=9&&a.display.inputHasSelection)a.display.inputHasSelection=null;id(a)});qa(d.input,"keydown",Pa(a,Be));qa(d.input,"keypress",Pa(a,Ce));qa(d.input,"focus",ob(Hd,
a));qa(d.input,"blur",ob(Uc,a));if(a.options.dragDrop){qa(d.scroller,"dragstart",function(e){var f=a;if(va&&(!f.state.draggingText||+new Date-De<100))Td(e);else if(!(lb(f,e)||Vb(f.display,e))){e.dataTransfer.setData("Text",f.getSelection());if(e.dataTransfer.setDragImage&&!Ee){var h=ga("img",null,null,"position: fixed; left: 0; top: 0;");h.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";if(mb){h.width=h.height=1;f.display.wrapper.appendChild(h);h._top=h.offsetTop}e.dataTransfer.setDragImage(h,
0,0);mb&&h.parentNode.removeChild(h)}}});qa(d.scroller,"dragenter",b);qa(d.scroller,"dragover",b);qa(d.scroller,"drop",Pa(a,Ef))}qa(d.scroller,"paste",function(e){if(!Vb(d,e)){a.state.pasteIncoming=true;$a(a);jd(a)}});qa(d.input,"paste",function(){if(Na&&!a.state.fakedLastChar&&!(new Date-a.state.lastMiddleDown<200)){var e=d.input.selectionStart,f=d.input.selectionEnd;d.input.value+="$";d.input.selectionEnd=f;d.input.selectionStart=e;a.state.fakedLastChar=true}a.state.pasteIncoming=true;jd(a)});qa(d.input,
"cut",c);qa(d.input,"copy",c);Jd&&qa(d.sizer,"mouseup",function(){Ab()==d.input&&d.input.blur();$a(a)})}function Ff(a){var b=a.display;if(!(b.lastWrapHeight==b.wrapper.clientHeight&&b.lastWrapWidth==b.wrapper.clientWidth)){b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null;b.scrollbarsClipped=false;a.setSize()}}function Vb(a,b){for(var c=b.target||b.srcElement;c!=a.wrapper;c=c.parentNode)if(!c||c.nodeType==1&&c.getAttribute("cm-ignore-events")=="true"||c.parentNode==a.sizer&&c!=a.mover)return true}
function lc(a,b,c,d){var e=a.display;if(!c&&(b.target||b.srcElement).getAttribute("not-content")=="true")return null;var f,h;c=e.lineSpace.getBoundingClientRect();try{f=b.clientX-c.left;h=b.clientY-c.top}catch(i){return null}b=za(a,f,h);var k;if(d&&b.xRel==1&&(k=ha(a.doc,b.line).text).length==b.ch){d=kb(k,k.length,a.options.tabSize)-k.length;b=W(b.line,Math.max(0,Math.round((f-yc(a.display).left)/sc(a.display))-d))}return b}function xe(a){if(!lb(this,a)){var b=this.display;b.shift=a.shiftKey;if(Vb(b,
a)){if(!Na){b.scroller.draggable=false;setTimeout(function(){b.scroller.draggable=true},100)}}else if(!Ud(this,a,"gutterClick",true,Qa)){var c=lc(this,a);window.focus();switch(Fe(a)){case 1:if(c)Gf(this,a,c);else(a.target||a.srcElement)==b.scroller&&Xa(a);break;case 2:if(Na)this.state.lastMiddleDown=+new Date;c&&xa(this.doc,c);setTimeout(ob($a,this),20);Xa(a);break;case 3:Vd&&ye(this,a)}}}}function Gf(a,b,c){setTimeout(ob(Sd,a),0);var d=+new Date,e;if(ld&&ld.time>d-400&&sa(ld.pos,c)==0)e="triple";
else if(md&&md.time>d-400&&sa(md.pos,c)==0){e="double";ld={time:d,pos:c}}else{e="single";md={time:d,pos:c}}d=a.doc.sel;var f=ib?b.metaKey:b.ctrlKey,h;a.options.dragDrop&&Hf&&!kd(a)&&e=="single"&&(h=d.contains(c))>-1&&!d.ranges[h].empty()?If(a,b,c,f):Jf(a,b,c,e,f)}function If(a,b,c,d){var e=a.display,f=Pa(a,function(h){if(Na)e.scroller.draggable=false;a.state.draggingText=false;yb(document,"mouseup",f);yb(e.scroller,"drop",f);if(Math.abs(b.clientX-h.clientX)+Math.abs(b.clientY-h.clientY)<10){Xa(h);
d||xa(a.doc,c);$a(a);va&&Fa==9&&setTimeout(function(){document.body.focus();$a(a)},20)}});if(Na)e.scroller.draggable=true;a.state.draggingText=f;e.scroller.dragDrop&&e.scroller.dragDrop();qa(document,"mouseup",f);qa(e.scroller,"drop",f)}function Jf(a,b,c,d,e){function f(da){if(sa(L,da)!=0){L=da;if(d=="rect"){var Ca=[],pa=a.options.tabSize,ya=kb(ha(m,c.line).text,c.ch,pa),ta=kb(ha(m,da.line).text,da.ch,pa),Da=Math.min(ya,ta);ya=Math.max(ya,ta);ta=Math.min(c.line,da.line);for(var Ta=Math.min(a.lastLine(),
Math.max(c.line,da.line));ta<=Ta;ta++){var nb=ha(m,ta).text,nd=Ge(nb,Da,pa);if(Da==ya)Ca.push(new s(W(ta,nd),W(ta,nd)));else nb.length>nd&&Ca.push(new s(W(ta,nd),W(ta,Ge(nb,ya,pa))))}Ca.length||Ca.push(new s(c,c));Ma(m,U(p.ranges.slice(0,t).concat(Ca),t),{origin:"*mouse",scroll:false});a.scrollIntoView(da)}else{Ca=o;pa=Ca.anchor;Da=da;if(d!="single"){da=d=="double"?a.findWordAt(da):new s(W(da.line,0),Y(m,W(da.line+1,0)));if(sa(da.anchor,pa)>0){Da=da.head;pa=r(Ca.from(),da.anchor)}else{Da=da.anchor;
pa=R(Ca.to(),da.head)}}Ca=p.ranges.slice(0);Ca[t]=new s(Y(m,pa),Da);Ma(m,U(Ca,t),Wd)}}}function h(da){var Ca=++fa,pa=lc(a,da,true,d=="rect");if(pa)if(sa(pa,L)!=0){Sd(a);f(pa);var ya=$(k,m);if(pa.line>=ya.to||pa.line<ya.from)setTimeout(Pa(a,function(){fa==Ca&&h(da)}),150)}else{var ta=da.clientY<ea.top?-20:da.clientY>ea.bottom?20:0;ta&&setTimeout(Pa(a,function(){if(fa==Ca){k.scroller.scrollTop+=ta;h(da)}}),50)}}function i(da){fa=Infinity;Xa(da);$a(a);yb(document,"mousemove",na);yb(document,"mouseup",
ia);m.history.lastSelOrigin=null}var k=a.display,m=a.doc;Xa(b);var o,t,p=m.sel,D=p.ranges;if(e&&!b.shiftKey){t=m.sel.contains(c);o=t>-1?D[t]:new s(c,c)}else o=m.sel.primary();if(b.altKey){d="rect";e||(o=new s(c,c));c=lc(a,b,true,true);t=-1}else if(d=="double"){b=a.findWordAt(c);o=a.display.shift||m.extend?Ha(m,o,b.anchor,b.head):b}else if(d=="triple"){b=new s(W(c.line,0),Y(m,W(c.line+1,0)));o=a.display.shift||m.extend?Ha(m,o,b.anchor,b.head):b}else o=Ha(m,o,c);if(e)if(t==-1){t=D.length;Ma(m,U(D.concat([o]),
t),{scroll:false,origin:"*mouse"})}else if(D.length>1&&D[t].empty()&&d=="single"){Ma(m,U(D.slice(0,t).concat(D.slice(t+1)),0));p=m.sel}else Ba(m,t,o,Wd);else{t=0;Ma(m,new F([o],0),Wd);p=m.sel}var L=c,ea=k.wrapper.getBoundingClientRect(),fa=0,na=Pa(a,function(da){Fe(da)?h(da):i(da)}),ia=Pa(a,i);qa(document,"mousemove",na);qa(document,"mouseup",ia)}function Ud(a,b,c,d,e){try{var f=b.clientX,h=b.clientY}catch(i){return false}if(f>=Math.floor(a.display.gutters.getBoundingClientRect().right))return false;
d&&Xa(b);d=a.display;var k=d.lineDiv.getBoundingClientRect();if(h>k.bottom||!jb(a,c))return Xd(b);h-=k.top-d.viewOffset;for(k=0;k<a.options.gutters.length;++k){var m=d.gutters.childNodes[k];if(m&&m.getBoundingClientRect().right>=f){f=Qb(a.doc,h);e(a,c,a,f,a.options.gutters[k],b);return Xd(b)}}}function Ef(a){var b=this;if(!(lb(b,a)||Vb(b.display,a))){Xa(a);if(va)De=+new Date;var c=lc(b,a,true),d=a.dataTransfer.files;if(!(!c||kd(b)))if(d&&d.length&&window.FileReader&&window.File){var e=d.length,f=
Array(e),h=0;a=function(o,t){var p=new FileReader;p.onload=Pa(b,function(){f[t]=p.result;if(++h==e){c=Y(b.doc,c);var D={from:c,to:c,text:Tb(f.join("\n")),origin:"paste"};kc(b.doc,D);cc(b.doc,ja(c,Ib(D)))}});p.readAsText(o)};for(var i=0;i<e;++i)a(d[i],i)}else if(b.state.draggingText&&b.doc.sel.contains(c)>-1){b.state.draggingText(a);setTimeout(ob($a,b),20)}else try{if(f=a.dataTransfer.getData("Text")){if(b.state.draggingText&&!(ib?a.metaKey:a.ctrlKey))var k=b.listSelections();qb(b.doc,ja(c,c));if(k)for(i=
0;i<k.length;++i)od(b.doc,"",k[i].anchor,k[i].head,"drag");b.replaceSelection(f,"around","paste");$a(b)}}catch(m){}}}function uc(a,b){if(!(Math.abs(a.doc.scrollTop-b)<2)){a.doc.scrollTop=b;Gc||T(a,{top:b});if(a.display.scroller.scrollTop!=b)a.display.scroller.scrollTop=b;a.display.scrollbars.setScrollTop(b);Gc&&T(a);db(a,100)}}function ac(a,b,c){if(!(c?b==a.doc.scrollLeft:Math.abs(a.doc.scrollLeft-b)<2)){b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth);a.doc.scrollLeft=
b;Ga(a);if(a.display.scroller.scrollLeft!=b)a.display.scroller.scrollLeft=b;a.display.scrollbars.setScrollLeft(b)}}function ze(a,b){var c=He(b),d=c.x;c=c.y;var e=a.display,f=e.scroller;if(d&&f.scrollWidth>f.clientWidth||c&&f.scrollHeight>f.clientHeight){if(c&&ib&&Na){var h=b.target,i=e.view;a:for(;h!=f;h=h.parentNode)for(var k=0;k<i.length;k++)if(i[k].node==h){a.display.currentWheelTarget=h;break a}}if(d&&!Gc&&!mb&&bb!=null){c&&uc(a,Math.max(0,Math.min(f.scrollTop+c*bb,f.scrollHeight-f.clientHeight)));
ac(a,Math.max(0,Math.min(f.scrollLeft+d*bb,f.scrollWidth-f.clientWidth)));Xa(b);e.wheelStartX=null}else{if(c&&bb!=null){h=c*bb;i=a.doc.scrollTop;k=i+e.wrapper.clientHeight;if(h<0)i=Math.max(0,i+h-50);else k=Math.min(a.doc.height,k+h+50);T(a,{top:i,bottom:k})}if(pd<20)if(e.wheelStartX==null){e.wheelStartX=f.scrollLeft;e.wheelStartY=f.scrollTop;e.wheelDX=d;e.wheelDY=c;setTimeout(function(){if(e.wheelStartX!=null){var m=f.scrollLeft-e.wheelStartX,o=f.scrollTop-e.wheelStartY;m=o&&e.wheelDY&&o/e.wheelDY||
m&&e.wheelDX&&m/e.wheelDX;e.wheelStartX=e.wheelStartY=null;if(m){bb=(bb*pd+m)/(pd+1);++pd}}},200)}else{e.wheelDX+=d;e.wheelDY+=c}}}}function qd(a,b,c){if(typeof b=="string"){b=rd[b];if(!b)return false}if(a.display.pollingFast&&id(a))a.display.pollingFast=false;var d=a.display.shift,e=false;try{if(kd(a))a.state.suppressEdits=true;if(c)a.display.shift=false;e=b(a)!=Ie}finally{a.display.shift=d;a.state.suppressEdits=false}return e}function Kf(a,b,c){for(var d=0;d<a.state.keyMaps.length;d++){var e=Hc(b,
a.state.keyMaps[d],c,a);if(e)return e}return a.options.extraKeys&&Hc(b,a.options.extraKeys,c,a)||Hc(b,a.options.keyMap,c,a)}function sd(a,b,c,d){var e=a.state.keySeq;if(e){if(Lf(b))return"handled";Mf.set(50,function(){if(a.state.keySeq==e){a.state.keySeq=null;gb(a)}});b=e+" "+b}d=Kf(a,b,d);if(d=="multi")a.state.keySeq=b;d=="handled"&&Qa(a,"keyHandled",a,b,c);if(d=="handled"||d=="multi"){Xa(c);Fb(a)}if(e&&!d&&/\'$/.test(b)){Xa(c);return true}return!!d}function Je(a,b){var c=Nf(b,true);if(!c)return false;
return b.shiftKey&&!a.state.keySeq?sd(a,"Shift-"+c,b,function(d){return qd(a,d,true)})||sd(a,c,b,function(d){if(typeof d=="string"?/^go[A-Z]/.test(d):d.motion)return qd(a,d)}):sd(a,c,b,function(d){return qd(a,d)})}function Of(a,b,c){return sd(a,"'"+c+"'",b,function(d){return qd(a,d,true)})}function Be(a){Sd(this);if(!lb(this,a)){if(va&&Fa<11&&a.keyCode==27)a.returnValue=false;var b=a.keyCode;this.display.shift=b==16||a.shiftKey;var c=Je(this,a);if(mb){Yd=c?b:null;if(!c&&b==88&&!we&&(ib?a.metaKey:
a.ctrlKey))this.replaceSelection("",null,"cut")}b==18&&!/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)&&Pf(this)}}function Pf(a){function b(d){if(d.keyCode==18||!d.altKey){tc(c,"CodeMirror-crosshair");yb(document,"keyup",b);yb(document,"mouseover",b)}}var c=a.display.lineDiv;vc(c,"CodeMirror-crosshair");qa(document,"keyup",b);qa(document,"mouseover",b)}function Ae(a){if(a.keyCode==16)this.doc.sel.shift=false;lb(this,a)}function Ce(a){if(!(lb(this,a)||a.ctrlKey&&!a.altKey||ib&&a.metaKey)){var b=
a.keyCode,c=a.charCode;if(mb&&b==Yd){Yd=null;Xa(a)}else if(!((mb&&(!a.which||a.which<10)||Jd)&&Je(this,a))){b=String.fromCharCode(c==null?b:c);if(!Of(this,a,b)){if(va&&Fa>=9)this.display.inputHasSelection=null;jd(this)}}}}function Hd(a){if(a.options.readOnly!="nocursor"){if(!a.state.focused){Oa(a,"focus",a);a.state.focused=true;vc(a.display.wrapper,"CodeMirror-focused");if(!a.curOp&&a.display.selForContextMenu!=a.doc.sel){gb(a);Na&&setTimeout(ob(gb,a,true),0)}}hd(a);Fb(a)}}function Uc(a){if(a.state.focused){Oa(a,
"blur",a);a.state.focused=false;tc(a.display.wrapper,"CodeMirror-focused")}clearInterval(a.display.blinker);setTimeout(function(){if(!a.state.focused)a.display.shift=false},150)}function ye(a,b){function c(){if(e.input.selectionStart!=null){var o=a.somethingSelected(),t=e.input.value="\u200b"+(o?e.input.value:"");e.prevInput=o?"":"\u200b";e.input.selectionStart=1;e.input.selectionEnd=t.length;e.selForContextMenu=a.doc.sel}}function d(){e.contextMenuPending=false;e.inputDiv.style.position="relative";
e.input.style.cssText=i;if(va&&Fa<9)e.scrollbars.setScrollTop(e.scroller.scrollTop=h);hd(a);if(e.input.selectionStart!=null){if(!va||va&&Fa<9)c();var o=0,t=function(){if(e.selForContextMenu==a.doc.sel&&e.input.selectionStart==0)Pa(a,rd.selectAll)(a);else if(o++<10)e.detectingSelectAll=setTimeout(t,500);else gb(a)};e.detectingSelectAll=setTimeout(t,200)}}if(!lb(a,b,"contextmenu")){var e=a.display;if(!(Vb(e,b)||Qf(a,b))){var f=lc(a,b),h=e.scroller.scrollTop;if(!(!f||mb)){a.options.resetSelectionOnContextMenu&&
a.doc.sel.contains(f)==-1&&Pa(a,Ma)(a.doc,ja(f),Eb);var i=e.input.style.cssText;e.inputDiv.style.position="absolute";e.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(b.clientY-5)+"px; left: "+(b.clientX-5)+"px; z-index: 1000; background: "+(va?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(Na)var k=window.scrollY;$a(a);Na&&window.scrollTo(null,k);gb(a);if(!a.somethingSelected())e.input.value=
e.prevInput=" ";e.contextMenuPending=true;e.selForContextMenu=a.doc.sel;clearTimeout(e.detectingSelectAll);va&&Fa>=9&&c();if(Vd){Td(b);var m=function(){yb(window,"mouseup",m);setTimeout(d,20)};qa(window,"mouseup",m)}else setTimeout(d,50)}}}}function Qf(a,b){if(!jb(a,"gutterContextMenu"))return false;return Ud(a,b,"gutterContextMenu",false,Oa)}function Ke(a,b){if(sa(a,b.from)<0)return a;if(sa(a,b.to)<=0)return Ib(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;if(a.line==b.to.line)d+=
Ib(b).ch-b.to.ch;return W(c,d)}function Zd(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new s(Ke(e.anchor,b),Ke(e.head,b)))}return U(c,a.sel.primIndex)}function Le(a,b,c){return a.line==b.line?W(c.line,a.ch-b.ch+c.ch):W(c.line+(a.line-b.line),a.ch)}function Me(a,b,c){b={canceled:false,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){this.canceled=true}};if(c)b.update=function(d,e,f,h){if(d)this.from=Y(a,d);if(e)this.to=Y(a,e);if(f)this.text=f;if(h!==
undefined)this.origin=h};Oa(a,"beforeChange",a,b);a.cm&&Oa(a.cm,"beforeChange",a.cm,b);if(b.canceled)return null;return{from:b.from,to:b.to,text:b.text,origin:b.origin}}function kc(a,b,c){if(a.cm){if(!a.cm.curOp)return Pa(a.cm,kc)(a,b,c);if(a.cm.state.suppressEdits)return}if(jb(a,"beforeChange")||a.cm&&jb(a.cm,"beforeChange")){b=Me(a,b,true);if(!b)return}if(c=Ne&&!c&&Rf(a,b.from,b.to))for(var d=c.length-1;d>=0;--d)Oe(a,{from:c[d].from,to:c[d].to,text:d?[""]:b.text});else Oe(a,b)}function Oe(a,b){if(!(b.text.length==
1&&b.text[0]==""&&sa(b.from,b.to)==0)){var c=Zd(a,b);Pe(a,b,c,a.cm?a.cm.curOp.id:NaN);Ic(a,b,c,$d(a,b));var d=[];Wb(a,function(e,f){if(!f&&Ua(d,e.history)==-1){Qe(e.history,b);d.push(e.history)}Ic(e,b,null,$d(e,b))})}}function td(a,b,c){if(!(a.cm&&a.cm.state.suppressEdits)){for(var d=a.history,e,f=a.sel,h=b=="undo"?d.done:d.undone,i=b=="undo"?d.undone:d.done,k=0;k<h.length;k++){e=h[k];if(c?e.ranges&&!e.equals(a.sel):!e.ranges)break}if(k!=h.length){for(d.lastOrigin=d.lastSelOrigin=null;;){e=h.pop();
if(e.ranges){Wc(e,i);if(c&&!e.equals(a.sel)){Ma(a,e,{clearRedo:false});return}f=e}else break}c=[];Wc(f,i);i.push({changes:c,generation:d.generation});d.generation=e.generation||++d.maxGeneration;d=jb(a,"beforeChange")||a.cm&&jb(a.cm,"beforeChange");for(k=e.changes.length-1;k>=0;--k){var m=e.changes[k];m.origin=b;if(d&&!Me(a,m,false)){h.length=0;break}c.push(ae(a,m));f=k?Zd(a,m):Ia(h);Ic(a,m,f,Re(a,m));!k&&a.cm&&a.cm.scrollIntoView({from:m.from,to:Ib(m)});var o=[];Wb(a,function(t,p){if(!p&&Ua(o,t.history)==
-1){Qe(t.history,m);o.push(t.history)}Ic(t,m,null,Re(t,m))})}}}}function Se(a,b){if(b!=0){a.first+=b;a.sel=new F(Dc(a.sel.ranges,function(e){return new s(W(e.anchor.line+b,e.anchor.ch),W(e.head.line+b,e.head.ch))}),a.sel.primIndex);if(a.cm){ab(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;d<c.viewTo;d++)xb(a.cm,d,"gutter")}}}function Ic(a,b,c,d){if(a.cm&&!a.cm.curOp)return Pa(a.cm,Ic)(a,b,c,d);if(b.to.line<a.first)Se(a,b.text.length-1-(b.to.line-b.from.line));else if(!(b.from.line>
a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);Se(a,e);b={from:W(a.first,0),to:W(b.to.line+e,b.to.ch),text:[Ia(b.text)],origin:b.origin}}e=a.lastLine();if(b.to.line>e)b={from:b.from,to:W(e,ha(a,e).text.length),text:[b.text[0]],origin:b.origin};b.removed=Jc(a,b.from,b.to);c||(c=Zd(a,b));a.cm?Sf(a.cm,b,d):be(a,b,d);qb(a,c,Eb)}}function Sf(a,b,c){var d=a.doc,e=a.display,f=b.from,h=b.to,i=false,k=f.line;if(!a.options.lineWrapping){k=La(tb(ha(d,f.line)));d.iter(k,h.line+
1,function(m){if(m==e.maxLine)return i=true})}d.sel.contains(b.from,b.to)>-1&&te(a);be(d,b,c,u(a));if(!a.options.lineWrapping){d.iter(k,f.line+b.text.length,function(m){var o=M(m);if(o>e.maxLineLength){e.maxLine=m;e.maxLineLength=o;e.maxLineChanged=true;i=false}});if(i)a.curOp.updateMaxLine=true}d.frontier=Math.min(d.frontier,f.line);db(a,400);c=b.text.length-(h.line-f.line)-1;if(b.full)ab(a);else f.line==h.line&&b.text.length==1&&!Te(a.doc,b)?xb(a,f.line,"text"):ab(a,f.line,h.line+1,c);c=jb(a,"changes");
if((d=jb(a,"change"))||c){b={from:f,to:h,text:b.text,removed:b.removed,origin:b.origin};d&&Qa(a,"change",a,b);if(c)(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b)}a.display.selForContextMenu=null}function od(a,b,c,d,e){d||(d=c);if(sa(d,c)<0){var f=d;d=c;c=f}if(typeof b=="string")b=Tb(b);kc(a,{from:c,to:d,text:b,origin:e})}function fd(a,b,c,d,e){var f=a.display,h=vb(a.display);if(c<0)c=0;var i=a.curOp&&a.curOp.scrollTop!=null?a.curOp.scrollTop:f.scroller.scrollTop,k=Db(a),m={};if(e-c>k)e=c+k;
var o=a.doc.height+(f.mover.offsetHeight-f.lineSpace.offsetHeight),t=c<h;h=e>o-h;if(c<i)m.scrollTop=t?0:c;else if(e>i+k){c=Math.min(c,(h?o:e)-k);if(c!=i)m.scrollTop=c}i=a.curOp&&a.curOp.scrollLeft!=null?a.curOp.scrollLeft:f.scroller.scrollLeft;a=hb(a)-(a.options.fixedGutter?f.gutters.offsetWidth:0);if(f=d-b>a)d=b+a;if(b<10)m.scrollLeft=0;else if(b<i)m.scrollLeft=Math.max(0,b-(f?0:10));else if(d>a+i-3)m.scrollLeft=d+(f?0:10)-a;return m}function ce(a,b,c){if(b!=null||c!=null)ud(a);if(b!=null)a.curOp.scrollLeft=
(a.curOp.scrollLeft==null?a.doc.scrollLeft:a.curOp.scrollLeft)+b;if(c!=null)a.curOp.scrollTop=(a.curOp.scrollTop==null?a.doc.scrollTop:a.curOp.scrollTop)+c}function dc(a){ud(a);var b=a.getCursor(),c=b,d=b;if(!a.options.lineWrapping){c=b.ch?W(b.line,b.ch-1):b;d=W(b.line,b.ch+1)}a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:true}}function ud(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=K(a,b.from),d=K(a,b.to);b=fd(a,Math.min(c.left,d.left),Math.min(c.top,
d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(b.scrollLeft,b.scrollTop)}}function Ec(a,b,c,d){var e=a.doc,f;if(c==null)c="add";if(c=="smart")if(e.mode.indent)f=fb(a,b);else c="prev";var h=a.options.tabSize,i=ha(e,b),k=kb(i.text,null,h);if(i.stateAfter)i.stateAfter=null;var m=i.text.match(/^\s*/)[0],o;if(!d&&!/\S/.test(i.text)){o=0;c="not"}else if(c=="smart"){o=e.mode.indent(f,i.text.slice(m.length),i.text);if(o==Ie||o>150){if(!d)return;c="prev"}}if(c==
"prev")o=b>e.first?kb(ha(e,b-1).text,null,h):0;else if(c=="add")o=k+a.options.indentUnit;else if(c=="subtract")o=k-a.options.indentUnit;else if(typeof c=="number")o=k+c;o=Math.max(0,o);c="";d=0;if(a.options.indentWithTabs)for(a=Math.floor(o/h);a;--a){d+=h;c+="\t"}if(d<o)c+=Ue(o-d);if(c!=m)od(e,c,W(b,0),W(b,m.length),"+input");else for(a=0;a<e.sel.ranges.length;a++){h=e.sel.ranges[a];if(h.head.line==b&&h.head.ch<m.length){d=W(b,m.length);Ba(e,a,new s(d,d));break}}i.stateAfter=null}function vd(a,b,
c,d){var e=b,f=b;if(typeof b=="number")f=ha(a,Math.max(a.first,Math.min(b,a.first+a.size-1)));else e=La(b);if(e==null)return null;d(f,e)&&a.cm&&xb(a.cm,e,c);return f}function mc(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&sa(f.from,Ia(d).to)<=0;){var h=d.pop();if(sa(h.from,f.from)<0){f.from=h.from;break}}d.push(f)}Gb(a,function(){for(var i=d.length-1;i>=0;i--)od(a.doc,"",d[i].from,d[i].to,"+delete");dc(a)})}function de(a,b,c,d,e){function f(L){var ea=(e?Rd:
Ve)(m,i,c,true);if(ea==null){if(L=!L){L=h+c;if(L<a.first||L>=a.first+a.size)L=o=false;else{h=L;L=m=ha(a,L)}}if(L)i=e?(c<0?ed:dd)(m):c<0?m.text.length:0;else return o=false}else i=ea;return true}var h=b.line,i=b.ch,k=c,m=ha(a,h),o=true;if(d=="char")f();else if(d=="column")f(true);else if(d=="word"||d=="group"){var t=null;d=d=="group";b=a.cm&&a.cm.getHelper(b,"wordChars");for(var p=true;;p=false){if(c<0&&!f(!p))break;var D=m.text.charAt(i)||"\n";D=wd(D,b)?"w":d&&D=="\n"?"n":!d||/\s/.test(D)?null:"p";
if(d&&!p&&!D)D="s";if(t&&t!=D){if(c<0){c=1;f()}break}if(D)t=D;if(c>0&&!f(!p))break}}k=ec(a,W(h,i),k,true);if(!o)k.hitSide=true;return k}function We(a,b,c,d){var e=a.doc,f=b.left,h;if(d=="page")h=b.top+c*(Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight)-(c<0?1.5:0.5)*vb(a.display));else if(d=="line")h=c>0?b.bottom+3:b.top-3;for(;;){var i=za(a,f,h);if(!i.outside)break;if(c<0?h<=0:h>=e.height){i.hitSide=true;break}h+=c*5}return i}function oa(a,b,c,d){j.defaults[a]=
b;if(c)$b[a]=d?function(e,f,h){h!=ne&&c(e,f,h)}:c}function Tf(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var c,d,e,f,h=0;h<b.length-1;h++){var i=b[h];if(/^(cmd|meta|m)$/i.test(i))f=true;else if(/^a(lt)?$/i.test(i))c=true;else if(/^(c|ctrl|control)$/i.test(i))d=true;else if(/^s(hift)$/i.test(i))e=true;else throw Error("Unrecognized modifier name: "+i);}if(c)a="Alt-"+a;if(d)a="Ctrl-"+a;if(f)a="Cmd-"+a;if(e)a="Shift-"+a;return a}function xd(a){return typeof a=="string"?Jb[a]:a}function nc(a,b,c,
d,e){if(d&&d.shared)return Uf(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return Pa(a.cm,nc)(a,b,c,d,e);var f=new Xb(a,e);e=sa(b,c);d&&zb(d,f,false);if(e>0||e==0&&f.clearWhenEmpty!==false)return f;if(f.replacedWith){f.collapsed=true;f.widgetNode=ga("span",[f.replacedWith],"CodeMirror-widget");d.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true");if(d.insertLeft)f.widgetNode.insertLeft=true}if(f.collapsed){if(Xe(a,b.line,b,c,f)||b.line!=c.line&&Xe(a,c.line,b,c,f))throw Error("Inserting collapsed marker partially overlapping an existing one");
Cb=true}f.addToHistory&&Pe(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var h=b.line,i=a.cm,k;a.iter(h,c.line+1,function(m){if(i&&f.collapsed&&!i.options.lineWrapping&&tb(m)==i.display.maxLine)k=true;f.collapsed&&h!=b.line&&pb(m,0);var o=new yd(f,h==b.line?b.ch:null,h==c.line?c.ch:null);m.markedSpans=m.markedSpans?m.markedSpans.concat([o]):[o];o.marker.attachLine(m);++h});f.collapsed&&a.iter(b.line,c.line+1,function(m){Nb(a,m)&&pb(m,0)});f.clearOnEnter&&qa(f,"beforeCursorEnter",function(){f.clear()});
if(f.readOnly){Ne=true;if(a.history.done.length||a.history.undone.length)a.clearHistory()}if(f.collapsed){f.id=++Vf;f.atomic=true}if(i){if(k)i.curOp.updateMaxLine=true;if(f.collapsed)ab(i,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle||f.css)for(d=b.line;d<=c.line;d++)xb(i,d,"text");f.atomic&&Zc(i.doc);Qa(i,"markerAdded",i,f)}return f}function Uf(a,b,c,d,e){d=zb(d);d.shared=false;var f=[nc(a,b,c,d,e)],h=f[0],i=d.widgetNode;Wb(a,function(k){if(i)d.widgetNode=i.cloneNode(true);
f.push(nc(k,Y(k,b),Y(k,c),d,e));for(var m=0;m<k.linked.length;++m)if(k.linked[m].isParent)return;h=Ia(f)});return new zd(f,h)}function Ye(a){return a.findMarks(W(a.first,0),a.clipPos(W(a.lastLine())),function(b){return b.parent})}function Wf(a){for(var b=0;b<a.length;b++){var c=a[b],d=[c.primary.doc];Wb(c.primary.doc,function(h){d.push(h)});for(var e=0;e<c.markers.length;e++){var f=c.markers[e];if(Ua(d,f.doc)==-1){f.parent=null;c.markers.splice(e--,1)}}}}function yd(a,b,c){this.marker=a;this.from=
b;this.to=c}function Kc(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function $d(a,b){if(b.full)return null;var c=Ka(a,b.from.line)&&ha(a,b.from.line).markedSpans,d=Ka(a,b.to.line)&&ha(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,h=sa(b.from,b.to)==0;if(c)for(var i=0,k;i<c.length;++i){var m=c[i],o=m.marker;if(m.from==null||(o.inclusiveLeft?m.from<=e:m.from<e)||m.from==e&&o.type=="bookmark"&&(!h||!m.marker.insertLeft)){var t=m.to==null||(o.inclusiveRight?
m.to>=e:m.to>e);(k||(k=[])).push(new yd(o,m.from,t?null:m.to))}}c=k;if(d){i=0;for(var p;i<d.length;++i){k=d[i];m=k.marker;if(k.to==null||(m.inclusiveRight?k.to>=f:k.to>f)||k.from==f&&m.type=="bookmark"&&(!h||k.marker.insertLeft)){o=k.from==null||(m.inclusiveLeft?k.from<=f:k.from<f);(p||(p=[])).push(new yd(m,o?null:k.from-f,k.to==null?null:k.to-f))}}}d=p;h=b.text.length==1;p=Ia(b.text).length+(h?e:0);if(c)for(f=0;f<c.length;++f){i=c[f];if(i.to==null)if(k=Kc(d,i.marker)){if(h)i.to=k.to==null?null:k.to+
p}else i.to=e}if(d)for(f=0;f<d.length;++f){i=d[f];if(i.to!=null)i.to+=p;if(i.from==null){k=Kc(c,i.marker);if(!k){i.from=p;if(h)(c||(c=[])).push(i)}}else{i.from+=p;if(h)(c||(c=[])).push(i)}}if(c)c=Ze(c);if(d&&d!=c)d=Ze(d);e=[c];if(!h){h=b.text.length-2;var D;if(h>0&&c)for(f=0;f<c.length;++f)if(c[f].to==null)(D||(D=[])).push(new yd(c[f].marker,null,null));for(f=0;f<h;++f)e.push(D);e.push(d)}return e}function Ze(a){for(var b=0;b<a.length;++b){var c=a[b];c.from!=null&&c.from==c.to&&c.marker.clearWhenEmpty!==
false&&a.splice(b--,1)}if(!a.length)return null;return a}function Re(a,b){var c;if(c=b["spans_"+a.id]){for(var d=0,e=[];d<b.text.length;++d)e.push(Xf(c[d]));c=e}else c=null;d=$d(a,b);if(!c)return d;if(!d)return c;for(e=0;e<c.length;++e){var f=c[e],h=d[e];if(f&&h){var i=0;a:for(;i<h.length;++i){for(var k=h[i],m=0;m<f.length;++m)if(f[m].marker==k.marker)continue a;f.push(k)}}else if(h)c[e]=h}return c}function Rf(a,b,c){var d=null;a.iter(b.line,c.line+1,function(o){if(o.markedSpans)for(var t=0;t<o.markedSpans.length;++t){var p=
o.markedSpans[t].marker;if(p.readOnly&&(!d||Ua(d,p)==-1))(d||(d=[])).push(p)}});if(!d)return null;a=[{from:b,to:c}];for(b=0;b<d.length;++b){c=d[b];for(var e=c.find(0),f=0;f<a.length;++f){var h=a[f];if(!(sa(h.to,e.from)<0||sa(h.from,e.to)>0)){var i=[f,1],k=sa(h.from,e.from),m=sa(h.to,e.to);if(k<0||!c.inclusiveLeft&&!k)i.push({from:h.from,to:e.from});if(m>0||!c.inclusiveRight&&!m)i.push({from:e.to,to:h.to});a.splice.apply(a,i);f+=i.length-1}}}return a}function $e(a){var b=a.markedSpans;if(b){for(var c=
0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function af(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function bf(a,b){var c=a.lines.length-b.lines.length;if(c!=0)return c;c=a.find();var d=b.find(),e=sa(c.from,d.from)||(a.inclusiveLeft?-1:0)-(b.inclusiveLeft?-1:0);if(e)return-e;if(c=sa(c.to,d.to)||(a.inclusiveRight?1:0)-(b.inclusiveRight?1:0))return c;return b.id-a.id}function Pb(a,b){var c=Cb&&a.markedSpans,d;if(c)for(var e,f=0;f<c.length;++f){e=
c[f];if(e.marker.collapsed&&(b?e.from:e.to)==null&&(!d||bf(d,e.marker)<0))d=e.marker}return d}function Xe(a,b,c,d,e){a=ha(a,b);if(a=Cb&&a.markedSpans)for(b=0;b<a.length;++b){var f=a[b];if(f.marker.collapsed){var h=f.marker.find(0),i=sa(h.from,c)||(f.marker.inclusiveLeft?-1:0)-(e.inclusiveLeft?-1:0),k=sa(h.to,d)||(f.marker.inclusiveRight?1:0)-(e.inclusiveRight?1:0);if(!(i>=0&&k<=0||i<=0&&k>=0))if(i<=0&&(sa(h.to,c)>0||f.marker.inclusiveRight&&e.inclusiveLeft)||i>=0&&(sa(h.from,d)<0||f.marker.inclusiveLeft&&
e.inclusiveRight))return true}}}function tb(a){for(var b;b=Pb(a,true);)a=b.find(-1,true).line;return a}function Kd(a,b){var c=ha(a,b),d=tb(c);if(c==d)return b;return La(d)}function qe(a,b){if(b>a.lastLine())return b;var c=ha(a,b),d;if(!Nb(a,c))return b;for(;d=Pb(c,false);)c=d.find(1,true).line;return La(c)+1}function Nb(a,b){var c=Cb&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e){d=c[e];if(d.marker.collapsed){if(d.from==null)return true;if(!d.marker.widgetNode)if(d.from==0&&d.marker.inclusiveLeft&&
ee(a,b,d))return true}}}function ee(a,b,c){if(c.to==null){b=c.marker.find(1,true);return ee(a,b.line,Kc(b.line.markedSpans,c.marker))}if(c.marker.inclusiveRight&&c.to==b.text.length)return true;for(var d,e=0;e<b.markedSpans.length;++e){d=b.markedSpans[e];if(d.marker.collapsed&&!d.marker.widgetNode&&d.from==c.to&&(d.to==null||d.to!=c.from)&&(d.marker.inclusiveLeft||c.marker.inclusiveRight)&&ee(a,b,d))return true}}function cf(a,b,c){if(wb(b)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop))ce(a,null,c)}
function Bc(a){if(a.height!=null)return a.height;var b;a:{var c=document.body,d=a.node;if(c.contains)b=c.contains(d);else for(;d=d.parentNode;)if(d==c){b=true;break a}}if(!b){b="position: relative;";if(a.coverGutter)b+="margin-left: -"+a.cm.display.gutters.offsetWidth+"px;";if(a.noHScroll)b+="width: "+a.cm.display.wrapper.clientWidth+"px;";rb(a.cm.display.measure,ga("div",[a.node],null,b))}return a.height=a.node.offsetHeight}function Yf(a,b,c,d){var e=new Ad(a,c,d);if(e.noHScroll)a.display.alignWidgets=
true;vd(a.doc,b,"widget",function(f){var h=f.widgets||(f.widgets=[]);e.insertAt==null?h.push(e):h.splice(Math.min(h.length-1,Math.max(0,e.insertAt)),0,e);e.line=f;if(!Nb(a.doc,f)){h=wb(f)<a.doc.scrollTop;pb(f,f.height+Bc(e));h&&ce(a,null,e.height);a.curOp.forceUpdate=true}return true});return e}function df(a,b){if(a)for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";if(b[d]==null)b[d]=c[2];else RegExp("(?:^|s)"+
c[2]+"(?:$|s)").test(b[d])||(b[d]+=" "+c[2])}return a}function ef(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode){var c=j.innerMode(a,b);if(c.mode.blankLine)return c.mode.blankLine(c.state)}}function fe(a,b,c,d){for(var e=0;e<10;e++){if(d)d[0]=j.innerMode(a,c).mode;var f=a.token(b,c);if(b.pos>b.start)return f}throw Error("Mode "+a.name+" failed to advance stream.");}function ff(a,b,c,d){function e(p){return{start:o.start,end:o.pos,string:o.current(),type:i||null,state:p?gc(f.mode,m):m}}
var f=a.doc,h=f.mode,i;b=Y(f,b);var k=ha(f,b.line),m=fb(a,b.line,c),o=new Bd(k.text,a.options.tabSize),t;if(d)t=[];for(;(d||o.pos<b.ch)&&!o.eol();){o.start=o.pos;i=fe(h,o,m);d&&t.push(e(true))}return d?t:e()}function gf(a,b,c,d,e,f,h){var i=c.flattenSpans;if(i==null)i=a.options.flattenSpans;var k=0,m=null,o=new Bd(b,a.options.tabSize),t,p=a.options.addModeClass&&[null];for(b==""&&df(ef(c,d),f);!o.eol();){if(o.pos>a.options.maxHighlightLength){i=false;h&&Md(a,b,d,o.pos);o.pos=b.length;t=null}else t=
df(fe(c,o,d,p),f);if(p){var D=p[0].name;if(D)t="m-"+(t?D+" "+t:D)}if(!i||m!=t){for(;k<o.start;){k=Math.min(o.start,k+5E4);e(k,m)}m=t}o.start=o.pos}for(;k<o.pos;){a=Math.min(o.pos,k+5E4);e(a,m);k=a}}function ue(a,b,c,d){var e=[a.state.modeGen],f={};gf(a,b.text,a.doc.mode,c,function(m,o){e.push(m,o)},f,d);for(c=0;c<a.state.overlays.length;++c){var h=a.state.overlays[c],i=1,k=0;gf(a,b.text,h.mode,true,function(m,o){for(var t=i;k<m;){var p=e[i];p>m&&e.splice(i,1,m,e[i+1],p);i+=2;k=Math.min(m,p)}if(o)if(h.opaque){e.splice(t,
i-t,m,"cm-overlay "+o);i=t+2}else for(;t<i;t+=2){p=e[t+1];e[t+1]=(p?p+" ":"")+"cm-overlay "+o}},f)}return{styles:e,classes:f.bgClass||f.textClass?f:null}}function hf(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=ue(a,b,b.stateAfter=fb(a,La(b)));b.styles=d.styles;if(d.classes)b.styleClasses=d.classes;else if(b.styleClasses)b.styleClasses=null;c===a.doc.frontier&&a.doc.frontier++}return b.styles}function Md(a,b,c,d){var e=a.doc.mode,f=new Bd(b,a.options.tabSize);f.start=f.pos=d||0;for(b==
""&&ef(e,c);!f.eol()&&f.pos<=a.options.maxHighlightLength;){fe(e,f,c);f.start=f.pos}}function jf(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?Zf:$f;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function re(a,b){var c=ga("span",null,null,Na?"padding-right: .1px":null);c={pre:ga("pre",[c]),content:c,col:0,pos:0,cm:a};b.measure={};for(var d=0;d<=(b.rest?b.rest.length:0);d++){var e=d?b.rest[d-1]:b.line,f;c.pos=0;c.addToken=ag;if((va||Na)&&a.getOption("lineWrapping"))c.addToken=bg(c.addToken);
var h;if(ge!=null)h=ge;else{h=rb(a.display.measure,document.createTextNode("A\u062eA"));var i=ic(h,0,1).getBoundingClientRect();h=!i||i.left==i.right?false:ge=ic(h,1,2).getBoundingClientRect().right-i.right<3}if(h&&(f=sb(e)))c.addToken=cg(c.addToken,f);c.map=[];i=b!=a.display.externalMeasured&&La(e);h=c;i=hf(a,e,i);var k=e.markedSpans,m=e.text,o=0;if(k){var t=m.length,p=0;nb=1;for(var D="",L=void 0,ea=void 0,fa=0,na=void 0,ia=void 0,da=void 0,Ca=void 0,pa=void 0;;){if(fa==p){na=ia=da=Ca=ea="";pa=
null;fa=Infinity;for(var ya=[],ta=0;ta<k.length;++ta){var Da=k[ta],Ta=Da.marker;if(Da.from<=p&&(Da.to==null||Da.to>p)){if(Da.to!=null&&fa>Da.to){fa=Da.to;ia=""}if(Ta.className)na+=" "+Ta.className;if(Ta.css)ea=Ta.css;if(Ta.startStyle&&Da.from==p)da+=" "+Ta.startStyle;if(Ta.endStyle&&Da.to==fa)ia+=" "+Ta.endStyle;if(Ta.title&&!Ca)Ca=Ta.title;if(Ta.collapsed&&(!pa||bf(pa.marker,Ta)<0))pa=Da}else if(Da.from>p&&fa>Da.from)fa=Da.from;Ta.type=="bookmark"&&Da.from==p&&Ta.widgetNode&&ya.push(Ta)}if(pa&&(pa.from||
0)==p){kf(h,(pa.to==null?t+1:pa.to)-p,pa.marker,pa.from==null);if(pa.to==null)break}if(!pa&&ya.length)for(ta=0;ta<ya.length;++ta)kf(h,0,ya[ta])}if(p>=t)break;for(ya=Math.min(t,fa);;){if(D){ta=p+D.length;if(!pa){Da=ta>ya?D.slice(0,ya-p):D;h.addToken(h,Da,L?L+na:na,da,p+Da.length==fa?ia:"",Ca,ea)}if(ta>=ya){D=D.slice(ya-p);p=ya;break}p=ta;da=""}D=m.slice(o,o=i[nb++]);L=jf(i[nb++],h.cm.options)}}}else for(var nb=1;nb<i.length;nb+=2)h.addToken(h,m.slice(o,o=i[nb]),jf(i[nb+1],h.cm.options));if(e.styleClasses){if(e.styleClasses.bgClass)c.bgClass=
he(e.styleClasses.bgClass,c.bgClass||"");if(e.styleClasses.textClass)c.textClass=he(e.styleClasses.textClass,c.textClass||"")}c.map.length==0&&c.map.push(0,0,c.content.appendChild(dg(a.display.measure)));if(d==0){b.measure.map=c.map;b.measure.cache={}}else{(b.measure.maps||(b.measure.maps=[])).push(c.map);(b.measure.caches||(b.measure.caches=[])).push({})}}if(Na&&/\bcm-tab\b/.test(c.content.lastChild.className))c.content.className="cm-tab-wrap-hack";Oa(a,"renderLine",a,b.line,c.pre);if(c.pre.className)c.textClass=
he(c.pre.className,c.textClass||"");return c}function ag(a,b,c,d,e,f,h){if(b){var i=a.cm.options.specialChars,k=false;if(i.test(b)){D=document.createDocumentFragment();for(var m=0;;){i.lastIndex=m;var o=i.exec(b),t=o?o.index-m:b.length-m;if(t){var p=document.createTextNode(b.slice(m,m+t));va&&Fa<9?D.appendChild(ga("span",[p])):D.appendChild(p);a.map.push(a.pos,a.pos+t,p);a.col+=t;a.pos+=t}if(!o)break;m+=t+1;if(o[0]=="\t"){p=a.cm.options.tabSize;o=p-a.col%p;p=D.appendChild(ga("span",Ue(o),"cm-tab"));
a.col+=o}else{p=a.cm.options.specialCharPlaceholder(o[0]);va&&Fa<9?D.appendChild(ga("span",[p])):D.appendChild(p);a.col+=1}a.map.push(a.pos,a.pos+1,p);a.pos++}}else{a.col+=b.length;var D=document.createTextNode(b);a.map.push(a.pos,a.pos+b.length,D);if(va&&Fa<9)k=true;a.pos+=b.length}if(c||d||e||k||h){b=c||"";if(d)b+=d;if(e)b+=e;d=ga("span",[D],b,h);if(f)d.title=f;return a.content.appendChild(d)}a.content.appendChild(D)}}function bg(a){function b(c){for(var d=" ",e=0;e<c.length-2;++e)d+=e%2?" ":"\u00a0";
d+=" ";return d}return function(c,d,e,f,h,i){a(c,d.replace(/ {3,}/g,b),e,f,h,i)}}function cg(a,b){return function(c,d,e,f,h,i){e=e?e+" cm-force-border":"cm-force-border";for(var k=c.pos,m=k+d.length;;){for(var o=0;o<b.length;o++){var t=b[o];if(t.to>k&&t.from<=k)break}if(t.to>=m)return a(c,d,e,f,h,i);a(c,d.slice(0,t.to-k),e,f,null,i);f=null;d=d.slice(t.to-k);k=t.to}}}function kf(a,b,c,d){if(c=!d&&c.widgetNode){a.map.push(a.pos,a.pos+b,c);a.content.appendChild(c)}a.pos+=b}function Te(a,b){return b.from.ch==
0&&b.to.ch==0&&Ia(b.text)==""&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function be(a,b,c,d){function e(fa){return c?c[fa]:null}function f(fa,na,ia){var da=d;fa.text=na;if(fa.stateAfter)fa.stateAfter=null;if(fa.styles)fa.styles=null;if(fa.order!=null)fa.order=null;$e(fa);af(fa,ia);na=da?da(fa):1;na!=fa.height&&pb(fa,na);Qa(fa,"change",fa,b)}function h(fa,na){for(var ia=fa,da=[];ia<na;++ia)da.push(new Lc(m[ia],e(ia),d));return da}var i=b.from,k=b.to,m=b.text,o=ha(a,i.line),t=ha(a,k.line),p=Ia(m),
D=e(m.length-1),L=k.line-i.line;if(b.full){a.insert(0,h(0,m.length));a.remove(m.length,a.size-m.length)}else if(Te(a,b)){var ea=h(0,m.length-1);f(t,t.text,D);L&&a.remove(i.line,L);ea.length&&a.insert(i.line,ea)}else if(o==t)if(m.length==1)f(o,o.text.slice(0,i.ch)+p+o.text.slice(k.ch),D);else{ea=h(1,m.length-1);ea.push(new Lc(p+o.text.slice(k.ch),D,d));f(o,o.text.slice(0,i.ch)+m[0],e(0));a.insert(i.line+1,ea)}else if(m.length==1){f(o,o.text.slice(0,i.ch)+m[0]+t.text.slice(k.ch),e(0));a.remove(i.line+
1,L)}else{f(o,o.text.slice(0,i.ch)+m[0],e(0));f(t,p+t.text.slice(k.ch),D);ea=h(1,m.length-1);L>1&&a.remove(i.line+1,L-1);a.insert(i.line+1,ea)}Qa(a,"change",a,b)}function Mc(a){this.lines=a;this.parent=null;for(var b=0,c=0;b<a.length;++b){a[b].parent=this;c+=a[b].height}this.height=c}function Nc(a){this.children=a;for(var b=0,c=0,d=0;d<a.length;++d){var e=a[d];b+=e.chunkSize();c+=e.height;e.parent=this}this.size=b;this.height=c;this.parent=null}function Wb(a,b,c){function d(e,f,h){if(e.linked)for(var i=
0;i<e.linked.length;++i){var k=e.linked[i];if(k.doc!=f){var m=h&&k.sharedHist;if(!(c&&!m)){b(k.doc,m);d(k.doc,e,m)}}}}d(a,null,true)}function me(a,b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;g(a);X(a);a.options.lineWrapping||x(a);a.options.mode=b.modeOption;ab(a)}function ha(a,b){b-=a.first;if(b<0||b>=a.size)throw Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(b<f){c=e;break}b-=
f}return c.lines[b]}function Jc(a,b,c){var d=[],e=b.line;a.iter(b.line,c.line+1,function(f){f=f.text;if(e==c.line)f=f.slice(0,c.ch);if(e==b.line)f=f.slice(b.ch);d.push(f);++e});return d}function ie(a,b,c){var d=[];a.iter(b,c,function(e){d.push(e.text)});return d}function pb(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function La(a){if(a.parent==null)return null;var b=a.parent;a=Ua(b.lines,a);for(var c=b.parent;c;b=c,c=c.parent)for(var d=0;;++d){if(c.children[d]==b)break;a+=c.children[d].chunkSize()}return a+
b.first}function Qb(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],f=e.height;if(b<f){a=e;continue a}b-=f;c+=e.chunkSize()}return c}while(!a.lines);for(d=0;d<a.lines.length;++d){e=a.lines[d].height;if(b<e)break;b-=e}return c+d}function wb(a){a=tb(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;else b+=e.height}for(a=c.parent;a;c=a,a=c.parent)for(d=0;d<a.children.length;++d){e=a.children[d];if(e==c)break;else b+=e.height}return b}
function sb(a){var b=a.order;if(b==null)b=a.order=eg(a.text);return b}function Cd(a){this.done=[];this.undone=[];this.undoDepth=Infinity;this.lastModTime=this.lastSelTime=0;this.lastOrigin=this.lastSelOrigin=this.lastOp=this.lastSelOp=null;this.generation=this.maxGeneration=a||1}function ae(a,b){var c={from:W(b.from.line,b.from.ch),to:Ib(b),text:Jc(a,b.from,b.to)};lf(a,c,b.from.line,b.to.line+1);Wb(a,function(d){lf(d,c,b.from.line,b.to.line+1)},true);return c}function se(a){for(;a.length;)if(Ia(a).ranges)a.pop();
else break}function Pe(a,b,c,d){var e=a.history;e.undone.length=0;var f=+new Date,h,i;if(i=e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&(b.origin.charAt(0)=="+"&&a.cm&&e.lastModTime>f-a.cm.options.historyEventDelay||b.origin.charAt(0)=="*")){var k;if(e.lastOp==d){se(e.done);k=Ia(e.done)}else if(e.done.length&&!Ia(e.done).ranges)k=Ia(e.done);else if(e.done.length>1&&!e.done[e.done.length-2].ranges){e.done.pop();k=Ia(e.done)}i=h=k}if(i){var m=Ia(h.changes);if(sa(b.from,b.to)==0&&sa(b.from,m.to)==
0)m.to=Ib(b);else h.changes.push(ae(a,b))}else{h=Ia(e.done);if(!h||!h.ranges)Wc(a.sel,e.done);h={changes:[ae(a,b)],generation:e.generation};for(e.done.push(h);e.done.length>e.undoDepth;){e.done.shift();e.done[0].ranges||e.done.shift()}}e.done.push(c);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime=f;e.lastOp=e.lastSelOp=d;e.lastOrigin=e.lastSelOrigin=b.origin;m||Oa(a,"historyAdded")}function Wc(a,b){var c=Ia(b);c&&c.ranges&&c.equals(a)||b.push(a)}function lf(a,b,c,d){var e=b["spans_"+a.id],
f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(h){if(h.markedSpans)(e||(e=b["spans_"+a.id]={}))[f]=h.markedSpans;++f})}function Xf(a){if(!a)return null;for(var b=0,c;b<a.length;++b)if(a[b].marker.explicitlyCleared)c||(c=a.slice(0,b));else c&&c.push(a[b]);return!c?a:c.length?c:null}function oc(a,b,c){for(var d=0,e=[];d<a.length;++d){var f=a[d];if(f.ranges)e.push(c?F.prototype.deepCopy.call(f):f);else{f=f.changes;var h=[];e.push({changes:h});for(var i=0;i<f.length;++i){var k=f[i],
m;h.push({from:k.from,to:k.to,text:k.text});if(b)for(var o in k)if(m=o.match(/^spans_(\d+)$/))if(Ua(b,Number(m[1]))>-1){Ia(h)[o]=k[o];delete k[o]}}}}return e}function mf(a,b,c,d){if(c<a.line)a.line+=d;else if(b<a.line){a.line=b;a.ch=0}}function nf(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],h=true;if(f.ranges){if(!f.copied){f=a[e]=f.deepCopy();f.copied=true}for(var i=0;i<f.ranges.length;i++){mf(f.ranges[i].anchor,b,c,d);mf(f.ranges[i].head,b,c,d)}}else{for(i=0;i<f.changes.length;++i){var k=f.changes[i];
if(c<k.from.line){k.from=W(k.from.line+d,k.from.ch);k.to=W(k.to.line+d,k.to.ch)}else if(b<=k.to.line){h=false;break}}if(!h){a.splice(0,e+1);e=0}}}}function Qe(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;nf(a.done,c,d,e);nf(a.undone,c,d,e)}function Xd(a){return a.defaultPrevented!=null?a.defaultPrevented:a.returnValue==false}function Fe(a){var b=a.which;if(b==null)if(a.button&1)b=1;else if(a.button&2)b=3;else if(a.button&4)b=2;if(ib&&a.ctrlKey&&b==1)b=3;return b}function Qa(a,b){function c(i){return function(){i.apply(null,
e)}}var d=a._handlers&&a._handlers[b];if(d){var e=Array.prototype.slice.call(arguments,2),f;if(jc)f=jc.delayedCallbacks;else if(Oc)f=Oc;else{f=Oc=[];setTimeout(fg,0)}for(var h=0;h<d.length;++h)f.push(c(d[h]))}}function fg(){var a=Oc;Oc=null;for(var b=0;b<a.length;++b)a[b]()}function lb(a,b,c){if(typeof b=="string")b={type:b,preventDefault:function(){this.defaultPrevented=true}};Oa(a,c||b.type,a,b);return Xd(b)||b.codemirrorIgnore}function te(a){var b=a._handlers&&a._handlers.cursorActivity;if(b){a=
a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]);for(var c=0;c<b.length;++c)Ua(a,b[c])==-1&&a.push(b[c])}}function jb(a,b){var c=a._handlers&&a._handlers[b];return c&&c.length>0}function pc(a){a.prototype.on=function(b,c){qa(this,b,c)};a.prototype.off=function(b,c){yb(this,b,c)}}function Tc(){this.id=null}function Ge(a,b,c){for(var d=0,e=0;;){var f=a.indexOf("\t",d);if(f==-1)f=a.length;var h=f-d;if(f==a.length||e+h>=b)return d+Math.min(h,b-e);e+=f-d;e+=c-e%c;d=f+1;if(e>=b)return d}}
function Ue(a){for(;Dd.length<=a;)Dd.push(Ia(Dd)+" ");return Dd[a]}function Ia(a){return a[a.length-1]}function Ua(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}function Dc(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function of(a,b){var c;if(Object.create)c=Object.create(a);else{c=function(){};c.prototype=a;c=new c}b&&zb(b,c);return c}function zb(a,b,c){b||(b={});for(var d in a)if(a.hasOwnProperty(d)&&(c!==false||!b.hasOwnProperty(d)))b[d]=a[d];return b}function ob(a){var b=
Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function wd(a,b){if(!b)return pf(a);if(b.source.indexOf("\\w")>-1&&pf(a))return true;return b.test(a)}function qf(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return false;return true}function zc(a){return a.charCodeAt(0)>=768&&gg.test(a)}function ga(a,b,c,d){a=document.createElement(a);if(c)a.className=c;if(d)a.style.cssText=d;if(typeof b=="string")a.appendChild(document.createTextNode(b));else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);
return a}function Ob(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild);return a}function rb(a,b){return Ob(a).appendChild(b)}function Ab(){return document.activeElement}function Pc(a){return RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function he(a,b){for(var c=a.split(" "),d=0;d<c.length;d++)if(c[d]&&!Pc(c[d]).test(b))b+=" "+c[d];return b}function rf(a){if(document.body.getElementsByClassName)for(var b=document.body.getElementsByClassName("CodeMirror"),c=0;c<b.length;c++){var d=b[c].CodeMirror;
d&&a(d)}}function yf(){var a;qa(window,"resize",function(){if(a==null)a=setTimeout(function(){a=null;rf(Ff)},100)});qa(window,"blur",function(){rf(Uc)})}function dg(a){if(je==null){var b=ga("span","\u200b");rb(a,ga("span",[b,document.createTextNode("x")]));if(a.firstChild.offsetHeight!=0)je=b.offsetWidth<=1&&b.offsetHeight>2&&!(va&&Fa<8)}return je?ga("span","\u200b"):ga("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px")}function zf(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=
false,f=0;f<a.length;++f){var h=a[f];if(h.from<c&&h.to>b||b==c&&h.to==b){d(Math.max(h.from,b),Math.min(h.to,c),h.level==1?"rtl":"ltr");e=true}}e||d(b,c,"ltr")}function Pd(a){return a.level%2?a.from:a.to}function dd(a){return(a=sb(a))?a[0].level%2?a[0].to:a[0].from:0}function ed(a){var b=sb(a);if(!b)return a.text.length;return Pd(Ia(b))}function sf(a,b){var c=ha(a.doc,b),d=tb(c);if(d!=c)b=La(d);c=sb(d);d=!c?0:c[0].level%2?ed(d):dd(d);return W(b,d)}function tf(a,b){var c=sf(a,b.line),d=ha(a.doc,c.line),
e=sb(d);if(!e||e[0].level==0){d=Math.max(0,d.text.search(/\S/));return W(c.line,b.line==c.line&&b.ch<=d&&b.ch?0:d)}return c}function Qd(a,b){Cc=null;for(var c=0,d;c<a.length;++c){var e=a[c];if(e.from<b&&e.to>b)return c;if(e.from==b||e.to==b)if(d==null)d=c;else{var f;f=e.level;var h=a[d].level,i=a[0].level;f=f==i?true:h==i?false:f<h;if(f){if(e.from!=e.to)Cc=d;return c}else{if(e.from!=e.to)Cc=c;break}}}return d}function ke(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&zc(a.text.charAt(b)));return b}
function Rd(a,b,c,d){var e=sb(a);if(!e)return Ve(a,b,c,d);var f=Qd(e,b),h=e[f];for(b=ke(a,b,h.level%2?-c:c,d);;){if(b>h.from&&b<h.to)return b;if(b==h.from||b==h.to){if(Qd(e,b)==f)return b;h=e[f+c];return c>0==h.level%2?h.to:h.from}else{h=e[f+=c];if(!h)return null;b=c>0==h.level%2?ke(a,h.to,-1,d):ke(a,h.from,1,d)}}}function Ve(a,b,c,d){b+=c;if(d)for(;b>0&&zc(a.text.charAt(b));)b+=c;return b<0||b>a.text.length?null:b}var Gc=/gecko\/\d/i.test(navigator.userAgent),qc=/MSIE \d/.test(navigator.userAgent),
Ed=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),va=qc||Ed,Fa=va&&(qc?document.documentMode||6:Ed[1]),Na=/WebKit\//.test(navigator.userAgent);qc=Na&&/Qt\/\d+\.\d+/.test(navigator.userAgent);Ed=/Chrome\//.test(navigator.userAgent);var mb=/Opera\//.test(navigator.userAgent),Ee=/Apple Computer/.test(navigator.vendor),Jd=/KHTML\//.test(navigator.userAgent),hg=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),Cf=/PhantomJS/.test(navigator.userAgent),rc=/AppleWebKit/.test(navigator.userAgent)&&
/Mobile\/\w+/.test(navigator.userAgent),Gd=rc||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),ib=rc||/Mac/.test(navigator.platform),ig=/win/i.test(navigator.platform),Yb=mb&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);if(Yb)Yb=Number(Yb[1]);if(Yb&&Yb>=15){mb=false;Na=true}var uf=ib&&(qc||mb&&(Yb==null||Yb<12.11)),Vd=Gc||va&&Fa>=9,Ne=false,Cb=false;E.prototype=zb({update:function(a){a||(a=H(this.cm));var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+
1,d=a.nativeBarWidth;if(c){this.vert.style.display="block";this.vert.style.bottom=b?d+"px":"0";this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+(a.viewHeight-(b?d:0)))+"px"}else{this.vert.style.display="";this.vert.firstChild.style.height="0"}if(b){this.horiz.style.display="block";this.horiz.style.right=c?d+"px":"0";this.horiz.style.left=a.barLeft+"px";this.horiz.firstChild.style.width=a.scrollWidth-a.clientWidth+(a.viewWidth-a.barLeft-(c?d:0))+"px"}else{this.horiz.style.display=
"";this.horiz.firstChild.style.width="0"}if(!this.checkedOverlay&&a.clientHeight>0){d==0&&this.overlayHack();this.checkedOverlay=true}return{right:c?d:0,bottom:b?d:0}},setScrollLeft:function(a){if(this.horiz.scrollLeft!=a)this.horiz.scrollLeft=a},setScrollTop:function(a){if(this.vert.scrollTop!=a)this.vert.scrollTop=a},overlayHack:function(){this.horiz.style.minHeight=this.vert.style.minWidth=ib&&!hg?"12px":"18px";var a=this,b=function(c){(c.target||c.srcElement)!=a.vert&&(c.target||c.srcElement)!=
a.horiz&&Pa(a.cm,xe)(c)};qa(this.vert,"mousedown",b);qa(this.horiz,"mousedown",b)},clear:function(){var a=this.horiz.parentNode;a.removeChild(this.horiz);a.removeChild(this.vert)}},E.prototype);B.prototype=zb({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},B.prototype);j.scrollbarModel={"native":E,"null":B};var W=j.Pos=function(a,b){if(!(this instanceof W))return new W(a,b);this.line=a;this.ch=b},sa=j.cmpPos=function(a,b){return a.line-
b.line||a.ch-b.ch};F.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(a){if(a==this)return true;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return false;for(var b=0;b<this.ranges.length;b++){var c=this.ranges[b],d=a.ranges[b];if(sa(c.anchor,d.anchor)!=0||sa(c.head,d.head)!=0)return false}return true},deepCopy:function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new s(W(this.ranges[b].anchor.line,this.ranges[b].anchor.ch),W(this.ranges[b].head.line,
this.ranges[b].head.ch));return new F(a,this.primIndex)},somethingSelected:function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return true;return false},contains:function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(sa(b,d.from())>=0&&sa(a,d.to())<=0)return c}return-1}};s.prototype={from:function(){return r(this.anchor,this.head)},to:function(){return R(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==
this.anchor.ch}};var Nd={left:0,right:0,top:0,bottom:0},Sb,jc=null,Bf=0,Ub=null,md,ld,De=0,pd=0,bb=null;if(va)bb=-0.53;else if(Gc)bb=15;else if(Ed)bb=-0.7;else if(Ee)bb=-1/3;var He=function(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;if(b==null&&a.detail&&a.axis==a.HORIZONTAL_AXIS)b=a.detail;if(c==null&&a.detail&&a.axis==a.VERTICAL_AXIS)c=a.detail;else if(c==null)c=a.wheelDelta;return{x:b,y:c}};j.wheelEventPixels=function(a){a=He(a);a.x*=bb;a.y*=bb;return a};var Mf=new Tc,Yd=null,Ib=j.changeEnd=function(a){if(!a.text)return a.to;
return W(a.from.line+a.text.length-1,Ia(a.text).length+(a.text.length==1?a.from.ch:0))};j.prototype={constructor:j,focus:function(){window.focus();$a(this);jd(this)},setOption:function(a,b){var c=this.options,d=c[a];if(!(c[a]==b&&a!="mode")){c[a]=b;$b.hasOwnProperty(a)&&Pa(this,$b[a])(this,b,d)}},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](xd(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,
c=0;c<b.length;++c)if(b[c]==a||b[c].name==a){b.splice(c,1);return true}},addOverlay:Sa(function(a,b){var c=a.token?a:j.getMode(this.options,a);if(c.startState)throw Error("Overlays may not be stateful.");this.state.overlays.push({mode:c,modeSpec:a,opaque:b&&b.opaque});this.state.modeGen++;ab(this)}),removeOverlay:Sa(function(a){for(var b=this.state.overlays,c=0;c<b.length;++c){var d=b[c].modeSpec;if(d==a||typeof a=="string"&&d.name==a){b.splice(c,1);this.state.modeGen++;ab(this);break}}}),indentLine:Sa(function(a,
b,c){if(typeof b!="string"&&typeof b!="number")b=b==null?this.options.smartIndent?"smart":"prev":b?"add":"subtract";Ka(this.doc,a)&&Ec(this,a,b,c)}),indentSelection:Sa(function(a){for(var b=this.doc.sel.ranges,c=-1,d=0;d<b.length;d++){var e=b[d];if(e.empty()){if(e.head.line>c){Ec(this,e.head.line,a,true);c=e.head.line;d==this.doc.sel.primIndex&&dc(this)}}else{var f=e.from();e=e.to();var h=Math.max(c,f.line);c=Math.min(this.lastLine(),e.line-(e.ch?0:1))+1;for(e=h;e<c;++e)Ec(this,e,a);e=this.doc.sel.ranges;
f.ch==0&&b.length==e.length&&e[d].from().ch>0&&Ba(this.doc,d,new s(f,e[d].to()),Eb)}}}),getTokenAt:function(a,b){return ff(this,a,b)},getLineTokens:function(a,b){return ff(this,W(a),b,true)},getTokenTypeAt:function(a){a=Y(this.doc,a);var b=hf(this,ha(this.doc,a.line)),c=0,d=(b.length-1)/2;a=a.ch;var e;if(a==0)e=b[2];else for(;;){var f=c+d>>1;if((f?b[f*2-1]:0)>=a)d=f;else if(b[f*2+1]<a)c=f+1;else{e=b[f*2+2];break}}b=e?e.indexOf("cm-overlay "):-1;return b<0?e:b==0?null:e.slice(0,b-1)},getModeAt:function(a){var b=
this.doc.mode;if(!b.innerMode)return b;return j.innerMode(b,this.getTokenAt(a).state).mode},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var c=[];if(!Zb.hasOwnProperty(b))return Zb;var d=Zb[b],e=this.getModeAt(a);if(typeof e[b]=="string")d[e[b]]&&c.push(d[e[b]]);else if(e[b])for(var f=0;f<e[b].length;f++){var h=d[e[b][f]];h&&c.push(h)}else if(e.helperType&&d[e.helperType])c.push(d[e.helperType]);else d[e.name]&&c.push(d[e.name]);for(f=0;f<d._global.length;f++){h=
d._global[f];h.pred(e,this)&&Ua(c,h.val)==-1&&c.push(h.val)}return c},getStateAfter:function(a,b){var c=this.doc;a=Math.max(c.first,Math.min(a==null?c.first+c.size-1:a,c.first+c.size-1));return fb(this,a+1,b)},cursorCoords:function(a,b){var c;c=this.doc.sel.primary();c=a==null?c.head:typeof a=="object"?Y(this.doc,a):a?c.from():c.to();return N(this,c,b||"page")},charCoords:function(a,b){return I(this,Y(this.doc,a),b||"page")},coordsChar:function(a,b){a=n(this,a,b||"page");return za(this,a.left,a.top)},
lineAtHeight:function(a,b){a=n(this,{top:a,left:0},b||"page").top;return Qb(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b){var c=false,d=this.doc.first+this.doc.size-1;if(a<this.doc.first)a=this.doc.first;else if(a>d){a=d;c=true}d=ha(this.doc,a);return Ac(this,d,{top:0,left:0},b||"page").top+(c?this.doc.height-wb(d):0)},defaultTextHeight:function(){return vb(this.display)},defaultCharWidth:function(){return sc(this.display)},setGutterMarker:Sa(function(a,b,c){return vd(this.doc,a,
"gutter",function(d){var e=d.gutterMarkers||(d.gutterMarkers={});e[b]=c;if(!c&&qf(e))d.gutterMarkers=null;return true})}),clearGutter:Sa(function(a){var b=this,c=b.doc,d=c.first;c.iter(function(e){if(e.gutterMarkers&&e.gutterMarkers[a]){e.gutterMarkers[a]=null;xb(b,d,"gutter");if(qf(e.gutterMarkers))e.gutterMarkers=null}++d})}),addLineWidget:Sa(function(a,b,c){return Yf(this,a,b,c)}),removeLineWidget:function(a){a.clear()},lineInfo:function(a){if(typeof a=="number"){if(!Ka(this.doc,a))return null;
var b=a;a=ha(this.doc,a);if(!a)return null}else{b=La(a);if(b==null)return null}return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=N(this,Y(this.doc,a));var h=a.bottom,i=a.left;b.style.position="absolute";b.setAttribute("cm-ignore-events","true");f.sizer.appendChild(b);if(d==
"over")h=a.top;else if(d=="above"||d=="near"){var k=Math.max(f.wrapper.clientHeight,this.doc.height),m=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);if((d=="above"||a.bottom+b.offsetHeight>k)&&a.top>b.offsetHeight)h=a.top-b.offsetHeight;else if(a.bottom+b.offsetHeight<=k)h=a.bottom;if(i+b.offsetWidth>m)i=m-b.offsetWidth}b.style.top=h+"px";b.style.left=b.style.right="";if(e=="right"){i=f.sizer.clientWidth-b.offsetWidth;b.style.right="0px"}else{if(e=="left")i=0;else if(e=="middle")i=(f.sizer.clientWidth-
b.offsetWidth)/2;b.style.left=i+"px"}if(c){a=fd(this,i,h,i+b.offsetWidth,h+b.offsetHeight);a.scrollTop!=null&&uc(this,a.scrollTop);a.scrollLeft!=null&&ac(this,a.scrollLeft)}},triggerOnKeyDown:Sa(Be),triggerOnKeyPress:Sa(Ce),triggerOnKeyUp:Ae,execCommand:function(a){if(rd.hasOwnProperty(a))return rd[a](this)},findPosH:function(a,b,c,d){var e=1;if(b<0){e=-1;b=-b}var f=0;for(a=Y(this.doc,a);f<b;++f){a=de(this.doc,a,e,c,d);if(a.hitSide)break}return a},moveH:Sa(function(a,b){var c=this;c.extendSelectionsBy(function(d){return c.display.shift||
c.doc.extend||d.empty()?de(c.doc,d.head,a,b,c.options.rtlMoveVisually):a<0?d.from():d.to()},Qc)}),deleteH:Sa(function(a,b){var c=this.doc;this.doc.sel.somethingSelected()?c.replaceSelection("",null,"+delete"):mc(this,function(d){var e=de(c,d.head,a,b,false);return a<0?{from:e,to:d.head}:{from:d.head,to:e}})}),findPosV:function(a,b,c,d){var e=1;if(b<0){e=-1;b=-b}var f=0;for(a=Y(this.doc,a);f<b;++f){a=N(this,a,"div");if(d==null)d=a.left;else a.left=d;a=We(this,a,e,c);if(a.hitSide)break}return a},moveV:Sa(function(a,
b){var c=this,d=this.doc,e=[],f=!c.display.shift&&!d.extend&&d.sel.somethingSelected();d.extendSelectionsBy(function(i){if(f)return a<0?i.from():i.to();var k=N(c,i.head,"div");if(i.goalColumn!=null)k.left=i.goalColumn;e.push(k.left);var m=We(c,k,a,b);b=="page"&&i==d.sel.primary()&&ce(c,null,I(c,m,"div").top-k.top);return m},Qc);if(e.length)for(var h=0;h<d.sel.ranges.length;h++)d.sel.ranges[h].goalColumn=e[h]}),findWordAt:function(a){var b=ha(this.doc,a.line).text,c=a.ch,d=a.ch;if(b){var e=this.getHelper(a,
"wordChars");if((a.xRel<0||d==b.length)&&c)--c;else++d;var f=b.charAt(c);for(f=wd(f,e)?function(h){return wd(h,e)}:/\s/.test(f)?function(h){return/\s/.test(h)}:function(h){return!/\s/.test(h)&&!wd(h)};c>0&&f(b.charAt(c-1));)--c;for(;d<b.length&&f(b.charAt(d));)++d}return new s(W(a.line,c),W(a.line,d))},toggleOverwrite:function(a){if(!(a!=null&&a==this.state.overwrite)){(this.state.overwrite=!this.state.overwrite)?vc(this.display.cursorDiv,"CodeMirror-overwrite"):tc(this.display.cursorDiv,"CodeMirror-overwrite");
Oa(this,"overwriteToggle",this,this.state.overwrite)}},hasFocus:function(){return Ab()==this.display.input},scrollTo:Sa(function(a,b){if(a!=null||b!=null)ud(this);if(a!=null)this.curOp.scrollLeft=a;if(b!=null)this.curOp.scrollTop=b}),getScrollInfo:function(){var a=this.display.scroller;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-Za(this)-this.display.barHeight,width:a.scrollWidth-Za(this)-this.display.barWidth,clientHeight:Db(this),clientWidth:hb(this)}},scrollIntoView:Sa(function(a,
b){if(a==null){a={from:this.doc.sel.primary().head,to:null};if(b==null)b=this.options.cursorScrollMargin}else if(typeof a=="number")a={from:W(a,0),to:null};else if(a.from==null)a={from:a,to:null};if(!a.to)a.to=a.from;a.margin=b||0;if(a.from.line!=null){ud(this);this.curOp.scrollToPos=a}else{var c=fd(this,Math.min(a.from.left,a.to.left),Math.min(a.from.top,a.to.top)-a.margin,Math.max(a.from.right,a.to.right),Math.max(a.from.bottom,a.to.bottom)+a.margin);this.scrollTo(c.scrollLeft,c.scrollTop)}}),setSize:Sa(function(a,
b){function c(f){return typeof f=="number"||/^\d+$/.test(String(f))?f+"px":f}var d=this;if(a!=null)d.display.wrapper.style.width=c(a);if(b!=null)d.display.wrapper.style.height=c(b);d.options.lineWrapping&&cd(this);var e=d.display.viewFrom;d.doc.iter(e,d.display.viewTo,function(f){if(f.widgets)for(var h=0;h<f.widgets.length;h++)if(f.widgets[h].noHScroll){xb(d,e,"widget");break}++e});d.curOp.forceUpdate=true;Oa(d,"refresh",this)}),operation:function(a){return Gb(this,a)},refresh:Sa(function(){var a=
this.display.cachedTextHeight;ab(this);this.curOp.forceUpdate=true;aa(this);this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop);A(this);if(a==null||Math.abs(a-vb(this.display))>0.5)g(this);Oa(this,"refresh",this)}),swapDoc:Sa(function(a){var b=this.doc;b.cm=null;me(this,a);aa(this);gb(this);this.scrollTo(a.scrollLeft,a.scrollTop);this.curOp.forceScroll=true;Qa(this,"swapDoc",this,b);return b}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},
getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};pc(j);var wf=j.defaults={},$b=j.optionHandlers={},ne=j.Init={toString:function(){return"CodeMirror.Init"}};oa("value","",function(a,b){a.setValue(b)},true);oa("mode",null,function(a,b){a.doc.modeOption=b;X(a)},true);oa("indentUnit",2,X,true);oa("indentWithTabs",false);oa("smartIndent",true);oa("tabSize",4,function(a){w(a);aa(a);ab(a)},true);oa("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,
function(a,b){a.options.specialChars=RegExp(b.source+(b.test("\t")?"":"|\t"),"g");a.refresh()},true);oa("specialCharPlaceholder",function(a){var b=ga("span","\u2022","cm-invalidchar");b.title="\\u"+a.charCodeAt(0).toString(16);return b},function(a){a.refresh()},true);oa("electricChars",true);oa("rtlMoveVisually",!ig);oa("wholeLineUpdateBefore",true);oa("theme","default",function(a){l(a);q(a)},true);oa("keyMap","default",function(a,b,c){b=xd(b);(c=c!=j.Init&&xd(c))&&c.detach&&c.detach(a,b);if(b.attach)b.attach(a,
c||null)});oa("extraKeys",null);oa("lineWrapping",false,function(a){if(a.options.lineWrapping){vc(a.display.wrapper,"CodeMirror-wrap");a.display.sizer.style.minWidth="";a.display.sizerWidth=null}else{tc(a.display.wrapper,"CodeMirror-wrap");x(a)}g(a);ab(a);aa(a);setTimeout(function(){y(a)},100)},true);oa("gutters",[],function(a){J(a.options);q(a)},true);oa("fixedGutter",true,function(a,b){a.display.gutters.style.left=b?Va(a.display)+"px":"0";a.refresh()},true);oa("coverGutterNextToScrollbar",false,
function(a){y(a)},true);oa("scrollbarStyle","native",function(a){z(a);y(a);a.display.scrollbars.setScrollTop(a.doc.scrollTop);a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},true);oa("lineNumbers",false,function(a){J(a.options);q(a)},true);oa("firstLineNumber",1,q,true);oa("lineNumberFormatter",function(a){return a},q,true);oa("showCursorWhenSelecting",false,Rb,true);oa("resetSelectionOnContextMenu",true);oa("readOnly",false,function(a,b){if(b=="nocursor"){Uc(a);a.display.input.blur();a.display.disabled=
true}else{a.display.disabled=false;b||gb(a)}});oa("disableInput",false,function(a,b){b||gb(a)},true);oa("dragDrop",true);oa("cursorBlinkRate",530);oa("cursorScrollMargin",0);oa("cursorHeight",1,Rb,true);oa("singleCursorHeightPerLine",true,Rb,true);oa("workTime",100);oa("workDelay",100);oa("flattenSpans",true,w,true);oa("addModeClass",false,w,true);oa("pollInterval",100);oa("undoDepth",200,function(a,b){a.doc.history.undoDepth=b});oa("historyEventDelay",1250);oa("viewportMargin",10,function(a){a.refresh()},
true);oa("maxHighlightLength",1E4,w,true);oa("moveInputWithCursor",true,function(a,b){if(!b)a.display.inputDiv.style.top=a.display.inputDiv.style.left=0});oa("tabindex",null,function(a,b){a.display.input.tabIndex=b||""});oa("autofocus",null);var vf=j.modes={},Rc=j.mimeModes={};j.defineMode=function(a,b){if(!j.defaults.mode&&a!="null")j.defaults.mode=a;if(arguments.length>2)b.dependencies=Array.prototype.slice.call(arguments,2);vf[a]=b};j.defineMIME=function(a,b){Rc[a]=b};j.resolveMode=function(a){if(typeof a==
"string"&&Rc.hasOwnProperty(a))a=Rc[a];else if(a&&typeof a.name=="string"&&Rc.hasOwnProperty(a.name)){var b=Rc[a.name];if(typeof b=="string")b={name:b};a=of(b,a);a.name=b.name}else if(typeof a=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return j.resolveMode("application/xml");return typeof a=="string"?{name:a}:a||{name:"null"}};j.getMode=function(a,b){b=j.resolveMode(b);var c=vf[b.name];if(!c)return j.getMode(a,"text/plain");c=c(a,b);if(Sc.hasOwnProperty(b.name)){var d=Sc[b.name],e;for(e in d)if(d.hasOwnProperty(e)){if(c.hasOwnProperty(e))c["_"+
e]=c[e];c[e]=d[e]}}c.name=b.name;if(b.helperType)c.helperType=b.helperType;if(b.modeProps)for(e in b.modeProps)c[e]=b.modeProps[e];return c};j.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}});j.defineMIME("text/plain","null");var Sc=j.modeExtensions={};j.extendMode=function(a,b){var c=Sc.hasOwnProperty(a)?Sc[a]:Sc[a]={};zb(b,c)};j.defineExtension=function(a,b){j.prototype[a]=b};j.defineDocExtension=function(a,b){Ya.prototype[a]=b};j.defineOption=oa;var Id=[];j.defineInitHook=
function(a){Id.push(a)};var Zb=j.helpers={};j.registerHelper=function(a,b,c){Zb.hasOwnProperty(a)||(Zb[a]=j[a]={_global:[]});Zb[a][b]=c};j.registerGlobalHelper=function(a,b,c,d){j.registerHelper(a,b,d);Zb[a]._global.push({pred:c,val:d})};var gc=j.copyState=function(a,b){if(b===true)return b;if(a.copyState)return a.copyState(b);var c={},d;for(d in b){var e=b[d];if(e instanceof Array)e=e.concat([]);c[d]=e}return c},Af=j.startState=function(a,b,c){return a.startState?a.startState(b,c):true};j.innerMode=
function(a,b){for(;a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state;a=c.mode}return c||{mode:a,state:b}};var rd=j.commands={selectAll:function(a){a.setSelection(W(a.firstLine(),0),W(a.lastLine()),Eb)},singleSelection:function(a){a.setSelection(a.getCursor("anchor"),a.getCursor("head"),Eb)},killLine:function(a){mc(a,function(b){if(b.empty()){var c=ha(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:W(b.head.line+1,0)}:{from:b.head,to:W(b.head.line,
c)}}else return{from:b.from(),to:b.to()}})},deleteLine:function(a){mc(a,function(b){return{from:W(b.from().line,0),to:Y(a.doc,W(b.to().line+1,0))}})},delLineLeft:function(a){mc(a,function(b){return{from:W(b.from().line,0),to:b.from()}})},delWrappedLineLeft:function(a){mc(a,function(b){var c=a.charCoords(b.head,"div").top+5;return{from:a.coordsChar({left:0,top:c},"div"),to:b.from()}})},delWrappedLineRight:function(a){mc(a,function(b){var c=a.charCoords(b.head,"div").top+5;c=a.coordsChar({left:a.display.lineDiv.offsetWidth+
100,top:c},"div");return{from:b.from(),to:c}})},undo:function(a){a.undo()},redo:function(a){a.redo()},undoSelection:function(a){a.undoSelection()},redoSelection:function(a){a.redoSelection()},goDocStart:function(a){a.extendSelection(W(a.firstLine(),0))},goDocEnd:function(a){a.extendSelection(W(a.lastLine()))},goLineStart:function(a){a.extendSelectionsBy(function(b){return sf(a,b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){a.extendSelectionsBy(function(b){return tf(a,b.head)},
{origin:"+move",bias:1})},goLineEnd:function(a){a.extendSelectionsBy(function(b){b=b.head.line;for(var c,d=ha(a.doc,b);c=Pb(d,false);){d=c.find(1,true).line;b=null}c=sb(d);c=!c?d.text.length:c[0].level%2?dd(d):ed(d);return W(b==null?La(d):b,c)},{origin:"+move",bias:-1})},goLineRight:function(a){a.extendSelectionsBy(function(b){b=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},"div")},Qc)},goLineLeft:function(a){a.extendSelectionsBy(function(b){b=
a.charCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:b},"div")},Qc)},goLineLeftSmart:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5;c=a.coordsChar({left:0,top:c},"div");if(c.ch<a.getLine(c.line).search(/\S/))return tf(a,b.head);return c},Qc)},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},
goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goGroupRight:function(a){a.moveH(1,"group")},goGroupLeft:function(a){a.moveH(-1,"group")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")},delWordAfter:function(a){a.deleteH(1,"word")},
delGroupBefore:function(a){a.deleteH(-1,"group")},delGroupAfter:function(a){a.deleteH(1,"group")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection("\t")},insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,e=0;e<c.length;e++){var f=c[e].from();f=kb(a.getLine(f.line),f.ch,d);b.push(Array(d-f%d+1).join(" "))}a.replaceSelections(b)},
defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){Gb(a,function(){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++){var e=b[d].head,f=ha(a.doc,e.line).text;if(f){if(e.ch==f.length)e=new W(e.line,e.ch-1);if(e.ch>0){e=new W(e.line,e.ch+1);a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),W(e.line,e.ch-2),e,"+transpose")}else if(e.line>a.doc.first){var h=ha(a.doc,e.line-1).text;h&&a.replaceRange(f.charAt(0)+"\n"+h.charAt(h.length-
1),W(e.line-1,h.length-1),W(e.line,1),"+transpose")}}c.push(new s(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){Gb(a,function(){for(var b=a.listSelections().length,c=0;c<b;c++){var d=a.listSelections()[c];a.replaceRange("\n",d.anchor,d.head,"+input");a.indentLine(d.from().line+1,null,true);dc(a)}})},toggleOverwrite:function(a){a.toggleOverwrite()}},Jb=j.keyMap={};Jb.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",
PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"};Jb.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart",
"Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"};Jb.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft",
"Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"};Jb.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft",
"Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]};Jb["default"]=
ib?Jb.macDefault:Jb.pcDefault;j.normalizeKeyMap=function(a){var b={},c;for(c in a)if(a.hasOwnProperty(c)){var d=a[c];if(!/^(name|fallthrough|(de|at)tach)$/.test(c)){if(d!="...")for(var e=Dc(c.split(" "),Tf),f=0;f<e.length;f++){var h,i;if(f==e.length-1){i=c;h=d}else{i=e.slice(0,f+1).join(" ");h="..."}var k=b[i];if(k){if(k!=h)throw Error("Inconsistent bindings for "+i);}else b[i]=h}delete a[c]}}for(var m in b)a[m]=b[m];return a};var Hc=j.lookupKey=function(a,b,c,d){b=xd(b);var e=b.call?b.call(a,d):
b[a];if(e===false)return"nothing";if(e==="...")return"multi";if(e!=null&&c(e))return"handled";if(b.fallthrough){if(Object.prototype.toString.call(b.fallthrough)!="[object Array]")return Hc(a,b.fallthrough,c,d);for(e=0;e<b.fallthrough.length;e++){var f=Hc(a,b.fallthrough[e],c,d);if(f)return f}}},Lf=j.isModifierKey=function(a){a=typeof a=="string"?a:Kb[a.keyCode];return a=="Ctrl"||a=="Alt"||a=="Shift"||a=="Mod"},Nf=j.keyName=function(a,b){if(mb&&a.keyCode==34&&a["char"])return false;var c=Kb[a.keyCode],
d=c;if(d==null||a.altGraphKey)return false;if(a.altKey&&c!="Alt")d="Alt-"+d;if((uf?a.metaKey:a.ctrlKey)&&c!="Ctrl")d="Ctrl-"+d;if((uf?a.ctrlKey:a.metaKey)&&c!="Cmd")d="Cmd-"+d;if(!b&&a.shiftKey&&c!="Shift")d="Shift-"+d;return d};j.fromTextArea=function(a,b){function c(){a.value=k.getValue()}b||(b={});b.value=a.value;if(!b.tabindex&&a.tabindex)b.tabindex=a.tabindex;if(!b.placeholder&&a.placeholder)b.placeholder=a.placeholder;if(b.autofocus==null){var d=Ab();b.autofocus=d==a||a.getAttribute("autofocus")!=
null&&d==document.body}if(a.form){qa(a.form,"submit",c);if(!b.leaveSubmitMethodAlone){var e=a.form,f=e.submit;try{var h=e.submit=function(){c();e.submit=f;e.submit();e.submit=h}}catch(i){}}}a.style.display="none";var k=j(function(m){a.parentNode.insertBefore(m,a.nextSibling)},b);k.save=c;k.getTextArea=function(){return a};k.toTextArea=function(){k.toTextArea=isNaN;c();a.parentNode.removeChild(k.getWrapperElement());a.style.display="";if(a.form){yb(a.form,"submit",c);if(typeof a.form.submit=="function")a.form.submit=
f}};return k};var Bd=j.StringStream=function(a,b){this.pos=this.start=0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0};Bd.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||undefined},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if(typeof a=="string"?b==
a:b&&(a.test?a.test(b):a(b))){++this.pos;return b}},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){a=this.string.indexOf(a,this.pos);if(a>-1){this.pos=a;return true}},backUp:function(a){this.pos-=a},column:function(){if(this.lastColumnPos<this.start){this.lastColumnValue=kb(this.string,this.start,
this.tabSize,this.lastColumnPos,this.lastColumnValue);this.lastColumnPos=this.start}return this.lastColumnValue-(this.lineStart?kb(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return kb(this.string,null,this.tabSize)-(this.lineStart?kb(this.string,this.lineStart,this.tabSize):0)},match:function(a,b,c){if(typeof a=="string"){var d=this.string.substr(this.pos,a.length);if((c?d.toLowerCase():d)==(c?a.toLowerCase():a)){if(b!==false)this.pos+=a.length;return true}}else{if((a=this.string.slice(this.pos).match(a))&&
a.index>0)return null;if(a&&b!==false)this.pos+=a[0].length;return a}},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}};var Xb=j.TextMarker=function(a,b){this.lines=[];this.type=b;this.doc=a};pc(Xb);Xb.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;b&&Lb(a);if(jb(this,"clear")){var c=this.find();c&&Qa(this,"clear",c.from,c.to)}for(var d=c=null,e=0;e<this.lines.length;++e){var f=
this.lines[e],h=Kc(f.markedSpans,this);if(a&&!this.collapsed)xb(a,La(f),"text");else if(a){if(h.to!=null)d=La(f);if(h.from!=null)c=La(f)}for(var i=f,k=f.markedSpans,m=h,o=void 0,t=0;t<k.length;++t)if(k[t]!=m)(o||(o=[])).push(k[t]);i.markedSpans=o;h.from==null&&this.collapsed&&!Nb(this.doc,f)&&a&&pb(f,vb(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(e=0;e<this.lines.length;++e){f=tb(this.lines[e]);h=M(f);if(h>a.display.maxLineLength){a.display.maxLine=f;a.display.maxLineLength=h;a.display.maxLineChanged=
true}}c!=null&&a&&this.collapsed&&ab(a,c,d+1);this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;a&&Zc(a.doc)}a&&Qa(a,"markerCleared",a,this);b&&Mb(a);this.parent&&this.parent.clear()}};Xb.prototype.find=function(a,b){if(a==null&&this.type=="bookmark")a=1;for(var c,d,e=0;e<this.lines.length;++e){var f=this.lines[e],h=Kc(f.markedSpans,this);if(h.from!=null){c=W(b?f:La(f),h.from);if(a==-1)return c}if(h.to!=null){d=W(b?f:La(f),h.to);if(a==1)return d}}return c&&
{from:c,to:d}};Xb.prototype.changed=function(){var a=this.find(-1,true),b=this,c=this.doc.cm;a&&c&&Gb(c,function(){var d=a.line,e=La(a.line);if(e=ad(c,e)){bd(e);c.curOp.selectionChanged=c.curOp.forceUpdate=true}c.curOp.updateMaxLine=true;if(!Nb(b.doc,d)&&b.height!=null){e=b.height;b.height=null;(e=Bc(b)-e)&&pb(d,d.height+e)}})};Xb.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;if(!b.maybeHiddenMarkers||Ua(b.maybeHiddenMarkers,this)==-1)(b.maybeUnhiddenMarkers||
(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};Xb.prototype.detachLine=function(a){this.lines.splice(Ua(this.lines,a),1);if(!this.lines.length&&this.doc.cm){a=this.doc.cm.curOp;(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this)}};var Vf=0,zd=j.SharedTextMarker=function(a,b){this.markers=a;this.primary=b;for(var c=0;c<a.length;++c)a[c].parent=this};pc(zd);zd.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=true;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();
Qa(this,"clear")}};zd.prototype.find=function(a,b){return this.primary.find(a,b)};var Ad=j.LineWidget=function(a,b,c){if(c)for(var d in c)if(c.hasOwnProperty(d))this[d]=c[d];this.cm=a;this.node=b};pc(Ad);Ad.prototype.clear=function(){var a=this.cm,b=this.line.widgets,c=this.line,d=La(c);if(!(d==null||!b)){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);if(!b.length)c.widgets=null;var f=Bc(this);Gb(a,function(){cf(a,c,-f);xb(a,d,"widget");pb(c,Math.max(0,c.height-f))})}};Ad.prototype.changed=
function(){var a=this.height,b=this.cm,c=this.line;this.height=null;var d=Bc(this)-a;d&&Gb(b,function(){b.curOp.forceUpdate=true;cf(b,c,d);pb(c,c.height+d)})};var Lc=j.Line=function(a,b,c){this.text=a;af(this,b);this.height=c?c(this):1};pc(Lc);Lc.prototype.lineNo=function(){return La(this)};var $f={},Zf={};Mc.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;c<d;++c){var e=this.lines[c];this.height-=e.height;var f=e;f.parent=null;$e(f);Qa(e,"delete")}this.lines.splice(a,
b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height+=c;this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(a=0;a<b.length;++a)b[a].parent=this},iterN:function(a,b,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return true}};Nc.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(a<e){var f=Math.min(b,e-a),h=d.height;d.removeInner(a,
f);this.height-=h-d.height;if(e==f){this.children.splice(c--,1);d.parent=null}if((b-=f)==0)break;a=0}else a-=e}if(this.size-b<25&&(this.children.length>1||!(this.children[0]instanceof Mc))){c=[];this.collapse(c);this.children=[new Mc(c)];this.children[0].parent=this}},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length;this.height+=c;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();
if(a<=f){e.insertInner(a,b,c);if(e.lines&&e.lines.length>50){for(;e.lines.length>50;){a=e.lines.splice(e.lines.length-25,25);a=new Mc(a);e.height-=a.height;this.children.splice(d+1,0,a);a.parent=this}this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5);b=new Nc(b);if(a.parent){a.size-=b.size;a.height-=b.height;var c=Ua(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else{c=new Nc(a.children);c.parent=
a;a.children=[c,b];a=c}b.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<f){f=Math.min(b,f-a);if(e.iterN(a,f,c))return true;if((b-=f)==0)break;a=0}else a-=f}}};var jg=0,Ya=j.Doc=function(a,b,c){if(!(this instanceof Ya))return new Ya(a,b,c);if(c==null)c=0;Nc.call(this,[new Mc([new Lc("",null)])]);this.first=c;this.scrollTop=this.scrollLeft=0;this.cantEdit=false;this.cleanGeneration=
1;this.frontier=c;c=W(c,0);this.sel=ja(c);this.history=new Cd(null);this.id=++jg;this.modeOption=b;if(typeof a=="string")a=Tb(a);be(this,{from:c,to:c,text:a});Ma(this,ja(c),Eb)};Ya.prototype=of(Nc.prototype,{constructor:Ya,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0;d<b.length;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=
ie(this,this.first,this.first+this.size);if(a===false)return b;return b.join(a||"\n")},setValue:Wa(function(a){var b=W(this.first,0),c=this.first+this.size-1;kc(this,{from:b,to:W(c,ha(this,c).text.length),text:Tb(a),origin:"setValue",full:true},true);Ma(this,ja(b))}),replaceRange:function(a,b,c,d){b=Y(this,b);c=c?Y(this,c):b;od(this,a,b,c,d)},getRange:function(a,b,c){a=Jc(this,Y(this,a),Y(this,b));if(c===false)return a;return a.join(c||"\n")},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},
getLineHandle:function(a){if(Ka(this,a))return ha(this,a)},getLineNumber:function(a){return La(a)},getLineHandleVisualStart:function(a){if(typeof a=="number")a=ha(this,a);return tb(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return Y(this,a)},getCursor:function(a){var b=this.sel.primary();return a==null||a=="head"?b.head:a=="anchor"?b.anchor:a=="end"||a=="to"||a===false?b.to():b.from()},listSelections:function(){return this.sel.ranges},
somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Wa(function(a,b,c){a=Y(this,typeof a=="number"?W(a,b||0):a);Ma(this,ja(a,null),c)}),setSelection:Wa(function(a,b,c){var d=Y(this,a);a=Y(this,b||a);Ma(this,ja(d,a),c)}),extendSelection:Wa(function(a,b,c){xa(this,Y(this,a),b&&Y(this,b),c)}),extendSelections:Wa(function(a){for(var b=[],c=0;c<a.length;c++)b[c]=Y(this,a[c]);eb(this,b)}),extendSelectionsBy:Wa(function(a,b){eb(this,Dc(this.sel.ranges,a),b)}),setSelections:Wa(function(a,
b,c){if(a.length){for(var d=0,e=[];d<a.length;d++)e[d]=new s(Y(this,a[d].anchor),Y(this,a[d].head));if(b==null)b=Math.min(a.length-1,this.sel.primIndex);Ma(this,U(e,b),c)}}),addSelection:Wa(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new s(Y(this,a),Y(this,b||a)));Ma(this,U(d,d.length-1),c)}),getSelection:function(a){for(var b=this.sel.ranges,c,d=0;d<b.length;d++){var e=Jc(this,b[d].from(),b[d].to());c=c?c.concat(e):e}return a===false?c:c.join(a||"\n")},getSelections:function(a){for(var b=
[],c=this.sel.ranges,d=0;d<c.length;d++){var e=Jc(this,c[d].from(),c[d].to());if(a!==false)e=e.join(a||"\n");b[d]=e}return b},replaceSelection:function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c||"+input")},replaceSelections:Wa(function(a,b,c){for(var d=[],e=this.sel,f=0;f<e.ranges.length;f++){var h=e.ranges[f];d[f]={from:h.from(),to:h.to(),text:Tb(a[f]),origin:c}}if(f=b)if(f=b!="end"){f=[];c=a=W(this.first,0);for(e=0;e<d.length;e++){var i=d[e];h=Le(i.from,
a,c);var k=Le(Ib(i),a,c);a=i.to;c=k;if(b=="around"){i=this.sel.ranges[e];i=sa(i.head,i.anchor)<0;f[e]=new s(i?k:h,i?h:k)}else f[e]=new s(h,h)}f=new F(f,this.sel.primIndex)}b=f;for(f=d.length-1;f>=0;f--)kc(this,d[f]);if(b)cc(this,b);else this.cm&&dc(this.cm)}),undo:Wa(function(){td(this,"undo")}),redo:Wa(function(){td(this,"redo")}),undoSelection:Wa(function(){td(this,"undo",true)}),redoSelection:Wa(function(){td(this,"redo",true)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},
historySize:function(){for(var a=this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(d=0;d<a.undone.length;d++)a.undone[d].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new Cd(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(true)},changeGeneration:function(a){if(a)this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null;return this.history.generation},isClean:function(a){return this.history.generation==
(a||this.cleanGeneration)},getHistory:function(){return{done:oc(this.history.done),undone:oc(this.history.undone)}},setHistory:function(a){var b=this.history=new Cd(this.history.maxGeneration);b.done=oc(a.done.slice(0),null,true);b.undone=oc(a.undone.slice(0),null,true)},addLineClass:Wa(function(a,b,c){return vd(this,a,b=="gutter"?"gutter":"class",function(d){var e=b=="text"?"textClass":b=="background"?"bgClass":b=="gutter"?"gutterClass":"wrapClass";if(d[e])if(Pc(c).test(d[e]))return false;else d[e]+=
" "+c;else d[e]=c;return true})}),removeLineClass:Wa(function(a,b,c){return vd(this,a,b=="gutter"?"gutter":"class",function(d){var e=b=="text"?"textClass":b=="background"?"bgClass":b=="gutter"?"gutterClass":"wrapClass",f=d[e];if(f)if(c==null)d[e]=null;else{var h=f.match(Pc(c));if(!h)return false;var i=h.index+h[0].length;d[e]=f.slice(0,h.index)+(!h.index||i==f.length?"":" ")+f.slice(i)||null}else return false;return true})}),markText:function(a,b,c){return nc(this,Y(this,a),Y(this,b),c,"range")},
setBookmark:function(a,b){var c={replacedWith:b&&(b.nodeType==null?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:false,shared:b&&b.shared};a=Y(this,a);return nc(this,a,a,c,"bookmark")},findMarksAt:function(a){a=Y(this,a);var b=[],c=ha(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var e=c[d];if((e.from==null||e.from<=a.ch)&&(e.to==null||e.to>=a.ch))b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=Y(this,a);b=Y(this,b);var d=[],e=a.line;this.iter(a.line,b.line+
1,function(f){if(f=f.markedSpans)for(var h=0;h<f.length;h++){var i=f[h];if(!(e==a.line&&a.ch>i.to||i.from==null&&e!=a.line||e==b.line&&i.from>b.ch)&&(!c||c(i.marker)))d.push(i.marker.parent||i.marker)}++e});return d},getAllMarks:function(){var a=[];this.iter(function(b){if(b=b.markedSpans)for(var c=0;c<b.length;++c)b[c].from!=null&&a.push(b[c].marker)});return a},posFromIndex:function(a){var b,c=this.first;this.iter(function(d){d=d.text.length+1;if(d>a){b=a;return true}a-=d;++c});return Y(this,W(c,
b))},indexFromPos:function(a){a=Y(this,a);var b=a.ch;if(a.line<this.first||a.ch<0)return 0;this.iter(this.first,a.line,function(c){b+=c.text.length+1});return b},copy:function(a){var b=new Ya(ie(this,this.first,this.first+this.size),this.modeOption,this.first);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=false;if(a){b.history.undoDepth=this.history.undoDepth;b.setHistory(this.getHistory())}return b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;
if(a.from!=null&&a.from>b)b=a.from;if(a.to!=null&&a.to<c)c=a.to;b=new Ya(ie(this,b,c),a.mode||this.modeOption,b);if(a.sharedHist)b.history=this.history;(this.linked||(this.linked=[])).push({doc:b,sharedHist:a.sharedHist});b.linked=[{doc:this,isParent:true,sharedHist:a.sharedHist}];a=Ye(this);for(c=0;c<a.length;c++){var d=a[c],e=d.find(),f=b.clipPos(e.from);e=b.clipPos(e.to);if(sa(f,e)){f=nc(b,f,e,d.primary,d.primary.type);d.markers.push(f);f.parent=d}}return b},unlinkDoc:function(a){if(a instanceof
j)a=a.doc;if(this.linked)for(var b=0;b<this.linked.length;++b)if(this.linked[b].doc==a){this.linked.splice(b,1);a.unlinkDoc(this);Wf(Ye(this));break}if(a.history==this.history){var c=[a.id];Wb(a,function(d){c.push(d.id)},true);a.history=new Cd(null);a.history.done=oc(this.history.done,c);a.history.undone=oc(this.history.undone,c)}},iterLinkedDocs:function(a){Wb(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm}});Ya.prototype.eachLine=Ya.prototype.iter;qc="iter insert remove copy getEditor".split(" ");
for(var Fd in Ya.prototype)if(Ya.prototype.hasOwnProperty(Fd)&&Ua(qc,Fd)<0)j.prototype[Fd]=function(a){return function(){return a.apply(this.doc,arguments)}}(Ya.prototype[Fd]);pc(Ya);var Xa=j.e_preventDefault=function(a){if(a.preventDefault)a.preventDefault();else a.returnValue=false},kg=j.e_stopPropagation=function(a){if(a.stopPropagation)a.stopPropagation();else a.cancelBubble=true},Td=j.e_stop=function(a){Xa(a);kg(a)},qa=j.on=function(a,b,c){if(a.addEventListener)a.addEventListener(b,c,false);
else if(a.attachEvent)a.attachEvent("on"+b,c);else{a=a._handlers||(a._handlers={});(a[b]||(a[b]=[])).push(c)}},yb=j.off=function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,false);else if(a.detachEvent)a.detachEvent("on"+b,c);else if(a=a._handlers&&a._handlers[b])for(b=0;b<a.length;++b)if(a[b]==c){a.splice(b,1);break}},Oa=j.signal=function(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)},Oc=null,oe=30,
Ie=j.Pass={toString:function(){return"CodeMirror.Pass"}},Eb={scroll:false},Wd={origin:"*mouse"},Qc={origin:"+move"};Tc.prototype.set=function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var kb=j.countColumn=function(a,b,c,d,e){if(b==null){b=a.search(/[^\s\u00a0]/);if(b==-1)b=a.length}d=d||0;for(e=e||0;;){var f=a.indexOf("\t",d);if(f<0||f>=b)return e+(b-d);e+=f-d;e+=c-e%c;d=f+1}},Dd=[""],Fc=function(a){a.select()};if(rc)Fc=function(a){a.selectionStart=0;a.selectionEnd=a.value.length};else if(va)Fc=
function(a){try{a.select()}catch(b){}};var lg=/[\u00df\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,pf=j.isWordChar=function(a){return/\w/.test(a)||a>"\u0080"&&(a.toUpperCase()!=a.toLowerCase()||lg.test(a))},gg=/[\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]/,
ic;ic=document.createRange?function(a,b,c){var d=document.createRange();d.setEnd(a,c);d.setStart(a,b);return d}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(e){return d}d.collapse(true);d.moveEnd("character",c);d.moveStart("character",b);return d};if(va&&Fa<11)Ab=function(){try{return document.activeElement}catch(a){return document.body}};var tc=j.rmClass=function(a,b){var c=a.className,d=Pc(b).exec(c);if(d){var e=c.slice(d.index+d[0].length);a.className=
c.slice(0,d.index)+(e?d[1]+e:"")}},vc=j.addClass=function(a,b){var c=a.className;Pc(b).test(c)||(a.className+=(c?" ":"")+b)},le=false,Hf=function(){if(va&&Fa<9)return false;var a=ga("div");return"draggable"in a||"dragDrop"in a}(),je,ge,Tb=j.splitLines="\n\nb".split(/\n/).length!=3?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);if(e==-1)e=a.length;var f=a.slice(b,a.charAt(e-1)=="\r"?e-1:e),h=f.indexOf("\r");if(h!=-1){c.push(f.slice(0,h));b+=h+1}else{c.push(f);b=e+1}}return c}:
function(a){return a.split(/\r\n?|\n/)},Df=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return false}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}if(!b||b.parentElement()!=a)return false;return b.compareEndPoints("StartToEnd",b)!=0},we=function(){var a=ga("div");if("oncopy"in a)return true;a.setAttribute("oncopy","return;");return typeof a.oncopy=="function"}(),Od=null,Kb={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",
18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};j.keyNames=Kb;(function(){for(var a=
0;a<10;a++)Kb[a+48]=Kb[a+96]=String(a);for(a=65;a<=90;a++)Kb[a]=String.fromCharCode(a);for(a=1;a<=12;a++)Kb[a+111]=Kb[a+63235]="F"+a})();var Cc,eg=function(){function a(m){return m<=247?c.charAt(m):1424<=m&&m<=1524?"R":1536<=m&&m<=1773?d.charAt(m-1536):1774<=m&&m<=2220?"r":8192<=m&&m<=8203?"w":m==8204?"b":"L"}function b(m,o,t){this.level=m;this.from=o;this.to=t}var c="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",
d="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,h=/[LRr]/,i=/[Lb1n]/,k=/[1n]/;return function(m){if(!e.test(m))return false;for(var o=m.length,t=[],p=0,D;p<o;++p)t.push(a(m.charCodeAt(p)));p=0;for(var L="L";p<o;++p){D=t[p];if(D=="m")t[p]=L;else L=D}p=
0;for(L="L";p<o;++p){D=t[p];if(D=="1"&&L=="r")t[p]="n";else if(h.test(D)){L=D;if(D=="r")t[p]="R"}}p=1;for(L=t[0];p<o-1;++p){D=t[p];if(D=="+"&&L=="1"&&t[p+1]=="1")t[p]="1";else if(D==","&&L==t[p+1]&&(L=="1"||L=="n"))t[p]=L;L=D}for(p=0;p<o;++p){D=t[p];if(D==",")t[p]="N";else if(D=="%"){for(L=p+1;L<o&&t[L]=="%";++L);var ea=p&&t[p-1]=="!"||L<o&&t[L]=="1"?"1":"N";for(D=p;D<L;++D)t[D]=ea;p=L-1}}p=0;for(L="L";p<o;++p){D=t[p];if(L=="L"&&D=="1")t[p]="L";else if(h.test(D))L=D}for(p=0;p<o;++p)if(f.test(t[p])){for(L=
p+1;L<o&&f.test(t[L]);++L);D=(L<o?t[L]:"L")=="L";ea=(p?t[p-1]:"L")=="L"||D?"L":"R";for(D=p;D<L;++D)t[D]=ea;p=L-1}L=[];var fa;for(p=0;p<o;)if(i.test(t[p])){D=p;for(++p;p<o&&i.test(t[p]);++p);L.push(new b(0,D,p))}else{var na=p;ea=L.length;for(++p;p<o&&t[p]!="L";++p);for(D=na;D<p;)if(k.test(t[D])){na<D&&L.splice(ea,0,new b(1,na,D));na=D;for(++D;D<p&&k.test(t[D]);++D);L.splice(ea,0,new b(2,na,D));na=D}else++D;na<p&&L.splice(ea,0,new b(1,na,p))}if(L[0].level==1&&(fa=m.match(/^\s+/))){L[0].from=fa[0].length;
L.unshift(new b(0,0,fa[0].length))}if(Ia(L).level==1&&(fa=m.match(/\s+$/))){Ia(L).to-=fa[0].length;L.push(new b(0,o-fa[0].length,o))}L[0].level!=Ia(L).level&&L.push(new b(L[0].level,o,o));return L}}();j.version="4.11.1";return j});CodeMirror.defineMode("hl7",function(j,ca){var X=ca.DelimiterRegex||/(\\|&|~|\^|\|)/;return{token:function(w){if(w.string===ca.LfToken||w.string===ca.CrToken||w.string===ca.CrToken+ca.LfToken){w.next();return null}var u=w.peek();if(w.sol())if(/\w/.test(u)){w.eatWhile(/\w/);return"keyword"}if(u.match(X)){w.next();return"delim"}w.next();return null}}});(function(j){if(typeof exports=="object"&&typeof module=="object")j(require("../../lib/codemirror"));else typeof define=="function"&&define.amd?define(["../../lib/codemirror"],j):j(CodeMirror)})(function(j){function ca(y){for(var Q={},$=0;$<y.length;++$)Q[y[$]]=true;return Q}function X(y,Q){for(var $=false,Ga;(Ga=y.next())!=null;){if($&&Ga=="/"){Q.tokenize=null;break}$=Ga=="*"}return["comment","comment"]}function w(y,Q){if(y.skipTo("--\>")){y.match("--\>");Q.tokenize=null}else y.skipToEnd();return["comment",
"comment"]}j.defineMode("css",function(y,Q){function $(r,F){P=F;return r}function Ga(r,F){var s=r.next();if(O[s]){var U=O[s](r,F);if(U!==false)return U}if(s=="@"){r.eatWhile(/[\w\\\-]/);return $("def",r.current())}else if(s=="="||(s=="~"||s=="|")&&r.eat("="))return $(null,"compare");else if(s=='"'||s=="'"){F.tokenize=cb(s);return F.tokenize(r,F)}else if(s=="#"){r.eatWhile(/[\w\\\-]/);return $("atom","hash")}else if(s=="!"){r.match(/^\s*\w*/);return $("keyword","important")}else if(/\d/.test(s)||s==
"."&&r.eat(/\d/)){r.eatWhile(/[\w.%]/);return $("number","unit")}else if(s==="-")if(/[\d.]/.test(r.peek())){r.eatWhile(/[\w.%]/);return $("number","unit")}else{if(r.match(/^\w+-/))return $("meta","meta")}else if(/[,+>*\/]/.test(s))return $(null,"select-op");else if(s=="."&&r.match(/^-?[_a-z][_a-z0-9-]*/i))return $("qualifier","qualifier");else if(/[:;{}\[\]\(\)]/.test(s))return $(null,s);else if(s=="u"&&r.match("rl(")){r.backUp(1);F.tokenize=Va;return $("property","word")}else if(/[\w\\\-]/.test(s)){r.eatWhile(/[\w\\\-]/);
return $("property","word")}else return $(null,null)}function cb(r){return function(F,s){for(var U=false,ja;(ja=F.next())!=null;){if(ja==r&&!U){r==")"&&F.backUp(1);break}U=!U&&ja=="\\"}if(ja==r||!U&&r!=")")s.tokenize=null;return $("string","string")}}function Va(r,F){r.next();F.tokenize=r.match(/\s*[\"\')]/,false)?null:cb(")");return $(null,"(")}function Ja(r,F,s){this.type=r;this.indent=F;this.prev=s}function Ea(r,F,s){r.context=new Ja(s,F.indentation()+G,r.context);return s}function S(r){r.context=
r.context.prev;return r.context.type}function T(r,F,s,U){for(U=U||1;U>0;U--)s.context=s.context.prev;return R[s.context.type](r,F,s)}function C(r){r=r.current().toLowerCase();V=ma.hasOwnProperty(r)?"atom":Z.hasOwnProperty(r)?"keyword":"variable"}Q.propertyKeywords||(Q=j.resolveMode("text/css"));var G=y.indentUnit,O=Q.tokenHooks,ba=Q.mediaTypes||{},wa=Q.mediaFeatures||{},ra=Q.propertyKeywords||{},la=Q.nonStandardPropertyKeywords||{},Z=Q.colorKeywords||{},ma=Q.valueKeywords||{},Aa=Q.fontProperties||
{},ua=Q.allowNested,P,V,R={};R.top=function(r,F,s){if(r=="{")return Ea(s,F,"block");else if(r=="}"&&s.context.prev)return S(s);else if(r=="@media")return Ea(s,F,"media");else if(r=="@font-face")return"font_face_before";else if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(r))return"keyframes";else if(r&&r.charAt(0)=="@")return Ea(s,F,"at");else if(r=="hash")V="builtin";else if(r=="word")V="tag";else if(r=="variable-definition")return"maybeprop";else if(r=="interpolation")return Ea(s,F,"interpolation");
else if(r==":")return"pseudo";else if(ua&&r=="(")return Ea(s,F,"parens");return s.context.type};R.block=function(r,F,s){if(r=="word"){r=F.current().toLowerCase();if(ra.hasOwnProperty(r)){V="property";return"maybeprop"}else if(la.hasOwnProperty(r)){V="string-2";return"maybeprop"}else if(ua){V=F.match(/^\s*:(?:\s|$)/,false)?"property":"tag";return"block"}else{V+=" error";return"maybeprop"}}else if(r=="meta")return"block";else if(!ua&&(r=="hash"||r=="qualifier")){V="error";return"block"}else return R.top(r,
F,s)};R.maybeprop=function(r,F,s){if(r==":")return Ea(s,F,"prop");return R[s.context.type](r,F,s)};R.prop=function(r,F,s){if(r==";")return S(s);if(r=="{"&&ua)return Ea(s,F,"propBlock");if(r=="}"||r=="{")return T(r,F,s);if(r=="(")return Ea(s,F,"parens");if(r=="hash"&&!/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(F.current()))V+=" error";else if(r=="word")C(F);else if(r=="interpolation")return Ea(s,F,"interpolation");return"prop"};R.propBlock=function(r,F,s){if(r=="}")return S(s);if(r=="word"){V="property";
return"maybeprop"}return s.context.type};R.parens=function(r,F,s){if(r=="{"||r=="}")return T(r,F,s);if(r==")")return S(s);if(r=="(")return Ea(s,F,"parens");r=="word"&&C(F);return"parens"};R.pseudo=function(r,F,s){if(r=="word"){V="variable-3";return s.context.type}return R[s.context.type](r,F,s)};R.media=function(r,F,s){if(r=="(")return Ea(s,F,"media_parens");if(r=="}")return T(r,F,s);if(r=="{")return S(s)&&Ea(s,F,ua?"block":"top");if(r=="word"){r=F.current().toLowerCase();V=r=="only"||r=="not"||r==
"and"?"keyword":ba.hasOwnProperty(r)?"attribute":wa.hasOwnProperty(r)?"property":"error"}return s.context.type};R.media_parens=function(r,F,s){if(r==")")return S(s);if(r=="{"||r=="}")return T(r,F,s,2);return R.media(r,F,s)};R.font_face_before=function(r,F,s){if(r=="{")return Ea(s,F,"font_face");return R[s.context.type](r,F,s)};R.font_face=function(r,F,s){if(r=="}")return S(s);if(r=="word"){V=Aa.hasOwnProperty(F.current().toLowerCase())?"property":"error";return"maybeprop"}return"font_face"};R.keyframes=
function(r,F,s){if(r=="word"){V="variable";return"keyframes"}if(r=="{")return Ea(s,F,"top");return R[s.context.type](r,F,s)};R.at=function(r,F,s){if(r==";")return S(s);if(r=="{"||r=="}")return T(r,F,s);if(r=="word")V="tag";else if(r=="hash")V="builtin";return"at"};R.interpolation=function(r,F,s){if(r=="}")return S(s);if(r=="{"||r==";")return T(r,F,s);if(r!="variable")V="error";return"interpolation"};return{startState:function(r){return{tokenize:null,state:"top",context:new Ja("top",r||0,null)}},token:function(r,
F){if(!F.tokenize&&r.eatSpace())return null;var s=(F.tokenize||Ga)(r,F);if(s&&typeof s=="object"){P=s[1];s=s[0]}V=s;F.state=R[F.state](P,r,F);return V},indent:function(r,F){var s=r.context,U=F&&F.charAt(0),ja=s.indent;if(s.type=="prop"&&(U=="}"||U==")"))s=s.prev;if(s.prev&&(U=="}"&&(s.type=="block"||s.type=="top"||s.type=="interpolation"||s.type=="font_face")||U==")"&&(s.type=="parens"||s.type=="media_parens")||U=="{"&&(s.type=="at"||s.type=="media")))ja=s.indent-G;return ja},electricChars:"}",blockCommentStart:"/*",
blockCommentEnd:"*/",fold:"brace"}});var u=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],g=ca(u),l=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index",
"max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],q=ca(l),v=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment",
"background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice",
"border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear",
"clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit",
"fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area",
"grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift",
"line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style",
"outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent",
"resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line",
"text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align",
"visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker",
"marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],A=ca(v),M=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color",
"scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],x=ca(M),J=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta",
"darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray",
"lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred",
"papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],H=ca(J),E=["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always",
"amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext",
"caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash",
"dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig",
"ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline",
"inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background",
"media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian",
"monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap",
"preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show",
"sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group",
"table-row","table-row-group","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url",
"vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small"],B=ca(E),z=ca(["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]);u=u.concat(l).concat(v).concat(M).concat(J).concat(E);j.registerHelper("hintWords","css",u);j.defineMIME("text/css",{mediaTypes:g,mediaFeatures:q,propertyKeywords:A,
nonStandardPropertyKeywords:x,colorKeywords:H,valueKeywords:B,fontProperties:z,tokenHooks:{"<":function(y,Q){if(!y.match("!--"))return false;Q.tokenize=w;return w(y,Q)},"/":function(y,Q){if(!y.eat("*"))return false;Q.tokenize=X;return X(y,Q)}},name:"css"});j.defineMIME("text/x-scss",{mediaTypes:g,mediaFeatures:q,propertyKeywords:A,nonStandardPropertyKeywords:x,colorKeywords:H,valueKeywords:B,fontProperties:z,allowNested:true,tokenHooks:{"/":function(y,Q){if(y.eat("/")){y.skipToEnd();return["comment",
"comment"]}else if(y.eat("*")){Q.tokenize=X;return X(y,Q)}else return["operator","operator"]},":":function(y){if(y.match(/\s*\{/))return[null,"{"];return false},$:function(y){y.match(/^[\w-]+/);if(y.match(/^\s*:/,false))return["variable-2","variable-definition"];return["variable-2","variable"]},"#":function(y){if(!y.eat("{"))return false;return[null,"interpolation"]}},name:"css",helperType:"scss"});j.defineMIME("text/x-less",{mediaTypes:g,mediaFeatures:q,propertyKeywords:A,nonStandardPropertyKeywords:x,
colorKeywords:H,valueKeywords:B,fontProperties:z,allowNested:true,tokenHooks:{"/":function(y,Q){if(y.eat("/")){y.skipToEnd();return["comment","comment"]}else if(y.eat("*")){Q.tokenize=X;return X(y,Q)}else return["operator","operator"]},"@":function(y){if(y.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,false))return false;y.eatWhile(/[\w\\\-]/);if(y.match(/^\s*:/,false))return["variable-2","variable-definition"];return["variable-2","variable"]},
"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})});CodeMirror.defineMode("dbs",function(j,ca){function X(J,H){var E=J.next();if(E=='"'||E=="'"){E=w(E);H.tokenize=E;return E(J,H)}else if(!/[\[\]{}\(\),;\.]/.test(E))if(/\d/.test(E)){J.eatWhile(/[\w\.]/);return"number"}else if(E=="/")if(J.eat("*")){E=u;H.tokenize=E;return E(J,H)}else{J.eatWhile(x);return"operator"}else if(E=="-")if(J.eat("-")){J.skipToEnd();return"comment"}else{J.eatWhile(x);return"operator"}else if(E=="@"||E=="$"){J.eatWhile(/[\w\d\$_]/);return"variable"}else if(x.test(E)){J.eatWhile(x);
return"operator"}else{J.eatWhile(/[\w\$_]/);if(l&&l.propertyIsEnumerable(J.current().toLowerCase()))return"keyword";if(q&&q.propertyIsEnumerable(J.current().toLowerCase()))return"builtin";if(v&&v.propertyIsEnumerable(J.current().toLowerCase()))return"variable-2";if(A&&A.propertyIsEnumerable(J.current().toLowerCase()))return"variable-3";return"dbs-word"}}function w(J){return function(H,E){for(var B=false,z,y=false;(z=H.next())!=null;){if(z==J&&!B){y=true;break}B=!B&&z=="\\"}if(y||!(B||M))E.tokenize=
X;return"dbs-string"}}function u(J,H){for(var E=false,B;B=J.next();){if(B=="/"&&E){H.tokenize=X;break}E=B=="*"}return"dbs-comment"}function g(J){var H={};J=J.split(" ");for(var E=0;E<J.length;++E)H[J[E]]=true;return H}var l=g("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),
q=g("abs acos add_months ascii asin atan atan2 average bfilename ceil chartorowid chr concat convert cos cosh count decode deref dual dump dup_val_on_index empty error exp false floor found glb greatest hextoraw initcap instr instrb isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mod months_between new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null nvl others power rawtohex reftohex round rowcount rowidtochar rpad rtrim sign sin sinh soundex sqlcode sqlerrm sqrt stddev substr substrb sum sysdate tan tanh to_char to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid upper user userenv variance vsize"),
v=g("bfile blob character clob dec float int integer mlslabel natural naturaln nchar nclob number numeric nvarchar2 real rowtype signtype smallint string varchar varchar2"),A=g("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),
M=ca.multiLineStrings,x=/[+\-*&%=<>!?:\/|]/;return{startState:function(){return{tokenize:X,startOfLine:true}},token:function(J,H){if(J.eatSpace())return null;return H.tokenize(J,H)}}});(function(j){if(typeof exports=="object"&&typeof module=="object")j(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css"));else typeof define=="function"&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],j):j(CodeMirror)})(function(j){j.defineMode("htmlmixed",function(ca,X){function w(H,E){var B=E.htmlState.tagName;if(B)B=B.toLowerCase();var z=q.token(H,E.htmlState);if(B=="script"&&/\btag\b/.test(z)&&
H.current()==">"){if((B=(B=H.string.slice(Math.max(0,H.pos-100),H.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i))?B[1]:"")&&/[\"\']/.test(B.charAt(0)))B=B.slice(1,B.length-1);for(var y=0;y<A.length;++y){var Q=A[y];if(typeof Q.matches=="string"?B==Q.matches:Q.matches.test(B)){if(Q.mode){E.token=g;E.localMode=Q.mode;E.localState=Q.mode.startState&&Q.mode.startState(q.indent(E.htmlState,""))}break}}}else if(B=="style"&&/\btag\b/.test(z)&&H.current()==">"){E.token=l;E.localMode=v;E.localState=
v.startState(q.indent(E.htmlState,""))}return z}function u(H,E,B){var z=H.current(),y=z.search(E);if(y>-1)H.backUp(z.length-y);else if(z.match(/<\/?$/)){H.backUp(z.length);H.match(E,false)||H.match(z)}return B}function g(H,E){if(H.match(/^<\/\s*script\s*>/i,false)){E.token=w;return E.localState=E.localMode=null}return u(H,/<\/\s*script\s*>/,E.localMode.token(H,E.localState))}function l(H,E){if(H.match(/^<\/\s*style\s*>/i,false)){E.token=w;return E.localState=E.localMode=null}return u(H,/<\/\s*style\s*>/,
v.token(H,E.localState))}var q=j.getMode(ca,{name:"xml",htmlMode:true,multilineTagIndentFactor:X.multilineTagIndentFactor,multilineTagIndentPastTag:X.multilineTagIndentPastTag}),v=j.getMode(ca,"css"),A=[],M=X&&X.scriptTypes;A.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:j.getMode(ca,"javascript")});if(M)for(var x=0;x<M.length;++x){var J=M[x];A.push({matches:J.matches,mode:J.mode&&j.getMode(ca,J.mode)})}A.push({matches:/./,mode:j.getMode(ca,"text/plain")});return{startState:function(){var H=
q.startState();return{token:w,localMode:null,localState:null,htmlState:H}},copyState:function(H){if(H.localState)var E=j.copyState(H.localMode,H.localState);return{token:H.token,localMode:H.localMode,localState:E,htmlState:j.copyState(q,H.htmlState)}},token:function(H,E){return E.token(H,E)},indent:function(H,E){return!H.localMode||/^\s*<\//.test(E)?q.indent(H.htmlState,E):H.localMode.indent?H.localMode.indent(H.localState,E):j.Pass},innerMode:function(H){return{state:H.localState||H.htmlState,mode:H.localMode||
q}}}},"xml","javascript","css");j.defineMIME("text/html","htmlmixed")});(function(j){if(typeof exports=="object"&&typeof module=="object")j(require("../../lib/codemirror"));else typeof define=="function"&&define.amd?define(["../../lib/codemirror"],j):j(CodeMirror)})(function(j){j.defineMode("javascript",function(ca,X){function w(n,I,N){ub=n;Hb=N;return I}function u(n,I){var N=n.next();if(N=='"'||N=="'"){I.tokenize=g(N);return I.tokenize(n,I)}else if(N=="."&&n.match(/^\d+(?:[eE][+\-]?\d+)?/))return w("number","number");else if(N=="."&&n.match(".."))return w("spread","meta");
else if(/[\[\]{}\(\),;\:\.]/.test(N))return w(N);else if(N=="="&&n.eat(">"))return w("=>","operator");else if(N=="0"&&n.eat(/x/i)){n.eatWhile(/[\da-f]/i);return w("number","number")}else if(/\d/.test(N)){n.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);return w("number","number")}else if(N=="/")if(n.eat("*")){I.tokenize=l;return l(n,I)}else if(n.eat("/")){n.skipToEnd();return w("comment","comment")}else if(I.lastType=="operator"||I.lastType=="keyword c"||I.lastType=="sof"||/^[\[{}\(,;:]$/.test(I.lastType)){N=
false;for(var K,ka=false;(K=n.next())!=null;){if(!N){if(K=="/"&&!ka)break;if(K=="[")ka=true;else if(ka&&K=="]")ka=false}N=!N&&K=="\\"}n.eatWhile(/[gimy]/);return w("regexp","string-2")}else{n.eatWhile(Db);return w("operator","operator",n.current())}else if(N=="`"){I.tokenize=q;return q(n,I)}else if(N=="#"){n.skipToEnd();return w("error","error")}else if(Db.test(N)){n.eatWhile(Db);return w("operator","operator",n.current())}else if(Za.test(N)){n.eatWhile(Za);N=n.current();return(K=hb.propertyIsEnumerable(N)&&
hb[N])&&I.lastType!="."?w(K.type,K.style,N):w("variable","variable",N)}}function g(n){return function(I,N){var K=false,ka;if(hc&&I.peek()=="@"&&I.match(ad)){N.tokenize=u;return w("jsonld-keyword","meta")}for(;(ka=I.next())!=null;){if(ka==n&&!K)break;K=!K&&ka=="\\"}if(!K)N.tokenize=u;return w("string","string")}}function l(n,I){for(var N=false,K;K=n.next();){if(K=="/"&&N){I.tokenize=u;break}N=K=="*"}return w("comment","comment")}function q(n,I){for(var N=false,K;(K=n.next())!=null;){if(!N&&(K=="`"||
K=="$"&&n.eat("{"))){I.tokenize=u;break}N=!N&&K=="\\"}return w("quasi","string-2",n.current())}function v(n,I){if(I.fatArrowAt)I.fatArrowAt=null;var N=n.string.indexOf("=>",n.start);if(!(N<0)){var K=0,ka=false;for(N-=1;N>=0;--N){var za=n.string.charAt(N),Ra=bd.indexOf(za);if(Ra>=0&&Ra<3){if(!K){++N;break}if(--K==0)break}else if(Ra>=3&&Ra<6)++K;else if(Za.test(za))ka=true;else if(/["'\/]/.test(za))return;else if(ka&&!K){++N;break}}if(ka&&!K)I.fatArrowAt=N}}function A(n,I,N,K,ka,za){this.indented=n;
this.column=I;this.type=N;this.prev=ka;this.info=za;if(K!=null)this.align=K}function M(){for(var n=arguments.length-1;n>=0;n--)aa.cc.push(arguments[n])}function x(){M.apply(null,arguments);return true}function J(n){function I(K){for(;K;K=K.next)if(K.name==n)return true;return false}var N=aa.state;if(N.context){aa.marked="def";if(!I(N.localVars))N.localVars={name:n,next:N.localVars}}else if(!I(N.globalVars))if(X.globalVars)N.globalVars={name:n,next:N.globalVars}}function H(){aa.state.context={prev:aa.state.context,
vars:aa.state.localVars};aa.state.localVars=Ac}function E(){aa.state.localVars=aa.state.context.vars;aa.state.context=aa.state.context.prev}function B(n,I){var N=function(){var K=aa.state,ka=K.indented;if(K.lexical.type=="stat")ka=K.lexical.indented;else for(var za=K.lexical;za&&za.type==")"&&za.align;za=za.prev)ka=za.indented;K.lexical=new A(ka,aa.stream.column(),n,null,K.lexical,I)};N.lex=true;return N}function z(){var n=aa.state;if(n.lexical.prev){if(n.lexical.type==")")n.indented=n.lexical.indented;
n.lexical=n.lexical.prev}}function y(n){function I(N){return N==n?x():n==";"?M():x(I)}return I}function Q(n,I){if(n=="var")return x(B("vardef",I.length),R,y(";"),z);if(n=="keyword a")return x(B("form"),$,Q,z);if(n=="keyword b")return x(B("form"),Q,z);if(n=="{")return x(B("}"),ua,z);if(n==";")return x();if(n=="if"){aa.state.lexical.info=="else"&&aa.state.cc[aa.state.cc.length-1]==z&&aa.state.cc.pop()();return x(B("form"),$,Q,z,ja)}if(n=="function")return x(Ba);if(n=="for")return x(B("form"),Y,Q,z);
if(n=="variable")return x(B("stat"),ba);if(n=="switch")return x(B("form"),$,B("}","switch"),y("{"),ua,z,z);if(n=="case")return x($,y(":"));if(n=="default")return x(y(":"));if(n=="catch")return x(B("form"),H,y("("),bc,y(")"),Q,z,E);if(n=="module")return x(B("form"),H,Zc,E,z);if(n=="class")return x(B("form"),cc,z);if(n=="export")return x(B("form"),Yc,z);if(n=="import")return x(B("form"),ec,z);return M(B("stat"),$,y(";"),z)}function $(n){return cb(n,false)}function Ga(n){return cb(n,true)}function cb(n,
I){if(aa.state.fatArrowAt==aa.stream.start){var N=I?O:G;if(n=="(")return x(H,B(")"),ma(r,")"),z,y("=>"),N,E);else if(n=="variable")return M(H,r,y("=>"),N,E)}N=I?S:Ea;if(cd.hasOwnProperty(n))return x(N);if(n=="function")return x(Ba,N);if(n=="keyword c")return x(I?Ja:Va);if(n=="(")return x(B(")"),Va,Fb,y(")"),z,N);if(n=="operator"||n=="spread")return x(I?Ga:$);if(n=="[")return x(B("]"),Rb,z,N);if(n=="{")return Aa(ra,"}",null,N);if(n=="quasi")return M(T,N);return x()}function Va(n){if(n.match(/[;\}\)\],]/))return M();
return M($)}function Ja(n){if(n.match(/[;\}\)\],]/))return M();return M(Ga)}function Ea(n,I){if(n==",")return x($);return S(n,I,false)}function S(n,I,N){var K=N==false?Ea:S,ka=N==false?$:Ga;if(n=="=>")return x(H,N?O:G,E);if(n=="operator"){if(/\+\+|--/.test(I))return x(K);if(I=="?")return x($,y(":"),ka);return x(ka)}if(n=="quasi")return M(T,K);if(n!=";"){if(n=="(")return Aa(Ga,")","call",K);if(n==".")return x(wa,K);if(n=="[")return x(B("]"),Va,y("]"),z,K)}}function T(n,I){if(n!="quasi")return M();
if(I.slice(I.length-2)!="${")return x(T);return x($,C)}function C(n){if(n=="}"){aa.marked="string-2";aa.state.tokenize=q;return x(T)}}function G(n){v(aa.stream,aa.state);return M(n=="{"?Q:$)}function O(n){v(aa.stream,aa.state);return M(n=="{"?Q:Ga)}function ba(n){if(n==":")return x(z,Q);return M(Ea,y(";"),z)}function wa(n){if(n=="variable"){aa.marked="property";return x()}}function ra(n,I){if(n=="variable"||aa.style=="keyword"){aa.marked="property";if(I=="get"||I=="set")return x(la);return x(Z)}else if(n==
"number"||n=="string"){aa.marked=hc?"property":aa.style+" property";return x(Z)}else if(n=="jsonld-keyword")return x(Z);else if(n=="[")return x($,y("]"),Z)}function la(n){if(n!="variable")return M(Z);aa.marked="property";return x(Ba)}function Z(n){if(n==":")return x(Ga);if(n=="(")return M(Ba)}function ma(n,I){function N(K){if(K==","){K=aa.state.lexical;if(K.info=="call")K.pos=(K.pos||0)+1;return x(n,N)}if(K==I)return x();return x(y(I))}return function(K){if(K==I)return x();return M(n,N)}}function Aa(n,
I,N){for(var K=3;K<arguments.length;K++)aa.cc.push(arguments[K]);return x(B(I,N),ma(n,I),z)}function ua(n){if(n=="}")return x();return M(Q,ua)}function P(n){if(yc&&n==":")return x(V)}function V(n){if(n=="variable"){aa.marked="variable-3";return x()}}function R(){return M(r,P,s,U)}function r(n,I){if(n=="variable"){J(I);return x()}if(n=="[")return Aa(r,"]");if(n=="{")return Aa(F,"}")}function F(n,I){if(n=="variable"&&!aa.stream.match(/^\s*:/,false)){J(I);return x(s)}if(n=="variable")aa.marked="property";
return x(y(":"),r,s)}function s(n,I){if(I=="=")return x(Ga)}function U(n){if(n==",")return x(R)}function ja(n,I){if(n=="keyword b"&&I=="else")return x(B("form","else"),Q,z)}function Y(n){if(n=="(")return x(B(")"),Ka,y(")"),z)}function Ka(n){if(n=="var")return x(R,y(";"),xa);if(n==";")return x(xa);if(n=="variable")return x(Ha);return M($,y(";"),xa)}function Ha(n,I){if(I=="in"||I=="of"){aa.marked="keyword";return x($)}return x(Ea,xa)}function xa(n,I){if(n==";")return x(eb);if(I=="in"||I=="of"){aa.marked=
"keyword";return x($)}return M($,y(";"),eb)}function eb(n){n!=")"&&x($)}function Ba(n,I){if(I=="*"){aa.marked="keyword";return x(Ba)}if(n=="variable"){J(I);return x(Ba)}if(n=="(")return x(H,B(")"),ma(bc,")"),z,Q,E)}function bc(n){if(n=="spread")return x(bc);return M(r,P)}function cc(n,I){if(n=="variable"){J(I);return x(Ma)}}function Ma(n,I){if(I=="extends")return x($,Ma);if(n=="{")return x(B("}"),qb,z)}function qb(n,I){if(n=="variable"||aa.style=="keyword"){aa.marked="property";if(I=="get"||I=="set")return x(Xc,
Ba,qb);return x(Ba,qb)}if(I=="*"){aa.marked="keyword";return x(qb)}if(n==";")return x(qb);if(n=="}")return x()}function Xc(n){if(n!="variable")return M();aa.marked="property";return x()}function Zc(n,I){if(n=="string")return x(Q);if(n=="variable"){J(I);return x(fc)}}function Yc(n,I){if(I=="*"){aa.marked="keyword";return x(fc,y(";"))}if(I=="default"){aa.marked="keyword";return x($,y(";"))}return M(Q)}function ec(n){if(n=="string")return x();return M(xc,fc)}function xc(n,I){if(n=="{")return Aa(xc,"}");
n=="variable"&&J(I);return x()}function fc(n,I){if(I=="from"){aa.marked="keyword";return x($)}}function Rb(n){if(n=="]")return x();return M(Ga,Ld)}function Ld(n){if(n=="for")return M(Fb,y("]"));if(n==",")return x(ma(Ja,"]"));return M(ma(Ga,"]"))}function Fb(n){if(n=="for")return x(Y,Fb);if(n=="if")return x($,Fb)}var db=ca.indentUnit,$c=X.statementIndent,hc=X.jsonld,fb=X.json||hc,yc=X.typescript,Za=X.wordCharacters||/[\w$\xa1-\uffff]/,hb=function(){function n(vb){return{type:vb,style:"keyword"}}var I=
n("keyword a"),N=n("keyword b"),K=n("keyword c"),ka=n("operator"),za={type:"atom",style:"atom"};I={"if":n("if"),"while":I,"with":I,"else":N,"do":N,"try":N,"finally":N,"return":K,"break":K,"continue":K,"new":K,"delete":K,"throw":K,"debugger":K,"var":n("var"),"const":n("var"),let:n("var"),"function":n("function"),"catch":n("catch"),"for":n("for"),"switch":n("switch"),"case":n("case"),"default":n("default"),"in":ka,"typeof":ka,"instanceof":ka,"true":za,"false":za,"null":za,undefined:za,NaN:za,Infinity:za,
"this":n("this"),module:n("module"),"class":n("class"),"super":n("atom"),yield:K,"export":n("export"),"import":n("import"),"extends":K};if(yc){N={type:"variable",style:"variable-3"};N={"interface":n("interface"),"extends":n("extends"),constructor:n("constructor"),"public":n("public"),"private":n("private"),"protected":n("protected"),"static":n("static"),string:N,number:N,bool:N,any:N};for(var Ra in N)I[Ra]=N[Ra]}return I}(),Db=/[+\-*&%=<>!?|~^]/,ad=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,
ub,Hb,bd="([{}])",cd={atom:true,number:true,variable:true,string:true,regexp:true,"this":true,"jsonld-keyword":true},aa={state:null,column:null,marked:null,cc:null},Ac={name:"this",next:{name:"arguments"}};z.lex=true;return{startState:function(n){n={tokenize:u,lastType:"sof",cc:[],lexical:new A((n||0)-db,0,"block",false),localVars:X.localVars,context:X.localVars&&{vars:X.localVars},indented:0};if(X.globalVars&&typeof X.globalVars=="object")n.globalVars=X.globalVars;return n},token:function(n,I){if(n.sol()){if(!I.lexical.hasOwnProperty("align"))I.lexical.align=
false;I.indented=n.indentation();v(n,I)}if(I.tokenize!=l&&n.eatSpace())return null;var N=I.tokenize(n,I);if(ub=="comment")return N;I.lastType=ub=="operator"&&(Hb=="++"||Hb=="--")?"incdec":ub;var K;a:{var ka=ub,za=Hb,Ra=I.cc;aa.state=I;aa.stream=n;aa.marked=null;aa.cc=Ra;aa.style=N;if(!I.lexical.hasOwnProperty("align"))I.lexical.align=true;for(;;)if((Ra.length?Ra.pop():fb?$:Q)(ka,za)){for(;Ra.length&&Ra[Ra.length-1].lex;)Ra.pop()();if(aa.marked){K=aa.marked;break a}if(K=ka=="variable")b:{for(K=I.localVars;K;K=
K.next)if(K.name==za){K=true;break b}for(ka=I.context;ka;ka=ka.prev)for(K=ka.vars;K;K=K.next)if(K.name==za){K=true;break b}K=void 0}if(K){K="variable-2";break a}K=N;break a}}return K},indent:function(n,I){if(n.tokenize==l)return j.Pass;if(n.tokenize!=u)return 0;var N=I&&I.charAt(0),K=n.lexical;if(!/^\s*else\b/.test(I))for(var ka=n.cc.length-1;ka>=0;--ka){var za=n.cc[ka];if(za==z)K=K.prev;else if(za!=ja)break}if(K.type=="stat"&&N=="}")K=K.prev;if($c&&K.type==")"&&K.prev.type=="stat")K=K.prev;ka=K.type;
za=N==ka;return ka=="vardef"?K.indented+(n.lastType=="operator"||n.lastType==","?K.info+1:0):ka=="form"&&N=="{"?K.indented:ka=="form"?K.indented+db:ka=="stat"?K.indented+(n.lastType=="operator"||n.lastType==","||Db.test(I.charAt(0))||/[,.]/.test(I.charAt(0))?$c||db:0):K.info=="switch"&&!za&&X.doubleIndentSwitch!=false?K.indented+(/^(?:case|default)\b/.test(I)?db:2*db):K.align?K.column+(za?0:1):K.indented+(za?0:db)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:fb?null:"/*",blockCommentEnd:fb?
null:"*/",lineComment:fb?null:"//",fold:"brace",helperType:fb?"json":"javascript",jsonldMode:hc,jsonMode:fb}});j.registerHelper("wordChars","javascript",/[\w$]/);j.defineMIME("text/javascript","javascript");j.defineMIME("text/ecmascript","javascript");j.defineMIME("application/javascript","javascript");j.defineMIME("application/x-javascript","javascript");j.defineMIME("application/ecmascript","javascript");j.defineMIME("application/json",{name:"javascript",json:true});j.defineMIME("application/x-json",
{name:"javascript",json:true});j.defineMIME("application/ld+json",{name:"javascript",jsonld:true});j.defineMIME("text/typescript",{name:"javascript",typescript:true});j.defineMIME("application/typescript",{name:"javascript",typescript:true})});(function(j){if(typeof exports=="object"&&typeof module=="object")j(require("../../lib/codemirror"));else typeof define=="function"&&define.amd?define(["../../lib/codemirror"],j):j(CodeMirror)})(function(j){j.defineMode("lua",function(ca,X){function w(E){return RegExp("^(?:"+E.join("|")+")$","i")}function u(E,B){var z=E.next();if(z=="-"&&E.eat("-")){if(E.eat("[")){for(z={level:0,isBlock:false};E.eat("=");)++z.level;if(E.next()=="[")z.isBlock=true;if(z.isBlock){E.backUp(z.level);return(B.cur=g(z.level,
"comment"))(E,B)}}E.skipToEnd();return"comment"}if(z=='"'||z=="'")return(B.cur=l(z))(E,B);if(z=="["&&/[\[=]/.test(E.peek())){z=g;for(var y=0;E.eat("=");)++y;E.eat("[");return(B.cur=z(y,"string"))(E,B)}if(/\d/.test(z)){E.eatWhile(/[\w.%]/);return"number"}if(/[\w_]/.test(z)){E.eatWhile(/[\w\\\-_.]/);return"variable"}return null}function g(E,B){return function(z,y){for(var Q=null,$;($=z.next())!=null;)if(Q==null){if($=="]")Q=0}else if($=="=")++Q;else if($=="]"&&Q==E){y.cur=u;break}else Q=null;return B}}
function l(E){return function(B,z){for(var y=false,Q;(Q=B.next())!=null;){if(Q==E&&!y)break;y=!y&&Q=="\\"}if(!y)z.cur=u;return"string"}}var q=ca.indentUnit,v=w(X.specials||[]),A=w(["_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load","loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require","select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall","coroutine.create","coroutine.resume",
"coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield","debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable","debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable","debug.setupvalue","debug.traceback","close","flush","lines","read","seek","setvbuf","write","io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin","io.stdout","io.tmpfile",
"io.type","io.write","math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg","math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max","math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh","math.sqrt","math.tan","math.tanh","os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale","os.time","os.tmpname",
"os.fs.abspath","os.fs.access","os.fs.chmod","os.fs.chown","os.fs.glob","os.fs.mkdir","os.fs.rmdir","os.fs.stat","os.fs.utime","os.ts.date","os.ts.difftime","os.ts.gmdate","os.ts.gmtime","os.ts.time","package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload","package.seeall","string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub","string.len","string.lower","string.match","string.rep","string.reverse","string.sub",
"string.upper","table.concat","table.insert","table.maxn","table.remove","table.sort"]),M=w(["and","break","elseif","false","nil","not","or","return","true","function","end","if","then","else","do","while","repeat","until","for","in","local"]),x=w(["function","if","repeat","do","\\(","{"]),J=w(["end","until","\\)","}"]),H=/^(?:end|until|\)|}|else|elseif)/i;return{startState:function(E){return{basecol:E||0,indentDepth:0,cur:u}},token:function(E,B){if(E.eatSpace())return null;var z=B.cur(E,B),y=E.current();
if(z=="variable")if(M.test(y))z="keyword";else if(A.test(y))z="builtin";else if(v.test(y))z="variable-2";if(z!="comment"&&z!="string")if(x.test(y))++B.indentDepth;else J.test(y)&&--B.indentDepth;return z},indent:function(E,B){var z=H.test(B);return E.basecol+q*(E.indentDepth-(z?1:0))},lineComment:"--",blockCommentStart:"--[[",blockCommentEnd:"]]"}});j.defineMIME("text/x-lua","lua")});(function(j){if(typeof exports=="object"&&typeof module=="object")j(require("../../lib/codemirror"));else typeof define=="function"&&define.amd?define(["../../lib/codemirror"],j):j(CodeMirror)})(function(j){j.defineMode("sql",function(ca,X){function w(B,z){var y=B.next();if(H[y]){var Q=H[y](B,z);if(Q!==false)return Q}if(J.hexNumber==true&&(y=="0"&&B.match(/^[xX][0-9a-fA-F]+/)||(y=="x"||y=="X")&&B.match(/^'[0-9a-fA-F]+'/)))return"number";else if(J.binaryNumber==true&&((y=="b"||y=="B")&&B.match(/^'[01]+'/)||
y=="0"&&B.match(/^b[01]+/)))return"number";else if(y.charCodeAt(0)>47&&y.charCodeAt(0)<58){B.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/);J.decimallessFloat==true&&B.eat(".");return"number"}else if(y=="?"&&(B.eatSpace()||B.eol()||B.eat(";")))return"variable-3";else if(y=="'"||y=='"'&&J.doubleQuote){z.tokenize=u(y);return z.tokenize(B,z)}else if((J.nCharCast==true&&(y=="n"||y=="N")||J.charsetCast==true&&y=="_"&&B.match(/[a-z][a-z0-9]*/i))&&(B.peek()=="'"||B.peek()=='"'))return"keyword";else if(/^[\(\),\;\[\]]/.test(y))return null;
else if(J.commentSlashSlash&&y=="/"&&B.eat("/")){B.skipToEnd();return"comment"}else if(J.commentHash&&y=="#"||y=="-"&&B.eat("-")&&(!J.commentSpaceRequired||B.eat(" "))){B.skipToEnd();return"comment"}else if(y=="/"&&B.eat("*")){z.tokenize=g;return z.tokenize(B,z)}else if(y=="."){if(J.zerolessFloat==true&&B.match(/^(?:\d+(?:e[+-]?\d+)?)/i))return"number";if(J.ODBCdotTable==true&&B.match(/^[a-zA-Z_]+/))return"variable-2"}else if(x.test(y)){B.eatWhile(x);return null}else if(y=="{"&&(B.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||
B.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";else{B.eatWhile(/^[_\w\d]/);y=B.current().toLowerCase();if(E.hasOwnProperty(y)&&(B.match(/^( )+'[^']*'/)||B.match(/^( )+"[^"]*"/)))return"number";if(v.hasOwnProperty(y))return"atom";if(A.hasOwnProperty(y))return"builtin";if(M.hasOwnProperty(y))return"keyword";if(q.hasOwnProperty(y))return"string-2";return null}}function u(B){return function(z,y){for(var Q=false,$;($=z.next())!=null;){if($==B&&!Q){y.tokenize=w;break}Q=!Q&&$=="\\"}return"string"}}
function g(B,z){for(;;)if(B.skipTo("*")){B.next();if(B.eat("/")){z.tokenize=w;break}}else{B.skipToEnd();break}return"comment"}function l(B,z,y){z.context={prev:z.context,indent:B.indentation(),col:B.column(),type:y}}var q=X.client||{},v=X.atoms||{"false":true,"true":true,"null":true},A=X.builtin||{},M=X.keywords||{},x=X.operatorChars||/^[*+\-%<>!=&|~^]/,J=X.support||{},H=X.hooks||{},E=X.dateSQL||{date:true,time:true,timestamp:true};return{startState:function(){return{tokenize:w,context:null}},token:function(B,
z){if(B.sol())if(z.context&&z.context.align==null)z.context.align=false;if(B.eatSpace())return null;var y=z.tokenize(B,z);if(y=="comment")return y;if(z.context&&z.context.align==null)z.context.align=true;var Q=B.current();if(Q=="(")l(B,z,")");else if(Q=="[")l(B,z,"]");else if(z.context&&z.context.type==Q){z.indent=z.context.indent;z.context=z.context.prev}return y},indent:function(B,z){var y=B.context;if(!y)return 0;var Q=z.charAt(0)==y.type;return y.align?y.col+(Q?0:1):y.indent+(Q?0:ca.indentUnit)},
blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:J.commentSlashSlash?"//":J.commentHash?"#":null}});(function(){function ca(g){for(var l;(l=g.next())!=null;)if(l=="`"&&!g.eat("`"))return"variable-2";g.backUp(g.current().length-1);return g.eatWhile(/\w/)?"variable-2":null}function X(g){if(g.eat("@")){g.match(/^session\./);g.match(/^local\./);g.match(/^global\./)}if(g.eat("'")){g.match(/^.*'/);return"variable-2"}else if(g.eat('"')){g.match(/^.*"/);return"variable-2"}else if(g.eat("`")){g.match(/^.*`/);
return"variable-2"}else if(g.match(/^[0-9a-zA-Z$\.\_]+/))return"variable-2";return null}function w(g){if(g.eat("N"))return"atom";return g.match(/^[a-zA-Z.#!?]/)?"variable-2":null}function u(g){var l={};g=g.split(" ");for(var q=0;q<g.length;++q)l[g[q]]=true;return l}j.defineMIME("text/x-sql",{name:"sql",keywords:u("alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where begin"),builtin:u("bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"),
atoms:u("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:u("date time timestamp"),support:u("ODBCdotTable doubleQuote binaryNumber hexNumber")});j.defineMIME("text/x-mssql",{name:"sql",client:u("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:u("alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered"),
builtin:u("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),atoms:u("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:u("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":X}});j.defineMIME("text/x-mysql",{name:"sql",client:u("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),
keywords:u("alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group groupby_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
builtin:u("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:u("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:u("date time timestamp"),support:u("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),
hooks:{"@":X,"`":ca,"\\":w}});j.defineMIME("text/x-mariadb",{name:"sql",client:u("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:u("alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
builtin:u("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:u("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:u("date time timestamp"),support:u("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),
hooks:{"@":X,"`":ca,"\\":w}});j.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:u("use select from using consistency where limit first reversed first and in insert into values using consistency ttl update set delete truncate begin batch apply create keyspace with columnfamily primary key index on drop alter type add any one quorum all local_quorum each_quorum"),builtin:u("ascii bigint blob boolean counter decimal double float int text timestamp uuid varchar varint"),atoms:u("false true"),
operatorChars:/^[<>=]/,dateSQL:{},support:u("commentSlashSlash decimallessFloat"),hooks:{}});j.defineMIME("text/x-plsql",{name:"sql",client:u("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),
keywords:u("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),
builtin:u("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),
operatorChars:/^[*+\-%<>!=~]/,dateSQL:u("date time timestamp"),support:u("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")});j.defineMIME("text/x-hive",{name:"sql",keywords:u("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),
builtin:u("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),atoms:u("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:u("date timestamp"),support:u("ODBCdotTable doubleQuote binaryNumber hexNumber")})})()});(function(j){if(typeof exports=="object"&&typeof module=="object")j(require("../../lib/codemirror"));else typeof define=="function"&&define.amd?define(["../../lib/codemirror"],j):j(CodeMirror)})(function(j){j.defineMode("xml",function(ca,X){function w(C,G){function O(wa){G.tokenize=wa;return wa(C,G)}var ba=C.next();if(ba=="<")if(C.eat("!"))if(C.eat("["))return C.match("CDATA[")?O(l("atom","]]\>")):null;else if(C.match("--"))return O(l("comment","--\>"));else if(C.match("DOCTYPE",true,true)){C.eatWhile(/[\w\._\-]/);
return O(q(1))}else return null;else if(C.eat("?")){C.eatWhile(/[\w\._\-]/);G.tokenize=l("meta","?>");return"meta"}else{S=C.eat("/")?"closeTag":"openTag";G.tokenize=u;return"tag bracket"}else if(ba=="&")return(C.eat("#")?C.eat("x")?C.eatWhile(/[a-fA-F\d]/)&&C.eat(";"):C.eatWhile(/[\d]/)&&C.eat(";"):C.eatWhile(/[\w\.\-:]/)&&C.eat(";"))?"atom":"error";else{C.eatWhile(/[^&<]/);return null}}function u(C,G){var O=C.next();if(O==">"||O=="/"&&C.eat(">")){G.tokenize=w;S=O==">"?"endTag":"selfcloseTag";return"tag bracket"}else if(O==
"="){S="equals";return null}else if(O=="<"){G.tokenize=w;G.state=x;G.tagName=G.tagStart=null;return(O=G.tokenize(C,G))?O+" tag error":"tag error"}else if(/[\'\"]/.test(O)){G.tokenize=g(O);G.stringStartCol=C.column();return G.tokenize(C,G)}else{C.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);return"word"}}function g(C){var G=function(O,ba){for(;!O.eol();)if(O.next()==C){ba.tokenize=u;break}return"string"};G.isInAttribute=true;return G}function l(C,G){return function(O,ba){for(;!O.eol();){if(O.match(G)){ba.tokenize=
w;break}O.next()}return C}}function q(C){return function(G,O){for(var ba;(ba=G.next())!=null;)if(ba=="<"){O.tokenize=q(C+1);return O.tokenize(G,O)}else if(ba==">")if(C==1){O.tokenize=w;break}else{O.tokenize=q(C-1);return O.tokenize(G,O)}return"meta"}}function v(C,G,O){this.prev=C.context;this.tagName=G;this.indent=C.indented;this.startOfLine=O;if(Ja.doNotIndent.hasOwnProperty(G)||C.context&&C.context.noIndent)this.noIndent=true}function A(C){if(C.context)C.context=C.context.prev}function M(C,G){for(var O;;){if(!C.context)break;
O=C.context.tagName;if(!Ja.contextGrabbers.hasOwnProperty(O)||!Ja.contextGrabbers[O].hasOwnProperty(G))break;A(C)}}function x(C,G,O){if(C=="openTag"){O.tagStart=G.column();return J}else return C=="closeTag"?H:x}function J(C,G,O){if(C=="word"){O.tagName=G.current();T="tag";return z}else{T="error";return J}}function H(C,G,O){if(C=="word"){C=G.current();O.context&&O.context.tagName!=C&&Ja.implicitlyClosed.hasOwnProperty(O.context.tagName)&&A(O);if(O.context&&O.context.tagName==C){T="tag";return E}else{T=
"tag error";return B}}else{T="error";return B}}function E(C,G,O){if(C!="endTag"){T="error";return E}A(O);return x}function B(C,G,O){T="error";return E(C,G,O)}function z(C,G,O){if(C=="word"){T="attribute";return y}else if(C=="endTag"||C=="selfcloseTag"){G=O.tagName;var ba=O.tagStart;O.tagName=O.tagStart=null;if(C=="selfcloseTag"||Ja.autoSelfClosers.hasOwnProperty(G))M(O,G);else{M(O,G);O.context=new v(O,G,ba==O.indented)}return x}T="error";return z}function y(C,G,O){if(C=="equals")return Q;Ja.allowMissing||
(T="error");return z(C,G,O)}function Q(C,G,O){if(C=="string")return $;if(C=="word"&&Ja.allowUnquoted){T="string";return z}T="error";return z(C,G,O)}function $(C,G,O){if(C=="string")return $;return z(C,G,O)}var Ga=ca.indentUnit,cb=X.multilineTagIndentFactor||1,Va=X.multilineTagIndentPastTag;if(Va==null)Va=true;var Ja=X.htmlMode?{autoSelfClosers:{area:true,base:true,br:true,col:true,command:true,embed:true,frame:true,hr:true,img:true,input:true,keygen:true,link:true,meta:true,param:true,source:true,
track:true,wbr:true,menuitem:true},implicitlyClosed:{dd:true,li:true,optgroup:true,option:true,p:true,rp:true,rt:true,tbody:true,td:true,tfoot:true,th:true,tr:true},contextGrabbers:{dd:{dd:true,dt:true},dt:{dd:true,dt:true},li:{li:true},option:{option:true,optgroup:true},optgroup:{optgroup:true},p:{address:true,article:true,aside:true,blockquote:true,dir:true,div:true,dl:true,fieldset:true,footer:true,form:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,header:true,hgroup:true,hr:true,menu:true,
nav:true,ol:true,p:true,pre:true,section:true,table:true,ul:true},rp:{rp:true,rt:true},rt:{rp:true,rt:true},tbody:{tbody:true,tfoot:true},td:{td:true,th:true},tfoot:{tbody:true},th:{td:true,th:true},thead:{tbody:true,tfoot:true},tr:{tr:true}},doNotIndent:{pre:true},allowUnquoted:true,allowMissing:true,caseFold:true}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:false,allowMissing:false,caseFold:false},Ea=X.alignCDATA,S,T;return{startState:function(){return{tokenize:w,
state:x,indented:0,tagName:null,tagStart:null,context:null}},token:function(C,G){if(!G.tagName&&C.sol())G.indented=C.indentation();if(C.eatSpace())return null;S=null;var O=G.tokenize(C,G);if((O||S)&&O!="comment"){T=null;G.state=G.state(S||O,C,G);if(T)O=T=="error"?O+" error":T}return O},indent:function(C,G,O){var ba=C.context;if(C.tokenize.isInAttribute)return C.tagStart==C.indented?C.stringStartCol+1:C.indented+Ga;if(ba&&ba.noIndent)return j.Pass;if(C.tokenize!=u&&C.tokenize!=w)return O?O.match(/^(\s*)/)[0].length:
0;if(C.tagName)return Va?C.tagStart+C.tagName.length+2:C.tagStart+Ga*cb;if(Ea&&/<!\[CDATA\[/.test(G))return 0;if((C=G&&/^<(\/)?([\w_:\.-]*)/.exec(G))&&C[1])for(;ba;)if(ba.tagName==C[2]){ba=ba.prev;break}else if(Ja.implicitlyClosed.hasOwnProperty(ba.tagName))ba=ba.prev;else break;else if(C)for(;ba;)if((G=Ja.contextGrabbers[ba.tagName])&&G.hasOwnProperty(C[2]))ba=ba.prev;else break;for(;ba&&!ba.startOfLine;)ba=ba.prev;return ba?ba.indent+Ga:0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<\!--",
blockCommentEnd:"--\>",configuration:X.htmlMode?"html":"xml",helperType:X.htmlMode?"html":"xml"}});j.defineMIME("text/xml","xml");j.defineMIME("application/xml","xml");j.mimeModes.hasOwnProperty("text/html")||j.defineMIME("text/html",{name:"xml",htmlMode:true})});(function(j){if(typeof exports=="object"&&typeof module=="object")j(require("../../lib/codemirror"));else typeof define=="function"&&define.amd?define(["../../lib/codemirror"],j):j(CodeMirror)})(function(j){j.defineMode("http",function(){function ca(A,M){A.skipToEnd();M.cur=q;return"error"}function X(A,M){if(A.match(/^HTTP\/\d\.\d/)){M.cur=w;return"keyword"}else if(A.match(/^[A-Z]+/)&&/[ \t]/.test(A.peek())){M.cur=g;return"keyword"}else return ca(A,M)}function w(A,M){var x=A.match(/^\d+/);if(!x)return ca(A,
M);M.cur=u;x=Number(x[0]);return x>=100&&x<200?"positive informational":x>=200&&x<300?"positive success":x>=300&&x<400?"positive redirect":x>=400&&x<500?"negative client-error":x>=500&&x<600?"negative server-error":"error"}function u(A,M){A.skipToEnd();M.cur=q;return null}function g(A,M){A.eatWhile(/\S/);M.cur=l;return"string-2"}function l(A,M){if(A.match(/^HTTP\/\d\.\d$/)){M.cur=q;return"keyword"}else return ca(A,M)}function q(A){if(A.sol()&&!A.eat(/[ \t]/))if(A.match(/^.*?:/))return"atom";else{A.skipToEnd();
return"error"}else{A.skipToEnd();return"string"}}function v(A){A.skipToEnd();return null}return{token:function(A,M){var x=M.cur;if(x!=q&&x!=v&&A.eatSpace())return null;return x(A,M)},blankLine:function(A){A.cur=v},startState:function(){return{cur:X}}}});j.defineMIME("message/http","http")});(function(j){if(typeof exports=="object"&&typeof module=="object")j(require("../../lib/codemirror"));else typeof define=="function"&&define.amd?define(["../../lib/codemirror"],j):j(CodeMirror)})(function(j){function ca(u,g,l,q){this.atOccurrence=false;this.doc=u;if(q==null&&typeof g=="string")q=false;l=l?u.clipPos(l):w(0,0);this.pos={from:l,to:l};if(typeof g!="string"){g.global||(g=RegExp(g.source,g.ignoreCase?"ig":"g"));this.matches=function(J,H){if(J){g.lastIndex=0;for(var E=u.getLine(H.line).slice(0,
H.ch),B=0,z,y;;){g.lastIndex=B;B=g.exec(E);if(!B)break;z=B;y=z.index;B=z.index+(z[0].length||1);if(B==E.length)break}B=z&&z[0].length||0;if(!B)if(y==0&&E.length==0)z=undefined;else y!=u.getLine(H.line).length&&B++}else{g.lastIndex=H.ch;E=u.getLine(H.line);B=(z=g.exec(E))&&z[0].length||0;y=z&&z.index;if(y+B!=E.length&&!B)B=1}if(z&&B)return{from:w(H.line,y),to:w(H.line,y+B),match:z}}}else{var v=g;if(q)g=g.toLowerCase();var A=q?function(J){return J.toLowerCase()}:function(J){return J},M=g.split("\n");
if(M.length==1)this.matches=g.length?function(J,H){if(J){var E=u.getLine(H.line).slice(0,H.ch),B=A(E),z=B.lastIndexOf(g);if(z>-1){z=X(E,B,z);return{from:w(H.line,z),to:w(H.line,z+v.length)}}}else{E=u.getLine(H.line).slice(H.ch);B=A(E);z=B.indexOf(g);if(z>-1){z=X(E,B,z)+H.ch;return{from:w(H.line,z),to:w(H.line,z+v.length)}}}}:function(){};else{var x=v.split("\n");this.matches=function(J,H){var E=M.length-1;if(J){if(!(H.line-(M.length-1)<u.firstLine()))if(A(u.getLine(H.line).slice(0,x[E].length))==
M[M.length-1]){for(var B=w(H.line,x[E].length),z=H.line-1,y=E-1;y>=1;--y,--z)if(M[y]!=A(u.getLine(z)))return;y=u.getLine(z);var Q=y.length-x[0].length;if(A(y.slice(Q))==M[0])return{from:w(z,Q),to:B}}}else if(!(H.line+(M.length-1)>u.lastLine())){y=u.getLine(H.line);Q=y.length-x[0].length;if(A(y.slice(Q))==M[0]){B=w(H.line,Q);z=H.line+1;for(y=1;y<E;++y,++z)if(M[y]!=A(u.getLine(z)))return;if(A(u.getLine(z).slice(0,x[E].length))==M[E])return{from:B,to:w(z,x[E].length)}}}}}}}function X(u,g,l){if(u.length==
g.length)return l;for(g=Math.min(l,u.length);;){var q=u.slice(0,g).toLowerCase().length;if(q<l)++g;else if(q>l)--g;else return g}}var w=j.Pos;ca.prototype={findNext:function(){return this.find(false)},findPrevious:function(){return this.find(true)},find:function(u){function g(A){A=w(A,0);l.pos={from:A,to:A};return l.atOccurrence=false}for(var l=this,q=this.doc.clipPos(u?this.pos.from:this.pos.to);;){if(this.pos=this.matches(u,q)){this.atOccurrence=true;return this.pos.match||true}if(u){if(!q.line)return g(0);
q=w(q.line-1,this.doc.getLine(q.line-1).length)}else{var v=this.doc.lineCount();if(q.line==v-1)return g(v);q=w(q.line+1,0)}}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(u){if(this.atOccurrence){u=j.splitLines(u);this.doc.replaceRange(u,this.pos.from,this.pos.to);this.pos.to=w(this.pos.from.line+u.length-1,u[u.length-1].length+(u.length==1?this.pos.from.ch:0))}}};j.defineExtension("getSearchCursor",function(u,g,
l){return new ca(this.doc,u,g,l)});j.defineDocExtension("getSearchCursor",function(u,g,l){return new ca(this,u,g,l)});j.defineExtension("selectMatches",function(u,g){for(var l=[],q=this.getSearchCursor(u,this.getCursor("from"),g);q.findNext();){if(j.cmpPos(q.to(),this.getCursor("to"))>0)break;l.push({anchor:q.from(),head:q.to()})}l.length&&this.setSelections(l,0)})});(function(){var j=null;window.PR_SHOULD_USE_CONTINUATION=true;(function(){function ca(S){function T(P){var V=P.charCodeAt(0);if(V!==92)return V;var R=P.charAt(1);return(V=Aa[R])?V:"0"<=R&&R<="7"?parseInt(P.substring(1),8):R==="u"||R==="x"?parseInt(P.substring(2),16):P.charCodeAt(1)}function C(P){if(P<32)return(P<16?"\\x0":"\\x")+P.toString(16);P=String.fromCharCode(P);return P==="\\"||P==="-"||P==="]"||P==="^"?"\\"+P:P}function G(P){var V=P.substring(1,P.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g);
P=[];var R=V[0]==="^",r=["["];R&&r.push("^");R=R?1:0;for(var F=V.length;R<F;++R){var s=V[R];if(/\\[bdsw]/i.test(s))r.push(s);else{s=T(s);var U;R+2<F&&"-"===V[R+1]?(U=T(V[R+2]),R+=2):U=s;P.push([s,U]);U<65||s>122||(U<65||s>90||P.push([Math.max(65,s)|32,Math.min(U,90)|32]),U<97||s>122||P.push([Math.max(97,s)&-33,Math.min(U,122)&-33]))}}P.sort(function(ja,Y){return ja[0]-Y[0]||Y[1]-ja[1]});V=[];F=[];for(R=0;R<P.length;++R){s=P[R];s[0]<=F[1]+1?F[1]=Math.max(F[1],s[1]):V.push(F=s)}for(R=0;R<V.length;++R){s=
V[R];r.push(C(s[0]));s[1]>s[0]&&(s[1]+1>s[0]&&r.push("-"),r.push(C(s[1])))}r.push("]");return r.join("")}function O(P){for(var V=P.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),R=V.length,r=[],F=0,s=0;F<R;++F){var U=V[F];U==="("?++s:"\\"===U.charAt(0)&&(U=+U.substring(1))&&(U<=s?r[U]=-1:V[F]=C(U))}for(F=1;F<r.length;++F)-1===r[F]&&(r[F]=++ba);for(s=F=0;F<R;++F){U=V[F];U==="("?(++s,r[s]||(V[F]="(?:")):"\\"===U.charAt(0)&&(U=+U.substring(1))&&
U<=s&&(V[F]="\\"+r[U])}for(F=0;F<R;++F)"^"===V[F]&&"^"!==V[F+1]&&(V[F]="");if(P.ignoreCase&&wa)for(F=0;F<R;++F){U=V[F];P=U.charAt(0);U.length>=2&&P==="["?V[F]=G(U):P!=="\\"&&(V[F]=U.replace(/[A-Za-z]/g,function(ja){ja=ja.charCodeAt(0);return"["+String.fromCharCode(ja&-33,ja|32)+"]"}))}return V.join("")}for(var ba=0,wa=false,ra=false,la=0,Z=S.length;la<Z;++la){var ma=S[la];if(ma.ignoreCase)ra=true;else if(/[a-z]/i.test(ma.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){wa=true;ra=false;
break}}var Aa={b:8,t:9,n:10,v:11,f:12,r:13},ua=[];la=0;for(Z=S.length;la<Z;++la){ma=S[la];if(ma.global||ma.multiline)throw Error(""+ma);ua.push("(?:"+O(ma)+")")}return RegExp(ua.join("|"),ra?"gi":"g")}function X(S,T){function C(la){var Z=la.nodeType;if(Z==1){if(!G.test(la.className)){for(Z=la.firstChild;Z;Z=Z.nextSibling)C(Z);Z=la.nodeName.toLowerCase();if("br"===Z||"li"===Z){O[ra]="\n";wa[ra<<1]=ba++;wa[ra++<<1|1]=la}}}else if(Z==3||Z==4){Z=la.nodeValue;Z.length&&(Z=T?Z.replace(/\r\n?/g,"\n"):Z.replace(/[\t\n\r ]+/g,
" "),O[ra]=Z,wa[ra<<1]=ba,ba+=Z.length,wa[ra++<<1|1]=la)}}var G=/(?:^|\s)nocode(?:\s|$)/,O=[],ba=0,wa=[],ra=0;C(S);return{a:O.join("").replace(/\n$/,""),d:wa}}function w(S,T,C,G){T&&(S={a:T,e:S},C(S),G.push.apply(G,S.g))}function u(S){for(var T=void 0,C=S.firstChild;C;C=C.nextSibling){var G=C.nodeType;T=G===1?T?S:C:G===3?cb.test(C.nodeValue)?S:T:T}return T===S?void 0:T}function g(S,T){function C(wa){for(var ra=wa.e,la=[ra,"pln"],Z=0,ma=wa.a.match(O)||[],Aa={},ua=0,P=ma.length;ua<P;++ua){var V=ma[ua],
R=Aa[V],r=void 0,F;if(typeof R==="string")F=false;else{var s=G[V.charAt(0)];if(s){r=V.match(s[1]);R=s[0]}else{for(F=0;F<ba;++F)if(s=T[F],r=V.match(s[1])){R=s[0];break}r||(R="pln")}if((F=R.length>=5&&"lang-"===R.substring(0,5))&&!(r&&typeof r[1]==="string")){F=false;R="src"}F||(Aa[V]=R)}s=Z;Z+=V.length;if(F){F=r[1];var U=V.indexOf(F),ja=U+F.length;r[2]&&(ja=V.length-r[2].length,U=ja-F.length);R=R.substring(5);w(ra+s,V.substring(0,U),C,la);w(ra+s+U,F,A(R,F),la);w(ra+s+ja,V.substring(ja),C,la)}else la.push(ra+
s,R)}wa.g=la}var G={},O;(function(){for(var wa=S.concat(T),ra=[],la={},Z=0,ma=wa.length;Z<ma;++Z){var Aa=wa[Z],ua=Aa[3];if(ua)for(var P=ua.length;--P>=0;)G[ua.charAt(P)]=Aa;Aa=Aa[1];ua=""+Aa;la.hasOwnProperty(ua)||(ra.push(Aa),la[ua]=j)}ra.push(/[\S\s]/);O=ca(ra)})();var ba=T.length;return C}function l(S){var T=[],C=[];S.tripleQuotedStrings?T.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,
j,"'\""]):S.multiLineStrings?T.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,j,"'\"`"]):T.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,j,"\"'"]);S.verbatimStrings&&C.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,j]);var G=S.hashComments;G&&(S.cStyleComments?(G>1?T.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,j,"#"]):T.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,
j,"#"]),C.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,j])):T.push(["com",/^#[^\n\r]*/,j,"#"]));S.cStyleComments&&(C.push(["com",/^\/\/[^\n\r]*/,j]),C.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,j]));if(G=S.regexLiterals){var O=(G=G>1?"":"\n\r")?".":"[\\S\\s]";C.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+
("/(?=[^/*"+G+"])(?:[^/\\x5B\\x5C"+G+"]|\\x5C"+O+"|\\x5B(?:[^\\x5C\\x5D"+G+"]|\\x5C"+O+")*(?:\\x5D|$))+/")+")")])}(G=S.types)&&C.push(["typ",G]);G=(""+S.keywords).replace(/^ | $/g,"");G.length&&C.push(["kwd",RegExp("^(?:"+G.replace(/[\s,]+/g,"|")+")\\b"),j]);T.push(["pln",/^\s+/,j," \r\n\t\u00a0"]);G="^.[^\\s\\w.$@'\"`/\\\\]*";S.regexLiterals&&(G+="(?!s*/)");C.push(["lit",/^@[$_a-z][\w$@]*/i,j],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,j],["pln",/^[$_a-z][\w$@]*/i,j],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,
j,"0123456789"],["pln",/^\\[\S\s]?/,j],["pun",RegExp(G),j]);return g(T,C)}function q(S,T,C){function G(P){var V=P.nodeType;if(V==1&&!ba.test(P.className))if("br"===P.nodeName){O(P);P.parentNode&&P.parentNode.removeChild(P)}else for(P=P.firstChild;P;P=P.nextSibling)G(P);else if((V==3||V==4)&&C){var R=P.nodeValue,r=R.match(wa);if(r){V=R.substring(0,r.index);P.nodeValue=V;(R=R.substring(r.index+r[0].length))&&P.parentNode.insertBefore(ra.createTextNode(R),P.nextSibling);O(P);V||P.parentNode.removeChild(P)}}}
function O(P){function V(r,F){var s=F?r.cloneNode(false):r,U=r.parentNode;if(U){U=V(U,1);var ja=r.nextSibling;U.appendChild(s);for(var Y=ja;Y;Y=ja){ja=Y.nextSibling;U.appendChild(Y)}}return s}for(;!P.nextSibling;)if(P=P.parentNode,!P)return;P=V(P.nextSibling,0);for(var R;(R=P.parentNode)&&R.nodeType===1;)P=R;Z.push(P)}for(var ba=/(?:^|\s)nocode(?:\s|$)/,wa=/\r\n?|\n/,ra=S.ownerDocument,la=ra.createElement("li");S.firstChild;)la.appendChild(S.firstChild);for(var Z=[la],ma=0;ma<Z.length;++ma)G(Z[ma]);
T===(T|0)&&Z[0].setAttribute("value",T);var Aa=ra.createElement("ol");Aa.className="linenums";T=Math.max(0,T-1|0)||0;ma=0;for(var ua=Z.length;ma<ua;++ma){la=Z[ma];la.className="L"+(ma+T)%10;la.firstChild||la.appendChild(ra.createTextNode("\u00a0"));Aa.appendChild(la)}S.appendChild(Aa)}function v(S,T){for(var C=T.length;--C>=0;){var G=T[C];Ja.hasOwnProperty(G)?x.console&&console.warn("cannot override language handler %s",G):Ja[G]=S}}function A(S,T){if(!S||!Ja.hasOwnProperty(S))S=/^\s*</.test(T)?"default-markup":
"default-code";return Ja[S]}function M(S){var T=S.h;try{var C=X(S.c,S.i),G=C.a;S.a=G;S.d=C.d;S.e=0;A(T,G)(S);var O=/\bMSIE\s(\d+)/.exec(navigator.userAgent);O=O&&+O[1]<=8;T=/\n/g;var ba=S.a,wa=ba.length;C=0;var ra=S.d,la=ra.length;G=0;var Z=S.g,ma=Z.length,Aa=0;Z[ma]=wa;var ua,P;for(P=ua=0;P<ma;)Z[P]!==Z[P+2]?(Z[ua++]=Z[P++],Z[ua++]=Z[P++]):P+=2;ma=ua;for(P=ua=0;P<ma;){for(var V=Z[P],R=Z[P+1],r=P+2;r+2<=ma&&Z[r+1]===R;)r+=2;Z[ua++]=V;Z[ua++]=R;P=r}Z.length=ua;var F=S.c,s;if(F){s=F.style.display;F.style.display=
"none"}try{for(;G<la;){var U=ra[G+2]||wa,ja=Z[Aa+2]||wa;r=Math.min(U,ja);var Y=ra[G+1],Ka;if(Y.nodeType!==1&&(Ka=ba.substring(C,r))){O&&(Ka=Ka.replace(T,"\r"));Y.nodeValue=Ka;var Ha=Y.ownerDocument,xa=Ha.createElement("span");xa.className=Z[Aa+1];var eb=Y.parentNode;eb.replaceChild(xa,Y);xa.appendChild(Y);C<U&&(ra[G+1]=Y=Ha.createTextNode(ba.substring(r,U)),eb.insertBefore(Y,xa.nextSibling))}C=r;C>=U&&(G+=2);C>=ja&&(Aa+=2)}}finally{if(F)F.style.display=s}}catch(Ba){x.console&&console.log(Ba&&Ba.stack||
Ba)}}var x=window,J=["break,continue,do,else,for,if,return,while"],H=[[J,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],E=[H,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],
B=[H,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],z=[B,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"];H=[H,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];
var y=[J,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],Q=[J,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],$=[J,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"];J=[J,
"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var Ga=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,cb=/\S/,Va=l({keywords:[E,z,H,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",y,Q,J],hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true}),Ja={};v(Va,["default-code"]);
v(g([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);v(g([["pln",/^\s+/,j," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,
j,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);v(g([],[["atv",/^[\S\s]+/]]),["uq.val"]);v(l({keywords:E,hashComments:true,
cStyleComments:true,types:Ga}),["c","cc","cpp","cxx","cyc","m"]);v(l({keywords:"null,true,false"}),["json"]);v(l({keywords:z,hashComments:true,cStyleComments:true,verbatimStrings:true,types:Ga}),["cs"]);v(l({keywords:B,cStyleComments:true}),["java"]);v(l({keywords:J,hashComments:true,multiLineStrings:true}),["bash","bsh","csh","sh"]);v(l({keywords:y,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py","python"]);v(l({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",
hashComments:true,multiLineStrings:true,regexLiterals:2}),["perl","pl","pm"]);v(l({keywords:Q,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb","ruby"]);v(l({keywords:H,cStyleComments:true,regexLiterals:true}),["javascript","js"]);v(l({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,
regexLiterals:true}),["coffee"]);v(l({keywords:$,cStyleComments:true,multilineStrings:true}),["rc","rs","rust"]);v(g([],[["str",/^[\S\s]+/]]),["regex"]);var Ea=x.PR={createSimpleLexer:g,registerLangHandler:v,sourceDecorator:l,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:x.prettyPrintOne=function(S,T,C){var G=
document.createElement("div");G.innerHTML="<pre>"+S+"</pre>";G=G.firstChild;C&&q(G,C,true);M({h:T,j:C,c:G,i:1});return G.innerHTML},prettyPrint:x.prettyPrint=function(S,T){function C(){for(var U=x.PR_SHOULD_USE_CONTINUATION?Z.now()+250:Infinity;ma<ba.length&&Z.now()<U;ma++){for(var ja=ba[ma],Y=s,Ka=ja;Ka=Ka.previousSibling;){var Ha=Ka.nodeType,xa=(Ha===7||Ha===8)&&Ka.nodeValue;if(xa?!/^\??prettify\b/.test(xa):Ha!==3||/\S/.test(Ka.nodeValue))break;if(xa){Y={};xa.replace(/\b(\w+)=([\w%+\-.:]+)/g,function(bc,
cc,Ma){Y[cc]=Ma});break}}Ka=ja.className;if((Y!==s||P.test(Ka))&&!V.test(Ka)){Ha=false;for(xa=ja.parentNode;xa;xa=xa.parentNode)if(F.test(xa.tagName)&&xa.className&&P.test(xa.className)){Ha=true;break}if(!Ha){ja.className+=" prettyprinted";Ha=Y.lang;if(!Ha){Ha=Ka.match(ua);var eb;if(!Ha&&(eb=u(ja))&&r.test(eb.tagName))Ha=eb.className.match(ua);Ha&&(Ha=Ha[1])}if(R.test(ja.tagName))xa=1;else{xa=ja.currentStyle;var Ba=O.defaultView;xa=(xa=xa?xa.whiteSpace:Ba&&Ba.getComputedStyle?Ba.getComputedStyle(ja,
j).getPropertyValue("white-space"):0)&&"pre"===xa.substring(0,3)}Ba=Y.linenums;if(!(Ba=Ba==="true"||+Ba))Ba=(Ba=Ka.match(/\blinenums\b(?::(\d+))?/))?Ba[1]&&Ba[1].length?+Ba[1]:true:false;Ba&&q(ja,Ba,xa);Aa={h:Ha,c:ja,j:Ba,i:xa};M(Aa)}}}ma<ba.length?setTimeout(C,250):"function"===typeof S&&S()}var G=T||document.body,O=G.ownerDocument||document;G=[G.getElementsByTagName("pre"),G.getElementsByTagName("code"),G.getElementsByTagName("xmp")];for(var ba=[],wa=0;wa<G.length;++wa)for(var ra=0,la=G[wa].length;ra<
la;++ra)ba.push(G[wa][ra]);G=j;var Z=Date;Z.now||(Z={now:function(){return+new Date}});var ma=0,Aa,ua=/\blang(?:uage)?-([\w.]+)(?!\S)/,P=/\bprettyprint\b/,V=/\bprettyprinted\b/,R=/pre|xmp/i,r=/^code$/i,F=/^(?:pre|code|xmp)$/i,s={};C()}};typeof define==="function"&&define.amd&&define("google-code-prettify",[],function(){return Ea})})()})();
(function(j){j.toJSON=function(w){if(typeof JSON=="object"&&JSON.stringify)return JSON.stringify(w);var u=typeof w;if(w===null)return"null";if(u!="undefined"){if(u=="number"||u=="boolean")return w+"";if(u=="string")return j.quoteString(w);if(u=="object"){if(typeof w.toJSON=="function")return j.toJSON(w.toJSON());if(w.constructor===Date){var g=w.getUTCMonth()+1;if(g<10)g="0"+g;var l=w.getUTCDate();if(l<10)l="0"+l;u=w.getUTCFullYear();var q=w.getUTCHours();if(q<10)q="0"+q;var v=w.getUTCMinutes();if(v<
10)v="0"+v;var A=w.getUTCSeconds();if(A<10)A="0"+A;w=w.getUTCMilliseconds();if(w<100)w="0"+w;if(w<10)w="0"+w;return'"'+u+"-"+g+"-"+l+"T"+q+":"+v+":"+A+"."+w+'Z"'}if(w.constructor===Array){g=[];for(l=0;l<w.length;l++)g.push(j.toJSON(w[l])||"null");return"["+g.join(",")+"]"}g=[];for(l in w){u=typeof l;if(u=="number")u='"'+l+'"';else if(u=="string")u=j.quoteString(l);else continue;if(typeof w[l]!="function"){q=j.toJSON(w[l]);g.push(u+":"+q)}}return"{"+g.join(", ")+"}"}}};j.evalJSON=function(w){if(typeof JSON==
"object"&&JSON.parse)return JSON.parse(w);return eval("("+w+")")};j.secureEvalJSON=function(w){if(typeof JSON=="object"&&JSON.parse)return JSON.parse(w);var u;u=w.replace(/\\["\\\/bfnrtu]/g,"@");u=u.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");u=u.replace(/(?:^|:|,)(?:\s*\[)+/g,"");if(/^[\],:{}\s]*$/.test(u))return eval("("+w+")");else throw new SyntaxError("Error parsing JSON, source is not valid.");};j.quoteString=function(w){if(w.match(ca))return'"'+w.replace(ca,
function(u){var g=X[u];if(typeof g==="string")return g;g=u.charCodeAt();return"\\u00"+Math.floor(g/16).toString(16)+(g%16).toString(16)})+'"';return'"'+w+'"'};var ca=/["\\\x00-\x1f\x7f-\x9f]/g,X={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"}})(jQuery);(function(j){function ca(){this._settings=[];this._extensions=[];this.regional=[];this.regional[""]={errorLoadingText:"Error loading"};this.local=this.regional[""];this._uuid=(new Date).getTime();this._ie=!!window.ActiveXObject}function X(g,l){this._svg=g;this._container=l;for(var q=0;q<j.svg._extensions.length;q++){var v=j.svg._extensions[q];this[v[0]]=new v[1](this)}}function w(){this._path=""}function u(){this._parts=[]}j.extend(ca.prototype,{markerClassName:"hasSVG",propertyName:"svgwrapper",
svgNS:"http://www.w3.org/2000/svg",xlinkNS:"http://www.w3.org/1999/xlink",_wrapperClass:X,_attrNames:{class_:"class",in_:"in",alignmentBaseline:"alignment-baseline",baselineShift:"baseline-shift",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorRendering:"color-rendering",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",
floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",
markerStart:"marker-start",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",underlinePosition:"underline-position",
underlineThickness:"underline-thickness",vertAdvY:"vert-adv-y",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode"},_attachSVG:function(g,l){var q=g.namespaceURI===this.svgNS?g:null;g=q?null:g;if(!j(g||q).hasClass(this.markerClassName)){if(typeof l==="string")l={loadURL:l};else if(typeof l==="function")l={onLoad:l};j(g||q).addClass(this.markerClassName);try{if(!q){q=document.createElementNS(this.svgNS,"svg");q.setAttribute("version","1.1");g.clientWidth>0&&q.setAttribute("width",
g.clientWidth);g.clientHeight>0&&q.setAttribute("height",g.clientHeight);g.appendChild(q)}this._afterLoad(g,q,l||{})}catch(v){j(g).html("<p>SVG is not supported natively on this browser</p>")}}},_afterLoad:function(g,l,q){q=q||this._settings[g.id];this._settings[g?g.id:""]=null;var v=new this._wrapperClass(l,g);j.data(g||l,j.svg.propertyName,v);try{q.loadURL&&v.load(q.loadURL,q);q.settings&&v.configure(q.settings);if(q.onLoad&&!q.loadURL)q.onLoad.apply(g||l,[v])}catch(A){alert(A)}},_getSVG:function(g){return j(g).data(this.propertyName)},
_destroySVG:function(g){g=j(g);if(g.hasClass(this.markerClassName)){g.removeClass(this.markerClassName).removeData(this.propertyName);g[0].namespaceURI!==this.svgNS&&g.empty()}},addExtension:function(g,l){this._extensions.push([g,l])},isSVGElem:function(g){return g.nodeType===1&&g.namespaceURI===j.svg.svgNS}});j.extend(X.prototype,{width:function(){return this._container?this._container.clientWidth:this._svg.width},height:function(){return this._container?this._container.clientHeight:this._svg.height},
root:function(){return this._svg},configure:function(g,l,q){if(!g.nodeName){q=l;l=g;g=this._svg}if(q)for(q=g.attributes.length-1;q>=0;q--){var v=g.attributes.item(q);v.nodeName==="onload"||v.nodeName==="version"||v.nodeName.substring(0,5)==="xmlns"||g.attributes.removeNamedItem(v.nodeName)}for(var A in l)g.setAttribute(j.svg._attrNames[A]||A,l[A]);return this},getElementById:function(g){return this._svg.ownerDocument.getElementById(g)},change:function(g,l){if(g)for(var q in l)l[q]==null?g.removeAttribute(j.svg._attrNames[q]||
q):g.setAttribute(j.svg._attrNames[q]||q,l[q]);return this},_args:function(g,l,q){l.splice(0,0,"parent");l.splice(l.length,0,"settings");var v={},A=0;if(g[0]!=null&&g[0].jquery)g[0]=g[0][0];if(g[0]!=null&&!(typeof g[0]==="object"&&g[0].nodeName)){v.parent=null;A=1}for(var M=0;M<g.length;M++)v[l[M+A]]=g[M];q&&j.each(q,function(x,J){if(typeof v[J]==="object"){v.settings=v[J];v[J]=null}});return v},title:function(){var g=this._args(arguments,["text"]),l=this._makeNode(g.parent,"title",g.settings||{});
l.appendChild(this._svg.ownerDocument.createTextNode(g.text));return l},describe:function(){var g=this._args(arguments,["text"]),l=this._makeNode(g.parent,"desc",g.settings||{});l.appendChild(this._svg.ownerDocument.createTextNode(g.text));return l},defs:function(){var g=this._args(arguments,["id"],["id"]);return this._makeNode(g.parent,"defs",j.extend(g.id?{id:g.id}:{},g.settings||{}))},symbol:function(){var g=this._args(arguments,["id","x1","y1","width","height"]);return this._makeNode(g.parent,
"symbol",j.extend({id:g.id,viewBox:g.x1+" "+g.y1+" "+g.width+" "+g.height},g.settings||{}))},marker:function(){var g=this._args(arguments,["id","refX","refY","mWidth","mHeight","orient"],["orient"]);return this._makeNode(g.parent,"marker",j.extend({id:g.id,refX:g.refX,refY:g.refY,markerWidth:g.mWidth,markerHeight:g.mHeight,orient:g.orient||"auto"},g.settings||{}))},style:function(){var g=this._args(arguments,["styles"]),l=this._makeNode(g.parent,"style",j.extend({type:"text/css"},g.settings||{}));
l.appendChild(this._svg.ownerDocument.createTextNode(g.styles));return l},script:function(){var g=this._args(arguments,["script","type"],["type"]),l=this._makeNode(g.parent,"script",j.extend({type:g.type||"text/javascript"},g.settings||{}));l.appendChild(this._svg.ownerDocument.createTextNode(g.script));j.svg._ie&&j.globalEval(g.script);return l},linearGradient:function(){var g=this._args(arguments,["id","stops","x1","y1","x2","y2"],["x1"]),l=j.extend({id:g.id},g.x1!=null?{x1:g.x1,y1:g.y1,x2:g.x2,
y2:g.y2}:{});return this._gradient(g.parent,"linearGradient",j.extend(l,g.settings||{}),g.stops)},radialGradient:function(){var g=this._args(arguments,["id","stops","cx","cy","r","fx","fy"],["cx"]),l=j.extend({id:g.id},g.cx!=null?{cx:g.cx,cy:g.cy,r:g.r,fx:g.fx,fy:g.fy}:{});return this._gradient(g.parent,"radialGradient",j.extend(l,g.settings||{}),g.stops)},_gradient:function(g,l,q,v){g=this._makeNode(g,l,q);for(l=0;l<v.length;l++){q=v[l];this._makeNode(g,"stop",j.extend({offset:q[0],stopColor:q[1]},
q[2]!=null?{stopOpacity:q[2]}:{}))}return g},pattern:function(){var g=this._args(arguments,["id","x","y","width","height","vx","vy","vwidth","vheight"],["vx"]),l=j.extend({id:g.id,x:g.x,y:g.y,width:g.width,height:g.height},g.vx!=null?{viewBox:g.vx+" "+g.vy+" "+g.vwidth+" "+g.vheight}:{});return this._makeNode(g.parent,"pattern",j.extend(l,g.settings||{}))},clipPath:function(){var g=this._args(arguments,["id","units"]);g.units=g.units||"userSpaceOnUse";return this._makeNode(g.parent,"clipPath",j.extend({id:g.id,
clipPathUnits:g.units},g.settings||{}))},mask:function(){var g=this._args(arguments,["id","x","y","width","height"]);return this._makeNode(g.parent,"mask",j.extend({id:g.id,x:g.x,y:g.y,width:g.width,height:g.height},g.settings||{}))},createPath:function(){return new w},createText:function(){return new u},svg:function(){var g=this._args(arguments,["x","y","width","height","vx","vy","vwidth","vheight"],["vx"]),l=j.extend({x:g.x,y:g.y,width:g.width,height:g.height},g.vx!=null?{viewBox:g.vx+" "+g.vy+
" "+g.vwidth+" "+g.vheight}:{});return this._makeNode(g.parent,"svg",j.extend(l,g.settings||{}))},group:function(){var g=this._args(arguments,["id"],["id"]);return this._makeNode(g.parent,"g",j.extend({id:g.id},g.settings||{}))},use:function(){var g=this._args(arguments,["x","y","width","height","ref"]);if(typeof g.x==="string"){g.ref=g.x;g.settings=g.y;g.x=g.y=g.width=g.height=null}var l=this._makeNode(g.parent,"use",j.extend({x:g.x,y:g.y,width:g.width,height:g.height},g.settings||{}));l.setAttributeNS(j.svg.xlinkNS,
"href",g.ref);return l},link:function(){var g=this._args(arguments,["ref"]),l=this._makeNode(g.parent,"a",g.settings);l.setAttributeNS(j.svg.xlinkNS,"href",g.ref);return l},image:function(){var g=this._args(arguments,["x","y","width","height","ref"]),l=this._makeNode(g.parent,"image",j.extend({x:g.x,y:g.y,width:g.width,height:g.height},g.settings||{}));l.setAttributeNS(j.svg.xlinkNS,"href",g.ref);return l},path:function(){var g=this._args(arguments,["path"]);return this._makeNode(g.parent,"path",
j.extend({d:g.path.path?g.path.path():g.path},g.settings||{}))},rect:function(){var g=this._args(arguments,["x","y","width","height","rx","ry"],["rx"]);return this._makeNode(g.parent,"rect",j.extend({x:g.x,y:g.y,width:g.width,height:g.height},g.rx?{rx:g.rx,ry:g.ry}:{},g.settings||{}))},circle:function(){var g=this._args(arguments,["cx","cy","r"]);return this._makeNode(g.parent,"circle",j.extend({cx:g.cx,cy:g.cy,r:g.r},g.settings||{}))},ellipse:function(){var g=this._args(arguments,["cx","cy","rx",
"ry"]);return this._makeNode(g.parent,"ellipse",j.extend({cx:g.cx,cy:g.cy,rx:g.rx,ry:g.ry},g.settings||{}))},line:function(){var g=this._args(arguments,["x1","y1","x2","y2"]);return this._makeNode(g.parent,"line",j.extend({x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2},g.settings||{}))},polyline:function(){var g=this._args(arguments,["points"]);return this._poly(g.parent,"polyline",g.points,g.settings)},polygon:function(){var g=this._args(arguments,["points"]);return this._poly(g.parent,"polygon",g.points,g.settings)},
_poly:function(g,l,q,v){for(var A="",M=0;M<q.length;M++)A+=q[M].join()+" ";return this._makeNode(g,l,j.extend({points:j.trim(A)},v||{}))},text:function(){var g=this._args(arguments,["x","y","value"]);if(typeof g.x==="string"&&arguments.length<4){g.value=g.x;g.settings=g.y;g.x=g.y=null}return this._text(g.parent,"text",g.value,j.extend({x:g.x&&j.isArray(g.x)?g.x.join(" "):g.x,y:g.y&&j.isArray(g.y)?g.y.join(" "):g.y},g.settings||{}))},textpath:function(){var g=this._args(arguments,["path","value"]),
l=this._text(g.parent,"textPath",g.value,g.settings||{});l.setAttributeNS(j.svg.xlinkNS,"href",g.path);return l},_text:function(g,l,q,v){g=this._makeNode(g,l,v);if(typeof q==="string")g.appendChild(g.ownerDocument.createTextNode(q));else for(l=0;l<q._parts.length;l++){v=q._parts[l];if(v[0]==="tspan"){var A=this._makeNode(g,v[0],v[2]);A.appendChild(g.ownerDocument.createTextNode(v[1]));g.appendChild(A)}else if(v[0]==="tref"){A=this._makeNode(g,v[0],v[2]);A.setAttributeNS(j.svg.xlinkNS,"href",v[1]);
g.appendChild(A)}else if(v[0]==="textpath"){A=j.extend({},v[2]);A.href=null;A=this._makeNode(g,v[0],A);A.setAttributeNS(j.svg.xlinkNS,"href",v[2].href);A.appendChild(g.ownerDocument.createTextNode(v[1]));g.appendChild(A)}else g.appendChild(g.ownerDocument.createTextNode(v[1]))}return g},other:function(){var g=this._args(arguments,["name"]);return this._makeNode(g.parent,g.name,g.settings||{})},_makeNode:function(g,l,q){g=g||this._svg;var v=this._svg.ownerDocument.createElementNS(j.svg.svgNS,l);for(l in q){var A=
q[l];if(A!=null&&(typeof A!=="string"||A!==""))v.setAttribute(j.svg._attrNames[l]||l,A)}g.appendChild(v);return v},add:function(g){var l=this._args(arguments.length===1?[null,g]:arguments,["node"]),q=this;l.parent=l.parent||this._svg;l.node=l.node.jquery?l.node:j(l.node);try{l.parent.appendChild(l.node.cloneNode(true))}catch(v){l.node.each(function(){var A=q._cloneAsSVG(this);A&&l.parent.appendChild(A)})}return this},clone:function(g){var l=this,q=this._args(arguments.length===1?[null,g]:arguments,
["node"]);q.parent=q.parent||this._svg;q.node=q.node.jquery?q.node:j(q.node);var v=[];q.node.each(function(){var A=l._cloneAsSVG(this);if(A){A.id="";q.parent.appendChild(A);v.push(A)}});return v},_cloneAsSVG:function(g){var l=null;if(g.nodeType===1){l=this._svg.ownerDocument.createElementNS(j.svg.svgNS,this._checkName(g.nodeName));for(var q=0;q<g.attributes.length;q++){var v=g.attributes.item(q);if(v.nodeName!=="xmlns"&&v.nodeValue)v.prefix==="xlink"?l.setAttributeNS(j.svg.xlinkNS,v.localName||v.baseName,
v.nodeValue):l.setAttribute(this._checkName(v.nodeName),v.nodeValue)}for(q=0;q<g.childNodes.length;q++)(v=this._cloneAsSVG(g.childNodes[q]))&&l.appendChild(v)}else if(g.nodeType===3){if(j.trim(g.nodeValue))l=this._svg.ownerDocument.createTextNode(g.nodeValue)}else if(g.nodeType===4)if(j.trim(g.nodeValue))try{l=this._svg.ownerDocument.createCDATASection(g.nodeValue)}catch(A){l=this._svg.ownerDocument.createTextNode(g.nodeValue.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"))}return l},
_checkName:function(g){g=g.substring(0,1)>="A"&&g.substring(0,1)<="Z"?g.toLowerCase():g;return g.substring(0,4)==="svg:"?g.substring(4):g},load:function(g,l){l=typeof l==="boolean"?{addTo:l}:typeof l==="function"?{onLoad:l}:typeof l==="string"?{parent:l}:typeof l==="object"&&l.nodeName?{parent:l}:typeof l==="object"&&l.jquery?{parent:l}:l||{};!l.parent&&!l.addTo&&this.clear(false);var q=[this._svg.getAttribute("width"),this._svg.getAttribute("height")],v=this,A=function(J){J=j.svg.local.errorLoadingText+
": "+J;l.onLoad?l.onLoad.apply(v._container||v._svg,[v,J]):v.text(null,10,20,J)},M=function(J){if(J)if(J.documentElement.nodeName!=="svg"){var H=J.getElementsByTagName("parsererror"),E=H.length?H[0].getElementsByTagName("div"):[];A(!H.length?"???":(E.length?E[0]:H[0]).firstChild.nodeValue)}else{H=l.parent?j(l.parent)[0]:v._svg;var B={};for(E=0;E<J.documentElement.attributes.length;E++){var z=J.documentElement.attributes.item(E);if(!(z.nodeName==="version"||z.nodeName.substring(0,5)==="xmlns"))B[z.nodeName]=
z.nodeValue}v.configure(H,B,!l.parent);J=J.documentElement.childNodes;for(E=0;E<J.length;E++)try{H.appendChild(v._svg.ownerDocument.importNode(J[E],true));J[E].nodeName==="script"&&j.globalEval(J[E].textContent)}catch(y){v.add(H,J[E])}if(!l.keepRelativeLinks&&g.match("/")){var Q=g.replace(/\/[^\/]*$/,"/");j("*",H).each(function(){var $=j(this).attr("xlink:href");$&&!$.match(/(^[a-z][-a-z0-9+.]*:.*$)|(^\/.*$)|(^#.*$)/i)&&j(this).attr("xlink:href",Q+$)})}l.changeSize||v.configure(H,{width:q[0],height:q[1]});
if(l.onLoad)l.onLoad.apply(v._container||v._svg,[v])}};if(g.match("<svg"))try{M((new DOMParser).parseFromString(g,"text/xml"))}catch(x){A(x)}else j.ajax({url:g,dataType:"xml",success:function(J){M(J)},error:function(J,H,E){A(H+(E?" "+E.message:""))}});return this},remove:function(g){g=g.jquery?g[0]:g;g.parentNode.removeChild(g);return this},clear:function(g){for(g&&this.configure({},true);this._svg.firstChild;)this._svg.removeChild(this._svg.firstChild);return this},toSVG:function(g){g=g||this._svg;
return typeof XMLSerializer==="undefined"?this._toSVG(g):(new XMLSerializer).serializeToString(g)},_toSVG:function(g){var l="";if(!g)return l;if(g.nodeType===3)l=g.nodeValue;else if(g.nodeType===4)l="<![CDATA["+g.nodeValue+"]]\>";else{l="<"+g.nodeName;if(g.attributes)for(var q=0;q<g.attributes.length;q++){var v=g.attributes.item(q);j.trim(v.nodeValue)===""||v.nodeValue.match(/^\[object/)||v.nodeValue.match(/^function/)||(l+=" "+(v.namespaceURI===j.svg.xlinkNS?"xlink:":"")+v.nodeName+'="'+v.nodeValue+
'"')}if(g.firstChild){l+=">";for(q=g.firstChild;q;){l+=this._toSVG(q);q=q.nextSibling}l+="</"+g.nodeName+">"}else l+="/>"}return l}});j.extend(w.prototype,{reset:function(){this._path="";return this},move:function(g,l,q){q=j.isArray(g)?l:q;return this._coords(q?"m":"M",g,l)},line:function(g,l,q){q=j.isArray(g)?l:q;return this._coords(q?"l":"L",g,l)},horiz:function(g,l){this._path+=(l?"h":"H")+(j.isArray(g)?g.join(" "):g);return this},vert:function(g,l){this._path+=(l?"v":"V")+(j.isArray(g)?g.join(" "):
g);return this},curveC:function(g,l,q,v,A,M,x){x=j.isArray(g)?l:x;return this._coords(x?"c":"C",g,l,q,v,A,M)},smoothC:function(g,l,q,v,A){A=j.isArray(g)?l:A;return this._coords(A?"s":"S",g,l,q,v)},curveQ:function(g,l,q,v,A){A=j.isArray(g)?l:A;return this._coords(A?"q":"Q",g,l,q,v)},smoothQ:function(g,l,q){q=j.isArray(g)?l:q;return this._coords(q?"t":"T",g,l)},_coords:function(g,l,q,v,A,M,x){if(j.isArray(l))for(q=0;q<l.length;q++){v=l[q];this._path+=(q===0?g:" ")+v[0]+","+v[1]+(v.length<4?"":" "+v[2]+
","+v[3]+(v.length<6?"":" "+v[4]+","+v[5]))}else this._path+=g+l+","+q+(v==null?"":" "+v+","+A+(M==null?"":" "+M+","+x));return this},arc:function(g,l,q,v,A,M,x,J){J=j.isArray(g)?l:J;this._path+=J?"a":"A";if(j.isArray(g))for(l=0;l<g.length;l++){q=g[l];this._path+=(l===0?"":" ")+q[0]+","+q[1]+" "+q[2]+" "+(q[3]?"1":"0")+","+(q[4]?"1":"0")+" "+q[5]+","+q[6]}else this._path+=g+","+l+" "+q+" "+(v?"1":"0")+","+(A?"1":"0")+" "+M+","+x;return this},close:function(){this._path+="z";return this},path:function(){return this._path}});
w.prototype.moveTo=w.prototype.move;w.prototype.lineTo=w.prototype.line;w.prototype.horizTo=w.prototype.horiz;w.prototype.vertTo=w.prototype.vert;w.prototype.curveCTo=w.prototype.curveC;w.prototype.smoothCTo=w.prototype.smoothC;w.prototype.curveQTo=w.prototype.curveQ;w.prototype.smoothQTo=w.prototype.smoothQ;w.prototype.arcTo=w.prototype.arc;j.extend(u.prototype,{reset:function(){this._parts=[];return this},string:function(g){this._parts.push(["text",g]);return this},span:function(g,l){this._parts.push(["tspan",
g,l]);return this},ref:function(g,l){this._parts.push(["tref",g,l]);return this},path:function(g,l,q){this._parts.push(["textpath",l,j.extend({href:g},q||{})]);return this}});j.fn.svg=function(g){var l=Array.prototype.slice.call(arguments,1);if(typeof g==="string"&&g==="get")return j.svg["_"+g+"SVG"].apply(j.svg,[this[0]].concat(l));return this.each(function(){typeof g==="string"?j.svg["_"+g+"SVG"].apply(j.svg,[this].concat(l)):j.svg._attachSVG(this,g||{})})};j.svg=new ca})(jQuery);(function(j){function ca(w){return(!j.svg.isSVGElem(w)?w.className:w.className?w.className.baseVal:w.getAttribute("class"))||""}function X(w,u){w.className?w.className.baseVal=u:w.setAttribute("class",u)}j.fn.addClass=function(w){return function(u){if(j.isFunction(u))return this.each(function(l){j(this).addClass(u.call(this,l,ca(this)))});var g=arguments;u=u||"";return this.each(function(){if(j.svg.isSVGElem(this)){var l=this;j.each(u.split(/\s+/),function(q,v){var A=ca(l);if(j.inArray(v,A.split(/\s+/))===
-1)X(l,A+((A?" ":"")+v))})}else w.apply(j(this),g)})}}(j.fn.addClass);j.fn.removeClass=function(w){return function(u){if(j.isFunction(u))return this.each(function(l){j(this).removeClass(u.call(this,l,ca(this)))});var g=arguments;u=u||"";return this.each(function(){if(j.svg.isSVGElem(this)){var l=this;j.each(u.split(/\s+/),function(q,v){var A=ca(l);A=j.grep(A.split(/\s+/),function(M){return M!==v}).join(" ");X(l,A)})}else w.apply(j(this),g)})}}(j.fn.removeClass);j.fn.toggleClass=function(w){return function(u,
g){if(j.isFunction(u))return this.each(function(v){j(this).toggleClass(u.call(this,v,ca(this),g),g)});var l=arguments,q=typeof g==="boolean";return this.each(function(){if(j.svg.isSVGElem(this))if(typeof u==="string"){var v=j(this);j.each(u.split(/\s+/),function(M,x){q||(g=!v.hasClass(x));v[(g?"add":"remove")+"Class"](x)})}else{var A=ca(this);A&&j._data(this,"__className__",A);X(this,A||u===false?"":j._data(this,"__className__")||"")}else w.apply(j(this),l)})}}(j.fn.toggleClass);j.fn.hasClass=function(w){return function(u){u=
u||"";var g=false;this.each(function(){g=j.svg.isSVGElem(this)?j.inArray(u,ca(this).split(/\s+/))>-1:w.apply(j(this),[u]);return!g});return g}}(j.fn.hasClass);j.fn.attr=function(w){return function(u,g,l){if(typeof u==="string"&&g===undefined){var q=w.apply(this,arguments);if(q&&q.baseVal&&q.baseVal.numberOfItems!=null){g="";q=q.baseVal;if(u==="transform"){for(var v=0;v<q.numberOfItems;v++){var A=q.getItem(v);switch(A.type){case 1:g+=" matrix("+A.matrix.a+","+A.matrix.b+","+A.matrix.c+","+A.matrix.d+
","+A.matrix.e+","+A.matrix.f+")";break;case 2:g+=" translate("+A.matrix.e+","+A.matrix.f+")";break;case 3:g+=" scale("+A.matrix.a+","+A.matrix.d+")";break;case 4:g+=" rotate("+A.angle+")";break;case 5:g+=" skewX("+A.angle+")";break;case 6:g+=" skewY("+A.angle+")"}}q=g.substring(1)}else q=q.getItem(0).valueAsString}return q&&q.baseVal?q.baseVal.valueAsString:q}var M=u;if(typeof u==="string"){M={};M[u]=g}if(j.isFunction(g))return j(this).each(function(J){j(this).attr(u,g.call(this,J,j(this).attr(u)))});
var x=arguments;return j(this).each(function(){if(j.svg.isSVGElem(this))for(var J in M)l?this.style[J]=M[J]:this.setAttribute(J,M[J]);else w.apply(j(this),x)})}}(j.fn.attr);j.fn.removeAttr=function(w){return function(u){var g=arguments;return this.each(function(){if(j.svg.isSVGElem(this)){var l=this;j.each(u.split(/\s+/),function(q,v){l[v]&&l[v].baseVal?l[v].baseVal.value=null:l.removeAttribute(v)})}else w.apply(j(this),g)})}}(j.fn.removeAttr);j.extend(j.cssNumber,{stopOpacity:true,strokeMitrelimit:true,
strokeOpacity:true});if(j.cssProps)j.css=function(w){return function(u,g,l,q){return(g.match(/^svg.*/)?j(u).attr(j.cssProps[g]||g):"")||w(u,g,l,q)}}(j.css)})(jQuery);(function(j){if(typeof exports=="object"&&typeof module=="object")module.exports=j();else if(typeof define=="function"&&define.amd)return define([],j);else this.CodeMirror=j()})(function(){function j(a,b){if(!(this instanceof j))return new j(a,b);this.options=b=b?zb(b):{};zb(wf,b,false);J(b);var c=b.value;if(typeof c=="string")c=new Ya(c,b.mode);this.doc=c;var d=this.display=new ca(a,c);d.wrapper.CodeMirror=this;v(this);l(this);if(b.lineWrapping)this.display.wrapper.className+=" CodeMirror-wrap";
b.autofocus&&!Gd&&$a(this);z(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,focused:false,suppressEdits:false,pasteIncoming:false,cutIncoming:false,draggingText:false,highlight:new Tc,keySeq:null};va&&Fa<11&&setTimeout(ob(gb,this,true),20);xf(this);if(!le){yf();le=true}Lb(this);this.curOp.forceUpdate=true;me(this,c);b.autofocus&&!Gd||Ab()==d.input?setTimeout(ob(Hd,this),20):Uc(this);for(var e in $b)if($b.hasOwnProperty(e))$b[e](this,b[e],ne);cb(this);for(c=0;c<Id.length;++c)Id[c](this);
Mb(this);if(Na&&b.lineWrapping&&getComputedStyle(d.lineDiv).textRendering=="optimizelegibility")d.lineDiv.style.textRendering="auto"}function ca(a,b){var c=this.input=ga("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");if(Na)c.style.width="1000px";else c.setAttribute("wrap","off");if(rc)c.style.border="1px solid black";c.setAttribute("autocorrect","off");c.setAttribute("autocapitalize","off");c.setAttribute("spellcheck","false");this.inputDiv=ga("div",
[c],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");this.scrollbarFiller=ga("div",null,"CodeMirror-scrollbar-filler");this.scrollbarFiller.setAttribute("not-content","true");this.gutterFiller=ga("div",null,"CodeMirror-gutter-filler");this.gutterFiller.setAttribute("not-content","true");this.lineDiv=ga("div",null,"CodeMirror-code");this.selectionDiv=ga("div",null,null,"position: relative; z-index: 1");this.cursorDiv=ga("div",null,"CodeMirror-cursors");this.measure=ga("div",null,
"CodeMirror-measure");this.lineMeasure=ga("div",null,"CodeMirror-measure");this.lineSpace=ga("div",[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");this.mover=ga("div",[ga("div",[this.lineSpace],"CodeMirror-lines")],null,"position: relative");this.sizer=ga("div",[this.mover],"CodeMirror-sizer");this.sizerWidth=null;this.heightForcer=ga("div",null,null,"position: absolute; height: "+oe+"px; width: 1px;");this.gutters=ga("div",null,
"CodeMirror-gutters");this.lineGutter=null;this.scroller=ga("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex","-1");this.wrapper=ga("div",[this.inputDiv,this.scrollbarFiller,this.gutterFiller,this.scroller],"CodeMirror");if(va&&Fa<8){this.gutters.style.zIndex=-1;this.scroller.style.paddingRight=0}if(rc)c.style.width="0px";if(!Na)this.scroller.draggable=true;if(Jd){this.inputDiv.style.height="1px";this.inputDiv.style.position="absolute"}if(a)a.appendChild?
a.appendChild(this.wrapper):a(this.wrapper);this.reportedViewFrom=this.reportedViewTo=this.viewFrom=this.viewTo=b.first;this.view=[];this.externalMeasured=this.renderedView=null;this.lastWrapHeight=this.lastWrapWidth=this.viewOffset=0;this.updateLineNumbers=null;this.nativeBarWidth=this.barHeight=this.barWidth=0;this.scrollbarsClipped=false;this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=null;this.prevInput="";this.pollingFast=this.alignWidgets=false;this.poll=new Tc;this.cachedCharWidth=
this.cachedTextHeight=this.cachedPaddingH=null;this.inaccurateSelection=false;this.maxLine=null;this.maxLineLength=0;this.maxLineChanged=false;this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null;this.shift=false;this.selForContextMenu=null}function X(a){a.doc.mode=j.getMode(a.options,a.doc.modeOption);w(a)}function w(a){a.doc.iter(function(b){if(b.stateAfter)b.stateAfter=null;if(b.styles)b.styles=null});a.doc.frontier=a.doc.first;db(a,100);a.state.modeGen++;a.curOp&&ab(a)}function u(a){var b=
vb(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/sc(a.display)-3);return function(e){if(Nb(a.doc,e))return 0;var f=0;if(e.widgets)for(var h=0;h<e.widgets.length;h++)if(e.widgets[h].height)f+=e.widgets[h].height;return c?f+(Math.ceil(e.text.length/d)||1)*b:f+b}}function g(a){var b=a.doc,c=u(a);b.iter(function(d){var e=c(d);e!=d.height&&pb(d,e)})}function l(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g,
" cm-s-");aa(a)}function q(a){v(a);ab(a);setTimeout(function(){Ga(a)},20)}function v(a){var b=a.display.gutters,c=a.options.gutters;Ob(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(ga("div",null,"CodeMirror-gutter "+e));if(e=="CodeMirror-linenumbers"){a.display.lineGutter=f;f.style.width=(a.display.lineNumWidth||1)+"px"}}b.style.display=d?"":"none";A(a)}function A(a){a.display.sizer.style.marginLeft=a.display.gutters.offsetWidth+"px"}function M(a){if(a.height==0)return 0;for(var b=a.text.length,
c,d=a;c=Pb(d,true);){c=c.find(0,true);d=c.from.line;b+=c.from.ch-c.to.ch}for(d=a;c=Pb(d,false);){c=c.find(0,true);b-=d.text.length-c.from.ch;d=c.to.line;b+=d.text.length-c.to.ch}return b}function x(a){var b=a.display;a=a.doc;b.maxLine=ha(a,a.first);b.maxLineLength=M(b.maxLine);b.maxLineChanged=true;a.iter(function(c){var d=M(c);if(d>b.maxLineLength){b.maxLineLength=d;b.maxLine=c}})}function J(a){var b=Ua(a.gutters,"CodeMirror-linenumbers");if(b==-1&&a.lineNumbers)a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]);
else if(b>-1&&!a.lineNumbers){a.gutters=a.gutters.slice(0);a.gutters.splice(b,1)}}function H(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+(a.display.mover.offsetHeight-a.display.lineSpace.offsetHeight));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+Za(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,
gutterWidth:c}}function E(a,b,c){this.cm=c;var d=this.vert=ga("div",[ga("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=ga("div",[ga("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a(d);a(e);qa(d,"scroll",function(){d.clientHeight&&b(d.scrollTop,"vertical")});qa(e,"scroll",function(){e.clientWidth&&b(e.scrollLeft,"horizontal")});this.checkedOverlay=false;if(va&&Fa<8)this.horiz.style.minHeight=this.vert.style.minWidth="18px"}function B(){}function z(a){if(a.display.scrollbars){a.display.scrollbars.clear();
a.display.scrollbars.addClass&&tc(a.display.wrapper,a.display.scrollbars.addClass)}a.display.scrollbars=new j.scrollbarModel[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller);qa(b,"mousedown",function(){a.state.focused&&setTimeout(ob($a,a),0)});b.setAttribute("not-content","true")},function(b,c){c=="horizontal"?ac(a,b):uc(a,b)},a);a.display.scrollbars.addClass&&vc(a.display.wrapper,a.display.scrollbars.addClass)}function y(a,b){b||(b=H(a));var c=a.display.barWidth,
d=a.display.barHeight;Q(a,b);for(var e=0;e<4&&c!=a.display.barWidth||d!=a.display.barHeight;e++){c!=a.display.barWidth&&a.options.lineWrapping&&G(a);Q(a,H(a));c=a.display.barWidth;d=a.display.barHeight}}function Q(a,b){var c=a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+"px";c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px";if(d.right&&d.bottom){c.scrollbarFiller.style.display="block";c.scrollbarFiller.style.height=d.bottom+"px";c.scrollbarFiller.style.width=
d.right+"px"}else c.scrollbarFiller.style.display="";if(d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter){c.gutterFiller.style.display="block";c.gutterFiller.style.height=d.bottom+"px";c.gutterFiller.style.width=b.gutterWidth+"px"}else c.gutterFiller.style.display=""}function $(a,b,c){var d=c&&c.top!=null?Math.max(0,c.top):a.scroller.scrollTop;d=Math.floor(d-a.lineSpace.offsetTop);var e=c&&c.bottom!=null?c.bottom:d+a.wrapper.clientHeight;d=Qb(b,d);e=Qb(b,e);if(c&&c.ensure){var f=
c.ensure.from.line;c=c.ensure.to.line;if(f<d){d=f;e=Qb(b,wb(ha(b,f))+a.wrapper.clientHeight)}else if(Math.min(c,b.lastLine())>=e){d=Qb(b,wb(ha(b,c))-a.wrapper.clientHeight);e=c}}return{from:d,to:Math.max(e,d+1)}}function Ga(a){var b=a.display,c=b.view;if(!(!b.alignWidgets&&(!b.gutters.firstChild||!a.options.fixedGutter))){for(var d=Va(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",h=0;h<c.length;h++)if(!c[h].hidden){if(a.options.fixedGutter&&c[h].gutter)c[h].gutter.style.left=
f;var i=c[h].alignable;if(i)for(var k=0;k<i.length;k++)i[k].style.left=f}if(a.options.fixedGutter)b.gutters.style.left=d+e+"px"}}function cb(a){if(!a.options.lineNumbers)return false;var b=a.doc;b=String(a.options.lineNumberFormatter(b.first+b.size-1+a.options.firstLineNumber));var c=a.display;if(b.length!=c.lineNumChars){var d=c.measure.appendChild(ga("div",[ga("div",b)],"CodeMirror-linenumber CodeMirror-gutter-elt")),e=d.firstChild.offsetWidth;d=d.offsetWidth-e;c.lineGutter.style.width="";c.lineNumInnerWidth=
Math.max(e,c.lineGutter.offsetWidth-d);c.lineNumWidth=c.lineNumInnerWidth+d;c.lineNumChars=c.lineNumInnerWidth?b.length:-1;c.lineGutter.style.width=c.lineNumWidth+"px";A(a);return true}return false}function Va(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function Ja(a,b,c){var d=a.display;this.viewport=b;this.visible=$(d,a.doc,b);this.editorIsHidden=!d.wrapper.offsetWidth;this.wrapperHeight=d.wrapper.clientHeight;this.wrapperWidth=d.wrapper.clientWidth;this.oldDisplayWidth=
hb(a);this.force=c;this.dims=ba(a)}function Ea(a,b){var c=a.display,d=a.doc;if(b.editorIsHidden){Bb(a);return false}if(!b.force&&b.visible.from>=c.viewFrom&&b.visible.to<=c.viewTo&&(c.updateLineNumbers==null||c.updateLineNumbers>=c.viewTo)&&c.renderedView==c.view&&pe(a)==0)return false;if(cb(a)){Bb(a);b.dims=ba(a)}var e=d.first+d.size,f=Math.max(b.visible.from-a.options.viewportMargin,d.first),h=Math.min(e,b.visible.to+a.options.viewportMargin);if(c.viewFrom<f&&f-c.viewFrom<20)f=Math.max(d.first,
c.viewFrom);if(c.viewTo>h&&c.viewTo-h<20)h=Math.min(e,c.viewTo);if(Cb){f=Kd(a.doc,f);h=qe(a.doc,h)}d=f!=c.viewFrom||h!=c.viewTo||c.lastWrapHeight!=b.wrapperHeight||c.lastWrapWidth!=b.wrapperWidth;e=a.display;if(e.view.length==0||f>=e.viewTo||h<=e.viewFrom){e.view=Vc(a,f,h);e.viewFrom=f}else{if(e.viewFrom>f)e.view=Vc(a,f,e.viewFrom).concat(e.view);else if(e.viewFrom<f)e.view=e.view.slice(wc(a,f));e.viewFrom=f;if(e.viewTo<h)e.view=e.view.concat(Vc(a,e.viewTo,h));else if(e.viewTo>h)e.view=e.view.slice(0,
wc(a,h))}e.viewTo=h;c.viewOffset=wb(ha(a.doc,c.viewFrom));a.display.mover.style.top=c.viewOffset+"px";h=pe(a);if(!d&&h==0&&!b.force&&c.renderedView==c.view&&(c.updateLineNumbers==null||c.updateLineNumbers>=c.viewTo))return false;f=Ab();if(h>4)c.lineDiv.style.display="none";wa(a,c.updateLineNumbers,b.dims);if(h>4)c.lineDiv.style.display="";c.renderedView=c.view;f&&Ab()!=f&&f.offsetHeight&&f.focus();Ob(c.cursorDiv);Ob(c.selectionDiv);c.gutters.style.height=0;if(d){c.lastWrapHeight=b.wrapperHeight;c.lastWrapWidth=
b.wrapperWidth;db(a,400)}c.updateLineNumbers=null;return true}function S(a,b){for(var c=b.viewport,d=true;;d=false){if(!(d&&a.options.lineWrapping&&b.oldDisplayWidth!=hb(a))){if(c&&c.top!=null)c={top:Math.min(a.doc.height+(a.display.mover.offsetHeight-a.display.lineSpace.offsetHeight)-Db(a),c.top)};b.visible=$(a.display,a.doc,c);if(b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break}if(!Ea(a,b))break;G(a);d=H(a);Rb(a);C(a,d);y(a,d)}Qa(a,"update",a);if(a.display.viewFrom!=a.display.reportedViewFrom||
a.display.viewTo!=a.display.reportedViewTo){Qa(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo);a.display.reportedViewFrom=a.display.viewFrom;a.display.reportedViewTo=a.display.viewTo}}function T(a,b){var c=new Ja(a,b);if(Ea(a,c)){G(a);S(a,c);c=H(a);Rb(a);C(a,c);y(a,c)}}function C(a,b){a.display.sizer.style.minHeight=b.docHeight+"px";var c=b.docHeight+a.display.barHeight;a.display.heightForcer.style.top=c+"px";a.display.gutters.style.height=Math.max(c+Za(a),b.clientHeight)+"px"}function G(a){a=
a.display;for(var b=a.lineDiv.offsetTop,c=0;c<a.view.length;c++){var d=a.view[c],e;if(!d.hidden){if(va&&Fa<8){var f=d.node.offsetTop+d.node.offsetHeight;e=f-b;b=f}else{e=d.node.getBoundingClientRect();e=e.bottom-e.top}f=d.line.height-e;if(e<2)e=vb(a);if(f>0.001||f<-0.001){pb(d.line,e);O(d.line);if(d.rest)for(e=0;e<d.rest.length;e++)O(d.rest[e])}}}}function O(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.offsetHeight}function ba(a){for(var b=a.display,c={},
d={},e=b.gutters.clientLeft,f=b.gutters.firstChild,h=0;f;f=f.nextSibling,++h){c[a.options.gutters[h]]=f.offsetLeft+f.clientLeft+e;d[a.options.gutters[h]]=f.clientWidth}return{fixedPos:Va(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function wa(a,b,c){function d(p){var D=p.nextSibling;if(Na&&ib&&a.display.currentWheelTarget==p)p.style.display="none";else p.parentNode.removeChild(p);return D}var e=a.display,f=a.options.lineNumbers,h=e.lineDiv,
i=h.firstChild,k=e.view;e=e.viewFrom;for(var m=0;m<k.length;m++){var o=k[m];if(!o.hidden)if(o.node){for(;i!=o.node;)i=d(i);i=f&&b!=null&&b<=e&&o.lineNumber;if(o.changes){if(Ua(o.changes,"gutter")>-1)i=false;ra(a,o,e,c)}if(i){Ob(o.lineNumber);o.lineNumber.appendChild(document.createTextNode(String(a.options.lineNumberFormatter(e+a.options.firstLineNumber))))}i=o.node.nextSibling}else{var t=ua(a,o,e,c);h.insertBefore(t,i)}e+=o.size}for(;i;)i=d(i)}function ra(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=
b.changes[e];if(f=="text"){f=b;var h=f.text.className,i=Z(a,f);if(f.text==f.node)f.node=i.pre;f.text.parentNode.replaceChild(i.pre,f.text);f.text=i.pre;if(i.bgClass!=f.bgClass||i.textClass!=f.textClass){f.bgClass=i.bgClass;f.textClass=i.textClass;ma(f)}else if(h)f.text.className=h}else if(f=="gutter")Aa(a,b,c,d);else if(f=="class")ma(b);else if(f=="widget"){f=b;h=d;if(f.alignable)f.alignable=null;i=f.node.firstChild;for(var k=void 0;i;i=k){k=i.nextSibling;i.className=="CodeMirror-linewidget"&&f.node.removeChild(i)}P(f,
h)}}b.changes=null}function la(a){if(a.node==a.text){a.node=ga("div",null,null,"position: relative");a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text);a.node.appendChild(a.text);if(va&&Fa<8)a.node.style.zIndex=2}return a.node}function Z(a,b){var c=a.display.externalMeasured;if(c&&c.line==b.line){a.display.externalMeasured=null;b.measure=c.measure;return c.built}return re(a,b)}function ma(a){var b=a.bgClass?a.bgClass+" "+(a.line.bgClass||""):a.line.bgClass;if(b)b+=" CodeMirror-linebackground";
if(a.background)if(b)a.background.className=b;else{a.background.parentNode.removeChild(a.background);a.background=null}else if(b){var c=la(a);a.background=c.insertBefore(ga("div",null,b),c.firstChild)}if(a.line.wrapClass)la(a).className=a.line.wrapClass;else if(a.node!=a.text)a.node.className="";a.text.className=(a.textClass?a.textClass+" "+(a.line.textClass||""):a.line.textClass)||""}function Aa(a,b,c,d){if(b.gutter){b.node.removeChild(b.gutter);b.gutter=null}var e=b.line.gutterMarkers;if(a.options.lineNumbers||
e){var f=la(b);f=b.gutter=f.insertBefore(ga("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px; width: "+d.gutterTotalWidth+"px"),b.text);if(b.line.gutterClass)f.className+=" "+b.line.gutterClass;if(a.options.lineNumbers&&(!e||!e["CodeMirror-linenumbers"]))b.lineNumber=f.appendChild(ga("div",String(a.options.lineNumberFormatter(c+a.options.firstLineNumber)),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+
"px; width: "+a.display.lineNumInnerWidth+"px"));if(e)for(b=0;b<a.options.gutters.length;++b){c=a.options.gutters[b];var h=e.hasOwnProperty(c)&&e[c];h&&f.appendChild(ga("div",[h],"CodeMirror-gutter-elt","left: "+d.gutterLeft[c]+"px; width: "+d.gutterWidth[c]+"px"))}}}function ua(a,b,c,d){var e=Z(a,b);b.text=b.node=e.pre;if(e.bgClass)b.bgClass=e.bgClass;if(e.textClass)b.textClass=e.textClass;ma(b);Aa(a,b,c,d);P(b,d);return b.node}function P(a,b){V(a.line,a,b,true);if(a.rest)for(var c=0;c<a.rest.length;c++)V(a.rest[c],
a,b,false)}function V(a,b,c,d){if(a.widgets){var e=la(b),f=0;for(a=a.widgets;f<a.length;++f){var h=a[f],i=ga("div",[h.node],"CodeMirror-linewidget");h.handleMouseEvents||i.setAttribute("cm-ignore-events","true");var k=h,m=i,o=c;if(k.noHScroll){(b.alignable||(b.alignable=[])).push(m);var t=o.wrapperWidth;m.style.left=o.fixedPos+"px";if(!k.coverGutter){t-=o.gutterTotalWidth;m.style.paddingLeft=o.gutterTotalWidth+"px"}m.style.width=t+"px"}if(k.coverGutter){m.style.zIndex=5;m.style.position="relative";
if(!k.noHScroll)m.style.marginLeft=-o.gutterTotalWidth+"px"}d&&h.above?e.insertBefore(i,b.gutter||b.text):e.appendChild(i);Qa(h,"redraw")}}}function R(a,b){return sa(a,b)<0?b:a}function r(a,b){return sa(a,b)<0?a:b}function F(a,b){this.ranges=a;this.primIndex=b}function s(a,b){this.anchor=a;this.head=b}function U(a,b){var c=a[b];a.sort(function(i,k){return sa(i.from(),k.from())});b=Ua(a,c);for(c=1;c<a.length;c++){var d=a[c],e=a[c-1];if(sa(e.to(),d.from())>=0){var f=r(e.from(),d.from()),h=R(e.to(),
d.to());d=e.empty()?d.from()==d.head:e.from()==e.head;c<=b&&--b;a.splice(--c,2,new s(d?h:f,d?f:h))}}return new F(a,b)}function ja(a,b){return new F([new s(a,b||a)],0)}function Y(a,b){if(b.line<a.first)return W(a.first,0);var c=a.first+a.size-1;if(b.line>c)return W(c,ha(a,c).text.length);c=ha(a,b.line).text.length;var d=b.ch;return d==null||d>c?W(b.line,c):d<0?W(b.line,0):b}function Ka(a,b){return b>=a.first&&b<a.first+a.size}function Ha(a,b,c,d){if(a.cm&&a.cm.display.shift||a.extend){a=b.anchor;if(d){b=
sa(c,a)<0;if(b!=sa(d,a)<0){a=c;c=d}else if(b!=sa(c,d)<0)c=d}return new s(a,c)}else return new s(d||c,c)}function xa(a,b,c,d){Ma(a,new F([Ha(a,a.sel.primary(),b,c)],0),d)}function eb(a,b,c){for(var d=[],e=0;e<a.sel.ranges.length;e++)d[e]=Ha(a,a.sel.ranges[e],b[e],null);b=U(d,a.sel.primIndex);Ma(a,b,c)}function Ba(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c;Ma(a,U(e,a.sel.primIndex),d)}function bc(a,b){var c={ranges:b.ranges,update:function(d){this.ranges=[];for(var e=0;e<d.length;e++)this.ranges[e]=
new s(Y(a,d[e].anchor),Y(a,d[e].head))}};Oa(a,"beforeSelectionChange",a,c);a.cm&&Oa(a.cm,"beforeSelectionChange",a.cm,c);return c.ranges!=b.ranges?U(c.ranges,c.ranges.length-1):b}function cc(a,b,c){var d=a.history.done,e=Ia(d);if(e&&e.ranges){d[d.length-1]=b;qb(a,b,c)}else Ma(a,b,c)}function Ma(a,b,c){qb(a,b,c);b=a.sel;var d=a.cm?a.cm.curOp.id:NaN,e=a.history,f=c&&c.origin,h;if(!(h=d==e.lastSelOp))if(h=f)if(h=e.lastSelOrigin==f)if(!(h=e.lastModTime==e.lastSelTime&&e.lastOrigin==f)){h=Ia(e.done);var i=
f.charAt(0);h=i=="*"||i=="+"&&h.ranges.length==b.ranges.length&&h.somethingSelected()==b.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}if(h)e.done[e.done.length-1]=b;else Wc(b,e.done);e.lastSelTime=+new Date;e.lastSelOrigin=f;e.lastSelOp=d;c&&c.clearRedo!==false&&se(e.undone)}function qb(a,b,c){if(jb(a,"beforeSelectionChange")||a.cm&&jb(a.cm,"beforeSelectionChange"))b=bc(a,b);var d=c&&c.bias||(sa(b.primary().head,a.sel.primary().head)<0?-1:1);Xc(a,
Yc(a,b,d,true));!(c&&c.scroll===false)&&a.cm&&dc(a.cm)}function Xc(a,b){if(!b.equals(a.sel)){a.sel=b;if(a.cm){a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=true;te(a.cm)}Qa(a,"cursorActivity",a)}}function Zc(a){Xc(a,Yc(a,a.sel,null,false),Eb)}function Yc(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var h=b.ranges[f],i=ec(a,h.anchor,c,d),k=ec(a,h.head,c,d);if(e||i!=h.anchor||k!=h.head){e||(e=b.ranges.slice(0,f));e[f]=new s(i,k)}}return e?U(e,b.primIndex):b}function ec(a,b,c,d){var e=false,f=
b,h=c||1;a.cantEdit=false;a:for(;;){var i=ha(a,f.line);if(i.markedSpans)for(var k=0;k<i.markedSpans.length;++k){var m=i.markedSpans[k],o=m.marker;if((m.from==null||(o.inclusiveLeft?m.from<=f.ch:m.from<f.ch))&&(m.to==null||(o.inclusiveRight?m.to>=f.ch:m.to>f.ch))){if(d){Oa(o,"beforeCursorEnter");if(o.explicitlyCleared)if(i.markedSpans){--k;continue}else break}if(o.atomic){k=o.find(h<0?-1:1);if(sa(k,f)==0){k.ch+=h;if(k.ch<0)k=k.line>a.first?Y(a,W(k.line-1)):null;else if(k.ch>i.text.length)k=k.line<
a.first+a.size-1?W(k.line+1,0):null;if(!k){if(e){if(!d)return ec(a,b,c,true);a.cantEdit=true;return W(a.first,0)}e=true;k=b;h=-h}}f=k;continue a}}}return f}}function xc(a){for(var b=a.display,c=a.doc,d={},e=d.cursors=document.createDocumentFragment(),f=d.selection=document.createDocumentFragment(),h=0;h<c.sel.ranges.length;h++){var i=c.sel.ranges[h],k=i.empty();if(k||a.options.showCursorWhenSelecting){var m=a,o=e,t=N(m,i.head,"div",null,null,!m.options.singleCursorHeightPerLine),p=o.appendChild(ga("div",
"\u00a0","CodeMirror-cursor"));p.style.left=t.left+"px";p.style.top=t.top+"px";p.style.height=Math.max(0,t.bottom-t.top)*m.options.cursorHeight+"px";if(t.other){m=o.appendChild(ga("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor"));m.style.display="";m.style.left=t.other.left+"px";m.style.top=t.other.top+"px";m.style.height=(t.other.bottom-t.other.top)*0.85+"px"}}k||Ld(a,i,f)}if(a.options.moveInputWithCursor){a=N(a,c.sel.primary().head,"div");c=b.wrapper.getBoundingClientRect();e=b.lineDiv.getBoundingClientRect();
d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+e.top-c.top));d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,a.left+e.left-c.left))}return d}function fc(a,b){rb(a.display.cursorDiv,b.cursors);rb(a.display.selectionDiv,b.selection);if(b.teTop!=null){a.display.inputDiv.style.top=b.teTop+"px";a.display.inputDiv.style.left=b.teLeft+"px"}}function Rb(a){fc(a,xc(a))}function Ld(a,b,c){function d(p,D,L,ea){if(D<0)D=0;D=Math.round(D);ea=Math.round(ea);i.appendChild(ga("div",null,"CodeMirror-selected",
"position: absolute; left: "+p+"px; top: "+D+"px; width: "+(L==null?o-p:L)+"px; height: "+(ea-D)+"px"))}function e(p,D,L){var ea=ha(h,p),fa=ea.text.length,na,ia;zf(sb(ea),D||0,L==null?fa:L,function(da,Ca,pa){var ya=I(a,W(p,da),"div",ea,"left"),ta,Da;if(da==Ca){ta=ya;pa=Da=ya.left}else{ta=I(a,W(p,Ca-1),"div",ea,"right");if(pa=="rtl"){pa=ya;ya=ta;ta=pa}pa=ya.left;Da=ta.right}if(D==null&&da==0)pa=m;if(ta.top-ya.top>3){d(pa,ya.top,null,ya.bottom);pa=m;ya.bottom<ta.top&&d(pa,ya.bottom,null,ta.top)}if(L==
null&&Ca==fa)Da=o;if(!na||ya.top<na.top||ya.top==na.top&&ya.left<na.left)na=ya;if(!ia||ta.bottom>ia.bottom||ta.bottom==ia.bottom&&ta.right>ia.right)ia=ta;if(pa<m+1)pa=m;d(pa,ta.top,Da-pa,ta.bottom)});return{start:na,end:ia}}var f=a.display,h=a.doc,i=document.createDocumentFragment(),k=yc(a.display),m=k.left,o=Math.max(f.sizerWidth,hb(a)-f.sizer.offsetLeft)-k.right;f=b.from();b=b.to();if(f.line==b.line)e(f.line,f.ch,b.ch);else{var t=ha(h,f.line);k=ha(h,b.line);k=tb(t)==tb(k);f=e(f.line,f.ch,k?t.text.length+
1:null).end;b=e(b.line,k?0:null,b.ch).start;if(k)if(f.top<b.top-2){d(f.right,f.top,null,f.bottom);d(m,b.top,b.left,b.bottom)}else d(f.right,f.top,b.left-f.right,f.bottom);f.bottom<b.top&&d(m,f.bottom,null,b.top)}c.appendChild(i)}function Fb(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=true;b.cursorDiv.style.visibility="";if(a.options.cursorBlinkRate>0)b.blinker=setInterval(function(){b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate);else if(a.options.cursorBlinkRate<
0)b.cursorDiv.style.visibility="hidden"}}function db(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.viewTo&&a.state.highlight.set(b,ob($c,a))}function $c(a){var b=a.doc;if(b.frontier<b.first)b.frontier=b.first;if(!(b.frontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=gc(b.mode,fb(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(b.frontier>=a.display.viewFrom){var h=f.styles,i=ue(a,f,d,true);f.styles=i.styles;var k=f.styleClasses;
if(i=i.classes)f.styleClasses=i;else if(k)f.styleClasses=null;k=!h||h.length!=f.styles.length||k!=i&&(!k||!i||k.bgClass!=i.bgClass||k.textClass!=i.textClass);for(i=0;!k&&i<h.length;++i)k=h[i]!=f.styles[i];k&&e.push(b.frontier);f.stateAfter=gc(b.mode,d)}else{Md(a,f.text,d);f.stateAfter=b.frontier%5==0?gc(b.mode,d):null}++b.frontier;if(+new Date>c){db(a,a.options.workDelay);return true}});e.length&&Gb(a,function(){for(var f=0;f<e.length;f++)xb(a,e[f],"text")})}}function hc(a,b,c){for(var d,e,f=a.doc,
h=c?-1:b-(a.doc.mode.innerMode?1E3:100);b>h;--b){if(b<=f.first)return f.first;var i=ha(f,b-1);if(i.stateAfter&&(!c||b<=f.frontier))return b;i=kb(i.text,null,a.options.tabSize);if(e==null||d>i){e=b-1;d=i}}return e}function fb(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return true;var f=hc(a,b,c),h=f>d.first&&ha(d,f-1).stateAfter;h=h?gc(d.mode,h):Af(d.mode);d.iter(f,b,function(i){Md(a,i.text,h);i.stateAfter=f==b-1||f%5==0||f>=e.viewFrom&&f<e.viewTo?gc(d.mode,h):null;++f});if(c)d.frontier=
f;return h}function yc(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=rb(a.measure,ga("pre","x"));b=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle;b={left:parseInt(b.paddingLeft),right:parseInt(b.paddingRight)};if(!isNaN(b.left)&&!isNaN(b.right))a.cachedPaddingH=b;return b}function Za(a){return oe-a.display.nativeBarWidth}function hb(a){return a.display.scroller.clientWidth-Za(a)-a.display.barWidth}function Db(a){return a.display.scroller.clientHeight-Za(a)-a.display.barHeight}
function ad(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[wc(a,b)];var c=a.display.externalMeasured;if(c&&b>=c.lineN&&b<c.lineN+c.size)return c}function ub(a,b){var c=La(b),d=ad(a,c);if(d&&!d.text)d=null;else d&&d.changes&&ra(a,d,c,ba(a));if(!d){var e;e=tb(b);d=La(e);e=a.display.externalMeasured=new ve(a.doc,e,d);e.lineN=d;d=e.built=re(a,e);e.text=d.pre;rb(a.display.lineMeasure,d.pre);d=e}a:{e=d;if(e.line==b)c={map:e.measure.map,cache:e.measure.cache};else{for(var f=0;f<
e.rest.length;f++)if(e.rest[f]==b){c={map:e.measure.maps[f],cache:e.measure.caches[f]};break a}for(f=0;f<e.rest.length;f++)if(La(e.rest[f])>c){c={map:e.measure.maps[f],cache:e.measure.caches[f],before:true};break a}c=void 0}}return{line:b,view:d,rect:null,map:c.map,cache:c.cache,before:c.before,hasHeights:false}}function Hb(a,b,c,d,e){if(b.before)c=-1;var f=c+(d||"");if(b.cache.hasOwnProperty(f))a=b.cache[f];else{if(!b.rect)b.rect=b.view.text.getBoundingClientRect();if(!b.hasHeights){var h=b.view,
i=b.rect,k=a.options.lineWrapping,m=k&&hb(a);if(!h.measure.heights||k&&h.measure.width!=m){var o=h.measure.heights=[];if(k){h.measure.width=m;h=h.text.firstChild.getClientRects();for(k=0;k<h.length-1;k++){m=h[k];var t=h[k+1];Math.abs(m.bottom-t.bottom)>2&&o.push((m.bottom+t.top)/2-i.top)}}o.push(i.bottom-i.top)}b.hasHeights=true}i=d;o=b.map;var p,D,L,ea;for(d=0;d<o.length;d+=3){var fa=o[d],na=o[d+1];if(c<fa){D=0;L=1;ea="left"}else if(c<na){D=c-fa;L=D+1}else if(d==o.length-3||c==na&&o[d+3]>c){L=na-
fa;D=L-1;if(c>=na)ea="right"}if(D!=null){p=o[d+2];if(fa==na&&i==(p.insertLeft?"left":"right"))ea=i;if(i=="left"&&D==0)for(;d&&o[d-2]==o[d-3]&&o[d-1].insertLeft;){p=o[(d-=3)+2];ea="left"}if(i=="right"&&D==na-fa)for(;d<o.length-3&&o[d+3]==o[d+4]&&!o[d+5].insertLeft;){p=o[(d+=3)+2];ea="right"}break}}var ia;if(p.nodeType==3){for(d=0;d<4;d++){for(;D&&zc(b.line.text.charAt(fa+D));)--D;for(;fa+L<na&&zc(b.line.text.charAt(fa+L));)++L;if(va&&Fa<9&&D==0&&L==na-fa)ia=p.parentNode.getBoundingClientRect();else if(va&&
a.options.lineWrapping){var da=ic(p,D,L).getClientRects();ia=da.length?da[i=="right"?da.length-1:0]:Nd}else ia=ic(p,D,L).getBoundingClientRect()||Nd;if(ia.left||ia.right||D==0)break;L=D;D-=1;ea="right"}if(va&&Fa<11){if(!(c=!window.screen))if(!(c=screen.logicalXDPI==null))if(!(c=screen.logicalXDPI==screen.deviceXDPI)){if(Od!=null)c=Od;else{L=rb(a.display.measure,ga("span","x"));c=L.getBoundingClientRect();L=ic(L,0,1).getBoundingClientRect();c=Od=Math.abs(c.left-L.left)>1}c=!c}if(!c){c=screen.logicalXDPI/
screen.deviceXDPI;L=screen.logicalYDPI/screen.deviceYDPI;ia={left:ia.left*c,right:ia.right*c,top:ia.top*L,bottom:ia.bottom*L}}}}else{if(D>0)ea=i="right";ia=a.options.lineWrapping&&(da=p.getClientRects()).length>1?da[i=="right"?da.length-1:0]:p.getBoundingClientRect()}if(va&&Fa<9&&!D&&(!ia||!ia.left&&!ia.right))ia=(p=p.parentNode.getClientRects()[0])?{left:p.left,right:p.left+sc(a.display),top:p.top,bottom:p.bottom}:Nd;p=ia.top-b.rect.top;D=ia.bottom-b.rect.top;c=(p+D)/2;L=b.view.measure.heights;for(d=
0;d<L.length-1;d++)if(c<L[d])break;ea={left:(ea=="right"?ia.right:ia.left)-b.rect.left,right:(ea=="left"?ia.left:ia.right)-b.rect.left,top:d?L[d-1]:0,bottom:L[d]};if(!ia.left&&!ia.right)ea.bogus=true;if(!a.options.singleCursorHeightPerLine){ea.rtop=p;ea.rbottom=D}a=ea;a.bogus||(b.cache[f]=a)}return{left:a.left,right:a.right,top:e?a.rtop:a.top,bottom:e?a.rbottom:a.bottom}}function bd(a){if(a.measure){a.measure.cache={};a.measure.heights=null;if(a.rest)for(var b=0;b<a.rest.length;b++)a.measure.caches[b]=
{}}}function cd(a){a.display.externalMeasure=null;Ob(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)bd(a.display.view[b])}function aa(a){cd(a);a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null;if(!a.options.lineWrapping)a.display.maxLineChanged=true;a.display.lineNumChars=null}function Ac(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=Bc(b.widgets[e]);c.top+=f;c.bottom+=f}if(d=="line")return c;d||(d="local");b=
wb(b);if(d=="local")b+=a.display.lineSpace.offsetTop;else b-=a.display.viewOffset;if(d=="page"||d=="window"){a=a.display.lineSpace.getBoundingClientRect();b+=a.top+(d=="window"?0:window.pageYOffset||(document.documentElement||document.body).scrollTop);d=a.left+(d=="window"?0:window.pageXOffset||(document.documentElement||document.body).scrollLeft);c.left+=d;c.right+=d}c.top+=b;c.bottom+=b;return c}function n(a,b,c){if(c=="div")return b;var d=b.left;b=b.top;if(c=="page"){d-=window.pageXOffset||(document.documentElement||
document.body).scrollLeft;b-=window.pageYOffset||(document.documentElement||document.body).scrollTop}else if(c=="local"||!c){c=a.display.sizer.getBoundingClientRect();d+=c.left;b+=c.top}a=a.display.lineSpace.getBoundingClientRect();return{left:d-a.left,top:b-a.top}}function I(a,b,c,d,e){d||(d=ha(a.doc,b.line));return Ac(a,d,Hb(a,ub(a,d),b.ch,e),c)}function N(a,b,c,d,e,f){function h(o,t){var p=Hb(a,e,o,t?"right":"left",f);if(t)p.left=p.right;else p.right=p.left;return Ac(a,d,p,c)}function i(o,t){var p=
k[t],D=p.level%2;if(o==(p.level%2?p.to:p.from)&&t&&p.level<k[t-1].level){p=k[--t];o=Pd(p)-(p.level%2?0:1);D=true}else if(o==Pd(p)&&t<k.length-1&&p.level<k[t+1].level){p=k[++t];o=(p.level%2?p.to:p.from)-p.level%2;D=false}if(D&&o==p.to&&o>p.from)return h(o-1);return h(o,D)}d=d||ha(a.doc,b.line);e||(e=ub(a,d));var k=sb(d);b=b.ch;if(!k)return h(b);var m=Qd(k,b);m=i(b,m);if(Cc!=null)m.other=i(b,Cc);return m}function K(a,b){var c=0;b=Y(a.doc,b);a.options.lineWrapping||(c=sc(a.display)*b.ch);var d=ha(a.doc,
b.line),e=wb(d)+a.display.lineSpace.offsetTop;return{left:c,right:c,top:e,bottom:e+d.height}}function ka(a,b,c,d){a=W(a,b);a.xRel=d;if(c)a.outside=true;return a}function za(a,b,c){var d=a.doc;c+=a.display.viewOffset;if(c<0)return ka(d.first,0,true,-1);var e=Qb(d,c),f=d.first+d.size-1;if(e>f)return ka(d.first+d.size-1,ha(d,f).text.length,true,1);if(b<0)b=0;for(d=ha(d,e);;){e=Ra(a,d,e,b,c);f=(d=Pb(d,false))&&d.find(0,true);if(d&&(e.ch>f.from.ch||e.ch==f.from.ch&&e.xRel>0))e=La(d=f.to.line);else return e}}
function Ra(a,b,c,d,e){function f(Ca){Ca=N(a,W(c,Ca),"line",b,m);i=true;if(h>Ca.bottom)return Ca.left-k;else if(h<Ca.top)return Ca.left+k;else i=false;return Ca.left}var h=e-wb(b),i=false,k=2*a.display.wrapper.clientWidth,m=ub(a,b),o=sb(b),t=b.text.length;e=dd(b);var p=ed(b),D=f(e),L=i,ea=f(p),fa=i;if(d>ea)return ka(c,p,fa,1);for(;;){if(o?p==e||p==Rd(b,e,1):p-e<=1){o=d<D||d-D<=ea-d?e:p;for(d-=o==e?D:ea;zc(b.text.charAt(o));)++o;return ka(c,o,o==e?L:fa,d<-1?-1:d>1?1:0)}var na=Math.ceil(t/2),ia=e+na;
if(o){ia=e;for(var da=0;da<na;++da)ia=Rd(b,ia,1)}da=f(ia);if(da>d){p=ia;ea=da;if(fa=i)ea+=1E3;t=na}else{e=ia;D=da;L=i;t-=na}}}function vb(a){if(a.cachedTextHeight!=null)return a.cachedTextHeight;if(Sb==null){Sb=ga("pre");for(var b=0;b<49;++b){Sb.appendChild(document.createTextNode("x"));Sb.appendChild(ga("br"))}Sb.appendChild(document.createTextNode("x"))}rb(a.measure,Sb);b=Sb.offsetHeight/50;if(b>3)a.cachedTextHeight=b;Ob(a.measure);return b||1}function sc(a){if(a.cachedCharWidth!=null)return a.cachedCharWidth;
var b=ga("span","xxxxxxxxxx"),c=ga("pre",[b]);rb(a.measure,c);b=b.getBoundingClientRect();b=(b.right-b.left)/10;if(b>2)a.cachedCharWidth=b;return b||10}function Lb(a){a.curOp={cm:a,viewChanged:false,startHeight:a.doc.height,forceUpdate:false,updateInput:null,typing:false,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:false,updateMaxLine:false,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++Bf};if(jc)jc.ops.push(a.curOp);else a.curOp.ownsGroup=jc={ops:[a.curOp],
delayedCallbacks:[]}}function Mb(a){if(a=a.curOp.ownsGroup)try{var b=a.delayedCallbacks,c=0;do{for(;c<b.length;c++)b[c]();for(var d=0;d<a.ops.length;d++){var e=a.ops[d];if(e.cursorActivityHandlers)for(;e.cursorActivityCalled<e.cursorActivityHandlers.length;)e.cursorActivityHandlers[e.cursorActivityCalled++](e.cm)}}while(c<b.length)}finally{jc=null;for(b=0;b<a.ops.length;b++)a.ops[b].cm.curOp=null;a=a.ops;for(b=0;b<a.length;b++){e=a[b];c=e.cm;d=c.display;var f=c,h=f.display;if(!h.scrollbarsClipped&&
h.scroller.offsetWidth){h.nativeBarWidth=h.scroller.offsetWidth-h.scroller.clientWidth;h.heightForcer.style.height=Za(f)+"px";h.sizer.style.marginBottom=-h.nativeBarWidth+"px";h.sizer.style.borderRightWidth=Za(f)+"px";h.scrollbarsClipped=true}e.updateMaxLine&&x(c);e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<d.viewFrom||e.scrollToPos.to.line>=d.viewTo)||d.maxLineChanged&&c.options.lineWrapping;e.update=e.mustUpdate&&new Ja(c,e.mustUpdate&&{top:e.scrollTop,
ensure:e.scrollToPos},e.forceUpdate)}for(b=0;b<a.length;b++){e=a[b];e.updatedDisplay=e.mustUpdate&&Ea(e.cm,e.update)}for(b=0;b<a.length;b++){e=a[b];c=e.cm;d=c.display;e.updatedDisplay&&G(c);e.barMeasure=H(c);if(d.maxLineChanged&&!c.options.lineWrapping){e.adjustWidthTo=Hb(c,ub(c,d.maxLine),d.maxLine.text.length,void 0).left+3;c.display.sizerWidth=e.adjustWidthTo;e.barMeasure.scrollWidth=Math.max(d.scroller.clientWidth,d.sizer.offsetLeft+e.adjustWidthTo+Za(c)+c.display.barWidth);e.maxScrollLeft=Math.max(0,
d.sizer.offsetLeft+e.adjustWidthTo-hb(c))}if(e.updatedDisplay||e.selectionChanged)e.newSelectionNodes=xc(c)}for(b=0;b<a.length;b++){e=a[b];c=e.cm;if(e.adjustWidthTo!=null){c.display.sizer.style.minWidth=e.adjustWidthTo+"px";e.maxScrollLeft<c.doc.scrollLeft&&ac(c,Math.min(c.display.scroller.scrollLeft,e.maxScrollLeft),true);c.display.maxLineChanged=false}e.newSelectionNodes&&fc(c,e.newSelectionNodes);e.updatedDisplay&&C(c,e.barMeasure);if(e.updatedDisplay||e.startHeight!=c.doc.height)y(c,e.barMeasure);
e.selectionChanged&&Fb(c);c.state.focused&&e.updateInput&&gb(c,e.typing)}for(b=0;b<a.length;b++){e=a[b];c=e.cm;d=c.display;f=c.doc;e.updatedDisplay&&S(c,e.update);if(d.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos))d.wheelStartX=d.wheelStartY=null;if(e.scrollTop!=null&&(d.scroller.scrollTop!=e.scrollTop||e.forceScroll)){f.scrollTop=Math.max(0,Math.min(d.scroller.scrollHeight-d.scroller.clientHeight,e.scrollTop));d.scrollbars.setScrollTop(f.scrollTop);d.scroller.scrollTop=
f.scrollTop}if(e.scrollLeft!=null&&(d.scroller.scrollLeft!=e.scrollLeft||e.forceScroll)){f.scrollLeft=Math.max(0,Math.min(d.scroller.scrollWidth-hb(c),e.scrollLeft));d.scrollbars.setScrollLeft(f.scrollLeft);d.scroller.scrollLeft=f.scrollLeft;Ga(c)}if(e.scrollToPos){var i=void 0;h=Y(f,e.scrollToPos.from);i=Y(f,e.scrollToPos.to);var k=e.scrollToPos.margin;if(k==null)k=0;for(var m=0;m<5;m++){var o=false,t=N(c,h),p=!i||i==h?t:N(c,i);p=fd(c,Math.min(t.left,p.left),Math.min(t.top,p.top)-k,Math.max(t.left,
p.left),Math.max(t.bottom,p.bottom)+k);var D=c.doc.scrollTop,L=c.doc.scrollLeft;if(p.scrollTop!=null){uc(c,p.scrollTop);if(Math.abs(c.doc.scrollTop-D)>1)o=true}if(p.scrollLeft!=null){ac(c,p.scrollLeft);if(Math.abs(c.doc.scrollLeft-L)>1)o=true}if(!o)break}i=t;if(e.scrollToPos.isCursor&&c.state.focused)if(!lb(c,"scrollCursorIntoView")){k=c.display;m=k.sizer.getBoundingClientRect();h=null;if(i.top+m.top<0)h=true;else if(i.bottom+m.top>(window.innerHeight||document.documentElement.clientHeight))h=false;
if(h!=null&&!Cf){i=ga("div","\u200b",null,"position: absolute; top: "+(i.top-k.viewOffset-c.display.lineSpace.offsetTop)+"px; height: "+(i.bottom-i.top+Za(c)+k.barHeight)+"px; left: "+i.left+"px; width: 2px;");c.display.lineSpace.appendChild(i);i.scrollIntoView(h);c.display.lineSpace.removeChild(i)}}}h=e.maybeHiddenMarkers;i=e.maybeUnhiddenMarkers;if(h)for(k=0;k<h.length;++k)h[k].lines.length||Oa(h[k],"hide");if(i)for(k=0;k<i.length;++k)i[k].lines.length&&Oa(i[k],"unhide");if(d.wrapper.offsetHeight)f.scrollTop=
c.display.scroller.scrollTop;e.changeObjs&&Oa(c,"changes",c,e.changeObjs)}}}function Gb(a,b){if(a.curOp)return b();Lb(a);try{return b()}finally{Mb(a)}}function Pa(a,b){return function(){if(a.curOp)return b.apply(a,arguments);Lb(a);try{return b.apply(a,arguments)}finally{Mb(a)}}}function Sa(a){return function(){if(this.curOp)return a.apply(this,arguments);Lb(this);try{return a.apply(this,arguments)}finally{Mb(this)}}}function Wa(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,
arguments);Lb(b);try{return a.apply(this,arguments)}finally{Mb(b)}}}function ve(a,b,c){for(var d=this.line=b,e;d=Pb(d,false);){d=d.find(1,true).line;(e||(e=[])).push(d)}this.size=(this.rest=e)?La(Ia(this.rest))-c+1:1;this.node=this.text=null;this.hidden=Nb(a,b)}function Vc(a,b,c){var d=[],e;for(e=b;e<c;){b=new ve(a.doc,ha(a.doc,e),e);e+=b.size;d.push(b)}return d}function ab(a,b,c,d){if(b==null)b=a.doc.first;if(c==null)c=a.doc.first+a.doc.size;d||(d=0);var e=a.display;if(d&&c<e.viewTo&&(e.updateLineNumbers==
null||e.updateLineNumbers>b))e.updateLineNumbers=b;a.curOp.viewChanged=true;if(b>=e.viewTo)Cb&&Kd(a.doc,b)<e.viewTo&&Bb(a);else if(c<=e.viewFrom)if(Cb&&qe(a.doc,c+d)>e.viewFrom)Bb(a);else{e.viewFrom+=d;e.viewTo+=d}else if(b<=e.viewFrom&&c>=e.viewTo)Bb(a);else if(b<=e.viewFrom){var f=gd(a,c,c+d,1);if(f){e.view=e.view.slice(f.index);e.viewFrom=f.lineN;e.viewTo+=d}else Bb(a)}else if(c>=e.viewTo)if(f=gd(a,b,b,-1)){e.view=e.view.slice(0,f.index);e.viewTo=f.lineN}else Bb(a);else{f=gd(a,b,b,-1);var h=gd(a,
c,c+d,1);if(f&&h){e.view=e.view.slice(0,f.index).concat(Vc(a,f.lineN,h.lineN)).concat(e.view.slice(h.index));e.viewTo+=d}else Bb(a)}if(a=e.externalMeasured)if(c<a.lineN)a.lineN+=d;else if(b<a.lineN+a.size)e.externalMeasured=null}function xb(a,b,c){a.curOp.viewChanged=true;var d=a.display,e=a.display.externalMeasured;if(e&&b>=e.lineN&&b<e.lineN+e.size)d.externalMeasured=null;if(!(b<d.viewFrom||b>=d.viewTo)){a=d.view[wc(a,b)];if(a.node!=null){a=a.changes||(a.changes=[]);Ua(a,c)==-1&&a.push(c)}}}function Bb(a){a.display.viewFrom=
a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function wc(a,b){if(b>=a.display.viewTo)return null;b-=a.display.viewFrom;if(b<0)return null;for(var c=a.display.view,d=0;d<c.length;d++){b-=c[d].size;if(b<0)return d}}function gd(a,b,c,d){var e=wc(a,b),f=a.display.view;if(!Cb||c==a.doc.first+a.doc.size)return{index:e,lineN:c};for(var h=0,i=a.display.viewFrom;h<e;h++)i+=f[h].size;if(i!=b){if(d>0){if(e==f.length-1)return null;b=i+f[e].size-b;e++}else b=i-b;c+=b}for(;Kd(a.doc,c)!=
c;){if(e==(d<0?0:f.length-1))return null;c+=d*f[e-(d<0?1:0)].size;e+=d}return{index:e,lineN:c}}function pe(a){a=a.display.view;for(var b=0,c=0;c<a.length;c++){var d=a[c];if(!d.hidden&&(!d.node||d.changes))++b}return b}function hd(a){a.display.pollingFast||a.display.poll.set(a.options.pollInterval,function(){id(a);a.state.focused&&hd(a)})}function jd(a){function b(){if(!id(a)&&!c){c=true;a.display.poll.set(60,b)}else{a.display.pollingFast=false;hd(a)}}var c=false;a.display.pollingFast=true;a.display.poll.set(20,
b)}function id(a){var b=a.display.input,c=a.display.prevInput,d=a.doc;if(!a.state.focused||Df(b)&&!c||kd(a)||a.options.disableInput||a.state.keySeq)return false;if(a.state.pasteIncoming&&a.state.fakedLastChar){b.value=b.value.substring(0,b.value.length-1);a.state.fakedLastChar=false}var e=b.value;if(e==c&&!a.somethingSelected())return false;if(va&&Fa>=9&&a.display.inputHasSelection===e||ib&&/[\uf700-\uf7ff]/.test(e)){gb(a);return false}var f=!a.curOp;f&&Lb(a);a.display.shift=false;if(e.charCodeAt(0)==
8203&&d.sel==a.display.selForContextMenu&&!c)c="\u200b";for(var h=0,i=Math.min(c.length,e.length);h<i&&c.charCodeAt(h)==e.charCodeAt(h);)++h;i=e.slice(h);var k=Tb(i),m=null;if(a.state.pasteIncoming&&d.sel.ranges.length>1)if(Ub&&Ub.join("\n")==i)m=d.sel.ranges.length%Ub.length==0&&Dc(Ub,Tb);else if(k.length==d.sel.ranges.length)m=Dc(k,function(ea){return[ea]});for(var o=d.sel.ranges.length-1;o>=0;o--){var t=d.sel.ranges[o],p=t.from(),D=t.to();if(h<c.length)p=W(p.line,p.ch-(c.length-h));else if(a.state.overwrite&&
t.empty()&&!a.state.pasteIncoming)D=W(D.line,Math.min(ha(d,D.line).text.length,D.ch+Ia(k).length));var L=a.curOp.updateInput;p={from:p,to:D,text:m?m[o%m.length]:k,origin:a.state.pasteIncoming?"paste":a.state.cutIncoming?"cut":"+input"};kc(a.doc,p);Qa(a,"inputRead",a,p);if(i&&!a.state.pasteIncoming&&a.options.electricChars&&a.options.smartIndent&&t.head.ch<100&&(!o||d.sel.ranges[o-1].head.line!=t.head.line)){t=a.getModeAt(t.head);p=Ib(p);if(t.electricChars)for(D=0;D<t.electricChars.length;D++){if(i.indexOf(t.electricChars.charAt(D))>
-1){Ec(a,p.line,"smart");break}}else t.electricInput&&t.electricInput.test(ha(d,p.line).text.slice(0,p.ch))&&Ec(a,p.line,"smart")}}dc(a);a.curOp.updateInput=L;a.curOp.typing=true;if(e.length>1E3||e.indexOf("\n")>-1)b.value=a.display.prevInput="";else a.display.prevInput=e;f&&Mb(a);a.state.pasteIncoming=a.state.cutIncoming=false;return true}function gb(a,b){if(!a.display.contextMenuPending){var c,d,e=a.doc;if(a.somethingSelected()){a.display.prevInput="";c=e.sel.primary();d=(c=we&&(c.to().line-c.from().line>
100||(d=a.getSelection()).length>1E3))?"-":d||a.getSelection();a.display.input.value=d;a.state.focused&&Fc(a.display.input);if(va&&Fa>=9)a.display.inputHasSelection=d}else if(!b){a.display.prevInput=a.display.input.value="";if(va&&Fa>=9)a.display.inputHasSelection=null}a.display.inaccurateSelection=c}}function $a(a){if(a.options.readOnly!="nocursor"&&(!Gd||Ab()!=a.display.input))a.display.input.focus()}function Sd(a){if(!a.state.focused){$a(a);Hd(a)}}function kd(a){return a.options.readOnly||a.doc.cantEdit}
function xf(a){function b(e){lb(a,e)||Td(e)}function c(e){if(a.somethingSelected()){Ub=a.getSelections();if(d.inaccurateSelection){d.prevInput="";d.inaccurateSelection=false;d.input.value=Ub.join("\n");Fc(d.input)}}else{for(var f=[],h=[],i=0;i<a.doc.sel.ranges.length;i++){var k=a.doc.sel.ranges[i].head.line;k={anchor:W(k,0),head:W(k+1,0)};h.push(k);f.push(a.getRange(k.anchor,k.head))}if(e.type=="cut")a.setSelections(h,null,Eb);else{d.prevInput="";d.input.value=f.join("\n");Fc(d.input)}Ub=f}if(e.type==
"cut")a.state.cutIncoming=true}var d=a.display;qa(d.scroller,"mousedown",Pa(a,xe));va&&Fa<11?qa(d.scroller,"dblclick",Pa(a,function(e){if(!lb(a,e)){var f=lc(a,e);if(!(!f||Ud(a,e,"gutterClick",true,Qa)||Vb(a.display,e))){Xa(e);e=a.findWordAt(f);xa(a.doc,e.anchor,e.head)}}})):qa(d.scroller,"dblclick",function(e){lb(a,e)||Xa(e)});qa(d.lineSpace,"selectstart",function(e){Vb(d,e)||Xa(e)});Vd||qa(d.scroller,"contextmenu",function(e){ye(a,e)});qa(d.scroller,"scroll",function(){if(d.scroller.clientHeight){uc(a,
d.scroller.scrollTop);ac(a,d.scroller.scrollLeft,true);Oa(a,"scroll",a)}});qa(d.scroller,"mousewheel",function(e){ze(a,e)});qa(d.scroller,"DOMMouseScroll",function(e){ze(a,e)});qa(d.wrapper,"scroll",function(){d.wrapper.scrollTop=d.wrapper.scrollLeft=0});qa(d.input,"keyup",function(e){Ae.call(a,e)});qa(d.input,"input",function(){if(va&&Fa>=9&&a.display.inputHasSelection)a.display.inputHasSelection=null;id(a)});qa(d.input,"keydown",Pa(a,Be));qa(d.input,"keypress",Pa(a,Ce));qa(d.input,"focus",ob(Hd,
a));qa(d.input,"blur",ob(Uc,a));if(a.options.dragDrop){qa(d.scroller,"dragstart",function(e){var f=a;if(va&&(!f.state.draggingText||+new Date-De<100))Td(e);else if(!(lb(f,e)||Vb(f.display,e))){e.dataTransfer.setData("Text",f.getSelection());if(e.dataTransfer.setDragImage&&!Ee){var h=ga("img",null,null,"position: fixed; left: 0; top: 0;");h.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";if(mb){h.width=h.height=1;f.display.wrapper.appendChild(h);h._top=h.offsetTop}e.dataTransfer.setDragImage(h,
0,0);mb&&h.parentNode.removeChild(h)}}});qa(d.scroller,"dragenter",b);qa(d.scroller,"dragover",b);qa(d.scroller,"drop",Pa(a,Ef))}qa(d.scroller,"paste",function(e){if(!Vb(d,e)){a.state.pasteIncoming=true;$a(a);jd(a)}});qa(d.input,"paste",function(){if(Na&&!a.state.fakedLastChar&&!(new Date-a.state.lastMiddleDown<200)){var e=d.input.selectionStart,f=d.input.selectionEnd;d.input.value+="$";d.input.selectionEnd=f;d.input.selectionStart=e;a.state.fakedLastChar=true}a.state.pasteIncoming=true;jd(a)});qa(d.input,
"cut",c);qa(d.input,"copy",c);Jd&&qa(d.sizer,"mouseup",function(){Ab()==d.input&&d.input.blur();$a(a)})}function Ff(a){var b=a.display;if(!(b.lastWrapHeight==b.wrapper.clientHeight&&b.lastWrapWidth==b.wrapper.clientWidth)){b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null;b.scrollbarsClipped=false;a.setSize()}}function Vb(a,b){for(var c=b.target||b.srcElement;c!=a.wrapper;c=c.parentNode)if(!c||c.nodeType==1&&c.getAttribute("cm-ignore-events")=="true"||c.parentNode==a.sizer&&c!=a.mover)return true}
function lc(a,b,c,d){var e=a.display;if(!c&&(b.target||b.srcElement).getAttribute("not-content")=="true")return null;var f,h;c=e.lineSpace.getBoundingClientRect();try{f=b.clientX-c.left;h=b.clientY-c.top}catch(i){return null}b=za(a,f,h);var k;if(d&&b.xRel==1&&(k=ha(a.doc,b.line).text).length==b.ch){d=kb(k,k.length,a.options.tabSize)-k.length;b=W(b.line,Math.max(0,Math.round((f-yc(a.display).left)/sc(a.display))-d))}return b}function xe(a){if(!lb(this,a)){var b=this.display;b.shift=a.shiftKey;if(Vb(b,
a)){if(!Na){b.scroller.draggable=false;setTimeout(function(){b.scroller.draggable=true},100)}}else if(!Ud(this,a,"gutterClick",true,Qa)){var c=lc(this,a);window.focus();switch(Fe(a)){case 1:if(c)Gf(this,a,c);else(a.target||a.srcElement)==b.scroller&&Xa(a);break;case 2:if(Na)this.state.lastMiddleDown=+new Date;c&&xa(this.doc,c);setTimeout(ob($a,this),20);Xa(a);break;case 3:Vd&&ye(this,a)}}}}function Gf(a,b,c){setTimeout(ob(Sd,a),0);var d=+new Date,e;if(ld&&ld.time>d-400&&sa(ld.pos,c)==0)e="triple";
else if(md&&md.time>d-400&&sa(md.pos,c)==0){e="double";ld={time:d,pos:c}}else{e="single";md={time:d,pos:c}}d=a.doc.sel;var f=ib?b.metaKey:b.ctrlKey,h;a.options.dragDrop&&Hf&&!kd(a)&&e=="single"&&(h=d.contains(c))>-1&&!d.ranges[h].empty()?If(a,b,c,f):Jf(a,b,c,e,f)}function If(a,b,c,d){var e=a.display,f=Pa(a,function(h){if(Na)e.scroller.draggable=false;a.state.draggingText=false;yb(document,"mouseup",f);yb(e.scroller,"drop",f);if(Math.abs(b.clientX-h.clientX)+Math.abs(b.clientY-h.clientY)<10){Xa(h);
d||xa(a.doc,c);$a(a);va&&Fa==9&&setTimeout(function(){document.body.focus();$a(a)},20)}});if(Na)e.scroller.draggable=true;a.state.draggingText=f;e.scroller.dragDrop&&e.scroller.dragDrop();qa(document,"mouseup",f);qa(e.scroller,"drop",f)}function Jf(a,b,c,d,e){function f(da){if(sa(L,da)!=0){L=da;if(d=="rect"){var Ca=[],pa=a.options.tabSize,ya=kb(ha(m,c.line).text,c.ch,pa),ta=kb(ha(m,da.line).text,da.ch,pa),Da=Math.min(ya,ta);ya=Math.max(ya,ta);ta=Math.min(c.line,da.line);for(var Ta=Math.min(a.lastLine(),
Math.max(c.line,da.line));ta<=Ta;ta++){var nb=ha(m,ta).text,nd=Ge(nb,Da,pa);if(Da==ya)Ca.push(new s(W(ta,nd),W(ta,nd)));else nb.length>nd&&Ca.push(new s(W(ta,nd),W(ta,Ge(nb,ya,pa))))}Ca.length||Ca.push(new s(c,c));Ma(m,U(p.ranges.slice(0,t).concat(Ca),t),{origin:"*mouse",scroll:false});a.scrollIntoView(da)}else{Ca=o;pa=Ca.anchor;Da=da;if(d!="single"){da=d=="double"?a.findWordAt(da):new s(W(da.line,0),Y(m,W(da.line+1,0)));if(sa(da.anchor,pa)>0){Da=da.head;pa=r(Ca.from(),da.anchor)}else{Da=da.anchor;
pa=R(Ca.to(),da.head)}}Ca=p.ranges.slice(0);Ca[t]=new s(Y(m,pa),Da);Ma(m,U(Ca,t),Wd)}}}function h(da){var Ca=++fa,pa=lc(a,da,true,d=="rect");if(pa)if(sa(pa,L)!=0){Sd(a);f(pa);var ya=$(k,m);if(pa.line>=ya.to||pa.line<ya.from)setTimeout(Pa(a,function(){fa==Ca&&h(da)}),150)}else{var ta=da.clientY<ea.top?-20:da.clientY>ea.bottom?20:0;ta&&setTimeout(Pa(a,function(){if(fa==Ca){k.scroller.scrollTop+=ta;h(da)}}),50)}}function i(da){fa=Infinity;Xa(da);$a(a);yb(document,"mousemove",na);yb(document,"mouseup",
ia);m.history.lastSelOrigin=null}var k=a.display,m=a.doc;Xa(b);var o,t,p=m.sel,D=p.ranges;if(e&&!b.shiftKey){t=m.sel.contains(c);o=t>-1?D[t]:new s(c,c)}else o=m.sel.primary();if(b.altKey){d="rect";e||(o=new s(c,c));c=lc(a,b,true,true);t=-1}else if(d=="double"){b=a.findWordAt(c);o=a.display.shift||m.extend?Ha(m,o,b.anchor,b.head):b}else if(d=="triple"){b=new s(W(c.line,0),Y(m,W(c.line+1,0)));o=a.display.shift||m.extend?Ha(m,o,b.anchor,b.head):b}else o=Ha(m,o,c);if(e)if(t==-1){t=D.length;Ma(m,U(D.concat([o]),
t),{scroll:false,origin:"*mouse"})}else if(D.length>1&&D[t].empty()&&d=="single"){Ma(m,U(D.slice(0,t).concat(D.slice(t+1)),0));p=m.sel}else Ba(m,t,o,Wd);else{t=0;Ma(m,new F([o],0),Wd);p=m.sel}var L=c,ea=k.wrapper.getBoundingClientRect(),fa=0,na=Pa(a,function(da){Fe(da)?h(da):i(da)}),ia=Pa(a,i);qa(document,"mousemove",na);qa(document,"mouseup",ia)}function Ud(a,b,c,d,e){try{var f=b.clientX,h=b.clientY}catch(i){return false}if(f>=Math.floor(a.display.gutters.getBoundingClientRect().right))return false;
d&&Xa(b);d=a.display;var k=d.lineDiv.getBoundingClientRect();if(h>k.bottom||!jb(a,c))return Xd(b);h-=k.top-d.viewOffset;for(k=0;k<a.options.gutters.length;++k){var m=d.gutters.childNodes[k];if(m&&m.getBoundingClientRect().right>=f){f=Qb(a.doc,h);e(a,c,a,f,a.options.gutters[k],b);return Xd(b)}}}function Ef(a){var b=this;if(!(lb(b,a)||Vb(b.display,a))){Xa(a);if(va)De=+new Date;var c=lc(b,a,true),d=a.dataTransfer.files;if(!(!c||kd(b)))if(d&&d.length&&window.FileReader&&window.File){var e=d.length,f=
Array(e),h=0;a=function(o,t){var p=new FileReader;p.onload=Pa(b,function(){f[t]=p.result;if(++h==e){c=Y(b.doc,c);var D={from:c,to:c,text:Tb(f.join("\n")),origin:"paste"};kc(b.doc,D);cc(b.doc,ja(c,Ib(D)))}});p.readAsText(o)};for(var i=0;i<e;++i)a(d[i],i)}else if(b.state.draggingText&&b.doc.sel.contains(c)>-1){b.state.draggingText(a);setTimeout(ob($a,b),20)}else try{if(f=a.dataTransfer.getData("Text")){if(b.state.draggingText&&!(ib?a.metaKey:a.ctrlKey))var k=b.listSelections();qb(b.doc,ja(c,c));if(k)for(i=
0;i<k.length;++i)od(b.doc,"",k[i].anchor,k[i].head,"drag");b.replaceSelection(f,"around","paste");$a(b)}}catch(m){}}}function uc(a,b){if(!(Math.abs(a.doc.scrollTop-b)<2)){a.doc.scrollTop=b;Gc||T(a,{top:b});if(a.display.scroller.scrollTop!=b)a.display.scroller.scrollTop=b;a.display.scrollbars.setScrollTop(b);Gc&&T(a);db(a,100)}}function ac(a,b,c){if(!(c?b==a.doc.scrollLeft:Math.abs(a.doc.scrollLeft-b)<2)){b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth);a.doc.scrollLeft=
b;Ga(a);if(a.display.scroller.scrollLeft!=b)a.display.scroller.scrollLeft=b;a.display.scrollbars.setScrollLeft(b)}}function ze(a,b){var c=He(b),d=c.x;c=c.y;var e=a.display,f=e.scroller;if(d&&f.scrollWidth>f.clientWidth||c&&f.scrollHeight>f.clientHeight){if(c&&ib&&Na){var h=b.target,i=e.view;a:for(;h!=f;h=h.parentNode)for(var k=0;k<i.length;k++)if(i[k].node==h){a.display.currentWheelTarget=h;break a}}if(d&&!Gc&&!mb&&bb!=null){c&&uc(a,Math.max(0,Math.min(f.scrollTop+c*bb,f.scrollHeight-f.clientHeight)));
ac(a,Math.max(0,Math.min(f.scrollLeft+d*bb,f.scrollWidth-f.clientWidth)));Xa(b);e.wheelStartX=null}else{if(c&&bb!=null){h=c*bb;i=a.doc.scrollTop;k=i+e.wrapper.clientHeight;if(h<0)i=Math.max(0,i+h-50);else k=Math.min(a.doc.height,k+h+50);T(a,{top:i,bottom:k})}if(pd<20)if(e.wheelStartX==null){e.wheelStartX=f.scrollLeft;e.wheelStartY=f.scrollTop;e.wheelDX=d;e.wheelDY=c;setTimeout(function(){if(e.wheelStartX!=null){var m=f.scrollLeft-e.wheelStartX,o=f.scrollTop-e.wheelStartY;m=o&&e.wheelDY&&o/e.wheelDY||
m&&e.wheelDX&&m/e.wheelDX;e.wheelStartX=e.wheelStartY=null;if(m){bb=(bb*pd+m)/(pd+1);++pd}}},200)}else{e.wheelDX+=d;e.wheelDY+=c}}}}function qd(a,b,c){if(typeof b=="string"){b=rd[b];if(!b)return false}if(a.display.pollingFast&&id(a))a.display.pollingFast=false;var d=a.display.shift,e=false;try{if(kd(a))a.state.suppressEdits=true;if(c)a.display.shift=false;e=b(a)!=Ie}finally{a.display.shift=d;a.state.suppressEdits=false}return e}function Kf(a,b,c){for(var d=0;d<a.state.keyMaps.length;d++){var e=Hc(b,
a.state.keyMaps[d],c,a);if(e)return e}return a.options.extraKeys&&Hc(b,a.options.extraKeys,c,a)||Hc(b,a.options.keyMap,c,a)}function sd(a,b,c,d){var e=a.state.keySeq;if(e){if(Lf(b))return"handled";Mf.set(50,function(){if(a.state.keySeq==e){a.state.keySeq=null;gb(a)}});b=e+" "+b}d=Kf(a,b,d);if(d=="multi")a.state.keySeq=b;d=="handled"&&Qa(a,"keyHandled",a,b,c);if(d=="handled"||d=="multi"){Xa(c);Fb(a)}if(e&&!d&&/\'$/.test(b)){Xa(c);return true}return!!d}function Je(a,b){var c=Nf(b,true);if(!c)return false;
return b.shiftKey&&!a.state.keySeq?sd(a,"Shift-"+c,b,function(d){return qd(a,d,true)})||sd(a,c,b,function(d){if(typeof d=="string"?/^go[A-Z]/.test(d):d.motion)return qd(a,d)}):sd(a,c,b,function(d){return qd(a,d)})}function Of(a,b,c){return sd(a,"'"+c+"'",b,function(d){return qd(a,d,true)})}function Be(a){Sd(this);if(!lb(this,a)){if(va&&Fa<11&&a.keyCode==27)a.returnValue=false;var b=a.keyCode;this.display.shift=b==16||a.shiftKey;var c=Je(this,a);if(mb){Yd=c?b:null;if(!c&&b==88&&!we&&(ib?a.metaKey:
a.ctrlKey))this.replaceSelection("",null,"cut")}b==18&&!/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)&&Pf(this)}}function Pf(a){function b(d){if(d.keyCode==18||!d.altKey){tc(c,"CodeMirror-crosshair");yb(document,"keyup",b);yb(document,"mouseover",b)}}var c=a.display.lineDiv;vc(c,"CodeMirror-crosshair");qa(document,"keyup",b);qa(document,"mouseover",b)}function Ae(a){if(a.keyCode==16)this.doc.sel.shift=false;lb(this,a)}function Ce(a){if(!(lb(this,a)||a.ctrlKey&&!a.altKey||ib&&a.metaKey)){var b=
a.keyCode,c=a.charCode;if(mb&&b==Yd){Yd=null;Xa(a)}else if(!((mb&&(!a.which||a.which<10)||Jd)&&Je(this,a))){b=String.fromCharCode(c==null?b:c);if(!Of(this,a,b)){if(va&&Fa>=9)this.display.inputHasSelection=null;jd(this)}}}}function Hd(a){if(a.options.readOnly!="nocursor"){if(!a.state.focused){Oa(a,"focus",a);a.state.focused=true;vc(a.display.wrapper,"CodeMirror-focused");if(!a.curOp&&a.display.selForContextMenu!=a.doc.sel){gb(a);Na&&setTimeout(ob(gb,a,true),0)}}hd(a);Fb(a)}}function Uc(a){if(a.state.focused){Oa(a,
"blur",a);a.state.focused=false;tc(a.display.wrapper,"CodeMirror-focused")}clearInterval(a.display.blinker);setTimeout(function(){if(!a.state.focused)a.display.shift=false},150)}function ye(a,b){function c(){if(e.input.selectionStart!=null){var o=a.somethingSelected(),t=e.input.value="\u200b"+(o?e.input.value:"");e.prevInput=o?"":"\u200b";e.input.selectionStart=1;e.input.selectionEnd=t.length;e.selForContextMenu=a.doc.sel}}function d(){e.contextMenuPending=false;e.inputDiv.style.position="relative";
e.input.style.cssText=i;if(va&&Fa<9)e.scrollbars.setScrollTop(e.scroller.scrollTop=h);hd(a);if(e.input.selectionStart!=null){if(!va||va&&Fa<9)c();var o=0,t=function(){if(e.selForContextMenu==a.doc.sel&&e.input.selectionStart==0)Pa(a,rd.selectAll)(a);else if(o++<10)e.detectingSelectAll=setTimeout(t,500);else gb(a)};e.detectingSelectAll=setTimeout(t,200)}}if(!lb(a,b,"contextmenu")){var e=a.display;if(!(Vb(e,b)||Qf(a,b))){var f=lc(a,b),h=e.scroller.scrollTop;if(!(!f||mb)){a.options.resetSelectionOnContextMenu&&
a.doc.sel.contains(f)==-1&&Pa(a,Ma)(a.doc,ja(f),Eb);var i=e.input.style.cssText;e.inputDiv.style.position="absolute";e.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(b.clientY-5)+"px; left: "+(b.clientX-5)+"px; z-index: 1000; background: "+(va?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(Na)var k=window.scrollY;$a(a);Na&&window.scrollTo(null,k);gb(a);if(!a.somethingSelected())e.input.value=
e.prevInput=" ";e.contextMenuPending=true;e.selForContextMenu=a.doc.sel;clearTimeout(e.detectingSelectAll);va&&Fa>=9&&c();if(Vd){Td(b);var m=function(){yb(window,"mouseup",m);setTimeout(d,20)};qa(window,"mouseup",m)}else setTimeout(d,50)}}}}function Qf(a,b){if(!jb(a,"gutterContextMenu"))return false;return Ud(a,b,"gutterContextMenu",false,Oa)}function Ke(a,b){if(sa(a,b.from)<0)return a;if(sa(a,b.to)<=0)return Ib(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;if(a.line==b.to.line)d+=
Ib(b).ch-b.to.ch;return W(c,d)}function Zd(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new s(Ke(e.anchor,b),Ke(e.head,b)))}return U(c,a.sel.primIndex)}function Le(a,b,c){return a.line==b.line?W(c.line,a.ch-b.ch+c.ch):W(c.line+(a.line-b.line),a.ch)}function Me(a,b,c){b={canceled:false,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){this.canceled=true}};if(c)b.update=function(d,e,f,h){if(d)this.from=Y(a,d);if(e)this.to=Y(a,e);if(f)this.text=f;if(h!==
undefined)this.origin=h};Oa(a,"beforeChange",a,b);a.cm&&Oa(a.cm,"beforeChange",a.cm,b);if(b.canceled)return null;return{from:b.from,to:b.to,text:b.text,origin:b.origin}}function kc(a,b,c){if(a.cm){if(!a.cm.curOp)return Pa(a.cm,kc)(a,b,c);if(a.cm.state.suppressEdits)return}if(jb(a,"beforeChange")||a.cm&&jb(a.cm,"beforeChange")){b=Me(a,b,true);if(!b)return}if(c=Ne&&!c&&Rf(a,b.from,b.to))for(var d=c.length-1;d>=0;--d)Oe(a,{from:c[d].from,to:c[d].to,text:d?[""]:b.text});else Oe(a,b)}function Oe(a,b){if(!(b.text.length==
1&&b.text[0]==""&&sa(b.from,b.to)==0)){var c=Zd(a,b);Pe(a,b,c,a.cm?a.cm.curOp.id:NaN);Ic(a,b,c,$d(a,b));var d=[];Wb(a,function(e,f){if(!f&&Ua(d,e.history)==-1){Qe(e.history,b);d.push(e.history)}Ic(e,b,null,$d(e,b))})}}function td(a,b,c){if(!(a.cm&&a.cm.state.suppressEdits)){for(var d=a.history,e,f=a.sel,h=b=="undo"?d.done:d.undone,i=b=="undo"?d.undone:d.done,k=0;k<h.length;k++){e=h[k];if(c?e.ranges&&!e.equals(a.sel):!e.ranges)break}if(k!=h.length){for(d.lastOrigin=d.lastSelOrigin=null;;){e=h.pop();
if(e.ranges){Wc(e,i);if(c&&!e.equals(a.sel)){Ma(a,e,{clearRedo:false});return}f=e}else break}c=[];Wc(f,i);i.push({changes:c,generation:d.generation});d.generation=e.generation||++d.maxGeneration;d=jb(a,"beforeChange")||a.cm&&jb(a.cm,"beforeChange");for(k=e.changes.length-1;k>=0;--k){var m=e.changes[k];m.origin=b;if(d&&!Me(a,m,false)){h.length=0;break}c.push(ae(a,m));f=k?Zd(a,m):Ia(h);Ic(a,m,f,Re(a,m));!k&&a.cm&&a.cm.scrollIntoView({from:m.from,to:Ib(m)});var o=[];Wb(a,function(t,p){if(!p&&Ua(o,t.history)==
-1){Qe(t.history,m);o.push(t.history)}Ic(t,m,null,Re(t,m))})}}}}function Se(a,b){if(b!=0){a.first+=b;a.sel=new F(Dc(a.sel.ranges,function(e){return new s(W(e.anchor.line+b,e.anchor.ch),W(e.head.line+b,e.head.ch))}),a.sel.primIndex);if(a.cm){ab(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;d<c.viewTo;d++)xb(a.cm,d,"gutter")}}}function Ic(a,b,c,d){if(a.cm&&!a.cm.curOp)return Pa(a.cm,Ic)(a,b,c,d);if(b.to.line<a.first)Se(a,b.text.length-1-(b.to.line-b.from.line));else if(!(b.from.line>
a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);Se(a,e);b={from:W(a.first,0),to:W(b.to.line+e,b.to.ch),text:[Ia(b.text)],origin:b.origin}}e=a.lastLine();if(b.to.line>e)b={from:b.from,to:W(e,ha(a,e).text.length),text:[b.text[0]],origin:b.origin};b.removed=Jc(a,b.from,b.to);c||(c=Zd(a,b));a.cm?Sf(a.cm,b,d):be(a,b,d);qb(a,c,Eb)}}function Sf(a,b,c){var d=a.doc,e=a.display,f=b.from,h=b.to,i=false,k=f.line;if(!a.options.lineWrapping){k=La(tb(ha(d,f.line)));d.iter(k,h.line+
1,function(m){if(m==e.maxLine)return i=true})}d.sel.contains(b.from,b.to)>-1&&te(a);be(d,b,c,u(a));if(!a.options.lineWrapping){d.iter(k,f.line+b.text.length,function(m){var o=M(m);if(o>e.maxLineLength){e.maxLine=m;e.maxLineLength=o;e.maxLineChanged=true;i=false}});if(i)a.curOp.updateMaxLine=true}d.frontier=Math.min(d.frontier,f.line);db(a,400);c=b.text.length-(h.line-f.line)-1;if(b.full)ab(a);else f.line==h.line&&b.text.length==1&&!Te(a.doc,b)?xb(a,f.line,"text"):ab(a,f.line,h.line+1,c);c=jb(a,"changes");
if((d=jb(a,"change"))||c){b={from:f,to:h,text:b.text,removed:b.removed,origin:b.origin};d&&Qa(a,"change",a,b);if(c)(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b)}a.display.selForContextMenu=null}function od(a,b,c,d,e){d||(d=c);if(sa(d,c)<0){var f=d;d=c;c=f}if(typeof b=="string")b=Tb(b);kc(a,{from:c,to:d,text:b,origin:e})}function fd(a,b,c,d,e){var f=a.display,h=vb(a.display);if(c<0)c=0;var i=a.curOp&&a.curOp.scrollTop!=null?a.curOp.scrollTop:f.scroller.scrollTop,k=Db(a),m={};if(e-c>k)e=c+k;
var o=a.doc.height+(f.mover.offsetHeight-f.lineSpace.offsetHeight),t=c<h;h=e>o-h;if(c<i)m.scrollTop=t?0:c;else if(e>i+k){c=Math.min(c,(h?o:e)-k);if(c!=i)m.scrollTop=c}i=a.curOp&&a.curOp.scrollLeft!=null?a.curOp.scrollLeft:f.scroller.scrollLeft;a=hb(a)-(a.options.fixedGutter?f.gutters.offsetWidth:0);if(f=d-b>a)d=b+a;if(b<10)m.scrollLeft=0;else if(b<i)m.scrollLeft=Math.max(0,b-(f?0:10));else if(d>a+i-3)m.scrollLeft=d+(f?0:10)-a;return m}function ce(a,b,c){if(b!=null||c!=null)ud(a);if(b!=null)a.curOp.scrollLeft=
(a.curOp.scrollLeft==null?a.doc.scrollLeft:a.curOp.scrollLeft)+b;if(c!=null)a.curOp.scrollTop=(a.curOp.scrollTop==null?a.doc.scrollTop:a.curOp.scrollTop)+c}function dc(a){ud(a);var b=a.getCursor(),c=b,d=b;if(!a.options.lineWrapping){c=b.ch?W(b.line,b.ch-1):b;d=W(b.line,b.ch+1)}a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:true}}function ud(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=K(a,b.from),d=K(a,b.to);b=fd(a,Math.min(c.left,d.left),Math.min(c.top,
d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(b.scrollLeft,b.scrollTop)}}function Ec(a,b,c,d){var e=a.doc,f;if(c==null)c="add";if(c=="smart")if(e.mode.indent)f=fb(a,b);else c="prev";var h=a.options.tabSize,i=ha(e,b),k=kb(i.text,null,h);if(i.stateAfter)i.stateAfter=null;var m=i.text.match(/^\s*/)[0],o;if(!d&&!/\S/.test(i.text)){o=0;c="not"}else if(c=="smart"){o=e.mode.indent(f,i.text.slice(m.length),i.text);if(o==Ie||o>150){if(!d)return;c="prev"}}if(c==
"prev")o=b>e.first?kb(ha(e,b-1).text,null,h):0;else if(c=="add")o=k+a.options.indentUnit;else if(c=="subtract")o=k-a.options.indentUnit;else if(typeof c=="number")o=k+c;o=Math.max(0,o);c="";d=0;if(a.options.indentWithTabs)for(a=Math.floor(o/h);a;--a){d+=h;c+="\t"}if(d<o)c+=Ue(o-d);if(c!=m)od(e,c,W(b,0),W(b,m.length),"+input");else for(a=0;a<e.sel.ranges.length;a++){h=e.sel.ranges[a];if(h.head.line==b&&h.head.ch<m.length){d=W(b,m.length);Ba(e,a,new s(d,d));break}}i.stateAfter=null}function vd(a,b,
c,d){var e=b,f=b;if(typeof b=="number")f=ha(a,Math.max(a.first,Math.min(b,a.first+a.size-1)));else e=La(b);if(e==null)return null;d(f,e)&&a.cm&&xb(a.cm,e,c);return f}function mc(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&sa(f.from,Ia(d).to)<=0;){var h=d.pop();if(sa(h.from,f.from)<0){f.from=h.from;break}}d.push(f)}Gb(a,function(){for(var i=d.length-1;i>=0;i--)od(a.doc,"",d[i].from,d[i].to,"+delete");dc(a)})}function de(a,b,c,d,e){function f(L){var ea=(e?Rd:
Ve)(m,i,c,true);if(ea==null){if(L=!L){L=h+c;if(L<a.first||L>=a.first+a.size)L=o=false;else{h=L;L=m=ha(a,L)}}if(L)i=e?(c<0?ed:dd)(m):c<0?m.text.length:0;else return o=false}else i=ea;return true}var h=b.line,i=b.ch,k=c,m=ha(a,h),o=true;if(d=="char")f();else if(d=="column")f(true);else if(d=="word"||d=="group"){var t=null;d=d=="group";b=a.cm&&a.cm.getHelper(b,"wordChars");for(var p=true;;p=false){if(c<0&&!f(!p))break;var D=m.text.charAt(i)||"\n";D=wd(D,b)?"w":d&&D=="\n"?"n":!d||/\s/.test(D)?null:"p";
if(d&&!p&&!D)D="s";if(t&&t!=D){if(c<0){c=1;f()}break}if(D)t=D;if(c>0&&!f(!p))break}}k=ec(a,W(h,i),k,true);if(!o)k.hitSide=true;return k}function We(a,b,c,d){var e=a.doc,f=b.left,h;if(d=="page")h=b.top+c*(Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight)-(c<0?1.5:0.5)*vb(a.display));else if(d=="line")h=c>0?b.bottom+3:b.top-3;for(;;){var i=za(a,f,h);if(!i.outside)break;if(c<0?h<=0:h>=e.height){i.hitSide=true;break}h+=c*5}return i}function oa(a,b,c,d){j.defaults[a]=
b;if(c)$b[a]=d?function(e,f,h){h!=ne&&c(e,f,h)}:c}function Tf(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var c,d,e,f,h=0;h<b.length-1;h++){var i=b[h];if(/^(cmd|meta|m)$/i.test(i))f=true;else if(/^a(lt)?$/i.test(i))c=true;else if(/^(c|ctrl|control)$/i.test(i))d=true;else if(/^s(hift)$/i.test(i))e=true;else throw Error("Unrecognized modifier name: "+i);}if(c)a="Alt-"+a;if(d)a="Ctrl-"+a;if(f)a="Cmd-"+a;if(e)a="Shift-"+a;return a}function xd(a){return typeof a=="string"?Jb[a]:a}function nc(a,b,c,
d,e){if(d&&d.shared)return Uf(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return Pa(a.cm,nc)(a,b,c,d,e);var f=new Xb(a,e);e=sa(b,c);d&&zb(d,f,false);if(e>0||e==0&&f.clearWhenEmpty!==false)return f;if(f.replacedWith){f.collapsed=true;f.widgetNode=ga("span",[f.replacedWith],"CodeMirror-widget");d.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true");if(d.insertLeft)f.widgetNode.insertLeft=true}if(f.collapsed){if(Xe(a,b.line,b,c,f)||b.line!=c.line&&Xe(a,c.line,b,c,f))throw Error("Inserting collapsed marker partially overlapping an existing one");
Cb=true}f.addToHistory&&Pe(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var h=b.line,i=a.cm,k;a.iter(h,c.line+1,function(m){if(i&&f.collapsed&&!i.options.lineWrapping&&tb(m)==i.display.maxLine)k=true;f.collapsed&&h!=b.line&&pb(m,0);var o=new yd(f,h==b.line?b.ch:null,h==c.line?c.ch:null);m.markedSpans=m.markedSpans?m.markedSpans.concat([o]):[o];o.marker.attachLine(m);++h});f.collapsed&&a.iter(b.line,c.line+1,function(m){Nb(a,m)&&pb(m,0)});f.clearOnEnter&&qa(f,"beforeCursorEnter",function(){f.clear()});
if(f.readOnly){Ne=true;if(a.history.done.length||a.history.undone.length)a.clearHistory()}if(f.collapsed){f.id=++Vf;f.atomic=true}if(i){if(k)i.curOp.updateMaxLine=true;if(f.collapsed)ab(i,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle||f.css)for(d=b.line;d<=c.line;d++)xb(i,d,"text");f.atomic&&Zc(i.doc);Qa(i,"markerAdded",i,f)}return f}function Uf(a,b,c,d,e){d=zb(d);d.shared=false;var f=[nc(a,b,c,d,e)],h=f[0],i=d.widgetNode;Wb(a,function(k){if(i)d.widgetNode=i.cloneNode(true);
f.push(nc(k,Y(k,b),Y(k,c),d,e));for(var m=0;m<k.linked.length;++m)if(k.linked[m].isParent)return;h=Ia(f)});return new zd(f,h)}function Ye(a){return a.findMarks(W(a.first,0),a.clipPos(W(a.lastLine())),function(b){return b.parent})}function Wf(a){for(var b=0;b<a.length;b++){var c=a[b],d=[c.primary.doc];Wb(c.primary.doc,function(h){d.push(h)});for(var e=0;e<c.markers.length;e++){var f=c.markers[e];if(Ua(d,f.doc)==-1){f.parent=null;c.markers.splice(e--,1)}}}}function yd(a,b,c){this.marker=a;this.from=
b;this.to=c}function Kc(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function $d(a,b){if(b.full)return null;var c=Ka(a,b.from.line)&&ha(a,b.from.line).markedSpans,d=Ka(a,b.to.line)&&ha(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,h=sa(b.from,b.to)==0;if(c)for(var i=0,k;i<c.length;++i){var m=c[i],o=m.marker;if(m.from==null||(o.inclusiveLeft?m.from<=e:m.from<e)||m.from==e&&o.type=="bookmark"&&(!h||!m.marker.insertLeft)){var t=m.to==null||(o.inclusiveRight?
m.to>=e:m.to>e);(k||(k=[])).push(new yd(o,m.from,t?null:m.to))}}c=k;if(d){i=0;for(var p;i<d.length;++i){k=d[i];m=k.marker;if(k.to==null||(m.inclusiveRight?k.to>=f:k.to>f)||k.from==f&&m.type=="bookmark"&&(!h||k.marker.insertLeft)){o=k.from==null||(m.inclusiveLeft?k.from<=f:k.from<f);(p||(p=[])).push(new yd(m,o?null:k.from-f,k.to==null?null:k.to-f))}}}d=p;h=b.text.length==1;p=Ia(b.text).length+(h?e:0);if(c)for(f=0;f<c.length;++f){i=c[f];if(i.to==null)if(k=Kc(d,i.marker)){if(h)i.to=k.to==null?null:k.to+
p}else i.to=e}if(d)for(f=0;f<d.length;++f){i=d[f];if(i.to!=null)i.to+=p;if(i.from==null){k=Kc(c,i.marker);if(!k){i.from=p;if(h)(c||(c=[])).push(i)}}else{i.from+=p;if(h)(c||(c=[])).push(i)}}if(c)c=Ze(c);if(d&&d!=c)d=Ze(d);e=[c];if(!h){h=b.text.length-2;var D;if(h>0&&c)for(f=0;f<c.length;++f)if(c[f].to==null)(D||(D=[])).push(new yd(c[f].marker,null,null));for(f=0;f<h;++f)e.push(D);e.push(d)}return e}function Ze(a){for(var b=0;b<a.length;++b){var c=a[b];c.from!=null&&c.from==c.to&&c.marker.clearWhenEmpty!==
false&&a.splice(b--,1)}if(!a.length)return null;return a}function Re(a,b){var c;if(c=b["spans_"+a.id]){for(var d=0,e=[];d<b.text.length;++d)e.push(Xf(c[d]));c=e}else c=null;d=$d(a,b);if(!c)return d;if(!d)return c;for(e=0;e<c.length;++e){var f=c[e],h=d[e];if(f&&h){var i=0;a:for(;i<h.length;++i){for(var k=h[i],m=0;m<f.length;++m)if(f[m].marker==k.marker)continue a;f.push(k)}}else if(h)c[e]=h}return c}function Rf(a,b,c){var d=null;a.iter(b.line,c.line+1,function(o){if(o.markedSpans)for(var t=0;t<o.markedSpans.length;++t){var p=
o.markedSpans[t].marker;if(p.readOnly&&(!d||Ua(d,p)==-1))(d||(d=[])).push(p)}});if(!d)return null;a=[{from:b,to:c}];for(b=0;b<d.length;++b){c=d[b];for(var e=c.find(0),f=0;f<a.length;++f){var h=a[f];if(!(sa(h.to,e.from)<0||sa(h.from,e.to)>0)){var i=[f,1],k=sa(h.from,e.from),m=sa(h.to,e.to);if(k<0||!c.inclusiveLeft&&!k)i.push({from:h.from,to:e.from});if(m>0||!c.inclusiveRight&&!m)i.push({from:e.to,to:h.to});a.splice.apply(a,i);f+=i.length-1}}}return a}function $e(a){var b=a.markedSpans;if(b){for(var c=
0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function af(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function bf(a,b){var c=a.lines.length-b.lines.length;if(c!=0)return c;c=a.find();var d=b.find(),e=sa(c.from,d.from)||(a.inclusiveLeft?-1:0)-(b.inclusiveLeft?-1:0);if(e)return-e;if(c=sa(c.to,d.to)||(a.inclusiveRight?1:0)-(b.inclusiveRight?1:0))return c;return b.id-a.id}function Pb(a,b){var c=Cb&&a.markedSpans,d;if(c)for(var e,f=0;f<c.length;++f){e=
c[f];if(e.marker.collapsed&&(b?e.from:e.to)==null&&(!d||bf(d,e.marker)<0))d=e.marker}return d}function Xe(a,b,c,d,e){a=ha(a,b);if(a=Cb&&a.markedSpans)for(b=0;b<a.length;++b){var f=a[b];if(f.marker.collapsed){var h=f.marker.find(0),i=sa(h.from,c)||(f.marker.inclusiveLeft?-1:0)-(e.inclusiveLeft?-1:0),k=sa(h.to,d)||(f.marker.inclusiveRight?1:0)-(e.inclusiveRight?1:0);if(!(i>=0&&k<=0||i<=0&&k>=0))if(i<=0&&(sa(h.to,c)>0||f.marker.inclusiveRight&&e.inclusiveLeft)||i>=0&&(sa(h.from,d)<0||f.marker.inclusiveLeft&&
e.inclusiveRight))return true}}}function tb(a){for(var b;b=Pb(a,true);)a=b.find(-1,true).line;return a}function Kd(a,b){var c=ha(a,b),d=tb(c);if(c==d)return b;return La(d)}function qe(a,b){if(b>a.lastLine())return b;var c=ha(a,b),d;if(!Nb(a,c))return b;for(;d=Pb(c,false);)c=d.find(1,true).line;return La(c)+1}function Nb(a,b){var c=Cb&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e){d=c[e];if(d.marker.collapsed){if(d.from==null)return true;if(!d.marker.widgetNode)if(d.from==0&&d.marker.inclusiveLeft&&
ee(a,b,d))return true}}}function ee(a,b,c){if(c.to==null){b=c.marker.find(1,true);return ee(a,b.line,Kc(b.line.markedSpans,c.marker))}if(c.marker.inclusiveRight&&c.to==b.text.length)return true;for(var d,e=0;e<b.markedSpans.length;++e){d=b.markedSpans[e];if(d.marker.collapsed&&!d.marker.widgetNode&&d.from==c.to&&(d.to==null||d.to!=c.from)&&(d.marker.inclusiveLeft||c.marker.inclusiveRight)&&ee(a,b,d))return true}}function cf(a,b,c){if(wb(b)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop))ce(a,null,c)}
function Bc(a){if(a.height!=null)return a.height;var b;a:{var c=document.body,d=a.node;if(c.contains)b=c.contains(d);else for(;d=d.parentNode;)if(d==c){b=true;break a}}if(!b){b="position: relative;";if(a.coverGutter)b+="margin-left: -"+a.cm.display.gutters.offsetWidth+"px;";if(a.noHScroll)b+="width: "+a.cm.display.wrapper.clientWidth+"px;";rb(a.cm.display.measure,ga("div",[a.node],null,b))}return a.height=a.node.offsetHeight}function Yf(a,b,c,d){var e=new Ad(a,c,d);if(e.noHScroll)a.display.alignWidgets=
true;vd(a.doc,b,"widget",function(f){var h=f.widgets||(f.widgets=[]);e.insertAt==null?h.push(e):h.splice(Math.min(h.length-1,Math.max(0,e.insertAt)),0,e);e.line=f;if(!Nb(a.doc,f)){h=wb(f)<a.doc.scrollTop;pb(f,f.height+Bc(e));h&&ce(a,null,e.height);a.curOp.forceUpdate=true}return true});return e}function df(a,b){if(a)for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";if(b[d]==null)b[d]=c[2];else RegExp("(?:^|s)"+
c[2]+"(?:$|s)").test(b[d])||(b[d]+=" "+c[2])}return a}function ef(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode){var c=j.innerMode(a,b);if(c.mode.blankLine)return c.mode.blankLine(c.state)}}function fe(a,b,c,d){for(var e=0;e<10;e++){if(d)d[0]=j.innerMode(a,c).mode;var f=a.token(b,c);if(b.pos>b.start)return f}throw Error("Mode "+a.name+" failed to advance stream.");}function ff(a,b,c,d){function e(p){return{start:o.start,end:o.pos,string:o.current(),type:i||null,state:p?gc(f.mode,m):m}}
var f=a.doc,h=f.mode,i;b=Y(f,b);var k=ha(f,b.line),m=fb(a,b.line,c),o=new Bd(k.text,a.options.tabSize),t;if(d)t=[];for(;(d||o.pos<b.ch)&&!o.eol();){o.start=o.pos;i=fe(h,o,m);d&&t.push(e(true))}return d?t:e()}function gf(a,b,c,d,e,f,h){var i=c.flattenSpans;if(i==null)i=a.options.flattenSpans;var k=0,m=null,o=new Bd(b,a.options.tabSize),t,p=a.options.addModeClass&&[null];for(b==""&&df(ef(c,d),f);!o.eol();){if(o.pos>a.options.maxHighlightLength){i=false;h&&Md(a,b,d,o.pos);o.pos=b.length;t=null}else t=
df(fe(c,o,d,p),f);if(p){var D=p[0].name;if(D)t="m-"+(t?D+" "+t:D)}if(!i||m!=t){for(;k<o.start;){k=Math.min(o.start,k+5E4);e(k,m)}m=t}o.start=o.pos}for(;k<o.pos;){a=Math.min(o.pos,k+5E4);e(a,m);k=a}}function ue(a,b,c,d){var e=[a.state.modeGen],f={};gf(a,b.text,a.doc.mode,c,function(m,o){e.push(m,o)},f,d);for(c=0;c<a.state.overlays.length;++c){var h=a.state.overlays[c],i=1,k=0;gf(a,b.text,h.mode,true,function(m,o){for(var t=i;k<m;){var p=e[i];p>m&&e.splice(i,1,m,e[i+1],p);i+=2;k=Math.min(m,p)}if(o)if(h.opaque){e.splice(t,
i-t,m,"cm-overlay "+o);i=t+2}else for(;t<i;t+=2){p=e[t+1];e[t+1]=(p?p+" ":"")+"cm-overlay "+o}},f)}return{styles:e,classes:f.bgClass||f.textClass?f:null}}function hf(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=ue(a,b,b.stateAfter=fb(a,La(b)));b.styles=d.styles;if(d.classes)b.styleClasses=d.classes;else if(b.styleClasses)b.styleClasses=null;c===a.doc.frontier&&a.doc.frontier++}return b.styles}function Md(a,b,c,d){var e=a.doc.mode,f=new Bd(b,a.options.tabSize);f.start=f.pos=d||0;for(b==
""&&ef(e,c);!f.eol()&&f.pos<=a.options.maxHighlightLength;){fe(e,f,c);f.start=f.pos}}function jf(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?Zf:$f;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function re(a,b){var c=ga("span",null,null,Na?"padding-right: .1px":null);c={pre:ga("pre",[c]),content:c,col:0,pos:0,cm:a};b.measure={};for(var d=0;d<=(b.rest?b.rest.length:0);d++){var e=d?b.rest[d-1]:b.line,f;c.pos=0;c.addToken=ag;if((va||Na)&&a.getOption("lineWrapping"))c.addToken=bg(c.addToken);
var h;if(ge!=null)h=ge;else{h=rb(a.display.measure,document.createTextNode("A\u062eA"));var i=ic(h,0,1).getBoundingClientRect();h=!i||i.left==i.right?false:ge=ic(h,1,2).getBoundingClientRect().right-i.right<3}if(h&&(f=sb(e)))c.addToken=cg(c.addToken,f);c.map=[];i=b!=a.display.externalMeasured&&La(e);h=c;i=hf(a,e,i);var k=e.markedSpans,m=e.text,o=0;if(k){var t=m.length,p=0;nb=1;for(var D="",L=void 0,ea=void 0,fa=0,na=void 0,ia=void 0,da=void 0,Ca=void 0,pa=void 0;;){if(fa==p){na=ia=da=Ca=ea="";pa=
null;fa=Infinity;for(var ya=[],ta=0;ta<k.length;++ta){var Da=k[ta],Ta=Da.marker;if(Da.from<=p&&(Da.to==null||Da.to>p)){if(Da.to!=null&&fa>Da.to){fa=Da.to;ia=""}if(Ta.className)na+=" "+Ta.className;if(Ta.css)ea=Ta.css;if(Ta.startStyle&&Da.from==p)da+=" "+Ta.startStyle;if(Ta.endStyle&&Da.to==fa)ia+=" "+Ta.endStyle;if(Ta.title&&!Ca)Ca=Ta.title;if(Ta.collapsed&&(!pa||bf(pa.marker,Ta)<0))pa=Da}else if(Da.from>p&&fa>Da.from)fa=Da.from;Ta.type=="bookmark"&&Da.from==p&&Ta.widgetNode&&ya.push(Ta)}if(pa&&(pa.from||
0)==p){kf(h,(pa.to==null?t+1:pa.to)-p,pa.marker,pa.from==null);if(pa.to==null)break}if(!pa&&ya.length)for(ta=0;ta<ya.length;++ta)kf(h,0,ya[ta])}if(p>=t)break;for(ya=Math.min(t,fa);;){if(D){ta=p+D.length;if(!pa){Da=ta>ya?D.slice(0,ya-p):D;h.addToken(h,Da,L?L+na:na,da,p+Da.length==fa?ia:"",Ca,ea)}if(ta>=ya){D=D.slice(ya-p);p=ya;break}p=ta;da=""}D=m.slice(o,o=i[nb++]);L=jf(i[nb++],h.cm.options)}}}else for(var nb=1;nb<i.length;nb+=2)h.addToken(h,m.slice(o,o=i[nb]),jf(i[nb+1],h.cm.options));if(e.styleClasses){if(e.styleClasses.bgClass)c.bgClass=
he(e.styleClasses.bgClass,c.bgClass||"");if(e.styleClasses.textClass)c.textClass=he(e.styleClasses.textClass,c.textClass||"")}c.map.length==0&&c.map.push(0,0,c.content.appendChild(dg(a.display.measure)));if(d==0){b.measure.map=c.map;b.measure.cache={}}else{(b.measure.maps||(b.measure.maps=[])).push(c.map);(b.measure.caches||(b.measure.caches=[])).push({})}}if(Na&&/\bcm-tab\b/.test(c.content.lastChild.className))c.content.className="cm-tab-wrap-hack";Oa(a,"renderLine",a,b.line,c.pre);if(c.pre.className)c.textClass=
he(c.pre.className,c.textClass||"");return c}function ag(a,b,c,d,e,f,h){if(b){var i=a.cm.options.specialChars,k=false;if(i.test(b)){D=document.createDocumentFragment();for(var m=0;;){i.lastIndex=m;var o=i.exec(b),t=o?o.index-m:b.length-m;if(t){var p=document.createTextNode(b.slice(m,m+t));va&&Fa<9?D.appendChild(ga("span",[p])):D.appendChild(p);a.map.push(a.pos,a.pos+t,p);a.col+=t;a.pos+=t}if(!o)break;m+=t+1;if(o[0]=="\t"){p=a.cm.options.tabSize;o=p-a.col%p;p=D.appendChild(ga("span",Ue(o),"cm-tab"));
a.col+=o}else{p=a.cm.options.specialCharPlaceholder(o[0]);va&&Fa<9?D.appendChild(ga("span",[p])):D.appendChild(p);a.col+=1}a.map.push(a.pos,a.pos+1,p);a.pos++}}else{a.col+=b.length;var D=document.createTextNode(b);a.map.push(a.pos,a.pos+b.length,D);if(va&&Fa<9)k=true;a.pos+=b.length}if(c||d||e||k||h){b=c||"";if(d)b+=d;if(e)b+=e;d=ga("span",[D],b,h);if(f)d.title=f;return a.content.appendChild(d)}a.content.appendChild(D)}}function bg(a){function b(c){for(var d=" ",e=0;e<c.length-2;++e)d+=e%2?" ":"\u00a0";
d+=" ";return d}return function(c,d,e,f,h,i){a(c,d.replace(/ {3,}/g,b),e,f,h,i)}}function cg(a,b){return function(c,d,e,f,h,i){e=e?e+" cm-force-border":"cm-force-border";for(var k=c.pos,m=k+d.length;;){for(var o=0;o<b.length;o++){var t=b[o];if(t.to>k&&t.from<=k)break}if(t.to>=m)return a(c,d,e,f,h,i);a(c,d.slice(0,t.to-k),e,f,null,i);f=null;d=d.slice(t.to-k);k=t.to}}}function kf(a,b,c,d){if(c=!d&&c.widgetNode){a.map.push(a.pos,a.pos+b,c);a.content.appendChild(c)}a.pos+=b}function Te(a,b){return b.from.ch==
0&&b.to.ch==0&&Ia(b.text)==""&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function be(a,b,c,d){function e(fa){return c?c[fa]:null}function f(fa,na,ia){var da=d;fa.text=na;if(fa.stateAfter)fa.stateAfter=null;if(fa.styles)fa.styles=null;if(fa.order!=null)fa.order=null;$e(fa);af(fa,ia);na=da?da(fa):1;na!=fa.height&&pb(fa,na);Qa(fa,"change",fa,b)}function h(fa,na){for(var ia=fa,da=[];ia<na;++ia)da.push(new Lc(m[ia],e(ia),d));return da}var i=b.from,k=b.to,m=b.text,o=ha(a,i.line),t=ha(a,k.line),p=Ia(m),
D=e(m.length-1),L=k.line-i.line;if(b.full){a.insert(0,h(0,m.length));a.remove(m.length,a.size-m.length)}else if(Te(a,b)){var ea=h(0,m.length-1);f(t,t.text,D);L&&a.remove(i.line,L);ea.length&&a.insert(i.line,ea)}else if(o==t)if(m.length==1)f(o,o.text.slice(0,i.ch)+p+o.text.slice(k.ch),D);else{ea=h(1,m.length-1);ea.push(new Lc(p+o.text.slice(k.ch),D,d));f(o,o.text.slice(0,i.ch)+m[0],e(0));a.insert(i.line+1,ea)}else if(m.length==1){f(o,o.text.slice(0,i.ch)+m[0]+t.text.slice(k.ch),e(0));a.remove(i.line+
1,L)}else{f(o,o.text.slice(0,i.ch)+m[0],e(0));f(t,p+t.text.slice(k.ch),D);ea=h(1,m.length-1);L>1&&a.remove(i.line+1,L-1);a.insert(i.line+1,ea)}Qa(a,"change",a,b)}function Mc(a){this.lines=a;this.parent=null;for(var b=0,c=0;b<a.length;++b){a[b].parent=this;c+=a[b].height}this.height=c}function Nc(a){this.children=a;for(var b=0,c=0,d=0;d<a.length;++d){var e=a[d];b+=e.chunkSize();c+=e.height;e.parent=this}this.size=b;this.height=c;this.parent=null}function Wb(a,b,c){function d(e,f,h){if(e.linked)for(var i=
0;i<e.linked.length;++i){var k=e.linked[i];if(k.doc!=f){var m=h&&k.sharedHist;if(!(c&&!m)){b(k.doc,m);d(k.doc,e,m)}}}}d(a,null,true)}function me(a,b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;g(a);X(a);a.options.lineWrapping||x(a);a.options.mode=b.modeOption;ab(a)}function ha(a,b){b-=a.first;if(b<0||b>=a.size)throw Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(b<f){c=e;break}b-=
f}return c.lines[b]}function Jc(a,b,c){var d=[],e=b.line;a.iter(b.line,c.line+1,function(f){f=f.text;if(e==c.line)f=f.slice(0,c.ch);if(e==b.line)f=f.slice(b.ch);d.push(f);++e});return d}function ie(a,b,c){var d=[];a.iter(b,c,function(e){d.push(e.text)});return d}function pb(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function La(a){if(a.parent==null)return null;var b=a.parent;a=Ua(b.lines,a);for(var c=b.parent;c;b=c,c=c.parent)for(var d=0;;++d){if(c.children[d]==b)break;a+=c.children[d].chunkSize()}return a+
b.first}function Qb(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],f=e.height;if(b<f){a=e;continue a}b-=f;c+=e.chunkSize()}return c}while(!a.lines);for(d=0;d<a.lines.length;++d){e=a.lines[d].height;if(b<e)break;b-=e}return c+d}function wb(a){a=tb(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;else b+=e.height}for(a=c.parent;a;c=a,a=c.parent)for(d=0;d<a.children.length;++d){e=a.children[d];if(e==c)break;else b+=e.height}return b}
function sb(a){var b=a.order;if(b==null)b=a.order=eg(a.text);return b}function Cd(a){this.done=[];this.undone=[];this.undoDepth=Infinity;this.lastModTime=this.lastSelTime=0;this.lastOrigin=this.lastSelOrigin=this.lastOp=this.lastSelOp=null;this.generation=this.maxGeneration=a||1}function ae(a,b){var c={from:W(b.from.line,b.from.ch),to:Ib(b),text:Jc(a,b.from,b.to)};lf(a,c,b.from.line,b.to.line+1);Wb(a,function(d){lf(d,c,b.from.line,b.to.line+1)},true);return c}function se(a){for(;a.length;)if(Ia(a).ranges)a.pop();
else break}function Pe(a,b,c,d){var e=a.history;e.undone.length=0;var f=+new Date,h,i;if(i=e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&(b.origin.charAt(0)=="+"&&a.cm&&e.lastModTime>f-a.cm.options.historyEventDelay||b.origin.charAt(0)=="*")){var k;if(e.lastOp==d){se(e.done);k=Ia(e.done)}else if(e.done.length&&!Ia(e.done).ranges)k=Ia(e.done);else if(e.done.length>1&&!e.done[e.done.length-2].ranges){e.done.pop();k=Ia(e.done)}i=h=k}if(i){var m=Ia(h.changes);if(sa(b.from,b.to)==0&&sa(b.from,m.to)==
0)m.to=Ib(b);else h.changes.push(ae(a,b))}else{h=Ia(e.done);if(!h||!h.ranges)Wc(a.sel,e.done);h={changes:[ae(a,b)],generation:e.generation};for(e.done.push(h);e.done.length>e.undoDepth;){e.done.shift();e.done[0].ranges||e.done.shift()}}e.done.push(c);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime=f;e.lastOp=e.lastSelOp=d;e.lastOrigin=e.lastSelOrigin=b.origin;m||Oa(a,"historyAdded")}function Wc(a,b){var c=Ia(b);c&&c.ranges&&c.equals(a)||b.push(a)}function lf(a,b,c,d){var e=b["spans_"+a.id],
f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(h){if(h.markedSpans)(e||(e=b["spans_"+a.id]={}))[f]=h.markedSpans;++f})}function Xf(a){if(!a)return null;for(var b=0,c;b<a.length;++b)if(a[b].marker.explicitlyCleared)c||(c=a.slice(0,b));else c&&c.push(a[b]);return!c?a:c.length?c:null}function oc(a,b,c){for(var d=0,e=[];d<a.length;++d){var f=a[d];if(f.ranges)e.push(c?F.prototype.deepCopy.call(f):f);else{f=f.changes;var h=[];e.push({changes:h});for(var i=0;i<f.length;++i){var k=f[i],
m;h.push({from:k.from,to:k.to,text:k.text});if(b)for(var o in k)if(m=o.match(/^spans_(\d+)$/))if(Ua(b,Number(m[1]))>-1){Ia(h)[o]=k[o];delete k[o]}}}}return e}function mf(a,b,c,d){if(c<a.line)a.line+=d;else if(b<a.line){a.line=b;a.ch=0}}function nf(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],h=true;if(f.ranges){if(!f.copied){f=a[e]=f.deepCopy();f.copied=true}for(var i=0;i<f.ranges.length;i++){mf(f.ranges[i].anchor,b,c,d);mf(f.ranges[i].head,b,c,d)}}else{for(i=0;i<f.changes.length;++i){var k=f.changes[i];
if(c<k.from.line){k.from=W(k.from.line+d,k.from.ch);k.to=W(k.to.line+d,k.to.ch)}else if(b<=k.to.line){h=false;break}}if(!h){a.splice(0,e+1);e=0}}}}function Qe(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;nf(a.done,c,d,e);nf(a.undone,c,d,e)}function Xd(a){return a.defaultPrevented!=null?a.defaultPrevented:a.returnValue==false}function Fe(a){var b=a.which;if(b==null)if(a.button&1)b=1;else if(a.button&2)b=3;else if(a.button&4)b=2;if(ib&&a.ctrlKey&&b==1)b=3;return b}function Qa(a,b){function c(i){return function(){i.apply(null,
e)}}var d=a._handlers&&a._handlers[b];if(d){var e=Array.prototype.slice.call(arguments,2),f;if(jc)f=jc.delayedCallbacks;else if(Oc)f=Oc;else{f=Oc=[];setTimeout(fg,0)}for(var h=0;h<d.length;++h)f.push(c(d[h]))}}function fg(){var a=Oc;Oc=null;for(var b=0;b<a.length;++b)a[b]()}function lb(a,b,c){if(typeof b=="string")b={type:b,preventDefault:function(){this.defaultPrevented=true}};Oa(a,c||b.type,a,b);return Xd(b)||b.codemirrorIgnore}function te(a){var b=a._handlers&&a._handlers.cursorActivity;if(b){a=
a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]);for(var c=0;c<b.length;++c)Ua(a,b[c])==-1&&a.push(b[c])}}function jb(a,b){var c=a._handlers&&a._handlers[b];return c&&c.length>0}function pc(a){a.prototype.on=function(b,c){qa(this,b,c)};a.prototype.off=function(b,c){yb(this,b,c)}}function Tc(){this.id=null}function Ge(a,b,c){for(var d=0,e=0;;){var f=a.indexOf("\t",d);if(f==-1)f=a.length;var h=f-d;if(f==a.length||e+h>=b)return d+Math.min(h,b-e);e+=f-d;e+=c-e%c;d=f+1;if(e>=b)return d}}
function Ue(a){for(;Dd.length<=a;)Dd.push(Ia(Dd)+" ");return Dd[a]}function Ia(a){return a[a.length-1]}function Ua(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}function Dc(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function of(a,b){var c;if(Object.create)c=Object.create(a);else{c=function(){};c.prototype=a;c=new c}b&&zb(b,c);return c}function zb(a,b,c){b||(b={});for(var d in a)if(a.hasOwnProperty(d)&&(c!==false||!b.hasOwnProperty(d)))b[d]=a[d];return b}function ob(a){var b=
Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function wd(a,b){if(!b)return pf(a);if(b.source.indexOf("\\w")>-1&&pf(a))return true;return b.test(a)}function qf(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return false;return true}function zc(a){return a.charCodeAt(0)>=768&&gg.test(a)}function ga(a,b,c,d){a=document.createElement(a);if(c)a.className=c;if(d)a.style.cssText=d;if(typeof b=="string")a.appendChild(document.createTextNode(b));else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);
return a}function Ob(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild);return a}function rb(a,b){return Ob(a).appendChild(b)}function Ab(){return document.activeElement}function Pc(a){return RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function he(a,b){for(var c=a.split(" "),d=0;d<c.length;d++)if(c[d]&&!Pc(c[d]).test(b))b+=" "+c[d];return b}function rf(a){if(document.body.getElementsByClassName)for(var b=document.body.getElementsByClassName("CodeMirror"),c=0;c<b.length;c++){var d=b[c].CodeMirror;
d&&a(d)}}function yf(){var a;qa(window,"resize",function(){if(a==null)a=setTimeout(function(){a=null;rf(Ff)},100)});qa(window,"blur",function(){rf(Uc)})}function dg(a){if(je==null){var b=ga("span","\u200b");rb(a,ga("span",[b,document.createTextNode("x")]));if(a.firstChild.offsetHeight!=0)je=b.offsetWidth<=1&&b.offsetHeight>2&&!(va&&Fa<8)}return je?ga("span","\u200b"):ga("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px")}function zf(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=
false,f=0;f<a.length;++f){var h=a[f];if(h.from<c&&h.to>b||b==c&&h.to==b){d(Math.max(h.from,b),Math.min(h.to,c),h.level==1?"rtl":"ltr");e=true}}e||d(b,c,"ltr")}function Pd(a){return a.level%2?a.from:a.to}function dd(a){return(a=sb(a))?a[0].level%2?a[0].to:a[0].from:0}function ed(a){var b=sb(a);if(!b)return a.text.length;return Pd(Ia(b))}function sf(a,b){var c=ha(a.doc,b),d=tb(c);if(d!=c)b=La(d);c=sb(d);d=!c?0:c[0].level%2?ed(d):dd(d);return W(b,d)}function tf(a,b){var c=sf(a,b.line),d=ha(a.doc,c.line),
e=sb(d);if(!e||e[0].level==0){d=Math.max(0,d.text.search(/\S/));return W(c.line,b.line==c.line&&b.ch<=d&&b.ch?0:d)}return c}function Qd(a,b){Cc=null;for(var c=0,d;c<a.length;++c){var e=a[c];if(e.from<b&&e.to>b)return c;if(e.from==b||e.to==b)if(d==null)d=c;else{var f;f=e.level;var h=a[d].level,i=a[0].level;f=f==i?true:h==i?false:f<h;if(f){if(e.from!=e.to)Cc=d;return c}else{if(e.from!=e.to)Cc=c;break}}}return d}function ke(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&zc(a.text.charAt(b)));return b}
function Rd(a,b,c,d){var e=sb(a);if(!e)return Ve(a,b,c,d);var f=Qd(e,b),h=e[f];for(b=ke(a,b,h.level%2?-c:c,d);;){if(b>h.from&&b<h.to)return b;if(b==h.from||b==h.to){if(Qd(e,b)==f)return b;h=e[f+c];return c>0==h.level%2?h.to:h.from}else{h=e[f+=c];if(!h)return null;b=c>0==h.level%2?ke(a,h.to,-1,d):ke(a,h.from,1,d)}}}function Ve(a,b,c,d){b+=c;if(d)for(;b>0&&zc(a.text.charAt(b));)b+=c;return b<0||b>a.text.length?null:b}var Gc=/gecko\/\d/i.test(navigator.userAgent),qc=/MSIE \d/.test(navigator.userAgent),
Ed=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),va=qc||Ed,Fa=va&&(qc?document.documentMode||6:Ed[1]),Na=/WebKit\//.test(navigator.userAgent);qc=Na&&/Qt\/\d+\.\d+/.test(navigator.userAgent);Ed=/Chrome\//.test(navigator.userAgent);var mb=/Opera\//.test(navigator.userAgent),Ee=/Apple Computer/.test(navigator.vendor),Jd=/KHTML\//.test(navigator.userAgent),hg=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),Cf=/PhantomJS/.test(navigator.userAgent),rc=/AppleWebKit/.test(navigator.userAgent)&&
/Mobile\/\w+/.test(navigator.userAgent),Gd=rc||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),ib=rc||/Mac/.test(navigator.platform),ig=/win/i.test(navigator.platform),Yb=mb&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);if(Yb)Yb=Number(Yb[1]);if(Yb&&Yb>=15){mb=false;Na=true}var uf=ib&&(qc||mb&&(Yb==null||Yb<12.11)),Vd=Gc||va&&Fa>=9,Ne=false,Cb=false;E.prototype=zb({update:function(a){a||(a=H(this.cm));var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+
1,d=a.nativeBarWidth;if(c){this.vert.style.display="block";this.vert.style.bottom=b?d+"px":"0";this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+(a.viewHeight-(b?d:0)))+"px"}else{this.vert.style.display="";this.vert.firstChild.style.height="0"}if(b){this.horiz.style.display="block";this.horiz.style.right=c?d+"px":"0";this.horiz.style.left=a.barLeft+"px";this.horiz.firstChild.style.width=a.scrollWidth-a.clientWidth+(a.viewWidth-a.barLeft-(c?d:0))+"px"}else{this.horiz.style.display=
"";this.horiz.firstChild.style.width="0"}if(!this.checkedOverlay&&a.clientHeight>0){d==0&&this.overlayHack();this.checkedOverlay=true}return{right:c?d:0,bottom:b?d:0}},setScrollLeft:function(a){if(this.horiz.scrollLeft!=a)this.horiz.scrollLeft=a},setScrollTop:function(a){if(this.vert.scrollTop!=a)this.vert.scrollTop=a},overlayHack:function(){this.horiz.style.minHeight=this.vert.style.minWidth=ib&&!hg?"12px":"18px";var a=this,b=function(c){(c.target||c.srcElement)!=a.vert&&(c.target||c.srcElement)!=
a.horiz&&Pa(a.cm,xe)(c)};qa(this.vert,"mousedown",b);qa(this.horiz,"mousedown",b)},clear:function(){var a=this.horiz.parentNode;a.removeChild(this.horiz);a.removeChild(this.vert)}},E.prototype);B.prototype=zb({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},B.prototype);j.scrollbarModel={"native":E,"null":B};var W=j.Pos=function(a,b){if(!(this instanceof W))return new W(a,b);this.line=a;this.ch=b},sa=j.cmpPos=function(a,b){return a.line-
b.line||a.ch-b.ch};F.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(a){if(a==this)return true;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return false;for(var b=0;b<this.ranges.length;b++){var c=this.ranges[b],d=a.ranges[b];if(sa(c.anchor,d.anchor)!=0||sa(c.head,d.head)!=0)return false}return true},deepCopy:function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new s(W(this.ranges[b].anchor.line,this.ranges[b].anchor.ch),W(this.ranges[b].head.line,
this.ranges[b].head.ch));return new F(a,this.primIndex)},somethingSelected:function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return true;return false},contains:function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(sa(b,d.from())>=0&&sa(a,d.to())<=0)return c}return-1}};s.prototype={from:function(){return r(this.anchor,this.head)},to:function(){return R(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==
this.anchor.ch}};var Nd={left:0,right:0,top:0,bottom:0},Sb,jc=null,Bf=0,Ub=null,md,ld,De=0,pd=0,bb=null;if(va)bb=-0.53;else if(Gc)bb=15;else if(Ed)bb=-0.7;else if(Ee)bb=-1/3;var He=function(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;if(b==null&&a.detail&&a.axis==a.HORIZONTAL_AXIS)b=a.detail;if(c==null&&a.detail&&a.axis==a.VERTICAL_AXIS)c=a.detail;else if(c==null)c=a.wheelDelta;return{x:b,y:c}};j.wheelEventPixels=function(a){a=He(a);a.x*=bb;a.y*=bb;return a};var Mf=new Tc,Yd=null,Ib=j.changeEnd=function(a){if(!a.text)return a.to;
return W(a.from.line+a.text.length-1,Ia(a.text).length+(a.text.length==1?a.from.ch:0))};j.prototype={constructor:j,focus:function(){window.focus();$a(this);jd(this)},setOption:function(a,b){var c=this.options,d=c[a];if(!(c[a]==b&&a!="mode")){c[a]=b;$b.hasOwnProperty(a)&&Pa(this,$b[a])(this,b,d)}},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](xd(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,
c=0;c<b.length;++c)if(b[c]==a||b[c].name==a){b.splice(c,1);return true}},addOverlay:Sa(function(a,b){var c=a.token?a:j.getMode(this.options,a);if(c.startState)throw Error("Overlays may not be stateful.");this.state.overlays.push({mode:c,modeSpec:a,opaque:b&&b.opaque});this.state.modeGen++;ab(this)}),removeOverlay:Sa(function(a){for(var b=this.state.overlays,c=0;c<b.length;++c){var d=b[c].modeSpec;if(d==a||typeof a=="string"&&d.name==a){b.splice(c,1);this.state.modeGen++;ab(this);break}}}),indentLine:Sa(function(a,
b,c){if(typeof b!="string"&&typeof b!="number")b=b==null?this.options.smartIndent?"smart":"prev":b?"add":"subtract";Ka(this.doc,a)&&Ec(this,a,b,c)}),indentSelection:Sa(function(a){for(var b=this.doc.sel.ranges,c=-1,d=0;d<b.length;d++){var e=b[d];if(e.empty()){if(e.head.line>c){Ec(this,e.head.line,a,true);c=e.head.line;d==this.doc.sel.primIndex&&dc(this)}}else{var f=e.from();e=e.to();var h=Math.max(c,f.line);c=Math.min(this.lastLine(),e.line-(e.ch?0:1))+1;for(e=h;e<c;++e)Ec(this,e,a);e=this.doc.sel.ranges;
f.ch==0&&b.length==e.length&&e[d].from().ch>0&&Ba(this.doc,d,new s(f,e[d].to()),Eb)}}}),getTokenAt:function(a,b){return ff(this,a,b)},getLineTokens:function(a,b){return ff(this,W(a),b,true)},getTokenTypeAt:function(a){a=Y(this.doc,a);var b=hf(this,ha(this.doc,a.line)),c=0,d=(b.length-1)/2;a=a.ch;var e;if(a==0)e=b[2];else for(;;){var f=c+d>>1;if((f?b[f*2-1]:0)>=a)d=f;else if(b[f*2+1]<a)c=f+1;else{e=b[f*2+2];break}}b=e?e.indexOf("cm-overlay "):-1;return b<0?e:b==0?null:e.slice(0,b-1)},getModeAt:function(a){var b=
this.doc.mode;if(!b.innerMode)return b;return j.innerMode(b,this.getTokenAt(a).state).mode},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var c=[];if(!Zb.hasOwnProperty(b))return Zb;var d=Zb[b],e=this.getModeAt(a);if(typeof e[b]=="string")d[e[b]]&&c.push(d[e[b]]);else if(e[b])for(var f=0;f<e[b].length;f++){var h=d[e[b][f]];h&&c.push(h)}else if(e.helperType&&d[e.helperType])c.push(d[e.helperType]);else d[e.name]&&c.push(d[e.name]);for(f=0;f<d._global.length;f++){h=
d._global[f];h.pred(e,this)&&Ua(c,h.val)==-1&&c.push(h.val)}return c},getStateAfter:function(a,b){var c=this.doc;a=Math.max(c.first,Math.min(a==null?c.first+c.size-1:a,c.first+c.size-1));return fb(this,a+1,b)},cursorCoords:function(a,b){var c;c=this.doc.sel.primary();c=a==null?c.head:typeof a=="object"?Y(this.doc,a):a?c.from():c.to();return N(this,c,b||"page")},charCoords:function(a,b){return I(this,Y(this.doc,a),b||"page")},coordsChar:function(a,b){a=n(this,a,b||"page");return za(this,a.left,a.top)},
lineAtHeight:function(a,b){a=n(this,{top:a,left:0},b||"page").top;return Qb(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b){var c=false,d=this.doc.first+this.doc.size-1;if(a<this.doc.first)a=this.doc.first;else if(a>d){a=d;c=true}d=ha(this.doc,a);return Ac(this,d,{top:0,left:0},b||"page").top+(c?this.doc.height-wb(d):0)},defaultTextHeight:function(){return vb(this.display)},defaultCharWidth:function(){return sc(this.display)},setGutterMarker:Sa(function(a,b,c){return vd(this.doc,a,
"gutter",function(d){var e=d.gutterMarkers||(d.gutterMarkers={});e[b]=c;if(!c&&qf(e))d.gutterMarkers=null;return true})}),clearGutter:Sa(function(a){var b=this,c=b.doc,d=c.first;c.iter(function(e){if(e.gutterMarkers&&e.gutterMarkers[a]){e.gutterMarkers[a]=null;xb(b,d,"gutter");if(qf(e.gutterMarkers))e.gutterMarkers=null}++d})}),addLineWidget:Sa(function(a,b,c){return Yf(this,a,b,c)}),removeLineWidget:function(a){a.clear()},lineInfo:function(a){if(typeof a=="number"){if(!Ka(this.doc,a))return null;
var b=a;a=ha(this.doc,a);if(!a)return null}else{b=La(a);if(b==null)return null}return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=N(this,Y(this.doc,a));var h=a.bottom,i=a.left;b.style.position="absolute";b.setAttribute("cm-ignore-events","true");f.sizer.appendChild(b);if(d==
"over")h=a.top;else if(d=="above"||d=="near"){var k=Math.max(f.wrapper.clientHeight,this.doc.height),m=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);if((d=="above"||a.bottom+b.offsetHeight>k)&&a.top>b.offsetHeight)h=a.top-b.offsetHeight;else if(a.bottom+b.offsetHeight<=k)h=a.bottom;if(i+b.offsetWidth>m)i=m-b.offsetWidth}b.style.top=h+"px";b.style.left=b.style.right="";if(e=="right"){i=f.sizer.clientWidth-b.offsetWidth;b.style.right="0px"}else{if(e=="left")i=0;else if(e=="middle")i=(f.sizer.clientWidth-
b.offsetWidth)/2;b.style.left=i+"px"}if(c){a=fd(this,i,h,i+b.offsetWidth,h+b.offsetHeight);a.scrollTop!=null&&uc(this,a.scrollTop);a.scrollLeft!=null&&ac(this,a.scrollLeft)}},triggerOnKeyDown:Sa(Be),triggerOnKeyPress:Sa(Ce),triggerOnKeyUp:Ae,execCommand:function(a){if(rd.hasOwnProperty(a))return rd[a](this)},findPosH:function(a,b,c,d){var e=1;if(b<0){e=-1;b=-b}var f=0;for(a=Y(this.doc,a);f<b;++f){a=de(this.doc,a,e,c,d);if(a.hitSide)break}return a},moveH:Sa(function(a,b){var c=this;c.extendSelectionsBy(function(d){return c.display.shift||
c.doc.extend||d.empty()?de(c.doc,d.head,a,b,c.options.rtlMoveVisually):a<0?d.from():d.to()},Qc)}),deleteH:Sa(function(a,b){var c=this.doc;this.doc.sel.somethingSelected()?c.replaceSelection("",null,"+delete"):mc(this,function(d){var e=de(c,d.head,a,b,false);return a<0?{from:e,to:d.head}:{from:d.head,to:e}})}),findPosV:function(a,b,c,d){var e=1;if(b<0){e=-1;b=-b}var f=0;for(a=Y(this.doc,a);f<b;++f){a=N(this,a,"div");if(d==null)d=a.left;else a.left=d;a=We(this,a,e,c);if(a.hitSide)break}return a},moveV:Sa(function(a,
b){var c=this,d=this.doc,e=[],f=!c.display.shift&&!d.extend&&d.sel.somethingSelected();d.extendSelectionsBy(function(i){if(f)return a<0?i.from():i.to();var k=N(c,i.head,"div");if(i.goalColumn!=null)k.left=i.goalColumn;e.push(k.left);var m=We(c,k,a,b);b=="page"&&i==d.sel.primary()&&ce(c,null,I(c,m,"div").top-k.top);return m},Qc);if(e.length)for(var h=0;h<d.sel.ranges.length;h++)d.sel.ranges[h].goalColumn=e[h]}),findWordAt:function(a){var b=ha(this.doc,a.line).text,c=a.ch,d=a.ch;if(b){var e=this.getHelper(a,
"wordChars");if((a.xRel<0||d==b.length)&&c)--c;else++d;var f=b.charAt(c);for(f=wd(f,e)?function(h){return wd(h,e)}:/\s/.test(f)?function(h){return/\s/.test(h)}:function(h){return!/\s/.test(h)&&!wd(h)};c>0&&f(b.charAt(c-1));)--c;for(;d<b.length&&f(b.charAt(d));)++d}return new s(W(a.line,c),W(a.line,d))},toggleOverwrite:function(a){if(!(a!=null&&a==this.state.overwrite)){(this.state.overwrite=!this.state.overwrite)?vc(this.display.cursorDiv,"CodeMirror-overwrite"):tc(this.display.cursorDiv,"CodeMirror-overwrite");
Oa(this,"overwriteToggle",this,this.state.overwrite)}},hasFocus:function(){return Ab()==this.display.input},scrollTo:Sa(function(a,b){if(a!=null||b!=null)ud(this);if(a!=null)this.curOp.scrollLeft=a;if(b!=null)this.curOp.scrollTop=b}),getScrollInfo:function(){var a=this.display.scroller;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-Za(this)-this.display.barHeight,width:a.scrollWidth-Za(this)-this.display.barWidth,clientHeight:Db(this),clientWidth:hb(this)}},scrollIntoView:Sa(function(a,
b){if(a==null){a={from:this.doc.sel.primary().head,to:null};if(b==null)b=this.options.cursorScrollMargin}else if(typeof a=="number")a={from:W(a,0),to:null};else if(a.from==null)a={from:a,to:null};if(!a.to)a.to=a.from;a.margin=b||0;if(a.from.line!=null){ud(this);this.curOp.scrollToPos=a}else{var c=fd(this,Math.min(a.from.left,a.to.left),Math.min(a.from.top,a.to.top)-a.margin,Math.max(a.from.right,a.to.right),Math.max(a.from.bottom,a.to.bottom)+a.margin);this.scrollTo(c.scrollLeft,c.scrollTop)}}),setSize:Sa(function(a,
b){function c(f){return typeof f=="number"||/^\d+$/.test(String(f))?f+"px":f}var d=this;if(a!=null)d.display.wrapper.style.width=c(a);if(b!=null)d.display.wrapper.style.height=c(b);d.options.lineWrapping&&cd(this);var e=d.display.viewFrom;d.doc.iter(e,d.display.viewTo,function(f){if(f.widgets)for(var h=0;h<f.widgets.length;h++)if(f.widgets[h].noHScroll){xb(d,e,"widget");break}++e});d.curOp.forceUpdate=true;Oa(d,"refresh",this)}),operation:function(a){return Gb(this,a)},refresh:Sa(function(){var a=
this.display.cachedTextHeight;ab(this);this.curOp.forceUpdate=true;aa(this);this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop);A(this);if(a==null||Math.abs(a-vb(this.display))>0.5)g(this);Oa(this,"refresh",this)}),swapDoc:Sa(function(a){var b=this.doc;b.cm=null;me(this,a);aa(this);gb(this);this.scrollTo(a.scrollLeft,a.scrollTop);this.curOp.forceScroll=true;Qa(this,"swapDoc",this,b);return b}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},
getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};pc(j);var wf=j.defaults={},$b=j.optionHandlers={},ne=j.Init={toString:function(){return"CodeMirror.Init"}};oa("value","",function(a,b){a.setValue(b)},true);oa("mode",null,function(a,b){a.doc.modeOption=b;X(a)},true);oa("indentUnit",2,X,true);oa("indentWithTabs",false);oa("smartIndent",true);oa("tabSize",4,function(a){w(a);aa(a);ab(a)},true);oa("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,
function(a,b){a.options.specialChars=RegExp(b.source+(b.test("\t")?"":"|\t"),"g");a.refresh()},true);oa("specialCharPlaceholder",function(a){var b=ga("span","\u2022","cm-invalidchar");b.title="\\u"+a.charCodeAt(0).toString(16);return b},function(a){a.refresh()},true);oa("electricChars",true);oa("rtlMoveVisually",!ig);oa("wholeLineUpdateBefore",true);oa("theme","default",function(a){l(a);q(a)},true);oa("keyMap","default",function(a,b,c){b=xd(b);(c=c!=j.Init&&xd(c))&&c.detach&&c.detach(a,b);if(b.attach)b.attach(a,
c||null)});oa("extraKeys",null);oa("lineWrapping",false,function(a){if(a.options.lineWrapping){vc(a.display.wrapper,"CodeMirror-wrap");a.display.sizer.style.minWidth="";a.display.sizerWidth=null}else{tc(a.display.wrapper,"CodeMirror-wrap");x(a)}g(a);ab(a);aa(a);setTimeout(function(){y(a)},100)},true);oa("gutters",[],function(a){J(a.options);q(a)},true);oa("fixedGutter",true,function(a,b){a.display.gutters.style.left=b?Va(a.display)+"px":"0";a.refresh()},true);oa("coverGutterNextToScrollbar",false,
function(a){y(a)},true);oa("scrollbarStyle","native",function(a){z(a);y(a);a.display.scrollbars.setScrollTop(a.doc.scrollTop);a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},true);oa("lineNumbers",false,function(a){J(a.options);q(a)},true);oa("firstLineNumber",1,q,true);oa("lineNumberFormatter",function(a){return a},q,true);oa("showCursorWhenSelecting",false,Rb,true);oa("resetSelectionOnContextMenu",true);oa("readOnly",false,function(a,b){if(b=="nocursor"){Uc(a);a.display.input.blur();a.display.disabled=
true}else{a.display.disabled=false;b||gb(a)}});oa("disableInput",false,function(a,b){b||gb(a)},true);oa("dragDrop",true);oa("cursorBlinkRate",530);oa("cursorScrollMargin",0);oa("cursorHeight",1,Rb,true);oa("singleCursorHeightPerLine",true,Rb,true);oa("workTime",100);oa("workDelay",100);oa("flattenSpans",true,w,true);oa("addModeClass",false,w,true);oa("pollInterval",100);oa("undoDepth",200,function(a,b){a.doc.history.undoDepth=b});oa("historyEventDelay",1250);oa("viewportMargin",10,function(a){a.refresh()},
true);oa("maxHighlightLength",1E4,w,true);oa("moveInputWithCursor",true,function(a,b){if(!b)a.display.inputDiv.style.top=a.display.inputDiv.style.left=0});oa("tabindex",null,function(a,b){a.display.input.tabIndex=b||""});oa("autofocus",null);var vf=j.modes={},Rc=j.mimeModes={};j.defineMode=function(a,b){if(!j.defaults.mode&&a!="null")j.defaults.mode=a;if(arguments.length>2)b.dependencies=Array.prototype.slice.call(arguments,2);vf[a]=b};j.defineMIME=function(a,b){Rc[a]=b};j.resolveMode=function(a){if(typeof a==
"string"&&Rc.hasOwnProperty(a))a=Rc[a];else if(a&&typeof a.name=="string"&&Rc.hasOwnProperty(a.name)){var b=Rc[a.name];if(typeof b=="string")b={name:b};a=of(b,a);a.name=b.name}else if(typeof a=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return j.resolveMode("application/xml");return typeof a=="string"?{name:a}:a||{name:"null"}};j.getMode=function(a,b){b=j.resolveMode(b);var c=vf[b.name];if(!c)return j.getMode(a,"text/plain");c=c(a,b);if(Sc.hasOwnProperty(b.name)){var d=Sc[b.name],e;for(e in d)if(d.hasOwnProperty(e)){if(c.hasOwnProperty(e))c["_"+
e]=c[e];c[e]=d[e]}}c.name=b.name;if(b.helperType)c.helperType=b.helperType;if(b.modeProps)for(e in b.modeProps)c[e]=b.modeProps[e];return c};j.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}});j.defineMIME("text/plain","null");var Sc=j.modeExtensions={};j.extendMode=function(a,b){var c=Sc.hasOwnProperty(a)?Sc[a]:Sc[a]={};zb(b,c)};j.defineExtension=function(a,b){j.prototype[a]=b};j.defineDocExtension=function(a,b){Ya.prototype[a]=b};j.defineOption=oa;var Id=[];j.defineInitHook=
function(a){Id.push(a)};var Zb=j.helpers={};j.registerHelper=function(a,b,c){Zb.hasOwnProperty(a)||(Zb[a]=j[a]={_global:[]});Zb[a][b]=c};j.registerGlobalHelper=function(a,b,c,d){j.registerHelper(a,b,d);Zb[a]._global.push({pred:c,val:d})};var gc=j.copyState=function(a,b){if(b===true)return b;if(a.copyState)return a.copyState(b);var c={},d;for(d in b){var e=b[d];if(e instanceof Array)e=e.concat([]);c[d]=e}return c},Af=j.startState=function(a,b,c){return a.startState?a.startState(b,c):true};j.innerMode=
function(a,b){for(;a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state;a=c.mode}return c||{mode:a,state:b}};var rd=j.commands={selectAll:function(a){a.setSelection(W(a.firstLine(),0),W(a.lastLine()),Eb)},singleSelection:function(a){a.setSelection(a.getCursor("anchor"),a.getCursor("head"),Eb)},killLine:function(a){mc(a,function(b){if(b.empty()){var c=ha(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:W(b.head.line+1,0)}:{from:b.head,to:W(b.head.line,
c)}}else return{from:b.from(),to:b.to()}})},deleteLine:function(a){mc(a,function(b){return{from:W(b.from().line,0),to:Y(a.doc,W(b.to().line+1,0))}})},delLineLeft:function(a){mc(a,function(b){return{from:W(b.from().line,0),to:b.from()}})},delWrappedLineLeft:function(a){mc(a,function(b){var c=a.charCoords(b.head,"div").top+5;return{from:a.coordsChar({left:0,top:c},"div"),to:b.from()}})},delWrappedLineRight:function(a){mc(a,function(b){var c=a.charCoords(b.head,"div").top+5;c=a.coordsChar({left:a.display.lineDiv.offsetWidth+
100,top:c},"div");return{from:b.from(),to:c}})},undo:function(a){a.undo()},redo:function(a){a.redo()},undoSelection:function(a){a.undoSelection()},redoSelection:function(a){a.redoSelection()},goDocStart:function(a){a.extendSelection(W(a.firstLine(),0))},goDocEnd:function(a){a.extendSelection(W(a.lastLine()))},goLineStart:function(a){a.extendSelectionsBy(function(b){return sf(a,b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){a.extendSelectionsBy(function(b){return tf(a,b.head)},
{origin:"+move",bias:1})},goLineEnd:function(a){a.extendSelectionsBy(function(b){b=b.head.line;for(var c,d=ha(a.doc,b);c=Pb(d,false);){d=c.find(1,true).line;b=null}c=sb(d);c=!c?d.text.length:c[0].level%2?dd(d):ed(d);return W(b==null?La(d):b,c)},{origin:"+move",bias:-1})},goLineRight:function(a){a.extendSelectionsBy(function(b){b=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},"div")},Qc)},goLineLeft:function(a){a.extendSelectionsBy(function(b){b=
a.charCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:b},"div")},Qc)},goLineLeftSmart:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5;c=a.coordsChar({left:0,top:c},"div");if(c.ch<a.getLine(c.line).search(/\S/))return tf(a,b.head);return c},Qc)},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},
goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goGroupRight:function(a){a.moveH(1,"group")},goGroupLeft:function(a){a.moveH(-1,"group")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")},delWordAfter:function(a){a.deleteH(1,"word")},
delGroupBefore:function(a){a.deleteH(-1,"group")},delGroupAfter:function(a){a.deleteH(1,"group")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection("\t")},insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,e=0;e<c.length;e++){var f=c[e].from();f=kb(a.getLine(f.line),f.ch,d);b.push(Array(d-f%d+1).join(" "))}a.replaceSelections(b)},
defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){Gb(a,function(){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++){var e=b[d].head,f=ha(a.doc,e.line).text;if(f){if(e.ch==f.length)e=new W(e.line,e.ch-1);if(e.ch>0){e=new W(e.line,e.ch+1);a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),W(e.line,e.ch-2),e,"+transpose")}else if(e.line>a.doc.first){var h=ha(a.doc,e.line-1).text;h&&a.replaceRange(f.charAt(0)+"\n"+h.charAt(h.length-
1),W(e.line-1,h.length-1),W(e.line,1),"+transpose")}}c.push(new s(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){Gb(a,function(){for(var b=a.listSelections().length,c=0;c<b;c++){var d=a.listSelections()[c];a.replaceRange("\n",d.anchor,d.head,"+input");a.indentLine(d.from().line+1,null,true);dc(a)}})},toggleOverwrite:function(a){a.toggleOverwrite()}},Jb=j.keyMap={};Jb.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",
PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"};Jb.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart",
"Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"};Jb.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft",
"Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"};Jb.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft",
"Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]};Jb["default"]=
ib?Jb.macDefault:Jb.pcDefault;j.normalizeKeyMap=function(a){var b={},c;for(c in a)if(a.hasOwnProperty(c)){var d=a[c];if(!/^(name|fallthrough|(de|at)tach)$/.test(c)){if(d!="...")for(var e=Dc(c.split(" "),Tf),f=0;f<e.length;f++){var h,i;if(f==e.length-1){i=c;h=d}else{i=e.slice(0,f+1).join(" ");h="..."}var k=b[i];if(k){if(k!=h)throw Error("Inconsistent bindings for "+i);}else b[i]=h}delete a[c]}}for(var m in b)a[m]=b[m];return a};var Hc=j.lookupKey=function(a,b,c,d){b=xd(b);var e=b.call?b.call(a,d):
b[a];if(e===false)return"nothing";if(e==="...")return"multi";if(e!=null&&c(e))return"handled";if(b.fallthrough){if(Object.prototype.toString.call(b.fallthrough)!="[object Array]")return Hc(a,b.fallthrough,c,d);for(e=0;e<b.fallthrough.length;e++){var f=Hc(a,b.fallthrough[e],c,d);if(f)return f}}},Lf=j.isModifierKey=function(a){a=typeof a=="string"?a:Kb[a.keyCode];return a=="Ctrl"||a=="Alt"||a=="Shift"||a=="Mod"},Nf=j.keyName=function(a,b){if(mb&&a.keyCode==34&&a["char"])return false;var c=Kb[a.keyCode],
d=c;if(d==null||a.altGraphKey)return false;if(a.altKey&&c!="Alt")d="Alt-"+d;if((uf?a.metaKey:a.ctrlKey)&&c!="Ctrl")d="Ctrl-"+d;if((uf?a.ctrlKey:a.metaKey)&&c!="Cmd")d="Cmd-"+d;if(!b&&a.shiftKey&&c!="Shift")d="Shift-"+d;return d};j.fromTextArea=function(a,b){function c(){a.value=k.getValue()}b||(b={});b.value=a.value;if(!b.tabindex&&a.tabindex)b.tabindex=a.tabindex;if(!b.placeholder&&a.placeholder)b.placeholder=a.placeholder;if(b.autofocus==null){var d=Ab();b.autofocus=d==a||a.getAttribute("autofocus")!=
null&&d==document.body}if(a.form){qa(a.form,"submit",c);if(!b.leaveSubmitMethodAlone){var e=a.form,f=e.submit;try{var h=e.submit=function(){c();e.submit=f;e.submit();e.submit=h}}catch(i){}}}a.style.display="none";var k=j(function(m){a.parentNode.insertBefore(m,a.nextSibling)},b);k.save=c;k.getTextArea=function(){return a};k.toTextArea=function(){k.toTextArea=isNaN;c();a.parentNode.removeChild(k.getWrapperElement());a.style.display="";if(a.form){yb(a.form,"submit",c);if(typeof a.form.submit=="function")a.form.submit=
f}};return k};var Bd=j.StringStream=function(a,b){this.pos=this.start=0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0};Bd.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||undefined},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if(typeof a=="string"?b==
a:b&&(a.test?a.test(b):a(b))){++this.pos;return b}},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){a=this.string.indexOf(a,this.pos);if(a>-1){this.pos=a;return true}},backUp:function(a){this.pos-=a},column:function(){if(this.lastColumnPos<this.start){this.lastColumnValue=kb(this.string,this.start,
this.tabSize,this.lastColumnPos,this.lastColumnValue);this.lastColumnPos=this.start}return this.lastColumnValue-(this.lineStart?kb(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return kb(this.string,null,this.tabSize)-(this.lineStart?kb(this.string,this.lineStart,this.tabSize):0)},match:function(a,b,c){if(typeof a=="string"){var d=this.string.substr(this.pos,a.length);if((c?d.toLowerCase():d)==(c?a.toLowerCase():a)){if(b!==false)this.pos+=a.length;return true}}else{if((a=this.string.slice(this.pos).match(a))&&
a.index>0)return null;if(a&&b!==false)this.pos+=a[0].length;return a}},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}};var Xb=j.TextMarker=function(a,b){this.lines=[];this.type=b;this.doc=a};pc(Xb);Xb.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;b&&Lb(a);if(jb(this,"clear")){var c=this.find();c&&Qa(this,"clear",c.from,c.to)}for(var d=c=null,e=0;e<this.lines.length;++e){var f=
this.lines[e],h=Kc(f.markedSpans,this);if(a&&!this.collapsed)xb(a,La(f),"text");else if(a){if(h.to!=null)d=La(f);if(h.from!=null)c=La(f)}for(var i=f,k=f.markedSpans,m=h,o=void 0,t=0;t<k.length;++t)if(k[t]!=m)(o||(o=[])).push(k[t]);i.markedSpans=o;h.from==null&&this.collapsed&&!Nb(this.doc,f)&&a&&pb(f,vb(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(e=0;e<this.lines.length;++e){f=tb(this.lines[e]);h=M(f);if(h>a.display.maxLineLength){a.display.maxLine=f;a.display.maxLineLength=h;a.display.maxLineChanged=
true}}c!=null&&a&&this.collapsed&&ab(a,c,d+1);this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;a&&Zc(a.doc)}a&&Qa(a,"markerCleared",a,this);b&&Mb(a);this.parent&&this.parent.clear()}};Xb.prototype.find=function(a,b){if(a==null&&this.type=="bookmark")a=1;for(var c,d,e=0;e<this.lines.length;++e){var f=this.lines[e],h=Kc(f.markedSpans,this);if(h.from!=null){c=W(b?f:La(f),h.from);if(a==-1)return c}if(h.to!=null){d=W(b?f:La(f),h.to);if(a==1)return d}}return c&&
{from:c,to:d}};Xb.prototype.changed=function(){var a=this.find(-1,true),b=this,c=this.doc.cm;a&&c&&Gb(c,function(){var d=a.line,e=La(a.line);if(e=ad(c,e)){bd(e);c.curOp.selectionChanged=c.curOp.forceUpdate=true}c.curOp.updateMaxLine=true;if(!Nb(b.doc,d)&&b.height!=null){e=b.height;b.height=null;(e=Bc(b)-e)&&pb(d,d.height+e)}})};Xb.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;if(!b.maybeHiddenMarkers||Ua(b.maybeHiddenMarkers,this)==-1)(b.maybeUnhiddenMarkers||
(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};Xb.prototype.detachLine=function(a){this.lines.splice(Ua(this.lines,a),1);if(!this.lines.length&&this.doc.cm){a=this.doc.cm.curOp;(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this)}};var Vf=0,zd=j.SharedTextMarker=function(a,b){this.markers=a;this.primary=b;for(var c=0;c<a.length;++c)a[c].parent=this};pc(zd);zd.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=true;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();
Qa(this,"clear")}};zd.prototype.find=function(a,b){return this.primary.find(a,b)};var Ad=j.LineWidget=function(a,b,c){if(c)for(var d in c)if(c.hasOwnProperty(d))this[d]=c[d];this.cm=a;this.node=b};pc(Ad);Ad.prototype.clear=function(){var a=this.cm,b=this.line.widgets,c=this.line,d=La(c);if(!(d==null||!b)){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);if(!b.length)c.widgets=null;var f=Bc(this);Gb(a,function(){cf(a,c,-f);xb(a,d,"widget");pb(c,Math.max(0,c.height-f))})}};Ad.prototype.changed=
function(){var a=this.height,b=this.cm,c=this.line;this.height=null;var d=Bc(this)-a;d&&Gb(b,function(){b.curOp.forceUpdate=true;cf(b,c,d);pb(c,c.height+d)})};var Lc=j.Line=function(a,b,c){this.text=a;af(this,b);this.height=c?c(this):1};pc(Lc);Lc.prototype.lineNo=function(){return La(this)};var $f={},Zf={};Mc.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;c<d;++c){var e=this.lines[c];this.height-=e.height;var f=e;f.parent=null;$e(f);Qa(e,"delete")}this.lines.splice(a,
b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height+=c;this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(a=0;a<b.length;++a)b[a].parent=this},iterN:function(a,b,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return true}};Nc.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(a<e){var f=Math.min(b,e-a),h=d.height;d.removeInner(a,
f);this.height-=h-d.height;if(e==f){this.children.splice(c--,1);d.parent=null}if((b-=f)==0)break;a=0}else a-=e}if(this.size-b<25&&(this.children.length>1||!(this.children[0]instanceof Mc))){c=[];this.collapse(c);this.children=[new Mc(c)];this.children[0].parent=this}},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length;this.height+=c;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();
if(a<=f){e.insertInner(a,b,c);if(e.lines&&e.lines.length>50){for(;e.lines.length>50;){a=e.lines.splice(e.lines.length-25,25);a=new Mc(a);e.height-=a.height;this.children.splice(d+1,0,a);a.parent=this}this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5);b=new Nc(b);if(a.parent){a.size-=b.size;a.height-=b.height;var c=Ua(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else{c=new Nc(a.children);c.parent=
a;a.children=[c,b];a=c}b.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<f){f=Math.min(b,f-a);if(e.iterN(a,f,c))return true;if((b-=f)==0)break;a=0}else a-=f}}};var jg=0,Ya=j.Doc=function(a,b,c){if(!(this instanceof Ya))return new Ya(a,b,c);if(c==null)c=0;Nc.call(this,[new Mc([new Lc("",null)])]);this.first=c;this.scrollTop=this.scrollLeft=0;this.cantEdit=false;this.cleanGeneration=
1;this.frontier=c;c=W(c,0);this.sel=ja(c);this.history=new Cd(null);this.id=++jg;this.modeOption=b;if(typeof a=="string")a=Tb(a);be(this,{from:c,to:c,text:a});Ma(this,ja(c),Eb)};Ya.prototype=of(Nc.prototype,{constructor:Ya,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0;d<b.length;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=
ie(this,this.first,this.first+this.size);if(a===false)return b;return b.join(a||"\n")},setValue:Wa(function(a){var b=W(this.first,0),c=this.first+this.size-1;kc(this,{from:b,to:W(c,ha(this,c).text.length),text:Tb(a),origin:"setValue",full:true},true);Ma(this,ja(b))}),replaceRange:function(a,b,c,d){b=Y(this,b);c=c?Y(this,c):b;od(this,a,b,c,d)},getRange:function(a,b,c){a=Jc(this,Y(this,a),Y(this,b));if(c===false)return a;return a.join(c||"\n")},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},
getLineHandle:function(a){if(Ka(this,a))return ha(this,a)},getLineNumber:function(a){return La(a)},getLineHandleVisualStart:function(a){if(typeof a=="number")a=ha(this,a);return tb(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return Y(this,a)},getCursor:function(a){var b=this.sel.primary();return a==null||a=="head"?b.head:a=="anchor"?b.anchor:a=="end"||a=="to"||a===false?b.to():b.from()},listSelections:function(){return this.sel.ranges},
somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Wa(function(a,b,c){a=Y(this,typeof a=="number"?W(a,b||0):a);Ma(this,ja(a,null),c)}),setSelection:Wa(function(a,b,c){var d=Y(this,a);a=Y(this,b||a);Ma(this,ja(d,a),c)}),extendSelection:Wa(function(a,b,c){xa(this,Y(this,a),b&&Y(this,b),c)}),extendSelections:Wa(function(a){for(var b=[],c=0;c<a.length;c++)b[c]=Y(this,a[c]);eb(this,b)}),extendSelectionsBy:Wa(function(a,b){eb(this,Dc(this.sel.ranges,a),b)}),setSelections:Wa(function(a,
b,c){if(a.length){for(var d=0,e=[];d<a.length;d++)e[d]=new s(Y(this,a[d].anchor),Y(this,a[d].head));if(b==null)b=Math.min(a.length-1,this.sel.primIndex);Ma(this,U(e,b),c)}}),addSelection:Wa(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new s(Y(this,a),Y(this,b||a)));Ma(this,U(d,d.length-1),c)}),getSelection:function(a){for(var b=this.sel.ranges,c,d=0;d<b.length;d++){var e=Jc(this,b[d].from(),b[d].to());c=c?c.concat(e):e}return a===false?c:c.join(a||"\n")},getSelections:function(a){for(var b=
[],c=this.sel.ranges,d=0;d<c.length;d++){var e=Jc(this,c[d].from(),c[d].to());if(a!==false)e=e.join(a||"\n");b[d]=e}return b},replaceSelection:function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c||"+input")},replaceSelections:Wa(function(a,b,c){for(var d=[],e=this.sel,f=0;f<e.ranges.length;f++){var h=e.ranges[f];d[f]={from:h.from(),to:h.to(),text:Tb(a[f]),origin:c}}if(f=b)if(f=b!="end"){f=[];c=a=W(this.first,0);for(e=0;e<d.length;e++){var i=d[e];h=Le(i.from,
a,c);var k=Le(Ib(i),a,c);a=i.to;c=k;if(b=="around"){i=this.sel.ranges[e];i=sa(i.head,i.anchor)<0;f[e]=new s(i?k:h,i?h:k)}else f[e]=new s(h,h)}f=new F(f,this.sel.primIndex)}b=f;for(f=d.length-1;f>=0;f--)kc(this,d[f]);if(b)cc(this,b);else this.cm&&dc(this.cm)}),undo:Wa(function(){td(this,"undo")}),redo:Wa(function(){td(this,"redo")}),undoSelection:Wa(function(){td(this,"undo",true)}),redoSelection:Wa(function(){td(this,"redo",true)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},
historySize:function(){for(var a=this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(d=0;d<a.undone.length;d++)a.undone[d].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new Cd(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(true)},changeGeneration:function(a){if(a)this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null;return this.history.generation},isClean:function(a){return this.history.generation==
(a||this.cleanGeneration)},getHistory:function(){return{done:oc(this.history.done),undone:oc(this.history.undone)}},setHistory:function(a){var b=this.history=new Cd(this.history.maxGeneration);b.done=oc(a.done.slice(0),null,true);b.undone=oc(a.undone.slice(0),null,true)},addLineClass:Wa(function(a,b,c){return vd(this,a,b=="gutter"?"gutter":"class",function(d){var e=b=="text"?"textClass":b=="background"?"bgClass":b=="gutter"?"gutterClass":"wrapClass";if(d[e])if(Pc(c).test(d[e]))return false;else d[e]+=
" "+c;else d[e]=c;return true})}),removeLineClass:Wa(function(a,b,c){return vd(this,a,b=="gutter"?"gutter":"class",function(d){var e=b=="text"?"textClass":b=="background"?"bgClass":b=="gutter"?"gutterClass":"wrapClass",f=d[e];if(f)if(c==null)d[e]=null;else{var h=f.match(Pc(c));if(!h)return false;var i=h.index+h[0].length;d[e]=f.slice(0,h.index)+(!h.index||i==f.length?"":" ")+f.slice(i)||null}else return false;return true})}),markText:function(a,b,c){return nc(this,Y(this,a),Y(this,b),c,"range")},
setBookmark:function(a,b){var c={replacedWith:b&&(b.nodeType==null?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:false,shared:b&&b.shared};a=Y(this,a);return nc(this,a,a,c,"bookmark")},findMarksAt:function(a){a=Y(this,a);var b=[],c=ha(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var e=c[d];if((e.from==null||e.from<=a.ch)&&(e.to==null||e.to>=a.ch))b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=Y(this,a);b=Y(this,b);var d=[],e=a.line;this.iter(a.line,b.line+
1,function(f){if(f=f.markedSpans)for(var h=0;h<f.length;h++){var i=f[h];if(!(e==a.line&&a.ch>i.to||i.from==null&&e!=a.line||e==b.line&&i.from>b.ch)&&(!c||c(i.marker)))d.push(i.marker.parent||i.marker)}++e});return d},getAllMarks:function(){var a=[];this.iter(function(b){if(b=b.markedSpans)for(var c=0;c<b.length;++c)b[c].from!=null&&a.push(b[c].marker)});return a},posFromIndex:function(a){var b,c=this.first;this.iter(function(d){d=d.text.length+1;if(d>a){b=a;return true}a-=d;++c});return Y(this,W(c,
b))},indexFromPos:function(a){a=Y(this,a);var b=a.ch;if(a.line<this.first||a.ch<0)return 0;this.iter(this.first,a.line,function(c){b+=c.text.length+1});return b},copy:function(a){var b=new Ya(ie(this,this.first,this.first+this.size),this.modeOption,this.first);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=false;if(a){b.history.undoDepth=this.history.undoDepth;b.setHistory(this.getHistory())}return b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;
if(a.from!=null&&a.from>b)b=a.from;if(a.to!=null&&a.to<c)c=a.to;b=new Ya(ie(this,b,c),a.mode||this.modeOption,b);if(a.sharedHist)b.history=this.history;(this.linked||(this.linked=[])).push({doc:b,sharedHist:a.sharedHist});b.linked=[{doc:this,isParent:true,sharedHist:a.sharedHist}];a=Ye(this);for(c=0;c<a.length;c++){var d=a[c],e=d.find(),f=b.clipPos(e.from);e=b.clipPos(e.to);if(sa(f,e)){f=nc(b,f,e,d.primary,d.primary.type);d.markers.push(f);f.parent=d}}return b},unlinkDoc:function(a){if(a instanceof
j)a=a.doc;if(this.linked)for(var b=0;b<this.linked.length;++b)if(this.linked[b].doc==a){this.linked.splice(b,1);a.unlinkDoc(this);Wf(Ye(this));break}if(a.history==this.history){var c=[a.id];Wb(a,function(d){c.push(d.id)},true);a.history=new Cd(null);a.history.done=oc(this.history.done,c);a.history.undone=oc(this.history.undone,c)}},iterLinkedDocs:function(a){Wb(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm}});Ya.prototype.eachLine=Ya.prototype.iter;qc="iter insert remove copy getEditor".split(" ");
for(var Fd in Ya.prototype)if(Ya.prototype.hasOwnProperty(Fd)&&Ua(qc,Fd)<0)j.prototype[Fd]=function(a){return function(){return a.apply(this.doc,arguments)}}(Ya.prototype[Fd]);pc(Ya);var Xa=j.e_preventDefault=function(a){if(a.preventDefault)a.preventDefault();else a.returnValue=false},kg=j.e_stopPropagation=function(a){if(a.stopPropagation)a.stopPropagation();else a.cancelBubble=true},Td=j.e_stop=function(a){Xa(a);kg(a)},qa=j.on=function(a,b,c){if(a.addEventListener)a.addEventListener(b,c,false);
else if(a.attachEvent)a.attachEvent("on"+b,c);else{a=a._handlers||(a._handlers={});(a[b]||(a[b]=[])).push(c)}},yb=j.off=function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,false);else if(a.detachEvent)a.detachEvent("on"+b,c);else if(a=a._handlers&&a._handlers[b])for(b=0;b<a.length;++b)if(a[b]==c){a.splice(b,1);break}},Oa=j.signal=function(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)},Oc=null,oe=30,
Ie=j.Pass={toString:function(){return"CodeMirror.Pass"}},Eb={scroll:false},Wd={origin:"*mouse"},Qc={origin:"+move"};Tc.prototype.set=function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var kb=j.countColumn=function(a,b,c,d,e){if(b==null){b=a.search(/[^\s\u00a0]/);if(b==-1)b=a.length}d=d||0;for(e=e||0;;){var f=a.indexOf("\t",d);if(f<0||f>=b)return e+(b-d);e+=f-d;e+=c-e%c;d=f+1}},Dd=[""],Fc=function(a){a.select()};if(rc)Fc=function(a){a.selectionStart=0;a.selectionEnd=a.value.length};else if(va)Fc=
function(a){try{a.select()}catch(b){}};var lg=/[\u00df\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,pf=j.isWordChar=function(a){return/\w/.test(a)||a>"\u0080"&&(a.toUpperCase()!=a.toLowerCase()||lg.test(a))},gg=/[\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]/,
ic;ic=document.createRange?function(a,b,c){var d=document.createRange();d.setEnd(a,c);d.setStart(a,b);return d}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(e){return d}d.collapse(true);d.moveEnd("character",c);d.moveStart("character",b);return d};if(va&&Fa<11)Ab=function(){try{return document.activeElement}catch(a){return document.body}};var tc=j.rmClass=function(a,b){var c=a.className,d=Pc(b).exec(c);if(d){var e=c.slice(d.index+d[0].length);a.className=
c.slice(0,d.index)+(e?d[1]+e:"")}},vc=j.addClass=function(a,b){var c=a.className;Pc(b).test(c)||(a.className+=(c?" ":"")+b)},le=false,Hf=function(){if(va&&Fa<9)return false;var a=ga("div");return"draggable"in a||"dragDrop"in a}(),je,ge,Tb=j.splitLines="\n\nb".split(/\n/).length!=3?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);if(e==-1)e=a.length;var f=a.slice(b,a.charAt(e-1)=="\r"?e-1:e),h=f.indexOf("\r");if(h!=-1){c.push(f.slice(0,h));b+=h+1}else{c.push(f);b=e+1}}return c}:
function(a){return a.split(/\r\n?|\n/)},Df=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return false}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}if(!b||b.parentElement()!=a)return false;return b.compareEndPoints("StartToEnd",b)!=0},we=function(){var a=ga("div");if("oncopy"in a)return true;a.setAttribute("oncopy","return;");return typeof a.oncopy=="function"}(),Od=null,Kb={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",
18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};j.keyNames=Kb;(function(){for(var a=
0;a<10;a++)Kb[a+48]=Kb[a+96]=String(a);for(a=65;a<=90;a++)Kb[a]=String.fromCharCode(a);for(a=1;a<=12;a++)Kb[a+111]=Kb[a+63235]="F"+a})();var Cc,eg=function(){function a(m){return m<=247?c.charAt(m):1424<=m&&m<=1524?"R":1536<=m&&m<=1773?d.charAt(m-1536):1774<=m&&m<=2220?"r":8192<=m&&m<=8203?"w":m==8204?"b":"L"}function b(m,o,t){this.level=m;this.from=o;this.to=t}var c="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",
d="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,h=/[LRr]/,i=/[Lb1n]/,k=/[1n]/;return function(m){if(!e.test(m))return false;for(var o=m.length,t=[],p=0,D;p<o;++p)t.push(a(m.charCodeAt(p)));p=0;for(var L="L";p<o;++p){D=t[p];if(D=="m")t[p]=L;else L=D}p=
0;for(L="L";p<o;++p){D=t[p];if(D=="1"&&L=="r")t[p]="n";else if(h.test(D)){L=D;if(D=="r")t[p]="R"}}p=1;for(L=t[0];p<o-1;++p){D=t[p];if(D=="+"&&L=="1"&&t[p+1]=="1")t[p]="1";else if(D==","&&L==t[p+1]&&(L=="1"||L=="n"))t[p]=L;L=D}for(p=0;p<o;++p){D=t[p];if(D==",")t[p]="N";else if(D=="%"){for(L=p+1;L<o&&t[L]=="%";++L);var ea=p&&t[p-1]=="!"||L<o&&t[L]=="1"?"1":"N";for(D=p;D<L;++D)t[D]=ea;p=L-1}}p=0;for(L="L";p<o;++p){D=t[p];if(L=="L"&&D=="1")t[p]="L";else if(h.test(D))L=D}for(p=0;p<o;++p)if(f.test(t[p])){for(L=
p+1;L<o&&f.test(t[L]);++L);D=(L<o?t[L]:"L")=="L";ea=(p?t[p-1]:"L")=="L"||D?"L":"R";for(D=p;D<L;++D)t[D]=ea;p=L-1}L=[];var fa;for(p=0;p<o;)if(i.test(t[p])){D=p;for(++p;p<o&&i.test(t[p]);++p);L.push(new b(0,D,p))}else{var na=p;ea=L.length;for(++p;p<o&&t[p]!="L";++p);for(D=na;D<p;)if(k.test(t[D])){na<D&&L.splice(ea,0,new b(1,na,D));na=D;for(++D;D<p&&k.test(t[D]);++D);L.splice(ea,0,new b(2,na,D));na=D}else++D;na<p&&L.splice(ea,0,new b(1,na,p))}if(L[0].level==1&&(fa=m.match(/^\s+/))){L[0].from=fa[0].length;
L.unshift(new b(0,0,fa[0].length))}if(Ia(L).level==1&&(fa=m.match(/\s+$/))){Ia(L).to-=fa[0].length;L.push(new b(0,o-fa[0].length,o))}L[0].level!=Ia(L).level&&L.push(new b(L[0].level,o,o));return L}}();j.version="4.11.1";return j});CodeMirror.defineMode("hl7",function(j,ca){var X=ca.DelimiterRegex||/(\\|&|~|\^|\|)/;return{token:function(w){if(w.string===ca.LfToken||w.string===ca.CrToken||w.string===ca.CrToken+ca.LfToken){w.next();return null}var u=w.peek();if(w.sol())if(/\w/.test(u)){w.eatWhile(/\w/);return"keyword"}if(u.match(X)){w.next();return"delim"}w.next();return null}}});(function(j){if(typeof exports=="object"&&typeof module=="object")j(require("../../lib/codemirror"));else typeof define=="function"&&define.amd?define(["../../lib/codemirror"],j):j(CodeMirror)})(function(j){function ca(y){for(var Q={},$=0;$<y.length;++$)Q[y[$]]=true;return Q}function X(y,Q){for(var $=false,Ga;(Ga=y.next())!=null;){if($&&Ga=="/"){Q.tokenize=null;break}$=Ga=="*"}return["comment","comment"]}function w(y,Q){if(y.skipTo("--\>")){y.match("--\>");Q.tokenize=null}else y.skipToEnd();return["comment",
"comment"]}j.defineMode("css",function(y,Q){function $(r,F){P=F;return r}function Ga(r,F){var s=r.next();if(O[s]){var U=O[s](r,F);if(U!==false)return U}if(s=="@"){r.eatWhile(/[\w\\\-]/);return $("def",r.current())}else if(s=="="||(s=="~"||s=="|")&&r.eat("="))return $(null,"compare");else if(s=='"'||s=="'"){F.tokenize=cb(s);return F.tokenize(r,F)}else if(s=="#"){r.eatWhile(/[\w\\\-]/);return $("atom","hash")}else if(s=="!"){r.match(/^\s*\w*/);return $("keyword","important")}else if(/\d/.test(s)||s==
"."&&r.eat(/\d/)){r.eatWhile(/[\w.%]/);return $("number","unit")}else if(s==="-")if(/[\d.]/.test(r.peek())){r.eatWhile(/[\w.%]/);return $("number","unit")}else{if(r.match(/^\w+-/))return $("meta","meta")}else if(/[,+>*\/]/.test(s))return $(null,"select-op");else if(s=="."&&r.match(/^-?[_a-z][_a-z0-9-]*/i))return $("qualifier","qualifier");else if(/[:;{}\[\]\(\)]/.test(s))return $(null,s);else if(s=="u"&&r.match("rl(")){r.backUp(1);F.tokenize=Va;return $("property","word")}else if(/[\w\\\-]/.test(s)){r.eatWhile(/[\w\\\-]/);
return $("property","word")}else return $(null,null)}function cb(r){return function(F,s){for(var U=false,ja;(ja=F.next())!=null;){if(ja==r&&!U){r==")"&&F.backUp(1);break}U=!U&&ja=="\\"}if(ja==r||!U&&r!=")")s.tokenize=null;return $("string","string")}}function Va(r,F){r.next();F.tokenize=r.match(/\s*[\"\')]/,false)?null:cb(")");return $(null,"(")}function Ja(r,F,s){this.type=r;this.indent=F;this.prev=s}function Ea(r,F,s){r.context=new Ja(s,F.indentation()+G,r.context);return s}function S(r){r.context=
r.context.prev;return r.context.type}function T(r,F,s,U){for(U=U||1;U>0;U--)s.context=s.context.prev;return R[s.context.type](r,F,s)}function C(r){r=r.current().toLowerCase();V=ma.hasOwnProperty(r)?"atom":Z.hasOwnProperty(r)?"keyword":"variable"}Q.propertyKeywords||(Q=j.resolveMode("text/css"));var G=y.indentUnit,O=Q.tokenHooks,ba=Q.mediaTypes||{},wa=Q.mediaFeatures||{},ra=Q.propertyKeywords||{},la=Q.nonStandardPropertyKeywords||{},Z=Q.colorKeywords||{},ma=Q.valueKeywords||{},Aa=Q.fontProperties||
{},ua=Q.allowNested,P,V,R={};R.top=function(r,F,s){if(r=="{")return Ea(s,F,"block");else if(r=="}"&&s.context.prev)return S(s);else if(r=="@media")return Ea(s,F,"media");else if(r=="@font-face")return"font_face_before";else if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(r))return"keyframes";else if(r&&r.charAt(0)=="@")return Ea(s,F,"at");else if(r=="hash")V="builtin";else if(r=="word")V="tag";else if(r=="variable-definition")return"maybeprop";else if(r=="interpolation")return Ea(s,F,"interpolation");
else if(r==":")return"pseudo";else if(ua&&r=="(")return Ea(s,F,"parens");return s.context.type};R.block=function(r,F,s){if(r=="word"){r=F.current().toLowerCase();if(ra.hasOwnProperty(r)){V="property";return"maybeprop"}else if(la.hasOwnProperty(r)){V="string-2";return"maybeprop"}else if(ua){V=F.match(/^\s*:(?:\s|$)/,false)?"property":"tag";return"block"}else{V+=" error";return"maybeprop"}}else if(r=="meta")return"block";else if(!ua&&(r=="hash"||r=="qualifier")){V="error";return"block"}else return R.top(r,
F,s)};R.maybeprop=function(r,F,s){if(r==":")return Ea(s,F,"prop");return R[s.context.type](r,F,s)};R.prop=function(r,F,s){if(r==";")return S(s);if(r=="{"&&ua)return Ea(s,F,"propBlock");if(r=="}"||r=="{")return T(r,F,s);if(r=="(")return Ea(s,F,"parens");if(r=="hash"&&!/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(F.current()))V+=" error";else if(r=="word")C(F);else if(r=="interpolation")return Ea(s,F,"interpolation");return"prop"};R.propBlock=function(r,F,s){if(r=="}")return S(s);if(r=="word"){V="property";
return"maybeprop"}return s.context.type};R.parens=function(r,F,s){if(r=="{"||r=="}")return T(r,F,s);if(r==")")return S(s);if(r=="(")return Ea(s,F,"parens");r=="word"&&C(F);return"parens"};R.pseudo=function(r,F,s){if(r=="word"){V="variable-3";return s.context.type}return R[s.context.type](r,F,s)};R.media=function(r,F,s){if(r=="(")return Ea(s,F,"media_parens");if(r=="}")return T(r,F,s);if(r=="{")return S(s)&&Ea(s,F,ua?"block":"top");if(r=="word"){r=F.current().toLowerCase();V=r=="only"||r=="not"||r==
"and"?"keyword":ba.hasOwnProperty(r)?"attribute":wa.hasOwnProperty(r)?"property":"error"}return s.context.type};R.media_parens=function(r,F,s){if(r==")")return S(s);if(r=="{"||r=="}")return T(r,F,s,2);return R.media(r,F,s)};R.font_face_before=function(r,F,s){if(r=="{")return Ea(s,F,"font_face");return R[s.context.type](r,F,s)};R.font_face=function(r,F,s){if(r=="}")return S(s);if(r=="word"){V=Aa.hasOwnProperty(F.current().toLowerCase())?"property":"error";return"maybeprop"}return"font_face"};R.keyframes=
function(r,F,s){if(r=="word"){V="variable";return"keyframes"}if(r=="{")return Ea(s,F,"top");return R[s.context.type](r,F,s)};R.at=function(r,F,s){if(r==";")return S(s);if(r=="{"||r=="}")return T(r,F,s);if(r=="word")V="tag";else if(r=="hash")V="builtin";return"at"};R.interpolation=function(r,F,s){if(r=="}")return S(s);if(r=="{"||r==";")return T(r,F,s);if(r!="variable")V="error";return"interpolation"};return{startState:function(r){return{tokenize:null,state:"top",context:new Ja("top",r||0,null)}},token:function(r,
F){if(!F.tokenize&&r.eatSpace())return null;var s=(F.tokenize||Ga)(r,F);if(s&&typeof s=="object"){P=s[1];s=s[0]}V=s;F.state=R[F.state](P,r,F);return V},indent:function(r,F){var s=r.context,U=F&&F.charAt(0),ja=s.indent;if(s.type=="prop"&&(U=="}"||U==")"))s=s.prev;if(s.prev&&(U=="}"&&(s.type=="block"||s.type=="top"||s.type=="interpolation"||s.type=="font_face")||U==")"&&(s.type=="parens"||s.type=="media_parens")||U=="{"&&(s.type=="at"||s.type=="media")))ja=s.indent-G;return ja},electricChars:"}",blockCommentStart:"/*",
blockCommentEnd:"*/",fold:"brace"}});var u=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],g=ca(u),l=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index",
"max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],q=ca(l),v=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment",
"background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice",
"border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear",
"clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit",
"fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area",
"grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift",
"line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style",
"outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent",
"resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line",
"text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align",
"visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker",
"marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],A=ca(v),M=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color",
"scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],x=ca(M),J=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta",
"darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray",
"lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred",
"papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],H=ca(J),E=["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always",
"amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext",
"caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash",
"dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig",
"ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline",
"inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background",
"media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian",
"monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap",
"preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show",
"sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group",
"table-row","table-row-group","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url",
"vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small"],B=ca(E),z=ca(["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]);u=u.concat(l).concat(v).concat(M).concat(J).concat(E);j.registerHelper("hintWords","css",u);j.defineMIME("text/css",{mediaTypes:g,mediaFeatures:q,propertyKeywords:A,
nonStandardPropertyKeywords:x,colorKeywords:H,valueKeywords:B,fontProperties:z,tokenHooks:{"<":function(y,Q){if(!y.match("!--"))return false;Q.tokenize=w;return w(y,Q)},"/":function(y,Q){if(!y.eat("*"))return false;Q.tokenize=X;return X(y,Q)}},name:"css"});j.defineMIME("text/x-scss",{mediaTypes:g,mediaFeatures:q,propertyKeywords:A,nonStandardPropertyKeywords:x,colorKeywords:H,valueKeywords:B,fontProperties:z,allowNested:true,tokenHooks:{"/":function(y,Q){if(y.eat("/")){y.skipToEnd();return["comment",
"comment"]}else if(y.eat("*")){Q.tokenize=X;return X(y,Q)}else return["operator","operator"]},":":function(y){if(y.match(/\s*\{/))return[null,"{"];return false},$:function(y){y.match(/^[\w-]+/);if(y.match(/^\s*:/,false))return["variable-2","variable-definition"];return["variable-2","variable"]},"#":function(y){if(!y.eat("{"))return false;return[null,"interpolation"]}},name:"css",helperType:"scss"});j.defineMIME("text/x-less",{mediaTypes:g,mediaFeatures:q,propertyKeywords:A,nonStandardPropertyKeywords:x,
colorKeywords:H,valueKeywords:B,fontProperties:z,allowNested:true,tokenHooks:{"/":function(y,Q){if(y.eat("/")){y.skipToEnd();return["comment","comment"]}else if(y.eat("*")){Q.tokenize=X;return X(y,Q)}else return["operator","operator"]},"@":function(y){if(y.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,false))return false;y.eatWhile(/[\w\\\-]/);if(y.match(/^\s*:/,false))return["variable-2","variable-definition"];return["variable-2","variable"]},
"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})});CodeMirror.defineMode("dbs",function(j,ca){function X(J,H){var E=J.next();if(E=='"'||E=="'"){E=w(E);H.tokenize=E;return E(J,H)}else if(!/[\[\]{}\(\),;\.]/.test(E))if(/\d/.test(E)){J.eatWhile(/[\w\.]/);return"number"}else if(E=="/")if(J.eat("*")){E=u;H.tokenize=E;return E(J,H)}else{J.eatWhile(x);return"operator"}else if(E=="-")if(J.eat("-")){J.skipToEnd();return"comment"}else{J.eatWhile(x);return"operator"}else if(E=="@"||E=="$"){J.eatWhile(/[\w\d\$_]/);return"variable"}else if(x.test(E)){J.eatWhile(x);
return"operator"}else{J.eatWhile(/[\w\$_]/);if(l&&l.propertyIsEnumerable(J.current().toLowerCase()))return"keyword";if(q&&q.propertyIsEnumerable(J.current().toLowerCase()))return"builtin";if(v&&v.propertyIsEnumerable(J.current().toLowerCase()))return"variable-2";if(A&&A.propertyIsEnumerable(J.current().toLowerCase()))return"variable-3";return"dbs-word"}}function w(J){return function(H,E){for(var B=false,z,y=false;(z=H.next())!=null;){if(z==J&&!B){y=true;break}B=!B&&z=="\\"}if(y||!(B||M))E.tokenize=
X;return"dbs-string"}}function u(J,H){for(var E=false,B;B=J.next();){if(B=="/"&&E){H.tokenize=X;break}E=B=="*"}return"dbs-comment"}function g(J){var H={};J=J.split(" ");for(var E=0;E<J.length;++E)H[J[E]]=true;return H}var l=g("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),
q=g("abs acos add_months ascii asin atan atan2 average bfilename ceil chartorowid chr concat convert cos cosh count decode deref dual dump dup_val_on_index empty error exp false floor found glb greatest hextoraw initcap instr instrb isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mod months_between new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null nvl others power rawtohex reftohex round rowcount rowidtochar rpad rtrim sign sin sinh soundex sqlcode sqlerrm sqrt stddev substr substrb sum sysdate tan tanh to_char to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid upper user userenv variance vsize"),
v=g("bfile blob character clob dec float int integer mlslabel natural naturaln nchar nclob number numeric nvarchar2 real rowtype signtype smallint string varchar varchar2"),A=g("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),
M=ca.multiLineStrings,x=/[+\-*&%=<>!?:\/|]/;return{startState:function(){return{tokenize:X,startOfLine:true}},token:function(J,H){if(J.eatSpace())return null;return H.tokenize(J,H)}}});(function(j){if(typeof exports=="object"&&typeof module=="object")j(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css"));else typeof define=="function"&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],j):j(CodeMirror)})(function(j){j.defineMode("htmlmixed",function(ca,X){function w(H,E){var B=E.htmlState.tagName;if(B)B=B.toLowerCase();var z=q.token(H,E.htmlState);if(B=="script"&&/\btag\b/.test(z)&&
H.current()==">"){if((B=(B=H.string.slice(Math.max(0,H.pos-100),H.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i))?B[1]:"")&&/[\"\']/.test(B.charAt(0)))B=B.slice(1,B.length-1);for(var y=0;y<A.length;++y){var Q=A[y];if(typeof Q.matches=="string"?B==Q.matches:Q.matches.test(B)){if(Q.mode){E.token=g;E.localMode=Q.mode;E.localState=Q.mode.startState&&Q.mode.startState(q.indent(E.htmlState,""))}break}}}else if(B=="style"&&/\btag\b/.test(z)&&H.current()==">"){E.token=l;E.localMode=v;E.localState=
v.startState(q.indent(E.htmlState,""))}return z}function u(H,E,B){var z=H.current(),y=z.search(E);if(y>-1)H.backUp(z.length-y);else if(z.match(/<\/?$/)){H.backUp(z.length);H.match(E,false)||H.match(z)}return B}function g(H,E){if(H.match(/^<\/\s*script\s*>/i,false)){E.token=w;return E.localState=E.localMode=null}return u(H,/<\/\s*script\s*>/,E.localMode.token(H,E.localState))}function l(H,E){if(H.match(/^<\/\s*style\s*>/i,false)){E.token=w;return E.localState=E.localMode=null}return u(H,/<\/\s*style\s*>/,
v.token(H,E.localState))}var q=j.getMode(ca,{name:"xml",htmlMode:true,multilineTagIndentFactor:X.multilineTagIndentFactor,multilineTagIndentPastTag:X.multilineTagIndentPastTag}),v=j.getMode(ca,"css"),A=[],M=X&&X.scriptTypes;A.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:j.getMode(ca,"javascript")});if(M)for(var x=0;x<M.length;++x){var J=M[x];A.push({matches:J.matches,mode:J.mode&&j.getMode(ca,J.mode)})}A.push({matches:/./,mode:j.getMode(ca,"text/plain")});return{startState:function(){var H=
q.startState();return{token:w,localMode:null,localState:null,htmlState:H}},copyState:function(H){if(H.localState)var E=j.copyState(H.localMode,H.localState);return{token:H.token,localMode:H.localMode,localState:E,htmlState:j.copyState(q,H.htmlState)}},token:function(H,E){return E.token(H,E)},indent:function(H,E){return!H.localMode||/^\s*<\//.test(E)?q.indent(H.htmlState,E):H.localMode.indent?H.localMode.indent(H.localState,E):j.Pass},innerMode:function(H){return{state:H.localState||H.htmlState,mode:H.localMode||
q}}}},"xml","javascript","css");j.defineMIME("text/html","htmlmixed")});(function(j){if(typeof exports=="object"&&typeof module=="object")j(require("../../lib/codemirror"));else typeof define=="function"&&define.amd?define(["../../lib/codemirror"],j):j(CodeMirror)})(function(j){j.defineMode("javascript",function(ca,X){function w(n,I,N){ub=n;Hb=N;return I}function u(n,I){var N=n.next();if(N=='"'||N=="'"){I.tokenize=g(N);return I.tokenize(n,I)}else if(N=="."&&n.match(/^\d+(?:[eE][+\-]?\d+)?/))return w("number","number");else if(N=="."&&n.match(".."))return w("spread","meta");
else if(/[\[\]{}\(\),;\:\.]/.test(N))return w(N);else if(N=="="&&n.eat(">"))return w("=>","operator");else if(N=="0"&&n.eat(/x/i)){n.eatWhile(/[\da-f]/i);return w("number","number")}else if(/\d/.test(N)){n.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);return w("number","number")}else if(N=="/")if(n.eat("*")){I.tokenize=l;return l(n,I)}else if(n.eat("/")){n.skipToEnd();return w("comment","comment")}else if(I.lastType=="operator"||I.lastType=="keyword c"||I.lastType=="sof"||/^[\[{}\(,;:]$/.test(I.lastType)){N=
false;for(var K,ka=false;(K=n.next())!=null;){if(!N){if(K=="/"&&!ka)break;if(K=="[")ka=true;else if(ka&&K=="]")ka=false}N=!N&&K=="\\"}n.eatWhile(/[gimy]/);return w("regexp","string-2")}else{n.eatWhile(Db);return w("operator","operator",n.current())}else if(N=="`"){I.tokenize=q;return q(n,I)}else if(N=="#"){n.skipToEnd();return w("error","error")}else if(Db.test(N)){n.eatWhile(Db);return w("operator","operator",n.current())}else if(Za.test(N)){n.eatWhile(Za);N=n.current();return(K=hb.propertyIsEnumerable(N)&&
hb[N])&&I.lastType!="."?w(K.type,K.style,N):w("variable","variable",N)}}function g(n){return function(I,N){var K=false,ka;if(hc&&I.peek()=="@"&&I.match(ad)){N.tokenize=u;return w("jsonld-keyword","meta")}for(;(ka=I.next())!=null;){if(ka==n&&!K)break;K=!K&&ka=="\\"}if(!K)N.tokenize=u;return w("string","string")}}function l(n,I){for(var N=false,K;K=n.next();){if(K=="/"&&N){I.tokenize=u;break}N=K=="*"}return w("comment","comment")}function q(n,I){for(var N=false,K;(K=n.next())!=null;){if(!N&&(K=="`"||
K=="$"&&n.eat("{"))){I.tokenize=u;break}N=!N&&K=="\\"}return w("quasi","string-2",n.current())}function v(n,I){if(I.fatArrowAt)I.fatArrowAt=null;var N=n.string.indexOf("=>",n.start);if(!(N<0)){var K=0,ka=false;for(N-=1;N>=0;--N){var za=n.string.charAt(N),Ra=bd.indexOf(za);if(Ra>=0&&Ra<3){if(!K){++N;break}if(--K==0)break}else if(Ra>=3&&Ra<6)++K;else if(Za.test(za))ka=true;else if(/["'\/]/.test(za))return;else if(ka&&!K){++N;break}}if(ka&&!K)I.fatArrowAt=N}}function A(n,I,N,K,ka,za){this.indented=n;
this.column=I;this.type=N;this.prev=ka;this.info=za;if(K!=null)this.align=K}function M(){for(var n=arguments.length-1;n>=0;n--)aa.cc.push(arguments[n])}function x(){M.apply(null,arguments);return true}function J(n){function I(K){for(;K;K=K.next)if(K.name==n)return true;return false}var N=aa.state;if(N.context){aa.marked="def";if(!I(N.localVars))N.localVars={name:n,next:N.localVars}}else if(!I(N.globalVars))if(X.globalVars)N.globalVars={name:n,next:N.globalVars}}function H(){aa.state.context={prev:aa.state.context,
vars:aa.state.localVars};aa.state.localVars=Ac}function E(){aa.state.localVars=aa.state.context.vars;aa.state.context=aa.state.context.prev}function B(n,I){var N=function(){var K=aa.state,ka=K.indented;if(K.lexical.type=="stat")ka=K.lexical.indented;else for(var za=K.lexical;za&&za.type==")"&&za.align;za=za.prev)ka=za.indented;K.lexical=new A(ka,aa.stream.column(),n,null,K.lexical,I)};N.lex=true;return N}function z(){var n=aa.state;if(n.lexical.prev){if(n.lexical.type==")")n.indented=n.lexical.indented;
n.lexical=n.lexical.prev}}function y(n){function I(N){return N==n?x():n==";"?M():x(I)}return I}function Q(n,I){if(n=="var")return x(B("vardef",I.length),R,y(";"),z);if(n=="keyword a")return x(B("form"),$,Q,z);if(n=="keyword b")return x(B("form"),Q,z);if(n=="{")return x(B("}"),ua,z);if(n==";")return x();if(n=="if"){aa.state.lexical.info=="else"&&aa.state.cc[aa.state.cc.length-1]==z&&aa.state.cc.pop()();return x(B("form"),$,Q,z,ja)}if(n=="function")return x(Ba);if(n=="for")return x(B("form"),Y,Q,z);
if(n=="variable")return x(B("stat"),ba);if(n=="switch")return x(B("form"),$,B("}","switch"),y("{"),ua,z,z);if(n=="case")return x($,y(":"));if(n=="default")return x(y(":"));if(n=="catch")return x(B("form"),H,y("("),bc,y(")"),Q,z,E);if(n=="module")return x(B("form"),H,Zc,E,z);if(n=="class")return x(B("form"),cc,z);if(n=="export")return x(B("form"),Yc,z);if(n=="import")return x(B("form"),ec,z);return M(B("stat"),$,y(";"),z)}function $(n){return cb(n,false)}function Ga(n){return cb(n,true)}function cb(n,
I){if(aa.state.fatArrowAt==aa.stream.start){var N=I?O:G;if(n=="(")return x(H,B(")"),ma(r,")"),z,y("=>"),N,E);else if(n=="variable")return M(H,r,y("=>"),N,E)}N=I?S:Ea;if(cd.hasOwnProperty(n))return x(N);if(n=="function")return x(Ba,N);if(n=="keyword c")return x(I?Ja:Va);if(n=="(")return x(B(")"),Va,Fb,y(")"),z,N);if(n=="operator"||n=="spread")return x(I?Ga:$);if(n=="[")return x(B("]"),Rb,z,N);if(n=="{")return Aa(ra,"}",null,N);if(n=="quasi")return M(T,N);return x()}function Va(n){if(n.match(/[;\}\)\],]/))return M();
return M($)}function Ja(n){if(n.match(/[;\}\)\],]/))return M();return M(Ga)}function Ea(n,I){if(n==",")return x($);return S(n,I,false)}function S(n,I,N){var K=N==false?Ea:S,ka=N==false?$:Ga;if(n=="=>")return x(H,N?O:G,E);if(n=="operator"){if(/\+\+|--/.test(I))return x(K);if(I=="?")return x($,y(":"),ka);return x(ka)}if(n=="quasi")return M(T,K);if(n!=";"){if(n=="(")return Aa(Ga,")","call",K);if(n==".")return x(wa,K);if(n=="[")return x(B("]"),Va,y("]"),z,K)}}function T(n,I){if(n!="quasi")return M();
if(I.slice(I.length-2)!="${")return x(T);return x($,C)}function C(n){if(n=="}"){aa.marked="string-2";aa.state.tokenize=q;return x(T)}}function G(n){v(aa.stream,aa.state);return M(n=="{"?Q:$)}function O(n){v(aa.stream,aa.state);return M(n=="{"?Q:Ga)}function ba(n){if(n==":")return x(z,Q);return M(Ea,y(";"),z)}function wa(n){if(n=="variable"){aa.marked="property";return x()}}function ra(n,I){if(n=="variable"||aa.style=="keyword"){aa.marked="property";if(I=="get"||I=="set")return x(la);return x(Z)}else if(n==
"number"||n=="string"){aa.marked=hc?"property":aa.style+" property";return x(Z)}else if(n=="jsonld-keyword")return x(Z);else if(n=="[")return x($,y("]"),Z)}function la(n){if(n!="variable")return M(Z);aa.marked="property";return x(Ba)}function Z(n){if(n==":")return x(Ga);if(n=="(")return M(Ba)}function ma(n,I){function N(K){if(K==","){K=aa.state.lexical;if(K.info=="call")K.pos=(K.pos||0)+1;return x(n,N)}if(K==I)return x();return x(y(I))}return function(K){if(K==I)return x();return M(n,N)}}function Aa(n,
I,N){for(var K=3;K<arguments.length;K++)aa.cc.push(arguments[K]);return x(B(I,N),ma(n,I),z)}function ua(n){if(n=="}")return x();return M(Q,ua)}function P(n){if(yc&&n==":")return x(V)}function V(n){if(n=="variable"){aa.marked="variable-3";return x()}}function R(){return M(r,P,s,U)}function r(n,I){if(n=="variable"){J(I);return x()}if(n=="[")return Aa(r,"]");if(n=="{")return Aa(F,"}")}function F(n,I){if(n=="variable"&&!aa.stream.match(/^\s*:/,false)){J(I);return x(s)}if(n=="variable")aa.marked="property";
return x(y(":"),r,s)}function s(n,I){if(I=="=")return x(Ga)}function U(n){if(n==",")return x(R)}function ja(n,I){if(n=="keyword b"&&I=="else")return x(B("form","else"),Q,z)}function Y(n){if(n=="(")return x(B(")"),Ka,y(")"),z)}function Ka(n){if(n=="var")return x(R,y(";"),xa);if(n==";")return x(xa);if(n=="variable")return x(Ha);return M($,y(";"),xa)}function Ha(n,I){if(I=="in"||I=="of"){aa.marked="keyword";return x($)}return x(Ea,xa)}function xa(n,I){if(n==";")return x(eb);if(I=="in"||I=="of"){aa.marked=
"keyword";return x($)}return M($,y(";"),eb)}function eb(n){n!=")"&&x($)}function Ba(n,I){if(I=="*"){aa.marked="keyword";return x(Ba)}if(n=="variable"){J(I);return x(Ba)}if(n=="(")return x(H,B(")"),ma(bc,")"),z,Q,E)}function bc(n){if(n=="spread")return x(bc);return M(r,P)}function cc(n,I){if(n=="variable"){J(I);return x(Ma)}}function Ma(n,I){if(I=="extends")return x($,Ma);if(n=="{")return x(B("}"),qb,z)}function qb(n,I){if(n=="variable"||aa.style=="keyword"){aa.marked="property";if(I=="get"||I=="set")return x(Xc,
Ba,qb);return x(Ba,qb)}if(I=="*"){aa.marked="keyword";return x(qb)}if(n==";")return x(qb);if(n=="}")return x()}function Xc(n){if(n!="variable")return M();aa.marked="property";return x()}function Zc(n,I){if(n=="string")return x(Q);if(n=="variable"){J(I);return x(fc)}}function Yc(n,I){if(I=="*"){aa.marked="keyword";return x(fc,y(";"))}if(I=="default"){aa.marked="keyword";return x($,y(";"))}return M(Q)}function ec(n){if(n=="string")return x();return M(xc,fc)}function xc(n,I){if(n=="{")return Aa(xc,"}");
n=="variable"&&J(I);return x()}function fc(n,I){if(I=="from"){aa.marked="keyword";return x($)}}function Rb(n){if(n=="]")return x();return M(Ga,Ld)}function Ld(n){if(n=="for")return M(Fb,y("]"));if(n==",")return x(ma(Ja,"]"));return M(ma(Ga,"]"))}function Fb(n){if(n=="for")return x(Y,Fb);if(n=="if")return x($,Fb)}var db=ca.indentUnit,$c=X.statementIndent,hc=X.jsonld,fb=X.json||hc,yc=X.typescript,Za=X.wordCharacters||/[\w$\xa1-\uffff]/,hb=function(){function n(vb){return{type:vb,style:"keyword"}}var I=
n("keyword a"),N=n("keyword b"),K=n("keyword c"),ka=n("operator"),za={type:"atom",style:"atom"};I={"if":n("if"),"while":I,"with":I,"else":N,"do":N,"try":N,"finally":N,"return":K,"break":K,"continue":K,"new":K,"delete":K,"throw":K,"debugger":K,"var":n("var"),"const":n("var"),let:n("var"),"function":n("function"),"catch":n("catch"),"for":n("for"),"switch":n("switch"),"case":n("case"),"default":n("default"),"in":ka,"typeof":ka,"instanceof":ka,"true":za,"false":za,"null":za,undefined:za,NaN:za,Infinity:za,
"this":n("this"),module:n("module"),"class":n("class"),"super":n("atom"),yield:K,"export":n("export"),"import":n("import"),"extends":K};if(yc){N={type:"variable",style:"variable-3"};N={"interface":n("interface"),"extends":n("extends"),constructor:n("constructor"),"public":n("public"),"private":n("private"),"protected":n("protected"),"static":n("static"),string:N,number:N,bool:N,any:N};for(var Ra in N)I[Ra]=N[Ra]}return I}(),Db=/[+\-*&%=<>!?|~^]/,ad=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,
ub,Hb,bd="([{}])",cd={atom:true,number:true,variable:true,string:true,regexp:true,"this":true,"jsonld-keyword":true},aa={state:null,column:null,marked:null,cc:null},Ac={name:"this",next:{name:"arguments"}};z.lex=true;return{startState:function(n){n={tokenize:u,lastType:"sof",cc:[],lexical:new A((n||0)-db,0,"block",false),localVars:X.localVars,context:X.localVars&&{vars:X.localVars},indented:0};if(X.globalVars&&typeof X.globalVars=="object")n.globalVars=X.globalVars;return n},token:function(n,I){if(n.sol()){if(!I.lexical.hasOwnProperty("align"))I.lexical.align=
false;I.indented=n.indentation();v(n,I)}if(I.tokenize!=l&&n.eatSpace())return null;var N=I.tokenize(n,I);if(ub=="comment")return N;I.lastType=ub=="operator"&&(Hb=="++"||Hb=="--")?"incdec":ub;var K;a:{var ka=ub,za=Hb,Ra=I.cc;aa.state=I;aa.stream=n;aa.marked=null;aa.cc=Ra;aa.style=N;if(!I.lexical.hasOwnProperty("align"))I.lexical.align=true;for(;;)if((Ra.length?Ra.pop():fb?$:Q)(ka,za)){for(;Ra.length&&Ra[Ra.length-1].lex;)Ra.pop()();if(aa.marked){K=aa.marked;break a}if(K=ka=="variable")b:{for(K=I.localVars;K;K=
K.next)if(K.name==za){K=true;break b}for(ka=I.context;ka;ka=ka.prev)for(K=ka.vars;K;K=K.next)if(K.name==za){K=true;break b}K=void 0}if(K){K="variable-2";break a}K=N;break a}}return K},indent:function(n,I){if(n.tokenize==l)return j.Pass;if(n.tokenize!=u)return 0;var N=I&&I.charAt(0),K=n.lexical;if(!/^\s*else\b/.test(I))for(var ka=n.cc.length-1;ka>=0;--ka){var za=n.cc[ka];if(za==z)K=K.prev;else if(za!=ja)break}if(K.type=="stat"&&N=="}")K=K.prev;if($c&&K.type==")"&&K.prev.type=="stat")K=K.prev;ka=K.type;
za=N==ka;return ka=="vardef"?K.indented+(n.lastType=="operator"||n.lastType==","?K.info+1:0):ka=="form"&&N=="{"?K.indented:ka=="form"?K.indented+db:ka=="stat"?K.indented+(n.lastType=="operator"||n.lastType==","||Db.test(I.charAt(0))||/[,.]/.test(I.charAt(0))?$c||db:0):K.info=="switch"&&!za&&X.doubleIndentSwitch!=false?K.indented+(/^(?:case|default)\b/.test(I)?db:2*db):K.align?K.column+(za?0:1):K.indented+(za?0:db)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:fb?null:"/*",blockCommentEnd:fb?
null:"*/",lineComment:fb?null:"//",fold:"brace",helperType:fb?"json":"javascript",jsonldMode:hc,jsonMode:fb}});j.registerHelper("wordChars","javascript",/[\w$]/);j.defineMIME("text/javascript","javascript");j.defineMIME("text/ecmascript","javascript");j.defineMIME("application/javascript","javascript");j.defineMIME("application/x-javascript","javascript");j.defineMIME("application/ecmascript","javascript");j.defineMIME("application/json",{name:"javascript",json:true});j.defineMIME("application/x-json",
{name:"javascript",json:true});j.defineMIME("application/ld+json",{name:"javascript",jsonld:true});j.defineMIME("text/typescript",{name:"javascript",typescript:true});j.defineMIME("application/typescript",{name:"javascript",typescript:true})});(function(j){if(typeof exports=="object"&&typeof module=="object")j(require("../../lib/codemirror"));else typeof define=="function"&&define.amd?define(["../../lib/codemirror"],j):j(CodeMirror)})(function(j){j.defineMode("lua",function(ca,X){function w(E){return RegExp("^(?:"+E.join("|")+")$","i")}function u(E,B){var z=E.next();if(z=="-"&&E.eat("-")){if(E.eat("[")){for(z={level:0,isBlock:false};E.eat("=");)++z.level;if(E.next()=="[")z.isBlock=true;if(z.isBlock){E.backUp(z.level);return(B.cur=g(z.level,
"comment"))(E,B)}}E.skipToEnd();return"comment"}if(z=='"'||z=="'")return(B.cur=l(z))(E,B);if(z=="["&&/[\[=]/.test(E.peek())){z=g;for(var y=0;E.eat("=");)++y;E.eat("[");return(B.cur=z(y,"string"))(E,B)}if(/\d/.test(z)){E.eatWhile(/[\w.%]/);return"number"}if(/[\w_]/.test(z)){E.eatWhile(/[\w\\\-_.]/);return"variable"}return null}function g(E,B){return function(z,y){for(var Q=null,$;($=z.next())!=null;)if(Q==null){if($=="]")Q=0}else if($=="=")++Q;else if($=="]"&&Q==E){y.cur=u;break}else Q=null;return B}}
function l(E){return function(B,z){for(var y=false,Q;(Q=B.next())!=null;){if(Q==E&&!y)break;y=!y&&Q=="\\"}if(!y)z.cur=u;return"string"}}var q=ca.indentUnit,v=w(X.specials||[]),A=w(["_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load","loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require","select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall","coroutine.create","coroutine.resume",
"coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield","debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable","debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable","debug.setupvalue","debug.traceback","close","flush","lines","read","seek","setvbuf","write","io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin","io.stdout","io.tmpfile",
"io.type","io.write","math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg","math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max","math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh","math.sqrt","math.tan","math.tanh","os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale","os.time","os.tmpname",
"package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload","package.seeall","string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub","string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper","table.concat","table.insert","table.maxn","table.remove","table.sort"]),M=w(["and","break","elseif","false","nil","not","or","return","true","function","end","if","then","else","do",
"while","repeat","until","for","in","local"]),x=w(["function","if","repeat","do","\\(","{"]),J=w(["end","until","\\)","}"]),H=/^(?:end|until|\)|}|else|elseif)/i;return{startState:function(E){return{basecol:E||0,indentDepth:0,cur:u}},token:function(E,B){if(E.eatSpace())return null;var z=B.cur(E,B),y=E.current();if(z=="variable")if(M.test(y))z="keyword";else if(A.test(y))z="builtin";else if(v.test(y))z="variable-2";if(z!="comment"&&z!="string")if(x.test(y))++B.indentDepth;else J.test(y)&&--B.indentDepth;
return z},indent:function(E,B){var z=H.test(B);return E.basecol+q*(E.indentDepth-(z?1:0))},lineComment:"--",blockCommentStart:"--[[",blockCommentEnd:"]]"}});j.defineMIME("text/x-lua","lua")});(function(j){if(typeof exports=="object"&&typeof module=="object")j(require("../../lib/codemirror"));else typeof define=="function"&&define.amd?define(["../../lib/codemirror"],j):j(CodeMirror)})(function(j){j.defineMode("sql",function(ca,X){function w(B,z){var y=B.next();if(H[y]){var Q=H[y](B,z);if(Q!==false)return Q}if(J.hexNumber==true&&(y=="0"&&B.match(/^[xX][0-9a-fA-F]+/)||(y=="x"||y=="X")&&B.match(/^'[0-9a-fA-F]+'/)))return"number";else if(J.binaryNumber==true&&((y=="b"||y=="B")&&B.match(/^'[01]+'/)||
y=="0"&&B.match(/^b[01]+/)))return"number";else if(y.charCodeAt(0)>47&&y.charCodeAt(0)<58){B.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/);J.decimallessFloat==true&&B.eat(".");return"number"}else if(y=="?"&&(B.eatSpace()||B.eol()||B.eat(";")))return"variable-3";else if(y=="'"||y=='"'&&J.doubleQuote){z.tokenize=u(y);return z.tokenize(B,z)}else if((J.nCharCast==true&&(y=="n"||y=="N")||J.charsetCast==true&&y=="_"&&B.match(/[a-z][a-z0-9]*/i))&&(B.peek()=="'"||B.peek()=='"'))return"keyword";else if(/^[\(\),\;\[\]]/.test(y))return null;
else if(J.commentSlashSlash&&y=="/"&&B.eat("/")){B.skipToEnd();return"comment"}else if(J.commentHash&&y=="#"||y=="-"&&B.eat("-")&&(!J.commentSpaceRequired||B.eat(" "))){B.skipToEnd();return"comment"}else if(y=="/"&&B.eat("*")){z.tokenize=g;return z.tokenize(B,z)}else if(y=="."){if(J.zerolessFloat==true&&B.match(/^(?:\d+(?:e[+-]?\d+)?)/i))return"number";if(J.ODBCdotTable==true&&B.match(/^[a-zA-Z_]+/))return"variable-2"}else if(x.test(y)){B.eatWhile(x);return null}else if(y=="{"&&(B.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||
B.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";else{B.eatWhile(/^[_\w\d]/);y=B.current().toLowerCase();if(E.hasOwnProperty(y)&&(B.match(/^( )+'[^']*'/)||B.match(/^( )+"[^"]*"/)))return"number";if(v.hasOwnProperty(y))return"atom";if(A.hasOwnProperty(y))return"builtin";if(M.hasOwnProperty(y))return"keyword";if(q.hasOwnProperty(y))return"string-2";return null}}function u(B){return function(z,y){for(var Q=false,$;($=z.next())!=null;){if($==B&&!Q){y.tokenize=w;break}Q=!Q&&$=="\\"}return"string"}}
function g(B,z){for(;;)if(B.skipTo("*")){B.next();if(B.eat("/")){z.tokenize=w;break}}else{B.skipToEnd();break}return"comment"}function l(B,z,y){z.context={prev:z.context,indent:B.indentation(),col:B.column(),type:y}}var q=X.client||{},v=X.atoms||{"false":true,"true":true,"null":true},A=X.builtin||{},M=X.keywords||{},x=X.operatorChars||/^[*+\-%<>!=&|~^]/,J=X.support||{},H=X.hooks||{},E=X.dateSQL||{date:true,time:true,timestamp:true};return{startState:function(){return{tokenize:w,context:null}},token:function(B,
z){if(B.sol())if(z.context&&z.context.align==null)z.context.align=false;if(B.eatSpace())return null;var y=z.tokenize(B,z);if(y=="comment")return y;if(z.context&&z.context.align==null)z.context.align=true;var Q=B.current();if(Q=="(")l(B,z,")");else if(Q=="[")l(B,z,"]");else if(z.context&&z.context.type==Q){z.indent=z.context.indent;z.context=z.context.prev}return y},indent:function(B,z){var y=B.context;if(!y)return 0;var Q=z.charAt(0)==y.type;return y.align?y.col+(Q?0:1):y.indent+(Q?0:ca.indentUnit)},
blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:J.commentSlashSlash?"//":J.commentHash?"#":null}});(function(){function ca(g){for(var l;(l=g.next())!=null;)if(l=="`"&&!g.eat("`"))return"variable-2";g.backUp(g.current().length-1);return g.eatWhile(/\w/)?"variable-2":null}function X(g){if(g.eat("@")){g.match(/^session\./);g.match(/^local\./);g.match(/^global\./)}if(g.eat("'")){g.match(/^.*'/);return"variable-2"}else if(g.eat('"')){g.match(/^.*"/);return"variable-2"}else if(g.eat("`")){g.match(/^.*`/);
return"variable-2"}else if(g.match(/^[0-9a-zA-Z$\.\_]+/))return"variable-2";return null}function w(g){if(g.eat("N"))return"atom";return g.match(/^[a-zA-Z.#!?]/)?"variable-2":null}function u(g){var l={};g=g.split(" ");for(var q=0;q<g.length;++q)l[g[q]]=true;return l}j.defineMIME("text/x-sql",{name:"sql",keywords:u("alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where begin"),builtin:u("bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"),
atoms:u("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:u("date time timestamp"),support:u("ODBCdotTable doubleQuote binaryNumber hexNumber")});j.defineMIME("text/x-mssql",{name:"sql",client:u("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:u("alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered"),
builtin:u("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),atoms:u("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:u("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":X}});j.defineMIME("text/x-mysql",{name:"sql",client:u("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),
keywords:u("alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group groupby_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
builtin:u("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:u("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:u("date time timestamp"),support:u("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),
hooks:{"@":X,"`":ca,"\\":w}});j.defineMIME("text/x-mariadb",{name:"sql",client:u("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:u("alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
builtin:u("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:u("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:u("date time timestamp"),support:u("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),
hooks:{"@":X,"`":ca,"\\":w}});j.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:u("use select from using consistency where limit first reversed first and in insert into values using consistency ttl update set delete truncate begin batch apply create keyspace with columnfamily primary key index on drop alter type add any one quorum all local_quorum each_quorum"),builtin:u("ascii bigint blob boolean counter decimal double float int text timestamp uuid varchar varint"),atoms:u("false true"),
operatorChars:/^[<>=]/,dateSQL:{},support:u("commentSlashSlash decimallessFloat"),hooks:{}});j.defineMIME("text/x-plsql",{name:"sql",client:u("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),
keywords:u("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),
builtin:u("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),
operatorChars:/^[*+\-%<>!=~]/,dateSQL:u("date time timestamp"),support:u("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")});j.defineMIME("text/x-hive",{name:"sql",keywords:u("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),
builtin:u("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),atoms:u("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:u("date timestamp"),support:u("ODBCdotTable doubleQuote binaryNumber hexNumber")})})()});(function(j){if(typeof exports=="object"&&typeof module=="object")j(require("../../lib/codemirror"));else typeof define=="function"&&define.amd?define(["../../lib/codemirror"],j):j(CodeMirror)})(function(j){j.defineMode("xml",function(ca,X){function w(C,G){function O(wa){G.tokenize=wa;return wa(C,G)}var ba=C.next();if(ba=="<")if(C.eat("!"))if(C.eat("["))return C.match("CDATA[")?O(l("atom","]]\>")):null;else if(C.match("--"))return O(l("comment","--\>"));else if(C.match("DOCTYPE",true,true)){C.eatWhile(/[\w\._\-]/);
return O(q(1))}else return null;else if(C.eat("?")){C.eatWhile(/[\w\._\-]/);G.tokenize=l("meta","?>");return"meta"}else{S=C.eat("/")?"closeTag":"openTag";G.tokenize=u;return"tag bracket"}else if(ba=="&")return(C.eat("#")?C.eat("x")?C.eatWhile(/[a-fA-F\d]/)&&C.eat(";"):C.eatWhile(/[\d]/)&&C.eat(";"):C.eatWhile(/[\w\.\-:]/)&&C.eat(";"))?"atom":"error";else{C.eatWhile(/[^&<]/);return null}}function u(C,G){var O=C.next();if(O==">"||O=="/"&&C.eat(">")){G.tokenize=w;S=O==">"?"endTag":"selfcloseTag";return"tag bracket"}else if(O==
"="){S="equals";return null}else if(O=="<"){G.tokenize=w;G.state=x;G.tagName=G.tagStart=null;return(O=G.tokenize(C,G))?O+" tag error":"tag error"}else if(/[\'\"]/.test(O)){G.tokenize=g(O);G.stringStartCol=C.column();return G.tokenize(C,G)}else{C.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);return"word"}}function g(C){var G=function(O,ba){for(;!O.eol();)if(O.next()==C){ba.tokenize=u;break}return"string"};G.isInAttribute=true;return G}function l(C,G){return function(O,ba){for(;!O.eol();){if(O.match(G)){ba.tokenize=
w;break}O.next()}return C}}function q(C){return function(G,O){for(var ba;(ba=G.next())!=null;)if(ba=="<"){O.tokenize=q(C+1);return O.tokenize(G,O)}else if(ba==">")if(C==1){O.tokenize=w;break}else{O.tokenize=q(C-1);return O.tokenize(G,O)}return"meta"}}function v(C,G,O){this.prev=C.context;this.tagName=G;this.indent=C.indented;this.startOfLine=O;if(Ja.doNotIndent.hasOwnProperty(G)||C.context&&C.context.noIndent)this.noIndent=true}function A(C){if(C.context)C.context=C.context.prev}function M(C,G){for(var O;;){if(!C.context)break;
O=C.context.tagName;if(!Ja.contextGrabbers.hasOwnProperty(O)||!Ja.contextGrabbers[O].hasOwnProperty(G))break;A(C)}}function x(C,G,O){if(C=="openTag"){O.tagStart=G.column();return J}else return C=="closeTag"?H:x}function J(C,G,O){if(C=="word"){O.tagName=G.current();T="tag";return z}else{T="error";return J}}function H(C,G,O){if(C=="word"){C=G.current();O.context&&O.context.tagName!=C&&Ja.implicitlyClosed.hasOwnProperty(O.context.tagName)&&A(O);if(O.context&&O.context.tagName==C){T="tag";return E}else{T=
"tag error";return B}}else{T="error";return B}}function E(C,G,O){if(C!="endTag"){T="error";return E}A(O);return x}function B(C,G,O){T="error";return E(C,G,O)}function z(C,G,O){if(C=="word"){T="attribute";return y}else if(C=="endTag"||C=="selfcloseTag"){G=O.tagName;var ba=O.tagStart;O.tagName=O.tagStart=null;if(C=="selfcloseTag"||Ja.autoSelfClosers.hasOwnProperty(G))M(O,G);else{M(O,G);O.context=new v(O,G,ba==O.indented)}return x}T="error";return z}function y(C,G,O){if(C=="equals")return Q;Ja.allowMissing||
(T="error");return z(C,G,O)}function Q(C,G,O){if(C=="string")return $;if(C=="word"&&Ja.allowUnquoted){T="string";return z}T="error";return z(C,G,O)}function $(C,G,O){if(C=="string")return $;return z(C,G,O)}var Ga=ca.indentUnit,cb=X.multilineTagIndentFactor||1,Va=X.multilineTagIndentPastTag;if(Va==null)Va=true;var Ja=X.htmlMode?{autoSelfClosers:{area:true,base:true,br:true,col:true,command:true,embed:true,frame:true,hr:true,img:true,input:true,keygen:true,link:true,meta:true,param:true,source:true,
track:true,wbr:true,menuitem:true},implicitlyClosed:{dd:true,li:true,optgroup:true,option:true,p:true,rp:true,rt:true,tbody:true,td:true,tfoot:true,th:true,tr:true},contextGrabbers:{dd:{dd:true,dt:true},dt:{dd:true,dt:true},li:{li:true},option:{option:true,optgroup:true},optgroup:{optgroup:true},p:{address:true,article:true,aside:true,blockquote:true,dir:true,div:true,dl:true,fieldset:true,footer:true,form:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,header:true,hgroup:true,hr:true,menu:true,
nav:true,ol:true,p:true,pre:true,section:true,table:true,ul:true},rp:{rp:true,rt:true},rt:{rp:true,rt:true},tbody:{tbody:true,tfoot:true},td:{td:true,th:true},tfoot:{tbody:true},th:{td:true,th:true},thead:{tbody:true,tfoot:true},tr:{tr:true}},doNotIndent:{pre:true},allowUnquoted:true,allowMissing:true,caseFold:true}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:false,allowMissing:false,caseFold:false},Ea=X.alignCDATA,S,T;return{startState:function(){return{tokenize:w,
state:x,indented:0,tagName:null,tagStart:null,context:null}},token:function(C,G){if(!G.tagName&&C.sol())G.indented=C.indentation();if(C.eatSpace())return null;S=null;var O=G.tokenize(C,G);if((O||S)&&O!="comment"){T=null;G.state=G.state(S||O,C,G);if(T)O=T=="error"?O+" error":T}return O},indent:function(C,G,O){var ba=C.context;if(C.tokenize.isInAttribute)return C.tagStart==C.indented?C.stringStartCol+1:C.indented+Ga;if(ba&&ba.noIndent)return j.Pass;if(C.tokenize!=u&&C.tokenize!=w)return O?O.match(/^(\s*)/)[0].length:
0;if(C.tagName)return Va?C.tagStart+C.tagName.length+2:C.tagStart+Ga*cb;if(Ea&&/<!\[CDATA\[/.test(G))return 0;if((C=G&&/^<(\/)?([\w_:\.-]*)/.exec(G))&&C[1])for(;ba;)if(ba.tagName==C[2]){ba=ba.prev;break}else if(Ja.implicitlyClosed.hasOwnProperty(ba.tagName))ba=ba.prev;else break;else if(C)for(;ba;)if((G=Ja.contextGrabbers[ba.tagName])&&G.hasOwnProperty(C[2]))ba=ba.prev;else break;for(;ba&&!ba.startOfLine;)ba=ba.prev;return ba?ba.indent+Ga:0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<\!--",
blockCommentEnd:"--\>",configuration:X.htmlMode?"html":"xml",helperType:X.htmlMode?"html":"xml"}});j.defineMIME("text/xml","xml");j.defineMIME("application/xml","xml");j.mimeModes.hasOwnProperty("text/html")||j.defineMIME("text/html",{name:"xml",htmlMode:true})});(function(j){if(typeof exports=="object"&&typeof module=="object")j(require("../../lib/codemirror"));else typeof define=="function"&&define.amd?define(["../../lib/codemirror"],j):j(CodeMirror)})(function(j){j.defineMode("http",function(){function ca(A,M){A.skipToEnd();M.cur=q;return"error"}function X(A,M){if(A.match(/^HTTP\/\d\.\d/)){M.cur=w;return"keyword"}else if(A.match(/^[A-Z]+/)&&/[ \t]/.test(A.peek())){M.cur=g;return"keyword"}else return ca(A,M)}function w(A,M){var x=A.match(/^\d+/);if(!x)return ca(A,
M);M.cur=u;x=Number(x[0]);return x>=100&&x<200?"positive informational":x>=200&&x<300?"positive success":x>=300&&x<400?"positive redirect":x>=400&&x<500?"negative client-error":x>=500&&x<600?"negative server-error":"error"}function u(A,M){A.skipToEnd();M.cur=q;return null}function g(A,M){A.eatWhile(/\S/);M.cur=l;return"string-2"}function l(A,M){if(A.match(/^HTTP\/\d\.\d$/)){M.cur=q;return"keyword"}else return ca(A,M)}function q(A){if(A.sol()&&!A.eat(/[ \t]/))if(A.match(/^.*?:/))return"atom";else{A.skipToEnd();
return"error"}else{A.skipToEnd();return"string"}}function v(A){A.skipToEnd();return null}return{token:function(A,M){var x=M.cur;if(x!=q&&x!=v&&A.eatSpace())return null;return x(A,M)},blankLine:function(A){A.cur=v},startState:function(){return{cur:X}}}});j.defineMIME("message/http","http")});(function(j){if(typeof exports=="object"&&typeof module=="object")j(require("../../lib/codemirror"));else typeof define=="function"&&define.amd?define(["../../lib/codemirror"],j):j(CodeMirror)})(function(j){function ca(u,g,l,q){this.atOccurrence=false;this.doc=u;if(q==null&&typeof g=="string")q=false;l=l?u.clipPos(l):w(0,0);this.pos={from:l,to:l};if(typeof g!="string"){g.global||(g=RegExp(g.source,g.ignoreCase?"ig":"g"));this.matches=function(J,H){if(J){g.lastIndex=0;for(var E=u.getLine(H.line).slice(0,
H.ch),B=0,z,y;;){g.lastIndex=B;B=g.exec(E);if(!B)break;z=B;y=z.index;B=z.index+(z[0].length||1);if(B==E.length)break}B=z&&z[0].length||0;if(!B)if(y==0&&E.length==0)z=undefined;else y!=u.getLine(H.line).length&&B++}else{g.lastIndex=H.ch;E=u.getLine(H.line);B=(z=g.exec(E))&&z[0].length||0;y=z&&z.index;if(y+B!=E.length&&!B)B=1}if(z&&B)return{from:w(H.line,y),to:w(H.line,y+B),match:z}}}else{var v=g;if(q)g=g.toLowerCase();var A=q?function(J){return J.toLowerCase()}:function(J){return J},M=g.split("\n");
if(M.length==1)this.matches=g.length?function(J,H){if(J){var E=u.getLine(H.line).slice(0,H.ch),B=A(E),z=B.lastIndexOf(g);if(z>-1){z=X(E,B,z);return{from:w(H.line,z),to:w(H.line,z+v.length)}}}else{E=u.getLine(H.line).slice(H.ch);B=A(E);z=B.indexOf(g);if(z>-1){z=X(E,B,z)+H.ch;return{from:w(H.line,z),to:w(H.line,z+v.length)}}}}:function(){};else{var x=v.split("\n");this.matches=function(J,H){var E=M.length-1;if(J){if(!(H.line-(M.length-1)<u.firstLine()))if(A(u.getLine(H.line).slice(0,x[E].length))==
M[M.length-1]){for(var B=w(H.line,x[E].length),z=H.line-1,y=E-1;y>=1;--y,--z)if(M[y]!=A(u.getLine(z)))return;y=u.getLine(z);var Q=y.length-x[0].length;if(A(y.slice(Q))==M[0])return{from:w(z,Q),to:B}}}else if(!(H.line+(M.length-1)>u.lastLine())){y=u.getLine(H.line);Q=y.length-x[0].length;if(A(y.slice(Q))==M[0]){B=w(H.line,Q);z=H.line+1;for(y=1;y<E;++y,++z)if(M[y]!=A(u.getLine(z)))return;if(A(u.getLine(z).slice(0,x[E].length))==M[E])return{from:B,to:w(z,x[E].length)}}}}}}}function X(u,g,l){if(u.length==
g.length)return l;for(g=Math.min(l,u.length);;){var q=u.slice(0,g).toLowerCase().length;if(q<l)++g;else if(q>l)--g;else return g}}var w=j.Pos;ca.prototype={findNext:function(){return this.find(false)},findPrevious:function(){return this.find(true)},find:function(u){function g(A){A=w(A,0);l.pos={from:A,to:A};return l.atOccurrence=false}for(var l=this,q=this.doc.clipPos(u?this.pos.from:this.pos.to);;){if(this.pos=this.matches(u,q)){this.atOccurrence=true;return this.pos.match||true}if(u){if(!q.line)return g(0);
q=w(q.line-1,this.doc.getLine(q.line-1).length)}else{var v=this.doc.lineCount();if(q.line==v-1)return g(v);q=w(q.line+1,0)}}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(u){if(this.atOccurrence){u=j.splitLines(u);this.doc.replaceRange(u,this.pos.from,this.pos.to);this.pos.to=w(this.pos.from.line+u.length-1,u[u.length-1].length+(u.length==1?this.pos.from.ch:0))}}};j.defineExtension("getSearchCursor",function(u,g,
l){return new ca(this.doc,u,g,l)});j.defineDocExtension("getSearchCursor",function(u,g,l){return new ca(this,u,g,l)});j.defineExtension("selectMatches",function(u,g){for(var l=[],q=this.getSearchCursor(u,this.getCursor("from"),g);q.findNext();){if(j.cmpPos(q.to(),this.getCursor("to"))>0)break;l.push({anchor:q.from(),head:q.to()})}l.length&&this.setSelections(l,0)})});(function(){var j=null;window.PR_SHOULD_USE_CONTINUATION=true;(function(){function ca(S){function T(P){var V=P.charCodeAt(0);if(V!==92)return V;var R=P.charAt(1);return(V=Aa[R])?V:"0"<=R&&R<="7"?parseInt(P.substring(1),8):R==="u"||R==="x"?parseInt(P.substring(2),16):P.charCodeAt(1)}function C(P){if(P<32)return(P<16?"\\x0":"\\x")+P.toString(16);P=String.fromCharCode(P);return P==="\\"||P==="-"||P==="]"||P==="^"?"\\"+P:P}function G(P){var V=P.substring(1,P.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g);
P=[];var R=V[0]==="^",r=["["];R&&r.push("^");R=R?1:0;for(var F=V.length;R<F;++R){var s=V[R];if(/\\[bdsw]/i.test(s))r.push(s);else{s=T(s);var U;R+2<F&&"-"===V[R+1]?(U=T(V[R+2]),R+=2):U=s;P.push([s,U]);U<65||s>122||(U<65||s>90||P.push([Math.max(65,s)|32,Math.min(U,90)|32]),U<97||s>122||P.push([Math.max(97,s)&-33,Math.min(U,122)&-33]))}}P.sort(function(ja,Y){return ja[0]-Y[0]||Y[1]-ja[1]});V=[];F=[];for(R=0;R<P.length;++R){s=P[R];s[0]<=F[1]+1?F[1]=Math.max(F[1],s[1]):V.push(F=s)}for(R=0;R<V.length;++R){s=
V[R];r.push(C(s[0]));s[1]>s[0]&&(s[1]+1>s[0]&&r.push("-"),r.push(C(s[1])))}r.push("]");return r.join("")}function O(P){for(var V=P.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),R=V.length,r=[],F=0,s=0;F<R;++F){var U=V[F];U==="("?++s:"\\"===U.charAt(0)&&(U=+U.substring(1))&&(U<=s?r[U]=-1:V[F]=C(U))}for(F=1;F<r.length;++F)-1===r[F]&&(r[F]=++ba);for(s=F=0;F<R;++F){U=V[F];U==="("?(++s,r[s]||(V[F]="(?:")):"\\"===U.charAt(0)&&(U=+U.substring(1))&&
U<=s&&(V[F]="\\"+r[U])}for(F=0;F<R;++F)"^"===V[F]&&"^"!==V[F+1]&&(V[F]="");if(P.ignoreCase&&wa)for(F=0;F<R;++F){U=V[F];P=U.charAt(0);U.length>=2&&P==="["?V[F]=G(U):P!=="\\"&&(V[F]=U.replace(/[A-Za-z]/g,function(ja){ja=ja.charCodeAt(0);return"["+String.fromCharCode(ja&-33,ja|32)+"]"}))}return V.join("")}for(var ba=0,wa=false,ra=false,la=0,Z=S.length;la<Z;++la){var ma=S[la];if(ma.ignoreCase)ra=true;else if(/[a-z]/i.test(ma.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){wa=true;ra=false;
break}}var Aa={b:8,t:9,n:10,v:11,f:12,r:13},ua=[];la=0;for(Z=S.length;la<Z;++la){ma=S[la];if(ma.global||ma.multiline)throw Error(""+ma);ua.push("(?:"+O(ma)+")")}return RegExp(ua.join("|"),ra?"gi":"g")}function X(S,T){function C(la){var Z=la.nodeType;if(Z==1){if(!G.test(la.className)){for(Z=la.firstChild;Z;Z=Z.nextSibling)C(Z);Z=la.nodeName.toLowerCase();if("br"===Z||"li"===Z){O[ra]="\n";wa[ra<<1]=ba++;wa[ra++<<1|1]=la}}}else if(Z==3||Z==4){Z=la.nodeValue;Z.length&&(Z=T?Z.replace(/\r\n?/g,"\n"):Z.replace(/[\t\n\r ]+/g,
" "),O[ra]=Z,wa[ra<<1]=ba,ba+=Z.length,wa[ra++<<1|1]=la)}}var G=/(?:^|\s)nocode(?:\s|$)/,O=[],ba=0,wa=[],ra=0;C(S);return{a:O.join("").replace(/\n$/,""),d:wa}}function w(S,T,C,G){T&&(S={a:T,e:S},C(S),G.push.apply(G,S.g))}function u(S){for(var T=void 0,C=S.firstChild;C;C=C.nextSibling){var G=C.nodeType;T=G===1?T?S:C:G===3?cb.test(C.nodeValue)?S:T:T}return T===S?void 0:T}function g(S,T){function C(wa){for(var ra=wa.e,la=[ra,"pln"],Z=0,ma=wa.a.match(O)||[],Aa={},ua=0,P=ma.length;ua<P;++ua){var V=ma[ua],
R=Aa[V],r=void 0,F;if(typeof R==="string")F=false;else{var s=G[V.charAt(0)];if(s){r=V.match(s[1]);R=s[0]}else{for(F=0;F<ba;++F)if(s=T[F],r=V.match(s[1])){R=s[0];break}r||(R="pln")}if((F=R.length>=5&&"lang-"===R.substring(0,5))&&!(r&&typeof r[1]==="string")){F=false;R="src"}F||(Aa[V]=R)}s=Z;Z+=V.length;if(F){F=r[1];var U=V.indexOf(F),ja=U+F.length;r[2]&&(ja=V.length-r[2].length,U=ja-F.length);R=R.substring(5);w(ra+s,V.substring(0,U),C,la);w(ra+s+U,F,A(R,F),la);w(ra+s+ja,V.substring(ja),C,la)}else la.push(ra+
s,R)}wa.g=la}var G={},O;(function(){for(var wa=S.concat(T),ra=[],la={},Z=0,ma=wa.length;Z<ma;++Z){var Aa=wa[Z],ua=Aa[3];if(ua)for(var P=ua.length;--P>=0;)G[ua.charAt(P)]=Aa;Aa=Aa[1];ua=""+Aa;la.hasOwnProperty(ua)||(ra.push(Aa),la[ua]=j)}ra.push(/[\S\s]/);O=ca(ra)})();var ba=T.length;return C}function l(S){var T=[],C=[];S.tripleQuotedStrings?T.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,
j,"'\""]):S.multiLineStrings?T.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,j,"'\"`"]):T.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,j,"\"'"]);S.verbatimStrings&&C.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,j]);var G=S.hashComments;G&&(S.cStyleComments?(G>1?T.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,j,"#"]):T.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,
j,"#"]),C.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,j])):T.push(["com",/^#[^\n\r]*/,j,"#"]));S.cStyleComments&&(C.push(["com",/^\/\/[^\n\r]*/,j]),C.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,j]));if(G=S.regexLiterals){var O=(G=G>1?"":"\n\r")?".":"[\\S\\s]";C.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+
("/(?=[^/*"+G+"])(?:[^/\\x5B\\x5C"+G+"]|\\x5C"+O+"|\\x5B(?:[^\\x5C\\x5D"+G+"]|\\x5C"+O+")*(?:\\x5D|$))+/")+")")])}(G=S.types)&&C.push(["typ",G]);G=(""+S.keywords).replace(/^ | $/g,"");G.length&&C.push(["kwd",RegExp("^(?:"+G.replace(/[\s,]+/g,"|")+")\\b"),j]);T.push(["pln",/^\s+/,j," \r\n\t\u00a0"]);G="^.[^\\s\\w.$@'\"`/\\\\]*";S.regexLiterals&&(G+="(?!s*/)");C.push(["lit",/^@[$_a-z][\w$@]*/i,j],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,j],["pln",/^[$_a-z][\w$@]*/i,j],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,
j,"0123456789"],["pln",/^\\[\S\s]?/,j],["pun",RegExp(G),j]);return g(T,C)}function q(S,T,C){function G(P){var V=P.nodeType;if(V==1&&!ba.test(P.className))if("br"===P.nodeName){O(P);P.parentNode&&P.parentNode.removeChild(P)}else for(P=P.firstChild;P;P=P.nextSibling)G(P);else if((V==3||V==4)&&C){var R=P.nodeValue,r=R.match(wa);if(r){V=R.substring(0,r.index);P.nodeValue=V;(R=R.substring(r.index+r[0].length))&&P.parentNode.insertBefore(ra.createTextNode(R),P.nextSibling);O(P);V||P.parentNode.removeChild(P)}}}
function O(P){function V(r,F){var s=F?r.cloneNode(false):r,U=r.parentNode;if(U){U=V(U,1);var ja=r.nextSibling;U.appendChild(s);for(var Y=ja;Y;Y=ja){ja=Y.nextSibling;U.appendChild(Y)}}return s}for(;!P.nextSibling;)if(P=P.parentNode,!P)return;P=V(P.nextSibling,0);for(var R;(R=P.parentNode)&&R.nodeType===1;)P=R;Z.push(P)}for(var ba=/(?:^|\s)nocode(?:\s|$)/,wa=/\r\n?|\n/,ra=S.ownerDocument,la=ra.createElement("li");S.firstChild;)la.appendChild(S.firstChild);for(var Z=[la],ma=0;ma<Z.length;++ma)G(Z[ma]);
T===(T|0)&&Z[0].setAttribute("value",T);var Aa=ra.createElement("ol");Aa.className="linenums";T=Math.max(0,T-1|0)||0;ma=0;for(var ua=Z.length;ma<ua;++ma){la=Z[ma];la.className="L"+(ma+T)%10;la.firstChild||la.appendChild(ra.createTextNode("\u00a0"));Aa.appendChild(la)}S.appendChild(Aa)}function v(S,T){for(var C=T.length;--C>=0;){var G=T[C];Ja.hasOwnProperty(G)?x.console&&console.warn("cannot override language handler %s",G):Ja[G]=S}}function A(S,T){if(!S||!Ja.hasOwnProperty(S))S=/^\s*</.test(T)?"default-markup":
"default-code";return Ja[S]}function M(S){var T=S.h;try{var C=X(S.c,S.i),G=C.a;S.a=G;S.d=C.d;S.e=0;A(T,G)(S);var O=/\bMSIE\s(\d+)/.exec(navigator.userAgent);O=O&&+O[1]<=8;T=/\n/g;var ba=S.a,wa=ba.length;C=0;var ra=S.d,la=ra.length;G=0;var Z=S.g,ma=Z.length,Aa=0;Z[ma]=wa;var ua,P;for(P=ua=0;P<ma;)Z[P]!==Z[P+2]?(Z[ua++]=Z[P++],Z[ua++]=Z[P++]):P+=2;ma=ua;for(P=ua=0;P<ma;){for(var V=Z[P],R=Z[P+1],r=P+2;r+2<=ma&&Z[r+1]===R;)r+=2;Z[ua++]=V;Z[ua++]=R;P=r}Z.length=ua;var F=S.c,s;if(F){s=F.style.display;F.style.display=
"none"}try{for(;G<la;){var U=ra[G+2]||wa,ja=Z[Aa+2]||wa;r=Math.min(U,ja);var Y=ra[G+1],Ka;if(Y.nodeType!==1&&(Ka=ba.substring(C,r))){O&&(Ka=Ka.replace(T,"\r"));Y.nodeValue=Ka;var Ha=Y.ownerDocument,xa=Ha.createElement("span");xa.className=Z[Aa+1];var eb=Y.parentNode;eb.replaceChild(xa,Y);xa.appendChild(Y);C<U&&(ra[G+1]=Y=Ha.createTextNode(ba.substring(r,U)),eb.insertBefore(Y,xa.nextSibling))}C=r;C>=U&&(G+=2);C>=ja&&(Aa+=2)}}finally{if(F)F.style.display=s}}catch(Ba){x.console&&console.log(Ba&&Ba.stack||
Ba)}}var x=window,J=["break,continue,do,else,for,if,return,while"],H=[[J,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],E=[H,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],
B=[H,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],z=[B,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"];H=[H,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];
var y=[J,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],Q=[J,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],$=[J,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"];J=[J,
"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var Ga=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,cb=/\S/,Va=l({keywords:[E,z,H,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",y,Q,J],hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true}),Ja={};v(Va,["default-code"]);
v(g([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);v(g([["pln",/^\s+/,j," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,
j,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);v(g([],[["atv",/^[\S\s]+/]]),["uq.val"]);v(l({keywords:E,hashComments:true,
cStyleComments:true,types:Ga}),["c","cc","cpp","cxx","cyc","m"]);v(l({keywords:"null,true,false"}),["json"]);v(l({keywords:z,hashComments:true,cStyleComments:true,verbatimStrings:true,types:Ga}),["cs"]);v(l({keywords:B,cStyleComments:true}),["java"]);v(l({keywords:J,hashComments:true,multiLineStrings:true}),["bash","bsh","csh","sh"]);v(l({keywords:y,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py","python"]);v(l({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",
hashComments:true,multiLineStrings:true,regexLiterals:2}),["perl","pl","pm"]);v(l({keywords:Q,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb","ruby"]);v(l({keywords:H,cStyleComments:true,regexLiterals:true}),["javascript","js"]);v(l({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,
regexLiterals:true}),["coffee"]);v(l({keywords:$,cStyleComments:true,multilineStrings:true}),["rc","rs","rust"]);v(g([],[["str",/^[\S\s]+/]]),["regex"]);var Ea=x.PR={createSimpleLexer:g,registerLangHandler:v,sourceDecorator:l,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:x.prettyPrintOne=function(S,T,C){var G=
document.createElement("div");G.innerHTML="<pre>"+S+"</pre>";G=G.firstChild;C&&q(G,C,true);M({h:T,j:C,c:G,i:1});return G.innerHTML},prettyPrint:x.prettyPrint=function(S,T){function C(){for(var U=x.PR_SHOULD_USE_CONTINUATION?Z.now()+250:Infinity;ma<ba.length&&Z.now()<U;ma++){for(var ja=ba[ma],Y=s,Ka=ja;Ka=Ka.previousSibling;){var Ha=Ka.nodeType,xa=(Ha===7||Ha===8)&&Ka.nodeValue;if(xa?!/^\??prettify\b/.test(xa):Ha!==3||/\S/.test(Ka.nodeValue))break;if(xa){Y={};xa.replace(/\b(\w+)=([\w%+\-.:]+)/g,function(bc,
cc,Ma){Y[cc]=Ma});break}}Ka=ja.className;if((Y!==s||P.test(Ka))&&!V.test(Ka)){Ha=false;for(xa=ja.parentNode;xa;xa=xa.parentNode)if(F.test(xa.tagName)&&xa.className&&P.test(xa.className)){Ha=true;break}if(!Ha){ja.className+=" prettyprinted";Ha=Y.lang;if(!Ha){Ha=Ka.match(ua);var eb;if(!Ha&&(eb=u(ja))&&r.test(eb.tagName))Ha=eb.className.match(ua);Ha&&(Ha=Ha[1])}if(R.test(ja.tagName))xa=1;else{xa=ja.currentStyle;var Ba=O.defaultView;xa=(xa=xa?xa.whiteSpace:Ba&&Ba.getComputedStyle?Ba.getComputedStyle(ja,
j).getPropertyValue("white-space"):0)&&"pre"===xa.substring(0,3)}Ba=Y.linenums;if(!(Ba=Ba==="true"||+Ba))Ba=(Ba=Ka.match(/\blinenums\b(?::(\d+))?/))?Ba[1]&&Ba[1].length?+Ba[1]:true:false;Ba&&q(ja,Ba,xa);Aa={h:Ha,c:ja,j:Ba,i:xa};M(Aa)}}}ma<ba.length?setTimeout(C,250):"function"===typeof S&&S()}var G=T||document.body,O=G.ownerDocument||document;G=[G.getElementsByTagName("pre"),G.getElementsByTagName("code"),G.getElementsByTagName("xmp")];for(var ba=[],wa=0;wa<G.length;++wa)for(var ra=0,la=G[wa].length;ra<
la;++ra)ba.push(G[wa][ra]);G=j;var Z=Date;Z.now||(Z={now:function(){return+new Date}});var ma=0,Aa,ua=/\blang(?:uage)?-([\w.]+)(?!\S)/,P=/\bprettyprint\b/,V=/\bprettyprinted\b/,R=/pre|xmp/i,r=/^code$/i,F=/^(?:pre|code|xmp)$/i,s={};C()}};typeof define==="function"&&define.amd&&define("google-code-prettify",[],function(){return Ea})})()})();
function escape(a){a=a.replace(/&/g,"&amp;");a=a.replace(/</g,"&lt;");a=a.replace(/>/g,"&gt;");return a=a.replace(/"/g,"&quot;")}
function diffString(a,b){a=a.replace(/^\s+/,"");a=a.replace(/\s+$/,"");b=b.replace(/^\s+/,"");b=b.replace(/\s+$/,"");var c=diff(a==""?[]:a.split(/\s+/),b==""?[]:b.split(/\s+/)),e="",d=a.match(/\s+/g);if(d==null)d=["\n"];else d.push("\n");var f=b.match(/\s+/g);if(f==null)f=["\n"];else f.push("\n");if(c.n.length==0)for(var h=0;h<c.o.length;h++)e+="<del>"+c.o[h]+d[h]+"</del>";else{if(c.n[0].text==null)for(b=0;b<c.o.length&&c.o[b].text==null;b++)e+="<del>"+c.o[b]+d[b]+"</del>";for(h=0;h<c.n.length;h++)if(c.n[h].text==
null)e+="<ins>"+c.n[h]+f[h]+"</ins>";else{var j="";for(b=c.n[h].row+1;b<c.o.length&&c.o[b].text==null;b++)j+="<del>"+c.o[b]+d[b]+"</del>";e+=""+c.n[h].text+f[h]+j}}j="";for(h=0;h<c.o.length-1;h++)if(c.o[h].text!=null)break;else j+=c.o[h]+d[h];if(j.length>0)e="<del>"+j+"</del>"+e;return e}
function diff(a,b){for(var c={},e={},d=0;d<b.length;d++){if(c[b[d]]==null)c[b[d]]={rows:[],o:null};c[b[d]].rows.push(d)}for(d=0;d<a.length;d++){if(e[a[d]]==null)e[a[d]]={rows:[],n:null};e[a[d]].rows.push(d)}for(d in c)if(c[d].rows.length==1&&typeof e[d]!="undefined"&&e[d].rows.length==1){b[c[d].rows[0]]={text:b[c[d].rows[0]],row:e[d].rows[0]};a[e[d].rows[0]]={text:a[e[d].rows[0]],row:c[d].rows[0]}}for(d=0;d<b.length-1;d++)if(d-1>-1&&b[d].text!=null&&d+1<b.length-1&&b[d+1].text==null&&b[d].row+1<a.length-
1&&a[b[d].row+1].text==null&&b[d+1]==a[b[d].row+1]){b[d+1]={text:b[d+1],row:b[d].row+1};a[b[d].row+1]={text:a[b[d].row+1],row:d+1}}for(d=b.length-1;d>0;d--)if(b[d].text!=null&&b[d-1].text==null&&b[d].row>0&&a[b[d].row-1].text==null&&b[d-1]==a[b[d].row-1]){b[d-1]={text:b[d-1],row:b[d].row-1};a[b[d].row-1]={text:a[b[d].row-1],row:d-1}}return{o:a,n:b}};/*

 Aggregate JavaScript file for Iguana's Translator Script Editor
 Portions Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
 Bundled software includes copyright information where appropriate.
*/
if(!lib)var lib={};log={};lib.trace={};lib.newStack=[];lib.WrappedUp={};lib.trace.Trace=function(){};
lib.trace.Trace.prototype={parseGlob:function(a){a=a.split(" ");for(var b=[],c=[],e=0;e<a.length;e++)if(a[e])a[e][0]==="-"?b.push(a[e].substr(1)):c.push(a[e]);this.pmatch=this.makeRegex(c);this.nmatch=this.makeRegex(b)},load:function(){var a=localStorage.getItem("log.info");this.set(a);this.addHeader(a,"")},makeRegex:function(a){if(a.length==0)return 0;for(var b="https?:\\/\\/[^\\/]*\\/(",c=0;c<a.length;c++)b+="("+a[c].replace("/","\\/").replace("*",".*")+")"+(c===a.length-1?"":"|");b+=")\\.js:";
return RegExp(b)},set:function(a,b){if(a){this.parseGlob(a);b?this.debugTraceOn(true):this.debugTraceOn(false)}else{this.debugTraceOn(false);delete this.nmatch;delete this.pmatch}},setDebug:function(a){if(a){this.debugTraceOn(true);this.set(a,true)}else this.debugTraceOn(false)},debugTraceOn:function(a){log.debug=a?this.logr:function(){}},tracing:function(){return typeof this.pmatch==="object"},log:function(){try{throw Error();}catch(a){if(a.stack){lib.newStack=a.stack.split("\n");if(lib.newStack.length>
4){var b=lib.trace.pattern.exec(lib.newStack[4]);if(b!==null){Position=b[1];if(this.pmatch.test(Position)&&(!this.nmatch||!this.nmatch.test(Position)))return Position}}}}},checkTraceStatus:function(){if(!Trace.tracing())return false;var a=Trace.log();if(a===undefined)return false;return a},logr:function(){var a=Trace.checkTraceStatus();if(a){for(var b=[],c=0;c<arguments.length;c++)b[c]=typeof arguments[c]==="string"?arguments[c]+" ":backendlog.stringify(arguments[c])+" ";b.push(a);backendlog.appendLog(b,
false)}},variable:function(){var a=[],b=Trace.checkTraceStatus();if(b){for(var c=0;c<arguments.length;c+=2){a[c]=arguments[c]+backendlog.stringify(arguments[c+1]);a[c+1]=" "}a.push(b);backendlog.appendLog(a,false)}},func:function(a,b){var c=[],e=Trace.checkTraceStatus();if(e){if(b)for(var d=0;d<b.length;d++){c[d]=backendlog.stringify(b[d]);c[d]+=d==b.length-1?")":", "}c.length===0&&c.push(")");c.unshift(">"+a+"(");c.push(e);backendlog.appendLog(c,true)}},endfunc:function(a,b){var c=Trace.checkTraceStatus();
if(c){var e=["<"+a+(b?" R:"+backendlog.stringify(b):"")];e.push(c);backendlog.appendLog(e,false)}},addHeader:function(a,b){var c="";c=a==""?{log:"*************** Tracing OFF ***************\n"}:{log:"*************** Tracing "+a+" Debugging: "+b+" ***************\n"};$.post("/javascript/log",c)},wrapItUp:function(a){for(var b in eval(a)){Parent=eval(a);if(typeof Parent[b]==="object")this.wrapItUp(a+"."+b);else if(typeof Parent[b]==="function"&&!lib.WrappedUp[Parent[b]]){lib.WrappedUp[a+"."+b]=true;
Parent[b]=Wrapper(a,b)}}}};function Wrapper(a,b,c){c=c||window;var e=eval(a)[b];return function(){for(var d=[],f="(",h=0;h<arguments.length;h++){d.push(arguments[h]);f+=arguments[h]+(h==arguments.length-1?")":",")}return e.apply(c,d)}}var Trace=new lib.trace.Trace;lib.trace.pattern=/(https?.*[0-9])/;log.info=Trace.logr;log.variable=Trace.variable;log.func=Trace.func;log.endfunc=Trace.endfunc;Trace.load();function traceInfo(a){Trace.set(a);Trace.addHeader(a,"");localStorage["log.info"]=a}
function traceDebug(a){Trace.setDebug(a);Trace.addHeader(a,a);localStorage["log.info"]=a;localStorage["log.debug"]=a?true:false}backendlog={};var TempStart="";backendlog.appendLog=function(a,b){var c={log:this.createStack(a,b)};$.post("/javascript/log",c)};backendlog.getModule=function(a){a=a.match(/((((\/[\w]+)+.[js]+:[\d]+)))/)[0];a=/(.*?)\.js(:\d+)/.exec(a);return a[1].substring(1,a[1].length)+a[2]};
backendlog.getStartFunc=function(a){this.startFunction=a.match(/(^([.\s\w]+))/)[0];if(this.startFunction.startsWith("    at Object."))this.startFunction=this.startFunction.slice(14);else if(backendlog.startFunction.startsWith("    at "))this.startFunction=this.startFunction.slice(7);return this.startFunction};
backendlog.createModule=function(a,b,c){var e=[],d="";if(typeof b[0]==="object")e.push(this.stringify(b[0]));else{for(var f=0;f<b.length-1;f++)d+=String(b[f]);e.push(d)}return this.createLine(e,b,a,c)};backendlog.createLine=function(a,b,c,e){for(var d="",f=0;f<a.length;f++){var h=new Date;h=(h.toTimeString().slice(0,8)+":"+h.getMilliseconds()+"   ").slice(0,13)+this.getModule(b[b.length-1]);if(h.length<45)h+=Array(45-h.length).join(" ");h+=Array(c).join(" | ")+(e?" ":" | ")+a[f]+"\n";d+=h}return d};
backendlog.findPresent=function(){for(var a=0;a<lib.newStack.length;a++)if(this.getStartFunc(lib.newStack[a])==TempStart)return a;return-1};
backendlog.createStack=function(a,b){var c=1;if(TempStart=="")TempStart=this.getStartFunc(lib.newStack[4]);if(TempStart==""&&lib.newStack[lib.newStack.length-1].startsWith("    at XMLHttpRequest"))TempStart=this.getStartFunc(lib.newStack[lib.newStack.length-1]);if(this.findPresent()!=-1)c=TempStart=="XMLHttpRequest.jQuery.ajaxTransport.send.callback "?this.findPresent()-8:this.findPresent()-3;else TempStart=this.getStartFunc(lib.newStack[4]);return this.createModule(c,a,b)};
backendlog.replacer=function(a,b,c){if(a!=="__ifWare2015"){a=typeof b;if(b&&(b instanceof Event||b.tagName))return"[DOM]";if(a==="object"&&b!=null)if(b.__ifWare2015)return"self";else{b.__ifWare2015=true;c.push(b)}else if(a==="function")return"[FUNC]";return b}};backendlog.deleter=function(a,b){for(var c in b)delete b[c].__ifWare2015};backendlog.stringify=function(a){var b=[],c=JSON.stringify(a,function(e,d){return backendlog.replacer(e,d,b)});backendlog.deleter(a,b);return c};/*

 Copyright (c) 2015 iNTERFACEWARE Inc.  All rights reserved.
*/
LOG_VAR=function(){var a=/(https?.*[0-9])/;return function(){var b=[],c;a:{try{throw Error();}catch(e){if(e.stack){c=e.stack.split("\n");if(c.length>3){c=a.exec(c[3]);if(c!==null){c=c[1];break a}}}}c=void 0}typeof c!=="undefined"&&b.push(c);for(c=0;c<arguments.length;c++){var d="";if(c>0)d+=", ";d+="? =";b.push(d);b.push(arguments[c])}}}();/*

 Copyright (c) 2010-2013 iNTERFACEWARE Inc.  All rights reserved.
*/
ifware=window.ifware||{};(function(a){$lambda=function(b){return function(){return b}};$empty=function(){};$inherit=function(b,c,e){var d=$empty;d.prototype=c.prototype;b.prototype=new d;b.prototype.constructor=b;b.base=c;for(var f in e)b.prototype[f]=e[f];return b};a.extendFrom=function(b,c,e,d){d&&d(b,e);$.extend(c,e);b.data("state")?$.extend(b.data("state"),c):b.data("state",c);return b.data("state")}})(ifware);/*

 Copyright (c) 2010-2015 iNTERFACEWARE Inc.  All rights reserved.
*/
function PAGescapeQuotes(a){return a.replace(/'/g,"&#39;").replace(/"/,"&quot;")}function PAGencodeAllTheThings(a){return encodeURIComponent(a).replace(/[!'()*]/g,function(b){return"%"+b.charCodeAt(0).toString(16)})}function PAGconvertSpaceEncoding(a){return a.replace(/\+/g,"%20")}function PAGhtmlEscape(a){return a.replace(/;/g,"&#59;").replace(/&(?!#59;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")};var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS"},searchString:function(a){for(var b=0;b<a.length;b++){var c=a[b].string,e=a[b].prop;this.versionSearchString=a[b].versionSearch||a[b].identity;if(c){if(c.indexOf(a[b].subString)!=-1)return a[b].identity}else if(e)return a[b].identity}},
searchVersion:function(a){var b=a.indexOf(this.versionSearchString);if(b!=-1)return parseFloat(a.substring(b+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,
subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],
dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.userAgent,subString:"iPhone",identity:"iPhone/iPod"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};BrowserDetect.init();ifware=window.ifware||{};
var ScriptRunner=function(){function a(h,j,p,n,t){function w(){var C=d,B=$.inArray(y,C);B>=0&&C.splice(B,1);if(d.length==0){$(f).addClass("on");$(ifware).trigger("scriptExecuteDone")}s=true}var s=false,r,y;y={abort:function(){if(!s){w("aborted");Ajax.abort(r);p.task_id=h;Ajax.post("/ann/abort",p)}},destroy:function(){if(!s){w("aborted");Ajax.abort(r);p.task_id=h;Ajax.post("/ann/destroy",p)}},cancel:function(){y.destroy();try{t()}catch(C){}}};p.ScriptRunnerTask=h;r=Ajax.post(j,p,function(C,B,G){w("got data");
try{n(C,B,G)}catch(N){}},"json");d.push(y);$(f).removeClass("on");return y}var b=false,c=0,e=0,d=[],f="#script_stopper";$(document).on("click",f,function(){for(;d.length>0;)d[0].cancel();$(ifware).trigger("scriptExecuteDone")});return function(){var h="#"+ ++c,j;return{post:function(p,n,t,w){j&&j.abort();if(p=="/ann/intellisense_options"){b=true;$(ifware).trigger("cancelAnnotations")}else b=false;var s=h+": post #"+ ++e;j=a(s,p,n,t,w);if(!b)$(ifware).one("cancelAnnotations",function(){j.abort()})}}}}();
function ScriptRunnerDict(){var a={};return function(b){var c=a[b];if(!c){c=ScriptRunner();a[b]=c}return c}};/*

 Watermark plugin for jQuery
 Copyright ? 2009-2011 Todd Northrop
 http://www.speednet.biz/
 Dual licensed under the MIT or GPL Version 2 licenses.
*/
(function(a){a.watermarker=function(){};a.extend(a.watermarker,{defaults:{color:"#999",left:4},setDefaults:function(b){a.extend(a.watermarker.defaults,b)},checkVal:function(b,c){b==""?a(c).show():a(c).hide()}});a.fn.watermark=function(b,c){var e;e=a.extend(a.watermarker.defaults,c);this.filter("input[type=text], input[type=password], textarea").each(function(){var d,f,h,j,p,n;d=a(this);f=d.attr("placeholder")!=undefined&&d.attr("placeholder")!=""?"placeholder":"title";h=b===undefined||b===""?a(this).attr(f):
b;j=a('<span class="watermark_container"></span>');p=a('<span class="watermark">'+h+"</span>");f=="placeholder"&&d.removeAttr("placeholder");j.css({"float":d.css("float"),position:"relative"});d.wrap(j);if(this.nodeName.toLowerCase()!="textarea"){j=d.outerHeight();h="50%";n=j+"px"}else{h=d.position();f=d.css("margin-top")!=="auto"?parseInt(d.css("margin-top")):0;h=h.top+parseInt(d.css("padding-top"))+f+parseInt(d.css("border-top-width"));n=d.css("line-height");j=n==="normal"?parseInt(d.css("font-size")):
n}f=d.css("margin-left")!=="auto"?parseInt(d.css("margin-left")):"0";a.watermarker.checkVal(d.val(),p);p.css({position:"absolute",fontFamily:d.css("font-family"),fontSize:d.css("font-size"),color:e.color,left:e.left,right:0,bottom:0,top:h,height:j+"px",lineHeight:n,marginTop:"-"+j/2+"px",marginLeft:f+parseInt(d.css("padding-left"))}).data("jq_watermark_element",d);p.click(function(){a(a(this).data("jq_watermark_element")).focus()});d.before(p).focus(function(){a.watermarker.checkVal(a(this).val(),
p);p.animate({opacity:0.7},250)}).blur(function(){a.watermarker.checkVal(a(this).val(),p);p.animate({opacity:1},250)}).keydown(function(){a(p).hide()})});return this};a(document).ready(function(){a(".jq_watermark").watermark()})})(jQuery);/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
var AJAXusedRequestObjectStack=[],arrayRequest=[],userAgent=navigator.userAgent.toLowerCase();if(userAgent.indexOf("msie")!=-1)window.attachEvent("onbeforeunload",AJAXbeforeUnload);else document.implementation&&document.implementation.createDocument&&window.addEventListener("beforeunload",AJAXbeforeUnload,false);
function AJAXbeforeUnload(){for(countArray=0;countArray<arrayRequest.length;countArray++)if(arrayRequest[countArray]){arrayRequest[countArray].onreadystatechange=function(){};arrayRequest[countArray].abort()}}function AJAXnewHttpRequest(){return AJAXusedRequestObjectStack.length==0?window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"):AJAXusedRequestObjectStack.pop()}
function AJAXremoveFromArrayRequest(a){if(a)for(var b=0;b<arrayRequest.length;)if(arrayRequest[b]==a)arrayRequest.splice(b,1);else b++}
function AJAXhandleResponse(a,b,c){try{if(a.readyState==4){try{if(a.status==200||a.status==403)b(a.responseText,a.getResponseHeader("Content-Type"),a);else if(c){b="The response from the Iguana server could not be read.";if(a.status&&a.status!=0){b+="<br />Status: "+a.status;if(a.statusText&&a.statusText!="")b+=" - "+a.statusText}c(b,a)}}catch(e){}a.onreadystatechange=function(){};AJAXusedRequestObjectStack.push(a);AJAXremoveFromArrayRequest(a)}}catch(d){if(c&&a){try{c("The response from the Iguana server could not be read.<br />"+
(d.description||d),a)}catch(f){}a.onreadystatechange=function(){};AJAXusedRequestObjectStack.push(a);AJAXremoveFromArrayRequest(a)}}}function AJAXpost(a,b,c,e){try{var d=AJAXnewHttpRequest();arrayRequest[arrayRequest.length]=d;d.open("POST",a,true);d.onreadystatechange=function(){AJAXhandleResponse(d,c,e)};d.send(b)}catch(f){e&&e("AJAX is not supported by the browser.")}}
function AJAXsynchronousPost(a,b,c,e){try{var d=AJAXnewHttpRequest();arrayRequest[arrayRequest.length]=d;d.open("POST",a,false);d.send(b);AJAXhandleResponse(d,c,e)}catch(f){e&&e("AJAX is not supported by the browser.")}}var AJAXrequestsWithIds={};function AJAXabortRequest(a){a.onreadystatechange=function(){};a.abort();AJAXusedRequestObjectStack.push(a);AJAXremoveFromArrayRequest(a)}function AJAXclearRequestId(a){AJAXrequestsWithIds[a]&&delete AJAXrequestsWithIds[a]}
function AJAXabortRequestById(a){if(AJAXrequestsWithIds[a]){AJAXabortRequest(AJAXrequestsWithIds[a]);AJAXclearRequestId(a)}}function AJAXpostWithId(a,b,c,e,d){try{AJAXabortRequestById(c);var f=AJAXnewHttpRequest();arrayRequest[arrayRequest.length]=f;f.open("POST",a,true);f.onreadystatechange=function(){f.readyState==4&&AJAXclearRequestId(c);AJAXhandleResponse(f,e,d)};f.send(b);AJAXrequestsWithIds[c]=f}catch(h){AJAXclearRequestId(c);d&&d("AJAX is not supported by the browser.")}}
if(!window.JSON){window.JSON={};window.JSON.parse=function(a){return eval("("+a+")")}};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
function COOKIEcreate(a,b,c){if(c){var e=new Date;e.setTime(e.getTime()+c*864E5);c="; expires="+e.toGMTString()}else c="";document.cookie=a+"="+b+c+"; path=/"}function COOKIEread(a){a+="=";for(var b=document.cookie.split(";"),c=0;c<b.length;c++){for(var e=b[c];e.charAt(0)==" ";)e=e.substring(1,e.length);if(e.indexOf(a)==0)return e.substring(a.length,e.length)}return null}function COOKIEerase(a){COOKIEcreate(a,"",-1)};ifware.core=ifware.core||{};ifware.core.ui=ifware.core.ui||{};ifware.core.ui.displayManager=ifware.core.ui.displayManager||{};
(function(a,b){a.hideInactiveForegrounds=function(){var c=null;return{isRegisteredForEvents:false,eventType:"clickedAwayEvent",register:function(e){if(!e.ignore)throw Error("DisplayManager: failed to register because it doesn't implement ignore interface.");c=e;if(!this.isRegisteredForEvents){this.isRegisteredForEvents=true;$(b).bind(this.eventType,$.proxy(this.handleClick,this))}},handleClick:function(e){if(c){if(e.target===c.$this[0])return;c.ignore();c=null}$(b).unbind(this.eventType,this.handleClick);
this.isRegisteredForEvents=false},makeIgnoreable:function(e,d,f,h,j){j||(j={$this:e});e.click(function(p){p.stopPropagation()});j.hide=d;j.ignore=f;j.show=function(){a.hideInactiveForegrounds.register(this);h()};return j}}}();$(document).click(function(){$(b).trigger(a.hideInactiveForegrounds.eventType)})})(ifware.core.ui.displayManager,ifware);ifware.core=ifware.core||{};ifware.core.ui=ifware.core.ui||{};
(function(a){a.Button=function(){var b={pressedStyle:"",hoverStyle:"",isPressed:false},c=function(e,d){this.options=d=$.extend({},b,d);this.$this=e;this.enabled=true;e.css("cursor","pointer");e.hover($.proxy(this.hoverIn,this),$.proxy(this.hoverOut,this));this.isPressed=false;if(this.options.isPressed){e.is("input[type=checkbox]")&&e.attr("checked","checked");this.isPressed=true;this.options.pressedStyle&&this.$this.addClass(this.options.pressedStyle)}e.click($.proxy(this.press,this));e.data("Button",
this);this.isAnchor=e.is("a")};c.prototype={disable:function(){this.$this.attr("disabled",true);this.$this.addClass("disabled");this.enabled=false},enable:function(){this.$this.removeAttr("disabled");this.$this.removeClass("disabled");this.enabled=true},hoverIn:function(){this.options.hoverStyle&&this.$this.addClass(this.options.hoverStyle)},hoverOut:function(){this.options.hoverStyle&&!this.isPressed&&this.$this.removeClass(this.options.hoverStyle)},unpress:function(e){this.options.pressedStyle&&
this.$this.removeClass(this.options.pressedStyle);this.isPressed=false;this.onUnpressed(e)},press:function(e){this.onClick();if(this.isPressed)this.unpress(e);else{this.options.pressedStyle&&this.$this.addClass(this.options.pressedStyle);this.isPressed=true;this.onPressed(e)}this.options.press&&this.options.press(this.isPressed);if(this.isAnchor&&e!==null){e.preventDefault();return false}},onPressed:$empty,onUnpressed:$empty,onClick:$empty};return c}()})(ifware.core.ui,ifware);/*

 Copyright (c) 2010-2016 iNTERFACEWARE Inc.  All rights reserved.
*/
ifware.toolbar=ifware.toolbar||{};
(function(a){var b=String(BrowserDetect.version),c=false;if("Explorer"==BrowserDetect.browser&&null!=b.match(/^8/))c=true;a.sections={scriptExecutionSection:function(e,d){var f='<div class="toolbarSectionChild">                <a id="executeScriptButton" class="button_icon" title="Execute the script to generate annotations."></a>                <a id="script_stopper" class="button_icon on" title="Stop script"></a>                <a id="autoexecution_toggle" class="button_icon'+(d.ifware.projectSettings.disableAutoScriptExecution()?
"":" on")+'" title="Toggle auto-execution. When enabled, the script runs in the background during script editing. If disabled, auto-completion will be unavailable and annotations will only update if you run the script manually."></a>            </div>';f=$(f);var h=f.find("#executeScriptButton"),j=f.find("#script_stopper"),p=f.find("#autoexecution_toggle"),n=new ifware.core.ui.Button(h,{pressedStyle:"on",press:function(t){if(t){n.disable();$(ifware).trigger("scriptExecute");NISretrieveCodeBlockData(d);
NISretrieveMergeConflictData(d);NISupdateAnnotations(d,{force:true,SendCode:true});NIScleanDirtyLine(d)}d.ifware.focusLastFocussedElement()}});$(ifware).bind("scriptExecuteDone",function(){n.enable();n.unpress()});$(ifware).bind("ExecuteScriptOnce",function(){h.click()});j.click(function(){d.ifware.focusLastFocussedElement()});new ifware.core.ui.Button(p,{pressedStyle:"on",isPressed:!d.ifware.projectSettings.disableAutoScriptExecution(),press:function(t){d.ifware.projectSettings.disableAutoScriptExecution(!t);
t||NISclearAnnotations(d);NISupdateAnnotations(d,{SendCode:true});d.ifware.focusLastFocussedElement()}});e.append(f)},viewOptionsSection:function(e,d){var f=$('<div class="toolbarSectionChild">                <a id="project_pane_toggle" class="button_icon" title="Show project manager"></a>                <a id="thumbnail_toggle" class="button_icon" title="Show thumbnail"></a>            </div>'),h=f.find("#project_pane_toggle"),j=f.find("#thumbnail_toggle");new ifware.core.ui.Button(h,{pressedStyle:"on",
isPressed:d.ifware.projectSettings.showProjectExplorer(),press:function(p){d.ifware.projectSettings.showProjectExplorer(p);EDTtoggleProjectPane(p);d.ifware.focusLastFocussedElement()}});h=new ifware.core.ui.Button(j,{pressedStyle:"on",isPressed:d.ifware.projectSettings.showThumbnails(),press:function(p){d.ifware.projectSettings.showThumbnails(p);d.ifware.focusLastFocussedElement()}});if(c){h.disable(true);j.attr("title","This feature is not available in Internet Explorer 8 or lower.")}e.append(f)}}})(ifware.toolbar);var Ajax;
$(document).ready(function(){function a(){$("body").append('         <div id="ajax-popup" style="display:none">            <table width="100%">            <tr>               <td colspan="2" id="ajax-message" align="center">            </table>         </div>      ');return $("#ajax-popup").dialog({autoOpen:false,modal:true,title:"Communication Error",buttons:{Retry:function(){$(this).dialog("close");var p=h;h=null;p()}}})}function b(p,n){if(n.status==403)return"Your session has expired.";else if(p==
"parsererror")return"Unable to parse response from server.";else if(p=="permission_issue")return"You don't have the necessary permissions to view this page.";else if(p!="notmodified")return"The server is not responding."}function c(p){$("#permission_dlg").length&&$("#permission_dlg").remove();$("body").append('<div id="permission_dlg" style="display:none">'+p+"</div>");p=$("#permission_dlg");p.append('<p> Go back to the <a href="../dashboard.html"> dashboard. </a> </p>');p.dialog({bgiframe:true,width:400,
height:110,title:"Insufficient Permissions",position:"center",modal:true,autoOpen:false});p.dialog("open")}function e(p){if(p.PermissionIssue)return"permission_issue"}function d(p,n,t){if(j)if(h){var w=h;h=function(){try{w()}catch(r){}n()}}else{var s=$("#ajax-popup");s.length||(s=a());h=function(){n()};$("#ajax-message").text(b(p,t));s.dialog("open")}}function f(p,n,t){if(p=="permission_issue")c(b(p,t));else{typeof IFW!=="undefined"&&IFW.Sde!==null&&ifware.storage.set("CurrentMessageWithEdits",IFW.Sde._CodeMirror.getValue(),
1);MiniLogin.show(b(p,t),function(){location.reload()})}}var h,j;Ajax=window.MiniLogin?AjaxImpl(f,e):AjaxImpl(d,e);$(window).unload(function(){j=false});j=true});
function AFUuploadFile(a,b,c,e,d){function f(){$(this).dialog("close");location.reload()}function h(n){window.MiniLogin?MiniLogin.show("File upload failed. "+n,function(){location.reload()}):$("<div>"+n+"</div>").appendTo("body").dialog({modal:true,title:"Communication Error",buttons:{Reload:f}})}var j="uploader"+(new Date).getTime(),p=$('<iframe name="'+j+'" src="about:blank" />');p.css("display","none");$("body").append(p);p.load(function(){var n=null;n=p.contentDocument?p.contentDocument:p.contentWindow?
p.contentWindow.document:window.frames[j].document;if(n=$(n).find("body").html())if(n=="Not logged in.")h("File upload failed. Your session has expired.");else var t=JSON.parse(n);else h("File upload failed. The server is not responding.");setTimeout(function(){p.remove();e&&t&&e(t,d)},100)});b.attr("action",a).attr("method","post").attr("enctype","multipart/form-data").attr("encoding","multipart/form-data").attr("target",j);b.get(0).submit();c&&c(b)};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
var TOOLactiveTimeout,TOOLtooltipText="",TOOLtooltipShowCallback=null,TOOLtooltipElement=null,TOOLtooltipOffset,TOOLmousePositionX=0,TOOLmousePositionY=0,TOOLwindowSizeOffset=10,TOOLpositionOffset=10,TOOLarrowOffset=20,TOOLarrowWidth=10,TOOLborderSize=2;function TOOLinitialize(){document.captureEvents&&document.captureEvents(Event.MOUSEMOVE);document.onmousemove=TOOLmouseMove}function TOOLmouseMove(a){if(!a)a=window.event;TOOLmousePositionX=a.clientX;TOOLmousePositionY=a.clientY}
function TOOLcalculatePosition(a,b,c,e){var d=a+TOOLpositionOffset;if(d+e>c-TOOLwindowSizeOffset)d=a-e-TOOLpositionOffset;if(d<TOOLwindowSizeOffset)d=TOOLwindowSizeOffset;return d+b}var TOOLnormDiv;function TOOLnormalizeInnerHtml(a){TOOLnormDiv||(TOOLnormDiv=document.createElement("div"));TOOLnormDiv.innerHTML=a;return TOOLnormDiv.innerHTML}
function TOOLpositionWithMousePosition(a,b,c){b.style.display="none";c.style.display="none";if(TOOLnormalizeInnerHtml(TOOLtooltipText)!=document.getElementById("divTooltipBody").innerHTML){document.getElementById("divTooltipBody").innerHTML=TOOLtooltipText;a.style.left=TOOLcalculatePosition(TOOLmousePositionX,WINgetWindowLeft(),WINgetWindowWidth(),a.offsetWidth)+"px";a.style.top=TOOLcalculatePosition(TOOLmousePositionY,WINgetWindowTop(),WINgetWindowHeight(),a.offsetHeight)+"px"}}
function TOOLpositionLeftWithElement(a,b,c){var e=WINwindowOffsetLeft(TOOLtooltipElement),d=e+TOOLtooltipElement.offsetWidth-TOOLarrowOffset+(TOOLtooltipOffset.Left||0),f=0;if(d+a.offsetWidth>WINgetWindowWidth()-TOOLwindowSizeOffset){d=e-a.offsetWidth+TOOLarrowOffset-TOOLarrowWidth+TOOLtooltipElement.offsetWidth+(TOOLtooltipOffset.Left||0);f=a.offsetWidth-TOOLarrowOffset;b.style.backgroundImage="url(/js/tooltip/images/tooltip_arrow_top_left.gif)";c.style.backgroundImage="url(/js/tooltip/images/tooltip_arrow_bottom_left.gif)"}else{f=
TOOLarrowOffset;b.style.backgroundImage="url(/js/tooltip/images/tooltip_arrow_top_right.gif)";c.style.backgroundImage="url(/js/tooltip/images/tooltip_arrow_bottom_right.gif)"}if(d<TOOLwindowSizeOffset){d=TOOLwindowSizeOffset;f=e-TOOLwindowSizeOffset-TOOLarrowWidth}b.style.backgroundPosition=f+"px";c.style.backgroundPosition=f+"px";a.style.left=d+WINgetWindowLeft()+"px"}
function TOOLpositionTopWithElement(a,b,c){var e=WINwindowOffsetTop(TOOLtooltipElement),d=e+TOOLtooltipElement.offsetHeight-TOOLborderSize+(TOOLtooltipOffset.Top||0),f=false,h=false;if(d+a.offsetHeight>WINgetWindowHeight()-TOOLwindowSizeOffset){d=e-a.offsetHeight+TOOLborderSize-(TOOLtooltipOffset.Top||0);h=true}else f=true;if(d<TOOLwindowSizeOffset){d=TOOLwindowSizeOffset;h=f=false}b.style.visibility=f?"visible":"hidden";c.style.visibility=h?"visible":"hidden";a.style.top=d+WINgetWindowTop()+"px"}
function TOOLpositionWithElement(a,b,c){if(""!=TOOLtooltipText){b.style.width="1px";c.style.width="1px";if(TOOLnormalizeInnerHtml(TOOLtooltipText)!=document.getElementById("divTooltipBody").innerHTML){document.getElementById("divTooltipBody").innerHTML=TOOLtooltipText;TOOLpositionLeftWithElement(a,b,c);TOOLpositionTopWithElement(a,b,c)}b.style.width=a.offsetWidth+"px";c.style.width=a.offsetWidth+"px"}}
function TOOLtooltipShowAndFade(a,b,c){var e=$("#divTooltip"),d=function(){TOOLtooltipClose();e.fadeTo(0,1)};TOOLtooltipLink(a,null,b);setTimeout(function(){TOOLtooltipElement==b&&e.fadeTo("slow",0,d)},c)}
function TOOLtooltipShow(){var a=document.getElementById("divTooltip"),b=document.getElementById("divTooltipTop"),c=document.getElementById("divTooltipBottom");null==TOOLtooltipElement?TOOLpositionWithMousePosition(a,b,c):TOOLpositionWithElement(a,b,c);a.style.visibility="visible";TOOLtooltipShowCallback!=null&&TOOLtooltipShowCallback()}function TOOLtooltipRefresh(a){TOOLtooltipText=a;TOOLtooltipShow()}
function TOOLtooltipClose(){$(document).find("#divTooltip").remove();clearTimeout(TOOLactiveTimeout);window.status=""}function TOOLisTooltipShowing(){return"hidden"!=WINgetStyle(document.getElementById("divTooltip"),"visibility")}
function TOOLtooltipLink(a,b,c,e){$(document).find("body").append('<div id="divTooltip" class="tooltip"><div id="divTooltipTop" class="tooltip_top"></div><div id="divTooltipBody" class="tooltip_body"></div><div id="divTooltipBottom" class="tooltip_bottom"></div></div>');TOOLtooltipText=a;TOOLtooltipShowCallback=b;TOOLtooltipElement=c;TOOLtooltipOffset=e||{Left:0,Top:0};if(undefined===TOOLtooltipShowCallback)TOOLtooltipShowCallback=null;if(undefined===TOOLtooltipElement)TOOLtooltipElement=null;TOOLactiveTimeout=
setTimeout("TOOLtooltipShow();",300)};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
function WINgetWindowWidth(){return window.innerWidth===undefined?document.documentElement.clientWidth:window.innerWidth}function WINgetWindowHeight(){return window.innerHeight===undefined?document.documentElement.clientHeight:window.innerHeight}function WINgetWindowLeft(){var a=document.body.scrollLeft;if(0==a)a=window.pageXOffset?window.pageXOffset:document.body.parentElement?document.body.parentElement.scrollLeft:0;return a}
function WINgetWindowTop(){var a=document.body.scrollTop;if(0==a)a=window.pageYOffset?window.pageYOffset:document.body.parentElement?document.body.parentElement.scrollTop:0;return a}function WINwindowOffsetTop(a){for(var b=0,c=a;c!=null;c=c.offsetParent)if(c.offsetTop!==undefined)b+=c.offsetTop;for(c=a.parentNode;c!=null;c=c.parentNode)if(c.scrollTop!==undefined)b-=c.scrollTop;return b}
function WINwindowOffsetLeft(a){for(var b=0,c=a;c!=null;c=c.offsetParent)if(c.offsetLeft!==undefined)b+=c.offsetLeft;for(c=a.parentNode;c!=null;c=c.parentNode)if(c.scrollLeft!==undefined)b-=c.scrollLeft;return b}function WINgetStyle(a,b){var c=a.style[b];if(!c)if(window.getComputedStyle)c=(c=document.defaultView.getComputedStyle(a,null))?c[b]:null;else if(a.currentStyle)c=a.currentStyle[b];return c};/*

 http://www.JSON.org/json2.js
 2010-08-25

 Public Domain.

 NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.

 See http://www.JSON.org/js.html


 This code should be minified before deployment.
 See http://javascript.crockford.com/jsmin.html

 USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
 NOT CONTROL.


 This file creates a global JSON object containing two methods: stringify
 and parse.

 JSON.stringify(value, replacer, space)
 value       any JavaScript value, usually an object or array.

 replacer    an optional parameter that determines how object
 values are stringified for objects. It can be a
 function or an array of strings.

 space       an optional parameter that specifies the indentation
 of nested structures. If it is omitted, the text will
 be packed without extra whitespace. If it is a number,
 it will specify the number of spaces to indent at each
 level. If it is a string (such as '\t' or '&nbsp;'),
 it contains the characters used to indent at each level.

 This method produces a JSON text from a JavaScript value.

 When an object value is found, if the object contains a toJSON
 method, its toJSON method will be called and the result will be
 stringified. A toJSON method does not serialize: it returns the
 value represented by the name/value pair that should be serialized,
 or undefined if nothing should be serialized. The toJSON method
 will be passed the key associated with the value, and this will be
 bound to the value

 For example, this would serialize Dates as ISO strings.

 Date.prototype.toJSON = function (key) {
 function f(n) {
 // Format integers to have at least two digits.
 return n < 10 ? '0' + n : n;
 }

 return this.getUTCFullYear()   + '-' +
 f(this.getUTCMonth() + 1) + '-' +
 f(this.getUTCDate())      + 'T' +
 f(this.getUTCHours())     + ':' +
 f(this.getUTCMinutes())   + ':' +
 f(this.getUTCSeconds())   + 'Z';
 };

 You can provide an optional replacer method. It will be passed the
 key and value of each member, with this bound to the containing
 object. The value that is returned from your method will be
 serialized. If your method returns undefined, then the member will
 be excluded from the serialization.

 If the replacer parameter is an array of strings, then it will be
 used to select the members to be serialized. It filters the results
 such that only members with keys listed in the replacer array are
 stringified.

 Values that do not have JSON representations, such as undefined or
 functions, will not be serialized. Such values in objects will be
 dropped; in arrays they will be replaced with null. You can use
 a replacer function to replace those with JSON values.
 JSON.stringify(undefined) returns undefined.

 The optional space parameter produces a stringification of the
 value that is filled with line breaks and indentation to make it
 easier to read.

 If the space parameter is a non-empty string, then that string will
 be used for indentation. If the space parameter is a number, then
 the indentation will be that many spaces.

 Example:

 text = JSON.stringify(['e', {pluribus: 'unum'}]);
 // text is '["e",{"pluribus":"unum"}]'


 text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
 // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'

 text = JSON.stringify([new Date()], function (key, value) {
 return this[key] instanceof Date ?
 'Date(' + this[key] + ')' : value;
 });
 // text is '["Date(---current time---)"]'


 JSON.parse(text, reviver)
 This method parses a JSON text to produce an object or array.
 It can throw a SyntaxError exception.

 The optional reviver parameter is a function that can filter and
 transform the results. It receives each of the keys and values,
 and its return value is used instead of the original value.
 If it returns what it received, then the structure is not modified.
 If it returns undefined then the member is deleted.

 Example:

 // Parse the text. Values that look like ISO date strings will
 // be converted to Date objects.

 myData = JSON.parse(text, function (key, value) {
 var a;
 if (typeof value === 'string') {
 a =
 /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
 if (a) {
 return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
 +a[5], +a[6]));
 }
 }
 return value;
 });

 myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
 var d;
 if (typeof value === 'string' &&
 value.slice(0, 5) === 'Date(' &&
 value.slice(-1) === ')') {
 d = new Date(value.slice(5, -1));
 if (d) {
 return d;
 }
 }
 return value;
 });


 This is a reference implementation. You are free to copy, modify, or
 redistribute.
*/
if(!this.JSON)this.JSON={};
(function(){function a(n){return n<10?"0"+n:n}function b(n){d.lastIndex=0;return d.test(n)?'"'+n.replace(d,function(t){var w=j[t];return typeof w==="string"?w:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+n+'"'}function c(n,t){var w,s,r,y,C=f,B,G=t[n];if(G&&typeof G==="object"&&typeof G.toJSON==="function")G=G.toJSON(n);if(typeof p==="function")G=p.call(t,n,G);switch(typeof G){case "string":return b(G);case "number":return isFinite(G)?String(G):"null";case "boolean":case "null":return String(G);
case "object":if(!G)return"null";f+=h;B=[];if(Object.prototype.toString.apply(G)==="[object Array]"){y=G.length;for(w=0;w<y;w+=1)B[w]=c(w,G)||"null";r=B.length===0?"[]":f?"[\n"+f+B.join(",\n"+f)+"\n"+C+"]":"["+B.join(",")+"]";f=C;return r}if(p&&typeof p==="object"){y=p.length;for(w=0;w<y;w+=1){s=p[w];if(typeof s==="string")if(r=c(s,G))B.push(b(s)+(f?": ":":")+r)}}else for(s in G)if(Object.hasOwnProperty.call(G,s))if(r=c(s,G))B.push(b(s)+(f?": ":":")+r);r=B.length===0?"{}":f?"{\n"+f+B.join(",\n"+f)+
"\n"+C+"}":"{"+B.join(",")+"}";f=C;return r}}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+a(this.getUTCMonth()+1)+"-"+a(this.getUTCDate())+"T"+a(this.getUTCHours())+":"+a(this.getUTCMinutes())+":"+a(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var e=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
d=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f,h,j={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},p;if(typeof JSON.stringify!=="function")JSON.stringify=function(n,t,w){var s;h=f="";if(typeof w==="number")for(s=0;s<w;s+=1)h+=" ";else if(typeof w==="string")h=w;if((p=t)&&typeof t!=="function"&&(typeof t!=="object"||typeof t.length!=="number"))throw Error("JSON.stringify");return c("",
{"":n})};if(typeof JSON.parse!=="function")JSON.parse=function(n,t){function w(r,y){var C,B,G=r[y];if(G&&typeof G==="object")for(C in G)if(Object.hasOwnProperty.call(G,C)){B=w(G,C);if(B!==undefined)G[C]=B;else delete G[C]}return t.call(r,y,G)}var s;n=String(n);e.lastIndex=0;if(e.test(n))n=n.replace(e,function(r){return"\\u"+("0000"+r.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(n.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){s=eval("("+n+")");return typeof t==="function"?w({"":s},""):s}throw new SyntaxError("JSON.parse");}})();var IFW=IFW||{};IFW.TokenRegex=/{{IFWTOKEN}}(0[Dd]){{IFWTOKEN}}{{IFWTOKEN}}(0[Aa]){{IFWTOKEN}}|{{IFWTOKEN}}([0-9A-Fa-f]{2}){{IFWTOKEN}}/g;IFW.EOLregex=/({{IFWTOKEN}}0[Dd]{{IFWTOKEN}}{{IFWTOKEN}}0[Aa]{{IFWTOKEN}}|{{IFWTOKEN}}0[Dd]{{IFWTOKEN}}|{{IFWTOKEN}}0[Aa]{{IFWTOKEN}})/;IFW.TokenDelimRegex=/{{IFWTOKEN}}/g;IFW.ProcessingInterval=5E3;
IFW.SampleDataEditor=function(a,b){function c(o){this.CurrentMessage=o.Message||null;this.ParentSelector=o.ParentSelector||Q;this._CodeMirror=null;this.onCancel=o.onCancel||function(){};this.onMessageLoadComplete=o.onMessageLoadComplete||function(){};b.extend(o.CodeMirrorOptions,{extraKeys:{Tab:G,"Shift-Tab":G}});this._CodeMirror=this._initEditor(o.CodeMirrorOptions||{});this._CodeMirror.SDE=this;this._registerGuiEvents();this.CurrentMessage&&this.nextMessage(this.CurrentMessage)}function e(){var o=
b(L.getTextArea()).next().find(".EOL");b(".toggle-eol").prop("checked")?o.css("visibility","hidden"):o.css("visibility","visible")}function d(o){b(o).parents(V).find("textarea").trigger("focus");L.focus()}function f(o){d(o.target);o=b(L.getTextArea()).next().find(".EOL");o.first().css("visibility")==="visible"?o.css("visibility","hidden"):o.css("visibility","visible")}function h(){e()}function j(o){d(o.target)}function p(o){d(o.target);o=b("option:selected",this).val();o=T(o,L.SDE.CurrentMessage);
L.setOption("mode",o)}function n(o){if(!(o.keyCode!==undefined&&o.keyCode!==13)){o.preventDefault();d(o.target);o=L.SDE._$Controls.find(".insert-hex-value");var g=o.val().trim().toUpperCase();if(U(g)){alert("Valid hex codes range from 00 to FF");o.select()}else{var l=L.getCursor(),q=l.line;l=l.ch;if(g>="20"&&g<="7E"){g=P(g);L.replaceRange(g,{line:q,ch:l})}else{g=S.hexToken(g);L.replaceRange(g.ServerToken,{line:q,ch:l});L.markText({line:q,ch:l},{line:q,ch:l+g.ServerToken.length},{replacedWith:g.newNode(),
clearWhenEmpty:false})}o.val("")}}}function t(){var o=L.getValue();b.post("http://localhost:4567/write_sample_data",{message:o},function(){},"json");return false}function w(o,g){switch(g.origin){case "paste":if(g.text.length>1&&g.text[0].indexOf("{{IFWTOKEN}}")===-1)for(var l=S[b(".line-ending-select").val()],q=0,x=g.text.length;q<x;q++)if(g.text[q]!==""||g.text[q]===""&&q!==g.text.length-1)if(q!==g.text.length-1)g.text[q]+=l.ServerToken}}function s(o,g){switch(g.origin){case "paste":o.operation(function(){for(var l=
0,q=g.from.line;l<g.text.length;l++,q++)o.SDE._addMarkersToLine(o.getLine(q),q)})}}function r(o,g){if(g.keyCode===13){switch(L.SDE._$Controls.find("select.line-ending-select").val().toUpperCase()){case "CRLF":N(S.CRLF,void 0);break;case "CR":N(S.CR,void 0);break;case "LF":N(S.LF,void 0)}g.preventDefault()}}function y(o,g){b("<div>   <p>This action will process "+o+" lines and may take a while on older browsers. Would you like to proceed?</p></div>").dialog({appendTo:"body",buttons:{Proceed:function(){b(this).dialog("close");
g()},Cancel:function(){b(this).dialog("close")}}})}function C(){function o(Z){for(var X=Z;X<H;X++){if(x)if(x.InProgress){if(X>Z+q-1){x.update("Converted "+X+" of "+H+" lines. Canceling will leave the rest unconverted.",X);break}}else{x.start();break}var z=l,E=X,K=null;if((K=IFW.EOLregex.exec(L.getLine(E)))!==null){L.replaceRange(z.ServerToken,{line:E,ch:K.index},{line:E,ch:K.index+K[0].length});L.SDE._addMarkersToLine(L.getLine(E),E)}x&&X===H-1&&x.finished()}}var g=b(".line-ending-select").val(),
l=S[g],q=IFW.ProcessingInterval,x=null;if(L.getSelection()==="")var D=0,H=L.SDE.Lines.length;else{D=L.getCursor("from").line;H=L.getCursor("to").line}var W=H-D;W>q?y(W,function(){x=new B(o);L.operation(function(){o(D)})}):L.operation(function(){o(D)});b(".line-ending-select").val(g)}function B(o,g){this.Message="";var l='<div id="sde-loading">   <p id="sde-loading-msg"> '+this.Message+"</p></div>";this.Pos=0;this.InProgress=null;this.KeepWaitingCB=o;this.CancelCB=g;this.Timeouts=[];this.start=b.proxy(function(){this.$KeepWaitingDialog.dialog("open");
b(':button:contains("Keep Waiting")').prop("disabled",true).addClass("ui-state-disabled");b("#sde-loading-msg").text(this.Message||"Starting ...");this.InProgress=true;var q=this;this.Timeouts.push(setTimeout(function(){q.KeepWaitingCB(q.Pos)}))},this);this.$KeepWaitingDialog=b(l).appendTo("body").dialog({title:"Keep waiting?",width:400,modal:true,autoOpen:false,buttons:{"Keep Waiting":this.start,Cancel:b.proxy(function(){this.finished();this.CancelCB()},this)},open:function(){b(this).parents(".ui-dialog").find(".ui-dialog-titlebar-close").hide()},
draggable:false,resizable:false});this.update=function(q,x){if(this.$KeepWaitingDialog){this.Pos=x;this.Message=q;this.$KeepWaitingDialog.dialog("isOpen")||this.$KeepWaitingDialog.dialog("open");b("#sde-loading-msg").text(this.Message);this.InProgress&&this.Timeouts.push(setTimeout(b.proxy(function(){this.KeepWaitingCB(this.Pos)},this)))}};this.finished=function(){for(var q in this.Timeouts)clearTimeout(this.Timeouts[q]);this.InProgress=null;if(this.$KeepWaitingDialog&&this.$KeepWaitingDialog.dialog("isOpen")){this.$KeepWaitingDialog.dialog("close").remove();
this.$KeepWaitingDialog=null}}}function G(){var o=/({{IFWTOKEN}}([0-9A-F]{2}|CR|LF){{IFWTOKEN}}|\n)/g,g=L.getSelection().replace(o,"");o=L.getLine(L.getCursor().line).replace(o,"");g===""&&o===""?L.replaceSelection("\t"):L.operation(function(){for(var l=L.getCursor("from").line,q=L.getCursor("to").line;l<=q;l++)L.indentLine(l)})}function N(o,g){if(g===undefined)g=true;var l=L.getCursor().line;L.replaceSelection("\n");g&&L.replaceRange(o.ServerToken,{line:l,ch:L.getLine(l).length});var q=o.newNode();
if(b(L.getTextArea()).siblings(".eol-type").find(".toggle-eol").prop("checked"))q.style.visibility="hidden";L.markText({line:l,ch:L.getLine(l).length-o.ServerToken.length},{line:l,ch:L.getLine(l).length},{replacedWith:q,clearWhenEmpty:false,inclusiveRight:true})}function T(o,g){switch(o){case "hl7":var l="(",q=g.substr(3,5);for(i in q)l+=q[i].replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"|";l=l.substr(0,l.length-1)+")";return{name:"hl7",DelimiterRegex:l,LfToken:S.LF.Token,CrToken:S.CR.Token};case "xml":return{name:"xml"};
case "http":return{name:"http"};case "plain":return{name:"plain"};case "json":return{name:"javascript"}}}function F(o){if(/^(MSH|FHS|BHS)/i.test(o))return"hl7";if(/(<\?XML.*\?>|\!DOCTYPE HTML)/i.test(o))return"xml";if(/HTTP/i.test(o))return"http";var g;a:{for(var l=g=0;l<o.length;l++)if(o[l]=="{")g++;else if(o[l]=="}"){g--;if(g<0){g=false;break a}}g=g==0}if(g){var q;o=o.replace(/\{\{IFWTOKEN\}\}.*?\{\{IFWTOKEN\}\}/g,"");try{JSON.parse(o);q="json"}catch(x){q="plain"}return q}return"plain"}function P(o){if(U(o))throw Error("Bad Hex Code.");
return eval('"\\x'+o+'"')}function U(o){if(o[0]==="x"||o[0]==="X")o=o.substring(1);if(o[0]==="0x"||o[0]==="0X")o=o.substring(2);if(o.length===1)o="0"+o;o=o.toUpperCase();if(o>="00"&&o<="FF")return false;return true}var Q=".editor-container",L=null,V=".editor-wrapper",S=function(){return{CR:{Token:"CR",ServerToken:"{{IFWTOKEN}}0D{{IFWTOKEN}}",Actual:"\r",newNode:function(){return b("<span class='sde-token CR EOL'>CR</span>")[0]}},LF:{Token:"LF",ServerToken:"{{IFWTOKEN}}0A{{IFWTOKEN}}",Actual:"\n",
newNode:function(){return b("<span class='sde-token LF EOL'>LF</span>")[0]}},CRLF:{Token:"CRLF",ServerToken:"{{IFWTOKEN}}0D{{IFWTOKEN}}{{IFWTOKEN}}0A{{IFWTOKEN}}",Actual:"\r\n",newNode:function(){return b("<span class='sde-token CRLF EOL'>CRLF</span>")[0]}},hexToken:function(o){var g="0x"+o.toUpperCase(),l=P(o);return{ServerToken:"{{IFWTOKEN}}"+o+"{{IFWTOKEN}}",Token:g,ClassName:"hex-code",Actual:l,newNode:function(){return b("<span class='sde-token hex-code'>"+g+"</span>")[0]}}}}}(),m=c.prototype;
m.nextMessage=function(o){this.CurrentMessage=o;o=this.CurrentMessage.split("\n");o[o.length-1]===""&&o.pop();this.Lines=o;var g;o=this.Lines[0];if(o.substring(o.length-S.CRLF.ServerToken.length,o.length)===S.CRLF.ServerToken)g="CRLF";else if(o.substring(o.length-S.CR.ServerToken.length,o.length)===S.CR.ServerToken)g="CR";else if(o.substring(o.length-S.LF.ServerToken.length,o.length)===S.LF.ServerToken)g="LF";this.EolType=g;g=F(this.CurrentMessage);this._CodeMirror.setOption("mode",T(g,this.CurrentMessage));
this._CodeMirror.setValue(this.CurrentMessage);this._loadMessageIntoEditor();this.markClean();L&&e();this._setUpControlsForMode(g,this.EolType)};m.getValue=function(){return this._CodeMirror.getValue().replace(/\n/g,"")};m.refresh=function(){var o=this;this._CodeMirror.operation(function(){o._CodeMirror.eachLine(function(g){o._addMarkersToLine(g.text,o._CodeMirror.getLineNumber(g))})})};m.markClean=function(){this.IsCleanToken=this._CodeMirror.changeGeneration()};m.isClean=function(){return this._CodeMirror.isClean(this.IsCleanToken)};
m._initEditor=function(o){this.$Container=this.ParentSelector!==Q?b(this.ParentSelector):b(v.DefaultContainer);this.$Container.addClass(Q.substr(1));this._$Controls=b(v.Controls);this.$Container.before(this._$Controls);this._$EditorControl=b(v.EditorTextArea).appendTo(this.$Container);this._$EditorWrapper=b(v.EditorWrapper);this.$Container.wrap(this._$EditorWrapper);return a.fromTextArea(this._$EditorControl.get(0),o)};m._registerGuiEvents=function(){this._CodeMirror.on("keydown",r);this._CodeMirror.on("focus",
function(o){L=o});this._CodeMirror.on("change",s);this._CodeMirror.on("beforeChange",w);this._CodeMirror.on("beforeChange",w);this._CodeMirror.on("viewportChange",h);this._$Controls.find(".insert-hex-btn").on("click",n);this._$Controls.find(".insert-hex-value").on("keypress",n);this._$Controls.find("select").on("change",j);this._$Controls.find("button.convert-eol").on("click",C);this._$Controls.find(".toggle-eol").on("click",f);this._$Controls.find("select.message-type-select").on("change",p);this.$Container.parents("form").on("submit",
t)};m._setUpControlsForMode=function(o,g){this._$Controls.find("option[value="+o+"]").prop("selected",true);this._$Controls.find("option[value="+g+"]").prop("selected",true)};m._loadMessageIntoEditor=function(o){function g(H){for(var W=H;W<D;W++){if(W>H+l-1){x.update("Rendered "+W+" of "+D+" lines. Keep waiting?",W);break}q._addMarkersToLine(q.Lines[W],W);if(W===D-1){x&&x.finished();q.onMessageLoadComplete()}}}o=o||0;var l=IFW.ProcessingInterval,q=this,x=null,D=this.Lines.length;if(D>l)x=new B(g,
this.onCancel);this._CodeMirror.operation(function(){g(o)})};m._addMarkersToLine=function(o,g){var l=null;l="";for(var q=null,x=0,D=q="";(MatchData=IFW.TokenRegex.exec(o))!==null;){q=MatchData[1];D=MatchData[2];l=MatchData[3];x=MatchData.index;if(q&&D){l=S.CRLF;q=true}else if(l==="0D"){l=S.CR;q=true}else if(l==="0A"){l=S.LF;q=true}else{l=S.hexToken(l);q=false}this._CodeMirror.markText({line:g,ch:x},{line:g,ch:x+l.ServerToken.length},{replacedWith:l.newNode(),clearWhenEmpty:false,inclusiveRight:q})}};
var v={Controls:"<div class='control-wrapper'>   <label class='control message-type'><span>Message Type</span>      <select class='message-type-select'>         <option value='hl7'>HL7</option>         <option value='http'>HTTP</option>         <option value='xml'>XML</option>         <option value='json'>JSON</option>         <option value='plain'>Plain Text</option>      </select>   </label>   <label class='control eol-type'><span>EOL Type</span>      <select class='line-ending-select'>         <option value='CR'>CR</option>         <option value='LF'>LF</option>         <option value='CRLF'>CRLF</option>      </select>      <button class='convert-eol'>Convert</button>      <label><span> | Hide EOLs</span>         <input type='checkbox' class='toggle-eol'/>      </label>   </label>   <label class='control insert-hex'><span>Hex Code</span>      <input size='2' maxlength='2' class='insert-hex-value' type='text' style='font-family: monospace; text-transform: uppercase'/>      <button class='insert-hex-btn'>Insert</button>   </label></div>",
EditorTextArea:"<textarea class='editor'></textarea>",EditorWrapper:"<div class='editor-wrapper'></div>",DefaultContainer:"<div class='editor-container'></div>"};return c}(CodeMirror,jQuery);IFW=IFW||{};
IFW.editSampleData=function(a){var b={Guid:PAGgetField(a,"ChannelGuid"),Name:PAGgetOptionalField(a,"ChannelName")},c=MAPretrieveHeaderHTML("message_edit",a);c+='<div class="content_main floated_bottom"></div>';$(document).find("body").html(c);b=b.Guid;var e=a.NewMsg==0?PAGgetField(a,"Index"):-1;c='<div class="EDTtoolbar_wrapper">  <span id="sample_data_control"></span>  <div class="back">    <span class="label">&larr; Back to:&nbsp;&nbsp;      <a id="SPDsampleDataBackLink" href="'+PAGhref("SampleData",MAPretrieveParams("message_preview",
a))+'">Sample Data</a>    </span> |     <span class="label">      <a id="SPDscriptBackLink" href="'+PAGhref("OpenEditor",MAPretrieveParams("lua_editor",a))+'"> Script </a>    </span>  </div>  <span class="heading">Edit Message</span></div>';c+='<div class="SPDeditorWrapper">  <div style = "margin-top: 3px;">    <span class="heading">Name</span>  </div>  <textarea id="SPDnameEditor" class="SPDeditor" style="width:100%;height: 18px;margin-bottom: 3px;margin-top: 6px;"></textarea>  <div style = "margin-bottom: 6px;margin-top: 3px;">    <span style="display:inline-block" class="heading">Message</span><span style="font-weight: bold;" id="message-loading-spinner"> (Please wait while it renders...)</span>  </div>  <div id="SPDmessageEditorWrapper">    <hr/>  </div>  <div class="BTNbuttons">    <a class="action-button grey" href="javascript:SPDEexitPage(false);">Close</a>    <a class=\'action-button blue\' href=\'javascript:SPDEsaveMessage("'+
b+'", '+e+');\'>Save</a>  </div></div><div class="SPDajaxError"></div>';$("div.content_main").css("top",$("div.header").height()+"px");$("div.content_main").html(c);a.MPRapp=MPRapp.type;IFW.Sde=new IFW.SampleDataEditor({ParentSelector:"#SPDmessageEditorWrapper",onCancel:function(){PAGcurrentPage==="EditSampleData"&&$("#SPDsampleDataBackLink")[0].click()},CodeMirrorOptions:{lineNumbers:true,lineNumbers:true,autofocus:true,indentUnit:3,tabSize:3}});if(a.NewMsg==0){Ajax.post("/ann/sample_data_info",
a,function(d){IFW.TranslatorGuid=d.ChannelGuid;IFW.MessageName=d.Name;IFW.MessageIndex=d.Index;$("textarea#SPDnameEditor").text(d.Name)});c=ifware.storage.get("CurrentMessageWithEdits");if(c!==null&&c!==""){IFW.Sde.nextMessage(c);ifware.storage.remove("CurrentMessageWithEdits")}else Ajax.post("/ann/sample_data",a,function(d){IFW.Sde.nextMessage(d);$("#message-loading-spinner").remove()})}else IFW.Sde._CodeMirror.setOption("mode","hl7")};
function SPDEsaveMessage(a,b){var c=IFW.Sde.getValue(),e=$("#SPDnameEditor").val();Ajax.post(Params.NewMsg==0?"/ann/update_sample_data":"/ann/add_sample_data",{translator_guid:a,Index:b,Message:c,Name:e},SPDEhandleSaveResult,"json")}function SPDEhandleSaveResult(a){if(a.ErrorMessage){$("div.SPDeditorWrapper").css("bottom","50px");$("div.SPDajaxError").html(a.ErrorMessage)}else SPDEexitPage(true)}
function SPDEexitPage(a){var b;if(Params.BackToEditor)b=$("#SPDscriptBackLink").attr("href");else{b=$("#SPDsampleDataBackLink").attr("href");if(a)b+="&SavedMsgIndex="+Params.Index}location.href=b};/*

 A thin wrapper around storage, with one key difference:
 this allows the specification of the data's expiry (like cookies).
 Each time storage is accessed (through set(), get(), or remove()),
 all expired data will be removed.
 Only strings may be stored, but if the string 'true' or 'false' is stored, then it will return Boolean version.

 Unit tests exist for this module in
 shared_web_docs\js\unittests\utils\local_storageTests.js.

 Copyright (c) 2010-2013 iNTERFACEWARE Inc.  All rights reserved.
*/
(function(a,b){a.LocalStorage=function(c){function e(n){var t=n.indexOf(p);return[n.substring(0,t),n.substring(t+1)]}function d(){$(this).trigger(this.events.clearExpired);var n=Math.floor((new Date).getTime()/f);if(n!==h){var t=(new Date).getTime();for(k in j)try{var w=e(j[k]),s=parseInt(w[0]);s!=NaN&&s<t&&j.removeItem(k)}catch(r){}h=n}}var f=864E5,h,j=window.localStorage,p="^";return j?{events:{clearExpired:"clearExpired"},set:function(n,t,w){d.call(this);if(c)n=c.concat("_",n);j.setItem(n,((new Date).getTime()+
w*f).toString().concat(p,t))},setObject:function(n,t,w,s,r){t=JSON.stringify(t,s,r);this.set(n,t,w)},get:function(n){d.call(this);try{if(c)n=c.concat("_",n);var t=e(j.getItem(n));if(t[1]==="true"||t[1]==="false")return t[1]==="true";return t[1]}catch(w){return null}},getObject:function(n,t){var w=this.get(n);return w?JSON.parse(w,t):null},remove:function(n){d.call(this);j.removeItem(n)},clear:function(){j.clear()}}:{set:$empty,get:$lambda(null),remove:$empty,clear:$empty}};a.LocalStorage.setOrGetState=
function(c,e,d,f){if(d===b){if(!c[e].loaded){c[e].loaded=true;d=f.get(e);if(d!==null)c[e]=d}}else if(d!==c[e])if(c[e].constructor===d.constructor){c[e]=d;f.set(e,d)}else throw"Cannot set state of ".concat(e," to a value to a value of a different type.");return c[e]};a.storage=a.LocalStorage()})(ifware||{});var PAGlocation="",PAGcurrentPage="",PAGcurrentModule="",PAGbaseTitle="";function PAGsetupCommonMapCalls(a){a.OpenEditor=EDTopenEditor;a.SampleData=SPDview;a.BulkTestResults=BTRview;a.StageCommit=SCMstage;a.ReviewCommits=SCMreview;a.EditSampleData=IFW.editSampleData}function PAGhref(a,b){var c="#Page="+a;if(b)for(i in b)if("Page"!=i)c+="&"+i+"="+PAGencodeAllTheThings(b[i]);return c}function PAGlink(a,b,c){return"<a href='"+PAGhref(a,b)+"'>"+c+"</a>"}
function PAGwarning(a){$("<div>"+PAGhtmlEscape(a)+"</div>").appendTo("body:first").dialog({title:"Warning",modal:true,buttons:{OK:function(){$(this).dialog("close")}},close:function(){$(this).dialog("destroy").remove()}})}function PAGgetField(a,b){if(typeof a[b]==="undefined")throw Error("Need to have "+b+" defined.");return a[b]}function PAGgetOptionalField(a,b){if(typeof a[b]==="undefined")return"";return a[b]}
function PAGparseAnchorString(a){var b={};a=a.split("&");for(var c=0;c<a.length;c++){var e=a[c].split("=");if(undefined!=e[1])e[1]=PAGconvertSpaceEncoding(e[1]);b[e[0]]=decodeURIComponent(e[1])}return b}function PAGupdateParamGlobals(a){PAGcurrentPage=a.Page;PAGcurrentModule=a.Module}function PAGcheckParams(a){if(!a.Module)a.Module="main.lua";if(a.ChannelGuid&&!a.translator_guid)a.translator_guid=a.ChannelGuid}
function PAGcallPage(a){a=a.split("#");if(a.length<2)MPRapp.defaultRequest("No page specified.");else{a=a.pop();if(a!="error"){Params=PAGparseAnchorString(a);if("OpenEditor"==Params.Page&&PAGcurrentPage==Params.Page){PAGcheckParams(Params);PAGcurrentModule!=Params.Module&&NISonFileChanged(window.NISeditor,Params.Module);PAGupdateParamGlobals(Params)}else{PAGcheckParams(Params);PAGupdateParamGlobals(Params);window.onresize=null;$(window).unbind("keydown");if(typeof Params.Page==="undefined"||""==Params.Page)MPRapp.defaultRequest("No page specified.");
else if(typeof MPRapp.pageLookup[Params.Page]==="undefined"){a=PAGhtmlEscape(Params.Page);MPRapp.renderError("Page "+a+" not found.",Params)}else MPRapp.pageLookup[Params.Page](Params)}}}}$(document).ready(function(){function a(){if(PAGlocation!=location.href){PAGlocation=location.href;PAGcallPage(location.href)}}if("onhashchange"in window&&(document.documentMode===undefined||document.documentMode>7))window.onhashchange=a;else setInterval(a,100);PAGbaseTitle=$(document).get(0).title});
function PAGchangeParameter(a,b){var c=PAGparseAnchorString(location.hash.substr(1));c[a]=b;location.hash=PAGhref(c.Page,c);PAGlocation=location.href};$(document).ready(function(){PAGcallPage(window.location.href)});var NISeditor=null;function NIScreateIframe(a,b,c){var e;if(document.createElement&&(e=document.createElement("iframe"))){$(e).hide();e.name=e.id=a;$(e).css({position:"absolute",width:b,border:0});c.appendChild(e)}return e}function NISblockLeftMargin(a){for(var b=0,c=0;c<a.length;++c)if(a.charAt(c)==" ")++b;else break;return b}
function NISretrieveMergeConflictData(a){for(var b=a.ifware.CharWidth=NIScharWidth(a),c=-1,e=-1,d=-1;(Line=a.getLine(++c))!==undefined;){var f={};if(Line.match(/^.*BEGIN MERGE CONFLICT.*$/))e=c;else if(Line.match(/^.*END MERGE CONFLICT.*$/)){f.c=0;f.w=b*d;f.s=e;f.e=c;f.type="merge_conflict";f.t="Merge Conflict";a.ifware.BlockDataSet[a.ifware.BlockDataSet.length++]=f;e=d=-1}if(e!=-1)if(d<Line.length)d=Line.length}}
function NISretrieveCodeBlockData(a){var b=a.ifware.CharWidth=NIScharWidth(a);a.ifware.BlockDataSet={};for(var c=a.ifware.BlockDataSet.length=0,e=-1,d=false;(Line=a.getLine(++e))!==undefined;)if(!Line.match(/^\s*$/)){var f={};f.c=NISblockLeftMargin(Line);f.w=b*Line.length;f.s=e;f.e=f.s+1;if(d)if(Line.match(/^.*\]\].*$/)){f.type="comment";d=false}else f.type="comment";else if(Line.match(/^\s*\-\-\[\[.*/)){f.type="comment";d=true}else f.type=Line.match(/^\s*\-\-.*$/)||Line.match(/^\s*\-\-\[\[.*\]\].*/)?
"comment":Line.match(/^\s*require\s*.*$/)?"requires":Line.match(/^function .*$/)?"function":Line.match(/^end.*$/)?"end":"line";a.ifware.BlockDataSet[c]=f;++a.ifware.BlockDataSet.length;++c}}function NISmaxLineOfCodeLength(a,b){for(var c=a.length,e=0,d=0;d<c;++d)if("annotation"!=a[d].type){var f=a[d];f=0.5*f.c+0.5*f.w/b;if(f>e)e=f}return e}function NISoptimalBlockWidth(a,b,c,e){return Math.ceil(0.5*a.w/e)}
function NISretrieveBlockStyle(a){var b=null;b="annotation"==a?{"class":"ANNblock"}:"line"==a?{fill:"grey"}:"comment"==a?{"class":"lua-comment"}:"requires"==a?{"class":"lua-stdfunc"}:"function"==a?{"class":"lua-keyword"}:"end"==a?{"class":"lua-keyword"}:"merge_conflict"==a?{"class":"merge-conflict"}:{"class":"lua-token"};LOG_VAR(b);return b}function NISmainFileSelectedAndEmpty(a){return a.ifware.MainLuaFile==a.ifware.CurrentFileName&&a.lineCount()==1&&a.getLine(0)==""}
function NISonEditorInit(a){a.ifware.CharWidth=NIScharWidth(a);ITSinitIntellisense(a,a.ifware.IntellisenseStatusContainer);a.ifware.addKeyDownListener(function(b,c){if(c.keyCode==27){c.preventDefault();return POPdialogsController.closeFrontmostPopup()}return false});if(!a.ifware.projectSettings.showThumbnails()){$("div#EDTthumbnailScroll").hide();$("#EDTeditor .CodeMirror").css("right","0px")}NISannotateCode(a,{FirstRequest:true});ETHscrollerControl.initializeScroller(function(b){EDTscrollEditor(b,
a)});a.ifware.addScrollListener(function(b){ETHscrollerControl.scroll(b)});NISmainFileSelectedAndEmpty(a)&&SCMimportProjectAndData(a,ifware.ProjectManager);ifware.storage.get("CurrentMessageWithEdits")!==null&&$("#edit_message").trigger("click")}function NISonCursorActivity(a){if(!a.ifware.ChangingFile)for(var b=0;b<a.ifware.CursorActivityListeners.length;b++)a.ifware.CursorActivityListeners[b](a)}
function NISonScroll(a){for(var b=0;b<a.ifware.ScrollListeners.length;b++)a.ifware.ScrollListeners[b](a)}function NISonChange(a,b){for(var c=0;c<a.ifware.ChangeListeners.length;c++)a.ifware.ChangeListeners[c](a,b)}function NISonKeyDown(a,b){for(var c=0;c<a.ifware.KeyDownListeners.length;c++)if(a.ifware.KeyDownListeners[c](a,b))return true;return false}function NISonKeyPress(a,b){for(var c=0;c<a.ifware.KeyPressListeners.length;c++)if(a.ifware.KeyPressListeners[c](a,b))return true;return false}
function NISonTabPress(a){var b=a.getSelection(),c=a.getLine(a.getCursor().line);b===""&&c===""?a.replaceSelection("\t"):a.operation(function(){for(var e=a.getCursor("from").line,d=a.getCursor("to").line;e<=d;e++)a.indentLine(e)})}
function NIScreateEditorWithContent(a,b,c,e){var d=NISeditor=new CodeMirror(a,{mode:b.ScriptType,value:b.ScriptData,theme:"ifware",gutters:["CodeMirror-linenumbers","dirty"],extraKeys:{Tab:NISonTabPress,"Shift-Tab":NISonTabPress},lineNumbers:true,indentUnit:3,tabSize:3,fixedGutter:false});d.on("cursorActivity",NISonCursorActivity);d.on("scroll",NISonScroll);d.on("change",NISonChange);d.on("keypress",NISonKeyDown);d.on("keydown",NISonKeyPress);d.on("blur",NISunmarkCurrentLine);d.on("focus",NISonEditorFocus);
ifware.Editor=d;d.ifware={};d.ifware.data={};d.ifware.setSampleIndex=function(f){localStorage.setItem(d.ifware.ChannelGuid+"-SampleIndex",f.toString())};d.ifware.sampleIndex=function(){var f=localStorage.getItem(d.ifware.ChannelGuid+"-SampleIndex");f=parseInt(f);if(f>d.ifware.countOfSample())f=d.ifware.countOfSample();if(isNaN(f)||f<=0)f=1;return f};d.ifware.setCountOfSample=function(f){d.ifware.data.CountOfSample=f};d.ifware.countOfSample=function(){return d.ifware.data.CountOfSample};if(!d.getHistory||
!d.setHistory)alert("Warning: editor history patch (#17864) is unavailable.  Has CodeMirror been upgraded?");d.ifware.projectSettings=e;d.ifware.CursorActivityListeners=[NISdefaultOnCursorMove];d.ifware.addCursorActivityListener=function(f){this.CursorActivityListeners.push(f)};d.ifware.ScrollListeners=[];d.ifware.addScrollListener=function(f){this.ScrollListeners.push(f)};d.ifware.ChangeListeners=[NISdefaultOnChange];d.ifware.addChangeListener=function(f){this.ChangeListeners.push(f)};d.ifware.KeyDownListeners=
[];d.ifware.addKeyDownListener=function(f){this.KeyDownListeners.push(f)};d.ifware.KeyPressListeners=[];d.ifware.addKeyPressListener=function(f){this.KeyPressListeners.push(f)};$(window).keydown(function(f){NISonBodyKeyDown(f,d)});NISupdateEmptyTreenodeDisplayStyle(d);d.ifware.Parent=a;d.ifware.MainLuaFile="main.lua";NISsetScriptName(d,b.ScriptName);d.ifware.CurrentSourceHash=b.SourceHash;d.ifware.EditorGuid=b.EditorGuid;d.ifware.ChannelGuid=b.ChannelGuid;d.ifware.UsesParameter=b.UsesParameter;d.ifware.UsesHttpsParameter=
b.UsesHttpsParameter;b.UsesParameter&&d.ifware.setCountOfSample(b.CountOfSample);d.ifware.User=c;d.ifware.ModuleStates={};d.ifware.CurrentDirtyLine=null;d.ifware.ReqTank={};Params.Index!=undefined&&d.ifware.setSampleIndex(Params.Index);ifware.ProjectManager=new ProjectManager22($("#EDTprojectManager"),"SCRtree",Params.ChannelName,Params.ChannelGuid);ifware.ProjectManager.freshen();d.ifware.focusLastFocussedElement=$empty;return d}
var NISresizeDelay=function(){return function(a,b,c){clearTimeout(0);timer=setTimeout(a,b,c)}}();function NISdoThumbnailResize(a){if(!(null==a||null==a.ifware)){NISrefreshBlockInfo2(a,a.ifware.AnnotationBlockDataSet);ETHscrollerControl.resize(a)}}
function NISkillSwitch(a,b,c){$("#NISkillDialog").remove();$('<div id="NISkillDialog">   <p>This script is taking a long time to run. Do you want to force it to stop?</p>   <p>If you stop it, automatic script execution will be disabled to prevent a recurrence.</p></div>').appendTo("body").dialog({title:"Slow script",width:400,modal:true,buttons:{"Force stop":function(){$(this).dialog("close");NISkillAndSafeRefreshEditor(a,b,c)},"Keep waiting":function(){$(this).dialog("close")}},draggable:false,resizable:false});
$(".ui-dialog").css("z-index","1001")}function NISkillAndSafeRefreshEditor(a,b,c){$.ajax({url:"/ann/destroy",data:{translator_guid:c.translator_guid,user:c.User},success:function(){localStorage.setItem("disableAutoScriptExecution","NaN^true");NIScreateEditor(a,b,c)}})}
function NIScreateEditor(a,b,c){var e={translator_guid:PAGgetField(c,"ChannelGuid"),file_name:PAGgetOptionalField(c,"Module"),delay_sync:PAGgetOptionalField(c,"delay_sync")};ifware.project={};ifware.project.storage=ifware.LocalStorage(e.ChannelGuid);var d=ifware.initializeProjectSettings(ifware.project.storage);ifware.TheStore=d;$.ajax({url:"/ann/launch_editor",data:e,method:"POST",success:function(f){$("body:first div.EDTloading:first").remove();clearTimeout(ifware.Timers.Launch);ifware.Timers.Launch=
null;if(f.ErrorMessage){MPRapp.renderError(f.ErrorMessage,c);window.clearTimeOut(ifware.Timers.Launch)}else{if(c.Index!=undefined&&c.Index!=f.SampleDataIndex)f.SampleDataIndex=c.Index;var h=NIScreateEditorWithContent(a,f,c.User,d);ETHscrollerControl.show(h);window.onresize=function(j){if(j.target===window){NISresizeDelay(NISdoThumbnailResize,500,h);DCKdockController.resize();EDTonResize()}};$(window).off("focus");$(window).on("focus",function(){NIScheckIfFileModified(h)});typeof b!="undefined"&&b(h,
c);NISonEditorInit(h)}},error:function(f){clearTimeout(ifware.Timers.Launch);var h=f.statusText;if(f.responseJSON.error)h=f.responseJSON.error.description;MPRapp.renderError(h,c)}})}function NISgetEditorScollArea(){return $("#EDTeditor .CodeMirror-sizer")}var NISgetLineTop=function(){var a=null;return function(b,c){if(!a){a=$(NISgetEditorScollArea()).offset().top;setTimeout(function(){a=null},0)}return b.charCoords({line:c,ch:0}).top-a+1}}();
function NISgetLineLeft(){return $("#EDTeditor .CodeMirror-gutter").last().outerWidth()+4}function NISeditorIsEmpty(a){return a.lineCount()==0}function NIScharWidth(a){return a.defaultCharWidth()}var NIScharHeight=function(){var a=null;return function(){a||(a=NISeditor.defaultTextHeight());return a}}();function NISgetEditorScrollTop(){return $("#EDTeditor .CodeMirror-scroll").get(0).scrollTop}function NISgetEditorScrollLeft(){return $("#EDTeditor .CodeMirror-scroll").get(0).scrollLeft}
function NISsetEditorScrollPosition(a,b){$("#EDTeditor .CodeMirror-scroll").get(0).scrollTop=a;$("#EDTeditor .CodeMirror-scroll").get(0).scrollLeft=b}function NISsetEditorScrollTop(a){$("#EDTeditor .CodeMirror-scroll").get(0).scrollTop=a}function NISsetEditorScrollLeft(a){$("#EDTeditor .CodeMirror-scroll").get(0).scrollLeft=a}function NISscrollToLine(a,b){var c=NISgetLineTop(a,b);a.scrollTo(0,c-NISeditorHeight()/2)}function NISeditorHeight(){return $("#EDTeditor .CodeMirror")[0].clientHeight}
function NISeditorWidth(){return $("#EDTeditor .CodeMirror")[0].clientWidth}function NISeditorInnerWidth(){return NISgetEditorScollArea()[0].clientWidth}function NISeditorScrollHeight(){return $("#EDTeditor .CodeMirror-scroll")[0].scrollHeight}function NISeditorScrollWidth(){return $("#EDTeditor .CodeMirror-scroll")[0].scrollWidth}function NISclearAnnotations(){$("div.ANNblock").remove()}
function NISsetButtonVisibility(a,b){Images=a.find("img");Images.each(function(){var c=$(this).attr("src"),e=c.indexOf("/")>=0?c.lastIndexOf("/"):0,d=b?"dis":"ena";if(c.substr(d.length,3)!=d){c=c.substr(0,e+1)+d+c.slice(e+d.length+1,c.length);$(this).attr("src",c)}})}function NISclearErrors(a){if(a.ifware.ErrorLine!==undefined)for(var b=a.lineCount(),c=0;c<b;c++)a.removeLineClass(c,"background",null);a.ifware.ErrorLine=undefined;$(".error-close,.error-box").remove()}
function NISclearErrorBox(){$(".error-box").remove()}function NISmarkLineAsDirty(a,b){a.ifware.CurrentDirtyLine=b;a.setGutterMarker(b,"dirty",$('<span class="dirty" style="display:inline-block;width:100%;"> </span>')[0]);NISmarkAnnotationAsStale(a,b)}function NISmarkLineAsClean(a){a.clearGutter("dirty")}
function NIShighlightLine(a,b){if(b!==a.ifware.ErrorLine){a.addLineClass(b,"background","ANNhighline");$(".ANNhighline").stop(true,true).removeAttr("style");setTimeout(function(){a.addLineClass(b,"background","ANNhighlineFading");$(".ANNhighlineFading").stop(true,true).css("background-color","#B5EAAA").animate({"background-color":"#FFFFFF"},"slow",function(){a.removeLineClass(b,"background",null)})},1E3)}}
function NISprepareLuaPostInfo(a,b,c){if(c)b.Code=a.getValue();b.FileName=a.ifware.CurrentFileName;b.EditorGuid=a.ifware.EditorGuid;b.ChannelGuid=a.ifware.ChannelGuid;b.user=a.ifware.User;b.translator_guid=a.ifware.ChannelGuid;b.SampleDataIndex=a.ifware.sampleIndex()}function NISlogT(){}function NISreloadCurrentFile(a){NISswitchFile(a,{},a.ifware.CurrentFileName)}
function NISswitchFile(a,b,c,e){a.ifware.InspectingChange=undefined;if(a.ifware.ReqTank["/ann/source_hash_check"]){Ajax.abort(a.ifware.ReqTank["/ann/source_hash_check"]);delete a.ifware.ReqTank["/ann/source_hash_check"]}NISclearErrors(a);var d={};NISprepareLuaPostInfo(a,d,b.SendCode);d.SourceHash=a.ifware.CurrentSourceHash;d.NewFile=c;d.DirTree=a.ifware.projectSettings.projectTree();if(b.ExplicitOverwrite)d.ExplicitOverwrite=true;a.ifware.ReqTank["/ann/switch_file"]=Ajax.post("/ann/switch_file",d,
function(f){delete a.ifware.ReqTank["/ann/switch_file"];NISclearAnnotations(a);if(f.ErrorMessage){e&&e.dialog("close");PAGwarning("Could not switch to "+c+".\n"+f.ErrorMessage);PAGcurrentModule!=NISgetScriptName(a)&&NISgoToFile(NISgetScriptName(a))}else if(f.FileModified)NISshowFileModifiedDialog(f,a);else{NISsetScriptName(a,f.NewFile);NISsetCode(a,f.Code,f.LastEditorGuid,f.Type);ifware.ProjectManager.freshen();NISupdateAnnotations(a);e&&e.dialog("close")}},"json")}
function NISgetFullArgumentRequests(a){var b=[];DCKdockController.getFullArgumentRequests(b);POPdialogsController.getFullArgumentRequests(b);if(b.length)a.FullArgumentRequests=$.toJSON(b)}
var NISupdateAnnotations=function(){var a=ScriptRunner();return function(b,c){c||(c={});NISclearErrors(b);var e={};NISprepareLuaPostInfo(b,e,c.SendCode);if(c.ForceReload)e.ForceReload=true;if(b.ifware.projectSettings.disableAutoScriptExecution()&&!c.force){b.ifware.AnnotationsStatusContainer.innerHTML="";e.Disabled=true;NISclearAnnotations(b)}else{b.ifware.AnnotationsStatusContainer.innerHTML='<img src="/js/mapper/images/spinner.gif" />';DCKdockController.beforeRefresh();POPdialogsController.beforeRefresh()}if(c.SendCode)e.SourceHash=
b.ifware.CurrentSourceHash;if(c.ExplicitOverwrite)e.ExplicitOverwrite=true;if(b.ifware.RequestFunctionBlock){e.FunctionBlock=b.ifware.RequestFunctionBlock;b.ifware.RequestFunctionBlock=undefined}NISgetFullArgumentRequests(e);a.post("/ann/info",e,function(d,f,h){NISprocessAnnotation2(d,f,h,b,c.FirstRequest)},function(){b.ifware.AnnotationsStatusContainer.innerHTML="Cancelled."})}}(),NISscheduleAnnotationsUpdate,AnnotationsUpdated;
NISscheduleAnnotationsUpdate=function(a,b){AnnotationsUpdated=false;setTimeout(function(){if(!AnnotationsUpdated){NISupdateAnnotations(a,b);AnnotationsUpdated=true}},0)};
function NIScheckIfFileModified(a){if(!a.ifware.InspectingChange){if(a.ifware.ReqTank["/ann/source_hash_check"]){Ajax.abort(a.ifware.ReqTank["/ann/source_hash_check"]);delete a.ifware.ReqTank["/ann/source_hash_check"]}if(a.ifware.CurrentSourceHash)if(!($("#NISfileModifiedDialog:visible").size()||$("#NISfileDiffDialog:visible").size())){var b={SourceHash:a.ifware.CurrentSourceHash,File:NISgetScriptName(a)};NISprepareLuaPostInfo(a,b,false);a.ifware.ReqTank["/ann/source_hash_check"]=Ajax.post("/ann/source_hash_check",
b,function(c){delete a.ifware.ReqTank["/ann/source_hash_check"];c.FileModified&&NISshowFileModifiedDialog(c,a)},"json")}}}
function NISshowFileModifiedDialog(a,b){$("#NISfileModifiedDialog").remove();if(!b.ifware.CurrentFileName!=a.FromFile){var c={};c["Show changes"]=function(){b.ifware.InspectingChange=true;$(this).dialog("close");NISshowFileModifiedDiff(b.getValue(),a.FromFileSource,a.FromFile,b)};c["Load changed version"]=function(){NISswitchFile(b,{},a.ToFile,$(this))};c["Use this version"]=function(){NISswitchFile(b,{SendCode:true,ExplicitOverwrite:true},a.ToFile,$(this))};$('<div id="NISfileModifiedDialog">   <p>"'+
a.FromFile+"\" has been modified outside of this editor.</p>   <p>Do you want to keep using this editor's contents, or load the changed version?</p></div>").appendTo("body").dialog({title:"File Modified",width:475,modal:true,buttons:c,draggable:false,resizable:false})}}
function NISshowFilesAffectedFromNewChangesetsDialog(a){$("#NISfilesAffectedFromNewChangesetsDialog").remove();for(var b=false,c="",e=0;e<a.affected_files.length;e++){var d=a.affected_files[e];if(d==="project.prj")b=true;else c=c+"<li>"+d+"</li>"}a=a.affected_files.length!==1;e="<div id='NISfilesAffectedFromNewChangesetsDialog'>";if(a||!b)e+="  <p>The following files have been updated to bring in changes committed by another user.</p>  <p>Please check these files to make sure the update hasn't impacted any of your uncommitted work.</p>  <ul>"+
c+"</ul>";if(b){e+=a?"<p>It also seems that you had files in this project that had yet to be committed.</p><p>The other user's changes may have removed them.":"<p>It seems you had files in this project that had yet to be committed.</p><p>Another user has committed changes that may have removed them. ";e+=" If they belong in this project you can add them again from disk.</p>"}e+=+"</div>";$(e).appendTo("body").dialog({title:"Files Affected by Merged Changes.",width:475,modal:true,buttons:{OK:function(){$(this).dialog("close")}},
draggable:false,resizable:false})}function NISescapeTextForDiff(a){return a.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;").replace(/&lt;(\/?)(ins|del)&gt;/gm,"<$1$2>")}
function NISshowFileModifiedDiff(a,b,c,e){var d={};d["Load the changed version"]=function(){NISswitchFile(e,{},c,$(this))};d["Use this version"]=function(){NISswitchFile(e,{SendCode:true,ExplicitOverwrite:true},c,$(this))};$('<div id="NISfileDiffDialog">   <div class="diffboxWrap"><h3>This editor\'s version</h3><div class="diffbox" id="diffboxLocal">'+NISescapeTextForDiff(a)+'</div></div>   <div class="diffboxWrap"><h3>Changed version (<ins>additions</ins> <del>deletions</del>)</h3><div class="diffbox" id="diffboxRemote">'+
NISescapeTextForDiff(diffString(a,b))+"</div></div></div>").appendTo("body").dialog({title:"File Changes",width:"90%",modal:true,draggable:false,resizable:false,buttons:d,close:function(){e.ifware.InspectingChange=undefined}});var f=$("#diffboxLocal, #diffboxRemote");f.scroll(function(){var h=$(this).scrollTop(),j=$(this).scrollLeft();f.each(function(){$(this).scrollTop()!=h&&$(this).scrollTop(h);$(this).scrollLeft()!=j&&$(this).scrollLeft(j)})})}
function NISshowSaveErrorDialog(a){var b={};b.Close=function(){$(this).dialog("destroy").remove()};$('<div id="NISsaveErrorDialog"><p>Could not save file.</p><p>'+a.ErrorMessage+"</p></div>").appendTo("body").dialog({title:"Save Error",width:375,modal:true,draggable:false,resizable:false,buttons:b})}function NISsetScriptName(a,b){a.ifware.CurrentFileName=b}function NISgoToFile(a){var b=location.href;b=b.replace(/&Module=[^&]*/g,"");location.href=b+"&Module="+escape(a)}
function NIScurrentModuleState(a){var b=a.ifware.ModuleStates[a.ifware.CurrentFileName];if(!b){b={};b.CursorPosition={line:0,ch:0};a.ifware.ModuleStates[a.ifware.CurrentFileName]=b}return b}function NISonFileChanged(a,b){if(a.ifware.CurrentFileName&&b!=a.ifware.CurrentFileName){var c=NIScurrentModuleState(a);c.ScrollTop=NISgetEditorScrollTop();c.CursorPosition=a.getCursor();c.History=a.getHistory();a.clearHistory()}NISswitchFile(a,{SendCode:a.ifware.CurrentDirtyLine!==null},b)}
function NISonSampleDataChanged(a,b){NIScloseSampleDataMiniBrowser(a,$("div.EDTsd_goto"));if(null==a.ifware)a.ifware={};if(a.ifware.countOfSample()!=0){if(isNaN(b))b=a.ifware.sampleIndex();else{b=Math.max(1,b);b=Math.min(a.ifware.countOfSample(),b)}if(b!=a.ifware.sampleIndex()){a.ifware.setSampleIndex(b);NISupdateSampleDataControl(a);NISupdateAnnotations(a)}}}function NISgetScriptName(a){return a.ifware.CurrentFileName}
function NISsetCode(a,b,c,e){a.ifware.ChangingFile=true;try{a.setValue(b);a.setOption("mode",e)}finally{a.ifware.ChangingFile=undefined}$(a.getGutterElement()).find("pre.dirty").removeClass("dirty");b=NIScurrentModuleState(a);c==a.ifware.EditorGuid&&b.History?a.setHistory(b.History):a.clearHistory();a.setCursor(b.CursorPosition||{line:0,ch:0});NISsetEditorScrollTop(b.ScrollTop||0);a.focus()}
function NISsave(a,b,c){if(a.ifware.CurrentDirtyLine!==null){NIScleanDirtyLine(a);NISupdateAnnotations(a,{SendCode:true})}Ajax.post("/ann/save_program",{translator_guid:a.ifware.ChannelGuid,EditorGuid:a.ifware.EditorGuid},function(e){if(e.ErrorMessage&&e.ErrorType=="Save"){NISshowSaveErrorDialog(e);a.ifware.AnnotationsStatusContainer.innerHTML="Save error"}else if(e.ErrorMessage)a.ifware.AnnotationsStatusContainer.innerHTML=e.ErrorMessage;else b&&b(a,c)},"json")}
function NIScleanDirtyLine(a){NISmarkLineAsClean(a);a.ifware.CurrentDirtyLine=null}function NISisWhitespace(a){return a.match(/^\s*$/)!=null}function NISshouldMarkCursorLineAsDirty(a,b,c){if(!NISisWhitespace(a.getLine(c))&&b.text.length==1)if(b.to.line==c&&b.from.line==c)return true;else if(b.text[0]!=""&&c>=b.from.line&&c<=b.to.line)return true;return false}
function NISdefaultOnChange(a,b){a.ifware.CurrentDirtyLine!==null&&NIScleanDirtyLine(a);$(".error-box").hasClass("moved")||NISclearErrorBox();if(!a.ifware.ChangingFile){var c=a.getCursor().line;if(NISshouldMarkCursorLineAsDirty(a,b,c))NISmarkLineAsDirty(a,c);else{NISretrieveCodeBlockData(a);NISretrieveMergeConflictData(a);NISscheduleAnnotationsUpdate(a,{SendCode:true})}}}var NISonBodyKeyDown,NIS_IS_MAC=navigator.appVersion.indexOf("Mac")!=-1;
NISonBodyKeyDown=function(a,b){if((window.event?event.keyCode:a.keyCode)==70&&(!NIS_IS_MAC&&a.ctrlKey||NIS_IS_MAC&&a.metaKey&&!a.ctrlKey)){a.preventDefault();b.ifware.SearchBox.focus();a.preventDefault()}};function NISdefaultOnCursorMove(a){var b=a.getCursor().line;if(a.ifware.CurrentDirtyLine!==null&&b!==a.ifware.CurrentDirtyLine){NIScleanDirtyLine(a);NISscheduleAnnotationsUpdate(a,{SendCode:true})}$("#EDTeditor > .CodeMirror-focused").size()&&NISmarkCurrentLine(a,b)}
function NISonEditorFocus(a){NISmarkCurrentLine(a);a.ifware.focusLastFocussedElement=function(){}}function NISmarkCurrentLine(a,b){if(!b){a.ifware.CurrentLine=undefined;b=a.getCursor().line}if(a.ifware.CurrentLine!==b){var c=NISgetEditorScollArea().find("div.ANNblock pre");c.filter(".ANNhighlight").removeClass("ANNhighlight");c.filter(".ANNline_"+(b+1)+":last").addClass("ANNhighlight");a.ifware.CurrentLine=b}}
function NISunmarkCurrentLine(){NISgetEditorScollArea().find("div.ANNblock pre.ANNhighlight").removeClass("ANNhighlight")}function NISannotateCode(a,b){if(typeof a.ifware==="undefined")a.ifware={};a.ifware.BlockInfo={};DCKdockController.init(a);POPdialogsController.init(a);NISupdateAnnotations(a,b)}
function NISupdateEmptyTreenodeDisplayStyle(a){a=a.ifware.projectSettings.showEmptyNodes()?"":"none";for(var b=document,c=0;c<b.styleSheets.length;c++){var e=b.styleSheets[c];if(e.href&&e.href.indexOf("node_treeview.css")!=-1){(e.cssRules?e.cssRules:e.rules)[0].style.display=a;break}}}
function NISupdateSampleDataControl(a,b){b||(b=$("#sample_data_control"));var c=a.ifware.sampleIndex(),e=a.ifware.countOfSample(),d=a.ifware.UsesParameter,f=a.ifware.UsesHttpsParameter;Params.TotalSd=e;Params.Index=c;Params.UsesParameter=d;Params.UsesHttpsParameter=f;Params.NewMsg=0;if(e===0)sample.toolbar.build(b,a,Params,c,e,d,f);else{Params.Chunk=Math.floor((c-1)/50).toString();Params.MPRapp=MPRapp.type;Params.Page="SampleData";Params.Page="OpenEditor";sample.toolbar.build(b,a,Params,Params.Index,
Params.TotalSd,Params.UsesParameter,Params.UsesHttpsParameter);Params.Page="OpenEditor"}}function NIScloseSampleDataMiniBrowser(a,b){b.remove();a.ifware.focusLastFocussedElement()}function NISminUrlParams(a,b){var c=["ChannelGuid","ChannelName","ComponentType","ComponentName","User"],e={};e.Page=b;for(var d=0;d<c.length;d++)e[c[d]]=a[c[d]];if(a.Module)e.Module=a.Module;return e}
function NISqueryString(a){var b=[],c;for(c in a)a.hasOwnProperty(c)&&b.push(encodeURIComponent(c)+"="+encodeURIComponent(a[c]));return"#"+b.join("&")}
function NIScreateToolbar(a,b){var c=String(BrowserDetect.version),e=false;if("Explorer"==BrowserDetect.browser&&null!=c.match(/^8/))e=true;c='<div class="section"><span id="sample_data_control"></span></div>';c+='<div class="section" id="sourceControlSection">'+BTNtoolbar("","Commit to Source Control",{},"disabled","commit","Commit to source control")+BTNtoolbar("","View Commit History",{},"off","revisions","View commit history")+'</div><div class="section" id="scriptExecutionSection" />          <div class="section" id="viewOptionsSection" />          <div id="SRHbox" />';
NISupdateEmptyTreenodeDisplayStyle(a);c=$(document.createElement("form")).html(c).find("#sample_data_control").each(function(){NISupdateSampleDataControl(a,$(this))}).end().find("a#revisions").click(function(d){d.preventDefault();NISsave(a,SCMcallReview,NISminUrlParams(b,"ReviewCommits"))}).end().find("a#emptynodes").click(function(){NISupdateEmptyTreenodeDisplayStyle(a)}).end().find("#SRHbox").each(function(){a.ifware.SearchBox=new SRHsearchField(a,$(this))}).end().find("#autocompletion, #annotations, #emptynodes, #project_pane_toggle, #thumbnail_toggle, #script_stopper").click(function(){a.ifware.focusLastFocussedElement()}).end();
ifware.toolbar.sections.scriptExecutionSection(c.find("#scriptExecutionSection"),a);ifware.toolbar.sections.viewOptionsSection(c.find("#viewOptionsSection"),a);e||c.find("a#thumbnail_toggle").click(function(d){d.preventDefault();EDTtoggleThumbnail(a)});return c[0]}
function NIScreateStatusBar(a,b){b.html('<div class="an_sb">Auto-Completion: <span id="intellisense_status"></span></div><div class="an_sb an_sb_right">Annotations: <span id="annotations_status"></span></div>').find("#intellisense_status").each(function(){a.ifware.IntellisenseStatusContainer=this}).end().find("#annotations_status").each(function(){a.ifware.AnnotationsStatusContainer=this}).end()};function NISclearAnnotationBlockData(a){for(var b={},c=a.ifware.BlockDataSet.length,e=0,d=0;d<c;++d){var f=a.ifware.BlockDataSet[d];if("annotation"!=a.ifware.BlockDataSet[d].type){b[e]=f;++e}}a.ifware.BlockDataSet=b;a.ifware.BlockDataSet.length=e}
function NISretrieveAnnotationBlockData(a,b){NISclearAnnotationBlockData(a);for(var c=b.length,e=a.ifware.BlockDataSet.length,d=0;d<c;++e,++d){var f=b[d],h={};h.t=f.t;h.c=f.c;h.w=f.w;h.s=f.scope.s;h.e=f.scope.e;h.type="annotation";a.ifware.BlockDataSet[e]=h;++a.ifware.BlockDataSet.length}a.ifware.AnnotationBlockDataSet=b}
var NISprocessAnnotation2=function(){var a=!ifware.storage.get("DisableNoSampleDataWarning");return function(b,c,e,d,f){d.ifware.AnnotationsStatusContainer.innerHTML="";if(b.ErrorMessage&&b.ErrorType=="Save"){NISshowSaveErrorDialog(b);d.ifware.AnnotationsStatusContainer.innerHTML="Save error";ifware.ProjectManager.freshen()}else if(b.ErrorMessage){d.ifware.AnnotationsStatusContainer.innerHTML=b.ErrorMessage;ifware.ProjectManager.freshen()}else if(b.FileModified){NISshowFileModifiedDialog(b,d);b.has_affected_files&&
NISshowFilesAffectedFromNewChangesetsDialog(b)}else{b.has_affected_files&&NISshowFilesAffectedFromNewChangesetsDialog(b);d.ifware.AnnotationsStatusContainer.innerHTML=b.BlockData?'<span class="ok">Got data</span>':"Disabled";if(!(d.getValue()||"").match(/^\s*$/))if(a&&d.ifware.countOfSample()==0){a=false;$('<div>               Annotations will use an empty string until you add some sample data.<br><br>               <label><input type="checkbox" id="disable-no-sample-data-warning">Don\'t remind me again.</label>            </div>').appendTo("body").dialog({title:"Warning: No Sample Data",
buttons:{Close:function(){$(this).dialog("close")}},close:function(){$("#disable-no-sample-data-warning").get(0).checked&&ifware.storage.set("DisableNoSampleDataWarning","true",365);d.focus()}})}else f&&d.focus();NISretrieveCodeBlockData(d);NISretrieveMergeConflictData(d);if(b.BlockData){NISrefreshBlockInfo2(d,b.BlockData);NISretrieveAnnotationBlockData(d,b.BlockData);NISmarkCurrentLine(d)}ETHscrollerControl.setStylizer(function(h){return NISretrieveBlockStyle(h)});ETHscrollerControl.setMaxLineLengthCalculator(function(h,
j){return NISmaxLineOfCodeLength(h,j)});ETHscrollerControl.setOptimalBlockWidthCalculator(function(h,j,p,n){return NISoptimalBlockWidth(h,j,p,n)});ETHscrollerControl.show(d);if(b.ScriptError&&!$("#importProjectAndData:visible").size()){if(!b.ScriptError.Description.length)b.ScriptError.Description=" ";NISdisplayScriptError(d,b.ScriptError)}if(d.ifware.scrollToLine){d.ifware.scrollToLine();d.ifware.scrollToLine=undefined}ifware.ProjectManager.freshen();d.ifware.SearchBox.updateSearchMatches();DCKdockController.refresh(b.FullArgumentResponses,
b.ScriptError);POPdialogsController.refresh(b.FullArgumentResponses,b.ScriptError)}}}();
function NISrefreshBlockInfo2(a,b){var c=a.ifware.CharWidth=NIScharWidth(a),e={},d;Blocks=a.ifware.BlockInfo;if(NISeditorIsEmpty(a)||!b)NISclearAnnotations(a);else{for(d=0;d<b.length;d++)e[b[d].scope.s]=d;for(d in Blocks)if(typeof e[d]=="undefined"){delete Blocks[d];$("#EDTeditor .CodeMirror #n"+d).remove()}var f=NISgetLineLeft(),h=NISgetEditorScollArea();for(d in e){if(typeof Blocks[d]=="undefined")Blocks[d]={count:b[e[d]].scope.l};else{$("#EDTeditor .CodeMirror #n"+d).remove();Blocks[d].count=b[e[d]].scope.l}NIScreateBlock(a,
c,f,b[e[d]],h)}NISeditor&&NISeditor.display.scrollbars.update()}}function NISsetButtonVisibility(a,b){Images=a.find("img");Images.each(function(){var c=$(this).attr("src"),e=c.indexOf("/")>=0?c.lastIndexOf("/"):0,d=b?"dis":"ena";if(c.substr(d.length,3)!=d){c=c.substr(0,e+1)+d+c.slice(e+d.length+1,c.length);$(this).attr("src",c)}})}function NISsetAllButtonVisibility(a,b){NISsetButtonVisibility(a.find("span.ncback"),b.p==1);NISsetButtonVisibility(a.find("span.ncforw"),b.p==b.l)}
function NIScontrolBlock2(a){return"<div class='annav'><span class='nv ncback'><img class='bb' src='/js/mapper/images/ena_l_stop_arrow.png'/><img class='b' src='/js/mapper/images/ena_l_arrow.png'/></span><span class='inner'><span style='white-space: pre' class='position'>"+a.p+"</span> of "+a.l+"</span><span class='nv ncforw'><img class='f' src='/js/mapper/images/ena_r_arrow.png'/><img class='ff' src='/js/mapper/images/ena_r_stop_arrow.png'/></span></span></div>"}
function NIShideNavControl(a){a=$(a).find(".annav:first");a.removeClass("hover");a=a.find(".nv");$.support.opacity?a.stop(true,true).fadeTo("fast",0):a.css("visibility","hidden")}function NISshowNavControl(a){a=$(a).find(".annav:first");a.addClass("hover");a=a.find(".nv");$.support.opacity?a.stop(true,true).fadeTo("fast",1):a.css("visibility","")}
function NISshowPopupOrDockTab(a,b,c,e){c=true;if(DCKdockController.tabExists(b)){c=false;DCKdockController.selectTab(b,true)}else if(POPdialogsController.dialogExists(b))POPdialogsController.bringToFrontAndHighlightDialog(b);else{if(COOKIEread("isdockable")!="true")POPdialogsController.dialog(b);else{c=false;DCKdockController.tab(b);DCKdockController.selectTab(b)}if(!e)if(a.ifware.projectSettings.disableAutoScriptExecution()){var d=null;ITMgetItems($("body")).each(function(){var f=$(this);if(f.data("Id")===
b){d=f;return false}});if(d!==null)c?POPdialogsController.setAnnotationToDefaultForAutoScriptExecutionDisabled(d):DCKdockController.setAnnotationToDefaultForAutoScriptExecutionDisabled(d)}else NISupdateAnnotations(a)}if(e){c?POPdialogsController.setHelpContent(b,e):DCKdockController.setHelpContent(b,e);prettyPrint()}a.ifware.focusLastFocussedElement()}function NISlongStringOnClick(a,b){NISshowPopupOrDockTab(a,b.id,b)}
function NIStreeviewOnClick(a,b,c){a.preventDefault();NISshowPopupOrDockTab(b,c.id,c)}function NISchangeFunctionIteration(a,b,c,e){var d=a.ifware.AnnotationBlockDataSet;a=null;for(var f=0;f<d.length;f++)if(d[f].scope.s==b){a=d[f];break}if(a&&a.scope&&a.scope.p!=c){c=Math.min(a.scope.l,c);b=$("#n"+b);NISchangeCurrentIteration(b,a.scope,c,e)}}
function NISjumpToFunctionCall(a,b,c,e,d,f){if(b===a.ifware.CurrentFileName){NISscrollToLine(a,d);NISsetEditorScrollLeft(0);NIShighlightLine(a,d);NISchangeFunctionIteration(a,c,e,f)}else if(b){a.ifware.scrollToLine=function(){NISscrollToLine(a,d);NISsetEditorScrollLeft(0);NIShighlightLine(a,d)};a.ifware.RequestFunctionBlock=c+":"+e;if(f)a.ifware.RequestFunctionBlock+=":"+f;NISgoToFile(b)}else PAGwarning("Source not available for this function.")}
function NISonFunctionCallClick(a,b,c){a.preventDefault();a=$(c).find("div").text().split(":");c=a[0];var e=parseInt(a[1]),d=parseInt(a[2]),f=parseInt(a[3])-1;NISjumpToFunctionCall(b,c,e,d,f,a.length>4?a[4]:undefined)}function NISonFunctionCallEnter(a,b){var c,e=$(b);c=e.hasClass("fcin")?'<img src="/js/mapper/images/step_in.png" />':'<img src="/js/mapper/images/step_out.png" />';var d=e.position();$(c).appendTo(e).css("top",d.top+"px").css("left",d.left-18+"px").css("border","none").show()}
function NISonFunctionCallLeave(a,b){$(b).find("img").stop(true,true).remove()}function NISupdateAnnBlock(a,b,c){if(a.ErrorMessage)b.find("span.content").html(a.ErrorMessage);else{NISpopulateBlock(a,b,c,true);b=c.ifware.AnnotationBlockDataSet;for(c=0;c<b.length;c++)if(b[c].scope.s==a.scope.s){b[c]=a;break}}}function NISchangeCurrentIteration(a,b,c,e){if(!(c==b.p&&!e)){b.c=[];b.p=c;a.closest("div.ANNblock").trigger("scopeiterationchange",{TargetCallee:e,Container:a,Scope:b})}}
function NISattachNavClick(a,b,c){b.find("span.inner").click(function(){NISinsertGotoIframe2($(this),b,c,a)}).end().find("img.bb").click(function(){NISchangeCurrentIteration(a,c,1)}).end().find("img.b").click(function(){NISchangeCurrentIteration(a,c,Math.max(1,c.p-1))}).end().find("img.f").click(function(){NISchangeCurrentIteration(a,c,Math.min(c.l,c.p+1))}).end().find("img.ff").click(function(){NISchangeCurrentIteration(a,c,c.l)}).end()}
function NIScreateBlock(a,b,c,e,d){var f=$("<div></div>");f.attr("id","n"+e.scope.s);f.addClass("ANNblock");f.css("position","absolute");var h=NISgetLineTop(a,e.scope.s-1);f.css("top",h+"px");f.css("left",b*(e.c+2)+c+"px");f.find(".topRightHoverMenu").css("visibility","hidden");f.hover(function(){f.find(".topRightHoverMenu").css("visibility","visible")},function(){f.find(".topRightHoverMenu").css("visibility","hidden")});f.find("a").click(function(j){j.preventDefault();NISclearAnnotations(a)}).hover(function(){$(this).addClass("ui-state-hover")},
function(){$(this).removeClass("ui-state-hover")});d.append(f);NISpopulateBlock(e,f,a);f.innerWidth()<102&&f.css("width","102px");f.mousedown(function(j){j.stopPropagation()})}
function NISpopulateBlock(a,b,c,e){if(a.scope.l>1){b.css("width","");var d='<span class="content">'+a.scope.d+"</span>"+NIScontrolBlock2(a.scope);b.html(d).children().andSelf().hover(function(){NISshowNavControl(this)},function(){NIShideNavControl(this)});NISsetAllButtonVisibility(b.find("div.annav"),a.scope);if(!e){e=b.find(".nv");$.support.opacity?e.fadeTo(0,0):e.css("visibility","hidden")}NISattachNavClick(b,b.find("div.annav"),a.scope)}else{b.children().not(".topRightHoverMenu").remove();b.append(a.scope.d)}b.unbind("scopeiterationchange").bind("scopeiterationchange",
{Container:b,Scope:a.scope,Editor:c},NISonScopeIterationChange);e=NIScreateLoopBlocks(b,a.scope,NIScharHeight(),c)+30;b.innerWidth()<e&&b.width(e);b.find("span.pv").click(function(){NISlongStringOnClick(c,this)});b.find("a.ntv").click(function(f){NIStreeviewOnClick(f,c,this);return false});b.find("a.fc, a.fr").mouseenter(function(){NISonFunctionCallEnter(c,this)}).mouseleave(function(){NISonFunctionCallLeave(c,this)}).click(function(f){NISonFunctionCallClick(f,c,this)});a.w=b.outerWidth()}
function NISbuildIterationTree(a){for(var b={i:a.p,c:[]},c=a.c.length,e=0;e<c;e++)b.c[e]=NISbuildIterationTree(a.c[e]);return b}
function NISonScopeIterationChange(a,b){var c=b.TargetCallee,e=a.data.Container,d=a.data.Scope,f=a.data.Editor,h={};h.translator_guid=f.ifware.ChannelGuid;h.FunctionLine=d.s;if(c)h.TargetCallAndCallee=d.p+":"+c;else{c=JSON&&JSON.stringify?JSON.stringify:$.toJSON;d=NISbuildIterationTree(d);h.IterationTree=c(d)}if(f.ifware.projectSettings.disableAutoScriptExecution()){d=b.Scope;c=b.Container;var j=c.find(".content");if(j.length>0){j.html('<pre>To display results <button class="iterationChange">Execute Script Now</button></pre>');
c.find(".ANNloopBlock").remove()}else{c.children().not(c.find(".annav:first").parent()).remove();c.append('<pre>To display results <button class="iterationChange">Execute Script Now</button></pre>')}c=c.find(".annav:first");c.find("span.position").html(d.p);NISsetAllButtonVisibility(c,d);$(".iterationChange").click(function(){ScriptRunner().post("/ann/block",h,function(p){NISupdateAnnBlock(p,e,f)},function(){NISupdateAnnBlock({ErrorMessage:"Script cancelled."},e,f)})})}else ScriptRunner().post("/ann/block",
h,function(p){NISupdateAnnBlock(p,e,f)},function(){NISupdateAnnBlock({ErrorMessage:"Script cancelled."},e,f)})}function NIScreateLoopBlocks(a,b,c,e){for(var d=b.c.length,f=0,h=0;h<d;h++){var j=NIScreateLoopBlock(a,b.c[h],b.s,c,e);if(j>f)f=j}return f}
function NIScreateLoopBlock(a,b,c,e,d){if(b.l!=0){a=$('<div class="ANNloopBlock" />').appendTo(a);a.css("top",(b.s-c)*e+"px");a.html(b.d);c=$(NIScontrolBlock2(b)).prependTo(a.find("pre:first"));NISsetAllButtonVisibility(c,b);NISattachNavClick(a,c,b);c.outerWidth();c=c.find(".nv");$.support.opacity?c.fadeTo(0,0):c.css("visibility","hidden");a.hover(function(){NISshowNavControl(this)},function(){NIShideNavControl(this)});b=NIScreateLoopBlocks(a,b,e,d)+30;a.innerWidth()<b&&a.width(b);return a.outerWidth()}}
function NISlineLength(a,b){return a.getLine(b).length}function NISmarkAnnotationAsStale(a,b){for(var c=a.ifware.Editor=NIScharWidth(a),e=b+1,d=0;d<a.ifware.AnnotationBlockDataSet.length;d++){var f=a.ifware.AnnotationBlockDataSet[d];if(e>=f.scope.s&&e<=f.scope.e){var h=a.getLine(b);h=c*(Math.max(f.c,h.length)+2)+NISgetLineLeft();$("#n"+f.scope.s).css("left",h+"px").fadeTo(125,0.6)}else if(f.scope.s>e)break}}
function NISmarkAllAnnotationsAsStale(){$("div.ANNblock").each(function(a,b){$(b).fadeTo(125,0.6)})}function NISerrorText(a){return a.FileName!=""?"Error in "+a.FileName+" on line "+a.LineNumber:"Error  on line "+a.LineNumber}function NISjumpToStackFrame(a,b){NISjumpToFunctionCall(a,b.f,b.s,b.c,b.l-1,b.t)}
function NISdisplayErrorStackTrace(a){$("#error_stack_container").size()||("true"==COOKIEread("isdockable")?DCKdockController.errorStackTab(a,true):POPdialogsController.errorStackDialog(a,true))}function NISfindErrorStackFrame(a){var b=a.CallStack;if(b)for(var c=b.length-1;c>=0;c--){var e=b[c];if(e.f==a.FileName&&e.l==a.LineNumber)return e}return null}
function NISdisplayScriptError(a,b){function c(){var n=NISfindErrorStackFrame(b);n?NISjumpToStackFrame(a,n):NISscrollToLine(a,d);NISshowErrorBox(a,d,b);ETHscrollerControl.showError(a,b,p)}var e=a.ifware.CharWidth=NIScharWidth(a);if(!b.LineNumber)b.LineNumber=1;var d=b.LineNumber-1,f=$(a.ifware.AnnotationsStatusContainer),h='<a href="" class="el">'+NISerrorText(b)+"</a>";if(b.CallStack)h+='<a href="" class="ANNest_link">[Show Stack Trace]</a>';f.html(h).find("a.el").click(function(n){n.preventDefault();
if(j)c();else{a.ifware.scrollToLine=c;NISgoToFile(b.FileName)}}).end().find("a.ANNest_link").click(function(n){n.preventDefault();NISdisplayErrorStackTrace(b)});var j=a.ifware.CurrentFileName===b.FileName&&b.FileName!=="";if(j){(f=NISfindErrorStackFrame(b))&&NISchangeFunctionIteration(a,f.s,f.c,f.t);a.addLineClass(d,"background","error-highlight-row");a.ifware.ErrorLine=d;NISshowErrorBox(a,d,b);f=NISgetLineLeft();var p=a.getLine(d).length;h={};h.Description=NIStruncateErrorMessage(a,b.Description,
e*(p+2)+f);h.LineNumber=b.LineNumber;ETHscrollerControl.showError(a,h,p)}}
function NIStruncateErrorMessage(a,b,c){a=a.ifware.CharWidth=NIScharWidth(a);c=(NISeditorInnerWidth()+NISgetEditorScrollLeft()-c-70)/a;a="";for(var e=true,d=0;d<3&&e;d++){var f=b.search(/[\r\n]/),h=f;if(h==-1){h=b.length;e=false}var j=Math.max(48,c);a+=h>j?PAGhtmlEscape(b.substring(0,j))+"&hellip;":PAGhtmlEscape(b.substring(0,h));if(e){if(h>0)a+="\n";else d--;f=b.substring(f,f+2)=="\r\n"?f+2:f+1;b=b.substring(f)}}if(e)a+="&hellip;";return a}
function NISshowErrorBox(a,b,c){var e=a.ifware.CharWidth=NIScharWidth(a);if(!$("div.error-box").size()){var d=NISgetLineTop(a,b)-4,f=NISgetLineLeft(),h=NISlineLength(a,b);b=e*(h+2)+f;var j=$('<div class="error-box collapsed"><div class="error-toolbar"><span>ERROR (<a href="" title="Dismiss this error. Note that you need not explicitly dismiss each error; you may simply continue typing.">Dismiss</a>)</span><div class="error-buttons">'+(c.CallStack?'<img class="error-stack" src="/js/mapper/images/call_stack_button.gif" title="Show Stack Trace" />':
"")+'<img class="error-expand" src="/js/mapper/images/maximize_button_red.gif" title="Expand" /><img class="error-collapse" src="/js/mapper/images/minimize_button_red.gif" title="Collapse" /><img class="error-close" src="/js/mapper/images/close_button_red.gif" title="Close" /></div></div><div class="error-message"></div></div>');j.css("top",d+"px").css("left",b+"px");var p=NIStruncateErrorMessage(a,c.Description,b);j.attr("title","Expand/move this Message");j.find("img.error-stack").click(function(){NISdisplayErrorStackTrace(c)}).mousedown(function(n){n.stopPropagation()});
j.find("img.error-collapse").click(function(){j.removeClass("expanded");j.addClass("collapsed");j.attr("title","Expand/move this Message");j.find(".error-message").html(p);ETHscrollerControl.showError(a,c,h)});j.find("img.error-close, a").click(function(n){n.preventDefault();$(j).fadeOut("fast",function(){NISclearErrorBox()});ETHscrollerControl.clearError()}).mousedown(function(n){n.stopPropagation()});j.find("div.error-message").html(p).mousedown(function(n){j.hasClass("expanded")&&n.stopPropagation()});
NISgetEditorScollArea().append(j);j.draggable({stop:function(){j.addClass("moved");ETHscrollerControl.clearError();var n={};n.Description=c.Description;var t=$("#EDTeditor .CodeMirror-lines");t=t.children("div").offset().top-t.offset().top;n.LineNumber=Math.ceil(($(this).position().top-t)/NIScharHeight()+1);t=Math.ceil($(this).position().left/e-7);ETHscrollerControl.showError(a,n,t)}}).mousedown(function(n){n.stopPropagation();n.preventDefault();if(j.hasClass("collapsed")){j.removeClass("collapsed");
j.addClass("expanded");j.removeAttr("title");j.find(".error-message").hide().text(c.Description).fadeIn("fast");ETHscrollerControl.showError(a,c,h)}})}}
function NISinsertGotoIframe2(a,b,c){b=a.find(".position").get(0).innerHTML;var e=a.parent().width()+8,d="iframe"+c.s,f,h=$("#"+c.s).find("iframe"),j;if(j=h.length===0?NIScreateIframe(d,e,a.get(0).parentNode):h.get(0)){if(j.contentDocument)f=j.contentDocument;else if(j.contentWindow)f=j.contentWindow.document;else if(window.frames[j.name])f=window.frames[j.name].document;if(f){f.open();f.write('<html><body style="overflow: hidden; border: 1px solid #cccccc; -moz-border-radius:0 0 5px 5px; -webkit-border-radius:0 0 5px 5px; background: transparent url(/js/mapper/images/toolbar/bg_button_span.gif) no-repeat -5px -1px; font: normal 9px Lucida Sans, sans-serif; margin: 0px; padding: 0px;"><span style="padding: 0px 3px 0px 6px;">Go to </span><input id="input_field" style="width:20px; font-size: 9px; padding:1px 0px 0px 0px; margin:1px 5px 0px 0px; border:1px solid #CCCCCC;" type="text" value="'+
b+'" /><img src="/js/mapper/images/ok.png" style="position:absolute; cursor:pointer;"/></body></html>');f.close()}var p=$(f).find("#input_field");$(j).show();p.focus();p.select();var n=function(){var w=parseInt(p.get(0).value,10);if(!isNaN(w)){if(w<0)w=1;if(w>c.l)w=c.l;NISchangeCurrentIteration(a.closest("div.ANNblock"),c,w)}setTimeout(function(){$(j).remove()},100)},t=function(){setTimeout(function(){$(j).remove()},100)};p.blur(n);p.keydown(function(w){if(w.keyCode=="13")n();else w.keyCode=="27"&&
t()})}};function BTRview(a){if(!a.Chunk&&!a.Index)a.Chunk=0;Ajax.post("/bulk_testing_results",a,function(b){BTRrenderResultsView(b,a)},"json")}function BTRresultRow(a,b,c){c.Id=a.Id;c.TotalSd=b;return'<tr><td class="BTRsd">'+PAGlink("EditSampleData",c,a.Index+1)+'<td class="BTRreason"><div>'+(a.ErrorMessage?'<span class="BTRerrorMessage">'+a.ErrorMessage+"</span>":"Main function returned false.")+"<td>"+PAGlink("OpenEditor",MAPretrieveParams("lua_editor",c),"View in Script...")}
function BTRbutton(a,b,c,e){return e?PAGlink(a,c,b):'<a class="BTRdisabled">'+b+"</a>"}
function BTRrenderResultsView(a,b){function c(){w.fadeTo("fast",0.5);w.append('<div class="BTRnavPaneBlocker"><img src="/js/mapper/images/spinner_wide.gif" /></div>');w.find("div.BTRnavPaneBlocker img").fadeIn("slow")}if(a.ErrorMessage)MPRapp.renderError(a.ErrorMessage,b);else{var e=a.ChannelGuid,d=MAPretrieveHeaderHTML("bulk_tests",b),f=a.Chunk,h=a.CountOfChunk-1,j=a.CountOfResult+" Failures";if(a.CountOfResult)j=a.ChunkBegin+1+" to "+(a.ChunkEnd+1)+" of "+j;d+='<div class="content_main">';b.Chunk=
0;var p=BTRbutton("BulkTestResults","&lt;&lt;",b,f>0);b.Chunk=Math.max(0,f-1);var n=BTRbutton("BulkTestResults","&lt;",b,f>0);b.Chunk=Math.min(h,f+1);var t=BTRbutton("BulkTestResults","&gt;",b,f<h);b.Chunk=h;f=BTRbutton("BulkTestResults","&gt;&gt;",b,f<h);delete b.Chunk;d+='<div class="BTRnavPane">';d+=BTNwrapper(p+n+'<span class="SPDnavText">'+j+"</span>"+t+f)+"</div>";d+='<div class="BTRdataTable"><table id="bulk_test_results_table" class="BTRdataTable"><tr><th>Sample Data<th class="BTRreason">Reason<th>Script';
j=a.Results.length;p=a.ScriptName;for(n=0;n<j;n++)d+=BTRresultRow(a.Results[n],a.TotalSd,b,p);d+="</table></div></div>";$("body").html(d);var w=$("div.BTRnavPane");w.find("a").click(function(){this.href!=""&&c()});a.CountOfResult&&w.find("span.BTRnavText").click(function(){var s=$("div.BTRgoto");if(s.size())s.remove();else{s=$('<div class="BTRgoto">Go to <input type="text" class="BTRgotoInput" /><img src="/js/mapper/images/ok.png" /></div>');$("body").append(s);var r=w.offset();s.css("left",r.left+
(w.outerWidth()-s.outerWidth())/2);s.css("top",r.top+w.outerHeight());var y=s.find("input");y.val(a.ChunkBegin+1);y.focus();y.select();var C=function(){var B=parseInt(y.val());if(isNaN(B)||NewSd<1)B=1;else if(B>a.CountOfMessage)B=a.CountOfMessage;B--;if(a.Index!=B){window.location=PAGhref("BulkTestResult",{ChannelGuid:e,Index:B});c()}s.remove()};y.keydown(function(B){if(B.keyCode=="13")C(B);else B.keyCode=="27"&&s.remove()});s.find("img").click(C)}})}};function BTNbutton(a,b,c){return PAGlink(a,c,b)}function BTNtoolbar(a,b,c,e,d,f){return"<a href='"+(""!=a?PAGhref(a,c):"")+"' id="+d+" class='button_icon enabled "+e+"' title='"+f+"'><span>"+b+"</span></a>"}function BTNtoolbarDisabled(a,b){return"<div class='disabled' id='"+a+"' title='"+b+"'></div>"}function BTNtoolbarWithJavascript(a,b,c,e,d){return"<a href='"+a+"' id="+e+" class='button_icon enabled "+c+"' title='"+d+"'><span>"+b+"</span></a>"}
function BTNbuttonWithJavascript(a,b){return"<a href='"+a+"'>"+PAGescapeQuotes(b)+"</a>"}function BTNbuttonMinus(a,b,c){return"<a class='BTNnegative' href='"+PAGhref(a,c)+"'>"+PAGescapeQuotes(b)+"</a>"}function BTNbuttonMinusWithJavascript(a,b){return"<a class='BTNnegative' href='"+a+"'>"+PAGescapeQuotes(b)+"</a>"}function BTNbuttonPlus(a,b,c){return"<a class='BTNpositive' href='"+PAGhref(a,c)+"'>"+PAGescapeQuotes(b)+"</a>"}
function BTNbuttonPlusWithJavascript(a,b){return"<a class='BTNpositive' href='"+a+"'>"+PAGescapeQuotes(b)+"</a>"}function BTNwrapper(a){return"<div class='BTNbuttons'>"+a+"</div>"};function DCKdock(){function a(){var m={};return m="popup"==COOKIEread(Q)?$("div#popup_dock"):$("div#bottom_dock")}function b(m){return a().find("div.dock_tabs li."+m)}function c(){ITMgetItemsFromCookie(U).each(function(){var m=$(this);d(m);var v=m.data("Id");if(ITM_HELP_ID==v){var o=ITMretrieveMostRecentHelp(F);h(m,b(v),o)}p(v)&&DCKdockController.selectTab(v);ifware.Editor.ifware.projectSettings.disableAutoScriptExecution()&&DCKdockController.setAnnotationToDefaultForAutoScriptExecutionDisabled(m)});
DCKdockController.updateTabScrollButtons()}function e(m,v){setTimeout(function(){B(m,v)},0)}function d(m){var v=m.data("Id"),o=a(),g=V;if(o.is(":visible")){var l=o.find("ul.dock_tabs li:last");if(l.length){for(;!l.is(":visible");)DCKdockController.scrollForward();g=l.position().left+l.get(0).clientWidth+V}}else G();l=$("<li class='"+v+" waiting'></li>").appendTo(o.find("ul.dock_tabs"));l.addClass("visible");l.css("left",g+"px");l.css("top",S+"px");l.append("<div class='tab_content'><div><a href='' class='dock_tab_label ntv'>&nbsp;</a><a href='' id='dock_tab_close' class='dock_tab_button'><img src='/js/mapper/images/icon-close-small.png' title='Close Tab' /></a><a href='' id='dock_tab_popup' class='dock_tab_button'><img src='/js/mapper/images/popup.png' title='Pop Out' /></a></div></div>");
l.find("a#dock_tab_close").click(function(){C(v);F.ifware.focusLastFocussedElement();return false});l.find("a.dock_tab_label").html("Refreshing&hellip;");l.find("a#dock_tab_popup").unbind().click(function(){var q=m.data("Id");POPdialogsController.dialogFromExisting(m);y(q);COOKIEcreate(L,"false",ITM_COOKIE_EXPIRY);F.ifware.focusLastFocussedElement();return false});if(l.position().left+l.get(0).clientWidth>o.find("div.dock_toolbar").get(0).clientWidth-("popup"==COOKIEread(Q)?50:90)){l.removeClass("visible").addClass("hidden").hide();
DCKdockController.scrollForward()}l.click(function(){$(this).hasClass("selected")||DCKdockController.selectTab(v);return false});o=$("<div class='"+v+" link_detail hidden'></div>").appendTo(o.find("div.dock_content"));o.append(m);o.bind(ITM_VIEW_MODE_CHANGE_EVENT,function(q,x){ITMupdateCookie(U,x)});return o}function f(m,v,o,g){g.removeClass("waiting");var l=g.find("a.dock_tab_label");l.removeClass("error");var q=l.attr("class");q&&l.attr("class",q.replace(/( ?)nt_\d+_\d+/,""));l.attr("style","").addClass(v).html(m.replace(/\s/g,
"&nbsp;"));g.attr("title",o)}function h(m,v,o){var g=ITM_HELP_TITLE,l=ITMsetLabelInfo(m,g,undefined,undefined,"help");f(g,l,"",v);ITMrenderStaticView(m,o);ITMstoreMostRecentHelp(F,o)}function j(m,v){ITMsetLabelInfo(v,ITM_ERROR_STACK_TITLE,undefined,undefined,"error_stack");var o=b(ITM_ERROR_STACK_ID);f(ITM_ERROR_STACK_TITLE,"error_stack","",o);ITMpopulateErrorStackTrace(F,m,v)}function p(m){var v=COOKIEread(P);return!v||v==m}function n(){var m=a().find("ul.dock_tabs li.selected");if(0!=m.length)for(var v=
0>m.position().left?DCKdockController.scrollBackward:DCKdockController.scrollForward;m.hasClass("hidden");)v()}function t(m){for(var v=a(),o=v.find("ul.dock_tabs li:visible").filter(":first").get(0).clientWidth;m.length;){m.css("left",m.position().left+o+V);m=m.prev()}v.find("ul.dock_tabs li.visible").filter(":first").prev().removeClass("hidden").addClass("visible")}function w(m){for(var v=a(),o=v.find("ul.dock_tabs li:visible").filter(":first").get(0).clientWidth;m.length;){m.css("left",m.position().left-
o-V);m=m.next()}m=v.find("ul.dock_tabs li.visible").filter(":last").position().left;v.find("ul.dock_tabs li.visible").filter(":last").next().removeClass("hidden").addClass("visible").show().css("left",m+o+V)}function s(){var m=$("div#bottom_dock:first");m.find("ul.dock_tabs li").remove();m.find("div.link_detail").remove();m.hide();$("div#EDTeditor:first").css("bottom","32px");ETHscrollerControl.resize(F);EDTonResize();F.refresh()}function r(){var m=$("div#popup_dock:first");m.find("ul.dock_tabs li").remove();
m.find("div.link_detail").remove();m.dialog("destroy")}function y(m){var v=a();ITMremoveItemFromCookie(U,m);v.find("div.dock_content div."+m).remove();m=v.find("ul.dock_tabs li."+m);var o=m.prev(),g=m.next();m.remove();if(v.find("ul.dock_tabs li").length){v.find("ul.dock_tabs li.visible").filter(":first").prev().length?t(o):w(g);if(!v.find("ul.dock_tabs li.selected").length)if(g.length)g.trigger("click");else o.length&&o.trigger("click");DCKdockController.updateTabScrollButtons()}else"popup"==COOKIEread(Q)?
r():s()}function C(m){var v=a();ITMclearItemSpecificLocalData(F,m);y(m);if(!v.find("ul.dock_tabs li").length){COOKIEerase(U);COOKIEerase(P)}}function B(m,v){var o=v.data("Id");if(DCKdockController.tabExists(o)){o=b(o);if(m.ErrorMessage){var g=ITMsetLabelInfo(v,"Error",undefined,undefined,"error");f("Error",g,"",o);ITMrenderErrorView(m,v)}else if(m.Root){g=ITMsetTooltip(m,v);var l=ITMsetLabelInfo(v,m.Root.title,m.Root.pt,m.Root.nt,"error");f(m.Root.title,l,g,o);ITMrenderTreeviewView(F,m,v)}else if(m.ChunkInfo){g=
ITMsetTooltip(m,v);l=ITMsetLabelInfo(v,m.title,m.pt,m.nt,"error");f(m.title,l,g,o);ITMrenderGenericView(F,m,v)}}}function G(){if("popup"==COOKIEread(Q)){var m=$("div#popup_dock"),v={beforeClose:function(){DCKdockController.close()},resize:function(){m.find("a.scroll").hide()},resizeStop:function(){DCKdockController.resize();m.find("a.scroll").show()},open:function(){$(this).parents(".ANNouterDockPopup").find("span.ui-dialog-title").html("&nbsp;")},autoOpen:false,height:200,width:$(window).width()*
0.9,minWidth:950,dialogClass:"ANNouterDockPopup"};m.attr("title","&nbsp;");m.dialog(v);m.dialog("open");v=m.parents(".ui-dialog").find(".ui-dialog-titlebar");$('<a href="#" title="Dock to bottom" class="ui-corner-all ui-dialog-titlebar-dock"><span class="ui-icon ui-icon-arrowthick-1-sw">dock</span></a>').appendTo(v).hover(function(){$(this).addClass("ui-state-hover")},function(){$(this).removeClass("ui-state-hover")}).bind("click",function(o){o.preventDefault();DCKdockController.openDocked()});m.find("div.dock_tabs ul").addClass("dock_tabs");
COOKIEcreate(Q,"popup",ITM_COOKIE_EXPIRY)}else{$("div#bottom_dock").show();$("div#bottom_dock div.dock_tabs").find("ul").addClass("dock_tabs");COOKIEcreate(Q,"docked",ITM_COOKIE_EXPIRY);ETHscrollerControl.resize(F);EDTonResize()}DCKdockController.updateTabScrollButtons()}function N(m){m=b(m);var v=$('<div class="highlight_tab" />').appendTo(m);v.fadeOut("slow",function(){v.remove()})}function T(m){var v=ITMgetItems(a());COOKIEcreate(Q,m,ITM_COOKIE_EXPIRY);v.each(function(){var o=$(this);DCKdockController.tabFromExisting(o,
p(o.data("Id")))});(m=COOKIEread(P))&&DCKdockController.selectTab(m,false);DCKdockController.updateTabScrollButtons()}var F,P,U,Q="dock_view_state",L="isdockable",V=5,S=6;this.tabWidth=function(){return a().find("ul.dock_tabs li:first").get(0).clientWidth+V};this.updateTabScrollButtons=function(){var m=a(),v=m.find("a.dock_scroll_backward img");m=m.find("a.dock_scroll_forward img");if($("ul.dock_tabs li.hidden").length){v.css("visibility","visible");m.css("visibility","visible");$("ul.dock_tabs li.visible").filter(":first").prev().length?
v.attr("src","/js/mapper/images/arrow-backward.png"):v.attr("src","/js/mapper/images/arrow-backward-disabled.png");$("ul.dock_tabs li.visible").filter(":last").next().length?m.attr("src","/js/mapper/images/arrow-forward.png"):m.attr("src","/js/mapper/images/arrow-forward-disabled.png")}else{v.css("visibility","hidden");m.css("visibility","hidden")}};this.selectTab=function(m,v){COOKIEcreate(P,m,ITM_COOKIE_EXPIRY);var o=a();o.find("ul.dock_tabs li").removeClass("selected");o.find("ul.dock_tabs li."+
m).addClass("selected");o.find("div.dock_content div.link_detail").removeClass("visible").addClass("hidden");o.find("div.dock_content div."+m).removeClass("hidden").addClass("visible");n();v&&N(m)};this.tabExists=function(m){return b(m).length>0};this.scrollForward=function(){var m=a();m.find("ul.dock_tabs li.visible").filter(":first").removeClass("visible").addClass("hidden");w(m.find("ul.dock_tabs li").filter(":first"));DCKdockController.updateTabScrollButtons()};this.scrollBackward=function(){var m=
a();m.find("ul.dock_tabs li.visible").filter(":last").removeClass("visible").addClass("hidden").hide();t(m.find("ul.dock_tabs li").filter(":last"));DCKdockController.updateTabScrollButtons()};this.repositionTabs=function(){for(var m=a().find("ul.dock_tabs li").filter(".visible"),v=$(m.get(0)).width(),o=0,g=0;g<m.length;++g){var l=$(m.get(g));if(!l.hasClass("ui-sortable-helper")){l.css("left",v*o+V*(o+1)+"px");++o}}};this.resetOpenedTabsOrder=function(){var m=a(),v=COOKIEread(U),o="",g=m.find(".dock_content input[type='hidden']"),
l=Array(g.length),q;for(q=0;q<g.length;++q){var x=$(g[q]).val();l[m.find("ul.dock_tabs li."+x).index()]=x}for(q=0;q<g.length;++q){TabId=l[q];m=v.match(RegExp(TabId+":\\w*#","g"));o+=m}ITMresetCookie(U,o)};this.resize=function(){var m=a();if(m.is(":visible")){if("popup"!=COOKIEread(Q))if(250<$("div.content_main").height()){$("div#EDTeditor").css("bottom",$(window).height()-$("div#bottom_dock").offset().top-10+"px");$("div#bottom_dock").css("height",Math.min($("div#bottom_dock").height(),$("div.content_main").height()-
50))}else $("div#bottom_dock").css("height",Math.min($("div#bottom_dock").height(),200));if(m.find("div.dock_toolbar").length&&m.find("ul.dock_tabs li").length){var v=m.find("div.dock_toolbar").get(0).clientWidth-("popup"==COOKIEread(Q)?50:90),o=m.find("ul.dock_tabs li:first"),g=m.find("ul.dock_tabs li:last"),l=o.get(0).clientWidth,q=m.find("ul.dock_tabs li:visible").filter(":last"),x=q.position().left;if(x+2*(l+V)<v)for(;x+2*(l+V)<v&&(!g.is(":visible")||!o.hasClass("visible"));){g.is(":visible")?
this.scrollBackward():q.next().removeClass("hidden").addClass("visible").show().css("left",x+l+V);q=m.find("ul.dock_tabs li:visible").filter(":last");x=q.position().left}else if(x+l+V>v)for(;x+l+V>v;){q.removeClass("visible").addClass("hidden").hide();q=m.find("ul.dock_tabs li:visible").filter(":last");x=q.position().left}n();DCKdockController.updateTabScrollButtons()}}};this.openPopup=function(){T("popup");s()};this.openDocked=function(){T("docked");r()};this.close=function(){for(var m=ITMgetItems(a()),
v=0;v<m.length;++v){var o=$(m[v]);C(o.data("Id"))}};this.tab=function(m){var v=ITMcreateNewItem(m);ITMaddItemToCookie(U,v);d(v);DCKdockController.selectTab(m)};this.errorStackTab=function(m,v){if(DCKdockController.tabExists(ITM_ERROR_STACK_ID))v&&N(ITM_ERROR_STACK_ID);else{var o=ITMcreateNewItem(ITM_ERROR_STACK_ID);d(o);j(m,o);ITMpushItemToCookie(U,o)}DCKdockController.selectTab(ITM_ERROR_STACK_ID)};this.setHelpContent=function(m,v){var o=b(m),g=a().find("div.link_detail:has(input.link_id[value="+
m+"])");g=ITMgetItems(g);h(g,o,v)};this.refresh=function(m,v,o){ITMgetItems(a()).each(function(){var g=$(this),l=g.data("Id");if(!g.data("ContentIsStatic"))if(o)B({ErrorMessage:"Script did not finish executing because it was cancelled by the user."},g);else if(ITM_ERROR_STACK_ID==l)j(v,g);else m[l]?e(m[l],g):B({ErrorMessage:"Unknown error."},g)})};this.getFullArgumentRequests=function(m){var v=ITMgetItems(a());ITMitemsToRequests(v,m)};this.beforeRefresh=function(){for(var m=ITMgetItems(a()),v=0;v<
m.length;v++){var o=$(m[v]);o.data("ContentIsStatic")||b(o.data("Id")).addClass("waiting")}};this.init=function(m){F=m;P=F.ifware.ChannelGuid+"_"+F.ifware.User+"_SelectedDockTab";U=F.ifware.ChannelGuid+"_"+F.ifware.User+"_OpenedTabs";c();n()};this.tabFromExisting=function(m){var v=m.data("Title"),o=m.data("LabelClass"),g=m.data("Tooltip"),l=m.siblings().detach(),q=d(m);q.append(l);l=m.data("Id");l=b(l);f(v,o,g,l);ITMtriggerScrollEvent(q);ITMaddItemToCookie(U,m)};this.setAnnotationToDefaultForAutoScriptExecutionDisabled=
function(m){B({ChunkInfo:{Chunks:[{ChunkNumber:0,Value:'To display this object <a href="#" class="execScriptButton executeNowText">run the script now</a>.'}],TotalChunks:1,LinesInLastChunk:7},title:"&nbsp;",file_name:"",funct_name:"",call:1,line:-1},m);m=$(".execScriptButton");m.unbind("click");m.click(function(v){v.preventDefault();$(ifware).trigger("ExecuteScriptOnce")})}}var DCKdockController=new DCKdock;function EDTtoggleProjectPane(a){a?$("#EDTprojectManager").show():$("#EDTprojectManager").hide()}function EDTtoggleThumbnail(a){var b=$("div#EDTthumbnailScroll");if(b.is(":visible"))b.hide();else{b.show();ETHscrollerControl.show(a)}}
function EDTscrollEditor(a,b){var c=$("#EDTeditor .CodeMirror-scroll"),e=(NISeditorScrollHeight()/NIScharHeight()+2)*ETHscrollerControl.retrieveVerticalScale(),d=NISeditorHeight();e=NISeditorScrollHeight()*((a.pageY-c.offset().top)/e)-0.5*d;d=NISeditorScrollWidth()/NIScharWidth(b)*ETHscrollerControl.retrieveHorizontalScale()*0.5;var f=NISeditorWidth();c=NISeditorScrollWidth()*((a.pageX-(c.offset().left+NISeditorWidth())-15)/d)-0.5*f;NISsetEditorScrollPosition(e,c)}
function EDTsetupHeader(a,b){var c=NIScreateToolbar(a,b);$("div.EDTtoolbar_wrapper").append(c);a.ifware.projectSettings.showProjectExplorer()||EDTtoggleProjectPane();NIScreateStatusBar(a,$("div.EDTstatus_bar"))}function EDTopenEditor(a){$("body").css("background-color","#ECEFF1");$("body:first").html('<div class="EDTloading" />');setTimeout(function(){EDTopenEditorImpl(a)},0)}
function EDTopenEditorImpl(a){var b=String(BrowserDetect.version),c=false;if("Explorer"==BrowserDetect.browser&&null!=b.match(/^8/))c=true;b=MAPretrieveHeaderHTML("lua_editor",a);a.ChannelName=escape(a.ChannelName);b+='<div class="content_main floated_bottom">         <div class="EDTtoolbar_wrapper" />          <div id="EDTeditor">           <div id="EDTprojectManager" />';c||(b+='<div id="EDTthumbnailScroll" />');b+='</div>        <div id="bottom_dock">         <div class="dock_toolbar">          <div class="dock_tabs">           <ul class="dock_tabs">           </ul>          </div>          <div class="dock_buttons">           <a class="dock_scroll_backward scroll" href=""><img src="/js/mapper/images/arrow-backward-disabled.png" /></a><a class="dock_scroll_forward scroll" href=""><img src="/js/mapper/images/arrow-forward-disabled.png" /></a>           <a class="to_popup" href="">            <img src="/js/mapper/images/popup-big.png" />           </a>           <a class="dock_close" href="">            <img src="/js/mapper/images/icon-close.png" />           </a>          </div>         </div>         <div class="dock_content">         </div>        </div>        <div id="popup_dock">         <div class="dock_toolbar">          <div class="dock_tabs">           <ul class="dock_tabs">           </ul>          </div>          <div class="dock_buttons">           <a class="dock_scroll_backward scroll" href=""><img src="/js/mapper/images/arrow-backward-disabled.png" /></a><a class="dock_scroll_forward scroll" href=""><img src="/js/mapper/images/arrow-forward-disabled.png" /></a>          </div>         </div>         <div class="dock_content">         </div>        </div>        <div class="EDTstatus_bar" />       </div>';
$("body:first").append(b);c=$("#EDTprojectManager");c.resizable({handles:"e",minWidth:101});(b=COOKIEread("EDTprojectPaneWidth"))&&c.css("width",b);c=$("div#bottom_dock");c.resizable({handles:"n",resize:function(){$("div#bottom_dock").resizable("option","maxHeight",$("div.content_main").height()-50);$("div#bottom_dock").css("bottom","32px").css("top","").css("width","").css("right","0px");15>$("#EDTeditor .CodeMirror-scroll").get(0).clientHeight?$("#EDTeditor .CodeMirror-scroll").css("overflow","hidden"):
$("#EDTeditor .CodeMirror-scroll").css("overflow","auto");EDTonResize()},minHeight:101});(b=COOKIEread("EDTdockHeight"))||(b="101px");c.css("height",b);EDTonResize();$("a.dock_scroll_backward").bind("click",function(){$("ul.dock_tabs li:first").hasClass("hidden")&&DCKdockController.scrollBackward();return false});$("a.dock_scroll_backward img").attr("title","Scroll tabs backward");$("a.dock_scroll_forward").bind("click",function(){$("ul.dock_tabs li:last").hasClass("hidden")&&DCKdockController.scrollForward();
return false});$("a.dock_scroll_forward img").attr("title","Scroll tabs forward");$("a.to_popup").bind("click",function(){DCKdockController.openPopup();return false});$("a.to_popup img").attr("title","Undock");$("a.dock_close").click(function(){DCKdockController.close();return false});$("a.dock_close").attr("title","Close all");DCKdockController.updateTabScrollButtons();$(document).get(0).title=MAPretrieveDocTitle("lua_editor",a);$("ul.dock_tabs").sortable({axis:"x",opacity:0.5,items:"li"});$("ul.dock_tabs").disableSelection();
$("ul.dock_tabs").bind("sortstop",function(d,f){f.item.css("filter","");DCKdockController.repositionTabs();DCKdockController.resetOpenedTabsOrder()}).bind("sort",function(){var d=$("ul.dock_tabs li.ui-sortable-placeholder");if(0>$("ul.dock_tabs li.ui-sortable-helper").position().left){var f=$("ul.dock_tabs li:visible").get(0);if($(f).hasClass("ui-sortable-placeholder"))f=$(f).next();$(f).before(d)}else{f=Math.floor($("ul.dock_tabs li.ui-sortable-helper").position().left/DCKdockController.tabWidth());
NewIndex=Math.min($("ul.dock_tabs li:visible").length,f);f=$("ul.dock_tabs li:visible").get(NewIndex);if($(f).hasClass("ui-sortable-placeholder"))f=$(f).next();$(f).after(d)}DCKdockController.repositionTabs();$("ul.dock_tabs li.ui-sortable-helper").trigger("click")});var e=document.getElementById("EDTeditor");NIScreateEditor(e,EDTsetupHeader,a);if(typeof ifware.Timers=="undefined")ifware.Timers={};ifware.Timers.Launch=setTimeout(function(){NISkillSwitch(e,EDTsetupHeader,a)},5E3)}
function EDTonResize(){var a=$("div#bottom_dock");a.css("display")!="none"&&$("div#EDTeditor").css("bottom",$(window).height()-a.offset().top-11+"px");var b=$("#EDTeditor").innerWidth()-201,c=$("#EDTprojectManager");c.resizable("option","maxWidth",b);c.outerWidth()>b&&c.css("width",b+"px");c.css("height",$("div#EDTeditor").innerHeight());COOKIEcreate("EDTprojectPaneWidth",c.css("width"),365);COOKIEcreate("EDTdockHeight",a.css("height"),365)}
ifware.initializeProjectSettings=function(a){var b={showEmptyNodes:false,disableAutoScriptExecution:false,showThumbnails:false,showProjectExplorer:true,projectTree:JSON.stringify({shared:"C",other:"C"})};return{showEmptyNodes:function(c){return ifware.LocalStorage.setOrGetState(b,"showEmptyNodes",c,a)},disableAutoScriptExecution:function(c){c=ifware.LocalStorage.setOrGetState(b,"disableAutoScriptExecution",c,a);return ifware.Editor.getOption("mode")=="lua"?c:true},showThumbnails:function(c){return ifware.LocalStorage.setOrGetState(b,
"showThumbnails",c,a)},showProjectExplorer:function(c){return ifware.LocalStorage.setOrGetState(b,"showProjectExplorer",c,a)},projectTree:function(c){return ifware.LocalStorage.setOrGetState(b,"projectTree",c,a)}}};function ETHscroller(a){function b(){return true}function c(){return{fill:"black"}}function e(r,y){for(var C=r.length,B=0,G=0;G<C;++G){var N=r[G];N=N.c+N.w/y;if(N>B)B=N}return B}function d(r,y,C,B){return Math.ceil(r.w/B)}function f(){var r=$("g#"+GroupId).attr("transform").match(/scale\s*\(\s*\d(\.\d+)?\s*\,\s*\d(\.\d+)?\s*\)/g)[0].match(/\d(\.\d+)?/g);return parseFloat(r[1])}function h(){var r=$("g#"+GroupId).attr("transform").match(/scale\s*\(\s*\d(\.\d+)?\s*\,\s*\d(\.\d+)?\s*\)/g)[0].match(/\d(\.\d+)?/g);
return parseFloat(r[0])}function j(r){$("rect.lua-scrollbar").remove();var y=$("#"+ContainerId),C=y.svg("get");if(undefined!=C){var B=C.getElementById(GroupId),G=NISeditorHeight()/NIScharHeight(),N=0;if(NISeditorHeight()<NISeditorScrollHeight())N=15;r=0.5*((NISeditorWidth()-N)/r.ifware.CharWidth)+1;var T=N=1;if(y.is(":visible")){y=parseInt($("svg").attr("height"))/NISeditorScrollHeight();N=NISgetEditorScrollTop()*y/f();y=parseInt($("svg").attr("width"))/NISeditorScrollWidth();T=NISgetEditorScrollLeft()*
y/h()}C.rect(B,T,N,r,G,{"class":"lua-scrollbar"})}}function p(r){if(r.attr("tooltip")){clearTimeout(TimeoutId);$("#"+ContainerId);TOOLtooltipLink(r.attr("tooltip"),null,null,0);TimeoutId=setTimeout("TOOLtooltipClose();",2E3)}}function n(r){var y=$("#"+ContainerId),C=y.offset().left;y=y.offset().top;var B=(r.clientX-C)/h(),G=(r.clientY-y)/f();$("rect").each(function(){if($(this).attr("tooltip")){var N=parseInt($(this).attr("x")),T=parseInt($(this).attr("y")),F=N+parseInt($(this).attr("width")),P=T+
parseInt($(this).attr("height"));if(B>=N&&B<=F&&G>=T&&G<=P){p($(this));return false}}})}function t(){$("rect[tooltip]").bind("mouseenter",function(){p($(this))});$("rect.lua-scrollbar").unbind().bind("mousemove",function(r){n(r)})}function w(r){var y=$("#"+ContainerId),C=y.get(0).clientWidth;y=y.get(0).clientHeight;var B=$("#"+ContainerId),G=B.svg("get");if(undefined!=G){G.configure({viewbox:"0 0 "+B.get(0).clientWidth+" "+B.get(0).clientHeight,preserveAspectRatio:"none"},false);G.configure({height:Math.min(B.get(0).clientHeight,
NISeditorScrollHeight()/NIScharHeight()+2)},false);G.configure({width:B.get(0).clientWidth},false)}B=0.5*(NISeditorScrollWidth()/r.ifware.CharWidth);G=NISeditorScrollHeight()/NIScharHeight();$("g#"+GroupId).attr("transform","scale("+C/B+","+Math.min(1,y/G)+")");j(r)}EmbeddedScrollBarWidth=5;GroupId="EDTthumbnail_group";ContainerId=a;BlockFilter=b;Stylizer=c;MaxLineLengthCalculator=e;OptimalBlockWidthCalculator=d;TimeoutId=-1;if(document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure",
"1.1")){this.setBlockFilter=function(r){BlockFilter=r?r:b};this.setStylizer=function(r){Stylizer=r?r:c};this.setMaxLineLengthCalculator=function(r){MaxLineLengthCalculator=r?r:e};this.setOptimalBlockWidthCalculator=function(r){OptimalBlockWidthCalculator=r?r:d};this.retrieveVerticalScale=f;this.retrieveHorizontalScale=h;this.initializeScroller=function(r){var y=$("#"+ContainerId);y.unbind("mousedown").bind("mousedown",r).bind("mousedown",function(){$(this).unbind("mousemove").bind("mousemove",r);
$("rect").unbind()});y.unbind("mouseup").bind("mouseup",function(){$(this).unbind("mousemove");t()});y.unbind("mouseleave").bind("mouseleave",function(){$(this).unbind("mousemove");t()});$("rect").unbind();$("g").unbind();$("svg").unbind()};var s;this.scroll=function(r){j(r);$("rect").unbind();clearTimeout(s);s=setTimeout(t,500)};this.clearError=function(){$("rect.lua-error").remove()};this.showError=function(r,y,C){var B=$("#"+ContainerId).svg("get");if(undefined!=B){if($("rect.lua-error").length){C=
parseFloat($("rect.lua-error").attr("x"));y=parseFloat($("rect.lua-error").attr("y"))}else{C=0.5*C+5;y=y.LineNumber}ETHscrollerControl.clearError();var G=B.getElementById(GroupId);ErrorBlockWidth=0.5*$("div.error-box").get(0).clientWidth/NIScharWidth(r);ErrorBlockHeight=$("div.error-box").get(0).clientHeight/NIScharHeight();B.rect(G,C,y,ErrorBlockWidth,ErrorBlockHeight,{"class":"lua-error"});w(r)}};this.clear=function(){$("#"+ContainerId).svg("destroy")};this.resize=function(r){r.ifware.CharWidth=
NIScharWidth(r);w(r)};this.show=function(r){this.clear(r);r.ifware.BlockDataSet&&$("#"+ContainerId).svg({onLoad:function(y){for(var C=r.ifware.CharWidth=NIScharWidth(r),B=$("#"+ContainerId),G=y.group(null,GroupId),N=MaxLineLengthCalculator(r.ifware.BlockDataSet,C),T=r.ifware.BlockDataSet.length,F=0;F<T;++F){var P=r.ifware.BlockDataSet[F],U=Stylizer(P.type),Q=0.5*P.c,L=Math.max(0,OptimalBlockWidthCalculator(P,N,B.get(0).clientWidth,C)-3);if(isNaN(L))L=0;if(BlockFilter(P)){y.rect(G,EmbeddedScrollBarWidth+
Q,P.s,L,P.e-P.s,U);P.t&&$("rect:last").attr("tooltip",P.t)}else y.rect(G,EmbeddedScrollBarWidth+Q,P.s,L,P.e-P.s,{fill:$("div#EDTthumbnailScroll svg").css("background-color")})}w(r);t()}});TOOLinitialize()}}else{this.setBlockFilter=function(){};this.setStylizer=function(){};this.setMaxLineLengthCalculator=function(){};this.setOptimalBlockWidthCalculator=function(){};this.retrieveHorizontalScale=this.retrieveVerticalScale=1;this.initializeScroller=function(){};this.scroll=function(){};this.clearError=
function(){};this.showError=function(){};this.clear=function(){};this.resize=function(){};this.show=function(){}}}var ETHscrollerControl=new ETHscroller("EDTthumbnailScroll");function ERRrenderError(a,b,c){b=MAPretrieveHeaderHTML("error",b);b+="<div class='content_main'><div class='error'>"+a+"</div>";if(c&&history.length>1)b+="<hr>"+BTNwrapper(BTNbuttonWithJavascript("javascript:history.go(-2);","Back"));$(document).find("body").html(b);a=location.href.split("#");location.href=a[0]+"#error"}
function ERRrenderDefaultError(a,b){var c=MAPretrieveDefaultHeaderHTML();c+="<div class='content_main'><div class='error'>"+a+"</div>";if(b&&history.length>1)c+="<hr>"+BTNwrapper(BTNbuttonWithJavascript("javascript:history.go(-2);","Back"));$(document).find("body").html(c);c=location.href.split("#");location.href=c[0]+"#error"};function ITSinitIntellisense(a,b){function c(g){if(g.preventDefault)g.preventDefault();else g.returnValue=false}function e(){return $(F).find(".intellisenseOptionsList tr.hover").get(0)}function d(){var g=e();if(g){var l=$(".intellisenseOptionsContainer",F).get(0),q=g.offsetTop-2;g=g.offsetTop+g.offsetHeight+2+20;var x=l.scrollTop,D=l.scrollHeight-l.offsetHeight+20;if(g>l.scrollTop+l.offsetHeight)l.scrollTop=Math.max(0,Math.min(D,g-l.offsetHeight))+4;if(q<x)l.scrollTop=Math.max(0,Math.min(D,q))}}
function f(g){$(g).addClass("hover")}function h(){var g=e();g&&j(g);f($(F).find(".intellisenseOptionsList tr").get(0))}function j(g){$(g).removeClass("hover")}function p(){if(P){j(e());f(this)}}function n(){P&&j(this)}function t(g,l,q,x){var D=document.createElement("tr");D.onmouseover=p;D.onmouseout=n;D.onclick=function(W,Z){var X=g.ft,z=!g.s;T();var E=a.getLine(q),K=E.substring(0,x-l.length),u=X.length,A=u&&(X[u-1]=="("||X[u-1]=="{"),I=u&&Z=="="&&X[u-1]=="=";if(!z&&(A&&Z||I)){X=X.substring(0,u-
1);A=false}if(Z)X+=Z;K+=X;K+=E.substring(x);a.replaceRange(K,{line:q,ch:0},{line:q,ch:a.getLine(q).length});a.setCursor({line:q,ch:x+(X.length-l.length)});a.focus();if(z&&!Z)N(X);else if(A||Z)N()};var H=document.createElement("td");H.className="nt_"+g.pt+"_"+g.nt;if(g.r)H.className+=" r";H.innerHTML=g.dt;D.appendChild(H);return D}function w(g){var l=g<0?1:-1,q=e();if(!q){h();q=e();g+=l}for(;g!=0&&q;){var x=g<0?$(q).prev().get(0):$(q).next().get(0);if(x){j(q);f(x)}q=x;g+=l}d()}function s(g,l){switch(g){case 32:case 13:e().onclick();
return true;case 38:w(-1);return true;case 9:l?w(-1):w(1);return true;case 40:w(1);return true;case 33:w(-7);return true;case 34:w(7);return true;case 36:h();d();return true;case 35:var q=e();q&&j(q);q=$(F).find(".intellisenseOptionsList tr").get();f(q[q.length-1]);d();return true;case 27:T();return true;case 112:Q&&$(".intellisenseHelpButtons",F).is(":visible")&&Q();return true}return false}function r(g,l){if(!g.ifware.projectSettings.disableAutoScriptExecution()){var q=window.event?event.keyCode:
l.keyCode,x=e(),D=l.type=="keypress",H=undefined;if(D)H=L[l.charCode===undefined?q:l.charCode];if(H&&x){x.onclick(null,H);c(l);l.codemirrorIgnore=true}else{if(D)U=false;a:{if(l.type=="keypress"){if(l.charCode!=0&&q!=13||q==8){D=true;break a}}else if(l.type=="keydown"&&q==8){D=true;break a}D=false}if(D)U=true;else if(!(F.style.display=="none"||!x&&(q==13||q==32))){P=false;switch(q){case 112:if(q==112){document.onhelp=function(){return false};window.onhelp=function(){return false}}case 13:case 9:case 32:case 38:case 40:case 33:case 34:case 36:case 35:case 27:case 112:c(l);
if(l.type!="keydown")return}if(s(q,l.shiftKey))l.codemirrorIgnore=true}}}}function y(g,l,q){var x=g.getCursor();l=l.substring(0,x.ch-q);return g.charCoords({line:x.line,ch:l.length})}function C(g,l,q,x){Q=function(){var D=$(x).find(".intellisenseHelpData").clone();D.show();NISshowPopupOrDockTab(g,ITM_HELP_ID,undefined,D);g.focus()};$(x).prepend('<div class="intellisenseHelpTitle">HELP<div class="intellisenseHelpButtons">'+v+"</div></div>");$(".intellisenseHelpTitle",x).click(Q);$(".intellisenseHelpButtons-close",
x).click(T)}function B(g,l,q,x){g=y(g,l,q.length);F.style.left=g.left+"px";F.style.top=g.bottom+"px";F.style.height="";F.style.width="";if($(F).outerHeight()>x){F.style.height=x+"px";F.style.width=$(F).innerWidth()+18+"px"}x=WINgetWindowWidth()-g.left-50;l=$(F).outerWidth();if(l>x)F.style.width=x+"px";else if(l<80)F.style.width="80px";var D=$(F).outerHeight();$(".intellisenseHelpTitle",F).each(function(){var H=$(".intellisenseOptionsContainer:visible,.intellisenseHelpData:visible").height("100%").outerHeight();
if(H>D-$(this).outerHeight()){H-=$(this).outerHeight();$(".intellisenseOptionsContainer:visible,.intellisenseHelpData:visible").height(H)}D=$(F).outerHeight()});if(g.bottom+D>WINgetWindowHeight())F.style.top=g.top-D+"px"}function G(g){b.innerHTML="";if(g.ErrorMessage)b.innerHTML=g.ErrorMessage;else{var l=g.Options;if(l&&l.length>0){var q=a.getCursor(),x=q.line,D=a.getLine(x);g.LineNumber--;if(x==g.LineNumber&&q.ch==g.CursorPosition){var H=document.createElement("table");$(H).addClass("intellisenseOptionsList");
for(var W=0;W<l.length;W++)H.appendChild(t(l[W],g.FullExpression,x,q.ch));if(g.OptionsTruncated){l=document.createElement("tr");W=document.createElement("td");W.className="intellisenseOptionsTruncatedWarning";W.innerHTML="Not all results could be displayed.";l.appendChild(W);H.appendChild(l)}F.cursorPos=q.ch;F.lineNo=x;$(F).empty();if(g.HelpHtml){q=$('<div class="intellisenseOptionsContainer intellisenseHelpParams"></div>                                         <div style="display: none" class="intellisenseHelpData">'+
g.HelpHtml+"</div>");$(H).addClass("intellisenseOptionsHelp");$(F).append(q);$(".intellisenseHelpParams",F).append(H);C(a,D,g.SearchString,F)}else{$(H).addClass("intellisenseOptions");q=$('<div class="intellisenseOptionsContainer"></div>');q.append(H);$(F).append(q)}F.style.display="";B(a,D,g.SearchString,m)}}else if(g.HelpHtml){H=a.getCursor();q=H.line;D=a.getLine(q);g.LineNumber--;if(q==g.LineNumber&&H.ch==g.CursorPosition){F.cursorPos=H.ch;F.lineNo=q;$(F).empty();$(F).append('<div class="intellisenseOptionsContainer intellisenseHelpUsage"></div>                               <div style="display: none" class="intellisenseHelpData"></div>');
C(a,D,g.SearchString,$(F));if(g.UsageHelpHtml){H=g.UsageHelpHtml;$(".intellisenseHelpUsage",F).append(H).show();$(".intellisenseHelpData",F).append(g.HelpHtml).hide()}else if(g.HelpHtml){$(".intellisenseHelpUsage",F).hide();$(".intellisenseHelpButtons",F).hide();$(".intellisenseHelpData",F).append(g.HelpHtml).show()}F.style.display="";B(a,D,g.SearchString,S)}}}}function N(g){if(!a.ifware.projectSettings.disableAutoScriptExecution()){var l=a.getCursor();T();b.innerHTML='<img src="/js/mapper/images/spinner.gif" />';
l={LineNumber:l.line+1,CursorPosition:l.ch};if(g)l.AdditionalRequestExpression=g;NISprepareLuaPostInfo(a,l,true);o.post("/ann/intellisense_options",l,G,function(){b.innerHTML="Cancelled."})}}function T(g){g&&g.stopPropagation&&g.stopPropagation();if($(F).is(":visible")){$(F).empty().hide();a.focus()}}var F=$("body:first").prepend('<div class="ITSpopupProtector"><div class="intellisensePopup" style="display:none;"></div></div>').find("div.intellisensePopup:first")[0],P=false,U=false;$(F).mousemove(function(){P=
true});var Q,L={40:"(",41:")",44:",",46:".",58:":",61:"=",91:"[",93:"]",123:"{",125:"}"},V=/^(\s*--.*|\W*)$/,S=400,m=175,v='<img class="intellisenseHelpButtons-expand" title="Pop out" src="/js/mapper/images/maximize_button_yellow.gif">                             <img class="intellisenseHelpButtons-close" title="Close" src="/js/mapper/images/close_button_yellow.gif">',o=ScriptRunner();a.ifware.addKeyDownListener(r);a.ifware.addKeyPressListener(r);a.ifware.addCursorActivityListener(function(){b.innerHTML=
"";var g=a.getCursor();if(F.style.display==""&&(F.cursorPos!=g.ch||F.lineNo!=g.line))T()});a.ifware.addScrollListener(T);a.ifware.addChangeListener(function(g){if(U){U=false;var l=g.getCursor();g=g.getLine(l.line).substring(0,l.ch);V.test(g)||N()}})};var ITM_CHUNK_SIZE=200,ITM_ERROR_STACK_ID="error_stack",ITM_ERROR_STACK_TITLE="Error Stack",ITM_HELP_ID="help",ITM_HELP_TITLE="Help",ITM_VIEW_MODE_CHANGE_EVENT="itemviewmodechange",ITM_COOKIE_EXPIRY=60;function ITMgetContainerLineHeight(a){a=$("<div>\n</div>").appendTo(a);var b=a.outerHeight();a.remove();return b}
function ITMonScrollNearEmptyChunk(a,b,c,e){var d=b.attr("id").split("_")[1];Ajax.post("/ann/full_arg",{translator_guid:a.ifware.ChannelGuid,Id:c,ViewMode:e,Chunk:d},function(f){f.ErrorMessage?b.removeClass("empty").addClass("error").text(f.ErrorMessage):b.removeClass("empty").css("height","").html(f.ChunkInfo.Chunks[0].Value)},"json")}
function ITMsetChunkScrollHandler(a,b,c,e,d){b.unbind("scroll");d.Chunks.length!=d.TotalChunks&&b.scroll(function(){for(var f=this.scrollTop-200,h=this.scrollTop+b.outerHeight()+200,j=b.children("div.chunk.empty"),p=0,n=j.length;p<n;p++){var t=$(j[p]),w=t.get(0).offsetTop,s=w+t.outerHeight();if(f<=s&&s<=h||f<=w&&w<=h||w<=f&&h<=s)ITMonScrollNearEmptyChunk(a,t,c,e)}})}
function ITMrenderChunks(a,b,c,e,d){for(var f=ITMgetContainerLineHeight(b),h="",j=f*ITM_CHUNK_SIZE,p=0,n=d.TotalChunks;p<n;p++)h+='<div class="chunk empty" id="chk_'+p+'" style="height:'+j+'px;" />';b.html(h);p=0;for(n=d.Chunks.length;p<n;p++){h=d.Chunks[p];b.children("#chk_"+h.ChunkNumber).removeClass("empty").css("height","").html(h.Value)}b.children("div.chunk:last").css("height",f*d.LinesInLastChunk+"px");ITMsetChunkScrollHandler(a,b,c,e,d)}
function ITMonViewModeChange(a,b,c){var e=b.parent(),d=ITMgetContentDiv(e);e=ITMitemToRequest(b);e.translator_guid=a.ifware.ChannelGuid;c.addClass("waiting");Ajax.post("/ann/full_arg",e,function(f){c.removeClass("waiting");b.trigger(ITM_VIEW_MODE_CHANGE_EVENT,[b]);if(f.ErrorMessage){var h=d.children("div.chunk");h.empty().addClass("error");$(h[0]).text(f.ErrorMessage);d.scrollTop(0)}else ITMrenderGenericView(a,f,b)},"json")}
function ITMrenderViewOptions(a,b,c,e){if(!b.find(".string_slider").size()){b.html('<div class="string_slider"><a href="" class="slide_arrow" title="Show/hide view options"></a><div class="content"></div></div><div class="view_options"><div class="view_options_title">View Mode:</div><a href="" class="string_pt">Plain Text</a><a href="" class="string_et">Escaped Text</a><a href="" class="string_hx">Hexadecimal</a></div>');b.find("a.slide_arrow").click(function(d){d.preventDefault();d=$(this).parent();
d.stop(true,true).toggleClass("expanded");var f=d.hasClass("expanded")?"0px":"110px";d.animate({left:f},"fast")});b.find("div.view_options a").click(function(d){d.preventDefault();d=$(this);d.siblings().andSelf().removeClass("selected").removeClass("waiting");var f=this.className;d.addClass("selected");if(e.data("ViewMode")!=f){e.data("ViewMode",f);ITMonViewModeChange(a,e,d)}}).filter("."+c).addClass("selected")}}
function ITMremoveViewOptions(a){if(a.find(".string_slider").size()){var b=a.find("div.content").detach();a.children("div").remove();a.append(b)}}function ITMonShowNoDataError(a){if("Details"==$("a#no_data_toggle_"+a).html()){$("a#no_data_toggle_"+a).html("Hide");$("div#no_data_details_"+a).show()}else{$("a#no_data_toggle_"+a).html("Details");$("div#no_data_details_"+a).hide()}}
function ITMnoDataErrorToDisplay(a,b){var c="";if("Unknown error."==a)c="No data.  Tracepoint not reached.";else{if(!b.id)b.id=b.data("Id");c="No data.  The script was stopped or an error occurred. <br><a id='no_data_toggle_"+b.id+"' href='javascript:ITMonShowNoDataError(\""+b.id+"\")'>Details</a>";c+="<div id='no_data_details_"+b.id+"' style='display:none;'>"+a.replace(/^.*@@<><>.+<><>@@/,"")+"</div>"}return c}function ITMsetContentItem(a,b){a.append(b)}
function ITMgetContentDiv(a){var b=a.find("div.content:first");b.size()||(b=$('<div class="content"></div>').appendTo(a));return b}function ITMappendStackFrame(a,b,c){var e=PAGhtmlEscape(c.fd);$('<tr><td width="1%"><a href="" class="fc fcin" title="Step into '+c.n+" at "+e+":"+c.l+'">'+c.n+"</a></td><td>("+e+":"+c.l+")</td></tr>").appendTo(b).find("a.fc").click(function(d){d.preventDefault();NISjumpToStackFrame(a,c)})}
function ITMsetLabelInfo(a,b,c,e,d){c=undefined===c||undefined===e?d:"nt_"+c+"_"+e;a.data("Title",b);a.data("LabelClass",c);return c}
function ITMsetTooltip(a,b){if(a.title==="&nbsp;")return"This information cannot be displayed until the script is re-run.";var c=a.funct_name;if(undefined!=c){var e="",d=b.data("Id").replace(/^(.+_)+/,"").split("-");if("a"==d[2])e+="Argument "+parseInt(d[1]);else if("r"==d[2])e+="Return "+parseInt(d[1]);if("main"==c)e+=" of "+c;else{e+=" of call "+a.call+" of "+c;e+=" at "+a.file_name+":"+a.line}b.data("Tooltip",e);return e}else return""}
function ITMpopulateErrorStackTrace(a,b,c){var e=c.parent();if(e.size()){c.detach();e.empty();e=$('<div class="error_stack_container"></div>').appendTo(e);if(b&&b.CallStack){b=b.CallStack;for(var d=$('<table class="ANNest"></table>').appendTo(e),f=b.length-1;f>=0;f--)ITMappendStackFrame(a,d,b[f]);d.find("a.fc").mouseenter(function(){NISonFunctionCallEnter(a,this)}).mouseleave(function(){NISonFunctionCallLeave(a,this)})}else e.html('<div class="ANNest_none">There is no error in the script for which a stack trace can be provided.</div>');
ITMsetContentItem(e,c)}}function ITMrenderErrorView(a,b){var c=b.parent();b.detach();ITMgetContentDiv(c).html(ITMnoDataErrorToDisplay(a.ErrorMessage,b));ITMsetContentItem(c,b)}function ITMrenderStaticView(a,b){var c=a.parent();a.detach();ITMgetContentDiv(c).empty().append(b);ITMsetContentItem(c,a);a.data("ContentIsStatic",true)}
function ITMrenderTreeviewView(a,b,c){var e=c.parent();ITMremoveViewOptions(e);c.detach();var d=ITMgetContentDiv(e);d.html('<ul class="ifwareTreeview"></ul>');NTRinitTreeview(b.Root,d.find("ul.ifwareTreeview").get(0),c,"/ann/full_arg",{translator_guid:a.ifware.ChannelGuid},true);ITMsetContentItem(e,c)}
function ITMrenderGenericView(a,b,c){var e=c.parent();c.detach();var d=b.pt===0&&b.nt===4,f=c.data("ViewMode")||"string_pt";if(d){ITMrenderViewOptions(a,e,f,c);d=e.find("div.content")}else{ITMremoveViewOptions(e);d=ITMgetContentDiv(e)}ITMrenderChunks(a,d,c.data("Id"),f,b.ChunkInfo);ITMsetContentItem(e,c)}
function ITMgetVisibleChunks(a){var b=a.find("div.content");if(b.children("div.chunk:first").size()==0)return[];a=ITMgetContainerLineHeight(b);var c=Math.max(0,b.scrollTop()-200);b=b.scrollTop()+b.outerHeight()+200;c=Math.floor(Math.floor(c/a)/ITM_CHUNK_SIZE);a=Math.floor(Math.floor(b/a)/ITM_CHUNK_SIZE);return c!=a?[c,a]:[c]}
function ITMaddItemToCookie(a,b){var c=COOKIEread(a),e=b.data("Id"),d=e+":"+(b.data("ViewMode")||"")+"#";if(undefined==c)COOKIEcreate(a,d,ITM_COOKIE_EXPIRY);else{e=RegExp(e+":\\w*#","g");if(c.search(e)!=-1){c=c.replace(e,d);COOKIEcreate(a,c,ITM_COOKIE_EXPIRY)}else COOKIEcreate(a,c+d,ITM_COOKIE_EXPIRY)}}
function ITMpushItemToCookie(a,b){var c=COOKIEread(a),e=b.data("Id"),d=e+":"+(b.data("ViewMode")||"")+"#";if(undefined==c)COOKIEcreate(a,d,ITM_COOKIE_EXPIRY);else{c=c.replace(RegExp(e+":\\w*#","g"),"");COOKIEcreate(a,c+d,ITM_COOKIE_EXPIRY)}}function ITMupdateCookie(a,b){var c=b.data("Id"),e=c+":"+(b.data("ViewMode")||"")+"#",d=COOKIEread(a);d&&COOKIEcreate(a,d.replace(RegExp(c+":\\w*#","g"),e),ITM_COOKIE_EXPIRY)}
function ITMremoveItemFromCookie(a,b){var c=COOKIEread(a);if(undefined!=c){c=c.replace(RegExp(b+":\\w*#","g"),"");""==c?COOKIEerase(a):COOKIEcreate(a,c,ITM_COOKIE_EXPIRY)}}function ITMresetCookie(a,b){COOKIEcreate(a,b,ITM_COOKIE_EXPIRY)}function ITMgetItems(a){return a.find('input[type="hidden"]')}
function ITMitemToRequest(a){var b=a.data("Id"),c={Id:b},e=a.data("ViewMode");if(e)c.ViewMode=e;a=a.parent();if(a.find("div.chunk:first").size()!=0){if(b=ITMgetVisibleChunks(a)){if(b.length>0)c.Chunk=b[0];if(b.length>1)c.ExtraChunk=b[1]}}else c.ExpansionTree=NTRgetExpansionTreeFromCookie(b);return c}function ITMitemsToRequests(a,b){for(var c=0;c<a.length;c++){var e=$(a[c]);e.data("ContentIsStatic")||(b[b.length]=ITMitemToRequest(e))}}
function ITMcreateNewItem(a){var b=$('<input class="link_id" type="hidden" />');b.val(a);b.data("Id",a);return b}function ITMgetItemsFromCookie(a){var b=$([]);if(a=COOKIEread(a)){a=a.split("#");for(var c=0;c<a.length-1;++c){var e=a[c].split(":"),d=ITMcreateNewItem(e[0]);d.data("ViewMode",e[1]);b=b.add(d)}}return b}function ITMtriggerScrollEvent(a){ITMgetContentDiv(a).trigger("scroll")}
function ITMclearItemSpecificLocalData(a,b){COOKIEerase(b+"_expanded_tree_nodes");ITM_HELP_ID==b&&ITMremoveMostRecentHelp(a)}var ITMstoreMostRecentHelp,ITMretrieveMostRecentHelp,ITMremoveMostRecentHelp,key=function(a){return a.ifware.ChannelGuid+"_"+a.ifware.User+"_MostRecentHelpHtml"};ITMstoreMostRecentHelp=function(a,b){var c=b.clone().wrap("<p>").parent().html();ifware.storage.set(key(a),c,ITM_COOKIE_EXPIRY)};ITMretrieveMostRecentHelp=function(a){return $(ifware.storage.get(key(a))||"<span>No function selected.</span>")};
ITMremoveMostRecentHelp=function(a){ifware.storage.remove(key(a))};function NAVheader(a){var b=MPRapp.header;b+="<span class='crumb'>"+a+"</span>";b+="</div>";b+="<div class='content_main'>";return b}function NAVfooter(){return"</div>"};var NTRtoJson=JSON&&JSON.stringify?JSON.stringify:$.toJSON;function NTRcreateTreeNode(a){var b="nt_"+a.pt+"_"+a.nt,c="";if(a.e){b+=" e";c="e"}if(a.r)b+=" r";var e=!a.l&&a.c;b=TRVcreateNode(a,c,b,!a.l,e,e?a.ev:a.cv,NTRonNodeToggled);if(e){e=TRVgetChildContainer(b);for(c=0;c<a.c.length;c++)e.appendChild(NTRcreateTreeNode(a.c[c]))}return b}
function NTRscrollToChildren(a,b){var c=a.closest("ul.ifwareTreeview").parent(),e=c.scrollTop(),d=c.innerHeight(),f=$(b).position().top,h=$(b).outerHeight();f=f+h+20;if(f-e>d){h=e=a.position().top;if(f-e<d)h=f-d+5;c.stop().animate({scrollTop:h},"fast")}}function NTRgetNodeAddress(a){var b=a.data("DataNode"),c={};for(c[b.n]={};!a.closest("ul").hasClass("ifwareTreeview");){a=a.parent().closest("li");b=a.data("DataNode");var e={};e[b.n]=c;c=e}return c}
var NTRrequestChildren=function(){var a=ScriptRunnerDict();return function(b,c,e){e.addClass("waiting");var d=e.closest("li");d=NTRgetNodeAddress(d);d=NTRtoJson(d);var f=c.data("Id"),h=c.data("BranchUrl"),j=c.data("BranchVars"),p={Id:f,RootAddress:d};for(VarKey in j)p[VarKey]=j[VarKey];a(f+":"+d).post(h,p,function(n){e.removeClass("waiting");if(n.ErrorMessage){$(b).addClass("error").text(n.ErrorMessage);NTRonErrorResponse&&NTRonErrorResponse(n)}else{n=n.Root.c;for(var t=n.length,w=0;w<t;++w)b.appendChild(NTRcreateTreeNode(n[w]));
NTRshowOrHideEmptyNodes(c);NTRscrollToChildren(e,b)}},function(){e.removeClass("waiting");$(b).addClass("error").text("Request cancelled")})}}();function NTRonNodeToggled(a,b,c,e){var d=TRVgetTreeRoot(c),f=d.data("CookieName");if(e){b.innerHTML=a.ev;NTRrequestChildren(c,d,$(b))}else{b.innerHTML=a.cv;NTRshowOrHideEmptyNodes(d)}a=NTRgetExpansionTree(d.get(0));if(f){a=a.replace(/^{('|")r('|"):{}}$/,"");""!=a?COOKIEcreate(f,a,60):COOKIEerase(f)}}
function NTRpopulateExpansionTree(a,b){a=$(a);TRVgetChildren(a).each(function(){var c=$(this).data("DataNode");if(c.n!=""&&!b[c.n])b[c.n]={};var e=TRVgetChildContainer(this);NTRpopulateExpansionTree(e,b[c.n])})}function NTRgetDropdown(a){return a.closest(".content").siblings(".emptyNodeDropdown")}function NTRshowOrHideEmptyNodes(a){var b=a.find("li.e");a.data("ShowEmptyNodes")?b.show():b.hide();a=NTRgetDropdown(a);b.size()>0?a.show():a.hide()}
function NTRgetExpansionTree(a){var b={};NTRpopulateExpansionTree(a,b);return NTRtoJson(b)}function NTRgetExpansionTreeFromCookie(a){return COOKIEread(a+"_expanded_tree_nodes")}
function NTRinitTreeview(a,b,c,e,d,f){b.innerHTML="";var h=c.data("Id"),j=c.data("ViewMode")=="show_empty_nodes",p=h+"_expanded_tree_nodes",n=$(b);f&&n.data("CookieName",p);n.data("Id",h).data("BranchUrl",e).data("BranchVars",d).data("ShowEmptyNodes",j);b.appendChild(NTRcreateTreeNode(a));NTRgetDropdown(n).remove();a=$('<div class="emptyNodeDropdown">                         <label title="This tree contains some empty nodes. You can select whether or not you want these nodes to be visible.">                            <input type="checkbox" name="showEmptyNodes" />                            Show Empty Nodes                         </label>                      </div>');n.closest(".content").after(a);
a=a.find("input");j&&a.attr("checked","checked");a.change(function(){var t=$(this).is(":checked");c.data("ViewMode",t?"show_empty_nodes":"hide_empty_nodes");c.trigger(ITM_VIEW_MODE_CHANGE_EVENT,[c]);n.data("ShowEmptyNodes",t);NTRshowOrHideEmptyNodes(n)});NTRshowOrHideEmptyNodes(n)}var NTRonErrorResponse=null;function POPdialogs(a){function b(g){return $("div.ANNpopup:has(input.link_id[value="+g+"])")}function c(g){g=b(g).siblings("div.ui-dialog-titlebar");var l=$("<div class='highlight_title' />").prependTo(g);l.fadeOut("slow",function(){l.remove()})}function e(g){g=g.parents().filter(".ANNouterPopup");COOKIEcreate(T,g.position().top,ITM_COOKIE_EXPIRY);COOKIEcreate(F,g.position().left,ITM_COOKIE_EXPIRY);COOKIEcreate(P,g.width(),ITM_COOKIE_EXPIRY);COOKIEcreate(U,g.height(),ITM_COOKIE_EXPIRY)}function d(g,
l,q,x){if(m+V-20<g+q||S+L-20<l+x)return false;if(m>g||S>l)return false;q=$("div.ANNouterPopup");x={};x.key={};x.val={};for(var D=0;D<q.length;D++){var H=q.eq(D);x.key[D]=[H.position().left,H.position().top];x.val[D]=H}H=false;for(D=0;D<q.length;D++)if(g==x.key[D][0]&&l==x.key[D][1])break;if(D==q.length)H=true;return H}function f(g,l,q,x){var D=g+v,H=l+v;if(d(D,H,q,x))return[D,H];D=g-v;H=l-v;if(d(D,H,q,x))return[D,H];D=g-v;H=l+v;if(d(D,H,q,x))return[D,H];D=g+v;H=l-v;if(d(D,H,q,x))return[D,H];return null}
function h(g,l,q,x){var D=f(g,l,q,x);if(null!=D)return D;D=f(g+v,l,q,x);if(null!=D)return D;D=f(g,l+v,q,x);if(null!=D)return D;D=f(g-v,l,q,x);if(null!=D)return D;D=f(g,l-v,q,x);if(null!=D)return D;return[m+(V-q)/2,S+(L-x)/2]}function j(g,l){g.append(l);var q=l.data("Id"),x=$("div.CodeMirror-scroll").height()/2,D=$("div.CodeMirror-scroll").width()/2,H=S+(L-x)/2,W=m+(V-D)/2;if(null!=COOKIEread(T)){x=parseInt(COOKIEread(U));D=parseInt(COOKIEread(P));H=parseInt(COOKIEread(T));W=parseInt(COOKIEread(F));
H=h(W,H,D,x)}else H=[W,H];g.dialog({focus:function(){if(!(o.length>0&&o[o.length-1]==q)){C(q);o.push(q)}},close:function(){ITMremoveItemFromCookie(Q,q);$(this).dialog("destroy").remove();C(q);G.ifware.focusLastFocussedElement()},create:function(){$(this).parent().find("span.ui-dialog-title").empty().append(B)},autoOpen:false,width:D,height:x,position:H,dialogClass:"ANNouterPopup",minWidth:230});g.dialog("open");e(g);$(".ANNouterPopup").filter(":last").css("position","absolute").css("top",H[1]).css("left",
H[0]);g.unbind().bind("dialogfocus",function(){ITMpushItemToCookie(Q,l);e(g)}).bind("dialogbeforeclose",function(){ITMclearItemSpecificLocalData(G,q)}).bind("dialogdragstop",function(){e(g)}).bind("dialogresizestop",function(){e(g)}).bind(ITM_VIEW_MODE_CHANGE_EVENT,function(Z,X){ITMupdateCookie(Q,X)})}function p(){if(null!=COOKIEread(T)){var g=parseInt(COOKIEread(U)),l=parseInt(COOKIEread(P));COOKIEcreate(T,S+(L-g)/2-v,ITM_COOKIE_EXPIRY);COOKIEcreate(F,m+(V-l)/2-v,ITM_COOKIE_EXPIRY)}ITMgetItemsFromCookie(Q).each(function(){var q=
$(this),x=r(q);if(ITM_HELP_ID==q.data("Id")){var D=ITMretrieveMostRecentHelp(G);w(q,x,D);prettyPrint()}ifware.Editor.ifware.projectSettings.disableAutoScriptExecution()&&POPdialogsController.setAnnotationToDefaultForAutoScriptExecutionDisabled(q)})}function n(g,l){setTimeout(function(){s(g,l)},0)}function t(g,l,q){var x=g.dialog("widget").find("div.title.ntv:first");x[0].className="title ntv "+q;Title=$(x[0]);if("waiting"==q)Title.html("Refreshing&hellip;");else{q=l.data("Title")||" ";q=q.replace(/\s/g,
"&nbsp;");Title.html(q);q=g.parents(".ui-dialog").find(".ui-dialog-titlebar");$('<a title="Snap to dock" href="#" class="ui-corner-all ui-dialog-titlebar-dock"><span class="ui-icon ui-icon-arrowthick-1-sw">dock</span></a>').appendTo(q).hover(function(){$(this).addClass("ui-state-hover")},function(){$(this).removeClass("ui-state-hover")}).bind("click",function(D){D.preventDefault();DCKdockController.tabFromExisting(l);DCKdockController.selectTab(l.data("Id"));g.unbind("dialogbeforeclose");g.dialog("close");
COOKIEcreate("isdockable","true",ITM_COOKIE_EXPIRY)});q.find(".ui-icon").attr("style","background-image:url(/js/jquery-ui-1-8-16/css/ui-lightness/images/ui-icons_847e71_256x240.png);")}}function w(g,l,q){var x=ITMsetLabelInfo(g,ITM_HELP_TITLE,undefined,undefined,"help");t(l,g,x);ITMrenderStaticView(g,q);ITMstoreMostRecentHelp(G,q)}function s(g,l){var q=b(l.data("Id"));if(q.length)if(g.ErrorMessage){var x=ITMsetLabelInfo(l,"Error",undefined,undefined,"error");t(q,l,x);ITMrenderErrorView(g,l)}else if(g.Root){ITMsetTooltip(g,
l);x=ITMsetLabelInfo(l,g.Root.title,g.Root.pt,g.Root.nt,"error");t(q,l,x);ITMrenderTreeviewView(G,g,l)}else if(g.ChunkInfo){ITMsetTooltip(g,l);x=ITMsetLabelInfo(l,g.title,g.pt,g.nt,"error");t(q,l,x);ITMrenderGenericView(G,g,l)}}function r(g){var l=g.data("Id");l=b(l);if(!l.length){l=$("<div class='ANNpopup'></div>").appendTo($("body"));j(l,g)}return l}function y(g,l){var q=b(l.data("Id")),x=ITMsetLabelInfo(l,ITM_ERROR_STACK_TITLE,undefined,undefined,"error_stack");t(q,l,x);ITMpopulateErrorStackTrace(G,
g,l)}function C(g){g=o.indexOf(g);g!=-1&&o.splice(g,1)}var B="<div class='title ntv waiting'>Refreshing&hellip;</div>",G=a,N,T,F,P,U,Q,L=0,V=0,S=0,m=0,v=30,o=[];this.setEditorDimensions=function(){var g=$("div.CodeMirror-scroll");if(g.length){L=g.height();V=g.width();m=g.position().left;S=83}};this.moveDialogs=function(){$.each($("div.ANNpopup"),function(){var g=$(this).parents().filter(".ANNouterPopup"),l=g.position().left,q=g.position().top,x=false,D=g.height(),H=g.position().top;if(D+H>L+S){x=
true;q=L+S-g.height()}D=g.width();H=g.position().left;if(D+H>V+m){x=true;l=V+m-g.width()}x&&$(this).dialog("option","position",[l,q])})};this.dialog=function(g){g=ITMcreateNewItem(g);r(g);ITMpushItemToCookie(Q,g)};this.bringToFrontAndHighlightDialog=function(g){var l=b(g);if(l.length){l.dialog("moveToTop");c(g);ITMpushItemToCookie(Q,ITMgetItems(l))}};this.errorStackDialog=function(g,l){var q;if(POPdialogsController.dialogExists(ITM_ERROR_STACK_ID)){q=b(ITM_ERROR_STACK_ID).dialog("moveToTop");q=ITMgetItems(q);
l&&c(ITM_ERROR_STACK_ID)}else{q=ITMcreateNewItem(ITM_ERROR_STACK_ID);r(q);y(g,q)}ITMpushItemToCookie(Q,q)};this.setHelpContent=function(g,l){var q=b(g),x=ITMgetItems(q);w(x,q,l)};this.dialogExists=function(g){return b(g).length>0};this.refresh=function(g,l,q){ITMgetItems($("div.ANNpopup")).each(function(){var x=$(this),D=x.data("Id");if(!x.data("ContentIsStatic"))if(q)s({ErrorMessage:"Script did not finish executing because it was cancelled by the user."},x);else if(ITM_ERROR_STACK_ID==D)y(l,x);else g[D]?
n(g[D],x):s({ErrorMessage:"Unknown error."},x)})};this.getFullArgumentRequests=function(g){var l=ITMgetItems($("div.ANNpopup"));ITMitemsToRequests(l,g)};this.beforeRefresh=function(){$("div.ANNpopup").each(function(){var g=ITMgetItems($(this));g.data("ContentIsStatic")||t($(this),g,"waiting")})};this.init=function(g){G=g;N=G.ifware.ChannelGuid+"_"+G.ifware.User;T=N+"_PopupTop";F=N+"_PopupLeft";P=N+"_PopupWidth";U=N+"_PopupHeight";Q=N+"_OpenedPopup";POPdialogsController.setEditorDimensions();p();$(window).resize(function(){POPdialogsController.setEditorDimensions();
POPdialogsController.moveDialogs()})};this.dialogFromExisting=function(g){var l=g.data("LabelClass"),q=g.siblings().detach(),x=r(g);x.append(q);t(x,g,l);ITMtriggerScrollEvent(x);ITMpushItemToCookie(Q,g)};this.closeFrontmostPopup=function(){if(o.length>0){var g=o.pop();b(g).dialog("close");return true}return false};this.setAnnotationToDefaultForAutoScriptExecutionDisabled=function(g){s({ChunkInfo:{Chunks:[{ChunkNumber:0,Value:'To display this object <a href="#" class="execScriptButton executeNowText">run the script now</a>.'}],
TotalChunks:1,LinesInLastChunk:7},title:"&nbsp;",file_name:"",funct_name:"",call:1,line:-1},g);g=$(".execScriptButton");g.unbind("click");g.click(function(l){l.preventDefault();$(ifware).trigger("ExecuteScriptOnce")})}}var POPdialogsController=new POPdialogs;if(!Function.prototype.bind)Function.prototype.bind=function(a){if(typeof this!=="function")throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,e=function(){},d=function(){return c.apply(this instanceof e&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};e.prototype=this.prototype;d.prototype=new e;return d};function encode_utf8(a){return unescape(a.replace(/\\u/g,"%u"))}
var ProjectManager22=function(a,b,c,e){function d(z,E,K){if(typeof E[z]==="object"&&!E[z].type){K=K.add(z,"dir").open();z=="shared"&&K.parents().length==0&&K.makeSection();for(var u in E[z])E[z].hasOwnProperty(u)&&d(u,E[z],K);K.setCallbacks(j())}else if(E[z]==="C"){K=K.add(z,"dir",j()).close();z=="shared"&&K.parents().length==0&&K.makeSection()}else{u=E[z].status;if(!D)if(u=="notyet")D=true;if(!H)if(X.test(u))H=true;K.add(z,"file "+E[z].combined,{Click:w,Context:s},E[z]).setLeaf();if(E[z].current)ifware.Editor.ifware.CurrentSourceHash=
E[z].sourceHash}}function f(z){H=D=false;m_Timeout=0;var E=l=(new Tree22(q,"boss",j())).open();z=z.file_info;for(var K=0;K<4;K++){var u=z[K],A;for(A in u)d(A,u,E)}if(!H)if(X.test(z[4]["project.prj"].status))H=true;A=$("#"+g).scrollTop();$("#"+g).remove();o.prepend("<div id='"+g+"'></div>");E.render($("#"+g),Z);$("#"+g).scrollTop(A);ifware.Editor.ifware.projectSettings.projectTree(encode_utf8(JSON.stringify(n(l))));if(D){W=false;v()}else{h();!W&&ifware.Editor.ifware.projectSettings.disableAutoScriptExecution()&&
setTimeout(v,2E3);W=false}}function h(){var z=$("#sourceControlSection a#commit");if(H==true){z.unbind("click");z.click(function(E){E.preventDefault();NISsave(ifware.Editor,SCMcallStage,NISminUrlParams(Params,"StageCommit"))});z.removeClass("disabled").addClass("enabled")}else{z.unbind("click");z.click(function(E){E.preventDefault();return false});z.removeClass("enabled").addClass("disabled")}}function j(){return{Click:t,ContextClick:r}}function p(z){if(z.isBranch()){var E=z.parents();z!=l&&E.push(z);
return(z=$.map(E,function(K){return K.label()}).join("/"))?z+"/":""}else return z.getValue("path")}function n(z,E){var K=E||{};if(z.isBranch()&&z.isOpen())for(var u=z.size(),A=0;A<u;A++){var I=z.child(A);if(I.isBranch())if(I.isOpen())K[I.label()]=n(I);else K[I.label()]="C"}return K}function t(z){z.toggle();ifware.Editor.ifware.projectSettings.projectTree(encode_utf8(JSON.stringify(n(l))));z.isOpen()&&v()}function w(z){if(!z.getValue("current"))if(z.getValue("editable")){if(z.isWaiting())z.endWait();
else{z.wait();var E=z.getValue("path"),K=location.href;K=K.replace(/&Module=[^&]*/g,"");location.href=K+"&Module="+E}return z}}function s(z,E){var K=E.offset();if(!(!K||ifware.PopupJustRemoved&&E.hasClass("current-context"))){E.addClass("current-context");$("div.PRJfileContextMenu").remove();var u=$('<div class="PRJfileContextMenu"><div class="PRJleft" /><div class="PRJinner" /></div>'),A=u.find("div.PRJinner");E.closest("li");var I={"Change History":{ClassName:"PRJoptionFileHistory",Action:y},"Export Project":{ClassName:"PRJoptionDownload",
Action:C},"Import Project":{ClassName:"PRJoptionUpload",Action:B},Remove:{ClassName:"PRJoptionRemove",Action:G},Get:{ClassName:"PRJoptionDownload",Action:N},Replace:{ClassName:"PRJoptionUpload",Action:T},"Create DB Tables":{ClassName:"optionCreateDbTables",Action:function(ba){IGNMPRexportTablesExecute(p(ba),x)}}},J=["Get","Replace"];J.push("Change History");if(z.label()=="main.lua"&&z.parents().length==0){J.push("Export Project");J.push("Import Project")}else J.push("Remove");z.getValue("type")==
"vmd"&&J.push("Create DB Tables");for(var R=0;R<J.length;R++){var O=J[R],aa=$('<a href="#"><div class="'+I[O].ClassName+'">'+O+"</div></a>").appendTo(A);(function(ba,ca){aa.click(function(da){$(u).remove();da.preventDefault();ca(ba)})})(z,I[O].Action)}var M,Y=function(ba){ba.remove();ifware.PopupJustRemoved=true;setTimeout(function(){ifware.PopupJustRemoved=false;$(".current-context").removeClass("current-context")},500)};u.appendTo(document.body).bind("mouseout, mouseleave",function(){Y(this)});
u.css("left",K.left+12+"px");u.css("top",K.top+1+"px");u.fadeIn("fast");M=setInterval(function(){if(!u.is(":hover")){Y(u);clearInterval(M)}},200)}}function r(z){function E(M,Y){switch(Y.newTab.index()){case 0:O.dialog("option","buttons",aa.Existing);break;case 1:O.dialog("option","buttons",aa.Create);break;case 2:O.dialog("option","buttons",aa.Upload)}}function K(M,Y){switch(Y.newTab.index()){case 0:O.dialog("option","buttons",aa.Create);break;case 1:O.dialog("option","buttons",aa.Upload)}}$("#PRJaddFileDialog").remove();
var u="all",A=z.parents();if(A[0])u=A[0].label();var I="",J=p(z),R=J;A=false;if(z.label()=="shared"||z.label()=="other"){A=true;u=z.label()}z='<div id="PRJaddFileDialog">      <div id="PRJaddFileTabs"><ul>';if(A)z+='<li><a href="#PRJtabExisting">Add existing</a></li>';z+='<li><a href="#PRJtabCreate">Create a new file</a></li><li><a href="#PRJtabUpload">Upload a file</a></li></ul>       <div id="PRJtabScreenSet">';if(A)z+='<div id="PRJtabExisting"><fieldset><legend>Select an existing shared file from the library</legend><div id="PRJExistingTank"></div></div>';
z+='        <div id="PRJtabCreate">         <fieldset><legend>Type the name of the new file:</legend>          <input type="text" id="PRJnewFileName" />          <div id="PRJcorrectedFileName" />         </fieldset>        </div>        <div id="PRJtabUpload">         <fieldset><legend>Select a file to upload:</legend>          <form>           <input type="file" name="NewFile" id="PRJuploadFileField" size="15" />           <input type="hidden" name="ChannelGuid" value="'+x+'" />          </form>         </fieldset>         <fieldset><legend>(Optional) put the file in a new folder:</legend>          <input type="text" id="PRJfolderName" />          <div id="PRJcorrectedPath" />         </fieldset>         </div>        </div>       <div id="PRJnewModuleError" class="PRJerror"></div>      </div>';
var O=$(z);O.find("#PRJnewFileName").bind("change blur input keyup",function(){var M=$.trim($(this).val());$.ajax({url:"/ann/normalize_path",data:{translator_guid:x,path:J+M,is_file:1},dataType:"json",success:function(Y){$("#PRJcorrectedFileName").html('<span class="advice">Will be created as: </span><br><strong>'+Y.normal_path+"</strong>")}})});O.find("#PRJfolderName").bind("change blur input keyup",function(){R=J;var M=$.trim($(this).val());if(M){R+=M;R+="/"}$.ajax({url:"/ann/normalize_path",data:{translator_guid:x,
path:R},dataType:"json",success:function(Y){$("#PRJcorrectedPath").html('<span class="advice">Will create folder: </span><br><strong>'+Y.normal_path+"</strong>")}})});var aa={Existing:{Cancel:function(M){M.preventDefault();$(this).dialog("close")}},Create:{Cancel:function(M){M.preventDefault();$(this).dialog("close")},"Add file":function(){U(J,O,O.find('input[type="text"]#PRJnewFileName'),$(this))}},Upload:{Cancel:function(){$(this).dialog("close")},"Add file":function(){P(R,O.find("form"),O,O.find('input[type="file"]#PRJuploadFileField'))}}};
O.find("#PRJaddFileTabs").tabs({activate:A?E:K});A&&Ajax.get("/ann/list_files",{translator_guid:x,file_type:u},function(M){if(M.ErrorMessage)I='<span class="PRJerror">Could not retrieve list of existing files. Reason:<br />'+M.ErrorMessage+"</span>";else if(M.length){I+='<select class="PRJexistingList"><option value=""></option>';for(var Y=0;Y<M.length;Y++){var ba=PAGhtmlEscape(M[Y]);I+='<option value="'+ba+'">'+ba+"</option>"}I+="</select>"}else I="There are no existing files.";$("#PRJExistingTank").html(I);
$("select.PRJexistingList").change(function(){Q($("#PRJaddFileDialog"),$(this))})});O.appendTo("body").dialog({modal:true,title:"Add a file"+(J?" to "+J:""),resizable:false,width:400,buttons:A?aa.Existing:aa.Create});O.find('input[type="text"]').keypress(function(M){if((window.event?event.keyCode:M.keyCode)==13)O.dialog("option","buttons")["Add file"].apply(O)})}function y(z){var E=NISminUrlParams(Params,"ReviewCommits");E.one_file=p(z);NISsave(ifware.Editor,SCMcallReview,E)}function C(){!ifware.Editor.ifware.UsesParameter||
ifware.Editor.ifware.CountOfSampleData==0?SCMexportRequest(x,false):SCMincludeSampleConfirm(x)}function B(){NISsave(ifware.Editor,function(z){SCMimportProjectAndData(z,Z)})}function G(z){$("#EDTconfirmDialog").remove();var E={};E.No=function(){$(this).dialog("close")};E.Yes=function(){V(z,$(this))};$('<div id="EDTconfirmDialog"><p>Are you sure you want to remove this file from the project?</p>         <p>Warning: if the file is still in use by your script, it will be automatically added to the project again.</div>').appendTo("body").dialog({title:"Remove File",
width:375,modal:true,draggable:false,resizable:false,buttons:E})}function N(z){window.open("/ann/download_project_file?FilePath="+encodeURIComponent(p(z))+"&FileLabel="+encodeURIComponent(z.label())+"&FileType="+encodeURIComponent(z.getValue("type"))+"&translator_guid="+x)}function T(z){F(z,true)}function F(z,E){$("#PRJuploadDialog").remove();var K='<div id="PRJuploadDialog">                     <form>                     <input type="file" name="NewFile" />                     <input type="hidden" name="translator_guid" value="'+
x+'" />                     <input type="hidden" name="file_label" value="'+PAGhtmlEscape(z.label())+'" />                     <input type="hidden" name="file_path" value="'+PAGhtmlEscape(p(z))+'" />                     <input type="hidden" name="file_type" value="'+PAGhtmlEscape(z.getValue("type"))+'" />                     </form>                     </div>',u=$(K).appendTo("body"),A=u.find("form");E&&A.append('<input type="hidden" name="import_type" value="Replace" />');var I=A.find('input[type="file"]');
I.change(function(){S(z,A,$(I),u)});u.dialog({modal:true,title:"Replace "+PAGhtmlEscape(p(z)),minHeight:85,resizable:false,buttons:{Cancel:function(){u.dialog("close")}}})}function P(z,E,K,u){K.dialog("option","buttons",{});K.bind("dialogbeforeclose",function(){return false});var A=u.val().split("\\").pop();$('<input type="hidden" name="translator_guid" value="'+x+'" />').appendTo(E);$('<input type="hidden" name="file_label" value="'+A+'" />').appendTo(E);$('<input type="hidden" name="file_path" value="'+
z+A+'" />').appendTo(E);AFUuploadFile("/ann/upload_project_file",E,function(){u.attr("disabled","disabled").after('<img class="FileThrobber" src="/js/mapper/images/spinner.gif" />')},function(I){K.unbind("dialogbeforeclose");if(I.ErrorMessage){K.html('<span class="PRJerror">'+I.ErrorMessage+"</span>");$("img.FileThrobber").remove();K.dialog("option","buttons",{OK:function(){K.dialog("close")}})}else L(I.FileLabel,K,true)})}function U(z,E,K,u){var A=$.trim(K.val());if(A=="")E.find("#PRJnewModuleError").text("You must enter a name for the new module.");
else{E.find("#PRJnewModuleError").text("");K.attr("disabled","disabled");u.css("display","none").after('<img class="FileThrobber" src="/js/mapper/images/spinner.gif" />');E.bind("dialogbeforeclose",function(){return false});L(z+A,E)}}function Q(z,E){var K=E.val();if(K!=""){E.attr("disabled","disabled").after('<img class="FileThrobber" src="/js/mapper/images/spinner.gif" />');z.bind("dialogbeforeclose",function(){return false});L(K,z,true)}}function L(z,E,K){z={translator_guid:x,file_path:z};if(K)z.after_upload=
1;Ajax.post("/ann/add_project_file",z,function(u){E.unbind("dialogbeforeclose");if(u.ErrorMessage){E.html('<span class="PRJerror">'+u.ErrorMessage+"</span>");$("img.FileThrobber").remove();E.dialog("option","buttons",{OK:function(){E.dialog("close")}})}else if(u.success){v();NISupdateAnnotations(ifware.Editor);E.dialog("close")}},"json")}function V(z,E){E.html('<img class="FileThrobber" src="/js/mapper/images/spinner.gif" /> Removing '+PAGhtmlEscape(p(z))+"...");z.wait();E.dialog("option","buttons",
{});E.bind("dialogbeforeclose",function(){return false});var K={};K.translator_guid=x;K.FilePath=p(z);Ajax.post("/ann/remove_project_file",K,function(u){E.unbind("dialogbeforeclose");if(u.ErrorMessage){E.html('<span class="PRJerror">'+u.ErrorMessage+"</span>");$("img.FileThrobber").remove();E.dialog("option","buttons",{OK:function(){E.dialog("close")}})}else{E.dialog("close");if(z.getValue("current")){u=location.href;u=u.replace(/&Module=[^&]*/g,"");location.href=u}else{v();NISupdateAnnotations(ifware.Editor)}}},
"json")}function S(z,E,K,u,A){if(A||m(z,K,function(){S(z,E,K,u,true)})){u.dialog("option","buttons",{});u.bind("dialogbeforeclose",function(){return false});AFUuploadFile("/ann/upload_project_file",E,function(){K.attr("disabled","disabled").after('<img class="FileThrobber" src="/js/mapper/images/spinner.gif" />')},function(I){u.unbind("dialogbeforeclose");if(I.ErrorMessage){u.html('<span class="PRJerror">'+I.ErrorMessage+"</span>");$("img.FileThrobber").remove();u.dialog("option","buttons",{OK:function(){u.dialog("close")}})}else{u.dialog("close");
ifware.Editor.ifware.CurrentFileName==p(z)?NISreloadCurrentFile(ifware.Editor):NISupdateAnnotations(ifware.Editor)}})}}function m(z,E,K){var u=/\.\w+$/,A=u.exec(p(z));E=u.exec(E.val());A=A?A[0]:"no extension";E=E?E[0]:"no extension";if(A==E)return true;else{$("#PRJextensionWarning").remove();var I=$('<div id="PRJextensionWarning">                               <p class="PRJerror">The file extension of the existing file ('+A+") does not match the extension of the new file ("+E+").</p>                               <p>Are you sure you want to replace the contents of "+
PAGhtmlEscape(p(z))+" with the contents of the new file?</p>                               </div>").appendTo("body");z={};z.Cancel=function(){I.dialog("close")};z.Replace=function(){I.dialog("close");K&&K()};I.dialog({modal:false,width:375,title:"File Extensions Don't Match",draggable:false,resizable:false,buttons:z});return false}}function v(z){if(W)return false;W=true;Ajax.post("/ann/project_tree",{translator_guid:x,ghost:true,dirtree:ifware.Editor.ifware.projectSettings.projectTree()},f,"json")}
var o=a,g=b,l={},q=c,x=e,D=false,H=false,W=false,Z=this,X=/^edited|new|deleted|missing$/;this.freshen=function(){v()};this.usesContext=function(){return true};this.handleProjectUpload=function(z,E,K){E.dialog("option","buttons",{});E.bind("dialogbeforeclose",function(){return false});var u=K.val().split("\\").pop();$('<input type="hidden" name="translator_guid" value="'+x+'" />').appendTo(z);$('<input type="hidden" name="file_path" value="'+u+'" />').appendTo(z);$('<input type="hidden" name="import_type" value="ImportZippedProject" />').appendTo(z);
AFUuploadFile("/ann/upload_project_file",z,function(){K.attr("disabled","disabled").after('<img class="FileThrobber" src="/js/mapper/images/spinner.gif" />')},function(A){E.unbind("dialogbeforeclose");if(A.ErrorMessage){E.html('<span class="PRJerror">'+A.ErrorMessage+"</span>");$("img.FileThrobber").remove();E.dialog("option","buttons",{OK:function(){E.dialog("close")}})}else{E.dialog("close");SCMactivateUploadedZip(ifware.Editor,A.FileLabel)}})}};var CurrentChunk=0;
function SPDview(a){var b={Guid:PAGgetField(a,"ChannelGuid"),Name:PAGgetOptionalField(a,"ChannelName")},c=MAPretrieveHeaderHTML("message_preview",a);c+='<div class="content_main">';c+='<div class="EDTtoolbar_wrapper">';c+='<div class="back"><span class="label">';c+="&larr; Back to:&nbsp;&nbsp;";c+=PAGlink("OpenEditor",MAPretrieveParams("lua_editor",a),"Script");c+="</span></div>";c+='<span class="heading">Sample Data</span>';c+="</div>";c+='<div class="SPDnavPane"></div>';c+='<div class="SPDnavPanePadding"></div>';c+=
'<div class="SPDdataTable"></div>';c+='<div id="status"></div>';c+="</div>";$("body").html(c);SPDimportDialog(b,a);if(!a.Chunk&&!a.Index)a.Chunk=0;a.MPRapp=MPRapp.type;Ajax.post("/ann/sample_preview",a,function(e){SPDrenderEncodings(e);SPDrenderSampleDataView(e,a)},"json")}
function SPDrenderEncodings(a){function b(e){$.each(a.Encodings,function(d,f){f.Name&&f.Desc&&e(f)&&$("<option></option>").val(f.Name).text(f.Desc).appendTo(c)})}var c=$('select[name="SPDimportEncoding"]');b(function(e){return e.Default});c.append('<option value="">Binary (no conversion)</option>');c.append('<option value="no encoding selected">--</option>');b(function(e){return!e.Default})}
function SPDpreviewRow(a,b,c){c.NewMsg=0;c.Index=a.index+1;return"<tr"+(b?' class="SPDnewRow"':"")+'><td class="SPDindex">'+c.Index+'&nbsp;<td class = "SPDdeleteRow"><input type = "checkbox" class = "SPDdeleteBox" value = "'+c.Index+'" /><td class = "SPDsampleName" onclick = "location.href = \''+PAGhref("EditSampleData",c)+'\';" style = "cursor:pointer;width:200px;" title="Click to edit this message">'+a.name+'</td><td class = "SPDsampleText" onclick = "location.href = \''+PAGhref("EditSampleData",
c)+'\';" style = "cursor:pointer;" title="Click to edit this message">'+a.text+'</td> <td><a href="/ann/sample_data?download=1&translator_guid='+c.translator_guid+"&Index="+c.Index+'">Download</a></td></tr>'}function SPDbutton(a,b,c,e){c.Index=c.Chunk*50+1;return e?'<a class="action-button-small blue" href="'+PAGhref(a,c)+'">'+b+"</a>":'<a class="action-button-small blue" style="opacity: 0.4;">'+b+"</a>"}
function SPDupdateSampleDataView(a,b){if(a)if(a.ErrorMessage)MPRapp.renderError(a.ErrorMessage,b);else{CurrentChunk=a.Chunk;var c=a.CountOfChunk-1,e=a.CountOfMessage+" Messages";if(a.CountOfMessage)e=a.ChunkBegin+1+" to "+(a.ChunkEnd+1)+" of "+e;delete b.Index;var d=b.SavedMsgIndex;delete b.SavedMsgIndex;b.Chunk=0;var f=SPDbutton("SampleData","&lt;&lt;",b,CurrentChunk>0);b.Chunk=Math.max(0,CurrentChunk-1);var h=SPDbutton("SampleData","&lt;",b,CurrentChunk>0);b.Chunk=Math.min(c,CurrentChunk+1);var j=
SPDbutton("SampleData","&gt;",b,CurrentChunk<c);b.Chunk=c;c=SPDbutton("SampleData","&gt;&gt;",b,CurrentChunk<c);delete b.Chunk;b.TotalSd=a.CountOfMessage;var p='<input type="checkbox" class = "DeleteAll" value="abc"/><a class="SPDdeleteBTN action-button-small blue">Delete</a>';p+="<span>"+f+h+'<span class="SPDnavText">'+e+"</span>"+j+c+"</span>";p+='<a class="SPDimportBTN action-button-small blue">Import</a>';p+='<a class="SPDaddBTN action-button-small blue" href="">Add</a>';$("div.SPDnavPane").html(p);
e='<table id="sample_data_table" class="SPDdataTable">';f=a.Previews.length;h=a.Imported;for(j=0;j<f;j++)e+=SPDpreviewRow(a.Previews[j],SPDisNew(a,j,d),b);e+="</table>";$("div.SPDdataTable").html(e);SPDrowClickRegister();SPDpopulateAddNewSample(b,a.CountOfMessage);SPDalertBox("No messages are selected");SPDconfirmationDialog();$(".DeleteAll").change(function(){var n=$(this).prop("checked");$("input[class = SPDdeleteBox]").attr("checked",n)});$("input[class = SPDdeleteBox]").change(function(){$(this).prop("checked")==
false&&$("input[class = DeleteAll]").prop("checked",false)});$("a.SPDdeleteBTN").click(function(){if($("input[class = DeleteAll]:checked").length)b.TotalSd>0?$("#ConfirmBox").dialog("open").text("Delete all "+b.TotalSd+" messages?"):$("#AlertBox").dialog("open");else $("input[class = SPDdeleteBox]:checked").length==0?$("#AlertBox").dialog("open"):$("#ConfirmBox").dialog("open").text("Delete selected messages?")});$(".SPDimportBTN").click(function(){$(".SPDuploadDlg").dialog("open")});$("div#file_chooser").html('<input type="file" class="medium" id="import_file" name="ImportFile" />');
$("#status").html("");$("input#SPDimportOverwrite").prop("checked",false);$("div#SPDimportOverwriteContainer").toggle(f>0);if(h){d=$("#status");d.html('<span class="SPDsuccessMessage">'+a.Imported+" message"+(a.Imported!=1?"s":"")+" imported.</span>");d.get(0).scrollIntoView(false)}$("tr.SPDnewRow").each(function(){var n=$(this);n.removeClass("SPDnewRow");n.css("background-color","#C6FF83");setTimeout(function(){n.animate({"background-color":"#FDFDFD"},2E3)},4E3)})}else MPRapp.renderError("Unable to get sample data from server. Check if it is running.",
b)}
function SPDrenderSampleDataView(a,b){function c(){w.fadeTo("fast",0.5);w.append('<div class="SPDnavPaneBlocker"><img src="/js/mapper/images/spinner_wide.gif" /></div>');w.find("div.SPDnavPaneBlocker img").fadeIn("slow")}if(a.ErrorMessage)MPRapp.renderError(a.ErrorMessage,b);else{var e={Guid:PAGgetField(b,"ChannelGuid"),Name:PAGgetOptionalField(b,"ChannelName")};CurrentChunk=a.Chunk;var d=a.CountOfChunk-1,f=a.CountOfMessage+" Messages";if(a.CountOfMessage)f=a.ChunkBegin+1+" to "+(a.ChunkEnd+1)+" of "+
f;delete b.Index;var h=b.SavedMsgIndex;delete b.SavedMsgIndex;b.Chunk=0;var j=SPDbutton("SampleData","&lt;&lt;",b,CurrentChunk>0);b.Chunk=Math.max(0,CurrentChunk-1);var p=SPDbutton("SampleData","&lt;",b,CurrentChunk>0);b.Chunk=Math.min(d,CurrentChunk+1);var n=SPDbutton("SampleData","&gt;",b,CurrentChunk<d);b.Chunk=d;d=SPDbutton("SampleData","&gt;&gt;",b,CurrentChunk<d);delete b.Chunk;b.TotalSd=a.CountOfMessage;var t='<input type = "checkbox" class = "DeleteAll"  value = "abc"/><a class="SPDdeleteBTN action-button-small blue">Delete</a>';
t+="<span>"+j+p+'<span class="SPDnavText">'+f+"</span>"+n+d+"</span>";t+='<a class="SPDimportBTN action-button-small blue">Import</a>';t+='<a class="SPDaddBTN action-button-small blue" href = "">Add</a>';$("div.SPDnavPane").html(t);f='<table id="sample_data_table" class="SPDdataTable">';j=a.Previews.length;for(p=0;p<j;p++)f+=SPDpreviewRow(a.Previews[p],SPDisNew(a,p,h),b);f+="</table>";$("div.SPDdataTable").html(f);SPDrowClickRegister();SPDpopulateAddNewSample(b,a.CountOfMessage);SPDalertBox("No messages are selected");
SPDconfirmationDialog();$(".DeleteAll").change(function(){var s=$(this).prop("checked");$("input[class = SPDdeleteBox]").prop("checked",s)});$("input[class = SPDdeleteBox]").change(function(){$(this).prop("checked")==false&&$("input[class = DeleteAll]").prop("checked",false)});$("a.SPDdeleteBTN").click(function(){if($("input[class = DeleteAll]:checked").length)b.TotalSd>0?$("#ConfirmBox").dialog("open").text("Delete all "+b.TotalSd+" messages?"):$("#AlertBox").dialog("open");else $("input[class = SPDdeleteBox]:checked").length==
0?$("#AlertBox").dialog("open"):$("#ConfirmBox").dialog("open").text("Delete selected messages?")});$(".SPDimportBTN").click(function(){$(".SPDuploadDlg").dialog("open")});0>=j&&$("div#SPDimportOverwriteContainer").hide();h=$("tr.SPDnewRow");h.each(function(){var s=$(this);s.removeClass("SPDnewRow");s.css("background-color","#C6FF83");setTimeout(function(){s.animate({"background-color":"#FDFDFD"},2E3)},4E3)});h.length>0&&h.last().children("td").first().get(0).scrollIntoView(false);var w=$("div.SPDnavPane");
w.find("a").click(function(){this.href!=""&&c()});a.CountOfMessage&&w.find("span.SPDnavText").click(function(){var s=$("div.SPDgoto");if(s.size())s.remove();else{s=$('<div class="SPDgoto">Go to <input type="text" class="SPDgotoInput" /><img src="/js/mapper/images/ok.png" /></div>');$("body").append(s);var r=w.offset();s.css("left",r.left+(w.outerWidth()-s.outerWidth())/2);s.css("top",r.top+w.outerHeight());var y=s.find("input");y.val(a.ChunkBegin+1);y.focus();y.select();var C=function(){var B=parseInt(y.val());
if(isNaN(B)||B<1)B=1;else if(B>a.CountOfMessage)B=a.CountOfMessage;B--;if(a.Index!=B){window.location=PAGhref("SampleData",{ChannelGuid:e.Guid,ChannelName:e.Name,Index:B});c()}s.remove()};y.keydown(function(B){if(B.keyCode=="13")C(B);else B.keyCode=="27"&&s.remove()});s.find("img").click(C)}})}}
function SPDonImportBegin(a){$("#status").html('<img src="/js/mapper/images/spinner.gif" />');$("#import_file").prop("disabled",true);a=a.find("a[id='SPDimportButton']");a.attr("href","javascript:void(0);");a.css({opacity:".5",cursor:"default"})}function SPDdeleteSampleData(a,b){Ajax.post("/ann/delete_sample_data",{translator_guid:b,Ids:a},function(c){c.ErrorMessage?$("#status").html('<span class="SPDerrorMessage">'+c.ErrorMessage+"</span>"):SPDloadPage()})}
function SPDdeleteSampleDataAll(a){Ajax.post("/ann/delete_sample_data_all",{translator_guid:a},function(b){b.ErrorMessage?$("#status").html('<span class="SPDerrorMessage">'+b.ErrorMessage+"</span>"):SPDloadPage()})}function SPDloadPage(){delete Params.Index;Params.Chunk=CurrentChunk;Ajax.post("/ann/sample_preview",Params,function(a){SPDrenderEncodings(a);SPDupdateSampleDataView(a,Params)},"json")}
function SPDpopulateAddNewSample(a,b){a.Index=b+1;a.NewMsg=1;$("a.SPDaddBTN").attr("href",PAGhref("EditSampleData",a))}function SPDconfirmationDialog(){$("#ConfirmBox").remove();$(document).find("body").append('<div id="ConfirmBox" align="center"></div>');var a={};a.Delete=function(){SPDconfirmAction()};a.Cancel=function(){$(this).dialog("close")};$("#ConfirmBox").dialog({bgiframe:true,width:300,height:130,title:"Confirm",modal:true,autoOpen:false,buttons:a})}
function SPDconfirmAction(){if($("input[class = DeleteAll]:checked").length)SPDdeleteSampleDataAll(PAGgetField(Params,"ChannelGuid"));else{var a=[];$("input[class = SPDdeleteBox]:checked").each(function(){a.push($(this).val())});SPDdeleteSampleData(JSON.stringify(a),PAGgetField(Params,"ChannelGuid"))}$("#ConfirmBox").dialog("close")}
function SPDalertBox(a){$("#AlertBox").remove();$(document).find("body").append('<div id="AlertBox" align = "center">'+a+"</div>");$("#AlertBox").dialog({bgiframe:true,width:250,height:130,title:"Alert",modal:true,autoOpen:false,buttons:{OK:function(){$(this).dialog("close")}}})}
function SPDrowClickRegister(){$(".SPDsampleName").hover(function(){$(this).addClass("SPDrowHover");$(this).next().addClass("SPDrowHover")},function(){$(this).removeClass("SPDrowHover");$(this).next().removeClass("SPDrowHover")});$(".SPDsampleText").hover(function(){$(this).addClass("SPDrowHover");$(this).prev().addClass("SPDrowHover")},function(){$(this).removeClass("SPDrowHover");$(this).prev().removeClass("SPDrowHover")})}
function SPDimportDialog(a,b){$(".SPDuploadDlg").remove();$(document).find("body").append('<div class = "SPDuploadDlg"><form class="SPDuploadForm"><input type="hidden" name="MPRapp" value="'+MPRapp.type+'" /><input type="hidden" name="translator_guid" value="'+a.Guid+'" /><table class="import_table"><tr><td>Message file:</td><td><div id="file_chooser"><input type="file" class="medium" id="import_file" name="import_file" /></div></td></tr><tr><td>File encoding:<td><select name="SPDimportEncoding"></select><tr><td></td><td style="padding-top:0px;"><div id="SPDimportOverwriteContainer"><input type="checkbox" name="spd_import_overwrite" id="SPDimportOverwrite" style="margin:0px;">&nbsp;Overwrite all existing samples</div></td></tr></table></form></div>');
var c={};c.Import=function(){$(".SPDuploadDlg").dialog("close");AFUuploadFile("/ann/import_sample_data",$("form.SPDuploadForm"),SPDonImportBegin,SPDupdateSampleDataView,b)};c.Cancel=function(){$(".SPDuploadDlg").dialog("close")};$(".SPDuploadDlg").dialog({bgiframe:true,width:360,height:201,title:"Import Messages",modal:true,autoOpen:false,buttons:c})}function SPDisNew(a,b,c){var e=a.Previews.length,d=a.Imported;a=a.ChunkBegin;return d&&b>=e-d||c&&a+b+1==c};var sample={};sample.toolbar={};IFW=IFW||{};IFW.$SdePopup=null;IFW.Sde=null;IFW.SdeDialogSelector=".sde-dialog";IFW.SdeDialogClass=IFW.SdeDialogSelector.substr(1);IFW.SdeDialogWrapperSelector=".sde-dialog-wrapper";IFW.PopupIsOpen=false;IFW.MessageName=null;IFW.MessageIndex=null;IFW.TranslatorGuid=null;IFW.LoadingSDEmessage=false;
sample.toolbar.build=function(a,b,c,e,d,f,h){function j(){$(".ui-dialog-titlebar").find(".ui-dialog-titlebar-close").addClass("alt-button-style").end().append('<a class="alt-button-style ui-dialog-titlebar-maximize ui-corner-all ui-state-default">  <span class="ui-icon ui-icon-arrowthick-2-ne-sw" title="maximize">maximize</span></a>').find(".ui-dialog-titlebar-maximize").attr("role","button").mouseover(function(){$(this).addClass("ui-state-hover")}).mouseout(function(){$(this).removeClass("ui-state-hover")}).click(p)}
function p(){IFW.$SdePopup=null;var r=$("a#edit_message").attr("href"),y=PAGparseAnchorString(location.href).Module;if(y)var C=r.replace(/&Module=[^&]*/g,"&Module="+y);if(!IFW.Sde.isClean())try{ifware.storage.set("CurrentMessageWithEdits",IFW.Sde._CodeMirror.getValue(),1)}catch(B){$("<div><p>Please save this message first, then maximize it.</p></div>").dialog({buttons:{OK:function(){$(this).dialog("close")}},width:325});return false}location.href=C||r}function n(){var r={Message:IFW.Sde.getValue(),
Name:IFW.MessageName,Index:IFW.MessageIndex,translator_guid:IFW.TranslatorGuid};$(':button:contains("Save")').prop("disabled",true).addClass("ui-state-disabled");Ajax.post("/ann/update_sample_data",r,IFW.messageSaveHandler,"json")}c.BackToEditor=true;var t=d?BTNtoolbar("EditSampleData","Edit Sample Message",c,"off","edit_message","Edit Sample Message"):"";delete c.BackToEditor;var w='<a id="sample_data_link" href="'+PAGhref("SampleData",c)+'"> Sample Data </a>',s="";a.html('<span class="label">'+
(f?w:"Sample Data")+': </span><a href="" class="button_icon connected" id="msg_first" title="First Message">   <span>First   </span></a><a href="" class="button_icon connected" id="msg_prev"  title="Previous Message"><span>Previous</span></a><a href="" class="button_msg '+(f?"enabled":"disabled")+'" '+(f?'title="Go To Message"':"")+"><span>"+(d?e+" of "+d:"None")+'</span></a><a href="" class="button_icon connected" id="msg_next" title="Next Message"><span>Next</span></a><a href="" class="button_icon connected" id="msg_last" title="Last Message"><span>Last</span></a>'+
t);a.find("a#sample_data_link").click(function(){IFW.$SdePopup=null;var r=$(this).attr("href"),y=PAGparseAnchorString(location.href).Module;if(y){r=r.replace(/&Module=[^&]*/g,"&Module="+y);$(this).attr("href",r)}});IFW.messageSaveHandler=function(r){if(!r.ErrorMessage){$(':button:contains("Save")').prop("disabled",false).removeClass("ui-state-disabled");NISupdateAnnotations(b,{ForceReload:true,SendCode:true});IFW.Sde.refresh();IFW.Sde.markClean()}};a.find("a#msg_first").each(function(){sample.toolbar.initNavButton($(this),
!f||e==1,1,b)});a.find("a#msg_prev").each(function(){sample.toolbar.initNavButton($(this),!f||e==1,e-1,b)});a.find("a#msg_next").each(function(){sample.toolbar.initNavButton($(this),!f||e>=d,e+1,b)});a.find("a#msg_last").each(function(){sample.toolbar.initNavButton($(this),!f||e>=d,d,b)});a.find("#msg_first, #msg_prev, #msg_next, #msg_last").click(function(){b.ifware.focusLastFocussedElement()});f&&sample.toolbar.messageTooltip(c);a.find("#edit_message").on("click",function(){IFW.PopupIsOpen=true});
a.find("#msg_first, #msg_prev, #msg_next, #msg_last, #edit_message").on("click",function(r){r.preventDefault();if(!$(this).hasClass("disabled"))if(IFW.PopupIsOpen){$("#msg_first, #msg_prev, #msg_next, #msg_last").addClass("disabled").removeClass("enabled");IFW.LoadingSDEmessage=true;if(IFW.$SdePopup!==null){IFW.$SdePopup.dialog("open");IFW.$SdePopup.dialog("moveToTop")}else{IFW.$SdePopup=$("<div class='"+IFW.SdeDialogClass+"'></div>");IFW.$SdePopup.appendTo("body").dialog({title:"Sample Data Editor",
minWidth:690,minHeight:196,width:800,height:300,dialogClass:"sde-dialog-wrapper",open:function(){IFW.PopupIsOpen=true},close:function(){IFW.PopupIsOpen=false;ifware.storage.remove("CurrentMessageWithEdits")},beforeClose:function(){IFW.Sde._CodeMirror.setValue("")},buttons:[{text:"Save",click:n},{text:"Close",click:function(){$(this).dialog("close")}}]});IFW.Sde=new IFW.SampleDataEditor({ParentSelector:IFW.SdeDialogSelector,onCancel:function(){IFW.$SdePopup!==null&&IFW.$SdePopup.dialog("close");$("#msg_first, #msg_prev, #msg_next, #msg_last").addClass("enabled").removeClass("disabled");
IFW.LoadingSDEmessage=false},onMessageLoadComplete:function(){$("#msg_first, #msg_prev, #msg_next, #msg_last").addClass("enabled").removeClass("disabled");IFW.LoadingSDEmessage=false},CodeMirrorOptions:{lineNumbers:true,autofocus:true,indentUnit:3,tabSize:3,viewportMargin:70}});j()}Ajax.post("/ann/sample_data_info",c,function(y){IFW.TranslatorGuid=y.ChannelGuid;IFW.MessageName=y.Name;IFW.MessageIndex=y.Index;$("textarea#SPDnameEditor").text(y.Name)});r=ifware.storage.get("CurrentMessageWithEdits");
if(r!==null&&r!==""){IFW.Sde.nextMessage(r);ifware.storage.remove("CurrentMessageWithEdits")}else Ajax.post("/ann/sample_data",c,function(y){IFW.Sde.nextMessage(y)})}});sample.toolbar.createMiniBrowser(a,f,d,b,h)};sample.toolbar.messageTooltip=function(a){Ajax.post("/ann/sample_data_info",a,function(b){var c="Go To Message";if(b.Name)c+=" (Current: "+b.Name+")";$(".button_msg").attr("title",c)},"json")};sample.toolbar.updateSampleIndexUrl=function(a){PAGchangeParameter("Index",a.ifware.sampleIndex())};
sample.toolbar.changeSampleData=function(a,b){a.ifware.setSampleIndex(b);sample.toolbar.updateSampleIndexUrl(a);NISupdateSampleDataControl(a);NISupdateAnnotations(a);a.ifware.projectSettings.disableAutoScriptExecution()&&NISmarkAllAnnotationsAsStale(a)};sample.toolbar.initNavButton=function(a,b,c,e){a.addClass(b?"disabled":"enabled");a.click(function(d){d.preventDefault();!b&&!IFW.LoadingSDEmessage&&sample.toolbar.changeSampleData(e,c)})};
sample.toolbar.createMiniBrowser=function(a,b,c,e,d){a.find("a.button_msg").click(function(f){f.preventDefault();if(b){var h=$("div.EDTsd_goto");if(h.size())NIScloseSampleDataMiniBrowser(e,h);else{h=$('<div id="mb-parent" class="EDTsd_goto">'+(c?'<div id="goto-row">Go to <input class="EDTsd_gotoInput"><button id="goto-btn">Go</button></div>':"")+"</div>");$("body").append(h);window.MiniBrowser&&MiniBrowser.create({parent:$("#mb-parent"),source:PAGgetField(Params,"ChannelName"),target:e.ifware.ChannelGuid,
https:d,onOpen:function(){$("#goto-row").hide()},onCancel:function(){NIScloseSampleDataMiniBrowser(e,h)},onStart:function(){NIScloseSampleDataMiniBrowser(e,h)},onSuccess:function(t,w){e.ifware.setCountOfSample(e.ifware.countOfSample()+w);sample.toolbar.changeSampleData(e,t)}});f=$(this.firstChild);var j=f.offset();h.css("left",j.left-1);h.css("top",j.top+f.outerHeight()-1);var p=h.find("#goto-row input");p.val(e.ifware.sampleIndex());p.focus();p.select();var n;n=c?function(){var t=parseInt(p.val());
if(isNaN(t)||t<1)t=1;else if(t>e.ifware.countOfSample())t=e.ifware.countOfSample();sample.toolbar.changeSampleData(e,t);IFW.PopupIsOpen&&$("#edit_message").trigger("click")}:function(){NIScloseSampleDataMiniBrowser(e,h)};p.keydown(function(t){if(t.keyCode=="13")n(t);else t.keyCode=="27"&&NIScloseSampleDataMiniBrowser(e,h)});h.find("#goto-btn").click(n)}}else e.ifware.focusLastFocussedElement()})};var SRHsearchField=function(){return function(a,b){function c(s){if(s===undefined)s=a.getCursor(true);return a.getSearchCursor(m_Query,s,!m_CaseSensitive)}function e(){a.operation(function(){for(var s=c({line:0,ch:0});s.findNext();)m_Matches.push(a.markText(s.from(),s.to(),{className:"searched"}))});m_MatchCountSpan.text(m_Matches.length+" found")}function d(){a.operation(function(){for(var s=0;s<m_Matches.length;s++)m_Matches[s]&&m_Matches[s].clear()});m_Matches.length=0;m_MatchCountSpan.empty()}
function f(){if(document.selection&&document.selection.createRange){var s=document.selection.createRange().duplicate();s.moveEnd("character",m_Input.val().length);if(s.text=="")return m_Input.val().length;return m_Input.val().lastIndexOf(s.text)}else return m_Input[0].selectionStart}function h(){var s=m_Input.val();if(s!==m_PreviousValue){m_PreviousValue=s;d();m_SearchCursor=null;TOOLtooltipClose();m_Query=s;m_CursorPosition=f();if(m_Query===""){b.removeClass("no_match");b.addClass("empty");a.setCursor(a.getCursor(true))}else if(m_Query){e();
n()}m_Input.focus();if(m_Input[0].createTextRange){s=m_Input[0].createTextRange();s.move("character",m_CursorPosition);s.select()}else m_Input[0].setSelectionRange(m_CursorPosition,m_CursorPosition)}}function j(s,r){if(s.top==r.top&&s.left==r.left)return true;if(Math.round(s.top)==r.top&&Math.round(s.left)==r.left)return true;if(Math.round(s.left)==Math.round(r.left)&&Math.round(s.top)-r.top==1)return true;return false}function p(s){s==true&&a.setSelection(m_SearchCursor.from(),m_SearchCursor.to());
var r=$(".CodeMirror-selected").addClass("current_search_match").offset();$(".searched_current").removeClass("searched_current");$(".searched").each(function(){var y=$(this),C=y.offset();if(j(C,r)){y.addClass("searched_current");return false}})}function n(){m_SearchCursor||(m_SearchCursor=c());b.removeClass("empty no_match");if(m_SearchCursor.findNext())p(true);else{m_SearchCursor=c({line:0,ch:0});if(m_SearchCursor.findNext())p(true);else{b.addClass("no_match");a.setCursor(a.getCursor(true))}}}function t(){if($("#SRHoptions").size())$("#SRHoptions").remove();
else{var s=$('<div id="SRHoptions"><div class="SRHcheckboxes"><input id="SRHcaseSensitive" type="checkbox" /><label for="SRHcaseSensitive" title="Toggle case sensitivity">Case sensitive</label><br></div><div class="SRHdivider"></div><div style="position:relative;"><input id="SRHreplacementText" value="" /><br></div><button id="SRHreplaceSingle" title="Replace the current match and move to the next">Replace</button><button id="SRHskipToNext" title="Jump to the next match">Next</button><button id="SRHreplaceAll" title="Replace all occurrences.">Replace All</button></div>');
m_Input.after(s);s.fadeIn(150);var r=b.find(".SRHfield"),y=r.position();s.css("top",y.top+r.outerHeight()-1+"px");s.find("#SRHcaseSensitive").attr("checked",m_CaseSensitive).on("change",function(){m_CaseSensitive=!m_CaseSensitive;COOKIEcreate("SRHcaseSensitive",""+m_CaseSensitive,365);h()});s.find("#SRHreplaceSingle").on("click",function(C){C.preventDefault();if(m_SearchCursor&&m_Matches.length){a.replaceRange($("#SRHreplacementText").val(),m_SearchCursor.from(),m_SearchCursor.to());m_PreviousValue=
"";h()}});s.find("#SRHskipToNext").on("click",function(C){C.preventDefault();n()});s.find("#SRHreplaceAll").on("click",function(C){C.preventDefault();if(m_SearchCursor){C=0;for(var B=$("#SRHreplacementText").val(),G=c({line:0,ch:0});G.findNext();){a.replaceRange(B,G.from(),G.to());++C}h()}})}}function w(s){if(s===undefined)s=true;m_Input.focus();var r=b.find(".SRHfield");r.stop(true,true);s&&r.css("background-color","#A0CFEC").animate({"background-color":"white"},"slow")}b.addClass("empty").html('         <span class="SRHmatchCount"></span>         <div class="SRHfield">         <img id="imgMagnifyingGlass" src="/js/mapper/images/toolbar/icon_search_dropdown.gif" alt="" title="Show/hide search options" />            <input id="SRHsearchText" value="" title="Search the current script"></input>            <img id="imgSearchClear" src="/js/mapper/images/toolbar/icon_search_clear.gif" alt="" title="Clear this field" />         </div>         <a href="" class="button_icon connected enabled" id="search_prev" title="Find Previous"><span>Previous</span></a>         <a href="" class="button_icon connected enabled" id="search_next" title="Find Next"><span>Next</span></a>');
m_SearchCursor=null;m_Matches=[];m_Query="";m_CaseSensitive=COOKIEread("SRHcaseSensitive")=="true";m_Input=b.find("input");m_PreviousValue="";m_CursorPosition=0;m_MatchCountSpan=b.find("span.SRHmatchCount");COOKIEerase("SRHuseRegex");m_Input.keyup(function(){h()}).keydown(function(s){var r=window.event?event.keyCode:s.keyCode;if(r==13){s.preventDefault();if(!b.hasClass("empty")){n();w(false)}}else if(r==27){a.focus();s.preventDefault()}}).blur(function(){TOOLtooltipClose()}).focus(function(){a.ifware.focusLastFocussedElement=
function(){w(false)}});b.find("#imgMagnifyingGlass").click(function(){t()}).end().find("#imgSearchClear").click(function(){$("#SRHoptions").remove();$("#SRHsearchText").val("");h()}).end().find("#search_prev").click(function(s){s.preventDefault();if(!b.hasClass("empty")){m_SearchCursor||(m_SearchCursor=c());b.removeClass("empty no_match");if(m_SearchCursor.findPrevious())p(true);else{s=a.lineCount()-1;var r=a.getLine(s).length;m_SearchCursor=c({line:s,ch:r});if(m_SearchCursor.findPrevious())p(true);
else{b.addClass("no_match");a.setCursor(a.getCursor(true))}}}}).end().find("#search_next").click(function(s){s.preventDefault();b.hasClass("empty")||n()});return{updateSearchMatches:function(){if(m_Query&&m_Query!==""){d();e();p();b.removeClass("no_match")}},focus:w}}}();var SCMreplaceSampleStr="REPLACE_SAMPLE",SCMappendSampleStr="APPEND_SAMPLE",SCM_BUMP_NOTE="Will stop channel",SCM_POPUP_PARAMS={modal:true,minWidth:450,resizable:false,close:function(){$(this).remove()}};if(!Array.prototype.indexOf)Array.prototype.indexOf=function(a,b){for(var c=b||0,e=this.length;c<e;c++)if(this[c]===a)return c;return-1};function SCMcommitDlgGetConflictingFiles(a,b){SCMcheckConflicts(a,b,SCMcommitDlgUI)}
function handleProjectImportError(a){a=a.responseJSON.error?a.responseJSON.error.description:a.status+" - "+a.statusText;$(document).find("body").append($("<div id='scResponseDlg'><div class='sc_error'></div><br/></div>"));var b=$("#scResponseDlg"),c={};c.Close=function(){$(this).dialog("close")};b.dialog({bgiframe:true,width:400,title:"Error",modal:true,autoOpen:false,buttons:c});b.find(".sc_error").text(a);b.find(".sc_error").show();b.dialog("open");return true}
function SCMclearDependencies(a){$.ajax({url:"/sc/clear_dependencies",method:"POST",data:{translator_guid:a.ifware.ChannelGuid},success:function(b){SCMresponseDlgUI(b,false)},error:handleProjectImportError})}function SCMresponseDlgUI(a,b,c){$("#scResponseDlg").length&&$("#scResponseDlg").remove();typeof c=="function"&&c();return false}function SCMgetMainFileLabel(a){for(var b=0;b<a.length;++b)if(a[b].Type=="Main")return a[b].Label;return""}
function SCMgetProjectList(a,b){for(var c=[],e=0;e<a.length;++e)c.push(a[e][b]);return c}function SCMdialogWaiting(a,b){if(b){$(a).dialog("disable");$(a).siblings(".ui-dialog-buttonpane").prepend('<img class="scSpinner" src="/js/mapper/images/spinner.gif" />')}else{$(a).dialog("enable");$(a).siblings(".ui-dialog-buttonpane").children(".scSpinner").remove()}}
function SCMdialogConfirm(a,b){$("#fossilConfirmDlg").length&&$("#fossilConfirmDlg").remove();$(document).find("body").append($("<div id='fossilConfirmDlg'>"+a+"</div>"));var c={};c.No=function(){$(this).dialog("close")};c.Yes=function(){b();$(this).dialog("close")};var e=$("#fossilConfirmDlg");e.dialog({bgiframe:true,title:"Confirmation Request",width:500,modal:true,autoOpen:false,buttons:c});e.dialog("open")}
function SCMrevertConfirmText(){return"Revert operation might overwrite your changes. Are you sure you want to revert?"}
function SCMactivateUploadedZip(a,b){$.ajax({url:"/sc/import_from_zip",method:"POST",data:{translator_guid:a.ifware.ChannelGuid,uploaded_filename:b,data_import_type:a.ifware.DataImportType},error:handleProjectImportError,success:function(c){if(a.ifware.DataImportType==SCMreplaceSampleStr){a.ifware.setCountOfSample(c.CountOfSampleData);a.ifware.setSampleIndex(1);NISchangeSampleData(a,1)}else a.ifware.DataImportType==SCMappendSampleStr&&a.ifware.setCountOfSample(a.ifware.countOfSample()+c.CountOfSampleData);
NISupdateSampleDataControl(a);NISreloadCurrentFile(a)}})}function SCMuploadFile(a,b,c,e,d){d.handleProjectUpload(b,a,c)}function SCMenableImportBTN(a,b){a.dialog("widget").find('button:contains("Import")').button(b)}
function SCMimportProjectAndData(a,b){function c(){$("#ImportZipFileBrowse",e).val()==""&&$("input[name=import_type]:checked",e).val()=="ImportZippedProject"?SCMenableImportBTN(e,"disable"):SCMenableImportBTN(e,"enable")}$("#importProjectAndData").remove();$(document).find("body").append('<div id="importProjectAndData"><form id="importForm"><table><tr><td valign="top"><input type="radio" name="import_type" value="EmptyProject" id="importProjectAndData_importTypeId" class="ImportBlank"></td><td ><label for="importProjectAndData_importTypeId">Use a blank project</label></td><tr><td valign="top"><input type="radio" id="importProjectAndData_projectList" name="import_type" value="ImportProject" class = "ImportFromProject"></td>    <td><label for="importProjectAndData_projectList">Import from existing projects</label>        <br><select name="projectList"></select>'+(a.ifware.UsesParameter?
'        <br><input id="importProjectAndData_importSampleData" type="checkbox" name="importSampleData" checked="checked">        <label for="importProjectAndData_importSampleData">Import sample data</label>':"")+'<tr><td valign="top"><input type="radio" name="import_type" value="ImportZippedProject" id="importProjectAndData_importZipFile" class = "ImportFromZip"></td>    <td><label for="importProjectAndData_importZipFile">Import project from zip file</label><br><input type="file" id="ImportZipFileBrowse" name="NewFile" value = ""/>      <input type="hidden" name="translator_guid" value="'+
a.ifware.ChannelGuid+'" />  '+(a.ifware.UsesParameter?'<br><input id = "importProjectAndData_includeSampleData" type = "checkbox" name = "includeSampleData" checked="checked">  <label for="importProjectAndData_includeSampleData">Import sample data</label>'+(a.ifware.countOfSample()>0?'   <select name="addSampleTypeList"><option value = "APPEND_SAMPLE">Append</option><option value = "REPLACE_SAMPLE">Replace</option></select>':""):"")+'</td></tr></table></form><div class="importError" style="color: red"></div></div>');
var e=$("#importProjectAndData");NISmainFileSelectedAndEmpty(a)?$('input[class = "ImportBlank"]').prop("checked",true):$('input[class = "ImportFromProject"]').prop("checked",true);$("input[name=import_type]",e).click(function(){c()});$("input[name = NewFile]",e).change(function(){SCMenableImportBTN(e,"enable")});$("select[name = projectList]",e).mousedown(function(){$('input[class = "ImportFromProject"]').prop("checked",true);$(".importError").html("");c()});$("input[name = importSampleData]",e).click(function(){$('input[class = "ImportFromProject"]').prop("checked",
true);c()});$("input[name = NewFile]",e).click(function(){$('input[class = "ImportFromZip"]').prop("checked",true);c()});$("input[name = includeSampleData]",e).click(function(){$('input[class = "ImportFromZip"]').prop("checked",true);c()});$("select[name = addSampleTypeList]",e).mousedown(function(){$('input[class = "ImportFromZip"]').prop("checked",true);c()});var d={};d.Import=function(){if("ImportProject"==$("input[name=import_type]:checked",this).val()){a.ifware.CurrentSourceHash=null;var f=$("select[name=projectList] option:selected",
this).val();f||$(this).dialog("close");SCMdialogWaiting("#importProjectAndData",true);f={translator_guid:a.ifware.ChannelGuid,source_guid:f};if($("input[name=importSampleData]:checked",this).length&&a.ifware.UsesParameter)f.import_sample_data="true";$.ajax({url:"/sc/import_from_project",method:"POST",data:f,error:function(j){SCMdialogWaiting("#importProjectAndData",false);j=j.responseJSON.error?j.responseJSON.error.description:j.status+" - "+j.statusText;$(".importError",e).html(j)},success:function(j){SCMdialogWaiting("#importProjectAndData",
false);a.ifware.setCountOfSample(a.ifware.countOfSample()+j.import_count);NISupdateSampleDataControl(a);NISreloadCurrentFile(a);$(e).dialog("close")}})}else if("ImportZippedProject"==$("input[name=import_type]:checked",this).val()){a.ifware.CurrentSourceHash=null;f=e.find("form");var h=f.find('input[type="file"]');a.ifware.DataImportType=$("input[name=includeSampleData]:checked").length&&a.ifware.UsesParameter?$("select[name=addSampleTypeList] option:selected",this).val()=="APPEND_SAMPLE"||a.ifware.countOfSample()==
0?SCMappendSampleStr:SCMreplaceSampleStr:"";SCMuploadFile(e,f,h,a,b)}else{f="";f=MPRapp?" from "+MPRapp.type:"";f=a.ifware.UsesParameter?"-- The main function is the first function called"+f+".\n-- The Data argument will contain the message to be processed.\nfunction main(Data)\nend":"-- The main function is the first function called"+f+".\nfunction main()\nend";NISsetScriptName(a,a.ifware.MainLuaFile);a.setValue(f);a.clearHistory();SCMclearDependencies(a);$(e).dialog("close")}};d.Cancel=function(){$(this).dialog("close")};
e.dialog({bgiframe:true,title:a.ifware.UsesParameter?"Import Project/Sample Data":"Import Project",resizable:false,modal:true,autoOpen:false,buttons:d,close:function(){a.focus()}});c();e.dialog("open");SCMdialogWaiting("#importProjectAndData",true);$.ajax({url:"/sc/get_all_projects_file_info",method:"POST",data:{translator_guid:a.ifware.ChannelGuid},error:function(f,h,j){e.dialog("close");SCMdialogWaiting("#importProjectAndData",false);handleProjectImportError(f,h,j)},success:function(f){SCMdialogWaiting("#importProjectAndData",
false);f.Projects.sort(function(p,n){var t=(p.Name||p.Guid).toLowerCase(),w=(n.Name||n.Guid).toLowerCase();return t<w?-1:t>w?1:0});for(ProjIndex in f.Projects){var h=f.Projects[ProjIndex],j=$("<option></option>");j.val(h.Guid);j.html(h.Name||h.Guid);$("select[name=projectList]",e).append(j)}f=$("#importProjectAndData table:first").width();e.dialog("option","width",26+f);e.dialog("option","position","center");SCMdialogWaiting("#importProjectAndData",false)}})}
function SCMincludeSampleConfirm(a){$("#IncludeSampleConfirmDlg").remove();$(document).find("body").append('<div id="IncludeSampleConfirmDlg" align="center">Include Sample Messages? </div>');var b={};b.Yes=function(){SCMexportRequest(a,true);$("#IncludeSampleConfirmDlg").dialog("close")};b.No=function(){SCMexportRequest(a,false);$("#IncludeSampleConfirmDlg").dialog("close")};$("#IncludeSampleConfirmDlg").dialog({bgiframe:true,width:300,height:130,title:"Confirm",modal:true,autoOpen:true,buttons:b})}
function SCMexportRequest(a,b){window.open("/sc/export_to_zip?translator_guid="+a+"&sample_data="+b);this.focus()}function SCMpluralLines(a){return a==1?"line":"lines"}function SCMfindLabel(a,b){for(var c=0;c<b.length;c++)if(b[c]==a)return true;return false}
function SCMdisplayError(a,b){$("#scResponseDlg").remove();if(!a)return false;var c="<p> We're sorry, but an unexpected error occurred: </p>                    <p>"+a+"</p> ";$("body").append($("<div id='scResponseDlg'>                       <div class='sc_error'></div><br/>                       <div class='sc_output'></div><div class='sc_info'></div></div>                    "));var e=$("#scResponseDlg"),d={};d.Close=function(){$(this).dialog("close")};e.dialog({bgiframe:true,width:600,title:"Error",
modal:true,autoOpen:false,buttons:d,close:function(){b()}});e.find(".sc_error").html(c);e.find(".sc_error").show();e.dialog("open");return true}function SCMcatchError(a,b){if(!a.ErrorMessage)return false;return SCMdisplayError(a.ErrorMessage,b)}
function SCMupdateLegend(a){var b=$(".toolbar_lines");b.html("");a.summary&&b.html('<span class="label">Lines:</span><span class="lines_info">Added: <span class="lines_added">'+a.summary.added+'</span></span><span class="lines_info">Deleted: <span class="lines_deleted">'+a.summary.deleted+'</span></span><span class="lines_info">Changed: <span class="lines_changed">'+a.summary.changed+"</span></span>")}
function SCMdrawDiffs(a,b){if(b=="condensed"){$("#SCMdiff").html(a.condensed);$("#SCMdiff").addClass("changesOnly")}else{$("#SCMdiff").removeClass("changesOnly");var c=b=="vertical"?" vrt":"";if(a.full){c=$('<div class="diffTank'+c+'" id="diffFromTank"><div class="changeLabel">From</div><div class="diffCling">'+a.full.from+'</div></div><div class="diffDivider'+c+'" /><div class="diffTank'+c+'" id="diffToTank"><div class="changeLabel">To</div><div class="diffCling">'+a.full.to+"</div></div>");$("#SCMdiff").html(c);
var e=$(".diffCling");e.on("scroll",function(){var d=$(this),f=e.not(this);if(d.attr("scrolling")=="false"||d.attr("scrolling")==undefined){f.attr("scrolling","true");f.scrollTop(d.scrollTop());f.scrollLeft(d.scrollLeft())}d.attr("scrolling","false")})}}}function SCMlights(){return["red","yellow","green","gray"]}function SCMinitialDiffs(){return{condensed:"",full:{from:"",to:""},status:"",summary:{added:0,deleted:0,changed:0}}}
function SCMcompare(a,b,c){if(a[c]>b[c])return 1;if(a[c]<b[c])return-1;return 0}function SCMclip(a,b){if(a.length<=b)return a;return a.substr(0,b)+"..."}function SCMchannelConfigNameClip(a,b){var c=/^\Channels\//,e=/-[A-F0-9]{32}\/ChannelConfiguration.xml$/;if(c.test(a))return SCMclip(a.replace(c,"").replace(e,""),b);return SCMtranslatorNameClip(a,b)}
function SCMtranslatorNameClip(a,b){var c=/-(Ack|To|From|Filter|FromHTTP)-[A-Za-z0-9]{14}\//,e=/[A-F0-9]{32}\//;if(c.test(a))a=a.replace(c,"-$1.../");else if(e.test(a))a=a.replace(e,".../");return a.length<=b?a:"..."+a.substring(a.length-b)}function SCMsizeBoxes(a,b){if(!b)return[100,0];if(a<10)return[25,74];var c=a/(a+b)*100;if(c>75)c=75;return[c,99-c]}
function SCMfileClasses(a,b){if(!a.shared_files)return"";var c=" "+Object.keys(a.shared_files).map(function(e){return b[e].Index}).join(" ");if(a.contains_new_file)c+=" NEW";return c}
function SCMdecorate(a,b){$(".c").removeClass("c");$("#"+a).addClass("c");$(".h").removeClass("h");$("div.project."+a).addClass("h");$("div.project").on({mouseenter:function(){$("span.file."+$(this).attr("id")).addClass("h")},mouseleave:function(){$("span.file."+$(this).attr("id")).removeClass("h")}});$(".SCMstageLabel").each(function(){var c=$(this).outerHeight();$(this).next().css("top",c+"px")});$("#SCMstageFilesCollection").scrollTop(b)}
function SCMfixView(a,b,c,e){var d=$("#SCMcommitList"),f=$("#SCMcommitList .scroller");f.height(d.height()-$("#SCMcommitList .fixed").outerHeight()+"px");f.css("top",$("#SCMcommitList .fixed").outerHeight()+"px");$("#SCMcommitList .fixed table").width($("#SCMcommitList .scroller table").width()+"px");f=a.parent();var h=$(".EDT_toolbar_wrapper"),j=f.height();if(f.is("#HistoryBody"))j=f.outerHeight();if(h&&h.length==1)j-=h.outerHeight();a.height(j-d.outerHeight()-$("#SCMreviewControls").outerHeight()+
"px");e.height(b.height()-c.outerHeight()+"px")}function SCMfixDiffView(){var a=$("#SCMreviewPanelAndDiff"),b=$("#SCMdiffTank"),c=$(".diff_toolbar"),e=$("#SCMdiff");SCMfixView(a,b,c,e)}function SCMfixPreviewView(){var a=$("#HistoryBody #SCMreviewPanelAndPreview"),b=$("#HistoryBody #SCMpreviewTank"),c=$("#HistoryBody .preview_toolbar"),e=$("#HistoryBody #SCMpreview");SCMfixView(a,b,c,e)}
function SCMpullStatus(a,b){$.ajax({url:"/dashboard_data",method:"GET",cache:false,data:{include_remote_servers:true},success:function(c){SCMbumpStatus(c,a,b)}})}function SCMbumpStatus(a,b,c){var e=SCMlights();a=a.Channels;for(var d=0;d<a.length;d++){var f=a[d].Channel.Guid,h=e[a[d].Channel.Light];b[f]=h=="green"?true:false;var j=$("input.bumpUpdate[data-cguid="+f+"]");SCMupdateBumpNote(j,f,b,c);$("#BumpStatus_"+f).html('<img src="/images/button-dot'+h+'v4.gif" alt="'+h+'" />')}}
function SCMupdateBumpNote(a,b,c,e){var d=$("td#BumpNote_"+b);a.each(function(){if($(this).prop("checked")&&c[b]){d.html(e);return false}else d.html("")})}
function SCMbumpTickCheck(a,b,c,e,d){a.on("change",function(f){var h=true;f.stopPropagation();f=$(this).attr("data-"+e);a.each(function(){if(!$(this).prop("checked")){h=false;b.prop("checked",false)}});h&&b.prop("checked",true);var j=$("input.bumpUpdate[data-"+e+"='"+f+"']");if(d){SCMpullStatus(d,c);SCMupdateBumpNote(j,f,d,c)}});b.on("change",function(){$(this).prop("checked")?a.prop("checked",true):a.prop("checked",false);a.trigger("change")})}
function SCMcommitKeys(a,b,c){SCMdisableMouse();if(b!=0){var e=$("tr.commitRow.current");$("body").off("keydown.differ");$("body").on("keydown.differ",function(d){if(!(d.ctrlKey||d.metaKey||d.shiftKey)){d.preventDefault();SCMdisableMouse();var f=false;if(d.keyCode==38&&a<b){a++;f=true}else if(d.keyCode==40&&a>0){a--;f=true}f&&c(a,e);return false}});$("body").focus()}}function SCMdisableKeys(){$("body").off("keydown.differ");$("body").focus()}
function SCMscrollCommitList(){var a=$("tr.commitRow.current"),b=a.position();b.top<0&&a[0].scrollIntoView(true);b.top+a.outerHeight()>$(".scroller").height()&&a[0].scrollIntoView(false)}function SCMdisableMouse(){$(".commitTable").removeClass("mouseworthy")}function SCMreEnableMouse(){$(".scroller .commitTable").addClass("mouseworthy")}function SCMlinkText(a){return a.replace(/(https?:\/\/\S*)/,function(b){return'<a href="'+b+'" target="_blank">'+b+"</a>"})}
function SCMclearActiveRequest(a){a&&Object.keys(a).length&&a.hasOwnProperty("abort")&&a.abort()}function SCMcompareFunc(a,b){if(a[0]<b[0])return-1;return 1}
function SCMbuildChannelCollisionTable(a,b,c){var e='<div id="collision_list"><div class="fixed">                   <table class="CollisionTable fixedHead"><thead><tr><th class="CollisionLabel">Channel</th>';if(a)e+='<th class="tick status">Status</th>';e+='<th class="action">Action&nbsp;<br><span class="select-style">                                 <select id="bulk_action" class="dropdown">                                   <option class="dropdown_opt" value="none">No Action</option>                                   <option class="dropdown_opt" value="update_everything">Full Update</option>                                   <option class="dropdown_opt" value="update_translators_only">Update Translators Only</option>                                   <option class="dropdown_opt" value="create_new_channel">'+b+
' As New Channel</option>                                 </select></span>                              </th>                              <th class="newnamecol">New channel name</th>                              <th class="notecol">Notes</th>                    </tr></thead></table></div>                    <div class="scroller"><table class="CollisionTable"><tbody>';e+=SCMbuildChannelCollisionRows(a,b,c);e+="</tbody></table></div></div>";return e}
function SCMbuildChannelCollisionRows(a,b,c){for(var e=Object.keys(c).sort(SCMcompareFunc),d="",f=0;f<e.length;f++){var h=c[e[f]].local_guid;d+='<tr class="CollisionChannel"><td class="CollisionLabel">'+e[f]+"</td>";if(a)d+='<td class="tick status" id="ChannelStatus_'+h+'" /></td>';d+='<td class="action"><span class="select-style"><select class="dropdown" data-cguid="'+h+'" ><option class="dropdown_opt" value="none">No Action</option><option class="dropdown_opt" value="update_everything">Full Update</option><option class="dropdown_opt" value="update_translators_only">Update Translators Only</option><option class="dropdown_opt" value="create_new_channel">'+
b+' As New Channel</option></select></span></td><td class="newnamecol" id="NewName_'+h+'"></td><td class="notecol" id="Note_'+h+'"></td></tr>'}return d}function SCMbuildFileCollisionTable(a,b){return'<table id="bump_file_list" class="bumpTable"><thead><tr><th class="CollisionLabel">Shared file</th><th class="tick control"><input type="checkbox" name="BumpAll" id="BumpAll" />Replace with '+a+'</th><th class="notecol" /></tr></thead><tbody>'+SCMbuildFileCollisionRows(a,b)+"</tbody></table>"}
function SCMbuildFileCollisionRows(a,b){for(var c=Object.keys(b),e="",d=0;d<c.length;d++){e+='<tr class="BumpFile"><td>'+c[d]+'</td><td class="tick"><input type="checkbox" class="bumpUpdate fileBump" data-filepath="'+c[d]+'"></td>';if(d==0)e+='<td id="diffLink" rowspan="'+c.length+'"><span id="showCollidingFileDiffView" class="clickable_link">See what will change</span></td>';e+="</tr>"}return e}
function SCMcheckChannelLights(a,b){$.ajax({url:"/dashboard_data",method:"GET",data:{include_remote_servers:true},success:function(c){SCMupdateLightStatus(c,a,b)}})}function SCMupdateCollisionRestartNote(a,b,c,e){var d=$("table.CollisionTable td#Note_"+b);a.each(function(){if($(this).prop("checked")&&c[b]){d.html(e);return false}else d.html("")})}
function SCMupdateLightStatus(a,b,c){var e=SCMlights();a=a.Channels;for(var d=0;d<a.length;d++){var f=a[d].Channel.Guid,h=e[a[d].Channel.Light];b[f]=h=="green"?true:false;var j=$("input.bumpUpdate[data-cguid="+f+"]");SCMupdateCollisionRestartNote(j,f,b,c);$("#ChannelStatus_"+f).html('<img src="/images/button-dot'+h+'v4.gif" alt="'+h+'" />')}}function SCMupdateCollidingFileApprovals(a,b){a.each(function(){b[$(this).attr("data-filepath")].overwrite=$(this).prop("checked")})}
function SCMremoveInvalidChannelSelectOptions(a){a.NameOnlyCollisionsPresent=false;for(var b in a.ChannelCollisionMap){var c=a.ChannelCollisionMap[b],e=c.local_guid;if(!(c.hasOwnProperty("update_everything")||c.hasOwnProperty("update_translators_only"))){a.NameOnlyCollisionsPresent=true;c="select.dropdown[data-cguid='"+e+"'] option[value='update_translators_only']";$("select.dropdown[data-cguid='"+e+"'] option[value='update_everything']").remove();$(c).remove()}}}
function SCMcheckForNewChannelNameColumnVisibility(a){var b=$("table.CollisionTable th.newnamecol").css("display")=="none",c=a.length;$(a).each(function(){var e=$(this).val(),d="#NewName_"+$(this).attr("data-cguid");if(e!="create_new_channel"){c-=1;$(d).children("input").remove()}else $(d+" input").length||$(d).append("<input type='text'></input>")});if(c&&b){$("table.CollisionTable .newnamecol").css("display","table-cell");$("table.CollisionTable .notecol").css("width","25%")}else if(!c&&!b){$("table.CollisionTable .newnamecol").css("display",
"none");$("table.CollisionTable .notecol").css("width","50%")}}function SCMresetChannelCollisonChoices(a,b){var c=b[a];c.create_new_channel=false;if(c.hasOwnProperty("update_everything"))c.update_everything=false;if(c.hasOwnProperty("update_translators_only"))c.update_translators_only=false;c.new_channel_name=""}
function SCMupdateChannelApprovals(a,b,c){a.each(function(){var e=$(this).attr("data-cguid"),d=$(this).val(),f=c[e];SCMresetChannelCollisonChoices(f,b);if(d!="none"){b[f][d]=true;if(d=="create_new_channel"){e=$("#NewName_"+e+" input").val();b[f].new_channel_name=e}}})}function SCMupdateChannelNotes(a,b,c,e){var d=$("#collision_list td.notecol#Note_"+b);a.each(function(){var f=$(this).val();if((f=="update_everything"||f=="update_translators_only")&&c[b]){d.html(e);return false}else d.html("")})}
function SCMdisplayUpdateWarningMessageIfNeeded(a,b){if(!(!b||$("#collision_list #channel_update_warning_messge").length!=0)){var c;$("#collision_list").append("<p id='channel_update_warning_messge'>Note: <br> Some of the colliding channels match existing channels in name only and don't have the same component types.<br> Because of this you will not be able to "+a+" and update them. You will only be able to "+a+" them as new channels.</p>")}}
function SCMcheckIfContinueButtonNeedsDisabling(a,b){var c=a.length,e=0,d=b.length,f=0;$(a).each(function(){$(this).val()=="none"&&e++});$(b).each(function(){$(this).prop("checked")||f++});var h=$("#confirmation-button-continue");h.length||(h=$("#SCMgo"));if(c>0&&c===e&&d>0&&d==f){h.button("disable");$("#CompleteControls").hide();$("#SCMreviewControls .review-actions").css("padding","20px 20px")}else if(c>0&&c===e&&d===0){h.button("disable");$("#CompleteControls").hide();$("#SCMreviewControls .review-actions").css("padding",
"20px 20px")}else{h.button("enable");$("#SCMreviewControls .review-actions").css("padding","10px 20px");$("#CompleteControls").show()}}
function SCMsetSelectBoxChangeEvents(a,b,c,e,d){b.on("change",function(f){f.stopPropagation();f=$(this);f.val();var h=f.attr("data-"+e);SCMcheckChannelLights(a.StatusMap,SCM_BUMP_NOTE);SCMupdateChannelNotes(f,h,a.StatusMap,SCM_BUMP_NOTE);SCMupdateChannelApprovals(b,a.ChannelCollisionMap,a.LocalGuidsToNameMap);SCMcheckForNewChannelNameColumnVisibility(b)});c.on("change",function(){var f=$(this).val();$(b).each(function(){if($(this).children("option[value="+f+"]").length){$(this).val(f);$(this).trigger("change")}if(f==
"update_everything"||f=="update_translators_only")SCMdisplayUpdateWarningMessageIfNeeded(d,a.NameOnlyCollisionsPresent)})})}function SCMclearNewChannelNameWarnings(a){for(var b=0;b<a.length;b++){var c=$(a[b]).attr("data-cguid");$("#NewName_"+c+" input").css("border","none")}$("#collision_list .NewChannelNameWarning").remove()}
function SCMcheckForExistingName(a,b,c){for(var e in a)if(b===a[e].name){a="#collision_list .ExistingName-"+c;if(!$(a).length){b='<p class="NewChannelNameWarning ExistingName-'+c+'">Channel name "'+b+'" exists already! Choose another name.</p>';$("#collision_list").prepend(b);$(a).css("color","red")}$("#NewName_"+c+" input").css("border","1px solid red");return true}return false}
function SCMemptyNameFound(a){if(!$("#collision_list .EmptyName").length){$("#collision_list").prepend('<p class="NewChannelNameWarning EmptyName">New channel names cannot be empty!</p>');$("#collision_list .EmptyName").css("color","red")}$("#NewName_"+a+" input").css("border","1px solid red")}
function SCMcheckForDuplicateNewName(a,b,c){if(!(!b||b=="")){if(a.hasOwnProperty(b)){$("#NewName_"+c+" input").css("border","1px solid red");$("#NewName_"+a[b]+" input").css("border","1px solid red");a='Channel name "'+b+"\" Can't be added more than once!";if(!$("#collision_list .DuplicateNewName").length||$("#collision_list .DuplicateNewName").length&&$("#collision_list .DuplicateNewName").text()!==a){$("#collision_list").prepend('<p class="NewChannelNameWarning DuplicateNewName">'+a+"</p>");$("#collision_list .DuplicateNewName").css("color",
"red")}return true}else a[b]=c;return false}}function SCMvalidateAndStoreNewChannelNames(a,b,c){for(var e=false,d={},f=0;f<b.length;f++){var h=b[f],j=$(h).attr("data-cguid"),p=$(h).val();h=a.LocalGuidsToNameMap[j];if(p=="create_new_channel"){p=$("#NewName_"+j+" input").val();a.ChannelCollisionMap[h].new_channel_name=p;if(p==""||!p){SCMemptyNameFound(j);e=true}else if(c=="export")e=SCMcheckForExistingName(a.IxportableChannelList,p,j)||e;e=SCMcheckForDuplicateNewName(d,p,j)||e}}return e}
function SCMbuildCollidingFileDiffView(a,b,c,e,d){$("#SCMreview").remove();var f="",h=Object.keys(a.ChannelCollisionMap).length>0;if(h)f='<div id="SCMcommitList"></div>';var j=$('<div id="SCMreview"></div>');j.append(f+'<div id="SCMpanelAndDiff"><div id="SCMpanel"></div><div id="SCMdiffAndControls"><div id="SCMdiffTank"><div class="diff_toolbar"><div class="toolbar_filename"></div><div class="toolbar_lines"></div><div class="toolbar_display"><span class="label">Display:</span><div class="select-style" style="float: right;"><select id="SCMdiffViewSelect"><option value="vertical">Side by Side</option><option value="horizontal">Horizontal</option><option value="condensed">Changes Only</option></select></div><\!--/toolbar_display--\></div><\!--/diff_toolbar--\></div><div id="SCMdiff"></div><\!--/SCMdiffTank--\></div><\!--/SCMdiffAndControls--\></div><\!--/SCMpanelAndDiff--\></div><div id="SCMreviewControls"><div class="review-actions"><span id="CompleteControls"><a id="SCMgo" class="action-button green btn-large">Complete '+
b+'</a> <span style="margin: 0 10px; color: #888888;">or</span> </span><a id="SCMcancel" style="color: #666666; font-size: 14px;">Cancel</a></div><\!--/SCMreviewControls--\></div>');$("body").append(j);c();if(h){$("#collision_list").appendTo($("#SCMreview #SCMcommitList"));$("#SCMreview #SCMcommitList .scroller").css("top","45px")}else{$("#SCMreview #SCMpanelAndDiff").css("top","0");$("#SCMreview #SCMdiff").css("height","100%")}$("#bump_file_list").remove();$("#ApprovalDlg").remove();b=$(window).width()-
30;c=$(window).height()-30;j.css("overflow","hidden");j.dialog({bgiframe:true,width:b,height:c,title:"Confirm overwrites",modal:true,autoOpen:false,resizable:false,close:d});j.dialog("open");addControlsToDiffView(a,e,d)}
function SCMfixCollidingSharedFileView(){var a=$("#SCMreview #SCMcommitList"),b=$("#SCMreview .scroller");b.height(a.height()-$("#SCMreview .fixed").outerHeight()+"px");b.css("top",$("#SCMreview .fixed").outerHeight()-1+"px");$("#SCMreview .fixed table").width($("#SCMreview .scroller table").width()+"px")}
function SCMattachDisableActionsToDiffView(){var a=$("#collision_list .CollisionChannel select.dropdown"),b=$("#SCMpanel .tree input.commitFile");a.on("change",function(){SCMcheckIfContinueButtonNeedsDisabling(a,b)});b.on("change",function(){SCMcheckIfContinueButtonNeedsDisabling(a,b)});SCMcheckIfContinueButtonNeedsDisabling(a,b)}
function addControlsToDiffView(a,b,c){$("#SCMgo").button();$("#SCMreview #SCMdiffViewSelect").change(function(){a.DiffFormat=$(this).val();SCMdoFileDiff(a)});$("#SCMreview #SCMcancel").click(function(){$("#SCMreview").dialog("close");c()});$("#SCMreview #SCMpanelAndDiff").resizable({maxHeight:$("#SCMreview").height()-75,minHeight:10,handles:"n"});$("#SCMreview #SCMpanelAndDiff").on("resize",function(e,d){$("#SCMreview #SCMcommitList").css("height",d.position.top+"px");SCMfixCollidingSharedFileView()});
$("#SCMreview #SCMpanel").resizable({maxWidth:500,minWidth:60,handles:"e"});$("#SCMreview #SCMpanel").on("resize",function(e,d){e.stopPropagation();$("#SCMreview #SCMdiffAndControls").css("left",d.size.width+"px")});b();$("#SCMreview #SCMreviewControls").css("padding","0");$(".review-actions").css("padding","10px 20px")}
function SCMloadCollidingFileDiffViewData(a,b){var c=0,e="",d;for(d in a.FileCollisionMap)if(a.FileCollisionMap.hasOwnProperty(d)){a.IndexMap["File"+c]=d;a.FileCollisionMap[d].index=c;c==0&&SCMsetCurrentFile(a,d);e+=SCMbuildFileRow(a,d,c);c++}var f=a.CollationMap.projects,h=f?Object.keys(f).length:0,j=Object.keys(f);h&&j.sort(function(n,t){return SCMcompare(f[n],f[t],"project_name")});d="";for(var p=0;p<j.length;p++)d+=SCMbuildProjectRow(a,f,j[p]);j=Object.keys(a.FileCollisionMap).length;h=SCMsizeBoxes(j,
h);SCMrefreshFileBox(a,b,c,e,h[0]);SCMrefreshProjectBox(b,d,h[1])}function SCMprojectClasses(a){if(!a.other_projects)return"";return" "+a.other_projects.map(function(b){return"Prj"+b}).join(" ")}
function SCMbuildFileRow(a,b,c){var e="";e='<input class="commitFile" data-filepath="'+b+'" id="commitFile'+c+'" type="checkbox"'+(a.FileCollisionMap[b].overwrite?' checked="checked"':"")+" />";return"<li>"+e+'<label id="File'+c+'" class="file select '+SCMprojectClasses(a.CollationMap.files[b])+(b==a.CurrentFile?" c":"")+'">'+b+"</label></li>"}
function SCMbuildProjectRow(a,b,c){return'<div id="Prj'+c+'" class="project'+SCMfileClasses(b[c],a.FileCollisionMap)+'" data-projectguid="'+c+'"><strong>('+Object.keys(b[c].shared_files).length+")</strong> "+b[c].project_name+'<span class="project-files" id="PrjFil'+c+'" /></div>'}function SCMbuildProjectFileRow(a,b,c){return'<span class="project-file '+a[b].status+' " data-projectguid="'+c+'">'+b+"</span>"}
function SCMsetCurrentFile(a,b){a.CurrentFile=b;a.CurrentIndex="File"+a.FileCollisionMap[b].index;$(".toolbar_filename").html(b)}function SCMdoFileDiff(a){var b=a.Diffs[a.CurrentFile];SCMupdateLegend(b,$("#SCMreviewControls"));b.status&&!b.summary?$("#SCMdiff").html('<div class="noDiff">(<span>'+b.status+"</span>)</div>"):SCMdrawDiffs(b,a.DiffFormat)}
function SCMrefreshFileBox(a,b,c,e){var d=true,f;for(f in a.FileCollisionMap)if(!a.FileCollisionMap[f].overwrite){d=false;break}b=$('<ul class="tree">      <li><label><input type="checkbox" id="commitAll" name="commitAll"'+(d?' checked="checked"':"")+"/>Shared files in this "+b+":</label></li>"+e+"</ul>   ");e=b.find(".commitFile");d=b.find("#commitAll");SCMbumpTickCheck(e,d,"","filepath");e.on("change",function(){SCMupdateCollidingFileApprovals($(this),a.FileCollisionMap)});b.find(".select").click(function(){FileScroll=
$("#SCMstageFilesCollection").scrollTop();SCMsetCurrentFile(a,a.IndexMap[$(this).attr("id")]);SCMdecorate(c,FileScroll);SCMdoFileDiff(a)});$("#SCMreview #SCMpanel ul.tree").remove();$("#SCMreview #SCMpanel").prepend(b)}
function SCMrefreshProjectBox(a,b){if(a==="export")$("div.projects_affected").remove();else if(b){var c=$('<div class="projects_affected"><div class="label">Projects affected:</div><ul>'+b+"</ul></div>");$("#SCMreview div.projects_affected").remove();$("#SCMreview #SCMpanel").append(c)}else $("div.projects_affected").remove()};function SCMcallReview(a,b){location.href=NISqueryString(b)}function SCMreview(a){var b=MAPretrieveHeaderHTML("review_commits",a);b+='<div class="content_main floated_bottom" />';$("body").html(b);$(".content_main").css("top",$("div.header").height()+"px");ifware.Reviewer=new SCMreviewer(a);ifware.Reviewer.init()}
var SCMreviewer=function(a){function b(){$("#SCMreviewPanelAndDiff").resizable("option","maxHeight",$("body").height()-250);$("#SCMpanel").resizable("option","maxWidth",$("body").width()/3);y()}function c(m){m&&$(".content_main").html(m);$(window).on("resize",b);var v=$("#SCMcommitList");v.html("").addClass("SCMloading");m="/sc/translator_history";var o={translator_guid:B};if(U){m="/sc/file_history";o.file_path=P.path}$.ajax({url:m,method:"GET",cache:false,data:o,success:function(g){v.html("").removeClass("SCMloading");
F=g;if(!F||!F.length){r();v.html('<div style="padding: 10px;"><div id="commit_list_title">No Commits</div>                      Click "Save to Source Control" to commit a snapshot of this translator to the repository.                      <br><br><a href="'+G+'">Back to script</a></div>')}else{Q=F.length-1;p(v);v.css("height",$("#SCMreviewPanelAndDiff").position().top-44+"px");SCMfixDiffView();s();d()}},error:h});$("#SCMreviewPanelAndDiff").resizable({maxWidth:"100%",minWidth:"100%",minHeight:300,
maxHeight:$("body").height()-250,handles:"n"});$("#SCMreviewPanelAndDiff").on("resize",y);$("#SCMpanel").resizable({maxHeight:"100%",minHeight:"100%",minWidth:180,maxWidth:$("body").width()/3,handles:"e"});$("#SCMpanel").on("resize",function(g,l){g.stopPropagation();$("#SCMdiffAndControls").css("left",l.size.width+"px")})}function e(){$(".toolbar_filename").html(SCMtranslatorNameClip(P.path,30));var m={translator_guid:B,file_path:P.path};m.commit_from=V=="changes"?F[Q].commit_parent_id||"first":"null";
m.commit_to=F[Q].commit_id;$.ajax({url:"/sc/diff",method:"GET",data:m,success:function(v){N=v.diff;SCMupdateLegend(N,$("#SCMreviewControls"));N.status&&!N.summary?$("#SCMdiff").html('<div class="noDiff">(<span>'+N.status+"</span>)</div>"):SCMdrawDiffs(N,T)},error:h})}function d(){U?e():$.ajax({url:"/sc/files_from_commit",method:"GET",data:{translator_guid:B,commit_id:F[Q].commit_id},success:function(m){L=m.files;t();$("a#SCMrevert").show();$(".review-actions span").show()},error:h})}function f(){var m=
"/sc/revert_project",v={translator_guid:B,commit_id:F[Q].commit_id};if(U){m="/sc/revert_file";v.file_path=P.path}$.ajax({url:m,method:"POST",data:v,success:function(o){if(ifware.Editor)SCMfindLabel(ifware.Editor.ifware.CurrentFileName,o.reverted_files)?NISreloadCurrentFile(ifware.Editor):NISupdateAnnotations(ifware.Editor);C()},error:h})}function h(m){if(m.responseJSON.error.description&&m.responseJSON.error.description=="The selected translator project did not exist in the given commit."){$(".toolbar_lines").html("");
$("#SCMpanel ul.tree").remove();$(".review-actions span").hide();$("a#SCMrevert").hide();$("#SCMdiff").html('<div class="noDiff">(<span>This channel and translator project did not exist in this commit.</span>)</div>')}else SCMdisplayError(m.responseJSON.error?m.responseJSON.error.description:m.status+" - "+m.statusText,S.exit)}function j(){SCMcommitKeys(Q,F.length-1,function(m){Q=m;$("tr.commitRow").removeClass("current");$('tr.commitRow[data-index="'+m+'"]').addClass("current");SCMscrollCommitList();
d()})}function p(m){for(var v='<div class="fixed">                      <table id="commit_list" class="commitTable fixedHead"><thead><tr>                      <th class="note">Note</th><th class="commit_id">Commit ID</th>                      <th class="user">User</th><th class="date">Date</th></tr></thead></table>                      </div>                      <div class="scroller"><table class="commitTable mouseworthy"><tbody>',o=F.length-1;o>=0;o--)v+=n(o);v+="</tbody></table></div>";m.html(v);
$("body").click(function(){SCMreEnableMouse()});$(document).mousemove(function(g){if(window.lastX!==g.clientX||window.lastY!==g.clientY)SCMreEnableMouse();window.lastX=g.clientX;window.lastY=g.clientY});j();$("tr.commitRow").click(function(){var g=$(this);$("tr.commitRow.current").removeClass("current");Q=g.attr("data-index");g.addClass("current");j();d()});SCMfixDiffView()}function n(m){var v=F[m],o=new Date(v.commit_timestamp*1E3),g=v.commit_id==F[Q].commit_id?" current":"";o=o.toLocaleDateString()+
" "+o.toLocaleTimeString();return'<tr data-index="'+m+'" class="commitRow'+g+'"><td class="note">'+PAGhtmlEscape(v.commit_comment)+'</td><td class="commit_id">'+v.commit_id+'</td><td class="user">'+v.commit_user+'</td><td class="date">'+o+"</td></tr>"}function t(){var m=$('<ul class="tree">         <li><label>Project files at this commit:</label></li>'+w()+"</ul>      ");$("ul.tree").remove();var v=$("#SCMpanel");v.append(m);m.find(".select").click(function(){P=L[$(this).attr("data-index")];d()});
v.scrollLeft(0);e()}function w(){for(var m="",v=0;v<L.length;v++){var o=L[v],g=o.path==P.path?" c":"";o.changed||(g+=" unchanged");m+='<li><label class="file'+g+'"><span class="select" data-index="'+v+'">'+L[v].path+"</label></li>"}return m}function s(){$("#SCMdiffViewSelect").change(function(){T=$(this).val();SCMdrawDiffs(N,T)});$("#SCMcomparisonSelect").change(function(){V=$(this).val();e()});$("#SCMcancel").click(function(){C()});$("#SCMrevert").click(function(){f()})}function r(){$("#SCMdiffViewSelect, #SCMcomparisonSelect").prop("disabled",
true);$("#SCMcancel").click(function(){C()});$("#SCMrevert").removeClass("green").addClass("grey disabled")}function y(){$("#SCMcommitList").css("height",$("#SCMreviewPanelAndDiff").position().top-44+"px");SCMfixDiffView()}function C(){$("body").off("keydown.differ");$("body").css("background-color","#ECEFF1");$(window).off("resize",b);location.href=G}var B=a.ChannelGuid,G=NISqueryString(NISminUrlParams(a,"OpenEditor")),N=SCMinitialDiffs(),T="vertical",F=[],P={path:a.one_file||a.Module||"main.lua"},
U=a.one_file||false,Q=0,L=[],V="changes",S=this;this.init=function(){var m='<div class="EDTtoolbar_wrapper">         <div class="back">         <span class="label">\u2190 Back to:&nbsp;&nbsp;<a id="SCMstageScriptLink">Script</a></span>         <\!--/back--\></div>         <span class="heading">Change History: '+(U?P.path:a.ChannelName+" ("+a.ComponentName+")")+'</span>         <\!--/EDTtoolbar_wrapper--\></div>         <div id="SCMcommitList"></div>         <div id="SCMreviewPanelAndDiff">';m+=U?
'         <div id="SCMdiffAndControls" class="single">':'         <div id="SCMpanel"></div>         <div id="SCMdiffAndControls">';m+='         <div id="SCMdiffTank">         <div class="diff_toolbar">            <div class="toolbar_filename"></div>            <div class="toolbar_lines"></div>            <div class="toolbar_display"><div class="select-style" style="float: right;">               <select id="SCMdiffViewSelect">               <option value="vertical">Side by Side</option>               <option value="horizontal">Horizontal</option>               <option value="condensed">Changes Only</option>               </select>               <select id="SCMcomparisonSelect">               <option value="changes">What changed</option>               <option value="current">Preview revert</option>               </select></div>            </div>          <\!--/diff_toolbar--\></div>         <div id="SCMdiff"></div>         <\!--/SCMdiffTank--\></div>         <\!--/SCMdiffAndControls--\></div>         <\!--/SCMreviewPanelAndDiff--\></div>         <div id="SCMreviewControls">         <div class="review-actions"><a id="SCMrevert" style="display: inline" class="action-button green btn-large">Revert</a> <span style="margin: 0 10px; color: #888888;">or</span> <a id="SCMcancel" style="color: #666666; font-size: 14px;">Cancel</a></div>         <\!--/SCMreviewControls--\></div>      ';
c($(m));$("a#SCMstageScriptLink").on("click",C);$("body").css("background-color","rgba(0,0,0,0.5)")};this.exit=function(){C()}};function SCMcallStage(a,b){location.href=NISqueryString(b)}function SCMstage(a){var b=MAPretrieveHeaderHTML("stage_commit",a);b+='<div class="content_main floated_bottom" />';$("body").html(b);$(".content_main").css("top",$("div.header").height()+"px");ifware.Stager=new SCMstager(a);ifware.Stager.init()}
var SCMstager=function(a){function b(u){SCMdisplayError(u.responseJSON.error?u.responseJSON.error.description:u.status+" - "+u.statusText,z.exit)}function c(){$("#SCMcommit").off("click");$("#SCMcommit").click(function(){e()})}function e(){$("#SCMcommit").off("click");var u=$("#SCMcommitNoteError");u.text("");var A=$.trim($("#SCMstageComment").val());if(A.length==0){u.text("Note must not be blank.");c()}else{u={translator_guid:V,file_paths:JSON.stringify(n()),comment:A};$.ajax({url:"/sc/commit",method:"POST",
data:u,error:function(I,J,R){c();b(I,J,R)},success:function(I){c();Q(I)}})}}function d(){if(l=="NEW"){$("#SCMdiff").html('<div class="noDiff">(<span>'+o+"</span> is new, so there are no differences to display.)</div>");SCMupdateLegend(m,$(".EDTtoolbar_wrapper"))}else $.ajax({url:"/sc/diff",method:"GET",data:{translator_guid:V,file_path:o,commit_from:"null",commit_to:"null"},error:b,success:function(u){m=u.diff;SCMupdateLegend(m,$(".EDTtoolbar_wrapper"));if(m.status&&!m.summary)$("#SCMdiff").html('<div class="noDiff">(<span>'+
m.status+"</span>)</div>");else{SCMdrawDiffs(m,v);SCMfixDiffView()}}})}function f(u){$(window).resize(function(){$("#SCMpanel").resizable("option","maxWidth",$("body").width()/3);SCMfixDiffView()});var A=t();$.ajax({url:"/sc/stage",method:"GET",data:A,error:b,success:function(I){var J=I.files,R=Object.keys(J).length;if(!R){alert("This project has no changes, so there is nothing to commit.");s()}u&&$(".content_main").html(u);SCMfixDiffView();l=g="";var O=0,aa="",M;for(M in J)if(J.hasOwnProperty(M))if(J[M].status==
"UNCHANGED"){if(M==o)o=""}else{if(!q){D["File"+O]=M;H[M]={};H[M].Index="File"+O;H[M].Commit=true;H[M].Status=J[M].status}M==o&&r(M,J[M].status);aa+=C(J,M,O);O++}q=true;if(!g)if(J[E])r(E,J[E].status);else{O=Object.keys(J)[0];r(O,J[O].status)}d();var Y=I.projects;J=Y?Object.keys(Y).length:0;O=Object.keys(Y);J&&O.sort(function(ba,ca){return SCMcompare(Y[ba],Y[ca],"project_name")});I="";for(M=0;M<O.length;M++){W[O[M]]={};I+='<li id="Prj'+O[M]+'" class="project'+SCMfileClasses(Y[O[M]],H)+'" data-projectguid="'+
O[M]+'"><strong>('+Object.keys(Y[O[M]].shared_files).length+")</strong> "+Y[O[M]].project_name+'<span class="project-files" id="PrjFil'+O[M]+'" /></li>'}R=SCMsizeBoxes(R,J);P(aa,R[0]);U(I,R[1]);SCMdecorate(g,x);F();SCMfixDiffView()}})}function h(u){$.ajax({url:"/sc/stage",method:"GET",data:{translator_guid:u},error:b,success:function(A){A=A.files;var I="",J;for(J in A){W[u][J]=true;I+='<span class="project-file '+A[J].status+' " data-projectguid="'+u+'">'+J+"</span>"}$("#PrjFil"+u).html(I).css("display",
"block")}})}function j(){var u=$("#scBumpDlg");u.dialog({bgiframe:true,title:"Update Success",modal:true,autoOpen:false,buttons:{OK:function(){$(this).dialog("close")}},close:w});u.html("<p>Translators Successfully Updated!</p>")}function p(){var u=$("form#bumpo"),A=u.find("#BumpCommitId").val(),I=[];u.find("input.bumpUpdate:checked").each(function(){I.push($(this).attr("data-tguid"))});u=$("#scBumpDlg");u.dialog({bgiframe:true,title:"Updating Translators",modal:true,autoOpen:false,width:450,minWidth:450,
buttons:{},close:w});u.html("<p>Updating selected translators to run from the new commit...  <img src='/js/mapper/images/spinner.gif'/></p>");A={translator_guid:V,commit_id:A,translators_to_bump:JSON.stringify(I)};$.ajax({url:"/sc/bump",method:"POST",data:A,error:b,success:j})}function n(){var u=[],A;for(A in H)H[A].Commit&&u.push(A);return u}function t(){var u={translator_guid:V};if(!q)return u;u.file_paths=JSON.stringify(n());return u}function w(){var u=S+"&delay_sync=true";if(Z!=0){clearInterval(Z);
Z=0}$("body").css("background-color","#ECEFF1");location.href=u}function s(){if(Z!=0){clearInterval(Z);Z=0}$("body").css("background-color","#ECEFF1");location.href=S}function r(u,A){o=u;g=H[u].Index;l=A;$(".toolbar_filename").html(SCMtranslatorNameClip(o,30))}function y(u){if(!u.other_projects)return"";return" "+u.other_projects.map(function(A){return"Prj"+A}).join(" ")}function C(u,A,I){var J="";if(A!=E)J='<input class="commitFile" data-filepath="'+A+'" id="commitFile'+I+'" type="checkbox"'+(H[A].Commit?
' checked="checked"':"")+" />";return"<li>"+J+'<label id="File'+I+'" class="file select '+u[A].status+y(u[A])+'">'+A+"</label></li>"}function B(u,A,I,J){return'<tr class="BumpChannel"><td>'+u+'</td><td class="tick" id="BumpStatus_'+A+'" /><td class="type">'+J+'</td><td class="tick"><input type="checkbox" class="bumpUpdate" data-cguid="'+A+'" data-tguid="'+I+'" /></td><td class="BumpNote" id="BumpNote_'+A+'" /></td></tr>'}function G(u,A,I){return'<tr class="BumpTranslator"><td /><td /><td class="type">'+
I+'</td><td class="tick"><input type="checkbox" class="bumpUpdate" data-cguid="'+u+'" data-tguid="'+A+'" /></td><td /></tr>'}function N(u,A){var I=A.channel_guid;X[I]=false;var J="Commit "+u.commit_id+" was created successfully.<br><br>";J+='<table id="bump_list" class="bumpTable"><thead><tr><th>Channel</th><th class="tick">Status</th><th>Component(s)</th><th class="tick"><input type="checkbox" name="BumpAll" id="BumpAll" />Update to run<br>from new commit</th><th class="notecol">Notes</th></tr></thead><tbody>';
J+=B(A.channel_name,I,A.current_project.translator_guid,A.current_project.type);for(var R in A.projects)if(A.projects.hasOwnProperty(R))J+=G(I,R,A.projects[R].type);J+="</tbody></table>";return J}function T(u){var A="",I;for(I in u)if(u.hasOwnProperty(I)){var J=u[I].channel_guid;X[J]=false;for(var R in u[I].projects)if(u[I].projects.hasOwnProperty(R))A+=B(I,J,R,u[I].projects[R].type)}return A}function F(){c();$("#SCMdiffViewSelect").change(function(){v=$(this).val();SCMdrawDiffs(m,v)});$("#SCMcancel").click(function(){s()});
$("#SCMpanel").resizable({maxHeight:"100%",minHeight:"100%",minWidth:180,maxWidth:$("body").width()/3,handles:"e"});$("#SCMpanel").on("resize",function(u,A){u.stopPropagation();$("#SCMdiffAndControls").css("left",A.size.width+"px")})}function P(u){var A=true,I;for(I in H)if(!H[I].Commit){A=false;break}u=$('<ul class="tree">         <li><label><input type="checkbox" id="commitAll" name="commitAll"'+(A?' checked="checked"':"")+"/>Project files to commit:</label></li>"+u+"</ul>      ");var J=u.find(".commitFile"),
R=u.find("#commitAll");J.on("change",function(O){var aa=true;O.stopPropagation();J.each(function(){if($(this).prop("checked"))H[$(this).attr("data-filepath")].Commit=true;else{aa=H[$(this).attr("data-filepath")].Commit=false;R.removeAttr("checked")}});aa&&R.prop("checked",true);f()});R.on("change",function(){if($(this).prop("checked")){J.prop("checked",true);for(var O in H)H[O].Commit=true}else{J.prop("checked",false);for(O in H)if(O!=E)H[O].Commit=false}f()});u.find(".select").click(function(){x=
$("#SCMstageFilesCollection").scrollTop();o=D[$(this).attr("id")];f()});$("ul.tree").remove();$("#SCMpanel").prepend(u)}function U(u){if(u){u=$('<div class="projects_affected"><div class="label">Other projects affected:</div><ul>'+u+"</ul></div>");u.find(".project").click(function(){h($(this).attr("data-projectguid"))});$("div.projects_affected").remove();$("#SCMpanel").append(u)}else $("div.projects_affected").remove()}function B(u,A,I,J){return'<tr class="BumpChannel"><td>'+u+'</td><td class="tick" id="BumpStatus_'+
A+'"><td class="type">'+J+'</td><td class="tick"><input type="checkbox" class="bumpUpdate" data-cguid="'+A+'" data-tguid="'+I+'" /></td><td class="BumpNote" id="BumpNote_'+A+'" /></td></tr>'}function G(u,A,I){return'<tr class="BumpTranslator"><td /><td /><td class="type">'+I+'</td><td class="tick"><input type="checkbox" class="bumpUpdate" data-cguid="'+u+'" data-tguid="'+A+'" /></td><td /></tr>'}function N(u,A){var I=A.channel_guid;X[I]=false;var J="Commit "+u.commit_id+" was created successfully.<br><br>";
J+='<input type="hidden" name="commit_id" id="BumpCommitId" value="'+u.commit_id+'" />';J+='<table id="bump_list" class="bumpTable"><thead><tr><th>Channel</th><th class="tick">Status</th><th>Component(s)</th><th class="tick"><input type="checkbox" name="BumpAll" id="BumpAll" />Update to run<br>from new commit</th><th class="notecol">Notes</th></tr></thead><tbody>';J+=B(A.channel_name,I,A.current_project.translator_guid,A.current_project.type);for(var R in A.projects)if(A.projects.hasOwnProperty(R))J+=
G(I,R,A.projects[R].type);J+="</tbody></table>";return J}function T(u){var A="",I;for(I in u)if(u.hasOwnProperty(I)){var J=u[I].channel_guid;X[J]=false;for(var R in u[I].projects)if(u[I].projects.hasOwnProperty(R))A+=B(I,J,R,u[I].projects[R].type)}return A}function Q(u){$("#scBumpDlg").remove();var A=u.current_channel,I=u.affected_channels;u=u.new_commit;u===undefined&&s();$("body").append('<div id="scBumpDlg"></div>');var J=$("#scBumpDlg"),R={Update:p,Exit:function(){$(this).dialog("close")}},O=
$(window).width()*0.6,aa=$(window).height()*0.7;J.dialog({bgiframe:true,width:O,title:"Update Translators",modal:true,autoOpen:false,buttons:R,close:w});J.css("max-height",aa);var M=J.parent(),Y=M.children(":first"),ba=M.children(":last");M.resize(function(){if(M.height()>Y.outerHeight()+ba.outerHeight()+aa){var ca=M.height()-Y.outerHeight()-ba.outerHeight()-20;J.css("height",ca);J.css("max-height",ca)}else J.css("max-height",aa)});J.html('<form id="bumpo"></form>');R=J.find("#bumpo");R.html(N(u,
A));R.find("tbody").append(T(I));SCMpullStatus(X);Z=setInterval(function(){SCMpullStatus(X)},1E3);SCMbumpTickCheck($("input.bumpUpdate"),$("input#BumpAll"),K,"cguid",X);L();$("input.bumpUpdate").on("change",L);J.dialog("open")}function L(){var u=$(".ui-dialog-buttonpane button:contains('Update')"),A=false;$("input.bumpUpdate").each(function(){if($(this).prop("checked")){A=true;return false}});A?u.attr("disabled",false).removeClass("ui-state-disabled"):u.attr("disabled",true).addClass("ui-state-disabled")}
var V=a.ChannelGuid,S=NISqueryString(NISminUrlParams(a,"OpenEditor")),m=SCMinitialDiffs(),v="vertical",o=a.Module||"main.lua",g=0,l="",q=false,x=0,D={},H={},W={},Z=0,X={},z=this,E="project.prj";SCMlights();var K="Will restart channel";this.init=function(){var u=$('<div class="EDTtoolbar_wrapper">         <div class="back">         <span class="label">\u2190 Back to:&nbsp;&nbsp;<a id="SCMstageScriptLink">Script</a></span>         <\!--/back--\></div>         <span class="heading">Commit to Source Control: '+
a.ChannelName+" ("+a.ComponentName+')</span>         <\!--/EDTtoolbar_wrapper--\></div>         <div id="SCMstagePanelAndDiff">         <div id="SCMpanel"></div>         <div id="SCMdiffAndControls">         <div id="SCMdiffTank">         <div class="diff_toolbar">            <div class="toolbar_filename"></div>            <div class="toolbar_lines"></div>            <div class="toolbar_display"><span class="label">Display:</span><div class="select-style" style="float: right;">               <select id="SCMdiffViewSelect">               <option value="vertical">Side by Side</option>               <option value="horizontal">Horizontal</option>               <option value="condensed">Changes Only</option>               </select></div>            </div>         <\!--/diff_toolbar--\></div>         <div id="SCMdiff"></div>         <\!--/SCMdiffTank--\></div>         <\!--/SCMstagePanelAndDiff--\></div>         <\!--/SCMdiffAndControls--\></div>         <div id="SCMstageControls">         <div class="stage-actions"><a id="SCMcommit" style="display: inline" class="action-button green btn-large">Commit Files</a> <span style="margin: 0 10px; color: #888888;">or</span> <a id="SCMcancel" style="color: #666666; font-size: 14px;">Cancel</a></div>         <div class="milestone_description">            <label for="SCMstageComment" class="strong">Add a note about this commit:</label> <span id="SCMcommitNoteError"></span>            <textarea id="SCMstageComment" name="SCMstageComment"></textarea>         <\!--milestone_description--\></div>         <\!--/SCMstageControls--\></div>      ');
u.find("a#SCMstageScriptLink").on("click",s);f(u);$("body").css("background-color","rgba(0,0,0,0.5)")};this.exit=function(){s()};this.mappo=function(){return H}};function TRVcreateNode(a,b,c,e,d,f,h,j){var p=document.createElement("li"),n=$(p);n.data("DataNode",a);p.className=e&&d?"collapsable":e&&!d?"expandable":"leaf";if(b)p.className+=" "+b;p.innerHTML='<div>          <span class="treeIcon"></span>          <span class="nodeText '+c+'">'+f+"</span>       </div>       <ul"+(d?"":' style="display:none;"')+"></ul>";n.children("div").click(function(t){var w=n.find("span.nodeText:first").get(0),s=n.find("ul:first").get(0);s.innerHTML="";if(n.hasClass("expandable")){n.removeClass("expandable");
n.addClass("collapsable");s.style.display="";h(a,w,s,true)}else if(n.hasClass("collapsable")){n.removeClass("collapsable");n.addClass("expandable");s.style.display="none";h(a,w,s,false)}j&&j(a,w,s);t.stopPropagation()});if(e||j)n.find("span.nodeText:first").mouseover(function(){$(this).addClass("hover")}).mouseout(function(){$(this).removeClass("hover")});return p}function TRVgetChildContainer(a){return $(a).find("ul:first").get(0)}
function TRVgetChildren(a){return $(a).children("li.collapsable")}function TRVgetTreeRoot(a){return $(a).closest("ul.ifwareTreeview")};/*

 Copyright (c) 2010-2014 iNTERFACEWARE Inc.  All rights reserved.
*/
function Tree22(a,b,c,e,d){this.m_Label=a;this.m_Package=d;this.m_Class=b;this.m_Parent=e;this.m_Callbacks=c;this.m_Children=[];this.m_IsSection=this.m_IsWaiting=this.m_IsOpen=false;this.m_DomNode=null}
Tree22.prototype={label:function(){return this.m_Label},add:function(a,b,c,e){a=new Tree22(a,b,c,this,e);this.m_Children.push(a);return a},setCallbacks:function(a){this.m_Callbacks=a;return this},size:function(){if(!this.isBranch())return 0;return this.m_Children.length},child:function(a){return this.m_Children[a]},parent:function(){return this.m_Parent},parents:function(){var a=[],b=this.parent();if(!b)return a;for(;b.parent();){a.push(b);b=b.parent()}return a.reverse()},getValue:function(a){if(this.m_Package[a]&&
this.m_Package[a]!=undefined)return this.m_Package[a];return false},toggle:function(){if(this.isBranch())this.isOpen()?this.close():this.open()},close:function(){this.m_IsOpen=false;$(this.m_DomNode).removeClass("open");return this},open:function(){this.m_IsOpen=true;$(this.m_DomNode).addClass("open");return this},wait:function(){this.m_IsWaiting=true;$(this.m_DomNode).find("span.nodeText").addClass("waiting");return this},endWait:function(){this.m_IsWaiting=false;$(this.m_DomNode).find("span.nodeText").removeClass("waiting");
return this},makeSection:function(){this.m_IsSection=true;$(this.m_DomNode).addClass("section");return this},unSection:function(){this.m_IsSection=false;$(this.m_DomNode).removeClass("section");return this},isOpen:function(){return this.m_IsOpen},isWaiting:function(){return this.m_IsWaiting},isSection:function(){return this.m_IsSection},isBranch:function(){return null!==this.m_Children},render:function(a,b){var c=this.makeNode(b),e=document.createElement("ul");$(e).addClass("tree22").append(c);a.html(e);
return this},makeNode:function(a){var b="nodeText clickable";if(this.m_Class)b+=" "+this.m_Class;var c='<span class="'+b+'">'+this.m_Label+"</span>";this.m_DomNode=b=document.createElement("li");if(this.isBranch()){$(b).addClass("branch");this.isOpen()&&$(b).addClass("open");this.isSection()&&$(b).addClass("TreeSection");if(a.usesContext())c+=' <span class="context_click">[+]</span>'}else{$(b).addClass("leaf");if(a.usesContext())c+=' <span class="context"><img src="/js/treeview/images/arrow-contracted.gif" /></span>'}$(b).html('<div><span class="treeIcon clickable"></span>'+
c+"</div>");if(this.size()>0){$(b).append("<span class='content'><ul></ul></span>");c=$(b).contents("span.content").children("ul");for(var e=0;e<this.size();e++)$(c).append(this.child(e).makeNode(a))}var d=this;d.m_Callbacks.Drag&&$(b).draggable(d.m_Callbacks.Drag);d.m_Callbacks.Drop&&$(b).droppable(d.m_Callbacks.Drop);if(d.m_Callbacks.Click){c=$(b).children("div").children("span.clickable");$(c).click(function(j){j.stopPropagation();d.m_Callbacks.Click.call(a,d)})}if(a.usesContext()){if(d.m_Callbacks.Context){var f=
$(b).find("span.context");f.bind("mouseenter click",function(j){j.stopPropagation();d.m_Callbacks.Context.call(a,d,f)})}if(d.m_Callbacks.ContextClick){var h=$(b).find("span.context_click").first();h.bind("click",function(j){j.stopPropagation();d.m_Callbacks.ContextClick.call(a,d,h)})}}return b},setLeaf:function(){this.m_Children=null;return this}};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
function TABmaker(a){if(a){var b=1E3;for(i in a)$(a[i]).attr("tabindex",b++);if(a.length){$(a[a.length-1]).keydown(function(c){if(c.which==9){c.preventDefault();$(a[0]).focus()}});$(a[0]).focus()}}}
function IGNMPRexportTablesExecute(a,b){function c(n){return f+"_"+n}function e(){return{DbName:$("input[name=exportTableDb]",h).val(),DbApi:$("select[name=exportTableDbApi] option:selected",h).val(),DbUser:$("input[name=exportTableDbUsername]",h).val(),DbPassword:$("input[name=exportTableDbPassword]",h).val(),MapperGuid:b,VmdFile:a}}function d(n){$(n.getWrapperElement(),h).css("position","static").css("left","0px").css("right","0px");var t=false,w=$(".previewExportTableButton",h),s=$("#"+c("previewExportTableStatusIndicator")),
r=$(".ui-dialog-buttonpane button:contains('Execute Statements')");r.attr("disabled",true).addClass("ui-state-disabled");w.click(function(){if(!t){t=true;r.attr("disabled",true).addClass("ui-state-disabled");w.attr("disabled","disabled");s.html('<img src="/js/mapper/images/spinner.gif" />');Ajax.post("/export_mapper_vmd_tables_to_db",e(),function(y){t=false;r.attr("disabled",false).removeClass("ui-state-disabled");w.removeAttr("disabled");s.html("");n.setValue(y.Error?y.Error:y.ExportPreview);n.clearHistory();
$(".tableDropWarning",h).get(0).style.display=y.HaveDropCommands?"":"none"},"json")}});TABmaker(["#"+c("exportTableDbApi"),"#"+c("exportTableDb"),"#"+c("exportTableDbUsername"),"#"+c("exportTableDbPassword"),"#"+f+" .previewExportTableButton","#"+f+"~* button:last","#"+f+"~* button:first"])}var f="IGNexportTableDialog";if($("#"+f).length){$("#"+f).dialog("destroy");$("#"+f).remove()}$(document).find("body").append('<div id="'+f+'">       <form>       <table>       <tr>        <td><label for="'+c("exportTableDbApi")+
'">Database API:</label></td><td><select name="exportTableDbApi" id="'+c("exportTableDbApi")+'"/></select></td> \t\t<td><label for="'+c("exportTableDb")+'">Database:</label></td><td><input id="'+c("exportTableDb")+'" name="exportTableDb" type="text"/></td>         <td rowspan="2"><button type="button" class="previewExportTableButton">Preview Create Statements</button></td> \t\t<td rowspan="2" id="'+c("previewExportTableStatusIndicator")+'"></td>        </tr>       <tr>          <td><label for="'+
c("exportTableDbUsername")+'">Username:</label></td><td><input name="exportTableDbUsername" id="'+c("exportTableDbUsername")+'" type="text"/></td>           <td><label for="'+c("exportTableDbPassword")+'">Password:</label></td><td><input id="'+c("exportTableDbPassword")+'" name="exportTableDbPassword" type="password" autocomplete="off" /></td>       </tr>       </table>       <div>          <div style="padding-top: 5px;">Preview Results/SQL Statements:             <span class="tableDropWarning" style="display:none; color: #FF0000">WARNING: Tables will be dropped.</span>          <div>          <div class="tableExportSqlEditor" style="background-color: #FFFFFF; border: 1px solid #000000; width: 750px; height: 150px;"></div>          <div style="padding-top: 5px;">Execute Results:</div>          <div class="tableExportSqlResult" style="background-color: #FFFFFF; padding-left: 3px; border: 1px solid #000000; overflow-x: auto; width: 750px; height: 150px;"></div></>       </div>       </form>       </div>');
var h=$("#"+f),j=false,p;h.dialog({bgiframe:true,width:780,height:530,title:"Export Tables: "+a,modal:true,autoOpen:false,resizable:false,buttons:{Close:function(){$(this).dialog("close")},"Execute Statements":function(){if(!j){j=true;var n=e();n.ExecuteSql=p.getValue();$(".tableExportSqlResult",h).html("Executing ...");Ajax.post("/export_mapper_vmd_tables_to_db",n,function(t){j=false;t=t.ExportComplete?"Executed successfully.":t.Error;$(".tableExportSqlResult",h).html("<pre>"+t+"</pre>")})}}}});
Ajax.post("/db_api_list","",function(n){h.dialog("open");p=new CodeMirror($(".tableExportSqlEditor",h).get(0),{mode:"text/x-plsql",theme:"ifware",indentUnit:3,tabMode:"indent",lineNumbers:true,height:"150px",width:"740px"});if(n){var t=$("select[name=exportTableDbApi]",h);for(DbIndex in n.DbApi){var w=n.DbApi[DbIndex],s=$("<option></option");s.val(w).html(w);t.append(s)}}d(p)},"json")};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
var MPRapp={};MPRapp.type="Iguana";MPRapp.pageLookup={};PAGsetupCommonMapCalls(MPRapp.pageLookup);MPRapp.defaultRequest=function(a){ERRrenderDefaultError(a,true)};MPRapp.renderError=function(a,b){ERRrenderError(a,b,false)};MPRapp.header='<div class="header"><span class="logo"><img src="/mapper/logo_utrans.png"></span>';
function MAPretrieveHeaderHTML(a,b){b.User=escape(b.User);b.ComponentName=escape(b.ComponentName);var c="";c+='<div class="header">               <div class="header-left">                 <span class="logo">                 <img src="/mapper/logo_utrans.png">                 </span>                 <span class="crumb">';c+=MAPsetBreadCrumb(a,b);c+='  </span>               </div>               <div class="header-right">                 <span class="help">                   <a href="http://www.interfaceware.com/wiki/translator.html?v=6.0.0" target="_manual">Help</a>                 </span>                 <span class="login">Welcome, ';
c+=b.User;c+='     <ul id="menu">                     <li>                       <a href="#" onClick="return false;">&blacktriangledown;</a>                       <ul>                         <li><a href="/settings#Page=users/edit?user='+b.User+'"><img src="/images/icon-account.png">My Account</a></li>                         <li><a href="/login.html"><img src="/images/icon-logout.png">Log Out</a></li>                       </ul>                     </li>                   </ul>                 </span>               </div>             </div>';
return c}
function MAPretrieveDefaultHeaderHTML(){var a="";a+='<div class="header">             <div class="header-left">             <span class="logo">              <img src="/mapper/logo_utrans.png">             </span>             <span class="crumb">              <a href="/">Dashboard</a> &gt; Error             </span>             </div>             <div class="header-right">             <span class="help">              <a href="http://www.interfaceware.com/wiki/translator.html" target="_manual">Help</a>             </span>             </div>             </div>';return a}
function MAPretrieveDocTitle(a,b){return PAGbaseTitle+" > Dashboard > Channel "+PAGgetField(b,"ChannelName")+" > Configuration"}
function MAPretrieveParams(a,b){var c={};if("lua_editor"==a){c.ChannelGuid=b.ChannelGuid;c.ChannelName=b.ChannelName;c.ComponentType=b.ComponentType;c.ComponentName=b.ComponentName;c.User=b.User;c.Index=b.Index;c.Module=b.Module}else if("message_preview"==a){c.ChannelGuid=b.ChannelGuid;c.ChannelName=b.ChannelName;c.ComponentType=b.ComponentType;c.ComponentName=b.ComponentName;c.User=b.User;c.Index=b.Index;c.Module=b.Module}return c}
function MAPsetBreadCrumb(a,b){if(b.DashboardLinkOnly)return"<a href='/'>Dashboard</a> &rang; "+b.DashboardLinkOnly;var c="";MPRapp.ExtraOtherFileMenuOptions=[{name:"Create DB Tables",className:"optionCreateDbTables",func:function(h){IGNMPRexportTablesExecute(h.label,h.editor.ifware.ChannelGuid)},shouldShowFunc:function(h){return h.type=="vmd"}}];var e={Guid:PAGgetField(b,"ChannelGuid"),Name:PAGgetField(b,"ChannelName")},d={Type:PAGgetOptionalField(b,"ComponentType"),Name:PAGgetOptionalField(b,"ComponentName")};
c="<a href='/'>Dashboard</a> &rang; ";c+="<a href='/channel#Channel="+PAGescapeQuotes(encodeURIComponent(e.Name))+"'>"+PAGhtmlEscape(e.Name)+"</a> &rang;&nbsp; ";var f="";f="Destination"==d.Type?"destinationTab":"Filter"==d.Type?"filterTab":"sourceTab";c+="<a href='/channel#Channel="+PAGescapeQuotes(encodeURIComponent(e.Name))+"&editTab="+f+"'>"+d.Name+"</a> &rang;&nbsp; ";if("lua_editor"==a)c+="Script";else if("stage_commit"==a)c+="Commit to Source Control";else if("review_commits"==a||"review_file_commits"==
a)c+="Review Commit History";else if("message_edit"==a)c+=b.NewMsg==1?"New Message":"Edit Message ("+PAGgetField(b,"Index")+" of "+PAGgetField(b,"TotalSd")+")";else if("message_preview"==a)c+="Messages";else if("error"==a)c+="Error";return c};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
function AjaxImpl(a,b){function c(j){var p=j.error;j.error=function(t,w,s){if(p)try{if(p(t,w,s))return}catch(r){}w!=="abort"&&w!="notmodified"&&a(w,function(){jQuery.ajax(j)},t)};var n=j.success;j.success=function(t,w,s){if(s.status){var r;try{r=b(t,w,s)}catch(y){}if(r)a(r,function(){jQuery.ajax(j)},s);else n&&n(t,w,s)}else a(null,function(){jQuery.ajax(j)},s)};return jQuery.ajax(j)}function e(j,p,n,t){if(typeof n=="function"){t=n;n=undefined}return j.load(p,n,function(w,s,r){if(t)try{if(t(w,s,r))return}catch(y){}var C=
!r.status||s!="success"&&s!="notmodified";if(C){if(r.status)C=s}else try{C=b(w,s,r)||null}catch(B){C=null}if(C||!r.status)a(C,function(){e(j,p,n,t)},r)})}function d(j){return function(p,n,t,w){return typeof n=="function"?j(p,undefined,n,t):typeof t!="function"?j(p,n,undefined,t):j(p,n,t,w)}}function f(j){return d(function(p,n,t,w){return c({url:p,data:n,type:j,success:t,dataType:w})})}function h(j){return d(function(p,n,t){return c({url:p,data:n,success:t,dataType:j})})}a||(a=function(){});b||(b=
function(){});return{ajax:c,load:e,abort:function(j){if(j)try{j.onreadystatechange=function(){};j.abort()}catch(p){}},get:f(),getJSON:h("json"),getScript:h("script"),post:f("POST")}};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
var MiniLogin=function(){function a(){clearTimeout(f);jQuery.ajax({url:"/login_check",method:"POST",data:{Username:$("#login-user").val(),Password:$("#login-pass").val()},dataType:"json",cache:false,success:function(n){if(n)if(n.LoginOkay)if(n.UnlockRequired)window.location="/log_locker_settings.html";else{$("#login-popup").dialog("close");if(h){n=h;h=null;n()}}else $("#login-message").text("Login failed: "+n.ErrorText||"Please try again.");else $("#login-message").text("Login failed: Iguana is not responding.")},
error:function(n,t){if(n.status==403||t=="parsererror"){$("#login-message").text("Iguana is restarting, please wait...");f=setTimeout(a,1E3)}else $("#login-message").text("Login failed: Iguana is not responding.")}})}function b(n,t){if(j)if(h){var w=h;h=function(){try{w()}catch(y){}t()}}else{var s=$("#login-popup");s.length||(s=c());h=function(){t()};var r=$("#login-pass").val(d);$("#login-message").text(n);s.dialog("open");r.focus()}}function c(){$("body").append('         <div id="login-popup" style="display:none">            <table width="100%">            <tr>               <td colspan="2" id="login-message" align="center">            <tr>               <td align="right">Username:               <td><input type="text" id="login-user" readonly class="full_length">            <tr>               <td align="right">Password:               <td><input id="login-pass" type="password" class="full_length">            </table>         </div>      ');
$("#login-user").val(e);$("#login-pass").keydown(function(n){if(n.keyCode==13){n.preventDefault();a()}});return $("#login-popup").dialog({autoOpen:false,closeOnEscape:false,modal:true,open:function(){$(".ui-dialog-titlebar-close").hide()},resizable:false,title:"Iguana Login",buttons:{"Login & Retry":a,Cancel:function(){window.location="/"}}})}var e,d,f,h,j;$(document).ready(function(){$(window).unload(function(){j=false});j=true});var p=AjaxImpl(function(n,t,w){var s;if(w.status==403||n=="parsererror")s=
"Your session has expired.";else if(n!="notmodified")s="Iguana is not responding.";b(s,t)});p.show=b;p.loggedIn=function(){var n=p.ajax({url:"/login_check",method:"POST",dataType:"json",cache:false,async:false});try{if($.parseJSON(n.responseText).LoginOkay)return true}catch(t){}b("Your session has expired.",$.noop);return false};p.init=function(n,t){e=n;d=t};return p}();/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
var MiniBrowser=function(){var a,b,c,e;return{create:function(d){function f(r,y,C){var B=$("#mb-progress");B.length>0&&B.remove();$("body").append('            <div id="mb-progress" style="display:none">               <img src="/js/mapper/images/spinner.gif">               Importing message from logs...            </div>');B=$("#mb-progress").dialog({autoOpen:false,minHeight:50,resizable:false,title:"Importing"});B.dialog("open");w.getJSON(C?"/http_log_entries?":"/export_to_mapper?",{Action:"export",
TargetGuid:d.target,"Export.Plan":y},function(G){if(G.Success){B.dialog("close");d.onSuccess(G.ImportStart+1,G.SizeOfImport)}else{B.html(G.Error);B.dialog({buttons:{Close:function(){$(this).dialog("close")}},title:"Import Failed"})}})}function h(r,y){var C=$("#mb-source",r),B=C.val();C.html("<option selected></option>");$("option",C).text(B);$("<option>--</option>").attr("value",B).appendTo(C);$.map(y,function(G){if(G.Name!=B){C.append("<option></option>");$("option:last",C).text(G.Name)}})}function j(r,
y,C,B){!B&&C.BeforePosition===undefined&&h(r,y.Sources);var G=Math.max(0,5-$("div.mb-entry",r).length),N=$("#mb-loading",r),T=$('<div class="mb-entry"></div>');$.map(y.Entries.slice(0,G),function(F){T.clone().html(F.Preview).click(function(){try{d.onStart()}catch(P){}f(r,F.MessageId,B)}).insertBefore(N)});if(y.Complete||y.Entries.length>=G){N.hide();$("div.mb-entry",r).length||$("#mb-status",r).text("No matching entries.").show()}else{$("#mb-progress").html(y.Progress);C.BeforePosition=y.Continue.Position;
C.Date=y.Continue.Date;n(r,C)}}function p(r){var y=$("#mb-date").val().replace(/\s/g,""),C=$("#mb-time").val().replace(/\s/g,"");if(C&&!y){y=new Date;y=[y.getFullYear(),y.getMonth()+1,y.getDate()].join("/")}else if(y&&!C)C="23:59:59";if(y&&!y.match(/^\d+\/\d+\/\d+$/))$("#mb-status").text("Invalid date (use YYYY/MM/DD).").show();else C&&!C.match(/^\d+:\d+(:\d+)?$/)?$("#mb-status").text("Invalid time (use HH:MM or HH:MM:SS).").show():r(y?[y,C].join(" "):"")}function n(r,y,C){s&&w.abort(s);s=w.getJSON(C?
"/http_log_entries":"/log_entries",y,function(B){s=undefined;j(r,B,y,C)})}function t(r,y){$("div.mb-entry",r).remove();$("#mb-status",r).hide();p(function(C){$("#mb-progress",r).text("");$("#mb-loading",r).show();n(r,{Output:"json",Filter:$("#mb-query",r).val(),Source:$("#mb-source",r).val(),Before:C,Type:"messages",TargetGuid:d.target},y)})}var w=window.Ajax||window.MiniLogin,s;d.parent.append('         <div id="mini-browser">            <div id="mb-title" style="display:none">               Select a message from the logs to add as sample data.            </div>            <span id="mb-options" style="display:none">               <input id="mb-query" title="Search Text">               <select id="mb-source">                  <option selected></option>               </select>               <input id="mb-date" size="10" title="Select Date">               <input id="mb-time" size="6" title="Time">            </span>            <div id="mb-divider"></div>            <button id="mb-search">Add From Logs</button>            <button id="mb-addfromhttp">Add From HTTP Request Log</button>            <div id="mb-status" style="display:none"></div>            <div id="mb-loading" style="display:none">               <img src="/js/mapper/images/spinner.gif">               Searching... <span id="mb-progress"></span>            </div>         </div>');
d.https||$("#mb-addfromhttp").remove();$("#mb-query").val(a||"").change(function(){a=$(this).val()}).watermark().add("#mb-date,#mb-time").keydown(function(r){if(r.keyCode==13)$("#mb-search, #mb-addfromhttp").filter(":visible").click();else if(r.keyCode==27)d.onCancel()});$("#mb-source option").text(b||d.source);$("#mb-source").change(function(){b=$(this).val()});$("#mb-date").val(c||"").change(function(){c=$(this).val()}).watermark().datepicker({dateFormat:"yy/mm/dd",changeMonth:true,changeYear:true,
maxDate:"+0d",beforeShow:function(){$(".ui-datepicker").css("z-index",950)},onSelect:function(r){c=r;$(this).watermark()}});$("#mb-time").val(e||"").change(function(){e=$(this).val()}).watermark();$("#mb-search").click(function(){try{d.onOpen()}catch(r){}$("#mb-divider, #mb-addfromhttp").hide();$("#mb-title, #mb-options").show();$(this).text("Search");t($("#mini-browser"))});$("#mb-addfromhttp").click(function(){try{d.onOpen()}catch(r){}$("#mb-divider, #mb-search, #mb-source").hide();$("#mb-date, #mb-time").parent().hide();
$("#mb-title, #mb-options").show();$(this).text("Search");t($("#mini-browser"),true)})}}}();
