diff --git a/build/ace-uncompressed.js b/build/ace-uncompressed.js index 5283a236..dacdd1f1 100644 --- a/build/ace-uncompressed.js +++ b/build/ace-uncompressed.js @@ -2200,25 +2200,25 @@ define('pilot/index', function(require, exports, module) { exports.startup = function(data, reason) { require('pilot/fixoldbrowsers'); - require('pilot/types/basic').startup(); - require('pilot/types/command').startup(); - require('pilot/types/settings').startup(); - require('pilot/commands/settings').startup(); - require('pilot/commands/basic').startup(); - // require('pilot/commands/history').startup(); - require('pilot/settings/canon').startup(); - require('pilot/canon').startup(); + require('pilot/types/basic').startup(data, reason); + require('pilot/types/command').startup(data, reason); + require('pilot/types/settings').startup(data, reason); + require('pilot/commands/settings').startup(data, reason); + require('pilot/commands/basic').startup(data, reason); + // require('pilot/commands/history').startup(data, reason); + require('pilot/settings/canon').startup(data, reason); + require('pilot/canon').startup(data, reason); }; exports.shutdown = function(data, reason) { - require('pilot/types/basic').shutdown(); - require('pilot/types/command').shutdown(); - require('pilot/types/settings').shutdown(); - require('pilot/commands/settings').shutdown(); - require('pilot/commands/basic').shutdown(); - // require('pilot/commands/history').shutdown(); - require('pilot/settings/canon').shutdown(); - require('pilot/canon').shutdown(); + require('pilot/types/basic').shutdown(data, reason); + require('pilot/types/command').shutdown(data, reason); + require('pilot/types/settings').shutdown(data, reason); + require('pilot/commands/settings').shutdown(data, reason); + require('pilot/commands/basic').shutdown(data, reason); + // require('pilot/commands/history').shutdown(data, reason); + require('pilot/settings/canon').shutdown(data, reason); + require('pilot/canon').shutdown(data, reason); }; @@ -10402,6 +10402,7 @@ var VirtualRenderer = function(container, theme) { var changes = this.CHANGE_SIZE; var height = dom.getInnerHeight(this.container); +console.log('height: ', height, ' this.$size.height: ', this.$size.height); if (this.$size.height != height) { this.$size.height = height; @@ -10415,6 +10416,7 @@ var VirtualRenderer = function(container, theme) { } var width = dom.getInnerWidth(this.container); +console.log('width: ', width, ' this.$size.width: ', this.$size.width); if (this.$size.width != width) { this.$size.width = width; @@ -10422,10 +10424,14 @@ var VirtualRenderer = function(container, theme) { this.scroller.style.left = gutterWidth + "px"; this.scroller.style.width = Math.max(0, width - gutterWidth - this.scrollBar.getWidth()) + "px"; } +console.log('this.scroller.style.width: ', this.scroller.style.width); this.$size.scrollerWidth = this.scroller.clientWidth; this.$size.scrollerHeight = this.scroller.clientHeight; this.$loop.schedule(changes); +console.log('this.$size.scrollerWidth: ', this.$size.scrollerWidth); +console.log('this.$size.scrollerHeight: ', this.$size.scrollerHeight); +console.log('changes: ', changes); }; this.setTokenizer = function(tokenizer) { @@ -10547,7 +10553,7 @@ var VirtualRenderer = function(container, theme) { this.$renderChanges = function(changes) { if (!changes || !this.doc || !this.$tokenizer) return; - + // text, scrolling and resize changes can cause the view port size to change if (!this.layerConfig || changes & this.CHANGE_FULL || @@ -10937,362 +10943,48 @@ define('ace/theme/textmate', function(require, exports, module) { * * ***** END LICENSE BLOCK ***** */ -define('ace/layer/text', function(require, exports, module) { +define('ace/mode/text', function(require, exports, module) { -var oop = require("pilot/oop"); -var dom = require("pilot/dom"); -var lang = require("pilot/lang"); -var EventEmitter = require("pilot/event_emitter").EventEmitter; - -var Text = function(parentEl) { - this.element = document.createElement("div"); - this.element.className = "ace_layer ace_text-layer"; - parentEl.appendChild(this.element); - - this.$characterSize = this.$measureSizes(); - this.$pollSizeChanges(); -}; - -(function() { - - oop.implement(this, EventEmitter); - - this.EOF_CHAR = "¶"; - this.EOL_CHAR = "¬"; - this.TAB_CHAR = "→"; - this.SPACE_CHAR = "·"; - - this.setTokenizer = function(tokenizer) { - this.tokenizer = tokenizer; - }; - - this.getLineHeight = function() { - return this.$characterSize.height || 1; - }; - - this.getCharacterWidth = function() { - return this.$characterSize.width || 1; - }; - - this.$pollSizeChanges = function() { - var self = this; - setInterval(function() { - var size = self.$measureSizes(); - if (self.$characterSize.width !== size.width || self.$characterSize.height !== size.height) { - self.$characterSize = size; - self._dispatchEvent("changeCharaterSize", {data: size}); - } - }, 500); - }; - - this.$fontStyles = { - fontFamily : 1, - fontSize : 1, - fontWeight : 1, - fontStyle : 1, - lineHeight : 1 - }, - - this.$measureSizes = function() { - var n = 1000; - if (!this.$measureNode) { - var measureNode = this.$measureNode = document.createElement("div"); - var style = measureNode.style; - - style.width = style.height = "auto"; - style.left = style.top = "-1000px"; - - style.visibility = "hidden"; - style.position = "absolute"; - style.overflow = "visible"; - style.whiteSpace = "nowrap"; - - // in FF 3.6 monospace fonts can have a fixed sub pixel width. - // that's why we have to measure many characters - // Note: characterWidth can be a float! - measureNode.innerHTML = lang.stringRepeat("Xy", n); - document.body.insertBefore(measureNode, document.body.firstChild); - } - - var style = this.$measureNode.style; - for (var prop in this.$fontStyles) { - var value = dom.computedStyle(this.element, prop); - style[prop] = value; - } - - var size = { - height: this.$measureNode.offsetHeight, - width: this.$measureNode.offsetWidth / (n * 2) - }; - return size; - }; - - this.setDocument = function(doc) { - this.doc = doc; - }; - - this.$showInvisibles = false; - this.setShowInvisibles = function(showInvisibles) { - this.$showInvisibles = showInvisibles; - }; - - this.$computeTabString = function() { - var tabSize = this.doc.getTabSize(); - if (this.$showInvisibles) { - var halfTab = (tabSize) / 2; - this.$tabString = "" - + new Array(Math.floor(halfTab)).join(" ") - + this.TAB_CHAR - + new Array(Math.ceil(halfTab)+1).join(" ") - + ""; - } else { - this.$tabString = new Array(tabSize+1).join(" "); - } - }; - - this.updateLines = function(layerConfig, firstRow, lastRow) { - this.$computeTabString(); - this.config = layerConfig; - - var first = Math.max(firstRow, layerConfig.firstRow); - var last = Math.min(lastRow, layerConfig.lastRow); - - var lineElements = this.element.childNodes; - var _self = this; - this.tokenizer.getTokens(first, last, function(tokens) { - for ( var i = first; i <= last; i++) { - var lineElement = lineElements[i - layerConfig.firstRow]; - if (!lineElement) - continue; - - var html = []; - _self.$renderLine(html, i, tokens[i-first].tokens); - lineElement.innerHTML = html.join(""); - } - }); - }; - - this.scrollLines = function(config) { - var _self = this; - - this.$computeTabString(); - var oldConfig = this.config; - this.config = config; - - if (!oldConfig || oldConfig.lastRow < config.firstRow) - return this.update(config); - - if (config.lastRow < oldConfig.firstRow) - return this.update(config); - - var el = this.element; - - if (oldConfig.firstRow < config.firstRow) - for (var row=oldConfig.firstRow; row config.lastRow) - for (var row=config.lastRow+1; row<=oldConfig.lastRow; row++) - el.removeChild(el.lastChild); - - appendTop(appendBottom); - - function appendTop(callback) { - if (config.firstRow < oldConfig.firstRow) { - _self.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1, function(fragment) { - if (el.firstChild) - el.insertBefore(fragment, el.firstChild); - else - el.appendChild(fragment); - callback(); - }); - } - else - callback(); - } - - function appendBottom() { - if (config.lastRow > oldConfig.lastRow) { - _self.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow, function(fragment) { - el.appendChild(fragment); - }); - } - } - }; - - this.$renderLinesFragment = function(config, firstRow, lastRow, callback) { - var fragment = document.createDocumentFragment(); - var _self = this; - this.tokenizer.getTokens(firstRow, lastRow, function(tokens) { - for (var row=firstRow; row<=lastRow; row++) { - var lineEl = document.createElement("div"); - lineEl.className = "ace_line"; - var style = lineEl.style; - style.height = _self.$characterSize.height + "px"; - style.width = config.width + "px"; - - var html = []; - _self.$renderLine(html, row, tokens[row-firstRow].tokens); - lineEl.innerHTML = html.join(""); - fragment.appendChild(lineEl); - } - callback(fragment); - }); - }; - - this.update = function(config) { - this.$computeTabString(); - this.config = config; - - var html = []; - var _self = this; - this.tokenizer.getTokens(config.firstRow, config.lastRow, function(tokens) { - for ( var i = config.firstRow; i <= config.lastRow; i++) { - html.push("
"); - _self.$renderLine(html, i, tokens[i-config.firstRow].tokens), html.push("
"); - } - - _self.element.innerHTML = html.join(""); - }); - }; - - this.$textToken = { - "text": true, - "rparen": true, - "lparen": true - }; - - this.$renderLine = function(stringBuilder, row, tokens) { -// if (this.$showInvisibles) { -// var self = this; -// var spaceRe = /[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]+/g; -// var spaceReplace = function(space) { -// var space = new Array(space.length+1).join(self.SPACE_CHAR); -// return "" + space + ""; -// }; -// } -// else { - var spaceRe = /[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/g; - var spaceReplace = " "; -// } - - for ( var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - - var output = token.value - .replace(/&/g, "&") - .replace(/", output, ""); - } - else { - stringBuilder.push(output); - } - }; - - if (this.$showInvisibles) { - if (row !== this.doc.getLength() - 1) { - stringBuilder.push("" + this.EOL_CHAR + ""); - } else { - stringBuilder.push("" + this.EOF_CHAR + ""); - } - } - }; - -}).call(Text.prototype); - -exports.Text = Text; - -}); -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Ajax.org Code Editor (ACE). - * - * The Initial Developer of the Original Code is - * Ajax.org Services B.V. - * Portions created by the Initial Developer are Copyright (C) 2010 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Fabian Jakobs - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/doc_comment_highlight_rules', function(require, exports, module) { - -var oop = require("pilot/oop"); +var Tokenizer = require("ace/tokenizer").Tokenizer; var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules; -var DocCommentHighlightRules = function() { - - this.$rules = { - "start" : [ { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : "start" - }, { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+" // TODO: fix email addresses - }, { - token : "comment.doc", - regex : "\s+" - }, { - token : "comment.doc", - regex : "TODO" - }, { - token : "comment.doc", - regex : "[^@\\*]+" - }, { - token : "comment.doc", - regex : "." - }] - }; +var Mode = function() { + this.$tokenizer = new Tokenizer(new TextHighlightRules().getRules()); }; -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - (function() { - this.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next: start - }; + this.getTokenizer = function() { + return this.$tokenizer; }; -}).call(DocCommentHighlightRules.prototype); + this.toggleCommentLines = function(state, doc, startRow, endRow) { + return 0; + }; -exports.DocCommentHighlightRules = DocCommentHighlightRules; + this.getNextLineIndent = function(state, line, tab) { + return ""; + }; + this.checkOutdent = function(state, line, input) { + return false; + }; + + this.autoOutdent = function(state, doc, row) { + }; + + this.$getIndent = function(line) { + var match = line.match(/^(\s+)/); + if (match) { + return match[1]; + } + + return ""; + }; + +}).call(Mode.prototype); + +exports.Mode = Mode; }); /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 @@ -11458,6 +11150,83 @@ exports.Mode = Mode; * * ***** END LICENSE BLOCK ***** */ +define('ace/mode/text_highlight_rules', function(require, exports, module) { + +var TextHighlightRules = function() { + + // regexp must not have capturing parentheses + // regexps are ordered -> the first match is used + + this.$rules = { + "start" : [ { + token : "text", + regex : ".+" + } ] + }; +}; + +(function() { + + this.addRules = function(rules, prefix) { + for (var key in rules) { + var state = rules[key]; + for (var i=0; i + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + define('ace/mode/javascript_highlight_rules', function(require, exports, module) { var oop = require("pilot/oop"); @@ -11594,6 +11363,91 @@ JavaScriptHighlightRules = function() { oop.inherits(JavaScriptHighlightRules, TextHighlightRules); exports.JavaScriptHighlightRules = JavaScriptHighlightRules; +}); +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Ajax.org Code Editor (ACE). + * + * The Initial Developer of the Original Code is + * Ajax.org Services B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Fabian Jakobs + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +define('ace/mode/doc_comment_highlight_rules', function(require, exports, module) { + +var oop = require("pilot/oop"); +var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules; + +var DocCommentHighlightRules = function() { + + this.$rules = { + "start" : [ { + token : "comment.doc", // closing comment + regex : "\\*\\/", + next : "start" + }, { + token : "comment.doc.tag", + regex : "@[\\w\\d_]+" // TODO: fix email addresses + }, { + token : "comment.doc", + regex : "\s+" + }, { + token : "comment.doc", + regex : "TODO" + }, { + token : "comment.doc", + regex : "[^@\\*]+" + }, { + token : "comment.doc", + regex : "." + }] + }; +}; + +oop.inherits(DocCommentHighlightRules, TextHighlightRules); + +(function() { + + this.getStartRule = function(start) { + return { + token : "comment.doc", // doc comment + regex : "\\/\\*(?=\\*)", + next: start + }; + }; + +}).call(DocCommentHighlightRules.prototype); + +exports.DocCommentHighlightRules = DocCommentHighlightRules; + }); /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 @@ -11714,125 +11568,142 @@ exports.MatchingBraceOutdent = MatchingBraceOutdent; * * ***** END LICENSE BLOCK ***** */ -define('ace/mode/text', function(require, exports, module) { +define('ace/mode/javascript_highlight_rules', function(require, exports, module) { -var Tokenizer = require("ace/tokenizer").Tokenizer; +var oop = require("pilot/oop"); +var lang = require("pilot/lang"); +var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules; -var Mode = function() { - this.$tokenizer = new Tokenizer(new TextHighlightRules().getRules()); -}; +JavaScriptHighlightRules = function() { -(function() { + var docComment = new DocCommentHighlightRules(); - this.getTokenizer = function() { - return this.$tokenizer; - }; + var keywords = lang.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("|") + ); + + var buildinConstants = lang.arrayToMap( + ("null|Infinity|NaN|undefined").split("|") + ); + + var futureReserved = lang.arrayToMap( + ("class|enum|extends|super|const|export|import|implements|let|private|" + + "public|yield|interface|package|protected|static").split("|") + ); - this.toggleCommentLines = function(state, doc, startRow, endRow) { - return 0; - }; - - this.getNextLineIndent = function(state, line, tab) { - return ""; - }; - - this.checkOutdent = function(state, line, input) { - return false; - }; - - this.autoOutdent = function(state, doc, row) { - }; - - this.$getIndent = function(line) { - var match = line.match(/^(\s+)/); - if (match) { - return match[1]; - } - - return ""; - }; - -}).call(Mode.prototype); - -exports.Mode = Mode; -}); -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Ajax.org Code Editor (ACE). - * - * The Initial Developer of the Original Code is - * Ajax.org Services B.V. - * Portions created by the Initial Developer are Copyright (C) 2010 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Fabian Jakobs - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -define('ace/mode/text_highlight_rules', function(require, exports, module) { - -var TextHighlightRules = function() { - - // regexp must not have capturing parentheses + // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { - "start" : [ { - token : "text", - regex : ".+" - } ] + "start" : [ + { + token : "comment", + regex : "\\/\\/.*$" + }, + docComment.getStartRule("doc-start"), + { + token : "comment", // multi line comment + regex : "\\/\\*", + next : "comment" + }, { + token : "string.regexp", + regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)" + }, { + token : "string", // single line + regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' + }, { + token : "string", // multi line string start + regex : '["].*\\\\$', + next : "qqstring" + }, { + token : "string", // single line + regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" + }, { + token : "string", // multi line string start + regex : "['].*\\\\$", + next : "qstring" + }, { + token : "constant.numeric", // hex + regex : "0[xX][0-9a-fA-F]+\\b" + }, { + token : "constant.numeric", // float + regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" + }, { + token : "constant.language.boolean", + regex : "(?:true|false)\\b" + }, { + token : function(value) { + if (value == "this") + return "variable.language"; + else if (keywords[value]) + return "keyword"; + else if (buildinConstants[value]) + return "constant.language"; + else if (futureReserved[value]) + return "invalid.illegal"; + else if (value == "debugger") + return "invalid.deprecated"; + else + return "identifier"; + }, + // TODO: Unicode escape sequences + // TODO: Unicode identifiers + 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", // closing comment + regex : ".*?\\*\\/", + next : "start" + }, { + token : "comment", // comment spanning whole line + regex : ".+" + } + ], + "qqstring" : [ + { + token : "string", + regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', + next : "start" + }, { + token : "string", + regex : '.+' + } + ], + "qstring" : [ + { + token : "string", + regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", + next : "start" + }, { + token : "string", + regex : '.+' + } + ] }; + + this.addRules(docComment.getRules(), "doc-"); + this.$rules["doc-start"][0].next = "start"; }; -(function() { +oop.inherits(JavaScriptHighlightRules, TextHighlightRules); - this.addRules = function(rules, prefix) { - for (var key in rules) { - var state = rules[key]; - for (var i=0; iw)v.shiftObject();b._dispatchEvent("output",{requests:v,request:this})},x.prototype.doneWithError=function(a){this.error=!0,this.done(a)},x.prototype.async=function(){this._begunOutput||this._beginOutput()},x.prototype.output=function(a){this._begunOutput||this._beginOutput(),typeof a!=="string"&&!(a instanceof Node)&&(a=a.toString()),this.outputs.push(a),this._dispatchEvent("output",{});return this},x.prototype.done=function(a){this.completed=!0,this.end=new Date,this.duration=this.end.getTime()-this.start.getTime(),a&&this.output(a),this._dispatchEvent("output",{})},b.Request=x}),define("pilot/catalog",function(a,b,c){var d={};b.addExtensionSpec=function(a){d[a.name]=a},b.removeExtensionSpec=function(a){typeof a==="string"?delete d[a]:delete d[a.name]},b.getExtensionSpec=function(a){return d[a]},b.getExtensionSpecs=function(){return Object.keys(d)}}),define("pilot/commands/basic",function(require,exports,module){var checks=require("pilot/typecheck"),canon=require("pilot/canon"),helpMessages={plainPrefix:'

Welcome to Skywriter - Code in the Cloud

',plainSuffix:'For more information, see the Skywriter Wiki.'},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(a,b,c){var d=[],e=canon.getCommand(b.search);if(e&&e.exec)d.push(e.description?e.description:"No description for "+b.search);else{var f=!1;!b.search&&helpMessages.plainPrefix&&d.push(helpMessages.plainPrefix),e?(d.push("

Sub-Commands of "+e.name+"

"),d.push("

"+e.description+"

")):b.search?(b.search=="hidden"&&(b.search="",f=!0),d.push("

Commands starting with '"+b.search+"':

")):d.push("

Available Commands:

");var g=canon.getCommandNames();g.sort(),d.push("");for(var h=0;h"),d.push('"),d.push(""),d.push("")}d.push("
'+e.name+""+e.description+"
"),!b.search&&helpMessages.plainSuffix&&d.push(helpMessages.plainSuffix)}c.done(d.join(""))}},evalCommandSpec={name:"eval",params:[{name:"javascript",type:"text",description:"The JavaScript to evaluate"}],description:"evals given js code and show the result",hidden:!0,exec:function(env,args,request){var result,javascript=args.javascript;try{result=eval(javascript)}catch(e){result="Error: "+e.message+""}var msg="",type="",x;if(checks.isFunction(result))msg=(result+"").replace(/\n/g,"
").replace(/ /g," "),type="function";else if(checks.isObject(result)){Array.isArray(result)?type="array":type="object";var items=[],value;for(x in result)result.hasOwnProperty(x)&&(checks.isFunction(result[x])?value="[function]":checks.isObject(result[x])?value="[object]":value=result[x],items.push({name:x,value:value}));items.sort(function(a,b){return a.name.toLowerCase()"+items[x].name+": "+items[x].value+"
"}else msg=result,type=typeof result;request.done("Result for eval '"+javascript+"' (type: "+type+"):

"+msg)}},versionCommandSpec={name:"version",description:"show the Skywriter version",hidden:!0,exec:function(a,b,c){var d="Skywriter "+skywriter.versionNumber+" ("+skywriter.versionCodename+")";c.done(d)}},skywriterCommandSpec={name:"skywriter",hidden:!0,exec:function(a,b,c){var d=Math.floor(Math.random()*messages.length);c.done("Skywriter "+messages[d])}},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=require("pilot/canon");exports.startup=function(a,b){canon.addCommand(helpCommandSpec),canon.addCommand(evalCommandSpec),canon.addCommand(skywriterCommandSpec)},exports.shutdown=function(a,b){canon.removeCommand(helpCommandSpec),canon.removeCommand(evalCommandSpec),canon.removeCommand(skywriterCommandSpec)}}),define("pilot/commands/history",function(a,b,c){var d={name:"historyPrevious",predicates:{isCommandLine:!0,isKeyUp:!0},key:"up",exec:function(a,b){g>0&&g--;var c=history.requests[g].typed;env.commandLine.setInput(c)}},e={name:"historyNext",predicates:{isCommandLine:!0,isKeyUp:!0},key:"down",exec:function(a,b){g");var d=1;history.requests.forEach(function(a){c.push(""),c.push(""+d+""),c.push(""+a.typed+""),c.push(""),d++}),c.push(""),b.done(c.join(""))}},g=0;b.addedRequestOutput=function(){g=history.requests.length}}),define("pilot/commands/settings",function(a,b,c){var d={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(a,b,c){var d;if(b.setting)b.value===undefined?d=""+setting.name+" = "+setting.get():(b.setting.set(b.value),d="Setting: "+b.setting.name+" = "+b.setting.get());else{var e=a.settings.getSettingNames();d="",e.sort(function(a,b){return a.localeCompare(b)}),e.forEach(function(b){var c=a.settings.getSetting(b),e="https://wiki.mozilla.org/Labs/Skywriter/Settings#"+c.name;d+=''+c.name+" = "+c.value+"
"})}c.done(d)}},e={name:"unset",params:[{name:"setting",type:"setting",description:"The name of the setting to return to defaults"}],description:"unset a setting entirely",exec:function(a,b,c){var d=a.settings.get(b.setting);d?(d.reset(),c.done("Reset "+d.name+" to default: "+a.settings.get(b.setting))):c.doneWithError("No setting with the name "+b.setting+".")}},f=a("pilot/canon");b.startup=function(a,b){f.addCommand(d),f.addCommand(e)},b.shutdown=function(a,b){f.removeCommand(d),f.removeCommand(e)}}),define("pilot/console",function(a,b,c){var d=function(){},e=["assert","count","debug","dir","dirxml","error","group","groupEnd","info","log","profile","profileEnd","time","timeEnd","trace","warn"];typeof window==="undefined"?e.forEach(function(a){b[a]=function(){var b=Array.prototype.slice.call(arguments),c={op:"log",method:a,args:b};postMessage(JSON.stringify(c))}}):e.forEach(function(a){window.console&&window.console[a]?b[a]=Function.prototype.bind.call(window.console[a],window.console):b[a]=d})}),define("pilot/dom",function(a,b,c){b.setText=function(a,b){a.innerText!==undefined&&(a.innerText=b),a.textContent!==undefined&&(a.textContent=b)},b.hasCssClass=function(a,b){var c=a.className.split(/\s+/g);return c.indexOf(b)!==-1},b.addCssClass=function(a,c){b.hasCssClass(a,c)||(a.className+=" "+c)},b.setCssClass=function(a,c,d){d?b.addCssClass(a,c):b.removeCssClass(a,c)},b.removeCssClass=function(a,b){var c=a.className.split(/\s+/g);while(!0){var d=c.indexOf(b);if(d==-1)break;c.splice(d,1)}a.className=c.join(" ")},b.importCssString=function(a,b){b=b||document;if(b.createStyleSheet){var c=b.createStyleSheet();c.cssText=a}else{var d=b.createElement("style");d.appendChild(b.createTextNode(a)),b.getElementsByTagName("head")[0].appendChild(d)}},b.getInnerWidth=function(a){return parseInt(b.computedStyle(a,"paddingLeft"))+parseInt(b.computedStyle(a,"paddingRight"))+a.clientWidth},b.getInnerHeight=function(a){return parseInt(b.computedStyle(a,"paddingTop"))+parseInt(b.computedStyle(a,"paddingBottom"))+a.clientHeight},b.computedStyle=function(a,b){return window.getComputedStyle?(window.getComputedStyle(a,"")||{})[b]||"":a.currentStyle[b]},b.scrollbarWidth=function(){var a=document.createElement("p");a.style.width="100%",a.style.height="200px";var b=document.createElement("div"),c=b.style;c.position="absolute",c.left="-10000px",c.overflow="hidden",c.width="200px",c.height="150px",b.appendChild(a),document.body.appendChild(b);var d=a.offsetWidth;c.overflow="scroll";var e=a.offsetWidth;d==e&&(e=b.clientWidth),document.body.removeChild(b);return d-e}}),define("pilot/domtemplate",function(require,exports,module){function Templater(){this.scope=[]}Templater.prototype.processNode=function(a,b){typeof a==="string"&&(a=document.getElementById(a));if(b===null||b===undefined)b={};this.scope.push(a.nodeName+(a.id?"#"+a.id:""));try{if(a.attributes&&a.attributes.length){if(a.hasAttribute("foreach")){this.processForEach(a,b);return}if(a.hasAttribute("if"))if(!this.processIf(a,b))return;b.__element=a;var c=Array.prototype.slice.call(a.attributes);for(var d=0;d1&&(d.forEach(function(c){c!==null&&c!==undefined&&c!==""&&(c.charAt(0)==="$"&&(c=this.envEval(c.slice(1),b,a.data)),c===null&&(c="null"),c===undefined&&(c="undefined"),typeof c.cloneNode!=="function"&&(c=a.ownerDocument.createTextNode(c.toString())),a.parentNode.insertBefore(c,a))},this),a.parentNode.removeChild(a))},Templater.prototype.stripBraces=function(a){if(!a.match(/\$\{.*\}/g)){this.handleError("Expected "+a+" to match ${...}");return a}return a.slice(2,-1)},Templater.prototype.property=function(a,b,c){this.scope.push(a);try{typeof a==="string"&&(a=a.split("."));var d=b[a[0]];if(a.length===1){c!==undefined&&(b[a[0]]=c);if(typeof d==="function")return function(){return d.apply(b,arguments)};return d}if(!d){this.handleError("Can't find path="+a);return null}return this.property(a.slice(1),d,c)}finally{this.scope.pop()}},Templater.prototype.envEval=function(script,env,context){with(env)try{this.scope.push(context);return eval(script)}catch(ex){this.handleError("Template error evaluating '"+script+"'",ex);return script}finally{this.scope.pop()}},Templater.prototype.handleError=function(a,b){this.logError(a),this.logError("In: "+this.scope.join(" > ")),b&&this.logError(b)},Templater.prototype.logError=function(a){console.log(a)},exports.Templater=Templater}),define("pilot/environment",function(a,b,c){function e(){return{settings:d}}var d=a("pilot/settings").settings;b.create=e}),define("pilot/event",function(a,b,c){var d=a("pilot/useragent");b.addListener=function(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1);if(a.attachEvent){var d=function(){c(window.event)};c._wrapper=d,a.attachEvent("on"+b,d)}},b.removeListener=function(a,b,c){if(a.removeEventListener)return a.removeEventListener(b,c,!1);a.detachEvent&&a.detachEvent("on"+b,c._wrapper||c)},b.stopEvent=function(a){b.stopPropagation(a),b.preventDefault(a);return!1},b.stopPropagation=function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},b.preventDefault=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},b.getDocumentX=function(a){if(a.clientX){var b=document.documentElement.scrollLeft||document.body.scrollLeft;return a.clientX+b}return a.pageX},b.getDocumentY=function(a){if(a.clientY){var b=document.documentElement.scrollTop||document.body.scrollTop;return a.clientY+b}return a.pageX},b.getButton=function(a){return a.preventDefault?a.button:Math.max(a.button-1,2)},document.documentElement.setCapture?b.capture=function(a,c,d){function f(e){c&&c(e),d&&d(),b.removeListener(a,"mousemove",c),b.removeListener(a,"mouseup",f),b.removeListener(a,"losecapture",f),a.releaseCapture()}function e(a){c(a);return b.stopPropagation(a)}b.addListener(a,"mousemove",c),b.addListener(a,"mouseup",f),b.addListener(a,"losecapture",f),a.setCapture()}:b.capture=function(a,b,c){function e(a){b&&b(a),c&&c(),document.removeEventListener("mousemove",d,!0),document.removeEventListener("mouseup",e,!0),a.stopPropagation()}function d(a){b(a),a.stopPropagation()}document.addEventListener("mousemove",d,!0),document.addEventListener("mouseup",e,!0)},b.addMouseWheelListener=function(a,c){var d=function(a){a.wheelDelta!==undefined?a.wheelDeltaX!==undefined?(a.wheelX=-a.wheelDeltaX/8,a.wheelY=-a.wheelDeltaY/8):(a.wheelX=0,a.wheelY=-a.wheelDelta/8):a.axis&&a.axis==a.HORIZONTAL_AXIS?(a.wheelX=(a.detail||0)*5,a.wheelY=0):(a.wheelX=0,a.wheelY=(a.detail||0)*5),c(a)};b.addListener(a,"DOMMouseScroll",d),b.addListener(a,"mousewheel",d)},b.addMultiMouseDownListener=function(a,c,e,f,g){var h=0,i,j,k=function(a){h+=1,h==1&&(i=a.clientX,j=a.clientY,setTimeout(function(){h=0},f||600));if(b.getButton(a)!=c||Math.abs(a.clientX-i)>5||Math.abs(a.clientY-j)>5)h=0;h==e&&(h=0,g(a));return b.preventDefault(a)};b.addListener(a,"mousedown",k),d.isIE&&b.addListener(a,"dblclick",k)},b.addKeyListener=function(a,c){var e=null;b.addListener(a,"keydown",function(a){e=a.keyIdentifier||a.keyCode;return c(a)}),d.isMac&&(d.isGecko||d.isOpera)&&b.addListener(a,"keypress",function(a){var b=a.keyIdentifier||a.keyCode;if(e!==b)return c(a);e=null})}}),define("pilot/event_emitter",function(a,b,c){var d={};d._dispatchEvent=function(a,b){this._eventRegistry=this._eventRegistry||{};var c=this._eventRegistry[a];if(c&&c.length){var b=b||{};b.type=a;for(var d=0;d>>0;if(c===0)return-1;var d=0;arguments.length>0&&(d=Number(arguments[1]),d!==d?d=0:d!==0&&d!==1/0&&d!==-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d))));if(d>=c)return-1;var e=d>=0?d:Math.max(c-Math.abs(d),0);for(;e>>0;if(typeof a!=="function")throw new TypeError;var d=arguments[1];for(var e=0;e47&&d<58&&(j=a.altKey));if(f)a.altKey&&(h+="alt_"),a.ctrlKey&&(h+="ctrl_"),a.metaKey&&(h+="meta_");else if(a.ctrlKey||a.metaKey)return!1}f||(d=a.which,g=f=String.fromCharCode(d),i=f.toLowerCase(),a.metaKey?(h="meta_",f=i):f=null),a.shiftKey&&f&&j&&(h+="shift_"),f&&(f=h+f),!c&&f&&(f=f.replace(/ctrl_meta|meta/,"ctrl"));return[f,g]},b.addKeyDownListener=function(a,c){var g=function(a){var b=c(a);b&&d.stopEvent(a);return b};a.addEventListener("keydown",function(a){if(e.isGecko){if(b.KeyHelper.FUNCTION_KEYS[a.keyCode])return!0;if((a.ctrlKey||a.metaKey)&&b.KeyHelper.PRINTABLE_KEYS[a.keyCode])return!0}if(f(a))return g(a);return!0},!1),a.addEventListener("keypress",function(a){if(e.isGecko){if(b.KeyHelper.FUNCTION_KEYS[a.keyCode])return g(a);if((a.ctrlKey||a.metaKey)&&b.KeyHelper.PRINTABLE_KEYS_CHARCODE[a.charCode]){a._keyCode=b.KeyHelper.PRINTABLE_KEYS_CHARCODE[a.charCode],a._charCode=0;return g(a)}}if(a.charCode!==undefined&&a.charCode===0)return!0;return g(a)},!1)}}),define("pilot/lang",function(a,b,c){b.stringReverse=function(a){return a.split("").reverse().join("")},b.stringRepeat=function(a,b){return Array(b+1).join(a)},b.copyObject=function(a){var b={};for(var c in a)b[c]=a[c];return b},b.arrayToMap=function(a){var b={};for(var c=0;cthis.NEW){e.resolve(this);return e}a([this.name],function(a){a.install&&a.install(b,c),this.status=this.INSTALLED,e.resolve(this)}.bind(this));return e},register:function(b,c){var e=new d;if(this.status!=this.INSTALLED){e.resolve(this);return e}a([this.name],function(a){a.register&&a.register(b,c),this.status=this.REGISTERED,e.resolve(this)}.bind(this));return e},startup:function(c,e){e=e||b.REASONS.APP_STARTUP;var f=new d;if(this.status!=this.REGISTERED){f.resolve(this);return f}a([this.name],function(a){a.startup&&a.startup(c,e),this.status=this.STARTED,f.resolve(this)}.bind(this));return f},shutdown:function(b,c){this.status==this.STARTED&&(pluginModule=a(this.name),pluginModule.shutdown&&pluginModule.shutdown(b,c))}},b.PluginCatalog=function(){this.plugins={}},b.PluginCatalog.prototype={registerPlugins:function(a,c,e){var f=[];a.forEach(function(a){var d=this.plugins[a];d===undefined&&(d=new b.Plugin(a),this.plugins[a]=d,f.push(d.register(c,e)))}.bind(this));return d.group(f)},startupPlugins:function(a,b){var c=[];for(var e in this.plugins){var f=this.plugins[e];c.push(f.startup(a,b))}return d.group(c)}},b.catalog=new b.PluginCatalog}),define("pilot/promise",function(a,b,c){var d=a("pilot/console"),e=a("pilot/stacktrace").Trace,f=-1,g=0,h=1,i=0,j=!1,k=[],l=[];Promise=function(){this._status=g,this._value=undefined,this._onSuccessHandlers=[],this._onErrorHandlers=[],this._id=i++,k[this._id]=this},Promise.prototype.isPromise=!0,Promise.prototype.isComplete=function(){return this._status!=g},Promise.prototype.isResolved=function(){return this._status==h},Promise.prototype.isRejected=function(){return this._status==f},Promise.prototype.then=function(a,b){typeof a==="function"&&(this._status===h?a.call(null,this._value):this._status===g&&this._onSuccessHandlers.push(a)),typeof b==="function"&&(this._status===f?b.call(null,this._value):this._status===g&&this._onErrorHandlers.push(b));return this},Promise.prototype.chainPromise=function(a){var b=new Promise;b._chainedFrom=this,this.then(function(c){try{b.resolve(a(c))}catch(d){b.reject(d)}},function(a){b.reject(a)});return b},Promise.prototype.resolve=function(a){return this._complete(this._onSuccessHandlers,h,a,"resolve")},Promise.prototype.reject=function(a){return this._complete(this._onErrorHandlers,f,a,"reject")},Promise.prototype._complete=function(a,b,c,f){if(this._status!=g){d.group("Promise already closed"),d.error("Attempted "+f+"() with ",c),d.error("Previous status = ",this._status,", previous value = ",this._value),d.trace(),this._completeTrace&&(d.error("Trace of previous completion:"),this._completeTrace.log(5)),d.groupEnd();return this}j&&(this._completeTrace=new e(new Error)),this._status=b,this._value=c,a.forEach(function(a){a.call(null,this._value)},this),this._onSuccessHandlers.length=0,this._onErrorHandlers.length=0,delete k[this._id],l.push(this);while(l.length>20)l.shift();return this},Promise.group=function(a){a instanceof Array||(a=Array.prototype.slice.call(arguments));if(a.length===0)return(new Promise).resolve([]);var b=new Promise,c=[],d=0,e=function(e){return function(g){c[e]=g,d++,b._status!==f&&(d===a.length&&b.resolve(c))}};a.forEach(function(a,c){var d=e(c),f=b.reject.bind(b);a.then(d,f)});return b},b.Promise=Promise,b._outstanding=k,b._recent=l}),define("pilot/proxy",function(a,b,c){var d=a("pilot/promise").Promise;b.xhr=function(a,b,c,e){var f=new d;if(skywriter.proxy&&skywriter.proxy.xhr)skywriter.proxy.xhr.call(this,a,b,c,e,f);else{var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState===4){var a=g.status;if(a!==0&&a!==200){var b=new Error(g.responseText+" (Status "+g.status+")");b.xhr=g,f.reject(b);return}f.resolve(g.responseText)}}.bind(this),g.open("GET",b,c),e&&e(g),g.send()}return f},b.Worker=function(a){return skywriter.proxy&&skywriter.proxy.worker?new skywriter.proxy.worker(a):new Worker(a)}}),define("pilot/rangeutils",function(a,b,c){var d=a("util/util");b.addPositions=function(a,b){return{row:a.row+b.row,col:a.col+b.col}},b.cloneRange=function(a){var b=a.start,c=a.end,d={row:b.row,col:b.col},e={row:c.row,col:c.col};return{start:d,end:e}},b.comparePositions=function(a,b){var c=a.row-b.row;return c===0?a.col-b.col:c},b.equal=function(a,c){return b.comparePositions(a.start,c.start)===0&&b.comparePositions(a.end,c.end)===0},b.extendRange=function(a,b){var c=a.end;return{start:a.start,end:{row:c.row+b.row,col:c.col+b.col}}},b.intersectRangeSets=function(a,c){var e=d.clone(a),f=d.clone(c),g=[];while(e.length>0&&f.length>0){var h=e.shift(),i=f.shift(),j=b.comparePositions(h.start,i.start),k=b.comparePositions(h.end,i.end);b.comparePositions(h.end,i.start)<0?(g.push(h),f.unshift(i)):b.comparePositions(i.end,h.start)<0?(g.push(i),e.unshift(h)):j<0?(g.push({start:h.start,end:i.start}),e.unshift({start:i.start,end:h.end}),f.unshift(i)):j===0?k<0?f.unshift({start:h.end,end:i.end}):k>0&&e.unshift({start:i.end,end:h.end}):j>0&&(g.push({start:i.start,end:h.start}),e.unshift(h),f.unshift({start:h.start,end:i.end}))}return g.concat(e,f)},b.isZeroLength=function(a){return a.start.row===a.end.row&&a.start.col===a.end.col},b.maxPosition=function(a,c){return b.comparePositions(a,c)>0?a:c},b.normalizeRange=function(a){return this.comparePositions(a.start,a.end)<0?a:{start:a.end,end:a.start}},b.rangeSetBoundaries=function(a){return{start:a[0].start,end:a[a.length-1].end}},b.toString=function(a){var b=a.start,c=a.end;return"[ "+b.row+", "+b.col+" "+c.row+","+ +c.col+" ]"},b.unionRanges=function(a,b){return{start:a.start.rowb.end.row||a.end.row===b.end.row&&a.end.col>b.end.col?a.end:b.end}},b.isPosition=function(a){return!d.none(a)&&!d.none(a.row)&&!d.none(a.col)},b.isRange=function(a){return!d.none(a)&&b.isPosition(a.start)&&b.isPosition(a.end)}}),define("pilot/settings/canon",function(a,b,c){var d={name:"historyLength",description:"How many typed commands do we recall for reference?",type:"number",defaultValue:50};b.startup=function(a,b){a.env.settings.addSetting(d)},b.shutdown=function(a,b){a.env.settings.removeSetting(d)}}),define("pilot/settings",function(a,b,c){function l(){}function k(a){this._deactivated={},this._settings={},this._settingNames=[],a&&this.setPersister(a)}function j(a,b){this._settings=b,Object.keys(a).forEach(function(b){this[b]=a[b]},this),this.type=f.getType(this.type);if(this.type==null)throw new Error("In "+this.name+": can't find type for: "+JSON.stringify(a.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}var d=a("pilot/console"),e=a("pilot/oop"),f=a("pilot/types"),g=a("pilot/event_emitter").EventEmitter,h=a("pilot/catalog"),i={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"};b.startup=function(a,b){h.addExtensionSpec(i)},b.shutdown=function(a,b){h.removeExtensionSpec(i)},j.prototype={get:function(){return this.value},set:function(a){this.value!==a&&(this.value=a,this._settings.persister&&this._settings.persister.persistValue(this._settings,this.name,a),this._dispatchEvent("change",{setting:this,value:a}))},resetValue:function(){this.set(this.defaultValue)}},e.implement(j.prototype,g),k.prototype={addSetting:function(a){var b=new j(a,this);this._settings[b.name]=b,this._settingNames.push(b.name),this._settingNames.sort()},removeSetting:function(a){var b=typeof a==="string"?a:a.name;delete this._settings[b],util.arrayRemove(this._settingNames,b)},getSettingNames:function(){return this._settingNames},getSetting:function(a){return this._settings[a]},setPersister:function(a){this._persister=a,a&&a.loadInitialValues(this)},resetAll:function(){this.getSettingNames().forEach(function(a){this.resetValue(a)},this)},_list:function(){var a=[];this.getSettingNames().forEach(function(b){a.push({key:b,value:this.getSetting(b).get()})},this);return a},_loadDefaultValues:function(){this._loadFromObject(this._getDefaultValues())},_loadFromObject:function(a){for(var b in a)if(a.hasOwnProperty(b)){var c=this._settings[b];if(c){var d=c.type.parse(a[b]);this.set(b,d)}else this.set(b,a[b])}},_saveToObject:function(){return this.getSettingNames().map(function(a){return this._settings[a].type.stringify(this.get(a))}.bind(this))},_getDefaultValues:function(){return this.getSettingNames().map(function(a){return this._settings[a].spec.defaultValue}.bind(this))}},b.settings=new k,l.prototype={loadInitialValues:function(a){a._loadDefaultValues();var b=cookie.get("settings");a._loadFromObject(JSON.parse(b))},persistValue:function(a,b,c){try{var e=JSON.stringify(a._saveToObject());cookie.set("settings",e)}catch(f){d.error("Unable to JSONify the settings! "+f);return}}},b.CookiePersister=l}),define("pilot/stacktrace",function(a,b,c){function i(){}function g(a){for(var b=0;b\s*\(/gm,"{anonymous}()@").split("\n")},firefox:function(a){var b=a.stack;if(!b){e.log(a);return[]}b=b.replace(/(?:\n@:0)?\s+$/m,""),b=b.replace(/^\(/gm,"{anonymous}(");return b.split("\n")},opera:function(a){var b=a.message.split("\n"),c="{anonymous}",d=/Line\s+(\d+).*?script\s+(http\S+)(?:.*?in\s+function\s+(\S+))?/i,e,f,g;for(e=4,f=0,g=b.length;e0){var h="Possibilities"+(a.length===0?"":" for '"+a+"'");return new f(null,g.INCOMPLETE,h,e)}var h="Can't use '"+a+"'.";return new f(null,g.INVALID,h,e)},j.prototype.fromString=function(a){return a},j.prototype.decrement=function(a){var b=typeof this.data==="function"?this.data():this.data,c;if(a==null)c=b.length-1;else{var d=this.stringify(a),c=b.indexOf(d);c=c===0?b.length-1:c-1}return this.fromString(b[c])},j.prototype.increment=function(a){var b=typeof this.data==="function"?this.data():this.data,c;if(a==null)c=0;else{var d=this.stringify(a),c=b.indexOf(d);c=c===b.length-1?0:c+1}return this.fromString(b[c])},j.prototype.name="selection",b.SelectionType=j;var k=new j({name:"bool",data:["true","false"],stringify:function(a){return""+a},fromString:function(a){return a==="true"?!0:!1}});l.prototype=new e,l.prototype.stringify=function(a){return this.defer().stringify(a)},l.prototype.parse=function(a){return this.defer().parse(a)},l.prototype.decrement=function(a){var b=this.defer();return b.decrement?b.decrement(a):undefined},l.prototype.increment=function(a){var b=this.defer();return b.increment?b.increment(a):undefined},l.prototype.name="deferred",b.DeferredType=l,m.prototype=new e,m.prototype.stringify=function(a){return a.join(" ")},m.prototype.parse=function(a){return this.defer().parse(a)},m.prototype.name="array",b.startup=function(){d.registerType(h),d.registerType(i),d.registerType(k),d.registerType(j),d.registerType(l),d.registerType(m)},b.shutdown=function(){d.unregisterType(h),d.unregisterType(i),d.unregisterType(k),d.unregisterType(j),d.unregisterType(l),d.unregisterType(m)}}),define("pilot/types/command",function(a,b,c){var d=a("pilot/canon"),e=a("pilot/types/basic").SelectionType,f=a("pilot/types"),g=new e({name:"command",data:function(){return d.getCommandNames()},stringify:function(a){return a.name},fromString:function(a){return d.getCommand(a)}});b.startup=function(){f.registerType(g)},b.shutdown=function(){f.unregisterType(g)}}),define("pilot/types/settings",function(a,b,c){var d=a("pilot/types/basic").SelectionType,e=a("pilot/types/basic").DeferredType,f=a("pilot/types"),g=a("pilot/settings").settings,h,i=new d({name:"setting",data:function(){return k.settings.getSettingNames()},stringify:function(a){h=a;return a.name},fromString:function(a){h=g.getSetting(a);return h},noMatch:function(){h=null}}),j=new e({name:"settingValue",defer:function(){return h?h.type:f.getType("text")},getDefault:function(){var a=this.parse("");if(h){var b=h.get();if(a.predictions.length===0)a.predictions.push(b);else{var c=!1;while(!0){var d=a.predictions.indexOf(b);if(d===-1)break;a.predictions.splice(d,1),c=!0}c&&a.predictions.push(b)}}return a}}),k;b.startup=function(a,b){k=a.env,f.registerType(i),f.registerType(j)},b.shutdown=function(a,b){f.unregisterType(i),f.unregisterType(j)}}),define("pilot/types",function(a,b,c){function h(a,b){if(a.substr(-2)==="[]"){var c=a.slice(0,-2);return new g.array(c)}var d=g[a];typeof d==="function"&&(d=new d(b));return d}function f(){}function e(a,b,c,e){this.value=a,this.status=b||d.VALID,this.message=c,this.predictions=e||[]}var d={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(a){var b=d.VALID;for(var c=0;cb&&(b=arguments[c]);return b}};b.Status=d,b.Conversion=e,f.prototype={stringify:function(a){throw new Error("not implemented")},parse:function(a){throw new Error("not implemented")},name:undefined,increment:function(a){return undefined},decrement:function(a){return undefined},getDefault:function(){return this.parse("")}},b.Type=f;var g={};b.registerType=function(a){if(typeof a==="object"){if(!(a instanceof f))throw new Error("Can't registerType using: "+a);if(!a.name)throw new Error("All registered types must have a name");g[a.name]=a}else{if(typeof a!=="function")throw new Error("Unknown type: "+a);if(!a.prototype.name)throw new Error("All registered types must have a name");g[a.prototype.name]=a}},b.deregisterType=function(a){delete g[a.name]},b.getType=function(a){if(typeof a==="string")return h(a);if(typeof a==="object"){if(!a.name)throw new Error("Missing 'name' member to typeSpec");return h(a.name,a)}throw new Error("Can't extract type from "+a)}}),define("pilot/useragent",function(a,b,c){var d=(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase(),e=navigator.userAgent,f=navigator.appVersion;b.isWin=d=="win",b.isMac=d=="mac",b.isLinux=d=="linux",b.isIE=!+" 1",b.isGecko=b.isMozilla=window.controllers&&window.navigator.product==="Gecko",b.isOpera=window.opera&&Object.prototype.toString.call(window.opera)=="[object Opera]",b.isWebKit=parseFloat(e.split("WebKit/")[1])||undefined,b.isAIR=e.indexOf("AdobeAIR")>=0,b.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},b.getOS=function(){return b.isMac?b.OS.MAC:b.isLinux?b.OS.LINUX:b.OS.WINDOWS}}),define("ace/background_tokenizer",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/event_emitter").EventEmitter,f=function(a,b){this.running=!1,this.textLines=[],this.lines=[],this.currentLine=0,this.tokenizer=a;var c=this;this.$worker=function(){if(c.running){var a=new Date,d=c.currentLine,e=c.textLines,f=0,g=b.getLastVisibleRow();while(c.currentLine20){c.fireUpdateEvent(d,c.currentLine-1);var h=c.currentLine0&&this.lines[a-1]&&(d=this.lines[a-1].state,e=!0);for(var f=a;f<=b;f++)if(this.lines[f]){var g=this.lines[f];d=g.state,c.push(g)}else{var g=this.tokenizer.getLineTokens(this.textLines[f]||"",d),d=g.state;c.push(g),e&&(this.lines[f]=g)}return c}}).call(f.prototype),b.BackgroundTokenizer=f}),define("ace/commands/default_commands",function(a,b,c){var d=a("pilot/canon");d.addCommand({name:"selectall",exec:function(a,b,c){a.editor.getSelection().selectAll()}}),d.addCommand({name:"removeline",exec:function(a,b,c){a.editor.removeLines()}}),d.addCommand({name:"gotoline",exec:function(a,b,c){var d=parseInt(prompt("Enter line number:"));isNaN(d)||a.editor.gotoLine(d)}}),d.addCommand({name:"togglecomment",exec:function(a,b,c){a.editor.toggleCommentLines()}}),d.addCommand({name:"findnext",exec:function(a,b,c){a.editor.findNext()}}),d.addCommand({name:"findprevious",exec:function(a,b,c){a.editor.findPrevious()}}),d.addCommand({name:"find",exec:function(a,b,c){var d=prompt("Find:");a.editor.find(d)}}),d.addCommand({name:"undo",exec:function(a,b,c){a.editor.undo()}}),d.addCommand({name:"redo",exec:function(a,b,c){a.editor.redo()}}),d.addCommand({name:"redo",exec:function(a,b,c){a.editor.redo()}}),d.addCommand({name:"overwrite",exec:function(a,b,c){a.editor.toggleOverwrite()}}),d.addCommand({name:"copylinesup",exec:function(a,b,c){a.editor.copyLinesUp()}}),d.addCommand({name:"movelinesup",exec:function(a,b,c){a.editor.moveLinesUp()}}),d.addCommand({name:"selecttostart",exec:function(a,b,c){a.editor.getSelection().selectFileStart()}}),d.addCommand({name:"gotostart",exec:function(a,b,c){a.editor.navigateFileStart()}}),d.addCommand({name:"selectup",exec:function(a,b,c){a.editor.getSelection().selectUp()}}),d.addCommand({name:"golineup",exec:function(a,b,c){a.editor.navigateUp()}}),d.addCommand({name:"copylinesdown",exec:function(a,b,c){a.editor.copyLinesDown()}}),d.addCommand({name:"movelinesdown",exec:function(a,b,c){a.editor.moveLinesDown()}}),d.addCommand({name:"selecttoend",exec:function(a,b,c){a.editor.getSelection().selectFileEnd()}}),d.addCommand({name:"gotoend",exec:function(a,b,c){a.editor.navigateFileEnd()}}),d.addCommand({name:"selectdown",exec:function(a,b,c){a.editor.getSelection().selectDown()}}),d.addCommand({name:"godown",exec:function(a,b,c){a.editor.navigateDown()}}),d.addCommand({name:"selectwordleft",exec:function(a,b,c){a.editor.getSelection().selectWordLeft()}}),d.addCommand({name:"gotowordleft",exec:function(a,b,c){a.editor.navigateWordLeft()}}),d.addCommand({name:"selecttolinestart",exec:function(a,b,c){a.editor.getSelection().selectLineStart()}}),d.addCommand({name:"gotolinestart",exec:function(a,b,c){a.editor.navigateLineStart()}}),d.addCommand({name:"selectleft",exec:function(a,b,c){a.editor.getSelection().selectLeft()}}),d.addCommand({name:"gotoleft",exec:function(a,b,c){a.editor.navigateLeft()}}),d.addCommand({name:"selectwordright",exec:function(a,b,c){a.editor.getSelection().selectWordRight()}}),d.addCommand({name:"gotowordright",exec:function(a,b,c){a.editor.navigateWordRight()}}),d.addCommand({name:"selecttolineend",exec:function(a,b,c){a.editor.getSelection().selectLineEnd()}}),d.addCommand({name:"gotolineend",exec:function(a,b,c){a.editor.navigateLineEnd()}}),d.addCommand({name:"selectright",exec:function(a,b,c){a.editor.getSelection().selectRight()}}),d.addCommand({name:"gotoright",exec:function(a,b,c){a.editor.navigateRight()}}),d.addCommand({name:"selectpagedown",exec:function(a,b,c){a.editor.selectPageDown()}}),d.addCommand({name:"pagedown",exec:function(a,b,c){a.editor.scrollPageDown()}}),d.addCommand({name:"gotopagedown",exec:function(a,b,c){a.editor.gotoPageDown()}}),d.addCommand({name:"selectpageup",exec:function(a,b,c){a.editor.selectPageUp()}}),d.addCommand({name:"pageup",exec:function(a,b,c){a.editor.scrollPageUp()}}),d.addCommand({name:"gotopageup",exec:function(a,b,c){a.editor.gotoPageUp()}}),d.addCommand({name:"selectlinestart",exec:function(a,b,c){a.editor.getSelection().selectLineStart()}}),d.addCommand({name:"gotolinestart",exec:function(a,b,c){a.editor.navigateLineStart()}}),d.addCommand({name:"selectlineend",exec:function(a,b,c){a.editor.getSelection().selectLineEnd()}}),d.addCommand({name:"gotolineend",exec:function(a,b,c){a.editor.navigateLineEnd()}}),d.addCommand({name:"del",exec:function(a,b,c){a.editor.removeRight()}}),d.addCommand({name:"backspace",exec:function(a,b,c){a.editor.removeLeft()}}),d.addCommand({name:"outdent",exec:function(a,b,c){a.editor.blockOutdent()}}),d.addCommand({name:"indent",exec:function(a,b,c){a.editor.indent()}})}),define("ace/conf/keybindings/default_mac",function(a,b,c){b.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",function(a,b,c){b.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("ace/document",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("pilot/event_emitter").EventEmitter,g=a("ace/selection").Selection,h=a("ace/mode/text").Mode,i=a("ace/range").Range,j=function(a,b){this.modified=!0,this.lines=[],this.selection=new g(this),this.$breakpoints=[],this.listeners=[],b&&this.setMode(b),Array.isArray(a)?this.$insertLines(0,a):this.$insert({row:0,column:0},a)};(function(){d.implement(this,f),this.$undoManager=null,this.$split=function(a){return a.split(/\r\n|\r|\n/)},this.setValue=function(a){var b=[0,this.lines.length];b.push.apply(b,this.$split(a)),this.lines.splice.apply(this.lines,b),this.modified=!0,this.fireChangeEvent(0)},this.toString=function(){return this.lines.join(this.$getNewLineCharacter())},this.getSelection=function(){return this.selection},this.fireChangeEvent=function(a,b){var c={firstRow:a,lastRow:b};this._dispatchEvent("change",{data:c})},this.setUndoManager=function(a){this.$undoManager=a,this.$deltas=[],this.$informUndoManager&&this.$informUndoManager.cancel();if(a){var b=this;this.$informUndoManager=e.deferredCall(function(){b.$deltas.length>0&&a.execute({action:"aceupdate",args:[b.$deltas,b]}),b.$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=!0,this.setUseSoftTabs=function(a){this.$useSoftTabs!==a&&(this.$useSoftTabs=a)},this.getUseSoftTabs=function(){return this.$useSoftTabs},this.$tabSize=4,this.setTabSize=function(a){!isNaN(a)&&this.$tabSize!==a&&(this.modified=!0,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 b=0;b0&&(d=!!c.charAt(b-1).match(this.tokenRe)),d||(d=!!c.charAt(b).match(this.tokenRe));var e=d?this.tokenRe:this.nonTokenRe,f=b;if(f>0){do f--;while(f>=0&&c.charAt(f).match(e));f++}var g=b;while(g=0){var h=g.charAt(d);if(h==c){f-=1;if(f==0)return{row:e,column:d}}else h==a&&(f+=1);d-=1}e-=1;if(e<0)break;var g=this.getLine(e),d=g.length-1}return null},this.$findClosingBracket=function(a,b){var c=this.$brackets[a],d=b.column,e=b.row,f=1,g=this.getLine(e),h=this.getLength();while(!0){while(d=h)break;var g=this.getLine(e),d=0}return null},this.insert=function(a,b,c){var d=this.$insert(a,b,c);this.fireChangeEvent(a.row,a.row==d.row?a.row:undefined);return d},this.$insertLines=function(a,b,c){if(b.length!=0){var d=[a,0];d.push.apply(d,b),this.lines.splice.apply(this.lines,d);if(!c&&this.$undoManager){var e=this.$getNewLineCharacter();this.$deltas.push({action:"insertText",range:new i(a,0,a+b.length,0),text:b.join(e)+e}),this.$informUndoManager.schedule()}}},this.$insert=function(a,b,c){if(b.length==0)return a;this.modified=!0,this.lines.length<=1&&this.$detectNewLine(b);var d=this.$split(b);if(this.$isNewLine(b)){var e=this.lines[a.row]||"";this.lines[a.row]=e.substring(0,a.column),this.lines.splice(a.row+1,0,e.substring(a.column));var f={row:a.row+1,column:0}}else if(d.length==1){var e=this.lines[a.row]||"";this.lines[a.row]=e.substring(0,a.column)+b+e.substring(a.column);var f={row:a.row,column:a.column+b.length}}else{var e=this.lines[a.row]||"",g=e.substring(0,a.column)+d[0],h=d[d.length-1]+e.substring(a.column);this.lines[a.row]=g,this.$insertLines(a.row+1,[h],!0),d.length>2&&this.$insertLines(a.row+1,d.slice(1,-1),!0);var f={row:a.row+d.length-1,column:d[d.length-1].length}}!c&&this.$undoManager&&(this.$deltas.push({action:"insertText",range:i.fromPoints(a,f),text:b}),this.$informUndoManager.schedule());return f},this.$isNewLine=function(a){return a=="\r\n"||a=="\r"||a=="\n"},this.remove=function(a,b){if(a.isEmpty())return a.start;this.$remove(a,b),this.fireChangeEvent(a.start.row,a.isMultiLine()?undefined:a.start.row);return a.start},this.$remove=function(a,b){if(!a.isEmpty()){if(!b&&this.$undoManager){var c=this.$getNewLineCharacter();this.$deltas.push({action:"removeText",range:a.clone(),text:this.getTextRange(a)}),this.$informUndoManager.schedule()}this.modified=!0;var d=a.start.row,e=a.end.row,f=this.getLine(d).substring(0,a.start.column)+this.getLine(e).substring(a.end.column);f!=""?this.lines.splice(d,e-d+1,f):this.lines.splice(d,e-d+1,"");return a.start}},this.undoChanges=function(a){this.selection.clearSelection();for(var b=a.length-1;b>=0;b--){var c=a[b];c.action=="insertText"?(this.remove(c.range,!0),this.selection.moveCursorToPosition(c.range.start)):(this.insert(c.range.start,c.text,!0),this.selection.clearSelection())}},this.redoChanges=function(a){this.selection.clearSelection();for(var b=0;b=this.lines.length-1)return 0;var c=this.lines.slice(a,b+1);this.$remove(new i(a,0,b+1,0)),this.$insertLines(a+1,c),this.fireChangeEvent(a,b+1);return 1},this.duplicateLines=function(a,b){var a=this.$clipRowToDocument(a),b=this.$clipRowToDocument(b),c=this.getLines(a,b);this.$insertLines(a,c);var d=b-a+1;this.fireChangeEvent(a);return d},this.$clipRowToDocument=function(a){return Math.max(0,Math.min(a,this.lines.length-1))},this.documentToScreenColumn=function(a,b){var c=this.getTabSize(),d=0,e=b,f=this.getLine(a).split("\t");for(var g=0;gh)e-=h+1,d+=h+c;else{d+=e;break}}return d},this.screenToDocumentColumn=function(a,b){var c=this.getTabSize(),d=0,e=b,f=this.getLine(a).split("\t");for(var g=0;gh){d+=h;break}d+=e;break}e-=h+c,d+=h+1}return d}}).call(j.prototype),b.Document=j}),define("ace/editor",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/event"),f=a("pilot/lang"),g=a("ace/textinput").TextInput,h=a("ace/keybinding").KeyBinding,i=a("ace/document").Document,j=a("ace/search").Search,k=a("ace/background_tokenizer").BackgroundTokenizer,l=a("ace/range").Range,m=a("pilot/event_emitter").EventEmitter,n=function(a,b){var c=a.getContainerElement();this.container=c,this.renderer=a,this.textInput=new g(c,this),this.keyBinding=new h(c,this);var d=this;e.addListener(c,"mousedown",function(a){setTimeout(function(){d.focus()});return e.preventDefault(a)}),e.addListener(c,"selectstart",function(a){return e.preventDefault(a)});var f=a.getMouseEventTarget();e.addListener(f,"mousedown",this.onMouseDown.bind(this)),e.addMultiMouseDownListener(f,0,2,500,this.onMouseDoubleClick.bind(this)),e.addMultiMouseDownListener(f,0,3,600,this.onMouseTripleClick.bind(this)),e.addMouseWheelListener(f,this.onMouseWheel.bind(this)),this.$selectionMarker=null,this.$highlightLineMarker=null,this.$blockScrolling=!1,this.$search=(new j).set({wrap:!0}),this.setDocument(b||new i("")),this.focus()};(function(){d.implement(this,m),this.$forwardEvents={gutterclick:1,gutterdblclick:1},this.$originalAddEventListener=this.addEventListener,this.$originalRemoveEventListener=this.removeEventListener,this.addEventListener=function(a,b){return this.$forwardEvents[a]?this.renderer.addEventListener(a,b):this.$originalAddEventListener(a,b)},this.removeEventListener=function(a,b){return this.$forwardEvents[a]?this.renderer.removeEventListener(a,b):this.$originalRemoveEventListener(a,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 b=this.doc.getSelection();b.removeEventListener("changeCursor",this.$onCursorChange),b.removeEventListener("changeSelection",this.$onSelectionChange),this.doc.setScrollTopRow(this.renderer.getScrollTopRow())}this.doc=a,this.$onDocumentChange=this.onDocumentChange.bind(this),a.addEventListener("change",this.$onDocumentChange),this.renderer.setDocument(a),this.$onDocumentModeChange=this.onDocumentModeChange.bind(this),a.addEventListener("changeMode",this.$onDocumentModeChange),this.$onDocumentChangeTabSize=this.renderer.updateText.bind(this.renderer),a.addEventListener("changeTabSize",this.$onDocumentChangeTabSize),this.$onDocumentChangeBreakpoint=this.onDocumentChangeBreakpoint.bind(this),this.doc.addEventListener("changeBreakpoint",this.$onDocumentChangeBreakpoint),this.selection=a.getSelection(),this.$desiredColumn=0,this.$onCursorChange=this.onCursorChange.bind(this),this.selection.addEventListener("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.addEventListener("changeSelection",this.$onSelectionChange),this.onDocumentModeChange(),this.bgTokenizer.setLines(this.doc.lines),this.bgTokenizer.start(0),this.onCursorChange(),this.onSelectionChange(),this.onDocumentChangeBreakpoint(),this.renderer.scrollToRow(a.getScrollTopRow()),this.renderer.updateFull()}},this.getDocument=function(){return this.doc},this.getSelection=function(){return this.selection},this.resize=function(){this.renderer.onResize()},this.setTheme=function(a){this.renderer.setTheme(a)},this.$highlightBrackets=function(){this.$bracketHighlight&&(this.renderer.removeMarker(this.$bracketHighlight),this.$bracketHighlight=null);if(!this.$highlightPending){var a=this;this.$highlightPending=!0,setTimeout(function(){a.$highlightPending=!1;var b=a.doc.findMatchingBracket(a.getCursorPosition());if(b){var c=new l(b.row,b.column,b.row,b.column+1);a.$bracketHighlight=a.renderer.addMarker(c,"ace_bracket")}},10)}},this.focus=function(){this.textInput.focus()},this.blur=function(){this.textInput.blur()},this.onFocus=function(){this.renderer.showCursor(),this.renderer.visualizeFocus()},this.onBlur=function(){this.renderer.hideCursor(),this.renderer.visualizeBlur()},this.onDocumentChange=function(a){var b=a.data;this.bgTokenizer.start(b.firstRow),this.renderer.updateLines(b.firstRow,b.lastRow),this.renderer.updateCursor(this.getCursorPosition(),this.$overwrite)},this.onTokenizerUpdate=function(a){var b=a.data;this.renderer.updateLines(b.first,b.last)},this.onCursorChange=function(){this.$highlightBrackets(),this.renderer.updateCursor(this.getCursorPosition(),this.$overwrite),this.$blockScrolling||this.renderer.scrollCursorIntoView(),this.$updateHighlightActiveLine()},this.$updateHighlightActiveLine=function(){this.$highlightLineMarker&&this.renderer.removeMarker(this.$highlightLineMarker),this.$highlightLineMarker=null;if(this.getHighlightActiveLine()&&(this.getSelectionStyle()!="line"||!this.selection.isMultiLine())){var a=this.getCursorPosition(),b=new l(a.row,0,a.row+1,0);this.$highlightLineMarker=this.renderer.addMarker(b,"ace_active_line","line")}},this.onSelectionChange=function(){this.$selectionMarker&&this.renderer.removeMarker(this.$selectionMarker),this.$selectionMarker=null;if(!this.selection.isEmpty()){var a=this.selection.getRange(),b=this.getSelectionStyle();this.$selectionMarker=this.renderer.addMarker(a,"ace_selection",b)}this.onCursorChange()},this.onDocumentChangeBreakpoint=function(){this.renderer.setBreakpoints(this.doc.getBreakpoints())},this.onDocumentModeChange=function(){var a=this.doc.getMode();if(this.mode!=a){this.mode=a;var b=a.getTokenizer();if(this.bgTokenizer)this.bgTokenizer.setTokenizer(b);else{var c=this.onTokenizerUpdate.bind(this);this.bgTokenizer=new k(b,this),this.bgTokenizer.addEventListener("update",c)}this.renderer.setTokenizer(this.bgTokenizer)}},this.onMouseDown=function(a){var b=e.getDocumentX(a),c=e.getDocumentY(a),d=this.renderer.screenToTextCoordinates(b,c);d.row=Math.max(0,Math.min(d.row,this.doc.getLength()-1));if(e.getButton(a)!=0)this.selection.isEmpty()&&this.moveCursorToPosition(d);else{a.shiftKey?this.selection.selectToPosition(d):(this.moveCursorToPosition(d),this.$clickSelection||this.selection.clearSelection(d.row,d.column)),this.renderer.scrollCursorIntoView();var f=this,g,h,i=function(a){g=e.getDocumentX(a),h=e.getDocumentY(a)},j=function(){clearInterval(l),f.$clickSelection=null},k=function(){if(g!==undefined&&h!==undefined){var a=f.renderer.screenToTextCoordinates(g,h);a.row=Math.max(0,Math.min(a.row,f.doc.getLength()-1));if(f.$clickSelection)if(f.$clickSelection.contains(a.row,a.column))f.selection.setSelectionRange(f.$clickSelection);else{if(f.$clickSelection.compare(a.row,a.column)==-1)var b=f.$clickSelection.end;else var b=f.$clickSelection.start;f.selection.setSelectionAnchor(b.row,b.column),f.selection.selectToPosition(a)}else f.selection.selectToPosition(a);f.renderer.scrollCursorIntoView()}};e.capture(this.container,i,j);var l=setInterval(k,20);return e.preventDefault(a)}},this.onMouseDoubleClick=function(a){this.selection.selectWord(),this.$clickSelection=this.getSelectionRange(),this.$updateDesiredColumn()},this.onMouseTripleClick=function(a){this.selection.selectLine(),this.$clickSelection=this.getSelectionRange(),this.$updateDesiredColumn()},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())},this.onCut=function(){this.$readOnly||(this.selection.isEmpty()||(this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())),this.clearSelection()))},this.onTextInput=function(a){if(!this.$readOnly){var b=this.getCursorPosition();a=a.replace("\t",this.doc.getTabString());if(this.selection.isEmpty()){if(this.$overwrite){var c=new l.fromPoints(b,b);c.end.column+=a.length,this.doc.remove(c)}}else{var b=this.doc.remove(this.getSelectionRange());this.clearSelection()}this.clearSelection();var d=this;this.bgTokenizer.getState(b.row,function(c){var e=d.mode.checkOutdent(c,d.doc.getLine(b.row),a),f=d.doc.getLine(b.row),g=d.mode.getNextLineIndent(c,f.slice(0,b.column),d.doc.getTabString()),h=d.doc.insert(b,a);d.bgTokenizer.getState(b.row,function(a){if(b.row!==h.row){var c=d.doc.getTabSize(),i=Number.MAX_VALUE;for(var j=b.row+1;j<=h.row;++j){var k=0;f=d.doc.getLine(j);for(var m=0;m0;++m)f.charAt(m)=="\t"?n-=c:f.charAt(m)==" "&&(n-=1);d.doc.replace(new l(j,0,j,f.length),f.substr(m))}h.column+=d.doc.indentRows(b.row+1,h.row,g)}else e&&(h.column+=d.mode.autoOutdent(a,d.doc,b.row));d.moveCursorToPosition(h),d.renderer.scrollCursorIntoView()})})}},this.$overwrite=!1,this.setOverwrite=function(a){this.$overwrite!=a&&(this.$overwrite=a,this.$blockScrolling=!0,this.onCursorChange(),this.$blockScrolling=!1,this._dispatchEvent("changeOverwrite",{data:a}))},this.getOverwrite=function(){return this.$overwrite},this.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},this.$scrollSpeed=1,this.setScrollSpeed=function(a){this.$scrollSpeed=a},this.getScrollSpeed=function(){return this.$scrollSpeed},this.$selectionStyle="line",this.setSelectionStyle=function(a){this.$selectionStyle!=a&&(this.$selectionStyle=a,this.onSelectionChange(),this._dispatchEvent("changeSelectionStyle",{data:a}))},this.getSelectionStyle=function(){return this.$selectionStyle},this.$highlightActiveLine=!0,this.setHighlightActiveLine=function(a){this.$highlightActiveLine!=a&&(this.$highlightActiveLine=a,this.$updateHighlightActiveLine())},this.getHighlightActiveLine=function(){return this.$highlightActiveLine},this.setShowInvisibles=function(a){this.getShowInvisibles()!=a&&this.renderer.setShowInvisibles(a)},this.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},this.setShowPrintMargin=function(a){this.renderer.setShowPrintMargin(a)},this.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},this.setPrintMarginColumn=function(a){this.renderer.setPrintMarginColumn(a)},this.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},this.$readOnly=!1,this.setReadOnly=function(a){this.$readOnly=a},this.getReadOnly=function(){return this.$readOnly},this.removeRight=function(){this.$readOnly||(this.selection.isEmpty()&&this.selection.selectRight(),this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())),this.clearSelection())},this.removeLeft=function(){this.$readOnly||(this.selection.isEmpty()&&this.selection.selectLeft(),this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())),this.clearSelection())},this.indent=function(){if(!this.$readOnly){var a=this.doc,b=this.getSelectionRange();if(b.start.row>=b.end.row&&b.start.column>=b.end.column){var e;if(this.doc.getUseSoftTabs()){var g=a.getTabSize(),h=this.getCursorPosition(),i=a.documentToScreenColumn(h.row,h.column),d=g-i%g;e=f.stringRepeat(" ",d)}else e="\t";return this.onTextInput(e)}var c=this.$getSelectedRows(),d=a.indentRows(c.first,c.last,"\t");this.selection.shiftSelection(d)}},this.blockOutdent=function(){if(!this.$readOnly){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 a=this;this.bgTokenizer.getState(this.getCursorPosition().row,function(b){var c=a.$getSelectedRows(),d=a.mode.toggleCommentLines(b,a.doc,c.first,c.last);a.selection.shiftSelection(d)})}},this.removeLines=function(){if(!this.$readOnly){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(a,b){return this.doc.moveLinesDown(a,b)})},this.moveLinesUp=function(){this.$readOnly||this.$moveLines(function(a,b){return this.doc.moveLinesUp(a,b)})},this.copyLinesUp=function(){this.$readOnly||this.$moveLines(function(a,b){this.doc.duplicateLines(a,b);return 0})},this.copyLinesDown=function(){this.$readOnly||this.$moveLines(function(a,b){return this.doc.duplicateLines(a,b)})},this.$moveLines=function(a){var b=this.$getSelectedRows(),c=a.call(this,b.first,b.last),d=this.selection;d.setSelectionAnchor(b.last+c+1,0),d.$moveSelection(function(){d.moveCursorTo(b.first+c,0)})},this.$getSelectedRows=function(){var a=this.getSelectionRange().collapseRows();return{first:a.start.row,last:a.end.row}},this.onCompositionStart=function(a){this.renderer.showComposition(this.getCursorPosition())},this.onCompositionUpdate=function(a){this.renderer.setCompositionText(a)},this.onCompositionEnd=function(){this.renderer.hideComposition()},this.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},this.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},this.isRowVisible=function(a){return a>=this.getFirstVisibleRow()&&a<=this.getLastVisibleRow()},this.getVisibleRowCount=function(){return this.getLastVisibleRow()-this.getFirstVisibleRow()+1},this.getPageDownRow=function(){return this.renderer.getLastVisibleRow()-1},this.getPageUpRow=function(){var a=this.renderer.getFirstVisibleRow(),b=this.renderer.getLastVisibleRow();return a-(b-a)+1},this.selectPageDown=function(){var a=this.getPageDownRow()+Math.floor(this.getVisibleRowCount()/2);this.scrollPageDown();var b=this.getSelection();b.$moveSelection(function(){b.moveCursorTo(a,b.getSelectionLead().column)})},this.selectPageUp=function(){var a=this.getLastVisibleRow()-this.getFirstVisibleRow(),b=this.getPageUpRow()+Math.round(a/2);this.scrollPageUp();var c=this.getSelection();c.$moveSelection(function(){c.moveCursorTo(b,c.getSelectionLead().column)})},this.gotoPageDown=function(){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 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())},this.scrollPageUp=function(){this.renderer.scrollToRow(this.getPageUpRow())},this.scrollToRow=function(a){this.renderer.scrollToRow(a)},this.getCursorPosition=function(){return this.selection.getCursor()},this.getSelectionRange=function(){return this.selection.getRange()},this.clearSelection=function(){this.selection.clearSelection(),this.$updateDesiredColumn()},this.moveCursorTo=function(a,b){this.selection.moveCursorTo(a,b),this.$updateDesiredColumn()},this.moveCursorToPosition=function(a){this.selection.moveCursorToPosition(a),this.$updateDesiredColumn()},this.gotoLine=function(a,b){this.selection.clearSelection(),this.$blockScrolling=!0,this.moveCursorTo(a-1,b||0),this.$blockScrolling=!1,this.isRowVisible(this.getCursorPosition().row)||this.scrollToRow(a-1-Math.floor(this.getVisibleRowCount()/2))},this.navigateTo=function(a,b){this.clearSelection(),this.moveCursorTo(a,b),this.$updateDesiredColumn(b)},this.navigateUp=function(){this.selection.clearSelection(),this.selection.moveCursorBy(-1,0);if(this.$desiredColumn){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 a=this.getCursorPosition(),b=this.doc.screenToDocumentColumn(a.row,this.$desiredColumn);this.selection.moveCursorTo(a.row,b)}},this.$updateDesiredColumn=function(){var a=this.getCursorPosition();this.$desiredColumn=this.doc.documentToScreenColumn(a.row,a.column)},this.navigateLeft=function(){if(this.selection.isEmpty())this.selection.moveCursorLeft();else{var a=this.getSelectionRange().start;this.moveCursorToPosition(a)}this.clearSelection()},this.navigateRight=function(){if(this.selection.isEmpty())this.selection.moveCursorRight();else{var a=this.getSelectionRange().end;this.moveCursorToPosition(a)}this.clearSelection()},this.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},this.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},this.navigateFileEnd=function(){this.selection.moveCursorFileEnd(),this.clearSelection()},this.navigateFileStart=function(){this.selection.moveCursorFileStart(),this.clearSelection()},this.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},this.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},this.replace=function(a,b){b&&this.$search.set(b);var c=this.$search.find(this.doc);this.$tryReplace(c,a),c!==null&&this.selection.setSelectionRange(c),this.$updateDesiredColumn()},this.replaceAll=function(a,b){b&&this.$search.set(b);var c=this.$search.findAll(this.doc);if(c.length){this.clearSelection(),this.selection.moveCursorTo(0,0);for(var d=c.length-1;d>=0;--d)this.$tryReplace(c[d],a);c[0]!==null&&this.selection.setSelectionRange(c[0]),this.$updateDesiredColumn()}},this.$tryReplace=function(a,b){var c=this.doc.getTextRange(a),b=this.$search.replace(c,b);if(b!==null){a.end=this.doc.replace(a,b);return a}return null},this.getLastSearchOptions=function(){return this.$search.getOptions()},this.find=function(a,b){this.clearSelection(),b=b||{},b.needle=a,this.$search.set(b),this.$find()},this.findNext=function(a){a=a||{},typeof a.backwards=="undefined"&&(a.backwards=!1),this.$search.set(a),this.$find()},this.findPrevious=function(a){a=a||{},typeof a.backwards=="undefined"&&(a.backwards=!0),this.$search.set(a),this.$find()},this.$find=function(a){this.selection.isEmpty()||this.$search.set({needle:this.doc.getTextRange(this.getSelectionRange())}),typeof a!="undefined"&&this.$search.set({backwards:a});var b=this.$search.find(this.doc);b&&(this.gotoLine(b.end.row+1,b.end.column),this.$updateDesiredColumn(),this.selection.setSelectionRange(b))},this.undo=function(){this.doc.getUndoManager().undo()},this.redo=function(){this.doc.getUndoManager().redo()}}).call(n.prototype),b.Editor=n}),define("ace/keybinding",function(a,b,c){var d=a("pilot/useragent"),e=a("pilot/event"),f=a("ace/conf/keybindings/default_mac").bindings,g=a("ace/conf/keybindings/default_win").bindings,h=a("pilot/canon");a("ace/commands/default_commands");var i=function(a,b,c){this.setConfig(c);var f=this;e.addKeyListener(a,function(a){if(d.isOpera&&d.isMac)var c=0|(a.metaKey?1:0)|(a.altKey?2:0)|(a.shiftKey?4:0)|(a.ctrlKey?8:0);else var c=0|(a.ctrlKey?1:0)|(a.altKey?2:0)|(a.shiftKey?4:0)|(a.metaKey?8:0);var g=f.keyNames[a.keyCode],i=(f.config.reverse[c]||{})[(g||String.fromCharCode(a.keyCode)).toLowerCase()],j=h.exec(i,{editor:b});if(j)return e.stopEvent(a)})};(function(){function c(a,c){var d,e,f,g,h={};for(d in a){g=a[d];if(c&&typeof g=="string"){g=g.split(c);for(e=0,f=g.length;e",c+1,""),b.push("");this.element.innerHTML=b.join(""),this.element.style.height=a.minHeight+"px"}}).call(d.prototype),b.Gutter=d}),define("ace/layer/marker",function(a,b,c){var d=a("ace/range").Range,e=function(a){this.element=document.createElement("div"),this.element.className="ace_layer ace_marker-layer",a.appendChild(this.element),this.markers={},this.$markerId=1};(function(){this.setDocument=function(a){this.doc=a},this.addMarker=function(a,b,c){var d=this.$markerId++;this.markers[d]={range:a,type:c||"line",clazz:b};return d},this.removeMarker=function(a){var b=this.markers[a];b&&delete this.markers[a]},this.update=function(a){var a=a||this.config;if(a){this.config=a;var b=[];for(var c in this.markers){var d=this.markers[c],e=d.range.clipRows(a.firstRow,a.lastRow);if(e.isEmpty())continue;e.isMultiLine()?d.type=="text"?this.drawTextMarker(b,e,d.clazz,a):this.drawMultiLineMarker(b,e,d.clazz,a):this.drawSingleLineMarker(b,e,d.clazz,a)}this.element.innerHTML=b.join("")}},this.drawTextMarker=function(a,b,c,e){var f=b.start.row,g=new d(f,b.start.column,f,this.doc.getLine(f).length);this.drawSingleLineMarker(a,g,c,e);var f=b.end.row,g=new d(f,0,f,b.end.column);this.drawSingleLineMarker(a,g,c,e);for(var f=b.start.row+1;f");var g=(b.end.row-d.firstRow)*d.lineHeight,f=Math.round(b.end.column*d.characterWidth);a.push("
");var e=(b.end.row-b.start.row-1)*d.lineHeight;if(e>=0){var g=(b.start.row+1-d.firstRow)*d.lineHeight;a.push("
")}},this.drawSingleLineMarker=function(a,b,c,d){var b=b.toScreenRange(this.doc),e=d.lineHeight,f=Math.round((b.end.column-b.start.column)*d.characterWidth),g=(b.start.row-d.firstRow)*d.lineHeight,h=Math.round(b.start.column*d.characterWidth);a.push("
")}}).call(e.prototype),b.Marker=e}),define("ace/layer/text",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/dom"),f=a("pilot/lang"),g=a("pilot/event_emitter").EventEmitter,h=function(a){this.element=document.createElement("div"),this.element.className="ace_layer ace_text-layer",a.appendChild(this.element),this.$characterSize=this.$measureSizes(),this.$pollSizeChanges()};(function(){d.implement(this,g),this.EOF_CHAR="¶",this.EOL_CHAR="¬",this.TAB_CHAR="→",this.SPACE_CHAR="·",this.setTokenizer=function(a){this.tokenizer=a},this.getLineHeight=function(){return this.$characterSize.height||1},this.getCharacterWidth=function(){return this.$characterSize.width||1},this.$pollSizeChanges=function(){var a=this;setInterval(function(){var b=a.$measureSizes();if(a.$characterSize.width!==b.width||a.$characterSize.height!==b.height)a.$characterSize=b,a._dispatchEvent("changeCharaterSize",{data:b})},500)},this.$fontStyles={fontFamily:1,fontSize:1,fontWeight:1,fontStyle:1,lineHeight:1},this.$measureSizes=function(){var a=1e3;if(!this.$measureNode){var b=this.$measureNode=document.createElement("div"),c=b.style;c.width=c.height="auto",c.left=c.top="-1000px",c.visibility="hidden",c.position="absolute",c.overflow="visible",c.whiteSpace="nowrap",b.innerHTML=f.stringRepeat("Xy",a),document.body.insertBefore(b,document.body.firstChild)}var c=this.$measureNode.style;for(var d in this.$fontStyles){var g=e.computedStyle(this.element,d);c[d]=g}var h={height:this.$measureNode.offsetHeight,width:this.$measureNode.offsetWidth/(a*2)};return h},this.setDocument=function(a){this.doc=a},this.$showInvisibles=!1,this.setShowInvisibles=function(a){this.$showInvisibles=a},this.$computeTabString=function(){var a=this.doc.getTabSize();if(this.$showInvisibles){var b=a/2;this.$tabString=""+Array(Math.floor(b)).join(" ")+this.TAB_CHAR+Array(Math.ceil(b)+1).join(" ")+""}else this.$tabString=Array(a+1).join(" ")},this.updateLines=function(a,b,c){this.$computeTabString(),this.config=a;var d=Math.max(b,a.firstRow),e=Math.min(c,a.lastRow),f=this.element.childNodes,g=this;this.tokenizer.getTokens(d,e,function(b){for(var c=d;c<=e;c++){var h=f[c-a.firstRow];if(!h)continue;var i=[];g.$renderLine(i,c,b[c-d].tokens),h.innerHTML=i.join("")}})},this.scrollLines=function(a){function g(){a.lastRow>c.lastRow&&b.$renderLinesFragment(a,c.lastRow+1,a.lastRow,function(a){d.appendChild(a)})}function f(e){a.firstRowa.lastRow)for(var e=a.lastRow+1;e<=c.lastRow;e++)d.removeChild(d.lastChild);f(g)},this.$renderLinesFragment=function(a,b,c,d){var e=document.createDocumentFragment(),f=this;this.tokenizer.getTokens(b,c,function(g){for(var h=b;h<=c;h++){var i=document.createElement("div");i.className="ace_line";var j=i.style;j.height=f.$characterSize.height+"px",j.width=a.width+"px";var k=[];f.$renderLine(k,h,g[h-b].tokens),i.innerHTML=k.join(""),e.appendChild(i)}d(e)})},this.update=function(a){this.$computeTabString(),this.config=a;var b=[],c=this;this.tokenizer.getTokens(a.firstRow,a.lastRow,function(d){for(var e=a.firstRow;e<=a.lastRow;e++)b.push("
"),c.$renderLine(b,e,d[e-a.firstRow].tokens),b.push("
");c.element.innerHTML=b.join("")})},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderLine=function(a,b,c){var d=/[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/g,e=" ";for(var f=0;f",h,"")}}this.$showInvisibles&&(b!==this.doc.getLength()-1?a.push(""+this.EOL_CHAR+""):a.push(""+this.EOF_CHAR+""))}}).call(h.prototype),b.Text=h}),define("ace/range",function(a,b,c){var d=function(a,b,c,d){this.start={row:a,column:b},this.end={row:c,column:d}};(function(){this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(a,b){return this.compare(a,b)==0},this.compare=function(a,b){if(!this.isMultiLine())if(a===this.start.row)return bthis.end.column?1:0;if(athis.end.row)return 1;if(this.start.row===a)return b>=this.start.column?0:-1;if(this.end.row===a)return b<=this.end.column?0:1;return 0},this.clipRows=function(a,b){if(this.end.row>b)var c={row:b+1,column:0};if(this.start.row>b)var e={row:b+1,column:0};if(this.start.row=0;h--){var i=g[h],j=c.$rangeFromMatch(f,i.offset,i.str.length);if(d(j))return!0}})}}},this.$rangeFromMatch=function(a,b,c){return new f(a,b,a,b+c)},this.$assembleRegExp=function(){if(this.$options.regExp)var a=this.$options.needle;else a=d.escapeRegExp(this.$options.needle);this.$options.wholeWord&&(a="\\b"+a+"\\b");var b="g";this.$options.caseSensitive||(b+="i");var c=new RegExp(a,b);return c},this.$forwardLineIterator=function(a){function j(d){var e=a.getLine(d);b&&d==c.end.row&&(e=e.substring(0,c.end.column));return e}var b=this.$options.scope==g.SELECTION,c=a.getSelection().getRange(),d=a.getSelection().getCursor(),e=b?c.start.row:0,f=b?c.start.column:0,h=b?c.end.row:a.getLength()-1,i=this.$options.wrap;return{forEach:function(a){var b=d.row,c=j(b),g=d.column,k=!1;while(!a(c,g,b)){if(k)return;b++,g=0;if(b>h)if(i)b=e,g=f;else return;b==d.row&&(k=!0),c=j(b)}}}},this.$backwardLineIterator=function(a){var b=this.$options.scope==g.SELECTION,c=a.getSelection().getRange(),d=b?c.end:c.start,e=b?c.start.row:0,f=b?c.start.column:0,h=b?c.end.row:a.getLength()-1,i=this.$options.wrap;return{forEach:function(g){var j=d.row,k=a.getLine(j).substring(0,d.column),l=0,m=!1;while(!g(k,l,j)){if(m)return;j--,l=0;if(jb.row||a.row==b.row&&a.column>b.column},this.getRange=function(){var a=this.selectionAnchor||this.selectionLead,b=this.selectionLead;return this.isBackwards()?g.fromPoints(b,a):g.fromPoints(a,b)},this.clearSelection=function(){this.selectionAnchor&&(this.selectionAnchor=null,this._dispatchEvent("changeSelection",{}))},this.selectAll=function(){var a=this.doc.getLength()-1;this.setSelectionAnchor(a,this.doc.getLine(a).length),this.$moveSelection(function(){this.moveCursorTo(0,0)})},this.setSelectionRange=function(a,b){b?(this.setSelectionAnchor(a.end.row,a.end.column),this.selectTo(a.start.row,a.start.column)):(this.setSelectionAnchor(a.start.row,a.start.column),this.selectTo(a.end.row,a.end.column))},this.$moveSelection=function(a){var b=!1;this.selectionAnchor||(b=!0,this.selectionAnchor=this.$clone(this.selectionLead));var c=this.$clone(this.selectionLead);a.call(this);if(c.row!==this.selectionLead.row||c.column!==this.selectionLead.column)b=!0;b&&this._dispatchEvent("changeSelection",{})},this.selectTo=function(a,b){this.$moveSelection(function(){this.moveCursorTo(a,b)})},this.selectToPosition=function(a){this.$moveSelection(function(){this.moveCursorToPosition(a)})},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 a=this.selectionLead,b=a.column,c=this.doc.getWordRange(a.row,b);this.setSelectionRange(c)},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 a=this.doc,b=a.getTabSize(),c=this.selectionLead;a.isTabStop(c)&&a.getLine(c.row).slice(c.column-b,c.column).split(" ").length-1==b?this.moveCursorBy(0,-b):this.moveCursorBy(0,-1)}},this.moveCursorRight=function(){if(this.selectionLead.column==this.doc.getLine(this.selectionLead.row).length)this.selectionLead.rowa&&(this.$changedLines.firstRow=a),this.$changedLines.lastRowc&&this.scrollToY(c),this.getScrollTop()+this.$size.scrollerHeightb&&this.scrollToX(b),this.scroller.scrollLeft+this.$size.scrollerWidth"+Array(Math.floor(b)).join(" ")+this.TAB_CHAR+Array(Math.ceil(b)+1).join(" ")+""}else this.$tabString=Array(a+1).join(" ")},this.updateLines=function(a,b,c){this.$computeTabString(),this.config=a;var d=Math.max(b,a.firstRow),e=Math.min(c,a.lastRow),f=this.element.childNodes,g=this;this.tokenizer.getTokens(d,e,function(b){for(var c=d;c<=e;c++){var h=f[c-a.firstRow];if(!h)continue;var i=[];g.$renderLine(i,c,b[c-d].tokens),h.innerHTML=i.join("")}})},this.scrollLines=function(a){function g(){a.lastRow>c.lastRow&&b.$renderLinesFragment(a,c.lastRow+1,a.lastRow,function(a){d.appendChild(a)})}function f(e){a.firstRowa.lastRow)for(var e=a.lastRow+1;e<=c.lastRow;e++)d.removeChild(d.lastChild);f(g)},this.$renderLinesFragment=function(a,b,c,d){var e=document.createDocumentFragment(),f=this;this.tokenizer.getTokens(b,c,function(g){for(var h=b;h<=c;h++){var i=document.createElement("div");i.className="ace_line";var j=i.style;j.height=f.$characterSize.height+"px",j.width=a.width+"px";var k=[];f.$renderLine(k,h,g[h-b].tokens),i.innerHTML=k.join(""),e.appendChild(i)}d(e)})},this.update=function(a){this.$computeTabString(),this.config=a;var b=[],c=this;this.tokenizer.getTokens(a.firstRow,a.lastRow,function(d){for(var e=a.firstRow;e<=a.lastRow;e++)b.push("
"),c.$renderLine(b,e,d[e-a.firstRow].tokens),b.push("
");c.element.innerHTML=b.join("")})},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderLine=function(a,b,c){var d=/[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/g,e=" ";for(var f=0;f",h,"")}}this.$showInvisibles&&(b!==this.doc.getLength()-1?a.push(""+this.EOL_CHAR+""):a.push(""+this.EOF_CHAR+""))}}).call(h.prototype),b.Text=h}),define("ace/mode/doc_comment_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=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:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f}),define("ace/mode/javascript",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\/\//;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h).replace(g,"$1");j.start.row=h,j.end.row=h,j.end.column=k.length+2,b.replace(j,k)}return-2}return b.indentRows(c,d,"//")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}else if(a=="doc-start"){if(g=="start")return"";var h=b.match(/^\s*(\/?)\*/);h&&(h[1]&&(d+=" "),d+="* ")}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){return this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/javascript_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules,g=a("ace/mode/text_highlight_rules").TextHighlightRules;JavaScriptHighlightRules=function(){var a=new f,b=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("|")),c=e.arrayToMap("null|Infinity|NaN|undefined".split("|")),d=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:"\\/\\/.*$"},a.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(a){return a=="this"?"variable.language":b[a]?"keyword":c[a]?"constant.language":d[a]?"invalid.illegal":a=="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(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"},d.inherits(JavaScriptHighlightRules,g),b.JavaScriptHighlightRules=JavaScriptHighlightRules}),define("ace/mode/matching_brace_outdent",function(a,b,c){var d=a("ace/range").Range,e=function(){};(function(){this.checkOutdent=function(a,b){if(!/^\s+$/.test(a))return!1;return/^\s*\}/.test(b)},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h);return h.length-(f-1)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);if(b)return b[1];return""}}).call(e.prototype),b.MatchingBraceOutdent=e}),define("ace/mode/text",function(a,b,c){var d=a("ace/tokenizer").Tokenizer,e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$tokenizer=new d((new e).getRules())};(function(){this.getTokenizer=function(){return this.$tokenizer},this.toggleCommentLines=function(a,b,c,d){return 0},this.getNextLineIndent=function(a,b,c){return""},this.checkOutdent=function(a,b,c){return!1},this.autoOutdent=function(a,b,c){},this.$getIndent=function(a){var b=a.match(/^(\s+)/);if(b)return b[1];return""}}).call(f.prototype),b.Mode=f}),define("ace/mode/text_highlight_rules",function(a,b,c){var d=function(){this.$rules={start:[{token:"text",regex:".+"}]}};(function(){this.addRules=function(a,b){for(var c in a){var d=a[c];for(var e=0;ew)v.shiftObject();b._dispatchEvent("output",{requests:v,request:this})},x.prototype.doneWithError=function(a){this.error=true,this.done(a)},x.prototype.async=function(){this._begunOutput||this._beginOutput()},x.prototype.output=function(a){this._begunOutput||this._beginOutput(),typeof a!=="string"&&!(a instanceof Node)&&(a=a.toString()),this.outputs.push(a),this._dispatchEvent("output",{});return this},x.prototype.done=function(a){this.completed=true,this.end=new Date,this.duration=this.end.getTime()-this.start.getTime(),a&&this.output(a),this._dispatchEvent("output",{})},b.Request=x}),define("pilot/catalog",function(a,b,c){var d={};b.addExtensionSpec=function(a){d[a.name]=a},b.removeExtensionSpec=function(a){typeof a==="string"?delete d[a]:delete d[a.name]},b.getExtensionSpec=function(a){return d[a]},b.getExtensionSpecs=function(){return Object.keys(d)}}),define("pilot/commands/basic",function(require,exports,module){var checks=require("pilot/typecheck");var canon=require("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(a,b,c){var d=[];var e=canon.getCommand(b.search);if(e&&e.exec)d.push(e.description?e.description:"No description for "+b.search);else{var f=false;!b.search&&helpMessages.plainPrefix&&d.push(helpMessages.plainPrefix),e?(d.push("

Sub-Commands of "+e.name+"

"),d.push("

"+e.description+"

")):b.search?(b.search=="hidden"&&(b.search="",f=true),d.push("

Commands starting with '"+b.search+"':

")):d.push("

Available Commands:

");var g=canon.getCommandNames();g.sort(),d.push("");for(var h=0;h"),d.push(""),d.push(""),d.push("")}d.push("
"+e.name+""+e.description+"
"),!b.search&&helpMessages.plainSuffix&&d.push(helpMessages.plainSuffix)}c.done(d.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,args,request){var result;var javascript=args.javascript;try{result=eval(javascript)}catch(e){result="Error: "+e.message+""}var msg="";var type="";var x;if(checks.isFunction(result))msg=(result+"").replace(/\n/g,"
").replace(/ /g," "),type="function";else if(checks.isObject(result)){Array.isArray(result)?type="array":type="object";var items=[];var value;for(x in result)result.hasOwnProperty(x)&&(checks.isFunction(result[x])?value="[function]":checks.isObject(result[x])?value="[object]":value=result[x],items.push({name:x,value:value}));items.sort(function(a,b){return a.name.toLowerCase()"+items[x].name+": "+items[x].value+"
"}else msg=result,type=typeof result;request.done("Result for eval '"+javascript+"' (type: "+type+"):

"+msg)}};var versionCommandSpec={name:"version",description:"show the Skywriter version",hidden:true,exec:function(a,b,c){var d="Skywriter "+skywriter.versionNumber+" ("+skywriter.versionCodename+")";c.done(d)}};var skywriterCommandSpec={name:"skywriter",hidden:true,exec:function(a,b,c){var d=Math.floor(Math.random()*messages.length);c.done("Skywriter "+messages[d])}};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."];var canon=require("pilot/canon");exports.startup=function(a,b){canon.addCommand(helpCommandSpec),canon.addCommand(evalCommandSpec),canon.addCommand(skywriterCommandSpec)},exports.shutdown=function(a,b){canon.removeCommand(helpCommandSpec),canon.removeCommand(evalCommandSpec),canon.removeCommand(skywriterCommandSpec)}}),define("pilot/commands/history",function(a,b,c){var d={name:"historyPrevious",predicates:{isCommandLine:true,isKeyUp:true},key:"up",exec:function(a,b){g>0&&g--;var c=history.requests[g].typed;env.commandLine.setInput(c)}};var e={name:"historyNext",predicates:{isCommandLine:true,isKeyUp:true},key:"down",exec:function(a,b){g");var d=1;history.requests.forEach(function(a){c.push(""),c.push(""+d+""),c.push(""+a.typed+""),c.push(""),d++}),c.push(""),b.done(c.join(""))}};var g=0;b.addedRequestOutput=function(){g=history.requests.length}}),define("pilot/commands/settings",function(a,b,c){var d={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(a,b,c){var d;if(b.setting)b.value===undefined?d=""+setting.name+" = "+setting.get():(b.setting.set(b.value),d="Setting: "+b.setting.name+" = "+b.setting.get());else{var e=a.settings.getSettingNames();d="",e.sort(function(a,b){return a.localeCompare(b)}),e.forEach(function(b){var c=a.settings.getSetting(b);var e="https://wiki.mozilla.org/Labs/Skywriter/Settings#"+c.name;d+=""+c.name+" = "+c.value+"
"})}c.done(d)}};var e={name:"unset",params:[{name:"setting",type:"setting",description:"The name of the setting to return to defaults"}],description:"unset a setting entirely",exec:function(a,b,c){var d=a.settings.get(b.setting);d?(d.reset(),c.done("Reset "+d.name+" to default: "+a.settings.get(b.setting))):c.doneWithError("No setting with the name "+b.setting+".")}};var f=a("pilot/canon");b.startup=function(a,b){f.addCommand(d),f.addCommand(e)},b.shutdown=function(a,b){f.removeCommand(d),f.removeCommand(e)}}),define("pilot/console",function(a,b,c){var d=function(){};var e=["assert","count","debug","dir","dirxml","error","group","groupEnd","info","log","profile","profileEnd","time","timeEnd","trace","warn"];typeof window==="undefined"?e.forEach(function(a){b[a]=function(){var b=Array.prototype.slice.call(arguments);var c={op:"log",method:a,args:b};postMessage(JSON.stringify(c))}}):e.forEach(function(a){window.console&&window.console[a]?b[a]=Function.prototype.bind.call(window.console[a],window.console):b[a]=d})}),define("pilot/dom",function(a,b,c){b.setText=function(a,b){a.innerText!==undefined&&(a.innerText=b),a.textContent!==undefined&&(a.textContent=b)},b.hasCssClass=function(a,b){var c=a.className.split(/\s+/g);return c.indexOf(b)!==-1},b.addCssClass=function(a,c){b.hasCssClass(a,c)||(a.className+=" "+c)},b.setCssClass=function(a,c,d){d?b.addCssClass(a,c):b.removeCssClass(a,c)},b.removeCssClass=function(a,b){var c=a.className.split(/\s+/g);while(true){var d=c.indexOf(b);if(d==-1)break;c.splice(d,1)}a.className=c.join(" ")},b.importCssString=function(a,b){b=b||document;if(b.createStyleSheet){var c=b.createStyleSheet();c.cssText=a}else{var d=b.createElement("style");d.appendChild(b.createTextNode(a)),b.getElementsByTagName("head")[0].appendChild(d)}},b.getInnerWidth=function(a){return parseInt(b.computedStyle(a,"paddingLeft"))+parseInt(b.computedStyle(a,"paddingRight"))+a.clientWidth},b.getInnerHeight=function(a){return parseInt(b.computedStyle(a,"paddingTop"))+parseInt(b.computedStyle(a,"paddingBottom"))+a.clientHeight},b.computedStyle=function(a,b){return window.getComputedStyle?(window.getComputedStyle(a,"")||{})[b]||"":a.currentStyle[b]},b.scrollbarWidth=function(){var a=document.createElement("p");a.style.width="100%",a.style.height="200px";var b=document.createElement("div");var c=b.style;c.position="absolute",c.left="-10000px",c.overflow="hidden",c.width="200px",c.height="150px",b.appendChild(a),document.body.appendChild(b);var d=a.offsetWidth;c.overflow="scroll";var e=a.offsetWidth;d==e&&(e=b.clientWidth),document.body.removeChild(b);return d-e}}),define("pilot/domtemplate",function(require,exports,module){function Templater(){this.scope=[]}Templater.prototype.processNode=function(a,b){typeof a==="string"&&(a=document.getElementById(a));if(b===null||b===undefined)b={};this.scope.push(a.nodeName+(a.id?"#"+a.id:""));try{if(a.attributes&&a.attributes.length){if(a.hasAttribute("foreach")){this.processForEach(a,b);return}if(a.hasAttribute("if"))if(!this.processIf(a,b))return;b.__element=a;var c=Array.prototype.slice.call(a.attributes);for(var d=0;d1&&(d.forEach(function(c){c===null||c===undefined||c===""||(c.charAt(0)==="$"&&(c=this.envEval(c.slice(1),b,a.data)),c===null&&(c="null"),c===undefined&&(c="undefined"),typeof c.cloneNode!=="function"&&(c=a.ownerDocument.createTextNode(c.toString())),a.parentNode.insertBefore(c,a))},this),a.parentNode.removeChild(a))},Templater.prototype.stripBraces=function(a){if(!a.match(/\$\{.*\}/g)){this.handleError("Expected "+a+" to match ${...}");return a}return a.slice(2,-1)},Templater.prototype.property=function(a,b,c){this.scope.push(a);try{typeof a==="string"&&(a=a.split("."));var d=b[a[0]];if(a.length===1){c!==undefined&&(b[a[0]]=c);if(typeof d==="function")return function(){return d.apply(b,arguments)};return d}if(!d){this.handleError("Can't find path="+a);return null}return this.property(a.slice(1),d,c)}finally{this.scope.pop()}},Templater.prototype.envEval=function(script,env,context){with(env)try{this.scope.push(context);return eval(script)}catch(ex){this.handleError("Template error evaluating '"+script+"'",ex);return script}finally{this.scope.pop()}},Templater.prototype.handleError=function(a,b){this.logError(a),this.logError("In: "+this.scope.join(" > ")),b&&this.logError(b)},Templater.prototype.logError=function(a){console.log(a)},exports.Templater=Templater}),define("pilot/environment",function(a,b,c){var d=a("pilot/settings").settings;function e(){return{settings:d}}b.create=e}),define("pilot/event",function(a,b,c){var d=a("pilot/useragent");b.addListener=function(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,false);if(a.attachEvent){var d=function(){c(window.event)};c._wrapper=d,a.attachEvent("on"+b,d)}},b.removeListener=function(a,b,c){if(a.removeEventListener)return a.removeEventListener(b,c,false);a.detachEvent&&a.detachEvent("on"+b,c._wrapper||c)},b.stopEvent=function(a){b.stopPropagation(a),b.preventDefault(a);return false},b.stopPropagation=function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=true},b.preventDefault=function(a){a.preventDefault?a.preventDefault():a.returnValue=false},b.getDocumentX=function(a){if(a.clientX){var b=document.documentElement.scrollLeft||document.body.scrollLeft;return a.clientX+b}return a.pageX},b.getDocumentY=function(a){if(a.clientY){var b=document.documentElement.scrollTop||document.body.scrollTop;return a.clientY+b}return a.pageX},b.getButton=function(a){return a.preventDefault?a.button:Math.max(a.button-1,2)},document.documentElement.setCapture?b.capture=function(a,c,d){function e(a){c(a);return b.stopPropagation(a)}function f(e){c&&c(e),d&&d(),b.removeListener(a,"mousemove",c),b.removeListener(a,"mouseup",f),b.removeListener(a,"losecapture",f),a.releaseCapture()}b.addListener(a,"mousemove",c),b.addListener(a,"mouseup",f),b.addListener(a,"losecapture",f),a.setCapture()}:b.capture=function(a,b,c){function d(a){b(a),a.stopPropagation()}function e(a){b&&b(a),c&&c(),document.removeEventListener("mousemove",d,true),document.removeEventListener("mouseup",e,true),a.stopPropagation()}document.addEventListener("mousemove",d,true),document.addEventListener("mouseup",e,true)},b.addMouseWheelListener=function(a,c){var d=function(a){a.wheelDelta!==undefined?a.wheelDeltaX!==undefined?(a.wheelX=-a.wheelDeltaX/8,a.wheelY=-a.wheelDeltaY/8):(a.wheelX=0,a.wheelY=-a.wheelDelta/8):a.axis&&a.axis==a.HORIZONTAL_AXIS?(a.wheelX=(a.detail||0)*5,a.wheelY=0):(a.wheelX=0,a.wheelY=(a.detail||0)*5),c(a)};b.addListener(a,"DOMMouseScroll",d),b.addListener(a,"mousewheel",d)},b.addMultiMouseDownListener=function(a,c,e,f,g){var h=0;var i,j;var k=function(a){h+=1,h==1&&(i=a.clientX,j=a.clientY,setTimeout(function(){h=0},f||600));if(b.getButton(a)!=c||Math.abs(a.clientX-i)>5||Math.abs(a.clientY-j)>5)h=0;h==e&&(h=0,g(a));return b.preventDefault(a)};b.addListener(a,"mousedown",k),d.isIE&&b.addListener(a,"dblclick",k)},b.addKeyListener=function(a,c){var e=null;b.addListener(a,"keydown",function(a){e=a.keyIdentifier||a.keyCode;return c(a)}),d.isMac&&(d.isGecko||d.isOpera)&&b.addListener(a,"keypress",function(a){var b=a.keyIdentifier||a.keyCode;if(e!==b)return c(a);e=null})}}),define("pilot/event_emitter",function(a,b,c){var d={};d._dispatchEvent=function(a,b){this._eventRegistry=this._eventRegistry||{};var c=this._eventRegistry[a];if(!(!c||!c.length)){var b=b||{};b.type=a;for(var d=0;d>>0;if(c===0)return-1;var d=0;arguments.length>0&&(d=Number(arguments[1]),d!==d?d=0:d!==0&&d!==1/0&&d!==-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d))));if(d>=c)return-1;var e=d>=0?d:Math.max(c-Math.abs(d),0);for(;e>>0;if(typeof a!=="function")throw new TypeError;var d=arguments[1];for(var e=0;e47&&d<58&&(j=a.altKey));if(f)a.altKey&&(h+="alt_"),a.ctrlKey&&(h+="ctrl_"),a.metaKey&&(h+="meta_");else if(a.ctrlKey||a.metaKey)return false}f||(d=a.which,g=f=String.fromCharCode(d),i=f.toLowerCase(),a.metaKey?(h="meta_",f=i):f=null),a.shiftKey&&f&&j&&(h+="shift_"),f&&(f=h+f),!c&&f&&(f=f.replace(/ctrl_meta|meta/,"ctrl"));return[f,g]},b.addKeyDownListener=function(a,c){var g=function(a){var b=c(a);b&&d.stopEvent(a);return b};a.addEventListener("keydown",function(a){if(e.isGecko){if(b.KeyHelper.FUNCTION_KEYS[a.keyCode])return true;if((a.ctrlKey||a.metaKey)&&b.KeyHelper.PRINTABLE_KEYS[a.keyCode])return true}if(f(a))return g(a);return true},false),a.addEventListener("keypress",function(a){if(e.isGecko){if(b.KeyHelper.FUNCTION_KEYS[a.keyCode])return g(a);if((a.ctrlKey||a.metaKey)&&b.KeyHelper.PRINTABLE_KEYS_CHARCODE[a.charCode]){a._keyCode=b.KeyHelper.PRINTABLE_KEYS_CHARCODE[a.charCode],a._charCode=0;return g(a)}}if(a.charCode!==undefined&&a.charCode===0)return true;return g(a)},false)}}),define("pilot/lang",function(a,b,c){b.stringReverse=function(a){return a.split("").reverse().join("")},b.stringRepeat=function(a,b){return(new Array(b+1)).join(a)},b.copyObject=function(a){var b={};for(var c in a)b[c]=a[c];return b},b.arrayToMap=function(a){var b={};for(var c=0;cthis.NEW){e.resolve(this);return e}a([this.name],function(a){a.install&&a.install(b,c),this.status=this.INSTALLED,e.resolve(this)}.bind(this));return e},register:function(b,c){var e=new d;if(this.status!=this.INSTALLED){e.resolve(this);return e}a([this.name],function(a){a.register&&a.register(b,c),this.status=this.REGISTERED,e.resolve(this)}.bind(this));return e},startup:function(c,e){e=e||b.REASONS.APP_STARTUP;var f=new d;if(this.status!=this.REGISTERED){f.resolve(this);return f}a([this.name],function(a){a.startup&&a.startup(c,e),this.status=this.STARTED,f.resolve(this)}.bind(this));return f},shutdown:function(b,c){this.status!=this.STARTED||(pluginModule=a(this.name),pluginModule.shutdown&&pluginModule.shutdown(b,c))}},b.PluginCatalog=function(){this.plugins={}},b.PluginCatalog.prototype={registerPlugins:function(a,c,e){var f=[];a.forEach(function(a){var d=this.plugins[a];d===undefined&&(d=new b.Plugin(a),this.plugins[a]=d,f.push(d.register(c,e)))}.bind(this));return d.group(f)},startupPlugins:function(a,b){var c=[];for(var e in this.plugins){var f=this.plugins[e];c.push(f.startup(a,b))}return d.group(c)}},b.catalog=new b.PluginCatalog}),define("pilot/promise",function(a,b,c){var d=a("pilot/console");var e=a("pilot/stacktrace").Trace;var f=-1;var g=0;var h=1;var i=0;var j=false;var k=[];var l=[];Promise=function(){this._status=g,this._value=undefined,this._onSuccessHandlers=[],this._onErrorHandlers=[],this._id=i++,k[this._id]=this},Promise.prototype.isPromise=true,Promise.prototype.isComplete=function(){return this._status!=g},Promise.prototype.isResolved=function(){return this._status==h},Promise.prototype.isRejected=function(){return this._status==f},Promise.prototype.then=function(a,b){typeof a==="function"&&(this._status===h?a.call(null,this._value):this._status===g&&this._onSuccessHandlers.push(a)),typeof b==="function"&&(this._status===f?b.call(null,this._value):this._status===g&&this._onErrorHandlers.push(b));return this},Promise.prototype.chainPromise=function(a){var b=new Promise;b._chainedFrom=this,this.then(function(c){try{b.resolve(a(c))}catch(d){b.reject(d)}},function(a){b.reject(a)});return b},Promise.prototype.resolve=function(a){return this._complete(this._onSuccessHandlers,h,a,"resolve")},Promise.prototype.reject=function(a){return this._complete(this._onErrorHandlers,f,a,"reject")},Promise.prototype._complete=function(a,b,c,f){if(this._status!=g){d.group("Promise already closed"),d.error("Attempted "+f+"() with ",c),d.error("Previous status = ",this._status,", previous value = ",this._value),d.trace(),this._completeTrace&&(d.error("Trace of previous completion:"),this._completeTrace.log(5)),d.groupEnd();return this}j&&(this._completeTrace=new e(new Error)),this._status=b,this._value=c,a.forEach(function(a){a.call(null,this._value)},this),this._onSuccessHandlers.length=0,this._onErrorHandlers.length=0,delete k[this._id],l.push(this);while(l.length>20)l.shift();return this},Promise.group=function(a){a instanceof Array||(a=Array.prototype.slice.call(arguments));if(a.length===0)return(new Promise).resolve([]);var b=new Promise;var c=[];var d=0;var e=function(e){return function(g){c[e]=g,d++,b._status!==f&&(d===a.length&&b.resolve(c))}};a.forEach(function(a,c){var d=e(c);var f=b.reject.bind(b);a.then(d,f)});return b},b.Promise=Promise,b._outstanding=k,b._recent=l}),define("pilot/proxy",function(a,b,c){var d=a("pilot/promise").Promise;b.xhr=function(a,b,c,e){var f=new d;if(!skywriter.proxy||!skywriter.proxy.xhr){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(!(g.readyState!==4)){var a=g.status;if(a!==0&&a!==200){var b=new Error(g.responseText+" (Status "+g.status+")");b.xhr=g,f.reject(b);return}f.resolve(g.responseText)}}.bind(this),g.open("GET",b,c),e&&e(g),g.send()}else skywriter.proxy.xhr.call(this,a,b,c,e,f);return f},b.Worker=function(a){return!skywriter.proxy||!skywriter.proxy.worker?new Worker(a):new skywriter.proxy.worker(a)}}),define("pilot/rangeutils",function(a,b,c){var d=a("util/util");b.addPositions=function(a,b){return{row:a.row+b.row,col:a.col+b.col}},b.cloneRange=function(a){var b=a.start,c=a.end;var d={row:b.row,col:b.col};var e={row:c.row,col:c.col};return{start:d,end:e}},b.comparePositions=function(a,b){var c=a.row-b.row;return c===0?a.col-b.col:c},b.equal=function(a,c){return b.comparePositions(a.start,c.start)===0&&b.comparePositions(a.end,c.end)===0},b.extendRange=function(a,b){var c=a.end;return{start:a.start,end:{row:c.row+b.row,col:c.col+b.col}}},b.intersectRangeSets=function(a,c){var e=d.clone(a),f=d.clone(c);var g=[];while(e.length>0&&f.length>0){var h=e.shift(),i=f.shift();var j=b.comparePositions(h.start,i.start);var k=b.comparePositions(h.end,i.end);b.comparePositions(h.end,i.start)<0?(g.push(h),f.unshift(i)):b.comparePositions(i.end,h.start)<0?(g.push(i),e.unshift(h)):j<0?(g.push({start:h.start,end:i.start}),e.unshift({start:i.start,end:h.end}),f.unshift(i)):j===0?k<0?f.unshift({start:h.end,end:i.end}):k>0&&e.unshift({start:i.end,end:h.end}):j>0&&(g.push({start:i.start,end:h.start}),e.unshift(h),f.unshift({start:h.start,end:i.end}))}return g.concat(e,f)},b.isZeroLength=function(a){return a.start.row===a.end.row&&a.start.col===a.end.col},b.maxPosition=function(a,c){return b.comparePositions(a,c)>0?a:c},b.normalizeRange=function(a){return this.comparePositions(a.start,a.end)<0?a:{start:a.end,end:a.start}},b.rangeSetBoundaries=function(a){return{start:a[0].start,end:a[a.length-1].end}},b.toString=function(a){var b=a.start,c=a.end;return"[ "+b.row+", "+b.col+" "+c.row+","+ +c.col+" ]"},b.unionRanges=function(a,b){return{start:a.start.rowb.end.row||a.end.row===b.end.row&&a.end.col>b.end.col?a.end:b.end}},b.isPosition=function(a){return!d.none(a)&&!d.none(a.row)&&!d.none(a.col)},b.isRange=function(a){return!d.none(a)&&b.isPosition(a.start)&&b.isPosition(a.end)}}),define("pilot/settings/canon",function(a,b,c){var d={name:"historyLength",description:"How many typed commands do we recall for reference?",type:"number",defaultValue:50};b.startup=function(a,b){a.env.settings.addSetting(d)},b.shutdown=function(a,b){a.env.settings.removeSetting(d)}}),define("pilot/settings",function(a,b,c){var d=a("pilot/console");var e=a("pilot/oop");var f=a("pilot/types");var g=a("pilot/event_emitter").EventEmitter;var h=a("pilot/catalog");var i={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"};b.startup=function(a,b){h.addExtensionSpec(i)},b.shutdown=function(a,b){h.removeExtensionSpec(i)};function j(a,b){this._settings=b,Object.keys(a).forEach(function(b){this[b]=a[b]},this),this.type=f.getType(this.type);if(this.type==null)throw new Error("In "+this.name+": can't find type for: "+JSON.stringify(a.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}j.prototype={get:function(){return this.value},set:function(a){this.value===a||(this.value=a,this._settings.persister&&this._settings.persister.persistValue(this._settings,this.name,a),this._dispatchEvent("change",{setting:this,value:a}))},resetValue:function(){this.set(this.defaultValue)}},e.implement(j.prototype,g);function k(a){this._deactivated={},this._settings={},this._settingNames=[],a&&this.setPersister(a)}k.prototype={addSetting:function(a){var b=new j(a,this);this._settings[b.name]=b,this._settingNames.push(b.name),this._settingNames.sort()},removeSetting:function(a){var b=typeof a==="string"?a:a.name;delete this._settings[b],util.arrayRemove(this._settingNames,b)},getSettingNames:function(){return this._settingNames},getSetting:function(a){return this._settings[a]},setPersister:function(a){this._persister=a,a&&a.loadInitialValues(this)},resetAll:function(){this.getSettingNames().forEach(function(a){this.resetValue(a)},this)},_list:function(){var a=[];this.getSettingNames().forEach(function(b){a.push({key:b,value:this.getSetting(b).get()})},this);return a},_loadDefaultValues:function(){this._loadFromObject(this._getDefaultValues())},_loadFromObject:function(a){for(var b in a)if(a.hasOwnProperty(b)){var c=this._settings[b];if(c){var d=c.type.parse(a[b]);this.set(b,d)}else this.set(b,a[b])}},_saveToObject:function(){return this.getSettingNames().map(function(a){return this._settings[a].type.stringify(this.get(a))}.bind(this))},_getDefaultValues:function(){return this.getSettingNames().map(function(a){return this._settings[a].spec.defaultValue}.bind(this))}},b.settings=new k;function l(){}l.prototype={loadInitialValues:function(a){a._loadDefaultValues();var b=cookie.get("settings");a._loadFromObject(JSON.parse(b))},persistValue:function(a,b,c){try{var e=JSON.stringify(a._saveToObject());cookie.set("settings",e)}catch(f){d.error("Unable to JSONify the settings! "+f);return}}},b.CookiePersister=l}),define("pilot/stacktrace",function(a,b,c){var d=a("pilot/useragent");var e=a("pilot/console");var f=function(){return d.isGecko?"firefox":d.isOpera?"opera":"other"}();function g(a){for(var b=0;b\s*\(/gm,"{anonymous}()@").split("\n")},firefox:function(a){var b=a.stack;if(!b){e.log(a);return[]}b=b.replace(/(?:\n@:0)?\s+$/m,""),b=b.replace(/^\(/gm,"{anonymous}(");return b.split("\n")},opera:function(a){var b=a.message.split("\n"),c="{anonymous}",d=/Line\s+(\d+).*?script\s+(http\S+)(?:.*?in\s+function\s+(\S+))?/i,e,f,g;for(e=4,f=0,g=b.length;e0){var h="Possibilities"+(a.length===0?"":" for '"+a+"'");return new f(null,g.INCOMPLETE,h,e)}var h="Can't use '"+a+"'.";return new f(null,g.INVALID,h,e)},j.prototype.fromString=function(a){return a},j.prototype.decrement=function(a){var b=typeof this.data==="function"?this.data():this.data;var c;if(a==null)c=b.length-1;else{var d=this.stringify(a);var c=b.indexOf(d);c=c===0?b.length-1:c-1}return this.fromString(b[c])},j.prototype.increment=function(a){var b=typeof this.data==="function"?this.data():this.data;var c;if(a==null)c=0;else{var d=this.stringify(a);var c=b.indexOf(d);c=c===b.length-1?0:c+1}return this.fromString(b[c])},j.prototype.name="selection",b.SelectionType=j;var k=new j({name:"bool",data:["true","false"],stringify:function(a){return""+a},fromString:function(a){return a==="true"?true:false}});function l(a){if(typeof a.defer!=="function")throw new Error("Instances of DeferredType need typeSpec.defer to be a function that returns a type");Object.keys(a).forEach(function(b){this[b]=a[b]},this)}l.prototype=new e,l.prototype.stringify=function(a){return this.defer().stringify(a)},l.prototype.parse=function(a){return this.defer().parse(a)},l.prototype.decrement=function(a){var b=this.defer();return b.decrement?b.decrement(a):undefined},l.prototype.increment=function(a){var b=this.defer();return b.increment?b.increment(a):undefined},l.prototype.name="deferred",b.DeferredType=l;function m(a){if(a instanceof e)this.subtype=a;else if(typeof a==="string"){this.subtype=d.getType(a);if(this.subtype==null)throw new Error("Unknown array subtype: "+a)}else throw new Error("Can' handle array subtype")}m.prototype=new e,m.prototype.stringify=function(a){return a.join(" ")},m.prototype.parse=function(a){return this.defer().parse(a)},m.prototype.name="array",b.startup=function(){d.registerType(h),d.registerType(i),d.registerType(k),d.registerType(j),d.registerType(l),d.registerType(m)},b.shutdown=function(){d.unregisterType(h),d.unregisterType(i),d.unregisterType(k),d.unregisterType(j),d.unregisterType(l),d.unregisterType(m)}}),define("pilot/types/command",function(a,b,c){var d=a("pilot/canon");var e=a("pilot/types/basic").SelectionType;var f=a("pilot/types");var g=new e({name:"command",data:function(){return d.getCommandNames()},stringify:function(a){return a.name},fromString:function(a){return d.getCommand(a)}});b.startup=function(){f.registerType(g)},b.shutdown=function(){f.unregisterType(g)}}),define("pilot/types/settings",function(a,b,c){var d=a("pilot/types/basic").SelectionType;var e=a("pilot/types/basic").DeferredType;var f=a("pilot/types");var g=a("pilot/settings").settings;var h;var i=new d({name:"setting",data:function(){return k.settings.getSettingNames()},stringify:function(a){h=a;return a.name},fromString:function(a){h=g.getSetting(a);return h},noMatch:function(){h=null}});var j=new e({name:"settingValue",defer:function(){return h?h.type:f.getType("text")},getDefault:function(){var a=this.parse("");if(h){var b=h.get();if(a.predictions.length===0)a.predictions.push(b);else{var c=false;while(true){var d=a.predictions.indexOf(b);if(d===-1)break;a.predictions.splice(d,1),c=true}c&&a.predictions.push(b)}}return a}});var k;b.startup=function(a,b){k=a.env,f.registerType(i),f.registerType(j)},b.shutdown=function(a,b){f.unregisterType(i),f.unregisterType(j)}}),define("pilot/types",function(a,b,c){var d={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(a){var b=d.VALID;for(var c=0;cb&&(b=arguments[c]);return b}};b.Status=d;function e(a,b,c,e){this.value=a,this.status=b||d.VALID,this.message=c,this.predictions=e||[]}b.Conversion=e;function f(){}f.prototype={stringify:function(a){throw new Error("not implemented")},parse:function(a){throw new Error("not implemented")},name:undefined,increment:function(a){return undefined},decrement:function(a){return undefined},getDefault:function(){return this.parse("")}},b.Type=f;var g={};b.registerType=function(a){if(typeof a==="object")if(a instanceof f){if(!a.name)throw new Error("All registered types must have a name");g[a.name]=a}else throw new Error("Can't registerType using: "+a);else if(typeof a==="function"){if(!a.prototype.name)throw new Error("All registered types must have a name");g[a.prototype.name]=a}else throw new Error("Unknown type: "+a)},b.deregisterType=function(a){delete g[a.name]};function h(a,b){if(a.substr(-2)==="[]"){var c=a.slice(0,-2);return new g.array(c)}var d=g[a];typeof d==="function"&&(d=new d(b));return d}b.getType=function(a){if(typeof a==="string")return h(a);if(typeof a==="object"){if(!a.name)throw new Error("Missing 'name' member to typeSpec");return h(a.name,a)}throw new Error("Can't extract type from "+a)}}),define("pilot/useragent",function(a,b,c){var d=(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase();var e=navigator.userAgent;var f=navigator.appVersion;b.isWin=d=="win",b.isMac=d=="mac",b.isLinux=d=="linux",b.isIE=!+"\u000b1",b.isGecko=b.isMozilla=window.controllers&&window.navigator.product==="Gecko",b.isOpera=window.opera&&Object.prototype.toString.call(window.opera)=="[object Opera]",b.isWebKit=parseFloat(e.split("WebKit/")[1])||undefined,b.isAIR=e.indexOf("AdobeAIR")>=0,b.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},b.getOS=function(){return b.isMac?b.OS.MAC:b.isLinux?b.OS.LINUX:b.OS.WINDOWS}}),define("ace/background_tokenizer",function(a,b,c){var d=a("pilot/oop");var e=a("pilot/event_emitter").EventEmitter;var f=function(a,b){this.running=false,this.textLines=[],this.lines=[],this.currentLine=0,this.tokenizer=a;var c=this;this.$worker=function(){if(c.running){var a=new Date;var d=c.currentLine;var e=c.textLines;var f=0;var g=b.getLastVisibleRow();while(c.currentLine20){c.fireUpdateEvent(d,c.currentLine-1);var h=c.currentLine0&&this.lines[a-1]&&(d=this.lines[a-1].state,e=true);for(var f=a;f<=b;f++)if(this.lines[f]){var g=this.lines[f];d=g.state,c.push(g)}else{var g=this.tokenizer.getLineTokens(this.textLines[f]||"",d);var d=g.state;c.push(g),e&&(this.lines[f]=g)}return c}}).call(f.prototype),b.BackgroundTokenizer=f}),define("ace/commands/default_commands",function(a,b,c){var d=a("pilot/canon");d.addCommand({name:"selectall",exec:function(a,b,c){a.editor.getSelection().selectAll()}}),d.addCommand({name:"removeline",exec:function(a,b,c){a.editor.removeLines()}}),d.addCommand({name:"gotoline",exec:function(a,b,c){var d=parseInt(prompt("Enter line number:"));isNaN(d)||a.editor.gotoLine(d)}}),d.addCommand({name:"togglecomment",exec:function(a,b,c){a.editor.toggleCommentLines()}}),d.addCommand({name:"findnext",exec:function(a,b,c){a.editor.findNext()}}),d.addCommand({name:"findprevious",exec:function(a,b,c){a.editor.findPrevious()}}),d.addCommand({name:"find",exec:function(a,b,c){var d=prompt("Find:");a.editor.find(d)}}),d.addCommand({name:"undo",exec:function(a,b,c){a.editor.undo()}}),d.addCommand({name:"redo",exec:function(a,b,c){a.editor.redo()}}),d.addCommand({name:"redo",exec:function(a,b,c){a.editor.redo()}}),d.addCommand({name:"overwrite",exec:function(a,b,c){a.editor.toggleOverwrite()}}),d.addCommand({name:"copylinesup",exec:function(a,b,c){a.editor.copyLinesUp()}}),d.addCommand({name:"movelinesup",exec:function(a,b,c){a.editor.moveLinesUp()}}),d.addCommand({name:"selecttostart",exec:function(a,b,c){a.editor.getSelection().selectFileStart()}}),d.addCommand({name:"gotostart",exec:function(a,b,c){a.editor.navigateFileStart()}}),d.addCommand({name:"selectup",exec:function(a,b,c){a.editor.getSelection().selectUp()}}),d.addCommand({name:"golineup",exec:function(a,b,c){a.editor.navigateUp()}}),d.addCommand({name:"copylinesdown",exec:function(a,b,c){a.editor.copyLinesDown()}}),d.addCommand({name:"movelinesdown",exec:function(a,b,c){a.editor.moveLinesDown()}}),d.addCommand({name:"selecttoend",exec:function(a,b,c){a.editor.getSelection().selectFileEnd()}}),d.addCommand({name:"gotoend",exec:function(a,b,c){a.editor.navigateFileEnd()}}),d.addCommand({name:"selectdown",exec:function(a,b,c){a.editor.getSelection().selectDown()}}),d.addCommand({name:"godown",exec:function(a,b,c){a.editor.navigateDown()}}),d.addCommand({name:"selectwordleft",exec:function(a,b,c){a.editor.getSelection().selectWordLeft()}}),d.addCommand({name:"gotowordleft",exec:function(a,b,c){a.editor.navigateWordLeft()}}),d.addCommand({name:"selecttolinestart",exec:function(a,b,c){a.editor.getSelection().selectLineStart()}}),d.addCommand({name:"gotolinestart",exec:function(a,b,c){a.editor.navigateLineStart()}}),d.addCommand({name:"selectleft",exec:function(a,b,c){a.editor.getSelection().selectLeft()}}),d.addCommand({name:"gotoleft",exec:function(a,b,c){a.editor.navigateLeft()}}),d.addCommand({name:"selectwordright",exec:function(a,b,c){a.editor.getSelection().selectWordRight()}}),d.addCommand({name:"gotowordright",exec:function(a,b,c){a.editor.navigateWordRight()}}),d.addCommand({name:"selecttolineend",exec:function(a,b,c){a.editor.getSelection().selectLineEnd()}}),d.addCommand({name:"gotolineend",exec:function(a,b,c){a.editor.navigateLineEnd()}}),d.addCommand({name:"selectright",exec:function(a,b,c){a.editor.getSelection().selectRight()}}),d.addCommand({name:"gotoright",exec:function(a,b,c){a.editor.navigateRight()}}),d.addCommand({name:"selectpagedown",exec:function(a,b,c){a.editor.selectPageDown()}}),d.addCommand({name:"pagedown",exec:function(a,b,c){a.editor.scrollPageDown()}}),d.addCommand({name:"gotopagedown",exec:function(a,b,c){a.editor.gotoPageDown()}}),d.addCommand({name:"selectpageup",exec:function(a,b,c){a.editor.selectPageUp()}}),d.addCommand({name:"pageup",exec:function(a,b,c){a.editor.scrollPageUp()}}),d.addCommand({name:"gotopageup",exec:function(a,b,c){a.editor.gotoPageUp()}}),d.addCommand({name:"selectlinestart",exec:function(a,b,c){a.editor.getSelection().selectLineStart()}}),d.addCommand({name:"gotolinestart",exec:function(a,b,c){a.editor.navigateLineStart()}}),d.addCommand({name:"selectlineend",exec:function(a,b,c){a.editor.getSelection().selectLineEnd()}}),d.addCommand({name:"gotolineend",exec:function(a,b,c){a.editor.navigateLineEnd()}}),d.addCommand({name:"del",exec:function(a,b,c){a.editor.removeRight()}}),d.addCommand({name:"backspace",exec:function(a,b,c){a.editor.removeLeft()}}),d.addCommand({name:"outdent",exec:function(a,b,c){a.editor.blockOutdent()}}),d.addCommand({name:"indent",exec:function(a,b,c){a.editor.indent()}})}),define("ace/conf/keybindings/default_mac",function(a,b,c){b.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",function(a,b,c){b.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("ace/document",function(a,b,c){var d=a("pilot/oop");var e=a("pilot/lang");var f=a("pilot/event_emitter").EventEmitter;var g=a("ace/selection").Selection;var h=a("ace/mode/text").Mode;var i=a("ace/range").Range;var j=function(a,b){this.modified=true,this.lines=[],this.selection=new g(this),this.$breakpoints=[],this.listeners=[],b&&this.setMode(b),Array.isArray(a)?this.$insertLines(0,a):this.$insert({row:0,column:0},a)};(function(){d.implement(this,f),this.$undoManager=null,this.$split=function(a){return a.split(/\r\n|\r|\n/)},this.setValue=function(a){var b=[0,this.lines.length];b.push.apply(b,this.$split(a)),this.lines.splice.apply(this.lines,b),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,b){var c={firstRow:a,lastRow:b};this._dispatchEvent("change",{data:c})},this.setUndoManager=function(a){this.$undoManager=a,this.$deltas=[],this.$informUndoManager&&this.$informUndoManager.cancel();if(a){var b=this;this.$informUndoManager=e.deferredCall(function(){b.$deltas.length>0&&a.execute({action:"aceupdate",args:[b.$deltas,b]}),b.$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){this.$useSoftTabs===a||(this.$useSoftTabs=a)},this.getUseSoftTabs=function(){return this.$useSoftTabs},this.$tabSize=4,this.setTabSize=function(a){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 b=0;b0&&(d=!!c.charAt(b-1).match(this.tokenRe)),d||(d=!!c.charAt(b).match(this.tokenRe));var e=d?this.tokenRe:this.nonTokenRe;var f=b;if(f>0){do f--;while(f>=0&&c.charAt(f).match(e));f++}var g=b;while(g=0){var h=g.charAt(d);if(h==c){f-=1;if(f==0)return{row:e,column:d}}else h==a&&(f+=1);d-=1}e-=1;if(e<0)break;var g=this.getLine(e);var d=g.length-1}return null},this.$findClosingBracket=function(a,b){var c=this.$brackets[a];var d=b.column;var e=b.row;var f=1;var g=this.getLine(e);var h=this.getLength();while(true){while(d=h)break;var g=this.getLine(e);var d=0}return null},this.insert=function(a,b,c){var d=this.$insert(a,b,c);this.fireChangeEvent(a.row,a.row==d.row?a.row:undefined);return d},this.$insertLines=function(a,b,c){if(!(b.length==0)){var d=[a,0];d.push.apply(d,b),this.lines.splice.apply(this.lines,d);if(!c&&this.$undoManager){var e=this.$getNewLineCharacter();this.$deltas.push({action:"insertText",range:new i(a,0,a+b.length,0),text:b.join(e)+e}),this.$informUndoManager.schedule()}}},this.$insert=function(a,b,c){if(b.length==0)return a;this.modified=true,this.lines.length<=1&&this.$detectNewLine(b);var d=this.$split(b);if(this.$isNewLine(b)){var e=this.lines[a.row]||"";this.lines[a.row]=e.substring(0,a.column),this.lines.splice(a.row+1,0,e.substring(a.column));var f={row:a.row+1,column:0}}else if(d.length==1){var e=this.lines[a.row]||"";this.lines[a.row]=e.substring(0,a.column)+b+e.substring(a.column);var f={row:a.row,column:a.column+b.length}}else{var e=this.lines[a.row]||"";var g=e.substring(0,a.column)+d[0];var h=d[d.length-1]+e.substring(a.column);this.lines[a.row]=g,this.$insertLines(a.row+1,[h],true),d.length>2&&this.$insertLines(a.row+1,d.slice(1,-1),true);var f={row:a.row+d.length-1,column:d[d.length-1].length}}!c&&this.$undoManager&&(this.$deltas.push({action:"insertText",range:i.fromPoints(a,f),text:b}),this.$informUndoManager.schedule());return f},this.$isNewLine=function(a){return a=="\r\n"||a=="\r"||a=="\n"},this.remove=function(a,b){if(a.isEmpty())return a.start;this.$remove(a,b),this.fireChangeEvent(a.start.row,a.isMultiLine()?undefined:a.start.row);return a.start},this.$remove=function(a,b){if(!a.isEmpty()){if(!b&&this.$undoManager){var c=this.$getNewLineCharacter();this.$deltas.push({action:"removeText",range:a.clone(),text:this.getTextRange(a)}),this.$informUndoManager.schedule()}this.modified=true;var d=a.start.row;var e=a.end.row;var f=this.getLine(d).substring(0,a.start.column)+this.getLine(e).substring(a.end.column);f!=""?this.lines.splice(d,e-d+1,f):this.lines.splice(d,e-d+1,"");return a.start}},this.undoChanges=function(a){this.selection.clearSelection();for(var b=a.length-1;b>=0;b--){var c=a[b];c.action=="insertText"?(this.remove(c.range,true),this.selection.moveCursorToPosition(c.range.start)):(this.insert(c.range.start,c.text,true),this.selection.clearSelection())}},this.redoChanges=function(a){this.selection.clearSelection();for(var b=0;b=this.lines.length-1)return 0;var c=this.lines.slice(a,b+1);this.$remove(new i(a,0,b+1,0)),this.$insertLines(a+1,c),this.fireChangeEvent(a,b+1);return 1},this.duplicateLines=function(a,b){var a=this.$clipRowToDocument(a);var b=this.$clipRowToDocument(b);var c=this.getLines(a,b);this.$insertLines(a,c);var d=b-a+1;this.fireChangeEvent(a);return d},this.$clipRowToDocument=function(a){return Math.max(0,Math.min(a,this.lines.length-1))},this.documentToScreenColumn=function(a,b){var c=this.getTabSize();var d=0;var e=b;var f=this.getLine(a).split("\t");for(var g=0;gh)e-=h+1,d+=h+c;else{d+=e;break}}return d},this.screenToDocumentColumn=function(a,b){var c=this.getTabSize();var d=0;var e=b;var f=this.getLine(a).split("\t");for(var g=0;g=h+c)e-=h+c,d+=h+1;else{if(e>h){d+=h;break}d+=e;break}}return d}}).call(j.prototype),b.Document=j}),define("ace/editor",function(a,b,c){var d=a("pilot/oop");var e=a("pilot/event");var f=a("pilot/lang");var g=a("ace/textinput").TextInput;var h=a("ace/keybinding").KeyBinding;var i=a("ace/document").Document;var j=a("ace/search").Search;var k=a("ace/background_tokenizer").BackgroundTokenizer;var l=a("ace/range").Range;var m=a("pilot/event_emitter").EventEmitter;var n=function(a,b){var c=a.getContainerElement();this.container=c,this.renderer=a,this.textInput=new g(c,this),this.keyBinding=new h(c,this);var d=this;e.addListener(c,"mousedown",function(a){setTimeout(function(){d.focus()});return e.preventDefault(a)}),e.addListener(c,"selectstart",function(a){return e.preventDefault(a)});var f=a.getMouseEventTarget();e.addListener(f,"mousedown",this.onMouseDown.bind(this)),e.addMultiMouseDownListener(f,0,2,500,this.onMouseDoubleClick.bind(this)),e.addMultiMouseDownListener(f,0,3,600,this.onMouseTripleClick.bind(this)),e.addMouseWheelListener(f,this.onMouseWheel.bind(this)),this.$selectionMarker=null,this.$highlightLineMarker=null,this.$blockScrolling=false,this.$search=(new j).set({wrap:true}),this.setDocument(b||new i("")),this.focus()};(function(){d.implement(this,m),this.$forwardEvents={gutterclick:1,gutterdblclick:1},this.$originalAddEventListener=this.addEventListener,this.$originalRemoveEventListener=this.removeEventListener,this.addEventListener=function(a,b){return this.$forwardEvents[a]?this.renderer.addEventListener(a,b):this.$originalAddEventListener(a,b)},this.removeEventListener=function(a,b){return this.$forwardEvents[a]?this.renderer.removeEventListener(a,b):this.$originalRemoveEventListener(a,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 b=this.doc.getSelection();b.removeEventListener("changeCursor",this.$onCursorChange),b.removeEventListener("changeSelection",this.$onSelectionChange),this.doc.setScrollTopRow(this.renderer.getScrollTopRow())}this.doc=a,this.$onDocumentChange=this.onDocumentChange.bind(this),a.addEventListener("change",this.$onDocumentChange),this.renderer.setDocument(a),this.$onDocumentModeChange=this.onDocumentModeChange.bind(this),a.addEventListener("changeMode",this.$onDocumentModeChange),this.$onDocumentChangeTabSize=this.renderer.updateText.bind(this.renderer),a.addEventListener("changeTabSize",this.$onDocumentChangeTabSize),this.$onDocumentChangeBreakpoint=this.onDocumentChangeBreakpoint.bind(this),this.doc.addEventListener("changeBreakpoint",this.$onDocumentChangeBreakpoint),this.selection=a.getSelection(),this.$desiredColumn=0,this.$onCursorChange=this.onCursorChange.bind(this),this.selection.addEventListener("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.addEventListener("changeSelection",this.$onSelectionChange),this.onDocumentModeChange(),this.bgTokenizer.setLines(this.doc.lines),this.bgTokenizer.start(0),this.onCursorChange(),this.onSelectionChange(),this.onDocumentChangeBreakpoint(),this.renderer.scrollToRow(a.getScrollTopRow()),this.renderer.updateFull()}},this.getDocument=function(){return this.doc},this.getSelection=function(){return this.selection},this.resize=function(){this.renderer.onResize()},this.setTheme=function(a){this.renderer.setTheme(a)},this.$highlightBrackets=function(){this.$bracketHighlight&&(this.renderer.removeMarker(this.$bracketHighlight),this.$bracketHighlight=null);if(!this.$highlightPending){var a=this;this.$highlightPending=true,setTimeout(function(){a.$highlightPending=false;var b=a.doc.findMatchingBracket(a.getCursorPosition());if(b){var c=new l(b.row,b.column,b.row,b.column+1);a.$bracketHighlight=a.renderer.addMarker(c,"ace_bracket")}},10)}},this.focus=function(){this.textInput.focus()},this.blur=function(){this.textInput.blur()},this.onFocus=function(){this.renderer.showCursor(),this.renderer.visualizeFocus()},this.onBlur=function(){this.renderer.hideCursor(),this.renderer.visualizeBlur()},this.onDocumentChange=function(a){var b=a.data;this.bgTokenizer.start(b.firstRow),this.renderer.updateLines(b.firstRow,b.lastRow),this.renderer.updateCursor(this.getCursorPosition(),this.$overwrite)},this.onTokenizerUpdate=function(a){var b=a.data;this.renderer.updateLines(b.first,b.last)},this.onCursorChange=function(){this.$highlightBrackets(),this.renderer.updateCursor(this.getCursorPosition(),this.$overwrite),this.$blockScrolling||this.renderer.scrollCursorIntoView(),this.$updateHighlightActiveLine()},this.$updateHighlightActiveLine=function(){this.$highlightLineMarker&&this.renderer.removeMarker(this.$highlightLineMarker),this.$highlightLineMarker=null;if(this.getHighlightActiveLine()&&(this.getSelectionStyle()!="line"||!this.selection.isMultiLine())){var a=this.getCursorPosition();var b=new l(a.row,0,a.row+1,0);this.$highlightLineMarker=this.renderer.addMarker(b,"ace_active_line","line")}},this.onSelectionChange=function(){this.$selectionMarker&&this.renderer.removeMarker(this.$selectionMarker),this.$selectionMarker=null;if(!this.selection.isEmpty()){var a=this.selection.getRange();var b=this.getSelectionStyle();this.$selectionMarker=this.renderer.addMarker(a,"ace_selection",b)}this.onCursorChange()},this.onDocumentChangeBreakpoint=function(){this.renderer.setBreakpoints(this.doc.getBreakpoints())},this.onDocumentModeChange=function(){var a=this.doc.getMode();if(!(this.mode==a)){this.mode=a;var b=a.getTokenizer();if(this.bgTokenizer)this.bgTokenizer.setTokenizer(b);else{var c=this.onTokenizerUpdate.bind(this);this.bgTokenizer=new k(b,this),this.bgTokenizer.addEventListener("update",c)}this.renderer.setTokenizer(this.bgTokenizer)}},this.onMouseDown=function(a){var b=e.getDocumentX(a);var c=e.getDocumentY(a);var d=this.renderer.screenToTextCoordinates(b,c);d.row=Math.max(0,Math.min(d.row,this.doc.getLength()-1));if(e.getButton(a)!=0)this.selection.isEmpty()&&this.moveCursorToPosition(d);else{a.shiftKey?this.selection.selectToPosition(d):(this.moveCursorToPosition(d),this.$clickSelection||this.selection.clearSelection(d.row,d.column)),this.renderer.scrollCursorIntoView();var f=this;var g,h;var i=function(a){g=e.getDocumentX(a),h=e.getDocumentY(a)};var j=function(){clearInterval(l),f.$clickSelection=null};var k=function(){if(!(g===undefined||h===undefined)){var a=f.renderer.screenToTextCoordinates(g,h);a.row=Math.max(0,Math.min(a.row,f.doc.getLength()-1));if(f.$clickSelection)if(f.$clickSelection.contains(a.row,a.column))f.selection.setSelectionRange(f.$clickSelection);else{if(f.$clickSelection.compare(a.row,a.column)==-1)var b=f.$clickSelection.end;else var b=f.$clickSelection.start;f.selection.setSelectionAnchor(b.row,b.column),f.selection.selectToPosition(a)}else f.selection.selectToPosition(a);f.renderer.scrollCursorIntoView()}};e.capture(this.container,i,j);var l=setInterval(k,20);return e.preventDefault(a)}},this.onMouseDoubleClick=function(a){this.selection.selectWord(),this.$clickSelection=this.getSelectionRange(),this.$updateDesiredColumn()},this.onMouseTripleClick=function(a){this.selection.selectLine(),this.$clickSelection=this.getSelectionRange(),this.$updateDesiredColumn()},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())},this.onCut=function(){this.$readOnly||(this.selection.isEmpty()||(this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())),this.clearSelection()))},this.onTextInput=function(a){if(!this.$readOnly){var b=this.getCursorPosition();a=a.replace("\t",this.doc.getTabString());if(this.selection.isEmpty()){if(this.$overwrite){var c=new l.fromPoints(b,b);c.end.column+=a.length,this.doc.remove(c)}}else{var b=this.doc.remove(this.getSelectionRange());this.clearSelection()}this.clearSelection();var d=this;this.bgTokenizer.getState(b.row,function(c){var e=d.mode.checkOutdent(c,d.doc.getLine(b.row),a);var f=d.doc.getLine(b.row),g=d.mode.getNextLineIndent(c,f.slice(0,b.column),d.doc.getTabString());var h=d.doc.insert(b,a);d.bgTokenizer.getState(b.row,function(a){if(b.row!==h.row){var c=d.doc.getTabSize(),i=Number.MAX_VALUE;for(var j=b.row+1;j<=h.row;++j){var k=0;f=d.doc.getLine(j);for(var m=0;m0;++m)f.charAt(m)=="\t"?n-=c:f.charAt(m)==" "&&(n-=1);d.doc.replace(new l(j,0,j,f.length),f.substr(m))}h.column+=d.doc.indentRows(b.row+1,h.row,g)}else e&&(h.column+=d.mode.autoOutdent(a,d.doc,b.row));d.moveCursorToPosition(h),d.renderer.scrollCursorIntoView()})})}},this.$overwrite=false,this.setOverwrite=function(a){this.$overwrite==a||(this.$overwrite=a,this.$blockScrolling=true,this.onCursorChange(),this.$blockScrolling=false,this._dispatchEvent("changeOverwrite",{data:a}))},this.getOverwrite=function(){return this.$overwrite},this.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},this.$scrollSpeed=1,this.setScrollSpeed=function(a){this.$scrollSpeed=a},this.getScrollSpeed=function(){return this.$scrollSpeed},this.$selectionStyle="line",this.setSelectionStyle=function(a){this.$selectionStyle==a||(this.$selectionStyle=a,this.onSelectionChange(),this._dispatchEvent("changeSelectionStyle",{data:a}))},this.getSelectionStyle=function(){return this.$selectionStyle},this.$highlightActiveLine=true,this.setHighlightActiveLine=function(a){this.$highlightActiveLine==a||(this.$highlightActiveLine=a,this.$updateHighlightActiveLine())},this.getHighlightActiveLine=function(){return this.$highlightActiveLine},this.setShowInvisibles=function(a){this.getShowInvisibles()==a||this.renderer.setShowInvisibles(a)},this.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},this.setShowPrintMargin=function(a){this.renderer.setShowPrintMargin(a)},this.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},this.setPrintMarginColumn=function(a){this.renderer.setPrintMarginColumn(a)},this.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},this.$readOnly=false,this.setReadOnly=function(a){this.$readOnly=a},this.getReadOnly=function(){return this.$readOnly},this.removeRight=function(){this.$readOnly||(this.selection.isEmpty()&&this.selection.selectRight(),this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())),this.clearSelection())},this.removeLeft=function(){this.$readOnly||(this.selection.isEmpty()&&this.selection.selectLeft(),this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())),this.clearSelection())},this.indent=function(){if(!this.$readOnly){var a=this.doc,b=this.getSelectionRange();if(b.start.row=this.getFirstVisibleRow()&&a<=this.getLastVisibleRow()},this.getVisibleRowCount=function(){return this.getLastVisibleRow()-this.getFirstVisibleRow()+1},this.getPageDownRow=function(){return this.renderer.getLastVisibleRow()-1},this.getPageUpRow=function(){var a=this.renderer.getFirstVisibleRow();var b=this.renderer.getLastVisibleRow();return a-(b-a)+1},this.selectPageDown=function(){var a=this.getPageDownRow()+Math.floor(this.getVisibleRowCount()/2);this.scrollPageDown();var b=this.getSelection();b.$moveSelection(function(){b.moveCursorTo(a,b.getSelectionLead().column)})},this.selectPageUp=function(){var a=this.getLastVisibleRow()-this.getFirstVisibleRow();var b=this.getPageUpRow()+Math.round(a/2);this.scrollPageUp();var c=this.getSelection();c.$moveSelection(function(){c.moveCursorTo(b,c.getSelectionLead().column)})},this.gotoPageDown=function(){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 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())},this.scrollPageUp=function(){this.renderer.scrollToRow(this.getPageUpRow())},this.scrollToRow=function(a){this.renderer.scrollToRow(a)},this.getCursorPosition=function(){return this.selection.getCursor()},this.getSelectionRange=function(){return this.selection.getRange()},this.clearSelection=function(){this.selection.clearSelection(),this.$updateDesiredColumn()},this.moveCursorTo=function(a,b){this.selection.moveCursorTo(a,b),this.$updateDesiredColumn()},this.moveCursorToPosition=function(a){this.selection.moveCursorToPosition(a),this.$updateDesiredColumn()},this.gotoLine=function(a,b){this.selection.clearSelection(),this.$blockScrolling=true,this.moveCursorTo(a-1,b||0),this.$blockScrolling=false,this.isRowVisible(this.getCursorPosition().row)||this.scrollToRow(a-1-Math.floor(this.getVisibleRowCount()/2))},this.navigateTo=function(a,b){this.clearSelection(),this.moveCursorTo(a,b),this.$updateDesiredColumn(b)},this.navigateUp=function(){this.selection.clearSelection(),this.selection.moveCursorBy(-1,0);if(this.$desiredColumn){var a=this.getCursorPosition();var 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 a=this.getCursorPosition();var b=this.doc.screenToDocumentColumn(a.row,this.$desiredColumn);this.selection.moveCursorTo(a.row,b)}},this.$updateDesiredColumn=function(){var a=this.getCursorPosition();this.$desiredColumn=this.doc.documentToScreenColumn(a.row,a.column)},this.navigateLeft=function(){if(this.selection.isEmpty())this.selection.moveCursorLeft();else{var a=this.getSelectionRange().start;this.moveCursorToPosition(a)}this.clearSelection()},this.navigateRight=function(){if(this.selection.isEmpty())this.selection.moveCursorRight();else{var a=this.getSelectionRange().end;this.moveCursorToPosition(a)}this.clearSelection()},this.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},this.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},this.navigateFileEnd=function(){this.selection.moveCursorFileEnd(),this.clearSelection()},this.navigateFileStart=function(){this.selection.moveCursorFileStart(),this.clearSelection()},this.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},this.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},this.replace=function(a,b){b&&this.$search.set(b);var c=this.$search.find(this.doc);this.$tryReplace(c,a),c!==null&&this.selection.setSelectionRange(c),this.$updateDesiredColumn()},this.replaceAll=function(a,b){b&&this.$search.set(b);var c=this.$search.findAll(this.doc);if(c.length){this.clearSelection(),this.selection.moveCursorTo(0,0);for(var d=c.length-1;d>=0;--d)this.$tryReplace(c[d],a);c[0]!==null&&this.selection.setSelectionRange(c[0]),this.$updateDesiredColumn()}},this.$tryReplace=function(a,b){var c=this.doc.getTextRange(a);var b=this.$search.replace(c,b);if(b!==null){a.end=this.doc.replace(a,b);return a}return null},this.getLastSearchOptions=function(){return this.$search.getOptions()},this.find=function(a,b){this.clearSelection(),b=b||{},b.needle=a,this.$search.set(b),this.$find()},this.findNext=function(a){a=a||{},typeof a.backwards=="undefined"&&(a.backwards=false),this.$search.set(a),this.$find()},this.findPrevious=function(a){a=a||{},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 a!="undefined"&&this.$search.set({backwards:a});var b=this.$search.find(this.doc);b&&(this.gotoLine(b.end.row+1,b.end.column),this.$updateDesiredColumn(),this.selection.setSelectionRange(b))},this.undo=function(){this.doc.getUndoManager().undo()},this.redo=function(){this.doc.getUndoManager().redo()}}).call(n.prototype),b.Editor=n}),define("ace/keybinding",function(a,b,c){var d=a("pilot/useragent");var e=a("pilot/event");var f=a("ace/conf/keybindings/default_mac").bindings;var g=a("ace/conf/keybindings/default_win").bindings;var h=a("pilot/canon");a("ace/commands/default_commands");var i=function(a,b,c){this.setConfig(c);var f=this;e.addKeyListener(a,function(a){if(d.isOpera&&d.isMac)var c=0|(a.metaKey?1:0)|(a.altKey?2:0)|(a.shiftKey?4:0)|(a.ctrlKey?8:0);else var c=0|(a.ctrlKey?1:0)|(a.altKey?2:0)|(a.shiftKey?4:0)|(a.metaKey?8:0);var g=f.keyNames[a.keyCode];var i=(f.config.reverse[c]||{})[(g||String.fromCharCode(a.keyCode)).toLowerCase()];var j=h.exec(i,{editor:b});if(j)return e.stopEvent(a)})};(function(){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"};function a(a,b,c,d){return(d&&a.toLowerCase()||a).replace(/(?:^\s+|\n|\s+$)/g,"").split(new RegExp("[\\s ]*"+b+"[\\s ]*","g"),c||999)}function b(b,c,d){var e,f=0,g=a(b,"\\-",null,true),h=0,i=g.length;for(;h",c+1,""),b.push("");this.element.innerHTML=b.join(""),this.element.style.height=a.minHeight+"px"}}).call(d.prototype),b.Gutter=d}),define("ace/layer/marker",function(a,b,c){var d=a("ace/range").Range;var e=function(a){this.element=document.createElement("div"),this.element.className="ace_layer ace_marker-layer",a.appendChild(this.element),this.markers={},this.$markerId=1};(function(){this.setDocument=function(a){this.doc=a},this.addMarker=function(a,b,c){var d=this.$markerId++;this.markers[d]={range:a,type:c||"line",clazz:b};return d},this.removeMarker=function(a){var b=this.markers[a];b&&delete this.markers[a]},this.update=function(a){var a=a||this.config;if(a){this.config=a;var b=[];for(var c in this.markers){var d=this.markers[c];var e=d.range.clipRows(a.firstRow,a.lastRow);if(e.isEmpty())continue;e.isMultiLine()?d.type=="text"?this.drawTextMarker(b,e,d.clazz,a):this.drawMultiLineMarker(b,e,d.clazz,a):this.drawSingleLineMarker(b,e,d.clazz,a)}this.element.innerHTML=b.join("")}},this.drawTextMarker=function(a,b,c,e){var f=b.start.row;var g=new d(f,b.start.column,f,this.doc.getLine(f).length);this.drawSingleLineMarker(a,g,c,e);var f=b.end.row;var g=new d(f,0,f,b.end.column);this.drawSingleLineMarker(a,g,c,e);for(var f=b.start.row+1;f");var g=(b.end.row-d.firstRow)*d.lineHeight;var f=Math.round(b.end.column*d.characterWidth);a.push("
");var e=(b.end.row-b.start.row-1)*d.lineHeight;if(!(e<0)){var g=(b.start.row+1-d.firstRow)*d.lineHeight;a.push("
")}},this.drawSingleLineMarker=function(a,b,c,d){var b=b.toScreenRange(this.doc);var e=d.lineHeight;var f=Math.round((b.end.column-b.start.column)*d.characterWidth);var g=(b.start.row-d.firstRow)*d.lineHeight;var h=Math.round(b.start.column*d.characterWidth);a.push("
")}}).call(e.prototype),b.Marker=e}),define("ace/layer/text",function(a,b,c){var d=a("pilot/oop");var e=a("pilot/dom");var f=a("pilot/lang");var g=a("pilot/event_emitter").EventEmitter;var h=function(a){this.element=document.createElement("div"),this.element.className="ace_layer ace_text-layer",a.appendChild(this.element),this.$characterSize=this.$measureSizes(),this.$pollSizeChanges()};(function(){d.implement(this,g),this.EOF_CHAR="¶",this.EOL_CHAR="¬",this.TAB_CHAR="→",this.SPACE_CHAR="·",this.setTokenizer=function(a){this.tokenizer=a},this.getLineHeight=function(){return this.$characterSize.height||1},this.getCharacterWidth=function(){return this.$characterSize.width||1},this.$pollSizeChanges=function(){var a=this;setInterval(function(){var b=a.$measureSizes();if(a.$characterSize.width!==b.width||a.$characterSize.height!==b.height)a.$characterSize=b,a._dispatchEvent("changeCharaterSize",{data:b})},500)},this.$fontStyles={fontFamily:1,fontSize:1,fontWeight:1,fontStyle:1,lineHeight:1},this.$measureSizes=function(){var a=1e3;if(!this.$measureNode){var b=this.$measureNode=document.createElement("div");var c=b.style;c.width=c.height="auto",c.left=c.top="-1000px",c.visibility="hidden",c.position="absolute",c.overflow="visible",c.whiteSpace="nowrap",b.innerHTML=f.stringRepeat("Xy",a),document.body.insertBefore(b,document.body.firstChild)}var c=this.$measureNode.style;for(var d in this.$fontStyles){var g=e.computedStyle(this.element,d);c[d]=g}var h={height:this.$measureNode.offsetHeight,width:this.$measureNode.offsetWidth/(a*2)};return h},this.setDocument=function(a){this.doc=a},this.$showInvisibles=false,this.setShowInvisibles=function(a){this.$showInvisibles=a},this.$computeTabString=function(){var a=this.doc.getTabSize();if(this.$showInvisibles){var b=a/2;this.$tabString=""+(new Array(Math.floor(b))).join(" ")+this.TAB_CHAR+(new Array(Math.ceil(b)+1)).join(" ")+""}else this.$tabString=(new Array(a+1)).join(" ")},this.updateLines=function(a,b,c){this.$computeTabString(),this.config=a;var d=Math.max(b,a.firstRow);var e=Math.min(c,a.lastRow);var f=this.element.childNodes;var g=this;this.tokenizer.getTokens(d,e,function(b){for(var c=d;c<=e;c++){var h=f[c-a.firstRow];if(!h)continue;var i=[];g.$renderLine(i,c,b[c-d].tokens),h.innerHTML=i.join("")}})},this.scrollLines=function(a){var b=this;this.$computeTabString();var c=this.config;this.config=a;if(!c||c.lastRowa.lastRow)for(var e=a.lastRow+1;e<=c.lastRow;e++)d.removeChild(d.lastChild);f(g);function f(e){a.firstRowc.lastRow&&b.$renderLinesFragment(a,c.lastRow+1,a.lastRow,function(a){d.appendChild(a)})}},this.$renderLinesFragment=function(a,b,c,d){var e=document.createDocumentFragment();var f=this;this.tokenizer.getTokens(b,c,function(g){for(var h=b;h<=c;h++){var i=document.createElement("div");i.className="ace_line";var j=i.style;j.height=f.$characterSize.height+"px",j.width=a.width+"px";var k=[];f.$renderLine(k,h,g[h-b].tokens),i.innerHTML=k.join(""),e.appendChild(i)}d(e)})},this.update=function(a){this.$computeTabString(),this.config=a;var b=[];var c=this;this.tokenizer.getTokens(a.firstRow,a.lastRow,function(d){for(var e=a.firstRow;e<=a.lastRow;e++)b.push("
"),c.$renderLine(b,e,d[e-a.firstRow].tokens),b.push("
");c.element.innerHTML=b.join("")})},this.$textToken={text:true,rparen:true,lparen:true},this.$renderLine=function(a,b,c){var d=/[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/g;var e=" ";for(var f=0;f",h,"")}}this.$showInvisibles&&(b!==this.doc.getLength()-1?a.push(""+this.EOL_CHAR+""):a.push(""+this.EOF_CHAR+""))}}).call(h.prototype),b.Text=h}),define("ace/range",function(a,b,c){var d=function(a,b,c,d){this.start={row:a,column:b},this.end={row:c,column:d}};(function(){this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(a,b){return this.compare(a,b)==0},this.compare=function(a,b){if(!this.isMultiLine())if(a===this.start.row)return bthis.end.column?1:0;if(athis.end.row)return 1;if(this.start.row===a)return b>=this.start.column?0:-1;if(this.end.row===a)return b<=this.end.column?0:1;return 0},this.clipRows=function(a,b){if(this.end.row>b)var c={row:b+1,column:0};if(this.start.row>b)var e={row:b+1,column:0};if(this.start.row=0;h--){var i=g[h];var j=c.$rangeFromMatch(f,i.offset,i.str.length);if(d(j))return true}})}}},this.$rangeFromMatch=function(a,b,c){return new f(a,b,a,b+c)},this.$assembleRegExp=function(){if(this.$options.regExp)var a=this.$options.needle;else a=d.escapeRegExp(this.$options.needle);this.$options.wholeWord&&(a="\\b"+a+"\\b");var b="g";this.$options.caseSensitive||(b+="i");var c=new RegExp(a,b);return c},this.$forwardLineIterator=function(a){var b=this.$options.scope==g.SELECTION;var c=a.getSelection().getRange();var d=a.getSelection().getCursor();var e=b?c.start.row:0;var f=b?c.start.column:0;var h=b?c.end.row:a.getLength()-1;var i=this.$options.wrap;function j(d){var e=a.getLine(d);b&&d==c.end.row&&(e=e.substring(0,c.end.column));return e}return{forEach:function(a){var b=d.row;var c=j(b);var g=d.column;var k=false;while(!a(c,g,b)){if(k)return;b++,g=0;if(b>h)if(i)b=e,g=f;else return;b==d.row&&(k=true),c=j(b)}}}},this.$backwardLineIterator=function(a){var b=this.$options.scope==g.SELECTION;var c=a.getSelection().getRange();var d=b?c.end:c.start;var e=b?c.start.row:0;var f=b?c.start.column:0;var h=b?c.end.row:a.getLength()-1;var i=this.$options.wrap;return{forEach:function(g){var j=d.row;var k=a.getLine(j).substring(0,d.column);var l=0;var m=false;while(!g(k,l,j)){if(m)return;j--,l=0;if(jb.row||a.row==b.row&&a.column>b.column},this.getRange=function(){var a=this.selectionAnchor||this.selectionLead;var b=this.selectionLead;return this.isBackwards()?g.fromPoints(b,a):g.fromPoints(a,b)},this.clearSelection=function(){this.selectionAnchor&&(this.selectionAnchor=null,this._dispatchEvent("changeSelection",{}))},this.selectAll=function(){var a=this.doc.getLength()-1;this.setSelectionAnchor(a,this.doc.getLine(a).length),this.$moveSelection(function(){this.moveCursorTo(0,0)})},this.setSelectionRange=function(a,b){b?(this.setSelectionAnchor(a.end.row,a.end.column),this.selectTo(a.start.row,a.start.column)):(this.setSelectionAnchor(a.start.row,a.start.column),this.selectTo(a.end.row,a.end.column))},this.$moveSelection=function(a){var b=false;this.selectionAnchor||(b=true,this.selectionAnchor=this.$clone(this.selectionLead));var c=this.$clone(this.selectionLead);a.call(this);if(c.row!==this.selectionLead.row||c.column!==this.selectionLead.column)b=true;b&&this._dispatchEvent("changeSelection",{})},this.selectTo=function(a,b){this.$moveSelection(function(){this.moveCursorTo(a,b)})},this.selectToPosition=function(a){this.$moveSelection(function(){this.moveCursorToPosition(a)})},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 a=this.selectionLead;var b=a.column;var c=this.doc.getWordRange(a.row,b);this.setSelectionRange(c)},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 a=this.doc;var b=a.getTabSize();var c=this.selectionLead;a.isTabStop(c)&&a.getLine(c.row).slice(c.column-b,c.column).split(" ").length-1==b?this.moveCursorBy(0,-b):this.moveCursorBy(0,-1)}},this.moveCursorRight=function(){if(this.selectionLead.column==this.doc.getLine(this.selectionLead.row).length)this.selectionLead.row=b?this.moveCursorTo(a,0):this.moveCursorTo(a,d[0].length)},this.moveCursorLineEnd=function(){this.moveCursorTo(this.selectionLead.row,this.doc.getLine(this.selectionLead.row).length)},this.moveCursorFileEnd=function(){var a=this.doc.getLength()-1;var b=this.doc.getLine(a).length;this.moveCursorTo(a,b)},this.moveCursorFileStart=function(){this.moveCursorTo(0,0)},this.moveCursorWordRight=function(){var a=this.selectionLead.row;var b=this.selectionLead.column;var c=this.doc.getLine(a);var d=c.substring(b);var e;this.doc.nonTokenRe.lastIndex=0,this.doc.tokenRe.lastIndex=0;if(b==c.length)this.moveCursorRight();else{if(e=this.doc.nonTokenRe.exec(d))b+=this.doc.nonTokenRe.lastIndex,this.doc.nonTokenRe.lastIndex=0;else if(e=this.doc.tokenRe.exec(d))b+=this.doc.tokenRe.lastIndex,this.doc.tokenRe.lastIndex=0;this.moveCursorTo(a,b)}},this.moveCursorWordLeft=function(){var a=this.selectionLead.row;var b=this.selectionLead.column;var c=this.doc.getLine(a);var d=e.stringReverse(c.substring(0,b));var f;this.doc.nonTokenRe.lastIndex=0,this.doc.tokenRe.lastIndex=0;if(b==0)this.moveCursorLeft();else{if(f=this.doc.nonTokenRe.exec(d))b-=this.doc.nonTokenRe.lastIndex,this.doc.nonTokenRe.lastIndex=0;else if(f=this.doc.tokenRe.exec(d))b-=this.doc.tokenRe.lastIndex,this.doc.tokenRe.lastIndex=0;this.moveCursorTo(a,b)}},this.moveCursorBy=function(a,b){this.moveCursorTo(this.selectionLead.row+a,this.selectionLead.column+b)},this.moveCursorToPosition=function(a){this.moveCursorTo(a.row,a.column)},this.moveCursorTo=function(a,b){var c=this.$clipPositionToDocument(a,b);if(c.row!==this.selectionLead.row||c.column!==this.selectionLead.column)this.selectionLead=c,this._dispatchEvent("changeCursor",{data:this.getCursor()})},this.moveCursorUp=function(){this.moveCursorBy(-1,0)},this.$clipPositionToDocument=function(a,b){var c={};a>=this.doc.getLength()?(c.row=Math.max(0,this.doc.getLength()-1),c.column=this.doc.getLine(c.row).length):a<0?(c.row=0,c.column=0):(c.row=a,c.column=Math.min(this.doc.getLine(c.row).length,Math.max(0,b)));return c},this.$clone=function(a){return{row:a.row,column:a.column}}}).call(h.prototype),b.Selection=h}),define("ace/textinput",function(a,b,c){var d=a("pilot/event");var e=function(a,b){var c=document.createElement("textarea");var e=c.style;e.position="absolute",e.left="-10000px",e.top="-10000px",a.appendChild(c);var f=String.fromCharCode(0);i();var g=false;var h=false;function i(){if(!h){var a=c.value;a&&(a.charCodeAt(a.length-1)==f.charCodeAt(0)?(a=a.slice(0,-1),a&&b.onTextInput(a)):b.onTextInput(a))}h=false,c.value=f,c.select()}var j=function(a){setTimeout(function(){g||i()},0)};var k=function(a){g=true,i(),c.value="",b.onCompositionStart(),setTimeout(l,0)};var l=function(){b.onCompositionUpdate(c.value)};var m=function(){g=false,b.onCompositionEnd(),j()};var n=function(){h=true,c.value=b.getCopyText(),c.select(),h=true,setTimeout(i,0)};var o=function(){h=true,c.value=b.getCopyText(),b.onCut(),c.select(),setTimeout(i,0)};d.addListener(c,"keypress",j),d.addListener(c,"textInput",j),d.addListener(c,"paste",j),d.addListener(c,"propertychange",j),d.addListener(c,"copy",n),d.addListener(c,"cut",o),d.addListener(c,"compositionstart",k),d.addListener(c,"compositionupdate",l),d.addListener(c,"compositionend",m),d.addListener(c,"blur",function(){b.onBlur()}),d.addListener(c,"focus",function(){b.onFocus(),c.select()}),this.focus=function(){b.onFocus(),c.select(),c.focus()},this.blur=function(){c.blur()}};b.TextInput=e}),define("ace/tokenizer",function(a,b,c){var d=function(a){this.rules=a,this.regExps={};for(var b in this.rules){var c=this.rules[b];var d=[];for(var e=0;ea&&(this.$changedLines.firstRow=a),this.$changedLines.lastRowc.lastRow+1)){if(bc&&this.scrollToY(c),this.getScrollTop()+this.$size.scrollerHeightb&&this.scrollToX(b),this.scroller.scrollLeft+this.$size.scrollerWidth=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\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(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"},d.inherits(JavaScriptHighlightRules,g),b.JavaScriptHighlightRules=JavaScriptHighlightRules}),define("ace/mode/doc_comment_highlight_rules",function(a,b,c){var d=a("pilot/oop");var e=a("ace/mode/text_highlight_rules").TextHighlightRules;var f=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:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f}),define("ace/mode/matching_brace_outdent",function(a,b,c){var d=a("ace/range").Range;var e=function(){};(function(){this.checkOutdent=function(a,b){if(!/^\s+$/.test(a))return false;return/^\s*\}/.test(b)},this.autoOutdent=function(a,b){var c=a.getLine(b);var e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length;var g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h);return h.length-(f-1)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);if(b)return b[1];return""}}).call(e.prototype),b.MatchingBraceOutdent=e}),define("ace/mode/javascript_highlight_rules",function(a,b,c){var d=a("pilot/oop");var e=a("pilot/lang");var f=a("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;var g=a("ace/mode/text_highlight_rules").TextHighlightRules;JavaScriptHighlightRules=function(){var a=new f;var b=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("|"));var c=e.arrayToMap("null|Infinity|NaN|undefined".split("|"));var d=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:"\\/\\/.*$"},a.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(a){return a=="this"?"variable.language":b[a]?"keyword":c[a]?"constant.language":d[a]?"invalid.illegal":a=="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(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"},d.inherits(JavaScriptHighlightRules,g),b.JavaScriptHighlightRules=JavaScriptHighlightRules}),define("text!ace/css/editor.css",".ace_editor { position: absolute; overflow: hidden; font-family: \"Menlo\", \"Monaco\", \"Courier New\", monospace; font-size: 12px; }.ace_scroller { position: absolute; overflow-x: scroll; overflow-y: hidden; }.ace_gutter { position: absolute; overflow-x: hidden; overflow-y: hidden; height: 100%;}.ace_editor .ace_sb { position: absolute; overflow-x: hidden; overflow-y: scroll; right: 0;}.ace_editor .ace_sb div { position: absolute; width: 1px; left: 0px;}.ace_editor .ace_printMargin { position: absolute; height: 100%;}.ace_layer { z-index: 0; position: absolute; overflow: hidden; white-space: nowrap; height: 100%;}.ace_text-layer { font-family: Monaco, \"Courier New\", monospace; color: black;}.ace_cursor-layer { cursor: text;}.ace_cursor { z-index: 3; position: absolute;}.ace_line { white-space: nowrap;}.ace_marker-layer {}.ace_marker-layer .ace_step { position: absolute; z-index: 2;}.ace_marker-layer .ace_selection { position: absolute; z-index: 3;}.ace_marker-layer .ace_bracket { position: absolute; z-index: 4;}.ace_marker-layer .ace_active_line { position: absolute; z-index: 1;}"),define("text!ace/theme/tm.css",".ace-tm .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-tm .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-tm .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-tm .ace_gutter-layer { width: 100%; text-align: right;}.ace-tm .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-tm .ace_editor .ace_printMargin { width: 1px; background: #e8e8e8;}.ace-tm .ace_text-layer { cursor: text;}.ace-tm .ace_cursor { border-left: 2px solid black;}.ace-tm .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid black;} .ace-tm .ace_line .ace_invisible { color: rgb(191, 191, 191);}.ace-tm .ace_line .ace_keyword { color: blue;}.ace-tm .ace_line .ace_constant.ace_buildin { color: rgb(88, 72, 246);}.ace-tm .ace_line .ace_constant.ace_language { color: rgb(88, 92, 246);}.ace-tm .ace_line .ace_constant.ace_library { color: rgb(6, 150, 14);}.ace-tm .ace_line .ace_invalid { background-color: rgb(153, 0, 0); color: white;}.ace-tm .ace_line .ace_support.ace_function { color: rgb(60, 76, 114);}.ace-tm .ace_line .ace_support.ace_constant { color: rgb(6, 150, 14);}.ace-tm .ace_line .ace_support.ace_type,.ace-tm .ace_line .ace_support.ace_class { color: rgb(109, 121, 222);}.ace-tm .ace_line .ace_keyword.ace_operator { color: rgb(104, 118, 135);}.ace-tm .ace_line .ace_string { color: rgb(3, 106, 7);}.ace-tm .ace_line .ace_comment { color: rgb(76, 136, 107);}.ace-tm .ace_line .ace_comment.ace_doc { color: rgb(0, 102, 255);}.ace-tm .ace_line .ace_comment.ace_doc.ace_tag { color: rgb(128, 159, 191);}.ace-tm .ace_line .ace_constant.ace_numeric { color: rgb(0, 0, 205);}.ace-tm .ace_line .ace_variable { color: rgb(49, 132, 149);}.ace-tm .ace_line .ace_xml_pe { color: rgb(104, 104, 91);}.ace-tm .ace_marker-layer .ace_selection { background: rgb(181, 213, 255);}.ace-tm .ace_marker-layer .ace_step { background: rgb(252, 255, 0);}.ace-tm .ace_marker-layer .ace_stack { background: rgb(164, 229, 101);}.ace-tm .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgb(192, 192, 192);}.ace-tm .ace_marker-layer .ace_active_line { background: rgb(232, 242, 254);}.ace-tm .ace_string.ace_regex { color: rgb(255, 0, 0) }");var deps=["pilot/fixoldbrowsers","pilot/plugin_manager","pilot/settings","pilot/environment","demo_startup"];require(deps,function(){var a=require("pilot/plugin_manager").catalog;a.registerPlugins(["pilot/index"]).then(function(){})});var ace={edit:function(a){typeof a=="string"&&(a=document.getElementById(a));var b=require("pilot/environment").create();var c=require("pilot/plugin_manager").catalog;c.startupPlugins({env:b}).then(function(){var c=require("ace/document").Document;var d=require("ace/mode/javascript").Mode;var e=require("ace/undomanager").UndoManager;var f=require("ace/editor").Editor;var g=require("ace/virtual_renderer").VirtualRenderer;var h=require("ace/theme/textmate");var i=new c(a.innerHTML);a.innerHTML="",i.setMode(new d),i.setUndoManager(new e),b.editor=new f(new g(a,h)),b.editor.setDocument(i),b.editor.resize(),window.addEventListener("resize",function(){b.editor.resize()},false)})}} \ No newline at end of file