diff --git a/.gitmodules b/.gitmodules index 6060b38..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "vendor/CodeMirror"] - path = vendor/CodeMirror - url = https://github.com/marijnh/CodeMirror.git diff --git a/src/static/ace-0.1.6/ChangeLog.txt b/src/static/ace-0.1.6/ChangeLog.txt new file mode 100644 index 0000000..9eb6594 --- /dev/null +++ b/src/static/ace-0.1.6/ChangeLog.txt @@ -0,0 +1,50 @@ +2011.02.14, Version 0.1.6 + +* Floating Anchors + - An Anchor is a floating pointer in the document. + - Whenever text is inserted or deleted before the cursor, the position of the cursor is updated + - Usesd for the cursor and selection + - Basis for bookmarks, multiple cursors and snippets in the future +* Extensive support for Cocoa style keybindings on the Mac +* New commands: + - center selection in viewport + - remove to end/start of line + - split line + - transpose letters +* Refator markers + - Custom code can be used to render markers + - Markers can be in front or behind the text + - Markers are now stored in the session (was in the renderer) +* Lots of IE8 fixes including copy, cut and selections +* Unit tests can also be run in the browser +* Soft wrap can adapt to the width of the editor (Mike Ratcliffe, Joe Cheng) +* Add minimal node server server.js to run the Ace demo in Chrome +* The top level editor.html demo has been renamed to index.html +* Bug fixes + - Fixed gotoLine to consider wrapped lines when calculating where to scroll to (James Allen) + - Fixed isues when the editor was scrolled in the web page (Eric Allam) + - Highlighting of Python string literals + - Syntax rule for PHP comments + +2011.02.08, Version 0.1.5 + +* Add Coffeescript Mode (Satoshi Murakami) +* Fix word wrap bug (Julian Viereck) +* Fix packaged version of the Eclipse mode +* Loading of workers is more robust +* Fix "click selection" +* Allow tokizing empty lines (Daniel Krech) +* Make PageUp/Down behavior more consistent with native OS (Joe Cheng) + +2011.02.04, Version 0.1.4 + +* Add C/C++ mode contributed by Gastón Kleiman +* Fix exception in key input + +2011.02.04, Version 0.1.3 + +* Let the packaged version play nice with requireJS +* Add Ruby mode contributed by Shlomo Zalman Heigh +* Add Java mode contributed by Tom Tasche +* Fix annotation bug +* Changing a document added a new empty line at the end \ No newline at end of file diff --git a/src/static/ace-0.1.6/LICENSE b/src/static/ace-0.1.6/LICENSE new file mode 100644 index 0000000..853e4fd --- /dev/null +++ b/src/static/ace-0.1.6/LICENSE @@ -0,0 +1,476 @@ +Licensed under the tri-license MPL/LGPL/GPL. + + MOZILLA PUBLIC LICENSE + Version 1.1 + + --------------- + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the NPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``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 ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] + + + + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 \ No newline at end of file diff --git a/src/static/ace-0.1.6/Readme.md b/src/static/ace-0.1.6/Readme.md new file mode 100644 index 0000000..10b84fc --- /dev/null +++ b/src/static/ace-0.1.6/Readme.md @@ -0,0 +1,102 @@ +Ace (Ajax.org Cloud9 Editor) +============================ + +Ace is a standalone code editor written in JavaScript. Our goal is to create a web based code editor that matches and extends the features, usability and performance of existing native editors such as TextMate, Vim or Eclipse. It can be easily embedded in any web page and JavaScript application. Ace is developed as the primary editor for [Cloud9 IDE](http://www.cloud9ide.com/) and the successor of the Mozilla Skywriter (Bespin) Project. + +Features +-------- + +* Syntax highlighting +* Auto indentation and outdent +* An optional command line +* Work with huge documents (100,000 lines and more are no problem) +* Fully customizable key bindings including VI and Emacs modes +* Themes (TextMate themes can be imported) +* Search and replace with regular expressions +* Highlight matching parentheses +* Toggle between soft tabs and real tabs +* Displays hidden characters + +Take Ace for a spin! +-------------------- + +Check out the Ace live [demo](http://ajaxorg.github.com/ace/build/editor.html) or get a [Cloud9 IDE account](http://run.cloud9ide.com) to experience Ace while editing one of your own GitHub projects. + +History +------- + +Previously known as “Bespin” or lately “Skywriter” it’s now known as Ace (Ajax.org Cloud9 Editor)! Bespin and Ace started as two independent projects both aiming to build a no compromise code editor component for the web. Bespin started as part of Mozilla Labs and was based on the canvas tag, while Ace is the Editor component of the Cloud9 IDE and is using the DOM for rendering. After the release of Ace at JSConf.eu 2010 in Berlin the Skywriter team decided to merge Ace with a simplified version of Skywriter's plugin system and some of Skywriter's extensibility points. All these changes have been merged back to Ace now, which supersedes Skywriter. Both Ajax.org and Mozilla are actively developing and maintaining Ace. + +Getting the code +---------------- + +Ace is a community project. We actively encourage and support contributions. The Ace source code is hosted on GitHub. It is released under the Mozilla tri-license (MPL/GPL/LGPL). This is the same license used by Firefox. This license is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings! + + git clone git://github.com/ajaxorg/ace.git + git submodule update --init --recursive + +Embedding Ace +------------- + +Ace can be easily embedded into any existing web page. The Ace git repository ships with a pre-packaged version of Ace inside of the `build` directory. The same packaged files are also available as a separate [download](https://github.com/ajaxorg/ace/downloads). Simply copy the contents of the `src` subdirectory somewhere into your project and take a look at the included demos of how to use Ace. + +The easiest version is simply: + +
some text
+ + + +To change the theme simply include the Theme's JavaScript file + + + +and configure the editor to use the theme: + + editor.setTheme("ace/theme/twilight"); + +By default the editor only supports plain text mode. However all other language modes are available as separate modules. After including the mode's Javascript file + + + +the mode can be used like this: + + var JavaScriptMode = require("ace/mode/javascript").Mode; + editor.getSession().setMode(new JavaScriptMode()); + +Running Ace +----------- + +After the checkout Ace works out of the box. No build step is required. Simply open 'editor.html' in any browser except Google Chrome. Google Chrome doesn't allow XMLHTTPRequests from files loaded from disc (i.e. with a file:/// URL). To open the Ace in Chrome simply start the bundled mini HTTP server: + + ./static.py + +The editor can then be opened at http://localhost:9999/editor.html. + +Package Ace +----------- + +To package Ace we use the dryice build tool developed by the Mozilla Skywriter team. To install dryice and all its dependencies simply call: + + npm link . + +Afterwards Ace can by build by calling + + ./Makefile.dryice.js + +The packaged Ace will be put in the 'build' folder. + +Running the Unit Tests +---------------------- + +The Ace unit tests run on node.js. Before the first run a couple of node mudules have to be installed. The easiest way to do this is by using the node package manager (npm). In the Ace base directory simply call + + npm link . + +To run the tests call: + + node lib/ace/test/all.js + diff --git a/src/static/ace-0.1.6/editor.html b/src/static/ace-0.1.6/editor.html new file mode 100644 index 0000000..8f8a789 --- /dev/null +++ b/src/static/ace-0.1.6/editor.html @@ -0,0 +1,45 @@ + + + + + + Editor + + + + +
function foo(items) {
+    var i;
+    for (i = 0; i < items.length; i++) {
+        alert("Ace Rocks " + items[i]);
+    }
+}
+ + + + + + + + diff --git a/src/static/ace-0.1.6/src/ace-uncompressed.js b/src/static/ace-0.1.6/src/ace-uncompressed.js new file mode 100644 index 0000000..401e0dc --- /dev/null +++ b/src/static/ace-0.1.6/src/ace-uncompressed.js @@ -0,0 +1,12750 @@ +/* ***** 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 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 a module along with a payload + * @param module a name for the payload + * @param payload a function to call with (require, exports, module) params + */ + +(function() { + +var _define = function(module, payload) { + if (typeof module !== 'string') { + if (_define.original) + _define.original.apply(window, arguments); + else { + console.error('dropping module because define wasn\'t a string.'); + console.trace(); + } + return; + } + + if (!define.modules) + define.modules = {}; + + define.modules[module] = payload; +}; +if (window.define) + _define.original = window.define; + +window.define = _define; + + +/** + * Get at functionality define()ed using the function above + */ +var _require = function(module, callback) { + if (Object.prototype.toString.call(module) === "[object Array]") { + var params = []; + for (var i = 0, l = module.length; i < l; ++i) { + var dep = lookup(module[i]); + if (!dep && _require.original) + return _require.original.apply(window, arguments); + params.push(dep); + }; + if (callback) { + callback.apply(null, params); + } + } + + if (typeof module === 'string') { + var payload = lookup(module); + if (!payload && _require.original) + return _require.original.apply(window, arguments); + + if (callback) { + callback(); + } + + return payload; + }; +} + +if (window.require) + _require.original = window.require; + +window.require = _require; +require.packaged = true; + +/** + * Internal function to lookup moduleNames and resolve them by calling the + * definition function if needed. + */ +var lookup = function(moduleName) { + var module = define.modules[moduleName]; + if (module == null) { + console.error('Missing module: ' + moduleName); + return null; + } + + if (typeof module === 'function') { + var exports = {}; + module(require, exports, { id: moduleName, uri: '' }); + // cache the resulting module object for next time + define.modules[moduleName] = exports; + return exports; + } + + return module; +}; + +})();/* vim:ts=4:sts=4:sw=4: + * ***** 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 Mozilla Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Kevin Dangoor (kdangoor@mozilla.com) + * Irakli Gozalishvili (http://jeditoolkit.com) + * + * 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('pilot/fixoldbrowsers', function(require, exports, module) { + +// Should be the first thing, as we want to use that in this module. +if (!Function.prototype.bind) { + // from MDC + // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind + Function.prototype.bind = function (obj) { + var slice = [].slice; + var args = slice.call(arguments, 1); + var self = this; + var nop = function () {}; + + // optimize common case + if (arguments.length == 1) { + var bound = function() { + return self.apply(this instanceof nop ? this : obj, arguments); + }; + } + else { + var bound = function () { + return self.apply( + this instanceof nop ? this : ( obj || {} ), + args.concat( slice.call(arguments) ) + ); + }; + } + + nop.prototype = self.prototype; + bound.prototype = new nop(); + + // From Narwhal + bound.name = this.name; + bound.displayName = this.displayName; + bound.length = this.length; + bound.unbound = self; + + return bound; + }; +} + + +var F = function() {} +var call = Function.prototype.call; +// Shortcut for `Object.prototype.hasOwnProperty.call`. +var owns = call.bind(Object.prototype.hasOwnProperty); + +// Shortcuts for getter / setter utilities if supported by JS engine. +var getGetter, getSetter, setGetter, setSetter +getGetter = getSetter = setGetter = setSetter = F; + +if (Object.prototype.__lookupGetter__) + getGetter = call.bind(Object.prototype.__lookupGetter__); +if (Object.prototype.__lookupSetter__) + getSetter = call.bind(Object.prototype.__lookupSetter__); +if (Object.prototype.__defineGetter__) + setGetter = call.bind(Object.prototype.__defineGetter__); +if (Object.prototype.__defineSetter__) + setSetter = call.bind(Object.prototype.__defineSetter__); + +/** + * Array detector. + * Firefox 3.5 and Safari 4 have this already. Chrome 4 however ... + * Note to Dojo - your isArray is still broken: instanceof doesn't work with + * Arrays taken from a different frame/window. + */ +// ES5 15.4.3.2 +if (!Array.isArray) { + Array.isArray = function(data) { + return data && Object.prototype.toString.call(data) === "[object Array]"; + }; +} + +// from MDC +// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf +if (!Array.prototype.indexOf) +{ + Array.prototype.indexOf = function(searchElement /*, fromIndex */) + { + if (this === void 0 || this === null) + throw new TypeError(); + + var t = Object(this); + var len = t.length >>> 0; + if (len === 0) + return -1; + + var n = 0, zero = n; + if (arguments.length > 0) { + n = Number(arguments[1]); + if (n !== n) + n = 0; + else if (n !== 0 && n !== (1 / zero) && n !== -(1 / zero)) + n = (n > 0 || -1) * Math.floor(Math.abs(n)); + } + + if (n >= len) + return -1; + + var k = n >= 0 + ? n + : Math.max(len - Math.abs(n), 0); + + for (; k < len; k++) { + if (k in t && t[k] === searchElement) + return k; + } + return -1; + }; +} + +// from MDC +// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf +if (!Array.prototype.lastIndexOf) +{ + Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) + { + "use strict"; + + if (this === void 0 || this === null) + throw new TypeError(); + + var t = Object(this); + var len = t.length >>> 0; + if (len === 0) + return -1; + + var n = len, zero = false | 0; + if (arguments.length > 0) + { + n = Number(arguments[1]); + if (n !== n) + n = 0; + else if (n !== 0 && n !== (1 / zero) && n !== -(1 / zero)) + n = (n > 0 || -1) * Math.floor(Math.abs(n)); + } + + var k = n >= 0 + ? Math.min(n, len - 1) + : len - Math.abs(n); + + while (k >= 0) + { + if (k in t && t[k] === searchElement) + return k; + } + return -1; + }; +} + +// from MDC +// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/map +// ES5 15.4.4.19 +if (!Array.prototype.map) { + Array.prototype.map = function(fun /*, thisp */) { + if (this === void 0 || this === null) + throw new TypeError(); + + var t = Object(this); + var len = t.length >>> 0; + if (typeof fun !== "function") + throw new TypeError(); + + res = new Array(len); + var thisp = arguments[1]; + for (var i = 0; i < len; i++) { + if (i in t) + res[i] = fun.call(thisp, t[i], i, t); + } + + return res; + }; +} + +// from MDC +// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/forEach +// ES5 15.4.4.18 +if (!Array.prototype.forEach) { + Array.prototype.forEach = function(fun /*, thisp */) { + if (this === void 0 || this === null) + throw new TypeError(); + + var t = Object(this); + var len = t.length >>> 0; + if (typeof fun !== "function") + throw new TypeError(); + + var thisp = arguments[1]; + for (var i = 0; i < len; i++) { + if (i in t) + fun.call(thisp, t[i], i, t); + } + }; +} + +// ES5 15.4.4.20 +if (!Array.prototype.filter) { + Array.prototype.filter = function filter(callback, scope) { + var values = [], i, ii; + for (i = 0, ii = this.length; i < ii; i++) { + if (callback.call(scope, this[i])) values.push(this[i]); + } + return values; + }; +} + +// ES5 15.4.4.16 +if (!Array.prototype.every) { + Array.prototype.every = function every(callback, scope) { + var i, ii; + for (i = 0, ii = this.length; i < ii; i++) { + if (!callback.call(scope, this[i])) return false; + } + return true; + }; +} + +// ES5 15.4.4.17 +if (!Array.prototype.some) { + Array.prototype.some = function (callback, scope) { + var i, ii; + for (i = 0, ii = this.length; i < ii; i++) { + if (callback.call(scope, this[i])) return true; + } + return false; + }; +} + +// ES5 15.4.4.21 +// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce +if (!Array.prototype.reduce) { + Array.prototype.reduce = function(fun /*, initial*/) { + var len = this.length >>> 0; + if (typeof fun != "function") + throw new TypeError(); + + // no value to return if no initial value and an empty array + if (len == 0 && arguments.length == 1) + throw new TypeError(); + + var i = 0; + if (arguments.length >= 2) { + var rv = arguments[1]; + } else { + do { + if (i in this) { + rv = this[i++]; + break; + } + + // if array contains no values, no initial value to return + if (++i >= len) + throw new TypeError(); + } while (true); + } + + for (; i < len; i++) { + if (i in this) + rv = fun.call(null, rv, this[i], i, this); + } + + return rv; + }; +} + +// ES5 15.4.4.22 +// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight +if (!Array.prototype.reduceRight) { + Array.prototype.reduceRight = function(fun /*, initial*/) { + var len = this.length >>> 0; + if (typeof fun != "function") + throw new TypeError(); + + // no value to return if no initial value, empty array + if (len == 0 && arguments.length == 1) + throw new TypeError(); + + var i = len - 1; + if (arguments.length >= 2) { + var rv = arguments[1]; + } else { + do { + if (i in this) { + rv = this[i--]; + break; + } + + // if array contains no values, no initial value to return + if (--i < 0) + throw new TypeError(); + } while (true); + } + + for (; i >= 0; i--) { + if (i in this) + rv = fun.call(null, rv, this[i], i, this); + } + + return rv; + }; +} + + +/** + * Retrieves the list of keys on an object. + */ +if (!Object.keys) { + Object.keys = function keys(object) { + var name, names = []; + for (name in object) + if (owns(object, name)) names.push(name); + + return names; + }; +} + +// Can not be implemented so we default to the Object.keys +// ES5 15.2.3.4 +if (!Object.getOwnPropertyNames) { + Object.getOwnPropertyNames = Object.keys; +} + +// ES5 15.2.3.3 +var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a non-object" +if (!Object.getOwnPropertyDescriptor) { + Object.getOwnPropertyDescriptor = + function getOwnPropertyDescriptor(object, name) { + var descriptor, getter, setter; + + if (typeof object !== "object" && typeof object !== "function" + || object === null) throw new TypeError(ERR_NON_OBJECT); + + if (owns(object, name)) { + descriptor = { configurable: true, enumerable: true }; + getter = descriptor.get = getGetter(object, name); + setter = descriptor.set = getSetter(object, name); + // If nor getter nor setter is not defined we default to + // normal value. This can mean that either it's data + // property or js engine does not supports getters / setters. + if (!getter && !setter) { + descriptor.writeable = true; + descriptor.value = object[name] + } + } + return descriptor + } +} + +// Returning `__proto__` of an object or `object.constructor.prototype` for IE. +if (!Object.getPrototypeOf) { + Object.getPrototypeOf = function getPrototypeOf(object) { + return object.__proto__ || object.constructor.prototype; + } +} + +// ES5 15.2.3.5 +if (!Object.create) { + Object.create = function create(prototype, properties) { + var object; + + if (prototype === null) { + object = { __proto__: null }; + } else if (typeof prototype !== "object") { + throw new TypeError(prototype + " is not an object or null"); + } else { + F.prototype = prototype; + object = new F(); + } + + if (typeof properties !== "undefined") + Object.defineProperties(object, properties); + + return object; + }; +} + +// ES5 15.2.3.6 +if (!Object.defineProperty) { + Object.defineProperty = function defineProperty(object, name, descriptor) { + var proto, setter, getter; + + if ("object" !== typeof object && "function" !== typeof object) + throw new TypeError(object + "is not an object"); + if (descriptor && 'object' !== typeof descriptor) + throw new TypeError('Property descriptor map must be an object'); + if ('value' in descriptor) { // if it's a data property + if ('get' in descriptor || 'set' in descriptor) { + throw new TypeError('Invalid property. "value" present on ' + + 'property with getter or setter.'); + } + + // Swapping __proto__ with default one to avoid calling inherited + // getters / setters with this `name`. + if (proto = object.__proto__) object.__proto__ = Object.prototype; + // Delete property cause it may be a setter. + delete object[name]; + object[name] = descriptor.value; + // Return __proto__ back. + if (proto) object.__proto__ = proto; + } else { + if (getter = descriptor.get) setGetter(object, getter); + if (setter = descriptor.set) setSetter(object, setter); + } + return object; + }; +} + +// ES5 15.2.3.7 +if (!Object.defineProperties) { + Object.defineProperties = function defineProperties(object, properties) { + Object.getOwnPropertyNames(properties).forEach(function (name) { + Object.defineProperty(object, name, properties[name]); + }); + return object; + }; +} + +var passThrough = function(object) { return object }; +// ES5 15.2.3.8 +if (!Object.seal) Object.seal = passThrough; + +// ES5 15.2.3.9 +if (!Object.freeze) Object.freeze = passThrough; + +// ES5 15.2.3.10 +if (!Object.preventExtensions) Object.preventExtension = passThrough; + +var no = function() { return false }; +var yes = function() { return true }; + +// ES5 15.2.3.11 +if (!Object.isSealed) Object.isSealed = no; +// ES5 15.2.3.12 +if (!Object.isFrozen) Object.isFrozen = no; +// ES5 15.2.3.13 +if (!Object.isExtensible) Object.isExtensible = yes; + +if (!String.prototype.trim) { + String.prototype.trim = function() { + return this.trimLeft().trimRight(); + } +} + +if (!String.prototype.trimRight) { + String.prototype.trimRight = function() { + return this.replace(/[\t\v\f\s\u00a0\ufeff]+$/, ""); + } +} + +if (!String.prototype.trimLeft) { + String.prototype.trimLeft = function() { + return this.replace(/^[\t\v\f\s\u00a0\ufeff]+/, ""); + } +} + +exports.globalsLoaded = true; + +}); +/* ***** 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 Mozilla Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Kevin Dangoor (kdangoor@mozilla.com) + * + * 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('pilot/index', function(require, exports, module) { + +exports.startup = function(data, reason) { + require('pilot/fixoldbrowsers'); + + 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(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); +}; + + +}); +/* ***** 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 Mozilla Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Joe Walker (jwalker@mozilla.com) + * Kevin Dangoor (kdangoor@mozilla.com) + * + * 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('pilot/types/basic', function(require, exports, module) { + +var types = require("pilot/types"); +var Type = types.Type; +var Conversion = types.Conversion; +var Status = types.Status; + +/** + * These are the basic types that we accept. They are vaguely based on the + * Jetpack settings system (https://wiki.mozilla.org/Labs/Jetpack/JEP/24) + * although clearly more restricted. + * + *

In addition to these types, Jetpack also accepts range, member, password + * that we are thinking of adding. + * + *

This module probably should not be accessed directly, but instead used + * through types.js + */ + +/** + * 'text' is the default if no type is given. + */ +var text = new Type(); + +text.stringify = function(value) { + return value; +}; + +text.parse = function(value) { + if (typeof value != 'string') { + throw new Error('non-string passed to text.parse()'); + } + return new Conversion(value); +}; + +text.name = 'text'; + +/** + * We don't currently plan to distinguish between integers and floats + */ +var number = new Type(); + +number.stringify = function(value) { + if (!value) { + return null; + } + return '' + value; +}; + +number.parse = function(value) { + if (typeof value != 'string') { + throw new Error('non-string passed to number.parse()'); + } + + if (value.replace(/\s/g, '').length === 0) { + return new Conversion(null, Status.INCOMPLETE, ''); + } + + var reply = new Conversion(parseInt(value, 10)); + if (isNaN(reply.value)) { + reply.status = Status.INVALID; + reply.message = 'Can\'t convert "' + value + '" to a number.'; + } + + return reply; +}; + +number.decrement = function(value) { + return value - 1; +}; + +number.increment = function(value) { + return value + 1; +}; + +number.name = 'number'; + +/** + * One of a known set of options + */ +function SelectionType(typeSpec) { + if (!Array.isArray(typeSpec.data) && typeof typeSpec.data !== 'function') { + throw new Error('instances of SelectionType need typeSpec.data to be an array or function that returns an array:' + JSON.stringify(typeSpec)); + } + Object.keys(typeSpec).forEach(function(key) { + this[key] = typeSpec[key]; + }, this); +}; + +SelectionType.prototype = new Type(); + +SelectionType.prototype.stringify = function(value) { + return value; +}; + +SelectionType.prototype.parse = function(str) { + if (typeof str != 'string') { + throw new Error('non-string passed to parse()'); + } + if (!this.data) { + throw new Error('Missing data on selection type extension.'); + } + var data = (typeof(this.data) === 'function') ? this.data() : this.data; + + // The matchedValue could be the boolean value false + var hasMatched = false; + var matchedValue; + var completions = []; + data.forEach(function(option) { + if (str == option) { + matchedValue = this.fromString(option); + hasMatched = true; + } + else if (option.indexOf(str) === 0) { + completions.push(this.fromString(option)); + } + }, this); + + if (hasMatched) { + return new Conversion(matchedValue); + } + else { + // This is something of a hack it basically allows us to tell the + // setting type to forget its last setting hack. + if (this.noMatch) { + this.noMatch(); + } + + if (completions.length > 0) { + var msg = 'Possibilities' + + (str.length === 0 ? '' : ' for \'' + str + '\''); + return new Conversion(null, Status.INCOMPLETE, msg, completions); + } + else { + var msg = 'Can\'t use \'' + str + '\'.'; + return new Conversion(null, Status.INVALID, msg, completions); + } + } +}; + +SelectionType.prototype.fromString = function(str) { + return str; +}; + +SelectionType.prototype.decrement = function(value) { + var data = (typeof this.data === 'function') ? this.data() : this.data; + var index; + if (value == null) { + index = data.length - 1; + } + else { + var name = this.stringify(value); + var index = data.indexOf(name); + index = (index === 0 ? data.length - 1 : index - 1); + } + return this.fromString(data[index]); +}; + +SelectionType.prototype.increment = function(value) { + var data = (typeof this.data === 'function') ? this.data() : this.data; + var index; + if (value == null) { + index = 0; + } + else { + var name = this.stringify(value); + var index = data.indexOf(name); + index = (index === data.length - 1 ? 0 : index + 1); + } + return this.fromString(data[index]); +}; + +SelectionType.prototype.name = 'selection'; + +/** + * SelectionType is a base class for other types + */ +exports.SelectionType = SelectionType; + +/** + * true/false values + */ +var bool = new SelectionType({ + name: 'bool', + data: [ 'true', 'false' ], + stringify: function(value) { + return '' + value; + }, + fromString: function(str) { + return str === 'true' ? true : false; + } +}); + + +/** + * A we don't know right now, but hope to soon. + */ +function DeferredType(typeSpec) { + if (typeof typeSpec.defer !== 'function') { + throw new Error('Instances of DeferredType need typeSpec.defer to be a function that returns a type'); + } + Object.keys(typeSpec).forEach(function(key) { + this[key] = typeSpec[key]; + }, this); +}; + +DeferredType.prototype = new Type(); + +DeferredType.prototype.stringify = function(value) { + return this.defer().stringify(value); +}; + +DeferredType.prototype.parse = function(value) { + return this.defer().parse(value); +}; + +DeferredType.prototype.decrement = function(value) { + var deferred = this.defer(); + return (deferred.decrement ? deferred.decrement(value) : undefined); +}; + +DeferredType.prototype.increment = function(value) { + var deferred = this.defer(); + return (deferred.increment ? deferred.increment(value) : undefined); +}; + +DeferredType.prototype.name = 'deferred'; + +/** + * DeferredType is a base class for other types + */ +exports.DeferredType = DeferredType; + + +/** + * A set of objects of the same type + */ +function ArrayType(typeSpec) { + if (typeSpec instanceof Type) { + this.subtype = typeSpec; + } + else if (typeof typeSpec === 'string') { + this.subtype = types.getType(typeSpec); + if (this.subtype == null) { + throw new Error('Unknown array subtype: ' + typeSpec); + } + } + else { + throw new Error('Can\' handle array subtype'); + } +}; + +ArrayType.prototype = new Type(); + +ArrayType.prototype.stringify = function(values) { + // TODO: Check for strings with spaces and add quotes + return values.join(' '); +}; + +ArrayType.prototype.parse = function(value) { + return this.defer().parse(value); +}; + +ArrayType.prototype.name = 'array'; + +/** + * Registration and de-registration. + */ +exports.startup = function() { + types.registerType(text); + types.registerType(number); + types.registerType(bool); + types.registerType(SelectionType); + types.registerType(DeferredType); + types.registerType(ArrayType); +}; + +exports.shutdown = function() { + types.unregisterType(text); + types.unregisterType(number); + types.unregisterType(bool); + types.unregisterType(SelectionType); + types.unregisterType(DeferredType); + types.unregisterType(ArrayType); +}; + + +}); +/* ***** 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 Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Joe Walker (jwalker@mozilla.com) + * + * 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('pilot/types', function(require, exports, module) { + +/** + * Some types can detect validity, that is to say they can distinguish between + * valid and invalid values. + * TODO: Change these constants to be numbers for more performance? + */ +var Status = { + /** + * The conversion process worked without any problem, and the value is + * valid. There are a number of failure states, so the best way to check + * for failure is (x !== Status.VALID) + */ + VALID: { + toString: function() { return 'VALID'; }, + valueOf: function() { return 0; } + }, + + /** + * A conversion process failed, however it was noted that the string + * provided to 'parse()' could be VALID by the addition of more characters, + * so the typing may not be actually incorrect yet, just unfinished. + * @see Status.INVALID + */ + INCOMPLETE: { + toString: function() { return 'INCOMPLETE'; }, + valueOf: function() { return 1; } + }, + + /** + * The conversion process did not work, the value should be null and a + * reason for failure should have been provided. In addition some completion + * values may be available. + * @see Status.INCOMPLETE + */ + INVALID: { + toString: function() { return 'INVALID'; }, + valueOf: function() { return 2; } + }, + + /** + * A combined status is the worser of the provided statuses + */ + combine: function(statuses) { + var combined = Status.VALID; + for (var i = 0; i < arguments; i++) { + if (arguments[i] > combined) { + combined = arguments[i]; + } + } + return combined; + } +}; +exports.Status = Status; + +/** + * The type.parse() method returns a Conversion to inform the user about not + * only the result of a Conversion but also about what went wrong. + * We could use an exception, and throw if the conversion failed, but that + * seems to violate the idea that exceptions should be exceptional. Typos are + * not. Also in order to store both a status and a message we'd still need + * some sort of exception type... + */ +function Conversion(value, status, message, predictions) { + /** + * The result of the conversion process. Will be null if status != VALID + */ + this.value = value; + + /** + * The status of the conversion. + * @see Status + */ + this.status = status || Status.VALID; + + /** + * A message to go with the conversion. This could be present for any status + * including VALID in the case where we want to note a warning for example. + * I18N: On the one hand this nasty and un-internationalized, however with + * a command line it is hard to know where to start. + */ + this.message = message; + + /** + * A array of strings which are the systems best guess at better inputs than + * the one presented. + * We generally expect there to be about 7 predictions (to match human list + * comprehension ability) however it is valid to provide up to about 20, + * or less. It is the job of the predictor to decide a smart cut-off. + * For example if there are 4 very good matches and 4 very poor ones, + * probably only the 4 very good matches should be presented. + */ + this.predictions = predictions || []; +} +exports.Conversion = Conversion; + +/** + * Most of our types are 'static' e.g. there is only one type of 'text', however + * some types like 'selection' and 'deferred' are customizable. The basic + * Type type isn't useful, but does provide documentation about what types do. + */ +function Type() { +}; +Type.prototype = { + /** + * Convert the given value to a string representation. + * Where possible, there should be round-tripping between values and their + * string representations. + */ + stringify: function(value) { throw new Error("not implemented"); }, + + /** + * Convert the given str to an instance of this type. + * Where possible, there should be round-tripping between values and their + * string representations. + * @return Conversion + */ + parse: function(str) { throw new Error("not implemented"); }, + + /** + * The plug-in system, and other things need to know what this type is + * called. The name alone is not enough to fully specify a type. Types like + * 'selection' and 'deferred' need extra data, however this function returns + * only the name, not the extra data. + *

In old bespin, equality was based on the name. This may turn out to be + * important in Ace too. + */ + name: undefined, + + /** + * If there is some concept of a higher value, return it, + * otherwise return undefined. + */ + increment: function(value) { + return undefined; + }, + + /** + * If there is some concept of a lower value, return it, + * otherwise return undefined. + */ + decrement: function(value) { + return undefined; + }, + + /** + * There is interesting information (like predictions) in a conversion of + * nothing, the output of this can sometimes be customized. + * @return Conversion + */ + getDefault: function() { + return this.parse(''); + } +}; +exports.Type = Type; + +/** + * Private registry of types + * Invariant: types[name] = type.name + */ +var types = {}; + +/** + * Add a new type to the list available to the system. + * You can pass 2 things to this function - either an instance of Type, in + * which case we return this instance when #getType() is called with a 'name' + * that matches type.name. + * Also you can pass in a constructor (i.e. function) in which case when + * #getType() is called with a 'name' that matches Type.prototype.name we will + * pass the typeSpec into this constructor. See #reconstituteType(). + */ +exports.registerType = function(type) { + if (typeof type === 'object') { + if (type instanceof Type) { + if (!type.name) { + throw new Error('All registered types must have a name'); + } + types[type.name] = type; + } + else { + throw new Error('Can\'t registerType using: ' + type); + } + } + else if (typeof type === 'function') { + if (!type.prototype.name) { + throw new Error('All registered types must have a name'); + } + types[type.prototype.name] = type; + } + else { + throw new Error('Unknown type: ' + type); + } +}; + +exports.registerTypes = function registerTypes(types) { + Object.keys(types).forEach(function (name) { + var type = types[name]; + type.name = name; + exports.registerType(type); + }); +}; + +/** + * Remove a type from the list available to the system + */ +exports.deregisterType = function(type) { + delete types[type.name]; +}; + +/** + * See description of #exports.registerType() + */ +function reconstituteType(name, typeSpec) { + if (name.substr(-2) === '[]') { // i.e. endsWith('[]') + var subtypeName = name.slice(0, -2); + return new types['array'](subtypeName); + } + + var type = types[name]; + if (typeof type === 'function') { + type = new type(typeSpec); + } + return type; +} + +/** + * Find a type, previously registered using #registerType() + */ +exports.getType = function(typeSpec) { + if (typeof typeSpec === 'string') { + return reconstituteType(typeSpec); + } + + if (typeof typeSpec === 'object') { + if (!typeSpec.name) { + throw new Error('Missing \'name\' member to typeSpec'); + } + return reconstituteType(typeSpec.name, typeSpec); + } + + throw new Error('Can\'t extract type from ' + typeSpec); +}; + + +}); +/* ***** 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 Mozilla Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Joe Walker (jwalker@mozilla.com) + * Kevin Dangoor (kdangoor@mozilla.com) + * + * 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('pilot/types/command', function(require, exports, module) { + +var canon = require("pilot/canon"); +var SelectionType = require("pilot/types/basic").SelectionType; +var types = require("pilot/types"); + + +/** + * Select from the available commands + */ +var command = new SelectionType({ + name: 'command', + data: function() { + return canon.getCommandNames(); + }, + stringify: function(command) { + return command.name; + }, + fromString: function(str) { + return canon.getCommand(str); + } +}); + + +/** + * Registration and de-registration. + */ +exports.startup = function() { + types.registerType(command); +}; + +exports.shutdown = function() { + types.unregisterType(command); +}; + + +}); +/* ***** 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 Mozilla Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Joe Walker (jwalker@mozilla.com) + * + * 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('pilot/canon', function(require, exports, module) { + +var console = require('pilot/console'); +var Trace = require('pilot/stacktrace').Trace; +var oop = require('pilot/oop'); +var EventEmitter = require('pilot/event_emitter').EventEmitter; +var catalog = require('pilot/catalog'); +var Status = require('pilot/types').Status; +var types = require('pilot/types'); +var lang = require('pilot/lang'); + +/* +// TODO: this doesn't belong here - or maybe anywhere? +var dimensionsChangedExtensionSpec = { + name: 'dimensionsChanged', + description: 'A dimensionsChanged is a way to be notified of ' + + 'changes to the dimension of Skywriter' +}; +exports.startup = function(data, reason) { + catalog.addExtensionSpec(commandExtensionSpec); +}; +exports.shutdown = function(data, reason) { + catalog.removeExtensionSpec(commandExtensionSpec); +}; +*/ + +var commandExtensionSpec = { + name: 'command', + description: 'A command is a bit of functionality with optional ' + + 'typed arguments which can do something small like moving ' + + 'the cursor around the screen, or large like cloning a ' + + 'project from VCS.', + indexOn: 'name' +}; + +exports.startup = function(data, reason) { + // TODO: this is probably all kinds of evil, but we need something working + catalog.addExtensionSpec(commandExtensionSpec); +}; + +exports.shutdown = function(data, reason) { + catalog.removeExtensionSpec(commandExtensionSpec); +}; + +/** + * Manage a list of commands in the current canon + */ + +/** + * A Command is a discrete action optionally with a set of ways to customize + * how it happens. This is here for documentation purposes. + * TODO: Document better + */ +var thingCommand = { + name: 'thing', + description: 'thing is an example command', + params: [{ + name: 'param1', + description: 'an example parameter', + type: 'text', + defaultValue: null + }], + exec: function(env, args, request) { + thing(); + } +}; + +/** + * A lookup hash of our registered commands + */ +var commands = {}; + +/** + * A sorted list of command names, we regularly want them in order, so pre-sort + */ +var commandNames = []; + +/** + * This registration method isn't like other Ace registration methods because + * it doesn't return a decorated command because there is no functional + * decoration to be done. + * TODO: Are we sure that in the future there will be no such decoration? + */ +function addCommand(command) { + if (!command.name) { + throw new Error('All registered commands must have a name'); + } + if (command.params == null) { + command.params = []; + } + if (!Array.isArray(command.params)) { + throw new Error('command.params must be an array in ' + command.name); + } + // Replace the type + command.params.forEach(function(param) { + if (!param.name) { + throw new Error('In ' + command.name + ': all params must have a name'); + } + upgradeType(command.name, param); + }, this); + commands[command.name] = command; + + commandNames.push(command.name); + commandNames.sort(); +}; + +function upgradeType(name, param) { + var lookup = param.type; + param.type = types.getType(lookup); + if (param.type == null) { + throw new Error('In ' + name + '/' + param.name + + ': can\'t find type for: ' + JSON.stringify(lookup)); + } +} + +function removeCommand(command) { + var name = (typeof command === 'string' ? command : command.name); + delete commands[name]; + lang.arrayRemove(commandNames, name); +}; + +function getCommand(name) { + return commands[name]; +}; + +function getCommandNames() { + return commandNames; +}; + +/** + * Entry point for keyboard accelerators or anything else that knows + * everything it needs to about the command params + * @param command Either a command, or the name of one + */ +function exec(command, env, args, typed) { + if (typeof command === 'string') { + command = commands[command]; + } + if (!command) { + // TODO: Should we complain more than returning false? + return false; + } + + var request = new Request({ + command: command, + args: args, + typed: typed + }); + command.exec(env, args || {}, request); + return true; +}; + +exports.removeCommand = removeCommand; +exports.addCommand = addCommand; +exports.getCommand = getCommand; +exports.getCommandNames = getCommandNames; +exports.exec = exec; +exports.upgradeType = upgradeType; + + +/** + * We publish a 'output' event whenever new command begins output + * TODO: make this more obvious + */ +oop.implement(exports, EventEmitter); + + +/** + * Current requirements are around displaying the command line, and provision + * of a 'history' command and cursor up|down navigation of history. + *

Future requirements could include: + *

    + *
  • Multiple command lines + *
  • The ability to recall key presses (i.e. requests with no output) which + * will likely be needed for macro recording or similar + *
  • The ability to store the command history either on the server or in the + * browser local storage. + *
+ *

The execute() command doesn't really live here, except as part of that + * last future requirement, and because it doesn't really have anywhere else to + * live. + */ + +/** + * The array of requests that wish to announce their presence + */ +var requests = []; + +/** + * How many requests do we store? + */ +var maxRequestLength = 100; + +/** + * To create an invocation, you need to do something like this (all the ctor + * args are optional): + *

+ * var request = new Request({
+ *     command: command,
+ *     args: args,
+ *     typed: typed
+ * });
+ * 
+ * @constructor + */ +function Request(options) { + options = options || {}; + + // Will be used in the keyboard case and the cli case + this.command = options.command; + + // Will be used only in the cli case + this.args = options.args; + this.typed = options.typed; + + // Have we been initialized? + this._begunOutput = false; + + this.start = new Date(); + this.end = null; + this.completed = false; + this.error = false; +}; + +oop.implement(Request.prototype, EventEmitter); + +/** + * Lazy init to register with the history should only be done on output. + * init() is expensive, and won't be used in the majority of cases + */ +Request.prototype._beginOutput = function() { + this._begunOutput = true; + this.outputs = []; + + requests.push(this); + // This could probably be optimized with some maths, but 99.99% of the + // time we will only be off by one, and I'm feeling lazy. + while (requests.length > maxRequestLength) { + requests.shiftObject(); + } + + exports._dispatchEvent('output', { requests: requests, request: this }); +}; + +/** + * Sugar for: + *
request.error = true; request.done(output);
+ */ +Request.prototype.doneWithError = function(content) { + this.error = true; + this.done(content); +}; + +/** + * Declares that this function will not be automatically done when + * the command exits + */ +Request.prototype.async = function() { + if (!this._begunOutput) { + this._beginOutput(); + } +}; + +/** + * Complete the currently executing command with successful output. + * @param output Either DOM node, an SproutCore element or something that + * can be used in the content of a DIV to create a DOM node. + */ +Request.prototype.output = function(content) { + if (!this._begunOutput) { + this._beginOutput(); + } + + if (typeof content !== 'string' && !(content instanceof Node)) { + content = content.toString(); + } + + this.outputs.push(content); + this._dispatchEvent('output', {}); + + return this; +}; + +/** + * All commands that do output must call this to indicate that the command + * has finished execution. + */ +Request.prototype.done = function(content) { + this.completed = true; + this.end = new Date(); + this.duration = this.end.getTime() - this.start.getTime(); + + if (content) { + this.output(content); + } + + this._dispatchEvent('output', {}); +}; +exports.Request = Request; + + +}); +/* ***** 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 Mozilla Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Joe Walker (jwalker@mozilla.com) + * Patrick Walton (pwalton@mozilla.com) + * Julian Viereck (jviereck@mozilla.com) + * + * 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('pilot/console', function(require, exports, module) { + +/** + * This object represents a "safe console" object that forwards debugging + * messages appropriately without creating a dependency on Firebug in Firefox. + */ + +var noop = function() {}; + +// These are the functions that are available in Chrome 4/5, Safari 4 +// and Firefox 3.6. Don't add to this list without checking browser support +var NAMES = [ + "assert", "count", "debug", "dir", "dirxml", "error", "group", "groupEnd", + "info", "log", "profile", "profileEnd", "time", "timeEnd", "trace", "warn" +]; + +if (typeof(window) === 'undefined') { + // We're in a web worker. Forward to the main thread so the messages + // will show up. + NAMES.forEach(function(name) { + exports[name] = function() { + var args = Array.prototype.slice.call(arguments); + var msg = { op: 'log', method: name, args: args }; + postMessage(JSON.stringify(msg)); + }; + }); +} else { + // For each of the console functions, copy them if they exist, stub if not + NAMES.forEach(function(name) { + if (window.console && window.console[name]) { + exports[name] = Function.prototype.bind.call(window.console[name], window.console); + } else { + exports[name] = noop; + } + }); +} + +}); +define('pilot/stacktrace', function(require, exports, module) { + +var ua = require("pilot/useragent"); +var console = require('pilot/console'); + +// Changed to suit the specific needs of running within Skywriter + +// Domain Public by Eric Wendelin http://eriwen.com/ (2008) +// Luke Smith http://lucassmith.name/ (2008) +// Loic Dachary (2008) +// Johan Euphrosine (2008) +// Øyvind Sean Kinsey http://kinsey.no/blog +// +// Information and discussions +// http://jspoker.pokersource.info/skin/test-printstacktrace.html +// http://eriwen.com/javascript/js-stack-trace/ +// http://eriwen.com/javascript/stacktrace-update/ +// http://pastie.org/253058 +// http://browsershots.org/http://jspoker.pokersource.info/skin/test-printstacktrace.html +// + +// +// guessFunctionNameFromLines comes from firebug +// +// Software License Agreement (BSD License) +// +// Copyright (c) 2007, Parakey Inc. +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above +// copyright notice, this list of conditions and the +// following disclaimer. +// +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the +// following disclaimer in the documentation and/or other +// materials provided with the distribution. +// +// * Neither the name of Parakey Inc. nor the names of its +// contributors may be used to endorse or promote products +// derived from this software without specific prior +// written permission of Parakey Inc. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + +/** + * Different browsers create stack traces in different ways. + * Feature Browser detection baby ;). + */ +var mode = (function() { + + // We use SC's browser detection here to avoid the "break on error" + // functionality provided by Firebug. Firebug tries to do the right + // thing here and break, but it happens every time you load the page. + // bug 554105 + if (ua.isGecko) { + return 'firefox'; + } else if (ua.isOpera) { + return 'opera'; + } else { + return 'other'; + } + + // SC doesn't do any detection of Chrome at this time. + + // this is the original feature detection code that is used as a + // fallback. + try { + (0)(); + } catch (e) { + if (e.arguments) { + return 'chrome'; + } + if (e.stack) { + return 'firefox'; + } + if (window.opera && !('stacktrace' in e)) { //Opera 9- + return 'opera'; + } + } + return 'other'; +})(); + +/** + * + */ +function stringifyArguments(args) { + for (var i = 0; i < args.length; ++i) { + var argument = args[i]; + if (typeof argument == 'object') { + args[i] = '#object'; + } else if (typeof argument == 'function') { + args[i] = '#function'; + } else if (typeof argument == 'string') { + args[i] = '"' + argument + '"'; + } + } + return args.join(','); +} + +/** + * Extract a stack trace from the format emitted by each browser. + */ +var decoders = { + chrome: function(e) { + var stack = e.stack; + if (!stack) { + console.log(e); + return []; + } + return stack.replace(/^.*?\n/, ''). + replace(/^.*?\n/, ''). + replace(/^.*?\n/, ''). + replace(/^[^\(]+?[\n$]/gm, ''). + replace(/^\s+at\s+/gm, ''). + replace(/^Object.\s*\(/gm, '{anonymous}()@'). + split('\n'); + }, + + firefox: function(e) { + var stack = e.stack; + if (!stack) { + console.log(e); + return []; + } + // stack = stack.replace(/^.*?\n/, ''); + stack = stack.replace(/(?:\n@:0)?\s+$/m, ''); + stack = stack.replace(/^\(/gm, '{anonymous}('); + return stack.split('\n'); + }, + + // Opera 7.x and 8.x only! + opera: function(e) { + var lines = e.message.split('\n'), ANON = '{anonymous}', + lineRE = /Line\s+(\d+).*?script\s+(http\S+)(?:.*?in\s+function\s+(\S+))?/i, i, j, len; + + for (i = 4, j = 0, len = lines.length; i < len; i += 2) { + if (lineRE.test(lines[i])) { + lines[j++] = (RegExp.$3 ? RegExp.$3 + '()@' + RegExp.$2 + RegExp.$1 : ANON + '()@' + RegExp.$2 + ':' + RegExp.$1) + + ' -- ' + + lines[i + 1].replace(/^\s+/, ''); + } + } + + lines.splice(j, lines.length - j); + return lines; + }, + + // Safari, Opera 9+, IE, and others + other: function(curr) { + var ANON = '{anonymous}', fnRE = /function\s*([\w\-$]+)?\s*\(/i, stack = [], j = 0, fn, args; + + var maxStackSize = 10; + while (curr && stack.length < maxStackSize) { + fn = fnRE.test(curr.toString()) ? RegExp.$1 || ANON : ANON; + args = Array.prototype.slice.call(curr['arguments']); + stack[j++] = fn + '(' + stringifyArguments(args) + ')'; + + //Opera bug: if curr.caller does not exist, Opera returns curr (WTF) + if (curr === curr.caller && window.opera) { + //TODO: check for same arguments if possible + break; + } + curr = curr.caller; + } + return stack; + } +}; + +/** + * + */ +function NameGuesser() { +} + +NameGuesser.prototype = { + + sourceCache: {}, + + ajax: function(url) { + var req = this.createXMLHTTPObject(); + if (!req) { + return; + } + req.open('GET', url, false); + req.setRequestHeader('User-Agent', 'XMLHTTP/1.0'); + req.send(''); + return req.responseText; + }, + + createXMLHTTPObject: function() { + // Try XHR methods in order and store XHR factory + var xmlhttp, XMLHttpFactories = [ + function() { + return new XMLHttpRequest(); + }, function() { + return new ActiveXObject('Msxml2.XMLHTTP'); + }, function() { + return new ActiveXObject('Msxml3.XMLHTTP'); + }, function() { + return new ActiveXObject('Microsoft.XMLHTTP'); + } + ]; + for (var i = 0; i < XMLHttpFactories.length; i++) { + try { + xmlhttp = XMLHttpFactories[i](); + // Use memoization to cache the factory + this.createXMLHTTPObject = XMLHttpFactories[i]; + return xmlhttp; + } catch (e) {} + } + }, + + getSource: function(url) { + if (!(url in this.sourceCache)) { + this.sourceCache[url] = this.ajax(url).split('\n'); + } + return this.sourceCache[url]; + }, + + guessFunctions: function(stack) { + for (var i = 0; i < stack.length; ++i) { + var reStack = /{anonymous}\(.*\)@(\w+:\/\/([-\w\.]+)+(:\d+)?[^:]+):(\d+):?(\d+)?/; + var frame = stack[i], m = reStack.exec(frame); + if (m) { + var file = m[1], lineno = m[4]; //m[7] is character position in Chrome + if (file && lineno) { + var functionName = this.guessFunctionName(file, lineno); + stack[i] = frame.replace('{anonymous}', functionName); + } + } + } + return stack; + }, + + guessFunctionName: function(url, lineNo) { + try { + return this.guessFunctionNameFromLines(lineNo, this.getSource(url)); + } catch (e) { + return 'getSource failed with url: ' + url + ', exception: ' + e.toString(); + } + }, + + guessFunctionNameFromLines: function(lineNo, source) { + var reFunctionArgNames = /function ([^(]*)\(([^)]*)\)/; + var reGuessFunction = /['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*(function|eval|new Function)/; + // Walk backwards from the first line in the function until we find the line which + // matches the pattern above, which is the function definition + var line = '', maxLines = 10; + for (var i = 0; i < maxLines; ++i) { + line = source[lineNo - i] + line; + if (line !== undefined) { + var m = reGuessFunction.exec(line); + if (m) { + return m[1]; + } + else { + m = reFunctionArgNames.exec(line); + } + if (m && m[1]) { + return m[1]; + } + } + } + return '(?)'; + } +}; + +var guesser = new NameGuesser(); + +var frameIgnorePatterns = [ + /http:\/\/localhost:4020\/sproutcore.js:/ +]; + +exports.ignoreFramesMatching = function(regex) { + frameIgnorePatterns.push(regex); +}; + +/** + * Create a stack trace from an exception + * @param ex {Error} The error to create a stacktrace from (optional) + * @param guess {Boolean} If we should try to resolve the names of anonymous functions + */ +exports.Trace = function Trace(ex, guess) { + this._ex = ex; + this._stack = decoders[mode](ex); + + if (guess) { + this._stack = guesser.guessFunctions(this._stack); + } +}; + +/** + * Log to the console a number of lines (default all of them) + * @param lines {number} Maximum number of lines to wrote to console + */ +exports.Trace.prototype.log = function(lines) { + if (lines <= 0) { + // You aren't going to have more lines in your stack trace than this + // and it still fits in a 32bit integer + lines = 999999999; + } + + var printed = 0; + for (var i = 0; i < this._stack.length && printed < lines; i++) { + var frame = this._stack[i]; + var display = true; + frameIgnorePatterns.forEach(function(regex) { + if (regex.test(frame)) { + display = false; + } + }); + if (display) { + console.debug(frame); + printed++; + } + } +}; + +}); +/* ***** 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 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('pilot/useragent', function(require, exports, module) { + +var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase(); +var ua = navigator.userAgent; +var av = navigator.appVersion; + +/** Is the user using a browser that identifies itself as Windows */ +exports.isWin = (os == "win"); + +/** Is the user using a browser that identifies itself as Mac OS */ +exports.isMac = (os == "mac"); + +/** Is the user using a browser that identifies itself as Linux */ +exports.isLinux = (os == "linux"); + +exports.isIE = ! + "\v1"; + +/** Is this Firefox or related? */ +exports.isGecko = exports.isMozilla = window.controllers && window.navigator.product === "Gecko"; + +/** oldGecko == rev < 2.0 **/ +exports.isOldGecko = exports.isGecko && /rv\:1/.test(navigator.userAgent); + +/** Is this Opera */ +exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]"; + +/** Is the user using a browser that identifies itself as WebKit */ +exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined; + +exports.isAIR = ua.indexOf("AdobeAIR") >= 0; + +exports.isIPad = ua.indexOf("iPad") >= 0; + +/** + * I hate doing this, but we need some way to determine if the user is on a Mac + * The reason is that users have different expectations of their key combinations. + * + * Take copy as an example, Mac people expect to use CMD or APPLE + C + * Windows folks expect to use CTRL + C + */ +exports.OS = { + LINUX: 'LINUX', + MAC: 'MAC', + WINDOWS: 'WINDOWS' +}; + +/** + * Return an exports.OS constant + */ +exports.getOS = function() { + if (exports.isMac) { + return exports.OS['MAC']; + } else if (exports.isLinux) { + return exports.OS['LINUX']; + } else { + return exports.OS['WINDOWS']; + } +}; + +}); +/* ***** 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 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('pilot/oop', function(require, exports, module) { + +exports.inherits = (function() { + var tempCtor = function() {}; + return function(ctor, superCtor) { + tempCtor.prototype = superCtor.prototype; + ctor.super_ = superCtor.prototype; + ctor.prototype = new tempCtor(); + ctor.prototype.constructor = ctor; + } +}()); + +exports.mixin = function(obj, mixin) { + for (var key in mixin) { + obj[key] = mixin[key]; + } +}; + +exports.implement = function(proto, mixin) { + exports.mixin(proto, mixin); +}; + +}); +/* vim:ts=4:sts=4:sw=4: + * ***** 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 B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Fabian Jakobs + * Irakli Gozalishvili (http://jeditoolkit.com) + * + * 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('pilot/event_emitter', function(require, exports, module) { + +var EventEmitter = {}; + +EventEmitter._emit = +EventEmitter._dispatchEvent = function(eventName, e) { + this._eventRegistry = this._eventRegistry || {}; + + var listeners = this._eventRegistry[eventName]; + if (!listeners || !listeners.length) return; + + var e = e || {}; + e.type = eventName; + + 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('pilot/lang', function(require, exports, module) { + +exports.stringReverse = function(string) { + return string.split("").reverse().join(""); +}; + +exports.stringRepeat = function (string, count) { + return new Array(count + 1).join(string); +}; + +exports.copyObject = function(obj) { + var copy = {}; + for (var key in obj) { + copy[key] = obj[key]; + } + return copy; +}; + +exports.arrayToMap = function(arr) { + var map = {}; + for (var i=0; i (http://jeditoolkit.com) + * + * 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('pilot/settings', function(require, exports, module) { + +/** + * This plug-in manages settings. + */ + +var console = require('pilot/console'); +var oop = require('pilot/oop'); +var types = require('pilot/types'); +var EventEmitter = require('pilot/event_emitter').EventEmitter; +var catalog = require('pilot/catalog'); + +var settingExtensionSpec = { + name: 'setting', + description: 'A setting is something that the application offers as a ' + + 'way to customize how it works', + register: 'env.settings.addSetting', + indexOn: 'name' +}; + +exports.startup = function(data, reason) { + catalog.addExtensionSpec(settingExtensionSpec); +}; + +exports.shutdown = function(data, reason) { + catalog.removeExtensionSpec(settingExtensionSpec); +}; + + +/** + * Create a new setting. + * @param settingSpec An object literal that looks like this: + * { + * name: 'thing', + * description: 'Thing is an example setting', + * type: 'string', + * defaultValue: 'something' + * } + */ +function Setting(settingSpec, settings) { + this._settings = settings; + + Object.keys(settingSpec).forEach(function(key) { + this[key] = settingSpec[key]; + }, this); + + this.type = types.getType(this.type); + if (this.type == null) { + throw new Error('In ' + this.name + + ': can\'t find type for: ' + JSON.stringify(settingSpec.type)); + } + + if (!this.name) { + throw new Error('Setting.name == undefined. Ignoring.', this); + } + + if (!this.defaultValue === undefined) { + throw new Error('Setting.defaultValue == undefined', this); + } + + if (this.onChange) { + this.on('change', this.onChange.bind(this)) + } + + this.set(this.defaultValue); +} +Setting.prototype = { + get: function() { + return this.value; + }, + + set: function(value) { + if (this.value === value) { + return; + } + + this.value = value; + if (this._settings.persister) { + this._settings.persister.persistValue(this._settings, this.name, value); + } + + this._dispatchEvent('change', { setting: this, value: value }); + }, + + /** + * Reset the value of the key setting to it's default + */ + resetValue: function() { + this.set(this.defaultValue); + } +}; +oop.implement(Setting.prototype, EventEmitter); + + +/** + * A base class for all the various methods of storing settings. + *

Usage: + *

+ * // Create manually, or require 'settings' from the container.
+ * // This is the manual version:
+ * var settings = plugins.catalog.getObject('settings');
+ * // Add a new setting
+ * settings.addSetting({ name:'foo', ... });
+ * // Display the default value
+ * alert(settings.get('foo'));
+ * // Alter the value, which also publishes the change etc.
+ * settings.set('foo', 'bar');
+ * // Reset the value to the default
+ * settings.resetValue('foo');
+ * 
+ * @constructor + */ +function Settings(persister) { + // Storage for deactivated values + this._deactivated = {}; + + // Storage for the active settings + this._settings = {}; + // We often want sorted setting names. Cache + this._settingNames = []; + + if (persister) { + this.setPersister(persister); + } +}; + +Settings.prototype = { + /** + * Function to add to the list of available settings. + *

Example usage: + *

+     * var settings = plugins.catalog.getObject('settings');
+     * settings.addSetting({
+     *     name: 'tabsize', // For use in settings.get('X')
+     *     type: 'number',  // To allow value checking.
+     *     defaultValue: 4  // Default value for use when none is directly set
+     * });
+     * 
+ * @param {object} settingSpec Object containing name/type/defaultValue members. + */ + addSetting: function(settingSpec) { + var setting = new Setting(settingSpec, this); + this._settings[setting.name] = setting; + this._settingNames.push(setting.name); + this._settingNames.sort(); + }, + + addSettings: function addSettings(settings) { + Object.keys(settings).forEach(function (name) { + var setting = settings[name]; + if (!('name' in setting)) setting.name = name; + this.addSetting(setting); + }, this); + }, + + removeSetting: function(setting) { + var name = (typeof setting === 'string' ? setting : setting.name); + setting = this._settings[name]; + delete this._settings[name]; + util.arrayRemove(this._settingNames, name); + settings.removeAllListeners('change'); + }, + + removeSettings: function removeSettings(settings) { + Object.keys(settings).forEach(function(name) { + var setting = settings[name]; + if (!('name' in setting)) setting.name = name; + this.removeSettings(setting); + }, this); + }, + + getSettingNames: function() { + return this._settingNames; + }, + + getSetting: function(name) { + return this._settings[name]; + }, + + /** + * A Persister is able to store settings. It is an object that defines + * two functions: + * loadInitialValues(settings) and persistValue(settings, key, value). + */ + setPersister: function(persister) { + this._persister = persister; + if (persister) { + persister.loadInitialValues(this); + } + }, + + resetAll: function() { + this.getSettingNames().forEach(function(key) { + this.resetValue(key); + }, this); + }, + + /** + * Retrieve a list of the known settings and their values + */ + _list: function() { + var reply = []; + this.getSettingNames().forEach(function(setting) { + reply.push({ + 'key': setting, + 'value': this.getSetting(setting).get() + }); + }, this); + return reply; + }, + + /** + * Prime the local cache with the defaults. + */ + _loadDefaultValues: function() { + this._loadFromObject(this._getDefaultValues()); + }, + + /** + * Utility to load settings from an object + */ + _loadFromObject: function(data) { + // We iterate over data rather than keys so we don't forget values + // which don't have a setting yet. + for (var key in data) { + if (data.hasOwnProperty(key)) { + var setting = this._settings[key]; + if (setting) { + var value = setting.type.parse(data[key]); + this.set(key, value); + } else { + this.set(key, data[key]); + } + } + } + }, + + /** + * Utility to grab all the settings and export them into an object + */ + _saveToObject: function() { + return this.getSettingNames().map(function(key) { + return this._settings[key].type.stringify(this.get(key)); + }.bind(this)); + }, + + /** + * The default initial settings + */ + _getDefaultValues: function() { + return this.getSettingNames().map(function(key) { + return this._settings[key].spec.defaultValue; + }.bind(this)); + } +}; +exports.settings = new Settings(); + +/** + * Save the settings in a cookie + * This code has not been tested since reboot + * @constructor + */ +function CookiePersister() { +}; + +CookiePersister.prototype = { + loadInitialValues: function(settings) { + settings._loadDefaultValues(); + var data = cookie.get('settings'); + settings._loadFromObject(JSON.parse(data)); + }, + + persistValue: function(settings, key, value) { + try { + var stringData = JSON.stringify(settings._saveToObject()); + cookie.set('settings', stringData); + } catch (ex) { + console.error('Unable to JSONify the settings! ' + ex); + return; + } + } +}; + +exports.CookiePersister = CookiePersister; + +}); +/* ***** 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 Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Skywriter Team (skywriter@mozilla.com) + * + * 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('pilot/commands/settings', function(require, exports, module) { + + +var setCommandSpec = { + name: 'set', + params: [ + { + name: 'setting', + type: 'setting', + description: 'The name of the setting to display or alter', + defaultValue: null + }, + { + name: 'value', + type: 'settingValue', + description: 'The new value for the chosen setting', + defaultValue: null + } + ], + description: 'define and show settings', + exec: function(env, args, request) { + var html; + if (!args.setting) { + // 'set' by itself lists all the settings + var names = env.settings.getSettingNames(); + html = ''; + // first sort the settingsList based on the name + names.sort(function(name1, name2) { + return name1.localeCompare(name2); + }); + + names.forEach(function(name) { + var setting = env.settings.getSetting(name); + var url = 'https://wiki.mozilla.org/Labs/Skywriter/Settings#' + + setting.name; + html += '' + + setting.name + + ' = ' + + setting.value + + '
'; + }); + } else { + // set with only a setting, shows the value for that setting + if (args.value === undefined) { + html = '' + setting.name + ' = ' + + setting.get(); + } else { + // Actually change the setting + args.setting.set(args.value); + html = 'Setting: ' + args.setting.name + ' = ' + + args.setting.get(); + } + } + request.done(html); + } +}; + +var unsetCommandSpec = { + name: 'unset', + params: [ + { + name: 'setting', + type: 'setting', + description: 'The name of the setting to return to defaults' + } + ], + description: 'unset a setting entirely', + exec: function(env, args, request) { + var setting = env.settings.get(args.setting); + if (!setting) { + request.doneWithError('No setting with the name ' + + args.setting + '.'); + return; + } + + setting.reset(); + request.done('Reset ' + setting.name + ' to default: ' + + env.settings.get(args.setting)); + } +}; + +var canon = require('pilot/canon'); + +exports.startup = function(data, reason) { + canon.addCommand(setCommandSpec); + canon.addCommand(unsetCommandSpec); +}; + +exports.shutdown = function(data, reason) { + canon.removeCommand(setCommandSpec); + canon.removeCommand(unsetCommandSpec); +}; + + +}); +/* ***** 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 Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Skywriter Team (skywriter@mozilla.com) + * + * 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('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.' +}; + +/** + * 'help' command + */ +var helpCommandSpec = { + name: 'help', + params: [ + { + name: 'search', + type: 'text', + description: 'Search string to narrow the output.', + defaultValue: null + } + ], + description: 'Get help on the available commands.', + exec: function(env, args, request) { + var output = []; + + var command = canon.getCommand(args.search); + if (command && command.exec) { + // caught a real command + output.push(command.description ? + command.description : + 'No description for ' + args.search); + } else { + var showHidden = false; + + if (!args.search && helpMessages.plainPrefix) { + output.push(helpMessages.plainPrefix); + } + + if (command) { + // We must be looking at sub-commands + output.push('

Sub-Commands of ' + command.name + '

'); + output.push('

' + command.description + '

'); + } + else if (args.search) { + if (args.search == 'hidden') { // sneaky, sneaky. + args.search = ''; + showHidden = true; + } + output.push('

Commands starting with \'' + args.search + '\':

'); + } + else { + output.push('

Available Commands:

'); + } + + var commandNames = canon.getCommandNames(); + commandNames.sort(); + + output.push(''); + for (var i = 0; i < commandNames.length; i++) { + command = canon.getCommand(commandNames[i]); + if (!showHidden && command.hidden) { + continue; + } + if (command.description === undefined) { + // Ignore editor actions + continue; + } + if (args.search && command.name.indexOf(args.search) !== 0) { + // Filtered out by the user + continue; + } + if (!args.search && command.name.indexOf(' ') != -1) { + // sub command + continue; + } + if (command && command.name == args.search) { + // sub command, and we've already given that help + continue; + } + + // todo add back a column with parameter information, perhaps? + + output.push(''); + output.push(''); + output.push(''); + output.push(''); + } + output.push('
' + command.name + '' + command.description + '
'); + + if (!args.search && helpMessages.plainSuffix) { + output.push(helpMessages.plainSuffix); + } + } + + request.done(output.join('')); + } +}; + +/** + * 'eval' command + */ +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)) { + // converts the function to a well formated string + msg = (result + '').replace(/\n/g, '
').replace(/ /g, ' '); + type = 'function'; + } else if (checks.isObject(result)) { + if (Array.isArray(result)) { + type = 'array'; + } else { + type = 'object'; + } + + var items = []; + var value; + + for (x in result) { + if (result.hasOwnProperty(x)) { + if (checks.isFunction(result[x])) { + value = '[function]'; + } else if (checks.isObject(result[x])) { + value = '[object]'; + } else { + value = result[x]; + } + + items.push({name: x, value: value}); + } + } + + items.sort(function(a,b) { + return (a.name.toLowerCase() < b.name.toLowerCase()) ? -1 : 1; + }); + + for (x = 0; x < items.length; x++) { + msg += '' + items[x].name + ': ' + items[x].value + '
'; + } + + } else { + msg = result; + type = typeof result; + } + + request.done('Result for eval \'' + javascript + '\'' + + ' (type: '+ type+'):

'+ msg); + } +}; + +/** + * 'version' command + */ +var versionCommandSpec = { + name: 'version', + description: 'show the Skywriter version', + hidden: true, + exec: function(env, args, request) { + var version = 'Skywriter ' + skywriter.versionNumber + ' (' + + skywriter.versionCodename + ')'; + request.done(version); + } +}; + +/** + * 'skywriter' command + */ +var skywriterCommandSpec = { + name: 'skywriter', + hidden: true, + exec: function(env, args, request) { + var index = Math.floor(Math.random() * messages.length); + request.done('Skywriter ' + messages[index]); + } +}; +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(data, reason) { + canon.addCommand(helpCommandSpec); + canon.addCommand(evalCommandSpec); + // canon.addCommand(versionCommandSpec); + canon.addCommand(skywriterCommandSpec); +}; + +exports.shutdown = function(data, reason) { + canon.removeCommand(helpCommandSpec); + canon.removeCommand(evalCommandSpec); + // canon.removeCommand(versionCommandSpec); + canon.removeCommand(skywriterCommandSpec); +}; + + +}); +/* ***** 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 Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Joe Walker (jwalker@mozilla.com) + * + * 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('pilot/typecheck', function(require, exports, module) { + +var objectToString = Object.prototype.toString; + +/** + * Return true if it is a String + */ +exports.isString = function(it) { + return it && objectToString.call(it) === "[object String]"; +}; + +/** + * Returns true if it is a Boolean. + */ +exports.isBoolean = function(it) { + return it && objectToString.call(it) === "[object Boolean]"; +}; + +/** + * Returns true if it is a Number. + */ +exports.isNumber = function(it) { + return it && objectToString.call(it) === "[object Number]" && isFinite(it); +}; + +/** + * Hack copied from dojo. + */ +exports.isObject = function(it) { + return it !== undefined && + (it === null || typeof it == "object" || + Array.isArray(it) || exports.isFunction(it)); +}; + +/** + * Is the passed object a function? + * From dojo.isFunction() + */ +exports.isFunction = function(it) { + return it && objectToString.call(it) === "[object Function]"; +}; + +});/* ***** 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 Mozilla Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Joe Walker (jwalker@mozilla.com) + * + * 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('pilot/settings/canon', function(require, exports, module) { + + +var historyLengthSetting = { + name: "historyLength", + description: "How many typed commands do we recall for reference?", + type: "number", + defaultValue: 50 +}; + +exports.startup = function(data, reason) { + data.env.settings.addSetting(historyLengthSetting); +}; + +exports.shutdown = function(data, reason) { + data.env.settings.removeSetting(historyLengthSetting); +}; + + +}); +/* ***** 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 Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Kevin Dangoor (kdangoor@mozilla.com) + * + * 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('pilot/plugin_manager', function(require, exports, module) { + +var Promise = require("pilot/promise").Promise; + +exports.REASONS = { + APP_STARTUP: 1, + APP_SHUTDOWN: 2, + PLUGIN_ENABLE: 3, + PLUGIN_DISABLE: 4, + PLUGIN_INSTALL: 5, + PLUGIN_UNINSTALL: 6, + PLUGIN_UPGRADE: 7, + PLUGIN_DOWNGRADE: 8 +}; + +exports.Plugin = function(name) { + this.name = name; + this.status = this.INSTALLED; +}; + +exports.Plugin.prototype = { + /** + * constants for the state + */ + NEW: 0, + INSTALLED: 1, + REGISTERED: 2, + STARTED: 3, + UNREGISTERED: 4, + SHUTDOWN: 5, + + install: function(data, reason) { + var pr = new Promise(); + if (this.status > this.NEW) { + pr.resolve(this); + return pr; + } + require([this.name], function(pluginModule) { + if (pluginModule.install) { + pluginModule.install(data, reason); + } + this.status = this.INSTALLED; + pr.resolve(this); + }.bind(this)); + return pr; + }, + + register: function(data, reason) { + var pr = new Promise(); + if (this.status != this.INSTALLED) { + pr.resolve(this); + return pr; + } + require([this.name], function(pluginModule) { + if (pluginModule.register) { + pluginModule.register(data, reason); + } + this.status = this.REGISTERED; + pr.resolve(this); + }.bind(this)); + return pr; + }, + + startup: function(data, reason) { + reason = reason || exports.REASONS.APP_STARTUP; + var pr = new Promise(); + if (this.status != this.REGISTERED) { + pr.resolve(this); + return pr; + } + require([this.name], function(pluginModule) { + if (pluginModule.startup) { + pluginModule.startup(data, reason); + } + this.status = this.STARTED; + pr.resolve(this); + }.bind(this)); + return pr; + }, + + shutdown: function(data, reason) { + if (this.status != this.STARTED) { + return; + } + pluginModule = require(this.name); + if (pluginModule.shutdown) { + pluginModule.shutdown(data, reason); + } + } +}; + +exports.PluginCatalog = function() { + this.plugins = {}; +}; + +exports.PluginCatalog.prototype = { + registerPlugins: function(pluginList, data, reason) { + var registrationPromises = []; + pluginList.forEach(function(pluginName) { + var plugin = this.plugins[pluginName]; + if (plugin === undefined) { + plugin = new exports.Plugin(pluginName); + this.plugins[pluginName] = plugin; + registrationPromises.push(plugin.register(data, reason)); + } + }.bind(this)); + return Promise.group(registrationPromises); + }, + + startupPlugins: function(data, reason) { + var startupPromises = []; + for (var pluginName in this.plugins) { + var plugin = this.plugins[pluginName]; + startupPromises.push(plugin.startup(data, reason)); + } + return Promise.group(startupPromises); + } +}; + +exports.catalog = new exports.PluginCatalog(); + +}); +/* ***** 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 Mozilla Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Joe Walker (jwalker@mozilla.com) + * + * 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('pilot/promise', function(require, exports, module) { + +var console = require("pilot/console"); +var Trace = require('pilot/stacktrace').Trace; + +/** + * A promise can be in one of 2 states. + * The ERROR and SUCCESS states are terminal, the PENDING state is the only + * start state. + */ +var ERROR = -1; +var PENDING = 0; +var SUCCESS = 1; + +/** + * We give promises and ID so we can track which are outstanding + */ +var _nextId = 0; + +/** + * Debugging help if 2 things try to complete the same promise. + * This can be slow (especially on chrome due to the stack trace unwinding) so + * we should leave this turned off in normal use. + */ +var _traceCompletion = false; + +/** + * Outstanding promises. Handy list for debugging only. + */ +var _outstanding = []; + +/** + * Recently resolved promises. Also for debugging only. + */ +var _recent = []; + +/** + * Create an unfulfilled promise + */ +Promise = function () { + this._status = PENDING; + this._value = undefined; + this._onSuccessHandlers = []; + this._onErrorHandlers = []; + + // Debugging help + this._id = _nextId++; + //this._createTrace = new Trace(new Error()); + _outstanding[this._id] = this; +}; + +/** + * Yeay for RTTI. + */ +Promise.prototype.isPromise = true; + +/** + * Have we either been resolve()ed or reject()ed? + */ +Promise.prototype.isComplete = function() { + return this._status != PENDING; +}; + +/** + * Have we resolve()ed? + */ +Promise.prototype.isResolved = function() { + return this._status == SUCCESS; +}; + +/** + * Have we reject()ed? + */ +Promise.prototype.isRejected = function() { + return this._status == ERROR; +}; + +/** + * Take the specified action of fulfillment of a promise, and (optionally) + * a different action on promise rejection. + */ +Promise.prototype.then = function(onSuccess, onError) { + if (typeof onSuccess === 'function') { + if (this._status === SUCCESS) { + onSuccess.call(null, this._value); + } else if (this._status === PENDING) { + this._onSuccessHandlers.push(onSuccess); + } + } + + if (typeof onError === 'function') { + if (this._status === ERROR) { + onError.call(null, this._value); + } else if (this._status === PENDING) { + this._onErrorHandlers.push(onError); + } + } + + return this; +}; + +/** + * Like then() except that rather than returning this we return + * a promise which + */ +Promise.prototype.chainPromise = function(onSuccess) { + var chain = new Promise(); + chain._chainedFrom = this; + this.then(function(data) { + try { + chain.resolve(onSuccess(data)); + } catch (ex) { + chain.reject(ex); + } + }, function(ex) { + chain.reject(ex); + }); + return chain; +}; + +/** + * Supply the fulfillment of a promise + */ +Promise.prototype.resolve = function(data) { + return this._complete(this._onSuccessHandlers, SUCCESS, data, 'resolve'); +}; + +/** + * Renege on a promise + */ +Promise.prototype.reject = function(data) { + return this._complete(this._onErrorHandlers, ERROR, data, 'reject'); +}; + +/** + * Internal method to be called on resolve() or reject(). + * @private + */ +Promise.prototype._complete = function(list, status, data, name) { + // Complain if we've already been completed + if (this._status != PENDING) { + console.group('Promise already closed'); + console.error('Attempted ' + name + '() with ', data); + console.error('Previous status = ', this._status, + ', previous value = ', this._value); + console.trace(); + + if (this._completeTrace) { + console.error('Trace of previous completion:'); + this._completeTrace.log(5); + } + console.groupEnd(); + return this; + } + + if (_traceCompletion) { + this._completeTrace = new Trace(new Error()); + } + + this._status = status; + this._value = data; + + // Call all the handlers, and then delete them + list.forEach(function(handler) { + handler.call(null, this._value); + }, this); + this._onSuccessHandlers.length = 0; + this._onErrorHandlers.length = 0; + + // Remove the given {promise} from the _outstanding list, and add it to the + // _recent list, pruning more than 20 recent promises from that list. + delete _outstanding[this._id]; + _recent.push(this); + while (_recent.length > 20) { + _recent.shift(); + } + + return this; +}; + +/** + * Takes an array of promises and returns a promise that that is fulfilled once + * all the promises in the array are fulfilled + * @param group The array of promises + * @return the promise that is fulfilled when all the array is fulfilled + */ +Promise.group = function(promiseList) { + if (!(promiseList instanceof Array)) { + promiseList = Array.prototype.slice.call(arguments); + } + + // If the original array has nothing in it, return now to avoid waiting + if (promiseList.length === 0) { + return new Promise().resolve([]); + } + + var groupPromise = new Promise(); + var results = []; + var fulfilled = 0; + + var onSuccessFactory = function(index) { + return function(data) { + results[index] = data; + fulfilled++; + // If the group has already failed, silently drop extra results + if (groupPromise._status !== ERROR) { + if (fulfilled === promiseList.length) { + groupPromise.resolve(results); + } + } + }; + }; + + promiseList.forEach(function(promise, index) { + var onSuccess = onSuccessFactory(index); + var onError = groupPromise.reject.bind(groupPromise); + promise.then(onSuccess, onError); + }); + + return groupPromise; +}; + +exports.Promise = Promise; +exports._outstanding = _outstanding; +exports._recent = _recent; + +}); +/* ***** 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 DomTemplate. + * + * The Initial Developer of the Original Code is Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Joe Walker (jwalker@mozilla.com) (original author) + * + * 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('pilot/environment', function(require, exports, module) { + + +var settings = require("pilot/settings").settings; + +/** + * Create an environment object + */ +function create() { + return { + settings: settings + }; +}; + +exports.create = create; + + +}); +/* vim:ts=4:sts=4:sw=4: + * ***** 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 B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Fabian Jakobs + * Irakli Gozalishvili (http://jeditoolkit.com) + * Julian Viereck + * + * 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/editor', function(require, exports, module) { + +require("pilot/fixoldbrowsers"); + +var oop = require("pilot/oop"); +var event = require("pilot/event"); +var lang = require("pilot/lang"); +var useragent = require("pilot/useragent"); +var TextInput = require("ace/keyboard/textinput").TextInput; +var MouseHandler = require("ace/mouse_handler").MouseHandler; +//var TouchHandler = require("ace/touch_handler").TouchHandler; +var KeyBinding = require("ace/keyboard/keybinding").KeyBinding; +var EditSession = require("ace/edit_session").EditSession; +var Search = require("ace/search").Search; +var BackgroundTokenizer = require("ace/background_tokenizer").BackgroundTokenizer; +var Range = require("ace/range").Range; +var EventEmitter = require("pilot/event_emitter").EventEmitter; + +var Editor =function(renderer, session) { + var container = renderer.getContainerElement(); + this.container = container; + this.renderer = renderer; + + this.textInput = new TextInput(renderer.getTextAreaContainer(), this); + this.keyBinding = new KeyBinding(this); + + // TODO detect touch event support + if (useragent.isIPad) { + //this.$mouseHandler = new TouchHandler(this); + } else { + this.$mouseHandler = new MouseHandler(this); + } + + this.$blockScrolling = 0; + this.$search = new Search().set({ + wrap: true + }); + + this.setSession(session || new EditSession("")); +}; + +(function(){ + + oop.implement(this, EventEmitter); + + this.$forwardEvents = { + gutterclick: 1, + gutterdblclick: 1 + }; + + this.$originalAddEventListener = this.addEventListener; + this.$originalRemoveEventListener = this.removeEventListener; + + this.addEventListener = function(eventName, callback) { + if (this.$forwardEvents[eventName]) { + return this.renderer.addEventListener(eventName, callback); + } else { + return this.$originalAddEventListener(eventName, callback); + } + }; + + this.removeEventListener = function(eventName, callback) { + if (this.$forwardEvents[eventName]) { + return this.renderer.removeEventListener(eventName, callback); + } else { + return this.$originalRemoveEventListener(eventName, callback); + } + }; + + this.setKeyboardHandler = function(keyboardHandler) { + this.keyBinding.setKeyboardHandler(keyboardHandler); + }; + + this.getKeyboardHandler = function() { + return this.keyBinding.getKeyboardHandler(); + } + + this.setSession = function(session) { + if (this.session == session) return; + + if (this.session) { + var oldSession = this.session; + this.session.removeEventListener("change", this.$onDocumentChange); + this.session.removeEventListener("changeMode", this.$onDocumentModeChange); + this.session.removeEventListener("changeTabSize", this.$onDocumentChangeTabSize); + this.session.removeEventListener("changeWrapLimit", this.$onDocumentChangeWrapLimit); + this.session.removeEventListener("changeWrapMode", this.$onDocumentChangeWrapMode); + this.session.removeEventListener("changeFrontMarker", this.$onChangeFrontMarker); + this.session.removeEventListener("changeBackMarker", this.$onChangeBackMarker); + this.session.removeEventListener("changeBreakpoint", this.$onDocumentChangeBreakpoint); + this.session.removeEventListener("changeAnnotation", this.$onDocumentChangeAnnotation); + + var selection = this.session.getSelection(); + selection.removeEventListener("changeCursor", this.$onCursorChange); + selection.removeEventListener("changeSelection", this.$onSelectionChange); + + this.session.setScrollTopRow(this.renderer.getScrollTopRow()); + } + + this.session = session; + + this.$onDocumentChange = this.onDocumentChange.bind(this); + session.addEventListener("change", this.$onDocumentChange); + this.renderer.setSession(session); + + this.$onDocumentModeChange = this.onDocumentModeChange.bind(this); + session.addEventListener("changeMode", this.$onDocumentModeChange); + + this.$onDocumentChangeTabSize = this.renderer.updateText.bind(this.renderer); + session.addEventListener("changeTabSize", this.$onDocumentChangeTabSize); + + this.$onDocumentChangeWrapLimit = this.onDocumentChangeWrapLimit.bind(this); + session.addEventListener("changeWrapLimit", this.$onDocumentChangeWrapLimit); + + this.$onDocumentChangeWrapMode = this.onDocumentChangeWrapMode.bind(this); + session.addEventListener("changeWrapMode", this.$onDocumentChangeWrapMode); + + this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this); + this.session.addEventListener("changeFrontMarker", this.$onChangeFrontMarker); + + this.$onChangeBackMarker = this.onChangeBackMarker.bind(this); + this.session.addEventListener("changeBackMarker", this.$onChangeBackMarker); + + this.$onDocumentChangeBreakpoint = this.onDocumentChangeBreakpoint.bind(this); + this.session.addEventListener("changeBreakpoint", this.$onDocumentChangeBreakpoint); + + this.$onDocumentChangeAnnotation = this.onDocumentChangeAnnotation.bind(this); + this.session.addEventListener("changeAnnotation", this.$onDocumentChangeAnnotation); + + this.selection = session.getSelection(); + + 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.setDocument(session.getDocument()); + this.bgTokenizer.start(0); + + this.onCursorChange(); + this.onSelectionChange(); + this.onChangeFrontMarker(); + this.onChangeBackMarker(); + this.onDocumentChangeBreakpoint(); + this.onDocumentChangeAnnotation(); + this.renderer.scrollToRow(session.getScrollTopRow()); + this.renderer.updateFull(); + + this._dispatchEvent("changeSession", { + session: session, + oldSession: oldSession + }); + }; + + this.getSession = function() { + return this.session; + }; + + this.getSelection = function() { + return this.selection; + }; + + this.resize = function() { + this.renderer.onResize(); + }; + + this.setTheme = function(theme) { + this.renderer.setTheme(theme); + }; + + this.setStyle = function(style) { + this.renderer.setStyle(style) + }; + + this.unsetStyle = function(style) { + this.renderer.unsetStyle(style) + } + + this.$highlightBrackets = function() { + if (this.$bracketHighlight) { + this.session.removeMarker(this.$bracketHighlight); + this.$bracketHighlight = null; + } + + if (this.$highlightPending) { + return; + } + + // perform highlight async to not block the browser during navigation + var self = this; + this.$highlightPending = true; + setTimeout(function() { + self.$highlightPending = false; + + var pos = self.session.findMatchingBracket(self.getCursorPosition()); + if (pos) { + var range = new Range(pos.row, pos.column, pos.row, pos.column+1); + self.$bracketHighlight = self.session.addMarker(range, "ace_bracket"); + } + }, 10); + }; + + this.focus = function() { + // Safari need the timeout + // iOS and Firefox need it called immediately + // to be on the save side we do both + var _self = this; + setTimeout(function() { + _self.textInput.focus(); + }); + this.textInput.focus(); + }; + + this.blur = function() { + this.textInput.blur(); + }; + + this.onFocus = function() { + this.renderer.showCursor(); + this.renderer.visualizeFocus(); + this._dispatchEvent("focus"); + }; + + this.onBlur = function() { + this.renderer.hideCursor(); + this.renderer.visualizeBlur(); + this._dispatchEvent("blur"); + }; + + this.onDocumentChange = function(e) { + var delta = e.data; + var range = delta.range; + + this.bgTokenizer.start(range.start.row); + if (range.start.row == range.end.row && delta.action != "insertLines" && delta.action != "removeLines") + var lastRow = range.end.row; + else + lastRow = Infinity; + this.renderer.updateLines(range.start.row, lastRow); + + // update cursor because tab characters can influence the cursor position + this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite); + }; + + this.onTokenizerUpdate = function(e) { + var rows = e.data; + this.renderer.updateLines(rows.first, rows.last); + }; + + this.onCursorChange = function(e) { + this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite); + + if (!this.$blockScrolling) { + this.renderer.scrollCursorIntoView(); + } + + // move text input over the cursor + // this is required for iOS and IME + this.renderer.moveTextAreaToCursor(this.textInput.getElement()); + + this.$highlightBrackets(); + this.$updateHighlightActiveLine(); + }; + + this.$updateHighlightActiveLine = function() { + var session = this.getSession(); + + if (session.$highlightLineMarker) { + session.removeMarker(session.$highlightLineMarker); + } + session.$highlightLineMarker = null; + + if (this.getHighlightActiveLine() && (this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) { + var cursor = this.getCursorPosition(); + var range = new Range(cursor.row, 0, cursor.row+1, 0); + session.$highlightLineMarker = session.addMarker(range, "ace_active_line", "line"); + } + }; + + this.onSelectionChange = function(e) { + var session = this.getSession(); + + if (session.$selectionMarker) { + session.removeMarker(session.$selectionMarker); + } + session.$selectionMarker = null; + + if (!this.selection.isEmpty()) { + var range = this.selection.getRange(); + var style = this.getSelectionStyle(); + session.$selectionMarker = session.addMarker(range, "ace_selection", style); + } + + this.onCursorChange(e); + }; + + this.onChangeFrontMarker = function() { + this.renderer.updateFrontMarkers(); + }; + + this.onChangeBackMarker = function() { + this.renderer.updateBackMarkers(); + }; + + this.onDocumentChangeBreakpoint = function() { + this.renderer.setBreakpoints(this.session.getBreakpoints()); + }; + + this.onDocumentChangeAnnotation = function() { + this.renderer.setAnnotations(this.session.getAnnotations()); + }; + + this.onDocumentModeChange = function() { + var mode = this.session.getMode(); + if (this.mode == mode) + return; + + this.mode = mode; + var tokenizer = mode.getTokenizer(); + + if (!this.bgTokenizer) { + var onUpdate = this.onTokenizerUpdate.bind(this); + this.bgTokenizer = new BackgroundTokenizer(tokenizer, this); + this.bgTokenizer.addEventListener("update", onUpdate); + } else { + this.bgTokenizer.setTokenizer(tokenizer); + } + + this.renderer.setTokenizer(this.bgTokenizer); + }; + + this.onDocumentChangeWrapLimit = function() { + this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite); + this.renderer.updateFull(); + }; + + this.onDocumentChangeWrapMode = function() { + this.renderer.onResize(true); + }; + + this.getCopyText = function() { + if (!this.selection.isEmpty()) { + return this.session.getTextRange(this.getSelectionRange()); + } + else { + return ""; + } + }; + + this.onCut = function() { + if (this.$readOnly) + return; + + if (!this.selection.isEmpty()) { + this.session.remove(this.getSelectionRange()) + this.clearSelection(); + } + }; + + this.insert = function(text) { + if (this.$readOnly) + return; + + var cursor = this.getCursorPosition(); + text = text.replace("\t", this.session.getTabString()); + + // remove selected text + if (!this.selection.isEmpty()) { + var cursor = this.session.remove(this.getSelectionRange()); + this.clearSelection(); + } else if (this.$overwrite){ + var range = new Range.fromPoints(cursor, cursor); + range.end.column += text.length; + this.session.remove(range); + } + + this.clearSelection(); + + var lineState = this.bgTokenizer.getState(cursor.row); + var shouldOutdent = this.mode.checkOutdent(lineState, this.session.getLine(cursor.row), text); + var line = this.session.getLine(cursor.row); + var lineIndent = this.mode.getNextLineIndent(lineState, line.slice(0, cursor.column), this.session.getTabString()); + var end = this.session.insert(cursor, text); + + this.moveCursorToPosition(end); + + var lineState = this.bgTokenizer.getState(cursor.row); + // multi line insert + if (cursor.row !== end.row) { + var size = this.session.getTabSize(), + minIndent = Number.MAX_VALUE; + + for (var row = cursor.row + 1; row <= end.row; ++row) { + var indent = 0; + + line = this.session.getLine(row); + for (var i = 0; i < line.length; ++i) + if (line.charAt(i) == '\t') + indent += size; + else if (line.charAt(i) == ' ') + indent += 1; + else + break; + if (/[^\s]/.test(line)) + minIndent = Math.min(indent, minIndent); + } + + for (var row = cursor.row + 1; row <= end.row; ++row) { + var outdent = minIndent; + + line = this.session.getLine(row); + for (var i = 0; i < line.length && outdent > 0; ++i) + if (line.charAt(i) == '\t') + outdent -= size; + else if (line.charAt(i) == ' ') + outdent -= 1; + this.session.remove(new Range(row, 0, row, i)); + } + this.session.indentRows(cursor.row + 1, end.row, lineIndent); + } else { + if (shouldOutdent) { + this.mode.autoOutdent(lineState, this.session, cursor.row); + } + }; + } + + this.onTextInput = function(text) { + this.keyBinding.onTextInput(text); + }; + + this.onCommandKey = function(e, hashId, keyCode) { + this.keyBinding.onCommandKey(e, hashId, keyCode); + }; + + this.$overwrite = false; + this.setOverwrite = function(overwrite) { + if (this.$overwrite == overwrite) return; + + this.$overwrite = overwrite; + + this.$blockScrolling += 1; + this.onCursorChange(); + this.$blockScrolling -= 1; + + this._dispatchEvent("changeOverwrite", {data: overwrite}); + }; + + this.getOverwrite = function() { + return this.$overwrite; + }; + + this.toggleOverwrite = function() { + this.setOverwrite(!this.$overwrite); + }; + + this.setScrollSpeed = function(speed) { + this.$mouseHandler.setScrollSpeed(speed); + }; + + this.getScrollSpeed = function() { + return this.$mouseHandler.getScrollSpeed() + }; + + this.$selectionStyle = "line"; + this.setSelectionStyle = function(style) { + if (this.$selectionStyle == style) return; + + this.$selectionStyle = style; + this.onSelectionChange(); + this._dispatchEvent("changeSelectionStyle", {data: style}); + }; + + this.getSelectionStyle = function() { + return this.$selectionStyle; + }; + + this.$highlightActiveLine = true; + this.setHighlightActiveLine = function(shouldHighlight) { + if (this.$highlightActiveLine == shouldHighlight) return; + + this.$highlightActiveLine = shouldHighlight; + this.$updateHighlightActiveLine(); + }; + + this.getHighlightActiveLine = function() { + return this.$highlightActiveLine; + }; + + this.setShowInvisibles = function(showInvisibles) { + if (this.getShowInvisibles() == showInvisibles) + return; + + this.renderer.setShowInvisibles(showInvisibles); + }; + + this.getShowInvisibles = function() { + return this.renderer.getShowInvisibles(); + }; + + this.setShowPrintMargin = function(showPrintMargin) { + this.renderer.setShowPrintMargin(showPrintMargin); + }; + + this.getShowPrintMargin = function() { + return this.renderer.getShowPrintMargin(); + }; + + this.setPrintMarginColumn = function(showPrintMargin) { + this.renderer.setPrintMarginColumn(showPrintMargin); + }; + + this.getPrintMarginColumn = function() { + return this.renderer.getPrintMarginColumn(); + }; + + this.$readOnly = false; + this.setReadOnly = function(readOnly) { + this.$readOnly = readOnly; + }; + + this.getReadOnly = function() { + return this.$readOnly; + }; + + this.removeRight = function() { + if (this.$readOnly) + return; + + if (this.selection.isEmpty()) { + this.selection.selectRight(); + } + this.session.remove(this.getSelectionRange()) + this.clearSelection(); + }; + + this.removeLeft = function() { + if (this.$readOnly) + return; + + if (this.selection.isEmpty()) + this.selection.selectLeft(); + + this.session.remove(this.getSelectionRange()); + this.clearSelection(); + }; + + this.removeWordRight = function() { + if (this.$readOnly) + return; + + if (this.selection.isEmpty()) + this.selection.selectWordRight(); + + this.session.remove(this.getSelectionRange()); + this.clearSelection(); + }; + + this.removeWordLeft = function() { + if (this.$readOnly) + return; + + if (this.selection.isEmpty()) + this.selection.selectWordLeft(); + + this.session.remove(this.getSelectionRange()); + this.clearSelection(); + }; + + this.removeToLineStart = function() { + if (this.$readOnly) + return; + + if (this.selection.isEmpty()) + this.selection.selectLineStart(); + + this.session.remove(this.getSelectionRange()); + this.clearSelection(); + }; + + this.removeToLineEnd = function() { + if (this.$readOnly) + return; + + if (this.selection.isEmpty()) + this.selection.selectLineEnd(); + + this.session.remove(this.getSelectionRange()); + this.clearSelection(); + }; + + this.splitLine = function() { + if (this.$readOnly) + return; + + if (!this.selection.isEmpty()) { + this.session.remove(this.getSelectionRange()); + this.clearSelection(); + } + + var cursor = this.getCursorPosition(); + this.insert("\n"); + this.moveCursorToPosition(cursor); + }; + + this.transposeLetters = function() { + if (this.$readOnly) + return; + + if (!this.selection.isEmpty()) { + return; + } + + var cursor = this.getCursorPosition(); + var column = cursor.column; + if (column == 0) + return; + + var line = this.session.getLine(cursor.row); + if (column < line.length) { + var swap = line.charAt(column) + line.charAt(column-1); + var range = new Range(cursor.row, column-1, cursor.row, column+1) + } + else { + var swap = line.charAt(column-1) + line.charAt(column-2); + var range = new Range(cursor.row, column-2, cursor.row, column) + } + this.session.replace(range, swap); + }; + + this.indent = function() { + if (this.$readOnly) + return; + + var session = this.session; + var range = this.getSelectionRange(); + + if (range.start.row < range.end.row || range.start.column < range.end.column) { + var rows = this.$getSelectedRows(); + session.indentRows(rows.first, rows.last, "\t"); + } else { + var indentString; + + if (this.session.getUseSoftTabs()) { + var size = session.getTabSize(), + position = this.getCursorPosition(), + column = session.documentToScreenColumn(position.row, position.column), + count = (size - column % size); + + indentString = lang.stringRepeat(" ", count); + } else + indentString = "\t"; + return this.onTextInput(indentString); + } + }; + + this.blockOutdent = function() { + if (this.$readOnly) + return; + + var selection = this.session.getSelection(); + this.session.outdentRows(selection.getRange()); + }; + + this.toggleCommentLines = function() { + if (this.$readOnly) + return; + + var state = this.bgTokenizer.getState(this.getCursorPosition().row); + var rows = this.$getSelectedRows() + this.mode.toggleCommentLines(state, this.session, rows.first, rows.last); + }; + + this.removeLines = function() { + if (this.$readOnly) + return; + + var rows = this.$getSelectedRows(); + this.session.remove(new Range(rows.first, 0, rows.last+1, 0)); + this.clearSelection(); + }; + + this.moveLinesDown = function() { + if (this.$readOnly) + return; + + this.$moveLines(function(firstRow, lastRow) { + return this.session.moveLinesDown(firstRow, lastRow); + }); + }; + + this.moveLinesUp = function() { + if (this.$readOnly) + return; + + this.$moveLines(function(firstRow, lastRow) { + return this.session.moveLinesUp(firstRow, lastRow); + }); + }; + + this.copyLinesUp = function() { + if (this.$readOnly) + return; + + this.$moveLines(function(firstRow, lastRow) { + this.session.duplicateLines(firstRow, lastRow); + return 0; + }); + }; + + this.copyLinesDown = function() { + if (this.$readOnly) + return; + + this.$moveLines(function(firstRow, lastRow) { + return this.session.duplicateLines(firstRow, lastRow); + }); + }; + + + this.$moveLines = function(mover) { + var rows = this.$getSelectedRows(); + + var linesMoved = mover.call(this, rows.first, rows.last); + + var selection = this.selection; + selection.setSelectionAnchor(rows.last+linesMoved+1, 0); + selection.$moveSelection(function() { + selection.moveCursorTo(rows.first+linesMoved, 0); + }); + }; + + this.$getSelectedRows = function() { + var range = this.getSelectionRange().collapseRows(); + + return { + first: range.start.row, + last: range.end.row + }; + }; + + this.onCompositionStart = function(text) { + this.renderer.showComposition(this.getCursorPosition()); + }; + + this.onCompositionUpdate = function(text) { + this.renderer.setCompositionText(text); + }; + + this.onCompositionEnd = function() { + this.renderer.hideComposition(); + }; + + + this.getFirstVisibleRow = function() { + return this.renderer.getFirstVisibleRow(); + }; + + this.getLastVisibleRow = function() { + return this.renderer.getLastVisibleRow(); + }; + + this.isRowVisible = function(row) { + return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow()); + }; + + this.getVisibleRowCount = function() { + return this.getLastVisibleRow() - this.getFirstVisibleRow() + 1; + }; + + this.getPageDownRow = function() { + return this.renderer.getLastVisibleRow() - 1; + }; + + this.getPageUpRow = function() { + var firstRow = this.renderer.getFirstVisibleRow(); + var lastRow = this.renderer.getLastVisibleRow(); + + return firstRow - (lastRow - firstRow) + 1; + }; + + this.selectPageDown = function() { + var row = this.getPageDownRow() + Math.floor(this.getVisibleRowCount() / 2); + + this.scrollPageDown(); + + var selection = this.getSelection(); + selection.$moveSelection(function() { + selection.moveCursorTo(row, selection.getSelectionLead().column); + }); + }; + + this.selectPageUp = function() { + var visibleRows = this.getLastVisibleRow() - this.getFirstVisibleRow(); + var row = this.getPageUpRow() + Math.round(visibleRows / 2); + + this.scrollPageUp(); + + var selection = this.getSelection(); + selection.$moveSelection(function() { + selection.moveCursorTo(row, selection.getSelectionLead().column); + }); + }; + + this.gotoPageDown = function() { + var row = this.getPageDownRow(), + column = Math.min(this.getCursorPosition().column, + this.session.getLine(row).length); + + this.scrollToRow(row); + this.getSelection().moveCursorTo(row, column); + }; + + this.gotoPageUp = function() { + var row = this.getPageUpRow(), + column = Math.min(this.getCursorPosition().column, + this.session.getLine(row).length); + + this.scrollToRow(row); + this.getSelection().moveCursorTo(row, column); + }; + + this.scrollPageDown = function() { + this.scrollToRow(this.getPageDownRow()); + }; + + this.scrollPageUp = function() { + this.renderer.scrollToRow(this.getPageUpRow()); + }; + + this.scrollToRow = function(row) { + this.renderer.scrollToRow(row); + }; + + this.scrollToLine = function(line, center) { + this.renderer.scrollToLine(line, center); + }; + + this.centerSelection = function() { + var range = this.getSelectionRange(); + var line = Math.floor(range.start.row + (range.end.row - range.start.row) / 2); + this.renderer.scrollToLine(line, true); + }; + + this.getCursorPosition = function() { + return this.selection.getCursor(); + }; + + this.getSelectionRange = function() { + return this.selection.getRange(); + }; + + + this.selectAll = function() { + this.$blockScrolling += 1; + this.selection.selectAll(); + this.$blockScrolling -= 1; + }; + + this.clearSelection = function() { + this.selection.clearSelection(); + }; + + this.moveCursorTo = function(row, column) { + this.selection.moveCursorTo(row, column); + }; + + this.moveCursorToPosition = function(pos) { + this.selection.moveCursorToPosition(pos); + }; + + + this.gotoLine = function(lineNumber, row) { + this.selection.clearSelection(); + + this.$blockScrolling += 1; + this.moveCursorTo(lineNumber-1, row || 0); + this.$blockScrolling -= 1; + + if (!this.isRowVisible(this.getCursorPosition().row)) { + this.scrollToLine(lineNumber, true); + } + }, + + this.navigateTo = function(row, column) { + this.clearSelection(); + this.moveCursorTo(row, column); + }; + + this.navigateUp = function(times) { + this.selection.clearSelection(); + times = times || 1; + this.selection.moveCursorBy(-times, 0); + }; + + this.navigateDown = function(times) { + this.selection.clearSelection(); + times = times || 1; + this.selection.moveCursorBy(times, 0); + }; + + this.navigateLeft = function(times) { + if (!this.selection.isEmpty()) { + var selectionStart = this.getSelectionRange().start; + this.moveCursorToPosition(selectionStart); + } + else { + times = times || 1; + while (times--) { + this.selection.moveCursorLeft(); + } + } + this.clearSelection(); + }; + + this.navigateRight = function(times) { + if (!this.selection.isEmpty()) { + var selectionEnd = this.getSelectionRange().end; + this.moveCursorToPosition(selectionEnd); + } + else { + times = times || 1; + while (times--) { + this.selection.moveCursorRight(); + } + } + 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(replacement, options) { + if (options) + this.$search.set(options); + + var range = this.$search.find(this.session); + this.$tryReplace(range, replacement); + if (range !== null) + this.selection.setSelectionRange(range); + }, + + this.replaceAll = function(replacement, options) { + if (options) { + this.$search.set(options); + } + + var ranges = this.$search.findAll(this.session); + if (!ranges.length) + return; + + var selection = this.getSelectionRange(); + this.clearSelection(); + this.selection.moveCursorTo(0, 0); + + this.$blockScrolling += 1; + for (var i = ranges.length - 1; i >= 0; --i) + this.$tryReplace(ranges[i], replacement); + + this.selection.setSelectionRange(selection); + this.$blockScrolling -= 1; + }, + + this.$tryReplace = function(range, replacement) { + var input = this.session.getTextRange(range); + var replacement = this.$search.replace(input, replacement); + if (replacement !== null) { + range.end = this.session.replace(range, replacement); + return range; + } else { + return null; + } + }; + + this.getLastSearchOptions = function() { + return this.$search.getOptions(); + }; + + this.find = function(needle, options) { + this.clearSelection(); + options = options || {}; + options.needle = needle; + this.$search.set(options); + this.$find(); + }, + + this.findNext = function(options) { + options = options || {}; + if (typeof options.backwards == "undefined") + options.backwards = false; + this.$search.set(options); + this.$find(); + }; + + this.findPrevious = function(options) { + options = options || {}; + if (typeof options.backwards == "undefined") + options.backwards = true; + this.$search.set(options); + this.$find(); + }; + + this.$find = function(backwards) { + if (!this.selection.isEmpty()) { + this.$search.set({needle: this.session.getTextRange(this.getSelectionRange())}); + } + + if (typeof backwards != "undefined") + this.$search.set({backwards: backwards}); + + var range = this.$search.find(this.session); + if (range) { + this.gotoLine(range.end.row+1, range.end.column); + this.selection.setSelectionRange(range); + } + }; + + this.undo = function() { + this.session.getUndoManager().undo(); + }; + + this.redo = function() { + this.session.getUndoManager().redo(); + }; + +}).call(Editor.prototype); + + +exports.Editor = Editor; +}); +/* ***** 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 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('pilot/event', function(require, exports, module) { + +var keys = require("pilot/keys"); +var useragent = require("pilot/useragent"); +var dom = require("pilot/dom"); + +exports.addListener = function(elem, type, callback) { + if (elem.addEventListener) { + return elem.addEventListener(type, callback, false); + } + if (elem.attachEvent) { + var wrapper = function() { + callback(window.event); + }; + callback._wrapper = wrapper; + elem.attachEvent("on" + type, wrapper); + } +}; + +exports.removeListener = function(elem, type, callback) { + if (elem.removeEventListener) { + return elem.removeEventListener(type, callback, false); + } + if (elem.detachEvent) { + elem.detachEvent("on" + type, callback._wrapper || callback); + } +}; + +/** +* Prevents propagation and clobbers the default action of the passed event +*/ +exports.stopEvent = function(e) { + exports.stopPropagation(e); + exports.preventDefault(e); + return false; +}; + +exports.stopPropagation = function(e) { + if (e.stopPropagation) + e.stopPropagation(); + else + e.cancelBubble = true; +}; + +exports.preventDefault = function(e) { + if (e.preventDefault) + e.preventDefault(); + else + e.returnValue = false; +}; + +exports.getDocumentX = function(e) { + if (e.clientX) { + return e.clientX + dom.getPageScrollLeft(); + } else { + return e.pageX; + } +}; + +exports.getDocumentY = function(e) { + if (e.clientY) { + return e.clientY + dom.getPageScrollTop(); + } else { + return e.pageY; + } +}; + +/** + * @return {Number} 0 for left button, 1 for middle button, 2 for right button + */ +exports.getButton = function(e) { + if (e.type == "dblclick") + return 0; + else if (e.type == "contextmenu") + return 2; + + // DOM Event + if (e.preventDefault) { + return e.button; + } + // old IE + else { + return {1:0, 2:2, 4:1}[e.button]; + } +}; + +if (document.documentElement.setCapture) { + exports.capture = function(el, eventHandler, releaseCaptureHandler) { + function onMouseMove(e) { + eventHandler(e); + return exports.stopPropagation(e); + } + + function onReleaseCapture(e) { + eventHandler && eventHandler(e); + releaseCaptureHandler && releaseCaptureHandler(); + + exports.removeListener(el, "mousemove", eventHandler); + exports.removeListener(el, "mouseup", onReleaseCapture); + exports.removeListener(el, "losecapture", onReleaseCapture); + + el.releaseCapture(); + } + + exports.addListener(el, "mousemove", eventHandler); + exports.addListener(el, "mouseup", onReleaseCapture); + exports.addListener(el, "losecapture", onReleaseCapture); + el.setCapture(); + }; +} +else { + exports.capture = function(el, eventHandler, releaseCaptureHandler) { + function onMouseMove(e) { + eventHandler(e); + e.stopPropagation(); + } + + function onMouseUp(e) { + eventHandler && eventHandler(e); + releaseCaptureHandler && releaseCaptureHandler(); + + document.removeEventListener("mousemove", onMouseMove, true); + document.removeEventListener("mouseup", onMouseUp, true); + + e.stopPropagation(); + } + + document.addEventListener("mousemove", onMouseMove, true); + document.addEventListener("mouseup", onMouseUp, true); + }; +} + +exports.addMouseWheelListener = function(el, callback) { + var listener = function(e) { + if (e.wheelDelta !== undefined) { + if (e.wheelDeltaX !== undefined) { + e.wheelX = -e.wheelDeltaX / 8; + e.wheelY = -e.wheelDeltaY / 8; + } else { + e.wheelX = 0; + e.wheelY = -e.wheelDelta / 8; + } + } + else { + if (e.axis && e.axis == e.HORIZONTAL_AXIS) { + e.wheelX = (e.detail || 0) * 5; + e.wheelY = 0; + } else { + e.wheelX = 0; + e.wheelY = (e.detail || 0) * 5; + } + } + callback(e); + }; + exports.addListener(el, "DOMMouseScroll", listener); + exports.addListener(el, "mousewheel", listener); +}; + +exports.addMultiMouseDownListener = function(el, button, count, timeout, callback) { + var clicks = 0; + var startX, startY; + + var listener = function(e) { + clicks += 1; + if (clicks == 1) { + startX = e.clientX; + startY = e.clientY; + + setTimeout(function() { + clicks = 0; + }, timeout || 600); + } + + if (exports.getButton(e) != button + || Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5) + clicks = 0; + + if (clicks == count) { + clicks = 0; + callback(e); + } + return exports.preventDefault(e); + }; + + exports.addListener(el, "mousedown", listener); + useragent.isIE && exports.addListener(el, "dblclick", listener); +}; + +function normalizeCommandKeys(callback, e, keyCode) { + var hashId = 0; + if (useragent.isOpera && useragent.isMac) { + hashId = 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0) + | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0); + } else { + hashId = 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0) + | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0); + } + + if (keyCode in keys.MODIFIER_KEYS) { + switch (keys.MODIFIER_KEYS[keyCode]) { + case "Alt": + hashId = 2; + break; + case "Shift": + hashId = 4; + break + case "Ctrl": + hashId = 1; + break; + default: + hashId = 8; + break; + } + keyCode = 0; + } + + if (hashId & 8 && (keyCode == 91 || keyCode == 93)) { + keyCode = 0; + } + + // If there is no hashID and the keyCode is not a function key, then + // we don't call the callback as we don't handle a command key here + // (it's a normal key/character input). + if (hashId == 0 && !(keyCode in keys.FUNCTION_KEYS)) { + return false; + } + + return callback(e, hashId, keyCode); +} + +exports.addCommandKeyListener = function(el, callback) { + var addListener = exports.addListener; + if (useragent.isOldGecko) { + // Old versions of Gecko aka. Firefox < 4.0 didn't repeat the keydown + // event if the user pressed the key for a longer time. Instead, the + // keydown event was fired once and later on only the keypress event. + // To emulate the 'right' keydown behavior, the keyCode of the initial + // keyDown event is stored and in the following keypress events the + // stores keyCode is used to emulate a keyDown event. + var lastKeyDownKeyCode = null; + addListener(el, "keydown", function(e) { + lastKeyDownKeyCode = e.keyCode; + }); + addListener(el, "keypress", function(e) { + return normalizeCommandKeys(callback, e, lastKeyDownKeyCode); + }); + } else { + var lastDown = null; + + addListener(el, "keydown", function(e) { + lastDown = e.keyIdentifier || e.keyCode; + return normalizeCommandKeys(callback, e, e.keyCode); + }); + + // repeated keys are fired as keypress and not keydown events + if (useragent.isMac && useragent.isOpera) { + addListener(el, "keypress", function(e) { + var keyId = e.keyIdentifier || e.keyCode; + if (lastDown !== keyId) { + return normalizeCommandKeys(callback, e, e.keyCode); + } else { + lastDown = null; + } + }); + } + } +}; + +}); +/*! @license +========================================================================== +SproutCore -- JavaScript Application Framework +copyright 2006-2009, Sprout Systems Inc., Apple Inc. and contributors. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +SproutCore and the SproutCore logo are trademarks of Sprout Systems, Inc. + +For more information about SproutCore, visit http://www.sproutcore.com + + +========================================================================== +@license */ + +// Most of the following code is taken from SproutCore with a few changes. + +define('pilot/keys', function(require, exports, module) { + +var oop = require("pilot/oop"); + +/** + * Helper functions and hashes for key handling. + */ +var Keys = (function() { + var ret = { + MODIFIER_KEYS: { + 16: 'Shift', 17: 'Ctrl', 18: 'Alt', 224: 'Meta' + }, + + KEY_MODS: { + "ctrl": 1, "alt": 2, "option" : 2, + "shift": 4, "meta": 8, "command": 8 + }, + + FUNCTION_KEYS : { + 8 : "Backspace", + 9 : "Tab", + 13 : "Return", + 19 : "Pause", + 27 : "Esc", + 32 : "Space", + 33 : "PageUp", + 34 : "PageDown", + 35 : "End", + 36 : "Home", + 37 : "Left", + 38 : "Up", + 39 : "Right", + 40 : "Down", + 44 : "Print", + 45 : "Insert", + 46 : "Delete", + 112: "F1", + 113: "F2", + 114: "F3", + 115: "F4", + 116: "F5", + 117: "F6", + 118: "F7", + 119: "F8", + 120: "F9", + 121: "F10", + 122: "F11", + 123: "F12", + 144: "Numlock", + 145: "Scrolllock" + }, + + PRINTABLE_KEYS: { + 32: ' ', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5', + 54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a', + 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h', + 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o', + 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v', + 87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.', + 188: ',', 190: '.', 191: '/', 192: '`', 219: '[', 220: '\\', + 221: ']', 222: '\"' + } + }; + + // A reverse map of FUNCTION_KEYS + for (i in ret.FUNCTION_KEYS) { + var name = ret.FUNCTION_KEYS[i].toUpperCase(); + ret[name] = parseInt(i, 10); + } + + // Add the MODIFIER_KEYS, FUNCTION_KEYS and PRINTABLE_KEYS to the KEY + // variables as well. + oop.mixin(ret, ret.MODIFIER_KEYS); + oop.mixin(ret, ret.PRINTABLE_KEYS); + oop.mixin(ret, ret.FUNCTION_KEYS); + + return ret; +})(); +oop.mixin(exports, Keys); + +}); +/* ***** 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 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('pilot/dom', function(require, exports, module) { + +exports.setText = function(elem, text) { + if (elem.innerText !== undefined) { + elem.innerText = text; + } + if (elem.textContent !== undefined) { + elem.textContent = text; + } +}; + +exports.hasCssClass = function(el, name) { + var classes = el.className.split(/\s+/g); + return classes.indexOf(name) !== -1; +}; + +/** +* Add a CSS class to the list of classes on the given node +*/ +exports.addCssClass = function(el, name) { + if (!exports.hasCssClass(el, name)) { + el.className += " " + name; + } +}; + +/** + * Add or remove a CSS class from the list of classes on the given node + * depending on the value of include + */ +exports.setCssClass = function(node, className, include) { + if (include) { + exports.addCssClass(node, className); + } else { + exports.removeCssClass(node, className); + } +}; + +/** +* Remove a CSS class from the list of classes on the given node +*/ +exports.removeCssClass = function(el, name) { + var classes = el.className.split(/\s+/g); + while (true) { + var index = classes.indexOf(name); + if (index == -1) { + break; + } + classes.splice(index, 1); + } + el.className = classes.join(" "); +}; + +exports.importCssString = function(cssText, doc){ + doc = doc || document; + + if (doc.createStyleSheet) { + var sheet = doc.createStyleSheet(); + sheet.cssText = cssText; + } + else { + var style = doc.createElement("style"); + style.appendChild(doc.createTextNode(cssText)); + doc.getElementsByTagName("head")[0].appendChild(style); + } +}; + +exports.getInnerWidth = function(element) { + return (parseInt(exports.computedStyle(element, "paddingLeft")) + + parseInt(exports.computedStyle(element, "paddingRight")) + element.clientWidth); +}; + +exports.getInnerHeight = function(element) { + return (parseInt(exports.computedStyle(element, "paddingTop")) + + parseInt(exports.computedStyle(element, "paddingBottom")) + element.clientHeight); +}; + +if (window.pageYOffset !== undefined) { + exports.getPageScrollTop = function() { + return window.pageYOffset; + }; + + exports.getPageScrollLeft = function() { + return window.pageXOffset; + }; +} +else { + exports.getPageScrollTop = function() { + return document.body.scrollTop; + }; + + exports.getPageScrollLeft = function() { + return document.body.scrollLeft; + }; +} + +exports.computedStyle = function(element, style) { + if (window.getComputedStyle) { + return (window.getComputedStyle(element, "") || {})[style] || ""; + } + else { + return element.currentStyle[style]; + } +}; + +exports.scrollbarWidth = function() { + + var inner = document.createElement('p'); + inner.style.width = "100%"; + inner.style.height = "200px"; + + var outer = document.createElement("div"); + var style = outer.style; + + style.position = "absolute"; + style.left = "-10000px"; + style.overflow = "hidden"; + style.width = "200px"; + style.height = "150px"; + + outer.appendChild(inner); + document.body.appendChild(outer); + var noScrollbar = inner.offsetWidth; + + style.overflow = "scroll"; + var withScrollbar = inner.offsetWidth; + + if (noScrollbar == withScrollbar) { + withScrollbar = outer.clientWidth; + } + + document.body.removeChild(outer); + + return noScrollbar-withScrollbar; +}; + +/** + * Optimized set innerHTML. This is faster than plain innerHTML if the element + * already contains a lot of child elements. + * + * See http://blog.stevenlevithan.com/archives/faster-than-innerhtml for details + */ +exports.setInnerHtml = function(el, innerHtml) { + var element = el.cloneNode(false);//document.createElement("div"); + element.innerHTML = innerHtml; + el.parentNode.replaceChild(element, el); + return element; +}; + +exports.setInnerText = function(el, innerText) { + if ("textContent" in document.body) + el.textContent = innerText; + else + el.innerText = innerText; + +}; + +exports.getInnerText = function(el) { + if ("textContent" in document.body) + return el.textContent; + else + return el.innerText; +}; + +exports.getParentWindow = function(document) { + return document.defaultView || document.parentWindow; +}; + +exports.getSelectionStart = function(textarea) { + // TODO IE + var start; + try { + start = textarea.selectionStart || 0; + } catch (e) { + start = 0; + } + return start; +}; + +exports.setSelectionStart = function(textarea, start) { + // TODO IE + return textarea.selectionStart = start; +}; + +exports.getSelectionEnd = function(textarea) { + // TODO IE + var end; + try { + end = textarea.selectionEnd || 0; + } catch (e) { + end = 0; + } + return end; +}; + +exports.setSelectionEnd = function(textarea, end) { + // TODO IE + return textarea.selectionEnd = end; +}; + +}); +/* ***** 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 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/keyboard/textinput', function(require, exports, module) { + +var event = require("pilot/event"); +var useragent = require("pilot/useragent"); + +var TextInput = function(parentNode, host) { + + var text = document.createElement("textarea"); + text.style.left = "-10000px"; + parentNode.appendChild(text); + + var PLACEHOLDER = String.fromCharCode(0); + sendText(); + + var inCompostion = false; + var copied = false; + var tempStyle = ''; + + function sendText(valueToSend) { + if (!copied) { + var value = valueToSend || text.value; + if (value) { + if (value.charCodeAt(value.length-1) == PLACEHOLDER.charCodeAt(0)) { + value = value.slice(0, -1); + if (value) + host.onTextInput(value); + } else + host.onTextInput(value); + } + } + copied = false; + + // Safari doesn't fire copy events if no text is selected + text.value = PLACEHOLDER; + text.select(); + } + + var onTextInput = function(e) { + if (useragent.isIE && text.value.charCodeAt(0) > 128) return; + setTimeout(function() { + if (!inCompostion) + sendText(); + }, 0); + }; + + var onCompositionStart = function(e) { + inCompostion = true; + if (!useragent.isIE) { + sendText(); + text.value = ""; + }; + host.onCompositionStart(); + if (!useragent.isGecko) setTimeout(onCompositionUpdate, 0); + }; + + var onCompositionUpdate = function() { + if (!inCompostion) return; + host.onCompositionUpdate(text.value); + }; + + var onCompositionEnd = function() { + inCompostion = false; + host.onCompositionEnd(); + setTimeout(function () { + sendText(); + }, 0); + }; + + var onCopy = function(e) { + copied = true; + var copyText = host.getCopyText(); + if(copyText) + text.value = copyText; + else + e.preventDefault(); + text.select(); + setTimeout(function () { + sendText(); + }, 0); + }; + + var onCut = function(e) { + copied = true; + var copyText = host.getCopyText(); + if(copyText) { + text.value = copyText; + host.onCut(); + } else + e.preventDefault(); + text.select(); + setTimeout(function () { + sendText(); + }, 0); + }; + + event.addCommandKeyListener(text, host.onCommandKey.bind(host)); + event.addListener(text, "keypress", onTextInput); + if (useragent.isIE) { + var keytable = { 13:1, 27:1 }; + event.addListener(text, "keyup", function (e) { + if (inCompostion && (!text.value || keytable[e.keyCode])) + setTimeout(onCompositionEnd, 0); + if ((text.value.charCodeAt(0)|0) < 129) { + return; + }; + inCompostion ? onCompositionUpdate() : onCompositionStart(); + }); + }; + event.addListener(text, "textInput", onTextInput); + event.addListener(text, "paste", function(e) { + // Some browsers support the event.clipboardData API. Use this to get + // the pasted content which increases speed if pasting a lot of lines. + if (e.clipboardData && e.clipboardData.getData) { + sendText(e.clipboardData.getData("text/plain")); + e.preventDefault(); + } else + // If a browser doesn't support any of the things above, use the regular + // method to detect the pasted input. + { + onTextInput(); + } + }); + if (!useragent.isIE) { + event.addListener(text, "propertychange", onTextInput); + }; + + if (useragent.isIE) { + event.addListener(text, "beforecopy", function(e) { + var copyText = host.getCopyText(); + if(copyText) + clipboardData.setData("Text", copyText); + else + e.preventDefault(); + }); + event.addListener(parentNode, "keydown", function(e) { + if (e.ctrlKey && e.keyCode == 88) { + var copyText = host.getCopyText(); + if (copyText) { + clipboardData.setData("Text", copyText); + host.onCut(); + } + event.preventDefault(e) + } + }); + } + else { + event.addListener(text, "copy", onCopy); + event.addListener(text, "cut", onCut); + } + + event.addListener(text, "compositionstart", onCompositionStart); + if (useragent.isGecko) { + event.addListener(text, "text", onCompositionUpdate); + }; + if (useragent.isWebKit) { + event.addListener(text, "keyup", onCompositionUpdate); + }; + event.addListener(text, "compositionend", onCompositionEnd); + + event.addListener(text, "blur", function() { + host.onBlur(); + }); + + event.addListener(text, "focus", function() { + host.onFocus(); + text.select(); + }); + + this.focus = function() { + host.onFocus(); + text.select(); + text.focus(); + }; + + this.blur = function() { + text.blur(); + }; + + this.getElement = function() { + return text; + }; + + this.onContextMenu = function(mousePos, isEmpty){ + if (mousePos) { + if(!tempStyle) + tempStyle = text.style.cssText; + text.style.cssText = 'position:fixed; z-index:1000;' + + 'left:' + (mousePos.x - 2) + 'px; top:' + (mousePos.y - 2) + 'px;' + + } + if (isEmpty) + text.value=''; + } + + this.onContextMenuClose = function(){ + setTimeout(function () { + if (tempStyle) { + text.style.cssText = tempStyle; + tempStyle = ''; + } + sendText(); + }, 0); + } +}; + +exports.TextInput = TextInput; +}); +/* ***** 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 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/mouse_handler', function(require, exports, module) { + +var event = require("pilot/event"); + +var MouseHandler = function(editor) { + this.editor = editor; + event.addListener(editor.container, "mousedown", function(e) { + editor.focus(); + return event.preventDefault(e); + }); + event.addListener(editor.container, "selectstart", function(e) { + return event.preventDefault(e); + }); + + var mouseTarget = editor.renderer.getMouseEventTarget(); + event.addListener(mouseTarget, "mousedown", this.onMouseDown.bind(this)); + event.addMultiMouseDownListener(mouseTarget, 0, 2, 500, this.onMouseDoubleClick.bind(this)); + event.addMultiMouseDownListener(mouseTarget, 0, 3, 600, this.onMouseTripleClick.bind(this)); + event.addMouseWheelListener(mouseTarget, this.onMouseWheel.bind(this)); +}; + +(function() { + + this.$scrollSpeed = 1; + this.setScrollSpeed = function(speed) { + this.$scrollSpeed = speed; + }; + + this.getScrollSpeed = function() { + return this.$scrollSpeed; + }; + + this.onMouseDown = function(e) { + var pageX = event.getDocumentX(e); + var pageY = event.getDocumentY(e); + var editor = this.editor; + + var pos = editor.renderer.screenToTextCoordinates(pageX, pageY); + pos.row = Math.max(0, Math.min(pos.row, editor.session.getLength()-1)); + + var button = event.getButton(e) + if (button != 0) { + var isEmpty = editor.selection.isEmpty() + if (isEmpty) { + editor.moveCursorToPosition(pos); + } + if(button == 2) { + editor.textInput.onContextMenu({x: pageX, y: pageY}, isEmpty); + event.capture(editor.container, function(){}, editor.textInput.onContextMenuClose); + } + return; + } + + if (e.shiftKey) + editor.selection.selectToPosition(pos) + else { + editor.moveCursorToPosition(pos); + if (!editor.$clickSelection) + editor.selection.clearSelection(pos.row, pos.column); + } + + editor.renderer.scrollCursorIntoView(); + + var self = this; + var mousePageX, mousePageY; + + var onMouseSelection = function(e) { + mousePageX = event.getDocumentX(e); + mousePageY = event.getDocumentY(e); + }; + + var onMouseSelectionEnd = function() { + clearInterval(timerId); + self.$clickSelection = null; + }; + + var onSelectionInterval = function() { + if (mousePageX === undefined || mousePageY === undefined) + return; + + var cursor = editor.renderer.screenToTextCoordinates(mousePageX, mousePageY); + cursor.row = Math.max(0, Math.min(cursor.row, editor.session.getLength()-1)); + + if (self.$clickSelection) { + if (self.$clickSelection.contains(cursor.row, cursor.column)) { + editor.selection.setSelectionRange(self.$clickSelection); + } else { + if (self.$clickSelection.compare(cursor.row, cursor.column) == -1) { + var anchor = self.$clickSelection.end; + } else { + var anchor = self.$clickSelection.start; + } + editor.selection.setSelectionAnchor(anchor.row, anchor.column); + editor.selection.selectToPosition(cursor); + } + } + else { + editor.selection.selectToPosition(cursor); + } + + editor.renderer.scrollCursorIntoView(); + }; + + event.capture(editor.container, onMouseSelection, onMouseSelectionEnd); + var timerId = setInterval(onSelectionInterval, 20); + + return event.preventDefault(e); + }; + + this.onMouseDoubleClick = function(e) { + this.editor.selection.selectWord(); + this.$clickSelection = this.editor.getSelectionRange(); + }; + + this.onMouseTripleClick = function(e) { + this.editor.selection.selectLine(); + this.$clickSelection = this.editor.getSelectionRange(); + }; + + this.onMouseWheel = function(e) { + var speed = this.$scrollSpeed * 2; + + this.editor.renderer.scrollBy(e.wheelX * speed, e.wheelY * speed); + return event.preventDefault(e); + }; + + +}).call(MouseHandler.prototype); + +exports.MouseHandler = MouseHandler; +});/* ***** 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 B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Fabian Jakobs + * Julian Viereck + * + * 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/keyboard/keybinding', function(require, exports, module) { + +var useragent = require("pilot/useragent"); +var keyUtil = require("pilot/keys"); +var event = require("pilot/event"); +var settings = require("pilot/settings").settings; +var HashHandler = require("ace/keyboard/hash_handler").HashHandler; +var default_mac = require("ace/keyboard/keybinding/default_mac").bindings; +var default_win = require("ace/keyboard/keybinding/default_win").bindings; +var canon = require("pilot/canon"); +require("ace/commands/default_commands"); + +var KeyBinding = function(editor, config) { + this.$editor = editor; + this.$data = { }; + this.$keyboardHandler = null; + this.$defaulKeyboardHandler = new HashHandler(config || (useragent.isMac + ? default_mac + : default_win)); +}; + +(function() { + this.setKeyboardHandler = function(keyboardHandler) { + if (this.$keyboardHandler != keyboardHandler) { + this.$data = { }; + this.$keyboardHandler = keyboardHandler; + } + }; + + this.getKeyboardHandler = function() { + return this.$keyboardHandler; + }; + + this.$callKeyboardHandler = function (e, hashId, keyOrText, keyCode) { + var toExecute; + if (this.$keyboardHandler) { + toExecute = + this.$keyboardHandler.handleKeyboard(this.$data, hashId, keyOrText, keyCode, e); + } + + // If there is nothing to execute yet, then use the default keymapping. + if (!toExecute || !toExecute.command) { + toExecute = this.$defaulKeyboardHandler. + handleKeyboard(this.$data, hashId, keyOrText, keyCode, e); + } + + if (toExecute) { + var success = canon.exec(toExecute.command, + {editor: this.$editor}, toExecute.args); + if (success) { + return event.stopEvent(e); + } + } + }; + + this.onCommandKey = function(e, hashId, keyCode) { + key = (keyUtil[keyCode] || + String.fromCharCode(keyCode)).toLowerCase(); + + this.$callKeyboardHandler(e, hashId, key, keyCode); + }; + + this.onTextInput = function(text) { + this.$callKeyboardHandler({}, 0, text, 0); + } + +}).call(KeyBinding.prototype); + +exports.KeyBinding = KeyBinding; +}); +/* ***** 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 Mozilla Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Fabian Jakobs + * Julian Viereck (julian.viereck@gmail.com) + * + * 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/keyboard/hash_handler', function(require, exports, module) { + +var keyUtil = require("pilot/keys"); + +function HashHandler(config) { + this.setConfig(config); +} + +(function() { + function splitSafe(s, separator, limit, bLowerCase) { + return (bLowerCase && s.toLowerCase() || s) + .replace(/(?:^\s+|\n|\s+$)/g, "") + .split(new RegExp("[\\s ]*" + separator + "[\\s ]*", "g"), limit || 999); + } + + function parseKeys(keys, val, ret) { + var key, + hashId = 0, + parts = splitSafe(keys, "\\-", null, true), + i = 0, + l = parts.length; + + for (; i < l; ++i) { + if (keyUtil.KEY_MODS[parts[i]]) + hashId = hashId | keyUtil.KEY_MODS[parts[i]]; + else + key = parts[i] || "-"; //when empty, the splitSafe removed a '-' + } + + (ret[hashId] || (ret[hashId] = {}))[key] = val; + return ret; + } + + function objectReverse(obj, keySplit) { + var i, j, l, key, + ret = {}; + for (i in obj) { + key = obj[i]; + if (keySplit && typeof key == "string") { + key = key.split(keySplit); + for (j = 0, l = key.length; j < l; ++j) + parseKeys.call(this, key[j], i, ret); + } + else { + parseKeys.call(this, key, i, ret); + } + } + return ret; + } + + this.setConfig = function(config) { + this.$config = config; + if (typeof this.$config.reverse == "undefined") + this.$config.reverse = objectReverse.call(this, this.$config, "|"); + }; + + /** + * This function is called by keyBinding. + */ + this.handleKeyboard = function(data, hashId, textOrKey, keyCode) { + // Figure out if a commandKey was pressed or just some text was insert. + if (hashId != 0 || keyCode != 0) { + return { + command: (this.$config.reverse[hashId] || {})[textOrKey] + } + } else { + return { + command: "inserttext", + args: { + text: textOrKey + } + } + } + } +}).call(HashHandler.prototype) + +exports.HashHandler = HashHandler; +}); +/* ***** 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 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/keyboard/keybinding/default_mac', function(require, exports, module) { + +exports.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|Ctrl-P", + "copylinesdown": "Command-Option-Down", + "movelinesdown": "Option-Down", + "selecttoend": "Command-Shift-Down", + "gotoend": "Command-End|Command-Down", + "selectdown": "Shift-Down", + "golinedown": "Down|Ctrl-N", + "selectwordleft": "Option-Shift-Left", + "gotowordleft": "Option-Left", + "selecttolinestart": "Command-Shift-Left", + "gotolinestart": "Command-Left|Home|Ctrl-A", + "selectleft": "Shift-Left", + "gotoleft": "Left|Ctrl-B", + "selectwordright": "Option-Shift-Right", + "gotowordright": "Option-Right", + "selecttolineend": "Command-Shift-Right", + "gotolineend": "Command-Right|End|Ctrl-E", + "selectright": "Shift-Right", + "gotoright": "Right|Ctrl-F", + "selectpagedown": "Shift-PageDown", + "pagedown": "PageDown", + "gotopagedown": "Option-PageDown|Ctrl-V", + "selectpageup": "Shift-PageUp", + "pageup": "PageUp", + "gotopageup": "Option-PageUp", + "selectlinestart": "Shift-Home", + "selectlineend": "Shift-End", + "del": "Delete|Ctrl-D", + "backspace": "Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H", + "removetolineend": "Ctrl-K", + "removetolinestart": "Option-Backspace", + "removewordleft": "Alt-Backspace|Ctrl-Alt-Backspace", + "removewordright": "Alt-Delete", + "outdent": "Shift-Tab", + "indent": "Tab", + "transposeletters": "Ctrl-T", + "splitline": "Ctrl-O", + "centerselection": "Ctrl-L" +}; + +});/* ***** 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 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/keyboard/keybinding/default_win', function(require, exports, module) { + +exports.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", + "golinedown": "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", + "gotopagedown": "PageDown", + "selectpageup": "Shift-PageUp", + "gotopageup": "PageUp", + "selectlinestart": "Shift-Home", + "selectlineend": "Shift-End", + "del": "Delete", + "backspace": "Ctrl-Backspace|Command-Backspace|Option-Backspace|Shift-Backspace|Backspace", + "outdent": "Shift-Tab", + "indent": "Tab" +}; + +}); +/* ***** 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 B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Fabian Jakobs + * Julian Viereck + * + * 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/commands/default_commands', function(require, exports, module) { + +var lang = require("pilot/lang"); +var canon = require("pilot/canon"); + +canon.addCommand({ + name: "null", + exec: function(env, args, request) { } +}); + +canon.addCommand({ + name: "selectall", + exec: function(env, args, request) { env.editor.selectAll(); } +}); +canon.addCommand({ + name: "removeline", + exec: function(env, args, request) { env.editor.removeLines(); } +}); +canon.addCommand({ + name: "gotoline", + exec: function(env, args, request) { + var line = parseInt(prompt("Enter line number:")); + if (!isNaN(line)) { + env.editor.gotoLine(line); + } + } +}); +canon.addCommand({ + name: "togglecomment", + exec: function(env, args, request) { env.editor.toggleCommentLines(); } +}); +canon.addCommand({ + name: "findnext", + exec: function(env, args, request) { env.editor.findNext(); } +}); +canon.addCommand({ + name: "findprevious", + exec: function(env, args, request) { env.editor.findPrevious(); } +}); +canon.addCommand({ + name: "find", + exec: function(env, args, request) { + var needle = prompt("Find:"); + env.editor.find(needle); + } +}); +canon.addCommand({ + name: "undo", + exec: function(env, args, request) { env.editor.undo(); } +}); +canon.addCommand({ + name: "redo", + exec: function(env, args, request) { env.editor.redo(); } +}); +canon.addCommand({ + name: "redo", + exec: function(env, args, request) { env.editor.redo(); } +}); +canon.addCommand({ + name: "overwrite", + exec: function(env, args, request) { env.editor.toggleOverwrite(); } +}); +canon.addCommand({ + name: "copylinesup", + exec: function(env, args, request) { env.editor.copyLinesUp(); } +}); +canon.addCommand({ + name: "movelinesup", + exec: function(env, args, request) { env.editor.moveLinesUp(); } +}); +canon.addCommand({ + name: "selecttostart", + exec: function(env, args, request) { env.editor.getSelection().selectFileStart(); } +}); +canon.addCommand({ + name: "gotostart", + exec: function(env, args, request) { env.editor.navigateFileStart(); } +}); +canon.addCommand({ + name: "selectup", + exec: function(env, args, request) { env.editor.getSelection().selectUp(); } +}); +canon.addCommand({ + name: "golineup", + exec: function(env, args, request) { env.editor.navigateUp(args.times); } +}); +canon.addCommand({ + name: "copylinesdown", + exec: function(env, args, request) { env.editor.copyLinesDown(); } +}); +canon.addCommand({ + name: "movelinesdown", + exec: function(env, args, request) { env.editor.moveLinesDown(); } +}); +canon.addCommand({ + name: "selecttoend", + exec: function(env, args, request) { env.editor.getSelection().selectFileEnd(); } +}); +canon.addCommand({ + name: "gotoend", + exec: function(env, args, request) { env.editor.navigateFileEnd(); } +}); +canon.addCommand({ + name: "selectdown", + exec: function(env, args, request) { env.editor.getSelection().selectDown(); } +}); +canon.addCommand({ + name: "golinedown", + exec: function(env, args, request) { env.editor.navigateDown(args.times); } +}); +canon.addCommand({ + name: "selectwordleft", + exec: function(env, args, request) { env.editor.getSelection().selectWordLeft(); } +}); +canon.addCommand({ + name: "gotowordleft", + exec: function(env, args, request) { env.editor.navigateWordLeft(); } +}); +canon.addCommand({ + name: "selecttolinestart", + exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); } +}); +canon.addCommand({ + name: "gotolinestart", + exec: function(env, args, request) { env.editor.navigateLineStart(); } +}); +canon.addCommand({ + name: "selectleft", + exec: function(env, args, request) { env.editor.getSelection().selectLeft(); } +}); +canon.addCommand({ + name: "gotoleft", + exec: function(env, args, request) { env.editor.navigateLeft(args.times); } +}); +canon.addCommand({ + name: "selectwordright", + exec: function(env, args, request) { env.editor.getSelection().selectWordRight(); } +}); +canon.addCommand({ + name: "gotowordright", + exec: function(env, args, request) { env.editor.navigateWordRight(); } +}); +canon.addCommand({ + name: "selecttolineend", + exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); } +}); +canon.addCommand({ + name: "gotolineend", + exec: function(env, args, request) { env.editor.navigateLineEnd(); } +}); +canon.addCommand({ + name: "selectright", + exec: function(env, args, request) { env.editor.getSelection().selectRight(); } +}); +canon.addCommand({ + name: "gotoright", + exec: function(env, args, request) { env.editor.navigateRight(args.times); } +}); +canon.addCommand({ + name: "selectpagedown", + exec: function(env, args, request) { env.editor.selectPageDown(); } +}); +canon.addCommand({ + name: "pagedown", + exec: function(env, args, request) { env.editor.scrollPageDown(); } +}); +canon.addCommand({ + name: "gotopagedown", + exec: function(env, args, request) { env.editor.gotoPageDown(); } +}); +canon.addCommand({ + name: "selectpageup", + exec: function(env, args, request) { env.editor.selectPageUp(); } +}); +canon.addCommand({ + name: "pageup", + exec: function(env, args, request) { env.editor.scrollPageUp(); } +}); +canon.addCommand({ + name: "gotopageup", + exec: function(env, args, request) { env.editor.gotoPageUp(); } +}); +canon.addCommand({ + name: "selectlinestart", + exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); } +}); +canon.addCommand({ + name: "gotolinestart", + exec: function(env, args, request) { env.editor.navigateLineStart(); } +}); +canon.addCommand({ + name: "selectlineend", + exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); } +}); +canon.addCommand({ + name: "gotolineend", + exec: function(env, args, request) { env.editor.navigateLineEnd(); } +}); +canon.addCommand({ + name: "del", + exec: function(env, args, request) { env.editor.removeRight(); } +}); +canon.addCommand({ + name: "backspace", + exec: function(env, args, request) { env.editor.removeLeft(); } +}); +canon.addCommand({ + name: "removetolinestart", + exec: function(env, args, request) { env.editor.removeToLineStart(); } +}); +canon.addCommand({ + name: "removetolineend", + exec: function(env, args, request) { env.editor.removeToLineEnd(); } +}); +canon.addCommand({ + name: "removewordleft", + exec: function(env, args, request) { env.editor.removeWordLeft(); } +}); +canon.addCommand({ + name: "removewordright", + exec: function(env, args, request) { env.editor.removeWordRight(); } +}); +canon.addCommand({ + name: "outdent", + exec: function(env, args, request) { env.editor.blockOutdent(); } +}); +canon.addCommand({ + name: "indent", + exec: function(env, args, request) { env.editor.indent(); } +}); +canon.addCommand({ + name: "inserttext", + exec: function(env, args, request) { + env.editor.insert(lang.stringRepeat(args.text || "", args.times || 1)); + } +}); +canon.addCommand({ + name: "centerselection", + exec: function(env, args, request) { env.editor.centerSelection(); } +}); +canon.addCommand({ + name: "splitline", + exec: function(env, args, request) { env.editor.splitLine(); } +}); +canon.addCommand({ + name: "transposeletters", + exec: function(env, args, request) { env.editor.transposeLetters(); } +}); + + +}); +/* ***** 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 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/edit_session', function(require, exports, module) { + +var oop = require("pilot/oop"); +var lang = require("pilot/lang"); +var EventEmitter = require("pilot/event_emitter").EventEmitter; +var Selection = require("ace/selection").Selection; +var TextMode = require("ace/mode/text").Mode; +var Range = require("ace/range").Range; +var Document = require("ace/document").Document; + +var NO_CHANGE_DELTAS = {}; + +var EditSession = function(text, mode) { + this.$modified = true; + this.$breakpoints = []; + this.$frontMarkers = {}; + this.$backMarkers = {}; + this.$markerId = 1; + this.$wrapData = []; + this.listeners = []; + + if (text instanceof Document) { + this.setDocument(text); + } else { + this.setDocument(new Document(text)); + } + + this.selection = new Selection(this); + if (mode) + this.setMode(mode); +}; + + +(function() { + + oop.implement(this, EventEmitter); + + this.setDocument = function(doc) { + if (this.doc) + throw new Error("Document is already set"); + + this.doc = doc; + doc.on("change", this.onChange.bind(this)); + }; + + this.getDocument = function() { + return this.doc; + }; + + this.onChange = function(e) { + var delta = e.data; + this.$modified = true; + if (!this.$fromUndo && this.$undoManager) { + this.$deltas.push(delta); + this.$informUndoManager.schedule(); + } + + this.$updateWrapDataOnChange(e); + this._dispatchEvent("change", e); + }; + + this.setValue = function(text) { + this.doc.setValue(text); + this.$deltas = []; + }; + + this.getValue = + this.toString = function() { + return this.doc.getValue(); + }; + + this.getSelection = function() { + return this.selection; + }; + + this.setUndoManager = function(undoManager) { + this.$undoManager = undoManager; + this.$deltas = []; + + if (this.$informUndoManager) { + this.$informUndoManager.cancel(); + } + + if (undoManager) { + var self = this; + this.$informUndoManager = lang.deferredCall(function() { + if (self.$deltas.length > 0) + undoManager.execute({ + action : "aceupdate", + args : [self.$deltas, self] + }); + self.$deltas = []; + }); + } + }; + + this.$defaultUndoManager = { + undo: function() {}, + redo: function() {} + }; + + this.getUndoManager = function() { + return this.$undoManager || this.$defaultUndoManager; + }, + + this.getTabString = function() { + if (this.getUseSoftTabs()) { + return lang.stringRepeat(" ", this.getTabSize()); + } else { + return "\t"; + } + }; + + this.$useSoftTabs = true; + this.setUseSoftTabs = function(useSoftTabs) { + if (this.$useSoftTabs === useSoftTabs) return; + + this.$useSoftTabs = useSoftTabs; + }; + + this.getUseSoftTabs = function() { + return this.$useSoftTabs; + }; + + this.$tabSize = 4; + this.setTabSize = function(tabSize) { + if (isNaN(tabSize) || this.$tabSize === tabSize) return; + + this.$modified = true; + this.$tabSize = tabSize; + this._dispatchEvent("changeTabSize"); + }; + + this.getTabSize = function() { + return this.$tabSize; + }; + + this.isTabStop = function(position) { + return this.$useSoftTabs && (position.column % this.$tabSize == 0); + }; + + this.getBreakpoints = function() { + return this.$breakpoints; + }; + + this.setBreakpoints = function(rows) { + this.$breakpoints = []; + for (var i=0; i 0) { + inToken = !!line.charAt(column - 1).match(this.tokenRe); + } + + if (!inToken) { + inToken = !!line.charAt(column).match(this.tokenRe); + } + + var re = inToken ? this.tokenRe : this.nonTokenRe; + + var start = column; + if (start > 0) { + do { + start--; + } + while (start >= 0 && line.charAt(start).match(re)); + start++; + } + + var end = column; + while (end < line.length && line.charAt(end).match(re)) { + end++; + } + + return new Range(row, start, row, end); + }; + + this.setNewLineMode = function(newLineMode) { + this.doc.setNewLineMode(newLineMode); + }; + + this.getNewLineMode = function() { + return this.doc.getNewLineMode(); + }; + + this.$mode = null; + this.setMode = function(mode) { + if (this.$mode === mode) return; + + if (this.$worker) + this.$worker.terminate(); + + if (window.Worker) + this.$worker = mode.createWorker(this); + else + this.$worker = null; + + this.$mode = mode; + this._dispatchEvent("changeMode"); + }; + + this.getMode = function() { + if (!this.$mode) { + this.$mode = new TextMode(); + } + return this.$mode; + }; + + this.$scrollTop = 0; + this.setScrollTopRow = function(scrollTopRow) { + if (this.$scrollTop === scrollTopRow) return; + + this.$scrollTop = scrollTopRow; + this._dispatchEvent("changeScrollTop"); + }; + + this.getScrollTopRow = function() { + return this.$scrollTop; + }; + + this.getWidth = function() { + this.$computeWidth(); + return this.width; + }; + + this.getScreenWidth = function() { + this.$computeWidth(); + return this.screenWidth; + }; + + this.$computeWidth = function(force) { + if (this.$modified || force) { + this.$modified = false; + + var lines = this.doc.getAllLines(); + var longestLine = 0; + var longestScreenLine = 0; + var tabSize = this.getTabSize(); + + for ( var i = 0; i < lines.length; i++) { + var len = lines[i].length; + longestLine = Math.max(longestLine, len); + + lines[i].replace(/\t/g, function(m) { + len += tabSize-1; + return m; + }); + longestScreenLine = Math.max(longestScreenLine, len); + } + this.width = longestLine; + + if (this.$useWrapMode) { + this.screenWidth = this.$wrapLimit; + } else { + this.screenWidth = longestScreenLine; + } + } + }; + + /** + * Get a verbatim copy of the given line as it is in the document + */ + this.getLine = function(row) { + return this.doc.getLine(row); + }; + + /** + * Get a line as it is displayed on screen. Tabs are replaced by spaces. + */ + this.getDisplayLine = function(row) { + var tab = new Array(this.getTabSize()+1).join(" "); + return this.doc.getLine(row).replace(/\t/g, tab); + }; + + this.getLines = function(firstRow, lastRow) { + return this.doc.getLines(firstRow, lastRow); + }; + + this.getLength = function() { + return this.doc.getLength(); + }; + + this.getTextRange = function(range) { + return this.doc.getTextRange(range); + }; + + this.findMatchingBracket = function(position) { + if (position.column == 0) return null; + + var charBeforeCursor = this.getLine(position.row).charAt(position.column-1); + if (charBeforeCursor == "") return null; + + var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/); + if (!match) { + return null; + } + + if (match[1]) { + return this.$findClosingBracket(match[1], position); + } else { + return this.$findOpeningBracket(match[2], position); + } + }; + + this.$brackets = { + ")": "(", + "(": ")", + "]": "[", + "[": "]", + "{": "}", + "}": "{" + }; + + this.$findOpeningBracket = function(bracket, position) { + var openBracket = this.$brackets[bracket]; + + var column = position.column - 2; + var row = position.row; + var depth = 1; + + var line = this.getLine(row); + + while (true) { + while(column >= 0) { + var ch = line.charAt(column); + if (ch == openBracket) { + depth -= 1; + if (depth == 0) { + return {row: row, column: column}; + } + } + else if (ch == bracket) { + depth +=1; + } + column -= 1; + } + row -=1; + if (row < 0) break; + + var line = this.getLine(row); + var column = line.length-1; + } + return null; + }; + + this.$findClosingBracket = function(bracket, position) { + var closingBracket = this.$brackets[bracket]; + + var column = position.column; + var row = position.row; + var depth = 1; + + var line = this.getLine(row); + var lineCount = this.getLength(); + + while (true) { + while(column < line.length) { + var ch = line.charAt(column); + if (ch == closingBracket) { + depth -= 1; + if (depth == 0) { + return {row: row, column: column}; + } + } + else if (ch == bracket) { + depth +=1; + } + column += 1; + } + row +=1; + if (row >= lineCount) break; + + var line = this.getLine(row); + var column = 0; + } + return null; + }; + + this.insert = function(position, text) { + return this.doc.insert(position, text); + }; + + this.remove = function(range) { + return this.doc.remove(range); + }; + + this.undoChanges = function(deltas) { + if (!deltas.length) + return; + + this.$fromUndo = true; + this.doc.revertDeltas(deltas); + this.$fromUndo = false; + + // update the selection + var firstDelta = deltas[0]; + var lastDelta = deltas[deltas.length-1]; + + this.selection.clearSelection(); + if (firstDelta.action == "insertText" || firstDelta.action == "insertLines") + this.selection.moveCursorToPosition(firstDelta.range.start); + if (firstDelta.action == "removeText" || firstDelta.action == "removeLines") + this.selection.setSelectionRange(Range.fromPoints(lastDelta.range.start, firstDelta.range.end)); + }, + + this.redoChanges = function(deltas) { + if (!deltas.length) + return; + + this.$fromUndo = true; + this.doc.applyDeltas(deltas); + this.$fromUndo = false; + + // update the selection + var firstDelta = deltas[0]; + var lastDelta = deltas[deltas.length-1]; + + this.selection.clearSelection(); + if (firstDelta.action == "insertText" || firstDelta.action == "insertLines") + this.selection.setSelectionRange(Range.fromPoints(firstDelta.range.start, lastDelta.range.end)); + if (firstDelta.action == "removeText" || firstDelta.action == "removeLines") + this.selection.moveCursorToPosition(lastDelta.range.start); + }, + + this.replace = function(range, text) { + return this.doc.replace(range, text); + }; + + this.indentRows = function(startRow, endRow, indentString) { + indentString = indentString.replace(/\t/g, this.getTabString()); + for (var row=startRow; row<=endRow; row++) { + this.insert({row: row, column:0}, indentString); + } + }; + + this.outdentRows = function (range) { + var rowRange = range.collapseRows(); + var deleteRange = new Range(0, 0, 0, 0); + var size = this.getTabSize(); + + for (var i = rowRange.start.row; i <= rowRange.end.row; ++i) { + var line = this.getLine(i); + + deleteRange.start.row = i; + deleteRange.end.row = i; + for (var j = 0; j < size; ++j) + if (line.charAt(j) != ' ') + break; + if (j < size && line.charAt(j) == '\t') { + deleteRange.start.column = j; + deleteRange.end.column = j + 1; + } else { + deleteRange.start.column = 0; + deleteRange.end.column = j; + } + this.remove(deleteRange); + } + }; + + this.moveLinesUp = function(firstRow, lastRow) { + if (firstRow <= 0) return 0; + + var removed = this.doc.removeLines(firstRow, lastRow); + this.doc.insertLines(firstRow - 1, removed); + return -1; + }; + + this.moveLinesDown = function(firstRow, lastRow) { + if (lastRow >= this.doc.getLength()-1) return 0; + + var removed = this.doc.removeLines(firstRow, lastRow); + this.doc.insertLines(firstRow+1, removed); + return 1; + }; + + this.duplicateLines = function(firstRow, lastRow) { + var firstRow = this.$clipRowToDocument(firstRow); + var lastRow = this.$clipRowToDocument(lastRow); + + var lines = this.getLines(firstRow, lastRow); + this.doc.insertLines(firstRow, lines); + + var addedRows = lastRow - firstRow + 1; + return addedRows; + }; + + this.$clipRowToDocument = function(row) { + return Math.max(0, Math.min(row, this.doc.getLength()-1)); + }; + + // WRAPMODE + this.$wrapLimit = 80; + this.$useWrapMode = false; + this.$wrapLimitRange = { + min : null, + max : null + }; + + this.setUseWrapMode = function(useWrapMode) { + if (useWrapMode != this.$useWrapMode) { + this.$useWrapMode = useWrapMode; + this.$modified = true; + + // If wrapMode is activaed, the wrapData array has to be initialized. + if (useWrapMode) { + var len = this.getLength(); + this.$wrapMode = []; + for (i = 0; i < len; i++) { + this.$wrapData.push([]); + } + this.$updateWrapData(0, len - 1); + } + + this._dispatchEvent("changeWrapMode"); + } + }; + + this.getUseWrapMode = function() { + return this.$useWrapMode; + }; + + // Allow the wrap limit to move freely between min and max. Either + // parameter can be null to allow the wrap limit to be unconstrained + // in that direction. Or set both parameters to the same number to pin + // the limit to that value. + this.setWrapLimitRange = function(min, max) { + if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) { + this.$wrapLimitRange.min = min; + this.$wrapLimitRange.max = max; + this.$modified = true; + // This will force a recalculation of the wrap limit + this._dispatchEvent("changeWrapMode"); + } + }; + + // This should generally only be called by the renderer when a resize + // is detected. + this.adjustWrapLimit = function(desiredLimit) { + var wrapLimit = this.$constrainWrapLimit(desiredLimit); + if (wrapLimit != this.$wrapLimit && wrapLimit > 0) { + this.$wrapLimit = wrapLimit; + this.$modified = true; + if (this.$useWrapMode) { + this.$updateWrapData(0, this.getLength() - 1); + this._dispatchEvent("changeWrapLimit"); + } + return true; + } + return false; + }; + + this.$constrainWrapLimit = function(wrapLimit) { + var min = this.$wrapLimitRange.min; + if (min) + wrapLimit = Math.max(min, wrapLimit); + + var max = this.$wrapLimitRange.max; + if (max) + wrapLimit = Math.min(max, wrapLimit); + + // What would a limit of 0 even mean? + return Math.max(1, wrapLimit); + }; + + this.getWrapLimit = function() { + return this.$wrapLimit; + }; + + this.getWrapLimitRange = function() { + // Avoid unexpected mutation by returning a copy + return { + min : this.$wrapLimitRange.min, + max : this.$wrapLimitRange.max + }; + }; + + this.$updateWrapDataOnChange = function(e) { + if (!this.$useWrapMode) { + return; + } + + var len; + var action = e.data.action; + var firstRow = e.data.range.start.row, + lastRow = e.data.range.end.row; + + if (action.indexOf("Lines") != -1) { + if (action == "insertLines") { + lastRow = firstRow + (e.data.lines.length); + } else { + lastRow = firstRow; + } + len = e.data.lines.length; + } else { + len = lastRow - firstRow; + } + + if (len != 0) { + if (action.indexOf("remove") != -1) { + this.$wrapData.splice(firstRow, len); + lastRow = firstRow; + } else { + var args = [firstRow, 0]; + for (var i = 0; i < len; i++) args.push([]); + this.$wrapData.splice.apply(this.$wrapData, args); + } + } + + if (this.$wrapData.length != this.doc.$lines.length) { + console.error("The length of doc.$lines and $wrapData have to be the same!"); + } + + this.$updateWrapData(firstRow, lastRow); + }; + + this.$updateWrapData = function(firstRow, lastRow) { + var lines = this.doc.getAllLines(); + var tabSize = this.getTabSize(); + var wrapData = this.$wrapData; + var wrapLimit = this.$wrapLimit; + + for (var row = firstRow; row <= lastRow; row++) { + wrapData[row] = + this.$computeWrapSplits(lines[row], wrapLimit, tabSize); + } + }; + + // "Tokens" + var CHAR = 1, + CHAR_EXT = 2, + SPACE = 3, + TAB = 4, + TAB_SPACE = 5; + + this.$computeWrapSplits = function(textLine, wrapLimit, tabSize) { + textLine = textLine.trimRight(); + if (textLine.length == 0) { + return []; + } + + var tabSize = this.getTabSize(); + var splits = []; + var tokens = this.$getDisplayTokens(textLine); + var displayLength = tokens.length; + var lastSplit = 0, lastDocSplit = 0; + + function addSplit(screenPos) { + var displayed = tokens.slice(lastSplit, screenPos); + + // The document size is the current size - the extra width for tabs + // and multipleWidth characters. + var len = displayed.length; + displayed.join(""). + // Get all the tabs. + replace(/4/g, function(m) { + len -= tabSize - 1; + }). + // Get all the multipleWidth characters. + replace(/2/g, function(m) { + len -= 1; + }); + + lastDocSplit += len; + splits.push(lastDocSplit); + lastSplit = screenPos; + } + + while (displayLength - lastSplit > wrapLimit) { + // This is, where the split should be. + var split = lastSplit + wrapLimit; + + // If there is a space or tab at this split position. + if (tokens[split] >= SPACE) { + // Include all following spaces + tabs in this split as well. + while (tokens[split] >= SPACE) { + split ++; + } + addSplit(split); + } else { + // Search for the first non space/tab token. + for (split; split != lastSplit - 1; split--) { + if (tokens[split] >= SPACE) { + split++; + break; + } + } + // If we found one, then add the split. + if (split > lastSplit) { + addSplit(split); + } + // No space or tab around? Well, force a split then. + else { + addSplit(lastSplit + wrapLimit); + } + } + } + return splits; + } + + this.$getDisplayTokens = function(str) { + var arr = []; + var tabSize = this.getTabSize(); + + for (var i = 0; i < str.length; i++) { + var c = str.charCodeAt(i); + // Tab + if (c == 9) { + arr.push(TAB); + for (var n = 1; n < tabSize; n++) { + arr.push(TAB_SPACE); + } + } + // Space + else if(c == 32) { + arr.push(SPACE); + } + // CJK characters + else if ( + c >= 0x3040 && c <= 0x309F || // Hiragana + c >= 0x30A0 && c <= 0x30FF || // Katakana + c >= 0x4E00 && c <= 0x9FFF || // Single CJK ideographs + c >= 0xF900 && c <= 0xFAFF || + c >= 0x3400 && c <= 0x4DBF + ) { + arr.push(CHAR, CHAR_EXT); + } else { + arr.push(CHAR); + } + } + return arr; + } + + /** + * Calculates the width of the a string on the screen while assuming that + * the string starts at the first column on the screen. + * + * @param string str String to calculate the screen width of + * @return int number of columns for str on screen. + */ + this.$getStringScreenWidth = function(str) { + var screenColumn = 0; + var tabSize = this.getTabSize(); + + for (var i=0; i= 0x3040 && c <= 0x309F || // Hiragana + c >= 0x30A0 && c <= 0x30FF || // Katakana + c >= 0x4E00 && c <= 0x9FFF || // Single CJK ideographs + c >= 0xF900 && c <= 0xFAFF || + c >= 0x3400 && c <= 0x4DBF + ) { + screenColumn += 2; + } else { + screenColumn += 1; + } + } + + return screenColumn; + } + + this.getRowHeight = function(config, row) { + var rows; + if (!this.$useWrapMode || !this.$wrapData[row]) { + rows = 1; + } else { + rows = this.$wrapData[row].length + 1; + } + + return rows * config.lineHeight; + } + + this.getScreenLastRowColumn = function(screenRow, returnDocPosition) { + if (!this.$useWrapMode) { + return this.$getStringScreenWidth(this.getLine(screenRow)); + } + + var rowData = this.$screenToDocumentRow(screenRow); + var docRow = rowData[0], + row = rowData[1]; + + var start, end; + if (this.$wrapData[docRow][row]) { + start = (this.$wrapData[docRow][row - 1] || 0); + end = this.$wrapData[docRow][row]; + returnDocPosition && end--; + } else { + end = this.getLine(docRow).length; + start = (this.$wrapData[docRow][row - 1] || 0); + } + if (!returnDocPosition) { + return this.$getStringScreenWidth(this.getLine(docRow).substring(start, end)); + } else { + return end; + } + }; + + this.getDocumentLastRowColumn = function(docRow, docColumn) { + if (!this.$useWrapMode) { + return this.getLine(docRow).length; + } + + var screenRow = this.documentToScreenRow(docRow, docColumn); + return this.getScreenLastRowColumn(screenRow, true); + } + + this.getScreenFirstRowColumn = function(screenRow) { + if (!this.$useWrapMode) { + return 0; + } + + var rowData = this.$screenToDocumentRow(screenRow); + var docRow = rowData[0], + row = rowData[1]; + + return this.$wrapData[docRow][row - 1] || 0; + }; + + this.getRowSplitData = function(row) { + if (!this.$useWrapMode) { + return undefined; + } else { + return this.$wrapData[row]; + } + }; + + /** + * + * @returns array + * - array[0]: The documentRow equivalent. + * - array[1]: The screenRowOffset to the first documentRow on the screen. + */ + this.$screenToDocumentRow = function(row) { + if (!this.$useWrapMode) { + return [row, 0]; + } + + var wrapData = this.$wrapData, linesCount = this.getLength(); + var docRow = 0; + while (docRow < linesCount && row >= wrapData[docRow].length + 1) { + row -= wrapData[docRow].length + 1; + docRow ++; + } + + return [docRow, row]; + }; + + this.screenToDocumentRow = function(screenRow) { + return this.$screenToDocumentRow(screenRow)[0]; + }; + + this.screenToDocumentColumn = function(screenRow, screenColumn) { + return this.screenToDocumentPosition(screenRow, screenColumn).column; + }; + + this.screenToDocumentPosition = function(row, column) { + var line; + var docRow; + var docColumn; + var remaining = column; + var linesCount = this.getLength(); + if (!this.$useWrapMode) { + docRow = row >= linesCount? linesCount-1 : (row < 0 ? 0 : row); + row = 0; + docColumn = 0; + line = this.getLine(docRow); + } else { + var wrapData = this.$wrapData; + + var docRow = 0; + while (docRow < linesCount && row >= wrapData[docRow].length + 1) { + row -= wrapData[docRow].length + 1; + docRow ++; + } + + if (docRow >= linesCount) { + docRow = linesCount-1 + row = wrapData[docRow].length; + } + docColumn = wrapData[docRow][row - 1] || 0; + line = this.getLine(docRow).substring(docColumn); + } + + var tabSize = this.getTabSize(); + for(var i = 0; i < line.length; i++) { + var c = line.charCodeAt(i); + + if (remaining > 0) { + docColumn += 1; + // tab + if (c == 9) { + if (remaining >= tabSize) { + remaining -= tabSize; + } else { + remaining = 0; + docColumn -= 1; + } + } + // CJK characters + else if ( + c >= 0x3040 && c <= 0x309F || // Hiragana + c >= 0x30A0 && c <= 0x30FF || // Katakana + c >= 0x4E00 && c <= 0x9FFF || // Single CJK ideographs + c >= 0xF900 && c <= 0xFAFF || + c >= 0x3400 && c <= 0x4DBF + ) { + if (remaining >= 2) { + remaining -= 2; + } else { + remaining = 0; + docColumn -= 1; + } + } else { + remaining -= 1; + } + } else { + break; + } + } + + // Clamp docColumn. + if (this.$useWrapMode) { + column = wrapData[docRow][row] + if (docColumn >= column) { + // We remove one character at the end such that the docColumn + // position returned is not associated to the next row on the + // screen. + docColumn = column - 1; + } + } else if (line) { + docColumn = Math.min(docColumn, line.length); + } + + return { + row: docRow, + column: docColumn + }; + }; + + this.documentToScreenColumn = function(row, docColumn) { + return this.documentToScreenPosition(row, docColumn).column; + }; + + /** + * + * @return array[2] + * - array[0]: The number of the row on the screen (aka screenRow) + * - array[1]: The number of rows from the first docRow on the screen + * (aka screenRowOffset); + */ + this.$documentToScreenRow = function(docRow, docColumn) { + if (!this.$useWrapMode) { + return [docRow, 0]; + } + + var wrapData = this.$wrapData; + var screenRow = 0; + + // Handle special case where the row is outside of the range of lines. + if (docRow > wrapData.length - 1) { + return [ + this.getScreenLength(), + wrapData.length == 0 ? 0 : (wrapData[wrapData.length - 1].length - 1) + ]; + } + + for (var i = 0; i < docRow; i++) { + screenRow += wrapData[i].length + 1; + } + + var screenRowOffset = 0; + while (docColumn >= wrapData[docRow][screenRowOffset]) { + screenRow ++; + screenRowOffset++; + } + + return [screenRow, screenRowOffset]; + } + + this.documentToScreenRow = function(docRow, docColumn) { + return this.$documentToScreenRow(docRow, docColumn)[0]; + } + + this.documentToScreenPosition = function(pos, column) { + var str; + var tabSize = this.getTabSize(); + + // Normalize the passed in arguments. + var row; + if (column != null) { + row = pos; + } else { + row = pos.row; + column = pos.column; + } + + if (!this.$useWrapMode) { + str = this.getLine(row).substring(0, column); + column = this.$getStringScreenWidth(str); + return { + row: row, + column: column + }; + } + + var rowData = this.$documentToScreenRow(row, column); + var screenRow = rowData[0]; + + if (row >= this.getLength()) { + return { + row: screenRow, + column: 0 + }; + } + + var split; + var wrapRowData = this.$wrapData[row]; + var screenColumn; + var screenRowOffset = rowData[1]; + + str = this.getLine(row).substring( + wrapRowData[screenRowOffset - 1] || 0, column); + screenColumn = this.$getStringScreenWidth(str); + + return { + row: screenRow, + column: screenColumn + }; + }; + + this.getScreenLength = function() { + if (!this.$useWrapMode) { + return this.getLength(); + } + + var screenRows = 0; + for (var row = 0; row < this.$wrapData.length; row++) { + screenRows += this.$wrapData[row].length + 1; + } + return screenRows; + } + +}).call(EditSession.prototype); + +exports.EditSession = EditSession; +});/* ***** 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 B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Fabian Jakobs + * Julian Viereck + * + * 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/selection', function(require, exports, module) { + +var oop = require("pilot/oop"); +var lang = require("pilot/lang"); +var EventEmitter = require("pilot/event_emitter").EventEmitter; +var Range = require("ace/range").Range; +var Anchor = require("ace/anchor").Anchor; + +var Selection = function(session) { + this.session = session; + this.doc = session.getDocument(); + + this.clearSelection(); + this.selectionLead = new Anchor(this.doc, 0, 0); + this.selectionAnchor = new Anchor(this.doc, 0, 0); + + var _self = this; + this.selectionLead.on("change", function(e) { + _self._dispatchEvent("changeCursor"); + if (!_self.$isEmpty) + _self._dispatchEvent("changeSelection"); + if (e.old.row == e.value.row) + _self.$updateDesiredColumn(); + }); + + this.selectionAnchor.on("change", function() { + if (!_self.$isEmpty) + _self._dispatchEvent("changeSelection"); + }); +}; + +(function() { + + oop.implement(this, EventEmitter); + + this.isEmpty = function() { + return (this.$isEmpty || ( + this.selectionAnchor.row == this.selectionLead.row && + this.selectionAnchor.column == this.selectionLead.column + )); + }; + + this.isMultiLine = function() { + if (this.isEmpty()) { + return false; + } + + return this.getRange().isMultiLine(); + }; + + this.getCursor = function() { + return this.selectionLead.getPosition(); + }; + + this.setSelectionAnchor = function(row, column) { + this.selectionAnchor.setPosition(row, column); + + if (this.$isEmpty) { + this.$isEmpty = false; + this._dispatchEvent("changeSelection"); + } + }; + + this.getSelectionAnchor = function() { + if (this.$isEmpty) + return this.getSelectionLead() + else + return this.selectionAnchor.getPosition(); + }; + + this.getSelectionLead = function() { + return this.selectionLead.getPosition(); + }; + + this.shiftSelection = function(columns) { + if (this.$isEmpty) { + this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + columns); + return; + }; + + var anchor = this.getSelectionAnchor(); + var lead = this.getSelectionLead(); + + var isBackwards = this.isBackwards(); + + if (!isBackwards || anchor.column !== 0) + this.setSelectionAnchor(anchor.row, anchor.column + columns); + + if (isBackwards || lead.column !== 0) { + this.$moveSelection(function() { + this.moveCursorTo(lead.row, lead.column + columns); + }); + } + }; + + this.isBackwards = function() { + var anchor = this.selectionAnchor; + var lead = this.selectionLead; + return (anchor.row > lead.row || (anchor.row == lead.row && anchor.column > lead.column)); + }; + + this.getRange = function() { + var anchor = this.selectionAnchor; + var lead = this.selectionLead; + + if (this.isEmpty()) + return Range.fromPoints(lead, lead); + + if (this.isBackwards()) { + return Range.fromPoints(lead, anchor); + } + else { + return Range.fromPoints(anchor, lead); + } + }; + + this.clearSelection = function() { + if (!this.$isEmpty) { + this.$isEmpty = true; + this._dispatchEvent("changeSelection"); + } + }; + + this.selectAll = function() { + var lastRow = this.doc.getLength() - 1; + this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length); + this.moveCursorTo(0, 0); + }; + + this.setSelectionRange = function(range, reverse) { + if (reverse) { + this.setSelectionAnchor(range.end.row, range.end.column); + this.selectTo(range.start.row, range.start.column); + } else { + this.setSelectionAnchor(range.start.row, range.start.column); + this.selectTo(range.end.row, range.end.column); + } + this.$updateDesiredColumn(); + }; + + this.$updateDesiredColumn = function() { + var cursor = this.getCursor(); + this.$desiredColumn = this.session.documentToScreenColumn(cursor.row, cursor.column); + }; + + this.$moveSelection = function(mover) { + var lead = this.selectionLead; + if (this.$isEmpty) + this.setSelectionAnchor(lead.row, lead.column); + + mover.call(this); + }; + + this.selectTo = function(row, column) { + this.$moveSelection(function() { + this.moveCursorTo(row, column); + }); + }; + + this.selectToPosition = function(pos) { + this.$moveSelection(function() { + this.moveCursorToPosition(pos); + }); + }; + + 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 cursor = this.getCursor(); + var range = this.session.getWordRange(cursor.row, cursor.column); + this.setSelectionRange(range); + }; + + 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() { + var cursor = this.selectionLead.getPosition(); + if (cursor.column == 0) { + // cursor is a line (start + if (cursor.row > 0) { + this.moveCursorTo(cursor.row - 1, this.doc.getLine(cursor.row - 1).length); + } + } + else { + var tabSize = this.session.getTabSize(); + if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column-tabSize, cursor.column).split(" ").length-1 == tabSize) + this.moveCursorBy(0, -tabSize); + else + this.moveCursorBy(0, -1); + } + }; + + this.moveCursorRight = function() { + if (this.selectionLead.column == this.doc.getLine(this.selectionLead.row).length) { + if (this.selectionLead.row < this.doc.getLength() - 1) { + this.moveCursorTo(this.selectionLead.row + 1, 0); + } + } + else { + var tabSize = this.session.getTabSize(); + var cursor = this.selectionLead; + if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column, cursor.column+tabSize).split(" ").length-1 == tabSize) + this.moveCursorBy(0, tabSize); + else + this.moveCursorBy(0, 1); + } + }; + + this.moveCursorLineStart = function() { + var row = this.selectionLead.row; + var column = this.selectionLead.column; + var screenRow = this.session.documentToScreenRow(row, column); + var firstRowColumn = this.session.getScreenFirstRowColumn(screenRow); + var beforeCursor = this.doc.getLine(row).slice(firstRowColumn, column); + var leadingSpace = beforeCursor.match(/^\s*/); + if (leadingSpace[0].length == 0) { + var lastRowColumn = this.session.getDocumentLastRowColumn(row, column); + leadingSpace = this.doc.getLine(row). + substring(firstRowColumn, lastRowColumn). + match(/^\s*/); + this.moveCursorTo(row, firstRowColumn + leadingSpace[0].length); + } else if (leadingSpace[0].length >= column) { + this.moveCursorTo(row, firstRowColumn); + } else { + this.moveCursorTo(row, firstRowColumn + leadingSpace[0].length); + } + }; + + this.moveCursorLineEnd = function() { + var lead = this.selectionLead; + this.moveCursorTo(lead.row, this.session.getDocumentLastRowColumn(lead.row, lead.column)); + }; + + this.moveCursorFileEnd = function() { + var row = this.doc.getLength() - 1; + var column = this.doc.getLine(row).length; + this.moveCursorTo(row, column); + }; + + this.moveCursorFileStart = function() { + this.moveCursorTo(0, 0); + }; + + this.moveCursorWordRight = function() { + var row = this.selectionLead.row; + var column = this.selectionLead.column; + var line = this.doc.getLine(row); + var rightOfCursor = line.substring(column); + + var match; + this.session.nonTokenRe.lastIndex = 0; + this.session.tokenRe.lastIndex = 0; + + if (column == line.length) { + this.moveCursorRight(); + return; + } + else if (match = this.session.nonTokenRe.exec(rightOfCursor)) { + column += this.session.nonTokenRe.lastIndex; + this.session.nonTokenRe.lastIndex = 0; + } + else if (match = this.session.tokenRe.exec(rightOfCursor)) { + column += this.session.tokenRe.lastIndex; + this.session.tokenRe.lastIndex = 0; + } + + this.moveCursorTo(row, column); + }; + + this.moveCursorWordLeft = function() { + var row = this.selectionLead.row; + var column = this.selectionLead.column; + var line = this.doc.getLine(row); + var leftOfCursor = lang.stringReverse(line.substring(0, column)); + + var match; + this.session.nonTokenRe.lastIndex = 0; + this.session.tokenRe.lastIndex = 0; + + if (column == 0) { + this.moveCursorLeft(); + return; + } + else if (match = this.session.nonTokenRe.exec(leftOfCursor)) { + column -= this.session.nonTokenRe.lastIndex; + this.session.nonTokenRe.lastIndex = 0; + } + else if (match = this.session.tokenRe.exec(leftOfCursor)) { + column -= this.session.tokenRe.lastIndex; + this.session.tokenRe.lastIndex = 0; + } + + this.moveCursorTo(row, column); + }; + + this.moveCursorBy = function(rows, chars) { + if (this.session.getUseWrapMode()) { + var screenPos = this.session.documentToScreenPosition( + this.selectionLead.row, + this.selectionLead.column + ); + var screenCol = (chars == 0 && this.$desiredColumn) || screenPos.column; + var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenCol); + + this.moveCursorTo(docPos.row, docPos.column + chars, chars == 0); + } else { + var docColumn = (chars == 0 && this.$desiredColumn) || this.selectionLead.column; + this.moveCursorTo(this.selectionLead.row + rows, docColumn + chars, chars == 0); + } + }; + + this.moveCursorToPosition = function(position) { + this.moveCursorTo(position.row, position.column); + }; + + this.moveCursorTo = function(row, column, preventUpdateDesiredColumn) { + this.selectionLead.setPosition(row, column); + if (!preventUpdateDesiredColumn) + this.$updateDesiredColumn(this.selectionLead.column); + }; + +}).call(Selection.prototype); + +exports.Selection = Selection; +}); +/* ***** 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 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/range', function(require, exports, module) { + +var Range = function(startRow, startColumn, endRow, endColumn) { + this.start = { + row: startRow, + column: startColumn + }; + + this.end = { + row: endRow, + column: endColumn + }; +}; + +(function() { + + this.toString = function() { + return ("Range: [" + this.start.row + "/" + this.start.column + + "] -> [" + this.end.row + "/" + this.end.column + "]"); + }; + + this.contains = function(row, column) { + return this.compare(row, column) == 0; + }; + + this.compare = function(row, column) { + if (!this.isMultiLine()) { + if (row === this.start.row) { + return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0); + }; + } + + if (row < this.start.row) + return -1; + + if (row > this.end.row) + return 1; + + if (this.start.row === row) + return column >= this.start.column ? 0 : -1; + + if (this.end.row === row) + return column <= this.end.column ? 0 : 1; + + return 0; + }; + + this.clipRows = function(firstRow, lastRow) { + if (this.end.row > lastRow) { + var end = { + row: lastRow+1, + column: 0 + }; + } + + if (this.start.row > lastRow) { + var start = { + row: lastRow+1, + column: 0 + }; + } + + if (this.start.row < firstRow) { + var start = { + row: firstRow, + column: 0 + }; + } + + if (this.end.row < firstRow) { + var end = { + row: firstRow, + column: 0 + }; + } + return Range.fromPoints(start || this.start, end || this.end); + }; + + this.extend = function(row, column) { + var cmp = this.compare(row, column); + + if (cmp == 0) + return this; + else if (cmp == -1) + var start = {row: row, column: column}; + else + var end = {row: row, column: column}; + + return Range.fromPoints(start || this.start, end || this.end); + }; + + this.isEmpty = function() { + return (this.start.row == this.end.row && this.start.column == this.end.column); + }; + + this.isMultiLine = function() { + return (this.start.row !== this.end.row); + }; + + this.clone = function() { + return Range.fromPoints(this.start, this.end); + }; + + this.collapseRows = function() { + if (this.end.column == 0) + return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0) + else + return new Range(this.start.row, 0, this.end.row, 0) + }; + + this.toScreenRange = function(session) { + var screenPosStart = + session.documentToScreenPosition(this.start); + var screenPosEnd = + session.documentToScreenPosition(this.end); + return new Range( + screenPosStart.row, screenPosStart.column, + screenPosEnd.row, screenPosEnd.column + ); + }; + +}).call(Range.prototype); + + +Range.fromPoints = function(start, end) { + return new Range(start.row, start.column, end.row, end.column); +}; + +exports.Range = Range; +}); +/* ***** 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 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/anchor', function(require, exports, module) { + +var oop = require("pilot/oop"); +var EventEmitter = require("pilot/event_emitter").EventEmitter; + +/** + * An Anchor is a floating pointer in the document. Whenever text is inserted or + * deleted before the cursor, the position of the cursor is updated + */ +var Anchor = exports.Anchor = function(doc, row, column) { + this.document = doc; + + if (typeof column == "undefined") + this.setPosition(row.row, row.column) + else + this.setPosition(row, column); + + this.$onChange = this.onChange.bind(this); + doc.on("change", this.$onChange); +}; + +(function() { + + oop.implement(this, EventEmitter); + + this.getPosition = function() { + return this.$clipPositionToDocument(this.row, this.column); + }; + + this.getDocument = function() { + return this.document; + }; + + this.onChange = function(e) { + var delta = e.data; + var range = delta.range; + + if (range.start.row == range.end.row && range.start.row != this.row) + return; + + if (range.start.row > this.row) + return; + + if (range.start.row == this.row && range.start.column > this.column) + return; + + var row = this.row; + var column = this.column; + + if (delta.action === "insertText") { + if (range.start.row === row && range.start.column <= column) { + if (range.start.row === range.end.row) { + column += range.end.column - range.start.column; + } + else { + column -= range.start.column; + row += range.end.row - range.start.row; + } + } + else if (range.start.row !== range.end.row && range.start.row < row) { + row += range.end.row - range.start.row; + } + } else if (delta.action === "insertLines") { + if (range.start.row <= row) { + row += range.end.row - range.start.row; + } + } + else if (delta.action == "removeText") { + if (range.start.row == row && range.start.column < column) { + if (range.end.column >= column) + column = range.start.column; + else + column = Math.max(0, column - (range.end.column - range.start.column)); + + } else if (range.start.row !== range.end.row && range.start.row < row) { + if (range.end.row == row) { + column = Math.max(0, column - range.end.column) + range.start.column; + } + row -= (range.end.row - range.start.row); + } + else if (range.end.row == row) { + row -= range.end.row - range.start.row; + column = Math.max(0, column - range.end.column) + range.start.column; + } + } else if (delta.action == "removeLines") { + if (range.start.row <= row) { + if (range.end.row <= row) + row -= range.end.row - range.start.row; + else { + row = range.start.row; + column = 0; + } + } + } + + this.setPosition(row, column); + }; + + this.setPosition = function(row, column) { + pos = this.$clipPositionToDocument(row, column); + if (this.row == pos.row && this.column == pos.column) + return; + + var old = { + row: this.row, + column: this.column + }; + + this.row = pos.row; + this.column = pos.column; + this._dispatchEvent("change", { + old: old, + value: pos + }); + }; + + this.detach = function() { + this.document.removeEventListener("change", this.$onChange); + }; + + this.$clipPositionToDocument = function(row, column) { + var pos = {}; + + if (row >= this.document.getLength()) { + pos.row = Math.max(0, this.document.getLength() - 1); + pos.column = this.document.getLine(pos.row).length; + } + else if (row < 0) { + pos.row = 0; + pos.column = 0; + } + else { + pos.row = row; + pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column)); + } + + if (column < 0) + pos.column = 0; + + return pos; + }; + +}).call(Anchor.prototype); + +}); +/* ***** 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 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', function(require, exports, module) { + +var Tokenizer = require("ace/tokenizer").Tokenizer; +var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules; + +var Mode = function() { + this.$tokenizer = new Tokenizer(new TextHighlightRules().getRules()); +}; + +(function() { + + this.getTokenizer = function() { + return this.$tokenizer; + }; + + this.toggleCommentLines = function(state, doc, startRow, endRow) { + }; + + 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 ""; + }; + + this.createWorker = function(session) { + return null; + }; + +}).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 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/tokenizer', function(require, exports, module) { + +var Tokenizer = function(rules) { + this.rules = rules; + + this.regExps = {}; + for ( var key in this.rules) { + var state = this.rules[key]; + var ruleRegExps = []; + + for ( var i = 0; i < state.length; i++) { + ruleRegExps.push(state[i].regex); + }; + + this.regExps[key] = new RegExp("(?:(" + ruleRegExps.join(")|(") + ")|(.))", "g"); + } +}; + +(function() { + + this.getLineTokens = function(line, startState) { + var currentState = startState; + var state = this.rules[currentState]; + var re = this.regExps[currentState]; + re.lastIndex = 0; + + var match, tokens = []; + + var lastIndex = 0; + + var token = { + type: null, + value: "" + }; + + while (match = re.exec(line)) { + var type = "text"; + var value = match[0]; + + for ( var i = 0; i < state.length; i++) { + if (match[i + 1]) { + if (typeof state[i].token == "function") { + type = state[i].token(match[0]); + } + else { + type = state[i].token; + } + + if (state[i].next && state[i].next !== currentState) { + currentState = state[i].next; + var state = this.rules[currentState]; + var lastIndex = re.lastIndex; + + var re = this.regExps[currentState]; + re.lastIndex = lastIndex; + } + break; + } + }; + + + if (token.type !== type) { + if (token.type) { + tokens.push(token); + } + token = { + type: type, + value: value + }; + } else { + token.value += value; + } + + if (lastIndex == line.length) { + break; + } + + lastIndex = re.lastIndex; + }; + + if (token.type) { + tokens.push(token); + } + + return { + tokens : tokens, + state : currentState + }; + }; + +}).call(Tokenizer.prototype); + +exports.Tokenizer = Tokenizer; +}); +/* ***** 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 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 + // regexps are ordered -> the first match is used + + this.$rules = { + "start" : [ { + token : "empty_line", + regex : '^$' + }, { + 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/document', function(require, exports, module) { + +var oop = require("pilot/oop"); +var EventEmitter = require("pilot/event_emitter").EventEmitter; +var Range = require("ace/range").Range; + +var Document = function(text) { + this.$lines = []; + + if (Array.isArray(text)) { + this.insertLines(0, text); + } + // There has to be one line at least in the document. If you pass an empty + // string to the insert function, nothing will happen. Workaround. + else if (text.length == 0) { + this.$lines = [""]; + } else { + this.insert({row: 0, column:0}, text); + } +}; + +(function() { + + oop.implement(this, EventEmitter); + + this.setValue = function(text) { + var len = this.getLength(); + this.remove(new Range(0, 0, len, this.getLine(len-1).length)); + this.insert({row: 0, column:0}, text); + }; + + this.getValue = function() { + return this.$lines.join(this.getNewLineCharacter()); + }; + + // check for IE split bug + if ("aaa".split(/a/).length == 0) + this.$split = function(text) { + return text.replace(/\r\n|\r/g, "\n").split("\n"); + } + else + this.$split = function(text) { + return text.split(/\r\n|\r|\n/); + }; + + + this.$detectNewLine = function(text) { + var match = text.match(/^.*?(\r?\n)/m); + if (match) { + this.$autoNewLine = match[1]; + } else { + this.$autoNewLine = "\n"; + } + }; + + this.getNewLineCharacter = function() { + switch (this.$newLineMode) { + case "windows": + return "\r\n"; + + case "unix": + return "\n"; + + case "auto": + return this.$autoNewLine; + } + }, + + this.$autoNewLine = "\n"; + this.$newLineMode = "auto"; + this.setNewLineMode = function(newLineMode) { + if (this.$newLineMode === newLineMode) return; + + this.$newLineMode = newLineMode; + }; + + this.getNewLineMode = function() { + return this.$newLineMode; + }; + + this.isNewLine = function(text) { + return (text == "\r\n" || text == "\r" || text == "\n"); + }; + + /** + * Get a verbatim copy of the given line as it is in the document + */ + this.getLine = function(row) { + return this.$lines[row] || ""; + }; + + this.getLines = function(firstRow, lastRow) { + return this.$lines.slice(firstRow, lastRow+1); + }; + + /** + * Returns all lines in the document as string array. Warning: The caller + * should not modify this array! + */ + this.getAllLines = function() { + return this.$lines; + }; + + this.getLength = function() { + return this.$lines.length; + }; + + this.getTextRange = function(range) { + if (range.start.row == range.end.row) { + return this.$lines[range.start.row].substring(range.start.column, + range.end.column); + } + else { + var lines = []; + lines.push(this.$lines[range.start.row].substring(range.start.column)); + lines.push.apply(lines, this.getLines(range.start.row+1, range.end.row-1)); + lines.push(this.$lines[range.end.row].substring(0, range.end.column)); + return lines.join(this.getNewLineCharacter()); + } + }; + + this.$clipPosition = function(position) { + var length = this.getLength(); + if (position.row >= length) { + position.row = Math.max(0, length - 1); + position.column = this.getLine(length-1).length; + } + return position; + } + + this.insert = function(position, text) { + if (text.length == 0) + return position; + + position = this.$clipPosition(position); + + if (this.getLength() <= 1) + this.$detectNewLine(text); + + var newLines = this.$split(text); + + if (this.isNewLine(text)) { + var end = this.insertNewLine(position); + } + else if (newLines.length == 1) { + var end = this.insertInLine(position, text); + } + else { + var end = this.insertInLine(position, newLines[0]); + this.insertNewLine(end); + if (newLines.length > 2) + this.insertLines(position.row+1, newLines.slice(1, newLines.length-1)); + + var end = this.insertInLine({row: position.row + newLines.length - 1, column: 0}, newLines[newLines.length-1]); + } + + return end; + }; + + this.insertLines = function(row, lines) { + if (lines.length == 0) + return {row: row, column: 0}; + + var args = [row, 0]; + args.push.apply(args, lines); + this.$lines.splice.apply(this.$lines, args); + + var range = new Range(row, 0, row + lines.length, 0); + var delta = { + action: "insertLines", + range: range, + lines: lines + }; + this._dispatchEvent("change", { data: delta }); + return range.end; + }, + + this.insertNewLine = function(position) { + position = this.$clipPosition(position); + var line = this.$lines[position.row] || ""; + this.$lines[position.row] = line.substring(0, position.column); + this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length)); + + var end = { + row : position.row + 1, + column : 0 + }; + + var delta = { + action: "insertText", + range: Range.fromPoints(position, end), + text: this.getNewLineCharacter() + }; + this._dispatchEvent("change", { data: delta }); + + return end; + }; + + this.insertInLine = function(position, text) { + if (text.length == 0) + return position; + + var line = this.$lines[position.row] || ""; + this.$lines[position.row] = line.substring(0, position.column) + text + + line.substring(position.column); + + var end = { + row : position.row, + column : position.column + text.length + }; + + var delta = { + action: "insertText", + range: Range.fromPoints(position, end), + text: text + }; + this._dispatchEvent("change", { data: delta }); + + return end; + }; + + this.remove = function(range) { + // clip to document + range.start = this.$clipPosition(range.start); + range.end = this.$clipPosition(range.end); + + if (range.isEmpty()) + return range.start; + + var firstRow = range.start.row; + var lastRow = range.end.row; + + if (range.isMultiLine()) { + var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1; + var lastFullRow = lastRow - 1; + + if (range.end.column > 0) + this.removeInLine(lastRow, 0, range.end.column); + + if (lastFullRow >= firstFullRow) + this.removeLines(firstFullRow, lastFullRow); + + if (firstFullRow != firstRow) { + this.removeInLine(firstRow, range.start.column, this.$lines[firstRow].length); + this.removeNewLine(range.start.row); + } + } + else { + this.removeInLine(firstRow, range.start.column, range.end.column); + } + return range.start; + }; + + this.removeInLine = function(row, startColumn, endColumn) { + if (startColumn == endColumn) + return; + + var range = new Range(row, startColumn, row, endColumn); + var line = this.getLine(row); + var removed = line.substring(startColumn, endColumn); + var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length); + this.$lines.splice(row, 1, newLine); + + var delta = { + action: "removeText", + range: range, + text: removed + }; + this._dispatchEvent("change", { data: delta }); + return range.start; + }; + + /** + * Removes a range of full lines + * + * @param firstRow {Integer} The first row to be removed + * @param lastRow {Integer} The last row to be removed + * @return {String[]} The removed lines + */ + this.removeLines = function(firstRow, lastRow) { + var range = new Range(firstRow, 0, lastRow + 1, 0); + var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1); + + var delta = { + action: "removeLines", + range: range, + nl: this.getNewLineCharacter(), + lines: removed + }; + this._dispatchEvent("change", { data: delta }); + return removed; + }; + + this.removeNewLine = function(row) { + var firstLine = this.getLine(row); + var secondLine = this.getLine(row+1); + + var range = new Range(row, firstLine.length, row+1, 0); + var line = firstLine + secondLine; + + this.$lines.splice(row, 2, line); + + var delta = { + action: "removeText", + range: range, + text: this.getNewLineCharacter() + }; + this._dispatchEvent("change", { data: delta }); + }; + + this.replace = function(range, text) { + if (text.length == 0 && range.isEmpty()) + return range.start; + + // Shortcut: If the text we want to insert is the same as it is already + // in the document, we don't have to replace anything. + if (text == this.getTextRange(range)) + return range.end; + + this.remove(range); + if (text) { + var end = this.insert(range.start, text); + } + else { + end = range.start; + } + + return end; + }; + + this.applyDeltas = function(deltas) { + for (var i=0; i=0; i--) { + var delta = deltas[i]; + var range = Range.fromPoints(delta.range.start, delta.range.end); + + if (delta.action == "insertLines") + this.removeLines(range.start.row, range.end.row - 1) + else if (delta.action == "insertText") + this.remove(range) + else if (delta.action == "removeLines") + this.insertLines(range.start.row, delta.lines) + else if (delta.action == "removeText") + this.insert(range.start, delta.text) + } + }; + +}).call(Document.prototype); + +exports.Document = Document; +}); +/* ***** 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 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/search', function(require, exports, module) { + +var lang = require("pilot/lang"); +var oop = require("pilot/oop"); +var Range = require("ace/range").Range; + +var Search = function() { + this.$options = { + needle: "", + backwards: false, + wrap: false, + caseSensitive: false, + wholeWord: false, + scope: Search.ALL, + regExp: false + }; +}; + +Search.ALL = 1; +Search.SELECTION = 2; + +(function() { + + this.set = function(options) { + oop.mixin(this.$options, options); + return this; + }; + + this.getOptions = function() { + return lang.copyObject(this.$options); + }; + + this.find = function(session) { + if (!this.$options.needle) + return null; + + if (this.$options.backwards) { + var iterator = this.$backwardMatchIterator(session); + } else { + iterator = this.$forwardMatchIterator(session); + } + + var firstRange = null; + iterator.forEach(function(range) { + firstRange = range; + return true; + }); + + return firstRange; + }; + + this.findAll = function(session) { + if (!this.$options.needle) + return []; + + if (this.$options.backwards) { + var iterator = this.$backwardMatchIterator(session); + } else { + iterator = this.$forwardMatchIterator(session); + } + + var ranges = []; + iterator.forEach(function(range) { + ranges.push(range); + }); + + return ranges; + }; + + this.replace = function(input, replacement) { + var re = this.$assembleRegExp(); + var match = re.exec(input); + if (match && match[0].length == input.length) { + if (this.$options.regExp) { + return input.replace(re, replacement); + } else { + return replacement; + } + } else { + return null; + } + }; + + this.$forwardMatchIterator = function(session) { + var re = this.$assembleRegExp(); + var self = this; + + return { + forEach: function(callback) { + self.$forwardLineIterator(session).forEach(function(line, startIndex, row) { + if (startIndex) { + line = line.substring(startIndex); + } + + var matches = []; + + line.replace(re, function(str) { + var offset = arguments[arguments.length-2]; + matches.push({ + str: str, + offset: startIndex + offset + }); + return str; + }); + + for (var i=0; i= 0; i--) { + var match = matches[i]; + var range = self.$rangeFromMatch(row, match.offset, match.str.length); + if (callback(range)) + return true; + } + }); + } + }; + }; + + this.$rangeFromMatch = function(row, column, length) { + return new Range(row, column, row, column+length); + }; + + this.$assembleRegExp = function() { + if (this.$options.regExp) { + var needle = this.$options.needle; + } else { + needle = lang.escapeRegExp(this.$options.needle); + } + + if (this.$options.wholeWord) { + needle = "\\b" + needle + "\\b"; + } + + var modifier = "g"; + if (!this.$options.caseSensitive) { + modifier += "i"; + } + + var re = new RegExp(needle, modifier); + return re; + }; + + this.$forwardLineIterator = function(session) { + var searchSelection = this.$options.scope == Search.SELECTION; + + var range = session.getSelection().getRange(); + var start = session.getSelection().getCursor(); + + var firstRow = searchSelection ? range.start.row : 0; + var firstColumn = searchSelection ? range.start.column : 0; + var lastRow = searchSelection ? range.end.row : session.getLength() - 1; + + var wrap = this.$options.wrap; + + function getLine(row) { + var line = session.getLine(row); + if (searchSelection && row == range.end.row) { + line = line.substring(0, range.end.column); + } + return line; + } + + return { + forEach: function(callback) { + var row = start.row; + + var line = getLine(row); + var startIndex = start.column; + + var stop = false; + + while (!callback(line, startIndex, row)) { + + if (stop) { + return; + } + + row++; + startIndex = 0; + + if (row > lastRow) { + if (wrap) { + row = firstRow; + startIndex = firstColumn; + } else { + return; + } + } + + if (row == start.row) + stop = true; + + line = getLine(row); + } + } + }; + }; + + this.$backwardLineIterator = function(session) { + var searchSelection = this.$options.scope == Search.SELECTION; + + var range = session.getSelection().getRange(); + var start = searchSelection ? range.end : range.start; + + var firstRow = searchSelection ? range.start.row : 0; + var firstColumn = searchSelection ? range.start.column : 0; + var lastRow = searchSelection ? range.end.row : session.getLength() - 1; + + var wrap = this.$options.wrap; + + return { + forEach : function(callback) { + var row = start.row; + + var line = session.getLine(row).substring(0, start.column); + var startIndex = 0; + var stop = false; + + while (!callback(line, startIndex, row)) { + + if (stop) + return; + + row--; + startIndex = 0; + + if (row < firstRow) { + if (wrap) { + row = lastRow; + } else { + return; + } + } + + if (row == start.row) + stop = true; + + line = session.getLine(row); + if (searchSelection) { + if (row == firstRow) + startIndex = firstColumn; + else if (row == lastRow) + line = line.substring(0, range.end.column); + } + } + } + }; + }; + +}).call(Search.prototype); + +exports.Search = Search; +}); +/* ***** 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 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/background_tokenizer', function(require, exports, module) { + +var oop = require("pilot/oop"); +var EventEmitter = require("pilot/event_emitter").EventEmitter; + +var BackgroundTokenizer = function(tokenizer, editor) { + this.running = false; + this.lines = []; + this.currentLine = 0; + this.tokenizer = tokenizer; + + var self = this; + + this.$worker = function() { + if (!self.running) { return; } + + var workerStart = new Date(); + var startLine = self.currentLine; + var doc = self.doc; + + var processedLines = 0; + var lastVisibleRow = editor.getLastVisibleRow(); + + var len = doc.getLength(); + while (self.currentLine < len) { + self.lines[self.currentLine] = self.$tokenizeRows(self.currentLine, self.currentLine)[0]; + self.currentLine++; + + // only check every 5 lines + processedLines += 1; + if ((processedLines % 5 == 0) && (new Date() - workerStart) > 20) { + self.fireUpdateEvent(startLine, self.currentLine-1); + + var timeout = self.currentLine < lastVisibleRow ? 20 : 100; + self.running = setTimeout(self.$worker, timeout); + return; + } + } + + self.running = false; + + self.fireUpdateEvent(startLine, len - 1); + }; +}; + +(function(){ + + oop.implement(this, EventEmitter); + + this.setTokenizer = function(tokenizer) { + this.tokenizer = tokenizer; + this.lines = []; + + this.start(0); + }; + + this.setDocument = function(doc) { + this.doc = doc; + this.lines = []; + + this.stop(); + }; + + this.fireUpdateEvent = function(firstRow, lastRow) { + var data = { + first: firstRow, + last: lastRow + }; + this._dispatchEvent("update", {data: data}); + }; + + this.start = function(startRow) { + this.currentLine = Math.min(startRow || 0, this.currentLine, + this.doc.getLength()); + + // remove all cached items below this line + this.lines.splice(this.currentLine, this.lines.length); + + this.stop(); + // pretty long delay to prevent the tokenizer from interfering with the user + this.running = setTimeout(this.$worker, 700); + }; + + this.stop = function() { + if (this.running) + clearTimeout(this.running); + this.running = false; + }; + + this.getTokens = function(firstRow, lastRow) { + return this.$tokenizeRows(firstRow, lastRow); + }; + + this.getState = function(row) { + return this.$tokenizeRows(row, row)[0].state; + }; + + this.$tokenizeRows = function(firstRow, lastRow) { + if (!this.doc) + return []; + + var rows = []; + + // determine start state + var state = "start"; + var doCache = false; + if (firstRow > 0 && this.lines[firstRow - 1]) { + state = this.lines[firstRow - 1].state; + doCache = true; + } + + var lines = this.doc.getLines(firstRow, lastRow); + for (var row=firstRow; row<=lastRow; row++) { + if (!this.lines[row]) { + var tokens = this.tokenizer.getLineTokens(lines[row-firstRow] || "", state); + var state = tokens.state; + rows.push(tokens); + + if (doCache) { + this.lines[row] = tokens; + } + } + else { + var tokens = this.lines[row]; + state = tokens.state; + rows.push(tokens); + } + } + return rows; + }; + +}).call(BackgroundTokenizer.prototype); + +exports.BackgroundTokenizer = BackgroundTokenizer; +}); +/* ***** 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 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/undomanager', function(require, exports, module) { + +var UndoManager = function() { + this.$undoStack = []; + this.$redoStack = []; +}; + +(function() { + + this.execute = function(options) { + var deltas = options.args[0]; + this.$doc = options.args[1]; + this.$undoStack.push(deltas); + }; + + this.undo = function() { + var deltas = this.$undoStack.pop(); + if (deltas) { + this.$doc.undoChanges(deltas); + this.$redoStack.push(deltas); + } + }; + + this.redo = function() { + var deltas = this.$redoStack.pop(); + if (deltas) { + this.$doc.redoChanges(deltas); + this.$undoStack.push(deltas); + } + }; + +}).call(UndoManager.prototype); + +exports.UndoManager = UndoManager; +}); +/* ***** 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 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/theme/textmate', function(require, exports, module) { + + var dom = require("pilot/dom"); + var cssText = require("text!ace/theme/tm.css"); + + // import CSS once + dom.importCssString(cssText); + + exports.cssClass = "ace-tm"; +}); +/* ***** 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 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/matching_brace_outdent', function(require, exports, module) { + +var Range = require("ace/range").Range; + +var MatchingBraceOutdent = function() {}; + +(function() { + + this.checkOutdent = function(line, input) { + if (! /^\s+$/.test(line)) + return false; + + return /^\s*\}/.test(input); + }; + + this.autoOutdent = function(doc, row) { + var line = doc.getLine(row); + var match = line.match(/^(\s*\})/); + + if (!match) return 0; + + var column = match[1].length; + var openBracePos = doc.findMatchingBracket({row: row, column: column}); + + if (!openBracePos || openBracePos.row == row) return 0; + + var indent = this.$getIndent(doc.getLine(openBracePos.row)); + doc.replace(new Range(row, 0, row, column-1), indent); + }; + + this.$getIndent = function(line) { + var match = line.match(/^(\s+)/); + if (match) { + return match[1]; + } + + return ""; + }; + +}).call(MatchingBraceOutdent.prototype); + +exports.MatchingBraceOutdent = MatchingBraceOutdent; +}); +/* vim:ts=4:sts=4:sw=4: + * ***** 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 B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Fabian Jakobs + * Irakli Gozalishvili (http://jeditoolkit.com) + * Julian Viereck + * + * 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/virtual_renderer', function(require, exports, module) { + +var oop = require("pilot/oop"); +var dom = require("pilot/dom"); +var event = require("pilot/event"); +var useragent = require("pilot/useragent"); +var GutterLayer = require("ace/layer/gutter").Gutter; +var MarkerLayer = require("ace/layer/marker").Marker; +var TextLayer = require("ace/layer/text").Text; +var CursorLayer = require("ace/layer/cursor").Cursor; +var ScrollBar = require("ace/scrollbar").ScrollBar; +var RenderLoop = require("ace/renderloop").RenderLoop; +var EventEmitter = require("pilot/event_emitter").EventEmitter; +var editorCss = require("text!ace/css/editor.css"); + +// import CSS once +dom.importCssString(editorCss); + +var VirtualRenderer = function(container, theme) { + this.container = container; + dom.addCssClass(this.container, "ace_editor"); + + this.setTheme(theme); + + this.$gutter = document.createElement("div"); + this.$gutter.className = "ace_gutter"; + this.container.appendChild(this.$gutter); + + this.scroller = document.createElement("div"); + this.scroller.className = "ace_scroller"; + this.container.appendChild(this.scroller); + + this.content = document.createElement("div"); + this.content.className = "ace_content"; + this.scroller.appendChild(this.content); + + this.$gutterLayer = new GutterLayer(this.$gutter); + this.$markerBack = new MarkerLayer(this.content); + + var textLayer = this.$textLayer = new TextLayer(this.content); + this.canvas = textLayer.element; + + this.$markerFront = new MarkerLayer(this.content); + + this.characterWidth = textLayer.getCharacterWidth(); + this.lineHeight = textLayer.getLineHeight(); + + this.$cursorLayer = new CursorLayer(this.content); + this.$cursorPadding = 8; + + this.scrollBar = new ScrollBar(container); + this.scrollBar.addEventListener("scroll", this.onScroll.bind(this)); + + this.scrollTop = 0; + + this.cursorPos = { + row : 0, + column : 0 + }; + + var _self = this; + this.$textLayer.addEventListener("changeCharaterSize", function() { + _self.characterWidth = textLayer.getCharacterWidth(); + _self.lineHeight = textLayer.getLineHeight(); + _self.$updatePrintMargin(); + + _self.$loop.schedule(_self.CHANGE_FULL); + }); + event.addListener(this.$gutter, "click", this.$onGutterClick.bind(this)); + event.addListener(this.$gutter, "dblclick", this.$onGutterClick.bind(this)); + + this.$size = { + width: 0, + height: 0, + scrollerHeight: 0, + scrollerWidth: 0 + }; + + this.$loop = new RenderLoop(this.$renderChanges.bind(this)); + this.$loop.schedule(this.CHANGE_FULL); + + this.setPadding(4); + this.$updatePrintMargin(); +}; + +(function() { + this.showGutter = true; + + this.CHANGE_CURSOR = 1; + this.CHANGE_MARKER = 2; + this.CHANGE_GUTTER = 4; + this.CHANGE_SCROLL = 8; + this.CHANGE_LINES = 16; + this.CHANGE_TEXT = 32; + this.CHANGE_SIZE = 64; + this.CHANGE_MARKER_BACK = 128; + this.CHANGE_MARKER_FRONT = 256; + this.CHANGE_FULL = 512; + + oop.implement(this, EventEmitter); + + this.setSession = function(session) { + this.session = session; + this.$cursorLayer.setSession(session); + this.$markerBack.setSession(session); + this.$markerFront.setSession(session); + this.$gutterLayer.setSession(session); + this.$textLayer.setSession(session); + this.$loop.schedule(this.CHANGE_FULL); + }; + + /** + * Triggers partial update of the text layer + */ + this.updateLines = function(firstRow, lastRow) { + if (lastRow === undefined) + lastRow = Infinity; + + if (!this.$changedLines) { + this.$changedLines = { + firstRow: firstRow, + lastRow: lastRow + }; + } + else { + if (this.$changedLines.firstRow > firstRow) + this.$changedLines.firstRow = firstRow; + + if (this.$changedLines.lastRow < lastRow) + this.$changedLines.lastRow = lastRow; + } + + this.$loop.schedule(this.CHANGE_LINES); + }; + + /** + * Triggers full update of the text layer + */ + this.updateText = function() { + this.$loop.schedule(this.CHANGE_TEXT); + }; + + /** + * Triggers a full update of all layers + */ + this.updateFull = function() { + this.$loop.schedule(this.CHANGE_FULL); + }; + + /** + * Triggers resize of the editor + */ + this.onResize = function(force) { + var changes = this.CHANGE_SIZE; + + var height = dom.getInnerHeight(this.container); + if (force || this.$size.height != height) { + this.$size.height = height; + + this.scroller.style.height = height + "px"; + this.scrollBar.setHeight(height); + + if (this.session) { + this.scrollToY(this.getScrollTop()); + changes = changes | this.CHANGE_FULL; + } + } + + var width = dom.getInnerWidth(this.container); + if (force || this.$size.width != width) { + this.$size.width = width; + + var gutterWidth = this.showGutter ? this.$gutter.offsetWidth : 0; + this.scroller.style.left = gutterWidth + "px"; + this.scroller.style.width = Math.max(0, width - gutterWidth - this.scrollBar.getWidth()) + "px"; + + if (this.session.getUseWrapMode()) { + var availableWidth = this.scroller.clientWidth - this.$padding * 2; + var limit = Math.floor(availableWidth / this.characterWidth) - 1; + if (this.session.adjustWrapLimit(limit) || force) { + changes = changes | this.CHANGE_FULL; + } + } + } + + this.$size.scrollerWidth = this.scroller.clientWidth; + this.$size.scrollerHeight = this.scroller.clientHeight; + this.$loop.schedule(changes); + }; + + this.setTokenizer = function(tokenizer) { + this.$tokenizer = tokenizer; + this.$textLayer.setTokenizer(tokenizer); + this.$loop.schedule(this.CHANGE_TEXT); + }; + + this.$onGutterClick = function(e) { + var pageX = event.getDocumentX(e); + var pageY = event.getDocumentY(e); + + this._dispatchEvent("gutter" + e.type, { + row: this.screenToTextCoordinates(pageX, pageY).row, + htmlEvent: e + }); + }; + + this.setShowInvisibles = function(showInvisibles) { + if (this.$textLayer.setShowInvisibles(showInvisibles)) + this.$loop.schedule(this.CHANGE_TEXT); + }; + + this.getShowInvisibles = function() { + return this.$textLayer.showInvisibles; + }; + + this.$showPrintMargin = true; + this.setShowPrintMargin = function(showPrintMargin) { + this.$showPrintMargin = showPrintMargin; + this.$updatePrintMargin(); + }; + + this.getShowPrintMargin = function() { + return this.$showPrintMargin; + }; + + this.$printMarginColumn = 80; + this.setPrintMarginColumn = function(showPrintMargin) { + this.$printMarginColumn = showPrintMargin; + this.$updatePrintMargin(); + }; + + this.getPrintMarginColumn = function() { + return this.$printMarginColumn; + }; + + this.setShowGutter = function(show){ + if(this.showGutter === show) + return; + this.$gutter.style.display = show ? "block" : "none"; + this.showGutter = show; + this.onResize(true); + } + + this.$updatePrintMargin = function() { + var containerEl + + if (!this.$showPrintMargin && !this.$printMarginEl) + return; + + if (!this.$printMarginEl) { + containerEl = document.createElement("div"); + containerEl.className = "ace_print_margin_layer"; + this.$printMarginEl = document.createElement("div") + this.$printMarginEl.className = "ace_print_margin"; + containerEl.appendChild(this.$printMarginEl); + this.content.insertBefore(containerEl, this.$textLayer.element); + } + + var style = this.$printMarginEl.style; + style.left = ((this.characterWidth * this.$printMarginColumn) + this.$padding * 2) + "px"; + style.visibility = this.$showPrintMargin ? "visible" : "hidden"; + }; + + this.getContainerElement = function() { + return this.container; + }; + + this.getMouseEventTarget = function() { + return this.content; + }; + + this.getTextAreaContainer = function() { + return this.container; + }; + + this.moveTextAreaToCursor = function(textarea) { + // in IE the native cursor always shines through + if (useragent.isIE) + return; + + var pos = this.$cursorLayer.getPixelPosition(); + if (!pos) + return; + + var bounds = this.content.getBoundingClientRect(); + var offset = (this.layerConfig && this.layerConfig.offset) || 0; + + textarea.style.left = (bounds.left + pos.left + this.$padding) + "px"; + textarea.style.top = (bounds.top + pos.top - this.scrollTop + offset) + "px"; + }; + + this.getFirstVisibleRow = function() { + return (this.layerConfig || {}).firstRow || 0; + }; + + this.getFirstFullyVisibleRow = function(){ + if (!this.layerConfig) + return 0; + + return this.layerConfig.firstRow + (this.layerConfig.offset == 0 ? 0 : 1); + } + + this.getLastFullyVisibleRow = function() { + if (!this.layerConfig) + return 0; + + var flint = Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight); + return this.layerConfig.firstRow - 1 + flint; + } + + this.getLastVisibleRow = function() { + return (this.layerConfig || {}).lastRow || 0; + }; + + this.$padding = null; + this.setPadding = function(padding) { + this.$padding = padding; + this.content.style.padding = "0 " + padding + "px"; + this.$loop.schedule(this.CHANGE_FULL); + this.$updatePrintMargin(); + }; + + this.onScroll = function(e) { + this.scrollToY(e.data); + }; + + this.$updateScrollBar = function() { + this.scrollBar.setInnerHeight(this.session.getScreenLength() * this.lineHeight); + this.scrollBar.setScrollTop(this.scrollTop); + }; + + this.$renderChanges = function(changes) { + if (!changes || !this.session || !this.$tokenizer) + return; + + // text, scrolling and resize changes can cause the view port size to change + if (!this.layerConfig || + changes & this.CHANGE_FULL || + changes & this.CHANGE_SIZE || + changes & this.CHANGE_TEXT || + changes & this.CHANGE_LINES || + changes & this.CHANGE_SCROLL + ) + this.$computeLayerConfig(); + + // full + if (changes & this.CHANGE_FULL) { + this.$textLayer.update(this.layerConfig); + this.showGutter && this.$gutterLayer.update(this.layerConfig); + this.$markerBack.update(this.layerConfig); + this.$markerFront.update(this.layerConfig); + this.$cursorLayer.update(this.layerConfig); + this.$updateScrollBar(); + this.scrollCursorIntoView(); + return; + } + + // scrolling + if (changes & this.CHANGE_SCROLL) { + if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES) + this.$textLayer.update(this.layerConfig); + else + this.$textLayer.scrollLines(this.layerConfig); + this.showGutter && this.$gutterLayer.update(this.layerConfig); + this.$markerBack.update(this.layerConfig); + this.$markerFront.update(this.layerConfig); + this.$cursorLayer.update(this.layerConfig); + this.$updateScrollBar(); + return; + } + + if (changes & this.CHANGE_TEXT) { + this.$textLayer.update(this.layerConfig); + this.showGutter && this.$gutterLayer.update(this.layerConfig); + } + else if (changes & this.CHANGE_LINES) { + this.$updateLines(); + this.$updateScrollBar(); + this.showGutter && this.$gutterLayer.update(this.layerConfig); + } else if (changes & this.CHANGE_GUTTER) { + this.showGutter && this.$gutterLayer.update(this.layerConfig); + } + + if (changes & this.CHANGE_CURSOR) + this.$cursorLayer.update(this.layerConfig); + + if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) { + this.$markerFront.update(this.layerConfig); + } + + if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) { + this.$markerBack.update(this.layerConfig); + } + + if (changes & this.CHANGE_SIZE) + this.$updateScrollBar(); + }; + + this.$computeLayerConfig = function() { + var session = this.session; + + var offset = this.scrollTop % this.lineHeight; + var minHeight = this.$size.scrollerHeight + this.lineHeight; + + var longestLine = this.$getLongestLine(); + var widthChanged = !this.layerConfig ? true : (this.layerConfig.width != longestLine); + + var lineCount = Math.ceil(minHeight / this.lineHeight) - 1; + var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight)); + var lastRow = firstRow + lineCount; + + // Map lines on the screen to lines in the document. + var firstRowScreen, firstRowHeight; + var lineHeight = { lineHeight: this.lineHeight }; + firstRow = session.screenToDocumentRow(firstRow); + firstRowScreen = session.documentToScreenRow(firstRow); + firstRowHeight = session.getRowHeight(lineHeight, firstRow); + + lastRow = Math.min(session.screenToDocumentRow(lastRow), session.getLength() - 1); + minHeight = this.$size.scrollerHeight + session.getRowHeight(lineHeight, lastRow)+ + firstRowHeight; + + offset = this.scrollTop - firstRowScreen * this.lineHeight; + + var layerConfig = this.layerConfig = { + width : longestLine, + padding : this.$padding, + firstRow : firstRow, + firstRowScreen: firstRowScreen, + lastRow : lastRow, + lineHeight : this.lineHeight, + characterWidth : this.characterWidth, + minHeight : minHeight, + offset : offset, + height : this.$size.scrollerHeight + }; + + this.$gutterLayer.element.style.marginTop = (-offset) + "px"; + this.content.style.marginTop = (-offset) + "px"; + this.content.style.width = longestLine + "px"; + this.content.style.height = minHeight + "px"; + }; + + this.$updateLines = function() { + var firstRow = this.$changedLines.firstRow; + var lastRow = this.$changedLines.lastRow; + this.$changedLines = null; + + var layerConfig = this.layerConfig; + + // if the update changes the width of the document do a full redraw + if (layerConfig.width != this.$getLongestLine()) + return this.$textLayer.update(layerConfig); + + if (firstRow > layerConfig.lastRow + 1) { return; } + if (lastRow < layerConfig.firstRow) { return; } + + // if the last row is unknown -> redraw everything + if (lastRow === Infinity) { + this.showGutter && this.$gutterLayer.update(layerConfig); + this.$textLayer.update(layerConfig); + return; + } + + // else update only the changed rows + this.$textLayer.updateLines(layerConfig, firstRow, lastRow); + }; + + this.$getLongestLine = function() { + var charCount = this.session.getScreenWidth() + 1; + if (this.$textLayer.showInvisibles) + charCount += 1; + + return Math.max(this.$size.scrollerWidth - this.$padding * 2, Math.round(charCount * this.characterWidth)); + }; + + this.updateFrontMarkers = function() { + this.$markerFront.setMarkers(this.session.getMarkers(true)); + this.$loop.schedule(this.CHANGE_MARKER_FRONT); + }; + + this.updateBackMarkers = function() { + this.$markerBack.setMarkers(this.session.getMarkers()); + this.$loop.schedule(this.CHANGE_MARKER_BACK); + }; + + this.addGutterDecoration = function(row, className){ + this.$gutterLayer.addGutterDecoration(row, className); + this.$loop.schedule(this.CHANGE_GUTTER); + } + + this.removeGutterDecoration = function(row, className){ + this.$gutterLayer.removeGutterDecoration(row, className); + this.$loop.schedule(this.CHANGE_GUTTER); + } + + this.setBreakpoints = function(rows) { + this.$gutterLayer.setBreakpoints(rows); + this.$loop.schedule(this.CHANGE_GUTTER); + }; + + this.setAnnotations = function(annotations) { + this.$gutterLayer.setAnnotations(annotations); + this.$loop.schedule(this.CHANGE_GUTTER); + }; + + this.updateCursor = function(position, overwrite) { + this.$cursorLayer.setCursor(position, overwrite); + this.$loop.schedule(this.CHANGE_CURSOR); + }; + + this.hideCursor = function() { + this.$cursorLayer.hideCursor(); + }; + + this.showCursor = function() { + this.$cursorLayer.showCursor(); + }; + + this.scrollCursorIntoView = function() { + var pos = this.$cursorLayer.getPixelPosition(); + + var left = pos.left + this.$padding; + var top = pos.top; + + if (this.getScrollTop() > top) { + this.scrollToY(top); + } + + if (this.getScrollTop() + this.$size.scrollerHeight < top + + this.lineHeight) { + this.scrollToY(top + this.lineHeight - this.$size.scrollerHeight); + } + + if (this.scroller.scrollLeft > left) { + this.scrollToX(left); + } + + if (this.scroller.scrollLeft + this.$size.scrollerWidth < left + this.characterWidth) { + + if (left + this.characterWidth > this.scroller.scrollWidth) + this.$renderChanges(this.CHANGE_SIZE); + + this.scrollToX(Math.round(left + this.characterWidth - this.$size.scrollerWidth)); + } + }, + + this.getScrollTop = function() { + return this.scrollTop; + }; + + this.getScrollLeft = function() { + return this.scroller.scrollLeft; + }; + + this.getScrollTopRow = function() { + return this.scrollTop / this.lineHeight; + }; + + this.scrollToRow = function(row) { + this.scrollToY(row * this.lineHeight); + }; + + this.scrollToLine = function(line, center) { + var lineHeight = { lineHeight: this.lineHeight }; + var offset = 0; + for (var l = 1; l < line; l++) { + offset += this.session.getRowHeight(lineHeight, l-1); + } + + if (center) { + offset -= this.$size.scrollerHeight / 2; + } + this.scrollToY(offset); + }; + + this.scrollToY = function(scrollTop) { + var maxHeight = this.session.getScreenLength() * this.lineHeight - this.$size.scrollerHeight; + var scrollTop = Math.max(0, Math.min(maxHeight, scrollTop)); + + if (this.scrollTop !== scrollTop) { + this.scrollTop = scrollTop; + this.$loop.schedule(this.CHANGE_SCROLL); + } + }; + + this.scrollToX = function(scrollLeft) { + if (scrollLeft <= this.$padding) + scrollLeft = 0; + + this.scroller.scrollLeft = scrollLeft; + }; + + this.scrollBy = function(deltaX, deltaY) { + deltaY && this.scrollToY(this.scrollTop + deltaY); + deltaX && this.scrollToX(this.scroller.scrollLeft + deltaX); + }; + + this.screenToTextCoordinates = function(pageX, pageY) { + var canvasPos = this.scroller.getBoundingClientRect(); + + var col = Math.round((pageX + this.scroller.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft()) + / this.characterWidth); + var row = Math.floor((pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop()) + / this.lineHeight); + + return this.session.screenToDocumentPosition(row, Math.max(col, 0)); + }; + + this.textToScreenCoordinates = function(row, column) { + var canvasPos = this.scroller.getBoundingClientRect(); + var pos = this.session.documentToScreenPosition(row, column); + + var x = this.$padding + Math.round(pos.column * this.characterWidth); + var y = pos.row * this.lineHeight; + + return { + pageX: canvasPos.left + x - this.getScrollLeft(), + pageY: canvasPos.top + y - this.getScrollTop() + } + }; + + this.visualizeFocus = function() { + dom.addCssClass(this.container, "ace_focus"); + }; + + this.visualizeBlur = function() { + dom.removeCssClass(this.container, "ace_focus"); + }; + + this.showComposition = function(position) { + if (!this.$composition) { + this.$composition = document.createElement("div"); + this.$composition.className = "ace_composition"; + this.content.appendChild(this.$composition); + } + + this.$composition.innerHTML = " "; + + var pos = this.$cursorLayer.getPixelPosition(); + var style = this.$composition.style; + style.top = pos.top + "px"; + style.left = (pos.left + this.$padding) + "px"; + style.height = this.lineHeight + "px"; + + this.hideCursor(); + }; + + this.setCompositionText = function(text) { + dom.setInnerText(this.$composition, text); + }; + + this.hideComposition = function() { + this.showCursor(); + + if (!this.$composition) + return; + + var style = this.$composition.style; + style.top = "-10000px"; + style.left = "-10000px"; + }; + + this.setTheme = function(theme) { + var _self = this; + if (!theme || typeof theme == "string") { + theme = theme || "ace/theme/textmate"; + require([theme], function(theme) { + afterLoad(theme); + }); + } else { + afterLoad(theme); + } + + var _self = this; + function afterLoad(theme) { + if (_self.$theme) + dom.removeCssClass(_self.container, _self.$theme); + + _self.$theme = theme ? theme.cssClass : null; + + if (_self.$theme) + dom.addCssClass(_self.container, _self.$theme); + + // force re-measure of the gutter width + if (_self.$size) { + _self.$size.width = 0; + _self.onResize(); + } + } + }; + + // Methods allows to add / remove CSS classnames to the editor element. + // This feature can be used by plug-ins to provide a visual indication of + // a certain mode that editor is in. + + this.setStyle = function setStyle(style) { + dom.addCssClass(this.container, style) + }; + + this.unsetStyle = function unsetStyle(style) { + dom.removeCssClass(this.container, style) + }; + +}).call(VirtualRenderer.prototype); + +exports.VirtualRenderer = VirtualRenderer; +}); +/* ***** 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 B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Fabian Jakobs + * Julian Viereck + * + * 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/layer/gutter', function(require, exports, module) { + +var dom = require("pilot/dom"); + +var Gutter = function(parentEl) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_gutter-layer"; + parentEl.appendChild(this.element); + + this.$breakpoints = []; + this.$annotations = []; + this.$decorations = []; +}; + +(function() { + + this.setSession = function(session) { + this.session = session; + }; + + this.addGutterDecoration = function(row, className){ + if (!this.$decorations[row]) + this.$decorations[row] = ""; + this.$decorations[row] += " ace_" + className; + } + + this.removeGutterDecoration = function(row, className){ + this.$decorations[row] = this.$decorations[row].replace(" ace_" + className, ""); + }; + + this.setBreakpoints = function(rows) { + this.$breakpoints = rows.concat(); + }; + + this.setAnnotations = function(annotations) { + // iterate over sparse array + this.$annotations = []; + for (var row in annotations) if (annotations.hasOwnProperty(row)) { + var rowAnnotations = annotations[row]; + if (!rowAnnotations) + continue; + + var rowInfo = this.$annotations[row] = { + text: [] + }; + for (var i=0; i", (i+1), ""); + html.push(""); + } + this.element = dom.setInnerHtml(this.element, html.join("")); + this.element.style.height = config.minHeight + "px"; + }; + +}).call(Gutter.prototype); + +exports.Gutter = Gutter; + +}); +/* ***** 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 B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Fabian Jakobs + * Julian Viereck + * + * 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/layer/marker', function(require, exports, module) { + +var Range = require("ace/range").Range; +var dom = require("pilot/dom"); + +var Marker = function(parentEl) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_marker-layer"; + parentEl.appendChild(this.element); +}; + +(function() { + + this.setSession = function(session) { + this.session = session; + }; + + this.setMarkers = function(markers) { + this.markers = markers; + }; + + this.update = function(config) { + var config = config || this.config; + if (!config) + return; + + this.config = config; + + var html = []; + for ( var key in this.markers) { + var marker = this.markers[key]; + + var range = marker.range.clipRows(config.firstRow, config.lastRow); + if (range.isEmpty()) continue; + + range = range.toScreenRange(this.session); + + if (marker.renderer) { + var top = this.$getTop(range.start.row, config); + var left = Math.round(range.start.column * config.characterWidth); + marker.renderer(html, range, left, top, config); + } + else if (range.isMultiLine()) { + if (marker.type == "text") { + this.drawTextMarker(html, range, marker.clazz, config); + } else { + this.drawMultiLineMarker(html, range, marker.clazz, config); + } + } + else { + this.drawSingleLineMarker(html, range, marker.clazz, config); + } + } + this.element = dom.setInnerHtml(this.element, html.join("")); + }; + + this.$getTop = function(row, layerConfig) { + return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight; + }; + + this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig) { + // selection start + var row = range.start.row; + + var lineRange = new Range(row, range.start.column, + row, this.session.getScreenLastRowColumn(row)); + this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1); + + // selection end + var row = range.end.row; + var lineRange = new Range(row, 0, row, range.end.column); + this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig); + + for (var row = range.start.row + 1; row < range.end.row; row++) { + lineRange.start.row = row; + lineRange.end.row = row; + lineRange.end.column = this.session.getScreenLastRowColumn(row); + this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1); + } + }; + + this.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig) { + // from selection start to the end of the line + var height = layerConfig.lineHeight; + var width = Math.round(layerConfig.width - (range.start.column * layerConfig.characterWidth)); + var top = this.$getTop(range.start.row, layerConfig); + var left = Math.round(range.start.column * layerConfig.characterWidth); + + stringBuilder.push( + "
" + ); + + // from start of the last line to the selection end + var top = this.$getTop(range.end.row, layerConfig); + var width = Math.round(range.end.column * layerConfig.characterWidth); + + stringBuilder.push( + "
" + ); + + // all the complete lines + var height = (range.end.row - range.start.row - 1) * layerConfig.lineHeight; + if (height < 0) + return; + var top = this.$getTop(range.start.row + 1, layerConfig); + + stringBuilder.push( + "
" + ); + }; + + this.drawSingleLineMarker = function(stringBuilder, range, clazz, layerConfig, extraLength) { + var height = layerConfig.lineHeight; + var width = Math.round((range.end.column + (extraLength || 0) - range.start.column) * layerConfig.characterWidth); + var top = this.$getTop(range.start.row, layerConfig); + var left = Math.round(range.start.column * layerConfig.characterWidth); + + stringBuilder.push( + "
" + ); + }; + +}).call(Marker.prototype); + +exports.Marker = Marker; + +}); +/* ***** 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 B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Fabian Jakobs + * Julian Viereck + * + * 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/layer/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 = (-n * 40) + "px"; + + 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.setSession = function(session) { + this.session = session; + }; + + this.showInvisibles = false; + this.setShowInvisibles = function(showInvisibles) { + if (this.showInvisibles == showInvisibles) + return false; + + this.showInvisibles = showInvisibles; + return true; + }; + + this.$computeTabString = function() { + var tabSize = this.session.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(config, firstRow, lastRow) { + this.$computeTabString(); + // Due to wrap line changes there can be new lines if e.g. + // the line to updated wrapped in the meantime. + if (this.config.lastRow != config.lastRow || + this.config.firstRow != config.firstRow) { + this.scrollLines(config); + } + this.config = config; + + var first = Math.max(firstRow, config.firstRow); + var last = Math.min(lastRow, config.lastRow); + + var lineElements = this.element.childNodes; + var tokens = this.tokenizer.getTokens(first, last); + for (var i=first; i<=last; i++) { + var lineElement = lineElements[i - config.firstRow]; + if (!lineElement) + continue; + + var html = []; + this.$renderLine(html, i, tokens[i-first].tokens); + lineElement = dom.setInnerHtml(lineElement, html.join("")); + lineElement.style.height = + this.session.getRowHeight(config, i) + "px"; + } + }; + + this.scrollLines = function(config) { + 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); + + if (config.firstRow < oldConfig.firstRow) { + var fragment = this.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1); + if (el.firstChild) + el.insertBefore(fragment, el.firstChild); + else + el.appendChild(fragment); + } + + if (config.lastRow > oldConfig.lastRow) { + var fragment = this.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow); + el.appendChild(fragment); + } + }; + + this.$renderLinesFragment = function(config, firstRow, lastRow) { + var fragment = document.createDocumentFragment(); + var tokens = this.tokenizer.getTokens(firstRow, lastRow); + for (var row=firstRow; row<=lastRow; row++) { + var lineEl = document.createElement("div"); + lineEl.className = "ace_line"; + var style = lineEl.style; + style.height = this.session.getRowHeight(config, row) + "px"; + style.width = config.width + "px"; + + var html = []; + if (tokens.length > row-firstRow) + this.$renderLine(html, row, tokens[row-firstRow].tokens); + // don't use setInnerHtml since we are working with an empty DIV + lineEl.innerHTML = html.join(""); + fragment.appendChild(lineEl); + } + return fragment; + }; + + this.update = function(config) { + this.$computeTabString(); + this.config = config; + + var html = []; + var tokens = this.tokenizer.getTokens(config.firstRow, config.lastRow) + var fragment = this.$renderLinesFragment(config, config.firstRow, config.lastRow); + + // Clear the current content of the element and add the rendered fragment. + this.element.innerHTML = ""; + this.element.appendChild(fragment); + }; + + 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) { + if (space.charCodeAt(0) == 32) + return new Array(space.length+1).join(" "); + else { + 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 = " "; + } + + var _self = this; + var characterWidth = this.config.characterWidth; + function addToken(token, value) { + var output = value + .replace(/&/g, "&") + .replace(/" + c + "" + }); + + if (!_self.$textToken[token.type]) { + var classes = "ace_" + token.type.replace(/\./g, " ace_"); + stringBuilder.push("", output, ""); + } + else { + stringBuilder.push(output); + } + } + + var splits = this.session.getRowSplitData(row); + var chars = 0, split = 0, splitChars; + + if (!splits || splits.length == 0) { + splitChars = Number.MAX_VALUE; + } else { + splitChars = splits[0]; + } + + stringBuilder.push("
"); + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + var value = token.value; + + if (chars + value.length < splitChars) { + addToken(token, value); + chars += value.length; + } else { + while (chars + value.length >= splitChars) { + addToken(token, value.substring(0, splitChars - chars)); + value = value.substring(splitChars - chars); + chars = splitChars; + stringBuilder.push("
", + "
"); + split ++; + splitChars = splits[split] || Number.MAX_VALUE; + } + if (value.length != 0) { + chars += value.length; + addToken(token, value); + } + } + }; + + if (this.showInvisibles) { + if (row !== this.session.getLength() - 1) { + stringBuilder.push("" + this.EOL_CHAR + ""); + } else { + stringBuilder.push("" + this.EOF_CHAR + ""); + } + } + stringBuilder.push("
"); + }; + +}).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 B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Fabian Jakobs + * Julian Viereck + * + * 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/layer/cursor', function(require, exports, module) { + +var dom = require("pilot/dom"); + +var Cursor = function(parentEl) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_cursor-layer"; + parentEl.appendChild(this.element); + + this.cursor = document.createElement("div"); + this.cursor.className = "ace_cursor"; + + this.isVisible = false; +}; + +(function() { + + this.setSession = function(session) { + this.session = session; + }; + + this.setCursor = function(position, overwrite) { + this.position = + this.session.documentToScreenPosition(position); + + if (overwrite) { + dom.addCssClass(this.cursor, "ace_overwrite"); + } else { + dom.removeCssClass(this.cursor, "ace_overwrite"); + } + }; + + this.hideCursor = function() { + this.isVisible = false; + if (this.cursor.parentNode) { + this.cursor.parentNode.removeChild(this.cursor); + } + clearInterval(this.blinkId); + }; + + this.showCursor = function() { + this.isVisible = true; + this.element.appendChild(this.cursor); + + var cursor = this.cursor; + cursor.style.visibility = "visible"; + this.restartTimer(); + }; + + this.restartTimer = function() { + clearInterval(this.blinkId); + if (!this.isVisible) { + return; + } + + var cursor = this.cursor; + this.blinkId = setInterval(function() { + cursor.style.visibility = "hidden"; + setTimeout(function() { + cursor.style.visibility = "visible"; + }, 400); + }, 1000); + }; + + this.getPixelPosition = function(onScreen) { + if (!this.config || !this.position) { + return { + left : 0, + top : 0 + }; + } + + var pos = this.position; + var cursorLeft = Math.round(pos.column * this.config.characterWidth); + var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) * + this.config.lineHeight; + + return { + left : cursorLeft, + top : cursorTop + }; + }; + + this.update = function(config) { + if (!this.position) + return; + + this.config = config; + + this.pixelPos = this.getPixelPosition(true); + + this.cursor.style.left = this.pixelPos.left + "px"; + this.cursor.style.top = this.pixelPos.top + "px"; + this.cursor.style.width = config.characterWidth + "px"; + this.cursor.style.height = config.lineHeight + "px"; + + if (this.isVisible) { + this.element.appendChild(this.cursor); + } + this.restartTimer(); + }; + +}).call(Cursor.prototype); + +exports.Cursor = Cursor; + +}); +/* ***** 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 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/scrollbar', function(require, exports, module) { + +var oop = require("pilot/oop"); +var dom = require("pilot/dom"); +var event = require("pilot/event"); +var EventEmitter = require("pilot/event_emitter").EventEmitter; + +var ScrollBar = function(parent) { + this.element = document.createElement("div"); + this.element.className = "ace_sb"; + + this.inner = document.createElement("div"); + this.element.appendChild(this.inner); + + parent.appendChild(this.element); + + this.width = dom.scrollbarWidth(); + this.element.style.width = this.width; + + event.addListener(this.element, "scroll", this.onScroll.bind(this)); +}; + +(function() { + oop.implement(this, EventEmitter); + + this.onScroll = function() { + this._dispatchEvent("scroll", {data: this.element.scrollTop}); + }; + + this.getWidth = function() { + return this.width; + }; + + this.setHeight = function(height) { + this.element.style.height = Math.max(0, height - this.width) + "px"; + }; + + this.setInnerHeight = function(height) { + this.inner.style.height = height + "px"; + }; + + this.setScrollTop = function(scrollTop) { + this.element.scrollTop = scrollTop; + }; + +}).call(ScrollBar.prototype); + +exports.ScrollBar = ScrollBar; +}); +/* ***** 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 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/renderloop', function(require, exports, module) { + +var event = require("pilot/event"); + +var RenderLoop = function(onRender) { + this.onRender = onRender; + this.pending = false; + this.changes = 0; +}; + +(function() { + + this.schedule = function(change) { + //this.onRender(change); + //return; + this.changes = this.changes | change; + if (!this.pending) { + this.pending = true; + var _self = this; + this.setTimeoutZero(function() { + _self.pending = false; + var changes = _self.changes; + _self.changes = 0; + _self.onRender(changes); + }) + } + }; + + if (window.postMessage) { + + this.messageName = "zero-timeout-message"; + + this.setTimeoutZero = function(callback) { + if (!this.attached) { + var _self = this; + event.addListener(window, "message", function(e) { + if (_self.callback && e.data == _self.messageName) { + event.stopPropagation(e); + _self.callback(); + } + }); + this.attached = true; + } + this.callback = callback; + window.postMessage(this.messageName, "*"); + } + + } else { + + this.setTimeoutZero = function(callback) { + setTimeout(callback, 0); + } + } + +}).call(RenderLoop.prototype); + +exports.RenderLoop = RenderLoop; +}); +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_content {" + + " position: absolute;" + + " box-sizing: border-box;" + + " -moz-box-sizing: border-box;" + + " -webkit-box-sizing: border-box;" + + "}" + + "" + + ".ace_composition {" + + " position: absolute;" + + " background: #555;" + + " color: #DDD;" + + " z-index: 4;" + + "}" + + "" + + ".ace_gutter {" + + " position: absolute;" + + " overflow-x: hidden;" + + " overflow-y: hidden;" + + " height: 100%;" + + "}" + + "" + + ".ace_gutter-cell.ace_error {" + + " background-image: url(\"data:image/gif,GIF89a%10%00%10%00%D5%00%00%F5or%F5%87%88%F5nr%F4ns%EBmq%F5z%7F%DDJT%DEKS%DFOW%F1Yc%F2ah%CE(7%CE)8%D18E%DD%40M%F2KZ%EBU%60%F4%60m%DCir%C8%16(%C8%19*%CE%255%F1%3FR%F1%3FS%E6%AB%B5%CA%5DI%CEn%5E%F7%A2%9A%C9G%3E%E0a%5B%F7%89%85%F5yy%F6%82%80%ED%82%80%FF%BF%BF%E3%C4%C4%FF%FF%FF%FF%FF%FF%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00!%F9%04%01%00%00%25%00%2C%00%00%00%00%10%00%10%00%00%06p%C0%92pH%2C%1A%8F%C8%D2H%93%E1d4%23%E4%88%D3%09mB%1DN%B48%F5%90%40%60%92G%5B%94%20%3E%22%D2%87%24%FA%20%24%C5%06A%00%20%B1%07%02B%A38%89X.v%17%82%11%13q%10%0Fi%24%0F%8B%10%7BD%12%0Ei%09%92%09%0EpD%18%15%24%0A%9Ci%05%0C%18F%18%0B%07%04%01%04%06%A0H%18%12%0D%14%0D%12%A1I%B3%B4%B5IA%00%3B\");" + + " background-repeat: no-repeat;" + + " background-position: 4px center;" + + "}" + + "" + + ".ace_gutter-cell.ace_warning {" + + " background-image: url(\"data:image/gif,GIF89a%10%00%10%00%D5%00%00%FF%DBr%FF%DE%81%FF%E2%8D%FF%E2%8F%FF%E4%96%FF%E3%97%FF%E5%9D%FF%E6%9E%FF%EE%C1%FF%C8Z%FF%CDk%FF%D0s%FF%D4%81%FF%D5%82%FF%D5%83%FF%DC%97%FF%DE%9D%FF%E7%B8%FF%CCl%7BQ%13%80U%15%82W%16%81U%16%89%5B%18%87%5B%18%8C%5E%1A%94d%1D%C5%83-%C9%87%2F%C6%84.%C6%85.%CD%8B2%C9%871%CB%8A3%CD%8B5%DC%98%3F%DF%9BB%E0%9CC%E1%A5U%CB%871%CF%8B5%D1%8D6%DB%97%40%DF%9AB%DD%99B%E3%B0p%E7%CC%AE%FF%FF%FF%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00!%F9%04%01%00%00%2F%00%2C%00%00%00%00%10%00%10%00%00%06a%C0%97pH%2C%1A%8FH%A1%ABTr%25%87%2B%04%82%F4%7C%B9X%91%08%CB%99%1C!%26%13%84*iJ9(%15G%CA%84%14%01%1A%97%0C%03%80%3A%9A%3E%81%84%3E%11%08%B1%8B%20%02%12%0F%18%1A%0F%0A%03'F%1C%04%0B%10%16%18%10%0B%05%1CF%1D-%06%07%9A%9A-%1EG%1B%A0%A1%A0U%A4%A5%A6BA%00%3B\");" + + " background-repeat: no-repeat;" + + " background-position: 4px center;" + + "}" + + "" + + ".ace_editor .ace_sb {" + + " position: absolute;" + + " overflow-x: hidden;" + + " overflow-y: scroll;" + + " right: 0;" + + "}" + + "" + + ".ace_editor .ace_sb div {" + + " position: absolute;" + + " width: 1px;" + + " left: 0;" + + "}" + + "" + + ".ace_editor .ace_print_margin_layer {" + + " z-index: 0;" + + " position: absolute;" + + " overflow: hidden;" + + " margin: 0;" + + " left: 0;" + + " height: 100%;" + + " width: 100%;" + + "}" + + "" + + ".ace_editor .ace_print_margin {" + + " position: absolute;" + + " height: 100%;" + + "}" + + "" + + ".ace_editor textarea {" + + " position: fixed;" + + " z-index: -1;" + + " width: 10px;" + + " height: 30px;" + + " opacity: 0;" + + " background: transparent;" + + " appearance: none;" + + " border: none;" + + " resize: none;" + + " outline: none;" + + " overflow: hidden;" + + "}" + + "" + + ".ace_layer {" + + " z-index: 1;" + + " position: absolute;" + + " overflow: hidden; " + + " white-space: nowrap;" + + " height: 100%;" + + " width: 100%;" + + "}" + + "" + + ".ace_text-layer {" + + " font-family: Monaco, \"Courier New\", monospace;" + + " color: black;" + + "}" + + "" + + ".ace_cjk {" + + " display: inline-block;" + + " text-align: center;" + + "}" + + "" + + ".ace_cursor-layer {" + + " z-index: 4;" + + " cursor: text;" + + " pointer-events: none;" + + "}" + + "" + + ".ace_cursor {" + + " z-index: 4;" + + " position: absolute;" + + "}" + + "" + + ".ace_line {" + + " white-space: nowrap;" + + "}" + + "" + + ".ace_marker-layer {" + + "}" + + "" + + ".ace_marker-layer .ace_step {" + + " position: absolute;" + + " z-index: 3;" + + "}" + + "" + + ".ace_marker-layer .ace_selection {" + + " position: absolute;" + + " z-index: 4;" + + "}" + + "" + + ".ace_marker-layer .ace_bracket {" + + " position: absolute;" + + " z-index: 5;" + + "}" + + "" + + ".ace_marker-layer .ace_active_line {" + + " position: absolute;" + + " z-index: 2;" + + "}" + + ""); + +define("text!ace/theme/eclipse.css", ".ace-eclipse .ace_editor {" + + " border: 2px solid rgb(159, 159, 159);" + + "}" + + "" + + ".ace-eclipse .ace_editor.ace_focus {" + + " border: 2px solid #327fbd;" + + "}" + + "" + + ".ace-eclipse .ace_gutter {" + + " width: 40px;" + + " background: rgb(227, 227, 227);" + + " border-right: 1px solid rgb(159, 159, 159); " + + " color: rgb(136, 136, 136);" + + "}" + + "" + + ".ace-eclipse .ace_gutter-layer {" + + " right: 10px;" + + " text-align: right;" + + "}" + + "" + + ".ace-eclipse .ace_text-layer {" + + " cursor: text;" + + "}" + + "" + + ".ace-eclipse .ace_cursor {" + + " border-left: 1px solid black;" + + "}" + + "" + + ".ace-eclipse .ace_line .ace_keyword, .ace-eclipse .ace_line .ace_variable {" + + " color: rgb(127, 0, 85);" + + "}" + + "" + + ".ace-eclipse .ace_line .ace_constant.ace_buildin {" + + " color: rgb(88, 72, 246);" + + "}" + + "" + + ".ace-eclipse .ace_line .ace_constant.ace_library {" + + " color: rgb(6, 150, 14);" + + "}" + + "" + + ".ace-eclipse .ace_line .ace_function {" + + " color: rgb(60, 76, 114);" + + "}" + + "" + + ".ace-eclipse .ace_line .ace_string {" + + " color: rgb(42, 0, 255);" + + "}" + + "" + + ".ace-eclipse .ace_line .ace_comment {" + + " color: rgb(63, 127, 95);" + + "}" + + "" + + ".ace-eclipse .ace_line .ace_comment.ace_doc {" + + " color: rgb(63, 95, 191);" + + "}" + + "" + + ".ace-eclipse .ace_line .ace_comment.ace_doc.ace_tag {" + + " color: rgb(127, 159, 191);" + + "}" + + "" + + ".ace-eclipse .ace_line .ace_constant.ace_numeric {" + + "}" + + "" + + ".ace-eclipse .ace_line .ace_tag {" + + " color: rgb(63, 127, 127);" + + "}" + + "" + + ".ace-eclipse .ace_line .ace_xml_pe {" + + " color: rgb(104, 104, 91);" + + "}" + + "" + + ".ace-eclipse .ace_marker-layer .ace_selection {" + + " background: rgb(181, 213, 255);" + + "}" + + "" + + ".ace-eclipse .ace_marker-layer .ace_bracket {" + + " margin: -1px 0 0 -1px;" + + " border: 1px solid rgb(192, 192, 192);" + + "}" + + "" + + ".ace-eclipse .ace_marker-layer .ace_active_line {" + + " background: rgb(232, 242, 254);" + + "}"); + +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_print_margin {" + + " 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) " + + "}"); + +define("text!icons/epl.html", "" + + "" + + "" + + "" + + "Eclipse Public License - Version 1.0" + + "" + + "" + + "" + + "" + + "" + + "" + + "

Eclipse Public License - v 1.0

" + + "" + + "

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE" + + "PUBLIC LICENSE (\"AGREEMENT\"). ANY USE, REPRODUCTION OR" + + "DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS" + + "AGREEMENT.

" + + "" + + "

1. DEFINITIONS

" + + "" + + "

\"Contribution\" means:

" + + "" + + "

a) in the case of the initial Contributor, the initial" + + "code and documentation distributed under this Agreement, and

" + + "

b) in the case of each subsequent Contributor:

" + + "

i) changes to the Program, and

" + + "

ii) additions to the Program;

" + + "

where such changes and/or additions to the Program" + + "originate from and are distributed by that particular Contributor. A" + + "Contribution 'originates' from a Contributor if it was added to the" + + "Program by such Contributor itself or anyone acting on such" + + "Contributor's behalf. Contributions do not include additions to the" + + "Program which: (i) are separate modules of software distributed in" + + "conjunction with the Program under their own license agreement, and (ii)" + + "are not derivative works of the Program.

" + + "" + + "

\"Contributor\" means any person or entity that distributes" + + "the Program.

" + + "" + + "

\"Licensed Patents\" mean patent claims licensable by a" + + "Contributor which are necessarily infringed by the use or sale of its" + + "Contribution alone or when combined with the Program.

" + + "" + + "

\"Program\" means the Contributions distributed in accordance" + + "with this Agreement.

" + + "" + + "

\"Recipient\" means anyone who receives the Program under" + + "this Agreement, including all Contributors.

" + + "" + + "

2. GRANT OF RIGHTS

" + + "" + + "

a) Subject to the terms of this Agreement, each" + + "Contributor hereby grants Recipient a non-exclusive, worldwide," + + "royalty-free copyright license to reproduce, prepare derivative works" + + "of, publicly display, publicly perform, distribute and sublicense the" + + "Contribution of such Contributor, if any, and such derivative works, in" + + "source code and object code form.

" + + "" + + "

b) Subject to the terms of this Agreement, each" + + "Contributor hereby grants Recipient a non-exclusive, worldwide," + + "royalty-free patent license under Licensed Patents to make, use, sell," + + "offer to sell, import and otherwise transfer the Contribution of such" + + "Contributor, if any, in source code and object code form. This patent" + + "license shall apply to the combination of the Contribution and the" + + "Program if, at the time the Contribution is added by the Contributor," + + "such addition of the Contribution causes such combination to be covered" + + "by the Licensed Patents. The patent license shall not apply to any other" + + "combinations which include the Contribution. No hardware per se is" + + "licensed hereunder.

" + + "" + + "

c) Recipient understands that although each Contributor" + + "grants the licenses to its Contributions set forth herein, no assurances" + + "are provided by any Contributor that the Program does not infringe the" + + "patent or other intellectual property rights of any other entity. Each" + + "Contributor disclaims any liability to Recipient for claims brought by" + + "any other entity based on infringement of intellectual property rights" + + "or otherwise. As a condition to exercising the rights and licenses" + + "granted hereunder, each Recipient hereby assumes sole responsibility to" + + "secure any other intellectual property rights needed, if any. For" + + "example, if a third party patent license is required to allow Recipient" + + "to distribute the Program, it is Recipient's responsibility to acquire" + + "that license before distributing the Program.

" + + "" + + "

d) Each Contributor represents that to its knowledge it" + + "has sufficient copyright rights in its Contribution, if any, to grant" + + "the copyright license set forth in this Agreement.

" + + "" + + "

3. REQUIREMENTS

" + + "" + + "

A Contributor may choose to distribute the Program in object code" + + "form under its own license agreement, provided that:

" + + "" + + "

a) it complies with the terms and conditions of this" + + "Agreement; and

" + + "" + + "

b) its license agreement:

" + + "" + + "

i) effectively disclaims on behalf of all Contributors" + + "all warranties and conditions, express and implied, including warranties" + + "or conditions of title and non-infringement, and implied warranties or" + + "conditions of merchantability and fitness for a particular purpose;

" + + "" + + "

ii) effectively excludes on behalf of all Contributors" + + "all liability for damages, including direct, indirect, special," + + "incidental and consequential damages, such as lost profits;

" + + "" + + "

iii) states that any provisions which differ from this" + + "Agreement are offered by that Contributor alone and not by any other" + + "party; and

" + + "" + + "

iv) states that source code for the Program is available" + + "from such Contributor, and informs licensees how to obtain it in a" + + "reasonable manner on or through a medium customarily used for software" + + "exchange.

" + + "" + + "

When the Program is made available in source code form:

" + + "" + + "

a) it must be made available under this Agreement; and

" + + "" + + "

b) a copy of this Agreement must be included with each" + + "copy of the Program.

" + + "" + + "

Contributors may not remove or alter any copyright notices contained" + + "within the Program.

" + + "" + + "

Each Contributor must identify itself as the originator of its" + + "Contribution, if any, in a manner that reasonably allows subsequent" + + "Recipients to identify the originator of the Contribution.

" + + "" + + "

4. COMMERCIAL DISTRIBUTION

" + + "" + + "

Commercial distributors of software may accept certain" + + "responsibilities with respect to end users, business partners and the" + + "like. While this license is intended to facilitate the commercial use of" + + "the Program, the Contributor who includes the Program in a commercial" + + "product offering should do so in a manner which does not create" + + "potential liability for other Contributors. Therefore, if a Contributor" + + "includes the Program in a commercial product offering, such Contributor" + + "(\"Commercial Contributor\") hereby agrees to defend and" + + "indemnify every other Contributor (\"Indemnified Contributor\")" + + "against any losses, damages and costs (collectively \"Losses\")" + + "arising from claims, lawsuits and other legal actions brought by a third" + + "party against the Indemnified Contributor to the extent caused by the" + + "acts or omissions of such Commercial Contributor in connection with its" + + "distribution of the Program in a commercial product offering. The" + + "obligations in this section do not apply to any claims or Losses" + + "relating to any actual or alleged intellectual property infringement. In" + + "order to qualify, an Indemnified Contributor must: a) promptly notify" + + "the Commercial Contributor in writing of such claim, and b) allow the" + + "Commercial Contributor to control, and cooperate with the Commercial" + + "Contributor in, the defense and any related settlement negotiations. The" + + "Indemnified Contributor may participate in any such claim at its own" + + "expense.

" + + "" + + "

For example, a Contributor might include the Program in a commercial" + + "product offering, Product X. That Contributor is then a Commercial" + + "Contributor. If that Commercial Contributor then makes performance" + + "claims, or offers warranties related to Product X, those performance" + + "claims and warranties are such Commercial Contributor's responsibility" + + "alone. Under this section, the Commercial Contributor would have to" + + "defend claims against the other Contributors related to those" + + "performance claims and warranties, and if a court requires any other" + + "Contributor to pay any damages as a result, the Commercial Contributor" + + "must pay those damages.

" + + "" + + "

5. NO WARRANTY

" + + "" + + "

EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS" + + "PROVIDED ON AN \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS" + + "OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION," + + "ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY" + + "OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely" + + "responsible for determining the appropriateness of using and" + + "distributing the Program and assumes all risks associated with its" + + "exercise of rights under this Agreement , including but not limited to" + + "the risks and costs of program errors, compliance with applicable laws," + + "damage to or loss of data, programs or equipment, and unavailability or" + + "interruption of operations.

" + + "" + + "

6. DISCLAIMER OF LIABILITY

" + + "" + + "

EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT" + + "NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT," + + "INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING" + + "WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF" + + "LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING" + + "NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR" + + "DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED" + + "HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

" + + "" + + "

7. GENERAL

" + + "" + + "

If any provision of this Agreement is invalid or unenforceable under" + + "applicable law, it shall not affect the validity or enforceability of" + + "the remainder of the terms of this Agreement, and without further action" + + "by the parties hereto, such provision shall be reformed to the minimum" + + "extent necessary to make such provision valid and enforceable.

" + + "" + + "

If Recipient institutes patent litigation against any entity" + + "(including a cross-claim or counterclaim in a lawsuit) alleging that the" + + "Program itself (excluding combinations of the Program with other" + + "software or hardware) infringes such Recipient's patent(s), then such" + + "Recipient's rights granted under Section 2(b) shall terminate as of the" + + "date such litigation is filed.

" + + "" + + "

All Recipient's rights under this Agreement shall terminate if it" + + "fails to comply with any of the material terms or conditions of this" + + "Agreement and does not cure such failure in a reasonable period of time" + + "after becoming aware of such noncompliance. If all Recipient's rights" + + "under this Agreement terminate, Recipient agrees to cease use and" + + "distribution of the Program as soon as reasonably practicable. However," + + "Recipient's obligations under this Agreement and any licenses granted by" + + "Recipient relating to the Program shall continue and survive.

" + + "" + + "

Everyone is permitted to copy and distribute copies of this" + + "Agreement, but in order to avoid inconsistency the Agreement is" + + "copyrighted and may only be modified in the following manner. The" + + "Agreement Steward reserves the right to publish new versions (including" + + "revisions) of this Agreement from time to time. No one other than the" + + "Agreement Steward has the right to modify this Agreement. The Eclipse" + + "Foundation is the initial Agreement Steward. The Eclipse Foundation may" + + "assign the responsibility to serve as the Agreement Steward to a" + + "suitable separate entity. Each new version of the Agreement will be" + + "given a distinguishing version number. The Program (including" + + "Contributions) may always be distributed subject to the version of the" + + "Agreement under which it was received. In addition, after a new version" + + "of the Agreement is published, Contributor may elect to distribute the" + + "Program (including its Contributions) under the new version. Except as" + + "expressly stated in Sections 2(a) and 2(b) above, Recipient receives no" + + "rights or licenses to the intellectual property of any Contributor under" + + "this Agreement, whether expressly, by implication, estoppel or" + + "otherwise. All rights in the Program not expressly granted under this" + + "Agreement are reserved.

" + + "" + + "

This Agreement is governed by the laws of the State of New York and" + + "the intellectual property laws of the United States of America. No party" + + "to this Agreement will bring a legal action under this Agreement more" + + "than one year after the cause of action arose. Each party waives its" + + "rights to a jury trial in any resulting litigation.

" + + "" + + "" + + "" + + "" + + ""); + +define("text!styles.css", "html {" + + " height: 100%;" + + " overflow: hidden;" + + "}" + + "" + + "body {" + + " overflow: hidden;" + + " margin: 0;" + + " padding: 0;" + + " height: 100%;" + + " width: 100%;" + + " font-family: Arial, Helvetica, sans-serif, Tahoma, Verdana, sans-serif;" + + " font-size: 12px;" + + " background: rgb(14, 98, 165);" + + " color: white;" + + "}" + + "" + + "#editor {" + + " position: absolute;" + + " top: 60px;" + + " left: 0px;" + + " background: white;" + + "}" + + "" + + ".cool {" + + " position: absolute;" + + " background: orange;" + + " opacity: 0.8;" + + "}" + + "" + + ".cool_header {" + + " position: absolute;" + + " background: orange;" + + " color: black;" + + " font-size: 8px;" + + " padding: 1px;" + + " margin-top: -8px;" + + " opacity: 0.8;" + + "}" + + "" + + "#controls {" + + " width: 100%;" + + "}" + + "" + + "#cockpitInput {" + + " position: absolute;" + + " width: 100%;" + + " bottom: 0;" + + "" + + " border: none; outline: none;" + + " font-family: consolas, courier, monospace;" + + " font-size: 120%;" + + "}" + + "" + + "#cockpitOutput {" + + " padding: 10px;" + + " margin: 0 15px;" + + " border: 1px solid #AAA;" + + " -moz-border-radius-topleft: 10px;" + + " -moz-border-radius-topright: 10px;" + + " border-top-left-radius: 4px; border-top-right-radius: 4px;" + + " background: #DDD; color: #000;" + + "}"); + +define("text!icons/error_obj.gif", "data:image/gif;base64,R0lGODlhEAAQANUAAPVvcvWHiPVucvRuc+ttcfV6f91KVN5LU99PV/FZY/JhaM4oN84pONE4Rd1ATfJLWutVYPRgbdxpcsgWKMgZKs4lNfE/UvE/U+artcpdSc5uXveimslHPuBhW/eJhfV5efaCgO2CgP+/v+PExP///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACUALAAAAAAQABAAAAZwwJJwSCwaj8jSSJPhZDQj5IjTCW1CHU60OPWQQGCSR1uUID4i0ock+iAkxQZBACCxBwJCoziJWC52F4IRE3EQD2kkD4sQe0QSDmkJkgkOcEQYFSQKnGkFDBhGGAsHBAEEBqBIGBINFA0SoUmztLVJQQA7"); + +define("text!icons/warning_obj.gif", "data:image/gif;base64,R0lGODlhEAAQANUAAP/bcv/egf/ijf/ij//klv/jl//lnf/mnv/uwf/IWv/Na//Qc//Ugf/Vgv/Vg//cl//enf/nuP/MbHtRE4BVFYJXFoFVFolbGIdbGIxeGpRkHcWDLcmHL8aELsaFLs2LMsmHMcuKM82LNdyYP9+bQuCcQ+GlVcuHMc+LNdGNNtuXQN+aQt2ZQuOwcOfMrv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAC8ALAAAAAAQABAAAAZhwJdwSCwaj0ihq1RyJYcrBIL0fLlYkQjLmRwhJhOEKmlKOSgVR8qEFAEalwwDgDqaPoGEPhEIsYsgAhIPGBoPCgMnRhwECxAWGBALBRxGHS0GB5qaLR5HG6ChoFWkpaZCQQA7"); + +define("text!logo.png", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIkAAAAyCAYAAABoKfh/AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAP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/hy2V/SkTIqVE8OIn/OovV0BC9DHT+oePXdcPnauK/3svjNEBQS+ZDcVT2otnAsdxQRmFojAILvoYZ70qp3/isDcGI4REfjRw4txpw07bdaBrRX40MG5iTf7PH3lp7VONXdZFSrbeF8S/v8+H8SO1IKQvGce58O+djRtwT/h9UBgY7bexH+ndb1bAdTiYyvzKQMvFacdUf1hbkTvp9//4rIiqrEdTlYMMvew2oY7rEYUpUlV8Bl52q5SDHOHed+x3neyXm+lj+fXlnw7uf+u6HkAIVEXpJyX8zZC564+nopDD/yDRfyFIlAFEFUZ8PvphHqowAil9rnrvy/XPnfiZSvKlfElviWbvDw31/8GhQ398iGWzaGnLGbS/ofnqyrzw9Rnbwp+fX/VmU9z5iaYOJB4r/eh79HD3OuTdJKHZyTp8cZWq+N9LCaiqgm11bQ1NbT0lqqYQxggOZXAySqApVPZ/9qG7ZLPDVEX1jkd/CgM7xI7wGfv+DxTRfglOkk0XUoX+p38w6n+3/a8BAGOtxmE+9d9lAAAAAElFTkSuQmCC"); + +/* ***** 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 Mozilla Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Kevin Dangoor (kdangoor@mozilla.com) + * + * 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 ***** */ + +var deps = [ + "pilot/fixoldbrowsers", + "pilot/index", + "pilot/plugin_manager", + "pilot/environment", + "ace/editor", + "ace/edit_session", + "ace/virtual_renderer", + "ace/undomanager", + "ace/theme/textmate" +]; + +require(deps, function() { + var catalog = require("pilot/plugin_manager").catalog; + catalog.registerPlugins([ "pilot/index" ]); + + var Dom = require("pilot/dom"); + var Event = require("pilot/event"); + + var Editor = require("ace/editor").Editor; + var EditSession = require("ace/edit_session").EditSession; + var UndoManager = require("ace/undomanager").UndoManager; + var Renderer = require("ace/virtual_renderer").VirtualRenderer; + + window.ace = { + edit: function(el) { + if (typeof(el) == "string") { + el = document.getElementById(el); + } + + var doc = new EditSession(Dom.getInnerText(el)); + doc.setUndoManager(new UndoManager()); + el.innerHTML = ''; + + var editor = new Editor(new Renderer(el, "ace/theme/textmate")); + editor.setSession(doc); + + var env = require("pilot/environment").create(); + catalog.startupPlugins({ env: env }).then(function() { + env.document = doc; + env.editor = env; + editor.resize(); + Event.addListener(window, "resize", function() { + editor.resize(); + }); + el.env = env; + }); + return editor; + } + }; +}); diff --git a/src/static/ace-0.1.6/src/ace.js b/src/static/ace-0.1.6/src/ace.js new file mode 100644 index 0000000..651c613 --- /dev/null +++ b/src/static/ace-0.1.6/src/ace.js @@ -0,0 +1 @@ +(function(){var a=function(b,c){typeof b!=="string"?a.original?a.original.apply(window,arguments):(console.error("dropping module because define wasn't a string."),console.trace()):(define.modules||(define.modules={}),define.modules[b]=c)};window.define&&(a.original=window.define),window.define=a;var b=function(a,d){if(Object.prototype.toString.call(a)==="[object Array]"){var e=[];for(var f=0,g=a.length;f>>0;if(c===0)return-1;var d=0,e=d;arguments.length>0&&(d=Number(arguments[1]),d!==d?d=0:d!==0&&d!==1/e&&d!==-(1/e)&&(d=(d>0||-1)*Math.floor(Math.abs(d))));if(d>=c)return-1;var f=d>=0?d:Math.max(c-Math.abs(d),0);for(;f>>0;if(c===0)return-1;var d=c,e=!1|0;arguments.length>0&&(d=Number(arguments[1]),d!==d?d=0:d!==0&&d!==1/e&&d!==-(1/e)&&(d=(d>0||-1)*Math.floor(Math.abs(d))));var f=d>=0?Math.min(d,c-1):c-Math.abs(d);while(f>=0)if(f in b&&b[f]===a)return f;return-1}),Array.prototype.map||(Array.prototype.map=function(a){if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!=="function")throw new TypeError;res=Array(c);var d=arguments[1];for(var e=0;e>>0;if(typeof a!=="function")throw new TypeError;var d=arguments[1];for(var e=0;e>>0;if(typeof a!="function")throw new TypeError;if(b==0&&arguments.length==1)throw new TypeError;var c=0;if(arguments.length<2){do{if(c in this){d=this[c++];break}if(++c>=b)throw new TypeError}while(!0)}else var d=arguments[1];for(;c>>0;if(typeof a!="function")throw new TypeError;if(b==0&&arguments.length==1)throw new TypeError;var c=b-1;if(arguments.length<2){do{if(c in this){d=this[c--];break}if(--c<0)throw new TypeError}while(!0)}else var d=arguments[1];for(;c>=0;c--)c in this&&(d=a.call(null,d,this[c],c,this));return d}),Object.keys||(Object.keys=function m(a){var b,c=[];for(b in a)f(a,b)&&c.push(b);return c}),Object.getOwnPropertyNames||(Object.getOwnPropertyNames=Object.keys);var n="Object.getOwnPropertyDescriptor called on a non-object";Object.getOwnPropertyDescriptor||(Object.getOwnPropertyDescriptor=function o(a,b){var c,d,e;if(typeof a!=="object"&&typeof a!=="function"||a===null)throw new TypeError(n);f(a,b)&&(c={configurable:!0,enumerable:!0},d=c.get=g(a,b),e=c.set=h(a,b),!d&&!e&&(c.writeable=!0,c.value=a[b]));return c}),Object.getPrototypeOf||(Object.getPrototypeOf=function p(a){return a.__proto__||a.constructor.prototype}),Object.create||(Object.create=function q(a,b){var c;if(a===null)c={"__proto__":null};else{if(typeof a!=="object")throw new TypeError(a+" is not an object or null");d.prototype=a,c=new d}typeof b!=="undefined"&&Object.defineProperties(c,b);return c}),Object.defineProperty||(Object.defineProperty=function r(a,b,c){var d,e,f;if("object"!==typeof a&&"function"!==typeof a)throw new TypeError(a+"is not an object");if(c&&"object"!==typeof c)throw new TypeError("Property descriptor map must be an object");if("value"in c){if("get"in c||"set"in c)throw new TypeError('Invalid property. "value" present on property with getter or setter.');if(d=a.__proto__)a.__proto__=Object.prototype;delete a[b],a[b]=c.value,d&&(a.__proto__=d)}else(f=c.get)&&i(a,f),(e=c.set)&&j(a,e);return a}),Object.defineProperties||(Object.defineProperties=function s(a,b){Object.getOwnPropertyNames(b).forEach(function(c){Object.defineProperty(a,c,b[c])});return a});var t=function(a){return a};Object.seal||(Object.seal=t),Object.freeze||(Object.freeze=t),Object.preventExtensions||(Object.preventExtension=t);var u=function(){return!1},v=function(){return!0};Object.isSealed||(Object.isSealed=u),Object.isFrozen||(Object.isFrozen=u),Object.isExtensible||(Object.isExtensible=v),String.prototype.trim||(String.prototype.trim=function(){return this.trimLeft().trimRight()}),String.prototype.trimRight||(String.prototype.trimRight=function(){return this.replace(/[\t\v\f\s\u00a0\ufeff]+$/,"")}),String.prototype.trimLeft||(String.prototype.trimLeft=function(){return this.replace(/^[\t\v\f\s\u00a0\ufeff]+/,"")}),b.globalsLoaded=!0}),define("pilot/index",function(a,b,c){b.startup=function(b,c){a("pilot/fixoldbrowsers"),a("pilot/types/basic").startup(b,c),a("pilot/types/command").startup(b,c),a("pilot/types/settings").startup(b,c),a("pilot/commands/settings").startup(b,c),a("pilot/commands/basic").startup(b,c),a("pilot/settings/canon").startup(b,c),a("pilot/canon").startup(b,c)},b.shutdown=function(b,c){a("pilot/types/basic").shutdown(b,c),a("pilot/types/command").shutdown(b,c),a("pilot/types/settings").shutdown(b,c),a("pilot/commands/settings").shutdown(b,c),a("pilot/commands/basic").shutdown(b,c),a("pilot/settings/canon").shutdown(b,c),a("pilot/canon").shutdown(b,c)}}),define("pilot/types/basic",function(a,b,c){function m(a){if(a instanceof e)this.subtype=a;else{if(typeof a!=="string")throw new Error("Can' handle array subtype");this.subtype=d.getType(a);if(this.subtype==null)throw new Error("Unknown array subtype: "+a)}}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)}function j(a){if(!Array.isArray(a.data)&&typeof a.data!=="function")throw new Error("instances of SelectionType need typeSpec.data to be an array or function that returns an array:"+JSON.stringify(a));Object.keys(a).forEach(function(b){this[b]=a[b]},this)}var d=a("pilot/types"),e=d.Type,f=d.Conversion,g=d.Status,h=new e;h.stringify=function(a){return a},h.parse=function(a){if(typeof a!="string")throw new Error("non-string passed to text.parse()");return new f(a)},h.name="text";var i=new e;i.stringify=function(a){if(!a)return null;return""+a},i.parse=function(a){if(typeof a!="string")throw new Error("non-string passed to number.parse()");if(a.replace(/\s/g,"").length===0)return new f(null,g.INCOMPLETE,"");var b=new f(parseInt(a,10));isNaN(b.value)&&(b.status=g.INVALID,b.message="Can't convert \""+a+'" to a number.');return b},i.decrement=function(a){return a-1},i.increment=function(a){return a+1},i.name="number",j.prototype=new e,j.prototype.stringify=function(a){return a},j.prototype.parse=function(a){if(typeof a!="string")throw new Error("non-string passed to parse()");if(!this.data)throw new Error("Missing data on selection type extension.");var b=typeof this.data==="function"?this.data():this.data,c=!1,d,e=[];b.forEach(function(b){a==b?(d=this.fromString(b),c=!0):b.indexOf(a)===0&&e.push(this.fromString(b))},this);if(c)return new f(d);this.noMatch&&this.noMatch();if(e.length>0){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",function(a,b,c){function i(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.registerTypes=function h(a){Object.keys(a).forEach(function(c){var d=a[c];d.name=c,b.registerType(d)})},b.deregisterType=function(a){delete g[a.name]},b.getType=function(a){if(typeof a==="string")return i(a);if(typeof a==="object"){if(!a.name)throw new Error("Missing 'name' member to typeSpec");return i(a.name,a)}throw new Error("Can't extract type from "+a)}}),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/canon",function(a,b,c){function x(a){a=a||{},this.command=a.command,this.args=a.args,this.typed=a.typed,this._begunOutput=!1,this.start=new Date,this.end=null,this.completed=!1,this.error=!1}function u(a,b,c,d){typeof a==="string"&&(a=n[a]);if(!a)return!1;var e=new x({command:a,args:c,typed:d});a.exec(b,c||{},e);return!0}function t(){return o}function s(a){return n[a]}function r(a){var b=typeof a==="string"?a:a.name;delete n[b],k.arrayRemove(o,b)}function q(a,b){var c=b.type;b.type=j.getType(c);if(b.type==null)throw new Error("In "+a+"/"+b.name+": can't find type for: "+JSON.stringify(c))}function p(a){if(!a.name)throw new Error("All registered commands must have a name");a.params==null&&(a.params=[]);if(!Array.isArray(a.params))throw new Error("command.params must be an array in "+a.name);a.params.forEach(function(b){if(!b.name)throw new Error("In "+a.name+": all params must have a name");q(a.name,b)},this),n[a.name]=a,o.push(a.name),o.sort()}var d=a("pilot/console"),e=a("pilot/stacktrace").Trace,f=a("pilot/oop"),g=a("pilot/event_emitter").EventEmitter,h=a("pilot/catalog"),i=a("pilot/types").Status,j=a("pilot/types"),k=a("pilot/lang"),l={name:"command",description:"A command is a bit of functionality with optional typed arguments which can do something small like moving the cursor around the screen, or large like cloning a project from VCS.",indexOn:"name"};b.startup=function(a,b){h.addExtensionSpec(l)},b.shutdown=function(a,b){h.removeExtensionSpec(l)};var m={name:"thing",description:"thing is an example command",params:[{name:"param1",description:"an example parameter",type:"text",defaultValue:null}],exec:function(a,b,c){thing()}},n={},o=[];b.removeCommand=r,b.addCommand=p,b.getCommand=s,b.getCommandNames=t,b.exec=u,b.upgradeType=q,f.implement(b,g);var v=[],w=100;f.implement(x.prototype,g),x.prototype._beginOutput=function(){this._begunOutput=!0,this.outputs=[],v.push(this);while(v.length>w)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/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/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;e=0,b.isIPad=e.indexOf("iPad")>=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("pilot/oop",function(a,b,c){b.inherits=function(){var a=function(){};return function(b,c){a.prototype=c.prototype,b.super_=c.prototype,b.prototype=new a,b.prototype.constructor=b}}(),b.mixin=function(a,b){for(var c in b)a[c]=b[c]},b.implement=function(a,c){b.mixin(a,c)}}),define("pilot/event_emitter",function(a,b,c){var d={};d._emit=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"+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/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/typecheck",function(a,b,c){var d=Object.prototype.toString;b.isString=function(a){return a&&d.call(a)==="[object String]"},b.isBoolean=function(a){return a&&d.call(a)==="[object Boolean]"},b.isNumber=function(a){return a&&d.call(a)==="[object Number]"&&isFinite(a)},b.isObject=function(a){return a!==undefined&&(a===null||typeof a=="object"||Array.isArray(a)||b.isFunction(a))},b.isFunction=function(a){return a&&d.call(a)==="[object Function]"}}),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/plugin_manager",function(a,b,c){var d=a("pilot/promise").Promise;b.REASONS={APP_STARTUP:1,APP_SHUTDOWN:2,PLUGIN_ENABLE:3,PLUGIN_DISABLE:4,PLUGIN_INSTALL:5,PLUGIN_UNINSTALL:6,PLUGIN_UPGRADE:7,PLUGIN_DOWNGRADE:8},b.Plugin=function(a){this.name=a,this.status=this.INSTALLED},b.Plugin.prototype={NEW:0,INSTALLED:1,REGISTERED:2,STARTED:3,UNREGISTERED:4,SHUTDOWN:5,install:function(b,c){var e=new d;if(this.status>this.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/environment",function(a,b,c){function e(){return{settings:d}}var d=a("pilot/settings").settings;b.create=e}),define("ace/editor",function(a,b,c){a("pilot/fixoldbrowsers");var d=a("pilot/oop"),e=a("pilot/event"),f=a("pilot/lang"),g=a("pilot/useragent"),h=a("ace/keyboard/textinput").TextInput,i=a("ace/mouse_handler").MouseHandler,j=a("ace/keyboard/keybinding").KeyBinding,k=a("ace/edit_session").EditSession,l=a("ace/search").Search,m=a("ace/background_tokenizer").BackgroundTokenizer,n=a("ace/range").Range,o=a("pilot/event_emitter").EventEmitter,p=function(a,b){var c=a.getContainerElement();this.container=c,this.renderer=a,this.textInput=new h(a.getTextAreaContainer(),this),this.keyBinding=new j(this),g.isIPad||(this.$mouseHandler=new i(this)),this.$blockScrolling=0,this.$search=(new l).set({wrap:!0}),this.setSession(b||new k(""))};(function(){d.implement(this,o),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.setKeyboardHandler=function(a){this.keyBinding.setKeyboardHandler(a)},this.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},this.setSession=function(a){if(this.session!=a){if(this.session){var b=this.session;this.session.removeEventListener("change",this.$onDocumentChange),this.session.removeEventListener("changeMode",this.$onDocumentModeChange),this.session.removeEventListener("changeTabSize",this.$onDocumentChangeTabSize),this.session.removeEventListener("changeWrapLimit",this.$onDocumentChangeWrapLimit),this.session.removeEventListener("changeWrapMode",this.$onDocumentChangeWrapMode),this.session.removeEventListener("changeFrontMarker",this.$onChangeFrontMarker),this.session.removeEventListener("changeBackMarker",this.$onChangeBackMarker),this.session.removeEventListener("changeBreakpoint",this.$onDocumentChangeBreakpoint),this.session.removeEventListener("changeAnnotation",this.$onDocumentChangeAnnotation);var c=this.session.getSelection();c.removeEventListener("changeCursor",this.$onCursorChange),c.removeEventListener("changeSelection",this.$onSelectionChange),this.session.setScrollTopRow(this.renderer.getScrollTopRow())}this.session=a,this.$onDocumentChange=this.onDocumentChange.bind(this),a.addEventListener("change",this.$onDocumentChange),this.renderer.setSession(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.$onDocumentChangeWrapLimit=this.onDocumentChangeWrapLimit.bind(this),a.addEventListener("changeWrapLimit",this.$onDocumentChangeWrapLimit),this.$onDocumentChangeWrapMode=this.onDocumentChangeWrapMode.bind(this),a.addEventListener("changeWrapMode",this.$onDocumentChangeWrapMode),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.addEventListener("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.addEventListener("changeBackMarker",this.$onChangeBackMarker),this.$onDocumentChangeBreakpoint=this.onDocumentChangeBreakpoint.bind(this),this.session.addEventListener("changeBreakpoint",this.$onDocumentChangeBreakpoint),this.$onDocumentChangeAnnotation=this.onDocumentChangeAnnotation.bind(this),this.session.addEventListener("changeAnnotation",this.$onDocumentChangeAnnotation),this.selection=a.getSelection(),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.setDocument(a.getDocument()),this.bgTokenizer.start(0),this.onCursorChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onDocumentChangeBreakpoint(),this.onDocumentChangeAnnotation(),this.renderer.scrollToRow(a.getScrollTopRow()),this.renderer.updateFull(),this._dispatchEvent("changeSession",{session:a,oldSession:b})}},this.getSession=function(){return this.session},this.getSelection=function(){return this.selection},this.resize=function(){this.renderer.onResize()},this.setTheme=function(a){this.renderer.setTheme(a)},this.setStyle=function(a){this.renderer.setStyle(a)},this.unsetStyle=function(a){this.renderer.unsetStyle(a)},this.$highlightBrackets=function(){this.$bracketHighlight&&(this.session.removeMarker(this.$bracketHighlight),this.$bracketHighlight=null);if(!this.$highlightPending){var a=this;this.$highlightPending=!0,setTimeout(function(){a.$highlightPending=!1;var b=a.session.findMatchingBracket(a.getCursorPosition());if(b){var c=new n(b.row,b.column,b.row,b.column+1);a.$bracketHighlight=a.session.addMarker(c,"ace_bracket")}},10)}},this.focus=function(){var a=this;setTimeout(function(){a.textInput.focus()}),this.textInput.focus()},this.blur=function(){this.textInput.blur()},this.onFocus=function(){this.renderer.showCursor(),this.renderer.visualizeFocus(),this._dispatchEvent("focus")},this.onBlur=function(){this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._dispatchEvent("blur")},this.onDocumentChange=function(a){var b=a.data,c=b.range;this.bgTokenizer.start(c.start.row);if(c.start.row==c.end.row&&b.action!="insertLines"&&b.action!="removeLines")var d=c.end.row;else d=Infinity;this.renderer.updateLines(c.start.row,d),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(a){this.renderer.updateCursor(this.getCursorPosition(),this.$overwrite),this.$blockScrolling||this.renderer.scrollCursorIntoView(),this.renderer.moveTextAreaToCursor(this.textInput.getElement()),this.$highlightBrackets(),this.$updateHighlightActiveLine()},this.$updateHighlightActiveLine=function(){var a=this.getSession();a.$highlightLineMarker&&a.removeMarker(a.$highlightLineMarker),a.$highlightLineMarker=null;if(this.getHighlightActiveLine()&&(this.getSelectionStyle()!="line"||!this.selection.isMultiLine())){var b=this.getCursorPosition(),c=new n(b.row,0,b.row+1,0);a.$highlightLineMarker=a.addMarker(c,"ace_active_line","line")}},this.onSelectionChange=function(a){var b=this.getSession();b.$selectionMarker&&b.removeMarker(b.$selectionMarker),b.$selectionMarker=null;if(!this.selection.isEmpty()){var c=this.selection.getRange(),d=this.getSelectionStyle();b.$selectionMarker=b.addMarker(c,"ace_selection",d)}this.onCursorChange(a)},this.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},this.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},this.onDocumentChangeBreakpoint=function(){this.renderer.setBreakpoints(this.session.getBreakpoints())},this.onDocumentChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},this.onDocumentModeChange=function(){var a=this.session.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 m(b,this),this.bgTokenizer.addEventListener("update",c)}this.renderer.setTokenizer(this.bgTokenizer)}},this.onDocumentChangeWrapLimit=function(){this.renderer.updateCursor(this.getCursorPosition(),this.$overwrite),this.renderer.updateFull()},this.onDocumentChangeWrapMode=function(){this.renderer.onResize(!0)},this.getCopyText=function(){return this.selection.isEmpty()?"":this.session.getTextRange(this.getSelectionRange())},this.onCut=function(){this.$readOnly||(this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection()))},this.insert=function(a){if(!this.$readOnly){var b=this.getCursorPosition();a=a.replace("\t",this.session.getTabString());if(this.selection.isEmpty()){if(this.$overwrite){var c=new n.fromPoints(b,b);c.end.column+=a.length,this.session.remove(c)}}else{var b=this.session.remove(this.getSelectionRange());this.clearSelection()}this.clearSelection();var d=this.bgTokenizer.getState(b.row),e=this.mode.checkOutdent(d,this.session.getLine(b.row),a),f=this.session.getLine(b.row),g=this.mode.getNextLineIndent(d,f.slice(0,b.column),this.session.getTabString()),h=this.session.insert(b,a);this.moveCursorToPosition(h);var d=this.bgTokenizer.getState(b.row);if(b.row!==h.row){var i=this.session.getTabSize(),j=Number.MAX_VALUE;for(var k=b.row+1;k<=h.row;++k){var l=0;f=this.session.getLine(k);for(var m=0;m0;++m)f.charAt(m)=="\t"?o-=i:f.charAt(m)==" "&&(o-=1);this.session.remove(new n(k,0,k,m))}this.session.indentRows(b.row+1,h.row,g)}else e&&this.mode.autoOutdent(d,this.session,b.row)}},this.onTextInput=function(a){this.keyBinding.onTextInput(a)},this.onCommandKey=function(a,b,c){this.keyBinding.onCommandKey(a,b,c)},this.$overwrite=!1,this.setOverwrite=function(a){this.$overwrite!=a&&(this.$overwrite=a,this.$blockScrolling+=1,this.onCursorChange(),this.$blockScrolling-=1,this._dispatchEvent("changeOverwrite",{data:a}))},this.getOverwrite=function(){return this.$overwrite},this.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},this.setScrollSpeed=function(a){this.$mouseHandler.setScrollSpeed(a)},this.getScrollSpeed=function(){return this.$mouseHandler.getScrollSpeed()},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.session.remove(this.getSelectionRange()),this.clearSelection())},this.removeLeft=function(){this.$readOnly||(this.selection.isEmpty()&&this.selection.selectLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection())},this.removeWordRight=function(){this.$readOnly||(this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection())},this.removeWordLeft=function(){this.$readOnly||(this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection())},this.removeToLineStart=function(){this.$readOnly||(this.selection.isEmpty()&&this.selection.selectLineStart(),this.session.remove(this.getSelectionRange()),this.clearSelection())},this.removeToLineEnd=function(){this.$readOnly||(this.selection.isEmpty()&&this.selection.selectLineEnd(),this.session.remove(this.getSelectionRange()),this.clearSelection())},this.splitLine=function(){if(!this.$readOnly){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var a=this.getCursorPosition();this.insert("\n"),this.moveCursorToPosition(a)}},this.transposeLetters=function(){if(!this.$readOnly){if(!this.selection.isEmpty())return;var a=this.getCursorPosition(),b=a.column;if(b==0)return;var c=this.session.getLine(a.row);if(b=b.end.row&&b.start.column>=b.end.column){var d;if(this.session.getUseSoftTabs()){var e=a.getTabSize(),g=this.getCursorPosition(),h=a.documentToScreenColumn(g.row,g.column),i=e-h%e;d=f.stringRepeat(" ",i)}else d="\t";return this.onTextInput(d)}var c=this.$getSelectedRows();a.indentRows(c.first,c.last,"\t")}},this.blockOutdent=function(){if(!this.$readOnly){var a=this.session.getSelection();this.session.outdentRows(a.getRange())}},this.toggleCommentLines=function(){if(!this.$readOnly){var a=this.bgTokenizer.getState(this.getCursorPosition().row),b=this.$getSelectedRows();this.mode.toggleCommentLines(a,this.session,b.first,b.last)}},this.removeLines=function(){if(!this.$readOnly){var a=this.$getSelectedRows();this.session.remove(new n(a.first,0,a.last+1,0)),this.clearSelection()}},this.moveLinesDown=function(){this.$readOnly||this.$moveLines(function(a,b){return this.session.moveLinesDown(a,b)})},this.moveLinesUp=function(){this.$readOnly||this.$moveLines(function(a,b){return this.session.moveLinesUp(a,b)})},this.copyLinesUp=function(){this.$readOnly||this.$moveLines(function(a,b){this.session.duplicateLines(a,b);return 0})},this.copyLinesDown=function(){this.$readOnly||this.$moveLines(function(a,b){return this.session.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.session.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.session.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.scrollToLine=function(a,b){this.renderer.scrollToLine(a,b)},this.centerSelection=function(){var a=this.getSelectionRange(),b=Math.floor(a.start.row+(a.end.row-a.start.row)/2);this.renderer.scrollToLine(b,!0)},this.getCursorPosition=function(){return this.selection.getCursor()},this.getSelectionRange=function(){return this.selection.getRange()},this.selectAll=function(){this.$blockScrolling+=1,this.selection.selectAll(),this.$blockScrolling-=1},this.clearSelection=function(){this.selection.clearSelection()},this.moveCursorTo=function(a,b){this.selection.moveCursorTo(a,b)},this.moveCursorToPosition=function(a){this.selection.moveCursorToPosition(a)},this.gotoLine=function(a,b){this.selection.clearSelection(),this.$blockScrolling+=1,this.moveCursorTo(a-1,b||0),this.$blockScrolling-=1,this.isRowVisible(this.getCursorPosition().row)||this.scrollToLine(a,!0)},this.navigateTo=function(a,b){this.clearSelection(),this.moveCursorTo(a,b)},this.navigateUp=function(a){this.selection.clearSelection(),a=a||1,this.selection.moveCursorBy(-a,0)},this.navigateDown=function(a){this.selection.clearSelection(),a=a||1,this.selection.moveCursorBy(a,0)},this.navigateLeft=function(a){if(this.selection.isEmpty()){a=a||1;while(a--)this.selection.moveCursorLeft()}else{var b=this.getSelectionRange().start;this.moveCursorToPosition(b)}this.clearSelection()},this.navigateRight=function(a){if(this.selection.isEmpty()){a=a||1;while(a--)this.selection.moveCursorRight()}else{var b=this.getSelectionRange().end;this.moveCursorToPosition(b)}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.session);this.$tryReplace(c,a),c!==null&&this.selection.setSelectionRange(c)},this.replaceAll=function(a,b){b&&this.$search.set(b);var c=this.$search.findAll(this.session);if(c.length){var d=this.getSelectionRange();this.clearSelection(),this.selection.moveCursorTo(0,0),this.$blockScrolling+=1;for(var e=c.length-1;e>=0;--e)this.$tryReplace(c[e],a);this.selection.setSelectionRange(d),this.$blockScrolling-=1}},this.$tryReplace=function(a,b){var c=this.session.getTextRange(a),b=this.$search.replace(c,b);if(b!==null){a.end=this.session.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.session.getTextRange(this.getSelectionRange())}),typeof a!="undefined"&&this.$search.set({backwards:a});var b=this.$search.find(this.session);b&&(this.gotoLine(b.end.row+1,b.end.column),this.selection.setSelectionRange(b))},this.undo=function(){this.session.getUndoManager().undo()},this.redo=function(){this.session.getUndoManager().redo()}}).call(p.prototype),b.Editor=p}),define("pilot/event",function(a,b,c){function g(a,b,c){var f=0;e.isOpera&&e.isMac?f=0|(b.metaKey?1:0)|(b.altKey?2:0)|(b.shiftKey?4:0)|(b.ctrlKey?8:0):f=0|(b.ctrlKey?1:0)|(b.altKey?2:0)|(b.shiftKey?4:0)|(b.metaKey?8:0);if(c in d.MODIFIER_KEYS){switch(d.MODIFIER_KEYS[c]){case"Alt":f=2;break;case"Shift":f=4;break;case"Ctrl":f=1;break;default:f=8}c=0}f&8&&(c==91||c==93)&&(c=0);if(f==0&&!(c in d.FUNCTION_KEYS))return!1;return a(b,f,c)}var d=a("pilot/keys"),e=a("pilot/useragent"),f=a("pilot/dom");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){return a.clientX?a.clientX+f.getPageScrollLeft():a.pageX},b.getDocumentY=function(a){return a.clientY?a.clientY+f.getPageScrollTop():a.pageY},b.getButton=function(a){if(a.type=="dblclick")return 0;if(a.type=="contextmenu")return 2;return a.preventDefault?a.button:({1:0,2:2,4:1})[a.button]},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,d,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==d&&(h=0,g(a));return b.preventDefault(a)};b.addListener(a,"mousedown",k),e.isIE&&b.addListener(a,"dblclick",k)},b.addCommandKeyListener=function(a,c){var d=b.addListener;if(e.isOldGecko){var f=null;d(a,"keydown",function(a){f=a.keyCode}),d(a,"keypress",function(a){return g(c,a,f)})}else{var h=null;d(a,"keydown",function(a){h=a.keyIdentifier||a.keyCode;return g(c,a,a.keyCode)}),e.isMac&&e.isOpera&&d(a,"keypress",function(a){var b=a.keyIdentifier||a.keyCode;if(h!==b)return g(c,a,a.keyCode);h=null})}}}),define("pilot/keys",function(a,b,c){var d=a("pilot/oop"),e=function(){var a={MODIFIER_KEYS:{16:"Shift",17:"Ctrl",18:"Alt",224:"Meta"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,meta:8,command:8},FUNCTION_KEYS:{8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock"},PRINTABLE_KEYS:{32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",188:",",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:'"'}};for(i in a.FUNCTION_KEYS){var b=a.FUNCTION_KEYS[i].toUpperCase();a[b]=parseInt(i,10)}d.mixin(a,a.MODIFIER_KEYS),d.mixin(a,a.PRINTABLE_KEYS),d.mixin(a,a.FUNCTION_KEYS);return a}();d.mixin(b,e)}),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},window.pageYOffset!==undefined?(b.getPageScrollTop=function(){return window.pageYOffset},b.getPageScrollLeft=function(){return window.pageXOffset}):(b.getPageScrollTop=function(){return document.body.scrollTop},b.getPageScrollLeft=function(){return document.body.scrollLeft}),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},b.setInnerHtml=function(a,b){var c=a.cloneNode(!1);c.innerHTML=b,a.parentNode.replaceChild(c,a);return c},b.setInnerText=function(a,b){"textContent"in document.body?a.textContent=b:a.innerText=b},b.getInnerText=function(a){return"textContent"in document.body?a.textContent:a.innerText},b.getParentWindow=function(a){return a.defaultView||a.parentWindow},b.getSelectionStart=function(a){var b;try{b=a.selectionStart||0}catch(c){b=0}return b},b.setSelectionStart=function(a,b){return a.selectionStart=b},b.getSelectionEnd=function(a){var b;try{b=a.selectionEnd||0}catch(c){b=0}return b},b.setSelectionEnd=function(a,b){return a.selectionEnd=b}}),define("ace/keyboard/textinput",function(a,b,c){var d=a("pilot/event"),e=a("pilot/useragent"),f=function(a,b){function j(a){if(!h){var d=a||c.value;d&&(d.charCodeAt(d.length-1)==f.charCodeAt(0)?(d=d.slice(0,-1),d&&b.onTextInput(d)):b.onTextInput(d))}h=!1,c.value=f,c.select()}var c=document.createElement("textarea");c.style.left="-10000px",a.appendChild(c);var f=String.fromCharCode(0);j();var g=!1,h=!1,i="",k=function(a){(!e.isIE||c.value.charCodeAt(0)<=128)&&setTimeout(function(){g||j()},0)},l=function(a){g=!0,e.isIE||(j(),c.value=""),b.onCompositionStart(),e.isGecko||setTimeout(m,0)},m=function(){g&&b.onCompositionUpdate(c.value)},n=function(){g=!1,b.onCompositionEnd(),setTimeout(function(){j()},0)},o=function(a){h=!0;var d=b.getCopyText();d?c.value=d:a.preventDefault(),c.select(),setTimeout(function(){j()},0)},p=function(a){h=!0;var d=b.getCopyText();d?(c.value=d,b.onCut()):a.preventDefault(),c.select(),setTimeout(function(){j()},0)};d.addCommandKeyListener(c,b.onCommandKey.bind(b)),d.addListener(c,"keypress",k);if(e.isIE){var q={13:1,27:1};d.addListener(c,"keyup",function(a){g&&(!c.value||q[a.keyCode])&&setTimeout(n,0);(c.value.charCodeAt(0)|0)>=129&&(g?m():l())})}d.addListener(c,"textInput",k),d.addListener(c,"paste",function(a){a.clipboardData&&a.clipboardData.getData?(j(a.clipboardData.getData("text/plain")),a.preventDefault()):k()}),e.isIE||d.addListener(c,"propertychange",k),e.isIE?(d.addListener(c,"beforecopy",function(a){var c=b.getCopyText();c?clipboardData.setData("Text",c):a.preventDefault()}),d.addListener(a,"keydown",function(a){if(a.ctrlKey&&a.keyCode==88){var c=b.getCopyText();c&&(clipboardData.setData("Text",c),b.onCut()),d.preventDefault(a)}})):(d.addListener(c,"copy",o),d.addListener(c,"cut",p)),d.addListener(c,"compositionstart",l),e.isGecko&&d.addListener(c,"text",m),e.isWebKit&&d.addListener(c,"keyup",m),d.addListener(c,"compositionend",n),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()},this.getElement=function(){return c},this.onContextMenu=function(a,b){a&&(i||(i=c.style.cssText),c.style.cssText="position:fixed; z-index:1000;left:"+(a.x-2)+"px; top:"+(a.y-2)+"px;"),b&&(c.value="")},this.onContextMenuClose=function(){setTimeout(function(){i&&(c.style.cssText=i,i=""),j()},0)}};b.TextInput=f}),define("ace/mouse_handler",function(a,b,c){var d=a("pilot/event"),e=function(a){this.editor=a,d.addListener(a.container,"mousedown",function(b){a.focus();return d.preventDefault(b)}),d.addListener(a.container,"selectstart",function(a){return d.preventDefault(a)});var b=a.renderer.getMouseEventTarget();d.addListener(b,"mousedown",this.onMouseDown.bind(this)),d.addMultiMouseDownListener(b,0,2,500,this.onMouseDoubleClick.bind(this)),d.addMultiMouseDownListener(b,0,3,600,this.onMouseTripleClick.bind(this)),d.addMouseWheelListener(b,this.onMouseWheel.bind(this))};(function(){this.$scrollSpeed=1,this.setScrollSpeed=function(a){this.$scrollSpeed=a},this.getScrollSpeed=function(){return this.$scrollSpeed},this.onMouseDown=function(a){var b=d.getDocumentX(a),c=d.getDocumentY(a),e=this.editor,f=e.renderer.screenToTextCoordinates(b,c);f.row=Math.max(0,Math.min(f.row,e.session.getLength()-1));var g=d.getButton(a);{if(g==0){a.shiftKey?e.selection.selectToPosition(f):(e.moveCursorToPosition(f),e.$clickSelection||e.selection.clearSelection(f.row,f.column)),e.renderer.scrollCursorIntoView();var i=this,j,k,l=function(a){j=d.getDocumentX(a),k=d.getDocumentY(a)},m=function(){clearInterval(o),i.$clickSelection=null},n=function(){if(j!==undefined&&k!==undefined){var a=e.renderer.screenToTextCoordinates(j,k);a.row=Math.max(0,Math.min(a.row,e.session.getLength()-1));if(i.$clickSelection)if(i.$clickSelection.contains(a.row,a.column))e.selection.setSelectionRange(i.$clickSelection);else{if(i.$clickSelection.compare(a.row,a.column)==-1)var b=i.$clickSelection.end;else var b=i.$clickSelection.start;e.selection.setSelectionAnchor(b.row,b.column),e.selection.selectToPosition(a)}else e.selection.selectToPosition(a);e.renderer.scrollCursorIntoView()}};d.capture(e.container,l,m);var o=setInterval(n,20);return d.preventDefault(a)}var h=e.selection.isEmpty();h&&e.moveCursorToPosition(f),g==2&&(e.textInput.onContextMenu({x:b,y:c},h),d.capture(e.container,function(){},e.textInput.onContextMenuClose))}},this.onMouseDoubleClick=function(a){this.editor.selection.selectWord(),this.$clickSelection=this.editor.getSelectionRange()},this.onMouseTripleClick=function(a){this.editor.selection.selectLine(),this.$clickSelection=this.editor.getSelectionRange()},this.onMouseWheel=function(a){var b=this.$scrollSpeed*2;this.editor.renderer.scrollBy(a.wheelX*b,a.wheelY*b);return d.preventDefault(a)}}).call(e.prototype),b.MouseHandler=e}),define("ace/keyboard/keybinding",function(a,b,c){var d=a("pilot/useragent"),e=a("pilot/keys"),f=a("pilot/event"),g=a("pilot/settings").settings,h=a("ace/keyboard/hash_handler").HashHandler,i=a("ace/keyboard/keybinding/default_mac").bindings,j=a("ace/keyboard/keybinding/default_win").bindings,k=a("pilot/canon");a("ace/commands/default_commands");var l=function(a,b){this.$editor=a,this.$data={},this.$keyboardHandler=null,this.$defaulKeyboardHandler=new h(b||(d.isMac?i:j))};(function(){this.setKeyboardHandler=function(a){this.$keyboardHandler!=a&&(this.$data={},this.$keyboardHandler=a)},this.getKeyboardHandler=function(){return this.$keyboardHandler},this.$callKeyboardHandler=function(a,b,c,d){var e;this.$keyboardHandler&&(e=this.$keyboardHandler.handleKeyboard(this.$data,b,c,d,a));if(!e||!e.command)e=this.$defaulKeyboardHandler.handleKeyboard(this.$data,b,c,d,a);if(e){var g=k.exec(e.command,{editor:this.$editor},e.args);if(g)return f.stopEvent(a)}},this.onCommandKey=function(a,b,c){key=(e[c]||String.fromCharCode(c)).toLowerCase(),this.$callKeyboardHandler(a,b,key,c)},this.onTextInput=function(a){this.$callKeyboardHandler({},0,a,0)}}).call(l.prototype),b.KeyBinding=l}),define("ace/keyboard/hash_handler",function(a,b,c){function e(a){this.setConfig(a)}var d=a("pilot/keys");(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;e0&&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){return this.doc.insert(a,b)},this.remove=function(a){return this.doc.remove(a)},this.undoChanges=function(a){if(a.length){this.$fromUndo=!0,this.doc.revertDeltas(a),this.$fromUndo=!1;var b=a[0],c=a[a.length-1];this.selection.clearSelection(),(b.action=="insertText"||b.action=="insertLines")&&this.selection.moveCursorToPosition(b.range.start),(b.action=="removeText"||b.action=="removeLines")&&this.selection.setSelectionRange(j.fromPoints(c.range.start,b.range.end))}},this.redoChanges=function(a){if(a.length){this.$fromUndo=!0,this.doc.applyDeltas(a),this.$fromUndo=!1;var b=a[0],c=a[a.length-1];this.selection.clearSelection(),(b.action=="insertText"||b.action=="insertLines")&&this.selection.setSelectionRange(j.fromPoints(b.range.start,c.range.end)),(b.action=="removeText"||b.action=="removeLines")&&this.selection.moveCursorToPosition(c.range.start)}},this.replace=function(a,b){return this.doc.replace(a,b)},this.indentRows=function(a,b,c){c=c.replace(/\t/g,this.getTabString());for(var d=a;d<=b;d++)this.insert({row:d,column:0},c)},this.outdentRows=function(a){var b=a.collapseRows(),c=new j(0,0,0,0),d=this.getTabSize();for(var e=b.start.row;e<=b.end.row;++e){var f=this.getLine(e);c.start.row=e,c.end.row=e;for(var g=0;g=this.doc.getLength()-1)return 0;var c=this.doc.removeLines(a,b);this.doc.insertLines(a+1,c);return 1},this.duplicateLines=function(a,b){var a=this.$clipRowToDocument(a),b=this.$clipRowToDocument(b),c=this.getLines(a,b);this.doc.insertLines(a,c);var d=b-a+1;return d},this.$clipRowToDocument=function(a){return Math.max(0,Math.min(a,this.doc.getLength()-1))},this.$wrapLimit=80,this.$useWrapMode=!1,this.$wrapLimitRange={min:null,max:null},this.setUseWrapMode=function(a){if(a!=this.$useWrapMode){this.$useWrapMode=a,this.$modified=!0;if(a){var b=this.getLength();this.$wrapMode=[];for(i=0;i0){this.$wrapLimit=b,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this._dispatchEvent("changeWrapLimit"));return!0}return!1},this.$constrainWrapLimit=function(a){var b=this.$wrapLimitRange.min;b&&(a=Math.max(b,a));var c=this.$wrapLimitRange.max;c&&(a=Math.min(c,a));return Math.max(1,a)},this.getWrapLimit=function(){return this.$wrapLimit},this.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},this.$updateWrapDataOnChange=function(a){if(this.$useWrapMode){var b,c=a.data.action,d=a.data.range.start.row,e=a.data.range.end.row;c.indexOf("Lines")!=-1?(c=="insertLines"?e=d+a.data.lines.length:e=d,b=a.data.lines.length):b=e-d;if(b!=0)if(c.indexOf("remove")!=-1)this.$wrapData.splice(d,b),e=d;else{var f=[d,0];for(var g=0;gb){var k=h+b;if(f[k]=c){k++;break}k>h?j(k):j(h+b)}else{while(f[k]>=c)k++;j(k)}}return e},this.$getDisplayTokens=function(d){var e=[],f=this.getTabSize();for(var h=0;h=12352&&i<=12447||i>=12448&&i<=12543||i>=19968&&i<=40959||i>=63744&&i<=64255||i>=13312&&i<=19903?e.push(a,b):e.push(a)}return e},this.$getStringScreenWidth=function(a){var b=0,c=this.getTabSize();for(var d=0;d=12352&&e<=12447||e>=12448&&e<=12543||e>=19968&&e<=40959||e>=63744&&e<=64255||e>=13312&&e<=19903?b+=2:b+=1}return b},this.getRowHeight=function(a,b){var c;this.$useWrapMode&&this.$wrapData[b]?c=this.$wrapData[b].length+1:c=1;return c*a.lineHeight},this.getScreenLastRowColumn=function(a,b){if(!this.$useWrapMode)return this.$getStringScreenWidth(this.getLine(a));var c=this.$screenToDocumentRow(a),d=c[0],e=c[1],f,g;this.$wrapData[d][e]?(f=this.$wrapData[d][e-1]||0,g=this.$wrapData[d][e],b&&g--):(g=this.getLine(d).length,f=this.$wrapData[d][e-1]||0);return b?g:this.$getStringScreenWidth(this.getLine(d).substring(f,g))},this.getDocumentLastRowColumn=function(a,b){if(!this.$useWrapMode)return this.getLine(a).length;var c=this.documentToScreenRow(a,b);return this.getScreenLastRowColumn(c,!0)},this.getScreenFirstRowColumn=function(a){if(!this.$useWrapMode)return 0;var b=this.$screenToDocumentRow(a),c=b[0],d=b[1];return this.$wrapData[c][d-1]||0},this.getRowSplitData=function(a){return this.$useWrapMode?this.$wrapData[a]:undefined},this.$screenToDocumentRow=function(a){if(!this.$useWrapMode)return[a,0];var b=this.$wrapData,c=this.getLength(),d=0;while(d=b[d].length+1)a-=b[d].length+1,d++;return[d,a]},this.screenToDocumentRow=function(a){return this.$screenToDocumentRow(a)[0]},this.screenToDocumentColumn=function(a,b){return this.screenToDocumentPosition(a,b).column},this.screenToDocumentPosition=function(a,b){var c,d,e,f=b,g=this.getLength();if(this.$useWrapMode){var h=this.$wrapData,d=0;while(d=h[d].length+1)a-=h[d].length+1,d++;d>=g&&(d=g-1,a=h[d].length),e=h[d][a-1]||0,c=this.getLine(d).substring(e)}else d=a>=g?g-1:a<0?0:a,a=0,e=0,c=this.getLine(d);var i=this.getTabSize();for(var j=0;j0)e+=1,k==9?f=12352&&k<=12447||k>=12448&&k<=12543||k>=19968&&k<=40959||k>=63744&&k<=64255||k>=13312&&k<=19903?f<2?(f=0,e-=1):f-=2:f-=1;else break}this.$useWrapMode?(b=h[d][a],e>=b&&(e=b-1)):c&&(e=Math.min(e,c.length));return{row:d,column:e}},this.documentToScreenColumn=function(a,b){return this.documentToScreenPosition(a,b).column},this.$documentToScreenRow=function(a,b){if(!this.$useWrapMode)return[a,0];var c=this.$wrapData,d=0;if(a>c.length-1)return[this.getScreenLength(),c.length==0?0:c[c.length-1].length-1];for(var e=0;e=c[a][f])d++,f++;return[d,f]},this.documentToScreenRow=function(a,b){return this.$documentToScreenRow(a,b)[0]},this.documentToScreenPosition=function(a,b){var c,d=this.getTabSize(),e;b!=null?e=a:(e=a.row,b=a.column);if(!this.$useWrapMode){c=this.getLine(e).substring(0,b),b=this.$getStringScreenWidth(c);return{row:e,column:b}}var f=this.$documentToScreenRow(e,b),g=f[0];if(e>=this.getLength())return{row:g,column:0};var h,i=this.$wrapData[e],j,k=f[1];c=this.getLine(e).substring(i[k-1]||0,b),j=this.$getStringScreenWidth(c);return{row:g,column:j}},this.getScreenLength=function(){if(!this.$useWrapMode)return this.getLength();var a=0;for(var b=0;bb.row||a.row==b.row&&a.column>b.column},this.getRange=function(){var a=this.selectionAnchor,b=this.selectionLead;if(this.isEmpty())return g.fromPoints(b,b);return this.isBackwards()?g.fromPoints(b,a):g.fromPoints(a,b)},this.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._dispatchEvent("changeSelection"))},this.selectAll=function(){var a=this.doc.getLength()-1;this.setSelectionAnchor(a,this.doc.getLine(a).length),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.$updateDesiredColumn()},this.$updateDesiredColumn=function(){var a=this.getCursor();this.$desiredColumn=this.session.documentToScreenColumn(a.row,a.column)},this.$moveSelection=function(a){var b=this.selectionLead;this.$isEmpty&&this.setSelectionAnchor(b.row,b.column),a.call(this)},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.getCursor(),b=this.session.getWordRange(a.row,a.column);this.setSelectionRange(b)},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(){var a=this.selectionLead.getPosition();if(a.column==0)a.row>0&&this.moveCursorTo(a.row-1,this.doc.getLine(a.row-1).length);else{var b=this.session.getTabSize();this.session.isTabStop(a)&&this.doc.getLine(a.row).slice(a.column-b,a.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 ["+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.rowthis.row)return;if(c.start.row==this.row&&c.start.column>this.column)return;var d=this.row,e=this.column;b.action==="insertText"?c.start.row!==d||c.start.column>e?c.start.row!==c.end.row&&c.start.rowd?(d=c.start.row,e=0):d-=c.end.row-c.start.row)),this.setPosition(d,e)}},this.setPosition=function(a,b){pos=this.$clipPositionToDocument(a,b);if(this.row!=pos.row||this.column!=pos.column){var c={row:this.row,column:this.column};this.row=pos.row,this.column=pos.column,this._dispatchEvent("change",{old:c,value:pos})}},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.$clipPositionToDocument=function(a,b){var c={};a=b&&(a.row=Math.max(0,b-1),a.column=this.getLine(b-1).length);return a},this.insert=function(a,b){if(b.length==0)return a;a=this.$clipPosition(a),this.getLength()<=1&&this.$detectNewLine(b);var c=this.$split(b);if(this.isNewLine(b))var d=this.insertNewLine(a);else if(c.length==1)var d=this.insertInLine(a,b);else{var d=this.insertInLine(a,c[0]);this.insertNewLine(d),c.length>2&&this.insertLines(a.row+1,c.slice(1,c.length-1));var d=this.insertInLine({row:a.row+c.length-1,column:0},c[c.length-1])}return d},this.insertLines=function(a,b){if(b.length==0)return{row:a,column:0};var c=[a,0];c.push.apply(c,b),this.$lines.splice.apply(this.$lines,c);var d=new f(a,0,a+b.length,0),e={action:"insertLines",range:d,lines:b};this._dispatchEvent("change",{data:e});return d.end},this.insertNewLine=function(a){a=this.$clipPosition(a);var b=this.$lines[a.row]||"";this.$lines[a.row]=b.substring(0,a.column),this.$lines.splice(a.row+1,0,b.substring(a.column,b.length));var c={row:a.row+1,column:0},d={action:"insertText",range:f.fromPoints(a,c),text:this.getNewLineCharacter()};this._dispatchEvent("change",{data:d});return c},this.insertInLine=function(a,b){if(b.length==0)return a;var c=this.$lines[a.row]||"";this.$lines[a.row]=c.substring(0,a.column)+b+c.substring(a.column);var d={row:a.row,column:a.column+b.length},e={action:"insertText",range:f.fromPoints(a,d),text:b};this._dispatchEvent("change",{data:e});return d},this.remove=function(a){a.start=this.$clipPosition(a.start),a.end=this.$clipPosition(a.end);if(a.isEmpty())return a.start;var b=a.start.row,c=a.end.row;if(a.isMultiLine()){var d=a.start.column==0?b:b+1,e=c-1;a.end.column>0&&this.removeInLine(c,0,a.end.column),e>=d&&this.removeLines(d,e),d!=b&&(this.removeInLine(b,a.start.column,this.$lines[b].length),this.removeNewLine(a.start.row))}else this.removeInLine(b,a.start.column,a.end.column);return a.start},this.removeInLine=function(a,b,c){if(b!=c){var d=new f(a,b,a,c),e=this.getLine(a),g=e.substring(b,c),h=e.substring(0,b)+e.substring(c,e.length);this.$lines.splice(a,1,h);var i={action:"removeText",range:d,text:g};this._dispatchEvent("change",{data:i});return d.start}},this.removeLines=function(a,b){var c=new f(a,0,b+1,0),d=this.$lines.splice(a,b-a+1),e={action:"removeLines",range:c,nl:this.getNewLineCharacter(),lines:d};this._dispatchEvent("change",{data:e});return d},this.removeNewLine=function(a){var b=this.getLine(a),c=this.getLine(a+1),d=new f(a,b.length,a+1,0),e=b+c;this.$lines.splice(a,2,e);var g={action:"removeText",range:d,text:this.getNewLineCharacter()};this._dispatchEvent("change",{data:g})},this.replace=function(a,b){if(b.length==0&&a.isEmpty())return a.start;if(b==this.getTextRange(a))return a.end;this.remove(a);if(b)var c=this.insert(a.start,b);else c=a.start;return c},this.applyDeltas=function(a){for(var b=0;b=0;b--){var c=a[b],d=f.fromPoints(c.range.start,c.range.end);c.action=="insertLines"?this.removeLines(d.start.row,d.end.row-1):c.action=="insertText"?this.remove(d):c.action=="removeLines"?this.insertLines(d.start.row,c.lines):c.action=="removeText"&&this.insert(d.start,c.text)}}}).call(g.prototype),b.Document=g}),define("ace/search",function(a,b,c){var d=a("pilot/lang"),e=a("pilot/oop"),f=a("ace/range").Range,g=function(){this.$options={needle:"",backwards:!1,wrap:!1,caseSensitive:!1,wholeWord:!1,scope:g.ALL,regExp:!1}};g.ALL=1,g.SELECTION=2,function(){this.set=function(a){e.mixin(this.$options,a);return this},this.getOptions=function(){return d.copyObject(this.$options)},this.find=function(a){if(!this.$options.needle)return null;if(this.$options.backwards)var b=this.$backwardMatchIterator(a);else b=this.$forwardMatchIterator(a);var c=null;b.forEach(function(a){c=a;return!0});return c},this.findAll=function(a){if(!this.$options.needle)return[];if(this.$options.backwards)var b=this.$backwardMatchIterator(a);else b=this.$forwardMatchIterator(a);var c=[];b.forEach(function(a){c.push(a)});return c},this.replace=function(a,b){var c=this.$assembleRegExp(),d=c.exec(a);return d&&d[0].length==a.length?this.$options.regExp?a.replace(c,b):b:null},this.$forwardMatchIterator=function(a){var b=this.$assembleRegExp(),c=this;return{forEach:function(d){c.$forwardLineIterator(a).forEach(function(a,e,f){e&&(a=a.substring(e));var g=[];a.replace(b,function(a){var b=arguments[arguments.length-2];g.push({str:a,offset:e+b});return a});for(var h=0;h=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(j20){c.fireUpdateEvent(d,c.currentLine-1);var i=c.currentLine0&&this.lines[a-1]&&(d=this.lines[a-1].state,e=!0);var f=this.doc.getLines(a,b);for(var g=a;g<=b;g++)if(this.lines[g]){var h=this.lines[g];d=h.state,c.push(h)}else{var h=this.tokenizer.getLineTokens(f[g-a]||"",d),d=h.state;c.push(h),e&&(this.lines[g]=h)}return c}}).call(f.prototype),b.BackgroundTokenizer=f}),define("ace/undomanager",function(a,b,c){var d=function(){this.$undoStack=[],this.$redoStack=[]};(function(){this.execute=function(a){var b=a.args[0];this.$doc=a.args[1],this.$undoStack.push(b)},this.undo=function(){var a=this.$undoStack.pop();a&&(this.$doc.undoChanges(a),this.$redoStack.push(a))},this.redo=function(){var a=this.$redoStack.pop();a&&(this.$doc.redoChanges(a),this.$undoStack.push(a))}}).call(d.prototype),b.UndoManager=d}),define("ace/theme/textmate",function(a,b,c){var d=a("pilot/dom"),e=a("text!ace/theme/tm.css");d.importCssString(e),b.cssClass="ace-tm"}),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)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);if(b)return b[1];return""}}).call(e.prototype),b.MatchingBraceOutdent=e}),define("ace/virtual_renderer",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/dom"),f=a("pilot/event"),g=a("pilot/useragent"),h=a("ace/layer/gutter").Gutter,i=a("ace/layer/marker").Marker,j=a("ace/layer/text").Text,k=a("ace/layer/cursor").Cursor,l=a("ace/scrollbar").ScrollBar,m=a("ace/renderloop").RenderLoop,n=a("pilot/event_emitter").EventEmitter,o=a("text!ace/css/editor.css");e.importCssString(o);var p=function(a,b){this.container=a,e.addCssClass(this.container,"ace_editor"),this.setTheme(b),this.$gutter=document.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.scroller=document.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=document.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new h(this.$gutter),this.$markerBack=new i(this.content);var c=this.$textLayer=new j(this.content);this.canvas=c.element,this.$markerFront=new i(this.content),this.characterWidth=c.getCharacterWidth(),this.lineHeight=c.getLineHeight(),this.$cursorLayer=new k(this.content),this.$cursorPadding=8,this.scrollBar=new l(a),this.scrollBar.addEventListener("scroll",this.onScroll.bind(this)),this.scrollTop=0,this.cursorPos={row:0,column:0};var d=this;this.$textLayer.addEventListener("changeCharaterSize",function(){d.characterWidth=c.getCharacterWidth(),d.lineHeight=c.getLineHeight(),d.$updatePrintMargin(),d.$loop.schedule(d.CHANGE_FULL)}),f.addListener(this.$gutter,"click",this.$onGutterClick.bind(this)),f.addListener(this.$gutter,"dblclick",this.$onGutterClick.bind(this)),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0},this.$loop=new m(this.$renderChanges.bind(this)),this.$loop.schedule(this.CHANGE_FULL),this.setPadding(4),this.$updatePrintMargin()};(function(){this.showGutter=!0,this.CHANGE_CURSOR=1,this.CHANGE_MARKER=2,this.CHANGE_GUTTER=4,this.CHANGE_SCROLL=8,this.CHANGE_LINES=16,this.CHANGE_TEXT=32,this.CHANGE_SIZE=64,this.CHANGE_MARKER_BACK=128,this.CHANGE_MARKER_FRONT=256,this.CHANGE_FULL=512,d.implement(this,n),this.setSession=function(a){this.session=a,this.$cursorLayer.setSession(a),this.$markerBack.setSession(a),this.$markerFront.setSession(a),this.$gutterLayer.setSession(a),this.$textLayer.setSession(a),this.$loop.schedule(this.CHANGE_FULL)},this.updateLines=function(a,b){b===undefined&&(b=Infinity),this.$changedLines?(this.$changedLines.firstRow>a&&(this.$changedLines.firstRow=a),this.$changedLines.lastRowc&&this.scrollToY(c),this.getScrollTop()+this.$size.scrollerHeightb&&this.scrollToX(b),this.scroller.scrollLeft+this.$size.scrollerWidththis.scroller.scrollWidth&&this.$renderChanges(this.CHANGE_SIZE),this.scrollToX(Math.round(b+this.characterWidth-this.$size.scrollerWidth)))},this.getScrollTop=function(){return this.scrollTop},this.getScrollLeft=function(){return this.scroller.scrollLeft},this.getScrollTopRow=function(){return this.scrollTop/this.lineHeight},this.scrollToRow=function(a){this.scrollToY(a*this.lineHeight)},this.scrollToLine=function(a,b){var c={lineHeight:this.lineHeight},d=0;for(var e=1;e",c+1,""),b.push("")}this.element=d.setInnerHtml(this.element,b.join("")),this.element.style.height=a.minHeight+"px"}}).call(e.prototype),b.Gutter=e}),define("ace/layer/marker",function(a,b,c){var d=a("ace/range").Range,e=a("pilot/dom"),f=function(a){this.element=document.createElement("div"),this.element.className="ace_layer ace_marker-layer",a.appendChild(this.element)};(function(){this.setSession=function(a){this.session=a},this.setMarkers=function(a){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],f=d.range.clipRows(a.firstRow,a.lastRow);if(f.isEmpty())continue;f=f.toScreenRange(this.session);if(d.renderer){var g=this.$getTop(f.start.row,a),h=Math.round(f.start.column*a.characterWidth);d.renderer(b,f,h,g,a)}else f.isMultiLine()?d.type=="text"?this.drawTextMarker(b,f,d.clazz,a):this.drawMultiLineMarker(b,f,d.clazz,a):this.drawSingleLineMarker(b,f,d.clazz,a)}this.element=e.setInnerHtml(this.element,b.join(""))}},this.$getTop=function(a,b){return(a-b.firstRowScreen)*b.lineHeight},this.drawTextMarker=function(a,b,c,e){var f=b.start.row,g=new d(f,b.start.column,f,this.session.getScreenLastRowColumn(f));this.drawSingleLineMarker(a,g,c,e,1);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=this.$getTop(b.end.row,d),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=this.$getTop(b.start.row+1,d);a.push("
")}},this.drawSingleLineMarker=function(a,b,c,d,e){var f=d.lineHeight,g=Math.round((b.end.column+(e||0)-b.start.column)*d.characterWidth),h=this.$getTop(b.start.row,d),i=Math.round(b.start.column*d.characterWidth);a.push("
")}}).call(f.prototype),b.Marker=f}),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=-a*40+"px",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.setSession=function(a){this.session=a},this.showInvisibles=!1,this.setShowInvisibles=function(a){if(this.showInvisibles==a)return!1;this.showInvisibles=a;return!0},this.$computeTabString=function(){var a=this.session.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.lastRow!=a.lastRow||this.config.firstRow!=a.firstRow)&&this.scrollLines(a),this.config=a;var d=Math.max(b,a.firstRow),f=Math.min(c,a.lastRow),g=this.element.childNodes,h=this.tokenizer.getTokens(d,f);for(var i=d;i<=f;i++){var j=g[i-a.firstRow];if(!j)continue;var k=[];this.$renderLine(k,i,h[i-d].tokens),j=e.setInnerHtml(j,k.join("")),j.style.height=this.session.getRowHeight(a,i)+"px"}},this.scrollLines=function(a){this.$computeTabString();var b=this.config;this.config=a;if(!b||b.lastRowa.lastRow)for(var d=a.lastRow+1;d<=b.lastRow;d++)c.removeChild(c.lastChild);if(a.firstRowb.lastRow){var e=this.$renderLinesFragment(a,b.lastRow+1,a.lastRow);c.appendChild(e)}},this.$renderLinesFragment=function(a,b,c){var d=document.createDocumentFragment(),e=this.tokenizer.getTokens(b,c);for(var f=b;f<=c;f++){var g=document.createElement("div");g.className="ace_line";var h=g.style;h.height=this.session.getRowHeight(a,f)+"px",h.width=a.width+"px";var i=[];e.length>f-b&&this.$renderLine(i,f,e[f-b].tokens),g.innerHTML=i.join(""),d.appendChild(g)}return d},this.update=function(a){this.$computeTabString(),this.config=a;var b=[],c=this.tokenizer.getTokens(a.firstRow,a.lastRow),d=this.$renderLinesFragment(a,a.firstRow,a.lastRow);this.element.innerHTML="",this.element.appendChild(d)},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderLine=function(a,b,c){function i(b,c){var d=c.replace(/&/g,"&").replace(/"+a+""});if(g.$textToken[b.type])a.push(d);else{var i="ace_"+b.type.replace(/\./g," ace_");a.push("",d,"")}}if(this.showInvisibles)var d=this,e=/( +)|([\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000])/g,f=function(a){if(a.charCodeAt(0)==32)return Array(a.length+1).join(" ");var a=Array(a.length+1).join(d.SPACE_CHAR);return""+a+""};else var e=/[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/g,f=" ";var g=this,h=this.config.characterWidth,j=this.session.getRowSplitData(b),k=0,l=0,m;j&&j.length!=0?m=j[0]:m=Number.MAX_VALUE,a.push("
");for(var n=0;n=m)i(o,p.substring(0,m-k)),p=p.substring(m-k),k=m,a.push("
","
"),l++,m=j[l]||Number.MAX_VALUE;p.length!=0&&(k+=p.length,i(o,p))}}this.showInvisibles&&(b!==this.session.getLength()-1?a.push(""+this.EOL_CHAR+""):a.push(""+this.EOF_CHAR+"")),a.push("
")}}).call(h.prototype),b.Text=h}),define("ace/layer/cursor",function(a,b,c){var d=a("pilot/dom"),e=function(a){this.element=document.createElement("div"),this.element.className="ace_layer ace_cursor-layer",a.appendChild(this.element),this.cursor=document.createElement("div"),this.cursor.className="ace_cursor",this.isVisible=!1};(function(){this.setSession=function(a){this.session=a},this.setCursor=function(a,b){this.position=this.session.documentToScreenPosition(a),b?d.addCssClass(this.cursor,"ace_overwrite"):d.removeCssClass(this.cursor,"ace_overwrite")},this.hideCursor=function(){this.isVisible=!1,this.cursor.parentNode&&this.cursor.parentNode.removeChild(this.cursor),clearInterval(this.blinkId)},this.showCursor=function(){this.isVisible=!0,this.element.appendChild(this.cursor);var a=this.cursor;a.style.visibility="visible",this.restartTimer()},this.restartTimer=function(){clearInterval(this.blinkId);if(this.isVisible){var a=this.cursor;this.blinkId=setInterval(function(){a.style.visibility="hidden",setTimeout(function(){a.style.visibility="visible"},400)},1e3)}},this.getPixelPosition=function(a){if(!this.config||!this.position)return{left:0,top:0};var b=this.position,c=Math.round(b.column*this.config.characterWidth),d=(b.row-(a?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:c,top:d}},this.update=function(a){this.position&&(this.config=a,this.pixelPos=this.getPixelPosition(!0),this.cursor.style.left=this.pixelPos.left+"px",this.cursor.style.top=this.pixelPos.top+"px",this.cursor.style.width=a.characterWidth+"px",this.cursor.style.height=a.lineHeight+"px",this.isVisible&&this.element.appendChild(this.cursor),this.restartTimer())}}).call(e.prototype),b.Cursor=e}),define("ace/scrollbar",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/dom"),f=a("pilot/event"),g=a("pilot/event_emitter").EventEmitter,h=function(a){this.element=document.createElement("div"),this.element.className="ace_sb",this.inner=document.createElement("div"),this.element.appendChild(this.inner),a.appendChild(this.element),this.width=e.scrollbarWidth(),this.element.style.width=this.width,f.addListener(this.element,"scroll",this.onScroll.bind(this))};(function(){d.implement(this,g),this.onScroll=function(){this._dispatchEvent("scroll",{data:this.element.scrollTop})},this.getWidth=function(){return this.width},this.setHeight=function(a){this.element.style.height=Math.max(0,a-this.width)+"px"},this.setInnerHeight=function(a){this.inner.style.height=a+"px"},this.setScrollTop=function(a){this.element.scrollTop=a}}).call(h.prototype),b.ScrollBar=h}),define("ace/renderloop",function(a,b,c){var d=a("pilot/event"),e=function(a){this.onRender=a,this.pending=!1,this.changes=0};(function(){this.schedule=function(a){this.changes=this.changes|a;if(!this.pending){this.pending=!0;var b=this;this.setTimeoutZero(function(){b.pending=!1;var a=b.changes;b.changes=0,b.onRender(a)})}},window.postMessage?(this.messageName="zero-timeout-message",this.setTimeoutZero=function(a){if(!this.attached){var b=this;d.addListener(window,"message",function(a){b.callback&&a.data==b.messageName&&(d.stopPropagation(a),b.callback())}),this.attached=!0}this.callback=a,window.postMessage(this.messageName,"*")}):this.setTimeoutZero=function(a){setTimeout(a,0)}}).call(e.prototype),b.RenderLoop=e}),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_content { position: absolute; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box;}.ace_composition { position: absolute; background: #555; color: #DDD; z-index: 4;}.ace_gutter { position: absolute; overflow-x: hidden; overflow-y: hidden; height: 100%;}.ace_gutter-cell.ace_error { background-image: url("data:image/gif,GIF89a%10%00%10%00%D5%00%00%F5or%F5%87%88%F5nr%F4ns%EBmq%F5z%7F%DDJT%DEKS%DFOW%F1Yc%F2ah%CE(7%CE)8%D18E%DD%40M%F2KZ%EBU%60%F4%60m%DCir%C8%16(%C8%19*%CE%255%F1%3FR%F1%3FS%E6%AB%B5%CA%5DI%CEn%5E%F7%A2%9A%C9G%3E%E0a%5B%F7%89%85%F5yy%F6%82%80%ED%82%80%FF%BF%BF%E3%C4%C4%FF%FF%FF%FF%FF%FF%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00!%F9%04%01%00%00%25%00%2C%00%00%00%00%10%00%10%00%00%06p%C0%92pH%2C%1A%8F%C8%D2H%93%E1d4%23%E4%88%D3%09mB%1DN%B48%F5%90%40%60%92G%5B%94%20%3E%22%D2%87%24%FA%20%24%C5%06A%00%20%B1%07%02B%A38%89X.v%17%82%11%13q%10%0Fi%24%0F%8B%10%7BD%12%0Ei%09%92%09%0EpD%18%15%24%0A%9Ci%05%0C%18F%18%0B%07%04%01%04%06%A0H%18%12%0D%14%0D%12%A1I%B3%B4%B5IA%00%3B"); background-repeat: no-repeat; background-position: 4px center;}.ace_gutter-cell.ace_warning { background-image: url("data:image/gif,GIF89a%10%00%10%00%D5%00%00%FF%DBr%FF%DE%81%FF%E2%8D%FF%E2%8F%FF%E4%96%FF%E3%97%FF%E5%9D%FF%E6%9E%FF%EE%C1%FF%C8Z%FF%CDk%FF%D0s%FF%D4%81%FF%D5%82%FF%D5%83%FF%DC%97%FF%DE%9D%FF%E7%B8%FF%CCl%7BQ%13%80U%15%82W%16%81U%16%89%5B%18%87%5B%18%8C%5E%1A%94d%1D%C5%83-%C9%87%2F%C6%84.%C6%85.%CD%8B2%C9%871%CB%8A3%CD%8B5%DC%98%3F%DF%9BB%E0%9CC%E1%A5U%CB%871%CF%8B5%D1%8D6%DB%97%40%DF%9AB%DD%99B%E3%B0p%E7%CC%AE%FF%FF%FF%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00!%F9%04%01%00%00%2F%00%2C%00%00%00%00%10%00%10%00%00%06a%C0%97pH%2C%1A%8FH%A1%ABTr%25%87%2B%04%82%F4%7C%B9X%91%08%CB%99%1C!%26%13%84*iJ9(%15G%CA%84%14%01%1A%97%0C%03%80%3A%9A%3E%81%84%3E%11%08%B1%8B%20%02%12%0F%18%1A%0F%0A%03\'F%1C%04%0B%10%16%18%10%0B%05%1CF%1D-%06%07%9A%9A-%1EG%1B%A0%A1%A0U%A4%A5%A6BA%00%3B"); background-repeat: no-repeat; background-position: 4px center;}.ace_editor .ace_sb { position: absolute; overflow-x: hidden; overflow-y: scroll; right: 0;}.ace_editor .ace_sb div { position: absolute; width: 1px; left: 0;}.ace_editor .ace_print_margin_layer { z-index: 0; position: absolute; overflow: hidden; margin: 0; left: 0; height: 100%; width: 100%;}.ace_editor .ace_print_margin { position: absolute; height: 100%;}.ace_editor textarea { position: fixed; z-index: -1; width: 10px; height: 30px; opacity: 0; background: transparent; appearance: none; border: none; resize: none; outline: none; overflow: hidden;}.ace_layer { z-index: 1; position: absolute; overflow: hidden; white-space: nowrap; height: 100%; width: 100%;}.ace_text-layer { font-family: Monaco, "Courier New", monospace; color: black;}.ace_cjk { display: inline-block; text-align: center;}.ace_cursor-layer { z-index: 4; cursor: text; pointer-events: none;}.ace_cursor { z-index: 4; position: absolute;}.ace_line { white-space: nowrap;}.ace_marker-layer {}.ace_marker-layer .ace_step { position: absolute; z-index: 3;}.ace_marker-layer .ace_selection { position: absolute; z-index: 4;}.ace_marker-layer .ace_bracket { position: absolute; z-index: 5;}.ace_marker-layer .ace_active_line { position: absolute; z-index: 2;}'),define("text!ace/theme/eclipse.css",".ace-eclipse .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-eclipse .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-eclipse .ace_gutter { width: 40px; background: rgb(227, 227, 227); border-right: 1px solid rgb(159, 159, 159);\t color: rgb(136, 136, 136);}.ace-eclipse .ace_gutter-layer { right: 10px; text-align: right;}.ace-eclipse .ace_text-layer { cursor: text;}.ace-eclipse .ace_cursor { border-left: 1px solid black;}.ace-eclipse .ace_line .ace_keyword, .ace-eclipse .ace_line .ace_variable { color: rgb(127, 0, 85);}.ace-eclipse .ace_line .ace_constant.ace_buildin { color: rgb(88, 72, 246);}.ace-eclipse .ace_line .ace_constant.ace_library { color: rgb(6, 150, 14);}.ace-eclipse .ace_line .ace_function { color: rgb(60, 76, 114);}.ace-eclipse .ace_line .ace_string { color: rgb(42, 0, 255);}.ace-eclipse .ace_line .ace_comment { color: rgb(63, 127, 95);}.ace-eclipse .ace_line .ace_comment.ace_doc { color: rgb(63, 95, 191);}.ace-eclipse .ace_line .ace_comment.ace_doc.ace_tag { color: rgb(127, 159, 191);}.ace-eclipse .ace_line .ace_constant.ace_numeric {}.ace-eclipse .ace_line .ace_tag {\tcolor: rgb(63, 127, 127);}.ace-eclipse .ace_line .ace_xml_pe { color: rgb(104, 104, 91);}.ace-eclipse .ace_marker-layer .ace_selection { background: rgb(181, 213, 255);}.ace-eclipse .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgb(192, 192, 192);}.ace-eclipse .ace_marker-layer .ace_active_line { background: rgb(232, 242, 254);}"),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_print_margin { 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) }"),define("text!icons/epl.html",'Eclipse Public License - Version 1.0

Eclipse Public License - v 1.0

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSEPUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION ORDISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT\'S ACCEPTANCE OF THISAGREEMENT.

1. DEFINITIONS

"Contribution" means:

a) in the case of the initial Contributor, the initialcode and documentation distributed under this Agreement, and

b) in the case of each subsequent Contributor:

i) changes to the Program, and

ii) additions to the Program;

where such changes and/or additions to the Programoriginate from and are distributed by that particular Contributor. AContribution \'originates\' from a Contributor if it was added to theProgram by such Contributor itself or anyone acting on suchContributor\'s behalf. Contributions do not include additions to theProgram which: (i) are separate modules of software distributed inconjunction with the Program under their own license agreement, and (ii)are not derivative works of the Program.

"Contributor" means any person or entity that distributesthe Program.

"Licensed Patents" mean patent claims licensable by aContributor which are necessarily infringed by the use or sale of itsContribution alone or when combined with the Program.

"Program" means the Contributions distributed in accordancewith this Agreement.

"Recipient" means anyone who receives the Program underthis Agreement, including all Contributors.

2. GRANT OF RIGHTS

a) Subject to the terms of this Agreement, eachContributor hereby grants Recipient a non-exclusive, worldwide,royalty-free copyright license to reproduce, prepare derivative worksof, publicly display, publicly perform, distribute and sublicense theContribution of such Contributor, if any, and such derivative works, insource code and object code form.

b) Subject to the terms of this Agreement, eachContributor hereby grants Recipient a non-exclusive, worldwide,royalty-free patent license under Licensed Patents to make, use, sell,offer to sell, import and otherwise transfer the Contribution of suchContributor, if any, in source code and object code form. This patentlicense shall apply to the combination of the Contribution and theProgram if, at the time the Contribution is added by the Contributor,such addition of the Contribution causes such combination to be coveredby the Licensed Patents. The patent license shall not apply to any othercombinations which include the Contribution. No hardware per se islicensed hereunder.

c) Recipient understands that although each Contributorgrants the licenses to its Contributions set forth herein, no assurancesare provided by any Contributor that the Program does not infringe thepatent or other intellectual property rights of any other entity. EachContributor disclaims any liability to Recipient for claims brought byany other entity based on infringement of intellectual property rightsor otherwise. As a condition to exercising the rights and licensesgranted hereunder, each Recipient hereby assumes sole responsibility tosecure any other intellectual property rights needed, if any. Forexample, if a third party patent license is required to allow Recipientto distribute the Program, it is Recipient\'s responsibility to acquirethat license before distributing the Program.

d) Each Contributor represents that to its knowledge ithas sufficient copyright rights in its Contribution, if any, to grantthe copyright license set forth in this Agreement.

3. REQUIREMENTS

A Contributor may choose to distribute the Program in object codeform under its own license agreement, provided that:

a) it complies with the terms and conditions of thisAgreement; and

b) its license agreement:

i) effectively disclaims on behalf of all Contributorsall warranties and conditions, express and implied, including warrantiesor conditions of title and non-infringement, and implied warranties orconditions of merchantability and fitness for a particular purpose;

ii) effectively excludes on behalf of all Contributorsall liability for damages, including direct, indirect, special,incidental and consequential damages, such as lost profits;

iii) states that any provisions which differ from thisAgreement are offered by that Contributor alone and not by any otherparty; and

iv) states that source code for the Program is availablefrom such Contributor, and informs licensees how to obtain it in areasonable manner on or through a medium customarily used for softwareexchange.

When the Program is made available in source code form:

a) it must be made available under this Agreement; and

b) a copy of this Agreement must be included with eachcopy of the Program.

Contributors may not remove or alter any copyright notices containedwithin the Program.

Each Contributor must identify itself as the originator of itsContribution, if any, in a manner that reasonably allows subsequentRecipients to identify the originator of the Contribution.

4. COMMERCIAL DISTRIBUTION

Commercial distributors of software may accept certainresponsibilities with respect to end users, business partners and thelike. While this license is intended to facilitate the commercial use ofthe Program, the Contributor who includes the Program in a commercialproduct offering should do so in a manner which does not createpotential liability for other Contributors. Therefore, if a Contributorincludes the Program in a commercial product offering, such Contributor("Commercial Contributor") hereby agrees to defend andindemnify every other Contributor ("Indemnified Contributor")against any losses, damages and costs (collectively "Losses")arising from claims, lawsuits and other legal actions brought by a thirdparty against the Indemnified Contributor to the extent caused by theacts or omissions of such Commercial Contributor in connection with itsdistribution of the Program in a commercial product offering. Theobligations in this section do not apply to any claims or Lossesrelating to any actual or alleged intellectual property infringement. Inorder to qualify, an Indemnified Contributor must: a) promptly notifythe Commercial Contributor in writing of such claim, and b) allow theCommercial Contributor to control, and cooperate with the CommercialContributor in, the defense and any related settlement negotiations. TheIndemnified Contributor may participate in any such claim at its ownexpense.

For example, a Contributor might include the Program in a commercialproduct offering, Product X. That Contributor is then a CommercialContributor. If that Commercial Contributor then makes performanceclaims, or offers warranties related to Product X, those performanceclaims and warranties are such Commercial Contributor\'s responsibilityalone. Under this section, the Commercial Contributor would have todefend claims against the other Contributors related to thoseperformance claims and warranties, and if a court requires any otherContributor to pay any damages as a result, the Commercial Contributormust pay those damages.

5. NO WARRANTY

EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM ISPROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONSOF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITYOR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solelyresponsible for determining the appropriateness of using anddistributing the Program and assumes all risks associated with itsexercise of rights under this Agreement , including but not limited tothe risks and costs of program errors, compliance with applicable laws,damage to or loss of data, programs or equipment, and unavailability orinterruption of operations.

6. DISCLAIMER OF LIABILITY

EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENTNOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDINGWITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDINGNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ORDISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTEDHEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

7. GENERAL

If any provision of this Agreement is invalid or unenforceable underapplicable law, it shall not affect the validity or enforceability ofthe remainder of the terms of this Agreement, and without further actionby the parties hereto, such provision shall be reformed to the minimumextent necessary to make such provision valid and enforceable.

If Recipient institutes patent litigation against any entity(including a cross-claim or counterclaim in a lawsuit) alleging that theProgram itself (excluding combinations of the Program with othersoftware or hardware) infringes such Recipient\'s patent(s), then suchRecipient\'s rights granted under Section 2(b) shall terminate as of thedate such litigation is filed.

All Recipient\'s rights under this Agreement shall terminate if itfails to comply with any of the material terms or conditions of thisAgreement and does not cure such failure in a reasonable period of timeafter becoming aware of such noncompliance. If all Recipient\'s rightsunder this Agreement terminate, Recipient agrees to cease use anddistribution of the Program as soon as reasonably practicable. However,Recipient\'s obligations under this Agreement and any licenses granted byRecipient relating to the Program shall continue and survive.

Everyone is permitted to copy and distribute copies of thisAgreement, but in order to avoid inconsistency the Agreement iscopyrighted and may only be modified in the following manner. TheAgreement Steward reserves the right to publish new versions (includingrevisions) of this Agreement from time to time. No one other than theAgreement Steward has the right to modify this Agreement. The EclipseFoundation is the initial Agreement Steward. The Eclipse Foundation mayassign the responsibility to serve as the Agreement Steward to asuitable separate entity. Each new version of the Agreement will begiven a distinguishing version number. The Program (includingContributions) may always be distributed subject to the version of theAgreement under which it was received. In addition, after a new versionof the Agreement is published, Contributor may elect to distribute theProgram (including its Contributions) under the new version. Except asexpressly stated in Sections 2(a) and 2(b) above, Recipient receives norights or licenses to the intellectual property of any Contributor underthis Agreement, whether expressly, by implication, estoppel orotherwise. All rights in the Program not expressly granted under thisAgreement are reserved.

This Agreement is governed by the laws of the State of New York andthe intellectual property laws of the United States of America. No partyto this Agreement will bring a legal action under this Agreement morethan one year after the cause of action arose. Each party waives itsrights to a jury trial in any resulting litigation.

'),define("text!styles.css","html { height: 100%; overflow: hidden;}body { overflow: hidden; margin: 0; padding: 0; height: 100%; width: 100%; font-family: Arial, Helvetica, sans-serif, Tahoma, Verdana, sans-serif; font-size: 12px; background: rgb(14, 98, 165); color: white;}#editor { position: absolute; top: 60px; left: 0px; background: white;}.cool { position: absolute; background: orange; opacity: 0.8;}.cool_header { position: absolute; background: orange; color: black; font-size: 8px; padding: 1px; margin-top: -8px; opacity: 0.8;}#controls { width: 100%;}#cockpitInput { position: absolute; width: 100%; bottom: 0; border: none; outline: none; font-family: consolas, courier, monospace; font-size: 120%;}#cockpitOutput { padding: 10px; margin: 0 15px; border: 1px solid #AAA; -moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px; border-top-left-radius: 4px; border-top-right-radius: 4px; background: #DDD; color: #000;}"),define("text!icons/error_obj.gif","data:image/gif;base64,R0lGODlhEAAQANUAAPVvcvWHiPVucvRuc+ttcfV6f91KVN5LU99PV/FZY/JhaM4oN84pONE4Rd1ATfJLWutVYPRgbdxpcsgWKMgZKs4lNfE/UvE/U+artcpdSc5uXveimslHPuBhW/eJhfV5efaCgO2CgP+/v+PExP///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACUALAAAAAAQABAAAAZwwJJwSCwaj8jSSJPhZDQj5IjTCW1CHU60OPWQQGCSR1uUID4i0ock+iAkxQZBACCxBwJCoziJWC52F4IRE3EQD2kkD4sQe0QSDmkJkgkOcEQYFSQKnGkFDBhGGAsHBAEEBqBIGBINFA0SoUmztLVJQQA7"),define("text!icons/warning_obj.gif","data:image/gif;base64,R0lGODlhEAAQANUAAP/bcv/egf/ijf/ij//klv/jl//lnf/mnv/uwf/IWv/Na//Qc//Ugf/Vgv/Vg//cl//enf/nuP/MbHtRE4BVFYJXFoFVFolbGIdbGIxeGpRkHcWDLcmHL8aELsaFLs2LMsmHMcuKM82LNdyYP9+bQuCcQ+GlVcuHMc+LNdGNNtuXQN+aQt2ZQuOwcOfMrv///wAA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mCC");var deps=["pilot/fixoldbrowsers","pilot/index","pilot/plugin_manager","pilot/environment","ace/editor","ace/edit_session","ace/virtual_renderer","ace/undomanager","ace/theme/textmate"];require(deps,function(){var a=require("pilot/plugin_manager").catalog;a.registerPlugins(["pilot/index"]);var b=require("pilot/dom"),c=require("pilot/event"),d=require("ace/editor").Editor,e=require("ace/edit_session").EditSession,f=require("ace/undomanager").UndoManager,g=require("ace/virtual_renderer").VirtualRenderer;window.ace={edit:function(h){typeof h=="string"&&(h=document.getElementById(h));var i=new e(b.getInnerText(h));i.setUndoManager(new f),h.innerHTML="";var j=new d(new g(h,"ace/theme/textmate"));j.setSession(i);var k=require("pilot/environment").create();a.startupPlugins({env:k}).then(function(){k.document=i,k.editor=k,j.resize(),c.addListener(window,"resize",function(){j.resize()}),h.env=k});return j}}}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/cockpit-uncompressed.js b/src/static/ace-0.1.6/src/cockpit-uncompressed.js new file mode 100644 index 0000000..e26d270 --- /dev/null +++ b/src/static/ace-0.1.6/src/cockpit-uncompressed.js @@ -0,0 +1,2486 @@ +/* ***** 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 Mozilla Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Kevin Dangoor (kdangoor@mozilla.com) + * + * 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('cockpit/index', function(require, exports, module) { + + +exports.startup = function(data, reason) { + require('pilot/index'); + require('cockpit/cli').startup(data, reason); + // window.testCli = require('cockpit/test/testCli'); + + require('cockpit/ui/settings').startup(data, reason); + require('cockpit/ui/cli_view').startup(data, reason); + require('cockpit/commands/basic').startup(data, reason); +}; + +/* +exports.shutdown(data, reason) { +}; +*/ + + +}); +/* ***** 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 Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Joe Walker (jwalker@mozilla.com) + * + * 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('cockpit/cli', function(require, exports, module) { + + +var console = require('pilot/console'); +var lang = require('pilot/lang'); +var oop = require('pilot/oop'); +var EventEmitter = require('pilot/event_emitter').EventEmitter; + +//var keyboard = require('keyboard/keyboard'); +var types = require('pilot/types'); +var Status = require('pilot/types').Status; +var Conversion = require('pilot/types').Conversion; +var canon = require('pilot/canon'); + +/** + * Normally type upgrade is done when the owning command is registered, but + * out commandParam isn't part of a command, so it misses out. + */ +exports.startup = function(data, reason) { + canon.upgradeType('command', commandParam); +}; + +/** + * The information required to tell the user there is a problem with their + * input. + * TODO: There a several places where {start,end} crop up. Perhaps we should + * have a Cursor object. + */ +function Hint(status, message, start, end, predictions) { + this.status = status; + this.message = message; + + if (typeof start === 'number') { + this.start = start; + this.end = end; + this.predictions = predictions; + } + else { + var arg = start; + this.start = arg.start; + this.end = arg.end; + this.predictions = arg.predictions; + } +} +Hint.prototype = { +}; +/** + * Loop over the array of hints finding the one we should display. + * @param hints array of hints + */ +Hint.sort = function(hints, cursor) { + // Calculate 'distance from cursor' + if (cursor !== undefined) { + hints.forEach(function(hint) { + if (hint.start === Argument.AT_CURSOR) { + hint.distance = 0; + } + else if (cursor < hint.start) { + hint.distance = hint.start - cursor; + } + else if (cursor > hint.end) { + hint.distance = cursor - hint.end; + } + else { + hint.distance = 0; + } + }, this); + } + // Sort + hints.sort(function(hint1, hint2) { + // Compare first based on distance from cursor + if (cursor !== undefined) { + var diff = hint1.distance - hint2.distance; + if (diff != 0) { + return diff; + } + } + // otherwise go with hint severity + return hint2.status - hint1.status; + }); + // tidy-up + if (cursor !== undefined) { + hints.forEach(function(hint) { + delete hint.distance; + }, this); + } + return hints; +}; +exports.Hint = Hint; + +/** + * A Hint that arose as a result of a Conversion + */ +function ConversionHint(conversion, arg) { + this.status = conversion.status; + this.message = conversion.message; + if (arg) { + this.start = arg.start; + this.end = arg.end; + } + else { + this.start = 0; + this.end = 0; + } + this.predictions = conversion.predictions; +}; +oop.inherits(ConversionHint, Hint); + + +/** + * We record where in the input string an argument comes so we can report errors + * against those string positions. + * We publish a 'change' event when-ever the text changes + * @param emitter Arguments use something else to pass on change events. + * Currently this will be the creating Requisition. This prevents dependency + * loops and prevents us from needing to merge listener lists. + * @param text The string (trimmed) that contains the argument + * @param start The position of the text in the original input string + * @param end See start + * @param prefix Knowledge of quotation marks and whitespace used prior to the + * text in the input string allows us to re-generate the original input from + * the arguments. + * @param suffix Any quotation marks and whitespace used after the text. + * Whitespace is normally placed in the prefix to the succeeding argument, but + * can be used here when this is the last argument. + * @constructor + */ +function Argument(emitter, text, start, end, prefix, suffix) { + this.emitter = emitter; + this.setText(text); + this.start = start; + this.end = end; + this.prefix = prefix; + this.suffix = suffix; +} +Argument.prototype = { + /** + * Return the result of merging these arguments. + * TODO: What happens when we're merging arguments for the single string + * case and some of the arguments are in quotation marks? + */ + merge: function(following) { + if (following.emitter != this.emitter) { + throw new Error('Can\'t merge Arguments from different EventEmitters'); + } + return new Argument( + this.emitter, + this.text + this.suffix + following.prefix + following.text, + this.start, following.end, + this.prefix, + following.suffix); + }, + + /** + * See notes on events in Assignment. We might need to hook changes here + * into a CliRequisition so they appear of the command line. + */ + setText: function(text) { + if (text == null) { + throw new Error('Illegal text for Argument: ' + text); + } + var ev = { argument: this, oldText: this.text, text: text }; + this.text = text; + this.emitter._dispatchEvent('argumentChange', ev); + }, + + /** + * Helper when we're putting arguments back together + */ + toString: function() { + // TODO: There is a bug here - we should re-escape escaped characters + // But can we do that reliably? + return this.prefix + this.text + this.suffix; + } +}; + +/** + * Merge an array of arguments into a single argument. + * All Arguments in the array are expected to have the same emitter + */ +Argument.merge = function(argArray, start, end) { + start = (start === undefined) ? 0 : start; + end = (end === undefined) ? argArray.length : end; + + var joined; + for (var i = start; i < end; i++) { + var arg = argArray[i]; + if (!joined) { + joined = arg; + } + else { + joined = joined.merge(arg); + } + } + return joined; +}; + +/** + * We sometimes need a way to say 'this error occurs where ever the cursor is' + */ +Argument.AT_CURSOR = -1; + + +/** + * A link between a parameter and the data for that parameter. + * The data for the parameter is available as in the preferred type and as + * an Argument for the CLI. + *

We also record validity information where applicable. + *

For values, null and undefined have distinct definitions. null means + * that a value has been provided, undefined means that it has not. + * Thus, null is a valid default value, and common because it identifies an + * parameter that is optional. undefined means there is no value from + * the command line. + * @constructor + */ +function Assignment(param, requisition) { + this.param = param; + this.requisition = requisition; + this.setValue(param.defaultValue); +}; +Assignment.prototype = { + /** + * The parameter that we are assigning to + * @readonly + */ + param: undefined, + + /** + * Report on the status of the last parse() conversion. + * @see types.Conversion + */ + conversion: undefined, + + /** + * The current value in a type as specified by param.type + */ + value: undefined, + + /** + * The string version of the current value + */ + arg: undefined, + + /** + * The current value (i.e. not the string representation) + * Use setValue() to mutate + */ + value: undefined, + setValue: function(value) { + if (this.value === value) { + return; + } + + if (value === undefined) { + this.value = this.param.defaultValue; + this.conversion = this.param.getDefault ? + this.param.getDefault() : + this.param.type.getDefault(); + this.arg = undefined; + } else { + this.value = value; + this.conversion = undefined; + var text = (value == null) ? '' : this.param.type.stringify(value); + if (this.arg) { + this.arg.setText(text); + } + } + + this.requisition._assignmentChanged(this); + }, + + /** + * The textual representation of the current value + * Use setValue() to mutate + */ + arg: undefined, + setArgument: function(arg) { + if (this.arg === arg) { + return; + } + this.arg = arg; + this.conversion = this.param.type.parse(arg.text); + this.conversion.arg = arg; // TODO: make this automatic? + this.value = this.conversion.value; + this.requisition._assignmentChanged(this); + }, + + /** + * Create a list of the hints associated with this parameter assignment. + * Generally there will be only one hint generated because we're currently + * only displaying one hint at a time, ordering by distance from cursor + * and severity. Since distance from cursor will be the same for all hints + * from this assignment all but the most severe will ever be used. It might + * make sense with more experience to alter this to function to be getHint() + */ + getHint: function() { + // Allow the parameter to provide documentation + if (this.param.getCustomHint && this.value && this.arg) { + var hint = this.param.getCustomHint(this.value, this.arg); + if (hint) { + return hint; + } + } + + // If there is no argument, use the cursor position + var message = '' + this.param.name + ': '; + if (this.param.description) { + // TODO: This should be a short description - do we need to trim? + message += this.param.description.trim(); + + // Ensure the help text ends with '. ' + if (message.charAt(message.length - 1) !== '.') { + message += '.'; + } + if (message.charAt(message.length - 1) !== ' ') { + message += ' '; + } + } + var status = Status.VALID; + var start = this.arg ? this.arg.start : Argument.AT_CURSOR; + var end = this.arg ? this.arg.end : Argument.AT_CURSOR; + var predictions; + + // Non-valid conversions will have useful information to pass on + if (this.conversion) { + status = this.conversion.status; + if (this.conversion.message) { + message += this.conversion.message; + } + predictions = this.conversion.predictions; + } + + // Hint if the param is required, but not provided + var argProvided = this.arg && this.arg.text !== ''; + var dataProvided = this.value !== undefined || argProvided; + if (this.param.defaultValue === undefined && !dataProvided) { + status = Status.INVALID; + message += 'Required<\strong>'; + } + + return new Hint(status, message, start, end, predictions); + }, + + /** + * Basically setValue(conversion.predictions[0]) done in a safe + * way. + */ + complete: function() { + if (this.conversion && this.conversion.predictions && + this.conversion.predictions.length > 0) { + this.setValue(this.conversion.predictions[0]); + } + }, + + /** + * If the cursor is at 'position', do we have sufficient data to start + * displaying the next hint. This is both complex and important. + * For example, if the user has just typed:

    + *
  • 'set tabstop ' then they clearly want to know about the valid + * values for the tabstop setting, so the hint is based on the next + * parameter. + *
  • 'set tabstop' (without trailing space) - they will probably still + * want to know about the valid values for the tabstop setting because + * there is no confusion about the setting in question. + *
  • 'set tabsto' they've not finished typing a setting name so the hint + * should be based on the current parameter. + *
  • 'set tabstop' (when there is an additional tabstopstyle setting) we + * can't make assumptions about the setting - we're not finished. + *
+ *

Note that the input for 2 and 4 is identical, only the configuration + * has changed, so hint display is environmental. + * + *

This function works out if the cursor is before the end of this + * assignment (assuming that we've asked the same thing of the previous + * assignment) and then attempts to work out if we should use the hint from + * the next assignment even though technically the cursor is still inside + * this one due to the rules above. + */ + isPositionCaptured: function(position) { + if (!this.arg) { + return false; + } + + // Note we don't check if position >= this.arg.start because that's + // implied by the fact that we're asking the assignments in turn, and + // we want to avoid thing falling between the cracks, but we do need + // to check that the argument does have a position + if (this.arg.start === -1) { + return false; + } + + // We're clearly done if the position is past the end of the text + if (position > this.arg.end) { + return false; + } + + // If we're AT the end, the position is captured if either the status + // is not valid or if there are other valid options including current + if (position === this.arg.end) { + return this.conversion.status !== Status.VALID || + this.conversion.predictions.length !== 0; + } + + // Otherwise we're clearly inside + return true; + }, + + /** + * Replace the current value with the lower value if such a concept + * exists. + */ + decrement: function() { + var replacement = this.param.type.decrement(this.value); + if (replacement != null) { + this.setValue(replacement); + } + }, + + /** + * Replace the current value with the higher value if such a concept + * exists. + */ + increment: function() { + var replacement = this.param.type.increment(this.value); + if (replacement != null) { + this.setValue(replacement); + } + }, + + /** + * Helper when we're rebuilding command lines. + */ + toString: function() { + return this.arg ? this.arg.toString() : ''; + } +}; +exports.Assignment = Assignment; + + +/** + * This is a special parameter to reflect the command itself. + */ +var commandParam = { + name: '__command', + type: 'command', + description: 'The command to execute', + + /** + * Provide some documentation for a command. + */ + getCustomHint: function(command, arg) { + var docs = []; + docs.push(' > '); + docs.push(command.name); + if (command.params && command.params.length > 0) { + command.params.forEach(function(param) { + if (param.defaultValue === undefined) { + docs.push(' [' + param.name + ']'); + } + else { + docs.push(' [' + param.name + ']'); + } + }, this); + } + docs.push('
'); + + docs.push(command.description ? command.description : '(No description)'); + docs.push('
'); + + if (command.params && command.params.length > 0) { + docs.push('

    '); + command.params.forEach(function(param) { + docs.push('
  • '); + docs.push('' + param.name + ': '); + docs.push(param.description ? param.description : '(No description)'); + if (param.defaultValue === undefined) { + docs.push(' [Required]'); + } + else if (param.defaultValue === null) { + docs.push(' [Optional]'); + } + else { + docs.push(' [Default: ' + param.defaultValue + ']'); + } + docs.push('
  • '); + }, this); + docs.push('
'); + } + + return new Hint(Status.VALID, docs.join(''), arg); + } +}; + +/** + * A Requisition collects the information needed to execute a command. + * There is no point in a requisition for parameter-less commands because there + * is no information to collect. A Requisition is a collection of assignments + * of values to parameters, each handled by an instance of Assignment. + * CliRequisition adds functions for parsing input from a command line to this + * class. + *

Events

+ * We publish the following events:
    + *
  • argumentChange: The text of some argument has changed. It is likely that + * any UI component displaying this argument will need to be updated. (Note that + * this event is actually published by the Argument itself - see the docs for + * Argument for more details) + * The event object looks like: { argument: A, oldText: B, text: B } + *
  • commandChange: The command has changed. It is likely that a UI + * structure will need updating to match the parameters of the new command. + * The event object looks like { command: A } + * @constructor + */ +function Requisition(env) { + this.env = env; + this.commandAssignment = new Assignment(commandParam, this); +} + +Requisition.prototype = { + /** + * The command that we are about to execute. + * @see setCommandConversion() + * @readonly + */ + commandAssignment: undefined, + + /** + * The count of assignments. Excludes the commandAssignment + * @readonly + */ + assignmentCount: undefined, + + /** + * The object that stores of Assignment objects that we are filling out. + * The Assignment objects are stored under their param.name for named + * lookup. Note: We make use of the property of Javascript objects that + * they are not just hashmaps, but linked-list hashmaps which iterate in + * insertion order. + * Excludes the commandAssignment. + */ + _assignments: undefined, + + /** + * The store of hints generated by the assignments. We are trying to prevent + * the UI from needing to access this in broad form, but instead use + * methods that query part of this structure. + */ + _hints: undefined, + + /** + * When the command changes, we need to keep a bunch of stuff in sync + */ + _assignmentChanged: function(assignment) { + // This is all about re-creating Assignments + if (assignment.param.name !== '__command') { + return; + } + + this._assignments = {}; + + if (assignment.value) { + assignment.value.params.forEach(function(param) { + this._assignments[param.name] = new Assignment(param, this); + }, this); + } + + this.assignmentCount = Object.keys(this._assignments).length; + this._dispatchEvent('commandChange', { command: assignment.value }); + }, + + /** + * Assignments have an order, so we need to store them in an array. + * But we also need named access ... + */ + getAssignment: function(nameOrNumber) { + var name = (typeof nameOrNumber === 'string') ? + nameOrNumber : + Object.keys(this._assignments)[nameOrNumber]; + return this._assignments[name]; + }, + + /** + * Where parameter name == assignment names - they are the same. + */ + getParameterNames: function() { + return Object.keys(this._assignments); + }, + + /** + * A *shallow* clone of the assignments. + * This is useful for systems that wish to go over all the assignments + * finding values one way or another and wish to trim an array as they go. + */ + cloneAssignments: function() { + return Object.keys(this._assignments).map(function(name) { + return this._assignments[name]; + }, this); + }, + + /** + * Collect the statuses from the Assignments. + * The hints returned are sorted by severity + */ + _updateHints: function() { + // TODO: work out when to clear this out for the plain Requisition case + // this._hints = []; + this.getAssignments(true).forEach(function(assignment) { + this._hints.push(assignment.getHint()); + }, this); + Hint.sort(this._hints); + + // We would like to put some initial help here, but for anyone but + // a complete novice a 'type help' message is very annoying, so we + // need to find a way to only display this message once, or for + // until the user click a 'close' button or similar + // TODO: Add special case for '' input + }, + + /** + * Returns the most severe status + */ + getWorstHint: function() { + return this._hints[0]; + }, + + /** + * Extract the names and values of all the assignments, and return as + * an object. + */ + getArgsObject: function() { + var args = {}; + this.getAssignments().forEach(function(assignment) { + args[assignment.param.name] = assignment.value; + }, this); + return args; + }, + + /** + * Access the arguments as an array. + * @param includeCommand By default only the parameter arguments are + * returned unless (includeCommand === true), in which case the list is + * prepended with commandAssignment.arg + */ + getAssignments: function(includeCommand) { + var args = []; + if (includeCommand === true) { + args.push(this.commandAssignment); + } + Object.keys(this._assignments).forEach(function(name) { + args.push(this.getAssignment(name)); + }, this); + return args; + }, + + /** + * Reset all the assignments to their default values + */ + setDefaultValues: function() { + this.getAssignments().forEach(function(assignment) { + assignment.setValue(undefined); + }, this); + }, + + /** + * Helper to call canon.exec + */ + exec: function() { + canon.exec(this.commandAssignment.value, + this.env, + this.getArgsObject(), + this.toCanonicalString()); + }, + + /** + * Extract a canonical version of the input + */ + toCanonicalString: function() { + var line = []; + line.push(this.commandAssignment.value.name); + Object.keys(this._assignments).forEach(function(name) { + var assignment = this._assignments[name]; + var type = assignment.param.type; + // TODO: This will cause problems if there is a non-default value + // after a default value. Also we need to decide when to use + // named parameters in place of positional params. Both can wait. + if (assignment.value !== assignment.param.defaultValue) { + line.push(' '); + line.push(type.stringify(assignment.value)); + } + }, this); + return line.join(''); + } +}; +oop.implement(Requisition.prototype, EventEmitter); +exports.Requisition = Requisition; + + +/** + * An object used during command line parsing to hold the various intermediate + * data steps. + *

    The 'output' of the update is held in 2 objects: input.hints which is an + * array of hints to display to the user. In the future this will become a + * single value. + *

    The other output value is input.requisition which gives access to an + * args object for use in executing the final command. + * + *

    The majority of the functions in this class are called in sequence by the + * constructor. Their task is to add to hints fill out the requisition. + *

    The general sequence is:

      + *
    • _tokenize(): convert _typed into _parts + *
    • _split(): convert _parts into _command and _unparsedArgs + *
    • _assign(): convert _unparsedArgs into requisition + *
    + * + * @param typed {string} The instruction as typed by the user so far + * @param options {object} A list of optional named parameters. Can be any of: + * flags: Flags for us to check against the predicates specified with the + * commands. Defaulted to keyboard.buildFlags({ }); + * if not specified. + * @constructor + */ +function CliRequisition(env, options) { + Requisition.call(this, env); + + if (options && options.flags) { + /** + * TODO: We were using a default of keyboard.buildFlags({ }); + * This allowed us to have commands that only existed in certain contexts + * - i.e. Javascript specific commands. + */ + this.flags = options.flags; + } +} +oop.inherits(CliRequisition, Requisition); +(function() { + /** + * Called by the UI when ever the user interacts with a command line input + * @param input A structure that details the state of the input field. + * It should look something like: { typed:a, cursor: { start:b, end:c } } + * Where a is the contents of the input field, and b and c are the start + * and end of the cursor/selection respectively. + */ + CliRequisition.prototype.update = function(input) { + this.input = input; + this._hints = []; + + var args = this._tokenize(input.typed); + this._split(args); + + if (this.commandAssignment.value) { + this._assign(args); + } + + this._updateHints(); + }; + + /** + * Return an array of Status scores so we can create a marked up + * version of the command line input. + */ + CliRequisition.prototype.getInputStatusMarkup = function() { + // 'scores' is an array which tells us what chars are errors + // Initialize with everything VALID + var scores = this.toString().split('').map(function(ch) { + return Status.VALID; + }); + // For all chars in all hints, check and upgrade the score + this._hints.forEach(function(hint) { + for (var i = hint.start; i <= hint.end; i++) { + if (hint.status > scores[i]) { + scores[i] = hint.status; + } + } + }, this); + return scores; + }; + + /** + * Reconstitute the input from the args + */ + CliRequisition.prototype.toString = function() { + return this.getAssignments(true).map(function(assignment) { + return assignment.toString(); + }, this).join(''); + }; + + var superUpdateHints = CliRequisition.prototype._updateHints; + /** + * Marks up hints in a number of ways: + * - Makes INCOMPLETE hints that are not near the cursor INVALID since + * they can't be completed by typing + * - Finds the most severe hint, and annotates the array with it + * - Finds the hint to display, and also annotates the array with it + * TODO: I'm wondering if array annotation is evil and we should replace + * this with an object. Need to find out more. + */ + CliRequisition.prototype._updateHints = function() { + superUpdateHints.call(this); + + // Not knowing about cursor positioning, the requisition and assignments + // can't know this, but anything they mark as INCOMPLETE is actually + // INVALID unless the cursor is actually inside that argument. + var c = this.input.cursor; + this._hints.forEach(function(hint) { + var startInHint = c.start >= hint.start && c.start <= hint.end; + var endInHint = c.end >= hint.start && c.end <= hint.end; + var inHint = startInHint || endInHint; + if (!inHint && hint.status === Status.INCOMPLETE) { + hint.status = Status.INVALID; + } + }, this); + + Hint.sort(this._hints); + }; + + /** + * Accessor for the hints array. + * While we could just use the hints property, using getHints() is + * preferred for symmetry with Requisition where it needs a function due to + * lack of an atomic update system. + */ + CliRequisition.prototype.getHints = function() { + return this._hints; + }; + + /** + * Look through the arguments attached to our assignments for the assignment + * at the given position. + */ + CliRequisition.prototype.getAssignmentAt = function(position) { + var assignments = this.getAssignments(true); + for (var i = 0; i < assignments.length; i++) { + var assignment = assignments[i]; + if (!assignment.arg) { + // There is no argument in this assignment, we've fallen off + // the end of the obvious answers - it must be this one. + return assignment; + } + if (assignment.isPositionCaptured(position)) { + return assignment; + } + } + + return assignment; + }; + + /** + * Split up the input taking into account ' and " + */ + CliRequisition.prototype._tokenize = function(typed) { + // For blank input, place a dummy empty argument into the list + if (typed == null || typed.length === 0) { + return [ new Argument(this, '', 0, 0, '', '') ]; + } + + var OUTSIDE = 1; // The last character was whitespace + var IN_SIMPLE = 2; // The last character was part of a parameter + var IN_SINGLE_Q = 3; // We're inside a single quote: ' + var IN_DOUBLE_Q = 4; // We're inside double quotes: " + + var mode = OUTSIDE; + + // First we un-escape. This list was taken from: + // https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Core_Language_Features#Unicode + // We are generally converting to their real values except for \', \" + // and '\ ' which we are converting to unicode private characters so we + // can distinguish them from ', " and ' ', which have special meaning. + // They need swapping back post-split - see unescape2() + typed = typed + .replace(/\\\\/g, '\\') + .replace(/\\b/g, '\b') + .replace(/\\f/g, '\f') + .replace(/\\n/g, '\n') + .replace(/\\r/g, '\r') + .replace(/\\t/g, '\t') + .replace(/\\v/g, '\v') + .replace(/\\n/g, '\n') + .replace(/\\r/g, '\r') + .replace(/\\ /g, '\uF000') + .replace(/\\'/g, '\uF001') + .replace(/\\"/g, '\uF002'); + + function unescape2(str) { + return str + .replace(/\uF000/g, ' ') + .replace(/\uF001/g, '\'') + .replace(/\uF002/g, '"'); + } + + var i = 0; + var start = 0; // Where did this section start? + var prefix = ''; + var args = []; + + while (true) { + if (i >= typed.length) { + // There is nothing else to read - tidy up + if (mode !== OUTSIDE) { + var str = unescape2(typed.substring(start, i)); + args.push(new Argument(this, str, start, i, prefix, '')); + } + else { + if (i !== start) { + // There's a bunch of whitespace at the end of the + // command add it to the last argument's suffix, + // creating an empty argument if needed. + var extra = typed.substring(start, i); + var lastArg = args[args.length - 1]; + if (!lastArg) { + lastArg = new Argument(this, '', i, i, extra, ''); + args.push(lastArg); + } + else { + lastArg.suffix += extra; + } + } + } + break; + } + + var c = typed[i]; + switch (mode) { + case OUTSIDE: + if (c === '\'') { + prefix = typed.substring(start, i + 1); + mode = IN_SINGLE_Q; + start = i + 1; + } + else if (c === '"') { + prefix = typed.substring(start, i + 1); + mode = IN_DOUBLE_Q; + start = i + 1; + } + else if (/ /.test(c)) { + // Still whitespace, do nothing + } + else { + prefix = typed.substring(start, i); + mode = IN_SIMPLE; + start = i; + } + break; + + case IN_SIMPLE: + // There is an edge case of xx'xx which we are assuming to + // be a single parameter (and same with ") + if (c === ' ') { + var str = unescape2(typed.substring(start, i)); + args.push(new Argument(this, str, + start, i, prefix, '')); + mode = OUTSIDE; + start = i; + prefix = ''; + } + break; + + case IN_SINGLE_Q: + if (c === '\'') { + var str = unescape2(typed.substring(start, i)); + args.push(new Argument(this, str, + start - 1, i + 1, prefix, c)); + mode = OUTSIDE; + start = i + 1; + prefix = ''; + } + break; + + case IN_DOUBLE_Q: + if (c === '"') { + var str = unescape2(typed.substring(start, i)); + args.push(new Argument(this, str, + start - 1, i + 1, prefix, c)); + mode = OUTSIDE; + start = i + 1; + prefix = ''; + } + break; + } + + i++; + } + + return args; + }; + + /** + * Looks in the canon for a command extension that matches what has been + * typed at the command line. + */ + CliRequisition.prototype._split = function(args) { + var argsUsed = 1; + var arg; + + while (argsUsed <= args.length) { + var arg = Argument.merge(args, 0, argsUsed); + this.commandAssignment.setArgument(arg); + + if (!this.commandAssignment.value) { + // Not found. break with value == null + break; + } + + /* + // Previously we needed a way to hide commands depending context. + // We have not resurrected that feature yet. + if (!keyboard.flagsMatch(command.predicates, this.flags)) { + // If the predicates say 'no match' then go LA LA LA + command = null; + break; + } + */ + + if (this.commandAssignment.value.exec) { + // Valid command, break with command valid + for (var i = 0; i < argsUsed; i++) { + args.shift(); + } + break; + } + + argsUsed++; + } + }; + + /** + * Work out which arguments are applicable to which parameters. + *

    This takes #_command.params and #_unparsedArgs and creates a map of + * param names to 'assignment' objects, which have the following properties: + *

      + *
    • param - The matching parameter. + *
    • index - Zero based index into where the match came from on the input + *
    • value - The matching input + *
    + */ + CliRequisition.prototype._assign = function(args) { + if (args.length === 0) { + this.setDefaultValues(); + return; + } + + // Create an error if the command does not take parameters, but we have + // been given them ... + if (this.assignmentCount === 0) { + // TODO: previously we were doing some extra work to avoid this if + // we determined that we had args that were all whitespace, but + // probably given our tighter tokenize() this won't be an issue? + this._hints.push(new Hint(Status.INVALID, + this.commandAssignment.value.name + + ' does not take any parameters', + Argument.merge(args))); + return; + } + + // Special case: if there is only 1 parameter, and that's of type + // text we put all the params into the first param + if (this.assignmentCount === 1) { + var assignment = this.getAssignment(0); + if (assignment.param.type.name === 'text') { + assignment.setArgument(Argument.merge(args)); + return; + } + } + + var assignments = this.cloneAssignments(); + var names = this.getParameterNames(); + + // Extract all the named parameters + var used = []; + assignments.forEach(function(assignment) { + var namedArgText = '--' + assignment.name; + + var i = 0; + while (true) { + var arg = args[i]; + if (namedArgText !== arg.text) { + i++; + if (i >= args.length) { + break; + } + continue; + } + + // boolean parameters don't have values, default to false + if (assignment.param.type.name === 'boolean') { + assignment.setValue(true); + } + else { + if (i + 1 < args.length) { + // Missing value portion of this named param + this._hints.push(new Hint(Status.INCOMPLETE, + 'Missing value for: ' + namedArgText, + args[i])); + } + else { + args.splice(i + 1, 1); + assignment.setArgument(args[i + 1]); + } + } + + lang.arrayRemove(names, assignment.name); + args.splice(i, 1); + // We don't need to i++ if we splice + } + }, this); + + // What's left are positional parameters assign in order + names.forEach(function(name) { + var assignment = this.getAssignment(name); + if (args.length === 0) { + // No more values + assignment.setValue(undefined); // i.e. default + } + else { + var arg = args[0]; + args.splice(0, 1); + assignment.setArgument(arg); + } + }, this); + + if (args.length > 0) { + var remaining = Argument.merge(args); + this._hints.push(new Hint(Status.INVALID, + 'Input \'' + remaining.text + '\' makes no sense.', + remaining)); + } + }; + +})(); +exports.CliRequisition = CliRequisition; + + +}); +/* ***** 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 Mozilla Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Joe Walker (jwalker@mozilla.com) + * + * 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('cockpit/ui/settings', function(require, exports, module) { + + +var types = require("pilot/types"); +var SelectionType = require('pilot/types/basic').SelectionType; + +var direction = new SelectionType({ + name: 'direction', + data: [ 'above', 'below' ] +}); + +var hintDirectionSetting = { + name: "hintDirection", + description: "Are hints shown above or below the command line?", + type: "direction", + defaultValue: "above" +}; + +var outputDirectionSetting = { + name: "outputDirection", + description: "Is the output window shown above or below the command line?", + type: "direction", + defaultValue: "above" +}; + +var outputHeightSetting = { + name: "outputHeight", + description: "What height should the output panel be?", + type: "number", + defaultValue: 300 +}; + +exports.startup = function(data, reason) { + types.registerType(direction); + data.env.settings.addSetting(hintDirectionSetting); + data.env.settings.addSetting(outputDirectionSetting); + data.env.settings.addSetting(outputHeightSetting); +}; + +exports.shutdown = function(data, reason) { + types.unregisterType(direction); + data.env.settings.removeSetting(hintDirectionSetting); + data.env.settings.removeSetting(outputDirectionSetting); + data.env.settings.removeSetting(outputHeightSetting); +}; + + +}); +/* ***** 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 Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Joe Walker (jwalker@mozilla.com) + * + * 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('cockpit/ui/cli_view', function(require, exports, module) { + + +var editorCss = require("text!cockpit/ui/cli_view.css"); +var event = require("pilot/event"); +var dom = require("pilot/dom"); +dom.importCssString(editorCss); + +var event = require("pilot/event"); +var keys = require("pilot/keys"); +var canon = require("pilot/canon"); +var Status = require('pilot/types').Status; + +var CliRequisition = require('cockpit/cli').CliRequisition; +var Hint = require('cockpit/cli').Hint; +var RequestView = require('cockpit/ui/request_view').RequestView; + +var NO_HINT = new Hint(Status.VALID, '', 0, 0); + +/** + * On startup we need to: + * 1. Add 3 sets of elements to the DOM for: + * - command line output + * - input hints + * - completion + * 2. Attach a set of events so the command line works + */ +exports.startup = function(data, reason) { + var cli = new CliRequisition(data.env); + var cliView = new CliView(cli, data.env); +}; + +/** + * A class to handle the simplest UI implementation + */ +function CliView(cli, env) { + this.cli = cli; + this.doc = document; + this.win = dom.getParentWindow(this.doc); + + // TODO: we should have a better way to specify command lines??? + this.element = this.doc.getElementById('cockpitInput'); + if (!this.element) { + // console.log('No element with an id of cockpit. Bailing on cli'); + return; + } + + this.settings = env.settings; + this.hintDirection = this.settings.getSetting('hintDirection'); + this.outputDirection = this.settings.getSetting('outputDirection'); + this.outputHeight = this.settings.getSetting('outputHeight'); + + // If the requisition tells us something has changed, we use this to know + // if we should ignore it + this.isUpdating = false; + + this.createElements(); + this.update(); +} +CliView.prototype = { + /** + * Create divs for completion, hints and output + */ + createElements: function() { + var input = this.element; + + this.element.spellcheck = false; + + this.output = this.doc.getElementById('cockpitOutput'); + this.popupOutput = (this.output == null); + if (!this.output) { + this.output = this.doc.createElement('div'); + this.output.id = 'cockpitOutput'; + this.output.className = 'cptFocusPopup'; + input.parentNode.insertBefore(this.output, input.nextSibling); + + var setMaxOutputHeight = function() { + this.output.style.maxHeight = this.outputHeight.get() + 'px'; + }.bind(this); + this.outputHeight.addEventListener('change', setMaxOutputHeight); + setMaxOutputHeight(); + } + + this.completer = this.doc.createElement('div'); + this.completer.className = 'cptCompletion VALID'; + ; + this.completer.style.color = dom.computedStyle(input, "color"); + this.completer.style.fontSize = dom.computedStyle(input, "fontSize"); + this.completer.style.fontFamily = dom.computedStyle(input, "fontFamily"); + this.completer.style.fontWeight = dom.computedStyle(input, "fontWeight"); + this.completer.style.fontStyle = dom.computedStyle(input, "fontStyle"); + input.parentNode.insertBefore(this.completer, input.nextSibling); + + // Transfer background styling to the completer. + this.completer.style.backgroundColor = input.style.backgroundColor; + input.style.backgroundColor = 'transparent'; + + this.hinter = this.doc.createElement('div'); + this.hinter.className = 'cptHints cptFocusPopup'; + input.parentNode.insertBefore(this.hinter, input.nextSibling); + + var resizer = this.resizer.bind(this); + event.addListener(this.win, 'resize', resizer); + this.hintDirection.addEventListener('change', resizer); + this.outputDirection.addEventListener('change', resizer); + resizer(); + + canon.addEventListener('output', function(ev) { + new RequestView(ev.request, this); + }.bind(this)); + event.addCommandKeyListener(input, this.onCommandKey.bind(this)); + event.addListener(input, 'keyup', this.onKeyUp.bind(this)); + + // cursor position affects hint severity. TODO: shortcuts for speed + event.addListener(input, 'mouseup', function(ev) { + this.isUpdating = true; + this.update(); + this.isUpdating = false; + }.bind(this)); + + this.cli.addEventListener('argumentChange', this.onArgChange.bind(this)); + }, + + /** + * We need to see the output of the latest command entered + */ + scrollOutputToBottom: function() { + // Certain browsers have a bug such that scrollHeight is too small + // when content does not fill the client area of the element + var scrollHeight = Math.max(this.output.scrollHeight, this.output.clientHeight); + this.output.scrollTop = scrollHeight - this.output.clientHeight; + }, + + /** + * To be called on window resize or any time we want to align the elements + * with the input box. + */ + resizer: function() { + var rect = this.element.getClientRects()[0]; + + this.completer.style.top = rect.top + 'px'; + var height = rect.bottom - rect.top; + this.completer.style.height = height + 'px'; + this.completer.style.lineHeight = height + 'px'; + this.completer.style.left = rect.left + 'px'; + var width = rect.right - rect.left; + this.completer.style.width = width + 'px'; + + if (this.hintDirection.get() === 'below') { + this.hinter.style.top = rect.bottom + 'px'; + this.hinter.style.bottom = 'auto'; + } + else { + this.hinter.style.top = 'auto'; + this.hinter.style.bottom = (this.doc.documentElement.clientHeight - rect.top) + 'px'; + } + this.hinter.style.left = (rect.left + 30) + 'px'; + this.hinter.style.maxWidth = (width - 110) + 'px'; + + if (this.popupOutput) { + if (this.outputDirection.get() === 'below') { + this.output.style.top = rect.bottom + 'px'; + this.output.style.bottom = 'auto'; + } + else { + this.output.style.top = 'auto'; + this.output.style.bottom = (this.doc.documentElement.clientHeight - rect.top) + 'px'; + } + this.output.style.left = rect.left + 'px'; + this.output.style.width = (width - 80) + 'px'; + } + }, + + /** + * Ensure that TAB isn't handled by the browser + */ + onCommandKey: function(ev, hashId, keyCode) { + var handled; + // var handled = keyboardManager.processKeyEvent(ev, this, { + // isCommandLine: true, isKeyUp: false + // }); + if (keyCode === keys.TAB || + keyCode === keys.UP || + keyCode === keys.DOWN) { + event.stopEvent(ev); + } + return handled; + }, + + /** + * The main keyboard processing loop + */ + onKeyUp: function(ev) { + var handled; + /* + var handled = keyboardManager.processKeyEvent(ev, this, { + isCommandLine: true, isKeyUp: true + }); + */ + + // RETURN does a special exec/highlight thing + if (ev.keyCode === keys.RETURN) { + var worst = this.cli.getWorstHint(); + // Deny RETURN unless the command might work + if (worst.status === Status.VALID) { + this.cli.exec(); + this.element.value = ''; + } + else { + // If we've denied RETURN because the command was not VALID, + // select the part of the command line that is causing problems + // TODO: if there are 2 errors are we picking the right one? + dom.setSelectionStart(this.element, worst.start); + dom.setSelectionEnd(this.element, worst.end); + } + } + + this.update(); + + // Special actions which delegate to the assignment + var current = this.cli.getAssignmentAt(dom.getSelectionStart(this.element)); + if (current) { + // TAB does a special complete thing + if (ev.keyCode === keys.TAB) { + current.complete(); + this.update(); + } + + // UP/DOWN look for some history + if (ev.keyCode === keys.UP) { + current.increment(); + this.update(); + } + if (ev.keyCode === keys.DOWN) { + current.decrement(); + this.update(); + } + } + + return handled; + }, + + /** + * Actually parse the input and make sure we're all up to date + */ + update: function() { + this.isUpdating = true; + var input = { + typed: this.element.value, + cursor: { + start: dom.getSelectionStart(this.element), + end: dom.getSelectionEnd(this.element.selectionEnd) + } + }; + this.cli.update(input); + + var display = this.cli.getAssignmentAt(input.cursor.start).getHint(); + + // 1. Update the completer with prompt/error marker/TAB info + dom.removeCssClass(this.completer, Status.VALID.toString()); + dom.removeCssClass(this.completer, Status.INCOMPLETE.toString()); + dom.removeCssClass(this.completer, Status.INVALID.toString()); + + var completion = '> '; + if (this.element.value.length > 0) { + var scores = this.cli.getInputStatusMarkup(); + completion += this.markupStatusScore(scores); + } + + // Display the "-> prediction" at the end of the completer + if (this.element.value.length > 0 && + display.predictions && display.predictions.length > 0) { + var tab = display.predictions[0]; + completion += '  ⇥ ' + (tab.name ? tab.name : tab); + } + this.completer.innerHTML = completion; + dom.addCssClass(this.completer, this.cli.getWorstHint().status.toString()); + + // 2. Update the hint element + var hint = ''; + if (this.element.value.length !== 0) { + hint += display.message; + if (display.predictions && display.predictions.length > 0) { + hint += ': [ '; + display.predictions.forEach(function(prediction) { + hint += (prediction.name ? prediction.name : prediction); + hint += ' | '; + }, this); + hint = hint.replace(/\| $/, ']'); + } + } + + this.hinter.innerHTML = hint; + if (hint.length === 0) { + dom.addCssClass(this.hinter, 'cptNoPopup'); + } + else { + dom.removeCssClass(this.hinter, 'cptNoPopup'); + } + + this.isUpdating = false; + }, + + /** + * Markup an array of Status values with spans + */ + markupStatusScore: function(scores) { + var completion = ''; + // Create mark-up + var i = 0; + var lastStatus = -1; + while (true) { + if (lastStatus !== scores[i]) { + completion += ''; + lastStatus = scores[i]; + } + completion += this.element.value[i]; + i++; + if (i === this.element.value.length) { + completion += ''; + break; + } + if (lastStatus !== scores[i]) { + completion += ''; + } + } + + return completion; + }, + + /** + * Update the input element to reflect the changed argument + */ + onArgChange: function(ev) { + if (this.isUpdating) { + return; + } + + var prefix = this.element.value.substring(0, ev.argument.start); + var suffix = this.element.value.substring(ev.argument.end); + var insert = typeof ev.text === 'string' ? ev.text : ev.text.name; + this.element.value = prefix + insert + suffix; + // Fix the cursor. + var insertEnd = (prefix + insert).length; + this.element.selectionStart = insertEnd; + this.element.selectionEnd = insertEnd; + } +}; +exports.CliView = CliView; + + +}); +/* ***** 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 Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Joe Walker (jwalker@mozilla.com) + * + * 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('cockpit/ui/request_view', function(require, exports, module) { + +var dom = require("pilot/dom"); +var event = require("pilot/event"); +var requestViewHtml = require("text!cockpit/ui/request_view.html"); +var Templater = require("pilot/domtemplate").Templater; + +var requestViewCss = require("text!cockpit/ui/request_view.css"); +dom.importCssString(requestViewCss); + +/** + * Pull the HTML into the DOM, but don't add it to the document + */ +var templates = document.createElement('div'); +templates.innerHTML = requestViewHtml; +var row = templates.querySelector('.cptRow'); + +/** + * Work out the path for images. + * TODO: This should probably live in some utility area somewhere + */ +function imageUrl(path) { + var dataUrl = require('text!cockpit/ui/' + path); + if (dataUrl) { + return dataUrl; + } + + var filename = module.id.split('/').pop() + '.js'; + var imagePath; + + if (module.uri.substr(-filename.length) !== filename) { + console.error('Can\'t work out path from module.uri/module.id'); + return path; + } + + if (module.uri) { + var end = module.uri.length - filename.length - 1; + return module.uri.substr(0, end) + path; + } + + return filename + path; +} + + +/** + * Adds a row to the CLI output display + */ +function RequestView(request, cliView) { + this.request = request; + this.cliView = cliView; + this.imageUrl = imageUrl; + + // Elements attached to this by the templater. For info only + this.rowin = null; + this.rowout = null; + this.output = null; + this.hide = null; + this.show = null; + this.duration = null; + this.throb = null; + + new Templater().processNode(row.cloneNode(true), this); + + this.cliView.output.appendChild(this.rowin); + this.cliView.output.appendChild(this.rowout); + + this.request.addEventListener('output', this.onRequestChange.bind(this)); +}; + +RequestView.prototype = { + /** + * A single click on an invocation line in the console copies the command to + * the command line + */ + copyToInput: function() { + this.cliView.element.value = this.request.typed; + }, + + /** + * A double click on an invocation line in the console executes the command + */ + executeRequest: function(ev) { + this.cliView.cli.update({ + typed: this.request.typed, + cursor: { start:0, end:0 } + }); + this.cliView.cli.exec(); + }, + + hideOutput: function(ev) { + this.output.style.display = 'none'; + dom.addCssClass(this.hide, 'cmd_hidden'); + dom.removeCssClass(this.show, 'cmd_hidden'); + + event.stopPropagation(ev); + }, + + showOutput: function(ev) { + this.output.style.display = 'block'; + dom.removeCssClass(this.hide, 'cmd_hidden'); + dom.addCssClass(this.show, 'cmd_hidden'); + + event.stopPropagation(ev); + }, + + remove: function(ev) { + this.cliView.output.removeChild(this.rowin); + this.cliView.output.removeChild(this.rowout); + event.stopPropagation(ev); + }, + + onRequestChange: function(ev) { + this.duration.innerHTML = this.request.duration ? + 'completed in ' + (this.request.duration / 1000) + ' sec ' : + ''; + + this.output.innerHTML = ''; + this.request.outputs.forEach(function(output) { + var node; + if (typeof output == 'string') { + node = document.createElement('p'); + node.innerHTML = output; + } else { + node = output; + } + this.output.appendChild(node); + }, this); + this.cliView.scrollOutputToBottom(); + + dom.setCssClass(this.output, 'cmd_error', this.request.error); + + this.throb.style.display = this.request.completed ? 'none' : 'block'; + } +}; +exports.RequestView = RequestView; + + +}); +/* ***** 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 DomTemplate. + * + * The Initial Developer of the Original Code is Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Joe Walker (jwalker@mozilla.com) (original author) + * + * 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('pilot/domtemplate', function(require, exports, module) { + + +// WARNING: do not 'use_strict' without reading the notes in envEval; + +/** + * A templater that allows one to quickly template DOM nodes. + */ +function Templater() { + this.scope = []; +}; + +/** + * Recursive function to walk the tree processing the attributes as it goes. + * @param node the node to process. If you pass a string in instead of a DOM + * element, it is assumed to be an id for use with document.getElementById() + * @param data the data to use for node processing. + */ +Templater.prototype.processNode = function(node, data) { + if (typeof node === 'string') { + node = document.getElementById(node); + } + if (data === null || data === undefined) { + data = {}; + } + this.scope.push(node.nodeName + (node.id ? '#' + node.id : '')); + try { + // Process attributes + if (node.attributes && node.attributes.length) { + // We need to handle 'foreach' and 'if' first because they might stop + // some types of processing from happening, and foreach must come first + // because it defines new data on which 'if' might depend. + if (node.hasAttribute('foreach')) { + this.processForEach(node, data); + return; + } + if (node.hasAttribute('if')) { + if (!this.processIf(node, data)) { + return; + } + } + // Only make the node available once we know it's not going away + data.__element = node; + // It's good to clean up the attributes when we've processed them, + // but if we do it straight away, we mess up the array index + var attrs = Array.prototype.slice.call(node.attributes); + for (var i = 0; i < attrs.length; i++) { + var value = attrs[i].value; + var name = attrs[i].name; + this.scope.push(name); + try { + if (name === 'save') { + // Save attributes are a setter using the node + value = this.stripBraces(value); + this.property(value, data, node); + node.removeAttribute('save'); + } else if (name.substring(0, 2) === 'on') { + // Event registration relies on property doing a bind + value = this.stripBraces(value); + var func = this.property(value, data); + if (typeof func !== 'function') { + this.handleError('Expected ' + value + + ' to resolve to a function, but got ' + typeof func); + } + node.removeAttribute(name); + var capture = node.hasAttribute('capture' + name.substring(2)); + node.addEventListener(name.substring(2), func, capture); + if (capture) { + node.removeAttribute('capture' + name.substring(2)); + } + } else { + // Replace references in all other attributes + var self = this; + var newValue = value.replace(/\$\{[^}]*\}/g, function(path) { + return self.envEval(path.slice(2, -1), data, value); + }); + // Remove '_' prefix of attribute names so the DOM won't try + // to use them before we've processed the template + if (name.charAt(0) === '_') { + node.removeAttribute(name); + node.setAttribute(name.substring(1), newValue); + } else if (value !== newValue) { + attrs[i].value = newValue; + } + } + } finally { + this.scope.pop(); + } + } + } + + // Loop through our children calling processNode. First clone them, so the + // set of nodes that we visit will be unaffected by additions or removals. + var childNodes = Array.prototype.slice.call(node.childNodes); + for (var j = 0; j < childNodes.length; j++) { + this.processNode(childNodes[j], data); + } + + if (node.nodeType === Node.TEXT_NODE) { + this.processTextNode(node, data); + } + } finally { + this.scope.pop(); + } +}; + +/** + * Handle + * @param node An element with an 'if' attribute + * @param data The data to use with envEval + * @returns true if processing should continue, false otherwise + */ +Templater.prototype.processIf = function(node, data) { + this.scope.push('if'); + try { + var originalValue = node.getAttribute('if'); + var value = this.stripBraces(originalValue); + var recurse = true; + try { + var reply = this.envEval(value, data, originalValue); + recurse = !!reply; + } catch (ex) { + this.handleError('Error with \'' + value + '\'', ex); + recurse = false; + } + if (!recurse) { + node.parentNode.removeChild(node); + } + node.removeAttribute('if'); + return recurse; + } finally { + this.scope.pop(); + } +}; + +/** + * Handle and the special case of + * + * @param node An element with a 'foreach' attribute + * @param data The data to use with envEval + */ +Templater.prototype.processForEach = function(node, data) { + this.scope.push('foreach'); + try { + var originalValue = node.getAttribute('foreach'); + var value = originalValue; + + var paramName = 'param'; + if (value.charAt(0) === '$') { + // No custom loop variable name. Use the default: 'param' + value = this.stripBraces(value); + } else { + // Extract the loop variable name from 'NAME in ${ARRAY}' + var nameArr = value.split(' in '); + paramName = nameArr[0].trim(); + value = this.stripBraces(nameArr[1].trim()); + } + node.removeAttribute('foreach'); + try { + var self = this; + // Process a single iteration of a loop + var processSingle = function(member, clone, ref) { + ref.parentNode.insertBefore(clone, ref); + data[paramName] = member; + self.processNode(clone, data); + delete data[paramName]; + }; + + // processSingle is no good for nodes where we want to work on + // the childNodes rather than the node itself + var processAll = function(scope, member) { + self.scope.push(scope); + try { + if (node.nodeName === 'LOOP') { + for (var i = 0; i < node.childNodes.length; i++) { + var clone = node.childNodes[i].cloneNode(true); + processSingle(member, clone, node); + } + } else { + var clone = node.cloneNode(true); + clone.removeAttribute('foreach'); + processSingle(member, clone, node); + } + } finally { + self.scope.pop(); + } + }; + + var reply = this.envEval(value, data, originalValue); + if (Array.isArray(reply)) { + reply.forEach(function(data, i) { + processAll('' + i, data); + }, this); + } else { + for (var param in reply) { + if (reply.hasOwnProperty(param)) { + processAll(param, param); + } + } + } + node.parentNode.removeChild(node); + } catch (ex) { + this.handleError('Error with \'' + value + '\'', ex); + } + } finally { + this.scope.pop(); + } +}; + +/** + * Take a text node and replace it with another text node with the ${...} + * sections parsed out. We replace the node by altering node.parentNode but + * we could probably use a DOM Text API to achieve the same thing. + * @param node The Text node to work on + * @param data The data to use in calls to envEval + */ +Templater.prototype.processTextNode = function(node, data) { + // Replace references in other attributes + var value = node.data; + // We can't use the string.replace() with function trick (see generic + // attribute processing in processNode()) because we need to support + // functions that return DOM nodes, so we can't have the conversion to a + // string. + // Instead we process the string as an array of parts. In order to split + // the string up, we first replace '${' with '\uF001$' and '}' with '\uF002' + // We can then split using \uF001 or \uF002 to get an array of strings + // where scripts are prefixed with $. + // \uF001 and \uF002 are just unicode chars reserved for private use. + value = value.replace(/\$\{([^}]*)\}/g, '\uF001$$$1\uF002'); + var parts = value.split(/\uF001|\uF002/); + if (parts.length > 1) { + parts.forEach(function(part) { + if (part === null || part === undefined || part === '') { + return; + } + if (part.charAt(0) === '$') { + part = this.envEval(part.slice(1), data, node.data); + } + // It looks like this was done a few lines above but see envEval + if (part === null) { + part = "null"; + } + if (part === undefined) { + part = "undefined"; + } + // if (isDOMElement(part)) { ... } + if (typeof part.cloneNode !== 'function') { + part = node.ownerDocument.createTextNode(part.toString()); + } + node.parentNode.insertBefore(part, node); + }, this); + node.parentNode.removeChild(node); + } +}; + +/** + * Warn of string does not begin '${' and end '}' + * @param str the string to check. + * @return The string stripped of ${ and }, or untouched if it does not match + */ +Templater.prototype.stripBraces = function(str) { + if (!str.match(/\$\{.*\}/g)) { + this.handleError('Expected ' + str + ' to match ${...}'); + return str; + } + return str.slice(2, -1); +}; + +/** + * Combined getter and setter that works with a path through some data set. + * For example: + *
      + *
    • property('a.b', { a: { b: 99 }}); // returns 99 + *
    • property('a', { a: { b: 99 }}); // returns { b: 99 } + *
    • property('a', { a: { b: 99 }}, 42); // returns 99 and alters the + * input data to be { a: { b: 42 }} + *
    + * @param path An array of strings indicating the path through the data, or + * a string to be cut into an array using split('.') + * @param data An object to look in for the path argument + * @param newValue (optional) If defined, this value will replace the + * original value for the data at the path specified. + * @return The value pointed to by path before any + * newValue is applied. + */ +Templater.prototype.property = function(path, data, newValue) { + this.scope.push(path); + try { + if (typeof path === 'string') { + path = path.split('.'); + } + var value = data[path[0]]; + if (path.length === 1) { + if (newValue !== undefined) { + data[path[0]] = newValue; + } + if (typeof value === 'function') { + return function() { + return value.apply(data, arguments); + }; + } + return value; + } + if (!value) { + this.handleError('Can\'t find path=' + path); + return null; + } + return this.property(path.slice(1), value, newValue); + } finally { + this.scope.pop(); + } +}; + +/** + * Like eval, but that creates a context of the variables in env in + * which the script is evaluated. + * WARNING: This script uses 'with' which is generally regarded to be evil. + * The alternative is to create a Function at runtime that takes X parameters + * according to the X keys in the env object, and then call that function using + * the values in the env object. This is likely to be slow, but workable. + * @param script The string to be evaluated. + * @param env The environment in which to eval the script. + * @param context Optional debugging string in case of failure + * @return The return value of the script, or the error message if the script + * execution failed. + */ +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(); + } + } +}; + +/** + * A generic way of reporting errors, for easy overloading in different + * environments. + * @param message the error message to report. + * @param ex optional associated exception. + */ +Templater.prototype.handleError = function(message, ex) { + this.logError(message); + this.logError('In: ' + this.scope.join(' > ')); + if (ex) { + this.logError(ex); + } +}; + + +/** + * A generic way of reporting errors, for easy overloading in different + * environments. + * @param message the error message to report. + */ +Templater.prototype.logError = function(message) { + window.console && window.console.log && console.log(message); +}; + +exports.Templater = Templater; + + +}); +/* ***** 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 Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Skywriter Team (skywriter@mozilla.com) + * + * 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('cockpit/commands/basic', function(require, exports, module) { + + +var canon = require('pilot/canon'); + +/** + * '!' command + */ +var bangCommandSpec = { + name: 'sh', + description: 'Execute a system command (requires server support)', + params: [ + { + name: 'command', + type: 'text', + description: 'The string to send to the os shell.' + } + ], + exec: function(env, args, request) { + var req = new XMLHttpRequest(); + req.open('GET', '/exec?args=' + args.command, true); + req.onreadystatechange = function(ev) { + if (req.readyState == 4) { + if (req.status == 200) { + request.done('
    ' + req.responseText + '
    '); + } + } + }; + req.send(null); + } +}; + +var canon = require('pilot/canon'); + +exports.startup = function(data, reason) { + canon.addCommand(bangCommandSpec); +}; + +exports.shutdown = function(data, reason) { + canon.removeCommand(bangCommandSpec); +}; + + +}); +define("text!cockpit/ui/cli_view.css", "" + + "#cockpitInput { padding-left: 16px; }" + + "" + + "#cockpitOutput { overflow: auto; }" + + "#cockpitOutput.cptFocusPopup { position: absolute; z-index: 999; }" + + "" + + ".cptFocusPopup { display: none; }" + + "#cockpitInput:focus ~ .cptFocusPopup { display: block; }" + + "#cockpitInput:focus ~ .cptFocusPopup.cptNoPopup { display: none; }" + + "" + + ".cptCompletion { padding: 0; position: absolute; z-index: -1000; }" + + ".cptCompletion.VALID { background: #FFF; }" + + ".cptCompletion.INCOMPLETE { background: #DDD; }" + + ".cptCompletion.INVALID { background: #DDD; }" + + ".cptCompletion span { color: #FFF; }" + + ".cptCompletion span.INCOMPLETE { color: #DDD; border-bottom: 2px dotted #F80; }" + + ".cptCompletion span.INVALID { color: #DDD; border-bottom: 2px dotted #F00; }" + + "span.cptPrompt { color: #66F; font-weight: bold; }" + + "" + + "" + + ".cptHints {" + + " color: #000;" + + " position: absolute;" + + " border: 1px solid rgba(230, 230, 230, 0.8);" + + " background: rgba(250, 250, 250, 0.8);" + + " -moz-border-radius-topleft: 10px;" + + " -moz-border-radius-topright: 10px;" + + " border-top-left-radius: 10px; border-top-right-radius: 10px;" + + " z-index: 1000;" + + " padding: 8px;" + + " display: none;" + + "}" + + ".cptHints ul { margin: 0; padding: 0 15px; }" + + "" + + ".cptGt { font-weight: bold; font-size: 120%; }" + + ""); + +define("text!cockpit/ui/request_view.css", "" + + ".cptRowIn {" + + " display: box; display: -moz-box; display: -webkit-box;" + + " box-orient: horizontal; -moz-box-orient: horizontal; -webkit-box-orient: horizontal;" + + " box-align: center; -moz-box-align: center; -webkit-box-align: center;" + + " color: #333;" + + " background-color: #EEE;" + + " width: 100%;" + + " font-family: consolas, courier, monospace;" + + "}" + + ".cptRowIn > * { padding-left: 2px; padding-right: 2px; }" + + ".cptRowIn > img { cursor: pointer; }" + + ".cptHover { display: none; }" + + ".cptRowIn:hover > .cptHover { display: block; }" + + ".cptRowIn:hover > .cptHover.cptHidden { display: none; }" + + ".cptOutTyped {" + + " box-flex: 1; -moz-box-flex: 1; -webkit-box-flex: 1;" + + " font-weight: bold; color: #000; font-size: 120%;" + + "}" + + ".cptRowOutput { padding-left: 10px; line-height: 1.2em; }" + + ".cptRowOutput strong," + + ".cptRowOutput b," + + ".cptRowOutput th," + + ".cptRowOutput h1," + + ".cptRowOutput h2," + + ".cptRowOutput h3 { color: #000; }" + + ".cptRowOutput a { font-weight: bold; color: #666; text-decoration: none; }" + + ".cptRowOutput a: hover { text-decoration: underline; cursor: pointer; }" + + ".cptRowOutput input[type=password]," + + ".cptRowOutput input[type=text]," + + ".cptRowOutput textarea {" + + " color: #000; font-size: 120%;" + + " background: transparent; padding: 3px;" + + " border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;" + + "}" + + ".cptRowOutput table," + + ".cptRowOutput td," + + ".cptRowOutput th { border: 0; padding: 0 2px; }" + + ".cptRowOutput .right { text-align: right; }" + + ""); + +define("text!cockpit/ui/request_view.html", "" + + "
    " + + " " + + "
    " + + "" + + " " + + "
    >
    " + + "
    ${request.typed}
    " + + "" + + " " + + "
    " + + " \"Hide" + + " \"Show" + + " \"Remove" + + "" + + "
    " + + "" + + " " + + "
    " + + "
    " + + " " + + "
    " + + "
    " + + ""); + +define("text!cockpit/ui/images/closer.png", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAj9JREFUeNp0ks+LUlEUx7/vV1o8Z8wUx3IEHcQmiBiQlomjRNCiZpEuEqF/oEUwq/6EhvoHggmRcJUQBM1CRJAW0aLIaGQimZJxJsWxyV/P9/R1zzWlFl04vPvOPZ9z7rnnK5imidmKRCIq+zxgdoPZ1T/ut8xeM3tcKpW6s1hhBkaj0Qj7bDebTX+324WmadxvsVigqipcLleN/d4rFoulORiLxTZY8ItOp8MBCpYkiYPj8Xjus9vtlORWoVB4KcTjcQc732dLpSRXvCZaAws6Q4WDdqsO52kNH+oCRFGEz+f7ydwBKRgMPmTXi49GI1x2D/DsznesB06ws2eDbI7w9HYN6bVjvGss4KAjwDAMq81mM2SW5Wa/3weBbz42UL9uYnVpiO2Nr9ANHSGXib2Wgm9tCYIggGKJEVkvlwgi5/FQRmTLxO6hgJVzI1x0T/fJrBtHJxPeL6tI/fsZLA6ot8lkQi8HRVbw94gkWYI5MaHrOjcCGSNRxZosy9y5cErDzn0Dqx7gcwO8WtBp4PndI35GMYqiUMUvBL5yOBz8yRfFNpbPmqgcCFh/IuHa1nR/YXGM8+oUpFhihEQiwcdRLpfVRqOBtWXWq34Gra6AXq8Hp2piZcmKT4cKnE4nwuHwdByVSmWQz+d32WCTlHG/qaHHREN9kgi0sYQfv0R4PB4EAgESQDKXy72fSy6VSnHJVatVf71eR7vd5n66mtfrRSgU4pLLZrOlf7RKK51Ok8g3/yPyR5lMZi7y3wIMAME4EigHWgKnAAAAAElFTkSuQmCC"); + +define("text!cockpit/ui/images/dot_clear.gif", "data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAEBMgA7"); + +define("text!cockpit/ui/images/minus.png", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAAZiS0dEANIA0gDS7KbF4AAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9kFGw4xMrIJw5EAAAHcSURBVCjPhZIxSxtxGMZ/976XhJA/RA5EAyJcFksnp64hjUPBoXRyCYLQTyD0UxScu0nFwalCQSgFCVk7dXAwUAiBDA2RO4W7yN1x9+9gcyhU+pteHt4H3pfncay1LOl0OgY4BN4Ar/7KP4BvwNFwOIyWu87S2O12O8DxfD73oygiSRIAarUaxhhWV1fHwMFgMBiWxl6v9y6Koi+3t7ckSUKtVkNVAcjzvNRWVlYwxry9vLz86uzs7HjAZDKZGGstjUaDfxHHMSLC5ubmHdB2VfVwNpuZ5clxHPMcRVFwc3PTXFtbO3RFZHexWJCmabnweAaoVqvlv4vFAhHZdVX1ZZqmOI5DURR8fz/lxbp9Yrz+7bD72SfPcwBU1XdF5N5aWy2KgqIoeBzPEnWVLMseYnA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ux2Qk379qh4rYKet4GjrhhwEteBgBrH8BssoXEtbHzPpSBRRSpqlNpgAiUoxzHKxLRszoVuggIisxaDQWZqkQvQjAoax3NbDbLLGuUEABNGedXqSyLRupXgDT5JfAGZNLio9B0X8Uiwk4w77MDc1D4yejjWtykPS3DX01UDCY/GPQcVDe0QYT0CIxGFvUorfvBxZsRfVrUuWruMBAb/lXCUofoFNZfzGJtowXOX0vwUSFK4BgyMKm6P6s9wQUZld+jrYyMDC0iIQDaJdG4IyZQfL3RfbFcCBIlRgc+u3CjaTApuZ9KsANgG8PNzHlWWD3tCxd6kafNNiFp5HAalAkkJ0SCV2H3CgOD9Nc/FqrXuyb0Eocvfhq171p5eyuJ1omKJEP5rQGe/FOOnXtq335z8YmvYo9cHb2t8spIb3lVSseZW46FlGY/Sk9P50P2w20UlWJUkUHIushfc5PXGAzCo0PlD2pnpCYfCXga3lu+fPlevEhWrVrFyrN/Orfv87FOW9tlqb2Kc9pV8DzioMk3UNUbXM+8B/ATBr8C8CKdvGXWGD/9sqm3dkxtzA4McMjHMB8D2ftheYXo+qzt3pXvz8/PP/vk+v8537V+yYW87Zu+RZ1ZbrexoKAA/SBpaWn4+aL5w5zGk+/jW59JiMkESW5urpiVlWXENRb1H/Yf2I9txIxz5IdkX3TsraukpsbQjz6090yb4XsAvQoRE0YvJdamtIIbOnRoUVlZ2ftsLVQzIdEXHntsaZdimssVfCpFui109+BnWPsXaWLI/zactygAAAAASUVORK5CYII="); + +define("text!cockpit/ui/images/plus.png", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAAZiS0dEANIA0gDS7KbF4AAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9kFGw4yFTwuJTkAAAH7SURBVCjPdZKxa1NRFMZ/956XZMgFyyMlCZRA4hBx6lBcQ00GoYi4tEstFPwLAs7iLDi7FWuHThaUggihBDI5OWRoQAmBQFISQgvvpbwX3rsOaR4K+o2H8zvfOZxPWWtZqVarGaAJPAEe3ZW/A1+Bd+1221v1qhW4vb1dA44mk0nZ8zyCIAAgk8lgjGF9fb0PHF5cXLQTsF6vP/c879P19TVBEJDJZBARAKIoSmpra2sYY561Wq3PqtFouMBgMBgYay3ZbJZ/yfd9tNaUSqUboOKISPPq6sqsVvZ9H4AvL34B8PTj/QSO45jpdHovn883Ha31znw+JwzDpCEMQx4UloM8zyOdTif3zudztNY7jog8DMMQpRRxHPPt5TCBAEZvxlyOFTsfykRRBICIlB2t9a21Nh3HMXEc8+d7VhJHWCwWyzcohdZaHBHpO46z6fs+IsLj94XECaD4unCHL8FsNouI/HRE5Nx13c3ZbIbWOnG5HKtl+53TSq7rIiLnand31wUGnU7HjEYjlFLJZN/3yRnL1FMYY8jlcmxtbd0AFel2u7dnZ2eXxpi9xWJBEASkUimstYgIQSSkUimKxSKVSgVjzN7p6emPJHL7+/s14KjX65WHwyGz2SxZbWNjg2q12gcOT05O2n9lFeDg4MAAr/4T8rfHx8dJyH8DvvbYGzKvWukAAAAASUVORK5CYII="); + +define("text!cockpit/ui/images/throbber.gif", "data:image/gif;base64,R0lGODlh3AATAPQAAP///wAAAL6+vqamppycnLi4uLKyssjIyNjY2MTExNTU1Nzc3ODg4OTk5LCwsLy8vOjo6Ozs7MrKyvLy8vT09M7Ozvb29sbGxtDQ0O7u7tbW1sLCwqqqqvj4+KCgoJaWliH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAA3AATAAAF/yAgjmRpnmiqrmzrvnAsz3Rt33iu73zv/8CgcEgECAaEpHLJbDqf0Kh0Sq1ar9isdjoQtAQFg8PwKIMHnLF63N2438f0mv1I2O8buXjvaOPtaHx7fn96goR4hmuId4qDdX95c4+RG4GCBoyAjpmQhZN0YGYFXitdZBIVGAoKoq4CG6Qaswi1CBtkcG6ytrYJubq8vbfAcMK9v7q7D8O1ycrHvsW6zcTK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RXeOe1nC2BUEDiyAMMHZuwoTLAQX3nvDOAUW5Vogru434d4JnAsnPmFB9NBshQXfa9104+Rxl8e13rZxN+CEydtVsFkd+vDjE7C/q52wOvb4s7+faz025frbxefWbSoQIAEDEUCwgf9j7bUlwHN9ZVaegxDK1xYzFMJH24L5saXABhlYxiEzHoKoIV8LYqAMaw9aZqFmJUK4YHuNfRjiXhmk+NcyJgaIolvM8BhiBx3IleN8lH1IWAcRgkZgCgYiaBGJojGgHHFTgtagAFYSZhF7/qnTpY+faVlNAnqJN0EHWa6ozAZjBtgmmBokwMB01LW5jAZwbqfmlNips4B4eOqJgDJ2+imXRZpthuigeC6XZTWIxilXmRo8iYKBCwiWmWkJVEAkfB0w8KI1IvlIpKnOkVpqdB5+h96o8d3lFnijrgprjbfGRSt0lH0nAZG5vsprWxYRW6Suq4UWqrLEsspWg8Io6yv/q6EhK0Fw0GLbjKYn5CZYBYht1laPrnEY67kyrhYbuyceiR28Pso7bYwiXjihjWsWuWF5p/H765HmNoiur3RJsGKNG/jq748XMrwmjhwCfO6QD9v7LQsDxPTAMKsFpthyJCdkmgYiw0VdXF/Om9dyv7YMWGXTLYpZg5wNR11C78oW3p8HSGgul4qyrJppgllJHJZHn0Y0yUwDXCXUNquFZNLKyYXBAVZvxtAKYIQEsmPgDacr0tltO1y/DMwYpkgUpJfTasLGzd3cdCN3gN3UWRcY3epIEPevfq+3njBxq/kqBoGBduvea8f393zICS63ivRBTqgFpgaWZEIUULdcK+frIfAAL2AjscXqrLfu+uuwx05FF0XUbvvtuOeu++689+7778AHL/wJIQAAOwAAAAAAAAAAAA=="); + diff --git a/src/static/ace-0.1.6/src/cockpit.js b/src/static/ace-0.1.6/src/cockpit.js new file mode 100644 index 0000000..2c5cc62 --- /dev/null +++ b/src/static/ace-0.1.6/src/cockpit.js @@ -0,0 +1 @@ +define("cockpit/index",function(a,b,c){b.startup=function(b,c){a("pilot/index"),a("cockpit/cli").startup(b,c),a("cockpit/ui/settings").startup(b,c),a("cockpit/ui/cli_view").startup(b,c),a("cockpit/commands/basic").startup(b,c)}}),define("cockpit/cli",function(a,b,c){function r(a,b){q.call(this,a),b&&b.flags&&(this.flags=b.flags)}function q(a){this.env=a,this.commandAssignment=new o(p,this)}function o(a,b){this.param=a,this.requisition=b,this.setValue(a.defaultValue)}function n(a,b,c,d,e,f){this.emitter=a,this.setText(b),this.start=c,this.end=d,this.prefix=e,this.suffix=f}function m(a,b){this.status=a.status,this.message=a.message,b?(this.start=b.start,this.end=b.end):(this.start=0,this.end=0),this.predictions=a.predictions}function l(a,b,c,d,e){this.status=a,this.message=b;if(typeof c==="number")this.start=c,this.end=d,this.predictions=e;else{var f=c;this.start=f.start,this.end=f.end,this.predictions=f.predictions}}var d=a("pilot/console"),e=a("pilot/lang"),f=a("pilot/oop"),g=a("pilot/event_emitter").EventEmitter,h=a("pilot/types"),i=a("pilot/types").Status,j=a("pilot/types").Conversion,k=a("pilot/canon");b.startup=function(a,b){k.upgradeType("command",p)},l.prototype={},l.sort=function(a,b){b!==undefined&&a.forEach(function(a){a.start===n.AT_CURSOR?a.distance=0:ba.end?a.distance=b-a.end:a.distance=0},this),a.sort(function(a,c){if(b!==undefined){var d=a.distance-c.distance;if(d!=0)return d}return c.status-a.status}),b!==undefined&&a.forEach(function(a){delete a.distance},this);return a},b.Hint=l,f.inherits(m,l),n.prototype={merge:function(a){if(a.emitter!=this.emitter)throw new Error("Can't merge Arguments from different EventEmitters");return new n(this.emitter,this.text+this.suffix+a.prefix+a.text,this.start,a.end,this.prefix,a.suffix)},setText:function(a){if(a==null)throw new Error("Illegal text for Argument: "+a);var b={argument:this,oldText:this.text,text:a};this.text=a,this.emitter._dispatchEvent("argumentChange",b)},toString:function(){return this.prefix+this.text+this.suffix}},n.merge=function(a,b,c){b=b===undefined?0:b,c=c===undefined?a.length:c;var d;for(var e=b;e: ";this.param.description&&(b+=this.param.description.trim(),b.charAt(b.length-1)!=="."&&(b+="."),b.charAt(b.length-1)!==" "&&(b+=" "));var c=i.VALID,d=this.arg?this.arg.start:n.AT_CURSOR,e=this.arg?this.arg.end:n.AT_CURSOR,f;this.conversion&&(c=this.conversion.status,this.conversion.message&&(b+=this.conversion.message),f=this.conversion.predictions);var g=this.arg&&this.arg.text!=="",h=this.value!==undefined||g;this.param.defaultValue===undefined&&!h&&(c=i.INVALID,b+="Required");return new l(c,b,d,e,f)},complete:function(){this.conversion&&this.conversion.predictions&&this.conversion.predictions.length>0&&this.setValue(this.conversion.predictions[0])},isPositionCaptured:function(a){if(!this.arg)return!1;if(this.arg.start===-1)return!1;if(a>this.arg.end)return!1;if(a===this.arg.end)return this.conversion.status!==i.VALID||this.conversion.predictions.length!==0;return!0},decrement:function(){var a=this.param.type.decrement(this.value);a!=null&&this.setValue(a)},increment:function(){var a=this.param.type.increment(this.value);a!=null&&this.setValue(a)},toString:function(){return this.arg?this.arg.toString():""}},b.Assignment=o;var p={name:"__command",type:"command",description:"The command to execute",getCustomHint:function(a,b){var c=[];c.push(" > "),c.push(a.name),a.params&&a.params.length>0&&a.params.forEach(function(a){a.defaultValue===undefined?c.push(" ["+a.name+"]"):c.push(" ["+a.name+"]")},this),c.push("
    "),c.push(a.description?a.description:"(No description)"),c.push("
    "),a.params&&a.params.length>0&&(c.push("
      "),a.params.forEach(function(a){c.push("
    • "),c.push(""+a.name+": "),c.push(a.description?a.description:"(No description)"),a.defaultValue===undefined?c.push(" [Required]"):a.defaultValue===null?c.push(" [Optional]"):c.push(" [Default: "+a.defaultValue+"]"),c.push("
    • ")},this),c.push("
    "));return new l(i.VALID,c.join(""),b)}};q.prototype={commandAssignment:undefined,assignmentCount:undefined,_assignments:undefined,_hints:undefined,_assignmentChanged:function(a){a.param.name==="__command"&&(this._assignments={},a.value&&a.value.params.forEach(function(a){this._assignments[a.name]=new o(a,this)},this),this.assignmentCount=Object.keys(this._assignments).length,this._dispatchEvent("commandChange",{command:a.value}))},getAssignment:function(a){var b=typeof a==="string"?a:Object.keys(this._assignments)[a];return this._assignments[b]},getParameterNames:function(){return Object.keys(this._assignments)},cloneAssignments:function(){return Object.keys(this._assignments).map(function(a){return this._assignments[a]},this)},_updateHints:function(){this.getAssignments(!0).forEach(function(a){this._hints.push(a.getHint())},this),l.sort(this._hints)},getWorstHint:function(){return this._hints[0]},getArgsObject:function(){var a={};this.getAssignments().forEach(function(b){a[b.param.name]=b.value},this);return a},getAssignments:function(a){var b=[];a===!0&&b.push(this.commandAssignment),Object.keys(this._assignments).forEach(function(a){b.push(this.getAssignment(a))},this);return b},setDefaultValues:function(){this.getAssignments().forEach(function(a){a.setValue(undefined)},this)},exec:function(){k.exec(this.commandAssignment.value,this.env,this.getArgsObject(),this.toCanonicalString())},toCanonicalString:function(){var a=[];a.push(this.commandAssignment.value.name),Object.keys(this._assignments).forEach(function(b){var c=this._assignments[b],d=c.param.type;c.value!==c.param.defaultValue&&(a.push(" "),a.push(d.stringify(c.value)))},this);return a.join("")}},f.implement(q.prototype,g),b.Requisition=q,f.inherits(r,q),function(){r.prototype.update=function(a){this.input=a,this._hints=[];var b=this._tokenize(a.typed);this._split(b),this.commandAssignment.value&&this._assign(b),this._updateHints()},r.prototype.getInputStatusMarkup=function(){var a=this.toString().split("").map(function(a){return i.VALID});this._hints.forEach(function(b){for(var c=b.start;c<=b.end;c++)b.status>a[c]&&(a[c]=b.status)},this);return a},r.prototype.toString=function(){return this.getAssignments(!0).map(function(a){return a.toString()},this).join("")};var a=r.prototype._updateHints;r.prototype._updateHints=function(){a.call(this);var b=this.input.cursor;this._hints.forEach(function(a){var c=b.start>=a.start&&b.start<=a.end,d=b.end>=a.start&&b.end<=a.end,e=c||d;!e&&a.status===i.INCOMPLETE&&(a.status=i.INVALID)},this),l.sort(this._hints)},r.prototype.getHints=function(){return this._hints},r.prototype.getAssignmentAt=function(a){var b=this.getAssignments(!0);for(var c=0;c=a.length){if(f!==b){var l=g(a.substring(i,h));k.push(new n(this,l,i,h,j,""))}else if(h!==i){var m=a.substring(i,h),o=k[k.length-1];o?o.suffix+=m:(o=new n(this,"",h,h,m,""),k.push(o))}break}var p=a[h];switch(f){case b:p==="'"?(j=a.substring(i,h+1),f=d,i=h+1):p==='"'?(j=a.substring(i,h+1),f=e,i=h+1):/ /.test(p)||(j=a.substring(i,h),f=c,i=h);break;case c:if(p===" "){var l=g(a.substring(i,h));k.push(new n(this,l,i,h,j,"")),f=b,i=h,j=""}break;case d:if(p==="'"){var l=g(a.substring(i,h));k.push(new n(this,l,i-1,h+1,j,p)),f=b,i=h+1,j=""}break;case e:if(p==='"'){var l=g(a.substring(i,h));k.push(new n(this,l,i-1,h+1,j,p)),f=b,i=h+1,j=""}}h++}return k},r.prototype._split=function(a){var b=1,c;while(b<=a.length){var c=n.merge(a,0,b);this.commandAssignment.setArgument(c);if(!this.commandAssignment.value)break;if(this.commandAssignment.value.exec){for(var d=0;d=a.length)break;continue}b.param.type.name==="boolean"?b.setValue(!0):f+10){var g=n.merge(a);this._hints.push(new l(i.INVALID,"Input '"+g.text+"' makes no sense.",g))}}}}(),b.CliRequisition=r}),define("cockpit/ui/settings",function(a,b,c){var d=a("pilot/types"),e=a("pilot/types/basic").SelectionType,f=new e({name:"direction",data:["above","below"]}),g={name:"hintDirection",description:"Are hints shown above or below the command line?",type:"direction",defaultValue:"above"},h={name:"outputDirection",description:"Is the output window shown above or below the command line?",type:"direction",defaultValue:"above"},i={name:"outputHeight",description:"What height should the output panel be?",type:"number",defaultValue:300};b.startup=function(a,b){d.registerType(f),a.env.settings.addSetting(g),a.env.settings.addSetting(h),a.env.settings.addSetting(i)},b.shutdown=function(a,b){d.unregisterType(f),a.env.settings.removeSetting(g),a.env.settings.removeSetting(h),a.env.settings.removeSetting(i)}}),define("cockpit/ui/cli_view",function(a,b,c){function n(a,b){this.cli=a,this.doc=document,this.win=f.getParentWindow(this.doc),this.element=this.doc.getElementById("cockpitInput");this.element&&(this.settings=b.settings,this.hintDirection=this.settings.getSetting("hintDirection"),this.outputDirection=this.settings.getSetting("outputDirection"),this.outputHeight=this.settings.getSetting("outputHeight"),this.isUpdating=!1,this.createElements(),this.update())}var d=a("text!cockpit/ui/cli_view.css"),e=a("pilot/event"),f=a("pilot/dom");f.importCssString(d);var e=a("pilot/event"),g=a("pilot/keys"),h=a("pilot/canon"),i=a("pilot/types").Status,j=a("cockpit/cli").CliRequisition,k=a("cockpit/cli").Hint,l=a("cockpit/ui/request_view").RequestView,m=new k(i.VALID,"",0,0);b.startup=function(a,b){var c=new j(a.env),d=new n(c,a.env)},n.prototype={createElements:function(){var a=this.element;this.element.spellcheck=!1,this.output=this.doc.getElementById("cockpitOutput"),this.popupOutput=this.output==null;if(!this.output){this.output=this.doc.createElement("div"),this.output.id="cockpitOutput",this.output.className="cptFocusPopup",a.parentNode.insertBefore(this.output,a.nextSibling);var b=function(){this.output.style.maxHeight=this.outputHeight.get()+"px"}.bind(this);this.outputHeight.addEventListener("change",b),b()}this.completer=this.doc.createElement("div"),this.completer.className="cptCompletion VALID",this.completer.style.color=f.computedStyle(a,"color"),this.completer.style.fontSize=f.computedStyle(a,"fontSize"),this.completer.style.fontFamily=f.computedStyle(a,"fontFamily"),this.completer.style.fontWeight=f.computedStyle(a,"fontWeight"),this.completer.style.fontStyle=f.computedStyle(a,"fontStyle"),a.parentNode.insertBefore(this.completer,a.nextSibling),this.completer.style.backgroundColor=a.style.backgroundColor,a.style.backgroundColor="transparent",this.hinter=this.doc.createElement("div"),this.hinter.className="cptHints cptFocusPopup",a.parentNode.insertBefore(this.hinter,a.nextSibling);var c=this.resizer.bind(this);e.addListener(this.win,"resize",c),this.hintDirection.addEventListener("change",c),this.outputDirection.addEventListener("change",c),c(),h.addEventListener("output",function(a){new l(a.request,this)}.bind(this)),e.addCommandKeyListener(a,this.onCommandKey.bind(this)),e.addListener(a,"keyup",this.onKeyUp.bind(this)),e.addListener(a,"mouseup",function(a){this.isUpdating=!0,this.update(),this.isUpdating=!1}.bind(this)),this.cli.addEventListener("argumentChange",this.onArgChange.bind(this))},scrollOutputToBottom:function(){var a=Math.max(this.output.scrollHeight,this.output.clientHeight);this.output.scrollTop=a-this.output.clientHeight},resizer:function(){var a=this.element.getClientRects()[0];this.completer.style.top=a.top+"px";var b=a.bottom-a.top;this.completer.style.height=b+"px",this.completer.style.lineHeight=b+"px",this.completer.style.left=a.left+"px";var c=a.right-a.left;this.completer.style.width=c+"px",this.hintDirection.get()==="below"?(this.hinter.style.top=a.bottom+"px",this.hinter.style.bottom="auto"):(this.hinter.style.top="auto",this.hinter.style.bottom=this.doc.documentElement.clientHeight-a.top+"px"),this.hinter.style.left=a.left+30+"px",this.hinter.style.maxWidth=c-110+"px",this.popupOutput&&(this.outputDirection.get()==="below"?(this.output.style.top=a.bottom+"px",this.output.style.bottom="auto"):(this.output.style.top="auto",this.output.style.bottom=this.doc.documentElement.clientHeight-a.top+"px"),this.output.style.left=a.left+"px",this.output.style.width=c-80+"px")},onCommandKey:function(a,b,c){var d;(c===g.TAB||c===g.UP||c===g.DOWN)&&e.stopEvent(a);return d},onKeyUp:function(a){var b;if(a.keyCode===g.RETURN){var c=this.cli.getWorstHint();c.status===i.VALID?(this.cli.exec(),this.element.value=""):(f.setSelectionStart(this.element,c.start),f.setSelectionEnd(this.element,c.end))}this.update();var d=this.cli.getAssignmentAt(f.getSelectionStart(this.element));d&&(a.keyCode===g.TAB&&(d.complete(),this.update()),a.keyCode===g.UP&&(d.increment(),this.update()),a.keyCode===g.DOWN&&(d.decrement(),this.update()));return b},update:function(){this.isUpdating=!0;var a={typed:this.element.value,cursor:{start:f.getSelectionStart(this.element),end:f.getSelectionEnd(this.element.selectionEnd)}};this.cli.update(a);var b=this.cli.getAssignmentAt(a.cursor.start).getHint();f.removeCssClass(this.completer,i.VALID.toString()),f.removeCssClass(this.completer,i.INCOMPLETE.toString()),f.removeCssClass(this.completer,i.INVALID.toString());var c='> ';if(this.element.value.length>0){var d=this.cli.getInputStatusMarkup();c+=this.markupStatusScore(d)}if(this.element.value.length>0&&b.predictions&&b.predictions.length>0){var e=b.predictions[0];c+="  ⇥ "+(e.name?e.name:e)}this.completer.innerHTML=c,f.addCssClass(this.completer,this.cli.getWorstHint().status.toString());var g="";this.element.value.length!==0&&(g+=b.message,b.predictions&&b.predictions.length>0&&(g+=": [ ",b.predictions.forEach(function(a){g+=a.name?a.name:a,g+=" | "},this),g=g.replace(/\| $/,"]"))),this.hinter.innerHTML=g,g.length===0?f.addCssClass(this.hinter,"cptNoPopup"):f.removeCssClass(this.hinter,"cptNoPopup"),this.isUpdating=!1},markupStatusScore:function(a){var b="",c=0,d=-1;while(!0){d!==a[c]&&(b+="",d=a[c]),b+=this.element.value[c],c++;if(c===this.element.value.length){b+="";break}d!==a[c]&&(b+="")}return b},onArgChange:function(a){if(!this.isUpdating){var b=this.element.value.substring(0,a.argument.start),c=this.element.value.substring(a.argument.end),d=typeof a.text==="string"?a.text:a.text.name;this.element.value=b+d+c;var e=(b+d).length;this.element.selectionStart=e,this.element.selectionEnd=e}}},b.CliView=n}),define("cockpit/ui/request_view",function(a,b,c){function l(a,b){this.request=a,this.cliView=b,this.imageUrl=k,this.rowin=null,this.rowout=null,this.output=null,this.hide=null,this.show=null,this.duration=null,this.throb=null,(new g).processNode(j.cloneNode(!0),this),this.cliView.output.appendChild(this.rowin),this.cliView.output.appendChild(this.rowout),this.request.addEventListener("output",this.onRequestChange.bind(this))}function k(b){var d=a("text!cockpit/ui/"+b);if(d)return d;var e=c.id.split("/").pop()+".js",f;if(c.uri.substr(-e.length)!==e){console.error("Can't work out path from module.uri/module.id");return b}if(c.uri){var g=c.uri.length-e.length-1;return c.uri.substr(0,g)+b}return e+b}var d=a("pilot/dom"),e=a("pilot/event"),f=a("text!cockpit/ui/request_view.html"),g=a("pilot/domtemplate").Templater,h=a("text!cockpit/ui/request_view.css");d.importCssString(h);var i=document.createElement("div");i.innerHTML=f;var j=i.querySelector(".cptRow");l.prototype={copyToInput:function(){this.cliView.element.value=this.request.typed},executeRequest:function(a){this.cliView.cli.update({typed:this.request.typed,cursor:{start:0,end:0}}),this.cliView.cli.exec()},hideOutput:function(a){this.output.style.display="none",d.addCssClass(this.hide,"cmd_hidden"),d.removeCssClass(this.show,"cmd_hidden"),e.stopPropagation(a)},showOutput:function(a){this.output.style.display="block",d.removeCssClass(this.hide,"cmd_hidden"),d.addCssClass(this.show,"cmd_hidden"),e.stopPropagation(a)},remove:function(a){this.cliView.output.removeChild(this.rowin),this.cliView.output.removeChild(this.rowout),e.stopPropagation(a)},onRequestChange:function(a){this.duration.innerHTML=this.request.duration?"completed in "+this.request.duration/1e3+" sec ":"",this.output.innerHTML="",this.request.outputs.forEach(function(a){var b;typeof a=="string"?(b=document.createElement("p"),b.innerHTML=a):b=a,this.output.appendChild(b)},this),this.cliView.scrollOutputToBottom(),d.setCssClass(this.output,"cmd_error",this.request.error),this.throb.style.display=this.request.completed?"none":"block"}},b.RequestView=l}),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){window.console&&window.console.log&&console.log(a)},exports.Templater=Templater}),define("cockpit/commands/basic",function(a,b,c){var d=a("pilot/canon"),e={name:"sh",description:"Execute a system command (requires server support)",params:[{name:"command",type:"text",description:"The string to send to the os shell."}],exec:function(a,b,c){var d=new XMLHttpRequest;d.open("GET","/exec?args="+b.command,!0),d.onreadystatechange=function(a){d.readyState==4&&(d.status==200&&c.done("
    "+d.responseText+"
    "))},d.send(null)}},d=a("pilot/canon");b.startup=function(a,b){d.addCommand(e)},b.shutdown=function(a,b){d.removeCommand(e)}}),define("text!cockpit/ui/cli_view.css","#cockpitInput { padding-left: 16px; }#cockpitOutput { overflow: auto; }#cockpitOutput.cptFocusPopup { position: absolute; z-index: 999; }.cptFocusPopup { display: none; }#cockpitInput:focus ~ .cptFocusPopup { display: block; }#cockpitInput:focus ~ .cptFocusPopup.cptNoPopup { display: none; }.cptCompletion { padding: 0; position: absolute; z-index: -1000; }.cptCompletion.VALID { background: #FFF; }.cptCompletion.INCOMPLETE { background: #DDD; }.cptCompletion.INVALID { background: #DDD; }.cptCompletion span { color: #FFF; }.cptCompletion span.INCOMPLETE { color: #DDD; border-bottom: 2px dotted #F80; }.cptCompletion span.INVALID { color: #DDD; border-bottom: 2px dotted #F00; }span.cptPrompt { color: #66F; font-weight: bold; }.cptHints { color: #000; position: absolute; border: 1px solid rgba(230, 230, 230, 0.8); background: rgba(250, 250, 250, 0.8); -moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px; border-top-left-radius: 10px; border-top-right-radius: 10px; z-index: 1000; padding: 8px; display: none;}.cptHints ul { margin: 0; padding: 0 15px; }.cptGt { font-weight: bold; font-size: 120%; }"),define("text!cockpit/ui/request_view.css",".cptRowIn { display: box; display: -moz-box; display: -webkit-box; box-orient: horizontal; -moz-box-orient: horizontal; -webkit-box-orient: horizontal; box-align: center; -moz-box-align: center; -webkit-box-align: center; color: #333; background-color: #EEE; width: 100%; font-family: consolas, courier, monospace;}.cptRowIn > * { padding-left: 2px; padding-right: 2px; }.cptRowIn > img { cursor: pointer; }.cptHover { display: none; }.cptRowIn:hover > .cptHover { display: block; }.cptRowIn:hover > .cptHover.cptHidden { display: none; }.cptOutTyped { box-flex: 1; -moz-box-flex: 1; -webkit-box-flex: 1; font-weight: bold; color: #000; font-size: 120%;}.cptRowOutput { padding-left: 10px; line-height: 1.2em; }.cptRowOutput strong,.cptRowOutput b,.cptRowOutput th,.cptRowOutput h1,.cptRowOutput h2,.cptRowOutput h3 { color: #000; }.cptRowOutput a { font-weight: bold; color: #666; text-decoration: none; }.cptRowOutput a: hover { text-decoration: underline; cursor: pointer; }.cptRowOutput input[type=password],.cptRowOutput input[type=text],.cptRowOutput textarea { color: #000; font-size: 120%; background: transparent; padding: 3px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;}.cptRowOutput table,.cptRowOutput td,.cptRowOutput th { border: 0; padding: 0 2px; }.cptRowOutput .right { text-align: right; }"),define("text!cockpit/ui/request_view.html",'
    >
    ${request.typed}
    Hide command output Show command output Remove this command from the history
    '),define("text!cockpit/ui/images/closer.png","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAj9JREFUeNp0ks+LUlEUx7/vV1o8Z8wUx3IEHcQmiBiQlomjRNCiZpEuEqF/oEUwq/6EhvoHggmRcJUQBM1CRJAW0aLIaGQimZJxJsWxyV/P9/R1zzWlFl04vPvOPZ9z7rnnK5imidmKRCIq+zxgdoPZ1T/ut8xeM3tcKpW6s1hhBkaj0Qj7bDebTX+324WmadxvsVigqipcLleN/d4rFoulORiLxTZY8ItOp8MBCpYkiYPj8Xjus9vtlORWoVB4KcTjcQc732dLpSRXvCZaAws6Q4WDdqsO52kNH+oCRFGEz+f7ydwBKRgMPmTXi49GI1x2D/DsznesB06ws2eDbI7w9HYN6bVjvGss4KAjwDAMq81mM2SW5Wa/3weBbz42UL9uYnVpiO2Nr9ANHSGXib2Wgm9tCYIggGKJEVkvlwgi5/FQRmTLxO6hgJVzI1x0T/fJrBtHJxPeL6tI/fsZLA6ot8lkQi8HRVbw94gkWYI5MaHrOjcCGSNRxZosy9y5cErDzn0Dqx7gcwO8WtBp4PndI35GMYqiUMUvBL5yOBz8yRfFNpbPmqgcCFh/IuHa1nR/YXGM8+oUpFhihEQiwcdRLpfVRqOBtWXWq34Gra6AXq8Hp2piZcmKT4cKnE4nwuHwdByVSmWQz+d32WCTlHG/qaHHREN9kgi0sYQfv0R4PB4EAgESQDKXy72fSy6VSnHJVatVf71eR7vd5n66mtfrRSgU4pLLZrOlf7RKK51Ok8g3/yPyR5lMZi7y3wIMAME4EigHWgKnAAAAAElFTkSuQmCC"),define("text!cockpit/ui/images/dot_clear.gif","data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAEBMgA7"),define("text!cockpit/ui/images/minus.png","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAAZiS0dEANIA0gDS7KbF4AAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9kFGw4xMrIJw5EAAAHcSURBVCjPhZIxSxtxGMZ/976XhJA/RA5EAyJcFksnp64hjUPBoXRyCYLQTyD0UxScu0nFwalCQSgFCVk7dXAwUAiBDA2RO4W7yN1x9+9gcyhU+pteHt4H3pfncay1LOl0OgY4BN4Ar/7KP4BvwNFwOIyWu87S2O12O8DxfD73oygiSRIAarUaxhhWV1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ZaLjCHEww9Ei4FFiPg6Ja5gT6gxYgLgnRDHRQwJXbz2GOw0d4A3K4GXlUtMahJjYVxiYbrwOmxIS10bFnIBOSi6Tl9Jgs0zbOEX18wyEwgLPMrxD1Y4aCK8kmTpgYcpAF27Mzs42Hjx4kA8BICUlJfKArR7LcEvTB1xEC9AoEw9OPagWkVU/D1oesmK6U911zEczMVe01oZjiMggg6ux2Qk379qh4rYKet4GjrhhwEteBgBrH8BssoXEtbHzPpSBRRSpqlNpgAiUoxzHKxLRszoVuggIisxaDQWZqkQvQjAoax3NbDbLLGuUEABNGedXqSyLRupXgDT5JfAGZNLio9B0X8Uiwk4w77MDc1D4yejjWtykPS3DX01UDCY/GPQcVDe0QYT0CIxGFvUorfvBxZsRfVrUuWruMBAb/lXCUofoFNZfzGJtowXOX0vwUSFK4BgyMKm6P6s9wQUZld+jrYyMDC0iIQDaJdG4IyZQfL3RfbFcCBIlRgc+u3CjaTApuZ9KsANgG8PNzHlWWD3tCxd6kafNNiFp5HAalAkkJ0SCV2H3CgOD9Nc/FqrXuyb0Eocvfhq171p5eyuJ1omKJEP5rQGe/FOOnXtq335z8YmvYo9cHb2t8spIb3lVSseZW46FlGY/Sk9P50P2w20UlWJUkUHIushfc5PXGAzCo0PlD2pnpCYfCXga3lu+fPlevEhWrVrFyrN/Orfv87FOW9tlqb2Kc9pV8DzioMk3UNUbXM+8B/ATBr8C8CKdvGXWGD/9sqm3dkxtzA4McMjHMB8D2ftheYXo+qzt3pXvz8/PP/vk+v8537V+yYW87Zu+RZ1ZbrexoKAA/SBpaWn4+aL5w5zGk+/jW59JiMkESW5urpiVlWXENRb1H/Yf2I9txIxz5IdkX3TsraukpsbQjz6090yb4XsAvQoRE0YvJdamtIIbOnRoUVlZ2ftsLVQzIdEXHntsaZdimssVfCpFui109+BnWPsXaWLI/zactygAAAAASUVORK5CYII="),define("text!cockpit/ui/images/plus.png","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAAZiS0dEANIA0gDS7KbF4AAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9kFGw4yFTwuJTkAAAH7SURBVCjPdZKxa1NRFMZ/956XZMgFyyMlCZRA4hBx6lBcQ00GoYi4tEstFPwLAs7iLDi7FWuHThaUggihBDI5OWRoQAmBQFISQgvvpbwX3rsOaR4K+o2H8zvfOZxPWWtZqVarGaAJPAEe3ZW/A1+Bd+1221v1qhW4vb1dA44mk0nZ8zyCIAAgk8lgjGF9fb0PHF5cXLQTsF6vP/c879P19TVBEJDJZBARAKIoSmpra2sYY561Wq3PqtFouMBgMBgYay3ZbJZ/yfd9tNaUSqUboOKISPPq6sqsVvZ9H4AvL34B8PTj/QSO45jpdHovn883Ha31znw+JwzDpCEMQx4UloM8zyOdTif3zudztNY7jog8DMMQpRRxHPPt5TCBAEZvxlyOFTsfykRRBICIlB2t9a21Nh3HMXEc8+d7VhJHWCwWyzcohdZaHBHpO46z6fs+IsLj94XECaD4unCHL8FsNouI/HRE5Nx13c3ZbIbWOnG5HKtl+53TSq7rIiLnand31wUGnU7HjEYjlFLJZN/3yRnL1FMYY8jlcmxtbd0AFel2u7dnZ2eXxpi9xWJBEASkUimstYgIQSSkUimKxSKVSgVjzN7p6emPJHL7+/s14KjX65WHwyGz2SxZbWNjg2q12gcOT05O2n9lFeDg4MAAr/4T8rfHx8dJyH8DvvbYGzKvWukAAAAASUVORK5CYII="),define("text!cockpit/ui/images/throbber.gif","data:image/gif;base64,R0lGODlh3AATAPQAAP///wAAAL6+vqamppycnLi4uLKyssjIyNjY2MTExNTU1Nzc3ODg4OTk5LCwsLy8vOjo6Ozs7MrKyvLy8vT09M7Ozvb29sbGxtDQ0O7u7tbW1sLCwqqqqvj4+KCgoJaWliH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAA3AATAAAF/yAgjmRpnmiqrmzrv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No newline at end of file diff --git a/src/static/ace-0.1.6/src/keybinding-emacs.js b/src/static/ace-0.1.6/src/keybinding-emacs.js new file mode 100644 index 0000000..8bb5e31 --- /dev/null +++ b/src/static/ace-0.1.6/src/keybinding-emacs.js @@ -0,0 +1 @@ +define("ace/keyboard/keybinding/emacs",function(a,b,c){var d=a("ace/keyboard/state_handler").StateHandler,e=a("ace/keyboard/state_handler").matchCharacterOnly,f={start:[{key:"ctrl-x",then:"c-x"},{regex:["(?:command-([0-9]*))*","(down|ctrl-n)"],exec:"golinedown",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(right|ctrl-f)"],exec:"gotoright",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(up|ctrl-p)"],exec:"golineup",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(left|ctrl-b)"],exec:"gotoleft",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{comment:"This binding matches all printable characters except numbers as long as they are no numbers and print them n times.",regex:["(?:command-([0-9]*))","([^0-9]+)*"],match:e,exec:"inserttext",params:[{name:"times",match:1,type:"number",defaultValue:"1"},{name:"text",match:2}]},{comment:"This binding matches numbers as long as there is no meta_number in the buffer.",regex:["(command-[0-9]*)*","([0-9]+)"],match:e,disallowMatches:[1],exec:"inserttext",params:[{name:"text",match:2,type:"text"}]},{regex:["command-([0-9]*)","(command-[0-9]|[0-9])"],comment:"Stops execution if the regex /meta_[0-9]+/ matches to avoid resetting the buffer."}],"c-x":[{key:"ctrl-g",then:"start"},{key:"ctrl-s",exec:"save",then:"start"}]};b.Emacs=new d(f)}),define("ace/keyboard/state_handler",function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(state in a)this.$buildBindingsRegex(a[state]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?(a.key=new RegExp("^"+a.regex[1]+"$"),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var d=[];b&1&&d.push("ctrl"),b&8&&d.push("command"),b&2&&d.push("option"),b&4&&d.push("shift"),c&&d.push(c);var e=d.join("-"),f=a.buffer+e;b!=2&&(a.buffer=f);return{bufferToUse:f,symbolicName:e}},$find:function(a,b,c,e,f){var g={};this.keymapping[a.state].some(function(h){var i;if(h.key&&!h.key.test(c))return!1;if(h.regex&&!(i=h.regex.exec(b)))return!1;if(h.match&&!h.match(b,e,f,c))return!1;if(h.disallowMatches)for(var j=0;j"},{token:"keyword",regex:"(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"},{token:function(a){return a=="this"?"variable.language":b.hasOwnProperty(a)?"keyword":c.hasOwnProperty(a)?"constant.language":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|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(c_cppHighlightRules,g),b.c_cppHighlightRules=c_cppHighlightRules}),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}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/mode-coffee.js b/src/static/ace-0.1.6/src/mode-coffee.js new file mode 100644 index 0000000..0d9b987 --- /dev/null +++ b/src/static/ace-0.1.6/src/mode-coffee.js @@ -0,0 +1 @@ +define("ace/mode/coffee",function(a,b,c){function j(){this.$tokenizer=new d((new e).getRules()),this.$outdent=new f}var d=a("ace/tokenizer").Tokenizer,e=a("ace/mode/coffee_highlight_rules").CoffeeHighlightRules,f=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,g=a("ace/range").Range,h=a("ace/mode/text").Mode,i=a("pilot/oop");i.inherits(j,h);var k=j.prototype,l=/(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/,m=/^(\s*)#/,n=/^\s*###(?!#)/,o=/^\s*/;k.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a).tokens;(!e.length||e[e.length-1].type!=="comment")&&a==="start"&&l.test(b)&&(d+=c);return d},k.toggleCommentLines=function(a,b,c,d){console.log("toggle");var e=new g(0,0,0,0);for(var f=c;f<=d;++f){var h=b.getLine(f);if(n.test(h))continue;m.test(h)?h=h.replace(m,"$1"):h=h.replace(o,"$&#"),e.end.row=e.start.row=f,e.end.column=h.length+1,b.replace(e,h)}},k.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},k.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)},b.Mode=j}),define("ace/mode/coffee_highlight_rules",function(a,b,c){function d(){var a="[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*",b="(?![$\\w]|\\s*:)",c={token:"string",regex:".+"};this.$rules={start:[{token:"identifier",regex:"(?:@|(?:\\.|::)\\s*)"+a},{token:"keyword",regex:"(?:t(?:h(?:is|row|en)|ry|ypeof)|s(?:uper|witch)|return|b(?:reak|y)|c(?:ontinue|atch|lass)|i(?:n(?:stanceof)?|s(?:nt)?|f)|e(?:lse|xtends)|f(?:or (?:own)?|inally|unction)|wh(?:ile|en)|n(?:ew|ot?)|d(?:e(?:lete|bugger)|o)|loop|o(?:ff?|[rn])|un(?:less|til)|and|yes)"+b},{token:"constant.language",regex:"(?:true|false|null|undefined)"+b},{token:"invalid.illegal",regex:"(?:c(?:ase|onst)|default|function|v(?:ar|oid)|with|e(?:num|xport)|i(?:mplements|nterface)|let|p(?:ackage|r(?:ivate|otected)|ublic)|static|yield|__(?:hasProp|extends|slice|bind|indexOf))"+b},{token:"language.support.class",regex:"(?:Array|Boolean|Date|Function|Number|Object|R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|TypeError|URIError)"+b},{token:"language.support.function",regex:"(?:Math|JSON|is(?:NaN|Finite)|parse(?:Int|Float)|encodeURI(?:Component)?|decodeURI(?:Component)?)"+b},{token:"identifier",regex:a},{token:"constant.numeric",regex:"(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"},{token:"string",regex:"'''",next:"qdoc"},{token:"string",regex:'"""',next:"qqdoc"},{token:"string",regex:"'",next:"qstring"},{token:"string",regex:'"',next:"qqstring"},{token:"string",regex:"`",next:"js"},{token:"string.regex",regex:"///",next:"heregex"},{token:"string.regex",regex:"/(?!\\s)[^[/\\n\\\\]*(?: (?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[/\\n\\\\]*)*/[imgy]{0,4}(?!\\w)"},{token:"comment",regex:"###(?!#)",next:"comment"},{token:"comment",regex:"#.*"},{token:"lparen",regex:"[({[]"},{token:"rparen",regex:"[\\]})]"},{token:"keyword.operator",regex:"\\S+"},{token:"text",regex:"\\s+"}],qdoc:[{token:"string",regex:".*?'''",next:"start"},c],qqdoc:[{token:"string",regex:'.*?"""',next:"start"},c],qstring:[{token:"string",regex:"[^\\\\']*(?:\\\\.[^\\\\']*)*'",next:"start"},c],qqstring:[{token:"string",regex:'[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',next:"start"},c],js:[{token:"string",regex:"[^\\\\`]*(?:\\\\.[^\\\\`]*)*`",next:"start"},c],heregex:[{token:"string.regex",regex:".*?///[imgy]{0,4}",next:"start"},{token:"comment.regex",regex:"\\s+(?:#.*)?"},{token:"string.regex",regex:"\\S+"}],comment:[{token:"comment",regex:".*?###",next:"start"},{token:"comment",regex:".+"}]}}a("pilot/oop").inherits(d,a("ace/mode/text_highlight_rules").TextHighlightRules),b.CoffeeHighlightRules=d}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/mode-css.js b/src/static/ace-0.1.6/src/mode-css.js new file mode 100644 index 0000000..aaa16e5 --- /dev/null +++ b/src/static/ace-0.1.6/src/mode-css.js @@ -0,0 +1 @@ +define("ace/mode/css",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/css_highlight_rules").CssHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a).tokens;if(e.length&&e[e.length-1].type=="comment")return d;var f=b.match(/^.*\{\s*$/);f&&(d+=c);return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(i.prototype),b.Mode=i}),define("ace/mode/css_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){function g(a){var b=[],c=a.split("");for(var d=0;d=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\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"),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/worker/worker_client",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/event_emitter").EventEmitter,f=function(b,c,d,e){this.callbacks=[];if(a.packaged)var f=this.$guessBasePath(),g=this.$worker=new Worker(f+c);else{var h=a.nameToUrl("ace/worker/worker",null,"_"),g=this.$worker=new Worker(h),i={};for(var j=0;j"},{token:"comment",regex:"<\\!--",next:"comment"},{token:"text",regex:"<(?=s*script)",next:"script"},{token:"text",regex:"<(?=s*style)",next:"css"},{token:"text",regex:"<\\/?",next:"tag"},{token:"text",regex:"\\s+"},{token:"text",regex:"[^<]+"}],script:[{token:"text",regex:">",next:"js-start"},{token:"keyword",regex:"[-_a-zA-Z0-9:]+"},{token:"text",regex:"\\s+"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"}],css:[{token:"text",regex:">",next:"css-start"},{token:"keyword",regex:"[-_a-zA-Z0-9:]+"},{token:"text",regex:"\\s+"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"}],tag:[{token:"text",regex:">",next:"start"},{token:"keyword",regex:"[-_a-zA-Z0-9:]+"},{token:"text",regex:"\\s+"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"}],cdata:[{token:"text",regex:"\\]\\]>",next:"start"},{token:"text",regex:"\\s+"},{token:"text",regex:".+"}],comment:[{token:"comment",regex:".*?-->",next:"start"},{token:"comment",regex:".+"}]};var a=(new f).getRules();this.addRules(a,"js-"),this.$rules["js-start"].unshift({token:"comment",regex:"\\/\\/.*(?=<\\/script>)",next:"tag"},{token:"text",regex:"<\\/(?=script)",next:"tag"});var b=(new e).getRules();this.addRules(b,"css-"),this.$rules["css-start"].unshift({token:"text",regex:"<\\/(?=style)",next:"tag"})};d.inherits(h,g),b.HtmlHighlightRules=h}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/mode-java.js b/src/static/ace-0.1.6/src/mode-java.js new file mode 100644 index 0000000..b6d14fe --- /dev/null +++ b/src/static/ace-0.1.6/src/mode-java.js @@ -0,0 +1 @@ +define("ace/mode/java",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/javascript").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/java_highlight_rules").JavaHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.createWorker=function(a){return null}}.call(i.prototype),b.Mode=i}),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=a("ace/worker/worker_client").WorkerClient,k=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(k,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),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else 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){this.$outdent.autoOutdent(b,c)},this.createWorker=function(a){var b=a.getDocument(),c=new j(["ace","pilot"],"worker-javascript.js","ace/mode/javascript_worker","JavaScriptWorker");c.call("setValue",[b.getValue()]),b.on("change",function(a){a.range={start:a.data.range.start,end:a.data.range.end},c.emit("change",a)}),c.on("jslint",function(b){var c=[];for(var d=0;d=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\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"),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/worker/worker_client",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/event_emitter").EventEmitter,f=function(b,c,d,e){this.callbacks=[];if(a.packaged)var f=this.$guessBasePath(),g=this.$worker=new Worker(f+c);else{var h=a.nameToUrl("ace/worker/worker",null,"_"),g=this.$worker=new Worker(h),i={};for(var j=0;j=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\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(JavaHighlightRules,g),b.JavaHighlightRules=JavaHighlightRules}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/mode-javascript.js b/src/static/ace-0.1.6/src/mode-javascript.js new file mode 100644 index 0000000..e130fd6 --- /dev/null +++ b/src/static/ace-0.1.6/src/mode-javascript.js @@ -0,0 +1 @@ +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=a("ace/worker/worker_client").WorkerClient,k=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(k,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),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else 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){this.$outdent.autoOutdent(b,c)},this.createWorker=function(a){var b=a.getDocument(),c=new j(["ace","pilot"],"worker-javascript.js","ace/mode/javascript_worker","JavaScriptWorker");c.call("setValue",[b.getValue()]),b.on("change",function(a){a.range={start:a.data.range.start,end:a.data.range.end},c.emit("change",a)}),c.on("jslint",function(b){var c=[];for(var d=0;d=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\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"),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/worker/worker_client",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/event_emitter").EventEmitter,f=function(b,c,d,e){this.callbacks=[];if(a.packaged)var f=this.$guessBasePath(),g=this.$worker=new Worker(f+c);else{var h=a.nameToUrl("ace/worker/worker",null,"_"),g=this.$worker=new Worker(h),i={};for(var j=0;j"},{token:"comment",regex:"\\/\\/.*$"},{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",regex:"\\b(?:DEFAULT_INCLUDE_PATH|E_(?:ALL|CO(?:MPILE_(?:ERROR|WARNING)|RE_(?:ERROR|WARNING))|ERROR|NOTICE|PARSE|STRICT|USER_(?:ERROR|NOTICE|WARNING)|WARNING)|P(?:EAR_(?:EXTENSION_DIR|INSTALL_DIR)|HP_(?:BINDIR|CONFIG_FILE_(?:PATH|SCAN_DIR)|DATADIR|E(?:OL|XTENSION_DIR)|INT_(?:MAX|SIZE)|L(?:IBDIR|OCALSTATEDIR)|O(?:S|UTPUT_HANDLER_(?:CONT|END|START))|PREFIX|S(?:API|HLIB_SUFFIX|YSCONFDIR)|VERSION))|__COMPILER_HALT_OFFSET__)\\b"},{token:"constant.language",regex:"\\b(?:A(?:B(?:DAY_(?:1|2|3|4|5|6|7)|MON_(?:1(?:0|1|2|)|2|3|4|5|6|7|8|9))|LT_DIGITS|M_STR|SSERT_(?:ACTIVE|BAIL|CALLBACK|QUIET_EVAL|WARNING))|C(?:ASE_(?:LOWER|UPPER)|HAR_MAX|O(?:DESET|NNECTION_(?:ABORTED|NORMAL|TIMEOUT)|UNT_(?:NORMAL|RECURSIVE))|R(?:EDITS_(?:ALL|DOCS|FULLPAGE|G(?:ENERAL|ROUP)|MODULES|QA|SAPI)|NCYSTR|YPT_(?:BLOWFISH|EXT_DES|MD5|S(?:ALT_LENGTH|TD_DES)))|URRENCY_SYMBOL)|D(?:AY_(?:1|2|3|4|5|6|7)|ECIMAL_POINT|IRECTORY_SEPARATOR|_(?:FMT|T_FMT))|E(?:NT_(?:COMPAT|NOQUOTES|QUOTES)|RA(?:_(?:D_(?:FMT|T_FMT)|T_FMT|YEAR)|)|XTR_(?:IF_EXISTS|OVERWRITE|PREFIX_(?:ALL|I(?:F_EXISTS|NVALID)|SAME)|SKIP))|FRAC_DIGITS|GROUPING|HTML_(?:ENTITIES|SPECIALCHARS)|IN(?:FO_(?:ALL|C(?:ONFIGURATION|REDITS)|ENVIRONMENT|GENERAL|LICENSE|MODULES|VARIABLES)|I_(?:ALL|PERDIR|SYSTEM|USER)|T_(?:CURR_SYMBOL|FRAC_DIGITS))|L(?:C_(?:ALL|C(?:OLLATE|TYPE)|M(?:ESSAGES|ONETARY)|NUMERIC|TIME)|O(?:CK_(?:EX|NB|SH|UN)|G_(?:A(?:LERT|UTH(?:PRIV|))|C(?:ONS|R(?:IT|ON))|D(?:AEMON|EBUG)|E(?:MERG|RR)|INFO|KERN|L(?:OCAL(?:0|1|2|3|4|5|6|7)|PR)|MAIL|N(?:DELAY|EWS|O(?:TICE|WAIT))|ODELAY|P(?:ERROR|ID)|SYSLOG|U(?:SER|UCP)|WARNING)))|M(?:ON_(?:1(?:0|1|2|)|2|3|4|5|6|7|8|9|DECIMAL_POINT|GROUPING|THOUSANDS_SEP)|_(?:1_PI|2_(?:PI|SQRTPI)|E|L(?:N(?:10|2)|OG(?:10E|2E))|PI(?:_(?:2|4)|)|SQRT(?:1_2|2)))|N(?:EGATIVE_SIGN|O(?:EXPR|STR)|_(?:CS_PRECEDES|S(?:EP_BY_SPACE|IGN_POSN)))|P(?:ATH(?:INFO_(?:BASENAME|DIRNAME|EXTENSION)|_SEPARATOR)|M_STR|OSITIVE_SIGN|_(?:CS_PRECEDES|S(?:EP_BY_SPACE|IGN_POSN)))|RADIXCHAR|S(?:EEK_(?:CUR|END|SET)|ORT_(?:ASC|DESC|NUMERIC|REGULAR|STRING)|TR_PAD_(?:BOTH|LEFT|RIGHT))|T(?:HOUS(?:ANDS_SEP|EP)|_FMT(?:_AMPM|))|YES(?:EXPR|STR)|STD(?:IN|OUT|ERR))\\b"},{token:function(a){if(c.hasOwnProperty(a))return"keyword";if(d.hasOwnProperty(a))return"constant.language";if(g.hasOwnProperty(a))return"variable.language";if(h.hasOwnProperty(a))return"invalid.illegal";if(b.hasOwnProperty(a))return"support.function";if(a=="debugger")return"invalid.deprecated";if(a.match(/^(\$[a-zA-Z][a-zA-Z0-9_]*|self|parent)$/))return"variable";return"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(PhpHighlightRules,g),b.PhpHighlightRules=PhpHighlightRules}),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}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/mode-python.js b/src/static/ace-0.1.6/src/mode-python.js new file mode 100644 index 0000000..948805e --- /dev/null +++ b/src/static/ace-0.1.6/src/mode-python.js @@ -0,0 +1 @@ +define("ace/mode/python",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/python_highlight_rules").PythonHighlightRules,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),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else 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)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/python_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules;PythonHighlightRules=function(){var a=e.arrayToMap("and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield".split("|")),b=e.arrayToMap("True|False|None|NotImplemented|Ellipsis|__debug__".split("|")),c=e.arrayToMap("abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern".split("|")),d=e.arrayToMap("".split("|")),f="(?:r|u|ur|R|U|UR|Ur|uR)?",g="(?:(?:[1-9]\\d*)|(?:0))",h="(?:0[oO]?[0-7]+)",i="(?:0[xX][\\dA-Fa-f]+)",j="(?:0[bB][01]+)",k="(?:"+g+"|"+h+"|"+i+"|"+j+")",l="(?:[eE][+-]?\\d+)",m="(?:\\.\\d+)",n="(?:\\d+)",o="(?:(?:"+n+"?"+m+")|(?:"+n+"\\.))",p="(?:(?:"+o+"|"+n+")"+l+")",q="(?:"+p+"|"+o+")";this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string",regex:f+'"{3}(?:[^\\\\]|\\\\.)*?"{3}'},{token:"string",regex:f+'"{3}.*$',next:"qqstring"},{token:"string",regex:f+'"(?:[^\\\\]|\\\\.)*?"'},{token:"string",regex:f+"'{3}(?:[^\\\\]|\\\\.)*?'{3}"},{token:"string",regex:f+"'{3}.*$",next:"qstring"},{token:"string",regex:f+"'(?:[^\\\\]|\\\\.)*?'"},{token:"constant.numeric",regex:"(?:"+q+"|\\d+)[jJ]\\b"},{token:"constant.numeric",regex:q},{token:"constant.numeric",regex:k+"[lL]\\b"},{token:"constant.numeric",regex:k+"\\b"},{token:function(e){return a.hasOwnProperty(e)?"keyword":b.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"invalid.illegal":c.hasOwnProperty(e)?"support.function":e=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"lparen",regex:"[\\[\\(\\{]"},{token:"rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:[^\\\\]|\\\\.)*?"{3}',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:[^\\\\]|\\\\.)*?'{3}",next:"start"},{token:"string",regex:".+"}]}},d.inherits(PythonHighlightRules,f),b.PythonHighlightRules=PythonHighlightRules}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/mode-ruby.js b/src/static/ace-0.1.6/src/mode-ruby.js new file mode 100644 index 0000000..830fc6d --- /dev/null +++ b/src/static/ace-0.1.6/src/mode-ruby.js @@ -0,0 +1 @@ +define("ace/mode/ruby",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/ruby_highlight_rules").RubyHighlightRules,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),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else 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)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/ruby_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules;RubyHighlightRules=function(){var a=e.arrayToMap("abort|Array|at_exit|autoload|binding|block_given?|callcc|caller|catch|chomp|chomp!|chop|chop!|eval|exec|exit|exit!fail|Float|fork|format|gets|global_variables|gsub|gsub!|Integer|lambda|load|local_variables|loop|open|p|print|printf|proc|putc|puts|raise|rand|readline|readlines|require|scan|select|set_trace_func|sleep|split|sprintf|srand|String|syscall|system|sub|sub!|test|throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan".split("|")),b=e.arrayToMap("alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|__FILE__|finally|for|if|in|__LINE__|module|next|not|or|redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield".split("|")),c=e.arrayToMap("true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING".split("|")),d=e.arrayToMap("$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE".split("|"));this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"comment",regex:"^=begin$",next:"comment"},{token:"string.regexp",regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{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(e){return e=="self"?"variable.language":b.hasOwnProperty(e)?"keyword":c.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"variable.language":a.hasOwnProperty(e)?"support.function":e=="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:"^=end$",next:"start"},{token:"comment",regex:".+"}]}},d.inherits(RubyHighlightRules,f),b.RubyHighlightRules=RubyHighlightRules}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/mode-xml.js b/src/static/ace-0.1.6/src/mode-xml.js new file mode 100644 index 0000000..8cdb058 --- /dev/null +++ b/src/static/ace-0.1.6/src/mode-xml.js @@ -0,0 +1 @@ +define("ace/mode/xml",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/xml_highlight_rules").XmlHighlightRules,h=function(){this.$tokenizer=new f((new g).getRules())};d.inherits(h,e),function(){this.getNextLineIndent=function(a,b,c){return this.$getIndent(b)}}.call(h.prototype),b.Mode=h}),define("ace/mode/xml_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:"text",regex:"<\\!\\[CDATA\\[",next:"cdata"},{token:"xml_pe",regex:"<\\?.*?\\?>"},{token:"comment",regex:"<\\!--",next:"comment"},{token:"text",regex:"<\\/?",next:"tag"},{token:"text",regex:"\\s+"},{token:"text",regex:"[^<]+"}],tag:[{token:"text",regex:">",next:"start"},{token:"keyword",regex:"[-_a-zA-Z0-9:]+"},{token:"text",regex:"\\s+"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"}],cdata:[{token:"text",regex:"\\]\\]>",next:"start"},{token:"text",regex:"\\s+"},{token:"text",regex:"(?:[^\\]]|\\](?!\\]>))+"}],comment:[{token:"comment",regex:".*?-->",next:"start"},{token:"comment",regex:".+"}]}};d.inherits(f,e),b.XmlHighlightRules=f}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/theme-clouds.js b/src/static/ace-0.1.6/src/theme-clouds.js new file mode 100644 index 0000000..48c0d5c --- /dev/null +++ b/src/static/ace-0.1.6/src/theme-clouds.js @@ -0,0 +1 @@ +define("ace/theme/clouds",function(a,b,c){var d=a("pilot/dom"),e=".ace-clouds .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-clouds .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-clouds .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-clouds .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-clouds .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-clouds .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-clouds .ace_scroller {\n background-color: #FFFFFF;\n}\n\n.ace-clouds .ace_text-layer {\n cursor: text;\n color: #000000;\n}\n\n.ace-clouds .ace_cursor {\n border-left: 2px solid #000000;\n}\n\n.ace-clouds .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #000000;\n}\n \n.ace-clouds .ace_marker-layer .ace_selection {\n background: #BDD5FC;\n}\n\n.ace-clouds .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-clouds .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #BFBFBF;\n}\n\n.ace-clouds .ace_marker-layer .ace_active_line {\n background: #FFFBD1;\n}\n\n \n.ace-clouds .ace_invisible {\n color: #BFBFBF;\n}\n\n.ace-clouds .ace_keyword {\n color:#AF956F;\n}\n\n.ace-clouds .ace_keyword.ace_operator {\n color:#484848;\n}\n\n.ace-clouds .ace_constant {\n \n}\n\n.ace-clouds .ace_constant.ace_language {\n color:#39946A;\n}\n\n.ace-clouds .ace_constant.ace_library {\n \n}\n\n.ace-clouds .ace_constant.ace_numeric {\n color:#46A609;\n}\n\n.ace-clouds .ace_invalid {\n background-color:#FF002A;\n}\n\n.ace-clouds .ace_invalid.ace_illegal {\n \n}\n\n.ace-clouds .ace_invalid.ace_deprecated {\n \n}\n\n.ace-clouds .ace_support {\n \n}\n\n.ace-clouds .ace_support.ace_function {\n color:#C52727;\n}\n\n.ace-clouds .ace_function.ace_buildin {\n \n}\n\n.ace-clouds .ace_string {\n color:#5D90CD;\n}\n\n.ace-clouds .ace_string.ace_regexp {\n \n}\n\n.ace-clouds .ace_comment {\n color:#BCC8BA;\n}\n\n.ace-clouds .ace_comment.ace_doc {\n \n}\n\n.ace-clouds .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-clouds .ace_variable {\n \n}\n\n.ace-clouds .ace_variable.ace_language {\n \n}\n\n.ace-clouds .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-clouds"}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/theme-clouds_midnight.js b/src/static/ace-0.1.6/src/theme-clouds_midnight.js new file mode 100644 index 0000000..eff103e --- /dev/null +++ b/src/static/ace-0.1.6/src/theme-clouds_midnight.js @@ -0,0 +1 @@ +define("ace/theme/clouds_midnight",function(a,b,c){var d=a("pilot/dom"),e=".ace-clouds-midnight .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-clouds-midnight .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-clouds-midnight .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-clouds-midnight .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-clouds-midnight .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-clouds-midnight .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-clouds-midnight .ace_scroller {\n background-color: #191919;\n}\n\n.ace-clouds-midnight .ace_text-layer {\n cursor: text;\n color: #929292;\n}\n\n.ace-clouds-midnight .ace_cursor {\n border-left: 2px solid #7DA5DC;\n}\n\n.ace-clouds-midnight .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #7DA5DC;\n}\n \n.ace-clouds-midnight .ace_marker-layer .ace_selection {\n background: #000000;\n}\n\n.ace-clouds-midnight .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-clouds-midnight .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #BFBFBF;\n}\n\n.ace-clouds-midnight .ace_marker-layer .ace_active_line {\n background: rgba(215, 215, 215, 0.031);\n}\n\n \n.ace-clouds-midnight .ace_invisible {\n color: #BFBFBF;\n}\n\n.ace-clouds-midnight .ace_keyword {\n color:#927C5D;\n}\n\n.ace-clouds-midnight .ace_keyword.ace_operator {\n color:#4B4B4B;\n}\n\n.ace-clouds-midnight .ace_constant {\n \n}\n\n.ace-clouds-midnight .ace_constant.ace_language {\n color:#39946A;\n}\n\n.ace-clouds-midnight .ace_constant.ace_library {\n \n}\n\n.ace-clouds-midnight .ace_constant.ace_numeric {\n color:#46A609;\n}\n\n.ace-clouds-midnight .ace_invalid {\n color:#FFFFFF;\nbackground-color:#E92E2E;\n}\n\n.ace-clouds-midnight .ace_invalid.ace_illegal {\n \n}\n\n.ace-clouds-midnight .ace_invalid.ace_deprecated {\n \n}\n\n.ace-clouds-midnight .ace_support {\n \n}\n\n.ace-clouds-midnight .ace_support.ace_function {\n color:#E92E2E;\n}\n\n.ace-clouds-midnight .ace_function.ace_buildin {\n \n}\n\n.ace-clouds-midnight .ace_string {\n color:#5D90CD;\n}\n\n.ace-clouds-midnight .ace_string.ace_regexp {\n \n}\n\n.ace-clouds-midnight .ace_comment {\n color:#3C403B;\n}\n\n.ace-clouds-midnight .ace_comment.ace_doc {\n \n}\n\n.ace-clouds-midnight .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-clouds-midnight .ace_variable {\n \n}\n\n.ace-clouds-midnight .ace_variable.ace_language {\n \n}\n\n.ace-clouds-midnight .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-clouds-midnight"}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/theme-cobalt.js b/src/static/ace-0.1.6/src/theme-cobalt.js new file mode 100644 index 0000000..176026d --- /dev/null +++ b/src/static/ace-0.1.6/src/theme-cobalt.js @@ -0,0 +1 @@ +define("ace/theme/cobalt",function(a,b,c){var d=a("pilot/dom"),e=".ace-cobalt .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-cobalt .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-cobalt .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-cobalt .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-cobalt .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-cobalt .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-cobalt .ace_scroller {\n background-color: #002240;\n}\n\n.ace-cobalt .ace_text-layer {\n cursor: text;\n color: #FFFFFF;\n}\n\n.ace-cobalt .ace_cursor {\n border-left: 2px solid #FFFFFF;\n}\n\n.ace-cobalt .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FFFFFF;\n}\n \n.ace-cobalt .ace_marker-layer .ace_selection {\n background: rgba(179, 101, 57, 0.75);\n}\n\n.ace-cobalt .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-cobalt .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 255, 255, 0.15);\n}\n\n.ace-cobalt .ace_marker-layer .ace_active_line {\n background: rgba(0, 0, 0, 0.35);\n}\n\n \n.ace-cobalt .ace_invisible {\n color: rgba(255, 255, 255, 0.15);\n}\n\n.ace-cobalt .ace_keyword {\n color:#FF9D00;\n}\n\n.ace-cobalt .ace_keyword.ace_operator {\n \n}\n\n.ace-cobalt .ace_constant {\n color:#FF628C;\n}\n\n.ace-cobalt .ace_constant.ace_language {\n \n}\n\n.ace-cobalt .ace_constant.ace_library {\n \n}\n\n.ace-cobalt .ace_constant.ace_numeric {\n \n}\n\n.ace-cobalt .ace_invalid {\n color:#F8F8F8;\nbackground-color:#800F00;\n}\n\n.ace-cobalt .ace_invalid.ace_illegal {\n \n}\n\n.ace-cobalt .ace_invalid.ace_deprecated {\n \n}\n\n.ace-cobalt .ace_support {\n color:#80FFBB;\n}\n\n.ace-cobalt .ace_support.ace_function {\n color:#FFB054;\n}\n\n.ace-cobalt .ace_function.ace_buildin {\n \n}\n\n.ace-cobalt .ace_string {\n \n}\n\n.ace-cobalt .ace_string.ace_regexp {\n color:#80FFC2;\n}\n\n.ace-cobalt .ace_comment {\n font-style:italic;\ncolor:#0088FF;\n}\n\n.ace-cobalt .ace_comment.ace_doc {\n \n}\n\n.ace-cobalt .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-cobalt .ace_variable {\n color:#CCCCCC;\n}\n\n.ace-cobalt .ace_variable.ace_language {\n color:#FF80E1;\n}\n\n.ace-cobalt .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-cobalt"}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/theme-dawn.js b/src/static/ace-0.1.6/src/theme-dawn.js new file mode 100644 index 0000000..b155994 --- /dev/null +++ b/src/static/ace-0.1.6/src/theme-dawn.js @@ -0,0 +1 @@ +define("ace/theme/dawn",function(a,b,c){var d=a("pilot/dom"),e=".ace-dawn .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-dawn .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-dawn .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-dawn .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-dawn .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-dawn .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-dawn .ace_scroller {\n background-color: #F9F9F9;\n}\n\n.ace-dawn .ace_text-layer {\n cursor: text;\n color: #080808;\n}\n\n.ace-dawn .ace_cursor {\n border-left: 2px solid #000000;\n}\n\n.ace-dawn .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #000000;\n}\n \n.ace-dawn .ace_marker-layer .ace_selection {\n background: rgba(39, 95, 255, 0.30);\n}\n\n.ace-dawn .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-dawn .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(75, 75, 126, 0.50);\n}\n\n.ace-dawn .ace_marker-layer .ace_active_line {\n background: rgba(36, 99, 180, 0.12);\n}\n\n \n.ace-dawn .ace_invisible {\n color: rgba(75, 75, 126, 0.50);\n}\n\n.ace-dawn .ace_keyword {\n color:#794938;\n}\n\n.ace-dawn .ace_keyword.ace_operator {\n \n}\n\n.ace-dawn .ace_constant {\n color:#811F24;\n}\n\n.ace-dawn .ace_constant.ace_language {\n \n}\n\n.ace-dawn .ace_constant.ace_library {\n \n}\n\n.ace-dawn .ace_constant.ace_numeric {\n \n}\n\n.ace-dawn .ace_invalid {\n \n}\n\n.ace-dawn .ace_invalid.ace_illegal {\n text-decoration:underline;\nfont-style:italic;\ncolor:#F8F8F8;\nbackground-color:#B52A1D;\n}\n\n.ace-dawn .ace_invalid.ace_deprecated {\n text-decoration:underline;\nfont-style:italic;\ncolor:#B52A1D;\n}\n\n.ace-dawn .ace_support {\n color:#691C97;\n}\n\n.ace-dawn .ace_support.ace_function {\n color:#693A17;\n}\n\n.ace-dawn .ace_function.ace_buildin {\n \n}\n\n.ace-dawn .ace_string {\n color:#0B6125;\n}\n\n.ace-dawn .ace_string.ace_regexp {\n color:#CF5628;\n}\n\n.ace-dawn .ace_comment {\n font-style:italic;\ncolor:#5A525F;\n}\n\n.ace-dawn .ace_comment.ace_doc {\n \n}\n\n.ace-dawn .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-dawn .ace_variable {\n color:#234A97;\n}\n\n.ace-dawn .ace_variable.ace_language {\n \n}\n\n.ace-dawn .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-dawn"}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/theme-eclipse.js b/src/static/ace-0.1.6/src/theme-eclipse.js new file mode 100644 index 0000000..1d70586 --- /dev/null +++ b/src/static/ace-0.1.6/src/theme-eclipse.js @@ -0,0 +1 @@ +define("ace/theme/eclipse",function(a,b,c){var d=a("pilot/dom"),e=a("text!ace/theme/eclipse.css");d.importCssString(e),b.cssClass="ace-eclipse"}),define("text!ace/theme/eclipse.css",".ace-eclipse .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-eclipse .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-eclipse .ace_gutter { width: 40px; background: rgb(227, 227, 227); border-right: 1px solid rgb(159, 159, 159);\t color: rgb(136, 136, 136);}.ace-eclipse .ace_gutter-layer { right: 10px; text-align: right;}.ace-eclipse .ace_text-layer { cursor: text;}.ace-eclipse .ace_cursor { border-left: 1px solid black;}.ace-eclipse .ace_line .ace_keyword, .ace-eclipse .ace_line .ace_variable { color: rgb(127, 0, 85);}.ace-eclipse .ace_line .ace_constant.ace_buildin { color: rgb(88, 72, 246);}.ace-eclipse .ace_line .ace_constant.ace_library { color: rgb(6, 150, 14);}.ace-eclipse .ace_line .ace_function { color: rgb(60, 76, 114);}.ace-eclipse .ace_line .ace_string { color: rgb(42, 0, 255);}.ace-eclipse .ace_line .ace_comment { color: rgb(63, 127, 95);}.ace-eclipse .ace_line .ace_comment.ace_doc { color: rgb(63, 95, 191);}.ace-eclipse .ace_line .ace_comment.ace_doc.ace_tag { color: rgb(127, 159, 191);}.ace-eclipse .ace_line .ace_constant.ace_numeric {}.ace-eclipse .ace_line .ace_tag {\tcolor: rgb(63, 127, 127);}.ace-eclipse .ace_line .ace_xml_pe { color: rgb(104, 104, 91);}.ace-eclipse .ace_marker-layer .ace_selection { background: rgb(181, 213, 255);}.ace-eclipse .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgb(192, 192, 192);}.ace-eclipse .ace_marker-layer .ace_active_line { background: rgb(232, 242, 254);}") \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/theme-idle_fingers.js b/src/static/ace-0.1.6/src/theme-idle_fingers.js new file mode 100644 index 0000000..209ac41 --- /dev/null +++ b/src/static/ace-0.1.6/src/theme-idle_fingers.js @@ -0,0 +1 @@ +define("ace/theme/idle_fingers",function(a,b,c){var d=a("pilot/dom"),e=".ace-idle-fingers .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-idle-fingers .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-idle-fingers .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-idle-fingers .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-idle-fingers .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-idle-fingers .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-idle-fingers .ace_scroller {\n background-color: #323232;\n}\n\n.ace-idle-fingers .ace_text-layer {\n cursor: text;\n color: #FFFFFF;\n}\n\n.ace-idle-fingers .ace_cursor {\n border-left: 2px solid #91FF00;\n}\n\n.ace-idle-fingers .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #91FF00;\n}\n \n.ace-idle-fingers .ace_marker-layer .ace_selection {\n background: rgba(90, 100, 126, 0.88);\n}\n\n.ace-idle-fingers .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-idle-fingers .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #404040;\n}\n\n.ace-idle-fingers .ace_marker-layer .ace_active_line {\n background: #353637;\n}\n\n \n.ace-idle-fingers .ace_invisible {\n color: #404040;\n}\n\n.ace-idle-fingers .ace_keyword {\n color:#CC7833;\n}\n\n.ace-idle-fingers .ace_keyword.ace_operator {\n \n}\n\n.ace-idle-fingers .ace_constant {\n color:#6C99BB;\n}\n\n.ace-idle-fingers .ace_constant.ace_language {\n \n}\n\n.ace-idle-fingers .ace_constant.ace_library {\n \n}\n\n.ace-idle-fingers .ace_constant.ace_numeric {\n \n}\n\n.ace-idle-fingers .ace_invalid {\n color:#FFFFFF;\nbackground-color:#FF0000;\n}\n\n.ace-idle-fingers .ace_invalid.ace_illegal {\n \n}\n\n.ace-idle-fingers .ace_invalid.ace_deprecated {\n \n}\n\n.ace-idle-fingers .ace_support {\n color:#bc9458;\n}\n\n.ace-idle-fingers .ace_support.ace_function {\n color:#B83426;\n}\n\n.ace-idle-fingers .ace_function.ace_buildin {\n \n}\n\n.ace-idle-fingers .ace_string {\n color:#A5C261;\n}\n\n.ace-idle-fingers .ace_string.ace_regexp {\n color:#CCCC33;\n}\n\n.ace-idle-fingers .ace_comment {\n font-style:italic;\n color:#BC9458;\n}\n\n.ace-idle-fingers .ace_comment.ace_doc {\n \n}\n\n.ace-idle-fingers .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-idle-fingers .ace_variable {\n color:#b7dff8;\n}\n\n.ace-idle-fingers .ace_variable.ace_language {\n color:#b7dff8;\n}\n\n.ace-idle-fingers .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-idle-fingers"}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/theme-kr_theme.js b/src/static/ace-0.1.6/src/theme-kr_theme.js new file mode 100644 index 0000000..8c0a813 --- /dev/null +++ b/src/static/ace-0.1.6/src/theme-kr_theme.js @@ -0,0 +1 @@ +define("ace/theme/kr_theme",function(a,b,c){var d=a("pilot/dom"),e=".ace-kr-theme .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-kr-theme .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-kr-theme .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-kr-theme .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-kr-theme .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-kr-theme .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-kr-theme .ace_scroller {\n background-color: #0B0A09;\n}\n\n.ace-kr-theme .ace_text-layer {\n cursor: text;\n color: #FCFFE0;\n}\n\n.ace-kr-theme .ace_cursor {\n border-left: 2px solid #FF9900;\n}\n\n.ace-kr-theme .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FF9900;\n}\n \n.ace-kr-theme .ace_marker-layer .ace_selection {\n background: rgba(170, 0, 255, 0.45);\n}\n\n.ace-kr-theme .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-kr-theme .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 177, 111, 0.32);\n}\n\n.ace-kr-theme .ace_marker-layer .ace_active_line {\n background: #38403D;\n}\n\n \n.ace-kr-theme .ace_invisible {\n color: rgba(255, 177, 111, 0.32);\n}\n\n.ace-kr-theme .ace_keyword {\n color:#949C8B;\n}\n\n.ace-kr-theme .ace_keyword.ace_operator {\n \n}\n\n.ace-kr-theme .ace_constant {\n color:rgba(210, 117, 24, 0.76);\n}\n\n.ace-kr-theme .ace_constant.ace_language {\n \n}\n\n.ace-kr-theme .ace_constant.ace_library {\n \n}\n\n.ace-kr-theme .ace_constant.ace_numeric {\n \n}\n\n.ace-kr-theme .ace_invalid {\n color:#F8F8F8;\nbackground-color:#A41300;\n}\n\n.ace-kr-theme .ace_invalid.ace_illegal {\n \n}\n\n.ace-kr-theme .ace_invalid.ace_deprecated {\n \n}\n\n.ace-kr-theme .ace_support {\n color:#9FC28A;\n}\n\n.ace-kr-theme .ace_support.ace_function {\n color:#85873A;\n}\n\n.ace-kr-theme .ace_function.ace_buildin {\n \n}\n\n.ace-kr-theme .ace_string {\n \n}\n\n.ace-kr-theme .ace_string.ace_regexp {\n color:rgba(125, 255, 192, 0.65);\n}\n\n.ace-kr-theme .ace_comment {\n font-style:italic;\ncolor:#706D5B;\n}\n\n.ace-kr-theme .ace_comment.ace_doc {\n \n}\n\n.ace-kr-theme .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-kr-theme .ace_variable {\n color:#D1A796;\n}\n\n.ace-kr-theme .ace_variable.ace_language {\n color:#FF80E1;\n}\n\n.ace-kr-theme .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-kr-theme"}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/theme-mono_industrial.js b/src/static/ace-0.1.6/src/theme-mono_industrial.js new file mode 100644 index 0000000..8ecdca3 --- /dev/null +++ b/src/static/ace-0.1.6/src/theme-mono_industrial.js @@ -0,0 +1 @@ +define("ace/theme/mono_industrial",function(a,b,c){var d=a("pilot/dom"),e=".ace-mono-industrial .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-mono-industrial .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-mono-industrial .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-mono-industrial .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-mono-industrial .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-mono-industrial .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-mono-industrial .ace_scroller {\n background-color: #222C28;\n}\n\n.ace-mono-industrial .ace_text-layer {\n cursor: text;\n color: #FFFFFF;\n}\n\n.ace-mono-industrial .ace_cursor {\n border-left: 2px solid #FFFFFF;\n}\n\n.ace-mono-industrial .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FFFFFF;\n}\n \n.ace-mono-industrial .ace_marker-layer .ace_selection {\n background: rgba(145, 153, 148, 0.40);\n}\n\n.ace-mono-industrial .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-mono-industrial .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(102, 108, 104, 0.50);\n}\n\n.ace-mono-industrial .ace_marker-layer .ace_active_line {\n background: rgba(12, 13, 12, 0.25);\n}\n\n \n.ace-mono-industrial .ace_invisible {\n color: rgba(102, 108, 104, 0.50);\n}\n\n.ace-mono-industrial .ace_keyword {\n color:#A39E64;\n}\n\n.ace-mono-industrial .ace_keyword.ace_operator {\n color:#A8B3AB;\n}\n\n.ace-mono-industrial .ace_constant {\n color:#E98800;\n}\n\n.ace-mono-industrial .ace_constant.ace_language {\n \n}\n\n.ace-mono-industrial .ace_constant.ace_library {\n \n}\n\n.ace-mono-industrial .ace_constant.ace_numeric {\n color:#E98800;\n}\n\n.ace-mono-industrial .ace_invalid {\n color:#FFFFFF;\nbackground-color:rgba(153, 0, 0, 0.68);\n}\n\n.ace-mono-industrial .ace_invalid.ace_illegal {\n \n}\n\n.ace-mono-industrial .ace_invalid.ace_deprecated {\n \n}\n\n.ace-mono-industrial .ace_support {\n \n}\n\n.ace-mono-industrial .ace_support.ace_function {\n color:#588E60;\n}\n\n.ace-mono-industrial .ace_function.ace_buildin {\n \n}\n\n.ace-mono-industrial .ace_string {\n \n}\n\n.ace-mono-industrial .ace_string.ace_regexp {\n \n}\n\n.ace-mono-industrial .ace_comment {\n color:#666C68;\nbackground-color:#151C19;\n}\n\n.ace-mono-industrial .ace_comment.ace_doc {\n \n}\n\n.ace-mono-industrial .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-mono-industrial .ace_variable {\n \n}\n\n.ace-mono-industrial .ace_variable.ace_language {\n color:#648BD2;\n}\n\n.ace-mono-industrial .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-mono-industrial"}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/theme-monokai.js b/src/static/ace-0.1.6/src/theme-monokai.js new file mode 100644 index 0000000..4052afb --- /dev/null +++ b/src/static/ace-0.1.6/src/theme-monokai.js @@ -0,0 +1 @@ +define("ace/theme/monokai",function(a,b,c){var d=a("pilot/dom"),e=".ace-monokai .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-monokai .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-monokai .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-monokai .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-monokai .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-monokai .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-monokai .ace_scroller {\n background-color: #272822;\n}\n\n.ace-monokai .ace_text-layer {\n cursor: text;\n color: #F8F8F2;\n}\n\n.ace-monokai .ace_cursor {\n border-left: 2px solid #F8F8F0;\n}\n\n.ace-monokai .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #F8F8F0;\n}\n \n.ace-monokai .ace_marker-layer .ace_selection {\n background: #49483E;\n}\n\n.ace-monokai .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-monokai .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #49483E;\n}\n\n.ace-monokai .ace_marker-layer .ace_active_line {\n background: #49483E;\n}\n\n \n.ace-monokai .ace_invisible {\n color: #49483E;\n}\n\n.ace-monokai .ace_keyword {\n color:#F92672;\n}\n\n.ace-monokai .ace_keyword.ace_operator {\n \n}\n\n.ace-monokai .ace_constant {\n \n}\n\n.ace-monokai .ace_constant.ace_language {\n color:#AE81FF;\n}\n\n.ace-monokai .ace_constant.ace_library {\n \n}\n\n.ace-monokai .ace_constant.ace_numeric {\n color:#AE81FF;\n}\n\n.ace-monokai .ace_invalid {\n color:#F8F8F0;\nbackground-color:#F92672;\n}\n\n.ace-monokai .ace_invalid.ace_illegal {\n \n}\n\n.ace-monokai .ace_invalid.ace_deprecated {\n color:#F8F8F0;\nbackground-color:#AE81FF;\n}\n\n.ace-monokai .ace_support {\n \n}\n\n.ace-monokai .ace_support.ace_function {\n color:#66D9EF;\n}\n\n.ace-monokai .ace_function.ace_buildin {\n \n}\n\n.ace-monokai .ace_string {\n color:#E6DB74;\n}\n\n.ace-monokai .ace_string.ace_regexp {\n \n}\n\n.ace-monokai .ace_comment {\n color:#75715E;\n}\n\n.ace-monokai .ace_comment.ace_doc {\n \n}\n\n.ace-monokai .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-monokai .ace_variable {\n \n}\n\n.ace-monokai .ace_variable.ace_language {\n \n}\n\n.ace-monokai .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-monokai"}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/theme-pastel_on_dark.js b/src/static/ace-0.1.6/src/theme-pastel_on_dark.js new file mode 100644 index 0000000..19d0be1 --- /dev/null +++ b/src/static/ace-0.1.6/src/theme-pastel_on_dark.js @@ -0,0 +1 @@ +define("ace/theme/pastel_on_dark",function(a,b,c){var d=a("pilot/dom"),e=".ace-pastel-on-dark .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-pastel-on-dark .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-pastel-on-dark .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-pastel-on-dark .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-pastel-on-dark .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-pastel-on-dark .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-pastel-on-dark .ace_scroller {\n background-color: #2c2828;\n}\n\n.ace-pastel-on-dark .ace_text-layer {\n cursor: text;\n color: #8f938f;\n}\n\n.ace-pastel-on-dark .ace_cursor {\n border-left: 2px solid #A7A7A7;\n}\n\n.ace-pastel-on-dark .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #A7A7A7;\n}\n \n.ace-pastel-on-dark .ace_marker-layer .ace_selection {\n background: rgba(221, 240, 255, 0.20);\n}\n\n.ace-pastel-on-dark .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-pastel-on-dark .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 255, 255, 0.25);\n}\n\n.ace-pastel-on-dark .ace_marker-layer .ace_active_line {\n background: rgba(255, 255, 255, 0.031);\n}\n\n \n.ace-pastel-on-dark .ace_invisible {\n color: rgba(255, 255, 255, 0.25);\n}\n\n.ace-pastel-on-dark .ace_keyword {\n color:#757ad8;\n}\n\n.ace-pastel-on-dark .ace_keyword.ace_operator {\n color:#797878;\n}\n\n.ace-pastel-on-dark .ace_constant {\n color:#4fb7c5;\n}\n\n.ace-pastel-on-dark .ace_constant.ace_language {\n \n}\n\n.ace-pastel-on-dark .ace_constant.ace_library {\n \n}\n\n.ace-pastel-on-dark .ace_constant.ace_numeric {\n \n}\n\n.ace-pastel-on-dark .ace_invalid {\n \n}\n\n.ace-pastel-on-dark .ace_invalid.ace_illegal {\n color:#F8F8F8;\nbackground-color:rgba(86, 45, 86, 0.75);\n}\n\n.ace-pastel-on-dark .ace_invalid.ace_deprecated {\n text-decoration:underline;\nfont-style:italic;\ncolor:#D2A8A1;\n}\n\n.ace-pastel-on-dark .ace_support {\n color:#9a9a9a;\n}\n\n.ace-pastel-on-dark .ace_support.ace_function {\n color:#aeb2f8;\n}\n\n.ace-pastel-on-dark .ace_function.ace_buildin {\n \n}\n\n.ace-pastel-on-dark .ace_string {\n color:#66a968;\n}\n\n.ace-pastel-on-dark .ace_string.ace_regexp {\n color:#E9C062;\n}\n\n.ace-pastel-on-dark .ace_comment {\n color:#656865;\n}\n\n.ace-pastel-on-dark .ace_comment.ace_doc {\n color:A6C6FF;\n}\n\n.ace-pastel-on-dark .ace_comment.ace_doc.ace_tag {\n color:A6C6FF;\n}\n\n.ace-pastel-on-dark .ace_variable {\n color:#bebf55;\n}\n\n.ace-pastel-on-dark .ace_variable.ace_language {\n color:#bebf55;\n}\n\n.ace-pastel-on-dark .ace_xml_pe {\n color:#494949;\n}";d.importCssString(e),b.cssClass="ace-pastel-on-dark"}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/theme-twilight.js b/src/static/ace-0.1.6/src/theme-twilight.js new file mode 100644 index 0000000..c274c88 --- /dev/null +++ b/src/static/ace-0.1.6/src/theme-twilight.js @@ -0,0 +1 @@ +define("ace/theme/twilight",function(a,b,c){var d=a("pilot/dom"),e=".ace-twilight .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-twilight .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-twilight .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-twilight .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-twilight .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-twilight .ace_print_margin {\n border-left: 1px solid #3C3C3C;\n width: 100%;\n background: #242424;\n}\n\n.ace-twilight .ace_scroller {\n background-color: #141414;\n}\n\n.ace-twilight .ace_text-layer {\n cursor: text;\n color: #F8F8F8;\n}\n\n.ace-twilight .ace_cursor {\n border-left: 2px solid #A7A7A7;\n}\n\n.ace-twilight .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #A7A7A7;\n}\n.ace-twilight.normal-mode .ace_cursor.ace_overwrite {\n border: 1px solid #FFE300;\n background: #766B13;\n}\n.ace-twilight.normal-mode .ace_cursor-layer {\n z-index: 0;\n}\n \n.ace-twilight .ace_marker-layer .ace_selection {\n background: rgba(221, 240, 255, 0.20);\n}\n\n.ace-twilight .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-twilight .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 255, 255, 0.25);\n}\n\n.ace-twilight .ace_marker-layer .ace_active_line {\n background: rgba(255, 255, 255, 0.031);\n}\n\n \n.ace-twilight .ace_invisible {\n color: rgba(255, 255, 255, 0.25);\n}\n\n.ace-twilight .ace_keyword {\n color:#CDA869;\n}\n\n.ace-twilight .ace_keyword.ace_operator {\n \n}\n\n.ace-twilight .ace_constant {\n color:#CF6A4C;\n}\n\n.ace-twilight .ace_constant.ace_language {\n \n}\n\n.ace-twilight .ace_constant.ace_library {\n \n}\n\n.ace-twilight .ace_constant.ace_numeric {\n \n}\n\n.ace-twilight .ace_invalid {\n \n}\n\n.ace-twilight .ace_invalid.ace_illegal {\n color:#F8F8F8;\nbackground-color:rgba(86, 45, 86, 0.75);\n}\n\n.ace-twilight .ace_invalid.ace_deprecated {\n text-decoration:underline;\nfont-style:italic;\ncolor:#D2A8A1;\n}\n\n.ace-twilight .ace_support {\n color:#9B859D;\n}\n\n.ace-twilight .ace_support.ace_function {\n color:#DAD085;\n}\n\n.ace-twilight .ace_function.ace_buildin {\n \n}\n\n.ace-twilight .ace_string {\n color:#8F9D6A;\n}\n\n.ace-twilight .ace_string.ace_regexp {\n color:#E9C062;\n}\n\n.ace-twilight .ace_comment {\n font-style:italic;\ncolor:#5F5A60;\n}\n\n.ace-twilight .ace_comment.ace_doc {\n \n}\n\n.ace-twilight .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-twilight .ace_variable {\n color:#7587A6;\n}\n\n.ace-twilight .ace_variable.ace_language {\n \n}\n\n.ace-twilight .ace_xml_pe {\n color:#494949;\n}";d.importCssString(e),b.cssClass="ace-twilight"}) \ No newline at end of file diff --git a/src/static/ace-0.1.6/src/worker-javascript.js b/src/static/ace-0.1.6/src/worker-javascript.js new file mode 100644 index 0000000..f970d56 --- /dev/null +++ b/src/static/ace-0.1.6/src/worker-javascript.js @@ -0,0 +1 @@ +function initSender(){var a=require("pilot/event_emitter").EventEmitter,b=require("pilot/oop"),c=function(){};(function(){b.implement(this,a),this.callback=function(a,b){postMessage({type:"call",id:b,data:a})},this.emit=function(a,b){postMessage({type:"event",name:a,data:b})}}).call(c.prototype);return new c}function initBaseUrls(a){require.tlns=a}var console={log:function(a){postMessage({type:"log",data:a})}},window={console:console},require=function(a){var b=require.modules[a];if(b){b.initialized||(b.exports=b.factory().exports,b.initialized=!0);return b.exports}var c=a.split("/");c[0]=require.tlns[c[0]]||c[0],path=c.join("/")+".js",require.id=a,importScripts(path);return require(a)};require.modules={},require.tlns={};var define=function(a,b){b||(b=a,a=require.id);a.indexOf("text!")!==0&&(require.modules[a]={factory:function(){var a={exports:{}},c=b(require,a.exports,a);c&&(a.exports=exports);return a}})},main,sender;onmessage=function(a){var b=a.data;if(b.command)main[b.command].apply(main,b.args);else if(b.init){initBaseUrls(b.tlns),require("pilot/fixoldbrowsers"),sender=initSender();var c=require(b.module)[b.classname];main=new c(sender)}else b.event&&sender._dispatchEvent(b.event,b.data)},define("pilot/fixoldbrowsers",function(a,b,c){Function.prototype.bind||(Function.prototype.bind=function(a){var b=[].slice,c=b.call(arguments,1),d=this,e=function(){};if(arguments.length==1)var f=function(){return d.apply(this instanceof e?this:a,arguments)};else var f=function(){return d.apply(this instanceof e?this:a||{},c.concat(b.call(arguments)))};e.prototype=d.prototype,f.prototype=new e,f.name=this.name,f.displayName=this.displayName,f.length=this.length,f.unbound=d;return f});var d=function(){},e=Function.prototype.call,f=e.bind(Object.prototype.hasOwnProperty),g,h,i,j;g=h=i=j=d,Object.prototype.__lookupGetter__&&(g=e.bind(Object.prototype.__lookupGetter__)),Object.prototype.__lookupSetter__&&(h=e.bind(Object.prototype.__lookupSetter__)),Object.prototype.__defineGetter__&&(i=e.bind(Object.prototype.__defineGetter__)),Object.prototype.__defineSetter__&&(j=e.bind(Object.prototype.__defineSetter__)),Array.isArray||(Array.isArray=function(a){return a&&Object.prototype.toString.call(a)==="[object Array]"}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(c===0)return-1;var d=0,e=d;arguments.length>0&&(d=Number(arguments[1]),d!==d?d=0:d!==0&&d!==1/e&&d!==-(1/e)&&(d=(d>0||-1)*Math.floor(Math.abs(d))));if(d>=c)return-1;var f=d>=0?d:Math.max(c-Math.abs(d),0);for(;f>>0;if(c===0)return-1;var d=c,e=!1|0;arguments.length>0&&(d=Number(arguments[1]),d!==d?d=0:d!==0&&d!==1/e&&d!==-(1/e)&&(d=(d>0||-1)*Math.floor(Math.abs(d))));var f=d>=0?Math.min(d,c-1):c-Math.abs(d);while(f>=0)if(f in b&&b[f]===a)return f;return-1}),Array.prototype.map||(Array.prototype.map=function(a){if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!=="function")throw new TypeError;res=Array(c);var d=arguments[1];for(var e=0;e>>0;if(typeof a!=="function")throw new TypeError;var d=arguments[1];for(var e=0;e>>0;if(typeof a!="function")throw new TypeError;if(b==0&&arguments.length==1)throw new TypeError;var c=0;if(arguments.length<2){do{if(c in this){d=this[c++];break}if(++c>=b)throw new TypeError}while(!0)}else var d=arguments[1];for(;c>>0;if(typeof a!="function")throw new TypeError;if(b==0&&arguments.length==1)throw new TypeError;var c=b-1;if(arguments.length<2){do{if(c in this){d=this[c--];break}if(--c<0)throw new TypeError}while(!0)}else var d=arguments[1];for(;c>=0;c--)c in this&&(d=a.call(null,d,this[c],c,this));return d}),Object.keys||(Object.keys=function m(a){var b,c=[];for(b in a)f(a,b)&&c.push(b);return c}),Object.getOwnPropertyNames||(Object.getOwnPropertyNames=Object.keys);var n="Object.getOwnPropertyDescriptor called on a non-object";Object.getOwnPropertyDescriptor||(Object.getOwnPropertyDescriptor=function o(a,b){var c,d,e;if(typeof a!=="object"&&typeof a!=="function"||a===null)throw new TypeError(n);f(a,b)&&(c={configurable:!0,enumerable:!0},d=c.get=g(a,b),e=c.set=h(a,b),!d&&!e&&(c.writeable=!0,c.value=a[b]));return c}),Object.getPrototypeOf||(Object.getPrototypeOf=function p(a){return a.__proto__||a.constructor.prototype}),Object.create||(Object.create=function q(a,b){var c;if(a===null)c={"__proto__":null};else{if(typeof a!=="object")throw new TypeError(a+" is not an object or null");d.prototype=a,c=new d}typeof b!=="undefined"&&Object.defineProperties(c,b);return c}),Object.defineProperty||(Object.defineProperty=function r(a,b,c){var d,e,f;if("object"!==typeof a&&"function"!==typeof a)throw new TypeError(a+"is not an object");if(c&&"object"!==typeof c)throw new TypeError("Property descriptor map must be an object");if("value"in c){if("get"in c||"set"in c)throw new TypeError('Invalid property. "value" present on property with getter or setter.');if(d=a.__proto__)a.__proto__=Object.prototype;delete a[b],a[b]=c.value,d&&(a.__proto__=d)}else(f=c.get)&&i(a,f),(e=c.set)&&j(a,e);return a}),Object.defineProperties||(Object.defineProperties=function s(a,b){Object.getOwnPropertyNames(b).forEach(function(c){Object.defineProperty(a,c,b[c])});return a});var t=function(a){return a};Object.seal||(Object.seal=t),Object.freeze||(Object.freeze=t),Object.preventExtensions||(Object.preventExtension=t);var u=function(){return!1},v=function(){return!0};Object.isSealed||(Object.isSealed=u),Object.isFrozen||(Object.isFrozen=u),Object.isExtensible||(Object.isExtensible=v),String.prototype.trim||(String.prototype.trim=function(){return this.trimLeft().trimRight()}),String.prototype.trimRight||(String.prototype.trimRight=function(){return this.replace(/[\t\v\f\s\u00a0\ufeff]+$/,"")}),String.prototype.trimLeft||(String.prototype.trimLeft=function(){return this.replace(/^[\t\v\f\s\u00a0\ufeff]+/,"")}),b.globalsLoaded=!0}),define("pilot/event_emitter",function(a,b,c){var d={};d._emit=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=b&&(a.row=Math.max(0,b-1),a.column=this.getLine(b-1).length);return a},this.insert=function(a,b){if(b.length==0)return a;a=this.$clipPosition(a),this.getLength()<=1&&this.$detectNewLine(b);var c=this.$split(b);if(this.isNewLine(b))var d=this.insertNewLine(a);else if(c.length==1)var d=this.insertInLine(a,b);else{var d=this.insertInLine(a,c[0]);this.insertNewLine(d),c.length>2&&this.insertLines(a.row+1,c.slice(1,c.length-1));var d=this.insertInLine({row:a.row+c.length-1,column:0},c[c.length-1])}return d},this.insertLines=function(a,b){if(b.length==0)return{row:a,column:0};var c=[a,0];c.push.apply(c,b),this.$lines.splice.apply(this.$lines,c);var d=new f(a,0,a+b.length,0),e={action:"insertLines",range:d,lines:b};this._dispatchEvent("change",{data:e});return d.end},this.insertNewLine=function(a){a=this.$clipPosition(a);var b=this.$lines[a.row]||"";this.$lines[a.row]=b.substring(0,a.column),this.$lines.splice(a.row+1,0,b.substring(a.column,b.length));var c={row:a.row+1,column:0},d={action:"insertText",range:f.fromPoints(a,c),text:this.getNewLineCharacter()};this._dispatchEvent("change",{data:d});return c},this.insertInLine=function(a,b){if(b.length==0)return a;var c=this.$lines[a.row]||"";this.$lines[a.row]=c.substring(0,a.column)+b+c.substring(a.column);var d={row:a.row,column:a.column+b.length},e={action:"insertText",range:f.fromPoints(a,d),text:b};this._dispatchEvent("change",{data:e});return d},this.remove=function(a){a.start=this.$clipPosition(a.start),a.end=this.$clipPosition(a.end);if(a.isEmpty())return a.start;var b=a.start.row,c=a.end.row;if(a.isMultiLine()){var d=a.start.column==0?b:b+1,e=c-1;a.end.column>0&&this.removeInLine(c,0,a.end.column),e>=d&&this.removeLines(d,e),d!=b&&(this.removeInLine(b,a.start.column,this.$lines[b].length),this.removeNewLine(a.start.row))}else this.removeInLine(b,a.start.column,a.end.column);return a.start},this.removeInLine=function(a,b,c){if(b!=c){var d=new f(a,b,a,c),e=this.getLine(a),g=e.substring(b,c),h=e.substring(0,b)+e.substring(c,e.length);this.$lines.splice(a,1,h);var i={action:"removeText",range:d,text:g};this._dispatchEvent("change",{data:i});return d.start}},this.removeLines=function(a,b){var c=new f(a,0,b+1,0),d=this.$lines.splice(a,b-a+1),e={action:"removeLines",range:c,nl:this.getNewLineCharacter(),lines:d};this._dispatchEvent("change",{data:e});return d},this.removeNewLine=function(a){var b=this.getLine(a),c=this.getLine(a+1),d=new f(a,b.length,a+1,0),e=b+c;this.$lines.splice(a,2,e);var g={action:"removeText",range:d,text:this.getNewLineCharacter()};this._dispatchEvent("change",{data:g})},this.replace=function(a,b){if(b.length==0&&a.isEmpty())return a.start;if(b==this.getTextRange(a))return a.end;this.remove(a);if(b)var c=this.insert(a.start,b);else c=a.start;return c},this.applyDeltas=function(a){for(var b=0;b=0;b--){var c=a[b],d=f.fromPoints(c.range.start,c.range.end);c.action=="insertLines"?this.removeLines(d.start.row,d.end.row-1):c.action=="insertText"?this.remove(d):c.action=="removeLines"?this.insertLines(d.start.row,c.lines):c.action=="removeText"&&this.insert(d.start,c.text)}}}).call(g.prototype),b.Document=g}),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'.",f,d),c=g.empty,f.type=d;for(;;){if(I.id==="/"){bF("/"),I.id!==">"&&bx("Expected '{a}' and instead saw '{b}'.",I,">",I.value);break}if(I.id&&I.id.substr(0,1)===">")break;I.identifier||((I.id==="(end)"||I.id==="(error)")&&bz("Missing '>'.",I),bx("Bad identifier.")),J.white=!0,bK(),a=I.value,J.white=h,bF(),!J.cap&&a!==a.toLowerCase()&&bx("Attribute '{a}' not all lower case.",I,a),a=a.toLowerCase(),bb="",bt(b,a)&&bx("Attribute '{a}' repeated.",I,a),a.slice(0,2)==="on"?(J.on||bx("Avoid HTML event handlers."),ba="scriptstring",bF("="),e=I.id,e!=='"'&&e!=="'"&&bz("Missing quote."),bb=e,i=J.white,J.white=!1,bF(e),bN(),cf("on"),J.white=i,I.id!==e&&bz("Missing close quote on script attribute."),ba="html",bb="",bF(e),g=!1):a==="style"?(ba="scriptstring",bF("="),e=I.id,e!=='"'&&e!=="'"&&bz("Missing quote."),ba="styleproperty",bb=e,bF(e),cD(),ba="html",bb="",bF(e),g=!1):I.id==="="?(bF("="),g=I.value,!I.identifier&&I.id!=='"'&&I.id!=="'"&&I.type!=="(string)"&&I.type!=="(number)"&&I.type!=="(color)"&&bx("Expected an attribute value and instead saw '{a}'.",X,a),bF()):g=!0,b[a]=g,cJ(d,a,g)}cK(d,b),c||R.push(f),ba="outer",bF(">");break;case""&&bz("Missing '{a}'.",I,">"),ba="outer",bF(">");break;case""||I.id==="(end)")break;I.value.indexOf("--")>=0&&bz("Unexpected --."),I.value.indexOf("<")>=0&&bz("Unexpected <."),I.value.indexOf(">")>=0&&bz("Unexpected >.")}ba="outer",bF(">");break;case"(end)":return;default:I.id==="(end)"?bz("Missing '{a}'.",I,""):bF()}if(R&&R.length===0&&(J.adsafe||!J.fragment||I.id==="(end)"))break}I.id!=="(end)"&&bz("Unexpected material after the end.")}function cL(a){return""}function cK(d,e){var g,h=y[d],i;Q=!1,h||bz("Unrecognized tag '<{a}>'.",I,d===d.toLowerCase()?d:d+" (capitalization error)");if(R.length>0){d==="html"&&bz("Too many tags.",X),i=h.parent;if(i)i.indexOf(" "+R[R.length-1].name+" ")<0&&bz("A '<{a}>' must be within '<{b}>'.",X,d,i);else if(!J.adsafe&&!J.fragment){g=R.length;do g<=0&&bz("A '<{a}>' must be within '<{b}>'.",X,d,"body"),g-=1;while(R[g].name!=="body")}}switch(d){case"div":J.adsafe&&R.length===1&&!a&&bx("ADSAFE violation: missing ID_.");break;case"script":ba="script",bF(">"),e.lang&&bx("lang is deprecated.",X),J.adsafe&&R.length!==1&&bx("ADsafe script placement violation.",X),e.src?(J.adsafe&&(!b||!f[e.src])&&bx("ADsafe unapproved script source.",X),e.type&&bx("type is unnecessary.",X)):(c&&bz("ADsafe script violation.",X),bN(),cf("script")),ba="html",bF(""),cH(),ba="html",bF("=0&&bx("Unexpected character '{a}' in {b}.",X,d.charAt(f),c),z[e]=!0):c==="class"||c==="type"||c==="name"?(f=d.search(bp),f>=0&&bx("Unexpected character '{a}' in {b}.",X,d.charAt(f),c),z[e]=!0):c!=="href"&&c!=="background"&&c!=="content"&&c!=="data"&&c.indexOf("src")<0&&c.indexOf("url")<0?c==="for"?J.adsafe&&(a?d.slice(0,a.length)!==a?bx("ADsafe violation: An id must have a '{a}' prefix",I,a):/^[A-Z]+_[A-Z]+$/.test(d)||bx("ADSAFE violation: bad id."):bx("ADSAFE violation: bad id.")):c==="name"&&(J.adsafe&&d.indexOf("_")>=0&&bx("ADsafe name violation.")):(J.safe&&bm.test(d)&&bz("ADsafe URL violation."),Y.push(d))}function cI(a){a!=="html"&&!J.fragment&&(a==="div"&&J.adsafe?bz("ADSAFE: Use the fragment option."):bz("Expected '{a}' and instead saw '{b}'.",X,"html",a)),J.adsafe&&(a==="html"&&bz("Currently, ADsafe does not operate on whole HTML documents. It operates on
    fragments and .js files.",X),J.fragment?a!=="div"&&bz("ADsafe violation: Wrap the widget in a div.",X):bz("Use the fragment option.",X)),J.browser=!0,bv()}function cH(){var a;while(I.id==="@"){a=bE(),bF("@");if(I.identifier)switch(I.value){case"import":bF(),cz()||(bx("Expected '{a}' and instead saw '{b}'.",I,"url",I.value),bF()),bM();break;case"media":bF();for(;;){(!I.identifier||q[I.value]===!0)&&bz("Expected a CSS media type, and instead saw '{a}'.",I,I.id),bF();if(I.id!==",")break;bL()}bF("{"),cG(),bF("}");break;default:bx("Expected an at-rule, and instead saw @{a}.",I,I.value)}else bx("Expected an at-rule, and instead saw '{a}'.",I,I.value)}cG()}function cG(){while(I.id!=="":case"+":bF(),cE();break;case":":bF(":");switch(I.value){case"active":case"after":case"before":case"checked":case"disabled":case"empty":case"enabled":case"first-child":case"first-letter":case"first-line":case"first-of-type":case"focus":case"hover":case"last-child":case"last-of-type":case"link":case"only-of-type":case"root":case"target":case"visited":bF();break;case"lang":bF(),bF("("),I.identifier||bx("Expected a lang code, and instead saw :{a}.",I,I.value),bF(")");break;case"nth-child":case"nth-last-child":case"nth-last-of-type":case"nth-of-type":bF(),bF("("),cC(),bF(")");break;case"not":bF(),bF("("),I.id===":"&&bE(0).value==="not"&&bx("Nested not."),cE(),bF(")");break;default:bx("Expected a pseudo, and instead saw :{a}.",I,I.value)}break;case"#":bF("#"),I.identifier||bx("Expected an id, and instead saw #{a}.",I,I.value),bF();break;case"*":bF("*");break;case".":bF("."),I.identifier||bx("Expected a class, and instead saw #.{a}.",I,I.value),bF();break;case"[":bF("["),I.identifier||bx("Expected an attribute, and instead saw [{a}].",I,I.value),bF();if(I.id==="="||I.value==="~="||I.value==="$="||I.value==="|="||I.id==="*="||I.id==="^=")bF(),I.type!=="(string)"&&bx("Expected a string, and instead saw {a}.",I,I.value),bF();bF("]");break;default:bz("Expected a CSS selector, and instead saw {a}.",I,I.value)}}function cD(){var a;for(;;){if(I.id==="}"||I.id==="(end)"||bb&&I.id===bb)return;while(I.id===";")bx("Misplaced ';'."),bF(";");a=cA(),bF(":"),I.identifier&&I.value==="inherit"?bF():cB(a)||(bx("Unexpected token '{a}'.",I,I.value),bF()),I.id==="!"&&(bF("!"),bJ(),I.identifier&&I.value==="important"?bF():bx("Expected '{a}' and instead saw '{b}'.",I,"important",I.value)),I.id==="}"||I.id===bb?bx("Missing '{a}'.",I,";"):bM()}}function cC(){if(I.id==="(number)")bF(),I.value==="n"&&I.identifier&&(bJ(),bF(),I.id==="+"&&(bJ(),bF("+"),bJ(),bF("(number)")));else{if(I.identifier&&(I.value==="odd"||I.value==="even")){bF();return}bx("Unexpected token '{a}'.",I,I.value)}}function cB(a){var b=0,c,d,e,f,g=0,h;switch(typeof a){case"function":return a();case"string":if(I.identifier&&I.value===a){bF();return!0}return!1}for(;;){if(b>=a.length)return!1;h=a[b],b+=1;if(h===!0)break;typeof h==="number"?(c=h,h=a[b],b+=1):c=1,e=!1;while(c>0)if(cB(h))e=!0,c-=1;else break;if(e)return!0}g=b,d=[];for(;;){f=!1;for(b=g;b=0&&bx("Bad url string."));b||bx("Missing url."),bF(),J.safe&&bm.test(b)&&bz("ADsafe URL violation."),Y.push(b);return!0}return!1}function cy(){var a;if(I.identifier&&I.value==="rect"){bF(),bF("(");for(a=0;a<4;a+=1)if(!cr()){bx("Expected a number and instead saw '{a}'.",I,I.value);break}bF(")");return!0}return!1}function cx(){if(I.identifier&&I.value==="counter"){bF(),bF("("),bF(),I.id===","&&(bL(),I.type!=="(string)"&&bx("Expected a string and instead saw '{a}'.",I,I.value),bF()),bF(")");return!0}if(I.identifier&&I.value==="counters"){bF(),bF("("),I.identifier||bx("Expected a name and instead saw '{a}'.",I,I.value),bF(),I.id===","&&(bL(),I.type!=="(string)"&&bx("Expected a string and instead saw '{a}'.",I,I.value),bF()),I.id===","&&(bL(),I.type!=="(string)"&&bx("Expected a string and instead saw '{a}'.",I,I.value),bF()),bF(")");return!0}return!1}function cw(){while(I.id!==";"){!cn()&&!cp()&&bx("Expected a name and instead saw '{a}'.",I,I.value);if(I.id!==",")return!0;bL()}}function cv(){if(I.identifier&&I.value==="attr"){bF(),bF("("),I.identifier||bx("Expected a name and instead saw '{a}'.",I,I.value),bF(),bF(")");return!0}return!1}function cu(){if(!I.identifier)return cr();if(I.value==="auto"){bF();return!0}}function ct(){if(!I.identifier)return cr();switch(I.value){case"thin":case"medium":case"thick":bF();return!0}}function cs(){I.id==="-"&&(bF("-"),bJ());if(I.type==="(number)"){bF(),I.type!=="(string)"&&p[I.value]===!0&&(bJ(),bF());return!0}return!1}function cr(){I.id==="-"&&(bF("-"),bJ());if(I.type==="(number)"){bF(),I.type!=="(string)"&&p[I.value]===!0?(bJ(),bF()):+X.value!==0&&bx("Expected a linear unit and instead saw '{a}'.",I,I.value);return!0}return!1}function cq(){var a,b,c;if(I.identifier){c=I.value;if(c==="rgb"||c==="rgba"){bF(),bF("(");for(a=0;a<3;a+=1)a&&bL(),b=I.value,I.type!=="(number)"||b<0?(bx("Expected a positive number and instead saw '{a}'",I,b),bF()):(bF(),I.id==="%"?(bF("%"),b>100&&bx("Expected a percentage and instead saw '{a}'",X,b)):b>255&&bx("Expected a small number and instead saw '{a}'",X,b));c==="rgba"&&(bL(),b=+I.value,(I.type!=="(number)"||b<0||b>1)&&bx("Expected a number between 0 and 1 and instead saw '{a}'",I,b),bF(),I.id==="%"&&(bx("Unexpected '%'."),bF("%"))),bF(")");return!0}if(m[I.value]===!0){bF();return!0}}else if(I.type==="(color)"){bF();return!0}return!1}function cp(){if(I.type==="(string)"){bF();return!0}}function co(){I.id==="-"&&(bF("-"),bJ());if(I.type==="(number)"){bF("(number)");return!0}}function cn(){if(I.identifier){bF();return!0}}function cm(){function b(){var a=I;bF("[");if(I.id!=="]")for(;;){if(I.id==="(end)")bz("Missing ']' to match '[' from line {a}.",I,a.line);else{if(I.id==="]"){bx("Unexpected comma.",X);break}I.id===","&&bz("Unexpected comma.",I)}cm();if(I.id!==",")break;bF(",")}bF("]")}function a(){var a={},b=I;bF("{");if(I.id!=="}")for(;;){if(I.id==="(end)")bz("Missing '}' to match '{' from line {a}.",I,b.line);else{if(I.id==="}"){bx("Unexpected comma.",X);break}I.id===","?bz("Unexpected comma.",I):I.id!=="(string)"&&bx("Expected a string and instead saw {a}.",I,I.value)}a[I.value]===!0?bx("Duplicate key '{a}'.",I,I.value):I.value==="__proto__"?bx("Stupid key '{a}'.",I,I.value):a[I.value]=!0,bF(),bF(":"),cm();if(I.id!==",")break;bF(",")}bF("}")}switch(I.id){case"{":a();break;case"[":b();break;case"true":case"false":case"null":case"(number)":case"(string)":bF();break;case"-":bF("-"),X.thru!==I.from&&bx("Unexpected space after '-'.",X),bJ(),bF("(number)");break;default:bz("Expected a JSON value.",I)}}function cl(a,b){var c=P;P=Object.create(c),u={"(name)":b||'"'+e+'"',"(line)":I.line,"(context)":u,"(breakage)":0,"(loopage)":0,"(scope)":P,"(token)":a},X.funct=u,w.push(u),b&&bC(b,"function"),a.name=b||"",a.first=u["(params)"]=ck(),a.block=cg(!1),P=c,u["(last)"]=X.line,u=u["(context)"];return a}function ck(){var a,b=I,c=[];bF("("),bI();if(I.id===")")bI(),bF(")");else for(;;){a=cd(),c.push(a),bC(a,"parameter");if(I.id===",")bL();else{bI(),bF(")",b);return c}}}function cj(){var a=cc(!0);a||(I.id==="(string)"?(a=I.value,J.adsafe&&(a.charAt(0)==="_"||a.charAt(a.length-1)==="_")&&bx("Unexpected {a} in '{b}'.",X,"dangling '_'",a),bF()):I.id==="(number)"&&(a=I.value.toString(),bF()));return a}function ci(a){var b=a.value,c=a.line,d=A[b];typeof d==="function"&&(d=!1),d?d[d.length-1]!==c&&d.push(c):(d=[c],A[b]=d)}function ch(a){H&&typeof H[a]!=="boolean"&&bx("Unexpected /*member '{a}'.",X,a),typeof G[a]==="number"?G[a]+=1:G[a]=1}function cg(a){var b,c=B,d=U,e=P,f;B=a,P=Object.create(P),bK(),f=I,I.id==="{"?(bF("{"),!a&&!bN()&&!d&&J.strict&&u["(context)"]["(global)"]&&bx('Missing "use strict" statement.'),b=cf(),U=d,bF("}",f)):a?(bx("Expected '{a}' and instead saw '{b}'.",I,"{",I.value),b=[ce()],b[0].disrupt&&(b.disrupt=!0)):bz("Expected '{a}' and instead saw '{b}'.",I,"{",I.value),u["(verb)"]=null,P=e,B=c,a&&b.length===0&&bx("Empty block.");return b}function cf(c){var d=[],e,f,g,h;if(J.adsafe)switch(c){case"script":b||(I.value!=="ADSAFE"||bE(0).id!=="."||bE(1).value!=="id"&&bE(1).value!=="go")&&bz("ADsafe violation: Missing ADSAFE.id or ADSAFE.go.",I),I.value==="ADSAFE"&&bE(0).id==="."&&bE(1).value==="id"&&(b&&bz("ADsafe violation.",I),bF("ADSAFE"),bF("."),bF("id"),bF("("),I.value!==a&&bz("ADsafe violation: id does not match.",I),bF("(string)"),bF(")"),bM(),b=!0);break;case"lib":if(I.value==="ADSAFE"){bF("ADSAFE"),bF("."),bF("lib"),bF("("),bF("(string)"),bL(),f=bO(0),f.id!=="function"&&bz("The second argument to lib must be a function.",f),g=f.funct["(params)"],g=g&&g.join(", "),g&&g!=="lib"&&bz("Expected '{a}' and instead saw '{b}'.",f,"(lib)","("+g+")"),bF(")"),bM();return d}bz("ADsafe lib violation.")}while(K[I.id]!==!0)I.id===";"?(bx("Unnecessary semicolon."),bF(";")):(e&&(bx("Unreachable '{a}' after '{b}'.",I,I.value,e.value),e=null),h=ce(),d.push(h),h.disrupt&&(e=h,d.disrupt=!0));return d}function ce(a){var b,c=P,d=I;if(d.id===";")bx("Unnecessary semicolon.",d),bF(";");else{d.identifier&&!d.reserved&&bE().id===":"&&(bF(),bF(":"),P=Object.create(c),bC(d.value,"label"),D[I.id]!==!0&&bx("Label '{a}' on '{b}' statement.",I,d.value,I.value),bl.test(d.value+":")&&bx("Label '{a}' looks like a javascript url.",d,d.value),I.label=d.value,d=I),b=bO(0,!0),b.arity==="statement"?b.id==="switch"||b.block&&b.id!=="do"?bK():bM():(b.id==="("&&b.first.id==="new"?bx("Do not use 'new' for side effects."):!b.assign&&b.id!=="delete"&&b.id!=="++"&&b.id!=="--"&&b.id!=="("&&bx("Expected an assignment or function call and instead saw an expression.",X),I.id!==";"?by("Missing semicolon.",X.line,X.from+X.value.length):bM()),P=c;return b}}function cd(){var a=cc();if(a)return a;X.id==="function"&&I.id==="("?bx("Missing name in function statement."):bz("Expected an identifier and instead saw '{a}'.",I,I.value)}function cc(){if(I.identifier){bF(),J.safe&&h[X.value]?bx("ADsafe violation: '{a}'.",X,X.value):X.reserved&&!J.es5&&bx("Expected an identifier and instead saw '{a}' (a reserved word).",X,X.id);return X.value}}function cb(a,b){var c=bP(a,150);c.led=function(a){bJ(N,X),J.plusplus?bx("Unexpected use of '{a}'.",this,this.id):(!a.identifier||a.reserved)&&a.id!=="."&&a.id!=="["&&bx("Bad operand.",this),this.first=a,this.arity="suffix";return this};return c}function ca(a,b){return bZ(a,b,function(a,c){J.bitwise&&bx("Unexpected use of '{a}'.",c,c.id),c.first=a,c.second=bO(b);return c})}function b_(a,b){var c=bZ(a,20,function(a,c){var d;J.bitwise&&b&&bx("Unexpected use of '{a}'.",c,c.id),c.first=a,L[a.value]===!1&&P[a.value]["(global)"]===!0?bx("Read only.",a):a["function"]&&bx("'{a}' is a function.",a,a.value);if(J.safe){d=a;do typeof L[d.value]==="boolean"&&bx("ADsafe violation.",d),d=d.first;while(d)}if(a){if(a.id==="."||a.id==="["){(!a.first||a.first.value==="arguments")&&bx("Bad assignment.",c),c.second=bO(19);return c}if(a.identifier&&!a.reserved){u[a.value]==="exception"&&bx("Do not assign to the exception parameter.",a),c.second=bO(19);return c}a===V["function"]&&bx("Expected an identifier in an assignment and instead saw a function invocation.",X)}bz("Bad assignment.",c)});c.assign=!0;return c}function b$(a,b){var c=bZ(a,100,function(a,c){var d=bO(100);b?bx("Expected '{a}' and instead saw '{b}'.",c,b,c.id):(a.id==="NaN"||d.id==="NaN")&&bx("Use the isNaN function to compare with NaN.",c),a.id==="!"&&bx("Confusing use of '{a}'.",a,"!"),d.id==="!"&&bx("Confusing use of '{a}'.",a,"!"),c.first=a,c.second=d;return c});return c}function bZ(a,b,c,d){var e=bP(a,b);bU(e),e.led=function(a){this.arity="infix",d||(bK(N,X),bK());if(typeof c==="function")return c(a,this);this.first=a,this.second=bO(b);return this};return e}function bY(a,b){return bX(a,function(){typeof b==="function"&&b(this);return this})}function bX(a,b){var c=bW(a,b);c.identifier=c.reserved=!0;return c}function bW(a,b){var c=bQ(a);c.type=a,c.nud=b;return c}function bV(a,b){var c=bP(a,150);bU(c),c.nud=typeof b==="function"?b:function(){a==="typeof"?bH():bJ(),this.first=bO(150),this.arity="prefix";if(this.id==="++"||this.id==="--")J.plusplus?bx("Unexpected use of '{a}'.",this,this.id):(!this.first.identifier||this.first.reserved)&&this.first.id!=="."&&this.first.id!=="["&&bx("Bad operand.",this);return this};return c}function bU(a){var b=a.id.charAt(0);if(b>="a"&&b<="z"||b>="A"&&b<="Z")a.identifier=a.reserved=!0;return a}function bT(a,b){var c=bS(a,b);c.disrupt=!0}function bS(a,b){var c=bQ(a);c.identifier=c.reserved=!0,c.fud=b;return c}function bR(a){var b=bP(a,0);b.from=0,b.thru=0,a.value=a;return b}function bQ(a){return bP(a,0)}function bP(a,b){var c=V[a];if(!c||typeof c!=="object")V[a]=c={id:a,lbp:b,value:a};return c}function bO(a,b){var c;I.id==="(end)"&&bz("Unexpected early end of program.",X),bF(),J.safe&&typeof L[X.value]==="boolean"&&(I.id!=="("&&I.id!==".")&&bx("ADsafe violation.",X),b&&(e="anonymous",u["(verb)"]=X.value);if(b===!0&&X.fud)c=X.fud();else{if(X.nud)c=X.nud();else{if(I.type==="(number)"&&X.id==="."){bx("A leading decimal point can be confused with a dot: '.{a}'.",X,I.value),bF();return X}bz("Expected an identifier and instead saw '{a}'.",X,X.id)}while(a=J.maxerr&&bw("Too many errors.",i,h);return j}function bw(a,b,c){throw{name:"JSLintError",line:b,character:c,message:a+" ("+Math.floor(b/E.length*100)+"% scanned)."}}function bv(){J.safe||(J.rhino&&bu(L,O),J.devel&&bu(L,s),J.browser&&bu(L,j),J.windows&&bu(L,_),J.widget&&bu(L,$))}function bu(a,b){var c;for(c in b)bt(b,c)&&(a[c]=b[c])}function bt(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function bs(){}var a,b,c,e,f,g={"<":!0,"<=":!0,"==":!0,"===":!0,"!==":!0,"!=":!0,">":!0,">=":!0,"+":!0,"-":!0,"*":!0,"/":!0,"%":!0},h={arguments:!0,callee:!0,caller:!0,constructor:!0,eval:!0,prototype:!0,stack:!0,unwatch:!0,valueOf:!0,watch:!0},i={adsafe:!0,bitwise:!0,browser:!0,cap:!0,css:!0,debug:!0,devel:!0,es5:!0,evil:!0,forin:!0,fragment:!0,newcap:!0,nomen:!0,on:!0,onevar:!0,passfail:!0,plusplus:!0,regexp:!0,rhino:!0,undef:!0,safe:!0,windows:!0,strict:!0,sub:!0,white:!0,widget:!0},j={addEventListener:!1,blur:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,defaultStatus:!1,document:!1,event:!1,focus:!1,frames:!1,getComputedStyle:!1,history:!1,Image:!1,length:!1,location:!1,moveBy:!1,moveTo:!1,name:!1,navigator:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,opener:!1,Option:!1,parent:!1,print:!1,removeEventListener:!1,resizeBy:!1,resizeTo:!1,screen:!1,scroll:!1,scrollBy:!1,scrollTo:!1,setInterval:!1,setTimeout:!1,status:!1,top:!1,XMLHttpRequest:!1},k,l,m={aliceblue:!0,antiquewhite:!0,aqua:!0,aquamarine:!0,azure:!0,beige:!0,bisque:!0,black:!0,blanchedalmond:!0,blue:!0,blueviolet:!0,brown:!0,burlywood:!0,cadetblue:!0,chartreuse:!0,chocolate:!0,coral:!0,cornflowerblue:!0,cornsilk:!0,crimson:!0,cyan:!0,darkblue:!0,darkcyan:!0,darkgoldenrod:!0,darkgray:!0,darkgreen:!0,darkkhaki:!0,darkmagenta:!0,darkolivegreen:!0,darkorange:!0,darkorchid:!0,darkred:!0,darksalmon:!0,darkseagreen:!0,darkslateblue:!0,darkslategray:!0,darkturquoise:!0,darkviolet:!0,deeppink:!0,deepskyblue:!0,dimgray:!0,dodgerblue:!0,firebrick:!0,floralwhite:!0,forestgreen:!0,fuchsia:!0,gainsboro:!0,ghostwhite:!0,gold:!0,goldenrod:!0,gray:!0,green:!0,greenyellow:!0,honeydew:!0,hotpink:!0,indianred:!0,indigo:!0,ivory:!0,khaki:!0,lavender:!0,lavenderblush:!0,lawngreen:!0,lemonchiffon:!0,lightblue:!0,lightcoral:!0,lightcyan:!0,lightgoldenrodyellow:!0,lightgreen:!0,lightpink:!0,lightsalmon:!0,lightseagreen:!0,lightskyblue:!0,lightslategray:!0,lightsteelblue:!0,lightyellow:!0,lime:!0,limegreen:!0,linen:!0,magenta:!0,maroon:!0,mediumaquamarine:!0,mediumblue:!0,mediumorchid:!0,mediumpurple:!0,mediumseagreen:!0,mediumslateblue:!0,mediumspringgreen:!0,mediumturquoise:!0,mediumvioletred:!0,midnightblue:!0,mintcream:!0,mistyrose:!0,moccasin:!0,navajowhite:!0,navy:!0,oldlace:!0,olive:!0,olivedrab:!0,orange:!0,orangered:!0,orchid:!0,palegoldenrod:!0,palegreen:!0,paleturquoise:!0,palevioletred:!0,papayawhip:!0,peachpuff:!0,peru:!0,pink:!0,plum:!0,powderblue:!0,purple:!0,red:!0,rosybrown:!0,royalblue:!0,saddlebrown:!0,salmon:!0,sandybrown:!0,seagreen:!0,seashell:!0,sienna:!0,silver:!0,skyblue:!0,slateblue:!0,slategray:!0,snow:!0,springgreen:!0,steelblue:!0,tan:!0,teal:!0,thistle:!0,tomato:!0,turquoise:!0,violet:!0,wheat:!0,white:!0,whitesmoke:!0,yellow:!0,yellowgreen:!0,activeborder:!0,activecaption:!0,appworkspace:!0,background:!0,buttonface:!0,buttonhighlight:!0,buttonshadow:!0,buttontext:!0,captiontext:!0,graytext:!0,highlight:!0,highlighttext:!0,inactiveborder:!0,inactivecaption:!0,inactivecaptiontext:!0,infobackground:!0,infotext:!0,menu:!0,menutext:!0,scrollbar:!0,threeddarkshadow:!0,threedface:!0,threedhighlight:!0,threedlightshadow:!0,threedshadow:!0,window:!0,windowframe:!0,windowtext:!0},n,o,p={"%":!0,cm:!0,em:!0,ex:!0,"in":!0,mm:!0,pc:!0,pt:!0,px:!0},q,r,s={alert:!1,confirm:!1,console:!1,Debug:!1,opera:!1,prompt:!1},t={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"/":"\\/","\\":"\\\\"},u,v=["closure","exception","global","label","outer","unused","var"],w,x,y={a:{},abbr:{},acronym:{},address:{},applet:{},area:{empty:!0,parent:" map "},article:{},aside:{},audio:{},b:{},base:{empty:!0,parent:" head "},bdo:{},big:{},blockquote:{},body:{parent:" html noframes "},br:{empty:!0},button:{},canvas:{parent:" body p div th td "},caption:{parent:" table "},center:{},cite:{},code:{},col:{empty:!0,parent:" table colgroup "},colgroup:{parent:" table "},command:{parent:" menu "},datalist:{},dd:{parent:" dl "},del:{},details:{},dialog:{},dfn:{},dir:{},div:{},dl:{},dt:{parent:" dl "},em:{},embed:{},fieldset:{},figure:{},font:{},footer:{},form:{},frame:{empty:!0,parent:" frameset "},frameset:{parent:" html frameset "},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},head:{parent:" html "},header:{},hgroup:{},hr:{empty:!0},"hta:application":{empty:!0,parent:" head "},html:{parent:"*"},i:{},iframe:{},img:{empty:!0},input:{empty:!0},ins:{},kbd:{},keygen:{},label:{},legend:{parent:" details fieldset figure "},li:{parent:" dir menu ol ul "},link:{empty:!0,parent:" head "},map:{},mark:{},menu:{},meta:{empty:!0,parent:" head noframes noscript "},meter:{},nav:{},noframes:{parent:" html body "},noscript:{parent:" body head noframes "},object:{},ol:{},optgroup:{parent:" select "},option:{parent:" optgroup select "},output:{},p:{},param:{empty:!0,parent:" applet object "},pre:{},progress:{},q:{},rp:{},rt:{},ruby:{},samp:{},script:{empty:!0,parent:" body div frame head iframe p pre span "},section:{},select:{},small:{},span:{},source:{},strong:{},style:{parent:" head ",empty:!0},sub:{},sup:{},table:{},tbody:{parent:" table "},td:{parent:" tr "},textarea:{},tfoot:{parent:" table "},th:{parent:" tr "},thead:{parent:" table "},time:{},title:{parent:" head "},tr:{parent:" table tbody thead tfoot "},tt:{},u:{},ul:{},"var":{},video:{}},z,A,B,C,D={"do":!0,"for":!0,"switch":!0,"while":!0},E,F,G,H,I,J,K={"(end)":!0,"(error)":!0,">?>?=?|<([\/=!]|\!(\[|--)?|<=?)?|\^=?|\!=?=?|[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+([xX][0-9a-fA-F]+|\.[0-9]*)?([eE][+\-]?[0-9]+)?)/,bf=/^\s*(['"=>\/&#]|<(?:\/|\!(?:--)?)?|[a-zA-Z][a-zA-Z0-9_\-:]*|[0-9]+|--)/,bg=/[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/,bh=/[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,bi=/[>&]|<[\/!]?|--/,bj=/\*\/|\/\*/,bk=/^([a-zA-Z_$][a-zA-Z0-9_$]*)$/,bl=/^(?:javascript|jscript|ecmascript|vbscript|mocha|livescript)\s*:/i,bm=/&|\+|\u00AD|\.\.|\/\*|%[^;]|base64|url|expression|data|mailto/i,bn=/^\s*([{:#%.=,>+\[\]@()"';]|\*=?|\$=|\|=|\^=|~=|[a-zA-Z_][a-zA-Z0-9_\-]*|[0-9]+|<\/|\/\*)/,bo=/^\s*([@#!"'};:\-%.=,+\[\]()*_]|[a-zA-Z][a-zA-Z0-9._\-]*|\/\*?|\d+(?:\.\d+)?|<\/)/,bp=/[^a-zA-Z0-9+\-_\/ ]/,bq=/[\[\]\/\\"'*<>.&:(){}+=#]/,br={outer:bf,html:bf,style:bn,styleproperty:bo};typeof Array.isArray!=="function"&&(Array.isArray=function(a){return Object.prototype.toString.apply(a)==="[object Array]"}),typeof Object.create!=="function"&&(Object.create=function(a){bs.prototype=a;return new bs}),typeof Object.keys!=="function"&&(Object.keys=function(a){var b=[],c;for(c in a)bt(a,c)&&b.push(c);return b}),typeof String.prototype.entityify!=="function"&&(String.prototype.entityify=function(){return this.replace(/&/g,"&").replace(//g,">")}),typeof String.prototype.isAlpha!=="function"&&(String.prototype.isAlpha=function(){return this>="a"&&this<="z￿"||this>="A"&&this<="Z￿"}),typeof String.prototype.isDigit!=="function"&&(String.prototype.isDigit=function(){return this>="0"&&this<="9"}),typeof String.prototype.supplant!=="function"&&(String.prototype.supplant=function(a){return this.replace(/\{([^{}]*)\}/g,function(b,c){var d=a[c];return typeof d==="string"||typeof d==="number"?d:b})}),typeof String.prototype.name!=="function"&&(String.prototype.name=function(){if(bk.test(this))return this;if(bg.test(this))return'"'+this.replace(bh,function(a){var b=t[a];if(b)return b;return"\\u"+("0000"+a.charCodeAt().toString(16)).slice(-4)})+'"';return'"'+this+'"'});var bB=function bB(){function f(d,e){var f,g;d==="(color)"||d==="(range)"?g={type:d}:d==="(punctuator)"||d==="(identifier)"&&bt(V,e)?g=V[e]||V["(error)"]:g=V[d],g=Object.create(g);if(d==="(string)"||d==="(range)")bl.test(e)&&by("Script URL.",c,b);d==="(identifier)"&&(g.identifier=!0,e==="__iterator__"||e==="__proto__"?bA("Reserved name '{a}'.",c,b,e):J.nomen&&(e.charAt(0)==="_"||e.charAt(e.length-1)==="_")&&by("Unexpected {a} in '{b}'.",c,b,"dangling '_'",e)),e!==undefined&&(g.value=e),g.line=c,g.thru=a,g.from=b,f=g.id,M=f&&("(,=:[!&|?{};".indexOf(f.charAt(f.length-1))>=0||f==="return");return g}function e(){var b;if(c>=E.length)return!1;a=1,d=E[c],c+=1,b=d.search(/ \t/),b>=0&&by("Mixed spaces and tabs.",c,b+1),d=d.replace(/\t/g,W),b=d.search(bd),b>=0&&by("Unsafe character.",c,b),J.maxlen&&J.maxlen=32&&e<=126&&e!==34&&e!==92&&e!==39&&by("Unnecessary escapement.",c,a),a+=b,h=String.fromCharCode(e)}var h,i,j="";C&&g!=='"'&&by("Strings must use doublequote.",c,a);if(bb===g||ba==="scriptstring"&&!bb)return f("(punctuator)",g);i=0;for(;;){while(i>=d.length)i=0,(ba!=="html"||!e())&&bA("Unclosed string.",c,b);h=d.charAt(i);if(h===g){a+=1,d=d.substr(i+1);return f("(string)",j,g)}if(h<" "){if(h==="\n"||h==="\r")break;by("Control character in string: {a}.",c,a+i,d.slice(0,i))}else if(h===bb)by("Bad HTML string",c,a+i);else if(h==="<")J.safe&&ba==="html"?by("ADsafe string violation.",c,a+i):d.charAt(i+1)==="/"&&(ba||J.safe)?by("Expected '<\\/' and instead saw '0){a+=1,d=d.slice(m);break}if(!e())return f("(end)","")}q=r(br[ba]||be);if(q){if(h.isAlpha()||h==="_"||h==="$")return f("(identifier)",q);if(h.isDigit()){ba!=="style"&&!isFinite(Number(q))&&by("Bad number '{a}'.",c,a,q),ba!=="style"&&ba!=="styleproperty"&&d.substr(0,1).isAlpha()&&by("Missing space after '{a}'.",c,a,q),h==="0"&&(j=q.substr(1,1),j.isDigit()?X.id!=="."&&ba!=="styleproperty"&&by("Don't use extra leading zeros '{a}'.",c,a,q):C&&(j==="x"||j==="X")&&by("Avoid 0x-. '{a}'.",c,a,q)),q.substr(q.length-1)==="."&&by("A trailing decimal point can be confused with a dot '{a}'.",c,a,q);return f("(number)",q)}switch(q){case'"':case"'":return s(q);case"//":Q||ba&&ba!=="script"?by("Unexpected comment.",c,a):ba==="script"&&/<\s*\//i.test(d)?by("Unexpected =0)break;e()?J.safe&&bc.test(d)&&by("ADsafe comment violation.",c,a):bA("Unclosed comment.",c,a)}a+=m+2,d.substr(m,1)==="/"&&bA("Nested comment.",c,a),d=d.substr(m+2),X.comment=!0;break;case"/*members":case"/*member":case"/*jslint":case"/*global":case"*/":return{value:q,type:"special",line:c,thru:a,from:b};case"":break;case"/":X.id==="/="&&bA("A regular expression literal can be confused with '/='.",c,b);if(M){k=0,i=0,n=0;for(;;){g=!0,h=d.charAt(n),n+=1;switch(h){case"":bA("Unclosed regular expression.",c,b);return;case"/":k>0&&by("Unescaped '{a}'.",c,b+n,"/"),h=d.substr(0,n-1),p={g:!0,i:!0,m:!0};while(p[d.charAt(n)]===!0)p[d.charAt(n)]=!1,n+=1;a+=n,d=d.substr(n),p=d.charAt(0),(p==="/"||p==="*")&&bA("Confusing regular expression.",c,b);return f("(regexp)",h);case"\\":h=d.charAt(n),h<" "?by("Unexpected control character in regular expression.",c,b+n):h==="<"&&by("Unexpected escaped character '{a}' in regular expression.",c,b+n,h),n+=1;break;case"(":k+=1,g=!1;if(d.charAt(n)==="?"){n+=1;switch(d.charAt(n)){case":":case"=":case"!":n+=1;break;default:by("Expected '{a}' and instead saw '{b}'.",c,b+n,":",d.charAt(n))}}else i+=1;break;case"|":g=!1;break;case")":k===0?by("Unescaped '{a}'.",c,b+n,")"):k-=1;break;case" ":p=1;while(d.charAt(n)===" ")n+=1,p+=1;p>1&&by("Spaces are hard to count. Use {{a}}.",c,b+n,p);break;case"[":h=d.charAt(n),h==="^"&&(n+=1,J.regexp?by("Insecure '{a}'.",c,b+n,h):d.charAt(n)==="]"&&bA("Unescaped '{a}'.",c,b+n,"^")),p=!1,h==="]"&&(by("Empty class.",c,b+n-1),p=!0);klass:do{h=d.charAt(n),n+=1;switch(h){case"[":case"^":by("Unescaped '{a}'.",c,b+n,h),p=!0;break;case"-":p?p=!1:(by("Unescaped '{a}'.",c,b+n,"-"),p=!0);break;case"]":p||by("Unescaped '{a}'.",c,b+n-1,"-");break klass;case"\\":h=d.charAt(n),h<" "?by("Unexpected control character in regular expression.",c,b+n):h==="<"&&by("Unexpected escaped character '{a}' in regular expression.",c,b+n,h),n+=1,p=!0;break;case"/":by("Unescaped '{a}'.",c,b+n-1,"/"),p=!0;break;case"<":ba==="script"&&(h=d.charAt(n),(h==="!"||h==="/")&&by("HTML confusion in regular expression '<{a}'.",c,b+n,h)),p=!0;break;default:p=!0}}while(h);break;case".":J.regexp&&by("Insecure '{a}'.",c,b+n,h);break;case"]":case"?":case"{":case"}":case"+":case"*":by("Unescaped '{a}'.",c,b+n,h);break;case"<":ba==="script"&&(h=d.charAt(n),(h==="!"||h==="/")&&by("HTML confusion in regular expression '<{a}'.",c,b+n,h))}if(g)switch(d.charAt(n)){case"?":case"+":case"*":n+=1,d.charAt(n)==="?"&&(n+=1);break;case"{":n+=1,h=d.charAt(n),(h<"0"||h>"9")&&by("Expected a number and instead saw '{a}'.",c,b+n,h),n+=1,o=+h;for(;;){h=d.charAt(n);if(h<"0"||h>"9")break;n+=1,o=+h+o*10}l=o;if(h===","){n+=1,l=Infinity,h=d.charAt(n);if(h>="0"&&h<="9"){n+=1,l=+h;for(;;){h=d.charAt(n);if(h<"0"||h>"9")break;n+=1,l=+h+l*10}}}d.charAt(n)!=="}"?by("Expected '{a}' and instead saw '{b}'.",c,b+n,"}",h):n+=1,d.charAt(n)==="?"&&(n+=1),o>l&&by("'{a}' should not be greater than '{b}'.",c,b+n,o,l)}}h=d.substr(0,n-1),a+=n,d=d.substr(n);return f("(regexp)",h)}return f("(punctuator)",q);case".",c,a),a+=3,d=d.slice(m+3);break;case"#":if(ba==="html"||ba==="styleproperty"){for(;;){h=d.charAt(0);if((h<"0"||h>"9")&&(h<"a"||h>"f")&&(h<"A"||h>"F"))break;a+=1,d=d.substr(1),q+=h}q.length!==4&&q.length!==7&&by("Bad hex color '{a}'.",c,b+n,q);return f("(color)",q)}return f("(punctuator)",q);default:if(ba==="outer"&&h==="&"){a+=1,d=d.substr(1);for(;;){h=d.charAt(0),a+=1,d=d.substr(1);if(h===";")break;(h<"0"||h>"9")&&(h<"a"||h>"z")&&h!=="#"&&bA("Bad entity",c,b+n,a)}break}return f("(punctuator)",q)}}else{q="",h="";while(d&&d<"!")d=d.substr(1);if(d){if(ba==="html")return f("(error)",d.charAt(0));bA("Unexpected '{a}'.",c,a,d.substr(0,1))}}}}}}();bW("(number)",function(){this.arity="number";return this}),bW("(string)",function(){this.arity="string";return this}),V["(identifier)"]={type:"(identifier)",lbp:0,identifier:!0,nud:function(){var a=this.value,b=P[a],c;typeof b==="function"?b=undefined:typeof b==="boolean"&&(c=u,u=w[0],bC(a,"var"),b=u,u=c);if(u===b)switch(u[a]){case"unused":u[a]="var";break;case"unction":u[a]="function",this["function"]=!0;break;case"function":this["function"]=!0;break;case"label":bx("'{a}' is a statement label.",X,a)}else if(u["(global)"])J.undef&&typeof L[a]!=="boolean"&&bx("'{a}' is not defined.",X,a),ci(X);else switch(u[a]){case"closure":case"function":case"var":case"unused":bx("'{a}' used out of scope.",X,a);break;case"label":bx("'{a}' is a statement label.",X,a);break;case"outer":case"global":break;default:if(b===!0)u[a]=!0;else if(b===null)bx("'{a}' is not allowed.",X,a),ci(X);else if(typeof b!=="object")J.undef?bx("'{a}' is not defined.",X,a):u[a]=!0,ci(X);else switch(b[a]){case"function":case"unction":this["function"]=!0,b[a]="closure",u[a]=b["(global)"]?"global":"outer";break;case"var":case"unused":b[a]="closure",u[a]=b["(global)"]?"global":"outer";break;case"closure":case"parameter":u[a]=b["(global)"]?"global":"outer";break;case"label":bx("'{a}' is a statement label.",X,a)}}return this},led:function(){bz("Expected an operator and instead saw '{a}'.",I,I.value)}},bW("(regexp)",function(){return this}),bR("(begin)"),bR("(end)"),bR("(error)"),bQ(""),bQ("}"),bQ(")"),bQ("]"),bQ('"'),bQ("'"),bQ(";"),bQ(":"),bQ(","),bQ("#"),bQ("@"),bX("else"),bX("case"),bX("catch"),bX("default"),bX("finally"),bY("arguments",function(a){U&&u["(global)"]?bx("Strict violation.",a):J.safe&&bx("ADsafe violation.",a)}),bY("eval",function(a){J.safe&&bx("ADsafe violation.",a)}),bY("false"),bY("Infinity"),bY("NaN"),bY("null"),bY("this",function(a){U&&(u["(statement)"]&&u["(name)"].charAt(0)>"Z"||u["(global)"])?bx("Strict violation.",a):J.safe&&bx("ADsafe violation.",a)}),bY("true"),bY("undefined"),b_("="),b_("+="),b_("-="),b_("*="),b_("/=").nud=function(){bz("A regular expression literal can be confused with '/='.")},b_("%="),b_("&=",!0),b_("|=",!0),b_("^=",!0),b_("<<=",!0),b_(">>=",!0),b_(">>>=",!0),bZ("?",30,function(a,b){b.first=a,b.second=bO(10),bK(),bF(":"),bK(),b.third=bO(10);return b}),bZ("||",40),bZ("&&",50),ca("|",70),ca("^",80),ca("&",90),b$("==","==="),b$("==="),b$("!=","!=="),b$("!=="),b$("<"),b$(">"),b$("<="),b$(">="),ca("<<",120),ca(">>",120),ca(">>>",120),bZ("in",120),bZ("instanceof",120),bZ("+",130,function(a,b){var c=bO(130);if(a&&c&&a.id==="(string)"&&c.id==="(string)"){a.value+=c.value,a.thru=c.thru,bl.test(a.value)&&bx("JavaScript URL.",a);return a}b.first=a,b.second=c;return b}),bV("+","num"),bV("+++",function(){bx("Confusing pluses."),this.first=bO(150),this.arity="prefix";return this}),bZ("+++",130,function(a){bx("Confusing pluses."),this.first=a,this.second=bO(130);return this}),bZ("-",130),bV("-"),bV("---",function(){bx("Confusing minuses."),this.first=bO(150),this.arity="prefix";return this}),bZ("---",130,function(a){bx("Confusing minuses."),this.first=a,this.second=bO(130);return this}),bZ("*",140),bZ("/",140),bZ("%",140),cb("++"),bV("++"),cb("--"),bV("--"),bV("delete",function(){bH();var a=bO(0);(!a||a.id!=="."&&a.id!=="[")&&bx("Only properties should be deleted."),this.first=a;return this}),bV("~",function(){bJ(),J.bitwise&&bx("Unexpected '{a}'.",this,"~"),bO(150);return this}),bV("!",function(){bJ(),this.first=bO(150),this.arity="prefix",g[this.first.id]===!0&&bx("Confusing use of '{a}'.",this,"!");return this}),bV("typeof"),bV("new",function(){bH();var a=bO(160),b;if(a.id!=="function")if(a.identifier)switch(a.value){case"Object":bx("Use the object literal notation {}.",X);break;case"Array":I.id!=="("?bx("Use the array literal notation [].",X):(bF("("),I.id===")"&&bx("Use the array literal notation [].",X),bF(")")),this.first=a;return this;case"Number":case"String":case"Boolean":case"Math":case"JSON":bx("Do not use {a} as a constructor.",X,a.value);break;case"Function":J.evil||bx("The Function constructor is eval.");break;case"Date":case"RegExp":break;default:a.id!=="function"&&(b=a.value.substr(0,1),J.newcap&&(b<"A"||b>"Z")&&bx("A constructor name should start with an uppercase letter.",X))}else a.id!=="."&&a.id!=="["&&a.id!=="("&&bx("Bad constructor.",X);else bx("Weird construction. Delete 'new'.",this);I.id!=="("&&bx("Missing '()' invoking a constructor."),this.first=a;return this}),bZ("(",160,function(a,b){bJ(N,X),!a.immed&&a.id==="function"&&bx("Wrap an immediate function invocation in parentheses to assist the reader in understanding that the expression is the result of a function, and not the function itself.");var c=[];a&&(a.type==="(identifier)"?a.value.match(/^[A-Z]([A-Z0-9_$]*[a-z][A-Za-z0-9_$]*)?$/)&&(a.value!=="Number"&&a.value!=="String"&&a.value!=="Boolean"&&a.value!=="Date"&&(a.value==="Math"?bx("Math is not a function.",a):J.newcap&&bx("Missing 'new' prefix when invoking a constructor.",a))):a.id==="."&&(J.safe&&a.first.value==="Math"&&a.second==="random"&&bx("ADsafe violation.",a)));if(I.id!==")"){bI();for(;;){c.push(bO(10));if(I.id!==",")break;bL()}}bI(),bF(")"),typeof a==="object"&&(a.value==="parseInt"&&c.length===1&&bx("Missing radix parameter.",a),J.evil||(a.value==="eval"||a.value==="Function"||a.value==="execScript"?bx("eval is evil.",a):c[0]&&c[0].id==="(string)"&&(a.value==="setTimeout"||a.value==="setInterval")&&bx("Implied eval is evil. Pass a function instead of a string.",a)),!a.identifier&&a.id!=="."&&a.id!=="["&&a.id!=="("&&a.id!=="&&"&&a.id!=="||"&&a.id!=="?"&&bx("Bad invocation.",a)),b.first=a,b.second=c;return b},!0),bV("(",function(){bI(),I.id==="function"&&(I.immed=!0);var a=bO(0);bI(),bF(")",this),a.id==="function"&&(I.id==="("?bx("Move the invocation into the parens that contain the function.",I):bx("Do not wrap function literals in parens unless they are to be immediately invoked.",this));return a}),bZ(".",170,function(d,e){bI(N,X),bI();var f=cd();typeof f==="string"&&ch(f),e.first=d,e.second=f,!d||d.value!=="arguments"||f!=="callee"&&f!=="caller"?J.evil||!d||d.value!=="document"||f!=="write"&&f!=="writeln"?J.adsafe&&(d&&d.value==="ADSAFE"&&(f==="id"||f==="lib"?bx("ADsafe violation.",e):f==="go"&&(ba!=="script"?bx("ADsafe violation.",e):(c||I.id!=="("||bE(0).id!=="(string)"||bE(0).value!==a||bE(1).id!==",")&&bz("ADsafe violation: go.",e),c=!0,b=!1))):bx("document.write can be a form of eval.",d):bx("Avoid arguments.{a}.",d,f);if(J.evil||f!=="eval"&&f!=="execScript"){if(J.safe)for(;;){h[f]===!0&&bx("ADsafe restricted word '{a}'.",X,f);if(typeof L[d.value]!=="boolean"||I.id==="(")break;if(T[f]===!0){I.id==="."&&bx("ADsafe violation.",e);break}if(I.id!=="."){bx("ADsafe violation.",e);break}bF("."),X.first=e,X.second=f,e=X,f=cd(),typeof f==="string"&&ch(f)}}else bx("eval is evil.");return e},!0),bZ("[",170,function(a,b){bJ(N,X),bI();var c=bO(0),d;if(c&&c.type==="(string)")J.safe&&h[c.value]===!0?bx("ADsafe restricted word '{a}'.",b,c.value):J.evil||c.value!=="eval"&&c.value!=="execScript"?J.safe&&(c.value.charAt(0)==="_"||c.value.charAt(0)==="-")&&bx("ADsafe restricted subscript '{a}'.",b,c.value):bx("eval is evil.",b),ch(c.value),!J.sub&&bk.test(c.value)&&(d=V[c.value],(!d||!d.reserved)&&bx("['{a}'] is better written in dot notation.",c,c.value));else if(!c||c.type!=="(number)"||c.value<0)J.safe&&bx("ADsafe subscripting.");bF("]",b),bI(N,X),b.first=a,b.second=c;return b},!0),bV("[",function(){this.first=[];while(I.id!=="(end)"){while(I.id===",")bx("Extra comma."),bF(",");if(I.id==="]")break;this.first.push(bO(10));if(I.id!==",")break;bL();if(I.id==="]"&&!J.es5){bx("Extra comma.",X);break}}bF("]",this);return this},170),bV("{",function(){var a,b,c,d,e,f,g={},h;this.arity="prefix",this.first=[];while(I.id!=="}"){I.value==="get"&&bE().id!==":"?(J.es5||bx("get/set are ES5 features."),a=I,bG(),bF("get"),d=I,b=cj(),b||bz("Missing property name."),cl(a,""),u["(loopage)"]&&bx("Don't make functions within a loop.",h),e=a.first,e&&bx("Unexpected parameter '{a}' in get {b} function.",h,e[0],b),bL(),f=I,bK(),bF("set"),bG(),c=cj(),b!==c&&bz("Expected '{a}' and instead saw '{b}'.",X,b,c),cl(f,""),e=f.first,(!e||e.length!==1||e[0]!=="value")&&bx("Expected (value) in set {a} function.",h,b),d.first=[a,f]):(d=I,b=cj(),typeof b!=="string"&&bz("Missing property name."),bF(":"),bK(),d.first=bO(10)),this.first.push(d),g[b]===!0&&bx("Duplicate member '{a}'.",I,b),g[b]=!0,ch(b);if(I.id!==",")break;for(;;){bL();if(I.id!==",")break;bx("Extra comma.")}I.id==="}"&&!J.es5&&bx("Extra comma.",X)}bF("}",this);return this}),bS("{",function(){bx("Expected to see a statement and instead saw a block."),this.arity="statement",this.block=cf(),this.disrupt=this.block.disrupt,bF("}");return this}),bS("var",function(){var a,b,c;u["(onevar)"]&&J.onevar?bx("Too many var statements."):u["(global)"]||(u["(onevar)"]=!0),this.arity="statement",this.first=[];for(;;){bK(),c=I,b=cd(),u["(global)"]&&L[b]===!1&&bx("Redefinition of '{a}'.",X,b),bC(b,"unused"),I.id==="="?(a=I,a.first=c,bK(),bF("="),bK(),I.id==="undefined"&&bx("It is not necessary to initialize '{a}' to 'undefined'.",X,b),bE(0).id==="="&&I.identifier&&bz("Variable {a} was not declared correctly.",I,I.value),a.second=bO(0),a.arity="infix",this.first.push(a)):this.first.push(c);if(I.id!==",")break;bL()}return this}),bS("function",function(){bH(),B&&bx("Function statements should not be placed in blocks. Use a function expression or move the statement to the top of the outer function.",X);var a=cd();a&&(bC(a,"unction"),bJ()),cl(this,a,!0),I.id==="("&&I.line===X.line&&bz("Function statements are not invocable. Wrap the whole function invocation in parens."),this.arity="statement";return this}),bV("function",function(){bH();var a=cc();a&&bJ(),cl(this,a),u["(loopage)"]&&bx("Don't make functions within a loop."),this.arity="function";return this}),bS("if",function(){var a=I;bH(),bF("("),bI(),this.arity="statement",this.first=bO(20),I.id==="="&&(bx("Expected a conditional expression and instead saw an assignment."),bF("="),bO(20)),bI(),bF(")",a),bG(),this.block=cg(!0),I.id==="else"&&(bH(),bF("else"),bG(),this["else"]=I.id==="if"||I.id==="switch"?ce(!0):cg(!0),this["else"].disrupt&&this.block.disrupt&&(this.disrupt=!0));return this}),bS("try",function(){var a,b,c,d;J.adsafe&&bx("ADsafe try violation.",this),bG(),this.arity="statement",this.block=cg(!1),I.id==="catch"&&(bH(),bF("catch"),bH(),bF("("),bJ(),c=P,P=Object.create(c),b=I.value,this.first=b,I.type!=="(identifier)"?bx("Expected an identifier and instead saw '{a}'.",I,b):bC(b,"exception"),bF(),bJ(),bF(")"),bH(),this.second=cg(!1),a=!0,P=c),I.id==="finally"?(bH(),d=I,bF("finally"),bH(),this.third=cg(!1)):a||bz("Expected '{a}' and instead saw '{b}'.",I,"catch",I.value);return this}),bS("while",function(){bH();var a=I;u["(breakage)"]+=1,u["(loopage)"]+=1,bF("("),bI(),this.arity="statement",this.first=bO(20),I.id==="="&&(bx("Expected a conditional expression and instead saw an assignment."),bF("="),bO(20)),bI(),bF(")",a),bG(),this.block=cg(!0),this.block.disrupt&&bx("Strange loop.",N),u["(breakage)"]-=1,u["(loopage)"]-=1;return this}),bX("with"),bS("switch",function(){var a=!0,b,c=I;u["(breakage)"]+=1,bH(),bF("("),bI(),this.arity="statement",this.first=bO(20),bI(),bF(")",c),bG(),bF("{"),this.second=[];while(I.id==="case"){c=I,c.first=[];do bK(),bF("case"),bH(),c.first.push(bO(0)),bJ(),bF(":");while(I.id==="case");bK(),c.second=cf(),c.second&&c.second.length>0?(b=c.second[c.second.length-1],b.disrupt?b.id==="break"&&(a=!1):bx("Missing break after case.")):bx("Empty case"),this.second.push(c)}this.second.length===0&&bx("switch without cases."),I.id==="default"&&(bK(),c=I,bF("default"),bJ(),bF(":"),bK(),c.second=cf(),c.second&&c.second.length>0&&(b=c.second[c.second.length-1],a&&b.disrupt&&b.id!=="break"&&(this.disrupt=!0)),this.second.push(c)),u["(breakage)"]-=1,bK(),bF("}");return this}),bS("debugger",function(){J.debug||bx("All 'debugger' statements should be removed."),this.arity="statement";return this}),bS("do",function(){u["(breakage)"]+=1,u["(loopage)"]+=1,bG(),this.arity="statement",this.block=cg(!0),this.block.disrupt&&bx("Strange loop.",N),bH(),bF("while");var a=I;bG(),bF("("),bI(),this.first=bO(0),this.first.id==="="&&bx("Expected a conditional expression and instead saw an assignment."),bI(),bF(")",a),u["(breakage)"]-=1,u["(loopage)"]-=1;return this}),bS("for",function(){var a=J.forin,b,c,d=I,e;this.arity="statement",u["(breakage)"]+=1,u["(loopage)"]+=1,bF("("),bK(this,d),bI();if(bE(0).id==="in"){e=I;switch(u[e.value]){case"unused":u[e.value]="var";break;case"var":break;default:bx("Bad for in variable '{a}'.",e,e.value)}bF(),b=I,bF("in"),b.first=e,b.second=bO(20),bF(")",d),this.first=b,c=cg(!0),!a&&(c.length>1||typeof c[0]!=="object"||c[0].value!=="if")&&bx("The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.",this)}else{if(I.id!==";"){this.first=[];for(;;){this.first.push(bO(0,"for"));if(I.id!==",")break;bL()}}bM(),I.id!==";"&&(this.second=bO(20),this.second.id==="="&&bx("Expected a conditional expression and instead saw an assignment.")),bM(X),I.id===";"&&bz("Expected '{a}' and instead saw '{b}'.",I,")",";");if(I.id!==")"){this.third=[];for(;;){this.third.push(bO(0,"for"));if(I.id!==",")break;bL()}}bI(),bF(")",d),bG(),c=cg(!0)}c.disrupt&&bx("Strange loop.",N),this.block=c,u["(breakage)"]-=1,u["(loopage)"]-=1;return this}),bT("break",function(){var a=I.value;this.arity="statement",u["(breakage)"]===0&&bx("Unexpected '{a}'.",I,this.value),I.identifier&&X.line===I.line&&(bG(),u[a]!=="label"?bx("'{a}' is not a label.",I,a):P[a]!==u&&bx("'{a}' is out of scope.",I,a),this.first=I,bF());return this}),bT("continue",function(){var a=I.value;this.arity="statement",u["(breakage)"]===0&&bx("Unexpected '{a}'.",I,this.value),I.identifier&&X.line===I.line&&(bG(),u[a]!=="label"?bx("'{a}' is not a label.",I,a):P[a]!==u&&bx("'{a}' is out of scope.",I,a),this.first=I,bF());return this}),bT("return",function(){this.arity="statement",I.id!==";"&&I.line===X.line&&(bG(),(I.id==="/"||I.id==="(regexp)")&&bx("Wrap the /regexp/ literal in parens to disambiguate the slash operator."),this.first=bO(20));return this}),bT("throw",function(){this.arity="statement",bG(),this.first=bO(20);return this}),bX("void"),bX("class"),bX("const"),bX("enum"),bX("export"),bX("extends"),bX("import"),bX("super"),bX("let"),bX("yield"),bX("implements"),bX("interface"),bX("package"),bX("private"),bX("protected"),bX("public"),bX("static"),l=[cz,function(){for(;;)if(I.identifier)switch(I.value.toLowerCase()){case"url":cz();break;case"expression":bx("Unexpected expression '{a}'.",I,I.value),bF();break;default:bF()}else{if(I.id===";"||I.id==="!"||I.id==="(end)"||I.id==="}")return!0;bF()}}],n=["none","dashed","dotted","double","groove","hidden","inset","outset","ridge","solid"],o=["auto","always","avoid","left","right"],q={all:!0,braille:!0,embossed:!0,handheld:!0,print:!0,projection:!0,screen:!0,speech:!0,tty:!0,tv:!0},r=["auto","hidden","scroll","visible"],k={background:[!0,"background-attachment","background-color","background-image","background-position","background-repeat"],"background-attachment":["scroll","fixed"],"background-color":["transparent",cq],"background-image":["none",cz],"background-position":[2,[cr,"top","bottom","left","right","center"]],"background-repeat":["repeat","repeat-x","repeat-y","no-repeat"],border:[!0,"border-color","border-style","border-width"],"border-bottom":[!0,"border-bottom-color","border-bottom-style","border-bottom-width"],"border-bottom-color":cq,"border-bottom-style":n,"border-bottom-width":ct,"border-collapse":["collapse","separate"],"border-color":["transparent",4,cq],"border-left":[!0,"border-left-color","border-left-style","border-left-width"],"border-left-color":cq,"border-left-style":n,"border-left-width":ct,"border-right":[!0,"border-right-color","border-right-style","border-right-width"],"border-right-color":cq,"border-right-style":n,"border-right-width":ct,"border-spacing":[2,cr],"border-style":[4,n],"border-top":[!0,"border-top-color","border-top-style","border-top-width"],"border-top-color":cq,"border-top-style":n,"border-top-width":ct,"border-width":[4,ct],bottom:[cr,"auto"],"caption-side":["bottom","left","right","top"],clear:["both","left","none","right"],clip:[cy,"auto"],color:cq,content:["open-quote","close-quote","no-open-quote","no-close-quote",cp,cz,cx,cv],"counter-increment":[cn,"none"],"counter-reset":[cn,"none"],cursor:[cz,"auto","crosshair","default","e-resize","help","move","n-resize","ne-resize","nw-resize","pointer","s-resize","se-resize","sw-resize","w-resize","text","wait"],direction:["ltr","rtl"],display:["block","compact","inline","inline-block","inline-table","list-item","marker","none","run-in","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group"],"empty-cells":["show","hide"],"float":["left","none","right"],font:["caption","icon","menu","message-box","small-caption","status-bar",!0,"font-size","font-style","font-weight","font-family"],"font-family":cw,"font-size":["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller",cr],"font-size-adjust":["none",co],"font-stretch":["normal","wider","narrower","ultra-condensed","extra-condensed","condensed","semi-condensed","semi-expanded","expanded","extra-expanded"],"font-style":["normal","italic","oblique"],"font-variant":["normal","small-caps"],"font-weight":["normal","bold","bolder","lighter",co],height:[cr,"auto"],left:[cr,"auto"],"letter-spacing":["normal",cr],"line-height":["normal",cs],"list-style":[!0,"list-style-image","list-style-position","list-style-type"],"list-style-image":["none",cz],"list-style-position":["inside","outside"],"list-style-type":["circle","disc","square","decimal","decimal-leading-zero","lower-roman","upper-roman","lower-greek","lower-alpha","lower-latin","upper-alpha","upper-latin","hebrew","katakana","hiragana-iroha","katakana-oroha","none"],margin:[4,cu],"margin-bottom":cu,"margin-left":cu,"margin-right":cu,"margin-top":cu,"marker-offset":[cr,"auto"],"max-height":[cr,"none"],"max-width":[cr,"none"],"min-height":cr,"min-width":cr,opacity:co,outline:[!0,"outline-color","outline-style","outline-width"],"outline-color":["invert",cq],"outline-style":["dashed","dotted","double","groove","inset","none","outset","ridge","solid"],"outline-width":ct,overflow:r,"overflow-x":r,"overflow-y":r,padding:[4,cr],"padding-bottom":cr,"padding-left":cr,"padding-right":cr,"padding-top":cr,"page-break-after":o,"page-break-before":o,position:["absolute","fixed","relative","static"],quotes:[8,cp],right:[cr,"auto"],"table-layout":["auto","fixed"],"text-align":["center","justify","left","right"],"text-decoration":["none","underline","overline","line-through","blink"],"text-indent":cr,"text-shadow":["none",4,[cq,cr]],"text-transform":["capitalize","uppercase","lowercase","none"],top:[cr,"auto"],"unicode-bidi":["normal","embed","bidi-override"],"vertical-align":["baseline","bottom","sub","super","top","text-top","middle","text-bottom",cr],visibility:["visible","hidden","collapse"],"white-space":["normal","nowrap","pre","pre-line","pre-wrap","inherit"],width:[cr,"auto"],"word-spacing":["normal",cr],"word-wrap":["break-word","normal"],"z-index":["auto",co]};var cN=function(e,g){var h,i,j;d.errors=[],d.tree="",L=Object.create(S);if(g){h=g.predef;if(h)if(Array.isArray(h))for(i=0;i",I.value),I.value==="use strict"&&(bx('Use the function form of "use strict".'),bN()),d.tree=cf("lib"),d.tree.disrupt&&bx("Weird program.",N)}bF("(end)")}catch(k){k&&d.errors.push({reason:k.message,line:k.line||I.line,character:k.character||I.from},null)}return d.errors.length===0};cN.data=function(){var a={functions:[]},b,c,d=[],e,f,g,h=[],i,j=[],k;cN.errors.length&&(a.errors=cN.errors),C&&(a.json=!0);for(i in A)bt(A,i)&&d.push({name:i,line:A[i]});d.length>0&&(a.implieds=d),Y.length>0&&(a.urls=Y),c=Object.keys(P),c.length>0&&(a.globals=c);for(f=1;f0&&(a.unused=j),h=[];for(i in G)if(typeof G[i]==="number"){a.member=G;break}return a},cN.report=function(a){function o(a,b){var c,d,e;if(b){m.push("
    "+a+" "),b=b.sort();for(d=0;d")}}var b=cN.data(),c=[],d,e,f,g,h,i,j,k="",l,m=[],n;if(b.errors||b.implieds||b.unused){f=!0,m.push("
    Error:");if(b.errors)for(h=0;hProblem"+(isFinite(d.line)?" at line "+d.line+" character "+d.character:"")+": "+d.reason.entityify()+"

    "+(e&&(e.length>80?e.slice(0,77)+"...":e).entityify())+"

    "));if(b.implieds){n=[];for(h=0;h"+b.implieds[h].name+" "+b.implieds[h].line+"";m.push("

    Implied global: "+n.join(", ")+"

    ")}if(b.unused){n=[];for(h=0;h"+b.unused[h].name+" "+b.unused[h].line+" "+b.unused[h]["function"]+"";m.push("

    Unused variable: "+n.join(", ")+"

    ")}b.json&&m.push("

    JSON: bad.

    "),m.push("
    ")}if(!a){m.push("
    "),b.urls&&o("URLs
    ",b.urls,"
    "),ba==="style"?m.push("

    CSS.

    "):b.json&&!f?m.push("

    JSON: good.

    "):b.globals?m.push("
    Global "+b.globals.sort().join(", ")+"
    "):m.push("
    No new global variables introduced.
    ");for(h=0;h
    "+g.line+"-"+g.last+" "+(g.name||"")+"("+(g.param?g.param.join(", "):"")+")
    "),o("Unused",g.unused),o("Closure",g.closure),o("Variable",g["var"]),o("Exception",g.exception),o("Outer",g.outer),o("Global",g.global),o("Label",g.label);if(b.member){c=Object.keys(b.member);if(c.length){c=c.sort(),k="
    /*members ",j=10;for(h=0;h72&&(m.push(k+"
    "),k=" ",j=1),j+=l.length+2,b.member[i]===1&&(l=""+l+""),h*/
    ")}m.push("
    ")}}return m.join("")},cN.jslint=cN,cN.edition="2011-01-09";return cN}()}),define("ace/narcissus/jsparse",function(require,exports,module){function parseStdin(a,b){for(;;)try{var c=new lexer.Tokenizer(a,"stdin",b.value),d=Script(c,!1);b.value=c.lineno;return d}catch(e){if(!c.unexpectedEOF)throw e;var f=readline();if(!f)throw e;a+="\n"+f}}function parse(a,b,c){var d=new lexer.Tokenizer(a,b,c),e=Script(d,!1);if(!d.done)throw d.newSyntaxError("Syntax error");return e}function PrimaryExpression(a,b){var c,d,e=a.get(!0);switch(e){case FUNCTION:c=FunctionDefinition(a,b,!1,EXPRESSED_FORM);break;case LEFT_BRACKET:c=new Node(a,{type:ARRAY_INIT});while((e=a.peek(!0))!==RIGHT_BRACKET){if(e===COMMA){a.get(),c.push(null);continue}c.push(AssignExpression(a,b));if(e!==COMMA&&!a.match(COMMA))break}c.children.length===1&&a.match(FOR)&&(d=new Node(a,{type:ARRAY_COMP,expression:c.children[0],tail:ComprehensionTail(a,b)}),c=d),a.mustMatch(RIGHT_BRACKET);break;case LEFT_CURLY:var f,g;c=new Node(a,{type:OBJECT_INIT});object_init:if(!a.match(RIGHT_CURLY)){do{e=a.get();if(a.token.value!=="get"&&a.token.value!=="set"||a.peek()!==IDENTIFIER){switch(e){case IDENTIFIER:case NUMBER:case STRING:f=new Node(a,{type:IDENTIFIER});break;case RIGHT_CURLY:if(b.ecma3OnlyMode)throw a.newSyntaxError("Illegal trailing ,");break object_init;default:if(a.token.value in definitions.keywords){f=new Node(a,{type:IDENTIFIER});break}throw a.newSyntaxError("Invalid property name")}if(a.match(COLON))d=new Node(a,{type:PROPERTY_INIT}),d.push(f),d.push(AssignExpression(a,b)),c.push(d);else{if(a.peek()!==COMMA&&a.peek()!==RIGHT_CURLY)throw a.newSyntaxError("missing : after property");c.push(f)}}else{if(b.ecma3OnlyMode)throw a.newSyntaxError("Illegal property accessor");c.push(FunctionDefinition(a,b,!0,EXPRESSED_FORM))}}while(a.match(COMMA));a.mustMatch(RIGHT_CURLY)}break;case LEFT_PAREN:c=ParenExpression(a,b),a.mustMatch(RIGHT_PAREN),c.parenthesized=!0;break;case LET:c=LetBlock(a,b,!1);break;case NULL:case THIS:case TRUE:case FALSE:case IDENTIFIER:case NUMBER:case STRING:case REGEXP:c=new Node(a);break;default:throw a.newSyntaxError("missing operand")}return c}function ArgumentList(a,b){var c,d;c=new Node(a,{type:LIST});if(a.match(RIGHT_PAREN,!0))return c;do{d=AssignExpression(a,b);if(d.type===YIELD&&!d.parenthesized&&a.peek()===COMMA)throw a.newSyntaxError("Yield expression must be parenthesized");if(a.match(FOR)){d=GeneratorExpression(a,b,d);if(c.children.length>1||a.peek(!0)===COMMA)throw a.newSyntaxError("Generator expression must be parenthesized")}c.push(d)}while(a.match(COMMA));a.mustMatch(RIGHT_PAREN);return c}function MemberExpression(a,b,c){var d,e,f,g;a.match(NEW)?(d=new Node(a),d.push(MemberExpression(a,b,!1)),a.match(LEFT_PAREN)&&(d.type=NEW_WITH_ARGS,d.push(ArgumentList(a,b)))):d=PrimaryExpression(a,b);while((g=a.get())!==END){switch(g){case DOT:e=new Node(a),e.push(d),a.mustMatch(IDENTIFIER),e.push(new Node(a));break;case LEFT_BRACKET:e=new Node(a,{type:INDEX}),e.push(d),e.push(Expression(a,b)),a.mustMatch(RIGHT_BRACKET);break;case LEFT_PAREN:if(c){e=new Node(a,{type:CALL}),e.push(d),e.push(ArgumentList(a,b));break};default:a.unget();return d}d=e}return d}function UnaryExpression(a,b){var c,d,e;switch(e=a.get(!0)){case DELETE:case VOID:case TYPEOF:case NOT:case BITWISE_NOT:case PLUS:case MINUS:e===PLUS?c=new Node(a,{type:UNARY_PLUS}):e===MINUS?c=new Node(a,{type:UNARY_MINUS}):c=new Node(a),c.push(UnaryExpression(a,b));break;case INCREMENT:case DECREMENT:c=new Node(a),c.push(MemberExpression(a,b,!0));break;default:a.unget(),c=MemberExpression(a,b,!0);if(a.tokens[a.tokenIndex+a.lookahead-1&3].lineno===a.lineno)if(a.match(INCREMENT)||a.match(DECREMENT))d=new Node(a,{postfix:!0}),d.push(c),c=d}return c}function MultiplyExpression(a,b){var c,d;c=UnaryExpression(a,b);while(a.match(MUL)||a.match(DIV)||a.match(MOD))d=new Node(a),d.push(c),d.push(UnaryExpression(a,b)),c=d;return c}function AddExpression(a,b){var c,d;c=MultiplyExpression(a,b);while(a.match(PLUS)||a.match(MINUS))d=new Node(a),d.push(c),d.push(MultiplyExpression(a,b)),c=d;return c}function ShiftExpression(a,b){var c,d;c=AddExpression(a,b);while(a.match(LSH)||a.match(RSH)||a.match(URSH))d=new Node(a),d.push(c),d.push(AddExpression(a,b)),c=d;return c}function RelationalExpression(a,b){var c,d,e=b.update({inForLoopInit:!1});c=ShiftExpression(a,e);while(a.match(LT)||a.match(LE)||a.match(GE)||a.match(GT)||!b.inForLoopInit&&a.match(IN)||a.match(INSTANCEOF))d=new Node(a),d.push(c),d.push(ShiftExpression(a,e)),c=d;return c}function EqualityExpression(a,b){var c,d;c=RelationalExpression(a,b);while(a.match(EQ)||a.match(NE)||a.match(STRICT_EQ)||a.match(STRICT_NE))d=new Node(a),d.push(c),d.push(RelationalExpression(a,b)),c=d;return c}function BitwiseAndExpression(a,b){var c,d;c=EqualityExpression(a,b);while(a.match(BITWISE_AND))d=new Node(a),d.push(c),d.push(EqualityExpression(a,b)),c=d;return c}function BitwiseXorExpression(a,b){var c,d;c=BitwiseAndExpression(a,b);while(a.match(BITWISE_XOR))d=new Node(a),d.push(c),d.push(BitwiseAndExpression(a,b)),c=d;return c}function BitwiseOrExpression(a,b){var c,d;c=BitwiseXorExpression(a,b);while(a.match(BITWISE_OR))d=new Node(a),d.push(c),d.push(BitwiseXorExpression(a,b)),c=d;return c}function AndExpression(a,b){var c,d;c=BitwiseOrExpression(a,b);while(a.match(AND))d=new Node(a),d.push(c),d.push(BitwiseOrExpression(a,b)),c=d;return c}function OrExpression(a,b){var c,d;c=AndExpression(a,b);while(a.match(OR))d=new Node(a),d.push(c),d.push(AndExpression(a,b)),c=d;return c}function ConditionalExpression(a,b){var c,d;c=OrExpression(a,b);if(a.match(HOOK)){d=c,c=new Node(a,{type:HOOK}),c.push(d),c.push(AssignExpression(a,b.update({inForLoopInit:!1})));if(!a.match(COLON))throw a.newSyntaxError("missing : after ?");c.push(AssignExpression(a,b))}return c}function AssignExpression(a,b){var c,d;if(a.match(YIELD,!0))return ReturnOrYield(a,b);c=new Node(a,{type:ASSIGN}),d=ConditionalExpression(a,b);if(!a.match(ASSIGN))return d;switch(d.type){case OBJECT_INIT:case ARRAY_INIT:d.destructuredNames=checkDestructuring(a,b,d);case IDENTIFIER:case DOT:case INDEX:case CALL:break;default:throw a.newSyntaxError("Bad left-hand side of assignment")}c.assignOp=a.token.assignOp,c.push(d),c.push(AssignExpression(a,b));return c}function Expression(a,b){var c,d;c=AssignExpression(a,b);if(a.match(COMMA)){d=new Node(a,{type:COMMA}),d.push(c),c=d;do{d=c.children[c.children.length-1];if(d.type===YIELD&&!d.parenthesized)throw a.newSyntaxError("Yield expression must be parenthesized");c.push(AssignExpression(a,b))}while(a.match(COMMA))}return c}function ParenExpression(a,b){var c=Expression(a,b.update({inForLoopInit:b.inForLoopInit&&a.token.type===LEFT_PAREN}));if(a.match(FOR)){if(c.type===YIELD&&!c.parenthesized)throw a.newSyntaxError("Yield expression must be parenthesized");if(c.type===COMMA&&!c.parenthesized)throw a.newSyntaxError("Generator expression must be parenthesized");c=GeneratorExpression(a,b,c)}return c}function HeadExpression(a,b){var c=MaybeLeftParen(a,b),d=ParenExpression(a,b);MaybeRightParen(a,c);if(c===END&&!d.parenthesized){var e=a.peek();if(e!==LEFT_CURLY&&!definitions.isStatementStartCode[e])throw a.newSyntaxError("Unparenthesized head followed by unbraced body")}return d}function ComprehensionTail(a,b){var c,d,e,f,g;c=new Node(a,{type:COMP_TAIL});do{d=new Node(a,{type:FOR_IN,isLoop:!0}),a.match(IDENTIFIER)&&(a.token.value==="each"?d.isEach=!0:a.unget()),g=MaybeLeftParen(a,b);switch(a.get()){case LEFT_BRACKET:case LEFT_CURLY:a.unget(),d.iterator=DestructuringExpression(a,b);break;case IDENTIFIER:d.iterator=f=new Node(a,{type:IDENTIFIER}),f.name=f.value,d.varDecl=e=new Node(a,{type:VAR}),e.push(f),b.parentScript.varDecls.push(f);break;default:throw a.newSyntaxError("missing identifier")}a.mustMatch(IN),d.object=Expression(a,b),MaybeRightParen(a,g),c.push(d)}while(a.match(FOR));a.match(IF)&&(c.guard=HeadExpression(a,b));return c}function GeneratorExpression(a,b,c){return new Node(a,{type:GENERATOR,expression:c,tail:ComprehensionTail(a,b)})}function DestructuringExpression(a,b,c){var d=PrimaryExpression(a,b);d.destructuredNames=checkDestructuring(a,b,d,c);return d}function checkDestructuring(a,b,c,d){if(c.type===ARRAY_COMP)throw a.newSyntaxError("Invalid array comprehension left-hand side");if(c.type===ARRAY_INIT||c.type===OBJECT_INIT){var e={},f,g,h,i,j,k=c.children;for(var l=0,m=k.length;l=0)throw a.newSyntaxError("More than one switch default");case CASE:f=new Node(a),j===DEFAULT?e.defaultIndex=e.cases.length:f.caseLabel=Expression(a,l,COLON);break;default:throw a.newSyntaxError("Invalid switch case")}a.mustMatch(COLON),f.statements=new Node(a,blockInit());while((j=a.peek(!0))!==CASE&&j!==DEFAULT&&j!==RIGHT_CURLY)f.statements.push(Statement(a,l));e.cases.push(f)}return e;case FOR:e=new Node(a,LOOP_INIT),a.match(IDENTIFIER)&&(a.token.value==="each"?e.isEach=!0:a.unget()),b.parenFreeMode||a.mustMatch(LEFT_PAREN),l=b.pushTarget(e).nest(NESTING_DEEP),m=b.update({inForLoopInit:!0}),(j=a.peek())!==SEMICOLON&&(j===VAR||j===CONST?(a.get(),f=Variables(a,m)):j===LET?(a.get(),a.peek()===LEFT_PAREN?f=LetBlock(a,m,!1):(m.parentBlock=e,e.varDecls=[],f=Variables(a,m))):f=Expression(a,m));if(f&&a.match(IN)){e.type=FOR_IN,e.object=Expression(a,m);if(f.type===VAR||f.type===LET){h=f.children;if(h.length!==1&&f.destructurings.length!==1)throw new SyntaxError("Invalid for..in left-hand side",a.filename,f.lineno);f.destructurings.length>0?e.iterator=f.destructurings[0]:e.iterator=h[0],e.varDecl=f}else{if(f.type===ARRAY_INIT||f.type===OBJECT_INIT)f.destructuredNames=checkDestructuring(a,m,f);e.iterator=f}}else{e.setup=f,a.mustMatch(SEMICOLON);if(e.isEach)throw a.newSyntaxError("Invalid for each..in loop");e.condition=a.peek()===SEMICOLON?null:Expression(a,m),a.mustMatch(SEMICOLON),k=a.peek(),e.update=(b.parenFreeMode?k===LEFT_CURLY||definitions.isStatementStartCode[k]:k===RIGHT_PAREN)?null:Expression(a,m)}b.parenFreeMode||a.mustMatch(RIGHT_PAREN),e.body=Statement(a,l);return e;case WHILE:e=new Node(a,{isLoop:!0}),e.condition=HeadExpression(a,b),e.body=Statement(a,b.pushTarget(e).nest(NESTING_DEEP));return e;case DO:e=new Node(a,{isLoop:!0}),e.body=Statement(a,b.pushTarget(e).nest(NESTING_DEEP)),a.mustMatch(WHILE),e.condition=HeadExpression(a,b);if(!b.ecmaStrictMode){a.match(SEMICOLON);return e}break;case BREAK:case CONTINUE:e=new Node(a),l=b.pushTarget(e),a.peekOnSameLine()===IDENTIFIER&&(a.get(),e.label=a.token.value),e.target=e.label?l.labeledTargets.find(function(a){return a.labels.has(e.label)}):l.defaultTarget;if(!e.target)throw a.newSyntaxError("Invalid "+(j===BREAK?"break":"continue"));if(!e.target.isLoop&&j===CONTINUE)throw a.newSyntaxError("Invalid continue");break;case TRY:e=new Node(a,{catchClauses:[]}),e.tryBlock=Block(a,b);while(a.match(CATCH)){f=new Node(a),g=MaybeLeftParen(a,b);switch(a.get()){case LEFT_BRACKET:case LEFT_CURLY:a.unget(),f.varName=DestructuringExpression(a,b,!0);break;case IDENTIFIER:f.varName=a.token.value;break;default:throw a.newSyntaxError("missing identifier in catch")}if(a.match(IF)){if(b.ecma3OnlyMode)throw a.newSyntaxError("Illegal catch guard");if(e.catchClauses.length&&!e.catchClauses.top().guard)throw a.newSyntaxError("Guarded catch after unguarded");f.guard=Expression(a,b)}MaybeRightParen(a,g),f.block=Block(a,b),e.catchClauses.push(f)}a.match(FINALLY)&&(e.finallyBlock=Block(a,b));if(!e.catchClauses.length&&!e.finallyBlock)throw a.newSyntaxError("Invalid try statement");return e;case CATCH:case FINALLY:throw a.newSyntaxError(definitions.tokens[j]+" without preceding try");case THROW:e=new Node(a),e.exception=Expression(a,b);break;case RETURN:e=ReturnOrYield(a,b);break;case WITH:e=new Node(a),e.object=HeadExpression(a,b),e.body=Statement(a,b.pushTarget(e).nest(NESTING_DEEP));return e;case VAR:case CONST:e=Variables(a,b);break;case LET:a.peek()===LEFT_PAREN?e=LetBlock(a,b,!0):e=Variables(a,b);break;case DEBUGGER:e=new Node(a);break;case NEWLINE:case SEMICOLON:e=new Node(a,{type:SEMICOLON}),e.expression=null;return e;default:if(j===IDENTIFIER){j=a.peek();if(j===COLON){d=a.token.value;if(b.allLabels.has(d))throw a.newSyntaxError("Duplicate label");a.get(),e=new Node(a,{type:LABEL,label:d}),e.statement=Statement(a,b.pushLabel(d).nest(NESTING_SHALLOW)),e.target=e.statement.type===LABEL?e.statement.target:e.statement;return e}}e=new Node(a,{type:SEMICOLON}),a.unget(),e.expression=Expression(a,b),e.end=e.expression.end}MagicalSemicolon(a);return e}function Block(a,b){a.mustMatch(LEFT_CURLY);var c=new Node(a,blockInit());Statements(a,b.update({parentBlock:c}).pushTarget(c),c),a.mustMatch(RIGHT_CURLY);return c}function Statements(a,b,c){try{while(!a.done&&a.peek(!0)!==RIGHT_CURLY)c.push(Statement(a,b))}catch(d){a.done&&(a.unexpectedEOF=!0);throw d}}function MaybeRightParen(a,b){b===LEFT_PAREN&&a.mustMatch(RIGHT_PAREN)}function MaybeLeftParen(a,b){if(b.parenFreeMode)return a.match(LEFT_PAREN)?LEFT_PAREN:END;return a.mustMatch(LEFT_PAREN).type}function scriptInit(){return{type:SCRIPT,funDecls:[],varDecls:[],modDecls:[],impDecls:[],expDecls:[],loadDeps:[],hasEmptyReturn:!1,hasReturnWithValue:!1,isGenerator:!1}}function blockInit(){return{type:BLOCK,varDecls:[]}}function tokenString(a){var b=definitions.tokens[a];return/^\W/.test(b)?definitions.opTypeNames[b]:b.toUpperCase()}function Node(a,b){var c=a.token;c?(this.type=c.type,this.value=c.value,this.lineno=c.lineno,this.start=c.start,this.end=c.end):this.lineno=a.lineno,this.tokenizer=a,this.children=[];for(var d in b)this[d]=b[d]}function Script(a,b){var c=new Node(a,scriptInit()),d=new StaticContext(c,c,b,!1,NESTING_TOP);Statements(a,d,c);return c}function StaticContext(a,b,c,d,e){this.parentScript=a,this.parentBlock=b,this.inFunction=c,this.inForLoopInit=d,this.nesting=e,this.allLabels=new Stack,this.currentLabels=new Stack,this.labeledTargets=new Stack,this.defaultTarget=null,definitions.options.ecma3OnlyMode&&(this.ecma3OnlyMode=!0),definitions.options.parenFreeMode&&(this.parenFreeMode=!0)}function pushDestructuringVarDecls(a,b){for(var c in a){var d=a[c];d.type===IDENTIFIER?b.varDecls.push(d):pushDestructuringVarDecls(d,b)}}var lexer=require("ace/narcissus/jslex"),definitions=require("ace/narcissus/jsdefs");const StringMap=definitions.StringMap,Stack=definitions.Stack;eval(definitions.consts);const NESTING_TOP=0,NESTING_SHALLOW=1,NESTING_DEEP=2;StaticContext.prototype={ecma3OnlyMode:!1,parenFreeMode:!1,update:function(a){var b={};for(var c in a)b[c]={value:a[c],writable:!0,enumerable:!0,configurable:!0};return Object.create(this,b)},pushLabel:function(a){return this.update({currentLabels:this.currentLabels.push(a),allLabels:this.allLabels.push(a)})},pushTarget:function(a){var b=a.isLoop||a.type===SWITCH;if(this.currentLabels.isEmpty())return b?this.update({defaultTarget:a}):this;a.labels=new StringMap,this.currentLabels.forEach(function(b){a.labels.set(b,!0)});return this.update({currentLabels:new Stack,labeledTargets:this.labeledTargets.push(a),defaultTarget:b?a:this.defaultTarget})},nest:function(a){var b=Math.max(this.nesting,a);return b!==this.nesting?this.update({nesting:b}):this}},definitions.defineProperty(Array.prototype,"top",function(){return this.length&&this[this.length-1]},!1,!1,!0);var Np=Node.prototype={};Np.constructor=Node,Np.toSource=Object.prototype.toSource,Np.push=function(a){a!==null&&(a.start=0)b+=c;return b},!1,!1,!0);const DECLARED_FORM=0,EXPRESSED_FORM=1,STATEMENT_FORM=2;exports.parse=parse,exports.parseStdin=parseStdin,exports.Node=Node,exports.DECLARED_FORM=DECLARED_FORM,exports.EXPRESSED_FORM=EXPRESSED_FORM,exports.STATEMENT_FORM=STATEMENT_FORM,exports.Tokenizer=lexer.Tokenizer,exports.FunctionDefinition=FunctionDefinition}),define("ace/narcissus/jslex",function(require,exports,module){function Tokenizer(a,b,c){this.cursor=0,this.source=String(a),this.tokens=[],this.tokenIndex=0,this.lookahead=0,this.scanNewlines=!1,this.unexpectedEOF=!1,this.filename=b||"",this.lineno=c||1}var definitions=require("ace/narcissus/jsdefs");eval(definitions.consts);var opTokens={};for(var op in definitions.opTypeNames){if(op==="\n"||op===".")continue;var node=opTokens;for(var i=0;i"9")throw this.newSyntaxError("Missing exponent");do ch=a[this.cursor++];while(ch>="0"&&ch<="9");this.cursor--;return!0}return!1},lexZeroNumber:function(a){var b=this.token,c=this.source;b.type=NUMBER,a=c[this.cursor++];if(a==="."){do a=c[this.cursor++];while(a>="0"&&a<="9");this.cursor--,this.lexExponent(),b.value=parseFloat(b.start,this.cursor)}else if(a==="x"||a==="X"){do a=c[this.cursor++];while(a>="0"&&a<="9"||a>="a"&&a<="f"||a>="A"&&a<="F");this.cursor--,b.value=parseInt(c.substring(b.start,this.cursor))}else if(a<"0"||a>"7")this.cursor--,this.lexExponent(),b.value=0;else{do a=c[this.cursor++];while(a>="0"&&a<="7");this.cursor--,b.value=parseInt(c.substring(b.start,this.cursor))}},lexNumber:function(a){var b=this.token,c=this.source;b.type=NUMBER;var d=!1;do a=c[this.cursor++],a==="."&&!d&&(d=!0,a=c[this.cursor++]);while(a>="0"&&a<="9");this.cursor--;var e=this.lexExponent();d=d||e;var f=c.substring(b.start,this.cursor);b.value=d?parseFloat(f):parseInt(f)},lexDot:function(a){var b=this.token,c=this.source,d=c[this.cursor];if(d<"0"||d>"9")b.type=DOT,b.assignOp=null,b.value=".";else{do a=c[this.cursor++];while(a>="0"&&a<="9");this.cursor--,this.lexExponent(),b.type=NUMBER,b.value=parseFloat(b.start,this.cursor)}},lexString:function(ch){var token=this.token,input=this.source;token.type=STRING;var hasEscapes=!1,delim=ch;while((ch=input[this.cursor++])!==delim){if(this.cursor==input.length)throw this.newSyntaxError("Unterminated string literal");if(ch==="\\"){hasEscapes=!0;if(++this.cursor==input.length)throw this.newSyntaxError("Unterminated string literal")}}token.value=hasEscapes?eval(input.substring(token.start,this.cursor)):input.substring(token.start+1,this.cursor-1)},lexRegExp:function(ch){var token=this.token,input=this.source;token.type=REGEXP;do{ch=input[this.cursor++];if(ch==="\\")this.cursor++;else if(ch==="["){do{if(ch===undefined)throw this.newSyntaxError("Unterminated character class");ch==="\\"&&this.cursor++,ch=input[this.cursor++]}while(ch!=="]")}else if(ch===undefined)throw this.newSyntaxError("Unterminated regex")}while(ch!=="/");do ch=input[this.cursor++];while(ch>="a"&&ch<="z");this.cursor--,token.value=eval(input.substring(token.start,this.cursor))},lexOp:function(a){var b=this.token,c=this.source,d=opTokens[a],e=c[this.cursor];e in d&&(d=d[e],this.cursor++,e=c[this.cursor],e in d&&(d=d[e],this.cursor++,e=c[this.cursor]));var f=d.op;definitions.assignOps[f]&&c[this.cursor]==="="?(this.cursor++,b.type=ASSIGN,b.assignOp=definitions.tokenIds[definitions.opTypeNames[f]],f+="="):(b.type=definitions.tokenIds[definitions.opTypeNames[f]],b.assignOp=null),b.value=f},lexIdent:function(a){var b=this.token,c=this.source;do a=c[this.cursor++];while(a>="a"&&a<="z"||a>="A"&&a<="Z"||a>="0"&&a<="9"||a==="$"||a==="_");this.cursor--;var d=c.substring(b.start,this.cursor);b.type=definitions.keywords[d]||IDENTIFIER,b.value=d},get:function(a){var b;while(this.lookahead){--this.lookahead,this.tokenIndex=this.tokenIndex+1&3,b=this.tokens[this.tokenIndex];if(b.type!==NEWLINE||this.scanNewlines)return b.type}this.skip(),this.tokenIndex=this.tokenIndex+1&3,b=this.tokens[this.tokenIndex],b||(this.tokens[this.tokenIndex]=b={});var c=this.source;if(this.cursor===c.length)return b.type=END;b.start=this.cursor,b.lineno=this.lineno;var d=c[this.cursor++];if(d>="a"&&d<="z"||d>="A"&&d<="Z"||d==="$"||d==="_")this.lexIdent(d);else if(a&&d==="/")this.lexRegExp(d);else if(d in opTokens)this.lexOp(d);else if(d===".")this.lexDot(d);else if(d<"1"||d>"9")if(d==="0")this.lexZeroNumber(d);else if(d==='"'||d==="'")this.lexString(d);else if(this.scanNewlines&&d==="\n")b.type=NEWLINE,b.value="\n",this.lineno++;else throw this.newSyntaxError("Illegal token");else this.lexNumber(d);b.end=this.cursor;return b.type},unget:function(){if(++this.lookahead===4)throw"PANIC: too much lookahead!";this.tokenIndex=this.tokenIndex-1&3},newSyntaxError:function(a){var b=new SyntaxError(a,this.filename,this.lineno);b.source=this.source,b.lineno=this.lineno,b.cursor=this.lookahead?this.tokens[this.tokenIndex+this.lookahead&3].start:this.cursor;return b}},exports.Tokenizer=Tokenizer}),define("ace/narcissus/jsdefs",function(a,b,c){function y(a){this.elts=a||null}function x(){this.table=Object.create(null,{}),this.size=0}function v(){return undefined}function u(a){return{getOwnPropertyDescriptor:function(b){var c=Object.getOwnPropertyDescriptor(a,b);c.configurable=!0;return c},getPropertyDescriptor:function(b){var c=s(a,b);c.configurable=!0;return c},getOwnPropertyNames:function(){return Object.getOwnPropertyNames(a)},defineProperty:function(b,c){Object.defineProperty(a,b,c)},"delete":function(b){return delete a[b]},fix:function(){if(Object.isFrozen(a))return t(a);return undefined},has:function(b){return b in a},hasOwn:function(b){return({}).hasOwnProperty.call(a,b)},get:function(b,c){return a[c]},set:function(b,c,d){a[c]=d;return!0},enumerate:function(){var b=[];for(m in a)b.push(m);return b},keys:function(){return Object.keys(a)}}}function t(a){var b={};for(var c in Object.getOwnPropertyNames(a))b[c]=Object.getOwnPropertyDescriptor(a,c);return b}function s(a,b){while(a){if(({}).hasOwnProperty.call(a,b))return Object.getOwnPropertyDescriptor(a,b);a=Object.getPrototypeOf(a)}}function r(a){return typeof a==="function"&&a.toString().match(/\[native code\]/)}function q(a,b,c,d,e,f){Object.defineProperty(a,b,{value:c,writable:!e,configurable:!d,enumerable:!f})}function p(a,b,c,d,e){Object.defineProperty(a,b,{get:c,configurable:!d,enumerable:!e})}b.options={version:185},function(){b.hostGlobal=this}();var d=["END","\n",";",",","=","?",":","CONDITIONAL","||","&&","|","^","&","==","!=","===","!==","<","<=",">=",">","<<",">>",">>>","+","-","*","/","%","!","~","UNARY_PLUS","UNARY_MINUS","++","--",".","[","]","{","}","(",")","SCRIPT","BLOCK","LABEL","FOR_IN","CALL","NEW_WITH_ARGS","INDEX","ARRAY_INIT","OBJECT_INIT","PROPERTY_INIT","GETTER","SETTER","GROUP","LIST","LET_BLOCK","ARRAY_COMP","GENERATOR","COMP_TAIL","IDENTIFIER","NUMBER","STRING","REGEXP","break","case","catch","const","continue","debugger","default","delete","do","else","false","finally","for","function","if","in","instanceof","let","new","null","return","switch","this","throw","true","try","typeof","var","void","yield","while","with"],e=["break","const","continue","debugger","do","for","if","return","switch","throw","try","var","yield","while","with"],f={"\n":"NEWLINE",";":"SEMICOLON",",":"COMMA","?":"HOOK",":":"COLON","||":"OR","&&":"AND","|":"BITWISE_OR","^":"BITWISE_XOR","&":"BITWISE_AND","===":"STRICT_EQ","==":"EQ","=":"ASSIGN","!==":"STRICT_NE","!=":"NE","<<":"LSH","<=":"LE","<":"LT",">>>":"URSH",">>":"RSH",">=":"GE",">":"GT","++":"INCREMENT","--":"DECREMENT","+":"PLUS","-":"MINUS","*":"MUL","/":"DIV","%":"MOD","!":"NOT","~":"BITWISE_NOT",".":"DOT","[":"LEFT_BRACKET","]":"RIGHT_BRACKET","{":"LEFT_CURLY","}":"RIGHT_CURLY","(":"LEFT_PAREN",")":"RIGHT_PAREN"},g={"__proto__":null},h={},i="const ";for(var j=0,k=d.length;j0&&(i+=", ");var l=d[j],m;/^[a-z]/.test(l)?(m=l.toUpperCase(),g[l]=j):m=/^\W/.test(l)?f[l]:l,i+=m+" = "+j,h[m]=j,d[l]=j}i+=";";var n={"__proto__":null};for(j=0,k=e.length;j>",">>>","+","-","*","/","%"];for(j=0,k=o.length;j h1{position:absolute;left:10px;bottom:10px;margin:0;font-weight:700;font-size:20px;line-height:20px;color:#eee;} #world{position:absolute;left:0;top:0;display:block;margin:0 auto;} #world-container{position:absolute;left:0;top:0;overflow:hidden;width:100%;height:100%;} @@ -7,13 +9,18 @@ body > h1{position:absolute;left:10px;bottom:10px;margin:0;font-weight:700;font- #loading{position:absolute;top:10px;left:10px;z-index:999;margin:0;font-weight:700;font-size:12px;line-height:20px;color:#fff;} .panel{width:300px;} -.panel-position-tr{border-bottom:1px solid #fff;} +.panel-position-tr, +.panel-position-tl{border-bottom:1px solid #fff;} .panel-position-br{border-top:1px solid #fff;} .panel h1{margin:0;height:32px;font-weight:400;font-size:16px;line-height:32px;color:#fff;cursor:pointer;} .panel .content{overflow:hidden;height:270px;background:rgba(0, 5, 20, 0.5);} -#panel-codepad{width:500px;} -#panel-codepad .content{background:rgb(255, 255, 255);} -#panel-codepad .content > div:first-child{padding-left:0.4em;} -#panel-codepad .CodeMirror-line-numbers{margin:0.4em;} -#panel-codepad .CodeMirror-line-numbers div{padding:0 3px;font-family:monospace;font-size:10pt;text-align:right;} \ No newline at end of file +#panel-codepad{width:600px;} +#panel-codepad .content{background:#e8e8e8;} +#panel-codepad button{height:30px;margin:5px;font-size:14px;cursor:pointer;} +#ace-editor{position:relative;width:600px;} + +#panel-console{position:relative;} +#panel-console .content{overflow:auto;} +#panel-console button{position:absolute;top:37px;right:5px;} +#panel-console .console{padding:10px;font-size:12px;color:#fff;} diff --git a/vendor/CodeMirror b/vendor/CodeMirror deleted file mode 160000 index 278400d..0000000 --- a/vendor/CodeMirror +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 278400d99cee12ae4ce3e47e3a470bee238689d4