From d4c11fc3dddb5d3ec4e9d9d4e595e51ad7715e5d Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Mon, 10 Jan 2011 13:56:16 +0100 Subject: [PATCH] update package for demo app --- build/ace/editor.js | 3592 ++------------------- build/ace/layer/text.js | 2 +- build/build.txt | 83 +- build/demo/boot.js | 6822 ++++++++++++++++++++++++++++++++++++++- build/demo/startup.js | 4708 +-------------------------- build/pilot/index.js | 12 +- 6 files changed, 7219 insertions(+), 8000 deletions(-) diff --git a/build/ace/editor.js b/build/ace/editor.js index 9cf68266..ddb61d34 100644 --- a/build/ace/editor.js +++ b/build/ace/editor.js @@ -1,2105 +1,65 @@ -define("pilot/oop", ["require", "exports", "module"], function(i, g) { - g.inherits = function(l, e) { - var j = function() { - }; - j.prototype = e.prototype; - l.super_ = e.prototype; - l.prototype = new j; - l.prototype.constructor = l - }; - g.mixin = function(l, e) { - for(var j in e) { - l[j] = e[j] - } - }; - g.implement = function(l, e) { - g.mixin(l, e) - } -}); -define("pilot/useragent", ["require", "exports", "module"], function(i, g) { - i = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase(); - var l = navigator.userAgent; - g.isWin = i == "win"; - g.isMac = i == "mac"; - g.isLinux = i == "linux"; - g.isIE = !+"\u000b1"; - g.isGecko = g.isMozilla = window.controllers && window.navigator.product === "Gecko"; - g.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]"; - g.isWebKit = parseFloat(l.split("WebKit/")[1]) || undefined; - g.isAIR = l.indexOf("AdobeAIR") >= 0; - g.OS = {LINUX:"LINUX", MAC:"MAC", WINDOWS:"WINDOWS"}; - g.getOS = function() { - return g.isMac ? g.OS.MAC : g.isLinux ? g.OS.LINUX : g.OS.WINDOWS - } -}); -define("pilot/event", ["require", "exports", "module", "pilot/useragent"], function(i, g) { - var l = i("pilot/useragent"); - g.addListener = function(e, j, o) { - if(e.addEventListener) { - return e.addEventListener(j, o, false) - }if(e.attachEvent) { - var d = function() { - o(window.event) - }; - o._wrapper = d; - e.attachEvent("on" + j, d) - } - }; - g.removeListener = function(e, j, o) { - if(e.removeEventListener) { - return e.removeEventListener(j, o, false) - }if(e.detachEvent) { - e.detachEvent("on" + j, o._wrapper || o) - } - }; - g.stopEvent = function(e) { - g.stopPropagation(e); - g.preventDefault(e); - return false - }; - g.stopPropagation = function(e) { - if(e.stopPropagation) { - e.stopPropagation() - }else { - e.cancelBubble = true - } - }; - g.preventDefault = function(e) { - if(e.preventDefault) { - e.preventDefault() - }else { - e.returnValue = false - } - }; - g.getDocumentX = function(e) { - return e.clientX ? e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) : e.pageX - }; - g.getDocumentY = function(e) { - return e.clientY ? e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) : e.pageX - }; - g.getButton = function(e) { - return e.preventDefault ? e.button : Math.max(e.button - 1, 2) - }; - g.capture = document.documentElement.setCapture ? function(e, j, o) { - function d(k) { - j && j(k); - o && o(); - g.removeListener(e, "mousemove", j); - g.removeListener(e, "mouseup", d); - g.removeListener(e, "losecapture", d); - e.releaseCapture() - } - g.addListener(e, "mousemove", j); - g.addListener(e, "mouseup", d); - g.addListener(e, "losecapture", d); - e.setCapture() - } : function(e, j, o) { - function d(a) { - j(a); - a.stopPropagation() - } - function k(a) { - j && j(a); - o && o(); - document.removeEventListener("mousemove", d, true); - document.removeEventListener("mouseup", k, true); - a.stopPropagation() - } - document.addEventListener("mousemove", d, true); - document.addEventListener("mouseup", k, true) - }; - g.addMouseWheelListener = function(e, j) { - var o = function(d) { - if(d.wheelDelta !== undefined) { - if(d.wheelDeltaX !== undefined) { - d.wheelX = -d.wheelDeltaX / 8; - d.wheelY = -d.wheelDeltaY / 8 - }else { - d.wheelX = 0; - d.wheelY = -d.wheelDelta / 8 - } - }else { - if(d.axis && d.axis == d.HORIZONTAL_AXIS) { - d.wheelX = (d.detail || 0) * 5; - d.wheelY = 0 - }else { - d.wheelX = 0; - d.wheelY = (d.detail || 0) * 5 - } - }j(d) - }; - g.addListener(e, "DOMMouseScroll", o); - g.addListener(e, "mousewheel", o) - }; - g.addMultiMouseDownListener = function(e, j, o, d, k) { - var a = 0, f, h, m = function(b) { - a += 1; - if(a == 1) { - f = b.clientX; - h = b.clientY; - setTimeout(function() { - a = 0 - }, d || 600) - }if(g.getButton(b) != j || Math.abs(b.clientX - f) > 5 || Math.abs(b.clientY - h) > 5) { - a = 0 - }if(a == o) { - a = 0; - k(b) - }return g.preventDefault(b) - }; - g.addListener(e, "mousedown", m); - l.isIE && g.addListener(e, "dblclick", m) - }; - g.addKeyListener = function(e, j) { - var o = null; - g.addListener(e, "keydown", function(d) { - o = d.keyIdentifier || d.keyCode; - return j(d) - }); - if(l.isMac && (l.isGecko || l.isOpera)) { - g.addListener(e, "keypress", function(d) { - if(o !== (d.keyIdentifier || d.keyCode)) { - return j(d) - }else { - o = null - } - }) - } - } -}); -define("pilot/lang", ["require", "exports", "module"], function(i, g) { - g.stringReverse = function(l) { - return l.split("").reverse().join("") - }; - g.stringRepeat = function(l, e) { - return(new Array(e + 1)).join(l) - }; - g.copyObject = function(l) { - var e = {}; - for(var j in l) { - e[j] = l[j] - }return e - }; - g.arrayToMap = function(l) { - for(var e = {}, j = 0;j < l.length;j++) { - e[l[j]] = 1 - }return e - }; - g.arrayRemove = function(l, e) { - for(var j = 0;j <= l.length;j++) { - e === l[j] && l.splice(j, 1) - } - }; - g.escapeRegExp = function(l) { - return l.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1") - }; - g.deferredCall = function(l) { - var e = null, j = function() { - e = null; - l() - }; - return{schedule:function() { - e || (e = setTimeout(j, 0)) - }, call:function() { - this.cancel(); - l() - }, cancel:function() { - clearTimeout(e); - e = null - }} - } -}); -define("ace/textinput", ["require", "exports", "module", "pilot/event"], function(i, g) { - var l = i("pilot/event"); - g.TextInput = function(e, j) { - function o() { - if(!h) { - var c = d.value; - if(c) { - if(c.charCodeAt(c.length - 1) == a.charCodeAt(0)) { - (c = c.slice(0, -1)) && j.onTextInput(c) - }else { - j.onTextInput(c) - } - } - }h = false; - d.value = a; - d.select() - } - var d = document.createElement("textarea"), k = d.style; - k.position = "absolute"; - k.left = "-10000px"; - k.top = "-10000px"; - e.appendChild(d); - var a = String.fromCharCode(0); - o(); - var f = false, h = false, m = function() { +define(function(g, r) { + var s = g("pilot/oop"), e = g("pilot/event"), t = g("pilot/lang"), u = g("ace/textinput").TextInput, v = g("ace/keybinding").KeyBinding, w = g("ace/document").Document, x = g("ace/search").Search, y = g("ace/background_tokenizer").BackgroundTokenizer, o = g("ace/range").Range, z = g("pilot/event_emitter").EventEmitter; + g = function(a, b) { + var d = a.getContainerElement(); + this.container = d; + this.renderer = a; + this.textInput = new u(d, this); + this.keyBinding = new v(d, this); + var c = this; + e.addListener(d, "mousedown", function(i) { setTimeout(function() { - f || o() - }, 0) - }, b = function() { - j.onCompositionUpdate(d.value) - }; - l.addListener(d, "keypress", m); - l.addListener(d, "textInput", m); - l.addListener(d, "paste", m); - l.addListener(d, "propertychange", m); - l.addListener(d, "copy", function() { - h = true; - d.value = j.getCopyText(); - d.select(); - h = true; - setTimeout(o, 0) - }); - l.addListener(d, "cut", function() { - h = true; - d.value = j.getCopyText(); - j.onCut(); - d.select(); - setTimeout(o, 0) - }); - l.addListener(d, "compositionstart", function() { - f = true; - o(); - d.value = ""; - j.onCompositionStart(); - setTimeout(b, 0) - }); - l.addListener(d, "compositionupdate", b); - l.addListener(d, "compositionend", function() { - f = false; - j.onCompositionEnd(); - m() - }); - l.addListener(d, "blur", function() { - j.onBlur() - }); - l.addListener(d, "focus", function() { - j.onFocus(); - d.select() - }); - this.focus = function() { - j.onFocus(); - d.select(); - d.focus() - }; - this.blur = function() { - d.blur() - } - } -}); -define("ace/conf/keybindings/default_mac", ["require", "exports", "module"], function(i, g) { - g.bindings = {selectall:"Command-A", removeline:"Command-D", gotoline:"Command-L", togglecomment:"Command-7", findnext:"Command-K", findprevious:"Command-Shift-K", find:"Command-F", replace:"Command-R", undo:"Command-Z", redo:"Command-Shift-Z|Command-Y", overwrite:"Insert", copylinesup:"Command-Option-Up", movelinesup:"Option-Up", selecttostart:"Command-Shift-Up", gotostart:"Command-Home|Command-Up", selectup:"Shift-Up", golineup:"Up", copylinesdown:"Command-Option-Down", movelinesdown:"Option-Down", - selecttoend:"Command-Shift-Down", gotoend:"Command-End|Command-Down", selectdown:"Shift-Down", godown:"Down", selectwordleft:"Option-Shift-Left", gotowordleft:"Option-Left", selecttolinestart:"Command-Shift-Left", gotolinestart:"Command-Left|Home", selectleft:"Shift-Left", gotoleft:"Left", selectwordright:"Option-Shift-Right", gotowordright:"Option-Right", selecttolineend:"Command-Shift-Right", gotolineend:"Command-Right|End", selectright:"Shift-Right", gotoright:"Right", selectpagedown:"Shift-PageDown", - pagedown:"PageDown", selectpageup:"Shift-PageUp", pageup:"PageUp", selectlinestart:"Shift-Home", selectlineend:"Shift-End", del:"Delete", backspace:"Ctrl-Backspace|Command-Backspace|Option-Backspace|Backspace", outdent:"Shift-Tab", indent:"Tab"} -}); -define("ace/conf/keybindings/default_win", ["require", "exports", "module"], function(i, g) { - g.bindings = {selectall:"Ctrl-A", removeline:"Ctrl-D", gotoline:"Ctrl-L", togglecomment:"Ctrl-7", findnext:"Ctrl-K", findprevious:"Ctrl-Shift-K", find:"Ctrl-F", replace:"Ctrl-R", undo:"Ctrl-Z", redo:"Ctrl-Shift-Z|Ctrl-Y", overwrite:"Insert", copylinesup:"Ctrl-Alt-Up", movelinesup:"Alt-Up", selecttostart:"Alt-Shift-Up", gotostart:"Ctrl-Home|Ctrl-Up", selectup:"Shift-Up", golineup:"Up", copylinesdown:"Ctrl-Alt-Down", movelinesdown:"Alt-Down", selecttoend:"Alt-Shift-Down", gotoend:"Ctrl-End|Ctrl-Down", - selectdown:"Shift-Down", godown:"Down", selectwordleft:"Ctrl-Shift-Left", gotowordleft:"Ctrl-Left", selecttolinestart:"Alt-Shift-Left", gotolinestart:"Alt-Left|Home", selectleft:"Shift-Left", gotoleft:"Left", selectwordright:"Ctrl-Shift-Right", gotowordright:"Ctrl-Right", selecttolineend:"Alt-Shift-Right", gotolineend:"Alt-Right|End", selectright:"Shift-Right", gotoright:"Right", selectpagedown:"Shift-PageDown", pagedown:"PageDown", selectpageup:"Shift-PageUp", pageup:"PageUp", selectlinestart:"Shift-Home", - selectlineend:"Shift-End", del:"Delete", backspace:"Backspace", outdent:"Shift-Tab", indent:"Tab"} -}); -define("pilot/console", ["require", "exports", "module"], function(i, g) { - var l = function() { - }; - i = ["assert", "count", "debug", "dir", "dirxml", "error", "group", "groupEnd", "info", "log", "profile", "profileEnd", "time", "timeEnd", "trace", "warn"]; - typeof window === "undefined" ? i.forEach(function(e) { - g[e] = function() { - var j = Array.prototype.slice.call(arguments); - postMessage(JSON.stringify({op:"log", method:e, args:j})) - } - }) : i.forEach(function(e) { - g[e] = window.console && window.console[e] ? Function.prototype.bind.call(window.console[e], window.console) : l - }) -}); -define("pilot/stacktrace", ["require", "exports", "module", "pilot/useragent", "pilot/console"], function(i, g) { - function l(h) { - for(var m = 0;m < h.length;++m) { - var b = h[m]; - if(typeof b == "object") { - h[m] = "#object" - }else { - if(typeof b == "function") { - h[m] = "#function" - }else { - if(typeof b == "string") { - h[m] = '"' + b + '"' - } - } - } - }return h.join(",") - } - function e() { - } - var j = i("pilot/useragent"), o = i("pilot/console"), d = function() { - return j.isGecko ? "firefox" : j.isOpera ? "opera" : "other" - }(), k = {chrome:function(h) { - var m = h.stack; - if(!m) { - o.log(h); - return[] - }return m.replace(/^.*?\n/, "").replace(/^.*?\n/, "").replace(/^.*?\n/, "").replace(/^[^\(]+?[\n$]/gm, "").replace(/^\s+at\s+/gm, "").replace(/^Object.\s*\(/gm, "{anonymous}()@").split("\n") - }, firefox:function(h) { - var m = h.stack; - if(!m) { - o.log(h); - return[] - }m = m.replace(/(?:\n@:0)?\s+$/m, ""); - m = m.replace(/^\(/gm, "{anonymous}("); - return m.split("\n") - }, opera:function(h) { - h = h.message.split("\n"); - var m = /Line\s+(\d+).*?script\s+(http\S+)(?:.*?in\s+function\s+(\S+))?/i, b, c, n; - b = 4; - c = 0; - for(n = h.length;b < n;b += 2) { - if(m.test(h[b])) { - h[c++] = (RegExp.$3 ? RegExp.$3 + "()@" + RegExp.$2 + RegExp.$1 : "{anonymous}()@" + RegExp.$2 + ":" + RegExp.$1) + " -- " + h[b + 1].replace(/^\s+/, "") - } - }h.splice(c, h.length - c); - return h - }, other:function(h) { - for(var m = /function\s*([\w\-$]+)?\s*\(/i, b = [], c = 0, n, p;h && b.length < 10;) { - n = m.test(h.toString()) ? RegExp.$1 || "{anonymous}" : "{anonymous}"; - p = Array.prototype.slice.call(h.arguments); - b[c++] = n + "(" + l(p) + ")"; - if(h === h.caller && window.opera) { - break - }h = h.caller - }return b - }}; - e.prototype = {sourceCache:{}, ajax:function(h) { - var m = this.createXMLHTTPObject(); - if(m) { - m.open("GET", h, false); - m.setRequestHeader("User-Agent", "XMLHTTP/1.0"); - m.send(""); - return m.responseText - } - }, createXMLHTTPObject:function() { - for(var h, m = [function() { - return new XMLHttpRequest - }, function() { - return new ActiveXObject("Msxml2.XMLHTTP") - }, function() { - return new ActiveXObject("Msxml3.XMLHTTP") - }, function() { - return new ActiveXObject("Microsoft.XMLHTTP") - }], b = 0;b < m.length;b++) { - try { - h = m[b](); - this.createXMLHTTPObject = m[b]; - return h - }catch(c) { - } - } - }, getSource:function(h) { - h in this.sourceCache || (this.sourceCache[h] = this.ajax(h).split("\n")); - return this.sourceCache[h] - }, guessFunctions:function(h) { - for(var m = 0;m < h.length;++m) { - var b = h[m], c = /{anonymous}\(.*\)@(\w+:\/\/([-\w\.]+)+(:\d+)?[^:]+):(\d+):?(\d+)?/.exec(b); - if(c) { - var n = c[1]; - c = c[4]; - if(n && c) { - n = this.guessFunctionName(n, c); - h[m] = b.replace("{anonymous}", n) - } - } - }return h - }, guessFunctionName:function(h, m) { - try { - return this.guessFunctionNameFromLines(m, this.getSource(h)) - }catch(b) { - return"getSource failed with url: " + h + ", exception: " + b.toString() - } - }, guessFunctionNameFromLines:function(h, m) { - for(var b = /function ([^(]*)\(([^)]*)\)/, c = /['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*(function|eval|new Function)/, n = "", p = 0;p < 10;++p) { - n = m[h - p] + n; - if(n !== undefined) { - var r = c.exec(n); - if(r) { - return r[1] - }else { - r = b.exec(n) - }if(r && r[1]) { - return r[1] - } - } - }return"(?)" - }}; - var a = new e, f = [/http:\/\/localhost:4020\/sproutcore.js:/]; - g.ignoreFramesMatching = function(h) { - f.push(h) - }; - g.Trace = function(h, m) { - this._ex = h; - this._stack = k[d](h); - if(m) { - this._stack = a.guessFunctions(this._stack) - } - }; - g.Trace.prototype.log = function(h) { - if(h <= 0) { - h = 999999999 - }for(var m = 0, b = 0;b < this._stack.length && m < h;b++) { - var c = this._stack[b], n = true; - f.forEach(function(p) { - if(p.test(c)) { - n = false - } + c.focus() }); - if(n) { - o.debug(c); - m++ - } - } - } -}); -define("pilot/event_emitter", ["require", "exports", "module"], function(i, g) { - i = {}; - i._dispatchEvent = function(l, e) { - this._eventRegistry = this._eventRegistry || {}; - var j = this._eventRegistry[l]; - if(j && j.length) { - e = e || {}; - e.type = l; - for(l = 0;l < j.length;l++) { - j[l](e) - } - } - }; - i.on = i.addEventListener = function(l, e) { - this._eventRegistry = this._eventRegistry || {}; - var j = this._eventRegistry[l]; - j || (j = this._eventRegistry[l] = []); - j.indexOf(e) == -1 && j.push(e) - }; - i.removeEventListener = function(l, e) { - this._eventRegistry = this._eventRegistry || {}; - if(l = this._eventRegistry[l]) { - e = l.indexOf(e); - e !== -1 && l.splice(e, 1) - } - }; - g.EventEmitter = i -}); -define("pilot/catalog", ["require", "exports", "module"], function(i, g) { - var l = {}; - g.addExtensionSpec = function(e) { - l[e.name] = e - }; - g.removeExtensionSpec = function(e) { - if(typeof e === "string") { - delete l[e] - }else { - delete l[e.name] - } - }; - g.getExtensionSpec = function(e) { - return l[e] - }; - g.getExtensionSpecs = function() { - return Object.keys(l) - } -}); -define("pilot/types", ["require", "exports", "module"], function(i, g) { - function l(k, a, f, h) { - this.value = k; - this.status = a || o.VALID; - this.message = f; - this.predictions = h || [] - } - function e() { - } - function j(k, a) { - k = d[k]; - if(typeof k === "function") { - k = new k(a) - }return k - } - var o = {VALID:{toString:function() { - return"VALID" - }, valueOf:function() { - return 0 - }}, INCOMPLETE:{toString:function() { - return"INCOMPLETE" - }, valueOf:function() { - return 1 - }}, INVALID:{toString:function() { - return"INVALID" - }, valueOf:function() { - return 2 - }}, combine:function() { - for(var k = o.VALID, a = 0;a < arguments;a++) { - if(arguments[a] > k) { - k = arguments[a] - } - }return k - }}; - g.Status = o; - g.Conversion = l; - e.prototype = {stringify:function() { - throw new Error("not implemented"); - }, parse:function() { - throw new Error("not implemented"); - }, name:undefined, increment:function() { - }, decrement:function() { - }}; - g.Type = e; - var d = {}; - g.registerType = function(k) { - if(typeof k === "object") { - if(k instanceof e) { - if(!k.name) { - throw new Error("All registered types must have a name"); - }d[k.name] = k - }else { - throw new Error("Can't registerType using: " + k); - } - }else { - if(typeof k === "function") { - if(!k.prototype.name) { - throw new Error("All registered types must have a name"); - }d[k.prototype.name] = k - }else { - throw new Error("Unknown type: " + k); - } - } - }; - g.deregisterType = function(k) { - delete d[k.name] - }; - g.getType = function(k) { - if(typeof k === "string") { - return j(k, k) - }if(typeof k == "object") { - if(!k.name) { - throw new Error("Missing 'name' member to typeSpec"); - }return j(k.name, k) - }throw new Error("Can't extract type from " + k); - } -}); -define("pilot/canon", ["require", "exports", "module", "pilot/console", "pilot/stacktrace", "pilot/oop", "pilot/event_emitter", "pilot/catalog", "pilot/types", "pilot/types", "pilot/lang"], function(i, g) { - function l(q) { - if(!q.name) { - throw new Error("All registered commands must have a name"); - }if(q.params == null) { - q.params = [] - }if(!Array.isArray(q.params)) { - throw new Error("command.params must be an array in " + q.name); - }q.params.forEach(function(s) { - if(!s.name) { - throw new Error("In " + q.name + ": all params must have a name"); - }e(q.name, s) - }, this); - p[q.name] = q; - r.push(q.name); - r.sort() - } - function e(q, s) { - var u = s.type; - s.type = b.getType(u); - if(s.type == null) { - throw new Error("In " + q + "/" + s.name + ": can't find type for: " + JSON.stringify(u)); - } - } - function j(q) { - q = typeof q === "string" ? q : q.name; - delete p[q]; - c.arrayRemove(r, q) - } - function o(q) { - return p[q] - } - function d() { - return r - } - function k(q, s, u, x) { - if(typeof q === "string") { - q = p[q] - }if(!q) { - return false - }x = new a({command:q, args:u, typed:x}); - q.exec(s, u || {}, x); - return true - } - function a(q) { - q = q || {}; - this.command = q.command; - this.args = q.args; - this.typed = q.typed; - this._begunOutput = false; - this.start = new Date; - this.end = null; - this.error = this.completed = false - } - i("pilot/console"); - i("pilot/stacktrace"); - var f = i("pilot/oop"), h = i("pilot/event_emitter").EventEmitter, m = i("pilot/catalog"); - i("pilot/types"); - var b = i("pilot/types"), c = i("pilot/lang"), n = {name:"command", description:"A command is a bit of functionality with optional typed arguments which can do something small like moving the cursor around the screen, or large like cloning a project from VCS.", indexOn:"name"}; - g.startup = function() { - m.addExtensionSpec(n) - }; - g.shutdown = function() { - m.removeExtensionSpec(n) - }; - var p = {}, r = []; - g.removeCommand = j; - g.addCommand = l; - g.getCommand = o; - g.getCommandNames = d; - g.exec = k; - g.upgradeType = e; - f.implement(g, h); - var t = []; - f.implement(a.prototype, h); - a.prototype._beginOutput = function() { - this._begunOutput = true; - this.outputs = []; - for(t.push(this);t.length > 100;) { - t.shiftObject() - }g._dispatchEvent("output", {requests:t, request:this}) - }; - a.prototype.doneWithError = function(q) { - this.error = true; - this.done(q) - }; - a.prototype.async = function() { - this._begunOutput || this._beginOutput() - }; - a.prototype.output = function(q) { - this._begunOutput || this._beginOutput(); - if(typeof q !== "string" && !(q instanceof Node)) { - q = q.toString() - }this.outputs.push(q); - this._dispatchEvent("output", {}); - return this - }; - a.prototype.done = function(q) { - this.completed = true; - this.end = new Date; - this.duration = this.end.getTime() - this.start.getTime(); - q && this.output(q); - this._dispatchEvent("output", {}) - }; - g.Request = a -}); -define("ace/commands/default_commands", ["require", "exports", "module", "pilot/canon"], function(i) { - i = i("pilot/canon"); - i.addCommand({name:"selectall", exec:function(g) { - g.editor.getSelection().selectAll() - }}); - i.addCommand({name:"removeline", exec:function(g) { - g.editor.removeLines() - }}); - i.addCommand({name:"gotoline", exec:function(g) { - var l = parseInt(prompt("Enter line number:")); - isNaN(l) || g.editor.gotoLine(l) - }}); - i.addCommand({name:"togglecomment", exec:function(g) { - g.editor.toggleCommentLines() - }}); - i.addCommand({name:"findnext", exec:function(g) { - g.editor.findNext() - }}); - i.addCommand({name:"findprevious", exec:function(g) { - g.editor.findPrevious() - }}); - i.addCommand({name:"find", exec:function(g) { - var l = prompt("Find:"); - g.editor.find(l) - }}); - i.addCommand({name:"undo", exec:function(g) { - g.editor.undo() - }}); - i.addCommand({name:"redo", exec:function(g) { - g.editor.redo() - }}); - i.addCommand({name:"redo", exec:function(g) { - g.editor.redo() - }}); - i.addCommand({name:"overwrite", exec:function(g) { - g.editor.toggleOverwrite() - }}); - i.addCommand({name:"copylinesup", exec:function(g) { - g.editor.copyLinesUp() - }}); - i.addCommand({name:"movelinesup", exec:function(g) { - g.editor.moveLinesUp() - }}); - i.addCommand({name:"selecttostart", exec:function(g) { - g.editor.getSelection().selectFileStart() - }}); - i.addCommand({name:"gotostart", exec:function(g) { - g.editor.navigateFileStart() - }}); - i.addCommand({name:"selectup", exec:function(g) { - g.editor.getSelection().selectUp() - }}); - i.addCommand({name:"golineup", exec:function(g) { - g.editor.navigateUp() - }}); - i.addCommand({name:"copylinesdown", exec:function(g) { - g.editor.copyLinesDown() - }}); - i.addCommand({name:"movelinesdown", exec:function(g) { - g.editor.moveLinesDown() - }}); - i.addCommand({name:"selecttoend", exec:function(g) { - g.editor.getSelection().selectFileEnd() - }}); - i.addCommand({name:"gotoend", exec:function(g) { - g.editor.navigateFileEnd() - }}); - i.addCommand({name:"selectdown", exec:function(g) { - g.editor.getSelection().selectDown() - }}); - i.addCommand({name:"godown", exec:function(g) { - g.editor.navigateDown() - }}); - i.addCommand({name:"selectwordleft", exec:function(g) { - g.editor.getSelection().selectWordLeft() - }}); - i.addCommand({name:"gotowordleft", exec:function(g) { - g.editor.navigateWordLeft() - }}); - i.addCommand({name:"selecttolinestart", exec:function(g) { - g.editor.getSelection().selectLineStart() - }}); - i.addCommand({name:"gotolinestart", exec:function(g) { - g.editor.navigateLineStart() - }}); - i.addCommand({name:"selectleft", exec:function(g) { - g.editor.getSelection().selectLeft() - }}); - i.addCommand({name:"gotoleft", exec:function(g) { - g.editor.navigateLeft() - }}); - i.addCommand({name:"selectwordright", exec:function(g) { - g.editor.getSelection().selectWordRight() - }}); - i.addCommand({name:"gotowordright", exec:function(g) { - g.editor.navigateWordRight() - }}); - i.addCommand({name:"selecttolineend", exec:function(g) { - g.editor.getSelection().selectLineEnd() - }}); - i.addCommand({name:"gotolineend", exec:function(g) { - g.editor.navigateLineEnd() - }}); - i.addCommand({name:"selectright", exec:function(g) { - g.editor.getSelection().selectRight() - }}); - i.addCommand({name:"gotoright", exec:function(g) { - g.editor.navigateRight() - }}); - i.addCommand({name:"selectpagedown", exec:function(g) { - g.editor.selectPageDown() - }}); - i.addCommand({name:"pagedown", exec:function(g) { - g.editor.scrollPageDown() - }}); - i.addCommand({name:"gotopagedown", exec:function(g) { - g.editor.gotoPageDown() - }}); - i.addCommand({name:"selectpageup", exec:function(g) { - g.editor.selectPageUp() - }}); - i.addCommand({name:"pageup", exec:function(g) { - g.editor.scrollPageUp() - }}); - i.addCommand({name:"gotopageup", exec:function(g) { - g.editor.gotoPageUp() - }}); - i.addCommand({name:"selectlinestart", exec:function(g) { - g.editor.getSelection().selectLineStart() - }}); - i.addCommand({name:"gotolinestart", exec:function(g) { - g.editor.navigateLineStart() - }}); - i.addCommand({name:"selectlineend", exec:function(g) { - g.editor.getSelection().selectLineEnd() - }}); - i.addCommand({name:"gotolineend", exec:function(g) { - g.editor.navigateLineEnd() - }}); - i.addCommand({name:"del", exec:function(g) { - g.editor.removeRight() - }}); - i.addCommand({name:"backspace", exec:function(g) { - g.editor.removeLeft() - }}); - i.addCommand({name:"outdent", exec:function(g) { - g.editor.blockOutdent() - }}); - i.addCommand({name:"indent", exec:function(g) { - g.editor.indent() - }}) -}); -define("ace/keybinding", ["require", "exports", "module", "pilot/useragent", "pilot/event", "ace/conf/keybindings/default_mac", "ace/conf/keybindings/default_win", "pilot/canon", "ace/commands/default_commands"], function(i, g) { - var l = i("pilot/useragent"), e = i("pilot/event"), j = i("ace/conf/keybindings/default_mac").bindings, o = i("ace/conf/keybindings/default_win").bindings, d = i("pilot/canon"); - i("ace/commands/default_commands"); - i = function(k, a, f) { - this.setConfig(f); - var h = this; - e.addKeyListener(k, function(m) { - var b = (h.config.reverse[l.isOpera && l.isMac ? 0 | (m.metaKey ? 1 : 0) | (m.altKey ? 2 : 0) | (m.shiftKey ? 4 : 0) | (m.ctrlKey ? 8 : 0) : 0 | (m.ctrlKey ? 1 : 0) | (m.altKey ? 2 : 0) | (m.shiftKey ? 4 : 0) | (m.metaKey ? 8 : 0)] || {})[(h.keyNames[m.keyCode] || String.fromCharCode(m.keyCode)).toLowerCase()]; - if(d.exec(b, {editor:a})) { - return e.stopEvent(m) - } - }) - }; - (function() { - function k(h, m, b, c) { - return(c && h.toLowerCase() || h).replace(/(?:^\s+|\n|\s+$)/g, "").split(new RegExp("[\\s ]*" + m + "[\\s ]*", "g"), b || 999) - } - function a(h, m, b) { - var c, n = 0; - h = k(h, "\\-", null, true); - for(var p = 0, r = h.length;p < r;++p) { - if(this.keyMods[h[p]]) { - n |= this.keyMods[h[p]] - }else { - c = h[p] || "-" - } - }(b[n] || (b[n] = {}))[c] = m; - return b - } - function f(h, m) { - var b, c, n, p, r = {}; - for(b in h) { - p = h[b]; - if(m && typeof p == "string") { - p = p.split(m); - c = 0; - for(n = p.length;c < n;++c) { - a.call(this, p[c], b, r) - } - }else { - a.call(this, p, b, r) - } - }return r - } - this.keyMods = {ctrl:1, alt:2, option:2, shift:4, meta:8, command:8}; - this.keyNames = {"8":"Backspace", "9":"Tab", "13":"Enter", "27":"Esc", "32":"Space", "33":"PageUp", "34":"PageDown", "35":"End", "36":"Home", "37":"Left", "38":"Up", "39":"Right", "40":"Down", "45":"Insert", "46":"Delete", "107":"+", "112":"F1", "113":"F2", "114":"F3", "115":"F4", "116":"F5", "117":"F6", "118":"F7", "119":"F8", "120":"F9", "121":"F10", "122":"F11", "123":"F12"}; - this.setConfig = function(h) { - this.config = h || (l.isMac ? j : o); - if(typeof this.config.reverse == "undefined") { - this.config.reverse = f.call(this, this.config, "|") - } - } - }).call(i.prototype); - g.KeyBinding = i -}); -define("ace/range", ["require", "exports", "module"], function(i, g) { - var l = function(e, j, o, d) { - this.start = {row:e, column:j}; - this.end = {row:o, column:d} - }; - (function() { - this.toString = function() { - return"Range: [" + this.start.row + "/" + this.start.column + "] -> [" + this.end.row + "/" + this.end.column + "]" - }; - this.contains = function(e, j) { - return this.compare(e, j) == 0 - }; - this.compare = function(e, j) { - if(!this.isMultiLine()) { - if(e === this.start.row) { - return j < this.start.column ? -1 : j > this.end.column ? 1 : 0 - } - }if(e < this.start.row) { - return-1 - }if(e > this.end.row) { - return 1 - }if(this.start.row === e) { - return j >= this.start.column ? 0 : -1 - }if(this.end.row === e) { - return j <= this.end.column ? 0 : 1 - }return 0 - }; - this.clipRows = function(e, j) { - if(this.end.row > j) { - var o = {row:j + 1, column:0} - }if(this.start.row > j) { - var d = {row:j + 1, column:0} - }if(this.start.row < e) { - d = {row:e, column:0} - }if(this.end.row < e) { - o = {row:e, column:0} - }return l.fromPoints(d || this.start, o || this.end) - }; - this.extend = function(e, j) { - var o = this.compare(e, j); - if(o == 0) { - return this - }else { - if(o == -1) { - var d = {row:e, column:j} - }else { - var k = {row:e, column:j} - } - }return l.fromPoints(d || this.start, k || this.end) - }; - this.isEmpty = function() { - return this.start.row == this.end.row && this.start.column == this.end.column - }; - this.isMultiLine = function() { - return this.start.row !== this.end.row - }; - this.clone = function() { - return l.fromPoints(this.start, this.end) - }; - this.collapseRows = function() { - return this.end.column == 0 ? new l(this.start.row, 0, Math.max(this.start.row, this.end.row - 1), 0) : new l(this.start.row, 0, this.end.row, 0) - }; - this.toScreenRange = function(e) { - return new l(this.start.row, e.documentToScreenColumn(this.start.row, this.start.column), this.end.row, e.documentToScreenColumn(this.end.row, this.end.column)) - } - }).call(l.prototype); - l.fromPoints = function(e, j) { - return new l(e.row, e.column, j.row, j.column) - }; - g.Range = l -}); -define("ace/selection", ["require", "exports", "module", "pilot/oop", "pilot/lang", "pilot/event_emitter", "ace/range"], function(i, g) { - var l = i("pilot/oop"), e = i("pilot/lang"), j = i("pilot/event_emitter").EventEmitter, o = i("ace/range").Range; - i = function(d) { - this.doc = d; - this.clearSelection(); - this.selectionLead = {row:0, column:0} - }; - (function() { - l.implement(this, j); - this.isEmpty = function() { - return!this.selectionAnchor || this.selectionAnchor.row == this.selectionLead.row && this.selectionAnchor.column == this.selectionLead.column - }; - this.isMultiLine = function() { - if(this.isEmpty()) { - return false - }return this.getRange().isMultiLine() - }; - this.getCursor = function() { - return this.selectionLead - }; - this.setSelectionAnchor = function(d, k) { - d = this.$clipPositionToDocument(d, k); - if(this.selectionAnchor) { - if(this.selectionAnchor.row !== d.row || this.selectionAnchor.column !== d.column) { - this.selectionAnchor = d; - this._dispatchEvent("changeSelection", {}) - } - }else { - this.selectionAnchor = d; - this._dispatchEvent("changeSelection", {}) - } - }; - this.getSelectionAnchor = function() { - return this.selectionAnchor ? this.$clone(this.selectionAnchor) : this.$clone(this.selectionLead) - }; - this.getSelectionLead = function() { - return this.$clone(this.selectionLead) - }; - this.shiftSelection = function(d) { - if(this.isEmpty()) { - this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + d) - }else { - var k = this.getSelectionAnchor(), a = this.getSelectionLead(), f = this.isBackwards(); - if(!f || k.column !== 0) { - this.setSelectionAnchor(k.row, k.column + d) - }if(f || a.column !== 0) { - this.$moveSelection(function() { - this.moveCursorTo(a.row, a.column + d) - }) - } - } - }; - this.isBackwards = function() { - var d = this.selectionAnchor || this.selectionLead, k = this.selectionLead; - return d.row > k.row || d.row == k.row && d.column > k.column - }; - this.getRange = function() { - var d = this.selectionAnchor || this.selectionLead, k = this.selectionLead; - return this.isBackwards() ? o.fromPoints(k, d) : o.fromPoints(d, k) - }; - this.clearSelection = function() { - if(this.selectionAnchor) { - this.selectionAnchor = null; - this._dispatchEvent("changeSelection", {}) - } - }; - this.selectAll = function() { - var d = this.doc.getLength() - 1; - this.setSelectionAnchor(d, this.doc.getLine(d).length); - if(!this.selectionAnchor) { - this.selectionAnchor = this.$clone(this.selectionLead) - }d = {row:0, column:0}; - if(d.row !== this.selectionLead.row || d.column !== this.selectionLead.column) { - this.selectionLead = d; - this._dispatchEvent("changeSelection", {blockScrolling:true}) - } - }; - this.setSelectionRange = function(d, k) { - if(k) { - this.setSelectionAnchor(d.end.row, d.end.column); - this.selectTo(d.start.row, d.start.column) - }else { - this.setSelectionAnchor(d.start.row, d.start.column); - this.selectTo(d.end.row, d.end.column) - } - }; - this.$moveSelection = function(d) { - var k = false; - if(!this.selectionAnchor) { - k = true; - this.selectionAnchor = this.$clone(this.selectionLead) - }var a = this.$clone(this.selectionLead); - d.call(this); - if(a.row !== this.selectionLead.row || a.column !== this.selectionLead.column) { - k = true - }k && this._dispatchEvent("changeSelection", {}) - }; - this.selectTo = function(d, k) { - this.$moveSelection(function() { - this.moveCursorTo(d, k) - }) - }; - this.selectToPosition = function(d) { - this.$moveSelection(function() { - this.moveCursorToPosition(d) - }) - }; - this.selectUp = function() { - this.$moveSelection(this.moveCursorUp) - }; - this.selectDown = function() { - this.$moveSelection(this.moveCursorDown) - }; - this.selectRight = function() { - this.$moveSelection(this.moveCursorRight) - }; - this.selectLeft = function() { - this.$moveSelection(this.moveCursorLeft) - }; - this.selectLineStart = function() { - this.$moveSelection(this.moveCursorLineStart) - }; - this.selectLineEnd = function() { - this.$moveSelection(this.moveCursorLineEnd) - }; - this.selectFileEnd = function() { - this.$moveSelection(this.moveCursorFileEnd) - }; - this.selectFileStart = function() { - this.$moveSelection(this.moveCursorFileStart) - }; - this.selectWordRight = function() { - this.$moveSelection(this.moveCursorWordRight) - }; - this.selectWordLeft = function() { - this.$moveSelection(this.moveCursorWordLeft) - }; - this.selectWord = function() { - var d = this.selectionLead; - this.setSelectionRange(this.doc.getWordRange(d.row, d.column)) - }; - this.selectLine = function() { - this.setSelectionAnchor(this.selectionLead.row, 0); - this.$moveSelection(function() { - this.moveCursorTo(this.selectionLead.row + 1, 0) - }) - }; - this.moveCursorUp = function() { - this.moveCursorBy(-1, 0) - }; - this.moveCursorDown = function() { - this.moveCursorBy(1, 0) - }; - this.moveCursorLeft = function() { - if(this.selectionLead.column == 0) { - this.selectionLead.row > 0 && this.moveCursorTo(this.selectionLead.row - 1, this.doc.getLine(this.selectionLead.row - 1).length) - }else { - var d = this.doc, k = d.getTabSize(), a = this.selectionLead; - d.isTabStop(a) && d.getLine(a.row).slice(a.column - k, a.column).split(" ").length - 1 == k ? this.moveCursorBy(0, -k) : this.moveCursorBy(0, -1) - } - }; - this.moveCursorRight = function() { - if(this.selectionLead.column == this.doc.getLine(this.selectionLead.row).length) { - this.selectionLead.row < this.doc.getLength() - 1 && this.moveCursorTo(this.selectionLead.row + 1, 0) - }else { - var d = this.doc, k = d.getTabSize(), a = this.selectionLead; - d.isTabStop(a) && d.getLine(a.row).slice(a.column, a.column + k).split(" ").length - 1 == k ? this.moveCursorBy(0, k) : this.moveCursorBy(0, 1) - } - }; - this.moveCursorLineStart = function() { - var d = this.selectionLead.row, k = this.selectionLead.column, a = this.doc.getLine(d).slice(0, k).match(/^\s*/); - if(a[0].length == 0) { - this.moveCursorTo(d, this.doc.getLine(d).match(/^\s*/)[0].length) - }else { - a[0].length >= k ? this.moveCursorTo(d, 0) : this.moveCursorTo(d, a[0].length) - } - }; - this.moveCursorLineEnd = function() { - this.moveCursorTo(this.selectionLead.row, this.doc.getLine(this.selectionLead.row).length) - }; - this.moveCursorFileEnd = function() { - var d = this.doc.getLength() - 1, k = this.doc.getLine(d).length; - this.moveCursorTo(d, k) - }; - this.moveCursorFileStart = function() { - this.moveCursorTo(0, 0) - }; - this.moveCursorWordRight = function() { - var d = this.selectionLead.row, k = this.selectionLead.column, a = this.doc.getLine(d), f = a.substring(k); - this.doc.nonTokenRe.lastIndex = 0; - this.doc.tokenRe.lastIndex = 0; - if(k == a.length) { - this.moveCursorRight() - }else { - if(this.doc.nonTokenRe.exec(f)) { - k += this.doc.nonTokenRe.lastIndex; - this.doc.nonTokenRe.lastIndex = 0 - }else { - if(this.doc.tokenRe.exec(f)) { - k += this.doc.tokenRe.lastIndex; - this.doc.tokenRe.lastIndex = 0 - } - }this.moveCursorTo(d, k) - } - }; - this.moveCursorWordLeft = function() { - var d = this.selectionLead.row, k = this.selectionLead.column, a = this.doc.getLine(d); - a = e.stringReverse(a.substring(0, k)); - this.doc.nonTokenRe.lastIndex = 0; - this.doc.tokenRe.lastIndex = 0; - if(k == 0) { - this.moveCursorLeft() - }else { - if(this.doc.nonTokenRe.exec(a)) { - k -= this.doc.nonTokenRe.lastIndex; - this.doc.nonTokenRe.lastIndex = 0 - }else { - if(this.doc.tokenRe.exec(a)) { - k -= this.doc.tokenRe.lastIndex; - this.doc.tokenRe.lastIndex = 0 - } - }this.moveCursorTo(d, k) - } - }; - this.moveCursorBy = function(d, k) { - this.moveCursorTo(this.selectionLead.row + d, this.selectionLead.column + k) - }; - this.moveCursorToPosition = function(d) { - this.moveCursorTo(d.row, d.column) - }; - this.moveCursorTo = function(d, k) { - d = this.$clipPositionToDocument(d, k); - if(d.row !== this.selectionLead.row || d.column !== this.selectionLead.column) { - this.selectionLead = d; - this._dispatchEvent("changeCursor", {data:this.getCursor()}) - } - }; - this.moveCursorUp = function() { - this.moveCursorBy(-1, 0) - }; - this.$clipPositionToDocument = function(d, k) { - var a = {}; - if(d >= this.doc.getLength()) { - a.row = Math.max(0, this.doc.getLength() - 1); - a.column = this.doc.getLine(a.row).length - }else { - if(d < 0) { - a.row = 0; - a.column = 0 - }else { - a.row = d; - a.column = Math.min(this.doc.getLine(a.row).length, Math.max(0, k)) - } - }return a - }; - this.$clone = function(d) { - return{row:d.row, column:d.column} - } - }).call(i.prototype); - g.Selection = i -}); -define("ace/tokenizer", ["require", "exports", "module"], function(i, g) { - i = function(l) { - this.rules = l; - this.regExps = {}; - for(var e in this.rules) { - l = this.rules[e]; - for(var j = [], o = 0;o < l.length;o++) { - j.push(l[o].regex) - }this.regExps[e] = new RegExp("(?:(" + j.join(")|(") + ")|(.))", "g") - } - }; - (function() { - this.getLineTokens = function(l, e) { - e = e; - var j = this.rules[e], o = this.regExps[e]; - o.lastIndex = 0; - for(var d, k = [], a = 0, f = {type:null, value:""};d = o.exec(l);) { - var h = "text", m = d[0]; - if(o.lastIndex == a) { - throw new Error("tokenizer error"); - }a = o.lastIndex; - for(var b = 0;b < j.length;b++) { - if(d[b + 1]) { - h = typeof j[b].token == "function" ? j[b].token(d[0]) : j[b].token; - if(j[b].next && j[b].next !== e) { - e = j[b].next; - j = this.rules[e]; - a = o.lastIndex; - o = this.regExps[e]; - o.lastIndex = a - }break - } - }if(f.type !== h) { - f.type && k.push(f); - f = {type:h, value:m} - }else { - f.value += m - } - }f.type && k.push(f); - return{tokens:k, state:e} - } - }).call(i.prototype); - g.Tokenizer = i -}); -define("ace/mode/text_highlight_rules", ["require", "exports", "module"], function(i, g) { - i = function() { - this.$rules = {start:[{token:"text", regex:".+"}]} - }; - (function() { - this.addRules = function(l, e) { - for(var j in l) { - for(var o = l[j], d = 0;d < o.length;d++) { - var k = o[d]; - k.next = k.next ? e + k.next : e + j - }this.$rules[e + j] = o - } - }; - this.getRules = function() { - return this.$rules - } - }).call(i.prototype); - g.TextHighlightRules = i -}); -define("ace/mode/text", ["require", "exports", "module", "ace/tokenizer", "ace/mode/text_highlight_rules"], function(i, g) { - var l = i("ace/tokenizer").Tokenizer, e = i("ace/mode/text_highlight_rules").TextHighlightRules; - i = function() { - this.$tokenizer = new l((new e).getRules()) - }; - (function() { - this.getTokenizer = function() { - return this.$tokenizer - }; - this.toggleCommentLines = function() { - return 0 - }; - this.getNextLineIndent = function() { - return"" - }; - this.checkOutdent = function() { - return false - }; - this.autoOutdent = function() { - }; - this.$getIndent = function(j) { - if(j = j.match(/^(\s+)/)) { - return j[1] - }return"" - } - }).call(i.prototype); - g.Mode = i -}); -define("ace/document", ["require", "exports", "module", "pilot/oop", "pilot/lang", "pilot/event_emitter", "ace/selection", "ace/mode/text", "ace/range"], function(i, g) { - var l = i("pilot/oop"), e = i("pilot/lang"), j = i("pilot/event_emitter").EventEmitter, o = i("ace/selection").Selection, d = i("ace/mode/text").Mode, k = i("ace/range").Range; - i = function(a, f) { - this.modified = true; - this.lines = []; - this.selection = new o(this); - this.$breakpoints = []; - this.listeners = []; - f && this.setMode(f); - Array.isArray(a) ? this.$insertLines(0, a) : this.$insert({row:0, column:0}, a) - }; - (function() { - l.implement(this, j); - this.$undoManager = null; - this.$split = function(a) { - return a.split(/\r\n|\r|\n/) - }; - this.setValue = function(a) { - var f = [0, this.lines.length]; - f.push.apply(f, this.$split(a)); - this.lines.splice.apply(this.lines, f); - this.modified = true; - this.fireChangeEvent(0) - }; - this.toString = function() { - return this.lines.join(this.$getNewLineCharacter()) - }; - this.getSelection = function() { - return this.selection - }; - this.fireChangeEvent = function(a, f) { - this._dispatchEvent("change", {data:{firstRow:a, lastRow:f}}) - }; - this.setUndoManager = function(a) { - this.$undoManager = a; - this.$deltas = []; - this.$informUndoManager && this.$informUndoManager.cancel(); - if(a) { - var f = this; - this.$informUndoManager = e.deferredCall(function() { - f.$deltas.length > 0 && a.execute({action:"aceupdate", args:[f.$deltas, f]}); - f.$deltas = [] - }) - } - }; - this.$defaultUndoManager = {undo:function() { - }, redo:function() { - }}; - this.getUndoManager = function() { - return this.$undoManager || this.$defaultUndoManager - }; - this.getTabString = function() { - return this.getUseSoftTabs() ? e.stringRepeat(" ", this.getTabSize()) : "\t" - }; - this.$useSoftTabs = true; - this.setUseSoftTabs = function(a) { - if(this.$useSoftTabs !== a) { - this.$useSoftTabs = a - } - }; - this.getUseSoftTabs = function() { - return this.$useSoftTabs - }; - this.$tabSize = 4; - this.setTabSize = function(a) { - if(!(isNaN(a) || this.$tabSize === a)) { - this.modified = true; - this.$tabSize = a; - this._dispatchEvent("changeTabSize") - } - }; - this.getTabSize = function() { - return this.$tabSize - }; - this.isTabStop = function(a) { - return this.$useSoftTabs && a.column % this.$tabSize == 0 - }; - this.getBreakpoints = function() { - return this.$breakpoints - }; - this.setBreakpoints = function(a) { - this.$breakpoints = []; - for(var f = 0;f < a.length;f++) { - this.$breakpoints[a[f]] = true - }this._dispatchEvent("changeBreakpoint", {}) - }; - this.clearBreakpoints = function() { - this.$breakpoints = []; - this._dispatchEvent("changeBreakpoint", {}) - }; - this.setBreakpoint = function(a) { - this.$breakpoints[a] = true; - this._dispatchEvent("changeBreakpoint", {}) - }; - this.clearBreakpoint = function(a) { - delete this.$breakpoints[a]; - this._dispatchEvent("changeBreakpoint", {}) - }; - this.$detectNewLine = function(a) { - this.$autoNewLine = (a = a.match(/^.*?(\r?\n)/m)) ? a[1] : "\n" - }; - this.tokenRe = /^[\w\d]+/g; - this.nonTokenRe = /^[^\w\d]+/g; - this.getWordRange = function(a, f) { - var h = this.getLine(a), m = false; - if(f > 0) { - m = !!h.charAt(f - 1).match(this.tokenRe) - }m || (m = !!h.charAt(f).match(this.tokenRe)); - m = m ? this.tokenRe : this.nonTokenRe; - var b = f; - if(b > 0) { - do { - b-- - }while(b >= 0 && h.charAt(b).match(m)); - b++ - }for(f = f;f < h.length && h.charAt(f).match(m);) { - f++ - }return new k(a, b, a, f) - }; - this.$getNewLineCharacter = function() { - switch(this.$newLineMode) { - case "windows": - return"\r\n"; - case "unix": - return"\n"; - case "auto": - return this.$autoNewLine - } - }; - this.$autoNewLine = "\n"; - this.$newLineMode = "auto"; - this.setNewLineMode = function(a) { - if(this.$newLineMode !== a) { - this.$newLineMode = a - } - }; - this.getNewLineMode = function() { - return this.$newLineMode - }; - this.$mode = null; - this.setMode = function(a) { - if(this.$mode !== a) { - this.$mode = a; - this._dispatchEvent("changeMode") - } - }; - this.getMode = function() { - if(!this.$mode) { - this.$mode = new d - }return this.$mode - }; - this.$scrollTop = 0; - this.setScrollTopRow = function(a) { - if(this.$scrollTop !== a) { - this.$scrollTop = a; - this._dispatchEvent("changeScrollTop") - } - }; - this.getScrollTopRow = function() { - return this.$scrollTop - }; - this.getWidth = function() { - this.$computeWidth(); - return this.width - }; - this.getScreenWidth = function() { - this.$computeWidth(); - return this.screenWidth - }; - this.$computeWidth = function() { - if(this.modified) { - this.modified = false; - for(var a = this.lines, f = 0, h = 0, m = this.getTabSize(), b = 0;b < a.length;b++) { - var c = a[b].length; - f = Math.max(f, c); - a[b].replace("\t", function(n) { - c += m - 1; - return n - }); - h = Math.max(h, c) - }this.width = f; - this.screenWidth = h - } - }; - this.getLine = function(a) { - return this.lines[a] || "" - }; - this.getDisplayLine = function(a) { - var f = (new Array(this.getTabSize() + 1)).join(" "); - return this.lines[a].replace(/\t/g, f) - }; - this.getLines = function(a, f) { - return this.lines.slice(a, f + 1) - }; - this.getLength = function() { - return this.lines.length - }; - this.getTextRange = function(a) { - if(a.start.row == a.end.row) { - return this.lines[a.start.row].substring(a.start.column, a.end.column) - }else { - var f = []; - f.push(this.lines[a.start.row].substring(a.start.column)); - f.push.apply(f, this.getLines(a.start.row + 1, a.end.row - 1)); - f.push(this.lines[a.end.row].substring(0, a.end.column)); - return f.join(this.$getNewLineCharacter()) - } - }; - this.findMatchingBracket = function(a) { - if(a.column == 0) { - return null - }var f = this.getLine(a.row).charAt(a.column - 1); - if(f == "") { - return null - }f = f.match(/([\(\[\{])|([\)\]\}])/); - if(!f) { - return null - }return f[1] ? this.$findClosingBracket(f[1], a) : this.$findOpeningBracket(f[2], a) - }; - this.$brackets = {")":"(", "(":")", "]":"[", "[":"]", "{":"}", "}":"{"}; - this.$findOpeningBracket = function(a, f) { - var h = this.$brackets[a], m = f.column - 2; - f = f.row; - for(var b = 1, c = this.getLine(f);;) { - for(;m >= 0;) { - var n = c.charAt(m); - if(n == h) { - b -= 1; - if(b == 0) { - return{row:f, column:m} - } - }else { - if(n == a) { - b += 1 - } - }m -= 1 - }f -= 1; - if(f < 0) { - break - }c = this.getLine(f); - m = c.length - 1 - }return null - }; - this.$findClosingBracket = function(a, f) { - var h = this.$brackets[a], m = f.column; - f = f.row; - for(var b = 1, c = this.getLine(f), n = this.getLength();;) { - for(;m < c.length;) { - var p = c.charAt(m); - if(p == h) { - b -= 1; - if(b == 0) { - return{row:f, column:m} - } - }else { - if(p == a) { - b += 1 - } - }m += 1 - }f += 1; - if(f >= n) { - break - }c = this.getLine(f); - m = 0 - }return null - }; - this.insert = function(a, f, h) { - f = this.$insert(a, f, h); - this.fireChangeEvent(a.row, a.row == f.row ? a.row : undefined); - return f - }; - this.multiRowInsert = function(a, f, h) { - for(var m = this.lines, b = a.length - 1;b >= 0;b--) { - var c = a[b]; - if(!(c >= m.length)) { - var n = f - m[c].length; - if(n > 0) { - var p = e.stringRepeat(" ", n) + h; - n = -n - }else { - p = h; - n = 0 - }p = this.$insert({row:c, column:f + n}, p, false) - } - }if(p) { - this.fireChangeEvent(a[0], a[a.length - 1] + p.row - a[0]); - return{rows:p.row - a[0], columns:p.column - f} - }else { - return{rows:0, columns:0} - } - }; - this.$insertLines = function(a, f, h) { - if(f.length != 0) { - var m = [a, 0]; - m.push.apply(m, f); - this.lines.splice.apply(this.lines, m); - if(!h && this.$undoManager) { - h = this.$getNewLineCharacter(); - this.$deltas.push({action:"insertText", range:new k(a, 0, a + f.length, 0), text:f.join(h) + h}); - this.$informUndoManager.schedule() - } - } - }; - this.$insert = function(a, f, h) { - if(f.length == 0) { - return a - }this.modified = true; - this.lines.length <= 1 && this.$detectNewLine(f); - var m = this.$split(f); - if(this.$isNewLine(f)) { - var b = this.lines[a.row] || ""; - this.lines[a.row] = b.substring(0, a.column); - this.lines.splice(a.row + 1, 0, b.substring(a.column)); - m = {row:a.row + 1, column:0} - }else { - if(m.length == 1) { - b = this.lines[a.row] || ""; - this.lines[a.row] = b.substring(0, a.column) + f + b.substring(a.column); - m = {row:a.row, column:a.column + f.length} - }else { - b = this.lines[a.row] || ""; - var c = b.substring(0, a.column) + m[0]; - b = m[m.length - 1] + b.substring(a.column); - this.lines[a.row] = c; - this.$insertLines(a.row + 1, [b], true); - m.length > 2 && this.$insertLines(a.row + 1, m.slice(1, -1), true); - m = {row:a.row + m.length - 1, column:m[m.length - 1].length} - } - }if(!h && this.$undoManager) { - this.$deltas.push({action:"insertText", range:k.fromPoints(a, m), text:f}); - this.$informUndoManager.schedule() - }return m - }; - this.$isNewLine = function(a) { - return a == "\r\n" || a == "\r" || a == "\n" - }; - this.remove = function(a, f) { - if(a.isEmpty()) { - return a.start - }this.$remove(a, f); - this.fireChangeEvent(a.start.row, a.isMultiLine() ? undefined : a.start.row); - return a.start - }; - this.multiRowRemove = function(a, f) { - if(f.start.row !== a[0]) { - throw new TypeError("range must start in the first row!"); - }for(var h = f.end.row - a[0], m = a.length - 1;m >= 0;m--) { - var b = a[m]; - if(!(b >= this.lines.length)) { - var c = this.$remove(new k(b, f.start.column, b + h, f.end.column), false) - } - }if(c) { - h < 0 ? this.fireChangeEvent(a[0] + h, undefined) : this.fireChangeEvent(a[0], h == 0 ? a[a.length - 1] : undefined) - } - }; - this.$remove = function(a, f) { - if(!a.isEmpty()) { - if(!f && this.$undoManager) { - this.$getNewLineCharacter(); - this.$deltas.push({action:"removeText", range:a.clone(), text:this.getTextRange(a)}); - this.$informUndoManager.schedule() - }this.modified = true; - f = a.start.row; - var h = a.end.row, m = this.getLine(f).substring(0, a.start.column) + this.getLine(h).substring(a.end.column); - m != "" ? this.lines.splice(f, h - f + 1, m) : this.lines.splice(f, h - f + 1, ""); - return a.start - } - }; - this.undoChanges = function(a) { - this.selection.clearSelection(); - for(var f = a.length - 1;f >= 0;f--) { - var h = a[f]; - if(h.action == "insertText") { - this.remove(h.range, true); - this.selection.moveCursorToPosition(h.range.start) - }else { - this.insert(h.range.start, h.text, true); - this.selection.clearSelection() - } - } - }; - this.redoChanges = function(a) { - this.selection.clearSelection(); - for(var f = 0;f < a.length;f++) { - var h = a[f]; - if(h.action == "insertText") { - this.insert(h.range.start, h.text, true); - this.selection.setSelectionRange(h.range) - }else { - this.remove(h.range, true); - this.selection.moveCursorToPosition(h.range.start) - } - } - }; - this.replace = function(a, f) { - this.$remove(a); - f = f ? this.$insert(a.start, f) : a.start; - var h = a.end.column == 0 ? a.end.column - 1 : a.end.column; - this.fireChangeEvent(a.start.row, h == f.row ? h : undefined); - return f - }; - this.indentRows = function(a, f, h) { - h = h.replace("\t", this.getTabString()); - for(var m = a;m <= f;m++) { - this.$insert({row:m, column:0}, h) - }this.fireChangeEvent(a, f); - return h.length - }; - this.outdentRows = function(a) { - for(var f = a.collapseRows(), h = new k(0, 0, 0, 0), m = this.getTabSize(), b = f.start.row;b <= f.end.row;++b) { - var c = this.getLine(b); - h.start.row = b; - h.end.row = b; - for(var n = 0;n < m;++n) { - if(c.charAt(n) != " ") { - break - } - }if(n < m && c.charAt(n) == "\t") { - h.start.column = n; - h.end.column = n + 1 - }else { - h.start.column = 0; - h.end.column = n - }if(b == a.start.row) { - a.start.column -= h.end.column - h.start.column - }if(b == a.end.row) { - a.end.column -= h.end.column - h.start.column - }this.$remove(h) - }this.fireChangeEvent(a.start.row, a.end.row); - return a - }; - this.moveLinesUp = function(a, f) { - if(a <= 0) { - return 0 - }var h = this.lines.slice(a, f + 1); - this.$remove(new k(a - 1, this.lines[a - 1].length, f, this.lines[f].length)); - this.$insertLines(a - 1, h); - this.fireChangeEvent(a - 1, f); - return-1 - }; - this.moveLinesDown = function(a, f) { - if(f >= this.lines.length - 1) { - return 0 - }var h = this.lines.slice(a, f + 1); - this.$remove(new k(a, 0, f + 1, 0)); - this.$insertLines(a + 1, h); - this.fireChangeEvent(a, f + 1); - return 1 - }; - this.duplicateLines = function(a, f) { - a = this.$clipRowToDocument(a); - f = this.$clipRowToDocument(f); - var h = this.getLines(a, f); - this.$insertLines(a, h); - f = f - a + 1; - this.fireChangeEvent(a); - return f - }; - this.$clipRowToDocument = function(a) { - return Math.max(0, Math.min(a, this.lines.length - 1)) - }; - this.documentToScreenColumn = function(a, f) { - var h = this.getTabSize(), m = 0; - f = f; - a = this.getLine(a).split("\t"); - for(var b = 0;b < a.length;b++) { - var c = a[b].length; - if(f > c) { - f -= c + 1; - m += c + h - }else { - m += f; - break - } - }return m - }; - this.screenToDocumentColumn = function(a, f) { - var h = this.getTabSize(), m = 0; - f = f; - a = this.getLine(a).split("\t"); - for(var b = 0;b < a.length;b++) { - var c = a[b].length; - if(f >= c + h) { - f -= c + h; - m += c + 1 - }else { - m += f > c ? c : f; - break - } - }return m - } - }).call(i.prototype); - g.Document = i -}); -define("ace/search", ["require", "exports", "module", "pilot/lang", "pilot/oop", "ace/range"], function(i, g) { - var l = i("pilot/lang"), e = i("pilot/oop"), j = i("ace/range").Range, o = function() { - this.$options = {needle:"", backwards:false, wrap:false, caseSensitive:false, wholeWord:false, scope:o.ALL, regExp:false} - }; - o.ALL = 1; - o.SELECTION = 2; - (function() { - this.set = function(d) { - e.mixin(this.$options, d); - return this - }; - this.getOptions = function() { - return l.copyObject(this.$options) - }; - this.find = function(d) { - if(!this.$options.needle) { - return null - }var k = null; - (this.$options.backwards ? this.$backwardMatchIterator(d) : this.$forwardMatchIterator(d)).forEach(function(a) { - k = a; - return true - }); - return k - }; - this.findAll = function(d) { - if(!this.$options.needle) { - return[] - }var k = []; - (this.$options.backwards ? this.$backwardMatchIterator(d) : this.$forwardMatchIterator(d)).forEach(function(a) { - k.push(a) - }); - return k - }; - this.replace = function(d, k) { - var a = this.$assembleRegExp(), f = a.exec(d); - return f && f[0].length == d.length ? this.$options.regExp ? d.replace(a, k) : k : null - }; - this.$forwardMatchIterator = function(d) { - var k = this.$assembleRegExp(), a = this; - return{forEach:function(f) { - a.$forwardLineIterator(d).forEach(function(h, m, b) { - if(m) { - h = h.substring(m) - }var c = []; - h.replace(k, function(p) { - c.push({str:p, offset:m + arguments[arguments.length - 2]}); - return p - }); - for(h = 0;h < c.length;h++) { - var n = c[h]; - n = a.$rangeFromMatch(b, n.offset, n.str.length); - if(f(n)) { - return true - } - } - }) - }} - }; - this.$backwardMatchIterator = function(d) { - var k = this.$assembleRegExp(), a = this; - return{forEach:function(f) { - a.$backwardLineIterator(d).forEach(function(h, m, b) { - if(m) { - h = h.substring(m) - }var c = []; - h.replace(k, function(p, r) { - c.push({str:p, offset:m + r}); - return p - }); - for(h = c.length - 1;h >= 0;h--) { - var n = c[h]; - n = a.$rangeFromMatch(b, n.offset, n.str.length); - if(f(n)) { - return true - } - } - }) - }} - }; - this.$rangeFromMatch = function(d, k, a) { - return new j(d, k, d, k + a) - }; - this.$assembleRegExp = function() { - var d = this.$options.regExp ? this.$options.needle : l.escapeRegExp(this.$options.needle); - if(this.$options.wholeWord) { - d = "\\b" + d + "\\b" - }var k = "g"; - this.$options.caseSensitive || (k += "i"); - return new RegExp(d, k) - }; - this.$forwardLineIterator = function(d) { - function k(p) { - var r = d.getLine(p); - if(a && p == f.end.row) { - r = r.substring(0, f.end.column) - }return r - } - var a = this.$options.scope == o.SELECTION, f = d.getSelection().getRange(), h = d.getSelection().getCursor(), m = a ? f.start.row : 0, b = a ? f.start.column : 0, c = a ? f.end.row : d.getLength() - 1, n = this.$options.wrap; - return{forEach:function(p) { - for(var r = h.row, t = k(r), q = h.column, s = false;!p(t, q, r);) { - if(s) { - return - }r++; - q = 0; - if(r > c) { - if(n) { - r = m; - q = b - }else { - return - } - }if(r == h.row) { - s = true - }t = k(r) - } - }} - }; - this.$backwardLineIterator = function(d) { - var k = this.$options.scope == o.SELECTION, a = d.getSelection().getRange(), f = k ? a.end : a.start, h = k ? a.start.row : 0, m = k ? a.start.column : 0, b = k ? a.end.row : d.getLength() - 1, c = this.$options.wrap; - return{forEach:function(n) { - for(var p = f.row, r = d.getLine(p).substring(0, f.column), t = 0, q = false;!n(r, t, p);) { - if(q) { - return - }p--; - t = 0; - if(p < h) { - if(c) { - p = b - }else { - return - } - }if(p == f.row) { - q = true - }r = d.getLine(p); - if(k) { - if(p == h) { - t = m - }else { - if(p == b) { - r = r.substring(0, a.end.column) - } - } - } - } - }} - } - }).call(o.prototype); - g.Search = o -}); -define("ace/background_tokenizer", ["require", "exports", "module", "pilot/oop", "pilot/event_emitter"], function(i, g) { - var l = i("pilot/oop"), e = i("pilot/event_emitter").EventEmitter; - i = function(j, o) { - this.running = false; - this.textLines = []; - this.lines = []; - this.currentLine = 0; - this.tokenizer = j; - var d = this; - this.$worker = function() { - if(d.running) { - for(var k = new Date, a = d.currentLine, f = d.textLines, h = 0, m = o.getLastVisibleRow();d.currentLine < f.length;) { - d.lines[d.currentLine] = d.$tokenizeRows(d.currentLine, d.currentLine)[0]; - d.currentLine++; - h += 1; - if(h % 5 == 0 && new Date - k > 20) { - d.fireUpdateEvent(a, d.currentLine - 1); - d.running = setTimeout(d.$worker, d.currentLine < m ? 20 : 100); - return - } - }d.running = false; - d.fireUpdateEvent(a, f.length - 1) - } - } - }; - (function() { - l.implement(this, e); - this.setTokenizer = function(j) { - this.tokenizer = j; - this.lines = []; - this.start(0) - }; - this.setLines = function(j) { - this.textLines = j; - this.lines = []; - this.stop() - }; - this.fireUpdateEvent = function(j, o) { - this._dispatchEvent("update", {data:{first:j, last:o}}) - }; - this.start = function(j) { - this.currentLine = Math.min(j || 0, this.currentLine, this.textLines.length); - this.lines.splice(this.currentLine, this.lines.length); - this.stop(); - this.running = setTimeout(this.$worker, 700) - }; - this.stop = function() { - this.running && clearTimeout(this.running); - this.running = false - }; - this.getTokens = function(j, o, d) { - d(this.$tokenizeRows(j, o)) - }; - this.getState = function(j, o) { - o(this.$tokenizeRows(j, j)[0].state) - }; - this.$tokenizeRows = function(j, o) { - var d = [], k = "start", a = false; - if(j > 0 && this.lines[j - 1]) { - k = this.lines[j - 1].state; - a = true - }for(j = j;j <= o;j++) { - if(this.lines[j]) { - f = this.lines[j]; - k = f.state; - d.push(f) - }else { - var f = this.tokenizer.getLineTokens(this.textLines[j] || "", k); - k = f.state; - d.push(f); - if(a) { - this.lines[j] = f - } - } - }return d - } - }).call(i.prototype); - g.BackgroundTokenizer = i -}); -define("ace/editor", ["require", "exports", "module", "pilot/oop", "pilot/event", "pilot/lang", "ace/textinput", "ace/keybinding", "ace/document", "ace/search", "ace/background_tokenizer", "ace/range", "pilot/event_emitter"], function(i, g) { - var l = i("pilot/oop"), e = i("pilot/event"), j = i("pilot/lang"), o = i("ace/textinput").TextInput, d = i("ace/keybinding").KeyBinding, k = i("ace/document").Document, a = i("ace/search").Search, f = i("ace/background_tokenizer").BackgroundTokenizer, h = i("ace/range").Range, m = i("pilot/event_emitter").EventEmitter; - i = function(b, c) { - var n = b.getContainerElement(); - this.container = n; - this.renderer = b; - this.textInput = new o(n, this); - this.keyBinding = new d(n, this); - var p = this; - e.addListener(n, "mousedown", function(r) { - setTimeout(function() { - p.focus() - }); - return e.preventDefault(r) + return e.preventDefault(i) }); - e.addListener(n, "selectstart", function(r) { - return e.preventDefault(r) + e.addListener(d, "selectstart", function(i) { + return e.preventDefault(i) }); - b = b.getMouseEventTarget(); - e.addListener(b, "mousedown", this.onMouseDown.bind(this)); - e.addMultiMouseDownListener(b, 0, 2, 500, this.onMouseDoubleClick.bind(this)); - e.addMultiMouseDownListener(b, 0, 3, 600, this.onMouseTripleClick.bind(this)); - e.addMouseWheelListener(b, this.onMouseWheel.bind(this)); + a = a.getMouseEventTarget(); + e.addListener(a, "mousedown", this.onMouseDown.bind(this)); + e.addMultiMouseDownListener(a, 0, 2, 500, this.onMouseDoubleClick.bind(this)); + e.addMultiMouseDownListener(a, 0, 3, 600, this.onMouseTripleClick.bind(this)); + e.addMouseWheelListener(a, this.onMouseWheel.bind(this)); this.$highlightLineMarker = this.$selectionMarker = null; this.$blockScrolling = false; - this.$search = (new a).set({wrap:true}); - this.setDocument(c || new k("")); + this.$search = (new x).set({wrap:true}); + this.setDocument(b || new w("")); this.focus() }; (function() { - l.implement(this, m); + s.implement(this, z); this.$forwardEvents = {gutterclick:1, gutterdblclick:1}; this.$originalAddEventListener = this.addEventListener; this.$originalRemoveEventListener = this.removeEventListener; - this.addEventListener = function(b, c) { - return this.$forwardEvents[b] ? this.renderer.addEventListener(b, c) : this.$originalAddEventListener(b, c) + this.addEventListener = function(a, b) { + return this.$forwardEvents[a] ? this.renderer.addEventListener(a, b) : this.$originalAddEventListener(a, b) }; - this.removeEventListener = function(b, c) { - return this.$forwardEvents[b] ? this.renderer.removeEventListener(b, c) : this.$originalRemoveEventListener(b, c) + this.removeEventListener = function(a, b) { + return this.$forwardEvents[a] ? this.renderer.removeEventListener(a, b) : this.$originalRemoveEventListener(a, b) }; - this.setDocument = function(b) { - if(this.doc != b) { + this.setDocument = function(a) { + if(this.doc != a) { if(this.doc) { this.doc.removeEventListener("change", this.$onDocumentChange); this.doc.removeEventListener("changeMode", this.$onDocumentModeChange); this.doc.removeEventListener("changeTabSize", this.$onDocumentChangeTabSize); this.doc.removeEventListener("changeBreakpoint", this.$onDocumentChangeBreakpoint); - var c = this.doc.getSelection(); - c.removeEventListener("changeCursor", this.$onCursorChange); - c.removeEventListener("changeSelection", this.$onSelectionChange); + var b = this.doc.getSelection(); + b.removeEventListener("changeCursor", this.$onCursorChange); + b.removeEventListener("changeSelection", this.$onSelectionChange); this.doc.setScrollTopRow(this.renderer.getScrollTopRow()) - }this.doc = b; + }this.doc = a; this.$onDocumentChange = this.onDocumentChange.bind(this); - b.addEventListener("change", this.$onDocumentChange); - this.renderer.setDocument(b); + a.addEventListener("change", this.$onDocumentChange); + this.renderer.setDocument(a); this.$onDocumentModeChange = this.onDocumentModeChange.bind(this); - b.addEventListener("changeMode", this.$onDocumentModeChange); + a.addEventListener("changeMode", this.$onDocumentModeChange); this.$onDocumentChangeTabSize = this.renderer.updateText.bind(this.renderer); - b.addEventListener("changeTabSize", this.$onDocumentChangeTabSize); + a.addEventListener("changeTabSize", this.$onDocumentChangeTabSize); this.$onDocumentChangeBreakpoint = this.onDocumentChangeBreakpoint.bind(this); this.doc.addEventListener("changeBreakpoint", this.$onDocumentChangeBreakpoint); - this.selection = b.getSelection(); + this.selection = a.getSelection(); this.$desiredColumn = 0; this.$onCursorChange = this.onCursorChange.bind(this); this.selection.addEventListener("changeCursor", this.$onCursorChange); @@ -2111,7 +71,7 @@ define("ace/editor", ["require", "exports", "module", "pilot/oop", "pilot/event" this.onCursorChange(); this.onSelectionChange(); this.onDocumentChangeBreakpoint(); - this.renderer.scrollToRow(b.getScrollTopRow()); + this.renderer.scrollToRow(a.getScrollTopRow()); this.renderer.updateFull() } }; @@ -2124,22 +84,22 @@ define("ace/editor", ["require", "exports", "module", "pilot/oop", "pilot/event" this.resize = function() { this.renderer.onResize() }; - this.setTheme = function(b) { - this.renderer.setTheme(b) + this.setTheme = function(a) { + this.renderer.setTheme(a) }; this.$highlightBrackets = function() { if(this.$bracketHighlight) { this.renderer.removeMarker(this.$bracketHighlight); this.$bracketHighlight = null }if(!this.$highlightPending) { - var b = this; + var a = this; this.$highlightPending = true; setTimeout(function() { - b.$highlightPending = false; - var c = b.doc.findMatchingBracket(b.getCursorPosition()); - if(c) { - c = new h(c.row, c.column, c.row, c.column + 1); - b.$bracketHighlight = b.renderer.addMarker(c, "ace_bracket") + a.$highlightPending = false; + var b = a.doc.findMatchingBracket(a.getCursorPosition()); + if(b) { + b = new o(b.row, b.column, b.row, b.column + 1); + a.$bracketHighlight = a.renderer.addMarker(b, "ace_bracket") } }, 10) } @@ -2158,20 +118,20 @@ define("ace/editor", ["require", "exports", "module", "pilot/oop", "pilot/event" this.renderer.hideCursor(); this.renderer.visualizeBlur() }; - this.onDocumentChange = function(b) { - b = b.data; - this.bgTokenizer.start(b.firstRow); - this.renderer.updateLines(b.firstRow, b.lastRow); + this.onDocumentChange = function(a) { + a = a.data; + this.bgTokenizer.start(a.firstRow); + this.renderer.updateLines(a.firstRow, a.lastRow); this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite) }; - this.onTokenizerUpdate = function(b) { - b = b.data; - this.renderer.updateLines(b.first, b.last) + this.onTokenizerUpdate = function(a) { + a = a.data; + this.renderer.updateLines(a.first, a.last) }; - this.onCursorChange = function(b) { + this.onCursorChange = function(a) { this.$highlightBrackets(); this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite); - if(!this.$blockScrolling && (!b || !b.blockScrolling)) { + if(!this.$blockScrolling && (!a || !a.blockScrolling)) { this.renderer.scrollCursorIntoView() }this.$updateHighlightActiveLine() }; @@ -2179,74 +139,74 @@ define("ace/editor", ["require", "exports", "module", "pilot/oop", "pilot/event" this.$highlightLineMarker && this.renderer.removeMarker(this.$highlightLineMarker); this.$highlightLineMarker = null; if(this.getHighlightActiveLine() && (this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) { - var b = this.getCursorPosition(); - this.$highlightLineMarker = this.renderer.addMarker(new h(b.row, 0, b.row + 1, 0), "ace_active_line", "line") + var a = this.getCursorPosition(); + this.$highlightLineMarker = this.renderer.addMarker(new o(a.row, 0, a.row + 1, 0), "ace_active_line", "line") } }; - this.onSelectionChange = function(b) { + this.onSelectionChange = function(a) { this.$selectionMarker && this.renderer.removeMarker(this.$selectionMarker); this.$selectionMarker = null; if(!this.selection.isEmpty()) { - var c = this.selection.getRange(), n = this.getSelectionStyle(); - this.$selectionMarker = this.renderer.addMarker(c, "ace_selection", n) - }this.onCursorChange(b) + var b = this.selection.getRange(), d = this.getSelectionStyle(); + this.$selectionMarker = this.renderer.addMarker(b, "ace_selection", d) + }this.onCursorChange(a) }; this.onDocumentChangeBreakpoint = function() { this.renderer.setBreakpoints(this.doc.getBreakpoints()) }; this.onDocumentModeChange = function() { - var b = this.doc.getMode(); - if(this.mode != b) { - this.mode = b; - b = b.getTokenizer(); + var a = this.doc.getMode(); + if(this.mode != a) { + this.mode = a; + a = a.getTokenizer(); if(this.bgTokenizer) { - this.bgTokenizer.setTokenizer(b) + this.bgTokenizer.setTokenizer(a) }else { - var c = this.onTokenizerUpdate.bind(this); - this.bgTokenizer = new f(b, this); - this.bgTokenizer.addEventListener("update", c) + var b = this.onTokenizerUpdate.bind(this); + this.bgTokenizer = new y(a, this); + this.bgTokenizer.addEventListener("update", b) }this.renderer.setTokenizer(this.bgTokenizer) } }; - this.onMouseDown = function(b) { - var c = e.getDocumentX(b), n = e.getDocumentY(b); - c = this.renderer.screenToTextCoordinates(c, n); - c.row = Math.max(0, Math.min(c.row, this.doc.getLength() - 1)); - if(e.getButton(b) != 0) { - this.selection.isEmpty() && this.moveCursorToPosition(c) + this.onMouseDown = function(a) { + var b = e.getDocumentX(a), d = e.getDocumentY(a); + b = this.renderer.screenToTextCoordinates(b, d); + b.row = Math.max(0, Math.min(b.row, this.doc.getLength() - 1)); + if(e.getButton(a) != 0) { + this.selection.isEmpty() && this.moveCursorToPosition(b) }else { - if(b.shiftKey) { - this.selection.selectToPosition(c) + if(a.shiftKey) { + this.selection.selectToPosition(b) }else { - this.moveCursorToPosition(c); - this.$clickSelection || this.selection.clearSelection(c.row, c.column) + this.moveCursorToPosition(b); + this.$clickSelection || this.selection.clearSelection(b.row, b.column) }this.renderer.scrollCursorIntoView(); - var p = this, r, t; - e.capture(this.container, function(s) { - r = e.getDocumentX(s); - t = e.getDocumentY(s) + var c = this, i, n; + e.capture(this.container, function(h) { + i = e.getDocumentX(h); + n = e.getDocumentY(h) }, function() { - clearInterval(q); - p.$clickSelection = null + clearInterval(f); + c.$clickSelection = null }); - var q = setInterval(function() { - if(!(r === undefined || t === undefined)) { - var s = p.renderer.screenToTextCoordinates(r, t); - s.row = Math.max(0, Math.min(s.row, p.doc.getLength() - 1)); - if(p.$clickSelection) { - if(p.$clickSelection.contains(s.row, s.column)) { - p.selection.setSelectionRange(p.$clickSelection) + var f = setInterval(function() { + if(!(i === undefined || n === undefined)) { + var h = c.renderer.screenToTextCoordinates(i, n); + h.row = Math.max(0, Math.min(h.row, c.doc.getLength() - 1)); + if(c.$clickSelection) { + if(c.$clickSelection.contains(h.row, h.column)) { + c.selection.setSelectionRange(c.$clickSelection) }else { - var u = p.$clickSelection.compare(s.row, s.column) == -1 ? p.$clickSelection.end : p.$clickSelection.start; - p.selection.setSelectionAnchor(u.row, u.column); - p.selection.selectToPosition(s) + var j = c.$clickSelection.compare(h.row, h.column) == -1 ? c.$clickSelection.end : c.$clickSelection.start; + c.selection.setSelectionAnchor(j.row, j.column); + c.selection.selectToPosition(h) } }else { - p.selection.selectToPosition(s) - }p.renderer.scrollCursorIntoView() + c.selection.selectToPosition(h) + }c.renderer.scrollCursorIntoView() } }, 20); - return e.preventDefault(b) + return e.preventDefault(a) } }; this.onMouseDoubleClick = function() { @@ -2259,10 +219,10 @@ define("ace/editor", ["require", "exports", "module", "pilot/oop", "pilot/event" this.$clickSelection = this.getSelectionRange(); this.$updateDesiredColumn() }; - this.onMouseWheel = function(b) { - var c = this.$scrollSpeed * 2; - this.renderer.scrollBy(b.wheelX * c, b.wheelY * c); - return e.preventDefault(b) + this.onMouseWheel = function(a) { + var b = this.$scrollSpeed * 2; + this.renderer.scrollBy(a.wheelX * b, a.wheelY * b); + return e.preventDefault(a) }; this.getCopyText = function() { return this.selection.isEmpty() ? "" : this.doc.getTextRange(this.getSelectionRange()) @@ -2275,73 +235,73 @@ define("ace/editor", ["require", "exports", "module", "pilot/oop", "pilot/event" } } }; - this.onTextInput = function(b) { + this.onTextInput = function(a) { if(!this.$readOnly) { - var c = this.getCursorPosition(); - b = b.replace("\t", this.doc.getTabString()); + var b = this.getCursorPosition(); + a = a.replace("\t", this.doc.getTabString()); if(this.selection.isEmpty()) { if(this.$overwrite) { - var n = new h.fromPoints(c, c); - n.end.column += b.length; - this.doc.remove(n) + var d = new o.fromPoints(b, b); + d.end.column += a.length; + this.doc.remove(d) } }else { - c = this.doc.remove(this.getSelectionRange()); + b = this.doc.remove(this.getSelectionRange()); this.clearSelection() }this.clearSelection(); - var p = this; - this.bgTokenizer.getState(c.row, function(r) { - var t = p.mode.checkOutdent(r, p.doc.getLine(c.row), b), q = p.doc.getLine(c.row), s = p.mode.getNextLineIndent(r, q.slice(0, c.column), p.doc.getTabString()), u = p.doc.insert(c, b); - p.bgTokenizer.getState(c.row, function(x) { - if(c.row !== u.row) { - x = p.doc.getTabSize(); - for(var z = Number.MAX_VALUE, w = c.row + 1;w <= u.row;++w) { - var y = 0; - q = p.doc.getLine(w); - for(var v = 0;v < q.length;++v) { - if(q.charAt(v) == "\t") { - y += x + var c = this; + this.bgTokenizer.getState(b.row, function(i) { + var n = c.mode.checkOutdent(i, c.doc.getLine(b.row), a), f = c.doc.getLine(b.row), h = c.mode.getNextLineIndent(i, f.slice(0, b.column), c.doc.getTabString()), j = c.doc.insert(b, a); + c.bgTokenizer.getState(b.row, function(p) { + if(b.row !== j.row) { + p = c.doc.getTabSize(); + for(var q = Number.MAX_VALUE, l = b.row + 1;l <= j.row;++l) { + var m = 0; + f = c.doc.getLine(l); + for(var k = 0;k < f.length;++k) { + if(f.charAt(k) == "\t") { + m += p }else { - if(q.charAt(v) == " ") { - y += 1 + if(f.charAt(k) == " ") { + m += 1 }else { break } } - }if(/[^\s]/.test(q)) { - z = Math.min(y, z) + }if(/[^\s]/.test(f)) { + q = Math.min(m, q) } - }for(w = c.row + 1;w <= u.row;++w) { - y = z; - q = p.doc.getLine(w); - for(v = 0;v < q.length && y > 0;++v) { - if(q.charAt(v) == "\t") { - y -= x + }for(l = b.row + 1;l <= j.row;++l) { + m = q; + f = c.doc.getLine(l); + for(k = 0;k < f.length && m > 0;++k) { + if(f.charAt(k) == "\t") { + m -= p }else { - if(q.charAt(v) == " ") { - y -= 1 + if(f.charAt(k) == " ") { + m -= 1 } } - }p.doc.replace(new h(w, 0, w, q.length), q.substr(v)) - }u.column += p.doc.indentRows(c.row + 1, u.row, s) + }c.doc.replace(new o(l, 0, l, f.length), f.substr(k)) + }j.column += c.doc.indentRows(b.row + 1, j.row, h) }else { - if(t) { - u.column += p.mode.autoOutdent(x, p.doc, c.row) + if(n) { + j.column += c.mode.autoOutdent(p, c.doc, b.row) } - }p.moveCursorToPosition(u); - p.renderer.scrollCursorIntoView() + }c.moveCursorToPosition(j); + c.renderer.scrollCursorIntoView() }) }) } }; this.$overwrite = false; - this.setOverwrite = function(b) { - if(this.$overwrite != b) { - this.$overwrite = b; + this.setOverwrite = function(a) { + if(this.$overwrite != a) { + this.$overwrite = a; this.$blockScrolling = true; this.onCursorChange(); this.$blockScrolling = false; - this._dispatchEvent("changeOverwrite", {data:b}) + this._dispatchEvent("changeOverwrite", {data:a}) } }; this.getOverwrite = function() { @@ -2351,54 +311,54 @@ define("ace/editor", ["require", "exports", "module", "pilot/oop", "pilot/event" this.setOverwrite(!this.$overwrite) }; this.$scrollSpeed = 1; - this.setScrollSpeed = function(b) { - this.$scrollSpeed = b + this.setScrollSpeed = function(a) { + this.$scrollSpeed = a }; this.getScrollSpeed = function() { return this.$scrollSpeed }; this.$selectionStyle = "line"; - this.setSelectionStyle = function(b) { - if(this.$selectionStyle != b) { - this.$selectionStyle = b; + this.setSelectionStyle = function(a) { + if(this.$selectionStyle != a) { + this.$selectionStyle = a; this.onSelectionChange(); - this._dispatchEvent("changeSelectionStyle", {data:b}) + this._dispatchEvent("changeSelectionStyle", {data:a}) } }; this.getSelectionStyle = function() { return this.$selectionStyle }; this.$highlightActiveLine = true; - this.setHighlightActiveLine = function(b) { - if(this.$highlightActiveLine != b) { - this.$highlightActiveLine = b; + this.setHighlightActiveLine = function(a) { + if(this.$highlightActiveLine != a) { + this.$highlightActiveLine = a; this.$updateHighlightActiveLine() } }; this.getHighlightActiveLine = function() { return this.$highlightActiveLine }; - this.setShowInvisibles = function(b) { - this.getShowInvisibles() != b && this.renderer.setShowInvisibles(b) + this.setShowInvisibles = function(a) { + this.getShowInvisibles() != a && this.renderer.setShowInvisibles(a) }; this.getShowInvisibles = function() { return this.renderer.getShowInvisibles() }; - this.setShowPrintMargin = function(b) { - this.renderer.setShowPrintMargin(b) + this.setShowPrintMargin = function(a) { + this.renderer.setShowPrintMargin(a) }; this.getShowPrintMargin = function() { return this.renderer.getShowPrintMargin() }; - this.setPrintMarginColumn = function(b) { - this.renderer.setPrintMarginColumn(b) + this.setPrintMarginColumn = function(a) { + this.renderer.setPrintMarginColumn(a) }; this.getPrintMarginColumn = function() { return this.renderer.getPrintMarginColumn() }; this.$readOnly = false; - this.setReadOnly = function(b) { - this.$readOnly = b + this.setReadOnly = function(a) { + this.$readOnly = a }; this.getReadOnly = function() { return this.$readOnly @@ -2419,87 +379,87 @@ define("ace/editor", ["require", "exports", "module", "pilot/oop", "pilot/event" }; this.indent = function() { if(!this.$readOnly) { - var b = this.doc, c = this.getSelectionRange(); - if(c.start.row < c.end.row || c.start.column < c.end.column) { - c = this.$getSelectedRows(); - b = b.indentRows(c.first, c.last, "\t"); - this.selection.shiftSelection(b) + var a = this.doc, b = this.getSelectionRange(); + if(b.start.row < b.end.row || b.start.column < b.end.column) { + b = this.$getSelectedRows(); + a = a.indentRows(b.first, b.last, "\t"); + this.selection.shiftSelection(a) }else { if(this.doc.getUseSoftTabs()) { - c = b.getTabSize(); - var n = this.getCursorPosition(); - b = b.documentToScreenColumn(n.row, n.column); - b = c - b % c; - b = j.stringRepeat(" ", b) + b = a.getTabSize(); + var d = this.getCursorPosition(); + a = a.documentToScreenColumn(d.row, d.column); + a = b - a % b; + a = t.stringRepeat(" ", a) }else { - b = "\t" - }return this.onTextInput(b) + a = "\t" + }return this.onTextInput(a) } } }; this.blockOutdent = function() { if(!this.$readOnly) { - var b = this.doc.getSelection(), c = this.doc.outdentRows(b.getRange()); - b.setSelectionRange(c, b.isBackwards()); + var a = this.doc.getSelection(), b = this.doc.outdentRows(a.getRange()); + a.setSelectionRange(b, a.isBackwards()); this.$updateDesiredColumn() } }; this.toggleCommentLines = function() { if(!this.$readOnly) { - var b = this; - this.bgTokenizer.getState(this.getCursorPosition().row, function(c) { - var n = b.$getSelectedRows(); - c = b.mode.toggleCommentLines(c, b.doc, n.first, n.last); - b.selection.shiftSelection(c) + var a = this; + this.bgTokenizer.getState(this.getCursorPosition().row, function(b) { + var d = a.$getSelectedRows(); + b = a.mode.toggleCommentLines(b, a.doc, d.first, d.last); + a.selection.shiftSelection(b) }) } }; this.removeLines = function() { if(!this.$readOnly) { - var b = this.$getSelectedRows(); - this.selection.setSelectionAnchor(b.last + 1, 0); - this.selection.selectTo(b.first, 0); + var a = this.$getSelectedRows(); + this.selection.setSelectionAnchor(a.last + 1, 0); + this.selection.selectTo(a.first, 0); this.doc.remove(this.getSelectionRange()); this.clearSelection() } }; this.moveLinesDown = function() { - this.$readOnly || this.$moveLines(function(b, c) { - return this.doc.moveLinesDown(b, c) + this.$readOnly || this.$moveLines(function(a, b) { + return this.doc.moveLinesDown(a, b) }) }; this.moveLinesUp = function() { - this.$readOnly || this.$moveLines(function(b, c) { - return this.doc.moveLinesUp(b, c) + this.$readOnly || this.$moveLines(function(a, b) { + return this.doc.moveLinesUp(a, b) }) }; this.copyLinesUp = function() { - this.$readOnly || this.$moveLines(function(b, c) { - this.doc.duplicateLines(b, c); + this.$readOnly || this.$moveLines(function(a, b) { + this.doc.duplicateLines(a, b); return 0 }) }; this.copyLinesDown = function() { - this.$readOnly || this.$moveLines(function(b, c) { - return this.doc.duplicateLines(b, c) + this.$readOnly || this.$moveLines(function(a, b) { + return this.doc.duplicateLines(a, b) }) }; - this.$moveLines = function(b) { - var c = this.$getSelectedRows(), n = b.call(this, c.first, c.last), p = this.selection; - p.setSelectionAnchor(c.last + n + 1, 0); - p.$moveSelection(function() { - p.moveCursorTo(c.first + n, 0) + this.$moveLines = function(a) { + var b = this.$getSelectedRows(), d = a.call(this, b.first, b.last), c = this.selection; + c.setSelectionAnchor(b.last + d + 1, 0); + c.$moveSelection(function() { + c.moveCursorTo(b.first + d, 0) }) }; this.$getSelectedRows = function() { - var b = this.getSelectionRange().collapseRows(); - return{first:b.start.row, last:b.end.row} + var a = this.getSelectionRange().collapseRows(); + return{first:a.start.row, last:a.end.row} }; this.onCompositionStart = function() { this.renderer.showComposition(this.getCursorPosition()) }; - this.onCompositionUpdate = function(b) { - this.renderer.setCompositionText(b) + this.onCompositionUpdate = function(a) { + this.renderer.setCompositionText(a) }; this.onCompositionEnd = function() { this.renderer.hideComposition() @@ -2510,8 +470,8 @@ define("ace/editor", ["require", "exports", "module", "pilot/oop", "pilot/event" this.getLastVisibleRow = function() { return this.renderer.getLastVisibleRow() }; - this.isRowVisible = function(b) { - return b >= this.getFirstVisibleRow() && b <= this.getLastVisibleRow() + this.isRowVisible = function(a) { + return a >= this.getFirstVisibleRow() && a <= this.getLastVisibleRow() }; this.getVisibleRowCount = function() { return this.getLastVisibleRow() - this.getFirstVisibleRow() + 1 @@ -2520,34 +480,34 @@ define("ace/editor", ["require", "exports", "module", "pilot/oop", "pilot/event" return this.renderer.getLastVisibleRow() - 1 }; this.getPageUpRow = function() { - var b = this.renderer.getFirstVisibleRow(), c = this.renderer.getLastVisibleRow(); - return b - (c - b) + 1 + var a = this.renderer.getFirstVisibleRow(), b = this.renderer.getLastVisibleRow(); + return a - (b - a) + 1 }; this.selectPageDown = function() { - var b = this.getPageDownRow() + Math.floor(this.getVisibleRowCount() / 2); + var a = this.getPageDownRow() + Math.floor(this.getVisibleRowCount() / 2); this.scrollPageDown(); - var c = this.getSelection(); - c.$moveSelection(function() { - c.moveCursorTo(b, c.getSelectionLead().column) + var b = this.getSelection(); + b.$moveSelection(function() { + b.moveCursorTo(a, b.getSelectionLead().column) }) }; this.selectPageUp = function() { - var b = this.getLastVisibleRow() - this.getFirstVisibleRow(), c = this.getPageUpRow() + Math.round(b / 2); + var a = this.getLastVisibleRow() - this.getFirstVisibleRow(), b = this.getPageUpRow() + Math.round(a / 2); this.scrollPageUp(); - var n = this.getSelection(); - n.$moveSelection(function() { - n.moveCursorTo(c, n.getSelectionLead().column) + var d = this.getSelection(); + d.$moveSelection(function() { + d.moveCursorTo(b, d.getSelectionLead().column) }) }; this.gotoPageDown = function() { - var b = this.getPageDownRow(), c = Math.min(this.getCursorPosition().column, this.doc.getLine(b).length); - this.scrollToRow(b); - this.getSelection().moveCursorTo(b, c) + var a = this.getPageDownRow(), b = Math.min(this.getCursorPosition().column, this.doc.getLine(a).length); + this.scrollToRow(a); + this.getSelection().moveCursorTo(a, b) }; this.gotoPageUp = function() { - var b = this.getPageUpRow(), c = Math.min(this.getCursorPosition().column, this.doc.getLine(b).length); - this.scrollToRow(b); - this.getSelection().moveCursorTo(b, c) + var a = this.getPageUpRow(), b = Math.min(this.getCursorPosition().column, this.doc.getLine(a).length); + this.scrollToRow(a); + this.getSelection().moveCursorTo(a, b) }; this.scrollPageDown = function() { this.scrollToRow(this.getPageDownRow()) @@ -2555,8 +515,8 @@ define("ace/editor", ["require", "exports", "module", "pilot/oop", "pilot/event" this.scrollPageUp = function() { this.renderer.scrollToRow(this.getPageUpRow()) }; - this.scrollToRow = function(b) { - this.renderer.scrollToRow(b) + this.scrollToRow = function(a) { + this.renderer.scrollToRow(a) }; this.getCursorPosition = function() { return this.selection.getCursor() @@ -2568,45 +528,45 @@ define("ace/editor", ["require", "exports", "module", "pilot/oop", "pilot/event" this.selection.clearSelection(); this.$updateDesiredColumn() }; - this.moveCursorTo = function(b, c) { - this.selection.moveCursorTo(b, c); + this.moveCursorTo = function(a, b) { + this.selection.moveCursorTo(a, b); this.$updateDesiredColumn() }; - this.moveCursorToPosition = function(b) { - this.selection.moveCursorToPosition(b); + this.moveCursorToPosition = function(a) { + this.selection.moveCursorToPosition(a); this.$updateDesiredColumn() }; - this.gotoLine = function(b, c) { + this.gotoLine = function(a, b) { this.selection.clearSelection(); this.$blockScrolling = true; - this.moveCursorTo(b - 1, c || 0); + this.moveCursorTo(a - 1, b || 0); this.$blockScrolling = false; - this.isRowVisible(this.getCursorPosition().row) || this.scrollToRow(b - 1 - Math.floor(this.getVisibleRowCount() / 2)) + this.isRowVisible(this.getCursorPosition().row) || this.scrollToRow(a - 1 - Math.floor(this.getVisibleRowCount() / 2)) }; - this.navigateTo = function(b, c) { + this.navigateTo = function(a, b) { this.clearSelection(); - this.moveCursorTo(b, c); - this.$updateDesiredColumn(c) + this.moveCursorTo(a, b); + this.$updateDesiredColumn(b) }; this.navigateUp = function() { this.selection.clearSelection(); this.selection.moveCursorBy(-1, 0); if(this.$desiredColumn) { - var b = this.getCursorPosition(), c = this.doc.screenToDocumentColumn(b.row, this.$desiredColumn); - this.selection.moveCursorTo(b.row, c) + var a = this.getCursorPosition(), b = this.doc.screenToDocumentColumn(a.row, this.$desiredColumn); + this.selection.moveCursorTo(a.row, b) } }; this.navigateDown = function() { this.selection.clearSelection(); this.selection.moveCursorBy(1, 0); if(this.$desiredColumn) { - var b = this.getCursorPosition(), c = this.doc.screenToDocumentColumn(b.row, this.$desiredColumn); - this.selection.moveCursorTo(b.row, c) + var a = this.getCursorPosition(), b = this.doc.screenToDocumentColumn(a.row, this.$desiredColumn); + this.selection.moveCursorTo(a.row, b) } }; this.$updateDesiredColumn = function() { - var b = this.getCursorPosition(); - this.$desiredColumn = this.doc.documentToScreenColumn(b.row, b.column) + var a = this.getCursorPosition(); + this.$desiredColumn = this.doc.documentToScreenColumn(a.row, a.column) }; this.navigateLeft = function() { this.selection.isEmpty() ? this.selection.moveCursorLeft() : this.moveCursorToPosition(this.getSelectionRange().start); @@ -2640,30 +600,30 @@ define("ace/editor", ["require", "exports", "module", "pilot/oop", "pilot/event" this.selection.moveCursorWordLeft(); this.clearSelection() }; - this.replace = function(b, c) { - c && this.$search.set(c); - c = this.$search.find(this.doc); - this.$tryReplace(c, b); - c !== null && this.selection.setSelectionRange(c); + this.replace = function(a, b) { + b && this.$search.set(b); + b = this.$search.find(this.doc); + this.$tryReplace(b, a); + b !== null && this.selection.setSelectionRange(b); this.$updateDesiredColumn() }; - this.replaceAll = function(b, c) { - c && this.$search.set(c); - c = this.$search.findAll(this.doc); - if(c.length) { + this.replaceAll = function(a, b) { + b && this.$search.set(b); + b = this.$search.findAll(this.doc); + if(b.length) { this.clearSelection(); this.selection.moveCursorTo(0, 0); - for(var n = c.length - 1;n >= 0;--n) { - this.$tryReplace(c[n], b) - }c[0] !== null && this.selection.setSelectionRange(c[0]); + for(var d = b.length - 1;d >= 0;--d) { + this.$tryReplace(b[d], a) + }b[0] !== null && this.selection.setSelectionRange(b[0]); this.$updateDesiredColumn() } }; - this.$tryReplace = function(b, c) { - c = this.$search.replace(this.doc.getTextRange(b), c); - if(c !== null) { - b.end = this.doc.replace(b, c); - return b + this.$tryReplace = function(a, b) { + b = this.$search.replace(this.doc.getTextRange(a), b); + if(b !== null) { + a.end = this.doc.replace(a, b); + return a }else { return null } @@ -2671,34 +631,34 @@ define("ace/editor", ["require", "exports", "module", "pilot/oop", "pilot/event" this.getLastSearchOptions = function() { return this.$search.getOptions() }; - this.find = function(b, c) { + this.find = function(a, b) { this.clearSelection(); - c = c || {}; - c.needle = b; - this.$search.set(c); - this.$find() - }; - this.findNext = function(b) { b = b || {}; - if(typeof b.backwards == "undefined") { - b.backwards = false - }this.$search.set(b); + b.needle = a; + this.$search.set(b); this.$find() }; - this.findPrevious = function(b) { - b = b || {}; - if(typeof b.backwards == "undefined") { - b.backwards = true - }this.$search.set(b); + this.findNext = function(a) { + a = a || {}; + if(typeof a.backwards == "undefined") { + a.backwards = false + }this.$search.set(a); this.$find() }; - this.$find = function(b) { + this.findPrevious = function(a) { + a = a || {}; + if(typeof a.backwards == "undefined") { + a.backwards = true + }this.$search.set(a); + this.$find() + }; + this.$find = function(a) { this.selection.isEmpty() || this.$search.set({needle:this.doc.getTextRange(this.getSelectionRange())}); - typeof b != "undefined" && this.$search.set({backwards:b}); - if(b = this.$search.find(this.doc)) { - this.gotoLine(b.end.row + 1, b.end.column); + typeof a != "undefined" && this.$search.set({backwards:a}); + if(a = this.$search.find(this.doc)) { + this.gotoLine(a.end.row + 1, a.end.column); this.$updateDesiredColumn(); - this.selection.setSelectionRange(b) + this.selection.setSelectionRange(a) } }; this.undo = function() { @@ -2707,1010 +667,6 @@ define("ace/editor", ["require", "exports", "module", "pilot/oop", "pilot/event" this.redo = function() { this.doc.getUndoManager().redo() } - }).call(i.prototype); - g.Editor = i -}); -define("ace/undomanager", ["require", "exports", "module"], function(i, g) { - i = function() { - this.$undoStack = []; - this.$redoStack = [] - }; - (function() { - this.execute = function(l) { - var e = l.args[0]; - this.$doc = l.args[1]; - this.$undoStack.push(e) - }; - this.undo = function() { - var l = this.$undoStack.pop(); - if(l) { - this.$doc.undoChanges(l); - this.$redoStack.push(l) - } - }; - this.redo = function() { - var l = this.$redoStack.pop(); - if(l) { - this.$doc.redoChanges(l); - this.$undoStack.push(l) - } - } - }).call(i.prototype); - g.UndoManager = i -}); -define("pilot/dom", ["require", "exports", "module"], function(i, g) { - g.setText = function(l, e) { - if(l.innerText !== undefined) { - l.innerText = e - }if(l.textContent !== undefined) { - l.textContent = e - } - }; - g.hasCssClass = function(l, e) { - return l.className.split(/\s+/g).indexOf(e) !== -1 - }; - g.addCssClass = function(l, e) { - g.hasCssClass(l, e) || (l.className += " " + e) - }; - g.setCssClass = function(l, e, j) { - j ? g.addCssClass(l, e) : g.removeCssClass(l, e) - }; - g.removeCssClass = function(l, e) { - for(var j = l.className.split(/\s+/g);;) { - var o = j.indexOf(e); - if(o == -1) { - break - }j.splice(o, 1) - }l.className = j.join(" ") - }; - g.importCssString = function(l, e) { - e = e || document; - if(e.createStyleSheet) { - e.createStyleSheet().cssText = l - }else { - var j = e.createElement("style"); - j.appendChild(e.createTextNode(l)); - e.getElementsByTagName("head")[0].appendChild(j) - } - }; - g.getInnerWidth = function(l) { - return parseInt(g.computedStyle(l, "paddingLeft")) + parseInt(g.computedStyle(l, "paddingRight")) + l.clientWidth - }; - g.getInnerHeight = function(l) { - return parseInt(g.computedStyle(l, "paddingTop")) + parseInt(g.computedStyle(l, "paddingBottom")) + l.clientHeight - }; - g.computedStyle = function(l, e) { - return window.getComputedStyle ? (window.getComputedStyle(l, "") || {})[e] || "" : l.currentStyle[e] - }; - g.scrollbarWidth = function() { - var l = document.createElement("p"); - l.style.width = "100%"; - l.style.height = "200px"; - var e = document.createElement("div"), j = e.style; - j.position = "absolute"; - j.left = "-10000px"; - j.overflow = "hidden"; - j.width = "200px"; - j.height = "150px"; - e.appendChild(l); - document.body.appendChild(e); - var o = l.offsetWidth; - j.overflow = "scroll"; - l = l.offsetWidth; - if(o == l) { - l = e.clientWidth - }document.body.removeChild(e); - return o - l - }; - g.setInnerHtml = function(l, e) { - var j = l.cloneNode(false); - j.innerHTML = e; - l.parentNode.replaceChild(j, l); - return j - }; - g.getParentWindow = function(l) { - return l.defaultView || l.parentWindow - } -}); -define("ace/layer/gutter", ["require", "exports", "module", "pilot/dom"], function(i, g) { - var l = i("pilot/dom"); - i = function(e) { - this.element = document.createElement("div"); - this.element.className = "ace_layer ace_gutter-layer"; - e.appendChild(this.element); - this.$breakpoints = []; - this.$decorations = [] - }; - (function() { - this.addGutterDecoration = function(e, j) { - this.$decorations[e] || (this.$decorations[e] = ""); - this.$decorations[e] += " ace_" + j - }; - this.removeGutterDecoration = function(e, j) { - this.$decorations[e] = this.$decorations[e].replace(" ace_" + j, "") - }; - this.setBreakpoints = function(e) { - this.$breakpoints = e.concat() - }; - this.update = function(e) { - this.$config = e; - for(var j = [], o = e.firstRow;o <= e.lastRow;o++) { - j.push("
", o + 1, "
"); - j.push("") - }this.element = l.setInnerHtml(this.element, j.join("")); - this.element.style.height = e.minHeight + "px" - } - }).call(i.prototype); - g.Gutter = i -}); -define("ace/layer/marker", ["require", "exports", "module", "ace/range", "pilot/dom"], function(i, g) { - var l = i("ace/range").Range, e = i("pilot/dom"); - i = function(j) { - this.element = document.createElement("div"); - this.element.className = "ace_layer ace_marker-layer"; - j.appendChild(this.element); - this.markers = {}; - this.$markerId = 1 - }; - (function() { - this.setDocument = function(j) { - this.doc = j - }; - this.addMarker = function(j, o, d) { - var k = this.$markerId++; - this.markers[k] = {range:j, type:d || "line", clazz:o}; - return k - }; - this.removeMarker = function(j) { - this.markers[j] && delete this.markers[j] - }; - this.update = function(j) { - if(j = j || this.config) { - this.config = j; - var o = []; - for(var d in this.markers) { - var k = this.markers[d], a = k.range.clipRows(j.firstRow, j.lastRow); - if(!a.isEmpty()) { - if(a.isMultiLine()) { - k.type == "text" ? this.drawTextMarker(o, a, k.clazz, j) : this.drawMultiLineMarker(o, a, k.clazz, j) - }else { - this.drawSingleLineMarker(o, a, k.clazz, j) - } - } - }this.element = e.setInnerHtml(this.element, o.join("")) - } - }; - this.drawTextMarker = function(j, o, d, k) { - var a = o.start.row, f = new l(a, o.start.column, a, this.doc.getLine(a).length); - this.drawSingleLineMarker(j, f, d, k, 1); - a = o.end.row; - f = new l(a, 0, a, o.end.column); - this.drawSingleLineMarker(j, f, d, k); - for(a = o.start.row + 1;a < o.end.row;a++) { - f.start.row = a; - f.end.row = a; - f.end.column = this.doc.getLine(a).length; - this.drawSingleLineMarker(j, f, d, k, 1) - } - }; - this.drawMultiLineMarker = function(j, o, d, k) { - o = o.toScreenRange(this.doc); - var a = k.lineHeight, f = Math.round(k.width - o.start.column * k.characterWidth), h = (o.start.row - k.firstRow) * k.lineHeight, m = Math.round(o.start.column * k.characterWidth); - j.push("
"); - h = (o.end.row - k.firstRow) * k.lineHeight; - f = Math.round(o.end.column * k.characterWidth); - j.push("
"); - a = (o.end.row - o.start.row - 1) * k.lineHeight; - if(!(a < 0)) { - h = (o.start.row + 1 - k.firstRow) * k.lineHeight; - j.push("
") - } - }; - this.drawSingleLineMarker = function(j, o, d, k, a) { - o = o.toScreenRange(this.doc); - var f = k.lineHeight; - a = Math.round((o.end.column + (a || 0) - o.start.column) * k.characterWidth); - var h = (o.start.row - k.firstRow) * k.lineHeight; - o = Math.round(o.start.column * k.characterWidth); - j.push("
") - } - }).call(i.prototype); - g.Marker = i -}); -define("ace/layer/text", ["require", "exports", "module", "pilot/oop", "pilot/dom", "pilot/lang", "pilot/event_emitter"], function(i, g) { - var l = i("pilot/oop"), e = i("pilot/dom"), j = i("pilot/lang"), o = i("pilot/event_emitter").EventEmitter; - i = function(d) { - this.element = document.createElement("div"); - this.element.className = "ace_layer ace_text-layer"; - d.appendChild(this.element); - this.$characterSize = this.$measureSizes(); - this.$pollSizeChanges() - }; - (function() { - l.implement(this, o); - this.EOF_CHAR = "¶"; - this.EOL_CHAR = "¬"; - this.TAB_CHAR = "→"; - this.SPACE_CHAR = "·"; - this.setTokenizer = function(d) { - this.tokenizer = d - }; - this.getLineHeight = function() { - return this.$characterSize.height || 1 - }; - this.getCharacterWidth = function() { - return this.$characterSize.width || 1 - }; - this.$pollSizeChanges = function() { - var d = this; - setInterval(function() { - var k = d.$measureSizes(); - if(d.$characterSize.width !== k.width || d.$characterSize.height !== k.height) { - d.$characterSize = k; - d._dispatchEvent("changeCharaterSize", {data:k}) - } - }, 500) - }; - this.$fontStyles = {fontFamily:1, fontSize:1, fontWeight:1, fontStyle:1, lineHeight:1}; - this.$measureSizes = function() { - if(!this.$measureNode) { - var d = this.$measureNode = document.createElement("div"), k = d.style; - k.width = k.height = "auto"; - k.left = k.top = "-1000px"; - k.visibility = "hidden"; - k.position = "absolute"; - k.overflow = "visible"; - k.whiteSpace = "nowrap"; - d.innerHTML = j.stringRepeat("Xy", 1E3); - document.body.insertBefore(d, document.body.firstChild) - }k = this.$measureNode.style; - for(var a in this.$fontStyles) { - d = e.computedStyle(this.element, a); - k[a] = d - }return{height:this.$measureNode.offsetHeight, width:this.$measureNode.offsetWidth / 2E3} - }; - this.setDocument = function(d) { - this.doc = d - }; - this.showInvisibles = false; - this.setShowInvisibles = function(d) { - if(this.showInvisibles == d) { - return false - }this.showInvisibles = d; - return true - }; - this.$computeTabString = function() { - var d = this.doc.getTabSize(); - if(this.showInvisibles) { - d = d / 2; - this.$tabString = "" + (new Array(Math.floor(d))).join(" ") + this.TAB_CHAR + (new Array(Math.ceil(d) + 1)).join(" ") + "" - }else { - this.$tabString = (new Array(d + 1)).join(" ") - } - }; - this.updateLines = function(d, k, a) { - this.$computeTabString(); - this.config = d; - var f = Math.max(k, d.firstRow), h = Math.min(a, d.lastRow), m = this.element.childNodes, b = this; - this.tokenizer.getTokens(f, h, function(c) { - for(var n = f;n <= h;n++) { - var p = m[n - d.firstRow]; - if(p) { - var r = []; - b.$renderLine(r, n, c[n - f].tokens); - e.setInnerHtml(p, r.join) - } - } - }) - }; - this.scrollLines = function(d) { - function k(c) { - d.firstRow < h.firstRow ? f.$renderLinesFragment(d, d.firstRow, h.firstRow - 1, function(n) { - m.firstChild ? m.insertBefore(n, m.firstChild) : m.appendChild(n); - c() - }) : c() - } - function a() { - d.lastRow > h.lastRow && f.$renderLinesFragment(d, h.lastRow + 1, d.lastRow, function(c) { - m.appendChild(c) - }) - } - var f = this; - this.$computeTabString(); - var h = this.config; - this.config = d; - if(!h || h.lastRow < d.firstRow) { - return this.update(d) - }if(d.lastRow < h.firstRow) { - return this.update(d) - }var m = this.element; - if(h.firstRow < d.firstRow) { - for(var b = h.firstRow;b < d.firstRow;b++) { - m.removeChild(m.firstChild) - } - }if(h.lastRow > d.lastRow) { - for(b = d.lastRow + 1;b <= h.lastRow;b++) { - m.removeChild(m.lastChild) - } - }k(a) - }; - this.$renderLinesFragment = function(d, k, a, f) { - var h = document.createDocumentFragment(), m = this; - this.tokenizer.getTokens(k, a, function(b) { - for(var c = k;c <= a;c++) { - var n = document.createElement("div"); - n.className = "ace_line"; - var p = n.style; - p.height = m.$characterSize.height + "px"; - p.width = d.width + "px"; - p = []; - m.$renderLine(p, c, b[c - k].tokens); - n.innerHTML = p.join(""); - h.appendChild(n) - }f(h) - }) - }; - this.update = function(d) { - this.$computeTabString(); - this.config = d; - var k = [], a = this; - this.tokenizer.getTokens(d.firstRow, d.lastRow, function(f) { - for(var h = d.firstRow;h <= d.lastRow;h++) { - k.push("
"); - a.$renderLine(k, h, f[h - d.firstRow].tokens); - k.push("
") - }a.element = e.setInnerHtml(a.element, k.join("")) - }) - }; - this.$textToken = {text:true, rparen:true, lparen:true}; - this.$renderLine = function(d, k, a) { - for(var f = /[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/g, h = 0;h < a.length;h++) { - var m = a[h], b = m.value.replace(/&/g, "&").replace(/", b, "") - } - }if(this.showInvisibles) { - k !== this.doc.getLength() - 1 ? d.push("" + this.EOL_CHAR + "") : d.push("" + this.EOF_CHAR + "") - } - } - }).call(i.prototype); - g.Text = i -}); -define("ace/layer/cursor", ["require", "exports", "module", "pilot/dom"], function(i, g) { - var l = i("pilot/dom"); - i = function(e) { - this.element = document.createElement("div"); - this.element.className = "ace_layer ace_cursor-layer"; - e.appendChild(this.element); - this.cursor = document.createElement("div"); - this.cursor.className = "ace_cursor"; - this.isVisible = false - }; - (function() { - this.setDocument = function(e) { - this.doc = e - }; - this.setCursor = function(e, j) { - this.position = {row:e.row, column:this.doc.documentToScreenColumn(e.row, e.column)}; - j ? l.addCssClass(this.cursor, "ace_overwrite") : l.removeCssClass(this.cursor, "ace_overwrite") - }; - this.hideCursor = function() { - this.isVisible = false; - this.cursor.parentNode && this.cursor.parentNode.removeChild(this.cursor); - clearInterval(this.blinkId) - }; - this.showCursor = function() { - this.isVisible = true; - this.element.appendChild(this.cursor); - this.cursor.style.visibility = "visible"; - this.restartTimer() - }; - this.restartTimer = function() { - clearInterval(this.blinkId); - if(this.isVisible) { - var e = this.cursor; - this.blinkId = setInterval(function() { - e.style.visibility = "hidden"; - setTimeout(function() { - e.style.visibility = "visible" - }, 400) - }, 1E3) - } - }; - this.getPixelPosition = function() { - if(!this.config || !this.position) { - return{left:0, top:0} - }var e = this.position.row * this.config.lineHeight; - return{left:Math.round(this.position.column * this.config.characterWidth), top:e} - }; - this.update = function(e) { - if(this.position) { - this.config = e; - var j = Math.round(this.position.column * e.characterWidth), o = this.position.row * e.lineHeight; - this.pixelPos = {left:j, top:o}; - this.cursor.style.left = j + "px"; - this.cursor.style.top = o - e.firstRow * e.lineHeight + "px"; - this.cursor.style.width = e.characterWidth + "px"; - this.cursor.style.height = e.lineHeight + "px"; - this.isVisible && this.element.appendChild(this.cursor); - this.restartTimer() - } - } - }).call(i.prototype); - g.Cursor = i -}); -define("ace/scrollbar", ["require", "exports", "module", "pilot/oop", "pilot/dom", "pilot/event", "pilot/event_emitter"], function(i, g) { - var l = i("pilot/oop"), e = i("pilot/dom"), j = i("pilot/event"), o = i("pilot/event_emitter").EventEmitter; - i = function(d) { - this.element = document.createElement("div"); - this.element.className = "ace_sb"; - this.inner = document.createElement("div"); - this.element.appendChild(this.inner); - d.appendChild(this.element); - this.width = e.scrollbarWidth(); - this.element.style.width = this.width; - j.addListener(this.element, "scroll", this.onScroll.bind(this)) - }; - (function() { - l.implement(this, o); - this.onScroll = function() { - this._dispatchEvent("scroll", {data:this.element.scrollTop}) - }; - this.getWidth = function() { - return this.width - }; - this.setHeight = function(d) { - this.element.style.height = Math.max(0, d - this.width) + "px" - }; - this.setInnerHeight = function(d) { - this.inner.style.height = d + "px" - }; - this.setScrollTop = function(d) { - this.element.scrollTop = d - } - }).call(i.prototype); - g.ScrollBar = i -}); -define("ace/renderloop", ["require", "exports", "module", "pilot/event"], function(i, g) { - var l = i("pilot/event"); - i = function(e) { - this.onRender = e; - this.pending = false; - this.changes = 0 - }; - (function() { - this.schedule = function(e) { - this.changes |= e; - if(!this.pending) { - this.pending = true; - var j = this; - this.setTimeoutZero(function() { - j.pending = false; - var o = j.changes; - j.changes = 0; - j.onRender(o) - }) - } - }; - if(window.postMessage) { - this.messageName = "zero-timeout-message"; - this.setTimeoutZero = function(e) { - if(!this.attached) { - var j = this; - l.addListener(window, "message", function(o) { - if(o.source == window && j.callback && o.data == j.messageName) { - l.stopPropagation(o); - j.callback() - } - }); - this.attached = true - }this.callback = e; - window.postMessage(this.messageName, "*") - } - }else { - this.setTimeoutZero = function(e) { - setTimeout(e, 0) - } - } - }).call(i.prototype); - g.RenderLoop = i -}); -define("ace/virtual_renderer", ["require", "exports", "module", "pilot/oop", "pilot/dom", "pilot/event", "ace/layer/gutter", "ace/layer/marker", "ace/layer/text", "ace/layer/cursor", "ace/scrollbar", "ace/renderloop", "pilot/event_emitter", 'text!ace/css/editor.css!.ace_editor {\n position: absolute;\n overflow: hidden;\n\n font-family: "Menlo", "Monaco", "Courier New", monospace;\n font-size: 12px; \n}\n\n.ace_scroller {\n position: absolute;\n overflow-x: scroll;\n overflow-y: hidden; \n}\n\n.ace_gutter {\n position: absolute;\n overflow-x: hidden;\n overflow-y: hidden;\n height: 100%;\n}\n\n.ace_editor .ace_sb {\n position: absolute;\n overflow-x: hidden;\n overflow-y: scroll;\n right: 0;\n}\n\n.ace_editor .ace_sb div {\n position: absolute;\n width: 1px;\n left: 0px;\n}\n\n.ace_editor .ace_printMargin {\n position: absolute;\n height: 100%;\n}\n\n.ace_layer {\n z-index: 0;\n position: absolute;\n overflow: hidden; \n white-space: nowrap;\n height: 100%;\n}\n\n.ace_text-layer {\n font-family: Monaco, "Courier New", monospace;\n color: black;\n}\n\n.ace_cursor-layer {\n cursor: text;\n}\n\n.ace_cursor {\n z-index: 3;\n position: absolute;\n}\n\n.ace_line {\n white-space: nowrap;\n}\n\n.ace_marker-layer {\n}\n\n.ace_marker-layer .ace_step {\n position: absolute;\n z-index: 2;\n}\n\n.ace_marker-layer .ace_selection {\n position: absolute;\n z-index: 3;\n}\n\n.ace_marker-layer .ace_bracket {\n position: absolute;\n z-index: 4;\n}\n\n.ace_marker-layer .ace_active_line {\n position: absolute;\n z-index: 1;\n}'], -function(i, g) { - var l = i("pilot/oop"), e = i("pilot/dom"), j = i("pilot/event"), o = i("ace/layer/gutter").Gutter, d = i("ace/layer/marker").Marker, k = i("ace/layer/text").Text, a = i("ace/layer/cursor").Cursor, f = i("ace/scrollbar").ScrollBar, h = i("ace/renderloop").RenderLoop, m = i("pilot/event_emitter").EventEmitter, b = i('text!ace/css/editor.css!.ace_editor {\n position: absolute;\n overflow: hidden;\n\n font-family: "Menlo", "Monaco", "Courier New", monospace;\n font-size: 12px; \n}\n\n.ace_scroller {\n position: absolute;\n overflow-x: scroll;\n overflow-y: hidden; \n}\n\n.ace_gutter {\n position: absolute;\n overflow-x: hidden;\n overflow-y: hidden;\n height: 100%;\n}\n\n.ace_editor .ace_sb {\n position: absolute;\n overflow-x: hidden;\n overflow-y: scroll;\n right: 0;\n}\n\n.ace_editor .ace_sb div {\n position: absolute;\n width: 1px;\n left: 0px;\n}\n\n.ace_editor .ace_printMargin {\n position: absolute;\n height: 100%;\n}\n\n.ace_layer {\n z-index: 0;\n position: absolute;\n overflow: hidden; \n white-space: nowrap;\n height: 100%;\n}\n\n.ace_text-layer {\n font-family: Monaco, "Courier New", monospace;\n color: black;\n}\n\n.ace_cursor-layer {\n cursor: text;\n}\n\n.ace_cursor {\n z-index: 3;\n position: absolute;\n}\n\n.ace_line {\n white-space: nowrap;\n}\n\n.ace_marker-layer {\n}\n\n.ace_marker-layer .ace_step {\n position: absolute;\n z-index: 2;\n}\n\n.ace_marker-layer .ace_selection {\n position: absolute;\n z-index: 3;\n}\n\n.ace_marker-layer .ace_bracket {\n position: absolute;\n z-index: 4;\n}\n\n.ace_marker-layer .ace_active_line {\n position: absolute;\n z-index: 1;\n}'); - e.importCssString(b); - b = function(c, n) { - this.container = c; - e.addCssClass(this.container, "ace_editor"); - this.setTheme(n); - this.$gutter = document.createElement("div"); - this.$gutter.className = "ace_gutter"; - this.container.appendChild(this.$gutter); - this.scroller = document.createElement("div"); - this.scroller.className = "ace_scroller"; - this.container.appendChild(this.scroller); - this.content = document.createElement("div"); - this.content.style.position = "absolute"; - this.scroller.appendChild(this.content); - this.$gutterLayer = new o(this.$gutter); - this.$markerLayer = new d(this.content); - var p = this.$textLayer = new k(this.content); - this.canvas = p.element; - this.characterWidth = p.getCharacterWidth(); - this.lineHeight = p.getLineHeight(); - this.$cursorLayer = new a(this.content); - this.layers = [this.$markerLayer, p, this.$cursorLayer]; - this.scrollBar = new f(c); - this.scrollBar.addEventListener("scroll", this.onScroll.bind(this)); - this.scrollTop = 0; - this.cursorPos = {row:0, column:0}; - var r = this; - this.$textLayer.addEventListener("changeCharaterSize", function() { - r.characterWidth = p.getCharacterWidth(); - r.lineHeight = p.getLineHeight(); - r.$loop.schedule(r.CHANGE_FULL) - }); - j.addListener(this.$gutter, "click", this.$onGutterClick.bind(this)); - j.addListener(this.$gutter, "dblclick", this.$onGutterClick.bind(this)); - this.$size = {width:0, height:0, scrollerHeight:0, scrollerWidth:0}; - this.$loop = new h(this.$renderChanges.bind(this)); - this.$loop.schedule(this.CHANGE_FULL); - this.$updatePrintMargin(); - this.setPadding(4) - }; - (function() { - this.showGutter = true; - this.CHANGE_CURSOR = 1; - this.CHANGE_MARKER = 2; - this.CHANGE_GUTTER = 4; - this.CHANGE_SCROLL = 8; - this.CHANGE_LINES = 16; - this.CHANGE_TEXT = 32; - this.CHANGE_SIZE = 64; - this.CHANGE_FULL = 128; - l.implement(this, m); - this.setDocument = function(c) { - this.lines = c.lines; - this.doc = c; - this.$cursorLayer.setDocument(c); - this.$markerLayer.setDocument(c); - this.$textLayer.setDocument(c); - this.$loop.schedule(this.CHANGE_FULL) - }; - this.updateLines = function(c, n) { - if(n === undefined) { - n = Infinity - }if(this.$changedLines) { - if(this.$changedLines.firstRow > c) { - this.$changedLines.firstRow = c - }if(this.$changedLines.lastRow < n) { - this.$changedLines.lastRow = n - } - }else { - this.$changedLines = {firstRow:c, lastRow:n} - }this.$loop.schedule(this.CHANGE_LINES) - }; - this.updateText = function() { - this.$loop.schedule(this.CHANGE_TEXT) - }; - this.updateFull = function() { - this.$loop.schedule(this.CHANGE_FULL) - }; - this.onResize = function() { - var c = this.CHANGE_SIZE, n = e.getInnerHeight(this.container); - if(this.$size.height != n) { - this.$size.height = n; - this.scroller.style.height = n + "px"; - this.scrollBar.setHeight(n); - if(this.doc) { - this.scrollToY(this.getScrollTop()); - c |= this.CHANGE_FULL - } - }n = e.getInnerWidth(this.container); - if(this.$size.width != n) { - this.$size.width = n; - var p = this.showGutter ? this.$gutter.offsetWidth : 0; - this.scroller.style.left = p + "px"; - this.scroller.style.width = Math.max(0, n - p - this.scrollBar.getWidth()) + "px" - }this.$size.scrollerWidth = this.scroller.clientWidth; - this.$size.scrollerHeight = this.scroller.clientHeight; - this.$loop.schedule(c) - }; - this.setTokenizer = function(c) { - this.$tokenizer = c; - this.$textLayer.setTokenizer(c); - this.$loop.schedule(this.CHANGE_TEXT) - }; - this.$onGutterClick = function(c) { - var n = j.getDocumentX(c), p = j.getDocumentY(c); - this._dispatchEvent("gutter" + c.type, {row:this.screenToTextCoordinates(n, p).row, htmlEvent:c}) - }; - this.setShowInvisibles = function(c) { - this.$textLayer.setShowInvisibles(c) && this.$loop.schedule(this.CHANGE_TEXT) - }; - this.getShowInvisibles = function() { - return this.$textLayer.showInvisibles - }; - this.$showPrintMargin = true; - this.setShowPrintMargin = function(c) { - this.$showPrintMargin = c; - this.$updatePrintMargin() - }; - this.getShowPrintMargin = function() { - return this.$showPrintMargin - }; - this.$printMarginColumn = 80; - this.setPrintMarginColumn = function(c) { - this.$printMarginColumn = c; - this.$updatePrintMargin() - }; - this.getPrintMarginColumn = function() { - return this.$printMarginColumn - }; - this.setShowGutter = function(c) { - this.$gutter.style.display = c ? "block" : "none"; - this.showGutter = c; - this.onResize() - }; - this.$updatePrintMargin = function() { - if(this.$showPrintMargin || this.$printMarginEl) { - if(!this.$printMarginEl) { - this.$printMarginEl = document.createElement("div"); - this.$printMarginEl.className = "ace_printMargin"; - this.content.insertBefore(this.$printMarginEl, this.$textLayer.element) - }var c = this.$printMarginEl.style; - c.left = this.characterWidth * this.$printMarginColumn + "px"; - c.visibility = this.$showPrintMargin ? "visible" : "hidden" - } - }; - this.getContainerElement = function() { - return this.container - }; - this.getMouseEventTarget = function() { - return this.content - }; - this.getFirstVisibleRow = function() { - return(this.layerConfig || {}).firstRow || 0 - }; - this.getFirstFullyVisibleRow = function() { - if(!this.layerConfig) { - return 0 - }return this.layerConfig.firstRow + (this.layerConfig.offset == 0 ? 0 : 1) - }; - this.getLastFullyVisibleRow = function() { - if(!this.layerConfig) { - return 0 - }return this.layerConfig.firstRow - 1 + Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight) - }; - this.getLastVisibleRow = function() { - return(this.layerConfig || {}).lastRow || 0 - }; - this.$padding = null; - this.setPadding = function(c) { - this.$padding = c; - this.content.style.padding = "0 " + c + "px"; - this.$loop.schedule(this.CHANGE_FULL) - }; - this.onScroll = function(c) { - this.scrollToY(c.data) - }; - this.$updateScrollBar = function() { - this.scrollBar.setInnerHeight(this.doc.getLength() * this.lineHeight); - this.scrollBar.setScrollTop(this.scrollTop) - }; - this.$renderChanges = function(c) { - if(!(!c || !this.doc || !this.$tokenizer)) { - if(!this.layerConfig || c & this.CHANGE_FULL || c & this.CHANGE_SIZE || c & this.CHANGE_TEXT || c & this.CHANGE_LINES || c & this.CHANGE_SCROLL) { - this.$computeLayerConfig() - }if(c & this.CHANGE_FULL) { - this.$textLayer.update(this.layerConfig); - this.showGutter && this.$gutterLayer.update(this.layerConfig); - this.$markerLayer.update(this.layerConfig); - this.$cursorLayer.update(this.layerConfig); - this.$updateScrollBar() - }else { - if(c & this.CHANGE_SCROLL) { - c & this.CHANGE_TEXT || c & this.CHANGE_LINES ? this.$textLayer.update(this.layerConfig) : this.$textLayer.scrollLines(this.layerConfig); - this.showGutter && this.$gutterLayer.update(this.layerConfig); - this.$markerLayer.update(this.layerConfig); - this.$cursorLayer.update(this.layerConfig); - this.$updateScrollBar() - }else { - if(c & this.CHANGE_TEXT) { - this.$textLayer.update(this.layerConfig); - this.showGutter && this.$gutterLayer.update(this.layerConfig) - }else { - if(c & this.CHANGE_LINES) { - this.$updateLines(); - this.$updateScrollBar(); - this.showGutter && this.$gutterLayer.update(this.layerConfig) - }else { - c & this.CHANGE_GUTTER && this.showGutter && this.$gutterLayer.update(this.layerConfig) - } - }c & this.CHANGE_CURSOR && this.$cursorLayer.update(this.layerConfig); - c & this.CHANGE_MARKER && this.$markerLayer.update(this.layerConfig); - c & this.CHANGE_SIZE && this.$updateScrollBar() - } - } - } - }; - this.$computeLayerConfig = function() { - var c = this.scrollTop % this.lineHeight, n = this.$size.scrollerHeight + this.lineHeight, p = this.$getLongestLine(), r = !this.layerConfig ? true : this.layerConfig.width != p, t = Math.ceil(n / this.lineHeight), q = Math.max(0, Math.round((this.scrollTop - c) / this.lineHeight)); - t = Math.max(0, Math.min(this.lines.length, q + t) - 1); - this.layerConfig = {width:p, padding:this.$padding, firstRow:q, lastRow:t, lineHeight:this.lineHeight, characterWidth:this.characterWidth, minHeight:n, offset:c, height:this.$size.scrollerHeight}; - for(q = 0;q < this.layers.length;q++) { - t = this.layers[q]; - if(r) { - t.element.style.width = p + "px" - } - }this.$gutterLayer.element.style.marginTop = -c + "px"; - this.content.style.marginTop = -c + "px"; - this.content.style.width = p + "px"; - this.content.style.height = n + "px" - }; - this.$updateLines = function() { - var c = this.$changedLines.firstRow, n = this.$changedLines.lastRow; - this.$changedLines = null; - var p = this.layerConfig; - if(p.width != this.$getLongestLine()) { - return this.$textLayer.update(p) - }if(!(c > p.lastRow + 1)) { - if(!(n < p.firstRow)) { - if(n === Infinity) { - this.showGutter && this.$gutterLayer.update(p); - this.$textLayer.update(p) - }else { - this.$textLayer.updateLines(p, c, n) - } - } - } - }; - this.$getLongestLine = function() { - var c = this.doc.getScreenWidth(); - if(this.$textLayer.showInvisibles) { - c += 1 - }return Math.max(this.$size.scrollerWidth - this.$padding * 2, Math.round(c * this.characterWidth)) - }; - this.addMarker = function(c, n, p) { - c = this.$markerLayer.addMarker(c, n, p); - this.$loop.schedule(this.CHANGE_MARKER); - return c - }; - this.removeMarker = function(c) { - this.$markerLayer.removeMarker(c); - this.$loop.schedule(this.CHANGE_MARKER) - }; - this.addGutterDecoration = function(c, n) { - this.$gutterLayer.addGutterDecoration(c, n); - this.$loop.schedule(this.CHANGE_GUTTER) - }; - this.removeGutterDecoration = function(c, n) { - this.$gutterLayer.removeGutterDecoration(c, n); - this.$loop.schedule(this.CHANGE_GUTTER) - }; - this.setBreakpoints = function(c) { - this.$gutterLayer.setBreakpoints(c); - this.$loop.schedule(this.CHANGE_GUTTER) - }; - this.updateCursor = function(c, n) { - this.$cursorLayer.setCursor(c, n); - this.$loop.schedule(this.CHANGE_CURSOR) - }; - this.hideCursor = function() { - this.$cursorLayer.hideCursor() - }; - this.showCursor = function() { - this.$cursorLayer.showCursor() - }; - this.scrollCursorIntoView = function() { - var c = this.$cursorLayer.getPixelPosition(), n = c.left + this.$padding; - c = c.top; - this.getScrollTop() > c && this.scrollToY(c); - this.getScrollTop() + this.$size.scrollerHeight < c + this.lineHeight && this.scrollToY(c + this.lineHeight - this.$size.scrollerHeight); - this.scroller.scrollLeft > n && this.scrollToX(n); - this.scroller.scrollLeft + this.$size.scrollerWidth < n + this.characterWidth && this.scrollToX(Math.round(n + this.characterWidth - this.$size.scrollerWidth)) - }; - this.getScrollTop = function() { - return this.scrollTop - }; - this.getScrollLeft = function() { - return this.scroller.scrollLeft - }; - this.getScrollTopRow = function() { - return this.scrollTop / this.lineHeight - }; - this.scrollToRow = function(c) { - this.scrollToY(c * this.lineHeight) - }; - this.scrollToY = function(c) { - c = Math.max(0, Math.min(this.lines.length * this.lineHeight - this.$size.scrollerHeight, c)); - if(this.scrollTop !== c) { - this.scrollTop = c; - this.$loop.schedule(this.CHANGE_SCROLL) - } - }; - this.scrollToX = function(c) { - if(c <= this.$padding) { - c = 0 - }this.scroller.scrollLeft = c - }; - this.scrollBy = function(c, n) { - n && this.scrollToY(this.scrollTop + n); - c && this.scrollToX(this.scroller.scrollLeft + c) - }; - this.screenToTextCoordinates = function(c, n) { - var p = this.scroller.getBoundingClientRect(); - c = Math.round((c + this.scroller.scrollLeft - p.left - this.$padding) / this.characterWidth); - n = Math.floor((n + this.scrollTop - p.top) / this.lineHeight); - return{row:n, column:this.doc.screenToDocumentColumn(Math.max(0, Math.min(n, this.doc.getLength() - 1)), c)} - }; - this.textToScreenCoordinates = function(c, n) { - var p = this.scroller.getBoundingClientRect(); - n = this.$padding + Math.round(this.doc.documentToScreenColumn(c, n) * this.characterWidth); - c = c * this.lineHeight; - return{pageX:p.left + n - this.getScrollLeft(), pageY:p.top + c - this.getScrollTop()} - }; - this.visualizeFocus = function() { - e.addCssClass(this.container, "ace_focus") - }; - this.visualizeBlur = function() { - e.removeCssClass(this.container, "ace_focus") - }; - this.showComposition = function() { - }; - this.setCompositionText = function() { - }; - this.hideComposition = function() { - }; - this.setTheme = function(c) { - function n(r) { - p.$theme && e.removeCssClass(p.container, p.$theme); - p.$theme = r ? r.cssClass : null; - p.$theme && e.addCssClass(p.container, p.$theme); - if(p.$size) { - p.$size.width = 0; - p.onResize() - } - } - var p = this; - if(!c || typeof c == "string") { - c = c || "ace/theme/textmate"; - i([c], function(r) { - n(r) - }) - }else { - n(c) - }p = this - } - }).call(b.prototype); - g.VirtualRenderer = b -}); -define("ace/mode/doc_comment_highlight_rules", ["require", "exports", "module", "pilot/oop", "ace/mode/text_highlight_rules"], function(i, g) { - var l = i("pilot/oop"); - i = i("ace/mode/text_highlight_rules").TextHighlightRules; - var e = function() { - this.$rules = {start:[{token:"comment.doc", regex:"\\*\\/", next:"start"}, {token:"comment.doc.tag", regex:"@[\\w\\d_]+"}, {token:"comment.doc", regex:"s+"}, {token:"comment.doc", regex:"TODO"}, {token:"comment.doc", regex:"[^@\\*]+"}, {token:"comment.doc", regex:"."}]} - }; - l.inherits(e, i); - (function() { - this.getStartRule = function(j) { - return{token:"comment.doc", regex:"\\/\\*(?=\\*)", next:j} - } - }).call(e.prototype); - g.DocCommentHighlightRules = e -}); -define("ace/mode/javascript_highlight_rules", ["require", "exports", "module", "pilot/oop", "pilot/lang", "ace/mode/doc_comment_highlight_rules", "ace/mode/text_highlight_rules"], function(i, g) { - var l = i("pilot/oop"), e = i("pilot/lang"), j = i("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules; - i = i("ace/mode/text_highlight_rules").TextHighlightRules; - JavaScriptHighlightRules = function() { - var o = new j, d = e.arrayToMap("break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|var|while|with".split("|")), k = e.arrayToMap("null|Infinity|NaN|undefined".split("|")), a = e.arrayToMap("class|enum|extends|super|const|export|import|implements|let|private|public|yield|interface|package|protected|static".split("|")); - this.$rules = {start:[{token:"comment", regex:"\\/\\/.*$"}, o.getStartRule("doc-start"), {token:"comment", regex:"\\/\\*", next:"comment"}, {token:"string.regexp", regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)"}, {token:"string", regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'}, {token:"string", regex:'["].*\\\\$', next:"qqstring"}, {token:"string", regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"}, {token:"string", regex:"['].*\\\\$", next:"qstring"}, {token:"constant.numeric", - regex:"0[xX][0-9a-fA-F]+\\b"}, {token:"constant.numeric", regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"}, {token:"constant.language.boolean", regex:"(?:true|false)\\b"}, {token:function(f) { - return f == "this" ? "variable.language" : d[f] ? "keyword" : k[f] ? "constant.language" : a[f] ? "invalid.illegal" : f == "debugger" ? "invalid.deprecated" : "identifier" - }, regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"}, {token:"keyword.operator", regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"}, {token:"lparen", regex:"[[({]"}, {token:"rparen", regex:"[\\])}]"}, {token:"text", regex:"\\s+"}], comment:[{token:"comment", regex:".*?\\*\\/", next:"start"}, {token:"comment", regex:".+"}], qqstring:[{token:"string", regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"', - next:"start"}, {token:"string", regex:".+"}], qstring:[{token:"string", regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'", next:"start"}, {token:"string", regex:".+"}]}; - this.addRules(o.getRules(), "doc-"); - this.$rules["doc-start"][0].next = "start" - }; - l.inherits(JavaScriptHighlightRules, i); - g.JavaScriptHighlightRules = JavaScriptHighlightRules -}); -define("ace/mode/matching_brace_outdent", ["require", "exports", "module", "ace/range"], function(i, g) { - var l = i("ace/range").Range; - i = function() { - }; - (function() { - this.checkOutdent = function(e, j) { - if(!/^\s+$/.test(e)) { - return false - }return/^\s*\}/.test(j) - }; - this.autoOutdent = function(e, j) { - var o = e.getLine(j).match(/^(\s*\})/); - if(!o) { - return 0 - }o = o[1].length; - var d = e.findMatchingBracket({row:j, column:o}); - if(!d || d.row == j) { - return 0 - }d = this.$getIndent(e.getLine(d.row)); - e.replace(new l(j, 0, j, o - 1), d); - return d.length - (o - 1) - }; - this.$getIndent = function(e) { - if(e = e.match(/^(\s+)/)) { - return e[1] - }return"" - } - }).call(i.prototype); - g.MatchingBraceOutdent = i -}); -define("ace/mode/javascript", ["require", "exports", "module", "pilot/oop", "ace/mode/text", "ace/tokenizer", "ace/mode/javascript_highlight_rules", "ace/mode/matching_brace_outdent", "ace/range"], function(i, g) { - var l = i("pilot/oop"), e = i("ace/mode/text").Mode, j = i("ace/tokenizer").Tokenizer, o = i("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules, d = i("ace/mode/matching_brace_outdent").MatchingBraceOutdent, k = i("ace/range").Range; - i = function() { - this.$tokenizer = new j((new o).getRules()); - this.$outdent = new d - }; - l.inherits(i, e); - (function() { - this.toggleCommentLines = function(a, f, h, m) { - var b = true; - a = /^(\s*)\/\//; - for(var c = h;c <= m;c++) { - if(!a.test(f.getLine(c))) { - b = false; - break - } - }if(b) { - b = new k(0, 0, 0, 0); - for(c = h;c <= m;c++) { - h = f.getLine(c).replace(a, "$1"); - b.start.row = c; - b.end.row = c; - b.end.column = h.length + 2; - f.replace(b, h) - }return-2 - }else { - return f.indentRows(h, m, "//") - } - }; - this.getNextLineIndent = function(a, f, h) { - var m = this.$getIndent(f), b = this.$tokenizer.getLineTokens(f, a), c = b.tokens; - b = b.state; - if(c.length && c[c.length - 1].type == "comment") { - return m - }if(a == "start") { - if(a = f.match(/^.*[\{\(\[]\s*$/)) { - m += h - } - }else { - if(a == "doc-start") { - if(b == "start") { - return"" - }if(a = f.match(/^\s*(\/?)\*/)) { - if(a[1]) { - m += " " - }m += "* " - } - } - }return m - }; - this.checkOutdent = function(a, f, h) { - return this.$outdent.checkOutdent(f, h) - }; - this.autoOutdent = function(a, f, h) { - return this.$outdent.autoOutdent(f, h) - } - }).call(i.prototype); - g.Mode = i -}); -define("ace/theme/textmate", ["require", "exports", "module", "pilot/dom", "text!ace/theme/tm.css!.ace-tm .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-tm .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-tm .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-tm .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-tm .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-tm .ace_editor .ace_printMargin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-tm .ace_text-layer {\n cursor: text;\n}\n\n.ace-tm .ace_cursor {\n border-left: 2px solid black;\n}\n\n.ace-tm .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid black;\n}\n \n.ace-tm .ace_line .ace_invisible {\n color: rgb(191, 191, 191);\n}\n\n.ace-tm .ace_line .ace_keyword {\n color: blue;\n}\n\n.ace-tm .ace_line .ace_constant.ace_buildin {\n color: rgb(88, 72, 246);\n}\n\n.ace-tm .ace_line .ace_constant.ace_language {\n color: rgb(88, 92, 246);\n}\n\n.ace-tm .ace_line .ace_constant.ace_library {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_line .ace_invalid {\n background-color: rgb(153, 0, 0);\n color: white;\n}\n\n.ace-tm .ace_line .ace_support.ace_function {\n color: rgb(60, 76, 114);\n}\n\n.ace-tm .ace_line .ace_support.ace_constant {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_line .ace_support.ace_type,\n.ace-tm .ace_line .ace_support.ace_class {\n color: rgb(109, 121, 222);\n}\n\n.ace-tm .ace_line .ace_keyword.ace_operator {\n color: rgb(104, 118, 135);\n}\n\n.ace-tm .ace_line .ace_string {\n color: rgb(3, 106, 7);\n}\n\n.ace-tm .ace_line .ace_comment {\n color: rgb(76, 136, 107);\n}\n\n.ace-tm .ace_line .ace_comment.ace_doc {\n color: rgb(0, 102, 255);\n}\n\n.ace-tm .ace_line .ace_comment.ace_doc.ace_tag {\n color: rgb(128, 159, 191);\n}\n\n.ace-tm .ace_line .ace_constant.ace_numeric {\n color: rgb(0, 0, 205);\n}\n\n.ace-tm .ace_line .ace_variable {\n color: rgb(49, 132, 149);\n}\n\n.ace-tm .ace_line .ace_xml_pe {\n color: rgb(104, 104, 91);\n}\n\n.ace-tm .ace_marker-layer .ace_selection {\n background: rgb(181, 213, 255);\n}\n\n.ace-tm .ace_marker-layer .ace_step {\n background: rgb(252, 255, 0);\n}\n\n.ace-tm .ace_marker-layer .ace_stack {\n background: rgb(164, 229, 101);\n}\n\n.ace-tm .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-tm .ace_marker-layer .ace_active_line {\n background: rgb(232, 242, 254);\n}\n\n.ace-tm .ace_string.ace_regex {\n color: rgb(255, 0, 0) \n}"], -function(i, g) { - var l = i("pilot/dom"); - i = i("text!ace/theme/tm.css!.ace-tm .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-tm .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-tm .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-tm .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-tm .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-tm .ace_editor .ace_printMargin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-tm .ace_text-layer {\n cursor: text;\n}\n\n.ace-tm .ace_cursor {\n border-left: 2px solid black;\n}\n\n.ace-tm .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid black;\n}\n \n.ace-tm .ace_line .ace_invisible {\n color: rgb(191, 191, 191);\n}\n\n.ace-tm .ace_line .ace_keyword {\n color: blue;\n}\n\n.ace-tm .ace_line .ace_constant.ace_buildin {\n color: rgb(88, 72, 246);\n}\n\n.ace-tm .ace_line .ace_constant.ace_language {\n color: rgb(88, 92, 246);\n}\n\n.ace-tm .ace_line .ace_constant.ace_library {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_line .ace_invalid {\n background-color: rgb(153, 0, 0);\n color: white;\n}\n\n.ace-tm .ace_line .ace_support.ace_function {\n color: rgb(60, 76, 114);\n}\n\n.ace-tm .ace_line .ace_support.ace_constant {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_line .ace_support.ace_type,\n.ace-tm .ace_line .ace_support.ace_class {\n color: rgb(109, 121, 222);\n}\n\n.ace-tm .ace_line .ace_keyword.ace_operator {\n color: rgb(104, 118, 135);\n}\n\n.ace-tm .ace_line .ace_string {\n color: rgb(3, 106, 7);\n}\n\n.ace-tm .ace_line .ace_comment {\n color: rgb(76, 136, 107);\n}\n\n.ace-tm .ace_line .ace_comment.ace_doc {\n color: rgb(0, 102, 255);\n}\n\n.ace-tm .ace_line .ace_comment.ace_doc.ace_tag {\n color: rgb(128, 159, 191);\n}\n\n.ace-tm .ace_line .ace_constant.ace_numeric {\n color: rgb(0, 0, 205);\n}\n\n.ace-tm .ace_line .ace_variable {\n color: rgb(49, 132, 149);\n}\n\n.ace-tm .ace_line .ace_xml_pe {\n color: rgb(104, 104, 91);\n}\n\n.ace-tm .ace_marker-layer .ace_selection {\n background: rgb(181, 213, 255);\n}\n\n.ace-tm .ace_marker-layer .ace_step {\n background: rgb(252, 255, 0);\n}\n\n.ace-tm .ace_marker-layer .ace_stack {\n background: rgb(164, 229, 101);\n}\n\n.ace-tm .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-tm .ace_marker-layer .ace_active_line {\n background: rgb(232, 242, 254);\n}\n\n.ace-tm .ace_string.ace_regex {\n color: rgb(255, 0, 0) \n}"); - l.importCssString(i); - g.cssClass = "ace-tm" + }).call(g.prototype); + r.Editor = g }); \ No newline at end of file diff --git a/build/ace/layer/text.js b/build/ace/layer/text.js index ae9bd66e..afbc4ab3 100644 --- a/build/ace/layer/text.js +++ b/build/ace/layer/text.js @@ -79,7 +79,7 @@ define(function(k, n) { if(j) { var m = []; h.$renderLine(m, f, i[f - g].tokens); - l.setInnerHtml(j, m.join) + l.setInnerHtml(j, m.join("")) } } }) diff --git a/build/build.txt b/build/build.txt index 4b5f4dce..c2f01d06 100644 --- a/build/build.txt +++ b/build/build.txt @@ -1,19 +1,42 @@ -demo/startup.js +demo/boot.js ---------------- +pilot/fixoldbrowsers.js +pilot/console.js pilot/useragent.js -pilot/event.js +pilot/stacktrace.js +pilot/promise.js +pilot/plugin_manager.js pilot/oop.js +pilot/types.js +pilot/event_emitter.js +pilot/catalog.js +pilot/settings.js +pilot/environment.js +pilot/types/basic.js pilot/lang.js +pilot/canon.js +pilot/types/command.js +pilot/types/settings.js +pilot/commands/settings.js +pilot/typecheck.js +pilot/commands/basic.js +pilot/settings/canon.js +pilot/index.js +cockpit/cli.js +cockpit/test/assert.js +cockpit/test/testCli.js +cockpit/ui/settings.js +pilot/event.js +pilot/dom.js +pilot/keyboard/keyutil.js +pilot/domtemplate.js +cockpit/ui/requestView.js +cockpit/ui/cliView.js +cockpit/index.js ace/textinput.js ace/conf/keybindings/default_mac.js ace/conf/keybindings/default_win.js -pilot/console.js -pilot/stacktrace.js -pilot/event_emitter.js -pilot/catalog.js -pilot/types.js -pilot/canon.js ace/commands/default_commands.js ace/keybinding.js ace/range.js @@ -25,7 +48,6 @@ ace/document.js ace/search.js ace/background_tokenizer.js ace/editor.js -pilot/dom.js ace/layer/gutter.js ace/layer/marker.js ace/layer/text.js @@ -50,48 +72,7 @@ ace/mode/php_highlight_rules.js ace/mode/php.js ace/undomanager.js demo/startup.js -pilot/fixoldbrowsers.js - -ace/editor.js ----------------- -pilot/oop.js -pilot/useragent.js -pilot/event.js -pilot/lang.js -ace/textinput.js -ace/conf/keybindings/default_mac.js -ace/conf/keybindings/default_win.js -pilot/console.js -pilot/stacktrace.js -pilot/event_emitter.js -pilot/catalog.js -pilot/types.js -pilot/canon.js -ace/commands/default_commands.js -ace/keybinding.js -ace/range.js -ace/selection.js -ace/tokenizer.js -ace/mode/text_highlight_rules.js -ace/mode/text.js -ace/document.js -ace/search.js -ace/background_tokenizer.js -ace/editor.js -ace/undomanager.js -pilot/dom.js -ace/layer/gutter.js -ace/layer/marker.js -ace/layer/text.js -ace/layer/cursor.js -ace/scrollbar.js -ace/renderloop.js -ace/virtual_renderer.js -ace/mode/doc_comment_highlight_rules.js -ace/mode/javascript_highlight_rules.js -ace/mode/matching_brace_outdent.js -ace/mode/javascript.js -ace/theme/textmate.js +demo/boot.js ace/theme/eclipse.js ---------------- diff --git a/build/demo/boot.js b/build/demo/boot.js index 048dcd99..fa166016 100644 --- a/build/demo/boot.js +++ b/build/demo/boot.js @@ -1,10 +1,6818 @@ -var config = {packagePaths:{"../support/cockpit/lib":[{name:"cockpit", main:"index", lib:"."}], "../support/cockpit/support/pilot/lib":[{name:"pilot", main:"index", lib:"."}]}, paths:{demo:"../demo", ace:"../lib/ace"}}, deps = ["pilot/fixoldbrowsers", "pilot/plugin_manager", "pilot/settings", "pilot/environment", "demo/startup"]; -require(config, deps, function() { - var a = require("pilot/plugin_manager").catalog; - a.registerPlugins(["pilot/index", "cockpit/index"]).then(function() { - var b = require("pilot/environment").create(); - a.startupPlugins({env:b}).then(function() { - require("demo/startup").launch(b) +define("pilot/fixoldbrowsers", ["require", "exports", "module"], function(require$$1, exports) { + if(!Array.isArray) { + Array.isArray = function(data) { + return data && Object.prototype.toString.call(data) === "[object Array]" + } + }if(!Array.prototype.indexOf) { + Array.prototype.indexOf = function(searchElement) { + if(this === void 0 || this === null) { + throw new TypeError; + }var t = Object(this); + var len = t.length >>> 0; + if(len === 0) { + return-1 + }var n = 0; + if(arguments.length > 0) { + n = Number(arguments[1]); + if(n !== n) { + n = 0 + }else { + if(n !== 0 && n !== 1 / 0 && n !== -(1 / 0)) { + n = (n > 0 || -1) * Math.floor(Math.abs(n)) + } + } + }if(n >= len) { + return-1 + }var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); + for(;k < len;k++) { + if(k in t && t[k] === searchElement) { + return k + } + }return-1 + } + }if(!Array.prototype.map) { + Array.prototype.map = function(fun, JSCompiler_OptimizeArgumentsArray_p0) { + if(this === void 0 || this === null) { + throw new TypeError; + }var t$$1 = Object(this); + var len$$1 = t$$1.length >>> 0; + if(typeof fun !== "function") { + throw new TypeError; + }res = new Array(len$$1); + var thisp = JSCompiler_OptimizeArgumentsArray_p0; + var i = 0; + for(;i < len$$1;i++) { + if(i in t$$1) { + res[i] = fun.call(thisp, t$$1[i], i, t$$1) + } + }return res + } + }if(!Array.prototype.forEach) { + Array.prototype.forEach = function(fun$$1, JSCompiler_OptimizeArgumentsArray_p1) { + if(this === void 0 || this === null) { + throw new TypeError; + }var t$$2 = Object(this); + var len$$2 = t$$2.length >>> 0; + if(typeof fun$$1 !== "function") { + throw new TypeError; + }var thisp$$1 = JSCompiler_OptimizeArgumentsArray_p1; + var i$$1 = 0; + for(;i$$1 < len$$2;i$$1++) { + i$$1 in t$$2 && fun$$1.call(thisp$$1, t$$2[i$$1], i$$1, t$$2) + } + } + }if(!Object.keys) { + Object.keys = function(obj) { + var k$$1; + var ret = []; + for(k$$1 in obj) { + obj.hasOwnProperty(k$$1) && ret.push(k$$1) + }return ret + } + }if(!Function.prototype.bind) { + Function.prototype.bind = function(obj$$1) { + var slice = [].slice; + var args = slice.call(arguments, 1); + var self = this; + var nop = function() { + }; + var bound = arguments.length == 1 ? function() { + return self.apply(this instanceof nop ? this : obj$$1, arguments) + } : function() { + return self.apply(this instanceof nop ? this : obj$$1 || {}, args.concat(slice.call(arguments))) + }; + nop.prototype = self.prototype; + bound.prototype = new nop; + bound.name = this.name; + bound.displayName = this.displayName; + bound.length = this.length; + bound.unbound = self; + return bound + } + }if(!String.prototype.trim) { + String.prototype.trim = function() { + return this.replace(/^\s+/, "").replace(/\s+$/, "") + } + }exports.globalsLoaded = true +}); +define("pilot/console", ["require", "exports", "module"], function(require$$2, exports$$1) { + var noop = function() { + }; + var NAMES = ["assert", "count", "debug", "dir", "dirxml", "error", "group", "groupEnd", "info", "log", "profile", "profileEnd", "time", "timeEnd", "trace", "warn"]; + typeof window === "undefined" ? NAMES.forEach(function(name) { + exports$$1[name] = function() { + var args$$1 = Array.prototype.slice.call(arguments); + var msg = {op:"log", method:name, args:args$$1}; + postMessage(JSON.stringify(msg)) + } + }) : NAMES.forEach(function(name$$1) { + exports$$1[name$$1] = window.console && window.console[name$$1] ? Function.prototype.bind.call(window.console[name$$1], window.console) : noop + }) +}); +define("pilot/useragent", ["require", "exports", "module"], function(require$$3, exports$$2) { + var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase(); + var ua = navigator.userAgent; + exports$$2.isWin = os == "win"; + exports$$2.isMac = os == "mac"; + exports$$2.isLinux = os == "linux"; + exports$$2.isIE = !+"\u000b1"; + exports$$2.isGecko = exports$$2.isMozilla = window.controllers && window.navigator.product === "Gecko"; + exports$$2.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]"; + exports$$2.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined; + exports$$2.isAIR = ua.indexOf("AdobeAIR") >= 0; + exports$$2.OS = {LINUX:"LINUX", MAC:"MAC", WINDOWS:"WINDOWS"}; + exports$$2.getOS = function() { + return exports$$2.isMac ? exports$$2.OS["MAC"] : exports$$2.isLinux ? exports$$2.OS["LINUX"] : exports$$2.OS["WINDOWS"] + } +}); +define("pilot/stacktrace", ["require", "exports", "module", "pilot/useragent", "pilot/console"], function(require$$4, exports$$3) { + function stringifyArguments(args$$2) { + var i$$2 = 0; + for(;i$$2 < args$$2.length;++i$$2) { + var argument = args$$2[i$$2]; + if(typeof argument == "object") { + args$$2[i$$2] = "#object" + }else { + if(typeof argument == "function") { + args$$2[i$$2] = "#function" + }else { + if(typeof argument == "string") { + args$$2[i$$2] = '"' + argument + '"' + } + } + } + }return args$$2.join(",") + } + function NameGuesser() { + } + var ua$$1 = require$$4("pilot/useragent"); + var console$$1 = require$$4("pilot/console"); + var mode = function() { + return ua$$1.isGecko ? "firefox" : ua$$1.isOpera ? "opera" : "other" + }(); + var decoders = {chrome:function(e$$1) { + var stack = e$$1.stack; + if(!stack) { + console$$1.log(e$$1); + return[] + }return stack.replace(/^.*?\n/, "").replace(/^.*?\n/, "").replace(/^.*?\n/, "").replace(/^[^\(]+?[\n$]/gm, "").replace(/^\s+at\s+/gm, "").replace(/^Object.\s*\(/gm, "{anonymous}()@").split("\n") + }, firefox:function(e$$2) { + var stack$$1 = e$$2.stack; + if(!stack$$1) { + console$$1.log(e$$2); + return[] + }stack$$1 = stack$$1.replace(/(?:\n@:0)?\s+$/m, ""); + stack$$1 = stack$$1.replace(/^\(/gm, "{anonymous}("); + return stack$$1.split("\n") + }, opera:function(e$$3) { + var lines = e$$3.message.split("\n"); + var ANON = "{anonymous}"; + var lineRE = /Line\s+(\d+).*?script\s+(http\S+)(?:.*?in\s+function\s+(\S+))?/i; + var i$$3; + var j; + var len$$3; + i$$3 = 4; + j = 0; + len$$3 = lines.length; + for(;i$$3 < len$$3;i$$3 += 2) { + if(lineRE.test(lines[i$$3])) { + lines[j++] = (RegExp.$3 ? RegExp.$3 + "()@" + RegExp.$2 + RegExp.$1 : ANON + "()@" + RegExp.$2 + ":" + RegExp.$1) + " -- " + lines[i$$3 + 1].replace(/^\s+/, "") + } + }lines.splice(j, lines.length - j); + return lines + }, other:function(curr) { + var ANON$$1 = "{anonymous}"; + var fnRE = /function\s*([\w\-$]+)?\s*\(/i; + var stack$$2 = []; + var j$$1 = 0; + var fn; + var args$$3; + var maxStackSize = 10; + for(;curr && stack$$2.length < maxStackSize;) { + fn = fnRE.test(curr.toString()) ? RegExp.$1 || ANON$$1 : ANON$$1; + args$$3 = Array.prototype.slice.call(curr["arguments"]); + stack$$2[j$$1++] = fn + "(" + stringifyArguments(args$$3) + ")"; + if(curr === curr.caller && window.opera) { + break + }curr = curr.caller + }return stack$$2 + }}; + NameGuesser.prototype = {sourceCache:{}, ajax:function(url) { + var req = this.createXMLHTTPObject(); + if(!req) { + return + }req.open("GET", url, false); + req.setRequestHeader("User-Agent", "XMLHTTP/1.0"); + req.send(""); + return req.responseText + }, createXMLHTTPObject:function() { + var xmlhttp; + var XMLHttpFactories = [function() { + return new XMLHttpRequest + }, function() { + return new ActiveXObject("Msxml2.XMLHTTP") + }, function() { + return new ActiveXObject("Msxml3.XMLHTTP") + }, function() { + return new ActiveXObject("Microsoft.XMLHTTP") + }]; + var i$$4 = 0; + for(;i$$4 < XMLHttpFactories.length;i$$4++) { + try { + xmlhttp = XMLHttpFactories[i$$4](); + this.createXMLHTTPObject = XMLHttpFactories[i$$4]; + return xmlhttp + }catch(e$$4) { + } + } + }, getSource:function(url$$1) { + url$$1 in this.sourceCache || (this.sourceCache[url$$1] = this.ajax(url$$1).split("\n")); + return this.sourceCache[url$$1] + }, guessFunctions:function(stack$$3) { + var i$$5 = 0; + for(;i$$5 < stack$$3.length;++i$$5) { + var reStack = /{anonymous}\(.*\)@(\w+:\/\/([-\w\.]+)+(:\d+)?[^:]+):(\d+):?(\d+)?/; + var frame = stack$$3[i$$5]; + var m = reStack.exec(frame); + if(m) { + var file = m[1]; + var lineno = m[4]; + if(file && lineno) { + var functionName = this.guessFunctionName(file, lineno); + stack$$3[i$$5] = frame.replace("{anonymous}", functionName) + } + } + }return stack$$3 + }, guessFunctionName:function(url$$2, lineNo) { + try { + return this.guessFunctionNameFromLines(lineNo, this.getSource(url$$2)) + }catch(e$$5) { + return"getSource failed with url: " + url$$2 + ", exception: " + e$$5.toString() + } + }, guessFunctionNameFromLines:function(lineNo$$1, source) { + var reFunctionArgNames = /function ([^(]*)\(([^)]*)\)/; + var reGuessFunction = /['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*(function|eval|new Function)/; + var line = ""; + var maxLines = 10; + var i$$6 = 0; + for(;i$$6 < maxLines;++i$$6) { + line = source[lineNo$$1 - i$$6] + line; + if(line !== undefined) { + var m$$1 = reGuessFunction.exec(line); + if(m$$1) { + return m$$1[1] + }else { + m$$1 = reFunctionArgNames.exec(line) + }if(m$$1 && m$$1[1]) { + return m$$1[1] + } + } + }return"(?)" + }}; + var guesser = new NameGuesser; + var frameIgnorePatterns = [/http:\/\/localhost:4020\/sproutcore.js:/]; + exports$$3.ignoreFramesMatching = function(regex) { + frameIgnorePatterns.push(regex) + }; + exports$$3.Trace = function(ex, guess) { + this._ex = ex; + this._stack = decoders[mode](ex); + if(guess) { + this._stack = guesser.guessFunctions(this._stack) + } + }; + exports$$3.Trace.prototype.log = function(lines$$1) { + if(lines$$1 <= 0) { + lines$$1 = 999999999 + }var printed = 0; + var i$$7 = 0; + for(;i$$7 < this._stack.length && printed < lines$$1;i$$7++) { + var frame$$1 = this._stack[i$$7]; + var display = true; + frameIgnorePatterns.forEach(function(regex$$1) { + if(regex$$1.test(frame$$1)) { + display = false + } + }); + if(display) { + console$$1.debug(frame$$1); + printed++ + } + } + } +}); +define("pilot/promise", ["require", "exports", "module", "pilot/console", "pilot/stacktrace"], function(require$$5, exports$$4) { + var console$$2 = require$$5("pilot/console"); + var Trace$$1 = require$$5("pilot/stacktrace").Trace; + var ERROR = -1; + var PENDING = 0; + var SUCCESS = 1; + var _nextId = 0; + var _traceCompletion = false; + var _outstanding = []; + var _recent = []; + Promise = function() { + this._status = PENDING; + this._value = undefined; + this._onSuccessHandlers = []; + this._onErrorHandlers = []; + this._id = _nextId++; + _outstanding[this._id] = this + }; + Promise.prototype.isPromise = true; + Promise.prototype.isComplete = function() { + return this._status != PENDING + }; + Promise.prototype.isResolved = function() { + return this._status == SUCCESS + }; + Promise.prototype.isRejected = function() { + return this._status == ERROR + }; + Promise.prototype.then = function(onSuccess, onError) { + if(typeof onSuccess === "function") { + if(this._status === SUCCESS) { + onSuccess.call(null, this._value) + }else { + this._status === PENDING && this._onSuccessHandlers.push(onSuccess) + } + }if(typeof onError === "function") { + if(this._status === ERROR) { + onError.call(null, this._value) + }else { + this._status === PENDING && this._onErrorHandlers.push(onError) + } + }return this + }; + Promise.prototype.chainPromise = function(onSuccess$$1) { + var chain = new Promise; + chain._chainedFrom = this; + this.then(function(data$$1) { + try { + chain.resolve(onSuccess$$1(data$$1)) + }catch(ex$$1) { + chain.reject(ex$$1) + } + }, function(ex$$2) { + chain.reject(ex$$2) + }); + return chain + }; + Promise.prototype.resolve = function(data$$2) { + return this._complete(this._onSuccessHandlers, SUCCESS, data$$2, "resolve") + }; + Promise.prototype.reject = function(data$$3) { + return this._complete(this._onErrorHandlers, ERROR, data$$3, "reject") + }; + Promise.prototype._complete = function(list, status, data$$4, name$$2) { + if(this._status != PENDING) { + console$$2.group("Promise already closed"); + console$$2.error("Attempted " + name$$2 + "() with ", data$$4); + console$$2.error("Previous status = ", this._status, ", previous value = ", this._value); + console$$2.trace(); + if(this._completeTrace) { + console$$2.error("Trace of previous completion:"); + this._completeTrace.log(5) + }console$$2.groupEnd(); + return this + }if(_traceCompletion) { + this._completeTrace = new Trace$$1(new Error) + }this._status = status; + this._value = data$$4; + list.forEach(function(handler) { + handler.call(null, this._value) + }, this); + this._onSuccessHandlers.length = 0; + this._onErrorHandlers.length = 0; + delete _outstanding[this._id]; + _recent.push(this); + for(;_recent.length > 20;) { + _recent.shift() + }return this + }; + Promise.group = function(promiseList) { + promiseList instanceof Array || (promiseList = Array.prototype.slice.call(arguments)); + if(promiseList.length === 0) { + return(new Promise).resolve([]) + }var groupPromise = new Promise; + var results = []; + var fulfilled = 0; + var onSuccessFactory = function(index) { + return function(data$$5) { + results[index] = data$$5; + fulfilled++; + groupPromise._status !== ERROR && fulfilled === promiseList.length && groupPromise.resolve(results) + } + }; + promiseList.forEach(function(promise, index$$1) { + var onSuccess$$2 = onSuccessFactory(index$$1); + var onError$$1 = groupPromise.reject.bind(groupPromise); + promise.then(onSuccess$$2, onError$$1) + }); + return groupPromise + }; + exports$$4.Promise = Promise; + exports$$4._outstanding = _outstanding; + exports$$4._recent = _recent +}); +define("pilot/plugin_manager", ["require", "exports", "module", "pilot/promise"], function(require$$6, exports$$5) { + var Promise$$1 = require$$6("pilot/promise").Promise; + exports$$5.REASONS = {APP_STARTUP:1, APP_SHUTDOWN:2, PLUGIN_ENABLE:3, PLUGIN_DISABLE:4, PLUGIN_INSTALL:5, PLUGIN_UNINSTALL:6, PLUGIN_UPGRADE:7, PLUGIN_DOWNGRADE:8}; + exports$$5.Plugin = function(name$$3) { + this.name = name$$3; + this.status = this.INSTALLED + }; + exports$$5.Plugin.prototype = {NEW:0, INSTALLED:1, REGISTERED:2, STARTED:3, UNREGISTERED:4, SHUTDOWN:5, install:function(data$$6, reason) { + var pr = new Promise$$1; + if(this.status > this.NEW) { + pr.resolve(this); + return pr + }require$$6([this.name], function(pluginModule$$1) { + pluginModule$$1.install && pluginModule$$1.install(data$$6, reason); + this.status = this.INSTALLED; + pr.resolve(this) + }.bind(this)); + return pr + }, register:function(data$$7, reason$$1) { + var pr$$1 = new Promise$$1; + if(this.status != this.INSTALLED) { + pr$$1.resolve(this); + return pr$$1 + }require$$6([this.name], function(pluginModule$$2) { + pluginModule$$2.register && pluginModule$$2.register(data$$7, reason$$1); + this.status = this.REGISTERED; + pr$$1.resolve(this) + }.bind(this)); + return pr$$1 + }, startup:function(data$$8, reason$$2) { + var pr$$2 = new Promise$$1; + if(this.status != this.REGISTERED) { + pr$$2.resolve(this); + return pr$$2 + }require$$6([this.name], function(pluginModule$$3) { + pluginModule$$3.startup && pluginModule$$3.startup(data$$8, reason$$2); + this.status = this.STARTED; + pr$$2.resolve(this) + }.bind(this)); + return pr$$2 + }, shutdown:function(data$$9, reason$$3) { + if(this.status != this.STARTED) { + return + }pluginModule = require$$6(this.name); + pluginModule.shutdown && pluginModule.shutdown(data$$9, reason$$3) + }}; + exports$$5.PluginCatalog = function() { + this.plugins = {} + }; + exports$$5.PluginCatalog.prototype = {registerPlugins:function(pluginList, data$$10, reason$$4) { + var registrationPromises = []; + pluginList.forEach(function(pluginName) { + var plugin = this.plugins[pluginName]; + if(plugin === undefined) { + plugin = new exports$$5.Plugin(pluginName); + this.plugins[pluginName] = plugin; + registrationPromises.push(plugin.register(data$$10, reason$$4)) + } + }.bind(this)); + return Promise$$1.group(registrationPromises) + }, startupPlugins:function(data$$11, reason$$5) { + var startupPromises = []; + for(var pluginName$$1 in this.plugins) { + var plugin$$1 = this.plugins[pluginName$$1]; + startupPromises.push(plugin$$1.startup(data$$11, reason$$5)) + }return Promise$$1.group(startupPromises) + }}; + exports$$5.catalog = new exports$$5.PluginCatalog +}); +define("pilot/oop", ["require", "exports", "module"], function(require$$7, exports$$6) { + exports$$6.inherits = function(ctor, superCtor) { + var tempCtor = function() { + }; + tempCtor.prototype = superCtor.prototype; + ctor.super_ = superCtor.prototype; + ctor.prototype = new tempCtor; + ctor.prototype.constructor = ctor + }; + exports$$6.mixin = function(obj$$2, mixin) { + for(var key in mixin) { + obj$$2[key] = mixin[key] + } + }; + exports$$6.implement = function(proto, mixin$$1) { + exports$$6.mixin(proto, mixin$$1) + } +}); +define("pilot/types", ["require", "exports", "module"], function(require$$8, exports$$7) { + function Conversion(value, status$$1, message, predictions) { + this.value = value; + this.status = status$$1 || Status.VALID; + this.message = message; + this.predictions = predictions || [] + } + function Type() { + } + function reconstituteType(name$$4, typeSpec) { + var type = types[name$$4]; + if(typeof type === "function") { + type = new type(typeSpec) + }return type + } + var Status = {VALID:{toString:function() { + return"VALID" + }, valueOf:function() { + return 0 + }}, INCOMPLETE:{toString:function() { + return"INCOMPLETE" + }, valueOf:function() { + return 1 + }}, INVALID:{toString:function() { + return"INVALID" + }, valueOf:function() { + return 2 + }}, combine:function() { + var combined = Status.VALID; + var i$$8 = 0; + for(;i$$8 < arguments;i$$8++) { + if(arguments[i$$8] > combined) { + combined = arguments[i$$8] + } + }return combined + }}; + exports$$7.Status = Status; + exports$$7.Conversion = Conversion; + Type.prototype = {stringify:function() { + throw new Error("not implemented"); + }, parse:function() { + throw new Error("not implemented"); + }, name:undefined, increment:function() { + return + }, decrement:function() { + return + }}; + exports$$7.Type = Type; + var types = {}; + exports$$7.registerType = function(type$$1) { + if(typeof type$$1 === "object") { + if(type$$1 instanceof Type) { + if(!type$$1.name) { + throw new Error("All registered types must have a name"); + }types[type$$1.name] = type$$1 + }else { + throw new Error("Can't registerType using: " + type$$1); + } + }else { + if(typeof type$$1 === "function") { + if(!type$$1.prototype.name) { + throw new Error("All registered types must have a name"); + }types[type$$1.prototype.name] = type$$1 + }else { + throw new Error("Unknown type: " + type$$1); + } + } + }; + exports$$7.deregisterType = function(type$$2) { + delete types[type$$2.name] + }; + exports$$7.getType = function(typeSpec$$1) { + if(typeof typeSpec$$1 === "string") { + return reconstituteType(typeSpec$$1, typeSpec$$1) + }if(typeof typeSpec$$1 == "object") { + if(!typeSpec$$1.name) { + throw new Error("Missing 'name' member to typeSpec"); + }return reconstituteType(typeSpec$$1.name, typeSpec$$1) + }throw new Error("Can't extract type from " + typeSpec$$1); + } +}); +define("pilot/event_emitter", ["require", "exports", "module"], function(require$$9, exports$$8) { + var EventEmitter = {}; + EventEmitter._dispatchEvent = function(eventName, e$$6) { + this._eventRegistry = this._eventRegistry || {}; + var listeners = this._eventRegistry[eventName]; + if(!listeners || !listeners.length) { + return + }e$$6 = e$$6 || {}; + e$$6.type = eventName; + var i$$9 = 0; + for(;i$$9 < listeners.length;i$$9++) { + listeners[i$$9](e$$6) + } + }; + EventEmitter.on = EventEmitter.addEventListener = function(eventName$$1, callback) { + this._eventRegistry = this._eventRegistry || {}; + var listeners$$1 = this._eventRegistry[eventName$$1]; + listeners$$1 || (listeners$$1 = this._eventRegistry[eventName$$1] = []); + listeners$$1.indexOf(callback) == -1 && listeners$$1.push(callback) + }; + EventEmitter.removeEventListener = function(eventName$$2, callback$$1) { + this._eventRegistry = this._eventRegistry || {}; + var listeners$$2 = this._eventRegistry[eventName$$2]; + if(!listeners$$2) { + return + }var index$$2 = listeners$$2.indexOf(callback$$1); + index$$2 !== -1 && listeners$$2.splice(index$$2, 1) + }; + exports$$8.EventEmitter = EventEmitter +}); +define("pilot/catalog", ["require", "exports", "module"], function(require$$10, exports$$9) { + var extensionSpecs = {}; + exports$$9.addExtensionSpec = function(extensionSpec) { + extensionSpecs[extensionSpec.name] = extensionSpec + }; + exports$$9.removeExtensionSpec = function(extensionSpec$$1) { + if(typeof extensionSpec$$1 === "string") { + delete extensionSpecs[extensionSpec$$1] + }else { + delete extensionSpecs[extensionSpec$$1.name] + } + }; + exports$$9.getExtensionSpec = function(name$$5) { + return extensionSpecs[name$$5] + }; + exports$$9.getExtensionSpecs = function() { + return Object.keys(extensionSpecs) + } +}); +define("pilot/settings", ["require", "exports", "module", "pilot/console", "pilot/oop", "pilot/types", "pilot/event_emitter", "pilot/catalog"], function(require$$11, exports$$10) { + function Setting(settingSpec, settings) { + this._settings = settings; + Object.keys(settingSpec).forEach(function(key$$1) { + this[key$$1] = settingSpec[key$$1] + }, this); + this.type = types$$1.getType(this.type); + if(this.type == null) { + throw new Error("In " + this.name + ": can't find type for: " + JSON.stringify(settingSpec.type)); + }if(!this.name) { + throw new Error("Setting.name == undefined. Ignoring.", this); + }if(!this.defaultValue === undefined) { + throw new Error("Setting.defaultValue == undefined", this); + }this.value = this.defaultValue + } + function Settings(persister) { + this._deactivated = {}; + this._settings = {}; + this._settingNames = []; + persister && this.setPersister(persister) + } + function CookiePersister() { + } + var console$$3 = require$$11("pilot/console"); + var oop = require$$11("pilot/oop"); + var types$$1 = require$$11("pilot/types"); + var EventEmitter$$1 = require$$11("pilot/event_emitter").EventEmitter; + var catalog = require$$11("pilot/catalog"); + var settingExtensionSpec = {name:"setting", description:"A setting is something that the application offers as a way to customize how it works", register:"env.settings.addSetting", indexOn:"name"}; + exports$$10.startup = function() { + catalog.addExtensionSpec(settingExtensionSpec) + }; + exports$$10.shutdown = function() { + catalog.removeExtensionSpec(settingExtensionSpec) + }; + Setting.prototype = {get:function() { + return this.value + }, set:function(value$$4) { + if(this.value === value$$4) { + return + }this.value = value$$4; + this._settings.persister && this._settings.persister.persistValue(this._settings, this.name, value$$4); + this._dispatchEvent("change", {setting:this, value:value$$4}) + }, resetValue:function() { + this.set(this.defaultValue) + }}; + oop.implement(Setting.prototype, EventEmitter$$1); + Settings.prototype = {addSetting:function(settingSpec$$1) { + var setting$$1 = new Setting(settingSpec$$1, this); + this._settings[setting$$1.name] = setting$$1; + this._settingNames.push(setting$$1.name); + this._settingNames.sort() + }, removeSetting:function(setting$$2) { + var name$$6 = typeof setting$$2 === "string" ? setting$$2 : setting$$2.name; + delete this._settings[name$$6]; + util.arrayRemove(this._settingNames, name$$6) + }, getSettingNames:function() { + return this._settingNames + }, getSetting:function(name$$7) { + return this._settings[name$$7] + }, setPersister:function(persister$$1) { + this._persister = persister$$1; + persister$$1 && persister$$1.loadInitialValues(this) + }, resetAll:function() { + this.getSettingNames().forEach(function(key$$2) { + this.resetValue(key$$2) + }, this) + }, _list:function() { + var reply = []; + this.getSettingNames().forEach(function(setting$$3) { + reply.push({key:setting$$3, value:this.getSetting(setting$$3).get()}) + }, this); + return reply + }, _loadDefaultValues:function() { + this._loadFromObject(this._getDefaultValues()) + }, _loadFromObject:function(data$$14) { + for(var key$$3 in data$$14) { + if(data$$14.hasOwnProperty(key$$3)) { + var setting$$4 = this._settings[key$$3]; + if(setting$$4) { + var value$$5 = setting$$4.type.parse(data$$14[key$$3]); + this.set(key$$3, value$$5) + }else { + this.set(key$$3, data$$14[key$$3]) + } + } + } + }, _saveToObject:function() { + return this.getSettingNames().map(function(key$$4) { + return this._settings[key$$4].type.stringify(this.get(key$$4)) + }.bind(this)) + }, _getDefaultValues:function() { + return this.getSettingNames().map(function(key$$5) { + return this._settings[key$$5].spec.defaultValue + }.bind(this)) + }}; + exports$$10.settings = new Settings; + CookiePersister.prototype = {loadInitialValues:function(settings$$1) { + settings$$1._loadDefaultValues(); + var data$$15 = cookie.get("settings"); + settings$$1._loadFromObject(JSON.parse(data$$15)) + }, persistValue:function(settings$$2) { + try { + var stringData = JSON.stringify(settings$$2._saveToObject()); + cookie.set("settings", stringData) + }catch(ex$$3) { + console$$3.error("Unable to JSONify the settings! " + ex$$3); + return + } + }}; + exports$$10.CookiePersister = CookiePersister +}); +define("pilot/environment", ["require", "exports", "module", "pilot/settings"], function(require$$12, exports$$11) { + function create() { + return{settings:settings$$3} + } + var settings$$3 = require$$12("pilot/settings").settings; + exports$$11.create = create +}); +define("pilot/types/basic", ["require", "exports", "module", "pilot/types"], function(require$$13, exports$$12) { + function SelectionType(typeSpec$$2) { + if(!Array.isArray(typeSpec$$2.data) && typeof typeSpec$$2.data !== "function") { + throw new Error("instances of SelectionType need typeSpec.data to be an array or function that returns an array:" + JSON.stringify(typeSpec$$2)); + }Object.keys(typeSpec$$2).forEach(function(key$$7) { + this[key$$7] = typeSpec$$2[key$$7] + }, this) + } + function DeferredType(typeSpec$$3) { + if(typeof typeSpec$$3.defer !== "function") { + throw new Error("Instances of DeferredType need typeSpec.defer to be a function that returns a type"); + }Object.keys(typeSpec$$3).forEach(function(key$$8) { + this[key$$8] = typeSpec$$3[key$$8] + }, this) + } + var types$$2 = require$$13("pilot/types"); + var Type$$1 = types$$2.Type; + var Conversion$$1 = types$$2.Conversion; + var Status$$1 = types$$2.Status; + var text = new Type$$1; + text.stringify = function(value$$7) { + return value$$7 + }; + text.parse = function(value$$8) { + if(typeof value$$8 != "string") { + throw new Error("non-string passed to text.parse()"); + }return new Conversion$$1(value$$8) + }; + text.name = "text"; + var number = new Type$$1; + number.stringify = function(value$$9) { + if(!value$$9) { + return null + }return"" + value$$9 + }; + number.parse = function(value$$10) { + if(typeof value$$10 != "string") { + throw new Error("non-string passed to number.parse()"); + }if(value$$10.replace(/\s/g, "").length === 0) { + return new Conversion$$1(null, Status$$1.INCOMPLETE, "") + }var reply$$1 = new Conversion$$1(parseInt(value$$10, 10)); + if(isNaN(reply$$1.value)) { + reply$$1.status = Status$$1.INVALID; + reply$$1.message = "Can't convert \"" + value$$10 + '" to a number.' + }return reply$$1 + }; + number.decrement = function(value$$11) { + return value$$11 - 1 + }; + number.increment = function(value$$12) { + return value$$12 + 1 + }; + number.name = "number"; + SelectionType.prototype = new Type$$1; + SelectionType.prototype.stringify = function(value$$13) { + return value$$13 + }; + SelectionType.prototype.parse = function(str$$1) { + if(typeof str$$1 != "string") { + throw new Error("non-string passed to parse()"); + }if(!this.data) { + throw new Error("Missing data on selection type extension."); + }var data$$16 = typeof this.data === "function" ? this.data() : this.data; + var hasMatched = false; + var matchedValue; + var completions = []; + data$$16.forEach(function(option) { + if(str$$1 == option) { + matchedValue = this.fromString(option); + hasMatched = true + }else { + option.indexOf(str$$1) === 0 && completions.push(this.fromString(option)) + } + }, this); + if(hasMatched) { + return new Conversion$$1(matchedValue) + }else { + this.noMatch && this.noMatch(); + if(completions.length > 0) { + var msg$$1 = "Possibilities" + (str$$1.length === 0 ? "" : " for '" + str$$1 + "'"); + return new Conversion$$1(null, Status$$1.INCOMPLETE, msg$$1, completions) + }else { + msg$$1 = "Can't use '" + str$$1 + "'."; + return new Conversion$$1(null, Status$$1.INVALID, msg$$1, completions) + } + } + }; + SelectionType.prototype.fromString = function(str$$2) { + return str$$2 + }; + SelectionType.prototype.decrement = function(value$$14) { + var data$$17 = typeof this.data === "function" ? this.data() : this.data; + var index$$3; + if(value$$14 == null) { + index$$3 = data$$17.length - 1 + }else { + var name$$8 = this.stringify(value$$14); + index$$3 = data$$17.indexOf(name$$8); + index$$3 = index$$3 === 0 ? data$$17.length - 1 : index$$3 - 1 + }return this.fromString(data$$17[index$$3]) + }; + SelectionType.prototype.increment = function(value$$15) { + var data$$18 = typeof this.data === "function" ? this.data() : this.data; + var index$$4; + if(value$$15 == null) { + index$$4 = 0 + }else { + var name$$9 = this.stringify(value$$15); + index$$4 = data$$18.indexOf(name$$9); + index$$4 = index$$4 === data$$18.length - 1 ? 0 : index$$4 + 1 + }return this.fromString(data$$18[index$$4]) + }; + SelectionType.prototype.name = "selection"; + exports$$12.SelectionType = SelectionType; + var bool = new SelectionType({name:"bool", data:["true", "false"], stringify:function(value$$16) { + return"" + value$$16 + }, fromString:function(str$$3) { + return str$$3 === "true" ? true : false + }}); + DeferredType.prototype = new Type$$1; + DeferredType.prototype.stringify = function(value$$17) { + return this.defer().stringify(value$$17) + }; + DeferredType.prototype.parse = function(value$$18) { + return this.defer().parse(value$$18) + }; + DeferredType.prototype.decrement = function(value$$19) { + var deferred = this.defer(); + return deferred.decrement ? deferred.decrement(value$$19) : undefined + }; + DeferredType.prototype.increment = function(value$$20) { + var deferred$$1 = this.defer(); + return deferred$$1.increment ? deferred$$1.increment(value$$20) : undefined + }; + DeferredType.prototype.name = "deferred"; + exports$$12.DeferredType = DeferredType; + exports$$12.startup = function() { + types$$2.registerType(text); + types$$2.registerType(number); + types$$2.registerType(bool); + types$$2.registerType(SelectionType); + types$$2.registerType(DeferredType) + }; + exports$$12.shutdown = function() { + types$$2.unregisterType(text); + types$$2.unregisterType(number); + types$$2.unregisterType(bool); + types$$2.unregisterType(SelectionType); + types$$2.unregisterType(DeferredType) + } +}); +define("pilot/lang", ["require", "exports", "module"], function(require$$14, exports$$13) { + exports$$13.stringReverse = function(string) { + return string.split("").reverse().join("") + }; + exports$$13.stringRepeat = function(string$$1, count) { + return(new Array(count + 1)).join(string$$1) + }; + exports$$13.copyObject = function(obj$$3) { + var copy = {}; + for(var key$$9 in obj$$3) { + copy[key$$9] = obj$$3[key$$9] + }return copy + }; + exports$$13.arrayToMap = function(arr) { + var map = {}; + var i$$10 = 0; + for(;i$$10 < arr.length;i$$10++) { + map[arr[i$$10]] = 1 + }return map + }; + exports$$13.arrayRemove = function(array, value$$21) { + var i$$11 = 0; + for(;i$$11 <= array.length;i$$11++) { + value$$21 === array[i$$11] && array.splice(i$$11, 1) + } + }; + exports$$13.escapeRegExp = function(str$$4) { + return str$$4.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1") + }; + exports$$13.deferredCall = function(fcn) { + var timer = null; + var callback$$2 = function() { + timer = null; + fcn() + }; + return{schedule:function() { + timer || (timer = setTimeout(callback$$2, 0)) + }, call:function() { + this.cancel(); + fcn() + }, cancel:function() { + clearTimeout(timer); + timer = null + }} + } +}); +define("pilot/canon", ["require", "exports", "module", "pilot/console", "pilot/stacktrace", "pilot/oop", "pilot/event_emitter", "pilot/catalog", "pilot/types", "pilot/types", "pilot/lang"], function(require$$15, exports$$14) { + function addCommand(command) { + if(!command.name) { + throw new Error("All registered commands must have a name"); + }if(command.params == null) { + command.params = [] + }if(!Array.isArray(command.params)) { + throw new Error("command.params must be an array in " + command.name); + }command.params.forEach(function(param) { + if(!param.name) { + throw new Error("In " + command.name + ": all params must have a name"); + }upgradeType(command.name, param) + }, this); + commands[command.name] = command; + commandNames.push(command.name); + commandNames.sort() + } + function upgradeType(name$$10, param$$1) { + var lookup = param$$1.type; + param$$1.type = types$$3.getType(lookup); + if(param$$1.type == null) { + throw new Error("In " + name$$10 + "/" + param$$1.name + ": can't find type for: " + JSON.stringify(lookup)); + } + } + function removeCommand(command$$1) { + var name$$11 = typeof command$$1 === "string" ? command$$1 : command$$1.name; + delete commands[name$$11]; + lang.arrayRemove(commandNames, name$$11) + } + function getCommand(name$$12) { + return commands[name$$12] + } + function getCommandNames() { + return commandNames + } + function exec(command$$2, env, args$$4, typed) { + if(typeof command$$2 === "string") { + command$$2 = commands[command$$2] + }if(!command$$2) { + return false + }var request = new Request({command:command$$2, args:args$$4, typed:typed}); + command$$2.exec(env, args$$4 || {}, request); + return true + } + function Request(options) { + options = options || {}; + this.command = options.command; + this.args = options.args; + this.typed = options.typed; + this._begunOutput = false; + this.start = new Date; + this.end = null; + this.completed = false; + this.error = false + } + require$$15("pilot/console"); + require$$15("pilot/stacktrace").Trace; + var oop$$1 = require$$15("pilot/oop"); + var EventEmitter$$2 = require$$15("pilot/event_emitter").EventEmitter; + var catalog$$1 = require$$15("pilot/catalog"); + require$$15("pilot/types").Status; + var types$$3 = require$$15("pilot/types"); + var lang = require$$15("pilot/lang"); + var commandExtensionSpec = {name:"command", description:"A command is a bit of functionality with optional typed arguments which can do something small like moving the cursor around the screen, or large like cloning a project from VCS.", indexOn:"name"}; + exports$$14.startup = function() { + catalog$$1.addExtensionSpec(commandExtensionSpec) + }; + exports$$14.shutdown = function() { + catalog$$1.removeExtensionSpec(commandExtensionSpec) + }; + var commands = {}; + var commandNames = []; + exports$$14.removeCommand = removeCommand; + exports$$14.addCommand = addCommand; + exports$$14.getCommand = getCommand; + exports$$14.getCommandNames = getCommandNames; + exports$$14.exec = exec; + exports$$14.upgradeType = upgradeType; + oop$$1.implement(exports$$14, EventEmitter$$2); + var requests = []; + var maxRequestLength = 100; + oop$$1.implement(Request.prototype, EventEmitter$$2); + Request.prototype._beginOutput = function() { + this._begunOutput = true; + this.outputs = []; + requests.push(this); + for(;requests.length > maxRequestLength;) { + requests.shiftObject() + }exports$$14._dispatchEvent("output", {requests:requests, request:this}) + }; + Request.prototype.doneWithError = function(content) { + this.error = true; + this.done(content) + }; + Request.prototype.async = function() { + this._begunOutput || this._beginOutput() + }; + Request.prototype.output = function(content$$1) { + this._begunOutput || this._beginOutput(); + if(typeof content$$1 !== "string" && !(content$$1 instanceof Node)) { + content$$1 = content$$1.toString() + }this.outputs.push(content$$1); + this._dispatchEvent("output", {}); + return this + }; + Request.prototype.done = function(content$$2) { + this.completed = true; + this.end = new Date; + this.duration = this.end.getTime() - this.start.getTime(); + content$$2 && this.output(content$$2); + this._dispatchEvent("output", {}) + }; + exports$$14.Request = Request +}); +define("pilot/types/command", ["require", "exports", "module", "pilot/canon", "pilot/types/basic", "pilot/types"], function(require$$16, exports$$15) { + var canon = require$$16("pilot/canon"); + var SelectionType$$1 = require$$16("pilot/types/basic").SelectionType; + var types$$4 = require$$16("pilot/types"); + var command$$3 = new SelectionType$$1({name:"command", data:function() { + return canon.getCommandNames() + }, stringify:function(command$$4) { + return command$$4.name + }, fromString:function(str$$5) { + return canon.getCommand(str$$5) + }}); + exports$$15.startup = function() { + types$$4.registerType(command$$3) + }; + exports$$15.shutdown = function() { + types$$4.unregisterType(command$$3) + } +}); +define("pilot/types/settings", ["require", "exports", "module", "pilot/types/basic", "pilot/types/basic", "pilot/types", "pilot/settings"], function(require$$17, exports$$16) { + var SelectionType$$2 = require$$17("pilot/types/basic").SelectionType; + var DeferredType$$1 = require$$17("pilot/types/basic").DeferredType; + var types$$5 = require$$17("pilot/types"); + var settings$$4 = require$$17("pilot/settings").settings; + var lastSetting; + var setting$$5 = new SelectionType$$2({name:"setting", data:function() { + return env$$2.settings.getSettingNames() + }, stringify:function(setting$$6) { + lastSetting = setting$$6; + return setting$$6.name + }, fromString:function(str$$6) { + lastSetting = settings$$4.getSetting(str$$6); + return lastSetting + }, noMatch:function() { + lastSetting = null + }}); + var settingValue = new DeferredType$$1({name:"settingValue", defer:function() { + return lastSetting ? lastSetting.type : types$$5.getType("text") + }}); + var env$$2; + exports$$16.startup = function(data$$21) { + env$$2 = data$$21.env; + types$$5.registerType(setting$$5); + types$$5.registerType(settingValue) + }; + exports$$16.shutdown = function() { + types$$5.unregisterType(setting$$5); + types$$5.unregisterType(settingValue) + } +}); +define("pilot/commands/settings", ["require", "exports", "module", "pilot/canon"], function(require$$18, exports$$17) { + var setCommandSpec = {name:"set", params:[{name:"setting", type:"setting", description:"The name of the setting to display or alter", defaultValue:null}, {name:"value", type:"settingValue", description:"The new value for the chosen setting", defaultValue:null}], description:"define and show settings", exec:function(env$$3, args$$6, request$$2) { + var html; + if(args$$6.setting) { + if(args$$6.value === undefined) { + html = "" + setting.name + " = " + setting.get() + }else { + args$$6.setting.set(args$$6.value); + html = "Setting: " + args$$6.setting.name + " = " + args$$6.setting.get() + } + }else { + var names = env$$3.settings.getSettingNames(); + html = ""; + names.sort(function(name1, name2) { + return name1.localeCompare(name2) + }); + names.forEach(function(name$$13) { + var setting$$7 = env$$3.settings.getSetting(name$$13); + var url$$3 = "https://wiki.mozilla.org/Labs/Skywriter/Settings#" + setting$$7.name; + html += '' + setting$$7.name + " = " + setting$$7.value + "
" + }) + }request$$2.done(html) + }}; + var unsetCommandSpec = {name:"unset", params:[{name:"setting", type:"setting", description:"The name of the setting to return to defaults"}], description:"unset a setting entirely", exec:function(env$$4, args$$7, request$$3) { + var setting$$8 = env$$4.settings.get(args$$7.setting); + if(!setting$$8) { + request$$3.doneWithError("No setting with the name " + args$$7.setting + "."); + return + }setting$$8.reset(); + request$$3.done("Reset " + setting$$8.name + " to default: " + env$$4.settings.get(args$$7.setting)) + }}; + var canon$$1 = require$$18("pilot/canon"); + exports$$17.startup = function() { + canon$$1.addCommand(setCommandSpec); + canon$$1.addCommand(unsetCommandSpec) + }; + exports$$17.shutdown = function() { + canon$$1.removeCommand(setCommandSpec); + canon$$1.removeCommand(unsetCommandSpec) + } +}); +define("pilot/typecheck", ["require", "exports", "module"], function(require$$19, exports$$18) { + var objectToString = Object.prototype.toString; + exports$$18.isString = function(it) { + return it && objectToString.call(it) === "[object String]" + }; + exports$$18.isBoolean = function(it$$1) { + return it$$1 && objectToString.call(it$$1) === "[object Boolean]" + }; + exports$$18.isNumber = function(it$$2) { + return it$$2 && objectToString.call(it$$2) === "[object Number]" && isFinite(it$$2) + }; + exports$$18.isObject = function(it$$3) { + return it$$3 !== undefined && (it$$3 === null || typeof it$$3 == "object" || Array.isArray(it$$3) || exports$$18.isFunction(it$$3)) + }; + exports$$18.isFunction = function(it$$4) { + return it$$4 && objectToString.call(it$$4) === "[object Function]" + } +}); +define("pilot/commands/basic", ["require", "exports", "module", "pilot/typecheck", "pilot/canon", "pilot/canon"], function(require$$20, exports$$19) { + var checks = require$$20("pilot/typecheck"); + var canon$$2 = require$$20("pilot/canon"); + var helpMessages = {plainPrefix:'

Welcome to Skywriter - Code in the Cloud

', + plainSuffix:'For more information, see the Skywriter Wiki.'}; + var helpCommandSpec = {name:"help", params:[{name:"search", type:"text", description:"Search string to narrow the output.", defaultValue:null}], description:"Get help on the available commands.", exec:function(env$$5, args$$8, request$$4) { + var output = []; + var command$$5 = canon$$2.getCommand(args$$8.search); + if(command$$5 && command$$5.exec) { + output.push(command$$5.description ? command$$5.description : "No description for " + args$$8.search) + }else { + var showHidden = false; + !args$$8.search && helpMessages.plainPrefix && output.push(helpMessages.plainPrefix); + if(command$$5) { + output.push("

Sub-Commands of " + command$$5.name + "

"); + output.push("

" + command$$5.description + "

") + }else { + if(args$$8.search) { + if(args$$8.search == "hidden") { + args$$8.search = ""; + showHidden = true + }output.push("

Commands starting with '" + args$$8.search + "':

") + }else { + output.push("

Available Commands:

") + } + }var commandNames$$1 = canon$$2.getCommandNames(); + commandNames$$1.sort(); + output.push(""); + var i$$12 = 0; + for(;i$$12 < commandNames$$1.length;i$$12++) { + command$$5 = canon$$2.getCommand(commandNames$$1[i$$12]); + if(!showHidden && command$$5.hidden) { + continue + }if(command$$5.description === undefined) { + continue + }if(args$$8.search && command$$5.name.indexOf(args$$8.search) !== 0) { + continue + }if(!args$$8.search && command$$5.name.indexOf(" ") != -1) { + continue + }if(command$$5 && command$$5.name == args$$8.search) { + continue + }output.push(""); + output.push('"); + output.push(""); + output.push("") + }output.push("
' + command$$5.name + "" + command$$5.description + "
"); + !args$$8.search && helpMessages.plainSuffix && output.push(helpMessages.plainSuffix) + }request$$4.done(output.join("")) + }}; + var evalCommandSpec = {name:"eval", params:[{name:"javascript", type:"text", description:"The JavaScript to evaluate"}], description:"evals given js code and show the result", hidden:true, exec:function(env$$6, args$$9, request$$5) { + var result; + var javascript = args$$9.javascript; + try { + result = eval(javascript) + }catch(e$$7) { + result = "Error: " + e$$7.message + "" + }var msg$$2 = ""; + var type$$3 = ""; + var x; + if(checks.isFunction(result)) { + msg$$2 = (result + "").replace(/\n/g, "
").replace(/ /g, " "); + type$$3 = "function" + }else { + if(checks.isObject(result)) { + type$$3 = Array.isArray(result) ? "array" : "object"; + var items = []; + var value$$22; + for(x in result) { + if(result.hasOwnProperty(x)) { + value$$22 = checks.isFunction(result[x]) ? "[function]" : checks.isObject(result[x]) ? "[object]" : result[x]; + items.push({name:x, value:value$$22}) + } + }items.sort(function(a, b) { + return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1 + }); + x = 0; + for(;x < items.length;x++) { + msg$$2 += "" + items[x].name + ": " + items[x].value + "
" + } + }else { + msg$$2 = result; + type$$3 = typeof result + } + }request$$5.done("Result for eval '" + javascript + "' (type: " + type$$3 + "):

" + msg$$2) + }}; + var skywriterCommandSpec = {name:"skywriter", hidden:true, exec:function(env$$8, args$$11, request$$7) { + var index$$5 = Math.floor(Math.random() * messages.length); + request$$7.done("Skywriter " + messages[index$$5]) + }}; + var messages = ["really wants you to trick it out in some way.", "is your Web editor.", "would love to be like Emacs on the Web.", "is written on the Web platform, so you can tweak it."]; + canon$$2 = require$$20("pilot/canon"); + exports$$19.startup = function() { + canon$$2.addCommand(helpCommandSpec); + canon$$2.addCommand(evalCommandSpec); + canon$$2.addCommand(skywriterCommandSpec) + }; + exports$$19.shutdown = function() { + canon$$2.removeCommand(helpCommandSpec); + canon$$2.removeCommand(evalCommandSpec); + canon$$2.removeCommand(skywriterCommandSpec) + } +}); +define("pilot/settings/canon", ["require", "exports", "module"], function(require$$21, exports$$20) { + var historyLengthSetting = {name:"historyLength", description:"How many typed commands do we recall for reference?", type:"number", defaultValue:50}; + exports$$20.startup = function(data$$27) { + data$$27.env.settings.addSetting(historyLengthSetting) + }; + exports$$20.shutdown = function(data$$28) { + data$$28.env.settings.removeSetting(historyLengthSetting) + } +}); +define("pilot/index", ["require", "exports", "module", "pilot/fixoldbrowsers", "pilot/types/basic", "pilot/types/command", "pilot/types/settings", "pilot/commands/settings", "pilot/commands/basic", "pilot/settings/canon", "pilot/canon"], function(require$$22, exports$$21) { + var deps = [require$$22("pilot/fixoldbrowsers"), require$$22("pilot/types/basic"), require$$22("pilot/types/command"), require$$22("pilot/types/settings"), require$$22("pilot/commands/settings"), require$$22("pilot/commands/basic"), require$$22("pilot/settings/canon"), require$$22("pilot/canon")]; + exports$$21.startup = function(data$$29, reason$$18) { + deps.forEach(function(module$$22) { + typeof module$$22.startup === "function" && module$$22.startup(data$$29, reason$$18) + }) + } +}); +define("cockpit/cli", ["require", "exports", "module", "pilot/console", "pilot/lang", "pilot/oop", "pilot/event_emitter", "pilot/types", "pilot/types", "pilot/types", "pilot/canon"], function(require$$23, exports$$22) { + function Hint(status$$2, message$$1, start, end, predictions$$1) { + this.status = status$$2; + this.message = message$$1; + if(typeof start === "number") { + this.start = start; + this.end = end; + this.predictions = predictions$$1 + }else { + var arg = start; + this.start = arg.start; + this.end = arg.end; + this.predictions = arg.predictions + } + } + function ConversionHint(conversion, arg$$1) { + this.status = conversion.status; + this.message = conversion.message; + if(arg$$1) { + this.start = arg$$1.start; + this.end = arg$$1.end + }else { + this.start = 0; + this.end = 0 + }this.predictions = conversion.predictions + } + function Argument(emitter, text$$1, start$$1, end$$1, priorSpace) { + this.emitter = emitter; + this.setText(text$$1); + this.start = start$$1; + this.end = end$$1; + this.priorSpace = priorSpace + } + function Assignment(param$$2, requisition) { + this.param = param$$2; + this.requisition = requisition; + this.setValue(param$$2.defaultValue) + } + function Requisition(env$$9) { + this.env = env$$9; + this.commandAssignment = new Assignment(commandParam, this) + } + function CliRequisition(env$$10, options$$1) { + Requisition.call(this, env$$10); + if(options$$1 && options$$1.flags) { + this.flags = options$$1.flags + } + } + require$$23("pilot/console"); + var lang$$1 = require$$23("pilot/lang"); + var oop$$2 = require$$23("pilot/oop"); + var EventEmitter$$3 = require$$23("pilot/event_emitter").EventEmitter; + require$$23("pilot/types"); + var Status$$3 = require$$23("pilot/types").Status; + require$$23("pilot/types").Conversion; + var canon$$3 = require$$23("pilot/canon"); + exports$$22.startup = function() { + canon$$3.upgradeType("command", commandParam) + }; + Hint.prototype = {}; + Hint.sort = function(hints, cursor) { + cursor !== undefined && hints.forEach(function(hint) { + hint.distance = hint.start === Argument.AT_CURSOR ? 0 : cursor < hint.start ? hint.start - cursor : cursor > hint.end ? cursor - hint.end : 0 + }, this); + hints.sort(function(hint1, hint2) { + if(cursor !== undefined) { + var diff = hint1.distance - hint2.distance; + if(diff != 0) { + return diff + } + }return hint2.status - hint1.status + }); + cursor !== undefined && hints.forEach(function(hint$$1) { + delete hint$$1.distance + }, this); + return hints + }; + exports$$22.Hint = Hint; + oop$$2.inherits(ConversionHint, Hint); + Argument.prototype = {merge:function(following) { + if(following.emitter != this.emitter) { + throw new Error("Can't merge Arguments from different EventEmitters"); + }return new Argument(this.emitter, this.text + following.priorSpace + following.text, this.start, following.end, this.priorSpace) + }, setText:function(text$$2) { + if(text$$2 == null) { + throw new Error("Illegal text for Argument: " + text$$2); + }var ev = {argument:this, oldText:this.text, text:text$$2}; + this.text = text$$2; + this.emitter._dispatchEvent("argumentChange", ev) + }, toString:function() { + return this.priorSpace + this.text + }}; + Argument.merge = function(argArray, start$$2, end$$2) { + start$$2 = start$$2 === undefined ? 0 : start$$2; + end$$2 = end$$2 === undefined ? argArray.length : end$$2; + var joined; + var i$$13 = start$$2; + for(;i$$13 < end$$2;i$$13++) { + var arg$$2 = argArray[i$$13]; + if(joined) { + joined = joined.merge(arg$$2) + }else { + joined = arg$$2 + } + }return joined + }; + Argument.AT_CURSOR = -1; + Assignment.prototype = {param:undefined, conversion:undefined, value:undefined, arg:undefined, value:undefined, setValue:function(value$$23) { + if(this.value === value$$23) { + return + }if(value$$23 === undefined) { + value$$23 = this.param.defaultValue; + this.arg = undefined + }this.value = value$$23; + var text$$3 = value$$23 == null ? "" : this.param.type.stringify(value$$23); + this.arg && this.arg.setText(text$$3); + this.conversion = undefined; + this.requisition._assignmentChanged(this) + }, arg:undefined, setArgument:function(arg$$3) { + if(this.arg === arg$$3) { + return + }this.arg = arg$$3; + this.conversion = this.param.type.parse(arg$$3.text); + this.conversion.arg = arg$$3; + this.value = this.conversion.value; + this.requisition._assignmentChanged(this) + }, getHint:function() { + if(this.param.getCustomHint && this.value && this.arg) { + var hint$$2 = this.param.getCustomHint(this.value, this.arg); + if(hint$$2) { + return hint$$2 + } + }var message$$2 = "" + this.param.name + ": "; + if(this.param.description) { + message$$2 += this.param.description.trim(); + if(message$$2.charAt(message$$2.length - 1) !== ".") { + message$$2 += "." + }if(message$$2.charAt(message$$2.length - 1) !== " ") { + message$$2 += " " + } + }var status$$3 = Status$$3.VALID; + var start$$3 = this.arg ? this.arg.start : Argument.AT_CURSOR; + var end$$3 = this.arg ? this.arg.end : Argument.AT_CURSOR; + var predictions$$2; + if(this.conversion) { + status$$3 = this.conversion.status; + if(this.conversion.message) { + message$$2 += this.conversion.message + }predictions$$2 = this.conversion.predictions + }var argProvided = this.arg && this.arg.text !== ""; + var dataProvided = this.value !== undefined || argProvided; + if(this.param.defaultValue === undefined && !dataProvided) { + status$$3 = Status$$3.INVALID; + message$$2 += "Required" + }return new Hint(status$$3, message$$2, start$$3, end$$3, predictions$$2) + }, complete:function() { + this.conversion && this.conversion.predictions && this.conversion.predictions.length > 0 && this.setValue(this.conversion.predictions[0]) + }, decrement:function() { + var replacement = this.param.type.decrement(this.value); + replacement != null && this.setValue(replacement) + }, increment:function() { + var replacement$$1 = this.param.type.increment(this.value); + replacement$$1 != null && this.setValue(replacement$$1) + }, toString:function() { + return this.arg ? this.arg.toString() : "" + }}; + exports$$22.Assignment = Assignment; + var commandParam = {name:"command", type:"command", description:"The command to execute", getCustomHint:function(command$$6, arg$$4) { + var docs = []; + docs.push(" > "); + docs.push(command$$6.name); + command$$6.params && command$$6.params.length > 0 && command$$6.params.forEach(function(param$$3) { + param$$3.defaultValue === undefined ? docs.push(" [" + param$$3.name + "]") : docs.push(" [" + param$$3.name + "]") + }, this); + docs.push("
"); + docs.push(command$$6.description ? command$$6.description : "(No description)"); + docs.push("
"); + if(command$$6.params && command$$6.params.length > 0) { + docs.push("
    "); + command$$6.params.forEach(function(param$$4) { + docs.push("
  • "); + docs.push("" + param$$4.name + ": "); + docs.push(param$$4.description ? param$$4.description : "(No description)"); + if(param$$4.defaultValue === undefined) { + docs.push(" [Required]") + }else { + param$$4.defaultValue === null ? docs.push(" [Optional]") : docs.push(" [Default: " + param$$4.defaultValue + "]") + }docs.push("
  • ") + }, this); + docs.push("
") + }return new Hint(Status$$3.VALID, docs.join(""), arg$$4) + }}; + Requisition.prototype = {commandAssignment:undefined, assignmentCount:undefined, _assignments:undefined, _hints:undefined, _assignmentChanged:function(assignment) { + if(assignment.param.name !== "command") { + return + }this._assignments = {}; + assignment.value && assignment.value.params.forEach(function(param$$5) { + this._assignments[param$$5.name] = new Assignment(param$$5, this) + }, this); + this.assignmentCount = Object.keys(this._assignments).length; + this._dispatchEvent("commandChange", {command:assignment.value}) + }, getAssignment:function(nameOrNumber) { + var name$$14 = typeof nameOrNumber === "string" ? nameOrNumber : Object.keys(this._assignments)[nameOrNumber]; + return this._assignments[name$$14] + }, getParameterNames:function() { + return Object.keys(this._assignments) + }, cloneAssignments:function() { + return Object.keys(this._assignments).map(function(name$$15) { + return this._assignments[name$$15] + }, this) + }, _updateHints:function() { + this._hints.push(this.commandAssignment.getHint()); + Object.keys(this._assignments).map(function(name$$16) { + var assignment$$1 = this._assignments[name$$16]; + assignment$$1.arg && this._hints.push(assignment$$1.getHint()) + }, this); + Hint.sort(this._hints) + }, getWorstHint:function() { + return this._hints[0] + }, getArgs:function() { + var args$$12 = {}; + Object.keys(this._assignments).forEach(function(name$$17) { + args$$12[name$$17] = this.getAssignment(name$$17).value + }, this); + return args$$12 + }, setDefaultValues:function() { + Object.keys(this._assignments).forEach(function(name$$18) { + this._assignments[name$$18].setValue(undefined) + }, this) + }, exec:function() { + var command$$7 = this.commandAssignment.value; + canon$$3.exec(command$$7, this.env, this.getArgs(), this.toCanonicalString()) + }, toCanonicalString:function() { + var line$$1 = []; + line$$1.push(this.commandAssignment.value.name); + Object.keys(this._assignments).forEach(function(name$$19) { + var assignment$$2 = this._assignments[name$$19]; + var type$$4 = assignment$$2.param.type; + if(assignment$$2.value !== assignment$$2.param.defaultValue) { + line$$1.push(" "); + line$$1.push(type$$4.stringify(assignment$$2.value)) + } + }, this); + return line$$1.join("") + }}; + oop$$2.implement(Requisition.prototype, EventEmitter$$3); + exports$$22.Requisition = Requisition; + oop$$2.inherits(CliRequisition, Requisition); + (function() { + CliRequisition.prototype.update = function(input) { + this.input = input; + this._hints = []; + var args$$13 = this._tokenize(input.typed); + this._split(args$$13); + this.commandAssignment.value && this._assign(args$$13); + this._updateHints() + }; + CliRequisition.prototype.getInputStatusMarkup = function() { + var scores = this.toString().split("").map(function() { + return Status$$3.VALID + }); + this._hints.forEach(function(hint$$3) { + var i$$14 = hint$$3.start; + for(;i$$14 <= hint$$3.end;i$$14++) { + if(hint$$3.status > scores[i$$14]) { + scores[i$$14] = hint$$3.status + } + } + }, this); + return scores + }; + CliRequisition.prototype.toString = function() { + var parts = Object.keys(this._assignments).map(function(name$$20) { + return this._assignments[name$$20].toString() + }, this); + parts.unshift(this.commandAssignment.toString()); + return parts.join("") + }; + var superUpdateHints = CliRequisition.prototype._updateHints; + CliRequisition.prototype._updateHints = function() { + superUpdateHints.call(this); + var c = this.input.cursor; + this._hints.forEach(function(hint$$4) { + var startInHint = c.start >= hint$$4.start && c.start <= hint$$4.end; + var endInHint = c.end >= hint$$4.start && c.end <= hint$$4.end; + var inHint = startInHint || endInHint; + if(!inHint && hint$$4.status === Status$$3.INCOMPLETE) { + hint$$4.status = Status$$3.INVALID + } + }, this); + Hint.sort(this._hints) + }; + CliRequisition.prototype.getHints = function() { + return this._hints + }; + CliRequisition.prototype.getAssignmentAt = function(position) { + var arg$$5 = this.commandAssignment.arg; + if(arg$$5 && position <= arg$$5.end) { + return this.commandAssignment + }var names$$1 = Object.keys(this._assignments); + var i$$15 = 0; + for(;i$$15 < names$$1.length;i$$15++) { + var assignment$$3 = this._assignments[names$$1[i$$15]]; + if(assignment$$3.arg && position <= assignment$$3.arg.end) { + return assignment$$3 + } + }throw new Error("position (" + position + ") is off end of requisition (" + this.toString() + ")"); + }; + CliRequisition.prototype._tokenize = function(typed$$1) { + function unescape(str$$8) { + return str$$8.replace(/\uF000/g, " ").replace(/\uF001/g, "'").replace(/\uF002/g, '"') + } + if(typed$$1 == null || typed$$1.length === 0) { + return[new Argument(this, "", 0, 0, "")] + }var OUTSIDE = 1; + var IN_SIMPLE = 2; + var IN_SINGLE_Q = 3; + var IN_DOUBLE_Q = 4; + var mode$$1 = OUTSIDE; + typed$$1 = typed$$1.replace(/\\\\/g, "\\").replace(/\\b/g, "\u0008").replace(/\\f/g, "\u000c").replace(/\\n/g, "\n").replace(/\\r/g, "\r").replace(/\\t/g, "\t").replace(/\\v/g, "\u000b").replace(/\\n/g, "\n").replace(/\\r/g, "\r").replace(/\\ /g, "\uf000").replace(/\\'/g, "\uf001").replace(/\\"/g, "\uf002"); + var i$$16 = 0; + var start$$4 = 0; + var priorSpace$$1 = ""; + var args$$14 = []; + for(;;) { + if(i$$16 >= typed$$1.length) { + if(mode$$1 !== OUTSIDE) { + var str$$7 = unescape(typed$$1.substring(start$$4, i$$16)); + args$$14.push(new Argument(this, str$$7, start$$4, i$$16, priorSpace$$1)) + }else { + if(i$$16 !== start$$4) { + priorSpace$$1 = typed$$1.substring(start$$4, i$$16); + args$$14.push(new Argument(this, "", i$$16, i$$16, priorSpace$$1)) + } + }break + }var c$$1 = typed$$1[i$$16]; + switch(mode$$1) { + case OUTSIDE: + if(c$$1 === "'") { + priorSpace$$1 = typed$$1.substring(start$$4, i$$16); + mode$$1 = IN_SINGLE_Q; + start$$4 = i$$16 + 1 + }else { + if(c$$1 === '"') { + priorSpace$$1 = typed$$1.substring(start$$4, i$$16); + mode$$1 = IN_DOUBLE_Q; + start$$4 = i$$16 + 1 + }else { + if(!/ /.test(c$$1)) { + priorSpace$$1 = typed$$1.substring(start$$4, i$$16); + mode$$1 = IN_SIMPLE; + start$$4 = i$$16 + } + } + }break; + case IN_SIMPLE: + if(c$$1 === " ") { + str$$7 = unescape(typed$$1.substring(start$$4, i$$16)); + args$$14.push(new Argument(this, str$$7, start$$4, i$$16, priorSpace$$1)); + mode$$1 = OUTSIDE; + start$$4 = i$$16; + priorSpace$$1 = "" + }break; + case IN_SINGLE_Q: + if(c$$1 === "'") { + str$$7 = unescape(typed$$1.substring(start$$4, i$$16)); + args$$14.push(new Argument(this, str$$7, start$$4, i$$16, priorSpace$$1)); + mode$$1 = OUTSIDE; + start$$4 = i$$16 + 1; + priorSpace$$1 = "" + }break; + case IN_DOUBLE_Q: + if(c$$1 === '"') { + str$$7 = unescape(typed$$1.substring(start$$4, i$$16)); + args$$14.push(new Argument(this, str$$7, start$$4, i$$16, priorSpace$$1)); + mode$$1 = OUTSIDE; + start$$4 = i$$16 + 1; + priorSpace$$1 = "" + }break + } + i$$16++ + }return args$$14 + }; + CliRequisition.prototype._split = function(args$$15) { + var argsUsed = 1; + var arg$$6; + for(;argsUsed <= args$$15.length;) { + arg$$6 = Argument.merge(args$$15, 0, argsUsed); + this.commandAssignment.setArgument(arg$$6); + if(!this.commandAssignment.value) { + break + }if(this.commandAssignment.value.exec) { + var i$$17 = 0; + for(;i$$17 < argsUsed;i$$17++) { + args$$15.shift() + }break + }argsUsed++ + }return + }; + CliRequisition.prototype._assign = function(args$$16) { + if(args$$16.length === 0) { + this.setDefaultValues(); + return + }if(this.assignmentCount === 0) { + this._hints.push(new Hint(Status$$3.INVALID, this.commandAssignment.value.name + " does not take any parameters", Argument.merge(args$$16))); + return + }if(this.assignmentCount === 1) { + var assignment$$4 = this.getAssignment(0); + if(assignment$$4.param.type.name === "text") { + assignment$$4.setArgument(Argument.merge(args$$16)); + return + } + }var assignments = this.cloneAssignments(); + var names$$2 = this.getParameterNames(); + assignments.forEach(function(assignment$$5) { + var namedArgText = "--" + assignment$$5.name; + var i$$18 = 0; + for(;;) { + var arg$$7 = args$$16[i$$18]; + if(namedArgText !== arg$$7.text) { + i$$18++; + if(i$$18 >= args$$16.length) { + break + }continue + }if(assignment$$5.param.type.name === "boolean") { + assignment$$5.setValue(true) + }else { + if(i$$18 + 1 < args$$16.length) { + this._hints.push(new Hint(Status$$3.INCOMPLETE, "Missing value for: " + namedArgText, args$$16[i$$18])) + }else { + args$$16.splice(i$$18 + 1, 1); + assignment$$5.setArgument(args$$16[i$$18 + 1]) + } + }lang$$1.arrayRemove(names$$2, assignment$$5.name); + args$$16.splice(i$$18, 1) + } + }, this); + names$$2.forEach(function(name$$21) { + var assignment$$6 = this.getAssignment(name$$21); + if(args$$16.length === 0) { + assignment$$6.setValue(undefined) + }else { + var arg$$8 = args$$16[0]; + args$$16.splice(0, 1); + assignment$$6.setArgument(arg$$8) + } + }, this); + if(args$$16.length > 0) { + var remaining = Argument.merge(args$$16); + this._hints.push(new Hint(Status$$3.INVALID, "Input '" + remaining.text + "' makes no sense.", remaining)) + } + } + })(); + exports$$22.CliRequisition = CliRequisition +}); +define("cockpit/test/assert", ["require", "exports", "module"], function(require$$24, exports$$23) { + var test = {success:function(message$$3) { + console.log(message$$3) + }, fail:function() { + test._recordThrow("fail", arguments) + }, assertTrue:function(value$$24) { + value$$24 || test._recordThrow("assertTrue", arguments) + }, verifyTrue:function(value$$25) { + value$$25 || test._recordTrace("verifyTrue", arguments) + }, assertFalse:function(value$$26) { + value$$26 && test._recordThrow("assertFalse", arguments) + }, verifyFalse:function(value$$27) { + value$$27 && test._recordTrace("verifyFalse", arguments) + }, assertNull:function(value$$28) { + value$$28 !== null && test._recordThrow("assertNull", arguments) + }, verifyNull:function(value$$29) { + value$$29 !== null && test._recordTrace("verifyNull", arguments) + }, assertNotNull:function(value$$30) { + value$$30 === null && test._recordThrow("assertNotNull", arguments) + }, verifyNotNull:function(value$$31) { + value$$31 === null && test._recordTrace("verifyNotNull", arguments) + }, assertUndefined:function(value$$32) { + value$$32 !== undefined && test._recordThrow("assertUndefined", arguments) + }, verifyUndefined:function(value$$33) { + value$$33 !== undefined && test._recordTrace("verifyUndefined", arguments) + }, assertNotUndefined:function(value$$34) { + value$$34 === undefined && test._recordThrow("assertNotUndefined", arguments) + }, verifyNotUndefined:function(value$$35) { + value$$35 === undefined && test._recordTrace("verifyNotUndefined", arguments) + }, assertNaN:function(value$$36) { + isNaN(value$$36) || test._recordThrow("assertNaN", arguments) + }, verifyNaN:function(value$$37) { + isNaN(value$$37) || test._recordTrace("verifyNaN", arguments) + }, assertNotNaN:function(value$$38) { + isNaN(value$$38) && test._recordThrow("assertNotNaN", arguments) + }, verifyNotNaN:function(value$$39) { + isNaN(value$$39) && test._recordTrace("verifyNotNaN", arguments) + }, assertEqual:function(expected, actual) { + test._isEqual(expected, actual) || test._recordThrow("assertEqual", arguments) + }, verifyEqual:function(expected$$1, actual$$1) { + test._isEqual(expected$$1, actual$$1) || test._recordTrace("verifyEqual", arguments) + }, assertNotEqual:function(expected$$2, actual$$2) { + test._isEqual(expected$$2, actual$$2) && test._recordThrow("assertNotEqual", arguments) + }, verifyNotEqual:function(expected$$3, actual$$3) { + test._isEqual(expected$$3, actual$$3) && test._recordTrace("verifyNotEqual", arguments) + }, assertSame:function(expected$$4, actual$$4) { + expected$$4 !== actual$$4 && test._recordThrow("assertSame", arguments) + }, verifySame:function(expected$$5, actual$$5) { + expected$$5 !== actual$$5 && test._recordTrace("verifySame", arguments) + }, assertNotSame:function(expected$$6, actual$$6) { + expected$$6 !== actual$$6 && test._recordThrow("assertNotSame", arguments) + }, verifyNotSame:function(expected$$7, actual$$7) { + expected$$7 !== actual$$7 && test._recordTrace("verifyNotSame", arguments) + }, _recordTrace:function() { + test._record.apply(this, arguments); + console.trace() + }, _recordThrow:function() { + test._record.apply(this, arguments); + throw new Error; + }, _record:function() { + console.error(arguments); + var message$$5 = arguments[0] + "("; + var data$$31 = arguments[1]; + if(typeof data$$31 == "string") { + message$$5 += data$$31 + }else { + var i$$19 = 0; + for(;i$$19 < data$$31.length;i$$19++) { + if(i$$19 != 0) { + message$$5 += ", " + }message$$5 += data$$31[i$$19] + } + }message$$5 += ")"; + console.log(message$$5) + }, _isEqual:function(expected$$8, actual$$8, depth) { + depth || (depth = 0); + if(depth > 10) { + return true + }if(expected$$8 == null) { + if(actual$$8 != null) { + console.log("expected: null, actual non-null: ", actual$$8); + return false + }return true + }if(typeof expected$$8 == "number" && isNaN(expected$$8)) { + if(!(typeof actual$$8 == "number" && isNaN(actual$$8))) { + console.log("expected: NaN, actual non-NaN: ", actual$$8); + return false + }return true + }if(actual$$8 == null) { + if(expected$$8 != null) { + console.log("actual: null, expected non-null: ", expected$$8); + return false + }return true + }if(typeof expected$$8 == "object") { + if(typeof actual$$8 != "object") { + console.log("expected object, actual not an object"); + return false + }var actualLength = 0; + for(var prop in actual$$8) { + if(typeof actual$$8[prop] != "function" || typeof expected$$8[prop] != "function") { + var nest = test._isEqual(actual$$8[prop], expected$$8[prop], depth + 1); + if(typeof nest != "boolean" || !nest) { + console.log("element '" + prop + "' does not match: " + nest); + return false + } + }actualLength++ + }var expectedLength = 0; + for(prop in expected$$8) { + expectedLength++ + }if(actualLength != expectedLength) { + console.log("expected object size = " + expectedLength + ", actual object size = " + actualLength); + return false + }return true + }if(actual$$8 != expected$$8) { + console.log("expected = " + expected$$8 + " (type=" + typeof expected$$8 + "), actual = " + actual$$8 + " (type=" + typeof actual$$8 + ")"); + return false + }if(expected$$8 instanceof Array) { + if(!(actual$$8 instanceof Array)) { + console.log("expected array, actual not an array"); + return false + }if(actual$$8.length != expected$$8.length) { + console.log("expected array length = " + expected$$8.length + ", actual array length = " + actual$$8.length); + return false + }var i$$20 = 0; + for(;i$$20 < actual$$8.length;i$$20++) { + var inner = test._isEqual(actual$$8[i$$20], expected$$8[i$$20], depth + 1); + if(typeof inner != "boolean" || !inner) { + console.log("element " + i$$20 + " does not match: " + inner); + return false + } + }return true + }return true + }}; + exports$$23.test = test +}); +define("cockpit/test/testCli", ["require", "exports", "module", "cockpit/test/assert", "pilot/types", "pilot/settings", "cockpit/cli", "cockpit/cli", "cockpit/cli"], function(require$$25, exports$$24) { + var test$$1 = require$$25("cockpit/test/assert").test; + var Status$$4 = require$$25("pilot/types").Status; + var settings$$5 = require$$25("pilot/settings").settings; + require$$25("cockpit/cli")._tokenize; + require$$25("cockpit/cli")._split; + var CliRequisition$$1 = require$$25("cockpit/cli").CliRequisition; + exports$$24.testAll = function() { + exports$$24.testTokenize(); + exports$$24.testSplit(); + exports$$24.testCli(); + return"testAll Completed" + }; + exports$$24.testTokenize = function() { + var args$$17; + var cli = new CliRequisition$$1; + args$$17 = cli._tokenize(""); + test$$1.verifyEqual(1, args$$17.length); + test$$1.verifyEqual("", args$$17[0].text); + test$$1.verifyEqual(0, args$$17[0].start); + test$$1.verifyEqual(0, args$$17[0].end); + test$$1.verifyEqual("", args$$17[0].priorSpace); + args$$17 = cli._tokenize("s"); + test$$1.verifyEqual(1, args$$17.length); + test$$1.verifyEqual("s", args$$17[0].text); + test$$1.verifyEqual(0, args$$17[0].start); + test$$1.verifyEqual(1, args$$17[0].end); + test$$1.verifyEqual("", args$$17[0].priorSpace); + args$$17 = cli._tokenize(" "); + test$$1.verifyEqual(1, args$$17.length); + test$$1.verifyEqual("", args$$17[0].text); + test$$1.verifyEqual(1, args$$17[0].start); + test$$1.verifyEqual(1, args$$17[0].end); + test$$1.verifyEqual(" ", args$$17[0].priorSpace); + args$$17 = cli._tokenize("s s"); + test$$1.verifyEqual(2, args$$17.length); + test$$1.verifyEqual("s", args$$17[0].text); + test$$1.verifyEqual(0, args$$17[0].start); + test$$1.verifyEqual(1, args$$17[0].end); + test$$1.verifyEqual("", args$$17[0].priorSpace); + test$$1.verifyEqual("s", args$$17[1].text); + test$$1.verifyEqual(2, args$$17[1].start); + test$$1.verifyEqual(3, args$$17[1].end); + test$$1.verifyEqual(" ", args$$17[1].priorSpace); + args$$17 = cli._tokenize(" 1234 '12 34'"); + test$$1.verifyEqual(2, args$$17.length); + test$$1.verifyEqual("1234", args$$17[0].text); + test$$1.verifyEqual(1, args$$17[0].start); + test$$1.verifyEqual(5, args$$17[0].end); + test$$1.verifyEqual(" ", args$$17[0].priorSpace); + test$$1.verifyEqual("12 34", args$$17[1].text); + test$$1.verifyEqual(8, args$$17[1].start); + test$$1.verifyEqual(13, args$$17[1].end); + test$$1.verifyEqual(" ", args$$17[1].priorSpace); + args$$17 = cli._tokenize('12\'34 "12 34" \\'); + test$$1.verifyEqual(3, args$$17.length); + test$$1.verifyEqual("12'34", args$$17[0].text); + test$$1.verifyEqual(0, args$$17[0].start); + test$$1.verifyEqual(5, args$$17[0].end); + test$$1.verifyEqual("", args$$17[0].priorSpace); + test$$1.verifyEqual("12 34", args$$17[1].text); + test$$1.verifyEqual(7, args$$17[1].start); + test$$1.verifyEqual(12, args$$17[1].end); + test$$1.verifyEqual(" ", args$$17[1].priorSpace); + test$$1.verifyEqual("\\", args$$17[2].text); + test$$1.verifyEqual(14, args$$17[2].start); + test$$1.verifyEqual(15, args$$17[2].end); + test$$1.verifyEqual(" ", args$$17[2].priorSpace); + args$$17 = cli._tokenize("a\\ b \\t\\n\\r \\'x\\\" 'd"); + test$$1.verifyEqual(4, args$$17.length); + test$$1.verifyEqual("a b", args$$17[0].text); + test$$1.verifyEqual(0, args$$17[0].start); + test$$1.verifyEqual(3, args$$17[0].end); + test$$1.verifyEqual("", args$$17[0].priorSpace); + test$$1.verifyEqual("\t\n\r", args$$17[1].text); + test$$1.verifyEqual(4, args$$17[1].start); + test$$1.verifyEqual(7, args$$17[1].end); + test$$1.verifyEqual(" ", args$$17[1].priorSpace); + test$$1.verifyEqual("'x\"", args$$17[2].text); + test$$1.verifyEqual(8, args$$17[2].start); + test$$1.verifyEqual(11, args$$17[2].end); + test$$1.verifyEqual(" ", args$$17[2].priorSpace); + test$$1.verifyEqual("d", args$$17[3].text); + test$$1.verifyEqual(13, args$$17[3].start); + test$$1.verifyEqual(14, args$$17[3].end); + test$$1.verifyEqual(" ", args$$17[3].priorSpace); + return"testTokenize Completed" + }; + exports$$24.testSplit = function() { + var args$$18; + var cli$$1 = new CliRequisition$$1; + args$$18 = cli$$1._tokenize("s"); + cli$$1._split(args$$18); + test$$1.verifyEqual(1, args$$18.length); + test$$1.verifyEqual("s", args$$18[0].text); + test$$1.verifyNull(cli$$1.commandAssignment.value); + args$$18 = cli$$1._tokenize("set"); + cli$$1._split(args$$18); + test$$1.verifyEqual([], args$$18); + test$$1.verifyEqual("set", cli$$1.commandAssignment.value.name); + args$$18 = cli$$1._tokenize("set a b"); + cli$$1._split(args$$18); + test$$1.verifyEqual("set", cli$$1.commandAssignment.value.name); + test$$1.verifyEqual(2, args$$18.length); + test$$1.verifyEqual("a", args$$18[0].text); + test$$1.verifyEqual("b", args$$18[1].text); + return"testSplit Completed" + }; + exports$$24.testCli = function() { + function update(input$$1) { + cli$$2.update(input$$1); + debug && console.log('####### TEST: typed="' + input$$1.typed + '" cur=' + input$$1.cursor.start + " cli=", cli$$2); + worst = cli$$2.getWorstHint(); + display$$1 = cli$$2.getAssignmentAt(input$$1.cursor.start).getHint(); + statuses$$1 = cli$$2.getInputStatusMarkup().map(function(status$$4) { + return status$$4.valueOf() + }).join(""); + if(cli$$2.commandAssignment.value && cli$$2.commandAssignment.value.name === "set") { + settingAssignment = cli$$2.getAssignment("setting"); + valueAssignment = cli$$2.getAssignment("value") + }else { + settingAssignment = undefined; + valueAssignment = undefined + } + } + function verifyPredictionsContains(name$$22, predictions$$3) { + return predictions$$3.every(function(prediction) { + return name$$22 === prediction || name$$22 === prediction.name + }, this) + } + var settingAssignment; + var valueAssignment; + var cli$$2 = new CliRequisition$$1; + var debug = true; + var worst; + var display$$1; + var statuses$$1; + var historyLengthSetting$$1 = settings$$5.getSetting("historyLength"); + update({typed:"", cursor:{start:0, end:0}}); + test$$1.verifyEqual("", statuses$$1); + test$$1.verifyEqual(1, cli$$2._hints.length); + test$$1.verifyEqual(Status$$4.INCOMPLETE, display$$1.status); + test$$1.verifyEqual(0, display$$1.start); + test$$1.verifyEqual(0, display$$1.end); + test$$1.verifyEqual(display$$1, worst); + test$$1.verifyNull(cli$$2.commandAssignment.value); + update({typed:" ", cursor:{start:1, end:1}}); + test$$1.verifyEqual("0", statuses$$1); + test$$1.verifyEqual(1, cli$$2._hints.length); + test$$1.verifyEqual(Status$$4.INCOMPLETE, display$$1.status); + test$$1.verifyEqual(1, display$$1.start); + test$$1.verifyEqual(1, display$$1.end); + test$$1.verifyEqual(display$$1, worst); + test$$1.verifyNull(cli$$2.commandAssignment.value); + update({typed:" ", cursor:{start:0, end:0}}); + test$$1.verifyEqual("0", statuses$$1); + test$$1.verifyEqual(1, cli$$2._hints.length); + test$$1.verifyEqual(Status$$4.INCOMPLETE, display$$1.status); + test$$1.verifyEqual(1, display$$1.start); + test$$1.verifyEqual(1, display$$1.end); + test$$1.verifyEqual(display$$1, worst); + test$$1.verifyNull(cli$$2.commandAssignment.value); + update({typed:"s", cursor:{start:1, end:1}}); + test$$1.verifyEqual("1", statuses$$1); + test$$1.verifyEqual(1, cli$$2._hints.length); + test$$1.verifyEqual(Status$$4.INCOMPLETE, display$$1.status); + test$$1.verifyEqual(0, display$$1.start); + test$$1.verifyEqual(1, display$$1.end); + test$$1.verifyEqual(display$$1, worst); + test$$1.verifyTrue(display$$1.predictions.length > 0); + test$$1.verifyTrue(display$$1.predictions.length < 20); + verifyPredictionsContains("set", display$$1.predictions); + test$$1.verifyNull(cli$$2.commandAssignment.value); + update({typed:"set", cursor:{start:3, end:3}}); + test$$1.verifyEqual("000", statuses$$1); + test$$1.verifyEqual(1, cli$$2._hints.length); + test$$1.verifyEqual(Status$$4.VALID, display$$1.status); + test$$1.verifyEqual(0, display$$1.start); + test$$1.verifyEqual(3, display$$1.end); + test$$1.verifyEqual("set", cli$$2.commandAssignment.value.name); + update({typed:"set ", cursor:{start:4, end:4}}); + test$$1.verifyEqual("0000", statuses$$1); + test$$1.verifyEqual(2, cli$$2._hints.length); + test$$1.verifyEqual(Status$$4.VALID, display$$1.status); + test$$1.verifyEqual(4, display$$1.start); + test$$1.verifyEqual(4, display$$1.end); + test$$1.verifyEqual(display$$1, worst); + test$$1.verifyEqual("set", cli$$2.commandAssignment.value.name); + update({typed:"set ", cursor:{start:2, end:2}}); + test$$1.verifyEqual("0000", statuses$$1); + test$$1.verifyEqual(2, cli$$2._hints.length); + test$$1.verifyEqual(Status$$4.VALID, display$$1.status); + test$$1.verifyEqual(0, display$$1.start); + test$$1.verifyEqual(3, display$$1.end); + test$$1.verifyEqual("set", cli$$2.commandAssignment.value.name); + update({typed:"set h", cursor:{start:5, end:5}}); + test$$1.verifyEqual("00001", statuses$$1); + test$$1.verifyEqual(2, cli$$2._hints.length); + test$$1.verifyEqual(Status$$4.INCOMPLETE, display$$1.status); + test$$1.verifyEqual(4, display$$1.start); + test$$1.verifyEqual(5, display$$1.end); + test$$1.verifyTrue(display$$1.predictions.length > 0); + verifyPredictionsContains("historyLength", display$$1.predictions); + test$$1.verifyEqual("set", cli$$2.commandAssignment.value.name); + test$$1.verifyEqual("h", settingAssignment.arg.text); + test$$1.verifyEqual(undefined, settingAssignment.value); + update({typed:"set historyLengt", cursor:{start:16, end:16}}); + test$$1.verifyEqual("0000111111111111", statuses$$1); + test$$1.verifyEqual(2, cli$$2._hints.length); + test$$1.verifyEqual(Status$$4.INCOMPLETE, display$$1.status); + test$$1.verifyEqual(4, display$$1.start); + test$$1.verifyEqual(16, display$$1.end); + test$$1.verifyEqual(1, display$$1.predictions.length); + verifyPredictionsContains("historyLength", display$$1.predictions); + test$$1.verifyEqual("set", cli$$2.commandAssignment.value.name); + test$$1.verifyEqual("historyLengt", settingAssignment.arg.text); + test$$1.verifyEqual(undefined, settingAssignment.value); + update({typed:"set historyLengt", cursor:{start:1, end:1}}); + test$$1.verifyEqual("0000222222222222", statuses$$1); + test$$1.verifyEqual(2, cli$$2._hints.length); + test$$1.verifyEqual(Status$$4.VALID, display$$1.status); + test$$1.verifyEqual(0, display$$1.start); + test$$1.verifyEqual(3, display$$1.end); + test$$1.verifyEqual(Status$$4.INVALID, worst.status); + test$$1.verifyEqual(4, worst.start); + test$$1.verifyEqual(16, worst.end); + test$$1.verifyEqual(1, worst.predictions.length); + verifyPredictionsContains("historyLength", worst.predictions); + test$$1.verifyEqual("set", cli$$2.commandAssignment.value.name); + test$$1.verifyEqual("historyLengt", settingAssignment.arg.text); + test$$1.verifyEqual(undefined, settingAssignment.value); + update({typed:"set historyLengt ", cursor:{start:17, end:17}}); + test$$1.verifyEqual("00002222222222222", statuses$$1); + test$$1.verifyEqual(3, cli$$2._hints.length); + test$$1.verifyEqual(Status$$4.VALID, display$$1.status); + test$$1.verifyEqual(17, display$$1.start); + test$$1.verifyEqual(17, display$$1.end); + test$$1.verifyEqual(Status$$4.INVALID, worst.status); + test$$1.verifyEqual(4, worst.start); + test$$1.verifyEqual(16, worst.end); + test$$1.verifyEqual(1, worst.predictions.length); + verifyPredictionsContains("historyLength", worst.predictions); + test$$1.verifyEqual("set", cli$$2.commandAssignment.value.name); + test$$1.verifyEqual("historyLengt", settingAssignment.arg.text); + test$$1.verifyEqual(undefined, settingAssignment.value); + update({typed:"set historyLength", cursor:{start:17, end:17}}); + test$$1.verifyEqual("00000000000000000", statuses$$1); + test$$1.verifyEqual(2, cli$$2._hints.length); + test$$1.verifyEqual("set", cli$$2.commandAssignment.value.name); + test$$1.verifyEqual("historyLength", settingAssignment.arg.text); + test$$1.verifyEqual(historyLengthSetting$$1, settingAssignment.value); + update({typed:"set historyLength ", cursor:{start:18, end:18}}); + test$$1.verifyEqual("000000000000000000", statuses$$1); + test$$1.verifyEqual(3, cli$$2._hints.length); + test$$1.verifyEqual("set", cli$$2.commandAssignment.value.name); + test$$1.verifyEqual("historyLength", settingAssignment.arg.text); + test$$1.verifyEqual(historyLengthSetting$$1, settingAssignment.value); + update({typed:"set historyLength 6", cursor:{start:19, end:19}}); + test$$1.verifyEqual("0000000000000000000", statuses$$1); + test$$1.verifyEqual(3, cli$$2._hints.length); + test$$1.verifyEqual("set", cli$$2.commandAssignment.value.name); + test$$1.verifyEqual("historyLength", settingAssignment.arg.text); + test$$1.verifyEqual(historyLengthSetting$$1, settingAssignment.value); + test$$1.verifyEqual("6", valueAssignment.arg.text); + test$$1.verifyEqual(6, valueAssignment.value); + test$$1.verifyEqual("number", typeof valueAssignment.value); + return"testCli Completed" + } +}); +define("cockpit/ui/settings", ["require", "exports", "module", "pilot/types", "pilot/types/basic"], function(require$$26, exports$$25) { + var types$$7 = require$$26("pilot/types"); + var SelectionType$$3 = require$$26("pilot/types/basic").SelectionType; + var direction = new SelectionType$$3({name:"direction", data:["above", "below"]}); + var hintDirectionSetting = {name:"hintDirection", description:"Are hints shown above or below the command line?", type:"direction", defaultValue:"above"}; + var outputDirectionSetting = {name:"outputDirection", description:"Is the output window shown above or below the command line?", type:"direction", defaultValue:"above"}; + var outputHeightSetting = {name:"outputHeight", description:"What height should the output panel be?", type:"number", defaultValue:300}; + exports$$25.startup = function(data$$32) { + types$$7.registerType(direction); + data$$32.env.settings.addSetting(hintDirectionSetting); + data$$32.env.settings.addSetting(outputDirectionSetting); + data$$32.env.settings.addSetting(outputHeightSetting) + }; + exports$$25.shutdown = function(data$$33) { + types$$7.unregisterType(direction); + data$$33.env.settings.removeSetting(hintDirectionSetting); + data$$33.env.settings.removeSetting(outputDirectionSetting); + data$$33.env.settings.removeSetting(outputHeightSetting) + } +}); +define("pilot/event", ["require", "exports", "module", "pilot/useragent"], function(require$$27, exports$$26) { + var useragent = require$$27("pilot/useragent"); + exports$$26.addListener = function(elem, type$$5, callback$$3) { + if(elem.addEventListener) { + return elem.addEventListener(type$$5, callback$$3, false) + }if(elem.attachEvent) { + var wrapper = function() { + callback$$3(window.event) + }; + callback$$3._wrapper = wrapper; + elem.attachEvent("on" + type$$5, wrapper) + } + }; + exports$$26.removeListener = function(elem$$1, type$$6, callback$$4) { + if(elem$$1.removeEventListener) { + return elem$$1.removeEventListener(type$$6, callback$$4, false) + }if(elem$$1.detachEvent) { + elem$$1.detachEvent("on" + type$$6, callback$$4._wrapper || callback$$4) + } + }; + exports$$26.stopEvent = function(e$$8) { + exports$$26.stopPropagation(e$$8); + exports$$26.preventDefault(e$$8); + return false + }; + exports$$26.stopPropagation = function(e$$9) { + if(e$$9.stopPropagation) { + e$$9.stopPropagation() + }else { + e$$9.cancelBubble = true + } + }; + exports$$26.preventDefault = function(e$$10) { + if(e$$10.preventDefault) { + e$$10.preventDefault() + }else { + e$$10.returnValue = false + } + }; + exports$$26.getDocumentX = function(e$$11) { + if(e$$11.clientX) { + var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft; + return e$$11.clientX + scrollLeft + }else { + return e$$11.pageX + } + }; + exports$$26.getDocumentY = function(e$$12) { + if(e$$12.clientY) { + var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; + return e$$12.clientY + scrollTop + }else { + return e$$12.pageX + } + }; + exports$$26.getButton = function(e$$13) { + return e$$13.preventDefault ? e$$13.button : Math.max(e$$13.button - 1, 2) + }; + exports$$26.capture = document.documentElement.setCapture ? function(el, eventHandler, releaseCaptureHandler) { + function onReleaseCapture(e$$15) { + eventHandler && eventHandler(e$$15); + releaseCaptureHandler && releaseCaptureHandler(); + exports$$26.removeListener(el, "mousemove", eventHandler); + exports$$26.removeListener(el, "mouseup", onReleaseCapture); + exports$$26.removeListener(el, "losecapture", onReleaseCapture); + el.releaseCapture() + } + exports$$26.addListener(el, "mousemove", eventHandler); + exports$$26.addListener(el, "mouseup", onReleaseCapture); + exports$$26.addListener(el, "losecapture", onReleaseCapture); + el.setCapture() + } : function(el$$1, eventHandler$$1, releaseCaptureHandler$$1) { + function onMouseMove$$1(e$$16) { + eventHandler$$1(e$$16); + e$$16.stopPropagation() + } + function onMouseUp(e$$17) { + eventHandler$$1 && eventHandler$$1(e$$17); + releaseCaptureHandler$$1 && releaseCaptureHandler$$1(); + document.removeEventListener("mousemove", onMouseMove$$1, true); + document.removeEventListener("mouseup", onMouseUp, true); + e$$17.stopPropagation() + } + document.addEventListener("mousemove", onMouseMove$$1, true); + document.addEventListener("mouseup", onMouseUp, true) + }; + exports$$26.addMouseWheelListener = function(el$$2, callback$$5) { + var listener = function(e$$18) { + if(e$$18.wheelDelta !== undefined) { + if(e$$18.wheelDeltaX !== undefined) { + e$$18.wheelX = -e$$18.wheelDeltaX / 8; + e$$18.wheelY = -e$$18.wheelDeltaY / 8 + }else { + e$$18.wheelX = 0; + e$$18.wheelY = -e$$18.wheelDelta / 8 + } + }else { + if(e$$18.axis && e$$18.axis == e$$18.HORIZONTAL_AXIS) { + e$$18.wheelX = (e$$18.detail || 0) * 5; + e$$18.wheelY = 0 + }else { + e$$18.wheelX = 0; + e$$18.wheelY = (e$$18.detail || 0) * 5 + } + }callback$$5(e$$18) + }; + exports$$26.addListener(el$$2, "DOMMouseScroll", listener); + exports$$26.addListener(el$$2, "mousewheel", listener) + }; + exports$$26.addMultiMouseDownListener = function(el$$3, button, count$$1, timeout, callback$$6) { + var clicks = 0; + var startX; + var startY; + var listener$$1 = function(e$$19) { + clicks += 1; + if(clicks == 1) { + startX = e$$19.clientX; + startY = e$$19.clientY; + setTimeout(function() { + clicks = 0 + }, timeout || 600) + }if(exports$$26.getButton(e$$19) != button || Math.abs(e$$19.clientX - startX) > 5 || Math.abs(e$$19.clientY - startY) > 5) { + clicks = 0 + }if(clicks == count$$1) { + clicks = 0; + callback$$6(e$$19) + }return exports$$26.preventDefault(e$$19) + }; + exports$$26.addListener(el$$3, "mousedown", listener$$1); + useragent.isIE && exports$$26.addListener(el$$3, "dblclick", listener$$1) + }; + exports$$26.addKeyListener = function(el$$4, callback$$7) { + var lastDown = null; + exports$$26.addListener(el$$4, "keydown", function(e$$20) { + lastDown = e$$20.keyIdentifier || e$$20.keyCode; + return callback$$7(e$$20) + }); + if(useragent.isMac && (useragent.isGecko || useragent.isOpera)) { + exports$$26.addListener(el$$4, "keypress", function(e$$21) { + var keyId = e$$21.keyIdentifier || e$$21.keyCode; + if(lastDown !== keyId) { + return callback$$7(e$$21) + }else { + lastDown = null + } + }) + } + } +}); +define("pilot/dom", ["require", "exports", "module"], function(require$$28, exports$$27) { + exports$$27.setText = function(elem$$2, text$$4) { + if(elem$$2.innerText !== undefined) { + elem$$2.innerText = text$$4 + }if(elem$$2.textContent !== undefined) { + elem$$2.textContent = text$$4 + } + }; + exports$$27.hasCssClass = function(el$$5, name$$23) { + var classes = el$$5.className.split(/\s+/g); + return classes.indexOf(name$$23) !== -1 + }; + exports$$27.addCssClass = function(el$$6, name$$24) { + exports$$27.hasCssClass(el$$6, name$$24) || (el$$6.className += " " + name$$24) + }; + exports$$27.setCssClass = function(node, className, include) { + include ? exports$$27.addCssClass(node, className) : exports$$27.removeCssClass(node, className) + }; + exports$$27.removeCssClass = function(el$$7, name$$25) { + var classes$$1 = el$$7.className.split(/\s+/g); + for(;;) { + var index$$6 = classes$$1.indexOf(name$$25); + if(index$$6 == -1) { + break + }classes$$1.splice(index$$6, 1) + }el$$7.className = classes$$1.join(" ") + }; + exports$$27.importCssString = function(cssText, doc) { + doc = doc || document; + if(doc.createStyleSheet) { + var sheet = doc.createStyleSheet(); + sheet.cssText = cssText + }else { + var style = doc.createElement("style"); + style.appendChild(doc.createTextNode(cssText)); + doc.getElementsByTagName("head")[0].appendChild(style) + } + }; + exports$$27.getInnerWidth = function(element) { + return parseInt(exports$$27.computedStyle(element, "paddingLeft")) + parseInt(exports$$27.computedStyle(element, "paddingRight")) + element.clientWidth + }; + exports$$27.getInnerHeight = function(element$$1) { + return parseInt(exports$$27.computedStyle(element$$1, "paddingTop")) + parseInt(exports$$27.computedStyle(element$$1, "paddingBottom")) + element$$1.clientHeight + }; + exports$$27.computedStyle = function(element$$2, style$$1) { + return window.getComputedStyle ? (window.getComputedStyle(element$$2, "") || {})[style$$1] || "" : element$$2.currentStyle[style$$1] + }; + exports$$27.scrollbarWidth = function() { + var inner$$1 = document.createElement("p"); + inner$$1.style.width = "100%"; + inner$$1.style.height = "200px"; + var outer = document.createElement("div"); + var style$$2 = outer.style; + style$$2.position = "absolute"; + style$$2.left = "-10000px"; + style$$2.overflow = "hidden"; + style$$2.width = "200px"; + style$$2.height = "150px"; + outer.appendChild(inner$$1); + document.body.appendChild(outer); + var noScrollbar = inner$$1.offsetWidth; + style$$2.overflow = "scroll"; + var withScrollbar = inner$$1.offsetWidth; + if(noScrollbar == withScrollbar) { + withScrollbar = outer.clientWidth + }document.body.removeChild(outer); + return noScrollbar - withScrollbar + }; + exports$$27.setInnerHtml = function(el$$8, innerHtml) { + var element$$3 = el$$8.cloneNode(false); + element$$3.innerHTML = innerHtml; + el$$8.parentNode.replaceChild(element$$3, el$$8); + return element$$3 + }; + exports$$27.getParentWindow = function(document$$1) { + return document$$1.defaultView || document$$1.parentWindow + } +}); +define("pilot/keyboard/keyutil", ["require", "exports", "module", "pilot/event", "pilot/useragent"], function(require$$29, exports$$28) { + var event = require$$29("pilot/event"); + var useragent$$1 = require$$29("pilot/useragent"); + exports$$28.KeyHelper = function() { + var ret$$1 = {MODIFIER_KEYS:{16:"shift", 17:"ctrl", 18:"alt", 224:"meta"}, FUNCTION_KEYS:{8:"backspace", 9:"tab", 13:"return", 19:"pause", 27:"escape", 33:"pageup", 34:"pagedown", 35:"end", 36:"home", 37:"left", 38:"up", 39:"right", 40:"down", 44:"printscreen", 45:"insert", 46:"delete", 112:"f1", 113:"f2", 114:"f3", 115:"f4", 116:"f5", 117:"f7", 119:"f8", 120:"f9", 121:"f10", 122:"f11", 123:"f12", 144:"numlock", 145:"scrolllock"}, PRINTABLE_KEYS:{32:" ", 48:"0", 49:"1", 50:"2", 51:"3", 52:"4", + 53:"5", 54:"6", 55:"7", 56:"8", 57:"9", 59:";", 61:"=", 65:"a", 66:"b", 67:"c", 68:"d", 69:"e", 70:"f", 71:"g", 72:"h", 73:"i", 74:"j", 75:"k", 76:"l", 77:"m", 78:"n", 79:"o", 80:"p", 81:"q", 82:"r", 83:"s", 84:"t", 85:"u", 86:"v", 87:"w", 88:"x", 89:"y", 90:"z", 107:"+", 109:"-", 110:".", 188:",", 190:".", 191:"/", 192:"`", 219:"[", 220:"\\", 221:"]", 222:'"'}, PRINTABLE_KEYS_CHARCODE:{}, KEY:{}}; + for(var i$$21 in ret$$1.PRINTABLE_KEYS) { + var k$$2 = ret$$1.PRINTABLE_KEYS[i$$21]; + ret$$1.PRINTABLE_KEYS_CHARCODE[k$$2.charCodeAt(0)] = i$$21; + if(k$$2.toUpperCase() != k$$2) { + ret$$1.PRINTABLE_KEYS_CHARCODE[k$$2.toUpperCase().charCodeAt(0)] = i$$21 + } + }for(i$$21 in ret$$1.FUNCTION_KEYS) { + var name$$26 = ret$$1.FUNCTION_KEYS[i$$21].toUpperCase(); + ret$$1.KEY[name$$26] = parseInt(i$$21, 10) + }return ret$$1 + }(); + var isFunctionOrNonPrintableKey = function(evt) { + return!!(evt.altKey || evt.ctrlKey || evt.metaKey || evt.charCode !== evt.which && exports$$28.KeyHelper.FUNCTION_KEYS[evt.which]) + }; + exports$$28.commandCodes = function(evt$$1, dontIgnoreMeta) { + var code = evt$$1._keyCode || evt$$1.keyCode; + var charCode = evt$$1._charCode === undefined ? evt$$1.charCode : evt$$1._charCode; + var ret$$2 = null; + var key$$10 = null; + var modifiers = ""; + var lowercase; + var allowShift = true; + if(code === 0 && evt$$1.which === 0) { + return false + }if(charCode !== 0) { + return false + }if(exports$$28.KeyHelper.MODIFIER_KEYS[charCode]) { + return[exports$$28.KeyHelper.MODIFIER_KEYS[charCode], null] + }if(code) { + ret$$2 = exports$$28.KeyHelper.FUNCTION_KEYS[code]; + if(!ret$$2 && (evt$$1.altKey || evt$$1.ctrlKey || evt$$1.metaKey)) { + ret$$2 = exports$$28.KeyHelper.PRINTABLE_KEYS[code]; + if(code > 47 && code < 58) { + allowShift = evt$$1.altKey + } + }if(ret$$2) { + if(evt$$1.altKey) { + modifiers += "alt_" + }if(evt$$1.ctrlKey) { + modifiers += "ctrl_" + }if(evt$$1.metaKey) { + modifiers += "meta_" + } + }else { + if(evt$$1.ctrlKey || evt$$1.metaKey) { + return false + } + } + }if(!ret$$2) { + code = evt$$1.which; + key$$10 = ret$$2 = String.fromCharCode(code); + lowercase = ret$$2.toLowerCase(); + if(evt$$1.metaKey) { + modifiers = "meta_"; + ret$$2 = lowercase + }else { + ret$$2 = null + } + }if(evt$$1.shiftKey && ret$$2 && allowShift) { + modifiers += "shift_" + }if(ret$$2) { + ret$$2 = modifiers + ret$$2 + }if(!dontIgnoreMeta && ret$$2) { + ret$$2 = ret$$2.replace(/ctrl_meta|meta/, "ctrl") + }return[ret$$2, key$$10] + }; + exports$$28.addKeyDownListener = function(element$$4, boundFunction) { + var handleBoundFunction = function(ev$$1) { + var handled = boundFunction(ev$$1); + handled && event.stopEvent(ev$$1); + return handled + }; + event.addListener(element$$4, "keydown", function(ev$$2) { + if(useragent$$1.isGecko) { + if(exports$$28.KeyHelper.FUNCTION_KEYS[ev$$2.keyCode]) { + return true + }else { + if((ev$$2.ctrlKey || ev$$2.metaKey) && exports$$28.KeyHelper.PRINTABLE_KEYS[ev$$2.keyCode]) { + return true + } + } + }if(isFunctionOrNonPrintableKey(ev$$2)) { + return handleBoundFunction(ev$$2) + }return true + }); + event.addListener(element$$4, "keypress", function(ev$$3) { + if(useragent$$1.isGecko) { + if(exports$$28.KeyHelper.FUNCTION_KEYS[ev$$3.keyCode]) { + return handleBoundFunction(ev$$3) + }else { + if((ev$$3.ctrlKey || ev$$3.metaKey) && exports$$28.KeyHelper.PRINTABLE_KEYS_CHARCODE[ev$$3.charCode]) { + ev$$3._keyCode = exports$$28.KeyHelper.PRINTABLE_KEYS_CHARCODE[ev$$3.charCode]; + ev$$3._charCode = 0; + return handleBoundFunction(ev$$3) + } + } + }if(ev$$3.charCode !== undefined && ev$$3.charCode === 0) { + return true + }return handleBoundFunction(ev$$3) + }) + } +}); +define("pilot/domtemplate", ["require", "exports", "module"], function(require$$30, exports$$29) { + function Templater() { + this.scope = [] + } + Templater.prototype.processNode = function(node$$1, data$$34) { + if(typeof node$$1 === "string") { + node$$1 = document.getElementById(node$$1) + }if(data$$34 === null || data$$34 === undefined) { + data$$34 = {} + }this.scope.push(node$$1.nodeName + (node$$1.id ? "#" + node$$1.id : "")); + try { + if(node$$1.attributes && node$$1.attributes.length) { + if(node$$1.hasAttribute("foreach")) { + this.processForEach(node$$1, data$$34); + return + }if(node$$1.hasAttribute("if")) { + if(!this.processIf(node$$1, data$$34)) { + return + } + }data$$34.__element = node$$1; + var attrs = Array.prototype.slice.call(node$$1.attributes); + var i$$22 = 0; + for(;i$$22 < attrs.length;i$$22++) { + var value$$40 = attrs[i$$22].value; + var name$$27 = attrs[i$$22].name; + this.scope.push(name$$27); + try { + if(name$$27 === "save") { + value$$40 = this.stripBraces(value$$40); + this.property(value$$40, data$$34, node$$1); + node$$1.removeAttribute("save") + }else { + if(name$$27.substring(0, 2) === "on") { + value$$40 = this.stripBraces(value$$40); + var func = this.property(value$$40, data$$34); + typeof func !== "function" && this.handleError("Expected " + value$$40 + " to resolve to a function, but got " + typeof func); + node$$1.removeAttribute(name$$27); + var capture = node$$1.hasAttribute("capture" + name$$27.substring(2)); + node$$1.addEventListener(name$$27.substring(2), func, capture); + capture && node$$1.removeAttribute("capture" + name$$27.substring(2)) + }else { + var self$$1 = this; + var newValue = value$$40.replace(/\$\{[^}]*\}/g, function(path) { + return self$$1.envEval(path.slice(2, -1), data$$34, value$$40) + }); + if(name$$27.charAt(0) === "_") { + node$$1.removeAttribute(name$$27); + node$$1.setAttribute(name$$27.substring(1), newValue) + }else { + if(value$$40 !== newValue) { + attrs[i$$22].value = newValue + } + } + } + } + }finally { + this.scope.pop() + } + } + }var childNodes = Array.prototype.slice.call(node$$1.childNodes); + var j$$2 = 0; + for(;j$$2 < childNodes.length;j$$2++) { + this.processNode(childNodes[j$$2], data$$34) + }node$$1.nodeType === Node.TEXT_NODE && this.processTextNode(node$$1, data$$34) + }finally { + this.scope.pop() + } + }; + Templater.prototype.processIf = function(node$$2, data$$35) { + this.scope.push("if"); + try { + var originalValue = node$$2.getAttribute("if"); + var value$$41 = this.stripBraces(originalValue); + var recurse = true; + try { + var reply$$2 = this.envEval(value$$41, data$$35, originalValue); + recurse = !!reply$$2 + }catch(ex$$4) { + this.handleError("Error with '" + value$$41 + "'", ex$$4); + recurse = false + }recurse || node$$2.parentNode.removeChild(node$$2); + node$$2.removeAttribute("if"); + return recurse + }finally { + this.scope.pop() + } + }; + Templater.prototype.processForEach = function(node$$3, data$$36) { + this.scope.push("foreach"); + try { + var originalValue$$1 = node$$3.getAttribute("foreach"); + var value$$42 = originalValue$$1; + var paramName = "param"; + if(value$$42.charAt(0) === "$") { + value$$42 = this.stripBraces(value$$42) + }else { + var nameArr = value$$42.split(" in "); + paramName = nameArr[0].trim(); + value$$42 = this.stripBraces(nameArr[1].trim()) + }node$$3.removeAttribute("foreach"); + try { + var self$$2 = this; + var processSingle = function(member, clone, ref) { + ref.parentNode.insertBefore(clone, ref); + data$$36[paramName] = member; + self$$2.processNode(clone, data$$36); + delete data$$36[paramName] + }; + var processAll = function(scope, member$$1) { + self$$2.scope.push(scope); + try { + if(node$$3.nodeName === "LOOP") { + var i$$23 = 0; + for(;i$$23 < node$$3.childNodes.length;i$$23++) { + var clone$$1 = node$$3.childNodes[i$$23].cloneNode(true); + processSingle(member$$1, clone$$1, node$$3) + } + }else { + clone$$1 = node$$3.cloneNode(true); + clone$$1.removeAttribute("foreach"); + processSingle(member$$1, clone$$1, node$$3) + } + }finally { + self$$2.scope.pop() + } + }; + var reply$$3 = this.envEval(value$$42, data$$36, originalValue$$1); + if(Array.isArray(reply$$3)) { + reply$$3.forEach(function(data$$37, i$$24) { + processAll("" + i$$24, data$$37) + }, this) + }else { + for(var param$$6 in reply$$3) { + reply$$3.hasOwnProperty(param$$6) && processAll(param$$6, param$$6) + } + }node$$3.parentNode.removeChild(node$$3) + }catch(ex$$5) { + this.handleError("Error with '" + value$$42 + "'", ex$$5) + } + }finally { + this.scope.pop() + } + }; + Templater.prototype.processTextNode = function(node$$4, data$$38) { + var value$$43 = node$$4.data; + value$$43 = value$$43.replace(/\$\{([^}]*)\}/g, "\uf001$$$1\uf002"); + var parts$$1 = value$$43.split(/\uF001|\uF002/); + if(parts$$1.length > 1) { + parts$$1.forEach(function(part) { + if(part === null || part === undefined || part === "") { + return + }if(part.charAt(0) === "$") { + part = this.envEval(part.slice(1), data$$38, node$$4.data) + }if(part === null) { + part = "null" + }if(part === undefined) { + part = "undefined" + }if(typeof part.cloneNode !== "function") { + part = node$$4.ownerDocument.createTextNode(part.toString()) + }node$$4.parentNode.insertBefore(part, node$$4) + }, this); + node$$4.parentNode.removeChild(node$$4) + } + }; + Templater.prototype.stripBraces = function(str$$9) { + if(!str$$9.match(/\$\{.*\}/g)) { + this.handleError("Expected " + str$$9 + " to match ${...}"); + return str$$9 + }return str$$9.slice(2, -1) + }; + Templater.prototype.property = function(path$$1, data$$39, newValue$$1) { + this.scope.push(path$$1); + try { + if(typeof path$$1 === "string") { + path$$1 = path$$1.split(".") + }var value$$44 = data$$39[path$$1[0]]; + if(path$$1.length === 1) { + if(newValue$$1 !== undefined) { + data$$39[path$$1[0]] = newValue$$1 + }if(typeof value$$44 === "function") { + return function() { + return value$$44.apply(data$$39, arguments) + } + }return value$$44 + }if(!value$$44) { + this.handleError("Can't find path=" + path$$1); + return null + }return this.property(path$$1.slice(1), value$$44, newValue$$1) + }finally { + this.scope.pop() + } + }; + Templater.prototype.envEval = function(script, env$$11, context) { + with(env$$11) { + try { + this.scope.push(context); + return eval(script) + }catch(ex$$6) { + this.handleError("Template error evaluating '" + script + "'", ex$$6); + return script + }finally { + this.scope.pop() + } + } + }; + Templater.prototype.handleError = function(message$$6, ex$$7) { + this.logError(message$$6); + this.logError("In: " + this.scope.join(" > ")); + ex$$7 && this.logError(ex$$7) + }; + Templater.prototype.logError = function(message$$7) { + console.log(message$$7) + }; + exports$$29.Templater = Templater +}); +define("cockpit/ui/requestView", ["require", "exports", "module", "pilot/dom", "pilot/event", 'text!cockpit/ui/requestView.html!\n
\n