var CodeMirror = (function () { function q(aD, aA) { var bN = {}, a9 = q.defaults; for (var ap in a9) { if (a9.hasOwnProperty(ap)) { bN[ap] = (aA && aA.hasOwnProperty(ap) ? aA : a9)[ap] } } var cy = bN.document; var au = cy.createElement("div"); au.className = "CodeMirror" + (bN.lineWrapping ? " CodeMirror-wrap" : ""); au.innerHTML = '
 
'; if (aD.appendChild) { aD.appendChild(au) } else { aD(au) } var bK = au.firstChild, bc = bK.firstChild, ba = au.lastChild, bA = ba.firstChild, b2 = bA.firstChild, ay = b2.firstChild, aQ = ay.firstChild, bk = ay.nextSibling.firstChild, al = bk.firstChild, a3 = al.nextSibling, a7 = a3.nextSibling, ah = a7.nextSibling; cp(); if (o) { bc.style.width = "0px" } if (!e) { bk.draggable = true } bk.style.outline = "none"; if (bN.tabindex != null) { bc.tabIndex = bN.tabindex } if (!bN.gutter && !bN.lineNumbers) { ay.style.display = "none" } try { cf("x") } catch (bU) { if (bU.message.match(/runtime/i)) { bU = new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)") } throw bU } var bT = new v(), am = new v(), cC; var bX, ck = new g([new Z([new d("")])]), b3, b5; bG(); var cK = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false}; var b4, bf, aR, bt = 0, a2, b9 = false, cd = false; var cb, bS, ar, cA, aG, a6, aJ, cm; var a4 = 0, cD = 0, bz = 0, bB = 0; var bQ; var br = "", aw, bj = aN(); ai(function () { aO(bN.value || ""); cb = false })(); var a0 = new i(); n(ba, "mousedown", ai(b6)); n(ba, "dblclick", ai(bJ)); n(bk, "dragstart", az); n(bk, "selectstart", N); if (!H) { n(ba, "contextmenu", aT) } n(ba, "scroll", function () { bt = ba.scrollTop; bZ([]); if (bN.fixedGutter) { ay.style.left = ba.scrollLeft + "px" } if (bN.onScroll) { bN.onScroll(bV) } }); n(window, "resize", function () { bZ(true) }); n(bc, "keyup", ai(b7)); n(bc, "input", aH); n(bc, "keydown", ai(bY)); n(bc, "keypress", ai(bd)); n(bc, "focus", cH); n(bc, "blur", av); n(ba, "dragenter", s); n(ba, "dragover", s); n(ba, "drop", ai(af)); n(ba, "paste", function () { bp(); aH() }); n(bc, "paste", aH); n(bc, "cut", ai(function () { if (!bN.readOnly) { bh("") } })); var ci; try { ci = (cy.activeElement == bc) } catch (bU) { } if (ci) { setTimeout(cH, 20) } else { av() } function bg(cN) { return cN >= 0 && cN < ck.size } var bV = au.CodeMirror = {getValue: bO, setValue: ai(aO), getSelection: bP, replaceSelection: ai(bh), focus: function () { bp(); cH(); aH() }, setOption: function (cO, cP) { var cN = bN[cO]; bN[cO] = cP; if (cO == "mode" || cO == "indentUnit") { bG() } else { if (cO == "readOnly" && cP == "nocursor") { av(); bc.blur() } else { if (cO == "readOnly" && !cP) { co(true) } else { if (cO == "theme") { cp() } else { if (cO == "lineWrapping" && cN != cP) { ai(cs)() } else { if (cO == "tabSize") { ai(cI)() } } } } } } if (cO == "lineNumbers" || cO == "gutter" || cO == "firstLineNumber" || cO == "theme") { bZ(true) } }, getOption: function (cN) { return bN[cN] }, undo: ai(cG), redo: ai(cv), indentLine: ai(function (cO, cN) { if (typeof cN != "string") { if (cN == null) { cN = bN.smartIndent ? "smart" : "prev" } else { cN = cN ? "add" : "subtract" } } if (bg(cO)) { bo(cO, cN) } }), indentSelection: ai(cn), historySize: function () { return{undo: a0.done.length, redo: a0.undone.length} }, clearHistory: function () { a0 = new i() }, matchBrackets: ai(function () { b0(true) }), getTokenAt: ai(function (cN) { cN = aK(cN); return cr(cN.line).getTokenAt(bX, cg(cN.line), cN.ch) }), getStateAfter: function (cN) { cN = bL(cN == null ? ck.size - 1 : cN); return cg(cN + 1) }, cursorCoords: function (cN) { if (cN == null) { cN = cK.inverted } return ag(cN ? cK.from : cK.to) }, charCoords: function (cN) { return ag(aK(cN)) }, coordsChar: function (cN) { var cO = ac(bk); return bv(cN.x - cO.left, cN.y - cO.top) }, markText: ai(bs), setBookmark: aL, setMarker: ai(bI), clearMarker: ai(ak), setLineClass: ai(bb), hideLine: ai(function (cN) { return cw(cN, true) }), showLine: ai(function (cN) { return cw(cN, false) }), onDeleteLine: function (cN, cO) { if (typeof cN == "number") { if (!bg(cN)) { return null } cN = cr(cN) } (cN.handlers || (cN.handlers = [])).push(cO); return cN }, lineInfo: aM, addWidget: function (cR, cP, cT, cQ, cV) { cR = cE(aK(cR)); var cS = cR.yBot, cO = cR.x; cP.style.position = "absolute"; bA.appendChild(cP); if (cQ == "over") { cS = cR.y } else { if (cQ == "near") { var cN = Math.max(ba.offsetHeight, ck.height * bC()), cU = Math.max(bA.clientWidth, bk.clientWidth) - aX(); if (cR.yBot + cP.offsetHeight > cN && cR.y > cP.offsetHeight) { cS = cR.y - cP.offsetHeight } if (cO + cP.offsetWidth > cU) { cO = cU - cP.offsetWidth } } } cP.style.top = (cS + ce()) + "px"; cP.style.left = cP.style.right = ""; if (cV == "right") { cO = bA.clientWidth - cP.offsetWidth; cP.style.right = "0px" } else { if (cV == "left") { cO = 0 } else { if (cV == "middle") { cO = (bA.clientWidth - cP.offsetWidth) / 2 } } cP.style.left = (cO + aX()) + "px" } if (cT) { aq(cO, cS, cO + cP.offsetWidth, cS + cP.offsetHeight) } }, lineCount: function () { return ck.size }, clipPos: aK, getCursor: function (cN) { if (cN == null) { cN = cK.inverted } return U(cN ? cK.from : cK.to) }, somethingSelected: function () { return !W(cK.from, cK.to) }, setCursor: ai(function (cN, cP, cO) { if (cP == null && typeof cN.line == "number") { aY(cN.line, cN.ch, cO) } else { aY(cN, cP, cO) } }), setSelection: ai(function (cP, cO, cN) { (cN ? bn : bm)(aK(cP), aK(cO || cP)) }), getLine: function (cN) { if (bg(cN)) { return cr(cN).text } }, getLineHandle: function (cN) { if (bg(cN)) { return cr(cN) } }, setLine: ai(function (cN, cO) { if (bg(cN)) { bD(cO, {line: cN, ch: 0}, {line: cN, ch: cr(cN).text.length}) } }), removeLine: ai(function (cN) { if (bg(cN)) { bD("", {line: cN, ch: 0}, aK({line: cN + 1, ch: 0})) } }), replaceRange: ai(bD), getRange: function (cO, cN) { return cB(aK(cO), aK(cN)) }, execCommand: function (cN) { return F[cN](bV) }, moveH: ai(cq), deleteH: ai(b8), moveV: ai(cj), toggleOverwrite: function () { b9 = !b9 }, posFromIndex: function (cO) { var cP = 0, cN; ck.iter(0, ck.size, function (cQ) { var cR = cQ.text.length + 1; if (cR > cO) { cN = cO; return true } cO -= cR; ++cP }); return aK({line: cP, ch: cN}) }, indexFromPos: function (cO) { if (cO.line < 0 || cO.ch < 0) { return 0 } var cN = cO.ch; ck.iter(0, cO.line, function (cP) { cN += cP.text.length + 1 }); return cN }, scrollTo: function (cN, cO) { if (cN != null) { ba.scrollTop = cN } if (cO != null) { ba.scrollLeft = cO } bZ([]) }, operation: function (cN) { return ai(cN)() }, refresh: function () { bZ(true); if (ba.scrollHeight > bt) { ba.scrollTop = bt } }, getInputField: function () { return bc }, getWrapperElement: function () { return au }, getScrollerElement: function () { return ba }, getGutterElement: function () { return ay }}; function cr(cN) { return x(ck, cN) } function aV(cO, cN) { aJ = true; var cP = cN - cO.height; for (var cQ = cO; cQ; cQ = cQ.parent) { cQ.height += cP } } function aO(cN) { var cO = {line: 0, ch: 0}; aF(cO, {line: ck.size - 1, ch: cr(ck.size - 1).text.length}, w(cN), cO, cO); cb = true } function bO(cN) { var cO = []; ck.iter(0, ck.size, function (cP) { cO.push(cP.text) }); return cO.join("\n") } function b6(cT) { aW(u(cT, "shiftKey")); for (var cQ = h(cT); cQ != au; cQ = cQ.parentNode) { if (cQ.parentNode == bA && cQ != b2) { return } } for (var cQ = h(cT); cQ != au; cQ = cQ.parentNode) { if (cQ.parentNode == aQ) { if (bN.onGutterClick) { bN.onGutterClick(bV, m(aQ.childNodes, cQ) + cD, cT) } return N(cT) } } var cN = aU(cT); switch (t(cT)) { case 3: if (H && !G) { aT(cT) } return; case 2: if (cN) { aY(cN.line, cN.ch, true) } return } if (!cN) { if (h(cT) == ba) { N(cT) } return } if (!b5) { cH() } var cO = +new Date; if (aR && aR.time > cO - 400 && W(aR.pos, cN)) { N(cT); setTimeout(bp, 20); return aB(cN.line) } else { if (bf && bf.time > cO - 400 && W(bf.pos, cN)) { aR = {time: cO, pos: cN}; N(cT); return bw(cN) } else { bf = {time: cO, pos: cN} } } var cV = cN, cP; if (z && !bN.readOnly && !W(cK.from, cK.to) && !T(cN, cK.from) && !T(cK.to, cN)) { if (e) { bk.draggable = true } var cS = n(cy, "mouseup", ai(function (cW) { if (e) { bk.draggable = false } a2 = false; cS(); if (Math.abs(cT.clientX - cW.clientX) + Math.abs(cT.clientY - cW.clientY) < 10) { N(cW); aY(cN.line, cN.ch, true); bp() } }), true); a2 = true; return } N(cT); aY(cN.line, cN.ch, true); function cU(cW) { var cY = aU(cW, true); if (cY && !W(cY, cV)) { if (!b5) { cH() } cV = cY; bn(cN, cY); cb = false; var cX = bq(); if (cY.line >= cX.to || cY.line < cX.from) { cP = setTimeout(ai(function () { cU(cW) }), 150) } } } var cR = n(cy, "mousemove", ai(function (cW) { clearTimeout(cP); N(cW); cU(cW) }), true); var cS = n(cy, "mouseup", ai(function (cW) { clearTimeout(cP); var cX = aU(cW); if (cX) { bn(cN, cX) } N(cW); bp(); cb = true; cR(); cS() }), true) } function bJ(cN) { for (var cP = h(cN); cP != au; cP = cP.parentNode) { if (cP.parentNode == aQ) { return N(cN) } } var cO = aU(cN); if (!cO) { return } aR = {time: +new Date, pos: cO}; N(cN); bw(cO) } function af(cT) { cT.preventDefault(); var cU = aU(cT, true), cN = cT.dataTransfer.files; if (!cU || bN.readOnly) { return } if (cN && cN.length && window.FileReader && window.File) { function cQ(cZ, cY) { var cX = new FileReader; cX.onload = function () { cW[cY] = cX.result; if (++cO == cP) { cU = aK(cU); ai(function () { var c0 = bD(cW.join(""), cU, cU); bn(cU, c0) })() } }; cX.readAsText(cZ) } var cP = cN.length, cW = Array(cP), cO = 0; for (var cR = 0; cR < cP; ++cR) { cQ(cN[cR], cR) } } else { try { var cW = cT.dataTransfer.getData("Text"); if (cW) { var cV = cK.from, cS = cK.to; bn(cU, cU); if (a2) { bD("", cV, cS) } bh(cW); bp() } } catch (cT) { } } } function az(cO) { var cN = bP(); J(cN); cO.dataTransfer.setDragImage(aa, 0, 0); cO.dataTransfer.setData("Text", cN) } function cx(cT) { var cQ = L[u(cT, "keyCode")], cS = r[bN.keyMap].auto, cR, cN; function cP() { return cS.call ? cS.call(null, bV) : cS } if (cQ == null || cT.altGraphKey) { if (cS) { bN.keyMap = cP() } return null } if (u(cT, "altKey")) { cQ = "Alt-" + cQ } if (u(cT, "ctrlKey")) { cQ = "Ctrl-" + cQ } if (u(cT, "metaKey")) { cQ = "Cmd-" + cQ } if (u(cT, "shiftKey") && (cR = j("Shift-" + cQ, bN.extraKeys, bN.keyMap))) { cN = true } else { cR = j(cQ, bN.extraKeys, bN.keyMap) } if (typeof cR == "string") { if (F.propertyIsEnumerable(cR)) { cR = F[cR] } else { cR = null } } if (cS && (cR || !K(cT))) { bN.keyMap = cP() } if (!cR) { return false } var cO = b4; try { if (bN.readOnly) { cd = true } if (cN) { b4 = null } cR(bV) } finally { b4 = cO; cd = false } N(cT); return true } var cu = null; function bY(cP) { if (!b5) { cH() } if (C && cP.keyCode == 27) { cP.returnValue = false } if (bN.onKeyEvent && bN.onKeyEvent(bV, I(cP))) { return } var cN = u(cP, "keyCode"); aW(cN == 16 || u(cP, "shiftKey")); var cO = cx(cP); if (window.opera) { cu = cO ? cN : null; if (!cO && cN == 88 && u(cP, G ? "metaKey" : "ctrlKey")) { bh("") } } } function bd(cQ) { var cP = u(cQ, "keyCode"), cN = u(cQ, "charCode"); if (window.opera && cP == cu) { cu = null; N(cQ); return } if (bN.onKeyEvent && bN.onKeyEvent(bV, I(cQ))) { return } if (window.opera && !cQ.which && cx(cQ)) { return } if (bN.electricChars && bX.electricChars && bN.smartIndent && !bN.readOnly) { var cO = String.fromCharCode(cN == null ? cP : cN); if (bX.electricChars.indexOf(cO) > -1) { setTimeout(ai(function () { bo(cK.to.line, "smart") }), 75) } } aH() } function b7(cN) { if (bN.onKeyEvent && bN.onKeyEvent(bV, I(cN))) { return } if (u(cN, "keyCode") == 16) { b4 = null } } function cH() { if (bN.readOnly == "nocursor") { return } if (!b5) { if (bN.onFocus) { bN.onFocus(bV) } b5 = true; if (au.className.search(/\bCodeMirror-focused\b/) == -1) { au.className += " CodeMirror-focused" } if (!a6) { co(true) } } ae(); cz() } function av() { if (b5) { if (bN.onBlur) { bN.onBlur(bV) } b5 = false; if (bQ) { ai(function () { if (bQ) { bQ(); bQ = null } })() } au.className = au.className.replace(" CodeMirror-focused", "") } clearInterval(cC); setTimeout(function () { if (!b5) { b4 = null } }, 150) } function aF(cS, cR, cQ, cO, cN) { if (cd) { return } if (a0) { var cP = []; ck.iter(cS.line, cR.line + 1, function (cT) { cP.push(cT.text) }); a0.addChange(cS.line, cQ.length, cP); while (a0.done.length > bN.undoDepth) { a0.done.shift() } } aj(cS, cR, cQ, cO, cN) } function bW(cV, cW, cN) { var cX = cV.pop(), cR = cX ? cX.length : 0, cP = []; for (var cQ = cN > 0 ? 0 : cR - 1, cS = cN > 0 ? cR : -1; cQ != cS; cQ += cN) { var cU = cX[cQ]; var cY = [], cO = cU.start + cU.added; ck.iter(cU.start, cO, function (cZ) { cY.push(cZ.text) }); cP.push({start: cU.start, added: cU.old.length, old: cY}); var cT = aK({line: cU.start + cU.old.length - 1, ch: Q(cY[cY.length - 1], cU.old[cU.old.length - 1])}); aj({line: cU.start, ch: 0}, {line: cO - 1, ch: cr(cO - 1).text.length}, cU.old, cT, cT) } cb = true; cW.push(cP) } function cG() { bW(a0.done, a0.undone, -1) } function cv() { bW(a0.undone, a0.done, 1) } function aj(c2, cR, c8, cN, c9) { if (cd) { return } var c7 = false, cQ = br.length; if (!bN.lineWrapping) { ck.iter(c2.line, cR.line, function (da) { if (da.text.length == cQ) { c7 = true; return true } }) } if (c2.line != cR.line || c8.length > 1) { aJ = true } var cZ = cR.line - c2.line, cY = cr(c2.line), cO = cr(cR.line); if (c2.ch == 0 && cR.ch == 0 && c8[c8.length - 1] == "") { var cW = [], cX = null; if (c2.line) { cX = cr(c2.line - 1); cX.fixMarkEnds(cO) } else { cO.fixMarkStarts() } for (var c4 = 0, c6 = c8.length - 1; c4 < c6; ++c4) { cW.push(d.inheritMarks(c8[c4], cX)) } if (cZ) { ck.remove(c2.line, cZ, cm) } if (cW.length) { ck.insert(c2.line, cW) } } else { if (cY == cO) { if (c8.length == 1) { cY.replace(c2.ch, cR.ch, c8[0]) } else { cO = cY.split(cR.ch, c8[c8.length - 1]); cY.replace(c2.ch, null, c8[0]); cY.fixMarkEnds(cO); var cW = []; for (var c4 = 1, c6 = c8.length - 1; c4 < c6; ++c4) { cW.push(d.inheritMarks(c8[c4], cY)) } cW.push(cO); ck.insert(c2.line + 1, cW) } } else { if (c8.length == 1) { cY.replace(c2.ch, null, c8[0]); cO.replace(null, cR.ch, ""); cY.append(cO); ck.remove(c2.line + 1, cZ, cm) } else { var cW = []; cY.replace(c2.ch, null, c8[0]); cO.replace(null, cR.ch, c8[c8.length - 1]); cY.fixMarkEnds(cO); for (var c4 = 1, c6 = c8.length - 1; c4 < c6; ++c4) { cW.push(d.inheritMarks(c8[c4], cY)) } if (cZ > 1) { ck.remove(c2.line + 1, cZ - 1, cm) } ck.insert(c2.line + 1, cW) } } } if (bN.lineWrapping) { var cT = ba.clientWidth / a8() - 3; ck.iter(c2.line, c2.line + c8.length, function (da) { if (da.hidden) { return } var db = Math.ceil(da.text.length / cT) || 1; if (db != da.height) { aV(da, db) } }) } else { ck.iter(c2.line, c4 + c8.length, function (db) { var da = db.text; if (da.length > cQ) { br = da; cQ = da.length; aw = null; c7 = false } }); if (c7) { cQ = 0; br = ""; aw = null; ck.iter(0, ck.size, function (db) { var da = db.text; if (da.length > cQ) { cQ = da.length; br = da } }) } } var cP = [], cV = c8.length - cZ - 1; for (var c4 = 0, c1 = b3.length; c4 < c1; ++c4) { var c5 = b3[c4]; if (c5 < c2.line) { cP.push(c5) } else { if (c5 > cR.line) { cP.push(c5 + cV) } } } var c3 = c2.line + Math.min(c8.length, 500); ct(c2.line, c3); cP.push(c3); b3 = cP; bu(100); ar.push({from: c2.line, to: cR.line + 1, diff: cV}); var cU = {from: c2, to: cR, text: c8}; if (cA) { for (var cS = cA; cS.next; cS = cS.next) { } cS.next = cU } else { cA = cU } function c0(da) { return da <= Math.min(cR.line, cR.line + cV) ? da : da + cV } bm(cN, c9, c0(cK.from.line), c0(cK.to.line)); if (ba.clientHeight) { bA.style.height = (ck.height * bC() + 2 * ce()) + "px" } } function bD(cO, cR, cQ) { cR = aK(cR); if (!cQ) { cQ = cR } else { cQ = aK(cQ) } cO = w(cO); function cP(cU) { if (T(cU, cR)) { return cU } if (!T(cQ, cU)) { return cN } var cS = cU.line + cO.length - (cQ.line - cR.line) - 1; var cT = cU.ch; if (cU.line == cQ.line) { cT += cO[cO.length - 1].length - (cQ.ch - (cQ.line == cR.line ? cR.ch : 0)) } return{line: cS, ch: cT} } var cN; at(cO, cR, cQ, function (cS) { cN = cS; return{from: cP(cK.from), to: cP(cK.to)} }); return cN } function bh(cN, cO) { at(w(cN), cK.from, cK.to, function (cP) { if (cO == "end") { return{from: cP, to: cP} } else { if (cO == "start") { return{from: cK.from, to: cK.from} } else { return{from: cK.from, to: cP} } } }) } function at(cQ, cS, cR, cN) { var cP = cQ.length == 1 ? cQ[0].length + cS.ch : cQ[cQ.length - 1].length; var cO = cN({line: cS.line + cQ.length - 1, ch: cP}); aF(cS, cR, cQ, cO.from, cO.to) } function cB(cR, cQ) { var cO = cR.line, cN = cQ.line; if (cO == cN) { return cr(cO).text.slice(cR.ch, cQ.ch) } var cP = [cr(cO).text.slice(cR.ch)]; ck.iter(cO + 1, cN, function (cS) { cP.push(cS.text) }); cP.push(cr(cN).text.slice(0, cQ.ch)); return cP.join("\n") } function bP() { return cB(cK.from, cK.to) } var bi = false; function ae() { if (bi) { return } bT.set(bN.pollInterval, function () { aE(); by(); if (b5) { ae() } ao() }) } function aH() { var cN = false; bi = true; function cO() { aE(); var cP = by(); if (!cP && !cN) { cN = true; bT.set(60, cO) } else { bi = false; ae() } ao() } bT.set(20, cO) } var a1 = ""; function by() { if (a6 || !b5 || X(bc) || bN.readOnly) { return false } var cO = bc.value; if (cO == a1) { return false } b4 = null; var cP = 0, cN = Math.min(a1.length, cO.length); while (cP < cN && a1[cP] == cO[cP]) { ++cP } if (cP < a1.length) { cK.from = {line: cK.from.line, ch: cK.from.ch - (a1.length - cP)} } else { if (b9 && W(cK.from, cK.to)) { cK.to = {line: cK.to.line, ch: Math.min(cr(cK.to.line).text.length, cK.to.ch + (cO.length - cP))} } } bh(cO.slice(cP), "end"); a1 = cO; return true } function co(cN) { if (!W(cK.from, cK.to)) { a1 = ""; bc.value = bP(); bc.select() } else { if (cN) { a1 = bc.value = "" } } } function bp() { if (bN.readOnly != "nocursor") { bc.focus() } } function cM() { if (!a3.getBoundingClientRect) { return } var cN = a3.getBoundingClientRect(); if (C && cN.top == cN.bottom) { return } var cO = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight); if (cN.top < 0 || cN.bottom > cO) { a3.scrollIntoView() } } function b1() { var cO = cE(cK.inverted ? cK.from : cK.to); var cN = bN.lineWrapping ? Math.min(cO.x, bk.offsetWidth) : cO.x; return aq(cN, cO.y, cN, cO.yBot) } function aq(cP, cU, cN, cT) { var cR = aX(), c0 = ce(), cW = bC(); cU += c0; cT += c0; cP += cR; cN += cR; var cX = ba.clientHeight, cQ = ba.scrollTop, cO = false, cZ = true; if (cU < cQ) { ba.scrollTop = Math.max(0, cU - 2 * cW); cO = true } else { if (cT > cQ + cX) { ba.scrollTop = cT + cW - cX; cO = true } } var cV = ba.clientWidth, cY = ba.scrollLeft; var cS = bN.fixedGutter ? ay.clientWidth : 0; if (cP < cY + cS) { if (cP < 50) { cP = 0 } ba.scrollLeft = Math.max(0, cP - 10 - cS); cO = true } else { if (cN > cV + cY - 3) { ba.scrollLeft = cN + 10 - cV; cO = true; if (cN > bA.clientWidth) { cZ = false } } } if (cO && bN.onScroll) { bN.onScroll(bV) } return cZ } function bq() { var cO = bC(), cQ = ba.scrollTop - ce(); var cN = Math.max(0, Math.floor(cQ / cO)); var cP = Math.ceil((cQ + ba.clientHeight) / cO); return{from: R(ck, cN), to: R(ck, cP)} } function bZ(cX, cS) { if (!ba.clientWidth) { cD = bz = a4 = 0; return } var cQ = bq(); if (cX !== true && cX.length == 0 && cQ.from > cD && cQ.to < bz) { return } var cY = Math.max(cQ.from - 100, 0), cZ = Math.min(ck.size, cQ.to + 100); if (cD < cY && cY - cD < 20) { cY = cD } if (bz > cZ && bz - cZ < 20) { cZ = Math.min(ck.size, bz) } var c0 = cX === true ? [] : bM([ {from: cD, to: bz, domStart: 0} ], cX); var cW = 0; for (var cT = 0; cT < c0.length; ++cT) { var cU = c0[cT]; if (cU.from < cY) { cU.domStart += (cY - cU.from); cU.from = cY } if (cU.to > cZ) { cU.to = cZ } if (cU.from >= cU.to) { c0.splice(cT--, 1) } else { cW += cU.to - cU.from } } if (cW == cZ - cY) { return } c0.sort(function (c2, c1) { return c2.domStart - c1.domStart }); var cP = bC(), cN = ay.style.display; ah.style.display = "none"; aI(cY, cZ, c0); ah.style.display = ay.style.display = ""; var cO = cY != cD || cZ != bz || bB != ba.clientHeight + cP; if (cO) { bB = ba.clientHeight + cP } cD = cY; bz = cZ; a4 = f(ck, cY); b2.style.top = (a4 * cP) + "px"; if (ba.clientHeight) { bA.style.height = (ck.height * cP + 2 * ce()) + "px" } if (ah.childNodes.length != bz - cD) { throw new Error("BAD PATCH! " + JSON.stringify(c0) + " size=" + (bz - cD) + " nodes=" + ah.childNodes.length) } if (bN.lineWrapping) { aw = ba.clientWidth; var cR = ah.firstChild, cV = false; ck.iter(cD, bz, function (c2) { if (!c2.hidden) { var c1 = Math.round(cR.offsetHeight / cP) || 1; if (c2.height != c1) { aV(c2, c1); aJ = cV = true } } cR = cR.nextSibling }); if (cV) { bA.style.height = (ck.height * cP + 2 * ce()) + "px" } } else { if (aw == null) { aw = cf(br) } if (aw > ba.clientWidth) { bk.style.width = aw + "px"; bA.style.width = ""; bA.style.width = ba.scrollWidth + "px" } else { bk.style.width = bA.style.width = "" } } ay.style.display = cN; if (cO || aJ) { aC() } cJ(); if (!cS && bN.onUpdate) { bN.onUpdate(bV) } return true } function bM(cW, cU) { for (var cR = 0, cP = cU.length || 0; cR < cP; ++cR) { var cT = cU[cR], cN = [], cV = cT.diff || 0; for (var cQ = 0, cO = cW.length; cQ < cO; ++cQ) { var cS = cW[cQ]; if (cT.to <= cS.from && cT.diff) { cN.push({from: cS.from + cV, to: cS.to + cV, domStart: cS.domStart}) } else { if (cT.to <= cS.from || cT.from >= cS.to) { cN.push(cS) } else { if (cT.from > cS.from) { cN.push({from: cS.from, to: cT.from, domStart: cS.domStart}) } if (cT.to < cS.to) { cN.push({from: cT.to + cV, to: cS.to + cV, domStart: cS.domStart + (cT.to - cS.from)}) } } } } cW = cN } return cW } function aI(cX, cY, c0) { if (!c0.length) { ah.innerHTML = "" } else { function cN(c2) { var c1 = c2.nextSibling; c2.parentNode.removeChild(c2); return c1 } var cS = 0, cQ = ah.firstChild, cO; for (var cT = 0; cT < c0.length; ++cT) { var cZ = c0[cT]; while (cZ.domStart > cS) { cQ = cN(cQ); cS++ } for (var cR = 0, cV = cZ.to - cZ.from; cR < cV; ++cR) { cQ = cQ.nextSibling; cS++ } } while (cQ) { cQ = cN(cQ) } } var cU = c0.shift(), cQ = ah.firstChild, cR = cX; var cW = cy.createElement("div"), cP; ck.iter(cX, cY, function (c1) { if (cU && cU.to == cR) { cU = c0.shift() } if (!cU || cU.from > cR) { if (c1.hidden) { var c2 = cW.innerHTML = "
"
					} else {
						var c2 = "
" + c1.getHTML(bj) + "
"; if (c1.className) { c2 = '
 
' + c2 + "
" } } cW.innerHTML = c2; ah.insertBefore(cW.firstChild, cQ) } else { cQ = cQ.nextSibling } ++cR }) } function aC() { if (!bN.gutter && !bN.lineNumbers) { return } var cN = b2.offsetHeight, cU = ba.clientHeight; ay.style.height = (cN - cU < 2 ? cU : cN) + "px"; var cP = [], cO = cD; ck.iter(cD, Math.max(bz, cD + 1), function (cW) { if (cW.hidden) { cP.push("
")
				} else {
					var cV = cW.gutterMarker;
					var cY = bN.lineNumbers ? cO + bN.firstLineNumber : null;
					if (cV && cV.text) {
						cY = cV.text.replace("%N%", cY != null ? cY : "")
					} else {
						if (cY == null) {
							cY = "\u00a0"
						}
					}
					cP.push((cV && cV.style ? '
' : "
"), cY);
					for (var cX = 1; cX < cW.height; ++cX) {
						cP.push("
 ") } cP.push("
") } ++cO }); ay.style.display = "none"; aQ.innerHTML = cP.join(""); var cT = String(ck.size).length, cR = aQ.firstChild, cS = B(cR), cQ = ""; while (cS.length + cQ.length < cT) { cQ += "\u00a0" } if (cQ) { cR.insertBefore(cy.createTextNode(cQ), cR.firstChild) } ay.style.display = ""; bk.style.marginLeft = ay.offsetWidth + "px"; aJ = false } function cJ() { var cQ = W(cK.from, cK.to); var cZ = cE(cK.from, true); var cV = cQ ? cZ : cE(cK.to, true); var cT = cK.inverted ? cZ : cV, cO = bC(); var cN = ac(au), cP = ac(ah); bK.style.top = Math.max(0, Math.min(ba.offsetHeight, cT.y + cP.top - cN.top)) + "px"; bK.style.left = Math.max(0, Math.min(ba.offsetWidth, cT.x + cP.left - cN.left)) + "px"; if (cQ) { a3.style.top = cT.y + "px"; a3.style.left = (bN.lineWrapping ? Math.min(cT.x, bk.offsetWidth) : cT.x) + "px"; a3.style.display = ""; a7.style.display = "none" } else { var cX = cZ.y == cV.y, cS = ""; function cY(c3, c2, c1, c0) { cS += '
' } if (cK.from.ch && cZ.y >= 0) { var cW = cX ? bk.clientWidth - cV.x : 0; cY(cZ.x, cZ.y, cW, cO) } var cR = Math.max(0, cZ.y + (cK.from.ch ? cO : 0)); var cU = Math.min(cV.y, bk.clientHeight) - cR; if (cU > 0.2 * cO) { cY(0, cR, 0, cU) } if ((!cX || !cK.from.ch) && cV.y < bk.clientHeight - 0.5 * cO) { cY(0, cV.y, bk.clientWidth - cV.x, cO) } a7.innerHTML = cS; a3.style.display = "none"; a7.style.display = "" } } function aW(cN) { if (cN) { b4 = b4 || (cK.inverted ? cK.to : cK.from) } else { b4 = null } } function bn(cP, cO) { var cN = b4 && aK(b4); if (cN) { if (T(cN, cP)) { cP = cN } else { if (T(cO, cN)) { cO = cN } } } bm(cP, cO); bS = true } function bm(cR, cQ, cN, cP) { ch = null; if (cN == null) { cN = cK.from.line; cP = cK.to.line } if (W(cK.from, cR) && W(cK.to, cQ)) { return } if (T(cQ, cR)) { var cO = cQ; cQ = cR; cR = cO } if (cR.line != cN) { cR = bE(cR, cN, cK.from.ch) } if (cQ.line != cP) { cQ = bE(cQ, cP, cK.to.ch) } if (W(cR, cQ)) { cK.inverted = false } else { if (W(cR, cK.to)) { cK.inverted = false } else { if (W(cQ, cK.from)) { cK.inverted = true } } } cK.from = cR; cK.to = cQ; aG = true } function bE(cR, cO, cP) { function cQ(cU) { var cW = cR.line + cU, cT = cU == 1 ? ck.size : -1; while (cW != cT) { var cS = cr(cW); if (!cS.hidden) { var cV = cR.ch; if (cV > cP || cV > cS.text.length) { cV = cS.text.length } return{line: cW, ch: cV} } cW += cU } } var cN = cr(cR.line); if (!cN.hidden) { return cR } if (cR.line >= cO) { return cQ(1) || cQ(-1) } else { return cQ(-1) || cQ(1) } } function aY(cN, cP, cO) { var cQ = aK({line: cN, ch: cP || 0}); (cO ? bn : bm)(cQ, cQ) } function bL(cN) { return Math.max(0, Math.min(cN, ck.size - 1)) } function aK(cP) { if (cP.line < 0) { return{line: 0, ch: 0} } if (cP.line >= ck.size) { return{line: ck.size - 1, ch: cr(ck.size - 1).text.length} } var cN = cP.ch, cO = cr(cP.line).text.length; if (cN == null || cN > cO) { return{line: cP.line, ch: cO} } else { if (cN < 0) { return{line: cP.line, ch: 0} } else { return cP } } } function ca(cQ, cU) { var cR = cK.inverted ? cK.from : cK.to, cV = cR.line, cN = cR.ch; var cT = cr(cV); function cO() { for (var cW = cV + cQ, cY = cQ < 0 ? -1 : ck.size; cW != cY; cW += cQ) { var cX = cr(cW); if (!cX.hidden) { cV = cW; cT = cX; return true } } } function cS(cW) { if (cN == (cQ < 0 ? 0 : cT.text.length)) { if (!cW && cO()) { cN = cQ < 0 ? cT.text.length : 0 } else { return false } } else { cN += cQ } return true } if (cU == "char") { cS() } else { if (cU == "column") { cS(true) } else { if (cU == "word") { var cP = false; for (; ;) { if (cQ < 0) { if (!cS()) { break } } if (Y(cT.text.charAt(cN))) { cP = true } else { if (cP) { if (cQ < 0) { cQ = 1; cS() } break } } if (cQ > 0) { if (!cS()) { break } } } } } } return{line: cV, ch: cN} } function cq(cN, cO) { var cP = cN < 0 ? cK.from : cK.to; if (b4 || W(cK.from, cK.to)) { cP = ca(cN, cO) } aY(cP.line, cP.ch, true) } function b8(cN, cO) { if (!W(cK.from, cK.to)) { bD("", cK.from, cK.to) } else { if (cN < 0) { bD("", ca(cN, cO), cK.to) } else { bD("", cK.from, ca(cN, cO)) } } bS = true } var ch = null; function cj(cN, cO) { var cQ = 0, cR = cE(cK.inverted ? cK.from : cK.to, true); if (ch != null) { cR.x = ch } if (cO == "page") { cQ = Math.min(ba.clientHeight, window.innerHeight || document.documentElement.clientHeight) } else { if (cO == "line") { cQ = bC() } } var cP = bv(cR.x, cR.y + cQ * cN + 2); aY(cP.line, cP.ch, true); ch = cR.x } function bw(cQ) { var cO = cr(cQ.line).text; var cP = cQ.ch, cN = cQ.ch; while (cP > 0 && Y(cO.charAt(cP - 1))) { --cP } while (cN < cO.length && Y(cO.charAt(cN))) { ++cN } bn({line: cQ.line, ch: cP}, {line: cQ.line, ch: cN}) } function aB(cN) { bn({line: cN, ch: 0}, {line: cN, ch: cr(cN).text.length}) } function cn(cP) { if (W(cK.from, cK.to)) { return bo(cK.from.line, cP) } var cO = cK.to.line - (cK.to.ch ? 0 : 1); for (var cN = cK.from.line; cN <= cO; ++cN) { bo(cN, cP) } } function bo(cP, cW) { if (!cW) { cW = "add" } if (cW == "smart") { if (!bX.indent) { cW = "prev" } else { var cN = cg(cP) } } var cX = cr(cP), cR = cX.indentation(bN.tabSize), cO = cX.text.match(/^\s*/)[0], cT; if (cW == "prev") { if (cP) { cT = cr(cP - 1).indentation(bN.tabSize) } else { cT = 0 } } else { if (cW == "smart") { cT = bX.indent(cN, cX.text.slice(cO.length), cX.text) } else { if (cW == "add") { cT = cR + bN.indentUnit } else { if (cW == "subtract") { cT = cR - bN.indentUnit } } } } cT = Math.max(0, cT); var cV = cT - cR; if (!cV) { if (cK.from.line != cP && cK.to.line != cP) { return } var cU = cO } else { var cU = "", cS = 0; if (bN.indentWithTabs) { for (var cQ = Math.floor(cT / bN.tabSize); cQ; --cQ) { cS += bN.tabSize; cU += "\t" } } while (cS < cT) { ++cS; cU += " " } } bD(cU, {line: cP, ch: 0}, {line: cP, ch: cO.length}) } function bG() { bX = q.getMode(bN, bN.mode); ck.iter(0, ck.size, function (cN) { cN.stateAfter = null }); b3 = [0]; bu() } function a5() { var cN = bN.gutter || bN.lineNumbers; ay.style.display = cN ? "" : "none"; if (cN) { aJ = true } else { ah.parentNode.style.marginLeft = 0 } } function cs(cP, cO) { if (bN.lineWrapping) { au.className += " CodeMirror-wrap"; var cN = ba.clientWidth / a8() - 3; ck.iter(0, ck.size, function (cQ) { if (cQ.hidden) { return } var cR = Math.ceil(cQ.text.length / cN) || 1; if (cR != 1) { aV(cQ, cR) } }); bk.style.width = bA.style.width = "" } else { au.className = au.className.replace(" CodeMirror-wrap", ""); aw = null; br = ""; ck.iter(0, ck.size, function (cQ) { if (cQ.height != 1 && !cQ.hidden) { aV(cQ, 1) } if (cQ.text.length > br.length) { br = cQ.text } }) } ar.push({from: 0, to: ck.size}) } function aN() { for (var cO = '', cN = 0; cN < bN.tabSize; ++cN) { cO += " " } return cO + "" } function cI() { bj = aN(); bZ(true) } function cp() { ba.className = ba.className.replace(/\s*cm-s-\w+/g, "") + bN.theme.replace(/(^|\s)\s*/g, " cm-s-") } function cL() { this.set = [] } cL.prototype.clear = ai(function () { var cS = Infinity, cO = -Infinity; for (var cR = 0, cU = this.set.length; cR < cU; ++cR) { var cP = this.set[cR], cN = cP.marked; if (!cN || !cP.parent) { continue } var cT = S(cP); cS = Math.min(cS, cT); cO = Math.max(cO, cT); for (var cQ = 0; cQ < cN.length; ++cQ) { if (cN[cQ].set == this.set) { cN.splice(cQ--, 1) } } } if (cS != Infinity) { ar.push({from: cS, to: cO + 1}) } }); cL.prototype.find = function () { var cS, cT; for (var cP = 0, cR = this.set.length; cP < cR; ++cP) { var cV = this.set[cP], cQ = cV.marked; for (var cO = 0; cO < cQ.length; ++cO) { var cN = cQ[cO]; if (cN.set == this.set) { if (cN.from != null || cN.to != null) { var cU = S(cV); if (cU != null) { if (cN.from != null) { cS = {line: cU, ch: cN.from} } if (cN.to != null) { cT = {line: cU, ch: cN.to} } } } } } } return{from: cS, to: cT} }; function bs(cT, cS, cP) { cT = aK(cT); cS = aK(cS); var cN = new cL(); function cR(cU, cX, cW, cV) { cr(cU).addMark(new E(cX, cW, cV, cN.set)) } if (cT.line == cS.line) { cR(cT.line, cT.ch, cS.ch, cP) } else { cR(cT.line, cT.ch, null, cP); for (var cO = cT.line + 1, cQ = cS.line; cO < cQ; ++cO) { cR(cO, null, null, cP) } cR(cS.line, null, cS.ch, cP) } ar.push({from: cT.line, to: cS.line + 1}); return cN } function aL(cO) { cO = aK(cO); var cN = new A(cO.ch); cr(cO.line).addMark(cN); return cN } function bI(cN, cP, cO) { if (typeof cN == "number") { cN = cr(bL(cN)) } cN.gutterMarker = {text: cP, style: cO}; aJ = true; return cN } function ak(cN) { if (typeof cN == "number") { cN = cr(bL(cN)) } cN.gutterMarker = null; aJ = true } function aP(cO, cQ) { var cP = cO, cN = cO; if (typeof cO == "number") { cN = cr(bL(cO)) } else { cP = S(cO) } if (cP == null) { return null } if (cQ(cN, cP)) { ar.push({from: cP, to: cP + 1}) } else { return null } return cN } function bb(cO, cN) { return aP(cO, function (cP) { if (cP.className != cN) { cP.className = cN; return true } }) } function cw(cO, cN) { return aP(cO, function (cP, cS) { if (cP.hidden != cN) { cP.hidden = cN; aV(cP, cN ? 0 : 1); var cR = cK.from.line, cQ = cK.to.line; if (cN && (cR == cS || cQ == cS)) { var cU = cR == cS ? bE({line: cR, ch: 0}, cR, 0) : cK.from; var cT = cQ == cS ? bE({line: cQ, ch: 0}, cQ, 0) : cK.to; bm(cU, cT) } return(aJ = true) } }) } function aM(cO) { if (typeof cO == "number") { if (!bg(cO)) { return null } var cP = cO; cO = cr(cO); if (!cO) { return null } } else { var cP = S(cO); if (cP == null) { return null } } var cN = cO.gutterMarker; return{line: cP, handle: cO, text: cO.text, markerText: cN && cN.text, markerClass: cN && cN.style, lineClass: cO.className} } function cf(cN) { al.innerHTML = "
x
"; al.firstChild.firstChild.firstChild.nodeValue = cN; return al.firstChild.firstChild.offsetWidth || 10 } function ax(cZ, cT) { if (cT <= 0) { return 0 } var cQ = cr(cZ), cW = cQ.text; function cX(c0) { al.innerHTML = "
" + cQ.getHTML(bj, c0) + "
"; return al.firstChild.firstChild.offsetWidth } var cU = 0, cS = 0, cV = cW.length, cR; var cO = Math.min(cV, Math.ceil(cT / a8())); for (; ;) { var cP = cX(cO); if (cP <= cT && cO < cV) { cO = Math.min(cV, Math.ceil(cO * 1.2)) } else { cR = cP; cV = cO; break } } if (cT > cR) { return cV } cO = Math.floor(cV * 0.8); cP = cX(cO); if (cP < cT) { cU = cO; cS = cP } for (; ;) { if (cV - cU <= 1) { return(cR - cT > cT - cS) ? cU : cV } var cY = Math.ceil((cU + cV) / 2), cN = cX(cY); if (cN > cT) { cV = cY; cR = cN } else { cU = cY; cS = cN } } } var cl = Math.floor(Math.random() * 16777215).toString(16); function bR(cP, cS) { if (cS == 0) { return{top: 0, left: 0} } var cN = ""; if (bN.lineWrapping) { var cO = cP.text.indexOf(" ", cS + 2); cN = J(cP.text.slice(cS + 1, cO < 0 ? cP.text.length : cO + (C ? 5 : 0))) } al.innerHTML = "
" + cP.getHTML(bj, cS) + '' + J(cP.text.charAt(cS) || " ") + "" + cN + "
"; var cR = document.getElementById("CodeMirror-temp-" + cl); var cU = cR.offsetTop, cT = cR.offsetLeft; if (C && cU == 0 && cT == 0) { var cQ = document.createElement("span"); cQ.innerHTML = "x"; cR.parentNode.insertBefore(cQ, cR.nextSibling); cU = cQ.offsetTop } return{top: cU, left: cT} } function cE(cS, cQ) { var cN, cO = bC(), cR = cO * (f(ck, cS.line) - (cQ ? a4 : 0)); if (cS.ch == 0) { cN = 0 } else { var cP = bR(cr(cS.line), cS.ch); cN = cP.left; if (bN.lineWrapping) { cR += Math.max(0, cP.top) } } return{x: cN, y: cR, yBot: cR + cO} } function bv(cW, cV) { if (cV < 0) { cV = 0 } var cT = bC(), cR = a8(), c2 = a4 + Math.floor(cV / cT); var cX = R(ck, c2); if (cX >= ck.size) { return{line: ck.size - 1, ch: cr(ck.size - 1).text.length} } var cO = cr(cX), cZ = cO.text; var c4 = bN.lineWrapping, cU = c4 ? c2 - f(ck, cX) : 0; if (cW <= 0 && cU == 0) { return{line: cX, ch: 0} } function c3(c6) { var c7 = bR(cO, c6); if (c4) { var c8 = Math.round(c7.top / cT); return Math.max(0, c7.left + (c8 - cU) * ba.clientWidth) } return c7.left } var c1 = 0, c0 = 0, cP = cZ.length, cN; var cY = Math.min(cP, Math.ceil((cW + cU * ba.clientWidth * 0.9) / cR)); for (; ;) { var cS = c3(cY); if (cS <= cW && cY < cP) { cY = Math.min(cP, Math.ceil(cY * 1.2)) } else { cN = cS; cP = cY; break } } if (cW > cN) { return{line: cX, ch: cP} } cY = Math.floor(cP * 0.8); cS = c3(cY); if (cS < cW) { c1 = cY; c0 = cS } for (; ;) { if (cP - c1 <= 1) { return{line: cX, ch: (cN - cW > cW - c0) ? c1 : cP} } var c5 = Math.ceil((c1 + cP) / 2), cQ = c3(c5); if (cQ > cW) { cP = c5; cN = cQ } else { c1 = c5; c0 = cQ } } } function ag(cP) { var cN = cE(cP, true), cO = ac(bk); return{x: cO.left + cN.x, y: cO.top + cN.y, yBot: cO.top + cN.yBot} } var aS, an, bH; function bC() { if (bH == null) { bH = "
";
				for (var cO = 0; cO < 49; ++cO) {
					bH += "x
" } bH += "x
" } var cN = ah.clientHeight; if (cN == an) { return aS } an = cN; al.innerHTML = bH; aS = al.firstChild.offsetHeight / 50 || 1; al.innerHTML = ""; return aS } var cF, bl = 0; function a8() { if (ba.clientWidth == bl) { return cF } bl = ba.clientWidth; return(cF = cf("x")) } function ce() { return bk.offsetTop } function aX() { return bk.offsetLeft } function aU(cR, cQ) { var cP = ac(ba, true), cN, cS; try { cN = cR.clientX; cS = cR.clientY } catch (cR) { return null } if (!cQ && (cN - cP.left > ba.clientWidth || cS - cP.top > ba.clientHeight)) { return null } var cO = ac(bk, true); return bv(cN - cO.left, cS - cO.top) } function aT(cO) { var cS = aU(cO); if (!cS || window.opera) { return } if (W(cK.from, cK.to) || T(cS, cK.from) || !T(cS, cK.to)) { ai(aY)(cS.line, cS.ch) } var cR = bc.style.cssText; bK.style.position = "absolute"; bc.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (cO.clientY - 5) + "px; left: " + (cO.clientX - 5) + "px; z-index: 1000; background: white; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"; a6 = true; var cQ = bc.value = bP(); bp(); bc.select(); function cN() { var cT = w(bc.value).join("\n"); if (cT != cQ) { ai(bh)(cT, "end") } bK.style.position = "relative"; bc.style.cssText = cR; a6 = false; co(true); ae() } if (H) { s(cO); var cP = n(window, "mouseup", function () { cP(); setTimeout(cN, 20) }, true) } else { setTimeout(cN, 50) } } function cz() { clearInterval(cC); var cN = true; a3.style.visibility = ""; cC = setInterval(function () { a3.style.visibility = (cN = !cN) ? "" : "hidden" }, 650) } var be = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"}; function b0(cT) { var cN = cK.inverted ? cK.from : cK.to, cV = cr(cN.line), cO = cN.ch - 1; var cS = (cO >= 0 && be[cV.text.charAt(cO)]) || be[cV.text.charAt(++cO)]; if (!cS) { return } var cW = cS.charAt(0), cU = cS.charAt(1) == ">", c6 = cU ? 1 : -1, c1 = cV.styles; for (var c7 = cO + 1, c3 = 0, c5 = c1.length; c3 < c5; c3 += 2) { if ((c7 -= c1[c3].length) <= 0) { var c4 = c1[c3 + 1]; break } } var cQ = [cV.text.charAt(cO)], c0 = /[(){}[\]]/; function cY(dj, de, df) { if (!dj.text) { return } var di = dj.styles, dd = cU ? 0 : dj.text.length - 1, dg; for (var da = cU ? 0 : di.length - 2, dc = cU ? di.length : -2; da != dc; da += 2 * c6) { var dh = di[da]; if (di[da + 1] != null && di[da + 1] != c4) { dd += c6 * dh.length; continue } for (var c9 = cU ? 0 : dh.length - 1, c8 = cU ? dh.length : -1; c9 != c8; c9 += c6, dd += c6) { if (dd >= de && dd < df && c0.test(dg = dh.charAt(c9))) { var db = be[dg]; if (db.charAt(1) == ">" == cU) { cQ.push(dg) } else { if (cQ.pop() != db.charAt(0)) { return{pos: dd, match: false} } else { if (!cQ.length) { return{pos: dd, match: true} } } } } } } } for (var c3 = cN.line, c5 = cU ? Math.min(c3 + 100, ck.size) : Math.max(-1, c3 - 100); c3 != c5; c3 += c6) { var cV = cr(c3), cR = c3 == cN.line; var cX = cY(cV, cR && cU ? cO + 1 : 0, cR && !cU ? cO : cV.text.length); if (cX) { break } } if (!cX) { cX = {pos: null, match: false} } var c4 = cX.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket"; var c2 = bs({line: cN.line, ch: cO}, {line: cN.line, ch: cO + 1}, c4), cP = cX.pos != null && bs({line: c3, ch: cX.pos}, {line: c3, ch: cX.pos + 1}, c4); var cZ = ai(function () { c2.clear(); cP && cP.clear() }); if (cT) { setTimeout(cZ, 800) } else { bQ = cZ } } function aZ(cT) { var cS, cP; for (var cO = cT, cQ = cT - 40; cO > cQ; --cO) { if (cO == 0) { return 0 } var cN = cr(cO - 1); if (cN.stateAfter) { return cO } var cR = cN.indentation(bN.tabSize); if (cP == null || cS > cR) { cP = cO - 1; cS = cR } } return cP } function cg(cP) { var cO = aZ(cP), cN = cO && cr(cO - 1).stateAfter; if (!cN) { cN = P(bX) } else { cN = l(bX, cN) } ck.iter(cO, cP, function (cQ) { cQ.highlight(bX, cN, bN.tabSize); cQ.stateAfter = l(bX, cN) }); if (cO < cP) { ar.push({from: cO, to: cP}) } if (cP < ck.size && !cr(cP).stateAfter) { b3.push(cP) } return cN } function ct(cP, cN) { var cO = cg(cP); ck.iter(cP, cN, function (cQ) { cQ.highlight(bX, cO, bN.tabSize); cQ.stateAfter = l(bX, cO) }) } function bF() { var cT = +new Date + bN.workTime; var cW = b3.length; while (b3.length) { if (!cr(cD).stateAfter) { var cQ = cD } else { var cQ = b3.pop() } if (cQ >= ck.size) { continue } var cO = aZ(cQ), cN = cO && cr(cO - 1).stateAfter; if (cN) { cN = l(bX, cN) } else { cN = P(bX) } var cS = 0, cP = bX.compareStates, cV = false, cU = cO, cR = false; ck.iter(cU, ck.size, function (cX) { var cY = cX.stateAfter; if (+new Date > cT) { b3.push(cU); bu(bN.workDelay); if (cV) { ar.push({from: cQ, to: cU + 1}) } return(cR = true) } var cZ = cX.highlight(bX, cN, bN.tabSize); if (cZ) { cV = true } cX.stateAfter = l(bX, cN); if (cP) { if (cY && cP(cY, cN)) { return true } } else { if (cZ !== false || !cY) { cS = 0 } else { if (++cS > 3 && (!bX.indent || bX.indent(cY, "") == bX.indent(cN, ""))) { return true } } } ++cU }); if (cR) { return } if (cV) { ar.push({from: cQ, to: cU + 1}) } } if (cW && bN.onHighlightComplete) { bN.onHighlightComplete(bV) } } function bu(cN) { if (!b3.length) { return } am.set(cN, ai(bF)) } function aE() { cb = bS = cA = null; ar = []; aG = false; cm = [] } function ao() { var cR = false, cO; if (aG) { cR = !b1() } if (ar.length) { cO = bZ(ar, true) } else { if (aG) { cJ() } if (aJ) { aC() } } if (cR) { b1() } if (aG) { cM(); cz() } if (b5 && !a6 && (cb === true || (cb !== false && aG))) { co(bS) } if (aG && bN.matchBrackets) { setTimeout(ai(function () { if (bQ) { bQ(); bQ = null } if (W(cK.from, cK.to)) { b0(false) } }), 20) } var cN = cA, cP = cm; if (aG && bN.onCursorActivity) { bN.onCursorActivity(bV) } if (cN && bN.onChange && bV) { bN.onChange(bV, cN) } for (var cQ = 0; cQ < cP.length; ++cQ) { cP[cQ](bV) } if (cO && bN.onUpdate) { bN.onUpdate(bV) } } var cc = 0; function ai(cN) { return function () { if (!cc++) { aE() } try { var cO = cN.apply(this, arguments) } finally { if (!--cc) { ao() } } return cO } } for (var bx in V) { if (V.propertyIsEnumerable(bx) && !bV.propertyIsEnumerable(bx)) { bV[bx] = V[bx] } } return bV } q.defaults = {value: "", mode: null, theme: "default", indentUnit: 2, indentWithTabs: false, smartIndent: true, tabSize: 4, keyMap: "default", extraKeys: null, electricChars: true, onKeyEvent: null, lineWrapping: false, lineNumbers: false, gutter: false, fixedGutter: false, firstLineNumber: 1, readOnly: false, onChange: null, onCursorActivity: null, onGutterClick: null, onHighlightComplete: null, onUpdate: null, onFocus: null, onBlur: null, onScroll: null, matchBrackets: false, workTime: 100, workDelay: 200, pollInterval: 100, undoDepth: 40, tabindex: null, document: window.document}; var o = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent); var G = o || /Mac/.test(navigator.platform); var O = /Win/.test(navigator.platform); var ab = {}, M = {}; q.defineMode = function (ae, af) { if (!q.defaults.mode && ae != "null") { q.defaults.mode = ae } ab[ae] = af }; q.defineMIME = function (af, ae) { M[af] = ae }; q.getMode = function (ag, ae) { if (typeof ae == "string" && M.hasOwnProperty(ae)) { ae = M[ae] } if (typeof ae == "string") { var ai = ae, af = {} } else { if (ae != null) { var ai = ae.name, af = ae } } var ah = ab[ai]; if (!ah) { if (window.console) { console.warn("No mode " + ai + " found, falling back to plain text.") } return q.getMode(ag, "text/plain") } return ah(ag, af || {}) }; q.listModes = function () { var af = []; for (var ae in ab) { if (ab.propertyIsEnumerable(ae)) { af.push(ae) } } return af }; q.listMIMEs = function () { var af = []; for (var ae in M) { if (M.propertyIsEnumerable(ae)) { af.push({mime: ae, mode: M[ae]}) } } return af }; var V = q.extensions = {}; q.defineExtension = function (ae, af) { V[ae] = af }; var F = q.commands = {selectAll: function (ae) { ae.setSelection({line: 0, ch: 0}, {line: ae.lineCount() - 1}) }, killLine: function (ae) { var ah = ae.getCursor(true), ag = ae.getCursor(false), af = !W(ah, ag); if (!af && ae.getLine(ah.line).length == ah.ch) { ae.replaceRange("", ah, {line: ah.line + 1, ch: 0}) } else { ae.replaceRange("", ah, af ? ag : {line: ah.line}) } }, deleteLine: function (ae) { var af = ae.getCursor().line; ae.replaceRange("", {line: af, ch: 0}, {line: af}) }, undo: function (ae) { ae.undo() }, redo: function (ae) { ae.redo() }, goDocStart: function (ae) { ae.setCursor(0, 0, true) }, goDocEnd: function (ae) { ae.setSelection({line: ae.lineCount() - 1}, null, true) }, goLineStart: function (ae) { ae.setCursor(ae.getCursor().line, 0, true) }, goLineStartSmart: function (ae) { var ah = ae.getCursor(); var ag = ae.getLine(ah.line), af = Math.max(0, ag.search(/\S/)); ae.setCursor(ah.line, ah.ch <= af && ah.ch ? 0 : af, true) }, goLineEnd: function (ae) { ae.setSelection({line: ae.getCursor().line}, null, true) }, goLineUp: function (ae) { ae.moveV(-1, "line") }, goLineDown: function (ae) { ae.moveV(1, "line") }, goPageUp: function (ae) { ae.moveV(-1, "page") }, goPageDown: function (ae) { ae.moveV(1, "page") }, goCharLeft: function (ae) { ae.moveH(-1, "char") }, goCharRight: function (ae) { ae.moveH(1, "char") }, goColumnLeft: function (ae) { ae.moveH(-1, "column") }, goColumnRight: function (ae) { ae.moveH(1, "column") }, goWordLeft: function (ae) { ae.moveH(-1, "word") }, goWordRight: function (ae) { ae.moveH(1, "word") }, delCharLeft: function (ae) { ae.deleteH(-1, "char") }, delCharRight: function (ae) { ae.deleteH(1, "char") }, delWordLeft: function (ae) { ae.deleteH(-1, "word") }, delWordRight: function (ae) { ae.deleteH(1, "word") }, indentAuto: function (ae) { ae.indentSelection("smart") }, indentMore: function (ae) { ae.indentSelection("add") }, indentLess: function (ae) { ae.indentSelection("subtract") }, insertTab: function (ae) { ae.replaceSelection("\t", "end") }, transposeChars: function (ae) { var ag = ae.getCursor(), af = ae.getLine(ag.line); if (ag.ch > 0 && ag.ch < af.length - 1) { ae.replaceRange(af.charAt(ag.ch) + af.charAt(ag.ch - 1), {line: ag.line, ch: ag.ch - 1}, {line: ag.line, ch: ag.ch + 1}) } }, newlineAndIndent: function (ae) { ae.replaceSelection("\n", "end"); ae.indentLine(ae.getCursor().line) }, toggleOverwrite: function (ae) { ae.toggleOverwrite() }}; var r = q.keyMap = {}; r.basic = {Left: "goCharLeft", Right: "goCharRight", Up: "goLineUp", Down: "goLineDown", End: "goLineEnd", Home: "goLineStartSmart", PageUp: "goPageUp", PageDown: "goPageDown", Delete: "delCharRight", Backspace: "delCharLeft", Tab: "indentMore", "Shift-Tab": "indentLess", Enter: "newlineAndIndent", Insert: "toggleOverwrite"}; r.pcDefault = {"Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo", "Ctrl-Home": "goDocStart", "Alt-Up": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Down": "goDocEnd", "Ctrl-Left": "goWordLeft", "Ctrl-Right": "goWordRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd", "Ctrl-Backspace": "delWordLeft", "Ctrl-Delete": "delWordRight", "Ctrl-S": "save", "Ctrl-F": "find", "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll", fallthrough: "basic"}; r.macDefault = {"Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goWordLeft", "Alt-Right": "goWordRight", "Cmd-Left": "goLineStart", "Cmd-Right": "goLineEnd", "Alt-Backspace": "delWordLeft", "Ctrl-Alt-Backspace": "delWordRight", "Alt-Delete": "delWordRight", "Cmd-S": "save", "Cmd-F": "find", "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll", fallthrough: ["basic", "emacsy"]}; r["default"] = G ? r.macDefault : r.pcDefault; r.emacsy = {"Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown", "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", "Ctrl-V": "goPageUp", "Shift-Ctrl-V": "goPageDown", "Ctrl-D": "delCharRight", "Ctrl-H": "delCharLeft", "Alt-D": "delWordRight", "Alt-Backspace": "delWordLeft", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars"}; function j(af, ae, ah) { function ag(ai, am, an) { var ak = am[ai]; if (ak != null) { return ak } if (an == null) { an = am.fallthrough } if (an == null) { return am.catchall } if (typeof an == "string") { return ag(ai, r[an]) } for (var aj = 0, al = an.length; aj < al; ++aj) { ak = ag(ai, r[an[aj]]); if (ak != null) { return ak } } return null } return ae ? ag(af, ae, ah) : ag(af, r[ah]) } function K(af) { var ae = L[u(af, "keyCode")]; return ae == "Ctrl" || ae == "Alt" || ae == "Shift" || ae == "Mod" } q.fromTextArea = function (af, ah) { if (!ah) { ah = {} } ah.value = af.value; if (!ah.tabindex && af.tabindex) { ah.tabindex = af.tabindex } function aj() { af.value = ae.getValue() } if (af.form) { var ai = n(af.form, "submit", aj, true); if (typeof af.form.submit == "function") { var ag = af.form.submit; function ak() { aj(); af.form.submit = ag; af.form.submit(); af.form.submit = ak } af.form.submit = ak } } af.style.display = "none"; var ae = q(function (al) { af.parentNode.insertBefore(al, af.nextSibling) }, ah); ae.save = aj; ae.getTextArea = function () { return af }; ae.toTextArea = function () { aj(); af.parentNode.removeChild(ae.getWrapperElement()); af.style.display = ""; if (af.form) { ai(); if (typeof af.form.submit == "function") { af.form.submit = ag } } }; return ae }; function l(ah, ae) { if (ae === true) { return ae } if (ah.copyState) { return ah.copyState(ae) } var ag = {}; for (var ai in ae) { var af = ae[ai]; if (af instanceof Array) { af = af.concat([]) } ag[ai] = af } return ag } q.copyState = l; function P(ag, af, ae) { return ag.startState ? ag.startState(af, ae) : true } q.startState = P; function b(ae, af) { this.pos = this.start = 0; this.string = ae; this.tabSize = af || 8 } b.prototype = {eol: function () { return this.pos >= this.string.length }, sol: function () { return this.pos == 0 }, peek: function () { return this.string.charAt(this.pos) }, next: function () { if (this.pos < this.string.length) { return this.string.charAt(this.pos++) } }, eat: function (ae) { var ag = this.string.charAt(this.pos); if (typeof ae == "string") { var af = ag == ae } else { var af = ag && (ae.test ? ae.test(ag) : ae(ag)) } if (af) { ++this.pos; return ag } }, eatWhile: function (ae) { var af = this.pos; while (this.eat(ae)) { } return this.pos > af }, eatSpace: function () { var ae = this.pos; while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this.pos } return this.pos > ae }, skipToEnd: function () { this.pos = this.string.length }, skipTo: function (ae) { var af = this.string.indexOf(ae, this.pos); if (af > -1) { this.pos = af; return true } }, backUp: function (ae) { this.pos -= ae }, column: function () { return k(this.string, this.start, this.tabSize) }, indentation: function () { return k(this.string, null, this.tabSize) }, match: function (ah, af, ae) { if (typeof ah == "string") { function ai(aj) { return ae ? aj.toLowerCase() : aj } if (ai(this.string).indexOf(ai(ah), this.pos) == this.pos) { if (af !== false) { this.pos += ah.length } return true } } else { var ag = this.string.slice(this.pos).match(ah); if (ag && af !== false) { this.pos += ag[0].length } return ag } }, current: function () { return this.string.slice(this.start, this.pos) }}; q.StringStream = b; function E(ah, ag, ae, af) { this.from = ah; this.to = ag; this.style = ae; this.set = af } E.prototype = {attach: function (ae) { this.set.push(ae) }, detach: function (af) { var ae = m(this.set, af); if (ae > -1) { this.set.splice(ae, 1) } }, split: function (ah, ae) { if (this.to <= ah && this.to != null) { return null } var ag = this.from < ah || this.from == null ? null : this.from - ah + ae; var af = this.to == null ? null : this.to - ah + ae; return new E(ag, af, this.style, this.set) }, dup: function () { return new E(null, null, this.style, this.set) }, clipTo: function (af, ai, ae, ah, ag) { if (this.from != null && this.from >= ai) { this.from = Math.max(ah, this.from) + ag } if (this.to != null && this.to > ai) { this.to = ah < this.to ? this.to + ag : ai } if (af && ah > this.from && (ah < this.to || this.to == null)) { this.from = null } if (ae && (ai < this.to || this.to == null) && (ai > this.from || this.from == null)) { this.to = null } }, isDead: function () { return this.from != null && this.to != null && this.from >= this.to }, sameSet: function (ae) { return this.set == ae.set }}; function A(ae) { this.from = ae; this.to = ae; this.line = null } A.prototype = {attach: function (ae) { this.line = ae }, detach: function (ae) { if (this.line == ae) { this.line = null } }, split: function (af, ae) { if (af < this.from) { this.from = this.to = (this.from - af) + ae; return this } }, isDead: function () { return this.from > this.to }, clipTo: function (af, ai, ae, ah, ag) { if ((af || ai < this.from) && (ae || ah > this.to)) { this.from = 0; this.to = -1 } else { if (this.from > ai) { this.from = this.to = Math.max(ah, this.from) + ag } } }, sameSet: function (ae) { return false }, find: function () { if (!this.line || !this.line.parent) { return null } return{line: S(this.line), ch: this.from} }, clear: function () { if (this.line) { var ae = m(this.line.marked, this); if (ae != -1) { this.line.marked.splice(ae, 1) } this.line = null } }}; function d(af, ae) { this.styles = ae || [af, null]; this.text = af; this.height = 1; this.marked = this.gutterMarker = this.className = this.handlers = null; this.stateAfter = this.parent = this.hidden = null } d.inheritMarks = function (ai, al) { var ah = new d(ai), ae = al && al.marked; if (ae) { for (var ag = 0; ag < ae.length; ++ag) { if (ae[ag].to == null && ae[ag].style) { var af = ah.marked || (ah.marked = []), ak = ae[ag]; var aj = ak.dup(); af.push(aj); aj.attach(ah) } } } return ah }; d.prototype = {replace: function (ai, ah, al) { var am = [], ag = this.marked, aj = ah == null ? this.text.length : ah; ad(0, ai, this.styles, am); if (al) { am.push(al, null) } ad(aj, this.text.length, this.styles, am); this.styles = am; this.text = this.text.slice(0, ai) + al + this.text.slice(aj); this.stateAfter = null; if (ag) { var ak = al.length - (aj - ai); for (var af = 0; af < ag.length; ++af) { var ae = ag[af]; ae.clipTo(ai == null, ai || 0, ah == null, aj, ak); if (ae.isDead()) { ae.detach(this); ag.splice(af--, 1) } } } }, split: function (al, aj) { var ah = [aj, null], af = this.marked; ad(al, this.text.length, this.styles, ah); var ag = new d(aj + this.text.slice(al), ah); if (af) { for (var ai = 0; ai < af.length; ++ai) { var ak = af[ai]; var ae = ak.split(al, aj.length); if (ae) { if (!ag.marked) { ag.marked = [] } ag.marked.push(ae); ae.attach(ag) } } } return ag }, append: function (af) { var ak = this.text.length, ae = af.marked, ai = this.marked; this.text += af.text; ad(0, af.text.length, af.styles, this.styles); if (ai) { for (var aj = 0; aj < ai.length; ++aj) { if (ai[aj].to == null) { ai[aj].to = ak } } } if (ae && ae.length) { if (!ai) { this.marked = ai = [] } outer:for (var aj = 0; aj < ae.length; ++aj) { var al = ae[aj]; if (!al.from) { for (var ah = 0; ah < ai.length; ++ah) { var ag = ai[ah]; if (ag.to == ak && ag.sameSet(al)) { ag.to = al.to == null ? null : al.to + ak; if (ag.isDead()) { ag.detach(this); ae.splice(aj--, 1) } continue outer } } } ai.push(al); al.attach(this); al.from += ak; if (al.to != null) { al.to += ak } } } }, fixMarkEnds: function (af) { var ae = this.marked, ai = af.marked; if (!ae) { return } for (var ah = 0; ah < ae.length; ++ah) { var ak = ae[ah], aj = ak.to == null; if (aj && ai) { for (var ag = 0; ag < ai.length; ++ag) { if (ai[ag].sameSet(ak)) { aj = false; break } } } if (aj) { ak.to = this.text.length } } }, fixMarkStarts: function () { var ae = this.marked; if (!ae) { return } for (var af = 0; af < ae.length; ++af) { if (ae[af].from == null) { ae[af].from = 0 } } }, addMark: function (ae) { ae.attach(this); if (this.marked == null) { this.marked = [] } this.marked.push(ae); this.marked.sort(function (ag, af) { return(ag.from || 0) - (af.from || 0) }) }, highlight: function (aj, af, ak) { var an = new b(this.text, ak), ao = this.styles, al = 0; var ai = false, ag = ao[0], am; if (this.text == "" && aj.blankLine) { aj.blankLine(af) } while (!an.eol()) { var ae = aj.token(an, af); var ah = this.text.slice(an.start, an.pos); an.start = an.pos; if (al && ao[al - 1] == ae) { ao[al - 2] += ah } else { if (ah) { if (!ai && (ao[al + 1] != ae || (al && ao[al - 2] != am))) { ai = true } ao[al++] = ah; ao[al++] = ae; am = ag; ag = ao[al] } } if (an.pos > 5000) { ao[al++] = this.text.slice(an.pos); ao[al++] = null; break } } if (ao.length != al) { ao.length = al; ai = true } if (al && ao[al - 2] != am) { ai = true } return ai || (ao.length < 5 && this.text.length < 10 ? null : false) }, getTokenAt: function (aj, ah, ag) { var ae = this.text, ai = new b(ae); while (ai.pos < ag && !ai.eol()) { ai.start = ai.pos; var af = aj.token(ai, ah) } return{start: ai.start, end: ai.pos, string: ai.current(), className: af || null, state: ah} }, indentation: function (ae) { return k(this.text, null, ae) }, getHTML: function (ao, au) { var ak = [], ai = true; function ay(aH, aG) { if (!aH) { return } if (ai && C && aH.charAt(0) == " ") { aH = "\u00a0" + aH.slice(1) } ai = false; if (aG) { ak.push('', J(aH).replace(/\t/g, ao), "") } else { ak.push(J(aH).replace(/\t/g, ao)) } } var ar = this.styles, aj = this.text, ap = this.marked; var aB = aj.length; if (au != null) { aB = Math.min(au, aB) } function ag(aG) { if (!aG) { return null } return"cm-" + aG.replace(/ +/g, " cm-") } if (!aj && au == null) { ay(" ") } else { if (!ap || !ap.length) { for (var az = 0, al = 0; al < aB; az += 2) { var at = ar[az], aC = ar[az + 1], av = at.length; if (al + av > aB) { at = at.slice(0, aB - al) } al += av; ay(at, ag(aC)) } } else { var ah = 0, az = 0, an = "", aC, aF = 0; var aE = ap[0].from || 0, ax = [], aD = 0; function aA() { var aG; while (aD < ap.length && ((aG = ap[aD]).from == ah || aG.from == null)) { if (aG.style != null) { ax.push(aG) } ++aD } aE = aD < ap.length ? ap[aD].from : Infinity; for (var aH = 0; aH < ax.length; ++aH) { var aI = ax[aH].to || Infinity; if (aI == ah) { ax.splice(aH--, 1) } else { aE = Math.min(aI, aE) } } } var aq = 0; while (ah < aB) { if (aE == ah) { aA() } var am = Math.min(aB, aE); while (true) { if (an) { var af = ah + an.length; var ae = aC; for (var aw = 0; aw < ax.length; ++aw) { ae = (ae ? ae + " " : "") + ax[aw].style } ay(af > am ? an.slice(0, am - ah) : an, ae); if (af >= am) { an = an.slice(am - ah); ah = am; break } ah = af } an = ar[az++]; aC = ag(ar[az++]) } } } } return ak.join("") }, cleanUp: function () { this.parent = null; if (this.marked) { for (var ae = 0, af = this.marked.length; ae < af; ++ae) { this.marked[ae].detach(this) } } }}; function ad(ak, al, ae, am) { for (var ai = 0, aj = 0, af = 0; aj < al; ai += 2) { var ag = ae[ai], ah = aj + ag.length; if (af == 0) { if (ah > ak) { am.push(ag.slice(ak - aj, Math.min(ag.length, al - aj)), ae[ai + 1]) } if (ah >= ak) { af = 1 } } else { if (af == 1) { if (ah > al) { am.push(ag.slice(0, al - aj), ae[ai + 1]) } else { am.push(ag, ae[ai + 1]) } } } aj = ah } } function Z(af) { this.lines = af; this.parent = null; for (var ag = 0, ah = af.length, ae = 0; ag < ah; ++ag) { af[ag].parent = this; ae += af[ag].height } this.height = ae } Z.prototype = {chunkSize: function () { return this.lines.length }, remove: function (ae, ak, ai) { for (var ah = ae, aj = ae + ak; ah < aj; ++ah) { var af = this.lines[ah]; this.height -= af.height; af.cleanUp(); if (af.handlers) { for (var ag = 0; ag < af.handlers.length; ++ag) { ai.push(af.handlers[ag]) } } } this.lines.splice(ae, ak) }, collapse: function (ae) { ae.splice.apply(ae, [ae.length, 0].concat(this.lines)) }, insertHeight: function (af, ag, ae) { this.height += ae; this.lines.splice.apply(this.lines, [af, 0].concat(ag)); for (var ah = 0, ai = ag.length; ah < ai; ++ah) { ag[ah].parent = this } }, iterN: function (ae, ah, ag) { for (var af = ae + ah; ae < af; ++ae) { if (ag(this.lines[ae])) { return true } } }}; function g(ah) { this.children = ah; var ag = 0, ae = 0; for (var af = 0, aj = ah.length; af < aj; ++af) { var ai = ah[af]; ag += ai.chunkSize(); ae += ai.height; ai.parent = this } this.size = ag; this.height = ae; this.parent = null } g.prototype = {chunkSize: function () { return this.size }, remove: function (ag, af, aj) { this.size -= af; for (var ah = 0; ah < this.children.length; ++ah) { var ae = this.children[ah], ak = ae.chunkSize(); if (ag < ak) { var ai = Math.min(af, ak - ag), al = ae.height; ae.remove(ag, ai, aj); this.height -= al - ae.height; if (ak == ai) { this.children.splice(ah--, 1); ae.parent = null } if ((af -= ai) == 0) { break } ag = 0 } else { ag -= ak } } if (this.size - af < 25) { var am = []; this.collapse(am); this.children = [new Z(am)]; this.children[0].parent = this } }, collapse: function (ae) { for (var af = 0, ag = this.children.length; af < ag; ++af) { this.children[af].collapse(ae) } }, insert: function (af, ag) { var ae = 0; for (var ah = 0, ai = ag.length; ah < ai; ++ah) { ae += ag[ah].height } this.insertHeight(af, ag, ae) }, insertHeight: function (af, am, al) { this.size += am.length; this.height += al; for (var ag = 0, ai = this.children.length; ag < ai; ++ag) { var ae = this.children[ag], aj = ae.chunkSize(); if (af <= aj) { ae.insertHeight(af, am, al); if (ae.lines && ae.lines.length > 50) { while (ae.lines.length > 50) { var ah = ae.lines.splice(ae.lines.length - 25, 25); var ak = new Z(ah); ae.height -= ak.height; this.children.splice(ag + 1, 0, ak); ak.parent = this } this.maybeSpill() } break } af -= aj } }, maybeSpill: function () { if (this.children.length <= 10) { return } var ah = this; do { var af = ah.children.splice(ah.children.length - 5, 5); var ag = new g(af); if (!ah.parent) { var ai = new g(ah.children); ai.parent = ah; ah.children = [ai, ag]; ah = ai } else { ah.size -= ag.size; ah.height -= ag.height; var ae = m(ah.parent.children, ah); ah.parent.children.splice(ae + 1, 0, ag) } ag.parent = ah.parent } while (ah.children.length > 10); ah.parent.maybeSpill() }, iter: function (ag, af, ae) { this.iterN(ag, af - ag, ae) }, iterN: function (ae, al, ak) { for (var af = 0, ai = this.children.length; af < ai; ++af) { var aj = this.children[af], ah = aj.chunkSize(); if (ae < ah) { var ag = Math.min(al, ah - ae); if (aj.iterN(ae, ag, ak)) { return true } if ((al -= ag) == 0) { break } ae = 0 } else { ae -= ah } } }}; function x(ae, ai) { while (!ae.lines) { for (var af = 0; ; ++af) { var ah = ae.children[af], ag = ah.chunkSize(); if (ai < ag) { ae = ah; break } ai -= ag } } return ae.lines[ai] } function S(ae) { if (ae.parent == null) { return null } var aj = ae.parent, ai = m(aj.lines, ae); for (var af = aj.parent; af; aj = af, af = af.parent) { for (var ag = 0, ah = af.children.length; ; ++ag) { if (af.children[ag] == aj) { break } ai += af.children[ag].chunkSize() } } return ai } function R(ak, ai) { var ag = 0; outer:do { for (var ah = 0, aj = ak.children.length; ah < aj; ++ah) { var af = ak.children[ah], ae = af.height; if (ai < ae) { ak = af; continue outer } ai -= ae; ag += af.chunkSize() } return ag } while (!ak.lines); for (var ah = 0, aj = ak.lines.length; ah < aj; ++ah) { var am = ak.lines[ah], al = am.height; if (ai < al) { break } ai -= al } return ag + ah } function f(ae, ak) { var ag = 0; outer:do { for (var af = 0, ai = ae.children.length; af < ai; ++af) { var aj = ae.children[af], ah = aj.chunkSize(); if (ak < ah) { ae = aj; continue outer } ak -= ah; ag += aj.height } return ag } while (!ae.lines); for (var af = 0; af < ak; ++af) { ag += ae.lines[af].height } return ag } function i() { this.time = 0; this.done = []; this.undone = [] } i.prototype = {addChange: function (ae, ak, af) { this.undone.length = 0; var ag = +new Date, am = this.done[this.done.length - 1], an = am && am[am.length - 1]; var ai = ag - this.time; if (ai > 400 || !an) { this.done.push([ {start: ae, added: ak, old: af} ]) } else { if (an.start > ae + ak || an.start + an.added < ae - an.added + an.old.length) { am.push({start: ae, added: ak, old: af}) } else { var al = 0; if (ae < an.start) { for (var ah = an.start - ae - 1; ah >= 0; --ah) { an.old.unshift(af[ah]) } an.added += an.start - ae; an.start = ae } else { if (an.start < ae) { al = ae - an.start; ak += al } } for (var ah = an.added - al, aj = af.length; ah < aj; ++ah) { an.old.push(af[ah]) } if (an.added < ak) { an.added = ak } } } this.time = ag }}; function D() { s(this) } function I(ae) { if (!ae.stop) { ae.stop = D } return ae } function N(ae) { if (ae.preventDefault) { ae.preventDefault() } else { ae.returnValue = false } } function y(ae) { if (ae.stopPropagation) { ae.stopPropagation() } else { ae.cancelBubble = true } } function s(ae) { N(ae); y(ae) } q.e_stop = s; q.e_preventDefault = N; q.e_stopPropagation = y; function h(ae) { return ae.target || ae.srcElement } function t(ae) { if (ae.which) { return ae.which } else { if (ae.button & 1) { return 1 } else { if (ae.button & 2) { return 3 } else { if (ae.button & 4) { return 2 } } } } } function u(af, ag) { var ae = af.override && af.override.hasOwnProperty(ag); return ae ? af.override[ag] : af[ag] } function n(ah, ag, af, ae) { if (typeof ah.addEventListener == "function") { ah.addEventListener(ag, af, false); if (ae) { return function () { ah.removeEventListener(ag, af, false) } } } else { var ai = function (aj) { af(aj || window.event) }; ah.attachEvent("on" + ag, ai); if (ae) { return function () { ah.detachEvent("on" + ag, ai) } } } } q.connect = n; function v() { this.id = null } v.prototype = {set: function (ae, af) { clearTimeout(this.id); this.id = setTimeout(af, ae) }}; var z = function () { if (/MSIE [1-8]\b/.test(navigator.userAgent)) { return false } var ae = document.createElement("div"); return"draggable" in ae }(); var H = /gecko\/\d{7}/i.test(navigator.userAgent); var C = /MSIE \d/.test(navigator.userAgent); var e = /WebKit\//.test(navigator.userAgent); var c = "\n"; (function () { var ae = document.createElement("textarea"); ae.value = "foo\nbar"; if (ae.value.indexOf("\r") > -1) { c = "\r\n" } }()); function k(af, ae, ah) { if (ae == null) { ae = af.search(/[^\s\u00a0]/); if (ae == -1) { ae = af.length } } for (var ag = 0, ai = 0; ag < ae; ++ag) { if (af.charAt(ag) == "\t") { ai += ah - (ai % ah) } else { ++ai } } return ai } function p(ae) { if (ae.currentStyle) { return ae.currentStyle } return window.getComputedStyle(ae, null) } function ac(af, an) { var ah = af.ownerDocument.body; var am = 0, al = 0, aj = false; for (var ae = af; ae; ae = ae.offsetParent) { var ak = ae.offsetLeft, ag = ae.offsetTop; if (ae == ah) { am += Math.abs(ak); al += Math.abs(ag) } else { am += ak, al += ag } if (an && p(ae).position == "fixed") { aj = true } } var ai = an && !aj ? null : ah; for (var ae = af.parentNode; ae != ai; ae = ae.parentNode) { if (ae.scrollLeft != null) { am -= ae.scrollLeft; al -= ae.scrollTop } } return{left: am, top: al} } if (document.documentElement.getBoundingClientRect != null) { ac = function (ah, ae) { try { var ag = ah.getBoundingClientRect(); ag = {top: ag.top, left: ag.left} } catch (ai) { ag = {top: 0, left: 0} } if (!ae) { if (window.pageYOffset == null) { var af = document.documentElement || document.body.parentNode; if (af.scrollTop == null) { af = document.body } ag.top += af.scrollTop; ag.left += af.scrollLeft } else { ag.top += window.pageYOffset; ag.left += window.pageXOffset } } return ag } } function B(ae) { return ae.textContent || ae.innerText || ae.nodeValue || "" } function a(ae) { if (o) { ae.selectionStart = 0; ae.selectionEnd = ae.value.length } else { ae.select() } } function W(af, ae) { return af.line == ae.line && af.ch == ae.ch } function T(af, ae) { return af.line < ae.line || (af.line == ae.line && af.ch < ae.ch) } function U(ae) { return{line: ae.line, ch: ae.ch} } var aa = document.createElement("pre"); function J(ae) { aa.textContent = ae; return aa.innerHTML } if (J("a") == "\na") { J = function (ae) { aa.textContent = ae; return aa.innerHTML.slice(1) } } else { if (J("\t") != "\t") { J = function (ae) { aa.innerHTML = ""; aa.appendChild(document.createTextNode(ae)); return aa.innerHTML } } } q.htmlEscape = J; function Q(ah, ag) { if (!ag) { return 0 } if (!ah) { return ag.length } for (var af = ah.length, ae = ag.length; af >= 0 && ae >= 0; --af, --ae) { if (ah.charAt(af) != ag.charAt(ae)) { break } } return ae + 1 } function m(ah, ae) { if (ah.indexOf) { return ah.indexOf(ae) } for (var af = 0, ag = ah.length; af < ag; ++af) { if (ah[af] == ae) { return af } } return -1 } function Y(ae) { return/\w/.test(ae) || ae.toUpperCase() != ae.toLowerCase() } var w = "\n\nb".split(/\n/).length != 3 ? function (ag) { var ah = 0, af, ae = []; while ((af = ag.indexOf("\n", ah)) > -1) { ae.push(ag.slice(ah, ag.charAt(af - 1) == "\r" ? af - 1 : af)); ah = af + 1 } ae.push(ag.slice(ah)); return ae } : function (ae) { return ae.split(/\r?\n/) }; q.splitLines = w; var X = window.getSelection ? function (af) { try { return af.selectionStart != af.selectionEnd } catch (ae) { return false } } : function (ag) { try { var ae = ag.ownerDocument.selection.createRange() } catch (af) { } if (!ae || ae.parentElement() != ag) { return false } return ae.compareEndPoints("StartToEnd", ae) != 0 }; q.defineMode("null", function () { return{token: function (ae) { ae.skipToEnd() }} }); q.defineMIME("text/plain", "null"); var L = {3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt", 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End", 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert", 46: "Delete", 59: ";", 91: "Mod", 92: "Mod", 93: "Mod", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", 221: "]", 222: "'", 63276: "PageUp", 63277: "PageDown", 63275: "End", 63273: "Home", 63234: "Left", 63232: "Up", 63235: "Right", 63233: "Down", 63302: "Insert", 63272: "Delete"}; q.keyNames = L; (function () { for (var ae = 0; ae < 10; ae++) { L[ae + 48] = String(ae) } for (var ae = 65; ae <= 90; ae++) { L[ae] = String.fromCharCode(ae) } for (var ae = 1; ae <= 12; ae++) { L[ae + 111] = L[ae + 63235] = "F" + ae } })(); return q })();