Version Description
- Fix incompatibility with Custom Sidebars plugin
Download this release
Release Info
Developer | WPMUDEV |
Plugin | Hustle – Pop-Ups, Slide-ins and Email Opt-ins |
Version | 4.7.0.2 |
Comparing to | |
See all releases |
Code changes from version 4.6.1.4 to 4.7.0.2
- changelog.txt +22 -0
- css/popup-admin.min.css +1 -1
- css/tpl/old-default/template.php +1 -1
- css/tpl/old-fixed/template.php +1 -1
- css/tpl/old-fullbackground/template.php +1 -1
- css/tpl/simple/style.css +11 -11
- css/tpl/simple/template.php +1 -1
- humans.txt +1 -1
- inc/addons/class-popup-addon-headerfooter.php +1 -1
- inc/class-popup-admin.php +64 -32
- inc/class-popup-base.php +22 -3
- inc/class-popup-item.php +94 -1
- inc/class-popup-public.php +12 -19
- inc/class-popup-rule.php +1 -1
- inc/external/wpmu-lib/changelog.txt +8 -0
- inc/external/wpmu-lib/core.php +2 -2
- inc/external/wpmu-lib/css/select2.min.css +1 -1
- inc/external/wpmu-lib/css/wpmu-ui.min.css +1 -1
- inc/external/wpmu-lib/css/wpmu-vnav.min.css +1 -1
- inc/external/wpmu-lib/functions-wpmulib.php +7 -10
- inc/external/wpmu-lib/js/select2.js +1 -1
- inc/external/wpmu-lib/js/select2.min.js +1 -1
- inc/external/wpmu-lib/js/tiny-scrollbar.js +1 -1
- inc/external/wpmu-lib/js/tiny-scrollbar.min.js +1 -1
- inc/external/wpmu-lib/js/wpmu-ui.js +1 -1
- inc/external/wpmu-lib/js/wpmu-ui.min.js +1 -1
- inc/external/wpmu-lib/js/wpmu-vnav.js +1 -1
- inc/external/wpmu-lib/js/wpmu-vnav.min.js +1 -1
- js/ace.js +19944 -0
- js/ace.min.js +11 -0
changelog.txt
CHANGED
@@ -4,6 +4,28 @@ Author: Barry (Incsub), Marko Miljus (Incsub), Philipp Stracker (Incsub)
|
|
4 |
Change Log:
|
5 |
----------------------------------------------------------------------
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
4.6.1.4
|
8 |
----------------------------------------------------------------------
|
9 |
- Better: Improved handling of forms inside PopUps
|
4 |
Change Log:
|
5 |
----------------------------------------------------------------------
|
6 |
|
7 |
+
4.7.0.2
|
8 |
+
----------------------------------------------------------------------
|
9 |
+
- Fix incompatibility with Custom Sidebars plugin
|
10 |
+
|
11 |
+
4.7.0.1
|
12 |
+
----------------------------------------------------------------------
|
13 |
+
- Fix small JavaScript error
|
14 |
+
|
15 |
+
4.7.0
|
16 |
+
----------------------------------------------------------------------
|
17 |
+
- Add PopUp Animations (PRO version)
|
18 |
+
- Add Behavior option: Form submit behavior (PRO version)
|
19 |
+
- Add new meta box: Custom CSS for individual PopUps (PRO version)
|
20 |
+
- Add validation of PopUp shortcodes for the current loading method
|
21 |
+
- Fix an issue where the PopUp closes when Gravity Forms is submitted
|
22 |
+
- Fix the on-URL rules in Ajax loading methods
|
23 |
+
- Fix the Ajax loading methods when Strict-Mime-Check is enabled
|
24 |
+
|
25 |
+
4.6.1.5
|
26 |
+
----------------------------------------------------------------------
|
27 |
+
- Fix error on servers that run older php version than 5.3
|
28 |
+
|
29 |
4.6.1.4
|
30 |
----------------------------------------------------------------------
|
31 |
- Better: Improved handling of forms inside PopUps
|
css/popup-admin.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! PopUp Free - v4.
|
2 |
* https://wordpress.org/plugins/wordpress-popup/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
|
1 |
+
/*! PopUp Free - v4.7.02
|
2 |
* https://wordpress.org/plugins/wordpress-popup/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
|
css/tpl/old-default/template.php
CHANGED
@@ -37,4 +37,4 @@ if ( defined( 'PO_ALLOW_CONTENT_FILTERING' ) && PO_ALLOW_CONTENT_FILTERING ) {
|
|
37 |
</div>
|
38 |
<div class="clear"></div>
|
39 |
|
40 |
-
</div>
|
37 |
</div>
|
38 |
<div class="clear"></div>
|
39 |
|
40 |
+
</div>
|
css/tpl/old-fixed/template.php
CHANGED
@@ -37,4 +37,4 @@ if ( defined( 'PO_ALLOW_CONTENT_FILTERING' ) && PO_ALLOW_CONTENT_FILTERING ) {
|
|
37 |
</div>
|
38 |
<div class="clear"></div>
|
39 |
|
40 |
-
</div>
|
37 |
</div>
|
38 |
<div class="clear"></div>
|
39 |
|
40 |
+
</div>
|
css/tpl/old-fullbackground/template.php
CHANGED
@@ -38,4 +38,4 @@ if ( defined( 'PO_ALLOW_CONTENT_FILTERING' ) && PO_ALLOW_CONTENT_FILTERING ) {
|
|
38 |
<div class="clear"></div>
|
39 |
|
40 |
</div>
|
41 |
-
</div>
|
38 |
<div class="clear"></div>
|
39 |
|
40 |
</div>
|
41 |
+
</div>
|
css/tpl/simple/style.css
CHANGED
@@ -67,7 +67,7 @@
|
|
67 |
#messagebox .wdpu-msg p:last-child {
|
68 |
margin-bottom: 0;
|
69 |
}
|
70 |
-
#messagebox .wdpu-
|
71 |
position: absolute;
|
72 |
top: -12px;
|
73 |
right: -12px;
|
@@ -79,12 +79,12 @@
|
|
79 |
background: transparent url(%styleurl%img/close.png) no-repeat;
|
80 |
}
|
81 |
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
|
82 |
-
#messagebox .wdpu-
|
83 |
background: transparent url(%styleurl%img/close@2x.png) no-repeat;
|
84 |
background-size: 30px 30px;
|
85 |
}
|
86 |
}
|
87 |
-
#messagebox .wdpu-
|
88 |
opacity: 1;
|
89 |
}
|
90 |
#messagebox .wdpu-msg-inner {
|
@@ -99,39 +99,39 @@
|
|
99 |
max-width: none;
|
100 |
min-width: 0;
|
101 |
}
|
102 |
-
#messagebox .wdpu-
|
103 |
-
#messagebox .wdpu-
|
104 |
vertical-align: middle;
|
105 |
display: inline-block;
|
106 |
box-sizing: border-box;
|
107 |
}
|
108 |
-
#messagebox .wdpu-
|
109 |
padding: 20px 20px 64px;
|
110 |
background: #F2F2F2;
|
111 |
position: relative;
|
112 |
z-index: 10;
|
113 |
height: 100%;
|
114 |
}
|
115 |
-
#messagebox .wdpu-
|
116 |
position: absolute;
|
117 |
top: 0;
|
118 |
bottom: 0;
|
119 |
overflow: hidden;
|
120 |
z-index: -1;
|
121 |
}
|
122 |
-
#messagebox .wdpu-
|
123 |
height: 100%;
|
124 |
width: auto;
|
125 |
position: relative;
|
126 |
}
|
127 |
-
#messagebox .wdpu-
|
128 |
overflow: auto;
|
129 |
height: 100%;
|
130 |
}
|
131 |
-
#messagebox .wdpu-
|
132 |
margin: 0;
|
133 |
}
|
134 |
-
#messagebox .wdpu-
|
135 |
position: absolute;
|
136 |
padding: 20px;
|
137 |
height: 24px;
|
67 |
#messagebox .wdpu-msg p:last-child {
|
68 |
margin-bottom: 0;
|
69 |
}
|
70 |
+
#messagebox .wdpu-close {
|
71 |
position: absolute;
|
72 |
top: -12px;
|
73 |
right: -12px;
|
79 |
background: transparent url(%styleurl%img/close.png) no-repeat;
|
80 |
}
|
81 |
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
|
82 |
+
#messagebox .wdpu-close {
|
83 |
background: transparent url(%styleurl%img/close@2x.png) no-repeat;
|
84 |
background-size: 30px 30px;
|
85 |
}
|
86 |
}
|
87 |
+
#messagebox .wdpu-close:hover {
|
88 |
opacity: 1;
|
89 |
}
|
90 |
#messagebox .wdpu-msg-inner {
|
99 |
max-width: none;
|
100 |
min-width: 0;
|
101 |
}
|
102 |
+
#messagebox .wdpu-text,
|
103 |
+
#messagebox .wdpu-image {
|
104 |
vertical-align: middle;
|
105 |
display: inline-block;
|
106 |
box-sizing: border-box;
|
107 |
}
|
108 |
+
#messagebox .wdpu-text {
|
109 |
padding: 20px 20px 64px;
|
110 |
background: #F2F2F2;
|
111 |
position: relative;
|
112 |
z-index: 10;
|
113 |
height: 100%;
|
114 |
}
|
115 |
+
#messagebox .wdpu-image {
|
116 |
position: absolute;
|
117 |
top: 0;
|
118 |
bottom: 0;
|
119 |
overflow: hidden;
|
120 |
z-index: -1;
|
121 |
}
|
122 |
+
#messagebox .wdpu-image img {
|
123 |
height: 100%;
|
124 |
width: auto;
|
125 |
position: relative;
|
126 |
}
|
127 |
+
#messagebox .wdpu-inner {
|
128 |
overflow: auto;
|
129 |
height: 100%;
|
130 |
}
|
131 |
+
#messagebox .wdpu-inner.no-bm {
|
132 |
margin: 0;
|
133 |
}
|
134 |
+
#messagebox .wdpu-buttons {
|
135 |
position: absolute;
|
136 |
padding: 20px;
|
137 |
height: 24px;
|
css/tpl/simple/template.php
CHANGED
@@ -141,4 +141,4 @@ $msg_class .= apply_filters( 'popup-template-class', '', $this->id, $this );
|
|
141 |
<?php endif; ?>
|
142 |
</div>
|
143 |
</div>
|
144 |
-
</div>
|
141 |
<?php endif; ?>
|
142 |
</div>
|
143 |
</div>
|
144 |
+
</div>
|
humans.txt
CHANGED
@@ -17,4 +17,4 @@
|
|
17 |
Developer: Philipp Stracker
|
18 |
Contact: philipp [at] incsub [dot] com
|
19 |
Twitter:
|
20 |
-
Location: Götzis, Austria
|
17 |
Developer: Philipp Stracker
|
18 |
Contact: philipp [at] incsub [dot] com
|
19 |
Twitter:
|
20 |
+
Location: Götzis, Austria
|
inc/addons/class-popup-addon-headerfooter.php
CHANGED
@@ -165,4 +165,4 @@ class IncPopupAddon_HeaderFooter {
|
|
165 |
}
|
166 |
};
|
167 |
|
168 |
-
IncPopupAddon_HeaderFooter::init();
|
165 |
}
|
166 |
};
|
167 |
|
168 |
+
IncPopupAddon_HeaderFooter::init();
|
inc/class-popup-admin.php
CHANGED
@@ -6,14 +6,14 @@ require_once PO_INC_DIR . 'class-popup-help.php';
|
|
6 |
/**
|
7 |
* Defines the popup class for admin pages.
|
8 |
*
|
9 |
-
* @since 4.6
|
10 |
*/
|
11 |
class IncPopup extends IncPopupBase {
|
12 |
|
13 |
/**
|
14 |
* Returns the singleton instance of the popup (admin) class.
|
15 |
*
|
16 |
-
* @since 4.6
|
17 |
*/
|
18 |
static public function instance() {
|
19 |
static $Inst = null;
|
@@ -35,7 +35,7 @@ class IncPopup extends IncPopupBase {
|
|
35 |
/**
|
36 |
* Private constructor (singleton)
|
37 |
*
|
38 |
-
* @since 4.6
|
39 |
*/
|
40 |
protected function __construct() {
|
41 |
parent::__construct();
|
@@ -82,7 +82,7 @@ class IncPopup extends IncPopupBase {
|
|
82 |
/**
|
83 |
* Initializes stuff that is only needed on the plugin screen
|
84 |
*
|
85 |
-
* @since 4.6
|
86 |
*/
|
87 |
static public function setup_module_specific( $hook ) {
|
88 |
WDev()->load_fields( $hook, 'post_type', 'base' );
|
@@ -98,6 +98,7 @@ class IncPopup extends IncPopupBase {
|
|
98 |
|
99 |
WDev()->add_ui( PO_CSS_URL . 'popup-admin.min.css' );
|
100 |
WDev()->add_ui( PO_JS_URL . 'popup-admin.min.js' );
|
|
|
101 |
WDev()->add_ui( PO_JS_URL . 'public.min.js' ); // For Preview.
|
102 |
|
103 |
if ( $_REQUEST['post_status'] !== 'trash' ) {
|
@@ -116,7 +117,7 @@ class IncPopup extends IncPopupBase {
|
|
116 |
'_popup_data',
|
117 |
array(
|
118 |
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
119 |
-
'do' => '
|
120 |
'popup' => '',
|
121 |
'noinit' => true,
|
122 |
'preview' => true,
|
@@ -230,7 +231,7 @@ class IncPopup extends IncPopupBase {
|
|
230 |
/**
|
231 |
* Register additional menu items in the dashboard.
|
232 |
*
|
233 |
-
* @since 4.6
|
234 |
*/
|
235 |
static public function admin_menus() {
|
236 |
global $submenu;
|
@@ -299,7 +300,7 @@ class IncPopup extends IncPopupBase {
|
|
299 |
* The Post-Editor does not work on Multisite Network dashboard.
|
300 |
* So display a notice and tell the user to go to the Main Site.
|
301 |
*
|
302 |
-
* @since 4.6
|
303 |
*/
|
304 |
static public function network_menu_notice() {
|
305 |
include PO_VIEWS_DIR . 'network.php';
|
@@ -308,7 +309,7 @@ class IncPopup extends IncPopupBase {
|
|
308 |
/**
|
309 |
* Handles all admin ajax calls.
|
310 |
*
|
311 |
-
* @since 4.6
|
312 |
*/
|
313 |
static public function handle_ajax() {
|
314 |
WDev()->load_post_fields( 'do', 'order' );
|
@@ -347,7 +348,7 @@ class IncPopup extends IncPopupBase {
|
|
347 |
/**
|
348 |
* Displays the settings page
|
349 |
*
|
350 |
-
* @since 4.6
|
351 |
*/
|
352 |
static public function handle_settings_page() {
|
353 |
include PO_VIEWS_DIR . 'settings.php';
|
@@ -356,7 +357,7 @@ class IncPopup extends IncPopupBase {
|
|
356 |
/**
|
357 |
* Called every time the settings page is loaded. Saves changes.
|
358 |
*
|
359 |
-
* @since 4.6
|
360 |
*/
|
361 |
static public function handle_settings_update() {
|
362 |
WDev()->load_post_fields( 'action', 'po_option' );
|
@@ -397,7 +398,7 @@ class IncPopup extends IncPopupBase {
|
|
397 |
/**
|
398 |
* Filter. Returns the columns for the item list of the popup post-type.
|
399 |
*
|
400 |
-
* @since 4.6
|
401 |
* @param array $post_columns
|
402 |
* @return array
|
403 |
*/
|
@@ -426,7 +427,7 @@ class IncPopup extends IncPopupBase {
|
|
426 |
/**
|
427 |
* Outputs the contents of a specific column.
|
428 |
*
|
429 |
-
* @since 4.6
|
430 |
* @param string $column The column-key (defined in post_columns above).
|
431 |
* @param int $post_id The ID of the popup.
|
432 |
*/
|
@@ -580,7 +581,7 @@ class IncPopup extends IncPopupBase {
|
|
580 |
/**
|
581 |
* Filter. Defines the quick-filters above the popup-table.
|
582 |
*
|
583 |
-
* @since 4.6
|
584 |
* @param array $views Default filters.
|
585 |
* @return array Modified filters.
|
586 |
*/
|
@@ -636,7 +637,7 @@ class IncPopup extends IncPopupBase {
|
|
636 |
* Defines the Bulk Actions available for popups.
|
637 |
* Note: This filter can only be used to *remove* bulk actions.
|
638 |
*
|
639 |
-
* @since 4.6
|
640 |
* @param array $actions Default list of bulk actions.
|
641 |
* @return array Modified action list.
|
642 |
*/
|
@@ -651,7 +652,7 @@ class IncPopup extends IncPopupBase {
|
|
651 |
/**
|
652 |
* Define our PopUp update messages.
|
653 |
*
|
654 |
-
* @since 4.6
|
655 |
* @see wp-admin/edit.php
|
656 |
* @param array $messages Array of messages, by post-type.
|
657 |
* @param array $counts
|
@@ -671,7 +672,7 @@ class IncPopup extends IncPopupBase {
|
|
671 |
/**
|
672 |
* Called when the file edit.php is loaded
|
673 |
*
|
674 |
-
* @since 4.6
|
675 |
*/
|
676 |
static public function post_list_edit() {
|
677 |
$wp_list_table = _get_list_table( 'WP_Posts_List_Table' );
|
@@ -775,7 +776,7 @@ class IncPopup extends IncPopupBase {
|
|
775 |
* Modify the main WP query to avoid pagination on the popup list and sort
|
776 |
* the popup list by the popup-order.
|
777 |
*
|
778 |
-
* @since 4.6
|
779 |
*/
|
780 |
static public function post_query( $query ) {
|
781 |
if ( ! $query->is_main_query() ) { return; }
|
@@ -789,7 +790,7 @@ class IncPopup extends IncPopupBase {
|
|
789 |
* Returns the custom value of "items-per-page".
|
790 |
* This value is used by WordPress to generate the pagination links.
|
791 |
*
|
792 |
-
* @since 4.6
|
793 |
* @param int $value Default value set in Database
|
794 |
* @param string $post_type
|
795 |
* @return int Customized value
|
@@ -805,7 +806,7 @@ class IncPopup extends IncPopupBase {
|
|
805 |
/**
|
806 |
* Remove the posts-per-page filter from screen options.
|
807 |
*
|
808 |
-
* @since 4.6
|
809 |
*/
|
810 |
static public function post_screenoptions() {
|
811 |
$screen = get_current_screen();
|
@@ -816,7 +817,7 @@ class IncPopup extends IncPopupBase {
|
|
816 |
* Takes an array as input and updates the order of all popups according to
|
817 |
* the definition in the array.
|
818 |
*
|
819 |
-
* @since 4.6
|
820 |
* @param array $order List of popup-IDs
|
821 |
*/
|
822 |
static public function post_order( $order ) {
|
@@ -850,7 +851,11 @@ class IncPopup extends IncPopupBase {
|
|
850 |
/**
|
851 |
* Save the popup data to database.
|
852 |
*
|
853 |
-
*
|
|
|
|
|
|
|
|
|
854 |
* @param int $post_id Post ID that was saved/created
|
855 |
* @param WP_Post $post Post object that was saved/created
|
856 |
* @param bool $update True means the post was updated (not created)
|
@@ -883,7 +888,7 @@ class IncPopup extends IncPopupBase {
|
|
883 |
/**
|
884 |
* Executes custom form actions, such as "duplicate PopUp"
|
885 |
*
|
886 |
-
* @since 4.6
|
887 |
*/
|
888 |
static protected function form_check_actions() {
|
889 |
WDev()->load_request_fields( 'post', 'do' );
|
@@ -913,10 +918,17 @@ class IncPopup extends IncPopupBase {
|
|
913 |
/**
|
914 |
* Register custom metaboxes for the PopUp editor
|
915 |
*
|
916 |
-
* @since 4.6
|
917 |
* @param WP_Post $post The PopUp being edited.
|
918 |
*/
|
919 |
static public function form_metabox( $post ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
920 |
// Remove core meta boxes.
|
921 |
remove_meta_box( 'submitdiv', IncPopupItem::POST_TYPE, 'side' );
|
922 |
remove_meta_box( 'slugdiv', IncPopupItem::POST_TYPE, 'normal' );
|
@@ -954,7 +966,16 @@ class IncPopup extends IncPopupBase {
|
|
954 |
__( 'Displaying Conditions (optional)', PO_LANG ),
|
955 |
array( 'IncPopup', 'meta_rules' ),
|
956 |
IncPopupItem::POST_TYPE,
|
957 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
958 |
'default'
|
959 |
);
|
960 |
|
@@ -972,7 +993,7 @@ class IncPopup extends IncPopupBase {
|
|
972 |
* Called before the post-edit form is rendered.
|
973 |
* We add the field "PopUp Title" above the form.
|
974 |
*
|
975 |
-
* @since 4.6
|
976 |
* @param WP_Post $post The PopUp being edited.
|
977 |
*/
|
978 |
static public function form_title( $post ) {
|
@@ -994,7 +1015,7 @@ class IncPopup extends IncPopupBase {
|
|
994 |
/**
|
995 |
* Renders the metabox: Content
|
996 |
*
|
997 |
-
* @since 4.6
|
998 |
* @param WP_Post $post The PopUp being edited.
|
999 |
*/
|
1000 |
static public function meta_content( $post ) {
|
@@ -1005,7 +1026,7 @@ class IncPopup extends IncPopupBase {
|
|
1005 |
/**
|
1006 |
* Renders the metabox: Appearance
|
1007 |
*
|
1008 |
-
* @since 4.6
|
1009 |
* @param WP_Post $post The PopUp being edited.
|
1010 |
*/
|
1011 |
static public function meta_appearance( $post ) {
|
@@ -1016,7 +1037,7 @@ class IncPopup extends IncPopupBase {
|
|
1016 |
/**
|
1017 |
* Renders the metabox: Behavior
|
1018 |
*
|
1019 |
-
* @since 4.6
|
1020 |
* @param WP_Post $post The PopUp being edited.
|
1021 |
*/
|
1022 |
static public function meta_behavior( $post ) {
|
@@ -1027,7 +1048,7 @@ class IncPopup extends IncPopupBase {
|
|
1027 |
/**
|
1028 |
* Renders the metabox: Conditions
|
1029 |
*
|
1030 |
-
* @since 4.6
|
1031 |
* @param WP_Post $post The PopUp being edited.
|
1032 |
*/
|
1033 |
static public function meta_rules( $post ) {
|
@@ -1035,10 +1056,21 @@ class IncPopup extends IncPopupBase {
|
|
1035 |
include PO_VIEWS_DIR . 'meta-rules.php';
|
1036 |
}
|
1037 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1038 |
/**
|
1039 |
* Renders the metabox: SubmitDiv (Save, Preview)
|
1040 |
*
|
1041 |
-
* @since 4.6
|
1042 |
* @param WP_Post $post The PopUp being edited.
|
1043 |
*/
|
1044 |
static public function meta_submitdiv( $post ) {
|
@@ -1049,7 +1081,7 @@ class IncPopup extends IncPopupBase {
|
|
1049 |
/**
|
1050 |
* Save the popup data to database
|
1051 |
*
|
1052 |
-
* @since 4.6
|
1053 |
* @param int $post_id Post ID that was saved/created
|
1054 |
* @param WP_Post $post Post object that was saved/created
|
1055 |
* @param bool $update True means the post was updated (not created)
|
@@ -1132,7 +1164,7 @@ class IncPopup extends IncPopupBase {
|
|
1132 |
* Removes the 'message' param from redirect URL.
|
1133 |
* This prevents the default WordPress update-notice to be displayed.
|
1134 |
*
|
1135 |
-
* @since 4.6
|
1136 |
* @param string $url The redirect URL.
|
1137 |
* @param int $post_id Which post was updated.
|
1138 |
* @return string The modified redirect URL.
|
6 |
/**
|
7 |
* Defines the popup class for admin pages.
|
8 |
*
|
9 |
+
* @since 4.6.0
|
10 |
*/
|
11 |
class IncPopup extends IncPopupBase {
|
12 |
|
13 |
/**
|
14 |
* Returns the singleton instance of the popup (admin) class.
|
15 |
*
|
16 |
+
* @since 4.6.0
|
17 |
*/
|
18 |
static public function instance() {
|
19 |
static $Inst = null;
|
35 |
/**
|
36 |
* Private constructor (singleton)
|
37 |
*
|
38 |
+
* @since 4.6.0
|
39 |
*/
|
40 |
protected function __construct() {
|
41 |
parent::__construct();
|
82 |
/**
|
83 |
* Initializes stuff that is only needed on the plugin screen
|
84 |
*
|
85 |
+
* @since 4.6.0
|
86 |
*/
|
87 |
static public function setup_module_specific( $hook ) {
|
88 |
WDev()->load_fields( $hook, 'post_type', 'base' );
|
98 |
|
99 |
WDev()->add_ui( PO_CSS_URL . 'popup-admin.min.css' );
|
100 |
WDev()->add_ui( PO_JS_URL . 'popup-admin.min.js' );
|
101 |
+
WDev()->add_ui( PO_JS_URL . 'ace.js' ); // CSS editor.
|
102 |
WDev()->add_ui( PO_JS_URL . 'public.min.js' ); // For Preview.
|
103 |
|
104 |
if ( $_REQUEST['post_status'] !== 'trash' ) {
|
117 |
'_popup_data',
|
118 |
array(
|
119 |
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
120 |
+
'do' => 'get_data',
|
121 |
'popup' => '',
|
122 |
'noinit' => true,
|
123 |
'preview' => true,
|
231 |
/**
|
232 |
* Register additional menu items in the dashboard.
|
233 |
*
|
234 |
+
* @since 4.6.0
|
235 |
*/
|
236 |
static public function admin_menus() {
|
237 |
global $submenu;
|
300 |
* The Post-Editor does not work on Multisite Network dashboard.
|
301 |
* So display a notice and tell the user to go to the Main Site.
|
302 |
*
|
303 |
+
* @since 4.6.0
|
304 |
*/
|
305 |
static public function network_menu_notice() {
|
306 |
include PO_VIEWS_DIR . 'network.php';
|
309 |
/**
|
310 |
* Handles all admin ajax calls.
|
311 |
*
|
312 |
+
* @since 4.6.0
|
313 |
*/
|
314 |
static public function handle_ajax() {
|
315 |
WDev()->load_post_fields( 'do', 'order' );
|
348 |
/**
|
349 |
* Displays the settings page
|
350 |
*
|
351 |
+
* @since 4.6.0
|
352 |
*/
|
353 |
static public function handle_settings_page() {
|
354 |
include PO_VIEWS_DIR . 'settings.php';
|
357 |
/**
|
358 |
* Called every time the settings page is loaded. Saves changes.
|
359 |
*
|
360 |
+
* @since 4.6.0
|
361 |
*/
|
362 |
static public function handle_settings_update() {
|
363 |
WDev()->load_post_fields( 'action', 'po_option' );
|
398 |
/**
|
399 |
* Filter. Returns the columns for the item list of the popup post-type.
|
400 |
*
|
401 |
+
* @since 4.6.0
|
402 |
* @param array $post_columns
|
403 |
* @return array
|
404 |
*/
|
427 |
/**
|
428 |
* Outputs the contents of a specific column.
|
429 |
*
|
430 |
+
* @since 4.6.0
|
431 |
* @param string $column The column-key (defined in post_columns above).
|
432 |
* @param int $post_id The ID of the popup.
|
433 |
*/
|
581 |
/**
|
582 |
* Filter. Defines the quick-filters above the popup-table.
|
583 |
*
|
584 |
+
* @since 4.6.0
|
585 |
* @param array $views Default filters.
|
586 |
* @return array Modified filters.
|
587 |
*/
|
637 |
* Defines the Bulk Actions available for popups.
|
638 |
* Note: This filter can only be used to *remove* bulk actions.
|
639 |
*
|
640 |
+
* @since 4.6.0
|
641 |
* @param array $actions Default list of bulk actions.
|
642 |
* @return array Modified action list.
|
643 |
*/
|
652 |
/**
|
653 |
* Define our PopUp update messages.
|
654 |
*
|
655 |
+
* @since 4.6.0
|
656 |
* @see wp-admin/edit.php
|
657 |
* @param array $messages Array of messages, by post-type.
|
658 |
* @param array $counts
|
672 |
/**
|
673 |
* Called when the file edit.php is loaded
|
674 |
*
|
675 |
+
* @since 4.6.0
|
676 |
*/
|
677 |
static public function post_list_edit() {
|
678 |
$wp_list_table = _get_list_table( 'WP_Posts_List_Table' );
|
776 |
* Modify the main WP query to avoid pagination on the popup list and sort
|
777 |
* the popup list by the popup-order.
|
778 |
*
|
779 |
+
* @since 4.6.0
|
780 |
*/
|
781 |
static public function post_query( $query ) {
|
782 |
if ( ! $query->is_main_query() ) { return; }
|
790 |
* Returns the custom value of "items-per-page".
|
791 |
* This value is used by WordPress to generate the pagination links.
|
792 |
*
|
793 |
+
* @since 4.6.0
|
794 |
* @param int $value Default value set in Database
|
795 |
* @param string $post_type
|
796 |
* @return int Customized value
|
806 |
/**
|
807 |
* Remove the posts-per-page filter from screen options.
|
808 |
*
|
809 |
+
* @since 4.6.0
|
810 |
*/
|
811 |
static public function post_screenoptions() {
|
812 |
$screen = get_current_screen();
|
817 |
* Takes an array as input and updates the order of all popups according to
|
818 |
* the definition in the array.
|
819 |
*
|
820 |
+
* @since 4.6.0
|
821 |
* @param array $order List of popup-IDs
|
822 |
*/
|
823 |
static public function post_order( $order ) {
|
851 |
/**
|
852 |
* Save the popup data to database.
|
853 |
*
|
854 |
+
* Intentionally no nonce-check: We want to validate the popup-positions
|
855 |
+
* every time a popup is modified, regardless from where the change was
|
856 |
+
* initiated.
|
857 |
+
*
|
858 |
+
* @since 4.6.0
|
859 |
* @param int $post_id Post ID that was saved/created
|
860 |
* @param WP_Post $post Post object that was saved/created
|
861 |
* @param bool $update True means the post was updated (not created)
|
888 |
/**
|
889 |
* Executes custom form actions, such as "duplicate PopUp"
|
890 |
*
|
891 |
+
* @since 4.6.0
|
892 |
*/
|
893 |
static protected function form_check_actions() {
|
894 |
WDev()->load_request_fields( 'post', 'do' );
|
918 |
/**
|
919 |
* Register custom metaboxes for the PopUp editor
|
920 |
*
|
921 |
+
* @since 4.6.0
|
922 |
* @param WP_Post $post The PopUp being edited.
|
923 |
*/
|
924 |
static public function form_metabox( $post ) {
|
925 |
+
$meta_order = get_user_option( 'meta-box-order_' . IncPopupItem::POST_TYPE );
|
926 |
+
$po_meta = array( 'submitdiv', 'meta-content', 'meta-appearance', 'meta_behavior', 'meta-rules', 'meta-customcss' );
|
927 |
+
$meta_order['side'] = str_replace( $po_meta, '', $meta_order['side'] );
|
928 |
+
$meta_order['normal'] = str_replace( $po_meta, '', $meta_order['normal'] );
|
929 |
+
$meta_order['advanced'] = str_replace( $po_meta, '', $meta_order['advanced'] );
|
930 |
+
update_user_option( get_current_user_id(), 'meta-box-order_' . IncPopupItem::POST_TYPE, $meta_order );
|
931 |
+
|
932 |
// Remove core meta boxes.
|
933 |
remove_meta_box( 'submitdiv', IncPopupItem::POST_TYPE, 'side' );
|
934 |
remove_meta_box( 'slugdiv', IncPopupItem::POST_TYPE, 'normal' );
|
966 |
__( 'Displaying Conditions (optional)', PO_LANG ),
|
967 |
array( 'IncPopup', 'meta_rules' ),
|
968 |
IncPopupItem::POST_TYPE,
|
969 |
+
'advanced',
|
970 |
+
'default'
|
971 |
+
);
|
972 |
+
|
973 |
+
add_meta_box(
|
974 |
+
'meta-customcss',
|
975 |
+
__( 'Custom CSS (optional)', PO_LANG ),
|
976 |
+
array( 'IncPopup', 'meta_customcss' ),
|
977 |
+
IncPopupItem::POST_TYPE,
|
978 |
+
'advanced',
|
979 |
'default'
|
980 |
);
|
981 |
|
993 |
* Called before the post-edit form is rendered.
|
994 |
* We add the field "PopUp Title" above the form.
|
995 |
*
|
996 |
+
* @since 4.6.0
|
997 |
* @param WP_Post $post The PopUp being edited.
|
998 |
*/
|
999 |
static public function form_title( $post ) {
|
1015 |
/**
|
1016 |
* Renders the metabox: Content
|
1017 |
*
|
1018 |
+
* @since 4.6.0
|
1019 |
* @param WP_Post $post The PopUp being edited.
|
1020 |
*/
|
1021 |
static public function meta_content( $post ) {
|
1026 |
/**
|
1027 |
* Renders the metabox: Appearance
|
1028 |
*
|
1029 |
+
* @since 4.6.0
|
1030 |
* @param WP_Post $post The PopUp being edited.
|
1031 |
*/
|
1032 |
static public function meta_appearance( $post ) {
|
1037 |
/**
|
1038 |
* Renders the metabox: Behavior
|
1039 |
*
|
1040 |
+
* @since 4.6.0
|
1041 |
* @param WP_Post $post The PopUp being edited.
|
1042 |
*/
|
1043 |
static public function meta_behavior( $post ) {
|
1048 |
/**
|
1049 |
* Renders the metabox: Conditions
|
1050 |
*
|
1051 |
+
* @since 4.6.0
|
1052 |
* @param WP_Post $post The PopUp being edited.
|
1053 |
*/
|
1054 |
static public function meta_rules( $post ) {
|
1056 |
include PO_VIEWS_DIR . 'meta-rules.php';
|
1057 |
}
|
1058 |
|
1059 |
+
/**
|
1060 |
+
* Renders the metabox: Custom CSS
|
1061 |
+
*
|
1062 |
+
* @since 4.7.0
|
1063 |
+
* @param WP_Post $post The PopUp being edited.
|
1064 |
+
*/
|
1065 |
+
static public function meta_customcss( $post ) {
|
1066 |
+
$popup = IncPopupDatabase::get( $post->ID );
|
1067 |
+
include PO_VIEWS_DIR . 'meta-customcss.php';
|
1068 |
+
}
|
1069 |
+
|
1070 |
/**
|
1071 |
* Renders the metabox: SubmitDiv (Save, Preview)
|
1072 |
*
|
1073 |
+
* @since 4.6.0
|
1074 |
* @param WP_Post $post The PopUp being edited.
|
1075 |
*/
|
1076 |
static public function meta_submitdiv( $post ) {
|
1081 |
/**
|
1082 |
* Save the popup data to database
|
1083 |
*
|
1084 |
+
* @since 4.6.0
|
1085 |
* @param int $post_id Post ID that was saved/created
|
1086 |
* @param WP_Post $post Post object that was saved/created
|
1087 |
* @param bool $update True means the post was updated (not created)
|
1164 |
* Removes the 'message' param from redirect URL.
|
1165 |
* This prevents the default WordPress update-notice to be displayed.
|
1166 |
*
|
1167 |
+
* @since 4.6.0
|
1168 |
* @param string $url The redirect URL.
|
1169 |
* @param int $post_id Which post was updated.
|
1170 |
* @return string The modified redirect URL.
|
inc/class-popup-base.php
CHANGED
@@ -47,6 +47,16 @@ abstract class IncPopupBase {
|
|
47 |
add_action( 'parse_query', array( $this, 'prepare_url' ) );
|
48 |
}
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
WDev()->translate_plugin( PO_LANG, PO_LANG_DIR );
|
51 |
|
52 |
// Register the popup post type.
|
@@ -201,7 +211,7 @@ abstract class IncPopupBase {
|
|
201 |
'dir' => trailingslashit( PO_TPL_DIR . $key ),
|
202 |
'name' => $data->name,
|
203 |
'pro' => $data->pro,
|
204 |
-
'deprecated' => $data->deprecated,
|
205 |
);
|
206 |
if ( isset( $urls[$data->name] ) ) { unset( $urls[$data->name] ); }
|
207 |
if ( isset( $paths[$data->name] ) ) { unset( $paths[$data->name] ); }
|
@@ -298,7 +308,11 @@ abstract class IncPopupBase {
|
|
298 |
'po_display',
|
299 |
'po_display_data',
|
300 |
'po_hide_expire',
|
301 |
-
'po_rule'
|
|
|
|
|
|
|
|
|
302 |
);
|
303 |
|
304 |
$data = array(
|
@@ -325,6 +339,9 @@ abstract class IncPopupBase {
|
|
325 |
'width' => $form['po_size_width'],
|
326 |
'height' => $form['po_size_height'],
|
327 |
),
|
|
|
|
|
|
|
328 |
|
329 |
// Meta: Behavior
|
330 |
'display' => $form['po_display'],
|
@@ -333,6 +350,7 @@ abstract class IncPopupBase {
|
|
333 |
'close_hides' => isset( $form['po_close_hides'] ),
|
334 |
'hide_expire' => $form['po_hide_expire'],
|
335 |
'overlay_close' => ! isset( $form['po_overlay_close'] ),
|
|
|
336 |
|
337 |
// Meta: Rules:
|
338 |
'rule' => $form['po_rule'],
|
@@ -354,7 +372,7 @@ abstract class IncPopupBase {
|
|
354 |
$action = $_REQUEST['do'];
|
355 |
|
356 |
switch ( $action ) {
|
357 |
-
case '
|
358 |
if ( isset( $_REQUEST['data']['post_type'] )
|
359 |
&& IncPopupItem::POST_TYPE == $_REQUEST['data']['post_type']
|
360 |
) {
|
@@ -368,6 +386,7 @@ abstract class IncPopupBase {
|
|
368 |
|
369 |
if ( ! empty( $this->popups ) ) {
|
370 |
$data = $this->get_popup_data();
|
|
|
371 |
echo 'po_data(' . json_encode( $data ) . ')';
|
372 |
}
|
373 |
die();
|
47 |
add_action( 'parse_query', array( $this, 'prepare_url' ) );
|
48 |
}
|
49 |
|
50 |
+
/*
|
51 |
+
* URLs for the "from" and "referer" fields are transmitted in reversed
|
52 |
+
* format (moc.elpmaxe//:ptth)
|
53 |
+
* Reason for this is that plugins like iThemes security might block
|
54 |
+
* incoming requests that contain the value "http://". This is how
|
55 |
+
* we bypass that security check.
|
56 |
+
*/
|
57 |
+
if ( ! empty( $_REQUEST['thefrom'] ) ) { $_REQUEST['thefrom'] = strrev( $_REQUEST['thefrom'] ); }
|
58 |
+
if ( ! empty( $_REQUEST['thereferrer'] ) ) { $_REQUEST['thereferrer'] = strrev( $_REQUEST['thereferrer'] ); }
|
59 |
+
|
60 |
WDev()->translate_plugin( PO_LANG, PO_LANG_DIR );
|
61 |
|
62 |
// Register the popup post type.
|
211 |
'dir' => trailingslashit( PO_TPL_DIR . $key ),
|
212 |
'name' => $data->name,
|
213 |
'pro' => $data->pro,
|
214 |
+
'deprecated' => (bool) $data->deprecated,
|
215 |
);
|
216 |
if ( isset( $urls[$data->name] ) ) { unset( $urls[$data->name] ); }
|
217 |
if ( isset( $paths[$data->name] ) ) { unset( $paths[$data->name] ); }
|
308 |
'po_display',
|
309 |
'po_display_data',
|
310 |
'po_hide_expire',
|
311 |
+
'po_rule',
|
312 |
+
'po_custom_css',
|
313 |
+
'po_animation_in',
|
314 |
+
'po_animation_out',
|
315 |
+
'po_form_submit'
|
316 |
);
|
317 |
|
318 |
$data = array(
|
339 |
'width' => $form['po_size_width'],
|
340 |
'height' => $form['po_size_height'],
|
341 |
),
|
342 |
+
'custom_css' => $form['po_custom_css'],
|
343 |
+
'animation_in' => $form['po_animation_in'],
|
344 |
+
'animation_out' => $form['po_animation_out'],
|
345 |
|
346 |
// Meta: Behavior
|
347 |
'display' => $form['po_display'],
|
350 |
'close_hides' => isset( $form['po_close_hides'] ),
|
351 |
'hide_expire' => $form['po_hide_expire'],
|
352 |
'overlay_close' => ! isset( $form['po_overlay_close'] ),
|
353 |
+
'form_submit' => $form['po_form_submit'],
|
354 |
|
355 |
// Meta: Rules:
|
356 |
'rule' => $form['po_rule'],
|
372 |
$action = $_REQUEST['do'];
|
373 |
|
374 |
switch ( $action ) {
|
375 |
+
case 'get_data':
|
376 |
if ( isset( $_REQUEST['data']['post_type'] )
|
377 |
&& IncPopupItem::POST_TYPE == $_REQUEST['data']['post_type']
|
378 |
) {
|
386 |
|
387 |
if ( ! empty( $this->popups ) ) {
|
388 |
$data = $this->get_popup_data();
|
389 |
+
header( 'Content-Type: application/javascript' );
|
390 |
echo 'po_data(' . json_encode( $data ) . ')';
|
391 |
}
|
392 |
die();
|
inc/class-popup-item.php
CHANGED
@@ -89,6 +89,9 @@ class IncPopupItem {
|
|
89 |
// Allow page to be scrolled while PopUp is open.
|
90 |
public $scroll_body = true;
|
91 |
|
|
|
|
|
|
|
92 |
// -- "Never show again" options
|
93 |
|
94 |
// Add button "Never show popup again".
|
@@ -100,9 +103,14 @@ class IncPopupItem {
|
|
100 |
// Expiration of "Never show popup again" (in days).
|
101 |
public $hide_expire = 365;
|
102 |
|
|
|
|
|
103 |
// Close popup when user clicks on the background overlay?
|
104 |
public $overlay_close = true;
|
105 |
|
|
|
|
|
|
|
106 |
// -- Display options
|
107 |
|
108 |
// When to display the popup (delay/scroll/anchor).
|
@@ -111,6 +119,12 @@ class IncPopupItem {
|
|
111 |
// Collection of additional options for the $display option (e.g. delay, ...)
|
112 |
public $display_data = array();
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
// -- Conditions
|
115 |
|
116 |
// Conditions that need to be true in order to use the popup.
|
@@ -188,6 +202,7 @@ class IncPopupItem {
|
|
188 |
'col2' => '',
|
189 |
);
|
190 |
$this->style = 'minimal';
|
|
|
191 |
$this->deprecated_style = false;
|
192 |
$this->round_corners = true;
|
193 |
$this->scroll_body = false;
|
@@ -195,6 +210,7 @@ class IncPopupItem {
|
|
195 |
$this->close_hides = false;
|
196 |
$this->hide_expire = 365;
|
197 |
$this->overlay_close = true;
|
|
|
198 |
$this->display = 'delay';
|
199 |
$this->display_data = array(
|
200 |
'delay' => 0,
|
@@ -203,6 +219,8 @@ class IncPopupItem {
|
|
203 |
'scroll_type' => '%',
|
204 |
'anchor' => '',
|
205 |
);
|
|
|
|
|
206 |
$this->rule = array();
|
207 |
$this->rule_files = array();
|
208 |
$this->rule_data = array();
|
@@ -247,6 +265,9 @@ class IncPopupItem {
|
|
247 |
isset( $data['cta_label'] ) && $this->cta_label = $data['cta_label'];
|
248 |
isset( $data['cta_link'] ) && $this->cta_link = $data['cta_link'];
|
249 |
isset( $data['custom_size'] ) && $this->custom_size = $data['custom_size'];
|
|
|
|
|
|
|
250 |
|
251 |
isset( $data['size']['width'] ) && $this->size['width'] = $data['size']['width'];
|
252 |
isset( $data['size']['height'] ) && $this->size['height'] = $data['size']['height'];
|
@@ -265,6 +286,7 @@ class IncPopupItem {
|
|
265 |
isset( $data['close_hides'] ) && $this->close_hides = (true == $data['close_hides']);
|
266 |
absint( @$data['hide_expire'] ) > 0 && $this->hide_expire = absint( $data['hide_expire'] );
|
267 |
isset( $data['overlay_close'] ) && $this->overlay_close = ( true == $data['overlay_close'] );
|
|
|
268 |
|
269 |
in_array( @$data['display'], self::$display_opts ) && $this->display = $data['display'];
|
270 |
|
@@ -367,6 +389,10 @@ class IncPopupItem {
|
|
367 |
$this->code->color2 = $this->color['col2'];
|
368 |
}
|
369 |
|
|
|
|
|
|
|
|
|
370 |
$this->script_data['html_id'] = $this->code->id;
|
371 |
$this->script_data['popup_id'] = $this->id;
|
372 |
$this->script_data['close_hide'] = $this->close_hides;
|
@@ -378,6 +404,9 @@ class IncPopupItem {
|
|
378 |
$this->script_data['display'] = $this->display;
|
379 |
$this->script_data['display_data'] = $this->display_data;
|
380 |
$this->script_data['scroll_body'] = $this->scroll_body;
|
|
|
|
|
|
|
381 |
|
382 |
// Validation only done when editing popups.
|
383 |
if ( is_admin() ) {
|
@@ -458,12 +487,16 @@ class IncPopupItem {
|
|
458 |
$this->color = get_post_meta( $this->id, 'po_color', true );
|
459 |
$this->custom_colors = get_post_meta( $this->id, 'po_custom_colors', true );
|
460 |
$this->style = get_post_meta( $this->id, 'po_style', true );
|
|
|
|
|
|
|
461 |
$this->round_corners = get_post_meta( $this->id, 'po_round_corners', true );
|
462 |
$this->scroll_body = get_post_meta( $this->id, 'po_scroll_body', true );
|
463 |
$this->can_hide = get_post_meta( $this->id, 'po_can_hide', true );
|
464 |
$this->close_hides = get_post_meta( $this->id, 'po_close_hides', true );
|
465 |
$this->hide_expire = get_post_meta( $this->id, 'po_hide_expire', true );
|
466 |
$this->overlay_close = get_post_meta( $this->id, 'po_overlay_close', true );
|
|
|
467 |
$this->display = get_post_meta( $this->id, 'po_display', true );
|
468 |
$this->display_data = get_post_meta( $this->id, 'po_display_data', true );
|
469 |
$this->rule = get_post_meta( $this->id, 'po_rule', true );
|
@@ -518,10 +551,15 @@ class IncPopupItem {
|
|
518 |
}
|
519 |
|
520 |
// When the content changed make sure to only allow valid code!
|
521 |
-
if ( $this->content != $this->orig_content
|
|
|
|
|
522 |
$this->content = wp_kses( $this->content, $allowedposttags );
|
523 |
}
|
524 |
|
|
|
|
|
|
|
525 |
$post = array(
|
526 |
'ID' => (0 == $this->id ? '' : $this->id),
|
527 |
'post_title' => $this->name,
|
@@ -550,12 +588,16 @@ class IncPopupItem {
|
|
550 |
update_post_meta( $this->id, 'po_color', $this->color );
|
551 |
update_post_meta( $this->id, 'po_custom_colors', $this->custom_colors );
|
552 |
update_post_meta( $this->id, 'po_style', $this->style );
|
|
|
|
|
|
|
553 |
update_post_meta( $this->id, 'po_round_corners', $this->round_corners );
|
554 |
update_post_meta( $this->id, 'po_scroll_body', $this->scroll_body );
|
555 |
update_post_meta( $this->id, 'po_can_hide', $this->can_hide );
|
556 |
update_post_meta( $this->id, 'po_close_hides', $this->close_hides );
|
557 |
update_post_meta( $this->id, 'po_hide_expire', $this->hide_expire );
|
558 |
update_post_meta( $this->id, 'po_overlay_close', $this->overlay_close );
|
|
|
559 |
update_post_meta( $this->id, 'po_display', $this->display );
|
560 |
update_post_meta( $this->id, 'po_display_data', $this->display_data );
|
561 |
update_post_meta( $this->id, 'po_rule', $this->rule );
|
@@ -595,6 +637,52 @@ class IncPopupItem {
|
|
595 |
return true;
|
596 |
}
|
597 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
598 |
/**
|
599 |
* Checks whether the current popup uses the specified rule or not.
|
600 |
*
|
@@ -674,6 +762,11 @@ class IncPopupItem {
|
|
674 |
$Code[ $this->id ] = str_replace( '#000001', $this->code->color1, $Code[ $this->id ] );
|
675 |
$Code[ $this->id ] = str_replace( '#000002', $this->code->color2, $Code[ $this->id ] );
|
676 |
}
|
|
|
|
|
|
|
|
|
|
|
677 |
}
|
678 |
return $Code[ $this->id ];
|
679 |
}
|
89 |
// Allow page to be scrolled while PopUp is open.
|
90 |
public $scroll_body = true;
|
91 |
|
92 |
+
// CSS code to customize this PopUp
|
93 |
+
public $custom_css = '';
|
94 |
+
|
95 |
// -- "Never show again" options
|
96 |
|
97 |
// Add button "Never show popup again".
|
103 |
// Expiration of "Never show popup again" (in days).
|
104 |
public $hide_expire = 365;
|
105 |
|
106 |
+
// -- Behavior options
|
107 |
+
|
108 |
// Close popup when user clicks on the background overlay?
|
109 |
public $overlay_close = true;
|
110 |
|
111 |
+
// What do do when form is submitted inside PopUp
|
112 |
+
public $form_submit = 'default';
|
113 |
+
|
114 |
// -- Display options
|
115 |
|
116 |
// When to display the popup (delay/scroll/anchor).
|
119 |
// Collection of additional options for the $display option (e.g. delay, ...)
|
120 |
public $display_data = array();
|
121 |
|
122 |
+
// Display animation
|
123 |
+
public $animation_in = '';
|
124 |
+
|
125 |
+
// Hiding animation
|
126 |
+
public $animation_out = '';
|
127 |
+
|
128 |
// -- Conditions
|
129 |
|
130 |
// Conditions that need to be true in order to use the popup.
|
202 |
'col2' => '',
|
203 |
);
|
204 |
$this->style = 'minimal';
|
205 |
+
$this->custom_css = '';
|
206 |
$this->deprecated_style = false;
|
207 |
$this->round_corners = true;
|
208 |
$this->scroll_body = false;
|
210 |
$this->close_hides = false;
|
211 |
$this->hide_expire = 365;
|
212 |
$this->overlay_close = true;
|
213 |
+
$this->form_submit = 'default';
|
214 |
$this->display = 'delay';
|
215 |
$this->display_data = array(
|
216 |
'delay' => 0,
|
219 |
'scroll_type' => '%',
|
220 |
'anchor' => '',
|
221 |
);
|
222 |
+
$this->animation_in = '';
|
223 |
+
$this->animation_out = '';
|
224 |
$this->rule = array();
|
225 |
$this->rule_files = array();
|
226 |
$this->rule_data = array();
|
265 |
isset( $data['cta_label'] ) && $this->cta_label = $data['cta_label'];
|
266 |
isset( $data['cta_link'] ) && $this->cta_link = $data['cta_link'];
|
267 |
isset( $data['custom_size'] ) && $this->custom_size = $data['custom_size'];
|
268 |
+
isset( $data['custom_css'] ) && $this->custom_css = $data['custom_css'];
|
269 |
+
isset( $data['animation_in'] ) && $this->animation_in = $data['animation_in'];
|
270 |
+
isset( $data['animation_out'] ) && $this->animation_out = $data['animation_out'];
|
271 |
|
272 |
isset( $data['size']['width'] ) && $this->size['width'] = $data['size']['width'];
|
273 |
isset( $data['size']['height'] ) && $this->size['height'] = $data['size']['height'];
|
286 |
isset( $data['close_hides'] ) && $this->close_hides = (true == $data['close_hides']);
|
287 |
absint( @$data['hide_expire'] ) > 0 && $this->hide_expire = absint( $data['hide_expire'] );
|
288 |
isset( $data['overlay_close'] ) && $this->overlay_close = ( true == $data['overlay_close'] );
|
289 |
+
isset( $data['form_submit'] ) && $this->form_submit = $data['form_submit'];
|
290 |
|
291 |
in_array( @$data['display'], self::$display_opts ) && $this->display = $data['display'];
|
292 |
|
389 |
$this->code->color2 = $this->color['col2'];
|
390 |
}
|
391 |
|
392 |
+
// Very rough validation that makes sure that the field does not close
|
393 |
+
// the <style> tag manually.
|
394 |
+
$this->custom_css = str_replace( '</s', 's', $this->custom_css );
|
395 |
+
|
396 |
$this->script_data['html_id'] = $this->code->id;
|
397 |
$this->script_data['popup_id'] = $this->id;
|
398 |
$this->script_data['close_hide'] = $this->close_hides;
|
404 |
$this->script_data['display'] = $this->display;
|
405 |
$this->script_data['display_data'] = $this->display_data;
|
406 |
$this->script_data['scroll_body'] = $this->scroll_body;
|
407 |
+
$this->script_data['form_submit'] = $this->form_submit;
|
408 |
+
$this->script_data['animation_in'] = $this->animation_in;
|
409 |
+
$this->script_data['animation_out'] = $this->animation_out;
|
410 |
|
411 |
// Validation only done when editing popups.
|
412 |
if ( is_admin() ) {
|
487 |
$this->color = get_post_meta( $this->id, 'po_color', true );
|
488 |
$this->custom_colors = get_post_meta( $this->id, 'po_custom_colors', true );
|
489 |
$this->style = get_post_meta( $this->id, 'po_style', true );
|
490 |
+
$this->custom_css = get_post_meta( $this->id, 'po_custom_css', true );
|
491 |
+
$this->animation_in = get_post_meta( $this->id, 'po_animation_in', true );
|
492 |
+
$this->animation_out = get_post_meta( $this->id, 'po_animation_out', true );
|
493 |
$this->round_corners = get_post_meta( $this->id, 'po_round_corners', true );
|
494 |
$this->scroll_body = get_post_meta( $this->id, 'po_scroll_body', true );
|
495 |
$this->can_hide = get_post_meta( $this->id, 'po_can_hide', true );
|
496 |
$this->close_hides = get_post_meta( $this->id, 'po_close_hides', true );
|
497 |
$this->hide_expire = get_post_meta( $this->id, 'po_hide_expire', true );
|
498 |
$this->overlay_close = get_post_meta( $this->id, 'po_overlay_close', true );
|
499 |
+
$this->form_submit = get_post_meta( $this->id, 'po_form_submit', true );
|
500 |
$this->display = get_post_meta( $this->id, 'po_display', true );
|
501 |
$this->display_data = get_post_meta( $this->id, 'po_display_data', true );
|
502 |
$this->rule = get_post_meta( $this->id, 'po_rule', true );
|
551 |
}
|
552 |
|
553 |
// When the content changed make sure to only allow valid code!
|
554 |
+
if ( $this->content != $this->orig_content
|
555 |
+
&& ! current_user_can( 'unfiltered_html' )
|
556 |
+
) {
|
557 |
$this->content = wp_kses( $this->content, $allowedposttags );
|
558 |
}
|
559 |
|
560 |
+
// Check if the content contains (potentially) incompatible shortcodes.
|
561 |
+
self::validate_shortcodes( $this->content );
|
562 |
+
|
563 |
$post = array(
|
564 |
'ID' => (0 == $this->id ? '' : $this->id),
|
565 |
'post_title' => $this->name,
|
588 |
update_post_meta( $this->id, 'po_color', $this->color );
|
589 |
update_post_meta( $this->id, 'po_custom_colors', $this->custom_colors );
|
590 |
update_post_meta( $this->id, 'po_style', $this->style );
|
591 |
+
update_post_meta( $this->id, 'po_custom_css', $this->custom_css );
|
592 |
+
update_post_meta( $this->id, 'po_animation_in', $this->animation_in );
|
593 |
+
update_post_meta( $this->id, 'po_animation_out', $this->animation_out );
|
594 |
update_post_meta( $this->id, 'po_round_corners', $this->round_corners );
|
595 |
update_post_meta( $this->id, 'po_scroll_body', $this->scroll_body );
|
596 |
update_post_meta( $this->id, 'po_can_hide', $this->can_hide );
|
597 |
update_post_meta( $this->id, 'po_close_hides', $this->close_hides );
|
598 |
update_post_meta( $this->id, 'po_hide_expire', $this->hide_expire );
|
599 |
update_post_meta( $this->id, 'po_overlay_close', $this->overlay_close );
|
600 |
+
update_post_meta( $this->id, 'po_form_submit', $this->form_submit );
|
601 |
update_post_meta( $this->id, 'po_display', $this->display );
|
602 |
update_post_meta( $this->id, 'po_display_data', $this->display_data );
|
603 |
update_post_meta( $this->id, 'po_rule', $this->rule );
|
637 |
return true;
|
638 |
}
|
639 |
|
640 |
+
/**
|
641 |
+
* Parses the specified content and looks for shortcodes that are not
|
642 |
+
* compatible with the current PopUp loading method.
|
643 |
+
*
|
644 |
+
* The function does not return a value, but if incompatible shortcodes are
|
645 |
+
* detected a new Admin Notification will be generated which is displayed to
|
646 |
+
* the user after the page has finished loading.
|
647 |
+
*
|
648 |
+
* @since 4.7.0
|
649 |
+
* @param string $content
|
650 |
+
*/
|
651 |
+
public static function validate_shortcodes( $content ) {
|
652 |
+
$settings = IncPopupDatabase::get_settings();
|
653 |
+
$method = isset( $settings['loadingmethod'] ) ? $settings['loadingmethod'] : 'ajax';
|
654 |
+
|
655 |
+
switch ( $method ) {
|
656 |
+
case 'ajax':
|
657 |
+
case 'anonymous':
|
658 |
+
// Check if the content contains any of the Front-Shortcodes:
|
659 |
+
$check = IncPopupAddon_HeaderFooter::check();
|
660 |
+
$content = do_shortcode( $content );
|
661 |
+
foreach ( $check->shortcodes as $code ) {
|
662 |
+
$match = array();
|
663 |
+
if ( preg_match( '#\[' . $code . '(\s.*?\]|\])#', $content, $match ) ) {
|
664 |
+
WDev()->message(
|
665 |
+
sprintf(
|
666 |
+
__( 'Shortcode <code>%s</code> requires a different <a href="%s">loading method</a> to work.<br />Try "Page Footer", though sometimes the method "Custom AJAX" also works (please test the result)', PO_LANG ),
|
667 |
+
$match[0],
|
668 |
+
'edit.php?post_type=' . IncPopupItem::POST_TYPE . '&page=settings'
|
669 |
+
),
|
670 |
+
'err'
|
671 |
+
);
|
672 |
+
}
|
673 |
+
}
|
674 |
+
break;
|
675 |
+
|
676 |
+
case 'footer':
|
677 |
+
case 'front':
|
678 |
+
// Nothing needs to be validated here...
|
679 |
+
break;
|
680 |
+
|
681 |
+
default:
|
682 |
+
//WDev()->message( 'Shortcode-Check not defined for: ' . $method );
|
683 |
+
}
|
684 |
+
}
|
685 |
+
|
686 |
/**
|
687 |
* Checks whether the current popup uses the specified rule or not.
|
688 |
*
|
762 |
$Code[ $this->id ] = str_replace( '#000001', $this->code->color1, $Code[ $this->id ] );
|
763 |
$Code[ $this->id ] = str_replace( '#000002', $this->code->color2, $Code[ $this->id ] );
|
764 |
}
|
765 |
+
$custom_css = $this->custom_css;
|
766 |
+
$custom_css = str_replace( '#popup', '#' . $this->code->id, $custom_css );
|
767 |
+
$custom_css = str_replace( '#messagebox', '#' . $this->code->id, $custom_css );
|
768 |
+
$custom_css = str_replace( '%styleurl%', $details->url, $custom_css );
|
769 |
+
$Code[ $this->id ] .= $custom_css;
|
770 |
}
|
771 |
return $Code[ $this->id ];
|
772 |
}
|
inc/class-popup-public.php
CHANGED
@@ -80,7 +80,7 @@ class IncPopup extends IncPopupBase {
|
|
80 |
|
81 |
// Initialize javascript-data.
|
82 |
$this->script_data['ajaxurl'] = '';
|
83 |
-
$this->script_data['do'] = '
|
84 |
$this->script_data['ajax_data'] = array();
|
85 |
|
86 |
// Find the current loading method.
|
@@ -89,9 +89,6 @@ class IncPopup extends IncPopupBase {
|
|
89 |
|
90 |
if ( isset( $_POST['_po_method_'] ) ) { $cur_method = $_POST['_po_method_']; }
|
91 |
|
92 |
-
if ( ! empty( $_REQUEST['thefrom'] ) ) { $_REQUEST['thefrom'] = strrev( $_REQUEST['thefrom'] ); }
|
93 |
-
if ( ! empty( $_REQUEST['thereferrer'] ) ) { $_REQUEST['thereferrer'] = strrev( $_REQUEST['thereferrer'] ); }
|
94 |
-
|
95 |
/*
|
96 |
* Apply the specific loading method to include the popup on the page.
|
97 |
* Details to the loading methods are documented in the header comment
|
@@ -145,28 +142,18 @@ class IncPopup extends IncPopupBase {
|
|
145 |
return;
|
146 |
}
|
147 |
|
148 |
-
wp_register_script(
|
149 |
-
'popup-public',
|
150 |
-
PO_JS_URL . 'public.min.js',
|
151 |
-
array( 'jquery' ),
|
152 |
-
false,
|
153 |
-
true
|
154 |
-
);
|
155 |
-
|
156 |
$popup_data = apply_filters( 'popup-ajax-data', $this->script_data );
|
157 |
|
158 |
-
|
159 |
-
|
160 |
-
'_popup_data',
|
161 |
-
$popup_data
|
162 |
-
);
|
163 |
-
|
164 |
-
wp_enqueue_script( 'popup-public' );
|
165 |
}
|
166 |
|
167 |
/**
|
168 |
* Load-Method: External
|
169 |
*
|
|
|
|
|
|
|
170 |
* PopUp data is loaded via a normal WordPress ajax request, directed at
|
171 |
* the admin-ajax.php handler.
|
172 |
*
|
@@ -186,6 +173,9 @@ class IncPopup extends IncPopupBase {
|
|
186 |
/**
|
187 |
* Load-Method: Front/Frontloading
|
188 |
*
|
|
|
|
|
|
|
189 |
* PopUp data is loaded in an ajax request. The ajax request is directed
|
190 |
* at the same URL that is currently displayed, but a few URL-parameters are
|
191 |
* added to instruct the plugin to return popup-data instead the the normal
|
@@ -210,6 +200,9 @@ class IncPopup extends IncPopupBase {
|
|
210 |
/**
|
211 |
* Load-Method: Footer
|
212 |
*
|
|
|
|
|
|
|
213 |
* The PopUp styles and html is directly injected into the webpage header
|
214 |
* and footer. The PopUp is ready when the page is loaded. No ajax request
|
215 |
* is made.
|
80 |
|
81 |
// Initialize javascript-data.
|
82 |
$this->script_data['ajaxurl'] = '';
|
83 |
+
$this->script_data['do'] = 'get_data';
|
84 |
$this->script_data['ajax_data'] = array();
|
85 |
|
86 |
// Find the current loading method.
|
89 |
|
90 |
if ( isset( $_POST['_po_method_'] ) ) { $cur_method = $_POST['_po_method_']; }
|
91 |
|
|
|
|
|
|
|
92 |
/*
|
93 |
* Apply the specific loading method to include the popup on the page.
|
94 |
* Details to the loading methods are documented in the header comment
|
142 |
return;
|
143 |
}
|
144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
$popup_data = apply_filters( 'popup-ajax-data', $this->script_data );
|
146 |
|
147 |
+
WDev()->add_data( '_popup_data', $popup_data, 'front' );
|
148 |
+
WDev()->add_ui( PO_JS_URL . 'public.min.js', 'front' );
|
|
|
|
|
|
|
|
|
|
|
149 |
}
|
150 |
|
151 |
/**
|
152 |
* Load-Method: External
|
153 |
*
|
154 |
+
* IS AJAX
|
155 |
+
* IS ADMIN
|
156 |
+
*
|
157 |
* PopUp data is loaded via a normal WordPress ajax request, directed at
|
158 |
* the admin-ajax.php handler.
|
159 |
*
|
173 |
/**
|
174 |
* Load-Method: Front/Frontloading
|
175 |
*
|
176 |
+
* NOT AJAX
|
177 |
+
* NOT ADMIN
|
178 |
+
*
|
179 |
* PopUp data is loaded in an ajax request. The ajax request is directed
|
180 |
* at the same URL that is currently displayed, but a few URL-parameters are
|
181 |
* added to instruct the plugin to return popup-data instead the the normal
|
200 |
/**
|
201 |
* Load-Method: Footer
|
202 |
*
|
203 |
+
* NOT AJAX
|
204 |
+
* NOT ADMIN
|
205 |
+
*
|
206 |
* The PopUp styles and html is directly injected into the webpage header
|
207 |
* and footer. The PopUp is ready when the page is loaded. No ajax request
|
208 |
* is made.
|
inc/class-popup-rule.php
CHANGED
@@ -443,4 +443,4 @@ abstract class IncPopupRule {
|
|
443 |
<?php
|
444 |
}
|
445 |
|
446 |
-
};
|
443 |
<?php
|
444 |
}
|
445 |
|
446 |
+
};
|
inc/external/wpmu-lib/changelog.txt
CHANGED
@@ -4,6 +4,14 @@ Author: Philipp Stracker
|
|
4 |
Change Log:
|
5 |
----------------------------------------------------------------------
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
1.0.15
|
8 |
----------------------------------------------------------------------
|
9 |
- Add new session storage functions: WDev()->store_add(), store_get()
|
4 |
Change Log:
|
5 |
----------------------------------------------------------------------
|
6 |
|
7 |
+
1.0.17
|
8 |
+
----------------------------------------------------------------------
|
9 |
+
- Fix issue where scripts were not loaded in some cases
|
10 |
+
|
11 |
+
1.0.16
|
12 |
+
----------------------------------------------------------------------
|
13 |
+
- Fix error on servers that run older version than PHP 5.3
|
14 |
+
|
15 |
1.0.15
|
16 |
----------------------------------------------------------------------
|
17 |
- Add new session storage functions: WDev()->store_add(), store_get()
|
inc/external/wpmu-lib/core.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WPMU Dev code library
|
4 |
Plugin URI: http://premium.wpmudev.org/
|
5 |
Description: Framework to support creating WordPress plugins and themes.
|
6 |
-
Version: 1.0.
|
7 |
Author: WPMU DEV
|
8 |
Author URI: http://premium.wpmudev.org/
|
9 |
Textdomain: wpmu-lib
|
@@ -16,7 +16,7 @@ Textdomain: wpmu-lib
|
|
16 |
* define( 'WDEV_DEBUG', true ) // Activate WDev()->debug() without having to enable WP_DEBUG
|
17 |
*/
|
18 |
|
19 |
-
$version = '1.0.
|
20 |
|
21 |
/**
|
22 |
* Load TheLib class definition if not some other plugin already loaded it.
|
3 |
Plugin Name: WPMU Dev code library
|
4 |
Plugin URI: http://premium.wpmudev.org/
|
5 |
Description: Framework to support creating WordPress plugins and themes.
|
6 |
+
Version: 1.0.17
|
7 |
Author: WPMU DEV
|
8 |
Author URI: http://premium.wpmudev.org/
|
9 |
Textdomain: wpmu-lib
|
16 |
* define( 'WDEV_DEBUG', true ) // Activate WDev()->debug() without having to enable WP_DEBUG
|
17 |
*/
|
18 |
|
19 |
+
$version = '1.0.17'; // Remember to update the class-name in functions-wpmulib.php!!
|
20 |
|
21 |
/**
|
22 |
* Load TheLib class definition if not some other plugin already loaded it.
|
inc/external/wpmu-lib/css/select2.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WPMU Dev code library - v1.0.
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
|
1 |
+
/*! WPMU Dev code library - v1.0.17
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
|
inc/external/wpmu-lib/css/wpmu-ui.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WPMU Dev code library - v1.0.
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
|
1 |
+
/*! WPMU Dev code library - v1.0.17
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
|
inc/external/wpmu-lib/css/wpmu-vnav.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WPMU Dev code library - v1.0.
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
|
1 |
+
/*! WPMU Dev code library - v1.0.17
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
|
inc/external/wpmu-lib/functions-wpmulib.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
// Based on Jigsaw plugin by Jared Novack (http://jigsaw.upstatement.com/)
|
4 |
-
class
|
5 |
|
6 |
// --- Start of 5.2 compatibility functions
|
7 |
|
@@ -337,8 +337,9 @@ class TheLib_1_0_15 {
|
|
337 |
}
|
338 |
|
339 |
$item = compact( 'url', 'alias', 'onpage' );
|
340 |
-
$hooked = $this->_have( $type );
|
341 |
$this->_add( $type, $item );
|
|
|
342 |
|
343 |
if ( ! did_action( $hook ) ) {
|
344 |
$hooked || add_action(
|
@@ -763,10 +764,8 @@ class TheLib_1_0_15 {
|
|
763 |
* @return int Number of missing fields that were initialized.
|
764 |
*/
|
765 |
public function load_post_fields( $fields ) {
|
766 |
-
|
767 |
-
|
768 |
-
is_array( $fields ) ? $fields : func_get_args()
|
769 |
-
);
|
770 |
}
|
771 |
|
772 |
/**
|
@@ -777,10 +776,8 @@ class TheLib_1_0_15 {
|
|
777 |
* @return int Number of missing fields that were initialized.
|
778 |
*/
|
779 |
public function load_request_fields( $fields ) {
|
780 |
-
|
781 |
-
|
782 |
-
is_array( $fields ) ? $fields : func_get_args()
|
783 |
-
);
|
784 |
}
|
785 |
|
786 |
/**
|
1 |
<?php
|
2 |
|
3 |
// Based on Jigsaw plugin by Jared Novack (http://jigsaw.upstatement.com/)
|
4 |
+
class TheLib_1_0_17 {
|
5 |
|
6 |
// --- Start of 5.2 compatibility functions
|
7 |
|
337 |
}
|
338 |
|
339 |
$item = compact( 'url', 'alias', 'onpage' );
|
340 |
+
$hooked = $this->_have( $hook . $type );
|
341 |
$this->_add( $type, $item );
|
342 |
+
$this->_add( $hook . $type, true );
|
343 |
|
344 |
if ( ! did_action( $hook ) ) {
|
345 |
$hooked || add_action(
|
764 |
* @return int Number of missing fields that were initialized.
|
765 |
*/
|
766 |
public function load_post_fields( $fields ) {
|
767 |
+
$fields = is_array( $fields ) ? $fields : func_get_args();
|
768 |
+
return $this->load_fields( $_POST, $fields );
|
|
|
|
|
769 |
}
|
770 |
|
771 |
/**
|
776 |
* @return int Number of missing fields that were initialized.
|
777 |
*/
|
778 |
public function load_request_fields( $fields ) {
|
779 |
+
$fields = is_array( $fields ) ? $fields : func_get_args();
|
780 |
+
return $this->load_fields( $_REQUEST, $fields );
|
|
|
|
|
781 |
}
|
782 |
|
783 |
/**
|
inc/external/wpmu-lib/js/select2.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WPMU Dev code library - v1.0.
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
/*!
|
1 |
+
/*! WPMU Dev code library - v1.0.17
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
/*!
|
inc/external/wpmu-lib/js/select2.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WPMU Dev code library - v1.0.
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
(function(e){e.fn.each2===void 0&&e.extend(e.fn,{each2:function(t){for(var s=e([0]),i=-1,n=this.length;n>++i&&(s.context=s[0]=this[i])&&t.call(s[0],i,s)!==!1;);return this}})})(jQuery),function(e,t){"use strict";function s(t){var s=e(document.createTextNode(""));t.before(s),s.before(t),s.remove()}function i(e){function t(e){return j[e]||e}return e.replace(/[^\u0000-\u007E]/g,t)}function n(e,t){for(var s=0,i=t.length;i>s;s+=1)if(a(e,t[s]))return s;return-1}function o(){var t=e(z);t.appendTo("body");var s={width:t.width()-t[0].clientWidth,height:t.height()-t[0].clientHeight};return t.remove(),s}function a(e,s){return e===s?!0:e===t||s===t?!1:null===e||null===s?!1:e.constructor===String?e+""==s+"":s.constructor===String?s+""==e+"":!1}function r(t,s){var i,n,o;if(null===t||1>t.length)return[];for(i=t.split(s),n=0,o=i.length;o>n;n+=1)i[n]=e.trim(i[n]);return i}function c(e){return e.outerWidth(!1)-e.width()}function l(s){var i="keyup-change-value";s.on("keydown",function(){e.data(s,i)===t&&e.data(s,i,s.val())}),s.on("keyup",function(){var n=e.data(s,i);n!==t&&s.val()!==n&&(e.removeData(s,i),s.trigger("keyup-change"))})}function h(s){s.on("mousemove",function(s){var i=F;(i===t||i.x!==s.pageX||i.y!==s.pageY)&&e(s.target).trigger("mousemove-filtered",s)})}function u(e,s,i){i=i||t;var n;return function(){var t=arguments;window.clearTimeout(n),n=window.setTimeout(function(){s.apply(i,t)},e)}}function d(e,t){var s=u(e,function(e){t.trigger("scroll-debounced",e)});t.on("scroll",function(e){n(e.target,t.get())>=0&&s(e)})}function p(e){e[0]!==document.activeElement&&window.setTimeout(function(){var t,s=e[0],i=e.val().length;e.focus();var n=s.offsetWidth>0||s.offsetHeight>0;n&&s===document.activeElement&&(s.setSelectionRange?s.setSelectionRange(i,i):s.createTextRange&&(t=s.createTextRange(),t.collapse(!1),t.select()))},0)}function f(t){t=e(t)[0];var s=0,i=0;if("selectionStart"in t)s=t.selectionStart,i=t.selectionEnd-s;else if("selection"in document){t.focus();var n=document.selection.createRange();i=document.selection.createRange().text.length,n.moveStart("character",-t.value.length),s=n.text.length-i}return{offset:s,length:i}}function g(e){e.preventDefault(),e.stopPropagation()}function m(e){e.preventDefault(),e.stopImmediatePropagation()}function v(t){if(!L){var s=t[0].currentStyle||window.getComputedStyle(t[0],null);L=e(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:s.fontSize,fontFamily:s.fontFamily,fontStyle:s.fontStyle,fontWeight:s.fontWeight,letterSpacing:s.letterSpacing,textTransform:s.textTransform,whiteSpace:"nowrap"}),L.attr("class","select2-sizer"),e("body").append(L)}return L.text(t.val()),L.width()}function b(t,s,i){var n,o,a=[];n=e.trim(t.attr("class")),n&&(n=""+n,e(n.split(/\s+/)).each2(function(){0===this.indexOf("select2-")&&a.push(this)})),n=e.trim(s.attr("class")),n&&(n=""+n,e(n.split(/\s+/)).each2(function(){0!==this.indexOf("select2-")&&(o=i(this),o&&a.push(o))})),t.attr("class",a.join(" "))}function w(e,s,n,o){var a=i(e.toUpperCase()).indexOf(i(s.toUpperCase())),r=s.length;return 0>a?(n.push(o(e)),t):(n.push(o(e.substring(0,a))),n.push("<span class='select2-match'>"),n.push(o(e.substring(a,a+r))),n.push("</span>"),n.push(o(e.substring(a+r,e.length))),t)}function C(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return(e+"").replace(/[&<>"'\/\\]/g,function(e){return t[e]})}function S(s){var i,n=null,o=s.quietMillis||100,a=s.url,r=this;return function(c){window.clearTimeout(i),i=window.setTimeout(function(){var i=s.data,o=a,l=s.transport||e.fn.select2.ajaxDefaults.transport,h={type:s.type||"GET",cache:s.cache||!1,jsonpCallback:s.jsonpCallback||t,dataType:s.dataType||"json"},u=e.extend({},e.fn.select2.ajaxDefaults.params,h);i=i?i.call(r,c.term,c.page,c.context):null,o="function"==typeof o?o.call(r,c.term,c.page,c.context):o,n&&"function"==typeof n.abort&&n.abort(),s.params&&(e.isFunction(s.params)?e.extend(u,s.params.call(r)):e.extend(u,s.params)),e.extend(u,{url:o,dataType:s.dataType,data:i,success:function(e){var t=s.results(e,c.page,c);c.callback(t)},error:function(e,t,s){var i={hasError:!0,jqXHR:e,textStatus:t,errorThrown:s};c.callback(i)}}),n=l.call(r,u)},o)}}function y(s){var i,n,o=s,a=function(e){return""+e.text};e.isArray(o)&&(n=o,o={results:n}),e.isFunction(o)===!1&&(n=o,o=function(){return n});var r=o();return r.text&&(a=r.text,e.isFunction(a)||(i=r.text,a=function(e){return e[i]})),function(s){var i,n=s.term,r={results:[]};return""===n?(s.callback(o()),t):(i=function(t,o){var r,c;if(t=t[0],t.children){r={};for(c in t)t.hasOwnProperty(c)&&(r[c]=t[c]);r.children=[],e(t.children).each2(function(e,t){i(t,r.children)}),(r.children.length||s.matcher(n,a(r),t))&&o.push(r)}else s.matcher(n,a(t),t)&&o.push(t)},e(o().results).each2(function(e,t){i(t,r.results)}),s.callback(r),t)}}function E(s){var i=e.isFunction(s);return function(n){var o=n.term,a={results:[]},r=i?s(n):s;e.isArray(r)&&(e(r).each(function(){var e=this.text!==t,s=e?this.text:this;(""===o||n.matcher(o,s))&&a.results.push(e?this:{id:this,text:this})}),n.callback(a))}}function x(t,s){if(e.isFunction(t))return!0;if(!t)return!1;if("string"==typeof t)return!0;throw Error(s+" must be a string, function, or falsy value")}function T(t,s){if(e.isFunction(t)){var i=Array.prototype.slice.call(arguments,2);return t.apply(s,i)}return t}function O(t){var s=0;return e.each(t,function(e,t){t.children?s+=O(t.children):s++}),s}function P(e,s,i,n){var o,r,c,l,h,u=e,d=!1;if(!n.createSearchChoice||!n.tokenSeparators||1>n.tokenSeparators.length)return t;for(;;){for(r=-1,c=0,l=n.tokenSeparators.length;l>c&&(h=n.tokenSeparators[c],r=e.indexOf(h),!(r>=0));c++);if(0>r)break;if(o=e.substring(0,r),e=e.substring(r+h.length),o.length>0&&(o=n.createSearchChoice.call(this,o,s),o!==t&&null!==o&&n.id(o)!==t&&null!==n.id(o))){for(d=!1,c=0,l=s.length;l>c;c++)if(a(n.id(o),n.id(s[c]))){d=!0;break}d||i(o)}}return u!==e?e:t}function I(){var t=this;e.each(arguments,function(e,s){t[s].remove(),t[s]=null})}function k(t,s){var i=function(){};return i.prototype=new t,i.prototype.constructor=i,i.prototype.parent=t.prototype,i.prototype=e.extend(i.prototype,s),i}if(window.Select2===t){var A,R,D,H,M,L,N,U,F={x:0,y:0},A={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(e){switch(e=e.which?e.which:e){case A.LEFT:case A.RIGHT:case A.UP:case A.DOWN:return!0}return!1},isControl:function(e){var t=e.which;switch(t){case A.SHIFT:case A.CTRL:case A.ALT:return!0}return e.metaKey?!0:!1},isFunctionKey:function(e){return e=e.which?e.which:e,e>=112&&123>=e}},z="<div class='select2-measure-scrollbar'></div>",j={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};N=e(document),M=function(){var e=1;return function(){return e++}}(),R=k(Object,{bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(s){var i,n,a=".select2-results";this.opts=s=this.prepareOpts(s),this.id=s.id,s.element.data("select2")!==t&&null!==s.element.data("select2")&&s.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body),this.containerId="s2id_"+(s.element.attr("id")||"autogen"+M()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",s.element.attr("title")),this.body=e("body"),b(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",s.element.attr("style")),this.container.css(T(s.containerCss,this.opts.element)),this.container.addClass(T(s.containerCssClass,this.opts.element)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",g),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),b(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(T(s.dropdownCssClass,this.opts.element)),this.dropdown.data("select2",this),this.dropdown.on("click",g),this.results=i=this.container.find(a),this.search=n=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",g),h(this.results),this.dropdown.on("mousemove-filtered",a,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",a,this.bind(function(e){this._touchEvent=!0,this.highlightUnderEvent(e)})),this.dropdown.on("touchmove",a,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",a,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),d(80,this.results),this.dropdown.on("scroll-debounced",a,this.bind(this.loadMoreIfNeeded)),e(this.container).on("change",".select2-input",function(e){e.stopPropagation()}),e(this.dropdown).on("change",".select2-input",function(e){e.stopPropagation()}),e.fn.mousewheel&&i.mousewheel(function(e,t,s,n){var o=i.scrollTop();n>0&&0>=o-n?(i.scrollTop(0),g(e)):0>n&&i.get(0).scrollHeight-i.scrollTop()+n<=i.height()&&(i.scrollTop(i.get(0).scrollHeight-i.height()),g(e))}),l(n),n.on("keyup-change input paste",this.bind(this.updateResults)),n.on("focus",function(){n.addClass("select2-focused")}),n.on("blur",function(){n.removeClass("select2-focused")}),this.dropdown.on("mouseup",a,this.bind(function(t){e(t.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(t),this.selectHighlighted(t))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(e){e.stopPropagation()}),this.nextSearchTerm=t,e.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==s.maximumInputLength&&this.search.attr("maxlength",s.maximumInputLength);var r=s.element.prop("disabled");r===t&&(r=!1),this.enable(!r);var c=s.element.prop("readonly");c===t&&(c=!1),this.readonly(c),U=U||o(),this.autofocus=s.element.prop("autofocus"),s.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",s.searchInputPlaceholder)},destroy:function(){var e=this.opts.element,s=e.data("select2"),i=this;this.close(),e.length&&e[0].detachEvent&&e.each(function(){this.detachEvent("onpropertychange",i._sync)}),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),this._sync=null,s!==t&&(s.container.remove(),s.liveRegion.remove(),s.dropdown.remove(),e.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?e.attr({tabindex:this.elementTabIndex}):e.removeAttr("tabindex"),e.show()),I.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(e){return e.is("option")?{id:e.prop("value"),text:e.text(),element:e.get(),css:e.attr("class"),disabled:e.prop("disabled"),locked:a(e.attr("locked"),"locked")||a(e.data("locked"),!0)}:e.is("optgroup")?{text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")}:t},prepareOpts:function(s){var i,n,o,c,l=this;if(i=s.element,"select"===i.get(0).tagName.toLowerCase()&&(this.select=n=s.element),n&&e.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in s)throw Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),s=e.extend({},{populateResults:function(i,n,o){var a,r=this.opts.id,c=this.liveRegion;a=function(i,n,h){var u,d,p,f,g,m,v,b,w,C;i=s.sortResults(i,n,o);var S=[];for(u=0,d=i.length;d>u;u+=1)p=i[u],g=p.disabled===!0,f=!g&&r(p)!==t,m=p.children&&p.children.length>0,v=e("<li></li>"),v.addClass("select2-results-dept-"+h),v.addClass("select2-result"),v.addClass(f?"select2-result-selectable":"select2-result-unselectable"),g&&v.addClass("select2-disabled"),m&&v.addClass("select2-result-with-children"),v.addClass(l.opts.formatResultCssClass(p)),v.attr("role","presentation"),b=e(document.createElement("div")),b.addClass("select2-result-label"),b.attr("id","select2-result-label-"+M()),b.attr("role","option"),C=s.formatResult(p,b,o,l.opts.escapeMarkup),C!==t&&(b.html(C),v.append(b)),m&&(w=e("<ul></ul>"),w.addClass("select2-result-sub"),a(p.children,w,h+1),v.append(w)),v.data("select2-data",p),S.push(v[0]);n.append(S),c.text(s.formatMatches(i.length))},a(n,i,0)}},e.fn.select2.defaults,s),"function"!=typeof s.id&&(o=s.id,s.id=function(e){return e[o]}),e.isArray(s.element.data("select2Tags"))){if("tags"in s)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+s.element.attr("id");s.tags=s.element.data("select2Tags")}if(n?(s.query=this.bind(function(e){var s,n,o,a={results:[],more:!1},r=e.term;o=function(t,s){var i;t.is("option")?e.matcher(r,t.text(),t)&&s.push(l.optionToData(t)):t.is("optgroup")&&(i=l.optionToData(t),t.children().each2(function(e,t){o(t,i.children)}),i.children.length>0&&s.push(i))},s=i.children(),this.getPlaceholder()!==t&&s.length>0&&(n=this.getPlaceholderOption(),n&&(s=s.not(n))),s.each2(function(e,t){o(t,a.results)}),e.callback(a)}),s.id=function(e){return e.id}):"query"in s||("ajax"in s?(c=s.element.data("ajax-url"),c&&c.length>0&&(s.ajax.url=c),s.query=S.call(s.element,s.ajax)):"data"in s?s.query=y(s.data):"tags"in s&&(s.query=E(s.tags),s.createSearchChoice===t&&(s.createSearchChoice=function(t){return{id:e.trim(t),text:e.trim(t)}}),s.initSelection===t&&(s.initSelection=function(i,n){var o=[];e(r(i.val(),s.separator)).each(function(){var i={id:this,text:this},n=s.tags;e.isFunction(n)&&(n=n()),e(n).each(function(){return a(this.id,i.id)?(i=this,!1):t}),o.push(i)}),n(o)}))),"function"!=typeof s.query)throw"query function not defined for Select2 "+s.element.attr("id");if("top"===s.createSearchChoicePosition)s.createSearchChoicePosition=function(e,t){e.unshift(t)};else if("bottom"===s.createSearchChoicePosition)s.createSearchChoicePosition=function(e,t){e.push(t)};else if("function"!=typeof s.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return s},monitorSource:function(){var s,i=this.opts.element,n=this;i.on("change.select2",this.bind(function(){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),this._sync=this.bind(function(){var e=i.prop("disabled");e===t&&(e=!1),this.enable(!e);var s=i.prop("readonly");s===t&&(s=!1),this.readonly(s),b(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(T(this.opts.containerCssClass,this.opts.element)),b(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(T(this.opts.dropdownCssClass,this.opts.element))}),i.length&&i[0].attachEvent&&i.each(function(){this.attachEvent("onpropertychange",n._sync)}),s=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,s!==t&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new s(function(t){e.each(t,n._sync)}),this.propertyObserver.observe(i.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(t){var s=e.Event("select2-selecting",{val:this.id(t),object:t,choice:t});return this.opts.element.trigger(s),!s.isDefaultPrevented()},triggerChange:function(t){t=t||{},t=e.extend({},t,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(t),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var e=this._enabled&&!this._readonly,t=!e;return e===this.enabledInterface?!1:(this.container.toggleClass("select2-container-disabled",t),this.close(),this.enabledInterface=e,!0)},enable:function(e){e===t&&(e=!0),this._enabled!==e&&(this._enabled=e,this.opts.element.prop("disabled",!e),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(e){e===t&&(e=!1),this._readonly!==e&&(this._readonly=e,this.opts.element.prop("readonly",e),this.enableInterface())},opened:function(){return this.container?this.container.hasClass("select2-dropdown-open"):!1},positionDropdown:function(){var t,s,i,n,o,a=this.dropdown,r=this.container.offset(),c=this.container.outerHeight(!1),l=this.container.outerWidth(!1),h=a.outerHeight(!1),u=e(window),d=u.width(),p=u.height(),f=u.scrollLeft()+d,g=u.scrollTop()+p,m=r.top+c,v=r.left,b=g>=m+h,w=r.top-h>=u.scrollTop(),C=a.outerWidth(!1),S=f>=v+C,y=a.hasClass("select2-drop-above");y?(s=!0,!w&&b&&(i=!0,s=!1)):(s=!1,!b&&w&&(i=!0,s=!0)),i&&(a.hide(),r=this.container.offset(),c=this.container.outerHeight(!1),l=this.container.outerWidth(!1),h=a.outerHeight(!1),f=u.scrollLeft()+d,g=u.scrollTop()+p,m=r.top+c,v=r.left,C=a.outerWidth(!1),S=f>=v+C,a.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(o=e(".select2-results",a)[0],a.addClass("select2-drop-auto-width"),a.css("width",""),C=a.outerWidth(!1)+(o.scrollHeight===o.clientHeight?0:U.width),C>l?l=C:C=l,h=a.outerHeight(!1),S=f>=v+C):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body.css("position")&&(t=this.body.offset(),m-=t.top,v-=t.left),S||(v=r.left+this.container.outerWidth(!1)-C),n={left:v,width:l},s?(n.top=r.top-h,n.bottom="auto",this.container.addClass("select2-drop-above"),a.addClass("select2-drop-above")):(n.top=m,n.bottom="auto",this.container.removeClass("select2-drop-above"),a.removeClass("select2-drop-above")),n=e.extend(n,T(this.opts.dropdownCss,this.opts.element)),a.css(n)},shouldOpen:function(){var t;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(t=e.Event("select2-opening"),this.opts.element.trigger(t),!t.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),N.on("mousemove.select2Event",function(e){F.x=e.pageX,F.y=e.pageY}),!0):!1},opening:function(){var t,i=this.containerEventName,n="scroll."+i,o="resize."+i,a="orientationchange."+i;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body.children().last()[0]&&this.dropdown.detach().appendTo(this.body),t=e("#select2-drop-mask"),0==t.length&&(t=e(document.createElement("div")),t.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),t.hide(),t.appendTo(this.body),t.on("mousedown touchstart click",function(i){s(t);var n,o=e("#select2-drop");o.length>0&&(n=o.data("select2"),n.opts.selectOnBlur&&n.selectHighlighted({noFocus:!0}),n.close(),i.preventDefault(),i.stopPropagation())})),this.dropdown.prev()[0]!==t[0]&&this.dropdown.before(t),e("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),t.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var r=this;this.container.parents().add(window).each(function(){e(this).on(o+" "+n+" "+a,function(){r.opened()&&r.positionDropdown()})})},close:function(){if(this.opened()){var t=this.containerEventName,s="scroll."+t,i="resize."+t,n="orientationchange."+t;this.container.parents().add(window).each(function(){e(this).off(s).off(i).off(n)}),this.clearDropdownAlignmentPreference(),e("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),N.off("mousemove.select2Event"),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger(e.Event("select2-close"))}},externalSearch:function(e){this.open(),this.search.val(e),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return T(this.opts.maximumSelectionSize,this.opts.element)},ensureHighlightVisible:function(){var s,i,n,o,a,r,c,l,h=this.results;if(i=this.highlight(),!(0>i)){if(0==i)return h.scrollTop(0),t;s=this.findHighlightableChoices().find(".select2-result-label"),n=e(s[i]),l=(n.offset()||{}).top||0,o=l+n.outerHeight(!0),i===s.length-1&&(c=h.find("li.select2-more-results"),c.length>0&&(o=c.offset().top+c.outerHeight(!0))),a=h.offset().top+h.outerHeight(!0),o>a&&h.scrollTop(h.scrollTop()+(o-a)),r=l-h.offset().top,0>r&&"none"!=n.css("display")&&h.scrollTop(h.scrollTop()+r)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(t){for(var s=this.findHighlightableChoices(),i=this.highlight();i>-1&&s.length>i;){i+=t;var n=e(s[i]);if(n.hasClass("select2-result-selectable")&&!n.hasClass("select2-disabled")&&!n.hasClass("select2-selected")){this.highlight(i);break}}},highlight:function(s){var i,o,a=this.findHighlightableChoices();return 0===arguments.length?n(a.filter(".select2-highlighted")[0],a.get()):(s>=a.length&&(s=a.length-1),0>s&&(s=0),this.removeHighlight(),i=e(a[s]),i.addClass("select2-highlighted"),this.search.attr("aria-activedescendant",i.find(".select2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(i.text()),o=i.data("select2-data"),o&&this.opts.element.trigger({type:"select2-highlight",val:this.id(o),choice:o}),t)},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(t){var s=e(t.target).closest(".select2-result-selectable");if(s.length>0&&!s.is(".select2-highlighted")){var i=this.findHighlightableChoices();this.highlight(i.index(s))}else 0==s.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var e,t=this.results,s=t.find("li.select2-more-results"),i=this.resultsPage+1,n=this,o=this.search.val(),a=this.context;0!==s.length&&(e=s.offset().top-t.offset().top-t.height(),this.opts.loadMorePadding>=e&&(s.addClass("select2-active"),this.opts.query({element:this.opts.element,term:o,page:i,context:a,matcher:this.opts.matcher,callback:this.bind(function(e){n.opened()&&(n.opts.populateResults.call(this,t,e.results,{term:o,page:i,context:a}),n.postprocessResults(e,!1,!1),e.more===!0?(s.detach().appendTo(t).text(T(n.opts.formatLoadMore,n.opts.element,i+1)),window.setTimeout(function(){n.loadMoreIfNeeded()},10)):s.remove(),n.positionDropdown(),n.resultsPage=i,n.context=e.context,this.opts.element.trigger({type:"select2-loaded",items:e}))})})))},tokenize:function(){},updateResults:function(s){function i(){l.removeClass("select2-active"),d.positionDropdown(),h.find(".select2-no-results,.select2-selection-limit,.select2-searching").length?d.liveRegion.text(h.text()):d.liveRegion.text(d.opts.formatMatches(h.find(".select2-result-selectable").length))}function n(e){h.html(e),i()}var o,r,c,l=this.search,h=this.results,u=this.opts,d=this,p=l.val(),f=e.data(this.container,"select2-last-term");if((s===!0||!f||!a(p,f))&&(e.data(this.container,"select2-last-term",p),s===!0||this.showSearchInput!==!1&&this.opened())){c=++this.queryCount;var g=this.getMaximumSelectionSize();if(g>=1&&(o=this.data(),e.isArray(o)&&o.length>=g&&x(u.formatSelectionTooBig,"formatSelectionTooBig")))return n("<li class='select2-selection-limit'>"+T(u.formatSelectionTooBig,u.element,g)+"</li>"),t;if(l.val().length<u.minimumInputLength)return x(u.formatInputTooShort,"formatInputTooShort")?n("<li class='select2-no-results'>"+T(u.formatInputTooShort,u.element,l.val(),u.minimumInputLength)+"</li>"):n(""),s&&this.showSearch&&this.showSearch(!0),t;if(u.maximumInputLength&&l.val().length>u.maximumInputLength)return x(u.formatInputTooLong,"formatInputTooLong")?n("<li class='select2-no-results'>"+T(u.formatInputTooLong,u.element,l.val(),u.maximumInputLength)+"</li>"):n(""),t;u.formatSearching&&0===this.findHighlightableChoices().length&&n("<li class='select2-searching'>"+T(u.formatSearching,u.element)+"</li>"),l.addClass("select2-active"),this.removeHighlight(),r=this.tokenize(),r!=t&&null!=r&&l.val(r),this.resultsPage=1,u.query({element:u.element,term:l.val(),page:this.resultsPage,context:null,matcher:u.matcher,callback:this.bind(function(o){var r;if(c==this.queryCount){if(!this.opened())return this.search.removeClass("select2-active"),t;if(o.hasError!==t&&x(u.formatAjaxError,"formatAjaxError"))return n("<li class='select2-ajax-error'>"+T(u.formatAjaxError,u.element,o.jqXHR,o.textStatus,o.errorThrown)+"</li>"),t;if(this.context=o.context===t?null:o.context,this.opts.createSearchChoice&&""!==l.val()&&(r=this.opts.createSearchChoice.call(d,l.val(),o.results),r!==t&&null!==r&&d.id(r)!==t&&null!==d.id(r)&&0===e(o.results).filter(function(){return a(d.id(this),d.id(r))}).length&&this.opts.createSearchChoicePosition(o.results,r)),0===o.results.length&&x(u.formatNoMatches,"formatNoMatches"))return n("<li class='select2-no-results'>"+T(u.formatNoMatches,u.element,l.val())+"</li>"),t;
|
1 |
+
/*! WPMU Dev code library - v1.0.17
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
(function(e){e.fn.each2===void 0&&e.extend(e.fn,{each2:function(t){for(var s=e([0]),i=-1,n=this.length;n>++i&&(s.context=s[0]=this[i])&&t.call(s[0],i,s)!==!1;);return this}})})(jQuery),function(e,t){"use strict";function s(t){var s=e(document.createTextNode(""));t.before(s),s.before(t),s.remove()}function i(e){function t(e){return j[e]||e}return e.replace(/[^\u0000-\u007E]/g,t)}function n(e,t){for(var s=0,i=t.length;i>s;s+=1)if(a(e,t[s]))return s;return-1}function o(){var t=e(z);t.appendTo("body");var s={width:t.width()-t[0].clientWidth,height:t.height()-t[0].clientHeight};return t.remove(),s}function a(e,s){return e===s?!0:e===t||s===t?!1:null===e||null===s?!1:e.constructor===String?e+""==s+"":s.constructor===String?s+""==e+"":!1}function r(t,s){var i,n,o;if(null===t||1>t.length)return[];for(i=t.split(s),n=0,o=i.length;o>n;n+=1)i[n]=e.trim(i[n]);return i}function c(e){return e.outerWidth(!1)-e.width()}function l(s){var i="keyup-change-value";s.on("keydown",function(){e.data(s,i)===t&&e.data(s,i,s.val())}),s.on("keyup",function(){var n=e.data(s,i);n!==t&&s.val()!==n&&(e.removeData(s,i),s.trigger("keyup-change"))})}function h(s){s.on("mousemove",function(s){var i=F;(i===t||i.x!==s.pageX||i.y!==s.pageY)&&e(s.target).trigger("mousemove-filtered",s)})}function u(e,s,i){i=i||t;var n;return function(){var t=arguments;window.clearTimeout(n),n=window.setTimeout(function(){s.apply(i,t)},e)}}function d(e,t){var s=u(e,function(e){t.trigger("scroll-debounced",e)});t.on("scroll",function(e){n(e.target,t.get())>=0&&s(e)})}function p(e){e[0]!==document.activeElement&&window.setTimeout(function(){var t,s=e[0],i=e.val().length;e.focus();var n=s.offsetWidth>0||s.offsetHeight>0;n&&s===document.activeElement&&(s.setSelectionRange?s.setSelectionRange(i,i):s.createTextRange&&(t=s.createTextRange(),t.collapse(!1),t.select()))},0)}function f(t){t=e(t)[0];var s=0,i=0;if("selectionStart"in t)s=t.selectionStart,i=t.selectionEnd-s;else if("selection"in document){t.focus();var n=document.selection.createRange();i=document.selection.createRange().text.length,n.moveStart("character",-t.value.length),s=n.text.length-i}return{offset:s,length:i}}function g(e){e.preventDefault(),e.stopPropagation()}function m(e){e.preventDefault(),e.stopImmediatePropagation()}function v(t){if(!L){var s=t[0].currentStyle||window.getComputedStyle(t[0],null);L=e(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:s.fontSize,fontFamily:s.fontFamily,fontStyle:s.fontStyle,fontWeight:s.fontWeight,letterSpacing:s.letterSpacing,textTransform:s.textTransform,whiteSpace:"nowrap"}),L.attr("class","select2-sizer"),e("body").append(L)}return L.text(t.val()),L.width()}function b(t,s,i){var n,o,a=[];n=e.trim(t.attr("class")),n&&(n=""+n,e(n.split(/\s+/)).each2(function(){0===this.indexOf("select2-")&&a.push(this)})),n=e.trim(s.attr("class")),n&&(n=""+n,e(n.split(/\s+/)).each2(function(){0!==this.indexOf("select2-")&&(o=i(this),o&&a.push(o))})),t.attr("class",a.join(" "))}function w(e,s,n,o){var a=i(e.toUpperCase()).indexOf(i(s.toUpperCase())),r=s.length;return 0>a?(n.push(o(e)),t):(n.push(o(e.substring(0,a))),n.push("<span class='select2-match'>"),n.push(o(e.substring(a,a+r))),n.push("</span>"),n.push(o(e.substring(a+r,e.length))),t)}function C(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return(e+"").replace(/[&<>"'\/\\]/g,function(e){return t[e]})}function S(s){var i,n=null,o=s.quietMillis||100,a=s.url,r=this;return function(c){window.clearTimeout(i),i=window.setTimeout(function(){var i=s.data,o=a,l=s.transport||e.fn.select2.ajaxDefaults.transport,h={type:s.type||"GET",cache:s.cache||!1,jsonpCallback:s.jsonpCallback||t,dataType:s.dataType||"json"},u=e.extend({},e.fn.select2.ajaxDefaults.params,h);i=i?i.call(r,c.term,c.page,c.context):null,o="function"==typeof o?o.call(r,c.term,c.page,c.context):o,n&&"function"==typeof n.abort&&n.abort(),s.params&&(e.isFunction(s.params)?e.extend(u,s.params.call(r)):e.extend(u,s.params)),e.extend(u,{url:o,dataType:s.dataType,data:i,success:function(e){var t=s.results(e,c.page,c);c.callback(t)},error:function(e,t,s){var i={hasError:!0,jqXHR:e,textStatus:t,errorThrown:s};c.callback(i)}}),n=l.call(r,u)},o)}}function y(s){var i,n,o=s,a=function(e){return""+e.text};e.isArray(o)&&(n=o,o={results:n}),e.isFunction(o)===!1&&(n=o,o=function(){return n});var r=o();return r.text&&(a=r.text,e.isFunction(a)||(i=r.text,a=function(e){return e[i]})),function(s){var i,n=s.term,r={results:[]};return""===n?(s.callback(o()),t):(i=function(t,o){var r,c;if(t=t[0],t.children){r={};for(c in t)t.hasOwnProperty(c)&&(r[c]=t[c]);r.children=[],e(t.children).each2(function(e,t){i(t,r.children)}),(r.children.length||s.matcher(n,a(r),t))&&o.push(r)}else s.matcher(n,a(t),t)&&o.push(t)},e(o().results).each2(function(e,t){i(t,r.results)}),s.callback(r),t)}}function E(s){var i=e.isFunction(s);return function(n){var o=n.term,a={results:[]},r=i?s(n):s;e.isArray(r)&&(e(r).each(function(){var e=this.text!==t,s=e?this.text:this;(""===o||n.matcher(o,s))&&a.results.push(e?this:{id:this,text:this})}),n.callback(a))}}function x(t,s){if(e.isFunction(t))return!0;if(!t)return!1;if("string"==typeof t)return!0;throw Error(s+" must be a string, function, or falsy value")}function T(t,s){if(e.isFunction(t)){var i=Array.prototype.slice.call(arguments,2);return t.apply(s,i)}return t}function O(t){var s=0;return e.each(t,function(e,t){t.children?s+=O(t.children):s++}),s}function P(e,s,i,n){var o,r,c,l,h,u=e,d=!1;if(!n.createSearchChoice||!n.tokenSeparators||1>n.tokenSeparators.length)return t;for(;;){for(r=-1,c=0,l=n.tokenSeparators.length;l>c&&(h=n.tokenSeparators[c],r=e.indexOf(h),!(r>=0));c++);if(0>r)break;if(o=e.substring(0,r),e=e.substring(r+h.length),o.length>0&&(o=n.createSearchChoice.call(this,o,s),o!==t&&null!==o&&n.id(o)!==t&&null!==n.id(o))){for(d=!1,c=0,l=s.length;l>c;c++)if(a(n.id(o),n.id(s[c]))){d=!0;break}d||i(o)}}return u!==e?e:t}function I(){var t=this;e.each(arguments,function(e,s){t[s].remove(),t[s]=null})}function k(t,s){var i=function(){};return i.prototype=new t,i.prototype.constructor=i,i.prototype.parent=t.prototype,i.prototype=e.extend(i.prototype,s),i}if(window.Select2===t){var A,R,D,H,M,L,N,U,F={x:0,y:0},A={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(e){switch(e=e.which?e.which:e){case A.LEFT:case A.RIGHT:case A.UP:case A.DOWN:return!0}return!1},isControl:function(e){var t=e.which;switch(t){case A.SHIFT:case A.CTRL:case A.ALT:return!0}return e.metaKey?!0:!1},isFunctionKey:function(e){return e=e.which?e.which:e,e>=112&&123>=e}},z="<div class='select2-measure-scrollbar'></div>",j={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};N=e(document),M=function(){var e=1;return function(){return e++}}(),R=k(Object,{bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(s){var i,n,a=".select2-results";this.opts=s=this.prepareOpts(s),this.id=s.id,s.element.data("select2")!==t&&null!==s.element.data("select2")&&s.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body),this.containerId="s2id_"+(s.element.attr("id")||"autogen"+M()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",s.element.attr("title")),this.body=e("body"),b(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",s.element.attr("style")),this.container.css(T(s.containerCss,this.opts.element)),this.container.addClass(T(s.containerCssClass,this.opts.element)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",g),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),b(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(T(s.dropdownCssClass,this.opts.element)),this.dropdown.data("select2",this),this.dropdown.on("click",g),this.results=i=this.container.find(a),this.search=n=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",g),h(this.results),this.dropdown.on("mousemove-filtered",a,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",a,this.bind(function(e){this._touchEvent=!0,this.highlightUnderEvent(e)})),this.dropdown.on("touchmove",a,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",a,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),d(80,this.results),this.dropdown.on("scroll-debounced",a,this.bind(this.loadMoreIfNeeded)),e(this.container).on("change",".select2-input",function(e){e.stopPropagation()}),e(this.dropdown).on("change",".select2-input",function(e){e.stopPropagation()}),e.fn.mousewheel&&i.mousewheel(function(e,t,s,n){var o=i.scrollTop();n>0&&0>=o-n?(i.scrollTop(0),g(e)):0>n&&i.get(0).scrollHeight-i.scrollTop()+n<=i.height()&&(i.scrollTop(i.get(0).scrollHeight-i.height()),g(e))}),l(n),n.on("keyup-change input paste",this.bind(this.updateResults)),n.on("focus",function(){n.addClass("select2-focused")}),n.on("blur",function(){n.removeClass("select2-focused")}),this.dropdown.on("mouseup",a,this.bind(function(t){e(t.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(t),this.selectHighlighted(t))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(e){e.stopPropagation()}),this.nextSearchTerm=t,e.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==s.maximumInputLength&&this.search.attr("maxlength",s.maximumInputLength);var r=s.element.prop("disabled");r===t&&(r=!1),this.enable(!r);var c=s.element.prop("readonly");c===t&&(c=!1),this.readonly(c),U=U||o(),this.autofocus=s.element.prop("autofocus"),s.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",s.searchInputPlaceholder)},destroy:function(){var e=this.opts.element,s=e.data("select2"),i=this;this.close(),e.length&&e[0].detachEvent&&e.each(function(){this.detachEvent("onpropertychange",i._sync)}),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),this._sync=null,s!==t&&(s.container.remove(),s.liveRegion.remove(),s.dropdown.remove(),e.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?e.attr({tabindex:this.elementTabIndex}):e.removeAttr("tabindex"),e.show()),I.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(e){return e.is("option")?{id:e.prop("value"),text:e.text(),element:e.get(),css:e.attr("class"),disabled:e.prop("disabled"),locked:a(e.attr("locked"),"locked")||a(e.data("locked"),!0)}:e.is("optgroup")?{text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")}:t},prepareOpts:function(s){var i,n,o,c,l=this;if(i=s.element,"select"===i.get(0).tagName.toLowerCase()&&(this.select=n=s.element),n&&e.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in s)throw Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),s=e.extend({},{populateResults:function(i,n,o){var a,r=this.opts.id,c=this.liveRegion;a=function(i,n,h){var u,d,p,f,g,m,v,b,w,C;i=s.sortResults(i,n,o);var S=[];for(u=0,d=i.length;d>u;u+=1)p=i[u],g=p.disabled===!0,f=!g&&r(p)!==t,m=p.children&&p.children.length>0,v=e("<li></li>"),v.addClass("select2-results-dept-"+h),v.addClass("select2-result"),v.addClass(f?"select2-result-selectable":"select2-result-unselectable"),g&&v.addClass("select2-disabled"),m&&v.addClass("select2-result-with-children"),v.addClass(l.opts.formatResultCssClass(p)),v.attr("role","presentation"),b=e(document.createElement("div")),b.addClass("select2-result-label"),b.attr("id","select2-result-label-"+M()),b.attr("role","option"),C=s.formatResult(p,b,o,l.opts.escapeMarkup),C!==t&&(b.html(C),v.append(b)),m&&(w=e("<ul></ul>"),w.addClass("select2-result-sub"),a(p.children,w,h+1),v.append(w)),v.data("select2-data",p),S.push(v[0]);n.append(S),c.text(s.formatMatches(i.length))},a(n,i,0)}},e.fn.select2.defaults,s),"function"!=typeof s.id&&(o=s.id,s.id=function(e){return e[o]}),e.isArray(s.element.data("select2Tags"))){if("tags"in s)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+s.element.attr("id");s.tags=s.element.data("select2Tags")}if(n?(s.query=this.bind(function(e){var s,n,o,a={results:[],more:!1},r=e.term;o=function(t,s){var i;t.is("option")?e.matcher(r,t.text(),t)&&s.push(l.optionToData(t)):t.is("optgroup")&&(i=l.optionToData(t),t.children().each2(function(e,t){o(t,i.children)}),i.children.length>0&&s.push(i))},s=i.children(),this.getPlaceholder()!==t&&s.length>0&&(n=this.getPlaceholderOption(),n&&(s=s.not(n))),s.each2(function(e,t){o(t,a.results)}),e.callback(a)}),s.id=function(e){return e.id}):"query"in s||("ajax"in s?(c=s.element.data("ajax-url"),c&&c.length>0&&(s.ajax.url=c),s.query=S.call(s.element,s.ajax)):"data"in s?s.query=y(s.data):"tags"in s&&(s.query=E(s.tags),s.createSearchChoice===t&&(s.createSearchChoice=function(t){return{id:e.trim(t),text:e.trim(t)}}),s.initSelection===t&&(s.initSelection=function(i,n){var o=[];e(r(i.val(),s.separator)).each(function(){var i={id:this,text:this},n=s.tags;e.isFunction(n)&&(n=n()),e(n).each(function(){return a(this.id,i.id)?(i=this,!1):t}),o.push(i)}),n(o)}))),"function"!=typeof s.query)throw"query function not defined for Select2 "+s.element.attr("id");if("top"===s.createSearchChoicePosition)s.createSearchChoicePosition=function(e,t){e.unshift(t)};else if("bottom"===s.createSearchChoicePosition)s.createSearchChoicePosition=function(e,t){e.push(t)};else if("function"!=typeof s.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return s},monitorSource:function(){var s,i=this.opts.element,n=this;i.on("change.select2",this.bind(function(){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),this._sync=this.bind(function(){var e=i.prop("disabled");e===t&&(e=!1),this.enable(!e);var s=i.prop("readonly");s===t&&(s=!1),this.readonly(s),b(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(T(this.opts.containerCssClass,this.opts.element)),b(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(T(this.opts.dropdownCssClass,this.opts.element))}),i.length&&i[0].attachEvent&&i.each(function(){this.attachEvent("onpropertychange",n._sync)}),s=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,s!==t&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new s(function(t){e.each(t,n._sync)}),this.propertyObserver.observe(i.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(t){var s=e.Event("select2-selecting",{val:this.id(t),object:t,choice:t});return this.opts.element.trigger(s),!s.isDefaultPrevented()},triggerChange:function(t){t=t||{},t=e.extend({},t,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(t),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var e=this._enabled&&!this._readonly,t=!e;return e===this.enabledInterface?!1:(this.container.toggleClass("select2-container-disabled",t),this.close(),this.enabledInterface=e,!0)},enable:function(e){e===t&&(e=!0),this._enabled!==e&&(this._enabled=e,this.opts.element.prop("disabled",!e),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(e){e===t&&(e=!1),this._readonly!==e&&(this._readonly=e,this.opts.element.prop("readonly",e),this.enableInterface())},opened:function(){return this.container?this.container.hasClass("select2-dropdown-open"):!1},positionDropdown:function(){var t,s,i,n,o,a=this.dropdown,r=this.container.offset(),c=this.container.outerHeight(!1),l=this.container.outerWidth(!1),h=a.outerHeight(!1),u=e(window),d=u.width(),p=u.height(),f=u.scrollLeft()+d,g=u.scrollTop()+p,m=r.top+c,v=r.left,b=g>=m+h,w=r.top-h>=u.scrollTop(),C=a.outerWidth(!1),S=f>=v+C,y=a.hasClass("select2-drop-above");y?(s=!0,!w&&b&&(i=!0,s=!1)):(s=!1,!b&&w&&(i=!0,s=!0)),i&&(a.hide(),r=this.container.offset(),c=this.container.outerHeight(!1),l=this.container.outerWidth(!1),h=a.outerHeight(!1),f=u.scrollLeft()+d,g=u.scrollTop()+p,m=r.top+c,v=r.left,C=a.outerWidth(!1),S=f>=v+C,a.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(o=e(".select2-results",a)[0],a.addClass("select2-drop-auto-width"),a.css("width",""),C=a.outerWidth(!1)+(o.scrollHeight===o.clientHeight?0:U.width),C>l?l=C:C=l,h=a.outerHeight(!1),S=f>=v+C):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body.css("position")&&(t=this.body.offset(),m-=t.top,v-=t.left),S||(v=r.left+this.container.outerWidth(!1)-C),n={left:v,width:l},s?(n.top=r.top-h,n.bottom="auto",this.container.addClass("select2-drop-above"),a.addClass("select2-drop-above")):(n.top=m,n.bottom="auto",this.container.removeClass("select2-drop-above"),a.removeClass("select2-drop-above")),n=e.extend(n,T(this.opts.dropdownCss,this.opts.element)),a.css(n)},shouldOpen:function(){var t;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(t=e.Event("select2-opening"),this.opts.element.trigger(t),!t.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),N.on("mousemove.select2Event",function(e){F.x=e.pageX,F.y=e.pageY}),!0):!1},opening:function(){var t,i=this.containerEventName,n="scroll."+i,o="resize."+i,a="orientationchange."+i;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body.children().last()[0]&&this.dropdown.detach().appendTo(this.body),t=e("#select2-drop-mask"),0==t.length&&(t=e(document.createElement("div")),t.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),t.hide(),t.appendTo(this.body),t.on("mousedown touchstart click",function(i){s(t);var n,o=e("#select2-drop");o.length>0&&(n=o.data("select2"),n.opts.selectOnBlur&&n.selectHighlighted({noFocus:!0}),n.close(),i.preventDefault(),i.stopPropagation())})),this.dropdown.prev()[0]!==t[0]&&this.dropdown.before(t),e("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),t.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var r=this;this.container.parents().add(window).each(function(){e(this).on(o+" "+n+" "+a,function(){r.opened()&&r.positionDropdown()})})},close:function(){if(this.opened()){var t=this.containerEventName,s="scroll."+t,i="resize."+t,n="orientationchange."+t;this.container.parents().add(window).each(function(){e(this).off(s).off(i).off(n)}),this.clearDropdownAlignmentPreference(),e("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),N.off("mousemove.select2Event"),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger(e.Event("select2-close"))}},externalSearch:function(e){this.open(),this.search.val(e),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return T(this.opts.maximumSelectionSize,this.opts.element)},ensureHighlightVisible:function(){var s,i,n,o,a,r,c,l,h=this.results;if(i=this.highlight(),!(0>i)){if(0==i)return h.scrollTop(0),t;s=this.findHighlightableChoices().find(".select2-result-label"),n=e(s[i]),l=(n.offset()||{}).top||0,o=l+n.outerHeight(!0),i===s.length-1&&(c=h.find("li.select2-more-results"),c.length>0&&(o=c.offset().top+c.outerHeight(!0))),a=h.offset().top+h.outerHeight(!0),o>a&&h.scrollTop(h.scrollTop()+(o-a)),r=l-h.offset().top,0>r&&"none"!=n.css("display")&&h.scrollTop(h.scrollTop()+r)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(t){for(var s=this.findHighlightableChoices(),i=this.highlight();i>-1&&s.length>i;){i+=t;var n=e(s[i]);if(n.hasClass("select2-result-selectable")&&!n.hasClass("select2-disabled")&&!n.hasClass("select2-selected")){this.highlight(i);break}}},highlight:function(s){var i,o,a=this.findHighlightableChoices();return 0===arguments.length?n(a.filter(".select2-highlighted")[0],a.get()):(s>=a.length&&(s=a.length-1),0>s&&(s=0),this.removeHighlight(),i=e(a[s]),i.addClass("select2-highlighted"),this.search.attr("aria-activedescendant",i.find(".select2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(i.text()),o=i.data("select2-data"),o&&this.opts.element.trigger({type:"select2-highlight",val:this.id(o),choice:o}),t)},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(t){var s=e(t.target).closest(".select2-result-selectable");if(s.length>0&&!s.is(".select2-highlighted")){var i=this.findHighlightableChoices();this.highlight(i.index(s))}else 0==s.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var e,t=this.results,s=t.find("li.select2-more-results"),i=this.resultsPage+1,n=this,o=this.search.val(),a=this.context;0!==s.length&&(e=s.offset().top-t.offset().top-t.height(),this.opts.loadMorePadding>=e&&(s.addClass("select2-active"),this.opts.query({element:this.opts.element,term:o,page:i,context:a,matcher:this.opts.matcher,callback:this.bind(function(e){n.opened()&&(n.opts.populateResults.call(this,t,e.results,{term:o,page:i,context:a}),n.postprocessResults(e,!1,!1),e.more===!0?(s.detach().appendTo(t).text(T(n.opts.formatLoadMore,n.opts.element,i+1)),window.setTimeout(function(){n.loadMoreIfNeeded()},10)):s.remove(),n.positionDropdown(),n.resultsPage=i,n.context=e.context,this.opts.element.trigger({type:"select2-loaded",items:e}))})})))},tokenize:function(){},updateResults:function(s){function i(){l.removeClass("select2-active"),d.positionDropdown(),h.find(".select2-no-results,.select2-selection-limit,.select2-searching").length?d.liveRegion.text(h.text()):d.liveRegion.text(d.opts.formatMatches(h.find(".select2-result-selectable").length))}function n(e){h.html(e),i()}var o,r,c,l=this.search,h=this.results,u=this.opts,d=this,p=l.val(),f=e.data(this.container,"select2-last-term");if((s===!0||!f||!a(p,f))&&(e.data(this.container,"select2-last-term",p),s===!0||this.showSearchInput!==!1&&this.opened())){c=++this.queryCount;var g=this.getMaximumSelectionSize();if(g>=1&&(o=this.data(),e.isArray(o)&&o.length>=g&&x(u.formatSelectionTooBig,"formatSelectionTooBig")))return n("<li class='select2-selection-limit'>"+T(u.formatSelectionTooBig,u.element,g)+"</li>"),t;if(l.val().length<u.minimumInputLength)return x(u.formatInputTooShort,"formatInputTooShort")?n("<li class='select2-no-results'>"+T(u.formatInputTooShort,u.element,l.val(),u.minimumInputLength)+"</li>"):n(""),s&&this.showSearch&&this.showSearch(!0),t;if(u.maximumInputLength&&l.val().length>u.maximumInputLength)return x(u.formatInputTooLong,"formatInputTooLong")?n("<li class='select2-no-results'>"+T(u.formatInputTooLong,u.element,l.val(),u.maximumInputLength)+"</li>"):n(""),t;u.formatSearching&&0===this.findHighlightableChoices().length&&n("<li class='select2-searching'>"+T(u.formatSearching,u.element)+"</li>"),l.addClass("select2-active"),this.removeHighlight(),r=this.tokenize(),r!=t&&null!=r&&l.val(r),this.resultsPage=1,u.query({element:u.element,term:l.val(),page:this.resultsPage,context:null,matcher:u.matcher,callback:this.bind(function(o){var r;if(c==this.queryCount){if(!this.opened())return this.search.removeClass("select2-active"),t;if(o.hasError!==t&&x(u.formatAjaxError,"formatAjaxError"))return n("<li class='select2-ajax-error'>"+T(u.formatAjaxError,u.element,o.jqXHR,o.textStatus,o.errorThrown)+"</li>"),t;if(this.context=o.context===t?null:o.context,this.opts.createSearchChoice&&""!==l.val()&&(r=this.opts.createSearchChoice.call(d,l.val(),o.results),r!==t&&null!==r&&d.id(r)!==t&&null!==d.id(r)&&0===e(o.results).filter(function(){return a(d.id(this),d.id(r))}).length&&this.opts.createSearchChoicePosition(o.results,r)),0===o.results.length&&x(u.formatNoMatches,"formatNoMatches"))return n("<li class='select2-no-results'>"+T(u.formatNoMatches,u.element,l.val())+"</li>"),t;
|
inc/external/wpmu-lib/js/tiny-scrollbar.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WPMU Dev code library - v1.0.
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
/*! tinyscrollbar - v2.1.7 - 2014-05-21
|
1 |
+
/*! WPMU Dev code library - v1.0.17
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
/*! tinyscrollbar - v2.1.7 - 2014-05-21
|
inc/external/wpmu-lib/js/tiny-scrollbar.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WPMU Dev code library - v1.0.
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?t(require("jquery")):t(jQuery)}(function(t){"use strict";function e(e,n){function o(){return d.update(),r(),d}function a(){v.css(x,d.contentPosition/d.trackRatio),f.css(x,-d.contentPosition),g.css(y,d.trackSize),m.css(y,d.trackSize),v.css(y,d.thumbSize)}function r(){S?p[0].ontouchstart=function(t){1===t.touches.length&&(t.stopPropagation(),c(t.touches[0]))}:(v.bind("mousedown",c),m.bind("mousedown",h)),t(window).resize(function(){d.update("relative")}),d.options.wheel&&window.addEventListener?e[0].addEventListener(C,l,!1):d.options.wheel&&(e[0].onmousewheel=l)}function c(e){t("body").addClass("noSelect"),w=b?e.pageX:e.pageY,d.thumbPosition=parseInt(v.css(x),10)||0,S?(document.ontouchmove=function(t){t.preventDefault(),h(t.touches[0])},document.ontouchend=u):(t(document).bind("mousemove",h),t(document).bind("mouseup",u),v.bind("mouseup",u))}function l(s){if(1>d.contentRatio){var i=s||window.event,n="delta"+d.options.axis.toUpperCase(),o=-(i[n]||i.detail||-1/3*i.wheelDelta)/40;d.contentPosition-=o*d.options.wheelSpeed,d.contentPosition=Math.min(d.contentSize-d.viewportSize,Math.max(0,d.contentPosition)),e.trigger("move"),v.css(x,d.contentPosition/d.trackRatio),f.css(x,-d.contentPosition),(d.options.wheelLock||d.contentPosition!==d.contentSize-d.viewportSize&&0!==d.contentPosition)&&(i=t.event.fix(i),i.preventDefault())}}function h(t){if(1>d.contentRatio){var s=b?t.pageX:t.pageY,i=s-w;d.options.scrollInvert&&S&&(i=w-s);var n=Math.min(d.trackSize-d.thumbSize,Math.max(0,d.thumbPosition+i));d.contentPosition=n*d.trackRatio,e.trigger("move"),v.css(x,n),f.css(x,-d.contentPosition)}}function u(){t("body").removeClass("noSelect"),t(document).unbind("mousemove",h),t(document).unbind("mouseup",u),v.unbind("mouseup",u),document.ontouchmove=document.ontouchend=null}this.options=t.extend({},i,n),this._defaults=i,this._name=s;var d=this,p=e.find(".viewport"),f=e.find(".overview"),g=e.find(".scrollbar"),m=g.find(".track"),v=g.find(".thumb"),w=0,b="x"===this.options.axis,S="ontouchstart"in document.documentElement,C="onwheel"in document||document.documentMode>=9?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll",y=b?"width":"height",x=b?"left":"top";return this.contentPosition=0,this.viewportSize=0,this.contentSize=0,this.contentRatio=0,this.trackSize=0,this.trackRatio=0,this.thumbSize=0,this.thumbPosition=0,this.update=function(t){var e=y.charAt(0).toUpperCase()+y.slice(1).toLowerCase();switch(this.viewportSize=p[0]["offset"+e],this.contentSize=f[0]["scroll"+e],this.contentRatio=this.viewportSize/this.contentSize,this.trackSize=this.options.trackSize||this.viewportSize,this.thumbSize=Math.min(this.trackSize,Math.max(0,this.options.thumbSize||this.trackSize*this.contentRatio)),this.trackRatio=this.options.thumbSize?(this.contentSize-this.viewportSize)/(this.trackSize-this.thumbSize):this.contentSize/this.trackSize,g.toggleClass("disable",this.contentRatio>=1),t){case"bottom":this.contentPosition=this.contentSize-this.viewportSize;break;case"relative":this.contentPosition=Math.min(Math.max(this.contentSize-this.viewportSize,0),Math.max(0,this.contentPosition));break;default:this.contentPosition=parseInt(t,10)||0}return a(),d},o()}var s="tinyscrollbar",i={axis:"y",wheel:!0,wheelSpeed:40,wheelLock:!0,scrollInvert:!1,trackSize:!1,thumbSize:!1};t.fn[s]=function(i){return this.each(function(){t.data(this,"plugin_"+s)||t.data(this,"plugin_"+s,new e(t(this),i))})}});
|
1 |
+
/*! WPMU Dev code library - v1.0.17
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?t(require("jquery")):t(jQuery)}(function(t){"use strict";function e(e,n){function o(){return d.update(),r(),d}function a(){v.css(x,d.contentPosition/d.trackRatio),f.css(x,-d.contentPosition),g.css(y,d.trackSize),m.css(y,d.trackSize),v.css(y,d.thumbSize)}function r(){S?p[0].ontouchstart=function(t){1===t.touches.length&&(t.stopPropagation(),c(t.touches[0]))}:(v.bind("mousedown",c),m.bind("mousedown",h)),t(window).resize(function(){d.update("relative")}),d.options.wheel&&window.addEventListener?e[0].addEventListener(C,l,!1):d.options.wheel&&(e[0].onmousewheel=l)}function c(e){t("body").addClass("noSelect"),w=b?e.pageX:e.pageY,d.thumbPosition=parseInt(v.css(x),10)||0,S?(document.ontouchmove=function(t){t.preventDefault(),h(t.touches[0])},document.ontouchend=u):(t(document).bind("mousemove",h),t(document).bind("mouseup",u),v.bind("mouseup",u))}function l(s){if(1>d.contentRatio){var i=s||window.event,n="delta"+d.options.axis.toUpperCase(),o=-(i[n]||i.detail||-1/3*i.wheelDelta)/40;d.contentPosition-=o*d.options.wheelSpeed,d.contentPosition=Math.min(d.contentSize-d.viewportSize,Math.max(0,d.contentPosition)),e.trigger("move"),v.css(x,d.contentPosition/d.trackRatio),f.css(x,-d.contentPosition),(d.options.wheelLock||d.contentPosition!==d.contentSize-d.viewportSize&&0!==d.contentPosition)&&(i=t.event.fix(i),i.preventDefault())}}function h(t){if(1>d.contentRatio){var s=b?t.pageX:t.pageY,i=s-w;d.options.scrollInvert&&S&&(i=w-s);var n=Math.min(d.trackSize-d.thumbSize,Math.max(0,d.thumbPosition+i));d.contentPosition=n*d.trackRatio,e.trigger("move"),v.css(x,n),f.css(x,-d.contentPosition)}}function u(){t("body").removeClass("noSelect"),t(document).unbind("mousemove",h),t(document).unbind("mouseup",u),v.unbind("mouseup",u),document.ontouchmove=document.ontouchend=null}this.options=t.extend({},i,n),this._defaults=i,this._name=s;var d=this,p=e.find(".viewport"),f=e.find(".overview"),g=e.find(".scrollbar"),m=g.find(".track"),v=g.find(".thumb"),w=0,b="x"===this.options.axis,S="ontouchstart"in document.documentElement,C="onwheel"in document||document.documentMode>=9?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll",y=b?"width":"height",x=b?"left":"top";return this.contentPosition=0,this.viewportSize=0,this.contentSize=0,this.contentRatio=0,this.trackSize=0,this.trackRatio=0,this.thumbSize=0,this.thumbPosition=0,this.update=function(t){var e=y.charAt(0).toUpperCase()+y.slice(1).toLowerCase();switch(this.viewportSize=p[0]["offset"+e],this.contentSize=f[0]["scroll"+e],this.contentRatio=this.viewportSize/this.contentSize,this.trackSize=this.options.trackSize||this.viewportSize,this.thumbSize=Math.min(this.trackSize,Math.max(0,this.options.thumbSize||this.trackSize*this.contentRatio)),this.trackRatio=this.options.thumbSize?(this.contentSize-this.viewportSize)/(this.trackSize-this.thumbSize):this.contentSize/this.trackSize,g.toggleClass("disable",this.contentRatio>=1),t){case"bottom":this.contentPosition=this.contentSize-this.viewportSize;break;case"relative":this.contentPosition=Math.min(Math.max(this.contentSize-this.viewportSize,0),Math.max(0,this.contentPosition));break;default:this.contentPosition=parseInt(t,10)||0}return a(),d},o()}var s="tinyscrollbar",i={axis:"y",wheel:!0,wheelSpeed:40,wheelLock:!0,scrollInvert:!1,trackSize:!1,thumbSize:!1};t.fn[s]=function(i){return this.each(function(){t.data(this,"plugin_"+s)||t.data(this,"plugin_"+s,new e(t(this),i))})}});
|
inc/external/wpmu-lib/js/wpmu-ui.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WPMU Dev code library - v1.0.
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
/*!
|
1 |
+
/*! WPMU Dev code library - v1.0.17
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
/*!
|
inc/external/wpmu-lib/js/wpmu-ui.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WPMU Dev code library - v1.0.
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
(function(t){function e(){null===r&&(a=jQuery(document),r=jQuery("html"),c=jQuery("body"),n(),o(),c.hasClass("no-auto-init")||(t.upgrade_multiselect(),t.upgrade_tooltips()),t.binary=new d)}function s(){null===l&&(l=jQuery("<div></div>").addClass("wpmui-overlay").appendTo(c)),c.addClass("wpmui-has-overlay"),r.addClass("wpmui-no-scroll")}function i(){c.removeClass("wpmui-has-overlay"),r.removeClass("wpmui-no-scroll")}function n(){var t=function t(t){var e=jQuery(this).closest(".wpmui-box");return t.preventDefault(),e.hasClass("static")?!1:(e.toggleClass("closed"),!1)};c.on("click",".wpmui-box > h3",t),c.on("click",".wpmui-box > h3 > .toggle",t)}function o(){var t=function t(t){var e=jQuery(this),s=e.closest(".wpmui-tabs"),i=s.next(".wpmui-tab-contents"),n=s.find(".active.tab"),o=e.attr("href"),a=n.attr("href"),r=i.find(o),c=i.find(a);return e.hasClass("active")||(n.removeClass("active"),c.removeClass("active")),e.addClass("active"),r.addClass("active"),t.preventDefault(),!1};c.on("click",".wpmui-tabs .tab",t)}var a=null,r=null,c=null,l=null;t.popup=function(){return e(),new h},t.ajax=function(t,s){return e(),new u(t,s)},t.upgrade_multiselect=function(t){e(),t=jQuery(t||c);var s=t.find("select[multiple]"),i=t.find("input[data-select-ajax]"),n=function n(t){var e=t.attr("id"),s="#s2id_"+e,i=t.parent().find(s);i.remove()},o=function o(){var t=jQuery(this),e={closeOnSelect:!1,width:"100%"};"1"!==t.data("wpmui-select")&&(t.data("wpmui-select","1"),n(t),window.setTimeout(function(){t.select2(e)},1))},a=function a(){var t=function t(t){return t.val},e=function e(t){return t.key},s=function s(t,e){var s=t.val(),i=[],n=[];jQuery(s.split(",")).each(function(){var t=this.split("::");n.push(t[0]),i.push({key:t[0],val:t[1]})}),t.val(n.join(",")),e(i)},i=jQuery(this),o={closeOnSelect:!1,width:"100%",multiple:!0,minimumInputLength:1,ajax:{url:i.attr("data-select-ajax"),dataType:"json",quietMillis:100,cache:!0,data:function(t){return{q:t}},results:function(t){return{results:t.items}}},id:e,formatResult:t,formatSelection:t,initSelection:s};"1"!==i.data("wpmui-select")&&(i.data("wpmui-select","1"),n(i),window.setTimeout(function(){i.select2(o)},1))};"function"==typeof jQuery.fn.each2?(s.each2(o),i.each2(a)):(s.each(o),i.each(a))},t.message=function(t){var s,i,n,o;e();var a=function a(t){return t.preventDefault(),i.remove(),!1},r=function r(){var t=jQuery(this).closest(".wpmui-msg");t.find(".debug").toggle()};return t===void 0?!1:(("string"==typeof t||t instanceof Array)&&(t={message:t}),t.message instanceof Array&&(t.message=t.message.join("<br />")),t.message?(t.type=void 0===t.type?"ok":(""+t.type).toLowerCase(),t.close=void 0===t.close?!0:t.close,t.parent=void 0===t.parent?".wrap":t.parent,t.insert_after=void 0===t.insert_after?"h2":t.insert_after,t.id=void 0===t.id?"":(""+t.id).toLowerCase(),t["class"]=void 0===t["class"]?"":(""+t["class"]).toLowerCase(),t.details=void 0===t.details?!1:t.details,("error"===t.type||"red"===t.type)&&(t.type="err"),("success"===t.type||"green"===t.type)&&(t.type="ok"),s=jQuery(t.parent).first(),s.length?(t.id&&jQuery('.wpmui-msg[data-id="'+t.id+'"]').length?(i=jQuery('.wpmui-msg[data-id="'+t.id+'"]').first(),o=!1):(i=jQuery("<div><p></p></div>"),t.id&&i.attr("data-id",t.id),o=!0),i.find("p").html(t.message),"err"===t.type&&t.details&&window.JSON&&(jQuery('<div class="debug" style="display:none"></div>').appendTo(i).text(JSON.stringify(t.details)),jQuery('<i class="dashicons dashicons-editor-help light"></i>').prependTo(i.find("p:first")).click(r).after(" ")),i.removeClass().addClass("updated wpmui-msg "+t["class"]),"err"===t.type&&i.addClass("error"),o&&(t.close&&(n=jQuery('<a href="#" class="wpmui-close">×</a>'),n.prependTo(i),n.click(a)),t.insert_after&&s.find(t.insert_after).length?(s=s.find(t.insert_after).first(),s.after(i)):s.prepend(i)),!0):!1):!1)},t.confirm=function(t){function e(){var e=jQuery(this),s=parseInt(e.data("key"));i.remove(),n.remove(),"function"==typeof t.callback&&t.callback(s)}var s,i,n,o,a,r,l,h;if(!t instanceof Object)return!1;if(void 0===t.message)return!1;for(t.modal=void 0===t.modal?!0:t.modal,t.layout=void 0===t.layout?"fixed":t.layout,t.parent=void 0===t.parent?c:t.parent,t.buttons=void 0===t.buttons?["OK"]:t.buttons,t.callback=void 0===t.callback?!1:t.callback,s=jQuery(t.parent),t.modal&&(i=jQuery('<div class="wmui-confirm-modal"></div>').css({position:t.layout}).appendTo(s)),n=jQuery('<div class="wpmui-confirm-box"></div>').css({position:t.layout}).appendTo(s),o=jQuery('<div class="wpmui-confirm-msg"></div>').html(t.message),a=jQuery('<div class="wpmui-confirm-btn"></div>'),h=!0,r=0;t.buttons.length>r;r+=1)l=jQuery("<button></button>").html(t.buttons[r]).addClass(h?"button-primary":"button-secondary").data("key",r).click(e).prependTo(a),h=!1;return o.appendTo(n),a.appendTo(n),!0},t.tooltip=function(t,s){var i,n;e();var o=function o(e){var i=e.outerWidth(),n=e.outerHeight(),o=5,a=t.outerWidth(),r=t.outerHeight(),c={};switch(c.left=(a-i)/2,c.top=(r-n)/2,c[s.pos]="auto",s.pos){case"top":c.bottom=r+o;break;case"bottom":c.top=r+o;break;case"left":c.right=a+o;break;case"right":c.left=a+o}e.css(c)},a=function a(){var t=jQuery(this).closest(".wpmui-tip-box").find(".wpmui-tip");t.addClass("wpmui-visible"),t.show(),o(t),window.setTimeout(function(){o(t)},35)},r=function r(){var t=jQuery(this).closest(".wpmui-tip-box").find(".wpmui-tip");t.removeClass("wpmui-visible"),t.hide()},c=function c(t){i.hasClass("wpmui-visible")?r.call(this,t):a.call(this,t)};return"string"==typeof s&&(s={content:s}),void 0===s.content?!1:(t=jQuery(t),t.length?(s.trigger=void 0===s.trigger?"hover":(""+s.trigger).toLowerCase(),s.pos=void 0===s.pos?"top":(""+s.pos).toLowerCase(),s["class"]=void 0===s["class"]?"":(""+s["class"]).toLowerCase(),n=t.parent(),n.hasClass("wpmui-tip-box")||(n=t.wrap('<span class="wpmui-tip-box"></span>').parent().addClass(s["class"]+"-box")),i=n.find("> .wpmui-tip"),t.off(),i.length||(i=jQuery('<div class="wpmui-tip"></div>'),i.addClass(s["class"]).addClass(s.pos).appendTo(t.parent()).hide(),isNaN(s.width)||i.width(s.width)),"hover"===s.trigger?t.on("mouseenter",a).on("mouseleave",r):"click"===s.trigger&&t.on("click",c),i.html(s.content),!0):!1)},t.upgrade_tooltips=function(){var e=jQuery("[data-tooltip]");e.each(function(){var e=jQuery(this),s={content:e.attr("data-tooltip"),pos:e.attr("data-pos"),trigger:e.attr("data-trigger"),"class":e.attr("data-class"),width:e.attr("data-width")};t.tooltip(e,s)})},t.obj=function(t){var e={};if(t instanceof Object)e=t;else if(t instanceof Array)if("function"==typeof t.reduce)e=t.reduce(function(t,e,s){return t[s]=e,t},{});else for(var s=t.length-1;s>0;s-=1)void 0!==t[s]&&(e[s]=t[s]);else"string"==typeof t?e.scalar=t:"number"==typeof t?e.scalar=t:"boolean"==typeof t&&(e.scalar=t);return e},jQuery(function(){e()});var h=function(){function e(){T=jQuery('<div class="wpmui-wnd"></div>'),O=jQuery('<div class="wpmui-wnd-title"><span class="the-title"></span></div>'),P=jQuery('<a href="#" class="wpmui-wnd-close"><i class="dashicons dashicons-no-alt"></i></a>'),j=jQuery('<div class="wpmui-wnd-content"></div>'),O.appendTo(T),j.appendTo(T),P.appendTo(O),T.appendTo(c).hide(),n(),f=!1,a()}function n(){T&&(T.on("click",".wpmui-wnd-close",p.close),T.on("click","thead .check-column :checkbox",u),T.on("click","tfoot .check-column :checkbox",u),T.on("click","tbody .check-column :checkbox",d),jQuery(window).on("resize",h))}function o(){T&&(T.off("click",".wpmui-wnd-close",p.close),T.off("click",".check-column :checkbox",u),jQuery(window).off("resize",h))}function a(t,e){if(!T)return!1;t=t||g,e=e||v;var n={width:t,height:e,"margin-left":-1*(t/2),"margin-top":-1*(e/2)};if(O.find(".the-title").text(w),C){T.find(".buttons").remove(),T.removeClass(),T.addClass("wpmui-wnd no-buttons"),b instanceof jQuery?j.html(b.html()):j.html(jQuery(b).html());var o=j.find(".buttons");o.length&&(o.appendTo(T),T.removeClass("no-buttons")),T.addClass(y),C=!1}T.is(":visible")?T.animate(n,200):T.css(n),l instanceof jQuery&&l.off("click",r),f?(T.show(),m&&s(),l.on("click",r),S&&(S=!1,h())):(T.hide(),i())}function r(){return T?!l instanceof jQuery?!1:(l.off("click",r),p.close(),void 0):!1}function h(){if(!T)return!1;var t=jQuery(this),e=t.innerWidth(),s=t.innerHeight(),i=g,n=v;g>e&&(i=e),v>s&&(n=s),a(i,n)}function u(t){var e=jQuery(this),s=e.prop("checked");t.shiftKey,e.closest("table").children("tbody, thead, tfoot").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",s)}function d(){var t=jQuery(this),e=t.closest("tbody").find(":checkbox").filter(":visible").not(":checked");return t.closest("table").children("thead, tfoot").find(":checkbox").prop("checked",0===e.length),!0}var p=this,f=!1,m=!1,g=740,v=400,w="Window",b="",y="",C=!1,S=!1,x=null,E=null,k=null,T=null,O=null,P=null,j=null,A="hidden";this.modal=function(t){return m=t?!0:!1,a(),p},this.size=function(t,e){var s=Math.abs(parseFloat(t)),i=Math.abs(parseFloat(e));return isNaN(s)||(g=s),isNaN(i)||(v=i),S=!0,a(),p},this.title=function(t){return w=t,a(),p},this.content=function(t){return b=t,S=!0,C=!0,a(),p},this.set_class=function(t){return y=t,C=!0,a(),p},this.onshow=function(t){return x=t,p},this.onhide=function(t){return E=t,p},this.onclose=function(t){return k=t,p},this.loading=function(t){return t?T.addClass("wpmui-loading"):T.removeClass("wpmui-loading"),p},this.confirm=function(e){return"visible"!==A?p:!e instanceof Object?p:(e.layout="absolute",e.parent=T,t.confirm(e),p)},this.show=function(){return f=!0,S=!0,A="visible",a(),"function"==typeof x&&x.apply(p,[p.$()]),p},this.hide=function(){return f=!1,A="hidden",a(),"function"==typeof E&&E.apply(p,[p.$()]),p},this.close=function(){"closing"!==A&&(p.hide(),A="closing","function"==typeof k&&k.apply(p,[p.$()]),o(),T.remove(),T=null)},this.$=function(){return T},p=this,e()},u=function(t,e){function s(){t||"string"!=typeof window.ajaxurl||(t=window.ajaxurl),d=c.find("#wpmui_void"),d.length||(d=jQuery("<iframe></iframe>").attr("name","wpmui_void").attr("id","wpmui_void").css({width:1,height:1,display:"none",visibility:"hidden",position:"absolute",left:-1e3,top:-1e3}).hide().appendTo(c)),i(),u.reset()}function i(){var t=document.createElement("INPUT"),e=new XMLHttpRequest;t.type="file",v="files"in t,g=!!(e&&"upload"in e&&"onprogress"in e.upload),w=!!window.FormData}function n(){var t=new window.XMLHttpRequest;return g&&(t.upload.addEventListener("progress",function(t){if(t.lengthComputable){var e=t.loaded/t.total;o(e)}else o(-1)},!1),t.addEventListener("progress",function(t){if(t.lengthComputable){var e=t.loaded/t.total;o(e)}else o(-1)},!1)),t}function o(t){g&&"function"==typeof f&&f(t)}function a(t,e,s){o(100),"function"==typeof m&&m(t,e,s)}function r(t,e){var s={};if(e=e&&w,p instanceof jQuery)if(p.find(".wp-editor-area").each(function(){var t=jQuery(this).attr("id"),e="#wp-"+t+"-wrap",s=jQuery(e),i=window.tinyMCE.get(t);i&&s.hasClass("tmce-active")&&i.save()}),e)s=new window.FormData(p[0]);else{s={};var i={},n={validate:/^[a-zA-Z][a-zA-Z0-9_-]*(?:\[(?:\d*|[a-zA-Z0-9_]+)\])*$/,key:/[a-zA-Z0-9_-]+|(?=\[\])/g,push:/^$/,fixed:/^\d+$/,named:/^[a-zA-Z0-9_-]+$/},o=function(t,e,s){return t[e]=s,t},a=function(t){return void 0===i[t]&&(i[t]=0),i[t]++};jQuery.each(p.serializeArray(),function(){if(n.validate.test(this.name)){for(var t,e=this.name.match(n.key),i=this.value,r=this.name;void 0!==(t=e.pop());)r=r.replace(RegExp("\\["+t+"\\]$"),""),t.match(n.push)?i=o([],a(r),i):t.match(n.fixed)?i=o([],t,i):t.match(n.named)&&(i=o({},t,i));s=jQuery.extend(!0,s,i)}}),p.find("input[type=file]").each(function(){var t=jQuery(this),e=t.attr("name"),i=t.clone(!0)[0];s[":files"]=s[":files"]||{},s[":files"][e]=i})}else if("string"==typeof p){var r=p.split("&").map(function(t){return t.split("=",2)});s=e?new window.FormData:{};for(var c in r){var l=decodeURI(r[c][0]),h=decodeURI(r[c][1]);e?s.append(l,h):void 0!==s[l]?("object"!=typeof s[l]&&(s[l]=[s[l]]),s[l].push(h)):s[l]=h}}else if("object"==typeof p)if(e){s=new window.FormData;for(var u in p)p.hasOwnProperty(u)&&s.append(u,p[u])}else s=jQuery.extend({},p);return s instanceof window.FormData?s.append("action",t):s.action=t,s}function l(e,s){var i=r(e,!0),c={},l=null,h=!1;"json"!==s&&(s="text"),o(-1),c={url:t,type:"POST",dataType:"html",data:i,xhr:n,success:function(t){if(h=!0,l=t,"json"===s)try{l=jQuery.parseJSON(t)}catch(e){l={status:"ERR",data:t}}},error:function(t,e,s){h=!1,l=s},complete:function(t){l instanceof Object&&"ERR"===l.status&&(h=!1),a(l,h,t)}},i instanceof window.FormData&&(c.processData=!1,c.contentType=!1),jQuery.ajax(c)}function h(e,s){var i=r(e,!1),n=jQuery("<form></form>"),o="";for(var a in i)if(i.hasOwnProperty(a))if(":files"===a)for(var l in i[a]){var h=i[a][l];n.append(h)}else"action"===a?o=a+"="+(""+i[a]):jQuery('<input type="hidden" />').attr("name",a).attr("value",i[a]).appendTo(n);o=-1===t.indexOf("?")?"?"+o:"&"+o,n.attr("action",t+o).attr("method","POST").attr("enctype","multipart/form-data").attr("target",s).hide().appendTo(c),n.submit()}var u=this,d=null,p={},f=null,m=null,g=!1,v=!1,w=!1;this.data=function(t){return p=t,u},this.extract_data=function(t){return p=t,r("",!1)},this.onprogress=function(t){return f=t,u},this.ondone=function(t){return m=t,u},this.reset=function(){return p={},f=null,m=null,u},this.load_text=function(t){return t=t||e,l(t,"text"),u},this.load_json=function(t){return t=t||e,l(t,"json"),u},this.load_http=function(t,s){return t=t||"wpmui_void",s=s||e,h(s,t),u},u=this,s()},d=function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";d.utf8_encode=function(t){if("string"!=typeof t)return t;t=t.replace(/\r\n/g,"\n");var e,s="",i=0;for(i;t.length>i;i++)e=t.charCodeAt(i),128>e?s+=String.fromCharCode(e):e>127&&2048>e?(s+=String.fromCharCode(192|e>>6),s+=String.fromCharCode(128|63&e)):(s+=String.fromCharCode(224|e>>12),s+=String.fromCharCode(128|63&e>>6),s+=String.fromCharCode(128|63&e));return s},d.utf8_decode=function(t){if("string"!=typeof t)return t;for(var e="",s=0,i=0;t.length>s;)i=t.charCodeAt(s),128>i?(e+=String.fromCharCode(i),s+=1):i>191&&224>i?(e+=String.fromCharCode((31&i)<<6|63&t.charCodeAt(s+1)),s+=2):(e+=String.fromCharCode((15&i)<<12|(63&t.charCodeAt(s+1))<<6|63&t.charCodeAt(s+2)),s+=3);return e},d.base64_encode=function(e){if("string"!=typeof e)return e;e=d.utf8_encode(e);for(var s,i,n,o,a,r,c,l="",h=0;e.length>h;)s=e.charCodeAt(h++),i=e.charCodeAt(h++),n=e.charCodeAt(h++),o=s>>2,a=(3&s)<<4|i>>4,r=(15&i)<<2|n>>6,c=63&n,isNaN(i)?r=c=64:isNaN(n)&&(c=64),l+=t.charAt(o)+t.charAt(a)+t.charAt(r)+t.charAt(c);return l},d.base64_decode=function(e){if("string"!=typeof e)return e;e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var s,i,n,o,a,r,c,l="",h=0;e.length>h;)o=t.indexOf(e.charAt(h++)),a=t.indexOf(e.charAt(h++)),r=t.indexOf(e.charAt(h++)),c=t.indexOf(e.charAt(h++)),s=o<<2|a>>4,i=(15&a)<<4|r>>2,n=(3&r)<<6|c,l+=String.fromCharCode(s),64!==r&&(l+=String.fromCharCode(i)),64!==c&&(l+=String.fromCharCode(n));return d.utf8_decode(l)}}})(window.wpmUi=window.wpmUi||{});
|
1 |
+
/*! WPMU Dev code library - v1.0.17
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
(function(t){function e(){null===r&&(a=jQuery(document),r=jQuery("html"),c=jQuery("body"),n(),o(),c.hasClass("no-auto-init")||(t.upgrade_multiselect(),t.upgrade_tooltips()),t.binary=new d)}function s(){null===l&&(l=jQuery("<div></div>").addClass("wpmui-overlay").appendTo(c)),c.addClass("wpmui-has-overlay"),r.addClass("wpmui-no-scroll")}function i(){c.removeClass("wpmui-has-overlay"),r.removeClass("wpmui-no-scroll")}function n(){var t=function t(t){var e=jQuery(this).closest(".wpmui-box");return t.preventDefault(),e.hasClass("static")?!1:(e.toggleClass("closed"),!1)};c.on("click",".wpmui-box > h3",t),c.on("click",".wpmui-box > h3 > .toggle",t)}function o(){var t=function t(t){var e=jQuery(this),s=e.closest(".wpmui-tabs"),i=s.next(".wpmui-tab-contents"),n=s.find(".active.tab"),o=e.attr("href"),a=n.attr("href"),r=i.find(o),c=i.find(a);return e.hasClass("active")||(n.removeClass("active"),c.removeClass("active")),e.addClass("active"),r.addClass("active"),t.preventDefault(),!1};c.on("click",".wpmui-tabs .tab",t)}var a=null,r=null,c=null,l=null;t.popup=function(){return e(),new h},t.ajax=function(t,s){return e(),new u(t,s)},t.upgrade_multiselect=function(t){e(),t=jQuery(t||c);var s=t.find("select[multiple]"),i=t.find("input[data-select-ajax]"),n=function n(t){var e=t.attr("id"),s="#s2id_"+e,i=t.parent().find(s);i.remove()},o=function o(){var t=jQuery(this),e={closeOnSelect:!1,width:"100%"};"1"!==t.data("wpmui-select")&&(t.data("wpmui-select","1"),n(t),window.setTimeout(function(){t.select2(e)},1))},a=function a(){var t=function t(t){return t.val},e=function e(t){return t.key},s=function s(t,e){var s=t.val(),i=[],n=[];jQuery(s.split(",")).each(function(){var t=this.split("::");n.push(t[0]),i.push({key:t[0],val:t[1]})}),t.val(n.join(",")),e(i)},i=jQuery(this),o={closeOnSelect:!1,width:"100%",multiple:!0,minimumInputLength:1,ajax:{url:i.attr("data-select-ajax"),dataType:"json",quietMillis:100,cache:!0,data:function(t){return{q:t}},results:function(t){return{results:t.items}}},id:e,formatResult:t,formatSelection:t,initSelection:s};"1"!==i.data("wpmui-select")&&(i.data("wpmui-select","1"),n(i),window.setTimeout(function(){i.select2(o)},1))};"function"==typeof jQuery.fn.each2?(s.each2(o),i.each2(a)):(s.each(o),i.each(a))},t.message=function(t){var s,i,n,o;e();var a=function a(t){return t.preventDefault(),i.remove(),!1},r=function r(){var t=jQuery(this).closest(".wpmui-msg");t.find(".debug").toggle()};return t===void 0?!1:(("string"==typeof t||t instanceof Array)&&(t={message:t}),t.message instanceof Array&&(t.message=t.message.join("<br />")),t.message?(t.type=void 0===t.type?"ok":(""+t.type).toLowerCase(),t.close=void 0===t.close?!0:t.close,t.parent=void 0===t.parent?".wrap":t.parent,t.insert_after=void 0===t.insert_after?"h2":t.insert_after,t.id=void 0===t.id?"":(""+t.id).toLowerCase(),t["class"]=void 0===t["class"]?"":(""+t["class"]).toLowerCase(),t.details=void 0===t.details?!1:t.details,("error"===t.type||"red"===t.type)&&(t.type="err"),("success"===t.type||"green"===t.type)&&(t.type="ok"),s=jQuery(t.parent).first(),s.length?(t.id&&jQuery('.wpmui-msg[data-id="'+t.id+'"]').length?(i=jQuery('.wpmui-msg[data-id="'+t.id+'"]').first(),o=!1):(i=jQuery("<div><p></p></div>"),t.id&&i.attr("data-id",t.id),o=!0),i.find("p").html(t.message),"err"===t.type&&t.details&&window.JSON&&(jQuery('<div class="debug" style="display:none"></div>').appendTo(i).text(JSON.stringify(t.details)),jQuery('<i class="dashicons dashicons-editor-help light"></i>').prependTo(i.find("p:first")).click(r).after(" ")),i.removeClass().addClass("updated wpmui-msg "+t["class"]),"err"===t.type&&i.addClass("error"),o&&(t.close&&(n=jQuery('<a href="#" class="wpmui-close">×</a>'),n.prependTo(i),n.click(a)),t.insert_after&&s.find(t.insert_after).length?(s=s.find(t.insert_after).first(),s.after(i)):s.prepend(i)),!0):!1):!1)},t.confirm=function(t){function e(){var e=jQuery(this),s=parseInt(e.data("key"));i.remove(),n.remove(),"function"==typeof t.callback&&t.callback(s)}var s,i,n,o,a,r,l,h;if(!t instanceof Object)return!1;if(void 0===t.message)return!1;for(t.modal=void 0===t.modal?!0:t.modal,t.layout=void 0===t.layout?"fixed":t.layout,t.parent=void 0===t.parent?c:t.parent,t.buttons=void 0===t.buttons?["OK"]:t.buttons,t.callback=void 0===t.callback?!1:t.callback,s=jQuery(t.parent),t.modal&&(i=jQuery('<div class="wmui-confirm-modal"></div>').css({position:t.layout}).appendTo(s)),n=jQuery('<div class="wpmui-confirm-box"></div>').css({position:t.layout}).appendTo(s),o=jQuery('<div class="wpmui-confirm-msg"></div>').html(t.message),a=jQuery('<div class="wpmui-confirm-btn"></div>'),h=!0,r=0;t.buttons.length>r;r+=1)l=jQuery("<button></button>").html(t.buttons[r]).addClass(h?"button-primary":"button-secondary").data("key",r).click(e).prependTo(a),h=!1;return o.appendTo(n),a.appendTo(n),!0},t.tooltip=function(t,s){var i,n;e();var o=function o(e){var i=e.outerWidth(),n=e.outerHeight(),o=5,a=t.outerWidth(),r=t.outerHeight(),c={};switch(c.left=(a-i)/2,c.top=(r-n)/2,c[s.pos]="auto",s.pos){case"top":c.bottom=r+o;break;case"bottom":c.top=r+o;break;case"left":c.right=a+o;break;case"right":c.left=a+o}e.css(c)},a=function a(){var t=jQuery(this).closest(".wpmui-tip-box").find(".wpmui-tip");t.addClass("wpmui-visible"),t.show(),o(t),window.setTimeout(function(){o(t)},35)},r=function r(){var t=jQuery(this).closest(".wpmui-tip-box").find(".wpmui-tip");t.removeClass("wpmui-visible"),t.hide()},c=function c(t){i.hasClass("wpmui-visible")?r.call(this,t):a.call(this,t)};return"string"==typeof s&&(s={content:s}),void 0===s.content?!1:(t=jQuery(t),t.length?(s.trigger=void 0===s.trigger?"hover":(""+s.trigger).toLowerCase(),s.pos=void 0===s.pos?"top":(""+s.pos).toLowerCase(),s["class"]=void 0===s["class"]?"":(""+s["class"]).toLowerCase(),n=t.parent(),n.hasClass("wpmui-tip-box")||(n=t.wrap('<span class="wpmui-tip-box"></span>').parent().addClass(s["class"]+"-box")),i=n.find("> .wpmui-tip"),t.off(),i.length||(i=jQuery('<div class="wpmui-tip"></div>'),i.addClass(s["class"]).addClass(s.pos).appendTo(t.parent()).hide(),isNaN(s.width)||i.width(s.width)),"hover"===s.trigger?t.on("mouseenter",a).on("mouseleave",r):"click"===s.trigger&&t.on("click",c),i.html(s.content),!0):!1)},t.upgrade_tooltips=function(){var e=jQuery("[data-tooltip]");e.each(function(){var e=jQuery(this),s={content:e.attr("data-tooltip"),pos:e.attr("data-pos"),trigger:e.attr("data-trigger"),"class":e.attr("data-class"),width:e.attr("data-width")};t.tooltip(e,s)})},t.obj=function(t){var e={};if(t instanceof Object)e=t;else if(t instanceof Array)if("function"==typeof t.reduce)e=t.reduce(function(t,e,s){return t[s]=e,t},{});else for(var s=t.length-1;s>0;s-=1)void 0!==t[s]&&(e[s]=t[s]);else"string"==typeof t?e.scalar=t:"number"==typeof t?e.scalar=t:"boolean"==typeof t&&(e.scalar=t);return e},jQuery(function(){e()});var h=function(){function e(){T=jQuery('<div class="wpmui-wnd"></div>'),O=jQuery('<div class="wpmui-wnd-title"><span class="the-title"></span></div>'),P=jQuery('<a href="#" class="wpmui-wnd-close"><i class="dashicons dashicons-no-alt"></i></a>'),j=jQuery('<div class="wpmui-wnd-content"></div>'),O.appendTo(T),j.appendTo(T),P.appendTo(O),T.appendTo(c).hide(),n(),f=!1,a()}function n(){T&&(T.on("click",".wpmui-wnd-close",p.close),T.on("click","thead .check-column :checkbox",u),T.on("click","tfoot .check-column :checkbox",u),T.on("click","tbody .check-column :checkbox",d),jQuery(window).on("resize",h))}function o(){T&&(T.off("click",".wpmui-wnd-close",p.close),T.off("click",".check-column :checkbox",u),jQuery(window).off("resize",h))}function a(t,e){if(!T)return!1;t=t||g,e=e||v;var n={width:t,height:e,"margin-left":-1*(t/2),"margin-top":-1*(e/2)};if(O.find(".the-title").text(w),C){T.find(".buttons").remove(),T.removeClass(),T.addClass("wpmui-wnd no-buttons"),b instanceof jQuery?j.html(b.html()):j.html(jQuery(b).html());var o=j.find(".buttons");o.length&&(o.appendTo(T),T.removeClass("no-buttons")),T.addClass(y),C=!1}T.is(":visible")?T.animate(n,200):T.css(n),l instanceof jQuery&&l.off("click",r),f?(T.show(),m&&s(),l.on("click",r),S&&(S=!1,h())):(T.hide(),i())}function r(){return T?!l instanceof jQuery?!1:(l.off("click",r),p.close(),void 0):!1}function h(){if(!T)return!1;var t=jQuery(this),e=t.innerWidth(),s=t.innerHeight(),i=g,n=v;g>e&&(i=e),v>s&&(n=s),a(i,n)}function u(t){var e=jQuery(this),s=e.prop("checked");t.shiftKey,e.closest("table").children("tbody, thead, tfoot").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",s)}function d(){var t=jQuery(this),e=t.closest("tbody").find(":checkbox").filter(":visible").not(":checked");return t.closest("table").children("thead, tfoot").find(":checkbox").prop("checked",0===e.length),!0}var p=this,f=!1,m=!1,g=740,v=400,w="Window",b="",y="",C=!1,S=!1,x=null,E=null,k=null,T=null,O=null,P=null,j=null,A="hidden";this.modal=function(t){return m=t?!0:!1,a(),p},this.size=function(t,e){var s=Math.abs(parseFloat(t)),i=Math.abs(parseFloat(e));return isNaN(s)||(g=s),isNaN(i)||(v=i),S=!0,a(),p},this.title=function(t){return w=t,a(),p},this.content=function(t){return b=t,S=!0,C=!0,a(),p},this.set_class=function(t){return y=t,C=!0,a(),p},this.onshow=function(t){return x=t,p},this.onhide=function(t){return E=t,p},this.onclose=function(t){return k=t,p},this.loading=function(t){return t?T.addClass("wpmui-loading"):T.removeClass("wpmui-loading"),p},this.confirm=function(e){return"visible"!==A?p:!e instanceof Object?p:(e.layout="absolute",e.parent=T,t.confirm(e),p)},this.show=function(){return f=!0,S=!0,A="visible",a(),"function"==typeof x&&x.apply(p,[p.$()]),p},this.hide=function(){return f=!1,A="hidden",a(),"function"==typeof E&&E.apply(p,[p.$()]),p},this.close=function(){"closing"!==A&&(p.hide(),A="closing","function"==typeof k&&k.apply(p,[p.$()]),o(),T.remove(),T=null)},this.$=function(){return T},p=this,e()},u=function(t,e){function s(){t||"string"!=typeof window.ajaxurl||(t=window.ajaxurl),d=c.find("#wpmui_void"),d.length||(d=jQuery("<iframe></iframe>").attr("name","wpmui_void").attr("id","wpmui_void").css({width:1,height:1,display:"none",visibility:"hidden",position:"absolute",left:-1e3,top:-1e3}).hide().appendTo(c)),i(),u.reset()}function i(){var t=document.createElement("INPUT"),e=new XMLHttpRequest;t.type="file",v="files"in t,g=!!(e&&"upload"in e&&"onprogress"in e.upload),w=!!window.FormData}function n(){var t=new window.XMLHttpRequest;return g&&(t.upload.addEventListener("progress",function(t){if(t.lengthComputable){var e=t.loaded/t.total;o(e)}else o(-1)},!1),t.addEventListener("progress",function(t){if(t.lengthComputable){var e=t.loaded/t.total;o(e)}else o(-1)},!1)),t}function o(t){g&&"function"==typeof f&&f(t)}function a(t,e,s){o(100),"function"==typeof m&&m(t,e,s)}function r(t,e){var s={};if(e=e&&w,p instanceof jQuery)if(p.find(".wp-editor-area").each(function(){var t=jQuery(this).attr("id"),e="#wp-"+t+"-wrap",s=jQuery(e),i=window.tinyMCE.get(t);i&&s.hasClass("tmce-active")&&i.save()}),e)s=new window.FormData(p[0]);else{s={};var i={},n={validate:/^[a-zA-Z][a-zA-Z0-9_-]*(?:\[(?:\d*|[a-zA-Z0-9_]+)\])*$/,key:/[a-zA-Z0-9_-]+|(?=\[\])/g,push:/^$/,fixed:/^\d+$/,named:/^[a-zA-Z0-9_-]+$/},o=function(t,e,s){return t[e]=s,t},a=function(t){return void 0===i[t]&&(i[t]=0),i[t]++};jQuery.each(p.serializeArray(),function(){if(n.validate.test(this.name)){for(var t,e=this.name.match(n.key),i=this.value,r=this.name;void 0!==(t=e.pop());)r=r.replace(RegExp("\\["+t+"\\]$"),""),t.match(n.push)?i=o([],a(r),i):t.match(n.fixed)?i=o([],t,i):t.match(n.named)&&(i=o({},t,i));s=jQuery.extend(!0,s,i)}}),p.find("input[type=file]").each(function(){var t=jQuery(this),e=t.attr("name"),i=t.clone(!0)[0];s[":files"]=s[":files"]||{},s[":files"][e]=i})}else if("string"==typeof p){var r=p.split("&").map(function(t){return t.split("=",2)});s=e?new window.FormData:{};for(var c in r){var l=decodeURI(r[c][0]),h=decodeURI(r[c][1]);e?s.append(l,h):void 0!==s[l]?("object"!=typeof s[l]&&(s[l]=[s[l]]),s[l].push(h)):s[l]=h}}else if("object"==typeof p)if(e){s=new window.FormData;for(var u in p)p.hasOwnProperty(u)&&s.append(u,p[u])}else s=jQuery.extend({},p);return s instanceof window.FormData?s.append("action",t):s.action=t,s}function l(e,s){var i=r(e,!0),c={},l=null,h=!1;"json"!==s&&(s="text"),o(-1),c={url:t,type:"POST",dataType:"html",data:i,xhr:n,success:function(t){if(h=!0,l=t,"json"===s)try{l=jQuery.parseJSON(t)}catch(e){l={status:"ERR",data:t}}},error:function(t,e,s){h=!1,l=s},complete:function(t){l instanceof Object&&"ERR"===l.status&&(h=!1),a(l,h,t)}},i instanceof window.FormData&&(c.processData=!1,c.contentType=!1),jQuery.ajax(c)}function h(e,s){var i=r(e,!1),n=jQuery("<form></form>"),o="";for(var a in i)if(i.hasOwnProperty(a))if(":files"===a)for(var l in i[a]){var h=i[a][l];n.append(h)}else"action"===a?o=a+"="+(""+i[a]):jQuery('<input type="hidden" />').attr("name",a).attr("value",i[a]).appendTo(n);o=-1===t.indexOf("?")?"?"+o:"&"+o,n.attr("action",t+o).attr("method","POST").attr("enctype","multipart/form-data").attr("target",s).hide().appendTo(c),n.submit()}var u=this,d=null,p={},f=null,m=null,g=!1,v=!1,w=!1;this.data=function(t){return p=t,u},this.extract_data=function(t){return p=t,r("",!1)},this.onprogress=function(t){return f=t,u},this.ondone=function(t){return m=t,u},this.reset=function(){return p={},f=null,m=null,u},this.load_text=function(t){return t=t||e,l(t,"text"),u},this.load_json=function(t){return t=t||e,l(t,"json"),u},this.load_http=function(t,s){return t=t||"wpmui_void",s=s||e,h(s,t),u},u=this,s()},d=function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";d.utf8_encode=function(t){if("string"!=typeof t)return t;t=t.replace(/\r\n/g,"\n");var e,s="",i=0;for(i;t.length>i;i++)e=t.charCodeAt(i),128>e?s+=String.fromCharCode(e):e>127&&2048>e?(s+=String.fromCharCode(192|e>>6),s+=String.fromCharCode(128|63&e)):(s+=String.fromCharCode(224|e>>12),s+=String.fromCharCode(128|63&e>>6),s+=String.fromCharCode(128|63&e));return s},d.utf8_decode=function(t){if("string"!=typeof t)return t;for(var e="",s=0,i=0;t.length>s;)i=t.charCodeAt(s),128>i?(e+=String.fromCharCode(i),s+=1):i>191&&224>i?(e+=String.fromCharCode((31&i)<<6|63&t.charCodeAt(s+1)),s+=2):(e+=String.fromCharCode((15&i)<<12|(63&t.charCodeAt(s+1))<<6|63&t.charCodeAt(s+2)),s+=3);return e},d.base64_encode=function(e){if("string"!=typeof e)return e;e=d.utf8_encode(e);for(var s,i,n,o,a,r,c,l="",h=0;e.length>h;)s=e.charCodeAt(h++),i=e.charCodeAt(h++),n=e.charCodeAt(h++),o=s>>2,a=(3&s)<<4|i>>4,r=(15&i)<<2|n>>6,c=63&n,isNaN(i)?r=c=64:isNaN(n)&&(c=64),l+=t.charAt(o)+t.charAt(a)+t.charAt(r)+t.charAt(c);return l},d.base64_decode=function(e){if("string"!=typeof e)return e;e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var s,i,n,o,a,r,c,l="",h=0;e.length>h;)o=t.indexOf(e.charAt(h++)),a=t.indexOf(e.charAt(h++)),r=t.indexOf(e.charAt(h++)),c=t.indexOf(e.charAt(h++)),s=o<<2|a>>4,i=(15&a)<<4|r>>2,n=(3&r)<<6|c,l+=String.fromCharCode(s),64!==r&&(l+=String.fromCharCode(i)),64!==c&&(l+=String.fromCharCode(n));return d.utf8_decode(l)}}})(window.wpmUi=window.wpmUi||{});
|
inc/external/wpmu-lib/js/wpmu-vnav.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WPMU Dev code library - v1.0.
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
/*!
|
1 |
+
/*! WPMU Dev code library - v1.0.17
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
/*!
|
inc/external/wpmu-lib/js/wpmu-vnav.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WPMU Dev code library - v1.0.
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
jQuery(function(){var t=jQuery(".vnav"),e=jQuery("input[name=_wp_http_referer]");if(t.length){var s,i,n,o,a,r,c,l=0,h=jQuery(window),u=t.html(),d=u.split("<h3>"),p=window.location.hash.replace(/^#/,""),f=p.length?"":" active";for(u='<ul class="lst-vnav">',s=0;d.length>s;s+=1)i=d[s],n=i.split("</h3>"),2===n.length&&n[0].length&&("-"===n[0]?u+='<li class="lst-vnav-sep"></li>':(c=n[0].toLowerCase().replace(/\W\W*/g," ").replace(/^\s|\s$/g,"").replace(/\s/g,"-"),p.length&&p===c&&(f=" active"),o='<h3 data-key="'+c+'">'+n[0]+"</h3>",a='<div class="data">'+n[1]+"</div>",u+='<li class="lst-vnav-item'+f+'">'+o+a+"</li>",f=""));u+="</ul>",t.html(u),r=jQuery(".lst-vnav",t).first(),t.find(".lst-vnav-item > .data > table").each(function(){var t=jQuery(this),e=t.find("> tbody > tr > th, > tr > th"),s=e.filter(":empty");e.length===s.length&&e.remove()});var m=function m(){var t=jQuery(this),s=t.parents(".lst-vnav-item").first(),i=jQuery(".lst-vnav-item.active",r),n=t.data("key"),o="";window.location.hash=n,e.each(function(){var t=jQuery(this);o=t.val().split("#").shift(),o+="#"+n,t.val(o)}),i.removeClass("active"),s.addClass("active"),g()},g=function g(){var t=jQuery(".lst-vnav-item.active",r),e=jQuery("> .data",t).first(),s=e.outerHeight();l||(l=r.outerHeight()),r.css({"min-height":s+"px"}),e.css({"min-height":l+"px"})},v=function v(t){r.hasClass("open")?b(t):w(t)},w=function w(){r.addClass("open")},b=function b(){r.removeClass("open")};t.on("click","h3",m),t.on("click","h3",v),h.resize(g),h.resize(b),window.setTimeout(function(){jQuery(".active h3",t).click()},50)}});
|
1 |
+
/*! WPMU Dev code library - v1.0.17
|
2 |
* http://premium.wpmudev.org/
|
3 |
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
jQuery(function(){var t=jQuery(".vnav"),e=jQuery("input[name=_wp_http_referer]");if(t.length){var s,i,n,o,a,r,c,l=0,h=jQuery(window),u=t.html(),d=u.split("<h3>"),p=window.location.hash.replace(/^#/,""),f=p.length?"":" active";for(u='<ul class="lst-vnav">',s=0;d.length>s;s+=1)i=d[s],n=i.split("</h3>"),2===n.length&&n[0].length&&("-"===n[0]?u+='<li class="lst-vnav-sep"></li>':(c=n[0].toLowerCase().replace(/\W\W*/g," ").replace(/^\s|\s$/g,"").replace(/\s/g,"-"),p.length&&p===c&&(f=" active"),o='<h3 data-key="'+c+'">'+n[0]+"</h3>",a='<div class="data">'+n[1]+"</div>",u+='<li class="lst-vnav-item'+f+'">'+o+a+"</li>",f=""));u+="</ul>",t.html(u),r=jQuery(".lst-vnav",t).first(),t.find(".lst-vnav-item > .data > table").each(function(){var t=jQuery(this),e=t.find("> tbody > tr > th, > tr > th"),s=e.filter(":empty");e.length===s.length&&e.remove()});var m=function m(){var t=jQuery(this),s=t.parents(".lst-vnav-item").first(),i=jQuery(".lst-vnav-item.active",r),n=t.data("key"),o="";window.location.hash=n,e.each(function(){var t=jQuery(this);o=t.val().split("#").shift(),o+="#"+n,t.val(o)}),i.removeClass("active"),s.addClass("active"),g()},g=function g(){var t=jQuery(".lst-vnav-item.active",r),e=jQuery("> .data",t).first(),s=e.outerHeight();l||(l=r.outerHeight()),r.css({"min-height":s+"px"}),e.css({"min-height":l+"px"})},v=function v(t){r.hasClass("open")?b(t):w(t)},w=function w(){r.addClass("open")},b=function b(){r.removeClass("open")};t.on("click","h3",m),t.on("click","h3",v),h.resize(g),h.resize(b),window.setTimeout(function(){jQuery(".active h3",t).click()},50)}});
|
js/ace.js
ADDED
@@ -0,0 +1,19944 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*! PopUp Free - v4.7.02
|
2 |
+
* https://wordpress.org/plugins/wordpress-popup/
|
3 |
+
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
+
/**
|
5 |
+
* Define a module along with a payload
|
6 |
+
* @param module a name for the payload
|
7 |
+
* @param payload a function to call with (require, exports, module) params
|
8 |
+
*/
|
9 |
+
|
10 |
+
// https://github.com/ajaxorg/ace-builds/tree/master/src-noconflict
|
11 |
+
|
12 |
+
(function() {
|
13 |
+
|
14 |
+
var ACE_NAMESPACE = "ace";
|
15 |
+
|
16 |
+
var global = (function() {
|
17 |
+
return this;
|
18 |
+
})();
|
19 |
+
|
20 |
+
|
21 |
+
if (!ACE_NAMESPACE && typeof requirejs !== "undefined")
|
22 |
+
return;
|
23 |
+
|
24 |
+
|
25 |
+
var _define = function(module, deps, payload) {
|
26 |
+
if (typeof module !== 'string') {
|
27 |
+
if (_define.original)
|
28 |
+
_define.original.apply(window, arguments);
|
29 |
+
else {
|
30 |
+
console.error('dropping module because define wasn\'t a string.');
|
31 |
+
console.trace();
|
32 |
+
}
|
33 |
+
return;
|
34 |
+
}
|
35 |
+
|
36 |
+
if (arguments.length == 2)
|
37 |
+
payload = deps;
|
38 |
+
|
39 |
+
if (!_define.modules) {
|
40 |
+
_define.modules = {};
|
41 |
+
_define.payloads = {};
|
42 |
+
}
|
43 |
+
|
44 |
+
_define.payloads[module] = payload;
|
45 |
+
_define.modules[module] = null;
|
46 |
+
};
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get at functionality ace.define()ed using the function above
|
50 |
+
*/
|
51 |
+
var _require = function(parentId, module, callback) {
|
52 |
+
if (Object.prototype.toString.call(module) === "[object Array]") {
|
53 |
+
var params = [];
|
54 |
+
for (var i = 0, l = module.length; i < l; ++i) {
|
55 |
+
var dep = lookup(parentId, module[i]);
|
56 |
+
if (!dep && _require.original)
|
57 |
+
return _require.original.apply(window, arguments);
|
58 |
+
params.push(dep);
|
59 |
+
}
|
60 |
+
if (callback) {
|
61 |
+
callback.apply(null, params);
|
62 |
+
}
|
63 |
+
} else if (typeof module === 'string') {
|
64 |
+
var payload = lookup(parentId, module);
|
65 |
+
if (!payload && _require.original)
|
66 |
+
return _require.original.apply(window, arguments);
|
67 |
+
|
68 |
+
if (callback) {
|
69 |
+
callback();
|
70 |
+
}
|
71 |
+
|
72 |
+
return payload;
|
73 |
+
} else {
|
74 |
+
if (_require.original)
|
75 |
+
return _require.original.apply(window, arguments);
|
76 |
+
}
|
77 |
+
};
|
78 |
+
|
79 |
+
var normalizeModule = function(parentId, moduleName) {
|
80 |
+
// normalize plugin requires
|
81 |
+
if (moduleName.indexOf("!") !== -1) {
|
82 |
+
var chunks = moduleName.split("!");
|
83 |
+
return normalizeModule(parentId, chunks[0]) + "!" + normalizeModule(parentId, chunks[1]);
|
84 |
+
}
|
85 |
+
// normalize relative requires
|
86 |
+
if (moduleName.charAt(0) == ".") {
|
87 |
+
var base = parentId.split("/").slice(0, -1).join("/");
|
88 |
+
moduleName = base + "/" + moduleName;
|
89 |
+
|
90 |
+
while (moduleName.indexOf(".") !== -1 && previous != moduleName) {
|
91 |
+
var previous = moduleName;
|
92 |
+
moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
return moduleName;
|
97 |
+
};
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Internal function to lookup moduleNames and resolve them by calling the
|
101 |
+
* definition function if needed.
|
102 |
+
*/
|
103 |
+
var lookup = function(parentId, moduleName) {
|
104 |
+
|
105 |
+
moduleName = normalizeModule(parentId, moduleName);
|
106 |
+
|
107 |
+
var module = _define.modules[moduleName];
|
108 |
+
if (!module) {
|
109 |
+
module = _define.payloads[moduleName];
|
110 |
+
if (typeof module === 'function') {
|
111 |
+
var exports = {};
|
112 |
+
var mod = {
|
113 |
+
id: moduleName,
|
114 |
+
uri: '',
|
115 |
+
exports: exports,
|
116 |
+
packaged: true
|
117 |
+
};
|
118 |
+
|
119 |
+
var req = function(module, callback) {
|
120 |
+
return _require(moduleName, module, callback);
|
121 |
+
};
|
122 |
+
|
123 |
+
var returnValue = module(req, exports, mod);
|
124 |
+
exports = returnValue || mod.exports;
|
125 |
+
_define.modules[moduleName] = exports;
|
126 |
+
delete _define.payloads[moduleName];
|
127 |
+
}
|
128 |
+
module = _define.modules[moduleName] = exports || module;
|
129 |
+
}
|
130 |
+
return module;
|
131 |
+
};
|
132 |
+
|
133 |
+
function exportAce(ns) {
|
134 |
+
var require = function(module, callback) {
|
135 |
+
return _require("", module, callback);
|
136 |
+
};
|
137 |
+
|
138 |
+
var root = global;
|
139 |
+
if (ns) {
|
140 |
+
if (!global[ns])
|
141 |
+
global[ns] = {};
|
142 |
+
root = global[ns];
|
143 |
+
}
|
144 |
+
|
145 |
+
if (!root.define || !root.define.packaged) {
|
146 |
+
_define.original = root.define;
|
147 |
+
root.define = _define;
|
148 |
+
root.define.packaged = true;
|
149 |
+
}
|
150 |
+
|
151 |
+
if (!root.require || !root.require.packaged) {
|
152 |
+
_require.original = root.require;
|
153 |
+
root.require = require;
|
154 |
+
root.require.packaged = true;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
exportAce(ACE_NAMESPACE);
|
159 |
+
|
160 |
+
})();
|
161 |
+
|
162 |
+
ace.define("ace/lib/regexp", ["require", "exports", "module"], function(require, exports, module) {
|
163 |
+
"use strict";
|
164 |
+
|
165 |
+
var real = {
|
166 |
+
exec: RegExp.prototype.exec,
|
167 |
+
test: RegExp.prototype.test,
|
168 |
+
match: String.prototype.match,
|
169 |
+
replace: String.prototype.replace,
|
170 |
+
split: String.prototype.split
|
171 |
+
},
|
172 |
+
compliantExecNpcg = real.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups
|
173 |
+
compliantLastIndexIncrement = function() {
|
174 |
+
var x = /^/g;
|
175 |
+
real.test.call(x, "");
|
176 |
+
return !x.lastIndex;
|
177 |
+
}();
|
178 |
+
|
179 |
+
if (compliantLastIndexIncrement && compliantExecNpcg)
|
180 |
+
return;
|
181 |
+
RegExp.prototype.exec = function(str) {
|
182 |
+
var match = real.exec.apply(this, arguments),
|
183 |
+
name, r2;
|
184 |
+
if (typeof(str) == 'string' && match) {
|
185 |
+
if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) {
|
186 |
+
r2 = RegExp(this.source, real.replace.call(getNativeFlags(this), "g", ""));
|
187 |
+
real.replace.call(str.slice(match.index), r2, function() {
|
188 |
+
for (var i = 1; i < arguments.length - 2; i++) {
|
189 |
+
if (arguments[i] === undefined)
|
190 |
+
match[i] = undefined;
|
191 |
+
}
|
192 |
+
});
|
193 |
+
}
|
194 |
+
if (this._xregexp && this._xregexp.captureNames) {
|
195 |
+
for (var i = 1; i < match.length; i++) {
|
196 |
+
name = this._xregexp.captureNames[i - 1];
|
197 |
+
if (name)
|
198 |
+
match[name] = match[i];
|
199 |
+
}
|
200 |
+
}
|
201 |
+
if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
|
202 |
+
this.lastIndex--;
|
203 |
+
}
|
204 |
+
return match;
|
205 |
+
};
|
206 |
+
if (!compliantLastIndexIncrement) {
|
207 |
+
RegExp.prototype.test = function(str) {
|
208 |
+
var match = real.exec.call(this, str);
|
209 |
+
if (match && this.global && !match[0].length && (this.lastIndex > match.index))
|
210 |
+
this.lastIndex--;
|
211 |
+
return !!match;
|
212 |
+
};
|
213 |
+
}
|
214 |
+
|
215 |
+
function getNativeFlags(regex) {
|
216 |
+
return (regex.global ? "g" : "") +
|
217 |
+
(regex.ignoreCase ? "i" : "") +
|
218 |
+
(regex.multiline ? "m" : "") +
|
219 |
+
(regex.extended ? "x" : "") + // Proposed for ES4; included in AS3
|
220 |
+
(regex.sticky ? "y" : "");
|
221 |
+
}
|
222 |
+
|
223 |
+
function indexOf(array, item, from) {
|
224 |
+
if (Array.prototype.indexOf) // Use the native array method if available
|
225 |
+
return array.indexOf(item, from);
|
226 |
+
for (var i = from || 0; i < array.length; i++) {
|
227 |
+
if (array[i] === item)
|
228 |
+
return i;
|
229 |
+
}
|
230 |
+
return -1;
|
231 |
+
}
|
232 |
+
|
233 |
+
});
|
234 |
+
|
235 |
+
ace.define("ace/lib/es5-shim", ["require", "exports", "module"], function(require, exports, module) {
|
236 |
+
|
237 |
+
function Empty() {}
|
238 |
+
|
239 |
+
if (!Function.prototype.bind) {
|
240 |
+
Function.prototype.bind = function bind(that) { // .length is 1
|
241 |
+
var target = this;
|
242 |
+
if (typeof target != "function") {
|
243 |
+
throw new TypeError("Function.prototype.bind called on incompatible " + target);
|
244 |
+
}
|
245 |
+
var args = slice.call(arguments, 1); // for normal call
|
246 |
+
var bound = function() {
|
247 |
+
|
248 |
+
if (this instanceof bound) {
|
249 |
+
|
250 |
+
var result = target.apply(
|
251 |
+
this,
|
252 |
+
args.concat(slice.call(arguments))
|
253 |
+
);
|
254 |
+
if (Object(result) === result) {
|
255 |
+
return result;
|
256 |
+
}
|
257 |
+
return this;
|
258 |
+
|
259 |
+
} else {
|
260 |
+
return target.apply(
|
261 |
+
that,
|
262 |
+
args.concat(slice.call(arguments))
|
263 |
+
);
|
264 |
+
|
265 |
+
}
|
266 |
+
|
267 |
+
};
|
268 |
+
if (target.prototype) {
|
269 |
+
Empty.prototype = target.prototype;
|
270 |
+
bound.prototype = new Empty();
|
271 |
+
Empty.prototype = null;
|
272 |
+
}
|
273 |
+
return bound;
|
274 |
+
};
|
275 |
+
}
|
276 |
+
var call = Function.prototype.call;
|
277 |
+
var prototypeOfArray = Array.prototype;
|
278 |
+
var prototypeOfObject = Object.prototype;
|
279 |
+
var slice = prototypeOfArray.slice;
|
280 |
+
var _toString = call.bind(prototypeOfObject.toString);
|
281 |
+
var owns = call.bind(prototypeOfObject.hasOwnProperty);
|
282 |
+
var defineGetter;
|
283 |
+
var defineSetter;
|
284 |
+
var lookupGetter;
|
285 |
+
var lookupSetter;
|
286 |
+
var supportsAccessors;
|
287 |
+
if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
|
288 |
+
defineGetter = call.bind(prototypeOfObject.__defineGetter__);
|
289 |
+
defineSetter = call.bind(prototypeOfObject.__defineSetter__);
|
290 |
+
lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
|
291 |
+
lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
|
292 |
+
}
|
293 |
+
if ([1, 2].splice(0).length != 2) {
|
294 |
+
if (function() { // test IE < 9 to splice bug - see issue #138
|
295 |
+
function makeArray(l) {
|
296 |
+
var a = new Array(l + 2);
|
297 |
+
a[0] = a[1] = 0;
|
298 |
+
return a;
|
299 |
+
}
|
300 |
+
var array = [],
|
301 |
+
lengthBefore;
|
302 |
+
|
303 |
+
array.splice.apply(array, makeArray(20));
|
304 |
+
array.splice.apply(array, makeArray(26));
|
305 |
+
|
306 |
+
lengthBefore = array.length; //46
|
307 |
+
array.splice(5, 0, "XXX"); // add one element
|
308 |
+
|
309 |
+
lengthBefore + 1 == array.length
|
310 |
+
|
311 |
+
if (lengthBefore + 1 == array.length) {
|
312 |
+
return true; // has right splice implementation without bugs
|
313 |
+
}
|
314 |
+
}()) { //IE 6/7
|
315 |
+
var array_splice = Array.prototype.splice;
|
316 |
+
Array.prototype.splice = function(start, deleteCount) {
|
317 |
+
if (!arguments.length) {
|
318 |
+
return [];
|
319 |
+
} else {
|
320 |
+
return array_splice.apply(this, [
|
321 |
+
start === void 0 ? 0 : start,
|
322 |
+
deleteCount === void 0 ? (this.length - start) : deleteCount
|
323 |
+
].concat(slice.call(arguments, 2)))
|
324 |
+
}
|
325 |
+
};
|
326 |
+
} else { //IE8
|
327 |
+
Array.prototype.splice = function(pos, removeCount) {
|
328 |
+
var length = this.length;
|
329 |
+
if (pos > 0) {
|
330 |
+
if (pos > length)
|
331 |
+
pos = length;
|
332 |
+
} else if (pos == void 0) {
|
333 |
+
pos = 0;
|
334 |
+
} else if (pos < 0) {
|
335 |
+
pos = Math.max(length + pos, 0);
|
336 |
+
}
|
337 |
+
|
338 |
+
if (!(pos + removeCount < length))
|
339 |
+
removeCount = length - pos;
|
340 |
+
|
341 |
+
var removed = this.slice(pos, pos + removeCount);
|
342 |
+
var insert = slice.call(arguments, 2);
|
343 |
+
var add = insert.length;
|
344 |
+
if (pos === length) {
|
345 |
+
if (add) {
|
346 |
+
this.push.apply(this, insert);
|
347 |
+
}
|
348 |
+
} else {
|
349 |
+
var remove = Math.min(removeCount, length - pos);
|
350 |
+
var tailOldPos = pos + remove;
|
351 |
+
var tailNewPos = tailOldPos + add - remove;
|
352 |
+
var tailCount = length - tailOldPos;
|
353 |
+
var lengthAfterRemove = length - remove;
|
354 |
+
|
355 |
+
if (tailNewPos < tailOldPos) { // case A
|
356 |
+
for (var i = 0; i < tailCount; ++i) {
|
357 |
+
this[tailNewPos + i] = this[tailOldPos + i];
|
358 |
+
}
|
359 |
+
} else if (tailNewPos > tailOldPos) { // case B
|
360 |
+
for (i = tailCount; i--;) {
|
361 |
+
this[tailNewPos + i] = this[tailOldPos + i];
|
362 |
+
}
|
363 |
+
} // else, add == remove (nothing to do)
|
364 |
+
|
365 |
+
if (add && pos === lengthAfterRemove) {
|
366 |
+
this.length = lengthAfterRemove; // truncate array
|
367 |
+
this.push.apply(this, insert);
|
368 |
+
} else {
|
369 |
+
this.length = lengthAfterRemove + add; // reserves space
|
370 |
+
for (i = 0; i < add; ++i) {
|
371 |
+
this[pos + i] = insert[i];
|
372 |
+
}
|
373 |
+
}
|
374 |
+
}
|
375 |
+
return removed;
|
376 |
+
};
|
377 |
+
}
|
378 |
+
}
|
379 |
+
if (!Array.isArray) {
|
380 |
+
Array.isArray = function isArray(obj) {
|
381 |
+
return _toString(obj) == "[object Array]";
|
382 |
+
};
|
383 |
+
}
|
384 |
+
var boxedString = Object("a"),
|
385 |
+
splitString = boxedString[0] != "a" || !(0 in boxedString);
|
386 |
+
|
387 |
+
if (!Array.prototype.forEach) {
|
388 |
+
Array.prototype.forEach = function forEach(fun /*, thisp*/ ) {
|
389 |
+
var object = toObject(this),
|
390 |
+
self = splitString && _toString(this) == "[object String]" ?
|
391 |
+
this.split("") :
|
392 |
+
object,
|
393 |
+
thisp = arguments[1],
|
394 |
+
i = -1,
|
395 |
+
length = self.length >>> 0;
|
396 |
+
if (_toString(fun) != "[object Function]") {
|
397 |
+
throw new TypeError(); // TODO message
|
398 |
+
}
|
399 |
+
|
400 |
+
while (++i < length) {
|
401 |
+
if (i in self) {
|
402 |
+
fun.call(thisp, self[i], i, object);
|
403 |
+
}
|
404 |
+
}
|
405 |
+
};
|
406 |
+
}
|
407 |
+
if (!Array.prototype.map) {
|
408 |
+
Array.prototype.map = function map(fun /*, thisp*/ ) {
|
409 |
+
var object = toObject(this),
|
410 |
+
self = splitString && _toString(this) == "[object String]" ?
|
411 |
+
this.split("") :
|
412 |
+
object,
|
413 |
+
length = self.length >>> 0,
|
414 |
+
result = Array(length),
|
415 |
+
thisp = arguments[1];
|
416 |
+
if (_toString(fun) != "[object Function]") {
|
417 |
+
throw new TypeError(fun + " is not a function");
|
418 |
+
}
|
419 |
+
|
420 |
+
for (var i = 0; i < length; i++) {
|
421 |
+
if (i in self)
|
422 |
+
result[i] = fun.call(thisp, self[i], i, object);
|
423 |
+
}
|
424 |
+
return result;
|
425 |
+
};
|
426 |
+
}
|
427 |
+
if (!Array.prototype.filter) {
|
428 |
+
Array.prototype.filter = function filter(fun /*, thisp */ ) {
|
429 |
+
var object = toObject(this),
|
430 |
+
self = splitString && _toString(this) == "[object String]" ?
|
431 |
+
this.split("") :
|
432 |
+
object,
|
433 |
+
length = self.length >>> 0,
|
434 |
+
result = [],
|
435 |
+
value,
|
436 |
+
thisp = arguments[1];
|
437 |
+
if (_toString(fun) != "[object Function]") {
|
438 |
+
throw new TypeError(fun + " is not a function");
|
439 |
+
}
|
440 |
+
|
441 |
+
for (var i = 0; i < length; i++) {
|
442 |
+
if (i in self) {
|
443 |
+
value = self[i];
|
444 |
+
if (fun.call(thisp, value, i, object)) {
|
445 |
+
result.push(value);
|
446 |
+
}
|
447 |
+
}
|
448 |
+
}
|
449 |
+
return result;
|
450 |
+
};
|
451 |
+
}
|
452 |
+
if (!Array.prototype.every) {
|
453 |
+
Array.prototype.every = function every(fun /*, thisp */ ) {
|
454 |
+
var object = toObject(this),
|
455 |
+
self = splitString && _toString(this) == "[object String]" ?
|
456 |
+
this.split("") :
|
457 |
+
object,
|
458 |
+
length = self.length >>> 0,
|
459 |
+
thisp = arguments[1];
|
460 |
+
if (_toString(fun) != "[object Function]") {
|
461 |
+
throw new TypeError(fun + " is not a function");
|
462 |
+
}
|
463 |
+
|
464 |
+
for (var i = 0; i < length; i++) {
|
465 |
+
if (i in self && !fun.call(thisp, self[i], i, object)) {
|
466 |
+
return false;
|
467 |
+
}
|
468 |
+
}
|
469 |
+
return true;
|
470 |
+
};
|
471 |
+
}
|
472 |
+
if (!Array.prototype.some) {
|
473 |
+
Array.prototype.some = function some(fun /*, thisp */ ) {
|
474 |
+
var object = toObject(this),
|
475 |
+
self = splitString && _toString(this) == "[object String]" ?
|
476 |
+
this.split("") :
|
477 |
+
object,
|
478 |
+
length = self.length >>> 0,
|
479 |
+
thisp = arguments[1];
|
480 |
+
if (_toString(fun) != "[object Function]") {
|
481 |
+
throw new TypeError(fun + " is not a function");
|
482 |
+
}
|
483 |
+
|
484 |
+
for (var i = 0; i < length; i++) {
|
485 |
+
if (i in self && fun.call(thisp, self[i], i, object)) {
|
486 |
+
return true;
|
487 |
+
}
|
488 |
+
}
|
489 |
+
return false;
|
490 |
+
};
|
491 |
+
}
|
492 |
+
if (!Array.prototype.reduce) {
|
493 |
+
Array.prototype.reduce = function reduce(fun /*, initial*/ ) {
|
494 |
+
var object = toObject(this),
|
495 |
+
self = splitString && _toString(this) == "[object String]" ?
|
496 |
+
this.split("") :
|
497 |
+
object,
|
498 |
+
length = self.length >>> 0;
|
499 |
+
if (_toString(fun) != "[object Function]") {
|
500 |
+
throw new TypeError(fun + " is not a function");
|
501 |
+
}
|
502 |
+
if (!length && arguments.length == 1) {
|
503 |
+
throw new TypeError("reduce of empty array with no initial value");
|
504 |
+
}
|
505 |
+
|
506 |
+
var i = 0;
|
507 |
+
var result;
|
508 |
+
if (arguments.length >= 2) {
|
509 |
+
result = arguments[1];
|
510 |
+
} else {
|
511 |
+
do {
|
512 |
+
if (i in self) {
|
513 |
+
result = self[i++];
|
514 |
+
break;
|
515 |
+
}
|
516 |
+
if (++i >= length) {
|
517 |
+
throw new TypeError("reduce of empty array with no initial value");
|
518 |
+
}
|
519 |
+
} while (true);
|
520 |
+
}
|
521 |
+
|
522 |
+
for (; i < length; i++) {
|
523 |
+
if (i in self) {
|
524 |
+
result = fun.call(void 0, result, self[i], i, object);
|
525 |
+
}
|
526 |
+
}
|
527 |
+
|
528 |
+
return result;
|
529 |
+
};
|
530 |
+
}
|
531 |
+
if (!Array.prototype.reduceRight) {
|
532 |
+
Array.prototype.reduceRight = function reduceRight(fun /*, initial*/ ) {
|
533 |
+
var object = toObject(this),
|
534 |
+
self = splitString && _toString(this) == "[object String]" ?
|
535 |
+
this.split("") :
|
536 |
+
object,
|
537 |
+
length = self.length >>> 0;
|
538 |
+
if (_toString(fun) != "[object Function]") {
|
539 |
+
throw new TypeError(fun + " is not a function");
|
540 |
+
}
|
541 |
+
if (!length && arguments.length == 1) {
|
542 |
+
throw new TypeError("reduceRight of empty array with no initial value");
|
543 |
+
}
|
544 |
+
|
545 |
+
var result, i = length - 1;
|
546 |
+
if (arguments.length >= 2) {
|
547 |
+
result = arguments[1];
|
548 |
+
} else {
|
549 |
+
do {
|
550 |
+
if (i in self) {
|
551 |
+
result = self[i--];
|
552 |
+
break;
|
553 |
+
}
|
554 |
+
if (--i < 0) {
|
555 |
+
throw new TypeError("reduceRight of empty array with no initial value");
|
556 |
+
}
|
557 |
+
} while (true);
|
558 |
+
}
|
559 |
+
|
560 |
+
do {
|
561 |
+
if (i in this) {
|
562 |
+
result = fun.call(void 0, result, self[i], i, object);
|
563 |
+
}
|
564 |
+
} while (i--);
|
565 |
+
|
566 |
+
return result;
|
567 |
+
};
|
568 |
+
}
|
569 |
+
if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
|
570 |
+
Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
|
571 |
+
var self = splitString && _toString(this) == "[object String]" ?
|
572 |
+
this.split("") :
|
573 |
+
toObject(this),
|
574 |
+
length = self.length >>> 0;
|
575 |
+
|
576 |
+
if (!length) {
|
577 |
+
return -1;
|
578 |
+
}
|
579 |
+
|
580 |
+
var i = 0;
|
581 |
+
if (arguments.length > 1) {
|
582 |
+
i = toInteger(arguments[1]);
|
583 |
+
}
|
584 |
+
i = i >= 0 ? i : Math.max(0, length + i);
|
585 |
+
for (; i < length; i++) {
|
586 |
+
if (i in self && self[i] === sought) {
|
587 |
+
return i;
|
588 |
+
}
|
589 |
+
}
|
590 |
+
return -1;
|
591 |
+
};
|
592 |
+
}
|
593 |
+
if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
|
594 |
+
Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */ ) {
|
595 |
+
var self = splitString && _toString(this) == "[object String]" ?
|
596 |
+
this.split("") :
|
597 |
+
toObject(this),
|
598 |
+
length = self.length >>> 0;
|
599 |
+
|
600 |
+
if (!length) {
|
601 |
+
return -1;
|
602 |
+
}
|
603 |
+
var i = length - 1;
|
604 |
+
if (arguments.length > 1) {
|
605 |
+
i = Math.min(i, toInteger(arguments[1]));
|
606 |
+
}
|
607 |
+
i = i >= 0 ? i : length - Math.abs(i);
|
608 |
+
for (; i >= 0; i--) {
|
609 |
+
if (i in self && sought === self[i]) {
|
610 |
+
return i;
|
611 |
+
}
|
612 |
+
}
|
613 |
+
return -1;
|
614 |
+
};
|
615 |
+
}
|
616 |
+
if (!Object.getPrototypeOf) {
|
617 |
+
Object.getPrototypeOf = function getPrototypeOf(object) {
|
618 |
+
return object.__proto__ || (
|
619 |
+
object.constructor ?
|
620 |
+
object.constructor.prototype :
|
621 |
+
prototypeOfObject
|
622 |
+
);
|
623 |
+
};
|
624 |
+
}
|
625 |
+
if (!Object.getOwnPropertyDescriptor) {
|
626 |
+
var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
|
627 |
+
"non-object: ";
|
628 |
+
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
|
629 |
+
if ((typeof object != "object" && typeof object != "function") || object === null)
|
630 |
+
throw new TypeError(ERR_NON_OBJECT + object);
|
631 |
+
if (!owns(object, property))
|
632 |
+
return;
|
633 |
+
|
634 |
+
var descriptor, getter, setter;
|
635 |
+
descriptor = {
|
636 |
+
enumerable: true,
|
637 |
+
configurable: true
|
638 |
+
};
|
639 |
+
if (supportsAccessors) {
|
640 |
+
var prototype = object.__proto__;
|
641 |
+
object.__proto__ = prototypeOfObject;
|
642 |
+
|
643 |
+
var getter = lookupGetter(object, property);
|
644 |
+
var setter = lookupSetter(object, property);
|
645 |
+
object.__proto__ = prototype;
|
646 |
+
|
647 |
+
if (getter || setter) {
|
648 |
+
if (getter) descriptor.get = getter;
|
649 |
+
if (setter) descriptor.set = setter;
|
650 |
+
return descriptor;
|
651 |
+
}
|
652 |
+
}
|
653 |
+
descriptor.value = object[property];
|
654 |
+
return descriptor;
|
655 |
+
};
|
656 |
+
}
|
657 |
+
if (!Object.getOwnPropertyNames) {
|
658 |
+
Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
|
659 |
+
return Object.keys(object);
|
660 |
+
};
|
661 |
+
}
|
662 |
+
if (!Object.create) {
|
663 |
+
var createEmpty;
|
664 |
+
if (Object.prototype.__proto__ === null) {
|
665 |
+
createEmpty = function() {
|
666 |
+
return {
|
667 |
+
"__proto__": null
|
668 |
+
};
|
669 |
+
};
|
670 |
+
} else {
|
671 |
+
createEmpty = function() {
|
672 |
+
var empty = {};
|
673 |
+
for (var i in empty)
|
674 |
+
empty[i] = null;
|
675 |
+
empty.constructor =
|
676 |
+
empty.hasOwnProperty =
|
677 |
+
empty.propertyIsEnumerable =
|
678 |
+
empty.isPrototypeOf =
|
679 |
+
empty.toLocaleString =
|
680 |
+
empty.toString =
|
681 |
+
empty.valueOf =
|
682 |
+
empty.__proto__ = null;
|
683 |
+
return empty;
|
684 |
+
}
|
685 |
+
}
|
686 |
+
|
687 |
+
Object.create = function create(prototype, properties) {
|
688 |
+
var object;
|
689 |
+
if (prototype === null) {
|
690 |
+
object = createEmpty();
|
691 |
+
} else {
|
692 |
+
if (typeof prototype != "object")
|
693 |
+
throw new TypeError("typeof prototype[" + (typeof prototype) + "] != 'object'");
|
694 |
+
var Type = function() {};
|
695 |
+
Type.prototype = prototype;
|
696 |
+
object = new Type();
|
697 |
+
object.__proto__ = prototype;
|
698 |
+
}
|
699 |
+
if (properties !== void 0)
|
700 |
+
Object.defineProperties(object, properties);
|
701 |
+
return object;
|
702 |
+
};
|
703 |
+
}
|
704 |
+
|
705 |
+
function doesDefinePropertyWork(object) {
|
706 |
+
try {
|
707 |
+
Object.defineProperty(object, "sentinel", {});
|
708 |
+
return "sentinel" in object;
|
709 |
+
} catch (exception) {}
|
710 |
+
}
|
711 |
+
if (Object.defineProperty) {
|
712 |
+
var definePropertyWorksOnObject = doesDefinePropertyWork({});
|
713 |
+
var definePropertyWorksOnDom = typeof document == "undefined" ||
|
714 |
+
doesDefinePropertyWork(document.createElement("div"));
|
715 |
+
if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
|
716 |
+
var definePropertyFallback = Object.defineProperty;
|
717 |
+
}
|
718 |
+
}
|
719 |
+
|
720 |
+
if (!Object.defineProperty || definePropertyFallback) {
|
721 |
+
var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
|
722 |
+
var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
|
723 |
+
var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
|
724 |
+
"on this javascript engine";
|
725 |
+
|
726 |
+
Object.defineProperty = function defineProperty(object, property, descriptor) {
|
727 |
+
if ((typeof object != "object" && typeof object != "function") || object === null)
|
728 |
+
throw new TypeError(ERR_NON_OBJECT_TARGET + object);
|
729 |
+
if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
|
730 |
+
throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
|
731 |
+
if (definePropertyFallback) {
|
732 |
+
try {
|
733 |
+
return definePropertyFallback.call(Object, object, property, descriptor);
|
734 |
+
} catch (exception) {}
|
735 |
+
}
|
736 |
+
if (owns(descriptor, "value")) {
|
737 |
+
|
738 |
+
if (supportsAccessors && (lookupGetter(object, property) ||
|
739 |
+
lookupSetter(object, property))) {
|
740 |
+
var prototype = object.__proto__;
|
741 |
+
object.__proto__ = prototypeOfObject;
|
742 |
+
delete object[property];
|
743 |
+
object[property] = descriptor.value;
|
744 |
+
object.__proto__ = prototype;
|
745 |
+
} else {
|
746 |
+
object[property] = descriptor.value;
|
747 |
+
}
|
748 |
+
} else {
|
749 |
+
if (!supportsAccessors)
|
750 |
+
throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
|
751 |
+
if (owns(descriptor, "get"))
|
752 |
+
defineGetter(object, property, descriptor.get);
|
753 |
+
if (owns(descriptor, "set"))
|
754 |
+
defineSetter(object, property, descriptor.set);
|
755 |
+
}
|
756 |
+
|
757 |
+
return object;
|
758 |
+
};
|
759 |
+
}
|
760 |
+
if (!Object.defineProperties) {
|
761 |
+
Object.defineProperties = function defineProperties(object, properties) {
|
762 |
+
for (var property in properties) {
|
763 |
+
if (owns(properties, property))
|
764 |
+
Object.defineProperty(object, property, properties[property]);
|
765 |
+
}
|
766 |
+
return object;
|
767 |
+
};
|
768 |
+
}
|
769 |
+
if (!Object.seal) {
|
770 |
+
Object.seal = function seal(object) {
|
771 |
+
return object;
|
772 |
+
};
|
773 |
+
}
|
774 |
+
if (!Object.freeze) {
|
775 |
+
Object.freeze = function freeze(object) {
|
776 |
+
return object;
|
777 |
+
};
|
778 |
+
}
|
779 |
+
try {
|
780 |
+
Object.freeze(function() {});
|
781 |
+
} catch (exception) {
|
782 |
+
Object.freeze = (function freeze(freezeObject) {
|
783 |
+
return function freeze(object) {
|
784 |
+
if (typeof object == "function") {
|
785 |
+
return object;
|
786 |
+
} else {
|
787 |
+
return freezeObject(object);
|
788 |
+
}
|
789 |
+
};
|
790 |
+
})(Object.freeze);
|
791 |
+
}
|
792 |
+
if (!Object.preventExtensions) {
|
793 |
+
Object.preventExtensions = function preventExtensions(object) {
|
794 |
+
return object;
|
795 |
+
};
|
796 |
+
}
|
797 |
+
if (!Object.isSealed) {
|
798 |
+
Object.isSealed = function isSealed(object) {
|
799 |
+
return false;
|
800 |
+
};
|
801 |
+
}
|
802 |
+
if (!Object.isFrozen) {
|
803 |
+
Object.isFrozen = function isFrozen(object) {
|
804 |
+
return false;
|
805 |
+
};
|
806 |
+
}
|
807 |
+
if (!Object.isExtensible) {
|
808 |
+
Object.isExtensible = function isExtensible(object) {
|
809 |
+
if (Object(object) === object) {
|
810 |
+
throw new TypeError(); // TODO message
|
811 |
+
}
|
812 |
+
var name = '';
|
813 |
+
while (owns(object, name)) {
|
814 |
+
name += '?';
|
815 |
+
}
|
816 |
+
object[name] = true;
|
817 |
+
var returnValue = owns(object, name);
|
818 |
+
delete object[name];
|
819 |
+
return returnValue;
|
820 |
+
};
|
821 |
+
}
|
822 |
+
if (!Object.keys) {
|
823 |
+
var hasDontEnumBug = true,
|
824 |
+
dontEnums = [
|
825 |
+
"toString",
|
826 |
+
"toLocaleString",
|
827 |
+
"valueOf",
|
828 |
+
"hasOwnProperty",
|
829 |
+
"isPrototypeOf",
|
830 |
+
"propertyIsEnumerable",
|
831 |
+
"constructor"
|
832 |
+
],
|
833 |
+
dontEnumsLength = dontEnums.length;
|
834 |
+
|
835 |
+
for (var key in {
|
836 |
+
"toString": null
|
837 |
+
}) {
|
838 |
+
hasDontEnumBug = false;
|
839 |
+
}
|
840 |
+
|
841 |
+
Object.keys = function keys(object) {
|
842 |
+
|
843 |
+
if (
|
844 |
+
(typeof object != "object" && typeof object != "function") ||
|
845 |
+
object === null
|
846 |
+
) {
|
847 |
+
throw new TypeError("Object.keys called on a non-object");
|
848 |
+
}
|
849 |
+
|
850 |
+
var keys = [];
|
851 |
+
for (var name in object) {
|
852 |
+
if (owns(object, name)) {
|
853 |
+
keys.push(name);
|
854 |
+
}
|
855 |
+
}
|
856 |
+
|
857 |
+
if (hasDontEnumBug) {
|
858 |
+
for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
|
859 |
+
var dontEnum = dontEnums[i];
|
860 |
+
if (owns(object, dontEnum)) {
|
861 |
+
keys.push(dontEnum);
|
862 |
+
}
|
863 |
+
}
|
864 |
+
}
|
865 |
+
return keys;
|
866 |
+
};
|
867 |
+
|
868 |
+
}
|
869 |
+
if (!Date.now) {
|
870 |
+
Date.now = function now() {
|
871 |
+
return new Date().getTime();
|
872 |
+
};
|
873 |
+
}
|
874 |
+
var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
|
875 |
+
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
|
876 |
+
"\u2029\uFEFF";
|
877 |
+
if (!String.prototype.trim || ws.trim()) {
|
878 |
+
ws = "[" + ws + "]";
|
879 |
+
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
|
880 |
+
trimEndRegexp = new RegExp(ws + ws + "*$");
|
881 |
+
String.prototype.trim = function trim() {
|
882 |
+
return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
|
883 |
+
};
|
884 |
+
}
|
885 |
+
|
886 |
+
function toInteger(n) {
|
887 |
+
n = +n;
|
888 |
+
if (n !== n) { // isNaN
|
889 |
+
n = 0;
|
890 |
+
} else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {
|
891 |
+
n = (n > 0 || -1) * Math.floor(Math.abs(n));
|
892 |
+
}
|
893 |
+
return n;
|
894 |
+
}
|
895 |
+
|
896 |
+
function isPrimitive(input) {
|
897 |
+
var type = typeof input;
|
898 |
+
return (
|
899 |
+
input === null ||
|
900 |
+
type === "undefined" ||
|
901 |
+
type === "boolean" ||
|
902 |
+
type === "number" ||
|
903 |
+
type === "string"
|
904 |
+
);
|
905 |
+
}
|
906 |
+
|
907 |
+
function toPrimitive(input) {
|
908 |
+
var val, valueOf, toString;
|
909 |
+
if (isPrimitive(input)) {
|
910 |
+
return input;
|
911 |
+
}
|
912 |
+
valueOf = input.valueOf;
|
913 |
+
if (typeof valueOf === "function") {
|
914 |
+
val = valueOf.call(input);
|
915 |
+
if (isPrimitive(val)) {
|
916 |
+
return val;
|
917 |
+
}
|
918 |
+
}
|
919 |
+
toString = input.toString;
|
920 |
+
if (typeof toString === "function") {
|
921 |
+
val = toString.call(input);
|
922 |
+
if (isPrimitive(val)) {
|
923 |
+
return val;
|
924 |
+
}
|
925 |
+
}
|
926 |
+
throw new TypeError();
|
927 |
+
}
|
928 |
+
var toObject = function(o) {
|
929 |
+
if (o == null) { // this matches both null and undefined
|
930 |
+
throw new TypeError("can't convert " + o + " to object");
|
931 |
+
}
|
932 |
+
return Object(o);
|
933 |
+
};
|
934 |
+
|
935 |
+
});
|
936 |
+
|
937 |
+
ace.define("ace/lib/fixoldbrowsers", ["require", "exports", "module", "ace/lib/regexp", "ace/lib/es5-shim"], function(require, exports, module) {
|
938 |
+
"use strict";
|
939 |
+
|
940 |
+
require("./regexp");
|
941 |
+
require("./es5-shim");
|
942 |
+
|
943 |
+
});
|
944 |
+
|
945 |
+
ace.define("ace/lib/dom", ["require", "exports", "module"], function(require, exports, module) {
|
946 |
+
"use strict";
|
947 |
+
|
948 |
+
if (typeof document == "undefined")
|
949 |
+
return;
|
950 |
+
|
951 |
+
var XHTML_NS = "http://www.w3.org/1999/xhtml";
|
952 |
+
|
953 |
+
exports.getDocumentHead = function(doc) {
|
954 |
+
if (!doc)
|
955 |
+
doc = document;
|
956 |
+
return doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement;
|
957 |
+
}
|
958 |
+
|
959 |
+
exports.createElement = function(tag, ns) {
|
960 |
+
return document.createElementNS ?
|
961 |
+
document.createElementNS(ns || XHTML_NS, tag) :
|
962 |
+
document.createElement(tag);
|
963 |
+
};
|
964 |
+
|
965 |
+
exports.hasCssClass = function(el, name) {
|
966 |
+
var classes = (el.className || "").split(/\s+/g);
|
967 |
+
return classes.indexOf(name) !== -1;
|
968 |
+
};
|
969 |
+
exports.addCssClass = function(el, name) {
|
970 |
+
if (!exports.hasCssClass(el, name)) {
|
971 |
+
el.className += " " + name;
|
972 |
+
}
|
973 |
+
};
|
974 |
+
exports.removeCssClass = function(el, name) {
|
975 |
+
var classes = el.className.split(/\s+/g);
|
976 |
+
while (true) {
|
977 |
+
var index = classes.indexOf(name);
|
978 |
+
if (index == -1) {
|
979 |
+
break;
|
980 |
+
}
|
981 |
+
classes.splice(index, 1);
|
982 |
+
}
|
983 |
+
el.className = classes.join(" ");
|
984 |
+
};
|
985 |
+
|
986 |
+
exports.toggleCssClass = function(el, name) {
|
987 |
+
var classes = el.className.split(/\s+/g),
|
988 |
+
add = true;
|
989 |
+
while (true) {
|
990 |
+
var index = classes.indexOf(name);
|
991 |
+
if (index == -1) {
|
992 |
+
break;
|
993 |
+
}
|
994 |
+
add = false;
|
995 |
+
classes.splice(index, 1);
|
996 |
+
}
|
997 |
+
if (add)
|
998 |
+
classes.push(name);
|
999 |
+
|
1000 |
+
el.className = classes.join(" ");
|
1001 |
+
return add;
|
1002 |
+
};
|
1003 |
+
exports.setCssClass = function(node, className, include) {
|
1004 |
+
if (include) {
|
1005 |
+
exports.addCssClass(node, className);
|
1006 |
+
} else {
|
1007 |
+
exports.removeCssClass(node, className);
|
1008 |
+
}
|
1009 |
+
};
|
1010 |
+
|
1011 |
+
exports.hasCssString = function(id, doc) {
|
1012 |
+
var index = 0,
|
1013 |
+
sheets;
|
1014 |
+
doc = doc || document;
|
1015 |
+
|
1016 |
+
if (doc.createStyleSheet && (sheets = doc.styleSheets)) {
|
1017 |
+
while (index < sheets.length)
|
1018 |
+
if (sheets[index++].owningElement.id === id) return true;
|
1019 |
+
} else if ((sheets = doc.getElementsByTagName("style"))) {
|
1020 |
+
while (index < sheets.length)
|
1021 |
+
if (sheets[index++].id === id) return true;
|
1022 |
+
}
|
1023 |
+
|
1024 |
+
return false;
|
1025 |
+
};
|
1026 |
+
|
1027 |
+
exports.importCssString = function importCssString(cssText, id, doc) {
|
1028 |
+
doc = doc || document;
|
1029 |
+
if (id && exports.hasCssString(id, doc))
|
1030 |
+
return null;
|
1031 |
+
|
1032 |
+
var style;
|
1033 |
+
|
1034 |
+
if (doc.createStyleSheet) {
|
1035 |
+
style = doc.createStyleSheet();
|
1036 |
+
style.cssText = cssText;
|
1037 |
+
if (id)
|
1038 |
+
style.owningElement.id = id;
|
1039 |
+
} else {
|
1040 |
+
style = doc.createElementNS ? doc.createElementNS(XHTML_NS, "style") : doc.createElement("style");
|
1041 |
+
|
1042 |
+
style.appendChild(doc.createTextNode(cssText));
|
1043 |
+
if (id)
|
1044 |
+
style.id = id;
|
1045 |
+
|
1046 |
+
exports.getDocumentHead(doc).appendChild(style);
|
1047 |
+
}
|
1048 |
+
};
|
1049 |
+
|
1050 |
+
exports.importCssStylsheet = function(uri, doc) {
|
1051 |
+
if (doc.createStyleSheet) {
|
1052 |
+
doc.createStyleSheet(uri);
|
1053 |
+
} else {
|
1054 |
+
var link = exports.createElement('link');
|
1055 |
+
link.rel = 'stylesheet';
|
1056 |
+
link.href = uri;
|
1057 |
+
|
1058 |
+
exports.getDocumentHead(doc).appendChild(link);
|
1059 |
+
}
|
1060 |
+
};
|
1061 |
+
|
1062 |
+
exports.getInnerWidth = function(element) {
|
1063 |
+
return (
|
1064 |
+
parseInt(exports.computedStyle(element, "paddingLeft"), 10) +
|
1065 |
+
parseInt(exports.computedStyle(element, "paddingRight"), 10) +
|
1066 |
+
element.clientWidth
|
1067 |
+
);
|
1068 |
+
};
|
1069 |
+
|
1070 |
+
exports.getInnerHeight = function(element) {
|
1071 |
+
return (
|
1072 |
+
parseInt(exports.computedStyle(element, "paddingTop"), 10) +
|
1073 |
+
parseInt(exports.computedStyle(element, "paddingBottom"), 10) +
|
1074 |
+
element.clientHeight
|
1075 |
+
);
|
1076 |
+
};
|
1077 |
+
|
1078 |
+
if (window.pageYOffset !== undefined) {
|
1079 |
+
exports.getPageScrollTop = function() {
|
1080 |
+
return window.pageYOffset;
|
1081 |
+
};
|
1082 |
+
|
1083 |
+
exports.getPageScrollLeft = function() {
|
1084 |
+
return window.pageXOffset;
|
1085 |
+
};
|
1086 |
+
} else {
|
1087 |
+
exports.getPageScrollTop = function() {
|
1088 |
+
return document.body.scrollTop;
|
1089 |
+
};
|
1090 |
+
|
1091 |
+
exports.getPageScrollLeft = function() {
|
1092 |
+
return document.body.scrollLeft;
|
1093 |
+
};
|
1094 |
+
}
|
1095 |
+
|
1096 |
+
if (window.getComputedStyle)
|
1097 |
+
exports.computedStyle = function(element, style) {
|
1098 |
+
if (style)
|
1099 |
+
return (window.getComputedStyle(element, "") || {})[style] || "";
|
1100 |
+
return window.getComputedStyle(element, "") || {};
|
1101 |
+
};
|
1102 |
+
else
|
1103 |
+
exports.computedStyle = function(element, style) {
|
1104 |
+
if (style)
|
1105 |
+
return element.currentStyle[style];
|
1106 |
+
return element.currentStyle;
|
1107 |
+
};
|
1108 |
+
|
1109 |
+
exports.scrollbarWidth = function(document) {
|
1110 |
+
var inner = exports.createElement("ace_inner");
|
1111 |
+
inner.style.width = "100%";
|
1112 |
+
inner.style.minWidth = "0px";
|
1113 |
+
inner.style.height = "200px";
|
1114 |
+
inner.style.display = "block";
|
1115 |
+
|
1116 |
+
var outer = exports.createElement("ace_outer");
|
1117 |
+
var style = outer.style;
|
1118 |
+
|
1119 |
+
style.position = "absolute";
|
1120 |
+
style.left = "-10000px";
|
1121 |
+
style.overflow = "hidden";
|
1122 |
+
style.width = "200px";
|
1123 |
+
style.minWidth = "0px";
|
1124 |
+
style.height = "150px";
|
1125 |
+
style.display = "block";
|
1126 |
+
|
1127 |
+
outer.appendChild(inner);
|
1128 |
+
|
1129 |
+
var body = document.documentElement;
|
1130 |
+
body.appendChild(outer);
|
1131 |
+
|
1132 |
+
var noScrollbar = inner.offsetWidth;
|
1133 |
+
|
1134 |
+
style.overflow = "scroll";
|
1135 |
+
var withScrollbar = inner.offsetWidth;
|
1136 |
+
|
1137 |
+
if (noScrollbar == withScrollbar) {
|
1138 |
+
withScrollbar = outer.clientWidth;
|
1139 |
+
}
|
1140 |
+
|
1141 |
+
body.removeChild(outer);
|
1142 |
+
|
1143 |
+
return noScrollbar - withScrollbar;
|
1144 |
+
};
|
1145 |
+
exports.setInnerHtml = function(el, innerHtml) {
|
1146 |
+
var element = el.cloneNode(false); //document.createElement("div");
|
1147 |
+
element.innerHTML = innerHtml;
|
1148 |
+
el.parentNode.replaceChild(element, el);
|
1149 |
+
return element;
|
1150 |
+
};
|
1151 |
+
|
1152 |
+
if ("textContent" in document.documentElement) {
|
1153 |
+
exports.setInnerText = function(el, innerText) {
|
1154 |
+
el.textContent = innerText;
|
1155 |
+
};
|
1156 |
+
|
1157 |
+
exports.getInnerText = function(el) {
|
1158 |
+
return el.textContent;
|
1159 |
+
};
|
1160 |
+
} else {
|
1161 |
+
exports.setInnerText = function(el, innerText) {
|
1162 |
+
el.innerText = innerText;
|
1163 |
+
};
|
1164 |
+
|
1165 |
+
exports.getInnerText = function(el) {
|
1166 |
+
return el.innerText;
|
1167 |
+
};
|
1168 |
+
}
|
1169 |
+
|
1170 |
+
exports.getParentWindow = function(document) {
|
1171 |
+
return document.defaultView || document.parentWindow;
|
1172 |
+
};
|
1173 |
+
|
1174 |
+
});
|
1175 |
+
|
1176 |
+
ace.define("ace/lib/oop", ["require", "exports", "module"], function(require, exports, module) {
|
1177 |
+
"use strict";
|
1178 |
+
|
1179 |
+
exports.inherits = function(ctor, superCtor) {
|
1180 |
+
ctor.super_ = superCtor;
|
1181 |
+
ctor.prototype = Object.create(superCtor.prototype, {
|
1182 |
+
constructor: {
|
1183 |
+
value: ctor,
|
1184 |
+
enumerable: false,
|
1185 |
+
writable: true,
|
1186 |
+
configurable: true
|
1187 |
+
}
|
1188 |
+
});
|
1189 |
+
};
|
1190 |
+
|
1191 |
+
exports.mixin = function(obj, mixin) {
|
1192 |
+
for (var key in mixin) {
|
1193 |
+
obj[key] = mixin[key];
|
1194 |
+
}
|
1195 |
+
return obj;
|
1196 |
+
};
|
1197 |
+
|
1198 |
+
exports.implement = function(proto, mixin) {
|
1199 |
+
exports.mixin(proto, mixin);
|
1200 |
+
};
|
1201 |
+
|
1202 |
+
});
|
1203 |
+
|
1204 |
+
ace.define("ace/lib/keys", ["require", "exports", "module", "ace/lib/fixoldbrowsers", "ace/lib/oop"], function(require, exports, module) {
|
1205 |
+
"use strict";
|
1206 |
+
|
1207 |
+
require("./fixoldbrowsers");
|
1208 |
+
|
1209 |
+
var oop = require("./oop");
|
1210 |
+
var Keys = (function() {
|
1211 |
+
var ret = {
|
1212 |
+
MODIFIER_KEYS: {
|
1213 |
+
16: 'Shift',
|
1214 |
+
17: 'Ctrl',
|
1215 |
+
18: 'Alt',
|
1216 |
+
224: 'Meta'
|
1217 |
+
},
|
1218 |
+
|
1219 |
+
KEY_MODS: {
|
1220 |
+
"ctrl": 1,
|
1221 |
+
"alt": 2,
|
1222 |
+
"option": 2,
|
1223 |
+
"shift": 4,
|
1224 |
+
"super": 8,
|
1225 |
+
"meta": 8,
|
1226 |
+
"command": 8,
|
1227 |
+
"cmd": 8
|
1228 |
+
},
|
1229 |
+
|
1230 |
+
FUNCTION_KEYS: {
|
1231 |
+
8: "Backspace",
|
1232 |
+
9: "Tab",
|
1233 |
+
13: "Return",
|
1234 |
+
19: "Pause",
|
1235 |
+
27: "Esc",
|
1236 |
+
32: "Space",
|
1237 |
+
33: "PageUp",
|
1238 |
+
34: "PageDown",
|
1239 |
+
35: "End",
|
1240 |
+
36: "Home",
|
1241 |
+
37: "Left",
|
1242 |
+
38: "Up",
|
1243 |
+
39: "Right",
|
1244 |
+
40: "Down",
|
1245 |
+
44: "Print",
|
1246 |
+
45: "Insert",
|
1247 |
+
46: "Delete",
|
1248 |
+
96: "Numpad0",
|
1249 |
+
97: "Numpad1",
|
1250 |
+
98: "Numpad2",
|
1251 |
+
99: "Numpad3",
|
1252 |
+
100: "Numpad4",
|
1253 |
+
101: "Numpad5",
|
1254 |
+
102: "Numpad6",
|
1255 |
+
103: "Numpad7",
|
1256 |
+
104: "Numpad8",
|
1257 |
+
105: "Numpad9",
|
1258 |
+
'-13': "NumpadEnter",
|
1259 |
+
112: "F1",
|
1260 |
+
113: "F2",
|
1261 |
+
114: "F3",
|
1262 |
+
115: "F4",
|
1263 |
+
116: "F5",
|
1264 |
+
117: "F6",
|
1265 |
+
118: "F7",
|
1266 |
+
119: "F8",
|
1267 |
+
120: "F9",
|
1268 |
+
121: "F10",
|
1269 |
+
122: "F11",
|
1270 |
+
123: "F12",
|
1271 |
+
144: "Numlock",
|
1272 |
+
145: "Scrolllock"
|
1273 |
+
},
|
1274 |
+
|
1275 |
+
PRINTABLE_KEYS: {
|
1276 |
+
32: ' ',
|
1277 |
+
48: '0',
|
1278 |
+
49: '1',
|
1279 |
+
50: '2',
|
1280 |
+
51: '3',
|
1281 |
+
52: '4',
|
1282 |
+
53: '5',
|
1283 |
+
54: '6',
|
1284 |
+
55: '7',
|
1285 |
+
56: '8',
|
1286 |
+
57: '9',
|
1287 |
+
59: ';',
|
1288 |
+
61: '=',
|
1289 |
+
65: 'a',
|
1290 |
+
66: 'b',
|
1291 |
+
67: 'c',
|
1292 |
+
68: 'd',
|
1293 |
+
69: 'e',
|
1294 |
+
70: 'f',
|
1295 |
+
71: 'g',
|
1296 |
+
72: 'h',
|
1297 |
+
73: 'i',
|
1298 |
+
74: 'j',
|
1299 |
+
75: 'k',
|
1300 |
+
76: 'l',
|
1301 |
+
77: 'm',
|
1302 |
+
78: 'n',
|
1303 |
+
79: 'o',
|
1304 |
+
80: 'p',
|
1305 |
+
81: 'q',
|
1306 |
+
82: 'r',
|
1307 |
+
83: 's',
|
1308 |
+
84: 't',
|
1309 |
+
85: 'u',
|
1310 |
+
86: 'v',
|
1311 |
+
87: 'w',
|
1312 |
+
88: 'x',
|
1313 |
+
89: 'y',
|
1314 |
+
90: 'z',
|
1315 |
+
107: '+',
|
1316 |
+
109: '-',
|
1317 |
+
110: '.',
|
1318 |
+
187: '=',
|
1319 |
+
188: ',',
|
1320 |
+
189: '-',
|
1321 |
+
190: '.',
|
1322 |
+
191: '/',
|
1323 |
+
192: '`',
|
1324 |
+
219: '[',
|
1325 |
+
220: '\\',
|
1326 |
+
221: ']',
|
1327 |
+
222: '\''
|
1328 |
+
}
|
1329 |
+
};
|
1330 |
+
var name, i;
|
1331 |
+
for (i in ret.FUNCTION_KEYS) {
|
1332 |
+
name = ret.FUNCTION_KEYS[i].toLowerCase();
|
1333 |
+
ret[name] = parseInt(i, 10);
|
1334 |
+
}
|
1335 |
+
for (i in ret.PRINTABLE_KEYS) {
|
1336 |
+
name = ret.PRINTABLE_KEYS[i].toLowerCase();
|
1337 |
+
ret[name] = parseInt(i, 10);
|
1338 |
+
}
|
1339 |
+
oop.mixin(ret, ret.MODIFIER_KEYS);
|
1340 |
+
oop.mixin(ret, ret.PRINTABLE_KEYS);
|
1341 |
+
oop.mixin(ret, ret.FUNCTION_KEYS);
|
1342 |
+
ret.enter = ret["return"];
|
1343 |
+
ret.escape = ret.esc;
|
1344 |
+
ret.del = ret["delete"];
|
1345 |
+
ret[173] = '-';
|
1346 |
+
|
1347 |
+
(function() {
|
1348 |
+
var mods = ["cmd", "ctrl", "alt", "shift"];
|
1349 |
+
for (var i = Math.pow(2, mods.length); i--;) {
|
1350 |
+
ret.KEY_MODS[i] = mods.filter(function(x) {
|
1351 |
+
return i & ret.KEY_MODS[x];
|
1352 |
+
}).join("-") + "-";
|
1353 |
+
}
|
1354 |
+
})();
|
1355 |
+
|
1356 |
+
ret.KEY_MODS[0] = "";
|
1357 |
+
ret.KEY_MODS[-1] = "input";
|
1358 |
+
|
1359 |
+
return ret;
|
1360 |
+
})();
|
1361 |
+
oop.mixin(exports, Keys);
|
1362 |
+
|
1363 |
+
exports.keyCodeToString = function(keyCode) {
|
1364 |
+
var keyString = Keys[keyCode];
|
1365 |
+
if (typeof keyString != "string")
|
1366 |
+
keyString = String.fromCharCode(keyCode);
|
1367 |
+
return keyString.toLowerCase();
|
1368 |
+
};
|
1369 |
+
|
1370 |
+
});
|
1371 |
+
|
1372 |
+
ace.define("ace/lib/useragent", ["require", "exports", "module"], function(require, exports, module) {
|
1373 |
+
"use strict";
|
1374 |
+
exports.OS = {
|
1375 |
+
LINUX: "LINUX",
|
1376 |
+
MAC: "MAC",
|
1377 |
+
WINDOWS: "WINDOWS"
|
1378 |
+
};
|
1379 |
+
exports.getOS = function() {
|
1380 |
+
if (exports.isMac) {
|
1381 |
+
return exports.OS.MAC;
|
1382 |
+
} else if (exports.isLinux) {
|
1383 |
+
return exports.OS.LINUX;
|
1384 |
+
} else {
|
1385 |
+
return exports.OS.WINDOWS;
|
1386 |
+
}
|
1387 |
+
};
|
1388 |
+
if (typeof navigator != "object")
|
1389 |
+
return;
|
1390 |
+
|
1391 |
+
var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
|
1392 |
+
var ua = navigator.userAgent;
|
1393 |
+
exports.isWin = (os == "win");
|
1394 |
+
exports.isMac = (os == "mac");
|
1395 |
+
exports.isLinux = (os == "linux");
|
1396 |
+
exports.isIE =
|
1397 |
+
(navigator.appName == "Microsoft Internet Explorer" || navigator.appName.indexOf("MSAppHost") >= 0) ? parseFloat((ua.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/) || [])[1]) : parseFloat((ua.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/) || [])[1]); // for ie
|
1398 |
+
|
1399 |
+
exports.isOldIE = exports.isIE && exports.isIE < 9;
|
1400 |
+
exports.isGecko = exports.isMozilla = (window.Controllers || window.controllers) && window.navigator.product === "Gecko";
|
1401 |
+
exports.isOldGecko = exports.isGecko && parseInt((ua.match(/rv\:(\d+)/) || [])[1], 10) < 4;
|
1402 |
+
exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]";
|
1403 |
+
exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined;
|
1404 |
+
|
1405 |
+
exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined;
|
1406 |
+
|
1407 |
+
exports.isAIR = ua.indexOf("AdobeAIR") >= 0;
|
1408 |
+
|
1409 |
+
exports.isIPad = ua.indexOf("iPad") >= 0;
|
1410 |
+
|
1411 |
+
exports.isTouchPad = ua.indexOf("TouchPad") >= 0;
|
1412 |
+
|
1413 |
+
exports.isChromeOS = ua.indexOf(" CrOS ") >= 0;
|
1414 |
+
|
1415 |
+
});
|
1416 |
+
|
1417 |
+
ace.define("ace/lib/event", ["require", "exports", "module", "ace/lib/keys", "ace/lib/useragent"], function(require, exports, module) {
|
1418 |
+
"use strict";
|
1419 |
+
|
1420 |
+
var keys = require("./keys");
|
1421 |
+
var useragent = require("./useragent");
|
1422 |
+
|
1423 |
+
exports.addListener = function(elem, type, callback) {
|
1424 |
+
if (elem.addEventListener) {
|
1425 |
+
return elem.addEventListener(type, callback, false);
|
1426 |
+
}
|
1427 |
+
if (elem.attachEvent) {
|
1428 |
+
var wrapper = function() {
|
1429 |
+
callback.call(elem, window.event);
|
1430 |
+
};
|
1431 |
+
callback._wrapper = wrapper;
|
1432 |
+
elem.attachEvent("on" + type, wrapper);
|
1433 |
+
}
|
1434 |
+
};
|
1435 |
+
|
1436 |
+
exports.removeListener = function(elem, type, callback) {
|
1437 |
+
if (elem.removeEventListener) {
|
1438 |
+
return elem.removeEventListener(type, callback, false);
|
1439 |
+
}
|
1440 |
+
if (elem.detachEvent) {
|
1441 |
+
elem.detachEvent("on" + type, callback._wrapper || callback);
|
1442 |
+
}
|
1443 |
+
};
|
1444 |
+
exports.stopEvent = function(e) {
|
1445 |
+
exports.stopPropagation(e);
|
1446 |
+
exports.preventDefault(e);
|
1447 |
+
return false;
|
1448 |
+
};
|
1449 |
+
|
1450 |
+
exports.stopPropagation = function(e) {
|
1451 |
+
if (e.stopPropagation)
|
1452 |
+
e.stopPropagation();
|
1453 |
+
else
|
1454 |
+
e.cancelBubble = true;
|
1455 |
+
};
|
1456 |
+
|
1457 |
+
exports.preventDefault = function(e) {
|
1458 |
+
if (e.preventDefault)
|
1459 |
+
e.preventDefault();
|
1460 |
+
else
|
1461 |
+
e.returnValue = false;
|
1462 |
+
};
|
1463 |
+
exports.getButton = function(e) {
|
1464 |
+
if (e.type == "dblclick")
|
1465 |
+
return 0;
|
1466 |
+
if (e.type == "contextmenu" || (useragent.isMac && (e.ctrlKey && !e.altKey && !e.shiftKey)))
|
1467 |
+
return 2;
|
1468 |
+
if (e.preventDefault) {
|
1469 |
+
return e.button;
|
1470 |
+
} else {
|
1471 |
+
return {
|
1472 |
+
1: 0,
|
1473 |
+
2: 2,
|
1474 |
+
4: 1
|
1475 |
+
}[e.button];
|
1476 |
+
}
|
1477 |
+
};
|
1478 |
+
|
1479 |
+
exports.capture = function(el, eventHandler, releaseCaptureHandler) {
|
1480 |
+
function onMouseUp(e) {
|
1481 |
+
eventHandler && eventHandler(e);
|
1482 |
+
releaseCaptureHandler && releaseCaptureHandler(e);
|
1483 |
+
|
1484 |
+
exports.removeListener(document, "mousemove", eventHandler, true);
|
1485 |
+
exports.removeListener(document, "mouseup", onMouseUp, true);
|
1486 |
+
exports.removeListener(document, "dragstart", onMouseUp, true);
|
1487 |
+
}
|
1488 |
+
|
1489 |
+
exports.addListener(document, "mousemove", eventHandler, true);
|
1490 |
+
exports.addListener(document, "mouseup", onMouseUp, true);
|
1491 |
+
exports.addListener(document, "dragstart", onMouseUp, true);
|
1492 |
+
|
1493 |
+
return onMouseUp;
|
1494 |
+
};
|
1495 |
+
|
1496 |
+
exports.addMouseWheelListener = function(el, callback) {
|
1497 |
+
if ("onmousewheel" in el) {
|
1498 |
+
exports.addListener(el, "mousewheel", function(e) {
|
1499 |
+
var factor = 8;
|
1500 |
+
if (e.wheelDeltaX !== undefined) {
|
1501 |
+
e.wheelX = -e.wheelDeltaX / factor;
|
1502 |
+
e.wheelY = -e.wheelDeltaY / factor;
|
1503 |
+
} else {
|
1504 |
+
e.wheelX = 0;
|
1505 |
+
e.wheelY = -e.wheelDelta / factor;
|
1506 |
+
}
|
1507 |
+
callback(e);
|
1508 |
+
});
|
1509 |
+
} else if ("onwheel" in el) {
|
1510 |
+
exports.addListener(el, "wheel", function(e) {
|
1511 |
+
var factor = 0.35;
|
1512 |
+
switch (e.deltaMode) {
|
1513 |
+
case e.DOM_DELTA_PIXEL:
|
1514 |
+
e.wheelX = e.deltaX * factor || 0;
|
1515 |
+
e.wheelY = e.deltaY * factor || 0;
|
1516 |
+
break;
|
1517 |
+
case e.DOM_DELTA_LINE:
|
1518 |
+
case e.DOM_DELTA_PAGE:
|
1519 |
+
e.wheelX = (e.deltaX || 0) * 5;
|
1520 |
+
e.wheelY = (e.deltaY || 0) * 5;
|
1521 |
+
break;
|
1522 |
+
}
|
1523 |
+
|
1524 |
+
callback(e);
|
1525 |
+
});
|
1526 |
+
} else {
|
1527 |
+
exports.addListener(el, "DOMMouseScroll", function(e) {
|
1528 |
+
if (e.axis && e.axis == e.HORIZONTAL_AXIS) {
|
1529 |
+
e.wheelX = (e.detail || 0) * 5;
|
1530 |
+
e.wheelY = 0;
|
1531 |
+
} else {
|
1532 |
+
e.wheelX = 0;
|
1533 |
+
e.wheelY = (e.detail || 0) * 5;
|
1534 |
+
}
|
1535 |
+
callback(e);
|
1536 |
+
});
|
1537 |
+
}
|
1538 |
+
};
|
1539 |
+
|
1540 |
+
exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbackName) {
|
1541 |
+
var clicks = 0;
|
1542 |
+
var startX, startY, timer;
|
1543 |
+
var eventNames = {
|
1544 |
+
2: "dblclick",
|
1545 |
+
3: "tripleclick",
|
1546 |
+
4: "quadclick"
|
1547 |
+
};
|
1548 |
+
|
1549 |
+
exports.addListener(el, "mousedown", function(e) {
|
1550 |
+
if (exports.getButton(e) !== 0) {
|
1551 |
+
clicks = 0;
|
1552 |
+
} else if (e.detail > 1) {
|
1553 |
+
clicks++;
|
1554 |
+
if (clicks > 4)
|
1555 |
+
clicks = 1;
|
1556 |
+
} else {
|
1557 |
+
clicks = 1;
|
1558 |
+
}
|
1559 |
+
if (useragent.isIE) {
|
1560 |
+
var isNewClick = Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5;
|
1561 |
+
if (!timer || isNewClick)
|
1562 |
+
clicks = 1;
|
1563 |
+
if (timer)
|
1564 |
+
clearTimeout(timer);
|
1565 |
+
timer = setTimeout(function() {
|
1566 |
+
timer = null
|
1567 |
+
}, timeouts[clicks - 1] || 600);
|
1568 |
+
|
1569 |
+
if (clicks == 1) {
|
1570 |
+
startX = e.clientX;
|
1571 |
+
startY = e.clientY;
|
1572 |
+
}
|
1573 |
+
}
|
1574 |
+
|
1575 |
+
e._clicks = clicks;
|
1576 |
+
|
1577 |
+
eventHandler[callbackName]("mousedown", e);
|
1578 |
+
|
1579 |
+
if (clicks > 4)
|
1580 |
+
clicks = 0;
|
1581 |
+
else if (clicks > 1)
|
1582 |
+
return eventHandler[callbackName](eventNames[clicks], e);
|
1583 |
+
});
|
1584 |
+
|
1585 |
+
if (useragent.isOldIE) {
|
1586 |
+
exports.addListener(el, "dblclick", function(e) {
|
1587 |
+
clicks = 2;
|
1588 |
+
if (timer)
|
1589 |
+
clearTimeout(timer);
|
1590 |
+
timer = setTimeout(function() {
|
1591 |
+
timer = null
|
1592 |
+
}, timeouts[clicks - 1] || 600);
|
1593 |
+
eventHandler[callbackName]("mousedown", e);
|
1594 |
+
eventHandler[callbackName](eventNames[clicks], e);
|
1595 |
+
});
|
1596 |
+
}
|
1597 |
+
};
|
1598 |
+
|
1599 |
+
var getModifierHash = useragent.isMac && useragent.isOpera && !("KeyboardEvent" in window) ? function(e) {
|
1600 |
+
return 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
|
1601 |
+
} : function(e) {
|
1602 |
+
return 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
|
1603 |
+
};
|
1604 |
+
|
1605 |
+
exports.getModifierString = function(e) {
|
1606 |
+
return keys.KEY_MODS[getModifierHash(e)];
|
1607 |
+
};
|
1608 |
+
|
1609 |
+
function normalizeCommandKeys(callback, e, keyCode) {
|
1610 |
+
var hashId = getModifierHash(e);
|
1611 |
+
|
1612 |
+
if (!useragent.isMac && pressedKeys) {
|
1613 |
+
if (pressedKeys[91] || pressedKeys[92])
|
1614 |
+
hashId |= 8;
|
1615 |
+
if (pressedKeys.altGr) {
|
1616 |
+
if ((3 & hashId) != 3)
|
1617 |
+
pressedKeys.altGr = 0;
|
1618 |
+
else
|
1619 |
+
return;
|
1620 |
+
}
|
1621 |
+
if (keyCode === 18 || keyCode === 17) {
|
1622 |
+
var location = "location" in e ? e.location : e.keyLocation;
|
1623 |
+
if (keyCode === 17 && location === 1) {
|
1624 |
+
ts = e.timeStamp;
|
1625 |
+
} else if (keyCode === 18 && hashId === 3 && location === 2) {
|
1626 |
+
var dt = -ts;
|
1627 |
+
ts = e.timeStamp;
|
1628 |
+
dt += ts;
|
1629 |
+
if (dt < 3)
|
1630 |
+
pressedKeys.altGr = true;
|
1631 |
+
}
|
1632 |
+
}
|
1633 |
+
}
|
1634 |
+
|
1635 |
+
if (keyCode in keys.MODIFIER_KEYS) {
|
1636 |
+
switch (keys.MODIFIER_KEYS[keyCode]) {
|
1637 |
+
case "Alt":
|
1638 |
+
hashId = 2;
|
1639 |
+
break;
|
1640 |
+
case "Shift":
|
1641 |
+
hashId = 4;
|
1642 |
+
break;
|
1643 |
+
case "Ctrl":
|
1644 |
+
hashId = 1;
|
1645 |
+
break;
|
1646 |
+
default:
|
1647 |
+
hashId = 8;
|
1648 |
+
break;
|
1649 |
+
}
|
1650 |
+
keyCode = -1;
|
1651 |
+
}
|
1652 |
+
|
1653 |
+
if (hashId & 8 && (keyCode === 91 || keyCode === 93)) {
|
1654 |
+
keyCode = -1;
|
1655 |
+
}
|
1656 |
+
|
1657 |
+
if (!hashId && keyCode === 13) {
|
1658 |
+
var location = "location" in e ? e.location : e.keyLocation;
|
1659 |
+
if (location === 3) {
|
1660 |
+
callback(e, hashId, -keyCode);
|
1661 |
+
if (e.defaultPrevented)
|
1662 |
+
return;
|
1663 |
+
}
|
1664 |
+
}
|
1665 |
+
|
1666 |
+
if (useragent.isChromeOS && hashId & 8) {
|
1667 |
+
callback(e, hashId, keyCode);
|
1668 |
+
if (e.defaultPrevented)
|
1669 |
+
return;
|
1670 |
+
else
|
1671 |
+
hashId &= ~8;
|
1672 |
+
}
|
1673 |
+
if (!hashId && !(keyCode in keys.FUNCTION_KEYS) && !(keyCode in keys.PRINTABLE_KEYS)) {
|
1674 |
+
return false;
|
1675 |
+
}
|
1676 |
+
|
1677 |
+
return callback(e, hashId, keyCode);
|
1678 |
+
}
|
1679 |
+
|
1680 |
+
var pressedKeys = null;
|
1681 |
+
var ts = 0;
|
1682 |
+
exports.addCommandKeyListener = function(el, callback) {
|
1683 |
+
var addListener = exports.addListener;
|
1684 |
+
if (useragent.isOldGecko || (useragent.isOpera && !("KeyboardEvent" in window))) {
|
1685 |
+
var lastKeyDownKeyCode = null;
|
1686 |
+
addListener(el, "keydown", function(e) {
|
1687 |
+
lastKeyDownKeyCode = e.keyCode;
|
1688 |
+
});
|
1689 |
+
addListener(el, "keypress", function(e) {
|
1690 |
+
return normalizeCommandKeys(callback, e, lastKeyDownKeyCode);
|
1691 |
+
});
|
1692 |
+
} else {
|
1693 |
+
var lastDefaultPrevented = null;
|
1694 |
+
|
1695 |
+
addListener(el, "keydown", function(e) {
|
1696 |
+
pressedKeys[e.keyCode] = true;
|
1697 |
+
var result = normalizeCommandKeys(callback, e, e.keyCode);
|
1698 |
+
lastDefaultPrevented = e.defaultPrevented;
|
1699 |
+
return result;
|
1700 |
+
});
|
1701 |
+
|
1702 |
+
addListener(el, "keypress", function(e) {
|
1703 |
+
if (lastDefaultPrevented && (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey)) {
|
1704 |
+
exports.stopEvent(e);
|
1705 |
+
lastDefaultPrevented = null;
|
1706 |
+
}
|
1707 |
+
});
|
1708 |
+
|
1709 |
+
addListener(el, "keyup", function(e) {
|
1710 |
+
pressedKeys[e.keyCode] = null;
|
1711 |
+
});
|
1712 |
+
|
1713 |
+
if (!pressedKeys) {
|
1714 |
+
pressedKeys = Object.create(null);
|
1715 |
+
addListener(window, "focus", function(e) {
|
1716 |
+
pressedKeys = Object.create(null);
|
1717 |
+
});
|
1718 |
+
}
|
1719 |
+
}
|
1720 |
+
};
|
1721 |
+
|
1722 |
+
if (window.postMessage && !useragent.isOldIE) {
|
1723 |
+
var postMessageId = 1;
|
1724 |
+
exports.nextTick = function(callback, win) {
|
1725 |
+
win = win || window;
|
1726 |
+
var messageName = "zero-timeout-message-" + postMessageId;
|
1727 |
+
exports.addListener(win, "message", function listener(e) {
|
1728 |
+
if (e.data == messageName) {
|
1729 |
+
exports.stopPropagation(e);
|
1730 |
+
exports.removeListener(win, "message", listener);
|
1731 |
+
callback();
|
1732 |
+
}
|
1733 |
+
});
|
1734 |
+
win.postMessage(messageName, "*");
|
1735 |
+
};
|
1736 |
+
}
|
1737 |
+
|
1738 |
+
|
1739 |
+
exports.nextFrame = window.requestAnimationFrame ||
|
1740 |
+
window.mozRequestAnimationFrame ||
|
1741 |
+
window.webkitRequestAnimationFrame ||
|
1742 |
+
window.msRequestAnimationFrame ||
|
1743 |
+
window.oRequestAnimationFrame;
|
1744 |
+
|
1745 |
+
if (exports.nextFrame)
|
1746 |
+
exports.nextFrame = exports.nextFrame.bind(window);
|
1747 |
+
else
|
1748 |
+
exports.nextFrame = function(callback) {
|
1749 |
+
setTimeout(callback, 17);
|
1750 |
+
};
|
1751 |
+
});
|
1752 |
+
|
1753 |
+
ace.define("ace/lib/lang", ["require", "exports", "module"], function(require, exports, module) {
|
1754 |
+
"use strict";
|
1755 |
+
|
1756 |
+
exports.last = function(a) {
|
1757 |
+
return a[a.length - 1];
|
1758 |
+
};
|
1759 |
+
|
1760 |
+
exports.stringReverse = function(string) {
|
1761 |
+
return string.split("").reverse().join("");
|
1762 |
+
};
|
1763 |
+
|
1764 |
+
exports.stringRepeat = function(string, count) {
|
1765 |
+
var result = '';
|
1766 |
+
while (count > 0) {
|
1767 |
+
if (count & 1)
|
1768 |
+
result += string;
|
1769 |
+
|
1770 |
+
if (count >>= 1)
|
1771 |
+
string += string;
|
1772 |
+
}
|
1773 |
+
return result;
|
1774 |
+
};
|
1775 |
+
|
1776 |
+
var trimBeginRegexp = /^\s\s*/;
|
1777 |
+
var trimEndRegexp = /\s\s*$/;
|
1778 |
+
|
1779 |
+
exports.stringTrimLeft = function(string) {
|
1780 |
+
return string.replace(trimBeginRegexp, '');
|
1781 |
+
};
|
1782 |
+
|
1783 |
+
exports.stringTrimRight = function(string) {
|
1784 |
+
return string.replace(trimEndRegexp, '');
|
1785 |
+
};
|
1786 |
+
|
1787 |
+
exports.copyObject = function(obj) {
|
1788 |
+
var copy = {};
|
1789 |
+
for (var key in obj) {
|
1790 |
+
copy[key] = obj[key];
|
1791 |
+
}
|
1792 |
+
return copy;
|
1793 |
+
};
|
1794 |
+
|
1795 |
+
exports.copyArray = function(array) {
|
1796 |
+
var copy = [];
|
1797 |
+
for (var i = 0, l = array.length; i < l; i++) {
|
1798 |
+
if (array[i] && typeof array[i] == "object")
|
1799 |
+
copy[i] = this.copyObject(array[i]);
|
1800 |
+
else
|
1801 |
+
copy[i] = array[i];
|
1802 |
+
}
|
1803 |
+
return copy;
|
1804 |
+
};
|
1805 |
+
|
1806 |
+
exports.deepCopy = function(obj) {
|
1807 |
+
if (typeof obj !== "object" || !obj)
|
1808 |
+
return obj;
|
1809 |
+
var cons = obj.constructor;
|
1810 |
+
if (cons === RegExp)
|
1811 |
+
return obj;
|
1812 |
+
|
1813 |
+
var copy = cons();
|
1814 |
+
for (var key in obj) {
|
1815 |
+
if (typeof obj[key] === "object") {
|
1816 |
+
copy[key] = exports.deepCopy(obj[key]);
|
1817 |
+
} else {
|
1818 |
+
copy[key] = obj[key];
|
1819 |
+
}
|
1820 |
+
}
|
1821 |
+
return copy;
|
1822 |
+
};
|
1823 |
+
|
1824 |
+
exports.arrayToMap = function(arr) {
|
1825 |
+
var map = {};
|
1826 |
+
for (var i = 0; i < arr.length; i++) {
|
1827 |
+
map[arr[i]] = 1;
|
1828 |
+
}
|
1829 |
+
return map;
|
1830 |
+
|
1831 |
+
};
|
1832 |
+
|
1833 |
+
exports.createMap = function(props) {
|
1834 |
+
var map = Object.create(null);
|
1835 |
+
for (var i in props) {
|
1836 |
+
map[i] = props[i];
|
1837 |
+
}
|
1838 |
+
return map;
|
1839 |
+
};
|
1840 |
+
exports.arrayRemove = function(array, value) {
|
1841 |
+
for (var i = 0; i <= array.length; i++) {
|
1842 |
+
if (value === array[i]) {
|
1843 |
+
array.splice(i, 1);
|
1844 |
+
}
|
1845 |
+
}
|
1846 |
+
};
|
1847 |
+
|
1848 |
+
exports.escapeRegExp = function(str) {
|
1849 |
+
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
|
1850 |
+
};
|
1851 |
+
|
1852 |
+
exports.escapeHTML = function(str) {
|
1853 |
+
return str.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<");
|
1854 |
+
};
|
1855 |
+
|
1856 |
+
exports.getMatchOffsets = function(string, regExp) {
|
1857 |
+
var matches = [];
|
1858 |
+
|
1859 |
+
string.replace(regExp, function(str) {
|
1860 |
+
matches.push({
|
1861 |
+
offset: arguments[arguments.length - 2],
|
1862 |
+
length: str.length
|
1863 |
+
});
|
1864 |
+
});
|
1865 |
+
|
1866 |
+
return matches;
|
1867 |
+
};
|
1868 |
+
exports.deferredCall = function(fcn) {
|
1869 |
+
var timer = null;
|
1870 |
+
var callback = function() {
|
1871 |
+
timer = null;
|
1872 |
+
fcn();
|
1873 |
+
};
|
1874 |
+
|
1875 |
+
var deferred = function(timeout) {
|
1876 |
+
deferred.cancel();
|
1877 |
+
timer = setTimeout(callback, timeout || 0);
|
1878 |
+
return deferred;
|
1879 |
+
};
|
1880 |
+
|
1881 |
+
deferred.schedule = deferred;
|
1882 |
+
|
1883 |
+
deferred.call = function() {
|
1884 |
+
this.cancel();
|
1885 |
+
fcn();
|
1886 |
+
return deferred;
|
1887 |
+
};
|
1888 |
+
|
1889 |
+
deferred.cancel = function() {
|
1890 |
+
clearTimeout(timer);
|
1891 |
+
timer = null;
|
1892 |
+
return deferred;
|
1893 |
+
};
|
1894 |
+
|
1895 |
+
deferred.isPending = function() {
|
1896 |
+
return timer;
|
1897 |
+
};
|
1898 |
+
|
1899 |
+
return deferred;
|
1900 |
+
};
|
1901 |
+
|
1902 |
+
|
1903 |
+
exports.delayedCall = function(fcn, defaultTimeout) {
|
1904 |
+
var timer = null;
|
1905 |
+
var callback = function() {
|
1906 |
+
timer = null;
|
1907 |
+
fcn();
|
1908 |
+
};
|
1909 |
+
|
1910 |
+
var _self = function(timeout) {
|
1911 |
+
if (timer == null)
|
1912 |
+
timer = setTimeout(callback, timeout || defaultTimeout);
|
1913 |
+
};
|
1914 |
+
|
1915 |
+
_self.delay = function(timeout) {
|
1916 |
+
timer && clearTimeout(timer);
|
1917 |
+
timer = setTimeout(callback, timeout || defaultTimeout);
|
1918 |
+
};
|
1919 |
+
_self.schedule = _self;
|
1920 |
+
|
1921 |
+
_self.call = function() {
|
1922 |
+
this.cancel();
|
1923 |
+
fcn();
|
1924 |
+
};
|
1925 |
+
|
1926 |
+
_self.cancel = function() {
|
1927 |
+
timer && clearTimeout(timer);
|
1928 |
+
timer = null;
|
1929 |
+
};
|
1930 |
+
|
1931 |
+
_self.isPending = function() {
|
1932 |
+
return timer;
|
1933 |
+
};
|
1934 |
+
|
1935 |
+
return _self;
|
1936 |
+
};
|
1937 |
+
});
|
1938 |
+
|
1939 |
+
ace.define("ace/keyboard/textinput", ["require", "exports", "module", "ace/lib/event", "ace/lib/useragent", "ace/lib/dom", "ace/lib/lang"], function(require, exports, module) {
|
1940 |
+
"use strict";
|
1941 |
+
|
1942 |
+
var event = require("../lib/event");
|
1943 |
+
var useragent = require("../lib/useragent");
|
1944 |
+
var dom = require("../lib/dom");
|
1945 |
+
var lang = require("../lib/lang");
|
1946 |
+
var BROKEN_SETDATA = useragent.isChrome < 18;
|
1947 |
+
var USE_IE_MIME_TYPE = useragent.isIE;
|
1948 |
+
|
1949 |
+
var TextInput = function(parentNode, host) {
|
1950 |
+
var text = dom.createElement("textarea");
|
1951 |
+
text.className = "ace_text-input";
|
1952 |
+
|
1953 |
+
if (useragent.isTouchPad)
|
1954 |
+
text.setAttribute("x-palm-disable-auto-cap", true);
|
1955 |
+
|
1956 |
+
text.wrap = "off";
|
1957 |
+
text.autocorrect = "off";
|
1958 |
+
text.autocapitalize = "off";
|
1959 |
+
text.spellcheck = false;
|
1960 |
+
|
1961 |
+
text.style.opacity = "0";
|
1962 |
+
if (useragent.isOldIE) text.style.top = "-100px";
|
1963 |
+
parentNode.insertBefore(text, parentNode.firstChild);
|
1964 |
+
|
1965 |
+
var PLACEHOLDER = "\x01\x01";
|
1966 |
+
|
1967 |
+
var copied = false;
|
1968 |
+
var pasted = false;
|
1969 |
+
var inComposition = false;
|
1970 |
+
var tempStyle = '';
|
1971 |
+
var isSelectionEmpty = true;
|
1972 |
+
try {
|
1973 |
+
var isFocused = document.activeElement === text;
|
1974 |
+
} catch (e) {}
|
1975 |
+
|
1976 |
+
event.addListener(text, "blur", function(e) {
|
1977 |
+
host.onBlur(e);
|
1978 |
+
isFocused = false;
|
1979 |
+
});
|
1980 |
+
event.addListener(text, "focus", function(e) {
|
1981 |
+
isFocused = true;
|
1982 |
+
host.onFocus(e);
|
1983 |
+
resetSelection();
|
1984 |
+
});
|
1985 |
+
this.focus = function() {
|
1986 |
+
text.focus();
|
1987 |
+
};
|
1988 |
+
this.blur = function() {
|
1989 |
+
text.blur();
|
1990 |
+
};
|
1991 |
+
this.isFocused = function() {
|
1992 |
+
return isFocused;
|
1993 |
+
};
|
1994 |
+
var syncSelection = lang.delayedCall(function() {
|
1995 |
+
isFocused && resetSelection(isSelectionEmpty);
|
1996 |
+
});
|
1997 |
+
var syncValue = lang.delayedCall(function() {
|
1998 |
+
if (!inComposition) {
|
1999 |
+
text.value = PLACEHOLDER;
|
2000 |
+
isFocused && resetSelection();
|
2001 |
+
}
|
2002 |
+
});
|
2003 |
+
|
2004 |
+
function resetSelection(isEmpty) {
|
2005 |
+
if (inComposition)
|
2006 |
+
return;
|
2007 |
+
if (inputHandler) {
|
2008 |
+
selectionStart = 0;
|
2009 |
+
selectionEnd = isEmpty ? 0 : text.value.length - 1;
|
2010 |
+
} else {
|
2011 |
+
var selectionStart = isEmpty ? 2 : 1;
|
2012 |
+
var selectionEnd = 2;
|
2013 |
+
}
|
2014 |
+
try {
|
2015 |
+
text.setSelectionRange(selectionStart, selectionEnd);
|
2016 |
+
} catch (e) {}
|
2017 |
+
}
|
2018 |
+
|
2019 |
+
function resetValue() {
|
2020 |
+
if (inComposition)
|
2021 |
+
return;
|
2022 |
+
text.value = PLACEHOLDER;
|
2023 |
+
if (useragent.isWebKit)
|
2024 |
+
syncValue.schedule();
|
2025 |
+
}
|
2026 |
+
|
2027 |
+
useragent.isWebKit || host.addEventListener('changeSelection', function() {
|
2028 |
+
if (host.selection.isEmpty() != isSelectionEmpty) {
|
2029 |
+
isSelectionEmpty = !isSelectionEmpty;
|
2030 |
+
syncSelection.schedule();
|
2031 |
+
}
|
2032 |
+
});
|
2033 |
+
|
2034 |
+
resetValue();
|
2035 |
+
if (isFocused)
|
2036 |
+
host.onFocus();
|
2037 |
+
|
2038 |
+
|
2039 |
+
var isAllSelected = function(text) {
|
2040 |
+
return text.selectionStart === 0 && text.selectionEnd === text.value.length;
|
2041 |
+
};
|
2042 |
+
if (!text.setSelectionRange && text.createTextRange) {
|
2043 |
+
text.setSelectionRange = function(selectionStart, selectionEnd) {
|
2044 |
+
var range = this.createTextRange();
|
2045 |
+
range.collapse(true);
|
2046 |
+
range.moveStart('character', selectionStart);
|
2047 |
+
range.moveEnd('character', selectionEnd);
|
2048 |
+
range.select();
|
2049 |
+
};
|
2050 |
+
isAllSelected = function(text) {
|
2051 |
+
try {
|
2052 |
+
var range = text.ownerDocument.selection.createRange();
|
2053 |
+
} catch (e) {}
|
2054 |
+
if (!range || range.parentElement() != text) return false;
|
2055 |
+
return range.text == text.value;
|
2056 |
+
}
|
2057 |
+
}
|
2058 |
+
if (useragent.isOldIE) {
|
2059 |
+
var inPropertyChange = false;
|
2060 |
+
var onPropertyChange = function(e) {
|
2061 |
+
if (inPropertyChange)
|
2062 |
+
return;
|
2063 |
+
var data = text.value;
|
2064 |
+
if (inComposition || !data || data == PLACEHOLDER)
|
2065 |
+
return;
|
2066 |
+
if (e && data == PLACEHOLDER[0])
|
2067 |
+
return syncProperty.schedule();
|
2068 |
+
|
2069 |
+
sendText(data);
|
2070 |
+
inPropertyChange = true;
|
2071 |
+
resetValue();
|
2072 |
+
inPropertyChange = false;
|
2073 |
+
};
|
2074 |
+
var syncProperty = lang.delayedCall(onPropertyChange);
|
2075 |
+
event.addListener(text, "propertychange", onPropertyChange);
|
2076 |
+
|
2077 |
+
var keytable = {
|
2078 |
+
13: 1,
|
2079 |
+
27: 1
|
2080 |
+
};
|
2081 |
+
event.addListener(text, "keyup", function(e) {
|
2082 |
+
if (inComposition && (!text.value || keytable[e.keyCode]))
|
2083 |
+
setTimeout(onCompositionEnd, 0);
|
2084 |
+
if ((text.value.charCodeAt(0) || 0) < 129) {
|
2085 |
+
return syncProperty.call();
|
2086 |
+
}
|
2087 |
+
inComposition ? onCompositionUpdate() : onCompositionStart();
|
2088 |
+
});
|
2089 |
+
event.addListener(text, "keydown", function(e) {
|
2090 |
+
syncProperty.schedule(50);
|
2091 |
+
});
|
2092 |
+
}
|
2093 |
+
|
2094 |
+
var onSelect = function(e) {
|
2095 |
+
if (copied) {
|
2096 |
+
copied = false;
|
2097 |
+
} else if (isAllSelected(text)) {
|
2098 |
+
host.selectAll();
|
2099 |
+
resetSelection();
|
2100 |
+
} else if (inputHandler) {
|
2101 |
+
resetSelection(host.selection.isEmpty());
|
2102 |
+
}
|
2103 |
+
};
|
2104 |
+
|
2105 |
+
var inputHandler = null;
|
2106 |
+
this.setInputHandler = function(cb) {
|
2107 |
+
inputHandler = cb
|
2108 |
+
};
|
2109 |
+
this.getInputHandler = function() {
|
2110 |
+
return inputHandler
|
2111 |
+
};
|
2112 |
+
var afterContextMenu = false;
|
2113 |
+
|
2114 |
+
var sendText = function(data) {
|
2115 |
+
if (inputHandler) {
|
2116 |
+
data = inputHandler(data);
|
2117 |
+
inputHandler = null;
|
2118 |
+
}
|
2119 |
+
if (pasted) {
|
2120 |
+
resetSelection();
|
2121 |
+
if (data)
|
2122 |
+
host.onPaste(data);
|
2123 |
+
pasted = false;
|
2124 |
+
} else if (data == PLACEHOLDER.charAt(0)) {
|
2125 |
+
if (afterContextMenu)
|
2126 |
+
host.execCommand("del", {
|
2127 |
+
source: "ace"
|
2128 |
+
});
|
2129 |
+
else // some versions of android do not fire keydown when pressing backspace
|
2130 |
+
host.execCommand("backspace", {
|
2131 |
+
source: "ace"
|
2132 |
+
});
|
2133 |
+
} else {
|
2134 |
+
if (data.substring(0, 2) == PLACEHOLDER)
|
2135 |
+
data = data.substr(2);
|
2136 |
+
else if (data.charAt(0) == PLACEHOLDER.charAt(0))
|
2137 |
+
data = data.substr(1);
|
2138 |
+
else if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0))
|
2139 |
+
data = data.slice(0, -1);
|
2140 |
+
if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0))
|
2141 |
+
data = data.slice(0, -1);
|
2142 |
+
|
2143 |
+
if (data)
|
2144 |
+
host.onTextInput(data);
|
2145 |
+
}
|
2146 |
+
if (afterContextMenu)
|
2147 |
+
afterContextMenu = false;
|
2148 |
+
};
|
2149 |
+
var onInput = function(e) {
|
2150 |
+
if (inComposition)
|
2151 |
+
return;
|
2152 |
+
var data = text.value;
|
2153 |
+
sendText(data);
|
2154 |
+
resetValue();
|
2155 |
+
};
|
2156 |
+
|
2157 |
+
var handleClipboardData = function(e, data) {
|
2158 |
+
var clipboardData = e.clipboardData || window.clipboardData;
|
2159 |
+
if (!clipboardData || BROKEN_SETDATA)
|
2160 |
+
return;
|
2161 |
+
var mime = USE_IE_MIME_TYPE ? "Text" : "text/plain";
|
2162 |
+
if (data) {
|
2163 |
+
return clipboardData.setData(mime, data) !== false;
|
2164 |
+
} else {
|
2165 |
+
return clipboardData.getData(mime);
|
2166 |
+
}
|
2167 |
+
};
|
2168 |
+
|
2169 |
+
var doCopy = function(e, isCut) {
|
2170 |
+
var data = host.getCopyText();
|
2171 |
+
if (!data)
|
2172 |
+
return event.preventDefault(e);
|
2173 |
+
|
2174 |
+
if (handleClipboardData(e, data)) {
|
2175 |
+
isCut ? host.onCut() : host.onCopy();
|
2176 |
+
event.preventDefault(e);
|
2177 |
+
} else {
|
2178 |
+
copied = true;
|
2179 |
+
text.value = data;
|
2180 |
+
text.select();
|
2181 |
+
setTimeout(function() {
|
2182 |
+
copied = false;
|
2183 |
+
resetValue();
|
2184 |
+
resetSelection();
|
2185 |
+
isCut ? host.onCut() : host.onCopy();
|
2186 |
+
});
|
2187 |
+
}
|
2188 |
+
};
|
2189 |
+
|
2190 |
+
var onCut = function(e) {
|
2191 |
+
doCopy(e, true);
|
2192 |
+
};
|
2193 |
+
|
2194 |
+
var onCopy = function(e) {
|
2195 |
+
doCopy(e, false);
|
2196 |
+
};
|
2197 |
+
|
2198 |
+
var onPaste = function(e) {
|
2199 |
+
var data = handleClipboardData(e);
|
2200 |
+
if (typeof data == "string") {
|
2201 |
+
if (data)
|
2202 |
+
host.onPaste(data);
|
2203 |
+
if (useragent.isIE)
|
2204 |
+
setTimeout(resetSelection);
|
2205 |
+
event.preventDefault(e);
|
2206 |
+
} else {
|
2207 |
+
text.value = "";
|
2208 |
+
pasted = true;
|
2209 |
+
}
|
2210 |
+
};
|
2211 |
+
|
2212 |
+
event.addCommandKeyListener(text, host.onCommandKey.bind(host));
|
2213 |
+
|
2214 |
+
event.addListener(text, "select", onSelect);
|
2215 |
+
|
2216 |
+
event.addListener(text, "input", onInput);
|
2217 |
+
|
2218 |
+
event.addListener(text, "cut", onCut);
|
2219 |
+
event.addListener(text, "copy", onCopy);
|
2220 |
+
event.addListener(text, "paste", onPaste);
|
2221 |
+
if (!('oncut' in text) || !('oncopy' in text) || !('onpaste' in text)) {
|
2222 |
+
event.addListener(parentNode, "keydown", function(e) {
|
2223 |
+
if ((useragent.isMac && !e.metaKey) || !e.ctrlKey)
|
2224 |
+
return;
|
2225 |
+
|
2226 |
+
switch (e.keyCode) {
|
2227 |
+
case 67:
|
2228 |
+
onCopy(e);
|
2229 |
+
break;
|
2230 |
+
case 86:
|
2231 |
+
onPaste(e);
|
2232 |
+
break;
|
2233 |
+
case 88:
|
2234 |
+
onCut(e);
|
2235 |
+
break;
|
2236 |
+
}
|
2237 |
+
});
|
2238 |
+
}
|
2239 |
+
var onCompositionStart = function(e) {
|
2240 |
+
if (inComposition || !host.onCompositionStart || host.$readOnly)
|
2241 |
+
return;
|
2242 |
+
inComposition = {};
|
2243 |
+
host.onCompositionStart();
|
2244 |
+
setTimeout(onCompositionUpdate, 0);
|
2245 |
+
host.on("mousedown", onCompositionEnd);
|
2246 |
+
if (!host.selection.isEmpty()) {
|
2247 |
+
host.insert("");
|
2248 |
+
host.session.markUndoGroup();
|
2249 |
+
host.selection.clearSelection();
|
2250 |
+
}
|
2251 |
+
host.session.markUndoGroup();
|
2252 |
+
};
|
2253 |
+
|
2254 |
+
var onCompositionUpdate = function() {
|
2255 |
+
if (!inComposition || !host.onCompositionUpdate || host.$readOnly)
|
2256 |
+
return;
|
2257 |
+
var val = text.value.replace(/\x01/g, "");
|
2258 |
+
if (inComposition.lastValue === val) return;
|
2259 |
+
|
2260 |
+
host.onCompositionUpdate(val);
|
2261 |
+
if (inComposition.lastValue)
|
2262 |
+
host.undo();
|
2263 |
+
inComposition.lastValue = val;
|
2264 |
+
if (inComposition.lastValue) {
|
2265 |
+
var r = host.selection.getRange();
|
2266 |
+
host.insert(inComposition.lastValue);
|
2267 |
+
host.session.markUndoGroup();
|
2268 |
+
inComposition.range = host.selection.getRange();
|
2269 |
+
host.selection.setRange(r);
|
2270 |
+
host.selection.clearSelection();
|
2271 |
+
}
|
2272 |
+
};
|
2273 |
+
|
2274 |
+
var onCompositionEnd = function(e) {
|
2275 |
+
if (!host.onCompositionEnd || host.$readOnly) return;
|
2276 |
+
var c = inComposition;
|
2277 |
+
inComposition = false;
|
2278 |
+
var timer = setTimeout(function() {
|
2279 |
+
timer = null;
|
2280 |
+
var str = text.value.replace(/\x01/g, "");
|
2281 |
+
if (inComposition)
|
2282 |
+
return;
|
2283 |
+
else if (str == c.lastValue)
|
2284 |
+
resetValue();
|
2285 |
+
else if (!c.lastValue && str) {
|
2286 |
+
resetValue();
|
2287 |
+
sendText(str);
|
2288 |
+
}
|
2289 |
+
});
|
2290 |
+
inputHandler = function compositionInputHandler(str) {
|
2291 |
+
if (timer)
|
2292 |
+
clearTimeout(timer);
|
2293 |
+
str = str.replace(/\x01/g, "");
|
2294 |
+
if (str == c.lastValue)
|
2295 |
+
return "";
|
2296 |
+
if (c.lastValue && timer)
|
2297 |
+
host.undo();
|
2298 |
+
return str;
|
2299 |
+
};
|
2300 |
+
host.onCompositionEnd();
|
2301 |
+
host.removeListener("mousedown", onCompositionEnd);
|
2302 |
+
if (e.type == "compositionend" && c.range) {
|
2303 |
+
host.selection.setRange(c.range);
|
2304 |
+
}
|
2305 |
+
};
|
2306 |
+
|
2307 |
+
|
2308 |
+
|
2309 |
+
var syncComposition = lang.delayedCall(onCompositionUpdate, 50);
|
2310 |
+
|
2311 |
+
event.addListener(text, "compositionstart", onCompositionStart);
|
2312 |
+
if (useragent.isGecko) {
|
2313 |
+
event.addListener(text, "text", function() {
|
2314 |
+
syncComposition.schedule()
|
2315 |
+
});
|
2316 |
+
} else {
|
2317 |
+
event.addListener(text, "keyup", function() {
|
2318 |
+
syncComposition.schedule()
|
2319 |
+
});
|
2320 |
+
event.addListener(text, "keydown", function() {
|
2321 |
+
syncComposition.schedule()
|
2322 |
+
});
|
2323 |
+
}
|
2324 |
+
event.addListener(text, "compositionend", onCompositionEnd);
|
2325 |
+
|
2326 |
+
this.getElement = function() {
|
2327 |
+
return text;
|
2328 |
+
};
|
2329 |
+
|
2330 |
+
this.setReadOnly = function(readOnly) {
|
2331 |
+
text.readOnly = readOnly;
|
2332 |
+
};
|
2333 |
+
|
2334 |
+
this.onContextMenu = function(e) {
|
2335 |
+
afterContextMenu = true;
|
2336 |
+
resetSelection(host.selection.isEmpty());
|
2337 |
+
host._emit("nativecontextmenu", {
|
2338 |
+
target: host,
|
2339 |
+
domEvent: e
|
2340 |
+
});
|
2341 |
+
this.moveToMouse(e, true);
|
2342 |
+
};
|
2343 |
+
|
2344 |
+
this.moveToMouse = function(e, bringToFront) {
|
2345 |
+
if (!bringToFront && useragent.isOldIE)
|
2346 |
+
return;
|
2347 |
+
if (!tempStyle)
|
2348 |
+
tempStyle = text.style.cssText;
|
2349 |
+
text.style.cssText = (bringToFront ? "z-index:100000;" : "") + "height:" + text.style.height + ";" + (useragent.isIE ? "opacity:0.1;" : "");
|
2350 |
+
|
2351 |
+
var rect = host.container.getBoundingClientRect();
|
2352 |
+
var style = dom.computedStyle(host.container);
|
2353 |
+
var top = rect.top + (parseInt(style.borderTopWidth) || 0);
|
2354 |
+
var left = rect.left + (parseInt(rect.borderLeftWidth) || 0);
|
2355 |
+
var maxTop = rect.bottom - top - text.clientHeight - 2;
|
2356 |
+
var move = function(e) {
|
2357 |
+
text.style.left = e.clientX - left - 2 + "px";
|
2358 |
+
text.style.top = Math.min(e.clientY - top - 2, maxTop) + "px";
|
2359 |
+
};
|
2360 |
+
move(e);
|
2361 |
+
|
2362 |
+
if (e.type != "mousedown")
|
2363 |
+
return;
|
2364 |
+
|
2365 |
+
if (host.renderer.$keepTextAreaAtCursor)
|
2366 |
+
host.renderer.$keepTextAreaAtCursor = null;
|
2367 |
+
if (useragent.isWin && !useragent.isOldIE)
|
2368 |
+
event.capture(host.container, move, onContextMenuClose);
|
2369 |
+
};
|
2370 |
+
|
2371 |
+
this.onContextMenuClose = onContextMenuClose;
|
2372 |
+
var closeTimeout;
|
2373 |
+
|
2374 |
+
function onContextMenuClose() {
|
2375 |
+
clearTimeout(closeTimeout)
|
2376 |
+
closeTimeout = setTimeout(function() {
|
2377 |
+
if (tempStyle) {
|
2378 |
+
text.style.cssText = tempStyle;
|
2379 |
+
tempStyle = '';
|
2380 |
+
}
|
2381 |
+
if (host.renderer.$keepTextAreaAtCursor == null) {
|
2382 |
+
host.renderer.$keepTextAreaAtCursor = true;
|
2383 |
+
host.renderer.$moveTextAreaToCursor();
|
2384 |
+
}
|
2385 |
+
}, useragent.isOldIE ? 200 : 0);
|
2386 |
+
}
|
2387 |
+
|
2388 |
+
var onContextMenu = function(e) {
|
2389 |
+
host.textInput.onContextMenu(e);
|
2390 |
+
onContextMenuClose();
|
2391 |
+
};
|
2392 |
+
event.addListener(host.renderer.scroller, "contextmenu", onContextMenu);
|
2393 |
+
event.addListener(text, "contextmenu", onContextMenu);
|
2394 |
+
};
|
2395 |
+
|
2396 |
+
exports.TextInput = TextInput;
|
2397 |
+
});
|
2398 |
+
|
2399 |
+
ace.define("ace/mouse/default_handlers", ["require", "exports", "module", "ace/lib/dom", "ace/lib/event", "ace/lib/useragent"], function(require, exports, module) {
|
2400 |
+
"use strict";
|
2401 |
+
|
2402 |
+
var dom = require("../lib/dom");
|
2403 |
+
var event = require("../lib/event");
|
2404 |
+
var useragent = require("../lib/useragent");
|
2405 |
+
|
2406 |
+
var DRAG_OFFSET = 0; // pixels
|
2407 |
+
|
2408 |
+
function DefaultHandlers(mouseHandler) {
|
2409 |
+
mouseHandler.$clickSelection = null;
|
2410 |
+
|
2411 |
+
var editor = mouseHandler.editor;
|
2412 |
+
editor.setDefaultHandler("mousedown", this.onMouseDown.bind(mouseHandler));
|
2413 |
+
editor.setDefaultHandler("dblclick", this.onDoubleClick.bind(mouseHandler));
|
2414 |
+
editor.setDefaultHandler("tripleclick", this.onTripleClick.bind(mouseHandler));
|
2415 |
+
editor.setDefaultHandler("quadclick", this.onQuadClick.bind(mouseHandler));
|
2416 |
+
editor.setDefaultHandler("mousewheel", this.onMouseWheel.bind(mouseHandler));
|
2417 |
+
|
2418 |
+
var exports = ["select", "startSelect", "selectEnd", "selectAllEnd", "selectByWordsEnd",
|
2419 |
+
"selectByLinesEnd", "dragWait", "dragWaitEnd", "focusWait"
|
2420 |
+
];
|
2421 |
+
|
2422 |
+
exports.forEach(function(x) {
|
2423 |
+
mouseHandler[x] = this[x];
|
2424 |
+
}, this);
|
2425 |
+
|
2426 |
+
mouseHandler.selectByLines = this.extendSelectionBy.bind(mouseHandler, "getLineRange");
|
2427 |
+
mouseHandler.selectByWords = this.extendSelectionBy.bind(mouseHandler, "getWordRange");
|
2428 |
+
}
|
2429 |
+
|
2430 |
+
(function() {
|
2431 |
+
|
2432 |
+
this.onMouseDown = function(ev) {
|
2433 |
+
var inSelection = ev.inSelection();
|
2434 |
+
var pos = ev.getDocumentPosition();
|
2435 |
+
this.mousedownEvent = ev;
|
2436 |
+
var editor = this.editor;
|
2437 |
+
|
2438 |
+
var button = ev.getButton();
|
2439 |
+
if (button !== 0) {
|
2440 |
+
var selectionRange = editor.getSelectionRange();
|
2441 |
+
var selectionEmpty = selectionRange.isEmpty();
|
2442 |
+
|
2443 |
+
if (selectionEmpty)
|
2444 |
+
editor.selection.moveToPosition(pos);
|
2445 |
+
editor.textInput.onContextMenu(ev.domEvent);
|
2446 |
+
return; // stopping event here breaks contextmenu on ff mac
|
2447 |
+
}
|
2448 |
+
|
2449 |
+
this.mousedownEvent.time = Date.now();
|
2450 |
+
if (inSelection && !editor.isFocused()) {
|
2451 |
+
editor.focus();
|
2452 |
+
if (this.$focusTimout && !this.$clickSelection && !editor.inMultiSelectMode) {
|
2453 |
+
this.setState("focusWait");
|
2454 |
+
this.captureMouse(ev);
|
2455 |
+
return;
|
2456 |
+
}
|
2457 |
+
}
|
2458 |
+
|
2459 |
+
this.captureMouse(ev);
|
2460 |
+
this.startSelect(pos, ev.domEvent._clicks > 1);
|
2461 |
+
return ev.preventDefault();
|
2462 |
+
};
|
2463 |
+
|
2464 |
+
this.startSelect = function(pos, waitForClickSelection) {
|
2465 |
+
pos = pos || this.editor.renderer.screenToTextCoordinates(this.x, this.y);
|
2466 |
+
var editor = this.editor;
|
2467 |
+
|
2468 |
+
if (this.mousedownEvent.getShiftKey())
|
2469 |
+
editor.selection.selectToPosition(pos);
|
2470 |
+
else if (!waitForClickSelection)
|
2471 |
+
editor.selection.moveToPosition(pos);
|
2472 |
+
if (!waitForClickSelection)
|
2473 |
+
this.select();
|
2474 |
+
if (editor.renderer.scroller.setCapture) {
|
2475 |
+
editor.renderer.scroller.setCapture();
|
2476 |
+
}
|
2477 |
+
editor.setStyle("ace_selecting");
|
2478 |
+
this.setState("select");
|
2479 |
+
};
|
2480 |
+
|
2481 |
+
this.select = function() {
|
2482 |
+
var anchor, editor = this.editor;
|
2483 |
+
var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);
|
2484 |
+
|
2485 |
+
if (this.$clickSelection) {
|
2486 |
+
var cmp = this.$clickSelection.comparePoint(cursor);
|
2487 |
+
|
2488 |
+
if (cmp == -1) {
|
2489 |
+
anchor = this.$clickSelection.end;
|
2490 |
+
} else if (cmp == 1) {
|
2491 |
+
anchor = this.$clickSelection.start;
|
2492 |
+
} else {
|
2493 |
+
var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
|
2494 |
+
cursor = orientedRange.cursor;
|
2495 |
+
anchor = orientedRange.anchor;
|
2496 |
+
}
|
2497 |
+
editor.selection.setSelectionAnchor(anchor.row, anchor.column);
|
2498 |
+
}
|
2499 |
+
editor.selection.selectToPosition(cursor);
|
2500 |
+
|
2501 |
+
editor.renderer.scrollCursorIntoView();
|
2502 |
+
};
|
2503 |
+
|
2504 |
+
this.extendSelectionBy = function(unitName) {
|
2505 |
+
var anchor, editor = this.editor;
|
2506 |
+
var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);
|
2507 |
+
var range = editor.selection[unitName](cursor.row, cursor.column);
|
2508 |
+
|
2509 |
+
if (this.$clickSelection) {
|
2510 |
+
var cmpStart = this.$clickSelection.comparePoint(range.start);
|
2511 |
+
var cmpEnd = this.$clickSelection.comparePoint(range.end);
|
2512 |
+
|
2513 |
+
if (cmpStart == -1 && cmpEnd <= 0) {
|
2514 |
+
anchor = this.$clickSelection.end;
|
2515 |
+
if (range.end.row != cursor.row || range.end.column != cursor.column)
|
2516 |
+
cursor = range.start;
|
2517 |
+
} else if (cmpEnd == 1 && cmpStart >= 0) {
|
2518 |
+
anchor = this.$clickSelection.start;
|
2519 |
+
if (range.start.row != cursor.row || range.start.column != cursor.column)
|
2520 |
+
cursor = range.end;
|
2521 |
+
} else if (cmpStart == -1 && cmpEnd == 1) {
|
2522 |
+
cursor = range.end;
|
2523 |
+
anchor = range.start;
|
2524 |
+
} else {
|
2525 |
+
var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
|
2526 |
+
cursor = orientedRange.cursor;
|
2527 |
+
anchor = orientedRange.anchor;
|
2528 |
+
}
|
2529 |
+
editor.selection.setSelectionAnchor(anchor.row, anchor.column);
|
2530 |
+
}
|
2531 |
+
editor.selection.selectToPosition(cursor);
|
2532 |
+
|
2533 |
+
editor.renderer.scrollCursorIntoView();
|
2534 |
+
};
|
2535 |
+
|
2536 |
+
this.selectEnd =
|
2537 |
+
this.selectAllEnd =
|
2538 |
+
this.selectByWordsEnd =
|
2539 |
+
this.selectByLinesEnd = function() {
|
2540 |
+
this.$clickSelection = null;
|
2541 |
+
this.editor.unsetStyle("ace_selecting");
|
2542 |
+
if (this.editor.renderer.scroller.releaseCapture) {
|
2543 |
+
this.editor.renderer.scroller.releaseCapture();
|
2544 |
+
}
|
2545 |
+
};
|
2546 |
+
|
2547 |
+
this.focusWait = function() {
|
2548 |
+
var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
|
2549 |
+
var time = Date.now();
|
2550 |
+
|
2551 |
+
if (distance > DRAG_OFFSET || time - this.mousedownEvent.time > this.$focusTimout)
|
2552 |
+
this.startSelect(this.mousedownEvent.getDocumentPosition());
|
2553 |
+
};
|
2554 |
+
|
2555 |
+
this.onDoubleClick = function(ev) {
|
2556 |
+
var pos = ev.getDocumentPosition();
|
2557 |
+
var editor = this.editor;
|
2558 |
+
var session = editor.session;
|
2559 |
+
|
2560 |
+
var range = session.getBracketRange(pos);
|
2561 |
+
if (range) {
|
2562 |
+
if (range.isEmpty()) {
|
2563 |
+
range.start.column--;
|
2564 |
+
range.end.column++;
|
2565 |
+
}
|
2566 |
+
this.setState("select");
|
2567 |
+
} else {
|
2568 |
+
range = editor.selection.getWordRange(pos.row, pos.column);
|
2569 |
+
this.setState("selectByWords");
|
2570 |
+
}
|
2571 |
+
this.$clickSelection = range;
|
2572 |
+
this.select();
|
2573 |
+
};
|
2574 |
+
|
2575 |
+
this.onTripleClick = function(ev) {
|
2576 |
+
var pos = ev.getDocumentPosition();
|
2577 |
+
var editor = this.editor;
|
2578 |
+
|
2579 |
+
this.setState("selectByLines");
|
2580 |
+
var range = editor.getSelectionRange();
|
2581 |
+
if (range.isMultiLine() && range.contains(pos.row, pos.column)) {
|
2582 |
+
this.$clickSelection = editor.selection.getLineRange(range.start.row);
|
2583 |
+
this.$clickSelection.end = editor.selection.getLineRange(range.end.row).end;
|
2584 |
+
} else {
|
2585 |
+
this.$clickSelection = editor.selection.getLineRange(pos.row);
|
2586 |
+
}
|
2587 |
+
this.select();
|
2588 |
+
};
|
2589 |
+
|
2590 |
+
this.onQuadClick = function(ev) {
|
2591 |
+
var editor = this.editor;
|
2592 |
+
|
2593 |
+
editor.selectAll();
|
2594 |
+
this.$clickSelection = editor.getSelectionRange();
|
2595 |
+
this.setState("selectAll");
|
2596 |
+
};
|
2597 |
+
|
2598 |
+
this.onMouseWheel = function(ev) {
|
2599 |
+
if (ev.getAccelKey())
|
2600 |
+
return;
|
2601 |
+
if (ev.getShiftKey() && ev.wheelY && !ev.wheelX) {
|
2602 |
+
ev.wheelX = ev.wheelY;
|
2603 |
+
ev.wheelY = 0;
|
2604 |
+
}
|
2605 |
+
|
2606 |
+
var t = ev.domEvent.timeStamp;
|
2607 |
+
var dt = t - (this.$lastScrollTime || 0);
|
2608 |
+
|
2609 |
+
var editor = this.editor;
|
2610 |
+
var isScrolable = editor.renderer.isScrollableBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
|
2611 |
+
if (isScrolable || dt < 200) {
|
2612 |
+
this.$lastScrollTime = t;
|
2613 |
+
editor.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
|
2614 |
+
return ev.stop();
|
2615 |
+
}
|
2616 |
+
};
|
2617 |
+
|
2618 |
+
}).call(DefaultHandlers.prototype);
|
2619 |
+
|
2620 |
+
exports.DefaultHandlers = DefaultHandlers;
|
2621 |
+
|
2622 |
+
function calcDistance(ax, ay, bx, by) {
|
2623 |
+
return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
|
2624 |
+
}
|
2625 |
+
|
2626 |
+
function calcRangeOrientation(range, cursor) {
|
2627 |
+
if (range.start.row == range.end.row)
|
2628 |
+
var cmp = 2 * cursor.column - range.start.column - range.end.column;
|
2629 |
+
else if (range.start.row == range.end.row - 1 && !range.start.column && !range.end.column)
|
2630 |
+
var cmp = cursor.column - 4;
|
2631 |
+
else
|
2632 |
+
var cmp = 2 * cursor.row - range.start.row - range.end.row;
|
2633 |
+
|
2634 |
+
if (cmp < 0)
|
2635 |
+
return {
|
2636 |
+
cursor: range.start,
|
2637 |
+
anchor: range.end
|
2638 |
+
};
|
2639 |
+
else
|
2640 |
+
return {
|
2641 |
+
cursor: range.end,
|
2642 |
+
anchor: range.start
|
2643 |
+
};
|
2644 |
+
}
|
2645 |
+
|
2646 |
+
});
|
2647 |
+
|
2648 |
+
ace.define("ace/tooltip", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom"], function(require, exports, module) {
|
2649 |
+
"use strict";
|
2650 |
+
|
2651 |
+
var oop = require("./lib/oop");
|
2652 |
+
var dom = require("./lib/dom");
|
2653 |
+
|
2654 |
+
function Tooltip(parentNode) {
|
2655 |
+
this.isOpen = false;
|
2656 |
+
this.$element = null;
|
2657 |
+
this.$parentNode = parentNode;
|
2658 |
+
}
|
2659 |
+
|
2660 |
+
(function() {
|
2661 |
+
this.$init = function() {
|
2662 |
+
this.$element = dom.createElement("div");
|
2663 |
+
this.$element.className = "ace_tooltip";
|
2664 |
+
this.$element.style.display = "none";
|
2665 |
+
this.$parentNode.appendChild(this.$element);
|
2666 |
+
return this.$element;
|
2667 |
+
};
|
2668 |
+
this.getElement = function() {
|
2669 |
+
return this.$element || this.$init();
|
2670 |
+
};
|
2671 |
+
this.setText = function(text) {
|
2672 |
+
dom.setInnerText(this.getElement(), text);
|
2673 |
+
};
|
2674 |
+
this.setHtml = function(html) {
|
2675 |
+
this.getElement().innerHTML = html;
|
2676 |
+
};
|
2677 |
+
this.setPosition = function(x, y) {
|
2678 |
+
this.getElement().style.left = x + "px";
|
2679 |
+
this.getElement().style.top = y + "px";
|
2680 |
+
};
|
2681 |
+
this.setClassName = function(className) {
|
2682 |
+
dom.addCssClass(this.getElement(), className);
|
2683 |
+
};
|
2684 |
+
this.show = function(text, x, y) {
|
2685 |
+
if (text != null)
|
2686 |
+
this.setText(text);
|
2687 |
+
if (x != null && y != null)
|
2688 |
+
this.setPosition(x, y);
|
2689 |
+
if (!this.isOpen) {
|
2690 |
+
this.getElement().style.display = "block";
|
2691 |
+
this.isOpen = true;
|
2692 |
+
}
|
2693 |
+
};
|
2694 |
+
|
2695 |
+
this.hide = function() {
|
2696 |
+
if (this.isOpen) {
|
2697 |
+
this.getElement().style.display = "none";
|
2698 |
+
this.isOpen = false;
|
2699 |
+
}
|
2700 |
+
};
|
2701 |
+
this.getHeight = function() {
|
2702 |
+
return this.getElement().offsetHeight;
|
2703 |
+
};
|
2704 |
+
this.getWidth = function() {
|
2705 |
+
return this.getElement().offsetWidth;
|
2706 |
+
};
|
2707 |
+
|
2708 |
+
}).call(Tooltip.prototype);
|
2709 |
+
|
2710 |
+
exports.Tooltip = Tooltip;
|
2711 |
+
});
|
2712 |
+
|
2713 |
+
ace.define("ace/mouse/default_gutter_handler", ["require", "exports", "module", "ace/lib/dom", "ace/lib/oop", "ace/lib/event", "ace/tooltip"], function(require, exports, module) {
|
2714 |
+
"use strict";
|
2715 |
+
var dom = require("../lib/dom");
|
2716 |
+
var oop = require("../lib/oop");
|
2717 |
+
var event = require("../lib/event");
|
2718 |
+
var Tooltip = require("../tooltip").Tooltip;
|
2719 |
+
|
2720 |
+
function GutterHandler(mouseHandler) {
|
2721 |
+
var editor = mouseHandler.editor;
|
2722 |
+
var gutter = editor.renderer.$gutterLayer;
|
2723 |
+
var tooltip = new GutterTooltip(editor.container);
|
2724 |
+
|
2725 |
+
mouseHandler.editor.setDefaultHandler("guttermousedown", function(e) {
|
2726 |
+
if (!editor.isFocused() || e.getButton() != 0)
|
2727 |
+
return;
|
2728 |
+
var gutterRegion = gutter.getRegion(e);
|
2729 |
+
|
2730 |
+
if (gutterRegion == "foldWidgets")
|
2731 |
+
return;
|
2732 |
+
|
2733 |
+
var row = e.getDocumentPosition().row;
|
2734 |
+
var selection = editor.session.selection;
|
2735 |
+
|
2736 |
+
if (e.getShiftKey())
|
2737 |
+
selection.selectTo(row, 0);
|
2738 |
+
else {
|
2739 |
+
if (e.domEvent.detail == 2) {
|
2740 |
+
editor.selectAll();
|
2741 |
+
return e.preventDefault();
|
2742 |
+
}
|
2743 |
+
mouseHandler.$clickSelection = editor.selection.getLineRange(row);
|
2744 |
+
}
|
2745 |
+
mouseHandler.setState("selectByLines");
|
2746 |
+
mouseHandler.captureMouse(e);
|
2747 |
+
return e.preventDefault();
|
2748 |
+
});
|
2749 |
+
|
2750 |
+
|
2751 |
+
var tooltipTimeout, mouseEvent, tooltipAnnotation;
|
2752 |
+
|
2753 |
+
function showTooltip() {
|
2754 |
+
var row = mouseEvent.getDocumentPosition().row;
|
2755 |
+
var annotation = gutter.$annotations[row];
|
2756 |
+
if (!annotation)
|
2757 |
+
return hideTooltip();
|
2758 |
+
|
2759 |
+
var maxRow = editor.session.getLength();
|
2760 |
+
if (row == maxRow) {
|
2761 |
+
var screenRow = editor.renderer.pixelToScreenCoordinates(0, mouseEvent.y).row;
|
2762 |
+
var pos = mouseEvent.$pos;
|
2763 |
+
if (screenRow > editor.session.documentToScreenRow(pos.row, pos.column))
|
2764 |
+
return hideTooltip();
|
2765 |
+
}
|
2766 |
+
|
2767 |
+
if (tooltipAnnotation == annotation)
|
2768 |
+
return;
|
2769 |
+
tooltipAnnotation = annotation.text.join("<br/>");
|
2770 |
+
|
2771 |
+
tooltip.setHtml(tooltipAnnotation);
|
2772 |
+
tooltip.show();
|
2773 |
+
editor.on("mousewheel", hideTooltip);
|
2774 |
+
|
2775 |
+
if (mouseHandler.$tooltipFollowsMouse) {
|
2776 |
+
moveTooltip(mouseEvent);
|
2777 |
+
} else {
|
2778 |
+
var gutterElement = gutter.$cells[editor.session.documentToScreenRow(row, 0)].element;
|
2779 |
+
var rect = gutterElement.getBoundingClientRect();
|
2780 |
+
var style = tooltip.getElement().style;
|
2781 |
+
style.left = rect.right + "px";
|
2782 |
+
style.top = rect.bottom + "px";
|
2783 |
+
}
|
2784 |
+
}
|
2785 |
+
|
2786 |
+
function hideTooltip() {
|
2787 |
+
if (tooltipTimeout)
|
2788 |
+
tooltipTimeout = clearTimeout(tooltipTimeout);
|
2789 |
+
if (tooltipAnnotation) {
|
2790 |
+
tooltip.hide();
|
2791 |
+
tooltipAnnotation = null;
|
2792 |
+
editor.removeEventListener("mousewheel", hideTooltip);
|
2793 |
+
}
|
2794 |
+
}
|
2795 |
+
|
2796 |
+
function moveTooltip(e) {
|
2797 |
+
tooltip.setPosition(e.x, e.y);
|
2798 |
+
}
|
2799 |
+
|
2800 |
+
mouseHandler.editor.setDefaultHandler("guttermousemove", function(e) {
|
2801 |
+
var target = e.domEvent.target || e.domEvent.srcElement;
|
2802 |
+
if (dom.hasCssClass(target, "ace_fold-widget"))
|
2803 |
+
return hideTooltip();
|
2804 |
+
|
2805 |
+
if (tooltipAnnotation && mouseHandler.$tooltipFollowsMouse)
|
2806 |
+
moveTooltip(e);
|
2807 |
+
|
2808 |
+
mouseEvent = e;
|
2809 |
+
if (tooltipTimeout)
|
2810 |
+
return;
|
2811 |
+
tooltipTimeout = setTimeout(function() {
|
2812 |
+
tooltipTimeout = null;
|
2813 |
+
if (mouseEvent && !mouseHandler.isMousePressed)
|
2814 |
+
showTooltip();
|
2815 |
+
else
|
2816 |
+
hideTooltip();
|
2817 |
+
}, 50);
|
2818 |
+
});
|
2819 |
+
|
2820 |
+
event.addListener(editor.renderer.$gutter, "mouseout", function(e) {
|
2821 |
+
mouseEvent = null;
|
2822 |
+
if (!tooltipAnnotation || tooltipTimeout)
|
2823 |
+
return;
|
2824 |
+
|
2825 |
+
tooltipTimeout = setTimeout(function() {
|
2826 |
+
tooltipTimeout = null;
|
2827 |
+
hideTooltip();
|
2828 |
+
}, 50);
|
2829 |
+
});
|
2830 |
+
|
2831 |
+
editor.on("changeSession", hideTooltip);
|
2832 |
+
}
|
2833 |
+
|
2834 |
+
function GutterTooltip(parentNode) {
|
2835 |
+
Tooltip.call(this, parentNode);
|
2836 |
+
}
|
2837 |
+
|
2838 |
+
oop.inherits(GutterTooltip, Tooltip);
|
2839 |
+
|
2840 |
+
(function() {
|
2841 |
+
this.setPosition = function(x, y) {
|
2842 |
+
var windowWidth = window.innerWidth || document.documentElement.clientWidth;
|
2843 |
+
var windowHeight = window.innerHeight || document.documentElement.clientHeight;
|
2844 |
+
var width = this.getWidth();
|
2845 |
+
var height = this.getHeight();
|
2846 |
+
x += 15;
|
2847 |
+
y += 15;
|
2848 |
+
if (x + width > windowWidth) {
|
2849 |
+
x -= (x + width) - windowWidth;
|
2850 |
+
}
|
2851 |
+
if (y + height > windowHeight) {
|
2852 |
+
y -= 20 + height;
|
2853 |
+
}
|
2854 |
+
Tooltip.prototype.setPosition.call(this, x, y);
|
2855 |
+
};
|
2856 |
+
|
2857 |
+
}).call(GutterTooltip.prototype);
|
2858 |
+
|
2859 |
+
|
2860 |
+
|
2861 |
+
exports.GutterHandler = GutterHandler;
|
2862 |
+
|
2863 |
+
});
|
2864 |
+
|
2865 |
+
ace.define("ace/mouse/mouse_event", ["require", "exports", "module", "ace/lib/event", "ace/lib/useragent"], function(require, exports, module) {
|
2866 |
+
"use strict";
|
2867 |
+
|
2868 |
+
var event = require("../lib/event");
|
2869 |
+
var useragent = require("../lib/useragent");
|
2870 |
+
var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
|
2871 |
+
this.domEvent = domEvent;
|
2872 |
+
this.editor = editor;
|
2873 |
+
|
2874 |
+
this.x = this.clientX = domEvent.clientX;
|
2875 |
+
this.y = this.clientY = domEvent.clientY;
|
2876 |
+
|
2877 |
+
this.$pos = null;
|
2878 |
+
this.$inSelection = null;
|
2879 |
+
|
2880 |
+
this.propagationStopped = false;
|
2881 |
+
this.defaultPrevented = false;
|
2882 |
+
};
|
2883 |
+
|
2884 |
+
(function() {
|
2885 |
+
|
2886 |
+
this.stopPropagation = function() {
|
2887 |
+
event.stopPropagation(this.domEvent);
|
2888 |
+
this.propagationStopped = true;
|
2889 |
+
};
|
2890 |
+
|
2891 |
+
this.preventDefault = function() {
|
2892 |
+
event.preventDefault(this.domEvent);
|
2893 |
+
this.defaultPrevented = true;
|
2894 |
+
};
|
2895 |
+
|
2896 |
+
this.stop = function() {
|
2897 |
+
this.stopPropagation();
|
2898 |
+
this.preventDefault();
|
2899 |
+
};
|
2900 |
+
this.getDocumentPosition = function() {
|
2901 |
+
if (this.$pos)
|
2902 |
+
return this.$pos;
|
2903 |
+
|
2904 |
+
this.$pos = this.editor.renderer.screenToTextCoordinates(this.clientX, this.clientY);
|
2905 |
+
return this.$pos;
|
2906 |
+
};
|
2907 |
+
this.inSelection = function() {
|
2908 |
+
if (this.$inSelection !== null)
|
2909 |
+
return this.$inSelection;
|
2910 |
+
|
2911 |
+
var editor = this.editor;
|
2912 |
+
|
2913 |
+
|
2914 |
+
var selectionRange = editor.getSelectionRange();
|
2915 |
+
if (selectionRange.isEmpty())
|
2916 |
+
this.$inSelection = false;
|
2917 |
+
else {
|
2918 |
+
var pos = this.getDocumentPosition();
|
2919 |
+
this.$inSelection = selectionRange.contains(pos.row, pos.column);
|
2920 |
+
}
|
2921 |
+
|
2922 |
+
return this.$inSelection;
|
2923 |
+
};
|
2924 |
+
this.getButton = function() {
|
2925 |
+
return event.getButton(this.domEvent);
|
2926 |
+
};
|
2927 |
+
this.getShiftKey = function() {
|
2928 |
+
return this.domEvent.shiftKey;
|
2929 |
+
};
|
2930 |
+
|
2931 |
+
this.getAccelKey = useragent.isMac ? function() {
|
2932 |
+
return this.domEvent.metaKey;
|
2933 |
+
} : function() {
|
2934 |
+
return this.domEvent.ctrlKey;
|
2935 |
+
};
|
2936 |
+
|
2937 |
+
}).call(MouseEvent.prototype);
|
2938 |
+
|
2939 |
+
});
|
2940 |
+
|
2941 |
+
ace.define("ace/mouse/dragdrop_handler", ["require", "exports", "module", "ace/lib/dom", "ace/lib/event", "ace/lib/useragent"], function(require, exports, module) {
|
2942 |
+
"use strict";
|
2943 |
+
|
2944 |
+
var dom = require("../lib/dom");
|
2945 |
+
var event = require("../lib/event");
|
2946 |
+
var useragent = require("../lib/useragent");
|
2947 |
+
|
2948 |
+
var AUTOSCROLL_DELAY = 200;
|
2949 |
+
var SCROLL_CURSOR_DELAY = 200;
|
2950 |
+
var SCROLL_CURSOR_HYSTERESIS = 5;
|
2951 |
+
|
2952 |
+
function DragdropHandler(mouseHandler) {
|
2953 |
+
|
2954 |
+
var editor = mouseHandler.editor;
|
2955 |
+
|
2956 |
+
var blankImage = dom.createElement("img");
|
2957 |
+
blankImage.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
|
2958 |
+
if (useragent.isOpera)
|
2959 |
+
blankImage.style.cssText = "width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;";
|
2960 |
+
|
2961 |
+
var exports = ["dragWait", "dragWaitEnd", "startDrag", "dragReadyEnd", "onMouseDrag"];
|
2962 |
+
|
2963 |
+
exports.forEach(function(x) {
|
2964 |
+
mouseHandler[x] = this[x];
|
2965 |
+
}, this);
|
2966 |
+
editor.addEventListener("mousedown", this.onMouseDown.bind(mouseHandler));
|
2967 |
+
|
2968 |
+
|
2969 |
+
var mouseTarget = editor.container;
|
2970 |
+
var dragSelectionMarker, x, y;
|
2971 |
+
var timerId, range;
|
2972 |
+
var dragCursor, counter = 0;
|
2973 |
+
var dragOperation;
|
2974 |
+
var isInternal;
|
2975 |
+
var autoScrollStartTime;
|
2976 |
+
var cursorMovedTime;
|
2977 |
+
var cursorPointOnCaretMoved;
|
2978 |
+
|
2979 |
+
this.onDragStart = function(e) {
|
2980 |
+
if (this.cancelDrag || !mouseTarget.draggable) {
|
2981 |
+
var self = this;
|
2982 |
+
setTimeout(function() {
|
2983 |
+
self.startSelect();
|
2984 |
+
self.captureMouse(e);
|
2985 |
+
}, 0);
|
2986 |
+
return e.preventDefault();
|
2987 |
+
}
|
2988 |
+
range = editor.getSelectionRange();
|
2989 |
+
|
2990 |
+
var dataTransfer = e.dataTransfer;
|
2991 |
+
dataTransfer.effectAllowed = editor.getReadOnly() ? "copy" : "copyMove";
|
2992 |
+
if (useragent.isOpera) {
|
2993 |
+
editor.container.appendChild(blankImage);
|
2994 |
+
blankImage.scrollTop = 0;
|
2995 |
+
}
|
2996 |
+
dataTransfer.setDragImage && dataTransfer.setDragImage(blankImage, 0, 0);
|
2997 |
+
if (useragent.isOpera) {
|
2998 |
+
editor.container.removeChild(blankImage);
|
2999 |
+
}
|
3000 |
+
dataTransfer.clearData();
|
3001 |
+
dataTransfer.setData("Text", editor.session.getTextRange());
|
3002 |
+
|
3003 |
+
isInternal = true;
|
3004 |
+
this.setState("drag");
|
3005 |
+
};
|
3006 |
+
|
3007 |
+
this.onDragEnd = function(e) {
|
3008 |
+
mouseTarget.draggable = false;
|
3009 |
+
isInternal = false;
|
3010 |
+
this.setState(null);
|
3011 |
+
if (!editor.getReadOnly()) {
|
3012 |
+
var dropEffect = e.dataTransfer.dropEffect;
|
3013 |
+
if (!dragOperation && dropEffect == "move")
|
3014 |
+
editor.session.remove(editor.getSelectionRange());
|
3015 |
+
editor.renderer.$cursorLayer.setBlinking(true);
|
3016 |
+
}
|
3017 |
+
this.editor.unsetStyle("ace_dragging");
|
3018 |
+
this.editor.renderer.setCursorStyle("");
|
3019 |
+
};
|
3020 |
+
|
3021 |
+
this.onDragEnter = function(e) {
|
3022 |
+
if (editor.getReadOnly() || !canAccept(e.dataTransfer))
|
3023 |
+
return;
|
3024 |
+
x = e.clientX;
|
3025 |
+
y = e.clientY;
|
3026 |
+
if (!dragSelectionMarker)
|
3027 |
+
addDragMarker();
|
3028 |
+
counter++;
|
3029 |
+
e.dataTransfer.dropEffect = dragOperation = getDropEffect(e);
|
3030 |
+
return event.preventDefault(e);
|
3031 |
+
};
|
3032 |
+
|
3033 |
+
this.onDragOver = function(e) {
|
3034 |
+
if (editor.getReadOnly() || !canAccept(e.dataTransfer))
|
3035 |
+
return;
|
3036 |
+
x = e.clientX;
|
3037 |
+
y = e.clientY;
|
3038 |
+
if (!dragSelectionMarker) {
|
3039 |
+
addDragMarker();
|
3040 |
+
counter++;
|
3041 |
+
}
|
3042 |
+
if (onMouseMoveTimer !== null)
|
3043 |
+
onMouseMoveTimer = null;
|
3044 |
+
|
3045 |
+
e.dataTransfer.dropEffect = dragOperation = getDropEffect(e);
|
3046 |
+
return event.preventDefault(e);
|
3047 |
+
};
|
3048 |
+
|
3049 |
+
this.onDragLeave = function(e) {
|
3050 |
+
counter--;
|
3051 |
+
if (counter <= 0 && dragSelectionMarker) {
|
3052 |
+
clearDragMarker();
|
3053 |
+
dragOperation = null;
|
3054 |
+
return event.preventDefault(e);
|
3055 |
+
}
|
3056 |
+
};
|
3057 |
+
|
3058 |
+
this.onDrop = function(e) {
|
3059 |
+
if (!dragCursor)
|
3060 |
+
return;
|
3061 |
+
var dataTransfer = e.dataTransfer;
|
3062 |
+
if (isInternal) {
|
3063 |
+
switch (dragOperation) {
|
3064 |
+
case "move":
|
3065 |
+
if (range.contains(dragCursor.row, dragCursor.column)) {
|
3066 |
+
range = {
|
3067 |
+
start: dragCursor,
|
3068 |
+
end: dragCursor
|
3069 |
+
};
|
3070 |
+
} else {
|
3071 |
+
range = editor.moveText(range, dragCursor);
|
3072 |
+
}
|
3073 |
+
break;
|
3074 |
+
case "copy":
|
3075 |
+
range = editor.moveText(range, dragCursor, true);
|
3076 |
+
break;
|
3077 |
+
}
|
3078 |
+
} else {
|
3079 |
+
var dropData = dataTransfer.getData('Text');
|
3080 |
+
range = {
|
3081 |
+
start: dragCursor,
|
3082 |
+
end: editor.session.insert(dragCursor, dropData)
|
3083 |
+
};
|
3084 |
+
editor.focus();
|
3085 |
+
dragOperation = null;
|
3086 |
+
}
|
3087 |
+
clearDragMarker();
|
3088 |
+
return event.preventDefault(e);
|
3089 |
+
};
|
3090 |
+
|
3091 |
+
event.addListener(mouseTarget, "dragstart", this.onDragStart.bind(mouseHandler));
|
3092 |
+
event.addListener(mouseTarget, "dragend", this.onDragEnd.bind(mouseHandler));
|
3093 |
+
event.addListener(mouseTarget, "dragenter", this.onDragEnter.bind(mouseHandler));
|
3094 |
+
event.addListener(mouseTarget, "dragover", this.onDragOver.bind(mouseHandler));
|
3095 |
+
event.addListener(mouseTarget, "dragleave", this.onDragLeave.bind(mouseHandler));
|
3096 |
+
event.addListener(mouseTarget, "drop", this.onDrop.bind(mouseHandler));
|
3097 |
+
|
3098 |
+
function scrollCursorIntoView(cursor, prevCursor) {
|
3099 |
+
var now = Date.now();
|
3100 |
+
var vMovement = !prevCursor || cursor.row != prevCursor.row;
|
3101 |
+
var hMovement = !prevCursor || cursor.column != prevCursor.column;
|
3102 |
+
if (!cursorMovedTime || vMovement || hMovement) {
|
3103 |
+
editor.$blockScrolling += 1;
|
3104 |
+
editor.moveCursorToPosition(cursor);
|
3105 |
+
editor.$blockScrolling -= 1;
|
3106 |
+
cursorMovedTime = now;
|
3107 |
+
cursorPointOnCaretMoved = {
|
3108 |
+
x: x,
|
3109 |
+
y: y
|
3110 |
+
};
|
3111 |
+
} else {
|
3112 |
+
var distance = calcDistance(cursorPointOnCaretMoved.x, cursorPointOnCaretMoved.y, x, y);
|
3113 |
+
if (distance > SCROLL_CURSOR_HYSTERESIS) {
|
3114 |
+
cursorMovedTime = null;
|
3115 |
+
} else if (now - cursorMovedTime >= SCROLL_CURSOR_DELAY) {
|
3116 |
+
editor.renderer.scrollCursorIntoView();
|
3117 |
+
cursorMovedTime = null;
|
3118 |
+
}
|
3119 |
+
}
|
3120 |
+
}
|
3121 |
+
|
3122 |
+
function autoScroll(cursor, prevCursor) {
|
3123 |
+
var now = Date.now();
|
3124 |
+
var lineHeight = editor.renderer.layerConfig.lineHeight;
|
3125 |
+
var characterWidth = editor.renderer.layerConfig.characterWidth;
|
3126 |
+
var editorRect = editor.renderer.scroller.getBoundingClientRect();
|
3127 |
+
var offsets = {
|
3128 |
+
x: {
|
3129 |
+
left: x - editorRect.left,
|
3130 |
+
right: editorRect.right - x
|
3131 |
+
},
|
3132 |
+
y: {
|
3133 |
+
top: y - editorRect.top,
|
3134 |
+
bottom: editorRect.bottom - y
|
3135 |
+
}
|
3136 |
+
};
|
3137 |
+
var nearestXOffset = Math.min(offsets.x.left, offsets.x.right);
|
3138 |
+
var nearestYOffset = Math.min(offsets.y.top, offsets.y.bottom);
|
3139 |
+
var scrollCursor = {
|
3140 |
+
row: cursor.row,
|
3141 |
+
column: cursor.column
|
3142 |
+
};
|
3143 |
+
if (nearestXOffset / characterWidth <= 2) {
|
3144 |
+
scrollCursor.column += (offsets.x.left < offsets.x.right ? -3 : +2);
|
3145 |
+
}
|
3146 |
+
if (nearestYOffset / lineHeight <= 1) {
|
3147 |
+
scrollCursor.row += (offsets.y.top < offsets.y.bottom ? -1 : +1);
|
3148 |
+
}
|
3149 |
+
var vScroll = cursor.row != scrollCursor.row;
|
3150 |
+
var hScroll = cursor.column != scrollCursor.column;
|
3151 |
+
var vMovement = !prevCursor || cursor.row != prevCursor.row;
|
3152 |
+
if (vScroll || (hScroll && !vMovement)) {
|
3153 |
+
if (!autoScrollStartTime)
|
3154 |
+
autoScrollStartTime = now;
|
3155 |
+
else if (now - autoScrollStartTime >= AUTOSCROLL_DELAY)
|
3156 |
+
editor.renderer.scrollCursorIntoView(scrollCursor);
|
3157 |
+
} else {
|
3158 |
+
autoScrollStartTime = null;
|
3159 |
+
}
|
3160 |
+
}
|
3161 |
+
|
3162 |
+
function onDragInterval() {
|
3163 |
+
var prevCursor = dragCursor;
|
3164 |
+
dragCursor = editor.renderer.screenToTextCoordinates(x, y);
|
3165 |
+
scrollCursorIntoView(dragCursor, prevCursor);
|
3166 |
+
autoScroll(dragCursor, prevCursor);
|
3167 |
+
}
|
3168 |
+
|
3169 |
+
function addDragMarker() {
|
3170 |
+
range = editor.selection.toOrientedRange();
|
3171 |
+
dragSelectionMarker = editor.session.addMarker(range, "ace_selection", editor.getSelectionStyle());
|
3172 |
+
editor.clearSelection();
|
3173 |
+
if (editor.isFocused())
|
3174 |
+
editor.renderer.$cursorLayer.setBlinking(false);
|
3175 |
+
clearInterval(timerId);
|
3176 |
+
onDragInterval();
|
3177 |
+
timerId = setInterval(onDragInterval, 20);
|
3178 |
+
counter = 0;
|
3179 |
+
event.addListener(document, "mousemove", onMouseMove);
|
3180 |
+
}
|
3181 |
+
|
3182 |
+
function clearDragMarker() {
|
3183 |
+
clearInterval(timerId);
|
3184 |
+
editor.session.removeMarker(dragSelectionMarker);
|
3185 |
+
dragSelectionMarker = null;
|
3186 |
+
editor.$blockScrolling += 1;
|
3187 |
+
editor.selection.fromOrientedRange(range);
|
3188 |
+
editor.$blockScrolling -= 1;
|
3189 |
+
if (editor.isFocused() && !isInternal)
|
3190 |
+
editor.renderer.$cursorLayer.setBlinking(!editor.getReadOnly());
|
3191 |
+
range = null;
|
3192 |
+
dragCursor = null;
|
3193 |
+
counter = 0;
|
3194 |
+
autoScrollStartTime = null;
|
3195 |
+
cursorMovedTime = null;
|
3196 |
+
event.removeListener(document, "mousemove", onMouseMove);
|
3197 |
+
}
|
3198 |
+
var onMouseMoveTimer = null;
|
3199 |
+
|
3200 |
+
function onMouseMove() {
|
3201 |
+
if (onMouseMoveTimer == null) {
|
3202 |
+
onMouseMoveTimer = setTimeout(function() {
|
3203 |
+
if (onMouseMoveTimer != null && dragSelectionMarker)
|
3204 |
+
clearDragMarker();
|
3205 |
+
}, 20);
|
3206 |
+
}
|
3207 |
+
}
|
3208 |
+
|
3209 |
+
function canAccept(dataTransfer) {
|
3210 |
+
var types = dataTransfer.types;
|
3211 |
+
return !types || Array.prototype.some.call(types, function(type) {
|
3212 |
+
return type == 'text/plain' || type == 'Text';
|
3213 |
+
});
|
3214 |
+
}
|
3215 |
+
|
3216 |
+
function getDropEffect(e) {
|
3217 |
+
var copyAllowed = ['copy', 'copymove', 'all', 'uninitialized'];
|
3218 |
+
var moveAllowed = ['move', 'copymove', 'linkmove', 'all', 'uninitialized'];
|
3219 |
+
|
3220 |
+
var copyModifierState = useragent.isMac ? e.altKey : e.ctrlKey;
|
3221 |
+
var effectAllowed = "uninitialized";
|
3222 |
+
try {
|
3223 |
+
effectAllowed = e.dataTransfer.effectAllowed.toLowerCase();
|
3224 |
+
} catch (e) {}
|
3225 |
+
var dropEffect = "none";
|
3226 |
+
|
3227 |
+
if (copyModifierState && copyAllowed.indexOf(effectAllowed) >= 0)
|
3228 |
+
dropEffect = "copy";
|
3229 |
+
else if (moveAllowed.indexOf(effectAllowed) >= 0)
|
3230 |
+
dropEffect = "move";
|
3231 |
+
else if (copyAllowed.indexOf(effectAllowed) >= 0)
|
3232 |
+
dropEffect = "copy";
|
3233 |
+
|
3234 |
+
return dropEffect;
|
3235 |
+
}
|
3236 |
+
}
|
3237 |
+
|
3238 |
+
(function() {
|
3239 |
+
|
3240 |
+
this.dragWait = function() {
|
3241 |
+
var interval = Date.now() - this.mousedownEvent.time;
|
3242 |
+
if (interval > this.editor.getDragDelay())
|
3243 |
+
this.startDrag();
|
3244 |
+
};
|
3245 |
+
|
3246 |
+
this.dragWaitEnd = function() {
|
3247 |
+
var target = this.editor.container;
|
3248 |
+
target.draggable = false;
|
3249 |
+
this.startSelect(this.mousedownEvent.getDocumentPosition());
|
3250 |
+
this.selectEnd();
|
3251 |
+
};
|
3252 |
+
|
3253 |
+
this.dragReadyEnd = function(e) {
|
3254 |
+
this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly());
|
3255 |
+
this.editor.unsetStyle("ace_dragging");
|
3256 |
+
this.editor.renderer.setCursorStyle("");
|
3257 |
+
this.dragWaitEnd();
|
3258 |
+
};
|
3259 |
+
|
3260 |
+
this.startDrag = function() {
|
3261 |
+
this.cancelDrag = false;
|
3262 |
+
var editor = this.editor;
|
3263 |
+
var target = editor.container;
|
3264 |
+
target.draggable = true;
|
3265 |
+
editor.renderer.$cursorLayer.setBlinking(false);
|
3266 |
+
editor.setStyle("ace_dragging");
|
3267 |
+
var cursorStyle = useragent.isWin ? "default" : "move";
|
3268 |
+
editor.renderer.setCursorStyle(cursorStyle);
|
3269 |
+
this.setState("dragReady");
|
3270 |
+
};
|
3271 |
+
|
3272 |
+
this.onMouseDrag = function(e) {
|
3273 |
+
var target = this.editor.container;
|
3274 |
+
if (useragent.isIE && this.state == "dragReady") {
|
3275 |
+
var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
|
3276 |
+
if (distance > 3)
|
3277 |
+
target.dragDrop();
|
3278 |
+
}
|
3279 |
+
if (this.state === "dragWait") {
|
3280 |
+
var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
|
3281 |
+
if (distance > 0) {
|
3282 |
+
target.draggable = false;
|
3283 |
+
this.startSelect(this.mousedownEvent.getDocumentPosition());
|
3284 |
+
}
|
3285 |
+
}
|
3286 |
+
};
|
3287 |
+
|
3288 |
+
this.onMouseDown = function(e) {
|
3289 |
+
if (!this.$dragEnabled)
|
3290 |
+
return;
|
3291 |
+
this.mousedownEvent = e;
|
3292 |
+
var editor = this.editor;
|
3293 |
+
|
3294 |
+
var inSelection = e.inSelection();
|
3295 |
+
var button = e.getButton();
|
3296 |
+
var clickCount = e.domEvent.detail || 1;
|
3297 |
+
if (clickCount === 1 && button === 0 && inSelection) {
|
3298 |
+
if (e.editor.inMultiSelectMode && (e.getAccelKey() || e.getShiftKey()))
|
3299 |
+
return;
|
3300 |
+
this.mousedownEvent.time = Date.now();
|
3301 |
+
var eventTarget = e.domEvent.target || e.domEvent.srcElement;
|
3302 |
+
if ("unselectable" in eventTarget)
|
3303 |
+
eventTarget.unselectable = "on";
|
3304 |
+
if (editor.getDragDelay()) {
|
3305 |
+
if (useragent.isWebKit) {
|
3306 |
+
this.cancelDrag = true;
|
3307 |
+
var mouseTarget = editor.container;
|
3308 |
+
mouseTarget.draggable = true;
|
3309 |
+
}
|
3310 |
+
this.setState("dragWait");
|
3311 |
+
} else {
|
3312 |
+
this.startDrag();
|
3313 |
+
}
|
3314 |
+
this.captureMouse(e, this.onMouseDrag.bind(this));
|
3315 |
+
e.defaultPrevented = true;
|
3316 |
+
}
|
3317 |
+
};
|
3318 |
+
|
3319 |
+
}).call(DragdropHandler.prototype);
|
3320 |
+
|
3321 |
+
|
3322 |
+
function calcDistance(ax, ay, bx, by) {
|
3323 |
+
return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
|
3324 |
+
}
|
3325 |
+
|
3326 |
+
exports.DragdropHandler = DragdropHandler;
|
3327 |
+
|
3328 |
+
});
|
3329 |
+
|
3330 |
+
ace.define("ace/lib/net", ["require", "exports", "module", "ace/lib/dom"], function(require, exports, module) {
|
3331 |
+
"use strict";
|
3332 |
+
var dom = require("./dom");
|
3333 |
+
|
3334 |
+
exports.get = function(url, callback) {
|
3335 |
+
var xhr = new XMLHttpRequest();
|
3336 |
+
xhr.open('GET', url, true);
|
3337 |
+
xhr.onreadystatechange = function() {
|
3338 |
+
if (xhr.readyState === 4) {
|
3339 |
+
callback(xhr.responseText);
|
3340 |
+
}
|
3341 |
+
};
|
3342 |
+
xhr.send(null);
|
3343 |
+
};
|
3344 |
+
|
3345 |
+
exports.loadScript = function(path, callback) {
|
3346 |
+
var head = dom.getDocumentHead();
|
3347 |
+
var s = document.createElement('script');
|
3348 |
+
|
3349 |
+
s.src = path;
|
3350 |
+
head.appendChild(s);
|
3351 |
+
|
3352 |
+
s.onload = s.onreadystatechange = function(_, isAbort) {
|
3353 |
+
if (isAbort || !s.readyState || s.readyState == "loaded" || s.readyState == "complete") {
|
3354 |
+
s = s.onload = s.onreadystatechange = null;
|
3355 |
+
if (!isAbort)
|
3356 |
+
callback();
|
3357 |
+
}
|
3358 |
+
};
|
3359 |
+
};
|
3360 |
+
exports.qualifyURL = function(url) {
|
3361 |
+
var a = document.createElement('a');
|
3362 |
+
a.href = url;
|
3363 |
+
return a.href;
|
3364 |
+
}
|
3365 |
+
|
3366 |
+
});
|
3367 |
+
|
3368 |
+
ace.define("ace/lib/event_emitter", ["require", "exports", "module"], function(require, exports, module) {
|
3369 |
+
"use strict";
|
3370 |
+
|
3371 |
+
var EventEmitter = {};
|
3372 |
+
var stopPropagation = function() {
|
3373 |
+
this.propagationStopped = true;
|
3374 |
+
};
|
3375 |
+
var preventDefault = function() {
|
3376 |
+
this.defaultPrevented = true;
|
3377 |
+
};
|
3378 |
+
|
3379 |
+
EventEmitter._emit =
|
3380 |
+
EventEmitter._dispatchEvent = function(eventName, e) {
|
3381 |
+
this._eventRegistry || (this._eventRegistry = {});
|
3382 |
+
this._defaultHandlers || (this._defaultHandlers = {});
|
3383 |
+
|
3384 |
+
var listeners = this._eventRegistry[eventName] || [];
|
3385 |
+
var defaultHandler = this._defaultHandlers[eventName];
|
3386 |
+
if (!listeners.length && !defaultHandler)
|
3387 |
+
return;
|
3388 |
+
|
3389 |
+
if (typeof e != "object" || !e)
|
3390 |
+
e = {};
|
3391 |
+
|
3392 |
+
if (!e.type)
|
3393 |
+
e.type = eventName;
|
3394 |
+
if (!e.stopPropagation)
|
3395 |
+
e.stopPropagation = stopPropagation;
|
3396 |
+
if (!e.preventDefault)
|
3397 |
+
e.preventDefault = preventDefault;
|
3398 |
+
|
3399 |
+
listeners = listeners.slice();
|
3400 |
+
for (var i = 0; i < listeners.length; i++) {
|
3401 |
+
listeners[i](e, this);
|
3402 |
+
if (e.propagationStopped)
|
3403 |
+
break;
|
3404 |
+
}
|
3405 |
+
|
3406 |
+
if (defaultHandler && !e.defaultPrevented)
|
3407 |
+
return defaultHandler(e, this);
|
3408 |
+
};
|
3409 |
+
|
3410 |
+
|
3411 |
+
EventEmitter._signal = function(eventName, e) {
|
3412 |
+
var listeners = (this._eventRegistry || {})[eventName];
|
3413 |
+
if (!listeners)
|
3414 |
+
return;
|
3415 |
+
listeners = listeners.slice();
|
3416 |
+
for (var i = 0; i < listeners.length; i++)
|
3417 |
+
listeners[i](e, this);
|
3418 |
+
};
|
3419 |
+
|
3420 |
+
EventEmitter.once = function(eventName, callback) {
|
3421 |
+
var _self = this;
|
3422 |
+
callback && this.addEventListener(eventName, function newCallback() {
|
3423 |
+
_self.removeEventListener(eventName, newCallback);
|
3424 |
+
callback.apply(null, arguments);
|
3425 |
+
});
|
3426 |
+
};
|
3427 |
+
|
3428 |
+
|
3429 |
+
EventEmitter.setDefaultHandler = function(eventName, callback) {
|
3430 |
+
var handlers = this._defaultHandlers
|
3431 |
+
if (!handlers)
|
3432 |
+
handlers = this._defaultHandlers = {
|
3433 |
+
_disabled_: {}
|
3434 |
+
};
|
3435 |
+
|
3436 |
+
if (handlers[eventName]) {
|
3437 |
+
var old = handlers[eventName];
|
3438 |
+
var disabled = handlers._disabled_[eventName];
|
3439 |
+
if (!disabled)
|
3440 |
+
handlers._disabled_[eventName] = disabled = [];
|
3441 |
+
disabled.push(old);
|
3442 |
+
var i = disabled.indexOf(callback);
|
3443 |
+
if (i != -1)
|
3444 |
+
disabled.splice(i, 1);
|
3445 |
+
}
|
3446 |
+
handlers[eventName] = callback;
|
3447 |
+
};
|
3448 |
+
EventEmitter.removeDefaultHandler = function(eventName, callback) {
|
3449 |
+
var handlers = this._defaultHandlers
|
3450 |
+
if (!handlers)
|
3451 |
+
return;
|
3452 |
+
var disabled = handlers._disabled_[eventName];
|
3453 |
+
|
3454 |
+
if (handlers[eventName] == callback) {
|
3455 |
+
var old = handlers[eventName];
|
3456 |
+
if (disabled)
|
3457 |
+
this.setDefaultHandler(eventName, disabled.pop());
|
3458 |
+
} else if (disabled) {
|
3459 |
+
var i = disabled.indexOf(callback);
|
3460 |
+
if (i != -1)
|
3461 |
+
disabled.splice(i, 1);
|
3462 |
+
}
|
3463 |
+
};
|
3464 |
+
|
3465 |
+
EventEmitter.on =
|
3466 |
+
EventEmitter.addEventListener = function(eventName, callback, capturing) {
|
3467 |
+
this._eventRegistry = this._eventRegistry || {};
|
3468 |
+
|
3469 |
+
var listeners = this._eventRegistry[eventName];
|
3470 |
+
if (!listeners)
|
3471 |
+
listeners = this._eventRegistry[eventName] = [];
|
3472 |
+
|
3473 |
+
if (listeners.indexOf(callback) == -1)
|
3474 |
+
listeners[capturing ? "unshift" : "push"](callback);
|
3475 |
+
return callback;
|
3476 |
+
};
|
3477 |
+
|
3478 |
+
EventEmitter.off =
|
3479 |
+
EventEmitter.removeListener =
|
3480 |
+
EventEmitter.removeEventListener = function(eventName, callback) {
|
3481 |
+
this._eventRegistry = this._eventRegistry || {};
|
3482 |
+
|
3483 |
+
var listeners = this._eventRegistry[eventName];
|
3484 |
+
if (!listeners)
|
3485 |
+
return;
|
3486 |
+
|
3487 |
+
var index = listeners.indexOf(callback);
|
3488 |
+
if (index !== -1)
|
3489 |
+
listeners.splice(index, 1);
|
3490 |
+
};
|
3491 |
+
|
3492 |
+
EventEmitter.removeAllListeners = function(eventName) {
|
3493 |
+
if (this._eventRegistry) this._eventRegistry[eventName] = [];
|
3494 |
+
};
|
3495 |
+
|
3496 |
+
exports.EventEmitter = EventEmitter;
|
3497 |
+
|
3498 |
+
});
|
3499 |
+
|
3500 |
+
ace.define("ace/config", ["require", "exports", "module", "ace/lib/lang", "ace/lib/oop", "ace/lib/net", "ace/lib/event_emitter"], function(require, exports, module) {
|
3501 |
+
"no use strict";
|
3502 |
+
|
3503 |
+
var lang = require("./lib/lang");
|
3504 |
+
var oop = require("./lib/oop");
|
3505 |
+
var net = require("./lib/net");
|
3506 |
+
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
3507 |
+
|
3508 |
+
var global = (function() {
|
3509 |
+
return this;
|
3510 |
+
})();
|
3511 |
+
|
3512 |
+
var options = {
|
3513 |
+
packaged: false,
|
3514 |
+
workerPath: null,
|
3515 |
+
modePath: null,
|
3516 |
+
themePath: null,
|
3517 |
+
basePath: "",
|
3518 |
+
suffix: ".js",
|
3519 |
+
$moduleUrls: {}
|
3520 |
+
};
|
3521 |
+
|
3522 |
+
exports.get = function(key) {
|
3523 |
+
if (!options.hasOwnProperty(key))
|
3524 |
+
throw new Error("Unknown config key: " + key);
|
3525 |
+
|
3526 |
+
return options[key];
|
3527 |
+
};
|
3528 |
+
|
3529 |
+
exports.set = function(key, value) {
|
3530 |
+
if (!options.hasOwnProperty(key))
|
3531 |
+
throw new Error("Unknown config key: " + key);
|
3532 |
+
|
3533 |
+
options[key] = value;
|
3534 |
+
};
|
3535 |
+
|
3536 |
+
exports.all = function() {
|
3537 |
+
return lang.copyObject(options);
|
3538 |
+
};
|
3539 |
+
oop.implement(exports, EventEmitter);
|
3540 |
+
|
3541 |
+
exports.moduleUrl = function(name, component) {
|
3542 |
+
if (options.$moduleUrls[name])
|
3543 |
+
return options.$moduleUrls[name];
|
3544 |
+
|
3545 |
+
var parts = name.split("/");
|
3546 |
+
component = component || parts[parts.length - 2] || "";
|
3547 |
+
var sep = component == "snippets" ? "/" : "-";
|
3548 |
+
var base = parts[parts.length - 1];
|
3549 |
+
if (component == "worker" && sep == "-") {
|
3550 |
+
var re = new RegExp("^" + component + "[\\-_]|[\\-_]" + component + "$", "g");
|
3551 |
+
base = base.replace(re, "");
|
3552 |
+
}
|
3553 |
+
|
3554 |
+
if ((!base || base == component) && parts.length > 1)
|
3555 |
+
base = parts[parts.length - 2];
|
3556 |
+
var path = options[component + "Path"];
|
3557 |
+
if (path == null) {
|
3558 |
+
path = options.basePath;
|
3559 |
+
} else if (sep == "/") {
|
3560 |
+
component = sep = "";
|
3561 |
+
}
|
3562 |
+
if (path && path.slice(-1) != "/")
|
3563 |
+
path += "/";
|
3564 |
+
return path + component + sep + base + this.get("suffix");
|
3565 |
+
};
|
3566 |
+
|
3567 |
+
exports.setModuleUrl = function(name, subst) {
|
3568 |
+
return options.$moduleUrls[name] = subst;
|
3569 |
+
};
|
3570 |
+
|
3571 |
+
exports.$loading = {};
|
3572 |
+
exports.loadModule = function(moduleName, onLoad) {
|
3573 |
+
var module, moduleType;
|
3574 |
+
if (Array.isArray(moduleName)) {
|
3575 |
+
moduleType = moduleName[0];
|
3576 |
+
moduleName = moduleName[1];
|
3577 |
+
}
|
3578 |
+
|
3579 |
+
try {
|
3580 |
+
module = require(moduleName);
|
3581 |
+
} catch (e) {}
|
3582 |
+
if (module && !exports.$loading[moduleName])
|
3583 |
+
return onLoad && onLoad(module);
|
3584 |
+
|
3585 |
+
if (!exports.$loading[moduleName])
|
3586 |
+
exports.$loading[moduleName] = [];
|
3587 |
+
|
3588 |
+
exports.$loading[moduleName].push(onLoad);
|
3589 |
+
|
3590 |
+
if (exports.$loading[moduleName].length > 1)
|
3591 |
+
return;
|
3592 |
+
|
3593 |
+
var afterLoad = function() {
|
3594 |
+
require([moduleName], function(module) {
|
3595 |
+
exports._emit("load.module", {
|
3596 |
+
name: moduleName,
|
3597 |
+
module: module
|
3598 |
+
});
|
3599 |
+
var listeners = exports.$loading[moduleName];
|
3600 |
+
exports.$loading[moduleName] = null;
|
3601 |
+
listeners.forEach(function(onLoad) {
|
3602 |
+
onLoad && onLoad(module);
|
3603 |
+
});
|
3604 |
+
});
|
3605 |
+
};
|
3606 |
+
|
3607 |
+
if (!exports.get("packaged"))
|
3608 |
+
return afterLoad();
|
3609 |
+
net.loadScript(exports.moduleUrl(moduleName, moduleType), afterLoad);
|
3610 |
+
};
|
3611 |
+
init(true);
|
3612 |
+
|
3613 |
+
function init(packaged) {
|
3614 |
+
|
3615 |
+
options.packaged = packaged || require.packaged || module.packaged || (global.define && define.packaged);
|
3616 |
+
|
3617 |
+
if (!global.document)
|
3618 |
+
return "";
|
3619 |
+
|
3620 |
+
var scriptOptions = {};
|
3621 |
+
var scriptUrl = "";
|
3622 |
+
var currentScript = (document.currentScript || document._currentScript); // native or polyfill
|
3623 |
+
var currentDocument = currentScript && currentScript.ownerDocument || document;
|
3624 |
+
|
3625 |
+
var scripts = currentDocument.getElementsByTagName("script");
|
3626 |
+
for (var i = 0; i < scripts.length; i++) {
|
3627 |
+
var script = scripts[i];
|
3628 |
+
|
3629 |
+
var src = script.src || script.getAttribute("src");
|
3630 |
+
if (!src)
|
3631 |
+
continue;
|
3632 |
+
|
3633 |
+
var attributes = script.attributes;
|
3634 |
+
for (var j = 0, l = attributes.length; j < l; j++) {
|
3635 |
+
var attr = attributes[j];
|
3636 |
+
if (attr.name.indexOf("data-ace-") === 0) {
|
3637 |
+
scriptOptions[deHyphenate(attr.name.replace(/^data-ace-/, ""))] = attr.value;
|
3638 |
+
}
|
3639 |
+
}
|
3640 |
+
|
3641 |
+
var m = src.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/);
|
3642 |
+
if (m)
|
3643 |
+
scriptUrl = m[1];
|
3644 |
+
}
|
3645 |
+
|
3646 |
+
if (scriptUrl) {
|
3647 |
+
scriptOptions.base = scriptOptions.base || scriptUrl;
|
3648 |
+
scriptOptions.packaged = true;
|
3649 |
+
}
|
3650 |
+
|
3651 |
+
scriptOptions.basePath = scriptOptions.base;
|
3652 |
+
scriptOptions.workerPath = scriptOptions.workerPath || scriptOptions.base;
|
3653 |
+
scriptOptions.modePath = scriptOptions.modePath || scriptOptions.base;
|
3654 |
+
scriptOptions.themePath = scriptOptions.themePath || scriptOptions.base;
|
3655 |
+
delete scriptOptions.base;
|
3656 |
+
|
3657 |
+
for (var key in scriptOptions)
|
3658 |
+
if (typeof scriptOptions[key] !== "undefined")
|
3659 |
+
exports.set(key, scriptOptions[key]);
|
3660 |
+
};
|
3661 |
+
|
3662 |
+
exports.init = init;
|
3663 |
+
|
3664 |
+
function deHyphenate(str) {
|
3665 |
+
return str.replace(/-(.)/g, function(m, m1) {
|
3666 |
+
return m1.toUpperCase();
|
3667 |
+
});
|
3668 |
+
}
|
3669 |
+
|
3670 |
+
var optionsProvider = {
|
3671 |
+
setOptions: function(optList) {
|
3672 |
+
Object.keys(optList).forEach(function(key) {
|
3673 |
+
this.setOption(key, optList[key]);
|
3674 |
+
}, this);
|
3675 |
+
},
|
3676 |
+
getOptions: function(optionNames) {
|
3677 |
+
var result = {};
|
3678 |
+
if (!optionNames) {
|
3679 |
+
optionNames = Object.keys(this.$options);
|
3680 |
+
} else if (!Array.isArray(optionNames)) {
|
3681 |
+
result = optionNames;
|
3682 |
+
optionNames = Object.keys(result);
|
3683 |
+
}
|
3684 |
+
optionNames.forEach(function(key) {
|
3685 |
+
result[key] = this.getOption(key);
|
3686 |
+
}, this);
|
3687 |
+
return result;
|
3688 |
+
},
|
3689 |
+
setOption: function(name, value) {
|
3690 |
+
if (this["$" + name] === value)
|
3691 |
+
return;
|
3692 |
+
var opt = this.$options[name];
|
3693 |
+
if (!opt) {
|
3694 |
+
if (typeof console != "undefined" && console.warn)
|
3695 |
+
console.warn('misspelled option "' + name + '"');
|
3696 |
+
return undefined;
|
3697 |
+
}
|
3698 |
+
if (opt.forwardTo)
|
3699 |
+
return this[opt.forwardTo] && this[opt.forwardTo].setOption(name, value);
|
3700 |
+
|
3701 |
+
if (!opt.handlesSet)
|
3702 |
+
this["$" + name] = value;
|
3703 |
+
if (opt && opt.set)
|
3704 |
+
opt.set.call(this, value);
|
3705 |
+
},
|
3706 |
+
getOption: function(name) {
|
3707 |
+
var opt = this.$options[name];
|
3708 |
+
if (!opt) {
|
3709 |
+
if (typeof console != "undefined" && console.warn)
|
3710 |
+
console.warn('misspelled option "' + name + '"');
|
3711 |
+
return undefined;
|
3712 |
+
}
|
3713 |
+
if (opt.forwardTo)
|
3714 |
+
return this[opt.forwardTo] && this[opt.forwardTo].getOption(name);
|
3715 |
+
return opt && opt.get ? opt.get.call(this) : this["$" + name];
|
3716 |
+
}
|
3717 |
+
};
|
3718 |
+
|
3719 |
+
var defaultOptions = {};
|
3720 |
+
exports.defineOptions = function(obj, path, options) {
|
3721 |
+
if (!obj.$options)
|
3722 |
+
defaultOptions[path] = obj.$options = {};
|
3723 |
+
|
3724 |
+
Object.keys(options).forEach(function(key) {
|
3725 |
+
var opt = options[key];
|
3726 |
+
if (typeof opt == "string")
|
3727 |
+
opt = {
|
3728 |
+
forwardTo: opt
|
3729 |
+
};
|
3730 |
+
|
3731 |
+
opt.name || (opt.name = key);
|
3732 |
+
obj.$options[opt.name] = opt;
|
3733 |
+
if ("initialValue" in opt)
|
3734 |
+
obj["$" + opt.name] = opt.initialValue;
|
3735 |
+
});
|
3736 |
+
oop.implement(obj, optionsProvider);
|
3737 |
+
|
3738 |
+
return this;
|
3739 |
+
};
|
3740 |
+
|
3741 |
+
exports.resetOptions = function(obj) {
|
3742 |
+
Object.keys(obj.$options).forEach(function(key) {
|
3743 |
+
var opt = obj.$options[key];
|
3744 |
+
if ("value" in opt)
|
3745 |
+
obj.setOption(key, opt.value);
|
3746 |
+
});
|
3747 |
+
};
|
3748 |
+
|
3749 |
+
exports.setDefaultValue = function(path, name, value) {
|
3750 |
+
var opts = defaultOptions[path] || (defaultOptions[path] = {});
|
3751 |
+
if (opts[name]) {
|
3752 |
+
if (opts.forwardTo)
|
3753 |
+
exports.setDefaultValue(opts.forwardTo, name, value);
|
3754 |
+
else
|
3755 |
+
opts[name].value = value;
|
3756 |
+
}
|
3757 |
+
};
|
3758 |
+
|
3759 |
+
exports.setDefaultValues = function(path, optionHash) {
|
3760 |
+
Object.keys(optionHash).forEach(function(key) {
|
3761 |
+
exports.setDefaultValue(path, key, optionHash[key]);
|
3762 |
+
});
|
3763 |
+
};
|
3764 |
+
|
3765 |
+
});
|
3766 |
+
|
3767 |
+
ace.define("ace/mouse/mouse_handler", ["require", "exports", "module", "ace/lib/event", "ace/lib/useragent", "ace/mouse/default_handlers", "ace/mouse/default_gutter_handler", "ace/mouse/mouse_event", "ace/mouse/dragdrop_handler", "ace/config"], function(require, exports, module) {
|
3768 |
+
"use strict";
|
3769 |
+
|
3770 |
+
var event = require("../lib/event");
|
3771 |
+
var useragent = require("../lib/useragent");
|
3772 |
+
var DefaultHandlers = require("./default_handlers").DefaultHandlers;
|
3773 |
+
var DefaultGutterHandler = require("./default_gutter_handler").GutterHandler;
|
3774 |
+
var MouseEvent = require("./mouse_event").MouseEvent;
|
3775 |
+
var DragdropHandler = require("./dragdrop_handler").DragdropHandler;
|
3776 |
+
var config = require("../config");
|
3777 |
+
|
3778 |
+
var MouseHandler = function(editor) {
|
3779 |
+
var _self = this;
|
3780 |
+
this.editor = editor;
|
3781 |
+
|
3782 |
+
new DefaultHandlers(this);
|
3783 |
+
new DefaultGutterHandler(this);
|
3784 |
+
new DragdropHandler(this);
|
3785 |
+
|
3786 |
+
var focusEditor = function(e) {
|
3787 |
+
if (!editor.isFocused() && editor.textInput)
|
3788 |
+
editor.textInput.moveToMouse(e);
|
3789 |
+
editor.focus()
|
3790 |
+
};
|
3791 |
+
|
3792 |
+
var mouseTarget = editor.renderer.getMouseEventTarget();
|
3793 |
+
event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click"));
|
3794 |
+
event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove"));
|
3795 |
+
event.addMultiMouseDownListener(mouseTarget, [400, 300, 250], this, "onMouseEvent");
|
3796 |
+
if (editor.renderer.scrollBarV) {
|
3797 |
+
event.addMultiMouseDownListener(editor.renderer.scrollBarV.inner, [400, 300, 250], this, "onMouseEvent");
|
3798 |
+
event.addMultiMouseDownListener(editor.renderer.scrollBarH.inner, [400, 300, 250], this, "onMouseEvent");
|
3799 |
+
if (useragent.isIE) {
|
3800 |
+
event.addListener(editor.renderer.scrollBarV.element, "mousedown", focusEditor);
|
3801 |
+
event.addListener(editor.renderer.scrollBarH.element, "mousemove", focusEditor);
|
3802 |
+
}
|
3803 |
+
}
|
3804 |
+
event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel"));
|
3805 |
+
|
3806 |
+
var gutterEl = editor.renderer.$gutter;
|
3807 |
+
event.addListener(gutterEl, "mousedown", this.onMouseEvent.bind(this, "guttermousedown"));
|
3808 |
+
event.addListener(gutterEl, "click", this.onMouseEvent.bind(this, "gutterclick"));
|
3809 |
+
event.addListener(gutterEl, "dblclick", this.onMouseEvent.bind(this, "gutterdblclick"));
|
3810 |
+
event.addListener(gutterEl, "mousemove", this.onMouseEvent.bind(this, "guttermousemove"));
|
3811 |
+
|
3812 |
+
event.addListener(mouseTarget, "mousedown", focusEditor);
|
3813 |
+
|
3814 |
+
event.addListener(gutterEl, "mousedown", function(e) {
|
3815 |
+
editor.focus();
|
3816 |
+
return event.preventDefault(e);
|
3817 |
+
});
|
3818 |
+
|
3819 |
+
editor.on("mousemove", function(e) {
|
3820 |
+
if (_self.state || _self.$dragDelay || !_self.$dragEnabled)
|
3821 |
+
return;
|
3822 |
+
|
3823 |
+
var char = editor.renderer.screenToTextCoordinates(e.x, e.y);
|
3824 |
+
var range = editor.session.selection.getRange();
|
3825 |
+
var renderer = editor.renderer;
|
3826 |
+
|
3827 |
+
if (!range.isEmpty() && range.insideStart(char.row, char.column)) {
|
3828 |
+
renderer.setCursorStyle("default");
|
3829 |
+
} else {
|
3830 |
+
renderer.setCursorStyle("");
|
3831 |
+
}
|
3832 |
+
});
|
3833 |
+
};
|
3834 |
+
|
3835 |
+
(function() {
|
3836 |
+
this.onMouseEvent = function(name, e) {
|
3837 |
+
this.editor._emit(name, new MouseEvent(e, this.editor));
|
3838 |
+
};
|
3839 |
+
|
3840 |
+
this.onMouseMove = function(name, e) {
|
3841 |
+
var listeners = this.editor._eventRegistry && this.editor._eventRegistry.mousemove;
|
3842 |
+
if (!listeners || !listeners.length)
|
3843 |
+
return;
|
3844 |
+
|
3845 |
+
this.editor._emit(name, new MouseEvent(e, this.editor));
|
3846 |
+
};
|
3847 |
+
|
3848 |
+
this.onMouseWheel = function(name, e) {
|
3849 |
+
var mouseEvent = new MouseEvent(e, this.editor);
|
3850 |
+
mouseEvent.speed = this.$scrollSpeed * 2;
|
3851 |
+
mouseEvent.wheelX = e.wheelX;
|
3852 |
+
mouseEvent.wheelY = e.wheelY;
|
3853 |
+
|
3854 |
+
this.editor._emit(name, mouseEvent);
|
3855 |
+
};
|
3856 |
+
|
3857 |
+
this.setState = function(state) {
|
3858 |
+
this.state = state;
|
3859 |
+
};
|
3860 |
+
|
3861 |
+
this.captureMouse = function(ev, mouseMoveHandler) {
|
3862 |
+
this.x = ev.x;
|
3863 |
+
this.y = ev.y;
|
3864 |
+
|
3865 |
+
this.isMousePressed = true;
|
3866 |
+
var renderer = this.editor.renderer;
|
3867 |
+
if (renderer.$keepTextAreaAtCursor)
|
3868 |
+
renderer.$keepTextAreaAtCursor = null;
|
3869 |
+
|
3870 |
+
var self = this;
|
3871 |
+
var onMouseMove = function(e) {
|
3872 |
+
if (!e) return;
|
3873 |
+
if (useragent.isWebKit && !e.which && self.releaseMouse)
|
3874 |
+
return self.releaseMouse();
|
3875 |
+
|
3876 |
+
self.x = e.clientX;
|
3877 |
+
self.y = e.clientY;
|
3878 |
+
mouseMoveHandler && mouseMoveHandler(e);
|
3879 |
+
self.mouseEvent = new MouseEvent(e, self.editor);
|
3880 |
+
self.$mouseMoved = true;
|
3881 |
+
};
|
3882 |
+
|
3883 |
+
var onCaptureEnd = function(e) {
|
3884 |
+
clearInterval(timerId);
|
3885 |
+
onCaptureInterval();
|
3886 |
+
self[self.state + "End"] && self[self.state + "End"](e);
|
3887 |
+
self.state = "";
|
3888 |
+
if (renderer.$keepTextAreaAtCursor == null) {
|
3889 |
+
renderer.$keepTextAreaAtCursor = true;
|
3890 |
+
renderer.$moveTextAreaToCursor();
|
3891 |
+
}
|
3892 |
+
self.isMousePressed = false;
|
3893 |
+
self.$onCaptureMouseMove = self.releaseMouse = null;
|
3894 |
+
e && self.onMouseEvent("mouseup", e);
|
3895 |
+
};
|
3896 |
+
|
3897 |
+
var onCaptureInterval = function() {
|
3898 |
+
self[self.state] && self[self.state]();
|
3899 |
+
self.$mouseMoved = false;
|
3900 |
+
};
|
3901 |
+
|
3902 |
+
if (useragent.isOldIE && ev.domEvent.type == "dblclick") {
|
3903 |
+
return setTimeout(function() {
|
3904 |
+
onCaptureEnd(ev);
|
3905 |
+
});
|
3906 |
+
}
|
3907 |
+
|
3908 |
+
self.$onCaptureMouseMove = onMouseMove;
|
3909 |
+
self.releaseMouse = event.capture(this.editor.container, onMouseMove, onCaptureEnd);
|
3910 |
+
var timerId = setInterval(onCaptureInterval, 20);
|
3911 |
+
};
|
3912 |
+
this.releaseMouse = null;
|
3913 |
+
this.cancelContextMenu = function() {
|
3914 |
+
var stop = function(e) {
|
3915 |
+
if (e && e.domEvent && e.domEvent.type != "contextmenu")
|
3916 |
+
return;
|
3917 |
+
this.editor.off("nativecontextmenu", stop);
|
3918 |
+
if (e && e.domEvent)
|
3919 |
+
event.stopEvent(e.domEvent);
|
3920 |
+
}.bind(this);
|
3921 |
+
setTimeout(stop, 10);
|
3922 |
+
this.editor.on("nativecontextmenu", stop);
|
3923 |
+
};
|
3924 |
+
}).call(MouseHandler.prototype);
|
3925 |
+
|
3926 |
+
config.defineOptions(MouseHandler.prototype, "mouseHandler", {
|
3927 |
+
scrollSpeed: {
|
3928 |
+
initialValue: 2
|
3929 |
+
},
|
3930 |
+
dragDelay: {
|
3931 |
+
initialValue: (useragent.isMac ? 150 : 0)
|
3932 |
+
},
|
3933 |
+
dragEnabled: {
|
3934 |
+
initialValue: true
|
3935 |
+
},
|
3936 |
+
focusTimout: {
|
3937 |
+
initialValue: 0
|
3938 |
+
},
|
3939 |
+
tooltipFollowsMouse: {
|
3940 |
+
initialValue: true
|
3941 |
+
}
|
3942 |
+
});
|
3943 |
+
|
3944 |
+
|
3945 |
+
exports.MouseHandler = MouseHandler;
|
3946 |
+
});
|
3947 |
+
|
3948 |
+
ace.define("ace/mouse/fold_handler", ["require", "exports", "module"], function(require, exports, module) {
|
3949 |
+
"use strict";
|
3950 |
+
|
3951 |
+
function FoldHandler(editor) {
|
3952 |
+
|
3953 |
+
editor.on("click", function(e) {
|
3954 |
+
var position = e.getDocumentPosition();
|
3955 |
+
var session = editor.session;
|
3956 |
+
var fold = session.getFoldAt(position.row, position.column, 1);
|
3957 |
+
if (fold) {
|
3958 |
+
if (e.getAccelKey())
|
3959 |
+
session.removeFold(fold);
|
3960 |
+
else
|
3961 |
+
session.expandFold(fold);
|
3962 |
+
|
3963 |
+
e.stop();
|
3964 |
+
}
|
3965 |
+
});
|
3966 |
+
|
3967 |
+
editor.on("gutterclick", function(e) {
|
3968 |
+
var gutterRegion = editor.renderer.$gutterLayer.getRegion(e);
|
3969 |
+
|
3970 |
+
if (gutterRegion == "foldWidgets") {
|
3971 |
+
var row = e.getDocumentPosition().row;
|
3972 |
+
var session = editor.session;
|
3973 |
+
if (session.foldWidgets && session.foldWidgets[row])
|
3974 |
+
editor.session.onFoldWidgetClick(row, e);
|
3975 |
+
if (!editor.isFocused())
|
3976 |
+
editor.focus();
|
3977 |
+
e.stop();
|
3978 |
+
}
|
3979 |
+
});
|
3980 |
+
|
3981 |
+
editor.on("gutterdblclick", function(e) {
|
3982 |
+
var gutterRegion = editor.renderer.$gutterLayer.getRegion(e);
|
3983 |
+
|
3984 |
+
if (gutterRegion == "foldWidgets") {
|
3985 |
+
var row = e.getDocumentPosition().row;
|
3986 |
+
var session = editor.session;
|
3987 |
+
var data = session.getParentFoldRangeData(row, true);
|
3988 |
+
var range = data.range || data.firstRange;
|
3989 |
+
|
3990 |
+
if (range) {
|
3991 |
+
row = range.start.row;
|
3992 |
+
var fold = session.getFoldAt(row, session.getLine(row).length, 1);
|
3993 |
+
|
3994 |
+
if (fold) {
|
3995 |
+
session.removeFold(fold);
|
3996 |
+
} else {
|
3997 |
+
session.addFold("...", range);
|
3998 |
+
editor.renderer.scrollCursorIntoView({
|
3999 |
+
row: range.start.row,
|
4000 |
+
column: 0
|
4001 |
+
});
|
4002 |
+
}
|
4003 |
+
}
|
4004 |
+
e.stop();
|
4005 |
+
}
|
4006 |
+
});
|
4007 |
+
}
|
4008 |
+
|
4009 |
+
exports.FoldHandler = FoldHandler;
|
4010 |
+
|
4011 |
+
});
|
4012 |
+
|
4013 |
+
ace.define("ace/keyboard/keybinding", ["require", "exports", "module", "ace/lib/keys", "ace/lib/event"], function(require, exports, module) {
|
4014 |
+
"use strict";
|
4015 |
+
|
4016 |
+
var keyUtil = require("../lib/keys");
|
4017 |
+
var event = require("../lib/event");
|
4018 |
+
|
4019 |
+
var KeyBinding = function(editor) {
|
4020 |
+
this.$editor = editor;
|
4021 |
+
this.$data = {
|
4022 |
+
editor: editor
|
4023 |
+
};
|
4024 |
+
this.$handlers = [];
|
4025 |
+
this.setDefaultHandler(editor.commands);
|
4026 |
+
};
|
4027 |
+
|
4028 |
+
(function() {
|
4029 |
+
this.setDefaultHandler = function(kb) {
|
4030 |
+
this.removeKeyboardHandler(this.$defaultHandler);
|
4031 |
+
this.$defaultHandler = kb;
|
4032 |
+
this.addKeyboardHandler(kb, 0);
|
4033 |
+
};
|
4034 |
+
|
4035 |
+
this.setKeyboardHandler = function(kb) {
|
4036 |
+
var h = this.$handlers;
|
4037 |
+
if (h[h.length - 1] == kb)
|
4038 |
+
return;
|
4039 |
+
|
4040 |
+
while (h[h.length - 1] && h[h.length - 1] != this.$defaultHandler)
|
4041 |
+
this.removeKeyboardHandler(h[h.length - 1]);
|
4042 |
+
|
4043 |
+
this.addKeyboardHandler(kb, 1);
|
4044 |
+
};
|
4045 |
+
|
4046 |
+
this.addKeyboardHandler = function(kb, pos) {
|
4047 |
+
if (!kb)
|
4048 |
+
return;
|
4049 |
+
if (typeof kb == "function" && !kb.handleKeyboard)
|
4050 |
+
kb.handleKeyboard = kb;
|
4051 |
+
var i = this.$handlers.indexOf(kb);
|
4052 |
+
if (i != -1)
|
4053 |
+
this.$handlers.splice(i, 1);
|
4054 |
+
|
4055 |
+
if (pos == undefined)
|
4056 |
+
this.$handlers.push(kb);
|
4057 |
+
else
|
4058 |
+
this.$handlers.splice(pos, 0, kb);
|
4059 |
+
|
4060 |
+
if (i == -1 && kb.attach)
|
4061 |
+
kb.attach(this.$editor);
|
4062 |
+
};
|
4063 |
+
|
4064 |
+
this.removeKeyboardHandler = function(kb) {
|
4065 |
+
var i = this.$handlers.indexOf(kb);
|
4066 |
+
if (i == -1)
|
4067 |
+
return false;
|
4068 |
+
this.$handlers.splice(i, 1);
|
4069 |
+
kb.detach && kb.detach(this.$editor);
|
4070 |
+
return true;
|
4071 |
+
};
|
4072 |
+
|
4073 |
+
this.getKeyboardHandler = function() {
|
4074 |
+
return this.$handlers[this.$handlers.length - 1];
|
4075 |
+
};
|
4076 |
+
|
4077 |
+
this.getStatusText = function() {
|
4078 |
+
var data = this.$data;
|
4079 |
+
var editor = data.editor;
|
4080 |
+
return this.$handlers.map(function(h) {
|
4081 |
+
return h.getStatusText && h.getStatusText(editor, data) || "";
|
4082 |
+
}).filter(Boolean).join(" ");
|
4083 |
+
};
|
4084 |
+
|
4085 |
+
this.$callKeyboardHandlers = function(hashId, keyString, keyCode, e) {
|
4086 |
+
var toExecute;
|
4087 |
+
var success = false;
|
4088 |
+
var commands = this.$editor.commands;
|
4089 |
+
|
4090 |
+
for (var i = this.$handlers.length; i--;) {
|
4091 |
+
toExecute = this.$handlers[i].handleKeyboard(
|
4092 |
+
this.$data, hashId, keyString, keyCode, e
|
4093 |
+
);
|
4094 |
+
if (!toExecute || !toExecute.command)
|
4095 |
+
continue;
|
4096 |
+
if (toExecute.command == "null") {
|
4097 |
+
success = true;
|
4098 |
+
} else {
|
4099 |
+
success = commands.exec(toExecute.command, this.$editor, toExecute.args, e);
|
4100 |
+
}
|
4101 |
+
if (success && e && hashId != -1 &&
|
4102 |
+
toExecute.passEvent != true && toExecute.command.passEvent != true
|
4103 |
+
) {
|
4104 |
+
event.stopEvent(e);
|
4105 |
+
}
|
4106 |
+
if (success)
|
4107 |
+
break;
|
4108 |
+
}
|
4109 |
+
return success;
|
4110 |
+
};
|
4111 |
+
|
4112 |
+
this.onCommandKey = function(e, hashId, keyCode) {
|
4113 |
+
var keyString = keyUtil.keyCodeToString(keyCode);
|
4114 |
+
this.$callKeyboardHandlers(hashId, keyString, keyCode, e);
|
4115 |
+
};
|
4116 |
+
|
4117 |
+
this.onTextInput = function(text) {
|
4118 |
+
var success = this.$callKeyboardHandlers(-1, text);
|
4119 |
+
if (!success)
|
4120 |
+
this.$editor.commands.exec("insertstring", this.$editor, text);
|
4121 |
+
};
|
4122 |
+
|
4123 |
+
}).call(KeyBinding.prototype);
|
4124 |
+
|
4125 |
+
exports.KeyBinding = KeyBinding;
|
4126 |
+
});
|
4127 |
+
|
4128 |
+
ace.define("ace/range", ["require", "exports", "module"], function(require, exports, module) {
|
4129 |
+
"use strict";
|
4130 |
+
var comparePoints = function(p1, p2) {
|
4131 |
+
return p1.row - p2.row || p1.column - p2.column;
|
4132 |
+
};
|
4133 |
+
var Range = function(startRow, startColumn, endRow, endColumn) {
|
4134 |
+
this.start = {
|
4135 |
+
row: startRow,
|
4136 |
+
column: startColumn
|
4137 |
+
};
|
4138 |
+
|
4139 |
+
this.end = {
|
4140 |
+
row: endRow,
|
4141 |
+
column: endColumn
|
4142 |
+
};
|
4143 |
+
};
|
4144 |
+
|
4145 |
+
(function() {
|
4146 |
+
this.isEqual = function(range) {
|
4147 |
+
return this.start.row === range.start.row &&
|
4148 |
+
this.end.row === range.end.row &&
|
4149 |
+
this.start.column === range.start.column &&
|
4150 |
+
this.end.column === range.end.column;
|
4151 |
+
};
|
4152 |
+
this.toString = function() {
|
4153 |
+
return ("Range: [" + this.start.row + "/" + this.start.column +
|
4154 |
+
"] -> [" + this.end.row + "/" + this.end.column + "]");
|
4155 |
+
};
|
4156 |
+
|
4157 |
+
this.contains = function(row, column) {
|
4158 |
+
return this.compare(row, column) == 0;
|
4159 |
+
};
|
4160 |
+
this.compareRange = function(range) {
|
4161 |
+
var cmp,
|
4162 |
+
end = range.end,
|
4163 |
+
start = range.start;
|
4164 |
+
|
4165 |
+
cmp = this.compare(end.row, end.column);
|
4166 |
+
if (cmp == 1) {
|
4167 |
+
cmp = this.compare(start.row, start.column);
|
4168 |
+
if (cmp == 1) {
|
4169 |
+
return 2;
|
4170 |
+
} else if (cmp == 0) {
|
4171 |
+
return 1;
|
4172 |
+
} else {
|
4173 |
+
return 0;
|
4174 |
+
}
|
4175 |
+
} else if (cmp == -1) {
|
4176 |
+
return -2;
|
4177 |
+
} else {
|
4178 |
+
cmp = this.compare(start.row, start.column);
|
4179 |
+
if (cmp == -1) {
|
4180 |
+
return -1;
|
4181 |
+
} else if (cmp == 1) {
|
4182 |
+
return 42;
|
4183 |
+
} else {
|
4184 |
+
return 0;
|
4185 |
+
}
|
4186 |
+
}
|
4187 |
+
};
|
4188 |
+
this.comparePoint = function(p) {
|
4189 |
+
return this.compare(p.row, p.column);
|
4190 |
+
};
|
4191 |
+
this.containsRange = function(range) {
|
4192 |
+
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
4193 |
+
};
|
4194 |
+
this.intersects = function(range) {
|
4195 |
+
var cmp = this.compareRange(range);
|
4196 |
+
return (cmp == -1 || cmp == 0 || cmp == 1);
|
4197 |
+
};
|
4198 |
+
this.isEnd = function(row, column) {
|
4199 |
+
return this.end.row == row && this.end.column == column;
|
4200 |
+
};
|
4201 |
+
this.isStart = function(row, column) {
|
4202 |
+
return this.start.row == row && this.start.column == column;
|
4203 |
+
};
|
4204 |
+
this.setStart = function(row, column) {
|
4205 |
+
if (typeof row == "object") {
|
4206 |
+
this.start.column = row.column;
|
4207 |
+
this.start.row = row.row;
|
4208 |
+
} else {
|
4209 |
+
this.start.row = row;
|
4210 |
+
this.start.column = column;
|
4211 |
+
}
|
4212 |
+
};
|
4213 |
+
this.setEnd = function(row, column) {
|
4214 |
+
if (typeof row == "object") {
|
4215 |
+
this.end.column = row.column;
|
4216 |
+
this.end.row = row.row;
|
4217 |
+
} else {
|
4218 |
+
this.end.row = row;
|
4219 |
+
this.end.column = column;
|
4220 |
+
}
|
4221 |
+
};
|
4222 |
+
this.inside = function(row, column) {
|
4223 |
+
if (this.compare(row, column) == 0) {
|
4224 |
+
if (this.isEnd(row, column) || this.isStart(row, column)) {
|
4225 |
+
return false;
|
4226 |
+
} else {
|
4227 |
+
return true;
|
4228 |
+
}
|
4229 |
+
}
|
4230 |
+
return false;
|
4231 |
+
};
|
4232 |
+
this.insideStart = function(row, column) {
|
4233 |
+
if (this.compare(row, column) == 0) {
|
4234 |
+
if (this.isEnd(row, column)) {
|
4235 |
+
return false;
|
4236 |
+
} else {
|
4237 |
+
return true;
|
4238 |
+
}
|
4239 |
+
}
|
4240 |
+
return false;
|
4241 |
+
};
|
4242 |
+
this.insideEnd = function(row, column) {
|
4243 |
+
if (this.compare(row, column) == 0) {
|
4244 |
+
if (this.isStart(row, column)) {
|
4245 |
+
return false;
|
4246 |
+
} else {
|
4247 |
+
return true;
|
4248 |
+
}
|
4249 |
+
}
|
4250 |
+
return false;
|
4251 |
+
};
|
4252 |
+
this.compare = function(row, column) {
|
4253 |
+
if (!this.isMultiLine()) {
|
4254 |
+
if (row === this.start.row) {
|
4255 |
+
return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
|
4256 |
+
};
|
4257 |
+
}
|
4258 |
+
|
4259 |
+
if (row < this.start.row)
|
4260 |
+
return -1;
|
4261 |
+
|
4262 |
+
if (row > this.end.row)
|
4263 |
+
return 1;
|
4264 |
+
|
4265 |
+
if (this.start.row === row)
|
4266 |
+
return column >= this.start.column ? 0 : -1;
|
4267 |
+
|
4268 |
+
if (this.end.row === row)
|
4269 |
+
return column <= this.end.column ? 0 : 1;
|
4270 |
+
|
4271 |
+
return 0;
|
4272 |
+
};
|
4273 |
+
this.compareStart = function(row, column) {
|
4274 |
+
if (this.start.row == row && this.start.column == column) {
|
4275 |
+
return -1;
|
4276 |
+
} else {
|
4277 |
+
return this.compare(row, column);
|
4278 |
+
}
|
4279 |
+
};
|
4280 |
+
this.compareEnd = function(row, column) {
|
4281 |
+
if (this.end.row == row && this.end.column == column) {
|
4282 |
+
return 1;
|
4283 |
+
} else {
|
4284 |
+
return this.compare(row, column);
|
4285 |
+
}
|
4286 |
+
};
|
4287 |
+
this.compareInside = function(row, column) {
|
4288 |
+
if (this.end.row == row && this.end.column == column) {
|
4289 |
+
return 1;
|
4290 |
+
} else if (this.start.row == row && this.start.column == column) {
|
4291 |
+
return -1;
|
4292 |
+
} else {
|
4293 |
+
return this.compare(row, column);
|
4294 |
+
}
|
4295 |
+
};
|
4296 |
+
this.clipRows = function(firstRow, lastRow) {
|
4297 |
+
if (this.end.row > lastRow)
|
4298 |
+
var end = {
|
4299 |
+
row: lastRow + 1,
|
4300 |
+
column: 0
|
4301 |
+
};
|
4302 |
+
else if (this.end.row < firstRow)
|
4303 |
+
var end = {
|
4304 |
+
row: firstRow,
|
4305 |
+
column: 0
|
4306 |
+
};
|
4307 |
+
|
4308 |
+
if (this.start.row > lastRow)
|
4309 |
+
var start = {
|
4310 |
+
row: lastRow + 1,
|
4311 |
+
column: 0
|
4312 |
+
};
|
4313 |
+
else if (this.start.row < firstRow)
|
4314 |
+
var start = {
|
4315 |
+
row: firstRow,
|
4316 |
+
column: 0
|
4317 |
+
};
|
4318 |
+
|
4319 |
+
return Range.fromPoints(start || this.start, end || this.end);
|
4320 |
+
};
|
4321 |
+
this.extend = function(row, column) {
|
4322 |
+
var cmp = this.compare(row, column);
|
4323 |
+
|
4324 |
+
if (cmp == 0)
|
4325 |
+
return this;
|
4326 |
+
else if (cmp == -1)
|
4327 |
+
var start = {
|
4328 |
+
row: row,
|
4329 |
+
column: column
|
4330 |
+
};
|
4331 |
+
else
|
4332 |
+
var end = {
|
4333 |
+
row: row,
|
4334 |
+
column: column
|
4335 |
+
};
|
4336 |
+
|
4337 |
+
return Range.fromPoints(start || this.start, end || this.end);
|
4338 |
+
};
|
4339 |
+
|
4340 |
+
this.isEmpty = function() {
|
4341 |
+
return (this.start.row === this.end.row && this.start.column === this.end.column);
|
4342 |
+
};
|
4343 |
+
this.isMultiLine = function() {
|
4344 |
+
return (this.start.row !== this.end.row);
|
4345 |
+
};
|
4346 |
+
this.clone = function() {
|
4347 |
+
return Range.fromPoints(this.start, this.end);
|
4348 |
+
};
|
4349 |
+
this.collapseRows = function() {
|
4350 |
+
if (this.end.column == 0)
|
4351 |
+
return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row - 1), 0)
|
4352 |
+
else
|
4353 |
+
return new Range(this.start.row, 0, this.end.row, 0)
|
4354 |
+
};
|
4355 |
+
this.toScreenRange = function(session) {
|
4356 |
+
var screenPosStart = session.documentToScreenPosition(this.start);
|
4357 |
+
var screenPosEnd = session.documentToScreenPosition(this.end);
|
4358 |
+
|
4359 |
+
return new Range(
|
4360 |
+
screenPosStart.row, screenPosStart.column,
|
4361 |
+
screenPosEnd.row, screenPosEnd.column
|
4362 |
+
);
|
4363 |
+
};
|
4364 |
+
this.moveBy = function(row, column) {
|
4365 |
+
this.start.row += row;
|
4366 |
+
this.start.column += column;
|
4367 |
+
this.end.row += row;
|
4368 |
+
this.end.column += column;
|
4369 |
+
};
|
4370 |
+
|
4371 |
+
}).call(Range.prototype);
|
4372 |
+
Range.fromPoints = function(start, end) {
|
4373 |
+
return new Range(start.row, start.column, end.row, end.column);
|
4374 |
+
};
|
4375 |
+
Range.comparePoints = comparePoints;
|
4376 |
+
|
4377 |
+
Range.comparePoints = function(p1, p2) {
|
4378 |
+
return p1.row - p2.row || p1.column - p2.column;
|
4379 |
+
};
|
4380 |
+
|
4381 |
+
|
4382 |
+
exports.Range = Range;
|
4383 |
+
});
|
4384 |
+
|
4385 |
+
ace.define("ace/selection", ["require", "exports", "module", "ace/lib/oop", "ace/lib/lang", "ace/lib/event_emitter", "ace/range"], function(require, exports, module) {
|
4386 |
+
"use strict";
|
4387 |
+
|
4388 |
+
var oop = require("./lib/oop");
|
4389 |
+
var lang = require("./lib/lang");
|
4390 |
+
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
4391 |
+
var Range = require("./range").Range;
|
4392 |
+
var Selection = function(session) {
|
4393 |
+
this.session = session;
|
4394 |
+
this.doc = session.getDocument();
|
4395 |
+
|
4396 |
+
this.clearSelection();
|
4397 |
+
this.lead = this.selectionLead = this.doc.createAnchor(0, 0);
|
4398 |
+
this.anchor = this.selectionAnchor = this.doc.createAnchor(0, 0);
|
4399 |
+
|
4400 |
+
var self = this;
|
4401 |
+
this.lead.on("change", function(e) {
|
4402 |
+
self._emit("changeCursor");
|
4403 |
+
if (!self.$isEmpty)
|
4404 |
+
self._emit("changeSelection");
|
4405 |
+
if (!self.$keepDesiredColumnOnChange && e.old.column != e.value.column)
|
4406 |
+
self.$desiredColumn = null;
|
4407 |
+
});
|
4408 |
+
|
4409 |
+
this.selectionAnchor.on("change", function() {
|
4410 |
+
if (!self.$isEmpty)
|
4411 |
+
self._emit("changeSelection");
|
4412 |
+
});
|
4413 |
+
};
|
4414 |
+
|
4415 |
+
(function() {
|
4416 |
+
|
4417 |
+
oop.implement(this, EventEmitter);
|
4418 |
+
this.isEmpty = function() {
|
4419 |
+
return (this.$isEmpty || (
|
4420 |
+
this.anchor.row == this.lead.row &&
|
4421 |
+
this.anchor.column == this.lead.column
|
4422 |
+
));
|
4423 |
+
};
|
4424 |
+
this.isMultiLine = function() {
|
4425 |
+
if (this.isEmpty()) {
|
4426 |
+
return false;
|
4427 |
+
}
|
4428 |
+
|
4429 |
+
return this.getRange().isMultiLine();
|
4430 |
+
};
|
4431 |
+
this.getCursor = function() {
|
4432 |
+
return this.lead.getPosition();
|
4433 |
+
};
|
4434 |
+
this.setSelectionAnchor = function(row, column) {
|
4435 |
+
this.anchor.setPosition(row, column);
|
4436 |
+
|
4437 |
+
if (this.$isEmpty) {
|
4438 |
+
this.$isEmpty = false;
|
4439 |
+
this._emit("changeSelection");
|
4440 |
+
}
|
4441 |
+
};
|
4442 |
+
this.getSelectionAnchor = function() {
|
4443 |
+
if (this.$isEmpty)
|
4444 |
+
return this.getSelectionLead();
|
4445 |
+
else
|
4446 |
+
return this.anchor.getPosition();
|
4447 |
+
};
|
4448 |
+
this.getSelectionLead = function() {
|
4449 |
+
return this.lead.getPosition();
|
4450 |
+
};
|
4451 |
+
this.shiftSelection = function(columns) {
|
4452 |
+
if (this.$isEmpty) {
|
4453 |
+
this.moveCursorTo(this.lead.row, this.lead.column + columns);
|
4454 |
+
return;
|
4455 |
+
}
|
4456 |
+
|
4457 |
+
var anchor = this.getSelectionAnchor();
|
4458 |
+
var lead = this.getSelectionLead();
|
4459 |
+
|
4460 |
+
var isBackwards = this.isBackwards();
|
4461 |
+
|
4462 |
+
if (!isBackwards || anchor.column !== 0)
|
4463 |
+
this.setSelectionAnchor(anchor.row, anchor.column + columns);
|
4464 |
+
|
4465 |
+
if (isBackwards || lead.column !== 0) {
|
4466 |
+
this.$moveSelection(function() {
|
4467 |
+
this.moveCursorTo(lead.row, lead.column + columns);
|
4468 |
+
});
|
4469 |
+
}
|
4470 |
+
};
|
4471 |
+
this.isBackwards = function() {
|
4472 |
+
var anchor = this.anchor;
|
4473 |
+
var lead = this.lead;
|
4474 |
+
return (anchor.row > lead.row || (anchor.row == lead.row && anchor.column > lead.column));
|
4475 |
+
};
|
4476 |
+
this.getRange = function() {
|
4477 |
+
var anchor = this.anchor;
|
4478 |
+
var lead = this.lead;
|
4479 |
+
|
4480 |
+
if (this.isEmpty())
|
4481 |
+
return Range.fromPoints(lead, lead);
|
4482 |
+
|
4483 |
+
if (this.isBackwards()) {
|
4484 |
+
return Range.fromPoints(lead, anchor);
|
4485 |
+
} else {
|
4486 |
+
return Range.fromPoints(anchor, lead);
|
4487 |
+
}
|
4488 |
+
};
|
4489 |
+
this.clearSelection = function() {
|
4490 |
+
if (!this.$isEmpty) {
|
4491 |
+
this.$isEmpty = true;
|
4492 |
+
this._emit("changeSelection");
|
4493 |
+
}
|
4494 |
+
};
|
4495 |
+
this.selectAll = function() {
|
4496 |
+
var lastRow = this.doc.getLength() - 1;
|
4497 |
+
this.setSelectionAnchor(0, 0);
|
4498 |
+
this.moveCursorTo(lastRow, this.doc.getLine(lastRow).length);
|
4499 |
+
};
|
4500 |
+
this.setRange =
|
4501 |
+
this.setSelectionRange = function(range, reverse) {
|
4502 |
+
if (reverse) {
|
4503 |
+
this.setSelectionAnchor(range.end.row, range.end.column);
|
4504 |
+
this.selectTo(range.start.row, range.start.column);
|
4505 |
+
} else {
|
4506 |
+
this.setSelectionAnchor(range.start.row, range.start.column);
|
4507 |
+
this.selectTo(range.end.row, range.end.column);
|
4508 |
+
}
|
4509 |
+
if (this.getRange().isEmpty())
|
4510 |
+
this.$isEmpty = true;
|
4511 |
+
this.$desiredColumn = null;
|
4512 |
+
};
|
4513 |
+
|
4514 |
+
this.$moveSelection = function(mover) {
|
4515 |
+
var lead = this.lead;
|
4516 |
+
if (this.$isEmpty)
|
4517 |
+
this.setSelectionAnchor(lead.row, lead.column);
|
4518 |
+
|
4519 |
+
mover.call(this);
|
4520 |
+
};
|
4521 |
+
this.selectTo = function(row, column) {
|
4522 |
+
this.$moveSelection(function() {
|
4523 |
+
this.moveCursorTo(row, column);
|
4524 |
+
});
|
4525 |
+
};
|
4526 |
+
this.selectToPosition = function(pos) {
|
4527 |
+
this.$moveSelection(function() {
|
4528 |
+
this.moveCursorToPosition(pos);
|
4529 |
+
});
|
4530 |
+
};
|
4531 |
+
this.moveTo = function(row, column) {
|
4532 |
+
this.clearSelection();
|
4533 |
+
this.moveCursorTo(row, column);
|
4534 |
+
};
|
4535 |
+
this.moveToPosition = function(pos) {
|
4536 |
+
this.clearSelection();
|
4537 |
+
this.moveCursorToPosition(pos);
|
4538 |
+
};
|
4539 |
+
this.selectUp = function() {
|
4540 |
+
this.$moveSelection(this.moveCursorUp);
|
4541 |
+
};
|
4542 |
+
this.selectDown = function() {
|
4543 |
+
this.$moveSelection(this.moveCursorDown);
|
4544 |
+
};
|
4545 |
+
this.selectRight = function() {
|
4546 |
+
this.$moveSelection(this.moveCursorRight);
|
4547 |
+
};
|
4548 |
+
this.selectLeft = function() {
|
4549 |
+
this.$moveSelection(this.moveCursorLeft);
|
4550 |
+
};
|
4551 |
+
this.selectLineStart = function() {
|
4552 |
+
this.$moveSelection(this.moveCursorLineStart);
|
4553 |
+
};
|
4554 |
+
this.selectLineEnd = function() {
|
4555 |
+
this.$moveSelection(this.moveCursorLineEnd);
|
4556 |
+
};
|
4557 |
+
this.selectFileEnd = function() {
|
4558 |
+
this.$moveSelection(this.moveCursorFileEnd);
|
4559 |
+
};
|
4560 |
+
this.selectFileStart = function() {
|
4561 |
+
this.$moveSelection(this.moveCursorFileStart);
|
4562 |
+
};
|
4563 |
+
this.selectWordRight = function() {
|
4564 |
+
this.$moveSelection(this.moveCursorWordRight);
|
4565 |
+
};
|
4566 |
+
this.selectWordLeft = function() {
|
4567 |
+
this.$moveSelection(this.moveCursorWordLeft);
|
4568 |
+
};
|
4569 |
+
this.getWordRange = function(row, column) {
|
4570 |
+
if (typeof column == "undefined") {
|
4571 |
+
var cursor = row || this.lead;
|
4572 |
+
row = cursor.row;
|
4573 |
+
column = cursor.column;
|
4574 |
+
}
|
4575 |
+
return this.session.getWordRange(row, column);
|
4576 |
+
};
|
4577 |
+
this.selectWord = function() {
|
4578 |
+
this.setSelectionRange(this.getWordRange());
|
4579 |
+
};
|
4580 |
+
this.selectAWord = function() {
|
4581 |
+
var cursor = this.getCursor();
|
4582 |
+
var range = this.session.getAWordRange(cursor.row, cursor.column);
|
4583 |
+
this.setSelectionRange(range);
|
4584 |
+
};
|
4585 |
+
|
4586 |
+
this.getLineRange = function(row, excludeLastChar) {
|
4587 |
+
var rowStart = typeof row == "number" ? row : this.lead.row;
|
4588 |
+
var rowEnd;
|
4589 |
+
|
4590 |
+
var foldLine = this.session.getFoldLine(rowStart);
|
4591 |
+
if (foldLine) {
|
4592 |
+
rowStart = foldLine.start.row;
|
4593 |
+
rowEnd = foldLine.end.row;
|
4594 |
+
} else {
|
4595 |
+
rowEnd = rowStart;
|
4596 |
+
}
|
4597 |
+
if (excludeLastChar === true)
|
4598 |
+
return new Range(rowStart, 0, rowEnd, this.session.getLine(rowEnd).length);
|
4599 |
+
else
|
4600 |
+
return new Range(rowStart, 0, rowEnd + 1, 0);
|
4601 |
+
};
|
4602 |
+
this.selectLine = function() {
|
4603 |
+
this.setSelectionRange(this.getLineRange());
|
4604 |
+
};
|
4605 |
+
this.moveCursorUp = function() {
|
4606 |
+
this.moveCursorBy(-1, 0);
|
4607 |
+
};
|
4608 |
+
this.moveCursorDown = function() {
|
4609 |
+
this.moveCursorBy(1, 0);
|
4610 |
+
};
|
4611 |
+
this.moveCursorLeft = function() {
|
4612 |
+
var cursor = this.lead.getPosition(),
|
4613 |
+
fold;
|
4614 |
+
|
4615 |
+
if (fold = this.session.getFoldAt(cursor.row, cursor.column, -1)) {
|
4616 |
+
this.moveCursorTo(fold.start.row, fold.start.column);
|
4617 |
+
} else if (cursor.column === 0) {
|
4618 |
+
if (cursor.row > 0) {
|
4619 |
+
this.moveCursorTo(cursor.row - 1, this.doc.getLine(cursor.row - 1).length);
|
4620 |
+
}
|
4621 |
+
} else {
|
4622 |
+
var tabSize = this.session.getTabSize();
|
4623 |
+
if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column - tabSize, cursor.column).split(" ").length - 1 == tabSize)
|
4624 |
+
this.moveCursorBy(0, -tabSize);
|
4625 |
+
else
|
4626 |
+
this.moveCursorBy(0, -1);
|
4627 |
+
}
|
4628 |
+
};
|
4629 |
+
this.moveCursorRight = function() {
|
4630 |
+
var cursor = this.lead.getPosition(),
|
4631 |
+
fold;
|
4632 |
+
if (fold = this.session.getFoldAt(cursor.row, cursor.column, 1)) {
|
4633 |
+
this.moveCursorTo(fold.end.row, fold.end.column);
|
4634 |
+
} else if (this.lead.column == this.doc.getLine(this.lead.row).length) {
|
4635 |
+
if (this.lead.row < this.doc.getLength() - 1) {
|
4636 |
+
this.moveCursorTo(this.lead.row + 1, 0);
|
4637 |
+
}
|
4638 |
+
} else {
|
4639 |
+
var tabSize = this.session.getTabSize();
|
4640 |
+
var cursor = this.lead;
|
4641 |
+
if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column, cursor.column + tabSize).split(" ").length - 1 == tabSize)
|
4642 |
+
this.moveCursorBy(0, tabSize);
|
4643 |
+
else
|
4644 |
+
this.moveCursorBy(0, 1);
|
4645 |
+
}
|
4646 |
+
};
|
4647 |
+
this.moveCursorLineStart = function() {
|
4648 |
+
var row = this.lead.row;
|
4649 |
+
var column = this.lead.column;
|
4650 |
+
var screenRow = this.session.documentToScreenRow(row, column);
|
4651 |
+
var firstColumnPosition = this.session.screenToDocumentPosition(screenRow, 0);
|
4652 |
+
var beforeCursor = this.session.getDisplayLine(
|
4653 |
+
row, null, firstColumnPosition.row,
|
4654 |
+
firstColumnPosition.column
|
4655 |
+
);
|
4656 |
+
|
4657 |
+
var leadingSpace = beforeCursor.match(/^\s*/);
|
4658 |
+
if (leadingSpace[0].length != column && !this.session.$useEmacsStyleLineStart)
|
4659 |
+
firstColumnPosition.column += leadingSpace[0].length;
|
4660 |
+
this.moveCursorToPosition(firstColumnPosition);
|
4661 |
+
};
|
4662 |
+
this.moveCursorLineEnd = function() {
|
4663 |
+
var lead = this.lead;
|
4664 |
+
var lineEnd = this.session.getDocumentLastRowColumnPosition(lead.row, lead.column);
|
4665 |
+
if (this.lead.column == lineEnd.column) {
|
4666 |
+
var line = this.session.getLine(lineEnd.row);
|
4667 |
+
if (lineEnd.column == line.length) {
|
4668 |
+
var textEnd = line.search(/\s+$/);
|
4669 |
+
if (textEnd > 0)
|
4670 |
+
lineEnd.column = textEnd;
|
4671 |
+
}
|
4672 |
+
}
|
4673 |
+
|
4674 |
+
this.moveCursorTo(lineEnd.row, lineEnd.column);
|
4675 |
+
};
|
4676 |
+
this.moveCursorFileEnd = function() {
|
4677 |
+
var row = this.doc.getLength() - 1;
|
4678 |
+
var column = this.doc.getLine(row).length;
|
4679 |
+
this.moveCursorTo(row, column);
|
4680 |
+
};
|
4681 |
+
this.moveCursorFileStart = function() {
|
4682 |
+
this.moveCursorTo(0, 0);
|
4683 |
+
};
|
4684 |
+
this.moveCursorLongWordRight = function() {
|
4685 |
+
var row = this.lead.row;
|
4686 |
+
var column = this.lead.column;
|
4687 |
+
var line = this.doc.getLine(row);
|
4688 |
+
var rightOfCursor = line.substring(column);
|
4689 |
+
|
4690 |
+
var match;
|
4691 |
+
this.session.nonTokenRe.lastIndex = 0;
|
4692 |
+
this.session.tokenRe.lastIndex = 0;
|
4693 |
+
var fold = this.session.getFoldAt(row, column, 1);
|
4694 |
+
if (fold) {
|
4695 |
+
this.moveCursorTo(fold.end.row, fold.end.column);
|
4696 |
+
return;
|
4697 |
+
}
|
4698 |
+
if (match = this.session.nonTokenRe.exec(rightOfCursor)) {
|
4699 |
+
column += this.session.nonTokenRe.lastIndex;
|
4700 |
+
this.session.nonTokenRe.lastIndex = 0;
|
4701 |
+
rightOfCursor = line.substring(column);
|
4702 |
+
}
|
4703 |
+
if (column >= line.length) {
|
4704 |
+
this.moveCursorTo(row, line.length);
|
4705 |
+
this.moveCursorRight();
|
4706 |
+
if (row < this.doc.getLength() - 1)
|
4707 |
+
this.moveCursorWordRight();
|
4708 |
+
return;
|
4709 |
+
}
|
4710 |
+
if (match = this.session.tokenRe.exec(rightOfCursor)) {
|
4711 |
+
column += this.session.tokenRe.lastIndex;
|
4712 |
+
this.session.tokenRe.lastIndex = 0;
|
4713 |
+
}
|
4714 |
+
|
4715 |
+
this.moveCursorTo(row, column);
|
4716 |
+
};
|
4717 |
+
this.moveCursorLongWordLeft = function() {
|
4718 |
+
var row = this.lead.row;
|
4719 |
+
var column = this.lead.column;
|
4720 |
+
var fold;
|
4721 |
+
if (fold = this.session.getFoldAt(row, column, -1)) {
|
4722 |
+
this.moveCursorTo(fold.start.row, fold.start.column);
|
4723 |
+
return;
|
4724 |
+
}
|
4725 |
+
|
4726 |
+
var str = this.session.getFoldStringAt(row, column, -1);
|
4727 |
+
if (str == null) {
|
4728 |
+
str = this.doc.getLine(row).substring(0, column);
|
4729 |
+
}
|
4730 |
+
|
4731 |
+
var leftOfCursor = lang.stringReverse(str);
|
4732 |
+
var match;
|
4733 |
+
this.session.nonTokenRe.lastIndex = 0;
|
4734 |
+
this.session.tokenRe.lastIndex = 0;
|
4735 |
+
if (match = this.session.nonTokenRe.exec(leftOfCursor)) {
|
4736 |
+
column -= this.session.nonTokenRe.lastIndex;
|
4737 |
+
leftOfCursor = leftOfCursor.slice(this.session.nonTokenRe.lastIndex);
|
4738 |
+
this.session.nonTokenRe.lastIndex = 0;
|
4739 |
+
}
|
4740 |
+
if (column <= 0) {
|
4741 |
+
this.moveCursorTo(row, 0);
|
4742 |
+
this.moveCursorLeft();
|
4743 |
+
if (row > 0)
|
4744 |
+
this.moveCursorWordLeft();
|
4745 |
+
return;
|
4746 |
+
}
|
4747 |
+
if (match = this.session.tokenRe.exec(leftOfCursor)) {
|
4748 |
+
column -= this.session.tokenRe.lastIndex;
|
4749 |
+
this.session.tokenRe.lastIndex = 0;
|
4750 |
+
}
|
4751 |
+
|
4752 |
+
this.moveCursorTo(row, column);
|
4753 |
+
};
|
4754 |
+
|
4755 |
+
this.$shortWordEndIndex = function(rightOfCursor) {
|
4756 |
+
var match, index = 0,
|
4757 |
+
ch;
|
4758 |
+
var whitespaceRe = /\s/;
|
4759 |
+
var tokenRe = this.session.tokenRe;
|
4760 |
+
|
4761 |
+
tokenRe.lastIndex = 0;
|
4762 |
+
if (match = this.session.tokenRe.exec(rightOfCursor)) {
|
4763 |
+
index = this.session.tokenRe.lastIndex;
|
4764 |
+
} else {
|
4765 |
+
while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch))
|
4766 |
+
index++;
|
4767 |
+
|
4768 |
+
if (index < 1) {
|
4769 |
+
tokenRe.lastIndex = 0;
|
4770 |
+
while ((ch = rightOfCursor[index]) && !tokenRe.test(ch)) {
|
4771 |
+
tokenRe.lastIndex = 0;
|
4772 |
+
index++;
|
4773 |
+
if (whitespaceRe.test(ch)) {
|
4774 |
+
if (index > 2) {
|
4775 |
+
index--;
|
4776 |
+
break;
|
4777 |
+
} else {
|
4778 |
+
while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch))
|
4779 |
+
index++;
|
4780 |
+
if (index > 2)
|
4781 |
+
break;
|
4782 |
+
}
|
4783 |
+
}
|
4784 |
+
}
|
4785 |
+
}
|
4786 |
+
}
|
4787 |
+
tokenRe.lastIndex = 0;
|
4788 |
+
|
4789 |
+
return index;
|
4790 |
+
};
|
4791 |
+
|
4792 |
+
this.moveCursorShortWordRight = function() {
|
4793 |
+
var row = this.lead.row;
|
4794 |
+
var column = this.lead.column;
|
4795 |
+
var line = this.doc.getLine(row);
|
4796 |
+
var rightOfCursor = line.substring(column);
|
4797 |
+
|
4798 |
+
var fold = this.session.getFoldAt(row, column, 1);
|
4799 |
+
if (fold)
|
4800 |
+
return this.moveCursorTo(fold.end.row, fold.end.column);
|
4801 |
+
|
4802 |
+
if (column == line.length) {
|
4803 |
+
var l = this.doc.getLength();
|
4804 |
+
do {
|
4805 |
+
row++;
|
4806 |
+
rightOfCursor = this.doc.getLine(row);
|
4807 |
+
} while (row < l && /^\s*$/.test(rightOfCursor));
|
4808 |
+
|
4809 |
+
if (!/^\s+/.test(rightOfCursor))
|
4810 |
+
rightOfCursor = "";
|
4811 |
+
column = 0;
|
4812 |
+
}
|
4813 |
+
|
4814 |
+
var index = this.$shortWordEndIndex(rightOfCursor);
|
4815 |
+
|
4816 |
+
this.moveCursorTo(row, column + index);
|
4817 |
+
};
|
4818 |
+
|
4819 |
+
this.moveCursorShortWordLeft = function() {
|
4820 |
+
var row = this.lead.row;
|
4821 |
+
var column = this.lead.column;
|
4822 |
+
|
4823 |
+
var fold;
|
4824 |
+
if (fold = this.session.getFoldAt(row, column, -1))
|
4825 |
+
return this.moveCursorTo(fold.start.row, fold.start.column);
|
4826 |
+
|
4827 |
+
var line = this.session.getLine(row).substring(0, column);
|
4828 |
+
if (column === 0) {
|
4829 |
+
do {
|
4830 |
+
row--;
|
4831 |
+
line = this.doc.getLine(row);
|
4832 |
+
} while (row > 0 && /^\s*$/.test(line));
|
4833 |
+
|
4834 |
+
column = line.length;
|
4835 |
+
if (!/\s+$/.test(line))
|
4836 |
+
line = "";
|
4837 |
+
}
|
4838 |
+
|
4839 |
+
var leftOfCursor = lang.stringReverse(line);
|
4840 |
+
var index = this.$shortWordEndIndex(leftOfCursor);
|
4841 |
+
|
4842 |
+
return this.moveCursorTo(row, column - index);
|
4843 |
+
};
|
4844 |
+
|
4845 |
+
this.moveCursorWordRight = function() {
|
4846 |
+
if (this.session.$selectLongWords)
|
4847 |
+
this.moveCursorLongWordRight();
|
4848 |
+
else
|
4849 |
+
this.moveCursorShortWordRight();
|
4850 |
+
};
|
4851 |
+
|
4852 |
+
this.moveCursorWordLeft = function() {
|
4853 |
+
if (this.session.$selectLongWords)
|
4854 |
+
this.moveCursorLongWordLeft();
|
4855 |
+
else
|
4856 |
+
this.moveCursorShortWordLeft();
|
4857 |
+
};
|
4858 |
+
this.moveCursorBy = function(rows, chars) {
|
4859 |
+
var screenPos = this.session.documentToScreenPosition(
|
4860 |
+
this.lead.row,
|
4861 |
+
this.lead.column
|
4862 |
+
);
|
4863 |
+
|
4864 |
+
if (chars === 0) {
|
4865 |
+
if (this.$desiredColumn)
|
4866 |
+
screenPos.column = this.$desiredColumn;
|
4867 |
+
else
|
4868 |
+
this.$desiredColumn = screenPos.column;
|
4869 |
+
}
|
4870 |
+
|
4871 |
+
var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column);
|
4872 |
+
|
4873 |
+
if (rows !== 0 && chars === 0 && docPos.row === this.lead.row && docPos.column === this.lead.column) {
|
4874 |
+
if (this.session.lineWidgets && this.session.lineWidgets[docPos.row])
|
4875 |
+
docPos.row++;
|
4876 |
+
}
|
4877 |
+
this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0);
|
4878 |
+
};
|
4879 |
+
this.moveCursorToPosition = function(position) {
|
4880 |
+
this.moveCursorTo(position.row, position.column);
|
4881 |
+
};
|
4882 |
+
this.moveCursorTo = function(row, column, keepDesiredColumn) {
|
4883 |
+
var fold = this.session.getFoldAt(row, column, 1);
|
4884 |
+
if (fold) {
|
4885 |
+
row = fold.start.row;
|
4886 |
+
column = fold.start.column;
|
4887 |
+
}
|
4888 |
+
|
4889 |
+
this.$keepDesiredColumnOnChange = true;
|
4890 |
+
this.lead.setPosition(row, column);
|
4891 |
+
this.$keepDesiredColumnOnChange = false;
|
4892 |
+
|
4893 |
+
if (!keepDesiredColumn)
|
4894 |
+
this.$desiredColumn = null;
|
4895 |
+
};
|
4896 |
+
this.moveCursorToScreen = function(row, column, keepDesiredColumn) {
|
4897 |
+
var pos = this.session.screenToDocumentPosition(row, column);
|
4898 |
+
this.moveCursorTo(pos.row, pos.column, keepDesiredColumn);
|
4899 |
+
};
|
4900 |
+
this.detach = function() {
|
4901 |
+
this.lead.detach();
|
4902 |
+
this.anchor.detach();
|
4903 |
+
this.session = this.doc = null;
|
4904 |
+
};
|
4905 |
+
|
4906 |
+
this.fromOrientedRange = function(range) {
|
4907 |
+
this.setSelectionRange(range, range.cursor == range.start);
|
4908 |
+
this.$desiredColumn = range.desiredColumn || this.$desiredColumn;
|
4909 |
+
};
|
4910 |
+
|
4911 |
+
this.toOrientedRange = function(range) {
|
4912 |
+
var r = this.getRange();
|
4913 |
+
if (range) {
|
4914 |
+
range.start.column = r.start.column;
|
4915 |
+
range.start.row = r.start.row;
|
4916 |
+
range.end.column = r.end.column;
|
4917 |
+
range.end.row = r.end.row;
|
4918 |
+
} else {
|
4919 |
+
range = r;
|
4920 |
+
}
|
4921 |
+
|
4922 |
+
range.cursor = this.isBackwards() ? range.start : range.end;
|
4923 |
+
range.desiredColumn = this.$desiredColumn;
|
4924 |
+
return range;
|
4925 |
+
};
|
4926 |
+
this.getRangeOfMovements = function(func) {
|
4927 |
+
var start = this.getCursor();
|
4928 |
+
try {
|
4929 |
+
func.call(null, this);
|
4930 |
+
var end = this.getCursor();
|
4931 |
+
return Range.fromPoints(start, end);
|
4932 |
+
} catch (e) {
|
4933 |
+
return Range.fromPoints(start, start);
|
4934 |
+
} finally {
|
4935 |
+
this.moveCursorToPosition(start);
|
4936 |
+
}
|
4937 |
+
};
|
4938 |
+
|
4939 |
+
this.toJSON = function() {
|
4940 |
+
if (this.rangeCount) {
|
4941 |
+
var data = this.ranges.map(function(r) {
|
4942 |
+
var r1 = r.clone();
|
4943 |
+
r1.isBackwards = r.cursor == r.start;
|
4944 |
+
return r1;
|
4945 |
+
});
|
4946 |
+
} else {
|
4947 |
+
var data = this.getRange();
|
4948 |
+
data.isBackwards = this.isBackwards();
|
4949 |
+
}
|
4950 |
+
return data;
|
4951 |
+
};
|
4952 |
+
|
4953 |
+
this.fromJSON = function(data) {
|
4954 |
+
if (data.start == undefined) {
|
4955 |
+
if (this.rangeList) {
|
4956 |
+
this.toSingleRange(data[0]);
|
4957 |
+
for (var i = data.length; i--;) {
|
4958 |
+
var r = Range.fromPoints(data[i].start, data[i].end);
|
4959 |
+
if (data.isBackwards)
|
4960 |
+
r.cursor = r.start;
|
4961 |
+
this.addRange(r, true);
|
4962 |
+
}
|
4963 |
+
return;
|
4964 |
+
} else
|
4965 |
+
data = data[0];
|
4966 |
+
}
|
4967 |
+
if (this.rangeList)
|
4968 |
+
this.toSingleRange(data);
|
4969 |
+
this.setSelectionRange(data, data.isBackwards);
|
4970 |
+
};
|
4971 |
+
|
4972 |
+
this.isEqual = function(data) {
|
4973 |
+
if ((data.length || this.rangeCount) && data.length != this.rangeCount)
|
4974 |
+
return false;
|
4975 |
+
if (!data.length || !this.ranges)
|
4976 |
+
return this.getRange().isEqual(data);
|
4977 |
+
|
4978 |
+
for (var i = this.ranges.length; i--;) {
|
4979 |
+
if (!this.ranges[i].isEqual(data[i]))
|
4980 |
+
return false;
|
4981 |
+
}
|
4982 |
+
return true;
|
4983 |
+
};
|
4984 |
+
|
4985 |
+
}).call(Selection.prototype);
|
4986 |
+
|
4987 |
+
exports.Selection = Selection;
|
4988 |
+
});
|
4989 |
+
|
4990 |
+
ace.define("ace/tokenizer", ["require", "exports", "module"], function(require, exports, module) {
|
4991 |
+
"use strict";
|
4992 |
+
var MAX_TOKEN_COUNT = 2000;
|
4993 |
+
var Tokenizer = function(rules) {
|
4994 |
+
this.states = rules;
|
4995 |
+
|
4996 |
+
this.regExps = {};
|
4997 |
+
this.matchMappings = {};
|
4998 |
+
for (var key in this.states) {
|
4999 |
+
var state = this.states[key];
|
5000 |
+
var ruleRegExps = [];
|
5001 |
+
var matchTotal = 0;
|
5002 |
+
var mapping = this.matchMappings[key] = {
|
5003 |
+
defaultToken: "text"
|
5004 |
+
};
|
5005 |
+
var flag = "g";
|
5006 |
+
|
5007 |
+
var splitterRurles = [];
|
5008 |
+
for (var i = 0; i < state.length; i++) {
|
5009 |
+
var rule = state[i];
|
5010 |
+
if (rule.defaultToken)
|
5011 |
+
mapping.defaultToken = rule.defaultToken;
|
5012 |
+
if (rule.caseInsensitive)
|
5013 |
+
flag = "gi";
|
5014 |
+
if (rule.regex == null)
|
5015 |
+
continue;
|
5016 |
+
|
5017 |
+
if (rule.regex instanceof RegExp)
|
5018 |
+
rule.regex = rule.regex.toString().slice(1, -1);
|
5019 |
+
var adjustedregex = rule.regex;
|
5020 |
+
var matchcount = new RegExp("(?:(" + adjustedregex + ")|(.))").exec("a").length - 2;
|
5021 |
+
if (Array.isArray(rule.token)) {
|
5022 |
+
if (rule.token.length == 1 || matchcount == 1) {
|
5023 |
+
rule.token = rule.token[0];
|
5024 |
+
} else if (matchcount - 1 != rule.token.length) {
|
5025 |
+
this.reportError("number of classes and regexp groups doesn't match", {
|
5026 |
+
rule: rule,
|
5027 |
+
groupCount: matchcount - 1
|
5028 |
+
});
|
5029 |
+
rule.token = rule.token[0];
|
5030 |
+
} else {
|
5031 |
+
rule.tokenArray = rule.token;
|
5032 |
+
rule.token = null;
|
5033 |
+
rule.onMatch = this.$arrayTokens;
|
5034 |
+
}
|
5035 |
+
} else if (typeof rule.token == "function" && !rule.onMatch) {
|
5036 |
+
if (matchcount > 1)
|
5037 |
+
rule.onMatch = this.$applyToken;
|
5038 |
+
else
|
5039 |
+
rule.onMatch = rule.token;
|
5040 |
+
}
|
5041 |
+
|
5042 |
+
if (matchcount > 1) {
|
5043 |
+
if (/\\\d/.test(rule.regex)) {
|
5044 |
+
adjustedregex = rule.regex.replace(/\\([0-9]+)/g, function(match, digit) {
|
5045 |
+
return "\\" + (parseInt(digit, 10) + matchTotal + 1);
|
5046 |
+
});
|
5047 |
+
} else {
|
5048 |
+
matchcount = 1;
|
5049 |
+
adjustedregex = this.removeCapturingGroups(rule.regex);
|
5050 |
+
}
|
5051 |
+
if (!rule.splitRegex && typeof rule.token != "string")
|
5052 |
+
splitterRurles.push(rule); // flag will be known only at the very end
|
5053 |
+
}
|
5054 |
+
|
5055 |
+
mapping[matchTotal] = i;
|
5056 |
+
matchTotal += matchcount;
|
5057 |
+
|
5058 |
+
ruleRegExps.push(adjustedregex);
|
5059 |
+
if (!rule.onMatch)
|
5060 |
+
rule.onMatch = null;
|
5061 |
+
}
|
5062 |
+
|
5063 |
+
if (!ruleRegExps.length) {
|
5064 |
+
mapping[0] = 0;
|
5065 |
+
ruleRegExps.push("$");
|
5066 |
+
}
|
5067 |
+
|
5068 |
+
splitterRurles.forEach(function(rule) {
|
5069 |
+
rule.splitRegex = this.createSplitterRegexp(rule.regex, flag);
|
5070 |
+
}, this);
|
5071 |
+
|
5072 |
+
this.regExps[key] = new RegExp("(" + ruleRegExps.join(")|(") + ")|($)", flag);
|
5073 |
+
}
|
5074 |
+
};
|
5075 |
+
|
5076 |
+
(function() {
|
5077 |
+
this.$setMaxTokenCount = function(m) {
|
5078 |
+
MAX_TOKEN_COUNT = m | 0;
|
5079 |
+
};
|
5080 |
+
|
5081 |
+
this.$applyToken = function(str) {
|
5082 |
+
var values = this.splitRegex.exec(str).slice(1);
|
5083 |
+
var types = this.token.apply(this, values);
|
5084 |
+
if (typeof types === "string")
|
5085 |
+
return [{
|
5086 |
+
type: types,
|
5087 |
+
value: str
|
5088 |
+
}];
|
5089 |
+
|
5090 |
+
var tokens = [];
|
5091 |
+
for (var i = 0, l = types.length; i < l; i++) {
|
5092 |
+
if (values[i])
|
5093 |
+
tokens[tokens.length] = {
|
5094 |
+
type: types[i],
|
5095 |
+
value: values[i]
|
5096 |
+
};
|
5097 |
+
}
|
5098 |
+
return tokens;
|
5099 |
+
},
|
5100 |
+
|
5101 |
+
this.$arrayTokens = function(str) {
|
5102 |
+
if (!str)
|
5103 |
+
return [];
|
5104 |
+
var values = this.splitRegex.exec(str);
|
5105 |
+
if (!values)
|
5106 |
+
return "text";
|
5107 |
+
var tokens = [];
|
5108 |
+
var types = this.tokenArray;
|
5109 |
+
for (var i = 0, l = types.length; i < l; i++) {
|
5110 |
+
if (values[i + 1])
|
5111 |
+
tokens[tokens.length] = {
|
5112 |
+
type: types[i],
|
5113 |
+
value: values[i + 1]
|
5114 |
+
};
|
5115 |
+
}
|
5116 |
+
return tokens;
|
5117 |
+
};
|
5118 |
+
|
5119 |
+
this.removeCapturingGroups = function(src) {
|
5120 |
+
var r = src.replace(
|
5121 |
+
/\[(?:\\.|[^\]])*?\]|\\.|\(\?[:=!]|(\()/g,
|
5122 |
+
function(x, y) {
|
5123 |
+
return y ? "(?:" : x;
|
5124 |
+
}
|
5125 |
+
);
|
5126 |
+
return r;
|
5127 |
+
};
|
5128 |
+
|
5129 |
+
this.createSplitterRegexp = function(src, flag) {
|
5130 |
+
if (src.indexOf("(?=") != -1) {
|
5131 |
+
var stack = 0;
|
5132 |
+
var inChClass = false;
|
5133 |
+
var lastCapture = {};
|
5134 |
+
src.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g, function(
|
5135 |
+
m, esc, parenOpen, parenClose, square, index
|
5136 |
+
) {
|
5137 |
+
if (inChClass) {
|
5138 |
+
inChClass = square != "]";
|
5139 |
+
} else if (square) {
|
5140 |
+
inChClass = true;
|
5141 |
+
} else if (parenClose) {
|
5142 |
+
if (stack == lastCapture.stack) {
|
5143 |
+
lastCapture.end = index + 1;
|
5144 |
+
lastCapture.stack = -1;
|
5145 |
+
}
|
5146 |
+
stack--;
|
5147 |
+
} else if (parenOpen) {
|
5148 |
+
stack++;
|
5149 |
+
if (parenOpen.length != 1) {
|
5150 |
+
lastCapture.stack = stack
|
5151 |
+
lastCapture.start = index;
|
5152 |
+
}
|
5153 |
+
}
|
5154 |
+
return m;
|
5155 |
+
});
|
5156 |
+
|
5157 |
+
if (lastCapture.end != null && /^\)*$/.test(src.substr(lastCapture.end)))
|
5158 |
+
src = src.substring(0, lastCapture.start) + src.substr(lastCapture.end);
|
5159 |
+
}
|
5160 |
+
return new RegExp(src, (flag || "").replace("g", ""));
|
5161 |
+
};
|
5162 |
+
this.getLineTokens = function(line, startState) {
|
5163 |
+
if (startState && typeof startState != "string") {
|
5164 |
+
var stack = startState.slice(0);
|
5165 |
+
startState = stack[0];
|
5166 |
+
if (startState === "#tmp") {
|
5167 |
+
stack.shift()
|
5168 |
+
startState = stack.shift()
|
5169 |
+
}
|
5170 |
+
} else
|
5171 |
+
var stack = [];
|
5172 |
+
|
5173 |
+
var currentState = startState || "start";
|
5174 |
+
var state = this.states[currentState];
|
5175 |
+
if (!state) {
|
5176 |
+
currentState = "start";
|
5177 |
+
state = this.states[currentState];
|
5178 |
+
}
|
5179 |
+
var mapping = this.matchMappings[currentState];
|
5180 |
+
var re = this.regExps[currentState];
|
5181 |
+
re.lastIndex = 0;
|
5182 |
+
|
5183 |
+
var match, tokens = [];
|
5184 |
+
var lastIndex = 0;
|
5185 |
+
var matchAttempts = 0;
|
5186 |
+
|
5187 |
+
var token = {
|
5188 |
+
type: null,
|
5189 |
+
value: ""
|
5190 |
+
};
|
5191 |
+
|
5192 |
+
while (match = re.exec(line)) {
|
5193 |
+
var type = mapping.defaultToken;
|
5194 |
+
var rule = null;
|
5195 |
+
var value = match[0];
|
5196 |
+
var index = re.lastIndex;
|
5197 |
+
|
5198 |
+
if (index - value.length > lastIndex) {
|
5199 |
+
var skipped = line.substring(lastIndex, index - value.length);
|
5200 |
+
if (token.type == type) {
|
5201 |
+
token.value += skipped;
|
5202 |
+
} else {
|
5203 |
+
if (token.type)
|
5204 |
+
tokens.push(token);
|
5205 |
+
token = {
|
5206 |
+
type: type,
|
5207 |
+
value: skipped
|
5208 |
+
};
|
5209 |
+
}
|
5210 |
+
}
|
5211 |
+
|
5212 |
+
for (var i = 0; i < match.length - 2; i++) {
|
5213 |
+
if (match[i + 1] === undefined)
|
5214 |
+
continue;
|
5215 |
+
|
5216 |
+
rule = state[mapping[i]];
|
5217 |
+
|
5218 |
+
if (rule.onMatch)
|
5219 |
+
type = rule.onMatch(value, currentState, stack);
|
5220 |
+
else
|
5221 |
+
type = rule.token;
|
5222 |
+
|
5223 |
+
if (rule.next) {
|
5224 |
+
if (typeof rule.next == "string") {
|
5225 |
+
currentState = rule.next;
|
5226 |
+
} else {
|
5227 |
+
currentState = rule.next(currentState, stack);
|
5228 |
+
}
|
5229 |
+
|
5230 |
+
state = this.states[currentState];
|
5231 |
+
if (!state) {
|
5232 |
+
this.reportError("state doesn't exist", currentState);
|
5233 |
+
currentState = "start";
|
5234 |
+
state = this.states[currentState];
|
5235 |
+
}
|
5236 |
+
mapping = this.matchMappings[currentState];
|
5237 |
+
lastIndex = index;
|
5238 |
+
re = this.regExps[currentState];
|
5239 |
+
re.lastIndex = index;
|
5240 |
+
}
|
5241 |
+
break;
|
5242 |
+
}
|
5243 |
+
|
5244 |
+
if (value) {
|
5245 |
+
if (typeof type === "string") {
|
5246 |
+
if ((!rule || rule.merge !== false) && token.type === type) {
|
5247 |
+
token.value += value;
|
5248 |
+
} else {
|
5249 |
+
if (token.type)
|
5250 |
+
tokens.push(token);
|
5251 |
+
token = {
|
5252 |
+
type: type,
|
5253 |
+
value: value
|
5254 |
+
};
|
5255 |
+
}
|
5256 |
+
} else if (type) {
|
5257 |
+
if (token.type)
|
5258 |
+
tokens.push(token);
|
5259 |
+
token = {
|
5260 |
+
type: null,
|
5261 |
+
value: ""
|
5262 |
+
};
|
5263 |
+
for (var i = 0; i < type.length; i++)
|
5264 |
+
tokens.push(type[i]);
|
5265 |
+
}
|
5266 |
+
}
|
5267 |
+
|
5268 |
+
if (lastIndex == line.length)
|
5269 |
+
break;
|
5270 |
+
|
5271 |
+
lastIndex = index;
|
5272 |
+
|
5273 |
+
if (matchAttempts++ > MAX_TOKEN_COUNT) {
|
5274 |
+
if (matchAttempts > 2 * line.length) {
|
5275 |
+
this.reportError("infinite loop with in ace tokenizer", {
|
5276 |
+
startState: startState,
|
5277 |
+
line: line
|
5278 |
+
});
|
5279 |
+
}
|
5280 |
+
while (lastIndex < line.length) {
|
5281 |
+
if (token.type)
|
5282 |
+
tokens.push(token);
|
5283 |
+
token = {
|
5284 |
+
value: line.substring(lastIndex, lastIndex += 2000),
|
5285 |
+
type: "overflow"
|
5286 |
+
};
|
5287 |
+
}
|
5288 |
+
currentState = "start";
|
5289 |
+
stack = [];
|
5290 |
+
break;
|
5291 |
+
}
|
5292 |
+
}
|
5293 |
+
|
5294 |
+
if (token.type)
|
5295 |
+
tokens.push(token);
|
5296 |
+
|
5297 |
+
if (stack.length > 1) {
|
5298 |
+
if (stack[0] !== currentState)
|
5299 |
+
stack.unshift("#tmp", currentState);
|
5300 |
+
}
|
5301 |
+
return {
|
5302 |
+
tokens: tokens,
|
5303 |
+
state: stack.length ? stack : currentState
|
5304 |
+
};
|
5305 |
+
};
|
5306 |
+
|
5307 |
+
this.reportError = function(msg, data) {
|
5308 |
+
var e = new Error(msg);
|
5309 |
+
e.data = data;
|
5310 |
+
if (typeof console == "object" && console.error)
|
5311 |
+
console.error(e);
|
5312 |
+
setTimeout(function() {
|
5313 |
+
throw e;
|
5314 |
+
});
|
5315 |
+
};
|
5316 |
+
}).call(Tokenizer.prototype);
|
5317 |
+
|
5318 |
+
exports.Tokenizer = Tokenizer;
|
5319 |
+
});
|
5320 |
+
|
5321 |
+
ace.define("ace/mode/text_highlight_rules", ["require", "exports", "module", "ace/lib/lang"], function(require, exports, module) {
|
5322 |
+
"use strict";
|
5323 |
+
|
5324 |
+
var lang = require("../lib/lang");
|
5325 |
+
|
5326 |
+
var TextHighlightRules = function() {
|
5327 |
+
|
5328 |
+
this.$rules = {
|
5329 |
+
"start": [{
|
5330 |
+
token: "empty_line",
|
5331 |
+
regex: '^$'
|
5332 |
+
}, {
|
5333 |
+
defaultToken: "text"
|
5334 |
+
}]
|
5335 |
+
};
|
5336 |
+
};
|
5337 |
+
|
5338 |
+
(function() {
|
5339 |
+
|
5340 |
+
this.addRules = function(rules, prefix) {
|
5341 |
+
if (!prefix) {
|
5342 |
+
for (var key in rules)
|
5343 |
+
this.$rules[key] = rules[key];
|
5344 |
+
return;
|
5345 |
+
}
|
5346 |
+
for (var key in rules) {
|
5347 |
+
var state = rules[key];
|
5348 |
+
for (var i = 0; i < state.length; i++) {
|
5349 |
+
var rule = state[i];
|
5350 |
+
if (rule.next || rule.onMatch) {
|
5351 |
+
if (typeof rule.next != "string") {
|
5352 |
+
if (rule.nextState && rule.nextState.indexOf(prefix) !== 0)
|
5353 |
+
rule.nextState = prefix + rule.nextState;
|
5354 |
+
} else {
|
5355 |
+
if (rule.next.indexOf(prefix) !== 0)
|
5356 |
+
rule.next = prefix + rule.next;
|
5357 |
+
}
|
5358 |
+
}
|
5359 |
+
}
|
5360 |
+
this.$rules[prefix + key] = state;
|
5361 |
+
}
|
5362 |
+
};
|
5363 |
+
|
5364 |
+
this.getRules = function() {
|
5365 |
+
return this.$rules;
|
5366 |
+
};
|
5367 |
+
|
5368 |
+
this.embedRules = function(HighlightRules, prefix, escapeRules, states, append) {
|
5369 |
+
var embedRules = typeof HighlightRules == "function" ? new HighlightRules().getRules() : HighlightRules;
|
5370 |
+
if (states) {
|
5371 |
+
for (var i = 0; i < states.length; i++)
|
5372 |
+
states[i] = prefix + states[i];
|
5373 |
+
} else {
|
5374 |
+
states = [];
|
5375 |
+
for (var key in embedRules)
|
5376 |
+
states.push(prefix + key);
|
5377 |
+
}
|
5378 |
+
|
5379 |
+
this.addRules(embedRules, prefix);
|
5380 |
+
|
5381 |
+
if (escapeRules) {
|
5382 |
+
var addRules = Array.prototype[append ? "push" : "unshift"];
|
5383 |
+
for (var i = 0; i < states.length; i++)
|
5384 |
+
addRules.apply(this.$rules[states[i]], lang.deepCopy(escapeRules));
|
5385 |
+
}
|
5386 |
+
|
5387 |
+
if (!this.$embeds)
|
5388 |
+
this.$embeds = [];
|
5389 |
+
this.$embeds.push(prefix);
|
5390 |
+
};
|
5391 |
+
|
5392 |
+
this.getEmbeds = function() {
|
5393 |
+
return this.$embeds;
|
5394 |
+
};
|
5395 |
+
|
5396 |
+
var pushState = function(currentState, stack) {
|
5397 |
+
if (currentState != "start" || stack.length)
|
5398 |
+
stack.unshift(this.nextState, currentState);
|
5399 |
+
return this.nextState;
|
5400 |
+
};
|
5401 |
+
var popState = function(currentState, stack) {
|
5402 |
+
stack.shift();
|
5403 |
+
return stack.shift() || "start";
|
5404 |
+
};
|
5405 |
+
|
5406 |
+
this.normalizeRules = function() {
|
5407 |
+
var id = 0;
|
5408 |
+
var rules = this.$rules;
|
5409 |
+
|
5410 |
+
function processState(key) {
|
5411 |
+
var state = rules[key];
|
5412 |
+
state.processed = true;
|
5413 |
+
for (var i = 0; i < state.length; i++) {
|
5414 |
+
var rule = state[i];
|
5415 |
+
if (!rule.regex && rule.start) {
|
5416 |
+
rule.regex = rule.start;
|
5417 |
+
if (!rule.next)
|
5418 |
+
rule.next = [];
|
5419 |
+
rule.next.push({
|
5420 |
+
defaultToken: rule.token
|
5421 |
+
}, {
|
5422 |
+
token: rule.token + ".end",
|
5423 |
+
regex: rule.end || rule.start,
|
5424 |
+
next: "pop"
|
5425 |
+
});
|
5426 |
+
rule.token = rule.token + ".start";
|
5427 |
+
rule.push = true;
|
5428 |
+
}
|
5429 |
+
var next = rule.next || rule.push;
|
5430 |
+
if (next && Array.isArray(next)) {
|
5431 |
+
var stateName = rule.stateName;
|
5432 |
+
if (!stateName) {
|
5433 |
+
stateName = rule.token;
|
5434 |
+
if (typeof stateName != "string")
|
5435 |
+
stateName = stateName[0] || "";
|
5436 |
+
if (rules[stateName])
|
5437 |
+
stateName += id++;
|
5438 |
+
}
|
5439 |
+
rules[stateName] = next;
|
5440 |
+
rule.next = stateName;
|
5441 |
+
processState(stateName);
|
5442 |
+
} else if (next == "pop") {
|
5443 |
+
rule.next = popState;
|
5444 |
+
}
|
5445 |
+
|
5446 |
+
if (rule.push) {
|
5447 |
+
rule.nextState = rule.next || rule.push;
|
5448 |
+
rule.next = pushState;
|
5449 |
+
delete rule.push;
|
5450 |
+
}
|
5451 |
+
|
5452 |
+
if (rule.rules) {
|
5453 |
+
for (var r in rule.rules) {
|
5454 |
+
if (rules[r]) {
|
5455 |
+
if (rules[r].push)
|
5456 |
+
rules[r].push.apply(rules[r], rule.rules[r]);
|
5457 |
+
} else {
|
5458 |
+
rules[r] = rule.rules[r];
|
5459 |
+
}
|
5460 |
+
}
|
5461 |
+
}
|
5462 |
+
if (rule.include || typeof rule == "string") {
|
5463 |
+
var includeName = rule.include || rule;
|
5464 |
+
var toInsert = rules[includeName];
|
5465 |
+
} else if (Array.isArray(rule))
|
5466 |
+
toInsert = rule;
|
5467 |
+
|
5468 |
+
if (toInsert) {
|
5469 |
+
var args = [i, 1].concat(toInsert);
|
5470 |
+
if (rule.noEscape)
|
5471 |
+
args = args.filter(function(x) {
|
5472 |
+
return !x.next;
|
5473 |
+
});
|
5474 |
+
state.splice.apply(state, args);
|
5475 |
+
i--;
|
5476 |
+
toInsert = null;
|
5477 |
+
}
|
5478 |
+
|
5479 |
+
if (rule.keywordMap) {
|
5480 |
+
rule.token = this.createKeywordMapper(
|
5481 |
+
rule.keywordMap, rule.defaultToken || "text", rule.caseInsensitive
|
5482 |
+
);
|
5483 |
+
delete rule.defaultToken;
|
5484 |
+
}
|
5485 |
+
}
|
5486 |
+
}
|
5487 |
+
Object.keys(rules).forEach(processState, this);
|
5488 |
+
};
|
5489 |
+
|
5490 |
+
this.createKeywordMapper = function(map, defaultToken, ignoreCase, splitChar) {
|
5491 |
+
var keywords = Object.create(null);
|
5492 |
+
Object.keys(map).forEach(function(className) {
|
5493 |
+
var a = map[className];
|
5494 |
+
if (ignoreCase)
|
5495 |
+
a = a.toLowerCase();
|
5496 |
+
var list = a.split(splitChar || "|");
|
5497 |
+
for (var i = list.length; i--;)
|
5498 |
+
keywords[list[i]] = className;
|
5499 |
+
});
|
5500 |
+
if (Object.getPrototypeOf(keywords)) {
|
5501 |
+
keywords.__proto__ = null;
|
5502 |
+
}
|
5503 |
+
this.$keywordList = Object.keys(keywords);
|
5504 |
+
map = null;
|
5505 |
+
return ignoreCase ? function(value) {
|
5506 |
+
return keywords[value.toLowerCase()] || defaultToken
|
5507 |
+
} : function(value) {
|
5508 |
+
return keywords[value] || defaultToken
|
5509 |
+
};
|
5510 |
+
};
|
5511 |
+
|
5512 |
+
this.getKeywords = function() {
|
5513 |
+
return this.$keywords;
|
5514 |
+
};
|
5515 |
+
|
5516 |
+
}).call(TextHighlightRules.prototype);
|
5517 |
+
|
5518 |
+
exports.TextHighlightRules = TextHighlightRules;
|
5519 |
+
});
|
5520 |
+
|
5521 |
+
ace.define("ace/mode/behaviour", ["require", "exports", "module"], function(require, exports, module) {
|
5522 |
+
"use strict";
|
5523 |
+
|
5524 |
+
var Behaviour = function() {
|
5525 |
+
this.$behaviours = {};
|
5526 |
+
};
|
5527 |
+
|
5528 |
+
(function() {
|
5529 |
+
|
5530 |
+
this.add = function(name, action, callback) {
|
5531 |
+
switch (undefined) {
|
5532 |
+
case this.$behaviours:
|
5533 |
+
this.$behaviours = {};
|
5534 |
+
case this.$behaviours[name]:
|
5535 |
+
this.$behaviours[name] = {};
|
5536 |
+
}
|
5537 |
+
this.$behaviours[name][action] = callback;
|
5538 |
+
}
|
5539 |
+
|
5540 |
+
this.addBehaviours = function(behaviours) {
|
5541 |
+
for (var key in behaviours) {
|
5542 |
+
for (var action in behaviours[key]) {
|
5543 |
+
this.add(key, action, behaviours[key][action]);
|
5544 |
+
}
|
5545 |
+
}
|
5546 |
+
}
|
5547 |
+
|
5548 |
+
this.remove = function(name) {
|
5549 |
+
if (this.$behaviours && this.$behaviours[name]) {
|
5550 |
+
delete this.$behaviours[name];
|
5551 |
+
}
|
5552 |
+
}
|
5553 |
+
|
5554 |
+
this.inherit = function(mode, filter) {
|
5555 |
+
if (typeof mode === "function") {
|
5556 |
+
var behaviours = new mode().getBehaviours(filter);
|
5557 |
+
} else {
|
5558 |
+
var behaviours = mode.getBehaviours(filter);
|
5559 |
+
}
|
5560 |
+
this.addBehaviours(behaviours);
|
5561 |
+
}
|
5562 |
+
|
5563 |
+
this.getBehaviours = function(filter) {
|
5564 |
+
if (!filter) {
|
5565 |
+
return this.$behaviours;
|
5566 |
+
} else {
|
5567 |
+
var ret = {}
|
5568 |
+
for (var i = 0; i < filter.length; i++) {
|
5569 |
+
if (this.$behaviours[filter[i]]) {
|
5570 |
+
ret[filter[i]] = this.$behaviours[filter[i]];
|
5571 |
+
}
|
5572 |
+
}
|
5573 |
+
return ret;
|
5574 |
+
}
|
5575 |
+
}
|
5576 |
+
|
5577 |
+
}).call(Behaviour.prototype);
|
5578 |
+
|
5579 |
+
exports.Behaviour = Behaviour;
|
5580 |
+
});
|
5581 |
+
|
5582 |
+
ace.define("ace/unicode", ["require", "exports", "module"], function(require, exports, module) {
|
5583 |
+
"use strict";
|
5584 |
+
exports.packages = {};
|
5585 |
+
|
5586 |
+
addUnicodePackage({
|
5587 |
+
L: "0041-005A0061-007A00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D03860388-038A038C038E-03A103A3-03F503F7-0481048A-05250531-055605590561-058705D0-05EA05F0-05F20621-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280904-0939093D09500958-0961097109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510D0-10FA10FC1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209421022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2D00-2D252D30-2D652D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A65FA662-A66EA67F-A697A6A0-A6E5A717-A71FA722-A788A78BA78CA7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",
|
5588 |
+
Ll: "0061-007A00AA00B500BA00DF-00F600F8-00FF01010103010501070109010B010D010F01110113011501170119011B011D011F01210123012501270129012B012D012F01310133013501370138013A013C013E014001420144014601480149014B014D014F01510153015501570159015B015D015F01610163016501670169016B016D016F0171017301750177017A017C017E-0180018301850188018C018D019201950199-019B019E01A101A301A501A801AA01AB01AD01B001B401B601B901BA01BD-01BF01C601C901CC01CE01D001D201D401D601D801DA01DC01DD01DF01E101E301E501E701E901EB01ED01EF01F001F301F501F901FB01FD01FF02010203020502070209020B020D020F02110213021502170219021B021D021F02210223022502270229022B022D022F02310233-0239023C023F0240024202470249024B024D024F-02930295-02AF037103730377037B-037D039003AC-03CE03D003D103D5-03D703D903DB03DD03DF03E103E303E503E703E903EB03ED03EF-03F303F503F803FB03FC0430-045F04610463046504670469046B046D046F04710473047504770479047B047D047F0481048B048D048F04910493049504970499049B049D049F04A104A304A504A704A904AB04AD04AF04B104B304B504B704B904BB04BD04BF04C204C404C604C804CA04CC04CE04CF04D104D304D504D704D904DB04DD04DF04E104E304E504E704E904EB04ED04EF04F104F304F504F704F904FB04FD04FF05010503050505070509050B050D050F05110513051505170519051B051D051F0521052305250561-05871D00-1D2B1D62-1D771D79-1D9A1E011E031E051E071E091E0B1E0D1E0F1E111E131E151E171E191E1B1E1D1E1F1E211E231E251E271E291E2B1E2D1E2F1E311E331E351E371E391E3B1E3D1E3F1E411E431E451E471E491E4B1E4D1E4F1E511E531E551E571E591E5B1E5D1E5F1E611E631E651E671E691E6B1E6D1E6F1E711E731E751E771E791E7B1E7D1E7F1E811E831E851E871E891E8B1E8D1E8F1E911E931E95-1E9D1E9F1EA11EA31EA51EA71EA91EAB1EAD1EAF1EB11EB31EB51EB71EB91EBB1EBD1EBF1EC11EC31EC51EC71EC91ECB1ECD1ECF1ED11ED31ED51ED71ED91EDB1EDD1EDF1EE11EE31EE51EE71EE91EEB1EED1EEF1EF11EF31EF51EF71EF91EFB1EFD1EFF-1F071F10-1F151F20-1F271F30-1F371F40-1F451F50-1F571F60-1F671F70-1F7D1F80-1F871F90-1F971FA0-1FA71FB0-1FB41FB61FB71FBE1FC2-1FC41FC61FC71FD0-1FD31FD61FD71FE0-1FE71FF2-1FF41FF61FF7210A210E210F2113212F21342139213C213D2146-2149214E21842C30-2C5E2C612C652C662C682C6A2C6C2C712C732C742C76-2C7C2C812C832C852C872C892C8B2C8D2C8F2C912C932C952C972C992C9B2C9D2C9F2CA12CA32CA52CA72CA92CAB2CAD2CAF2CB12CB32CB52CB72CB92CBB2CBD2CBF2CC12CC32CC52CC72CC92CCB2CCD2CCF2CD12CD32CD52CD72CD92CDB2CDD2CDF2CE12CE32CE42CEC2CEE2D00-2D25A641A643A645A647A649A64BA64DA64FA651A653A655A657A659A65BA65DA65FA663A665A667A669A66BA66DA681A683A685A687A689A68BA68DA68FA691A693A695A697A723A725A727A729A72BA72DA72F-A731A733A735A737A739A73BA73DA73FA741A743A745A747A749A74BA74DA74FA751A753A755A757A759A75BA75DA75FA761A763A765A767A769A76BA76DA76FA771-A778A77AA77CA77FA781A783A785A787A78CFB00-FB06FB13-FB17FF41-FF5A",
|
5589 |
+
Lu: "0041-005A00C0-00D600D8-00DE01000102010401060108010A010C010E01100112011401160118011A011C011E01200122012401260128012A012C012E01300132013401360139013B013D013F0141014301450147014A014C014E01500152015401560158015A015C015E01600162016401660168016A016C016E017001720174017601780179017B017D018101820184018601870189-018B018E-0191019301940196-0198019C019D019F01A001A201A401A601A701A901AC01AE01AF01B1-01B301B501B701B801BC01C401C701CA01CD01CF01D101D301D501D701D901DB01DE01E001E201E401E601E801EA01EC01EE01F101F401F6-01F801FA01FC01FE02000202020402060208020A020C020E02100212021402160218021A021C021E02200222022402260228022A022C022E02300232023A023B023D023E02410243-02460248024A024C024E03700372037603860388-038A038C038E038F0391-03A103A3-03AB03CF03D2-03D403D803DA03DC03DE03E003E203E403E603E803EA03EC03EE03F403F703F903FA03FD-042F04600462046404660468046A046C046E04700472047404760478047A047C047E0480048A048C048E04900492049404960498049A049C049E04A004A204A404A604A804AA04AC04AE04B004B204B404B604B804BA04BC04BE04C004C104C304C504C704C904CB04CD04D004D204D404D604D804DA04DC04DE04E004E204E404E604E804EA04EC04EE04F004F204F404F604F804FA04FC04FE05000502050405060508050A050C050E05100512051405160518051A051C051E0520052205240531-055610A0-10C51E001E021E041E061E081E0A1E0C1E0E1E101E121E141E161E181E1A1E1C1E1E1E201E221E241E261E281E2A1E2C1E2E1E301E321E341E361E381E3A1E3C1E3E1E401E421E441E461E481E4A1E4C1E4E1E501E521E541E561E581E5A1E5C1E5E1E601E621E641E661E681E6A1E6C1E6E1E701E721E741E761E781E7A1E7C1E7E1E801E821E841E861E881E8A1E8C1E8E1E901E921E941E9E1EA01EA21EA41EA61EA81EAA1EAC1EAE1EB01EB21EB41EB61EB81EBA1EBC1EBE1EC01EC21EC41EC61EC81ECA1ECC1ECE1ED01ED21ED41ED61ED81EDA1EDC1EDE1EE01EE21EE41EE61EE81EEA1EEC1EEE1EF01EF21EF41EF61EF81EFA1EFC1EFE1F08-1F0F1F18-1F1D1F28-1F2F1F38-1F3F1F48-1F4D1F591F5B1F5D1F5F1F68-1F6F1FB8-1FBB1FC8-1FCB1FD8-1FDB1FE8-1FEC1FF8-1FFB21022107210B-210D2110-211221152119-211D212421262128212A-212D2130-2133213E213F214521832C00-2C2E2C602C62-2C642C672C692C6B2C6D-2C702C722C752C7E-2C802C822C842C862C882C8A2C8C2C8E2C902C922C942C962C982C9A2C9C2C9E2CA02CA22CA42CA62CA82CAA2CAC2CAE2CB02CB22CB42CB62CB82CBA2CBC2CBE2CC02CC22CC42CC62CC82CCA2CCC2CCE2CD02CD22CD42CD62CD82CDA2CDC2CDE2CE02CE22CEB2CEDA640A642A644A646A648A64AA64CA64EA650A652A654A656A658A65AA65CA65EA662A664A666A668A66AA66CA680A682A684A686A688A68AA68CA68EA690A692A694A696A722A724A726A728A72AA72CA72EA732A734A736A738A73AA73CA73EA740A742A744A746A748A74AA74CA74EA750A752A754A756A758A75AA75CA75EA760A762A764A766A768A76AA76CA76EA779A77BA77DA77EA780A782A784A786A78BFF21-FF3A",
|
5590 |
+
Lt: "01C501C801CB01F21F88-1F8F1F98-1F9F1FA8-1FAF1FBC1FCC1FFC",
|
5591 |
+
Lm: "02B0-02C102C6-02D102E0-02E402EC02EE0374037A0559064006E506E607F407F507FA081A0824082809710E460EC610FC17D718431AA71C78-1C7D1D2C-1D611D781D9B-1DBF2071207F2090-20942C7D2D6F2E2F30053031-3035303B309D309E30FC-30FEA015A4F8-A4FDA60CA67FA717-A71FA770A788A9CFAA70AADDFF70FF9EFF9F",
|
5592 |
+
Lo: "01BB01C0-01C3029405D0-05EA05F0-05F20621-063F0641-064A066E066F0671-06D306D506EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA0800-08150904-0939093D09500958-096109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E450E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10D0-10FA1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317DC1820-18421844-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C771CE9-1CEC1CEE-1CF12135-21382D30-2D652D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE3006303C3041-3096309F30A1-30FA30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A014A016-A48CA4D0-A4F7A500-A60BA610-A61FA62AA62BA66EA6A0-A6E5A7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2AA00-AA28AA40-AA42AA44-AA4BAA60-AA6FAA71-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADBAADCABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF66-FF6FFF71-FF9DFFA0-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",
|
5593 |
+
M: "0300-036F0483-04890591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DE-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0903093C093E-094E0951-0955096209630981-098309BC09BE-09C409C709C809CB-09CD09D709E209E30A01-0A030A3C0A3E-0A420A470A480A4B-0A4D0A510A700A710A750A81-0A830ABC0ABE-0AC50AC7-0AC90ACB-0ACD0AE20AE30B01-0B030B3C0B3E-0B440B470B480B4B-0B4D0B560B570B620B630B820BBE-0BC20BC6-0BC80BCA-0BCD0BD70C01-0C030C3E-0C440C46-0C480C4A-0C4D0C550C560C620C630C820C830CBC0CBE-0CC40CC6-0CC80CCA-0CCD0CD50CD60CE20CE30D020D030D3E-0D440D46-0D480D4A-0D4D0D570D620D630D820D830DCA0DCF-0DD40DD60DD8-0DDF0DF20DF30E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F3E0F3F0F71-0F840F860F870F90-0F970F99-0FBC0FC6102B-103E1056-1059105E-10601062-10641067-106D1071-10741082-108D108F109A-109D135F1712-17141732-1734175217531772177317B6-17D317DD180B-180D18A91920-192B1930-193B19B0-19C019C819C91A17-1A1B1A55-1A5E1A60-1A7C1A7F1B00-1B041B34-1B441B6B-1B731B80-1B821BA1-1BAA1C24-1C371CD0-1CD21CD4-1CE81CED1CF21DC0-1DE61DFD-1DFF20D0-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66F-A672A67CA67DA6F0A6F1A802A806A80BA823-A827A880A881A8B4-A8C4A8E0-A8F1A926-A92DA947-A953A980-A983A9B3-A9C0AA29-AA36AA43AA4CAA4DAA7BAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE3-ABEAABECABEDFB1EFE00-FE0FFE20-FE26",
|
5594 |
+
Mn: "0300-036F0483-04870591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DF-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0902093C0941-0948094D0951-095509620963098109BC09C1-09C409CD09E209E30A010A020A3C0A410A420A470A480A4B-0A4D0A510A700A710A750A810A820ABC0AC1-0AC50AC70AC80ACD0AE20AE30B010B3C0B3F0B41-0B440B4D0B560B620B630B820BC00BCD0C3E-0C400C46-0C480C4A-0C4D0C550C560C620C630CBC0CBF0CC60CCC0CCD0CE20CE30D41-0D440D4D0D620D630DCA0DD2-0DD40DD60E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F71-0F7E0F80-0F840F860F870F90-0F970F99-0FBC0FC6102D-10301032-10371039103A103D103E10581059105E-10601071-1074108210851086108D109D135F1712-17141732-1734175217531772177317B7-17BD17C617C9-17D317DD180B-180D18A91920-19221927192819321939-193B1A171A181A561A58-1A5E1A601A621A65-1A6C1A73-1A7C1A7F1B00-1B031B341B36-1B3A1B3C1B421B6B-1B731B801B811BA2-1BA51BA81BA91C2C-1C331C361C371CD0-1CD21CD4-1CE01CE2-1CE81CED1DC0-1DE61DFD-1DFF20D0-20DC20E120E5-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66FA67CA67DA6F0A6F1A802A806A80BA825A826A8C4A8E0-A8F1A926-A92DA947-A951A980-A982A9B3A9B6-A9B9A9BCAA29-AA2EAA31AA32AA35AA36AA43AA4CAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE5ABE8ABEDFB1EFE00-FE0FFE20-FE26",
|
5595 |
+
Mc: "0903093E-09400949-094C094E0982098309BE-09C009C709C809CB09CC09D70A030A3E-0A400A830ABE-0AC00AC90ACB0ACC0B020B030B3E0B400B470B480B4B0B4C0B570BBE0BBF0BC10BC20BC6-0BC80BCA-0BCC0BD70C01-0C030C41-0C440C820C830CBE0CC0-0CC40CC70CC80CCA0CCB0CD50CD60D020D030D3E-0D400D46-0D480D4A-0D4C0D570D820D830DCF-0DD10DD8-0DDF0DF20DF30F3E0F3F0F7F102B102C10311038103B103C105610571062-10641067-106D108310841087-108C108F109A-109C17B617BE-17C517C717C81923-19261929-192B193019311933-193819B0-19C019C819C91A19-1A1B1A551A571A611A631A641A6D-1A721B041B351B3B1B3D-1B411B431B441B821BA11BA61BA71BAA1C24-1C2B1C341C351CE11CF2A823A824A827A880A881A8B4-A8C3A952A953A983A9B4A9B5A9BAA9BBA9BD-A9C0AA2FAA30AA33AA34AA4DAA7BABE3ABE4ABE6ABE7ABE9ABEAABEC",
|
5596 |
+
Me: "0488048906DE20DD-20E020E2-20E4A670-A672",
|
5597 |
+
N: "0030-003900B200B300B900BC-00BE0660-066906F0-06F907C0-07C90966-096F09E6-09EF09F4-09F90A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BF20C66-0C6F0C78-0C7E0CE6-0CEF0D66-0D750E50-0E590ED0-0ED90F20-0F331040-10491090-10991369-137C16EE-16F017E0-17E917F0-17F91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C5920702074-20792080-20892150-21822185-21892460-249B24EA-24FF2776-27932CFD30073021-30293038-303A3192-31953220-32293251-325F3280-328932B1-32BFA620-A629A6E6-A6EFA830-A835A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",
|
5598 |
+
Nd: "0030-00390660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",
|
5599 |
+
Nl: "16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF",
|
5600 |
+
No: "00B200B300B900BC-00BE09F4-09F90BF0-0BF20C78-0C7E0D70-0D750F2A-0F331369-137C17F0-17F920702074-20792080-20892150-215F21892460-249B24EA-24FF2776-27932CFD3192-31953220-32293251-325F3280-328932B1-32BFA830-A835",
|
5601 |
+
P: "0021-00230025-002A002C-002F003A003B003F0040005B-005D005F007B007D00A100AB00B700BB00BF037E0387055A-055F0589058A05BE05C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F3A-0F3D0F850FD0-0FD4104A-104F10FB1361-13681400166D166E169B169C16EB-16ED1735173617D4-17D617D8-17DA1800-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD32010-20272030-20432045-20512053-205E207D207E208D208E2329232A2768-277527C527C627E6-27EF2983-299829D8-29DB29FC29FD2CF9-2CFC2CFE2CFF2E00-2E2E2E302E313001-30033008-30113014-301F3030303D30A030FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFD3EFD3FFE10-FE19FE30-FE52FE54-FE61FE63FE68FE6AFE6BFF01-FF03FF05-FF0AFF0C-FF0FFF1AFF1BFF1FFF20FF3B-FF3DFF3FFF5BFF5DFF5F-FF65",
|
5602 |
+
Pd: "002D058A05BE140018062010-20152E172E1A301C303030A0FE31FE32FE58FE63FF0D",
|
5603 |
+
Ps: "0028005B007B0F3A0F3C169B201A201E2045207D208D23292768276A276C276E27702772277427C527E627E827EA27EC27EE2983298529872989298B298D298F299129932995299729D829DA29FC2E222E242E262E283008300A300C300E3010301430163018301A301DFD3EFE17FE35FE37FE39FE3BFE3DFE3FFE41FE43FE47FE59FE5BFE5DFF08FF3BFF5BFF5FFF62",
|
5604 |
+
Pe: "0029005D007D0F3B0F3D169C2046207E208E232A2769276B276D276F27712773277527C627E727E927EB27ED27EF298429862988298A298C298E2990299229942996299829D929DB29FD2E232E252E272E293009300B300D300F3011301530173019301B301E301FFD3FFE18FE36FE38FE3AFE3CFE3EFE40FE42FE44FE48FE5AFE5CFE5EFF09FF3DFF5DFF60FF63",
|
5605 |
+
Pi: "00AB2018201B201C201F20392E022E042E092E0C2E1C2E20",
|
5606 |
+
Pf: "00BB2019201D203A2E032E052E0A2E0D2E1D2E21",
|
5607 |
+
Pc: "005F203F20402054FE33FE34FE4D-FE4FFF3F",
|
5608 |
+
Po: "0021-00230025-0027002A002C002E002F003A003B003F0040005C00A100B700BF037E0387055A-055F058905C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F850FD0-0FD4104A-104F10FB1361-1368166D166E16EB-16ED1735173617D4-17D617D8-17DA1800-18051807-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD3201620172020-20272030-2038203B-203E2041-20432047-205120532055-205E2CF9-2CFC2CFE2CFF2E002E012E06-2E082E0B2E0E-2E162E182E192E1B2E1E2E1F2E2A-2E2E2E302E313001-3003303D30FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFE10-FE16FE19FE30FE45FE46FE49-FE4CFE50-FE52FE54-FE57FE5F-FE61FE68FE6AFE6BFF01-FF03FF05-FF07FF0AFF0CFF0EFF0FFF1AFF1BFF1FFF20FF3CFF61FF64FF65",
|
5609 |
+
S: "0024002B003C-003E005E0060007C007E00A2-00A900AC00AE-00B100B400B600B800D700F702C2-02C502D2-02DF02E5-02EB02ED02EF-02FF03750384038503F604820606-0608060B060E060F06E906FD06FE07F609F209F309FA09FB0AF10B700BF3-0BFA0C7F0CF10CF20D790E3F0F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-139917DB194019E0-19FF1B61-1B6A1B74-1B7C1FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE20442052207A-207C208A-208C20A0-20B8210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B2140-2144214A-214D214F2190-2328232B-23E82400-24262440-244A249C-24E92500-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE27C0-27C427C7-27CA27CC27D0-27E527F0-29822999-29D729DC-29FB29FE-2B4C2B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F309B309C319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A700-A716A720A721A789A78AA828-A82BA836-A839AA77-AA79FB29FDFCFDFDFE62FE64-FE66FE69FF04FF0BFF1C-FF1EFF3EFF40FF5CFF5EFFE0-FFE6FFE8-FFEEFFFCFFFD",
|
5610 |
+
Sm: "002B003C-003E007C007E00AC00B100D700F703F60606-060820442052207A-207C208A-208C2140-2144214B2190-2194219A219B21A021A321A621AE21CE21CF21D221D421F4-22FF2308-230B23202321237C239B-23B323DC-23E125B725C125F8-25FF266F27C0-27C427C7-27CA27CC27D0-27E527F0-27FF2900-29822999-29D729DC-29FB29FE-2AFF2B30-2B442B47-2B4CFB29FE62FE64-FE66FF0BFF1C-FF1EFF5CFF5EFFE2FFE9-FFEC",
|
5611 |
+
Sc: "002400A2-00A5060B09F209F309FB0AF10BF90E3F17DB20A0-20B8A838FDFCFE69FF04FFE0FFE1FFE5FFE6",
|
5612 |
+
Sk: "005E006000A800AF00B400B802C2-02C502D2-02DF02E5-02EB02ED02EF-02FF0375038403851FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE309B309CA700-A716A720A721A789A78AFF3EFF40FFE3",
|
5613 |
+
So: "00A600A700A900AE00B000B60482060E060F06E906FD06FE07F609FA0B700BF3-0BF80BFA0C7F0CF10CF20D790F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-1399194019E0-19FF1B61-1B6A1B74-1B7C210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B214A214C214D214F2195-2199219C-219F21A121A221A421A521A7-21AD21AF-21CD21D021D121D321D5-21F32300-2307230C-231F2322-2328232B-237B237D-239A23B4-23DB23E2-23E82400-24262440-244A249C-24E92500-25B625B8-25C025C2-25F72600-266E2670-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE2800-28FF2B00-2B2F2B452B462B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A828-A82BA836A837A839AA77-AA79FDFDFFE4FFE8FFEDFFEEFFFCFFFD",
|
5614 |
+
Z: "002000A01680180E2000-200A20282029202F205F3000",
|
5615 |
+
Zs: "002000A01680180E2000-200A202F205F3000",
|
5616 |
+
Zl: "2028",
|
5617 |
+
Zp: "2029",
|
5618 |
+
C: "0000-001F007F-009F00AD03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-0605061C061D0620065F06DD070E070F074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17B417B517DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF200B-200F202A-202E2060-206F20722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-F8FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFD-FF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFFBFFFEFFFF",
|
5619 |
+
Cc: "0000-001F007F-009F",
|
5620 |
+
Cf: "00AD0600-060306DD070F17B417B5200B-200F202A-202E2060-2064206A-206FFEFFFFF9-FFFB",
|
5621 |
+
Co: "E000-F8FF",
|
5622 |
+
Cs: "D800-DFFF",
|
5623 |
+
Cn: "03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-05FF06040605061C061D0620065F070E074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF2065-206920722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-D7FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFDFEFEFF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFF8FFFEFFFF"
|
5624 |
+
});
|
5625 |
+
|
5626 |
+
function addUnicodePackage(pack) {
|
5627 |
+
var codePoint = /\w{4}/g;
|
5628 |
+
for (var name in pack)
|
5629 |
+
exports.packages[name] = pack[name].replace(codePoint, "\\u$&");
|
5630 |
+
};
|
5631 |
+
|
5632 |
+
});
|
5633 |
+
|
5634 |
+
ace.define("ace/token_iterator", ["require", "exports", "module"], function(require, exports, module) {
|
5635 |
+
"use strict";
|
5636 |
+
var TokenIterator = function(session, initialRow, initialColumn) {
|
5637 |
+
this.$session = session;
|
5638 |
+
this.$row = initialRow;
|
5639 |
+
this.$rowTokens = session.getTokens(initialRow);
|
5640 |
+
|
5641 |
+
var token = session.getTokenAt(initialRow, initialColumn);
|
5642 |
+
this.$tokenIndex = token ? token.index : -1;
|
5643 |
+
};
|
5644 |
+
|
5645 |
+
(function() {
|
5646 |
+
this.stepBackward = function() {
|
5647 |
+
this.$tokenIndex -= 1;
|
5648 |
+
|
5649 |
+
while (this.$tokenIndex < 0) {
|
5650 |
+
this.$row -= 1;
|
5651 |
+
if (this.$row < 0) {
|
5652 |
+
this.$row = 0;
|
5653 |
+
return null;
|
5654 |
+
}
|
5655 |
+
|
5656 |
+
this.$rowTokens = this.$session.getTokens(this.$row);
|
5657 |
+
this.$tokenIndex = this.$rowTokens.length - 1;
|
5658 |
+
}
|
5659 |
+
|
5660 |
+
return this.$rowTokens[this.$tokenIndex];
|
5661 |
+
};
|
5662 |
+
this.stepForward = function() {
|
5663 |
+
this.$tokenIndex += 1;
|
5664 |
+
var rowCount;
|
5665 |
+
while (this.$tokenIndex >= this.$rowTokens.length) {
|
5666 |
+
this.$row += 1;
|
5667 |
+
if (!rowCount)
|
5668 |
+
rowCount = this.$session.getLength();
|
5669 |
+
if (this.$row >= rowCount) {
|
5670 |
+
this.$row = rowCount - 1;
|
5671 |
+
return null;
|
5672 |
+
}
|
5673 |
+
|
5674 |
+
this.$rowTokens = this.$session.getTokens(this.$row);
|
5675 |
+
this.$tokenIndex = 0;
|
5676 |
+
}
|
5677 |
+
|
5678 |
+
return this.$rowTokens[this.$tokenIndex];
|
5679 |
+
};
|
5680 |
+
this.getCurrentToken = function() {
|
5681 |
+
return this.$rowTokens[this.$tokenIndex];
|
5682 |
+
};
|
5683 |
+
this.getCurrentTokenRow = function() {
|
5684 |
+
return this.$row;
|
5685 |
+
};
|
5686 |
+
this.getCurrentTokenColumn = function() {
|
5687 |
+
var rowTokens = this.$rowTokens;
|
5688 |
+
var tokenIndex = this.$tokenIndex;
|
5689 |
+
var column = rowTokens[tokenIndex].start;
|
5690 |
+
if (column !== undefined)
|
5691 |
+
return column;
|
5692 |
+
|
5693 |
+
column = 0;
|
5694 |
+
while (tokenIndex > 0) {
|
5695 |
+
tokenIndex -= 1;
|
5696 |
+
column += rowTokens[tokenIndex].value.length;
|
5697 |
+
}
|
5698 |
+
|
5699 |
+
return column;
|
5700 |
+
};
|
5701 |
+
|
5702 |
+
}).call(TokenIterator.prototype);
|
5703 |
+
|
5704 |
+
exports.TokenIterator = TokenIterator;
|
5705 |
+
});
|
5706 |
+
|
5707 |
+
ace.define("ace/mode/text", ["require", "exports", "module", "ace/tokenizer", "ace/mode/text_highlight_rules", "ace/mode/behaviour", "ace/unicode", "ace/lib/lang", "ace/token_iterator", "ace/range"], function(require, exports, module) {
|
5708 |
+
"use strict";
|
5709 |
+
|
5710 |
+
var Tokenizer = require("../tokenizer").Tokenizer;
|
5711 |
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
5712 |
+
var Behaviour = require("./behaviour").Behaviour;
|
5713 |
+
var unicode = require("../unicode");
|
5714 |
+
var lang = require("../lib/lang");
|
5715 |
+
var TokenIterator = require("../token_iterator").TokenIterator;
|
5716 |
+
var Range = require("../range").Range;
|
5717 |
+
|
5718 |
+
var Mode = function() {
|
5719 |
+
this.HighlightRules = TextHighlightRules;
|
5720 |
+
this.$behaviour = new Behaviour();
|
5721 |
+
};
|
5722 |
+
|
5723 |
+
(function() {
|
5724 |
+
|
5725 |
+
this.tokenRe = new RegExp("^[" + unicode.packages.L + unicode.packages.Mn + unicode.packages.Mc + unicode.packages.Nd + unicode.packages.Pc + "\\$_]+", "g");
|
5726 |
+
|
5727 |
+
this.nonTokenRe = new RegExp("^(?:[^" + unicode.packages.L + unicode.packages.Mn + unicode.packages.Mc + unicode.packages.Nd + unicode.packages.Pc + "\\$_]|\\s])+", "g");
|
5728 |
+
|
5729 |
+
this.getTokenizer = function() {
|
5730 |
+
if (!this.$tokenizer) {
|
5731 |
+
this.$highlightRules = this.$highlightRules || new this.HighlightRules();
|
5732 |
+
this.$tokenizer = new Tokenizer(this.$highlightRules.getRules());
|
5733 |
+
}
|
5734 |
+
return this.$tokenizer;
|
5735 |
+
};
|
5736 |
+
|
5737 |
+
this.lineCommentStart = "";
|
5738 |
+
this.blockComment = "";
|
5739 |
+
|
5740 |
+
this.toggleCommentLines = function(state, session, startRow, endRow) {
|
5741 |
+
var doc = session.doc;
|
5742 |
+
|
5743 |
+
var ignoreBlankLines = true;
|
5744 |
+
var shouldRemove = true;
|
5745 |
+
var minIndent = Infinity;
|
5746 |
+
var tabSize = session.getTabSize();
|
5747 |
+
var insertAtTabStop = false;
|
5748 |
+
|
5749 |
+
if (!this.lineCommentStart) {
|
5750 |
+
if (!this.blockComment)
|
5751 |
+
return false;
|
5752 |
+
var lineCommentStart = this.blockComment.start;
|
5753 |
+
var lineCommentEnd = this.blockComment.end;
|
5754 |
+
var regexpStart = new RegExp("^(\\s*)(?:" + lang.escapeRegExp(lineCommentStart) + ")");
|
5755 |
+
var regexpEnd = new RegExp("(?:" + lang.escapeRegExp(lineCommentEnd) + ")\\s*$");
|
5756 |
+
|
5757 |
+
var comment = function(line, i) {
|
5758 |
+
if (testRemove(line, i))
|
5759 |
+
return;
|
5760 |
+
if (!ignoreBlankLines || /\S/.test(line)) {
|
5761 |
+
doc.insertInLine({
|
5762 |
+
row: i,
|
5763 |
+
column: line.length
|
5764 |
+
}, lineCommentEnd);
|
5765 |
+
doc.insertInLine({
|
5766 |
+
row: i,
|
5767 |
+
column: minIndent
|
5768 |
+
}, lineCommentStart);
|
5769 |
+
}
|
5770 |
+
};
|
5771 |
+
|
5772 |
+
var uncomment = function(line, i) {
|
5773 |
+
var m;
|
5774 |
+
if (m = line.match(regexpEnd))
|
5775 |
+
doc.removeInLine(i, line.length - m[0].length, line.length);
|
5776 |
+
if (m = line.match(regexpStart))
|
5777 |
+
doc.removeInLine(i, m[1].length, m[0].length);
|
5778 |
+
};
|
5779 |
+
|
5780 |
+
var testRemove = function(line, row) {
|
5781 |
+
if (regexpStart.test(line))
|
5782 |
+
return true;
|
5783 |
+
var tokens = session.getTokens(row);
|
5784 |
+
for (var i = 0; i < tokens.length; i++) {
|
5785 |
+
if (tokens[i].type === 'comment')
|
5786 |
+
return true;
|
5787 |
+
}
|
5788 |
+
};
|
5789 |
+
} else {
|
5790 |
+
if (Array.isArray(this.lineCommentStart)) {
|
5791 |
+
var regexpStart = this.lineCommentStart.map(lang.escapeRegExp).join("|");
|
5792 |
+
var lineCommentStart = this.lineCommentStart[0];
|
5793 |
+
} else {
|
5794 |
+
var regexpStart = lang.escapeRegExp(this.lineCommentStart);
|
5795 |
+
var lineCommentStart = this.lineCommentStart;
|
5796 |
+
}
|
5797 |
+
regexpStart = new RegExp("^(\\s*)(?:" + regexpStart + ") ?");
|
5798 |
+
|
5799 |
+
insertAtTabStop = session.getUseSoftTabs();
|
5800 |
+
|
5801 |
+
var uncomment = function(line, i) {
|
5802 |
+
var m = line.match(regexpStart);
|
5803 |
+
if (!m) return;
|
5804 |
+
var start = m[1].length,
|
5805 |
+
end = m[0].length;
|
5806 |
+
if (!shouldInsertSpace(line, start, end) && m[0][end - 1] == " ")
|
5807 |
+
end--;
|
5808 |
+
doc.removeInLine(i, start, end);
|
5809 |
+
};
|
5810 |
+
var commentWithSpace = lineCommentStart + " ";
|
5811 |
+
var comment = function(line, i) {
|
5812 |
+
if (!ignoreBlankLines || /\S/.test(line)) {
|
5813 |
+
if (shouldInsertSpace(line, minIndent, minIndent))
|
5814 |
+
doc.insertInLine({
|
5815 |
+
row: i,
|
5816 |
+
column: minIndent
|
5817 |
+
}, commentWithSpace);
|
5818 |
+
else
|
5819 |
+
doc.insertInLine({
|
5820 |
+
row: i,
|
5821 |
+
column: minIndent
|
5822 |
+
}, lineCommentStart);
|
5823 |
+
}
|
5824 |
+
};
|
5825 |
+
var testRemove = function(line, i) {
|
5826 |
+
return regexpStart.test(line);
|
5827 |
+
};
|
5828 |
+
|
5829 |
+
var shouldInsertSpace = function(line, before, after) {
|
5830 |
+
var spaces = 0;
|
5831 |
+
while (before-- && line.charAt(before) == " ")
|
5832 |
+
spaces++;
|
5833 |
+
if (spaces % tabSize != 0)
|
5834 |
+
return false;
|
5835 |
+
var spaces = 0;
|
5836 |
+
while (line.charAt(after++) == " ")
|
5837 |
+
spaces++;
|
5838 |
+
if (tabSize > 2)
|
5839 |
+
return spaces % tabSize != tabSize - 1;
|
5840 |
+
else
|
5841 |
+
return spaces % tabSize == 0;
|
5842 |
+
return true;
|
5843 |
+
};
|
5844 |
+
}
|
5845 |
+
|
5846 |
+
function iter(fun) {
|
5847 |
+
for (var i = startRow; i <= endRow; i++)
|
5848 |
+
fun(doc.getLine(i), i);
|
5849 |
+
}
|
5850 |
+
|
5851 |
+
|
5852 |
+
var minEmptyLength = Infinity;
|
5853 |
+
iter(function(line, i) {
|
5854 |
+
var indent = line.search(/\S/);
|
5855 |
+
if (indent !== -1) {
|
5856 |
+
if (indent < minIndent)
|
5857 |
+
minIndent = indent;
|
5858 |
+
if (shouldRemove && !testRemove(line, i))
|
5859 |
+
shouldRemove = false;
|
5860 |
+
} else if (minEmptyLength > line.length) {
|
5861 |
+
minEmptyLength = line.length;
|
5862 |
+
}
|
5863 |
+
});
|
5864 |
+
|
5865 |
+
if (minIndent == Infinity) {
|
5866 |
+
minIndent = minEmptyLength;
|
5867 |
+
ignoreBlankLines = false;
|
5868 |
+
shouldRemove = false;
|
5869 |
+
}
|
5870 |
+
|
5871 |
+
if (insertAtTabStop && minIndent % tabSize != 0)
|
5872 |
+
minIndent = Math.floor(minIndent / tabSize) * tabSize;
|
5873 |
+
|
5874 |
+
iter(shouldRemove ? uncomment : comment);
|
5875 |
+
};
|
5876 |
+
|
5877 |
+
this.toggleBlockComment = function(state, session, range, cursor) {
|
5878 |
+
var comment = this.blockComment;
|
5879 |
+
if (!comment)
|
5880 |
+
return;
|
5881 |
+
if (!comment.start && comment[0])
|
5882 |
+
comment = comment[0];
|
5883 |
+
|
5884 |
+
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
5885 |
+
var token = iterator.getCurrentToken();
|
5886 |
+
|
5887 |
+
var sel = session.selection;
|
5888 |
+
var initialRange = session.selection.toOrientedRange();
|
5889 |
+
var startRow, colDiff;
|
5890 |
+
|
5891 |
+
if (token && /comment/.test(token.type)) {
|
5892 |
+
var startRange, endRange;
|
5893 |
+
while (token && /comment/.test(token.type)) {
|
5894 |
+
var i = token.value.indexOf(comment.start);
|
5895 |
+
if (i != -1) {
|
5896 |
+
var row = iterator.getCurrentTokenRow();
|
5897 |
+
var column = iterator.getCurrentTokenColumn() + i;
|
5898 |
+
startRange = new Range(row, column, row, column + comment.start.length);
|
5899 |
+
break;
|
5900 |
+
}
|
5901 |
+
token = iterator.stepBackward();
|
5902 |
+
}
|
5903 |
+
|
5904 |
+
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
5905 |
+
var token = iterator.getCurrentToken();
|
5906 |
+
while (token && /comment/.test(token.type)) {
|
5907 |
+
var i = token.value.indexOf(comment.end);
|
5908 |
+
if (i != -1) {
|
5909 |
+
var row = iterator.getCurrentTokenRow();
|
5910 |
+
var column = iterator.getCurrentTokenColumn() + i;
|
5911 |
+
endRange = new Range(row, column, row, column + comment.end.length);
|
5912 |
+
break;
|
5913 |
+
}
|
5914 |
+
token = iterator.stepForward();
|
5915 |
+
}
|
5916 |
+
if (endRange)
|
5917 |
+
session.remove(endRange);
|
5918 |
+
if (startRange) {
|
5919 |
+
session.remove(startRange);
|
5920 |
+
startRow = startRange.start.row;
|
5921 |
+
colDiff = -comment.start.length;
|
5922 |
+
}
|
5923 |
+
} else {
|
5924 |
+
colDiff = comment.start.length;
|
5925 |
+
startRow = range.start.row;
|
5926 |
+
session.insert(range.end, comment.end);
|
5927 |
+
session.insert(range.start, comment.start);
|
5928 |
+
}
|
5929 |
+
if (initialRange.start.row == startRow)
|
5930 |
+
initialRange.start.column += colDiff;
|
5931 |
+
if (initialRange.end.row == startRow)
|
5932 |
+
initialRange.end.column += colDiff;
|
5933 |
+
session.selection.fromOrientedRange(initialRange);
|
5934 |
+
};
|
5935 |
+
|
5936 |
+
this.getNextLineIndent = function(state, line, tab) {
|
5937 |
+
return this.$getIndent(line);
|
5938 |
+
};
|
5939 |
+
|
5940 |
+
this.checkOutdent = function(state, line, input) {
|
5941 |
+
return false;
|
5942 |
+
};
|
5943 |
+
|
5944 |
+
this.autoOutdent = function(state, doc, row) {};
|
5945 |
+
|
5946 |
+
this.$getIndent = function(line) {
|
5947 |
+
return line.match(/^\s*/)[0];
|
5948 |
+
};
|
5949 |
+
|
5950 |
+
this.createWorker = function(session) {
|
5951 |
+
return null;
|
5952 |
+
};
|
5953 |
+
|
5954 |
+
this.createModeDelegates = function(mapping) {
|
5955 |
+
this.$embeds = [];
|
5956 |
+
this.$modes = {};
|
5957 |
+
for (var i in mapping) {
|
5958 |
+
if (mapping[i]) {
|
5959 |
+
this.$embeds.push(i);
|
5960 |
+
this.$modes[i] = new mapping[i]();
|
5961 |
+
}
|
5962 |
+
}
|
5963 |
+
|
5964 |
+
var delegations = ['toggleBlockComment', 'toggleCommentLines', 'getNextLineIndent',
|
5965 |
+
'checkOutdent', 'autoOutdent', 'transformAction', 'getCompletions'
|
5966 |
+
];
|
5967 |
+
|
5968 |
+
for (var i = 0; i < delegations.length; i++) {
|
5969 |
+
(function(scope) {
|
5970 |
+
var functionName = delegations[i];
|
5971 |
+
var defaultHandler = scope[functionName];
|
5972 |
+
scope[delegations[i]] = function() {
|
5973 |
+
return this.$delegator(functionName, arguments, defaultHandler);
|
5974 |
+
};
|
5975 |
+
}(this));
|
5976 |
+
}
|
5977 |
+
};
|
5978 |
+
|
5979 |
+
this.$delegator = function(method, args, defaultHandler) {
|
5980 |
+
var state = args[0];
|
5981 |
+
if (typeof state != "string")
|
5982 |
+
state = state[0];
|
5983 |
+
for (var i = 0; i < this.$embeds.length; i++) {
|
5984 |
+
if (!this.$modes[this.$embeds[i]]) continue;
|
5985 |
+
|
5986 |
+
var split = state.split(this.$embeds[i]);
|
5987 |
+
if (!split[0] && split[1]) {
|
5988 |
+
args[0] = split[1];
|
5989 |
+
var mode = this.$modes[this.$embeds[i]];
|
5990 |
+
return mode[method].apply(mode, args);
|
5991 |
+
}
|
5992 |
+
}
|
5993 |
+
var ret = defaultHandler.apply(this, args);
|
5994 |
+
return defaultHandler ? ret : undefined;
|
5995 |
+
};
|
5996 |
+
|
5997 |
+
this.transformAction = function(state, action, editor, session, param) {
|
5998 |
+
if (this.$behaviour) {
|
5999 |
+
var behaviours = this.$behaviour.getBehaviours();
|
6000 |
+
for (var key in behaviours) {
|
6001 |
+
if (behaviours[key][action]) {
|
6002 |
+
var ret = behaviours[key][action].apply(this, arguments);
|
6003 |
+
if (ret) {
|
6004 |
+
return ret;
|
6005 |
+
}
|
6006 |
+
}
|
6007 |
+
}
|
6008 |
+
}
|
6009 |
+
};
|
6010 |
+
|
6011 |
+
this.getKeywords = function(append) {
|
6012 |
+
if (!this.completionKeywords) {
|
6013 |
+
var rules = this.$tokenizer.rules;
|
6014 |
+
var completionKeywords = [];
|
6015 |
+
for (var rule in rules) {
|
6016 |
+
var ruleItr = rules[rule];
|
6017 |
+
for (var r = 0, l = ruleItr.length; r < l; r++) {
|
6018 |
+
if (typeof ruleItr[r].token === "string") {
|
6019 |
+
if (/keyword|support|storage/.test(ruleItr[r].token))
|
6020 |
+
completionKeywords.push(ruleItr[r].regex);
|
6021 |
+
} else if (typeof ruleItr[r].token === "object") {
|
6022 |
+
for (var a = 0, aLength = ruleItr[r].token.length; a < aLength; a++) {
|
6023 |
+
if (/keyword|support|storage/.test(ruleItr[r].token[a])) {
|
6024 |
+
var rule = ruleItr[r].regex.match(/\(.+?\)/g)[a];
|
6025 |
+
completionKeywords.push(rule.substr(1, rule.length - 2));
|
6026 |
+
}
|
6027 |
+
}
|
6028 |
+
}
|
6029 |
+
}
|
6030 |
+
}
|
6031 |
+
this.completionKeywords = completionKeywords;
|
6032 |
+
}
|
6033 |
+
if (!append)
|
6034 |
+
return this.$keywordList;
|
6035 |
+
return completionKeywords.concat(this.$keywordList || []);
|
6036 |
+
};
|
6037 |
+
|
6038 |
+
this.$createKeywordList = function() {
|
6039 |
+
if (!this.$highlightRules)
|
6040 |
+
this.getTokenizer();
|
6041 |
+
return this.$keywordList = this.$highlightRules.$keywordList || [];
|
6042 |
+
};
|
6043 |
+
|
6044 |
+
this.getCompletions = function(state, session, pos, prefix) {
|
6045 |
+
var keywords = this.$keywordList || this.$createKeywordList();
|
6046 |
+
return keywords.map(function(word) {
|
6047 |
+
return {
|
6048 |
+
name: word,
|
6049 |
+
value: word,
|
6050 |
+
score: 0,
|
6051 |
+
meta: "keyword"
|
6052 |
+
};
|
6053 |
+
});
|
6054 |
+
};
|
6055 |
+
|
6056 |
+
this.$id = "ace/mode/text";
|
6057 |
+
}).call(Mode.prototype);
|
6058 |
+
|
6059 |
+
exports.Mode = Mode;
|
6060 |
+
});
|
6061 |
+
|
6062 |
+
ace.define("ace/anchor", ["require", "exports", "module", "ace/lib/oop", "ace/lib/event_emitter"], function(require, exports, module) {
|
6063 |
+
"use strict";
|
6064 |
+
|
6065 |
+
var oop = require("./lib/oop");
|
6066 |
+
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
6067 |
+
|
6068 |
+
var Anchor = exports.Anchor = function(doc, row, column) {
|
6069 |
+
this.$onChange = this.onChange.bind(this);
|
6070 |
+
this.attach(doc);
|
6071 |
+
|
6072 |
+
if (typeof column == "undefined")
|
6073 |
+
this.setPosition(row.row, row.column);
|
6074 |
+
else
|
6075 |
+
this.setPosition(row, column);
|
6076 |
+
};
|
6077 |
+
|
6078 |
+
(function() {
|
6079 |
+
|
6080 |
+
oop.implement(this, EventEmitter);
|
6081 |
+
this.getPosition = function() {
|
6082 |
+
return this.$clipPositionToDocument(this.row, this.column);
|
6083 |
+
};
|
6084 |
+
this.getDocument = function() {
|
6085 |
+
return this.document;
|
6086 |
+
};
|
6087 |
+
this.$insertRight = false;
|
6088 |
+
this.onChange = function(e) {
|
6089 |
+
var delta = e.data;
|
6090 |
+
var range = delta.range;
|
6091 |
+
|
6092 |
+
if (range.start.row == range.end.row && range.start.row != this.row)
|
6093 |
+
return;
|
6094 |
+
|
6095 |
+
if (range.start.row > this.row)
|
6096 |
+
return;
|
6097 |
+
|
6098 |
+
if (range.start.row == this.row && range.start.column > this.column)
|
6099 |
+
return;
|
6100 |
+
|
6101 |
+
var row = this.row;
|
6102 |
+
var column = this.column;
|
6103 |
+
var start = range.start;
|
6104 |
+
var end = range.end;
|
6105 |
+
|
6106 |
+
if (delta.action === "insertText") {
|
6107 |
+
if (start.row === row && start.column <= column) {
|
6108 |
+
if (start.column === column && this.$insertRight) {} else if (start.row === end.row) {
|
6109 |
+
column += end.column - start.column;
|
6110 |
+
} else {
|
6111 |
+
column -= start.column;
|
6112 |
+
row += end.row - start.row;
|
6113 |
+
}
|
6114 |
+
} else if (start.row !== end.row && start.row < row) {
|
6115 |
+
row += end.row - start.row;
|
6116 |
+
}
|
6117 |
+
} else if (delta.action === "insertLines") {
|
6118 |
+
if (start.row === row && column === 0 && this.$insertRight) {} else if (start.row <= row) {
|
6119 |
+
row += end.row - start.row;
|
6120 |
+
}
|
6121 |
+
} else if (delta.action === "removeText") {
|
6122 |
+
if (start.row === row && start.column < column) {
|
6123 |
+
if (end.column >= column)
|
6124 |
+
column = start.column;
|
6125 |
+
else
|
6126 |
+
column = Math.max(0, column - (end.column - start.column));
|
6127 |
+
|
6128 |
+
} else if (start.row !== end.row && start.row < row) {
|
6129 |
+
if (end.row === row)
|
6130 |
+
column = Math.max(0, column - end.column) + start.column;
|
6131 |
+
row -= (end.row - start.row);
|
6132 |
+
} else if (end.row === row) {
|
6133 |
+
row -= end.row - start.row;
|
6134 |
+
column = Math.max(0, column - end.column) + start.column;
|
6135 |
+
}
|
6136 |
+
} else if (delta.action == "removeLines") {
|
6137 |
+
if (start.row <= row) {
|
6138 |
+
if (end.row <= row)
|
6139 |
+
row -= end.row - start.row;
|
6140 |
+
else {
|
6141 |
+
row = start.row;
|
6142 |
+
column = 0;
|
6143 |
+
}
|
6144 |
+
}
|
6145 |
+
}
|
6146 |
+
|
6147 |
+
this.setPosition(row, column, true);
|
6148 |
+
};
|
6149 |
+
this.setPosition = function(row, column, noClip) {
|
6150 |
+
var pos;
|
6151 |
+
if (noClip) {
|
6152 |
+
pos = {
|
6153 |
+
row: row,
|
6154 |
+
column: column
|
6155 |
+
};
|
6156 |
+
} else {
|
6157 |
+
pos = this.$clipPositionToDocument(row, column);
|
6158 |
+
}
|
6159 |
+
|
6160 |
+
if (this.row == pos.row && this.column == pos.column)
|
6161 |
+
return;
|
6162 |
+
|
6163 |
+
var old = {
|
6164 |
+
row: this.row,
|
6165 |
+
column: this.column
|
6166 |
+
};
|
6167 |
+
|
6168 |
+
this.row = pos.row;
|
6169 |
+
this.column = pos.column;
|
6170 |
+
this._signal("change", {
|
6171 |
+
old: old,
|
6172 |
+
value: pos
|
6173 |
+
});
|
6174 |
+
};
|
6175 |
+
this.detach = function() {
|
6176 |
+
this.document.removeEventListener("change", this.$onChange);
|
6177 |
+
};
|
6178 |
+
this.attach = function(doc) {
|
6179 |
+
this.document = doc || this.document;
|
6180 |
+
this.document.on("change", this.$onChange);
|
6181 |
+
};
|
6182 |
+
this.$clipPositionToDocument = function(row, column) {
|
6183 |
+
var pos = {};
|
6184 |
+
|
6185 |
+
if (row >= this.document.getLength()) {
|
6186 |
+
pos.row = Math.max(0, this.document.getLength() - 1);
|
6187 |
+
pos.column = this.document.getLine(pos.row).length;
|
6188 |
+
} else if (row < 0) {
|
6189 |
+
pos.row = 0;
|
6190 |
+
pos.column = 0;
|
6191 |
+
} else {
|
6192 |
+
pos.row = row;
|
6193 |
+
pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
|
6194 |
+
}
|
6195 |
+
|
6196 |
+
if (column < 0)
|
6197 |
+
pos.column = 0;
|
6198 |
+
|
6199 |
+
return pos;
|
6200 |
+
};
|
6201 |
+
|
6202 |
+
}).call(Anchor.prototype);
|
6203 |
+
|
6204 |
+
});
|
6205 |
+
|
6206 |
+
ace.define("ace/document", ["require", "exports", "module", "ace/lib/oop", "ace/lib/event_emitter", "ace/range", "ace/anchor"], function(require, exports, module) {
|
6207 |
+
"use strict";
|
6208 |
+
|
6209 |
+
var oop = require("./lib/oop");
|
6210 |
+
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
6211 |
+
var Range = require("./range").Range;
|
6212 |
+
var Anchor = require("./anchor").Anchor;
|
6213 |
+
|
6214 |
+
var Document = function(text) {
|
6215 |
+
this.$lines = [];
|
6216 |
+
if (text.length === 0) {
|
6217 |
+
this.$lines = [""];
|
6218 |
+
} else if (Array.isArray(text)) {
|
6219 |
+
this._insertLines(0, text);
|
6220 |
+
} else {
|
6221 |
+
this.insert({
|
6222 |
+
row: 0,
|
6223 |
+
column: 0
|
6224 |
+
}, text);
|
6225 |
+
}
|
6226 |
+
};
|
6227 |
+
|
6228 |
+
(function() {
|
6229 |
+
|
6230 |
+
oop.implement(this, EventEmitter);
|
6231 |
+
this.setValue = function(text) {
|
6232 |
+
var len = this.getLength();
|
6233 |
+
this.remove(new Range(0, 0, len, this.getLine(len - 1).length));
|
6234 |
+
this.insert({
|
6235 |
+
row: 0,
|
6236 |
+
column: 0
|
6237 |
+
}, text);
|
6238 |
+
};
|
6239 |
+
this.getValue = function() {
|
6240 |
+
return this.getAllLines().join(this.getNewLineCharacter());
|
6241 |
+
};
|
6242 |
+
this.createAnchor = function(row, column) {
|
6243 |
+
return new Anchor(this, row, column);
|
6244 |
+
};
|
6245 |
+
if ("aaa".split(/a/).length === 0)
|
6246 |
+
this.$split = function(text) {
|
6247 |
+
return text.replace(/\r\n|\r/g, "\n").split("\n");
|
6248 |
+
};
|
6249 |
+
else
|
6250 |
+
this.$split = function(text) {
|
6251 |
+
return text.split(/\r\n|\r|\n/);
|
6252 |
+
};
|
6253 |
+
|
6254 |
+
|
6255 |
+
this.$detectNewLine = function(text) {
|
6256 |
+
var match = text.match(/^.*?(\r\n|\r|\n)/m);
|
6257 |
+
this.$autoNewLine = match ? match[1] : "\n";
|
6258 |
+
this._signal("changeNewLineMode");
|
6259 |
+
};
|
6260 |
+
this.getNewLineCharacter = function() {
|
6261 |
+
switch (this.$newLineMode) {
|
6262 |
+
case "windows":
|
6263 |
+
return "\r\n";
|
6264 |
+
case "unix":
|
6265 |
+
return "\n";
|
6266 |
+
default:
|
6267 |
+
return this.$autoNewLine || "\n";
|
6268 |
+
}
|
6269 |
+
};
|
6270 |
+
|
6271 |
+
this.$autoNewLine = "";
|
6272 |
+
this.$newLineMode = "auto";
|
6273 |
+
this.setNewLineMode = function(newLineMode) {
|
6274 |
+
if (this.$newLineMode === newLineMode)
|
6275 |
+
return;
|
6276 |
+
|
6277 |
+
this.$newLineMode = newLineMode;
|
6278 |
+
this._signal("changeNewLineMode");
|
6279 |
+
};
|
6280 |
+
this.getNewLineMode = function() {
|
6281 |
+
return this.$newLineMode;
|
6282 |
+
};
|
6283 |
+
this.isNewLine = function(text) {
|
6284 |
+
return (text == "\r\n" || text == "\r" || text == "\n");
|
6285 |
+
};
|
6286 |
+
this.getLine = function(row) {
|
6287 |
+
return this.$lines[row] || "";
|
6288 |
+
};
|
6289 |
+
this.getLines = function(firstRow, lastRow) {
|
6290 |
+
return this.$lines.slice(firstRow, lastRow + 1);
|
6291 |
+
};
|
6292 |
+
this.getAllLines = function() {
|
6293 |
+
return this.getLines(0, this.getLength());
|
6294 |
+
};
|
6295 |
+
this.getLength = function() {
|
6296 |
+
return this.$lines.length;
|
6297 |
+
};
|
6298 |
+
this.getTextRange = function(range) {
|
6299 |
+
if (range.start.row == range.end.row) {
|
6300 |
+
return this.getLine(range.start.row)
|
6301 |
+
.substring(range.start.column, range.end.column);
|
6302 |
+
}
|
6303 |
+
var lines = this.getLines(range.start.row, range.end.row);
|
6304 |
+
lines[0] = (lines[0] || "").substring(range.start.column);
|
6305 |
+
var l = lines.length - 1;
|
6306 |
+
if (range.end.row - range.start.row == l)
|
6307 |
+
lines[l] = lines[l].substring(0, range.end.column);
|
6308 |
+
return lines.join(this.getNewLineCharacter());
|
6309 |
+
};
|
6310 |
+
|
6311 |
+
this.$clipPosition = function(position) {
|
6312 |
+
var length = this.getLength();
|
6313 |
+
if (position.row >= length) {
|
6314 |
+
position.row = Math.max(0, length - 1);
|
6315 |
+
position.column = this.getLine(length - 1).length;
|
6316 |
+
} else if (position.row < 0)
|
6317 |
+
position.row = 0;
|
6318 |
+
return position;
|
6319 |
+
};
|
6320 |
+
this.insert = function(position, text) {
|
6321 |
+
if (!text || text.length === 0)
|
6322 |
+
return position;
|
6323 |
+
|
6324 |
+
position = this.$clipPosition(position);
|
6325 |
+
if (this.getLength() <= 1)
|
6326 |
+
this.$detectNewLine(text);
|
6327 |
+
|
6328 |
+
var lines = this.$split(text);
|
6329 |
+
var firstLine = lines.splice(0, 1)[0];
|
6330 |
+
var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0];
|
6331 |
+
|
6332 |
+
position = this.insertInLine(position, firstLine);
|
6333 |
+
if (lastLine !== null) {
|
6334 |
+
position = this.insertNewLine(position); // terminate first line
|
6335 |
+
position = this._insertLines(position.row, lines);
|
6336 |
+
position = this.insertInLine(position, lastLine || "");
|
6337 |
+
}
|
6338 |
+
return position;
|
6339 |
+
};
|
6340 |
+
this.insertLines = function(row, lines) {
|
6341 |
+
if (row >= this.getLength())
|
6342 |
+
return this.insert({
|
6343 |
+
row: row,
|
6344 |
+
column: 0
|
6345 |
+
}, "\n" + lines.join("\n"));
|
6346 |
+
return this._insertLines(Math.max(row, 0), lines);
|
6347 |
+
};
|
6348 |
+
this._insertLines = function(row, lines) {
|
6349 |
+
if (lines.length == 0)
|
6350 |
+
return {
|
6351 |
+
row: row,
|
6352 |
+
column: 0
|
6353 |
+
};
|
6354 |
+
while (lines.length > 0xF000) {
|
6355 |
+
var end = this._insertLines(row, lines.slice(0, 0xF000));
|
6356 |
+
lines = lines.slice(0xF000);
|
6357 |
+
row = end.row;
|
6358 |
+
}
|
6359 |
+
|
6360 |
+
var args = [row, 0];
|
6361 |
+
args.push.apply(args, lines);
|
6362 |
+
this.$lines.splice.apply(this.$lines, args);
|
6363 |
+
|
6364 |
+
var range = new Range(row, 0, row + lines.length, 0);
|
6365 |
+
var delta = {
|
6366 |
+
action: "insertLines",
|
6367 |
+
range: range,
|
6368 |
+
lines: lines
|
6369 |
+
};
|
6370 |
+
this._signal("change", {
|
6371 |
+
data: delta
|
6372 |
+
});
|
6373 |
+
return range.end;
|
6374 |
+
};
|
6375 |
+
this.insertNewLine = function(position) {
|
6376 |
+
position = this.$clipPosition(position);
|
6377 |
+
var line = this.$lines[position.row] || "";
|
6378 |
+
|
6379 |
+
this.$lines[position.row] = line.substring(0, position.column);
|
6380 |
+
this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length));
|
6381 |
+
|
6382 |
+
var end = {
|
6383 |
+
row: position.row + 1,
|
6384 |
+
column: 0
|
6385 |
+
};
|
6386 |
+
|
6387 |
+
var delta = {
|
6388 |
+
action: "insertText",
|
6389 |
+
range: Range.fromPoints(position, end),
|
6390 |
+
text: this.getNewLineCharacter()
|
6391 |
+
};
|
6392 |
+
this._signal("change", {
|
6393 |
+
data: delta
|
6394 |
+
});
|
6395 |
+
|
6396 |
+
return end;
|
6397 |
+
};
|
6398 |
+
this.insertInLine = function(position, text) {
|
6399 |
+
if (text.length == 0)
|
6400 |
+
return position;
|
6401 |
+
|
6402 |
+
var line = this.$lines[position.row] || "";
|
6403 |
+
|
6404 |
+
this.$lines[position.row] = line.substring(0, position.column) + text + line.substring(position.column);
|
6405 |
+
|
6406 |
+
var end = {
|
6407 |
+
row: position.row,
|
6408 |
+
column: position.column + text.length
|
6409 |
+
};
|
6410 |
+
|
6411 |
+
var delta = {
|
6412 |
+
action: "insertText",
|
6413 |
+
range: Range.fromPoints(position, end),
|
6414 |
+
text: text
|
6415 |
+
};
|
6416 |
+
this._signal("change", {
|
6417 |
+
data: delta
|
6418 |
+
});
|
6419 |
+
|
6420 |
+
return end;
|
6421 |
+
};
|
6422 |
+
this.remove = function(range) {
|
6423 |
+
if (!(range instanceof Range))
|
6424 |
+
range = Range.fromPoints(range.start, range.end);
|
6425 |
+
range.start = this.$clipPosition(range.start);
|
6426 |
+
range.end = this.$clipPosition(range.end);
|
6427 |
+
|
6428 |
+
if (range.isEmpty())
|
6429 |
+
return range.start;
|
6430 |
+
|
6431 |
+
var firstRow = range.start.row;
|
6432 |
+
var lastRow = range.end.row;
|
6433 |
+
|
6434 |
+
if (range.isMultiLine()) {
|
6435 |
+
var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1;
|
6436 |
+
var lastFullRow = lastRow - 1;
|
6437 |
+
|
6438 |
+
if (range.end.column > 0)
|
6439 |
+
this.removeInLine(lastRow, 0, range.end.column);
|
6440 |
+
|
6441 |
+
if (lastFullRow >= firstFullRow)
|
6442 |
+
this._removeLines(firstFullRow, lastFullRow);
|
6443 |
+
|
6444 |
+
if (firstFullRow != firstRow) {
|
6445 |
+
this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);
|
6446 |
+
this.removeNewLine(range.start.row);
|
6447 |
+
}
|
6448 |
+
} else {
|
6449 |
+
this.removeInLine(firstRow, range.start.column, range.end.column);
|
6450 |
+
}
|
6451 |
+
return range.start;
|
6452 |
+
};
|
6453 |
+
this.removeInLine = function(row, startColumn, endColumn) {
|
6454 |
+
if (startColumn == endColumn)
|
6455 |
+
return;
|
6456 |
+
|
6457 |
+
var range = new Range(row, startColumn, row, endColumn);
|
6458 |
+
var line = this.getLine(row);
|
6459 |
+
var removed = line.substring(startColumn, endColumn);
|
6460 |
+
var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length);
|
6461 |
+
this.$lines.splice(row, 1, newLine);
|
6462 |
+
|
6463 |
+
var delta = {
|
6464 |
+
action: "removeText",
|
6465 |
+
range: range,
|
6466 |
+
text: removed
|
6467 |
+
};
|
6468 |
+
this._signal("change", {
|
6469 |
+
data: delta
|
6470 |
+
});
|
6471 |
+
return range.start;
|
6472 |
+
};
|
6473 |
+
this.removeLines = function(firstRow, lastRow) {
|
6474 |
+
if (firstRow < 0 || lastRow >= this.getLength())
|
6475 |
+
return this.remove(new Range(firstRow, 0, lastRow + 1, 0));
|
6476 |
+
return this._removeLines(firstRow, lastRow);
|
6477 |
+
};
|
6478 |
+
|
6479 |
+
this._removeLines = function(firstRow, lastRow) {
|
6480 |
+
var range = new Range(firstRow, 0, lastRow + 1, 0);
|
6481 |
+
var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
|
6482 |
+
|
6483 |
+
var delta = {
|
6484 |
+
action: "removeLines",
|
6485 |
+
range: range,
|
6486 |
+
nl: this.getNewLineCharacter(),
|
6487 |
+
lines: removed
|
6488 |
+
};
|
6489 |
+
this._signal("change", {
|
6490 |
+
data: delta
|
6491 |
+
});
|
6492 |
+
return removed;
|
6493 |
+
};
|
6494 |
+
this.removeNewLine = function(row) {
|
6495 |
+
var firstLine = this.getLine(row);
|
6496 |
+
var secondLine = this.getLine(row + 1);
|
6497 |
+
|
6498 |
+
var range = new Range(row, firstLine.length, row + 1, 0);
|
6499 |
+
var line = firstLine + secondLine;
|
6500 |
+
|
6501 |
+
this.$lines.splice(row, 2, line);
|
6502 |
+
|
6503 |
+
var delta = {
|
6504 |
+
action: "removeText",
|
6505 |
+
range: range,
|
6506 |
+
text: this.getNewLineCharacter()
|
6507 |
+
};
|
6508 |
+
this._signal("change", {
|
6509 |
+
data: delta
|
6510 |
+
});
|
6511 |
+
};
|
6512 |
+
this.replace = function(range, text) {
|
6513 |
+
if (!(range instanceof Range))
|
6514 |
+
range = Range.fromPoints(range.start, range.end);
|
6515 |
+
if (text.length == 0 && range.isEmpty())
|
6516 |
+
return range.start;
|
6517 |
+
if (text == this.getTextRange(range))
|
6518 |
+
return range.end;
|
6519 |
+
|
6520 |
+
this.remove(range);
|
6521 |
+
if (text) {
|
6522 |
+
var end = this.insert(range.start, text);
|
6523 |
+
} else {
|
6524 |
+
end = range.start;
|
6525 |
+
}
|
6526 |
+
|
6527 |
+
return end;
|
6528 |
+
};
|
6529 |
+
this.applyDeltas = function(deltas) {
|
6530 |
+
for (var i = 0; i < deltas.length; i++) {
|
6531 |
+
var delta = deltas[i];
|
6532 |
+
var range = Range.fromPoints(delta.range.start, delta.range.end);
|
6533 |
+
|
6534 |
+
if (delta.action == "insertLines")
|
6535 |
+
this.insertLines(range.start.row, delta.lines);
|
6536 |
+
else if (delta.action == "insertText")
|
6537 |
+
this.insert(range.start, delta.text);
|
6538 |
+
else if (delta.action == "removeLines")
|
6539 |
+
this._removeLines(range.start.row, range.end.row - 1);
|
6540 |
+
else if (delta.action == "removeText")
|
6541 |
+
this.remove(range);
|
6542 |
+
}
|
6543 |
+
};
|
6544 |
+
this.revertDeltas = function(deltas) {
|
6545 |
+
for (var i = deltas.length - 1; i >= 0; i--) {
|
6546 |
+
var delta = deltas[i];
|
6547 |
+
|
6548 |
+
var range = Range.fromPoints(delta.range.start, delta.range.end);
|
6549 |
+
|
6550 |
+
if (delta.action == "insertLines")
|
6551 |
+
this._removeLines(range.start.row, range.end.row - 1);
|
6552 |
+
else if (delta.action == "insertText")
|
6553 |
+
this.remove(range);
|
6554 |
+
else if (delta.action == "removeLines")
|
6555 |
+
this._insertLines(range.start.row, delta.lines);
|
6556 |
+
else if (delta.action == "removeText")
|
6557 |
+
this.insert(range.start, delta.text);
|
6558 |
+
}
|
6559 |
+
};
|
6560 |
+
this.indexToPosition = function(index, startRow) {
|
6561 |
+
var lines = this.$lines || this.getAllLines();
|
6562 |
+
var newlineLength = this.getNewLineCharacter().length;
|
6563 |
+
for (var i = startRow || 0, l = lines.length; i < l; i++) {
|
6564 |
+
index -= lines[i].length + newlineLength;
|
6565 |
+
if (index < 0)
|
6566 |
+
return {
|
6567 |
+
row: i,
|
6568 |
+
column: index + lines[i].length + newlineLength
|
6569 |
+
};
|
6570 |
+
}
|
6571 |
+
return {
|
6572 |
+
row: l - 1,
|
6573 |
+
column: lines[l - 1].length
|
6574 |
+
};
|
6575 |
+
};
|
6576 |
+
this.positionToIndex = function(pos, startRow) {
|
6577 |
+
var lines = this.$lines || this.getAllLines();
|
6578 |
+
var newlineLength = this.getNewLineCharacter().length;
|
6579 |
+
var index = 0;
|
6580 |
+
var row = Math.min(pos.row, lines.length);
|
6581 |
+
for (var i = startRow || 0; i < row; ++i)
|
6582 |
+
index += lines[i].length + newlineLength;
|
6583 |
+
|
6584 |
+
return index + pos.column;
|
6585 |
+
};
|
6586 |
+
|
6587 |
+
}).call(Document.prototype);
|
6588 |
+
|
6589 |
+
exports.Document = Document;
|
6590 |
+
});
|
6591 |
+
|
6592 |
+
ace.define("ace/background_tokenizer", ["require", "exports", "module", "ace/lib/oop", "ace/lib/event_emitter"], function(require, exports, module) {
|
6593 |
+
"use strict";
|
6594 |
+
|
6595 |
+
var oop = require("./lib/oop");
|
6596 |
+
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
6597 |
+
|
6598 |
+
var BackgroundTokenizer = function(tokenizer, editor) {
|
6599 |
+
this.running = false;
|
6600 |
+
this.lines = [];
|
6601 |
+
this.states = [];
|
6602 |
+
this.currentLine = 0;
|
6603 |
+
this.tokenizer = tokenizer;
|
6604 |
+
|
6605 |
+
var self = this;
|
6606 |
+
|
6607 |
+
this.$worker = function() {
|
6608 |
+
if (!self.running) {
|
6609 |
+
return;
|
6610 |
+
}
|
6611 |
+
|
6612 |
+
var workerStart = new Date();
|
6613 |
+
var currentLine = self.currentLine;
|
6614 |
+
var endLine = -1;
|
6615 |
+
var doc = self.doc;
|
6616 |
+
|
6617 |
+
while (self.lines[currentLine])
|
6618 |
+
currentLine++;
|
6619 |
+
|
6620 |
+
var startLine = currentLine;
|
6621 |
+
|
6622 |
+
var len = doc.getLength();
|
6623 |
+
var processedLines = 0;
|
6624 |
+
self.running = false;
|
6625 |
+
while (currentLine < len) {
|
6626 |
+
self.$tokenizeRow(currentLine);
|
6627 |
+
endLine = currentLine;
|
6628 |
+
do {
|
6629 |
+
currentLine++;
|
6630 |
+
} while (self.lines[currentLine]);
|
6631 |
+
processedLines++;
|
6632 |
+
if ((processedLines % 5 === 0) && (new Date() - workerStart) > 20) {
|
6633 |
+
self.running = setTimeout(self.$worker, 20);
|
6634 |
+
break;
|
6635 |
+
}
|
6636 |
+
}
|
6637 |
+
self.currentLine = currentLine;
|
6638 |
+
|
6639 |
+
if (startLine <= endLine)
|
6640 |
+
self.fireUpdateEvent(startLine, endLine);
|
6641 |
+
};
|
6642 |
+
};
|
6643 |
+
|
6644 |
+
(function() {
|
6645 |
+
|
6646 |
+
oop.implement(this, EventEmitter);
|
6647 |
+
this.setTokenizer = function(tokenizer) {
|
6648 |
+
this.tokenizer = tokenizer;
|
6649 |
+
this.lines = [];
|
6650 |
+
this.states = [];
|
6651 |
+
|
6652 |
+
this.start(0);
|
6653 |
+
};
|
6654 |
+
this.setDocument = function(doc) {
|
6655 |
+
this.doc = doc;
|
6656 |
+
this.lines = [];
|
6657 |
+
this.states = [];
|
6658 |
+
|
6659 |
+
this.stop();
|
6660 |
+
};
|
6661 |
+
this.fireUpdateEvent = function(firstRow, lastRow) {
|
6662 |
+
var data = {
|
6663 |
+
first: firstRow,
|
6664 |
+
last: lastRow
|
6665 |
+
};
|
6666 |
+
this._signal("update", {
|
6667 |
+
data: data
|
6668 |
+
});
|
6669 |
+
};
|
6670 |
+
this.start = function(startRow) {
|
6671 |
+
this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());
|
6672 |
+
this.lines.splice(this.currentLine, this.lines.length);
|
6673 |
+
this.states.splice(this.currentLine, this.states.length);
|
6674 |
+
|
6675 |
+
this.stop();
|
6676 |
+
this.running = setTimeout(this.$worker, 700);
|
6677 |
+
};
|
6678 |
+
|
6679 |
+
this.scheduleStart = function() {
|
6680 |
+
if (!this.running)
|
6681 |
+
this.running = setTimeout(this.$worker, 700);
|
6682 |
+
}
|
6683 |
+
|
6684 |
+
this.$updateOnChange = function(delta) {
|
6685 |
+
var range = delta.range;
|
6686 |
+
var startRow = range.start.row;
|
6687 |
+
var len = range.end.row - startRow;
|
6688 |
+
|
6689 |
+
if (len === 0) {
|
6690 |
+
this.lines[startRow] = null;
|
6691 |
+
} else if (delta.action == "removeText" || delta.action == "removeLines") {
|
6692 |
+
this.lines.splice(startRow, len + 1, null);
|
6693 |
+
this.states.splice(startRow, len + 1, null);
|
6694 |
+
} else {
|
6695 |
+
var args = Array(len + 1);
|
6696 |
+
args.unshift(startRow, 1);
|
6697 |
+
this.lines.splice.apply(this.lines, args);
|
6698 |
+
this.states.splice.apply(this.states, args);
|
6699 |
+
}
|
6700 |
+
|
6701 |
+
this.currentLine = Math.min(startRow, this.currentLine, this.doc.getLength());
|
6702 |
+
|
6703 |
+
this.stop();
|
6704 |
+
};
|
6705 |
+
this.stop = function() {
|
6706 |
+
if (this.running)
|
6707 |
+
clearTimeout(this.running);
|
6708 |
+
this.running = false;
|
6709 |
+
};
|
6710 |
+
this.getTokens = function(row) {
|
6711 |
+
return this.lines[row] || this.$tokenizeRow(row);
|
6712 |
+
};
|
6713 |
+
this.getState = function(row) {
|
6714 |
+
if (this.currentLine == row)
|
6715 |
+
this.$tokenizeRow(row);
|
6716 |
+
return this.states[row] || "start";
|
6717 |
+
};
|
6718 |
+
|
6719 |
+
this.$tokenizeRow = function(row) {
|
6720 |
+
var line = this.doc.getLine(row);
|
6721 |
+
var state = this.states[row - 1];
|
6722 |
+
|
6723 |
+
var data = this.tokenizer.getLineTokens(line, state, row);
|
6724 |
+
|
6725 |
+
if (this.states[row] + "" !== data.state + "") {
|
6726 |
+
this.states[row] = data.state;
|
6727 |
+
this.lines[row + 1] = null;
|
6728 |
+
if (this.currentLine > row + 1)
|
6729 |
+
this.currentLine = row + 1;
|
6730 |
+
} else if (this.currentLine == row) {
|
6731 |
+
this.currentLine = row + 1;
|
6732 |
+
}
|
6733 |
+
|
6734 |
+
return this.lines[row] = data.tokens;
|
6735 |
+
};
|
6736 |
+
|
6737 |
+
}).call(BackgroundTokenizer.prototype);
|
6738 |
+
|
6739 |
+
exports.BackgroundTokenizer = BackgroundTokenizer;
|
6740 |
+
});
|
6741 |
+
|
6742 |
+
ace.define("ace/search_highlight", ["require", "exports", "module", "ace/lib/lang", "ace/lib/oop", "ace/range"], function(require, exports, module) {
|
6743 |
+
"use strict";
|
6744 |
+
|
6745 |
+
var lang = require("./lib/lang");
|
6746 |
+
var oop = require("./lib/oop");
|
6747 |
+
var Range = require("./range").Range;
|
6748 |
+
|
6749 |
+
var SearchHighlight = function(regExp, clazz, type) {
|
6750 |
+
this.setRegexp(regExp);
|
6751 |
+
this.clazz = clazz;
|
6752 |
+
this.type = type || "text";
|
6753 |
+
};
|
6754 |
+
|
6755 |
+
(function() {
|
6756 |
+
this.MAX_RANGES = 500;
|
6757 |
+
|
6758 |
+
this.setRegexp = function(regExp) {
|
6759 |
+
if (this.regExp + "" == regExp + "")
|
6760 |
+
return;
|
6761 |
+
this.regExp = regExp;
|
6762 |
+
this.cache = [];
|
6763 |
+
};
|
6764 |
+
|
6765 |
+
this.update = function(html, markerLayer, session, config) {
|
6766 |
+
if (!this.regExp)
|
6767 |
+
return;
|
6768 |
+
var start = config.firstRow,
|
6769 |
+
end = config.lastRow;
|
6770 |
+
|
6771 |
+
for (var i = start; i <= end; i++) {
|
6772 |
+
var ranges = this.cache[i];
|
6773 |
+
if (ranges == null) {
|
6774 |
+
ranges = lang.getMatchOffsets(session.getLine(i), this.regExp);
|
6775 |
+
if (ranges.length > this.MAX_RANGES)
|
6776 |
+
ranges = ranges.slice(0, this.MAX_RANGES);
|
6777 |
+
ranges = ranges.map(function(match) {
|
6778 |
+
return new Range(i, match.offset, i, match.offset + match.length);
|
6779 |
+
});
|
6780 |
+
this.cache[i] = ranges.length ? ranges : "";
|
6781 |
+
}
|
6782 |
+
|
6783 |
+
for (var j = ranges.length; j--;) {
|
6784 |
+
markerLayer.drawSingleLineMarker(
|
6785 |
+
html, ranges[j].toScreenRange(session), this.clazz, config);
|
6786 |
+
}
|
6787 |
+
}
|
6788 |
+
};
|
6789 |
+
|
6790 |
+
}).call(SearchHighlight.prototype);
|
6791 |
+
|
6792 |
+
exports.SearchHighlight = SearchHighlight;
|
6793 |
+
});
|
6794 |
+
|
6795 |
+
ace.define("ace/edit_session/fold_line", ["require", "exports", "module", "ace/range"], function(require, exports, module) {
|
6796 |
+
"use strict";
|
6797 |
+
|
6798 |
+
var Range = require("../range").Range;
|
6799 |
+
|
6800 |
+
function FoldLine(foldData, folds) {
|
6801 |
+
this.foldData = foldData;
|
6802 |
+
if (Array.isArray(folds)) {
|
6803 |
+
this.folds = folds;
|
6804 |
+
} else {
|
6805 |
+
folds = this.folds = [folds];
|
6806 |
+
}
|
6807 |
+
|
6808 |
+
var last = folds[folds.length - 1];
|
6809 |
+
this.range = new Range(folds[0].start.row, folds[0].start.column,
|
6810 |
+
last.end.row, last.end.column);
|
6811 |
+
this.start = this.range.start;
|
6812 |
+
this.end = this.range.end;
|
6813 |
+
|
6814 |
+
this.folds.forEach(function(fold) {
|
6815 |
+
fold.setFoldLine(this);
|
6816 |
+
}, this);
|
6817 |
+
}
|
6818 |
+
|
6819 |
+
(function() {
|
6820 |
+
this.shiftRow = function(shift) {
|
6821 |
+
this.start.row += shift;
|
6822 |
+
this.end.row += shift;
|
6823 |
+
this.folds.forEach(function(fold) {
|
6824 |
+
fold.start.row += shift;
|
6825 |
+
fold.end.row += shift;
|
6826 |
+
});
|
6827 |
+
};
|
6828 |
+
|
6829 |
+
this.addFold = function(fold) {
|
6830 |
+
if (fold.sameRow) {
|
6831 |
+
if (fold.start.row < this.startRow || fold.endRow > this.endRow) {
|
6832 |
+
throw new Error("Can't add a fold to this FoldLine as it has no connection");
|
6833 |
+
}
|
6834 |
+
this.folds.push(fold);
|
6835 |
+
this.folds.sort(function(a, b) {
|
6836 |
+
return -a.range.compareEnd(b.start.row, b.start.column);
|
6837 |
+
});
|
6838 |
+
if (this.range.compareEnd(fold.start.row, fold.start.column) > 0) {
|
6839 |
+
this.end.row = fold.end.row;
|
6840 |
+
this.end.column = fold.end.column;
|
6841 |
+
} else if (this.range.compareStart(fold.end.row, fold.end.column) < 0) {
|
6842 |
+
this.start.row = fold.start.row;
|
6843 |
+
this.start.column = fold.start.column;
|
6844 |
+
}
|
6845 |
+
} else if (fold.start.row == this.end.row) {
|
6846 |
+
this.folds.push(fold);
|
6847 |
+
this.end.row = fold.end.row;
|
6848 |
+
this.end.column = fold.end.column;
|
6849 |
+
} else if (fold.end.row == this.start.row) {
|
6850 |
+
this.folds.unshift(fold);
|
6851 |
+
this.start.row = fold.start.row;
|
6852 |
+
this.start.column = fold.start.column;
|
6853 |
+
} else {
|
6854 |
+
throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");
|
6855 |
+
}
|
6856 |
+
fold.foldLine = this;
|
6857 |
+
};
|
6858 |
+
|
6859 |
+
this.containsRow = function(row) {
|
6860 |
+
return row >= this.start.row && row <= this.end.row;
|
6861 |
+
};
|
6862 |
+
|
6863 |
+
this.walk = function(callback, endRow, endColumn) {
|
6864 |
+
var lastEnd = 0,
|
6865 |
+
folds = this.folds,
|
6866 |
+
fold,
|
6867 |
+
cmp, stop, isNewRow = true;
|
6868 |
+
|
6869 |
+
if (endRow == null) {
|
6870 |
+
endRow = this.end.row;
|
6871 |
+
endColumn = this.end.column;
|
6872 |
+
}
|
6873 |
+
|
6874 |
+
for (var i = 0; i < folds.length; i++) {
|
6875 |
+
fold = folds[i];
|
6876 |
+
|
6877 |
+
cmp = fold.range.compareStart(endRow, endColumn);
|
6878 |
+
if (cmp == -1) {
|
6879 |
+
callback(null, endRow, endColumn, lastEnd, isNewRow);
|
6880 |
+
return;
|
6881 |
+
}
|
6882 |
+
|
6883 |
+
stop = callback(null, fold.start.row, fold.start.column, lastEnd, isNewRow);
|
6884 |
+
stop = !stop && callback(fold.placeholder, fold.start.row, fold.start.column, lastEnd);
|
6885 |
+
if (stop || cmp === 0) {
|
6886 |
+
return;
|
6887 |
+
}
|
6888 |
+
isNewRow = !fold.sameRow;
|
6889 |
+
lastEnd = fold.end.column;
|
6890 |
+
}
|
6891 |
+
callback(null, endRow, endColumn, lastEnd, isNewRow);
|
6892 |
+
};
|
6893 |
+
|
6894 |
+
this.getNextFoldTo = function(row, column) {
|
6895 |
+
var fold, cmp;
|
6896 |
+
for (var i = 0; i < this.folds.length; i++) {
|
6897 |
+
fold = this.folds[i];
|
6898 |
+
cmp = fold.range.compareEnd(row, column);
|
6899 |
+
if (cmp == -1) {
|
6900 |
+
return {
|
6901 |
+
fold: fold,
|
6902 |
+
kind: "after"
|
6903 |
+
};
|
6904 |
+
} else if (cmp === 0) {
|
6905 |
+
return {
|
6906 |
+
fold: fold,
|
6907 |
+
kind: "inside"
|
6908 |
+
};
|
6909 |
+
}
|
6910 |
+
}
|
6911 |
+
return null;
|
6912 |
+
};
|
6913 |
+
|
6914 |
+
this.addRemoveChars = function(row, column, len) {
|
6915 |
+
var ret = this.getNextFoldTo(row, column),
|
6916 |
+
fold, folds;
|
6917 |
+
if (ret) {
|
6918 |
+
fold = ret.fold;
|
6919 |
+
if (ret.kind == "inside" && fold.start.column != column && fold.start.row != row) {
|
6920 |
+
window.console && window.console.log(row, column, fold);
|
6921 |
+
} else if (fold.start.row == row) {
|
6922 |
+
folds = this.folds;
|
6923 |
+
var i = folds.indexOf(fold);
|
6924 |
+
if (i === 0) {
|
6925 |
+
this.start.column += len;
|
6926 |
+
}
|
6927 |
+
for (i; i < folds.length; i++) {
|
6928 |
+
fold = folds[i];
|
6929 |
+
fold.start.column += len;
|
6930 |
+
if (!fold.sameRow) {
|
6931 |
+
return;
|
6932 |
+
}
|
6933 |
+
fold.end.column += len;
|
6934 |
+
}
|
6935 |
+
this.end.column += len;
|
6936 |
+
}
|
6937 |
+
}
|
6938 |
+
};
|
6939 |
+
|
6940 |
+
this.split = function(row, column) {
|
6941 |
+
var pos = this.getNextFoldTo(row, column);
|
6942 |
+
|
6943 |
+
if (!pos || pos.kind == "inside")
|
6944 |
+
return null;
|
6945 |
+
|
6946 |
+
var fold = pos.fold;
|
6947 |
+
var folds = this.folds;
|
6948 |
+
var foldData = this.foldData;
|
6949 |
+
|
6950 |
+
var i = folds.indexOf(fold);
|
6951 |
+
var foldBefore = folds[i - 1];
|
6952 |
+
this.end.row = foldBefore.end.row;
|
6953 |
+
this.end.column = foldBefore.end.column;
|
6954 |
+
folds = folds.splice(i, folds.length - i);
|
6955 |
+
|
6956 |
+
var newFoldLine = new FoldLine(foldData, folds);
|
6957 |
+
foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine);
|
6958 |
+
return newFoldLine;
|
6959 |
+
};
|
6960 |
+
|
6961 |
+
this.merge = function(foldLineNext) {
|
6962 |
+
var folds = foldLineNext.folds;
|
6963 |
+
for (var i = 0; i < folds.length; i++) {
|
6964 |
+
this.addFold(folds[i]);
|
6965 |
+
}
|
6966 |
+
var foldData = this.foldData;
|
6967 |
+
foldData.splice(foldData.indexOf(foldLineNext), 1);
|
6968 |
+
};
|
6969 |
+
|
6970 |
+
this.toString = function() {
|
6971 |
+
var ret = [this.range.toString() + ": ["];
|
6972 |
+
|
6973 |
+
this.folds.forEach(function(fold) {
|
6974 |
+
ret.push(" " + fold.toString());
|
6975 |
+
});
|
6976 |
+
ret.push("]");
|
6977 |
+
return ret.join("\n");
|
6978 |
+
};
|
6979 |
+
|
6980 |
+
this.idxToPosition = function(idx) {
|
6981 |
+
var lastFoldEndColumn = 0;
|
6982 |
+
|
6983 |
+
for (var i = 0; i < this.folds.length; i++) {
|
6984 |
+
var fold = this.folds[i];
|
6985 |
+
|
6986 |
+
idx -= fold.start.column - lastFoldEndColumn;
|
6987 |
+
if (idx < 0) {
|
6988 |
+
return {
|
6989 |
+
row: fold.start.row,
|
6990 |
+
column: fold.start.column + idx
|
6991 |
+
};
|
6992 |
+
}
|
6993 |
+
|
6994 |
+
idx -= fold.placeholder.length;
|
6995 |
+
if (idx < 0) {
|
6996 |
+
return fold.start;
|
6997 |
+
}
|
6998 |
+
|
6999 |
+
lastFoldEndColumn = fold.end.column;
|
7000 |
+
}
|
7001 |
+
|
7002 |
+
return {
|
7003 |
+
row: this.end.row,
|
7004 |
+
column: this.end.column + idx
|
7005 |
+
};
|
7006 |
+
};
|
7007 |
+
}).call(FoldLine.prototype);
|
7008 |
+
|
7009 |
+
exports.FoldLine = FoldLine;
|
7010 |
+
});
|
7011 |
+
|
7012 |
+
ace.define("ace/range_list", ["require", "exports", "module", "ace/range"], function(require, exports, module) {
|
7013 |
+
"use strict";
|
7014 |
+
var Range = require("./range").Range;
|
7015 |
+
var comparePoints = Range.comparePoints;
|
7016 |
+
|
7017 |
+
var RangeList = function() {
|
7018 |
+
this.ranges = [];
|
7019 |
+
};
|
7020 |
+
|
7021 |
+
(function() {
|
7022 |
+
this.comparePoints = comparePoints;
|
7023 |
+
|
7024 |
+
this.pointIndex = function(pos, excludeEdges, startIndex) {
|
7025 |
+
var list = this.ranges;
|
7026 |
+
|
7027 |
+
for (var i = startIndex || 0; i < list.length; i++) {
|
7028 |
+
var range = list[i];
|
7029 |
+
var cmpEnd = comparePoints(pos, range.end);
|
7030 |
+
if (cmpEnd > 0)
|
7031 |
+
continue;
|
7032 |
+
var cmpStart = comparePoints(pos, range.start);
|
7033 |
+
if (cmpEnd === 0)
|
7034 |
+
return excludeEdges && cmpStart !== 0 ? -i - 2 : i;
|
7035 |
+
if (cmpStart > 0 || (cmpStart === 0 && !excludeEdges))
|
7036 |
+
return i;
|
7037 |
+
|
7038 |
+
return -i - 1;
|
7039 |
+
}
|
7040 |
+
return -i - 1;
|
7041 |
+
};
|
7042 |
+
|
7043 |
+
this.add = function(range) {
|
7044 |
+
var excludeEdges = !range.isEmpty();
|
7045 |
+
var startIndex = this.pointIndex(range.start, excludeEdges);
|
7046 |
+
if (startIndex < 0)
|
7047 |
+
startIndex = -startIndex - 1;
|
7048 |
+
|
7049 |
+
var endIndex = this.pointIndex(range.end, excludeEdges, startIndex);
|
7050 |
+
|
7051 |
+
if (endIndex < 0)
|
7052 |
+
endIndex = -endIndex - 1;
|
7053 |
+
else
|
7054 |
+
endIndex++;
|
7055 |
+
return this.ranges.splice(startIndex, endIndex - startIndex, range);
|
7056 |
+
};
|
7057 |
+
|
7058 |
+
this.addList = function(list) {
|
7059 |
+
var removed = [];
|
7060 |
+
for (var i = list.length; i--;) {
|
7061 |
+
removed.push.call(removed, this.add(list[i]));
|
7062 |
+
}
|
7063 |
+
return removed;
|
7064 |
+
};
|
7065 |
+
|
7066 |
+
this.substractPoint = function(pos) {
|
7067 |
+
var i = this.pointIndex(pos);
|
7068 |
+
|
7069 |
+
if (i >= 0)
|
7070 |
+
return this.ranges.splice(i, 1);
|
7071 |
+
};
|
7072 |
+
this.merge = function() {
|
7073 |
+
var removed = [];
|
7074 |
+
var list = this.ranges;
|
7075 |
+
|
7076 |
+
list = list.sort(function(a, b) {
|
7077 |
+
return comparePoints(a.start, b.start);
|
7078 |
+
});
|
7079 |
+
|
7080 |
+
var next = list[0],
|
7081 |
+
range;
|
7082 |
+
for (var i = 1; i < list.length; i++) {
|
7083 |
+
range = next;
|
7084 |
+
next = list[i];
|
7085 |
+
var cmp = comparePoints(range.end, next.start);
|
7086 |
+
if (cmp < 0)
|
7087 |
+
continue;
|
7088 |
+
|
7089 |
+
if (cmp == 0 && !range.isEmpty() && !next.isEmpty())
|
7090 |
+
continue;
|
7091 |
+
|
7092 |
+
if (comparePoints(range.end, next.end) < 0) {
|
7093 |
+
range.end.row = next.end.row;
|
7094 |
+
range.end.column = next.end.column;
|
7095 |
+
}
|
7096 |
+
|
7097 |
+
list.splice(i, 1);
|
7098 |
+
removed.push(next);
|
7099 |
+
next = range;
|
7100 |
+
i--;
|
7101 |
+
}
|
7102 |
+
|
7103 |
+
this.ranges = list;
|
7104 |
+
|
7105 |
+
return removed;
|
7106 |
+
};
|
7107 |
+
|
7108 |
+
this.contains = function(row, column) {
|
7109 |
+
return this.pointIndex({
|
7110 |
+
row: row,
|
7111 |
+
column: column
|
7112 |
+
}) >= 0;
|
7113 |
+
};
|
7114 |
+
|
7115 |
+
this.containsPoint = function(pos) {
|
7116 |
+
return this.pointIndex(pos) >= 0;
|
7117 |
+
};
|
7118 |
+
|
7119 |
+
this.rangeAtPoint = function(pos) {
|
7120 |
+
var i = this.pointIndex(pos);
|
7121 |
+
if (i >= 0)
|
7122 |
+
return this.ranges[i];
|
7123 |
+
};
|
7124 |
+
|
7125 |
+
|
7126 |
+
this.clipRows = function(startRow, endRow) {
|
7127 |
+
var list = this.ranges;
|
7128 |
+
if (list[0].start.row > endRow || list[list.length - 1].start.row < startRow)
|
7129 |
+
return [];
|
7130 |
+
|
7131 |
+
var startIndex = this.pointIndex({
|
7132 |
+
row: startRow,
|
7133 |
+
column: 0
|
7134 |
+
});
|
7135 |
+
if (startIndex < 0)
|
7136 |
+
startIndex = -startIndex - 1;
|
7137 |
+
var endIndex = this.pointIndex({
|
7138 |
+
row: endRow,
|
7139 |
+
column: 0
|
7140 |
+
}, startIndex);
|
7141 |
+
if (endIndex < 0)
|
7142 |
+
endIndex = -endIndex - 1;
|
7143 |
+
|
7144 |
+
var clipped = [];
|
7145 |
+
for (var i = startIndex; i < endIndex; i++) {
|
7146 |
+
clipped.push(list[i]);
|
7147 |
+
}
|
7148 |
+
return clipped;
|
7149 |
+
};
|
7150 |
+
|
7151 |
+
this.removeAll = function() {
|
7152 |
+
return this.ranges.splice(0, this.ranges.length);
|
7153 |
+
};
|
7154 |
+
|
7155 |
+
this.attach = function(session) {
|
7156 |
+
if (this.session)
|
7157 |
+
this.detach();
|
7158 |
+
|
7159 |
+
this.session = session;
|
7160 |
+
this.onChange = this.$onChange.bind(this);
|
7161 |
+
|
7162 |
+
this.session.on('change', this.onChange);
|
7163 |
+
};
|
7164 |
+
|
7165 |
+
this.detach = function() {
|
7166 |
+
if (!this.session)
|
7167 |
+
return;
|
7168 |
+
this.session.removeListener('change', this.onChange);
|
7169 |
+
this.session = null;
|
7170 |
+
};
|
7171 |
+
|
7172 |
+
this.$onChange = function(e) {
|
7173 |
+
var changeRange = e.data.range;
|
7174 |
+
if (e.data.action[0] == "i") {
|
7175 |
+
var start = changeRange.start;
|
7176 |
+
var end = changeRange.end;
|
7177 |
+
} else {
|
7178 |
+
var end = changeRange.start;
|
7179 |
+
var start = changeRange.end;
|
7180 |
+
}
|
7181 |
+
var startRow = start.row;
|
7182 |
+
var endRow = end.row;
|
7183 |
+
var lineDif = endRow - startRow;
|
7184 |
+
|
7185 |
+
var colDiff = -start.column + end.column;
|
7186 |
+
var ranges = this.ranges;
|
7187 |
+
|
7188 |
+
for (var i = 0, n = ranges.length; i < n; i++) {
|
7189 |
+
var r = ranges[i];
|
7190 |
+
if (r.end.row < startRow)
|
7191 |
+
continue;
|
7192 |
+
if (r.start.row > startRow)
|
7193 |
+
break;
|
7194 |
+
|
7195 |
+
if (r.start.row == startRow && r.start.column >= start.column) {
|
7196 |
+
if (r.start.column == start.column && this.$insertRight) {} else {
|
7197 |
+
r.start.column += colDiff;
|
7198 |
+
r.start.row += lineDif;
|
7199 |
+
}
|
7200 |
+
}
|
7201 |
+
if (r.end.row == startRow && r.end.column >= start.column) {
|
7202 |
+
if (r.end.column == start.column && this.$insertRight) {
|
7203 |
+
continue;
|
7204 |
+
}
|
7205 |
+
if (r.end.column == start.column && colDiff > 0 && i < n - 1) {
|
7206 |
+
if (r.end.column > r.start.column && r.end.column == ranges[i + 1].start.column)
|
7207 |
+
r.end.column -= colDiff;
|
7208 |
+
}
|
7209 |
+
r.end.column += colDiff;
|
7210 |
+
r.end.row += lineDif;
|
7211 |
+
}
|
7212 |
+
}
|
7213 |
+
|
7214 |
+
if (lineDif != 0 && i < n) {
|
7215 |
+
for (; i < n; i++) {
|
7216 |
+
var r = ranges[i];
|
7217 |
+
r.start.row += lineDif;
|
7218 |
+
r.end.row += lineDif;
|
7219 |
+
}
|
7220 |
+
}
|
7221 |
+
};
|
7222 |
+
|
7223 |
+
}).call(RangeList.prototype);
|
7224 |
+
|
7225 |
+
exports.RangeList = RangeList;
|
7226 |
+
});
|
7227 |
+
|
7228 |
+
ace.define("ace/edit_session/fold", ["require", "exports", "module", "ace/range", "ace/range_list", "ace/lib/oop"], function(require, exports, module) {
|
7229 |
+
"use strict";
|
7230 |
+
|
7231 |
+
var Range = require("../range").Range;
|
7232 |
+
var RangeList = require("../range_list").RangeList;
|
7233 |
+
var oop = require("../lib/oop")
|
7234 |
+
var Fold = exports.Fold = function(range, placeholder) {
|
7235 |
+
this.foldLine = null;
|
7236 |
+
this.placeholder = placeholder;
|
7237 |
+
this.range = range;
|
7238 |
+
this.start = range.start;
|
7239 |
+
this.end = range.end;
|
7240 |
+
|
7241 |
+
this.sameRow = range.start.row == range.end.row;
|
7242 |
+
this.subFolds = this.ranges = [];
|
7243 |
+
};
|
7244 |
+
|
7245 |
+
oop.inherits(Fold, RangeList);
|
7246 |
+
|
7247 |
+
(function() {
|
7248 |
+
|
7249 |
+
this.toString = function() {
|
7250 |
+
return '"' + this.placeholder + '" ' + this.range.toString();
|
7251 |
+
};
|
7252 |
+
|
7253 |
+
this.setFoldLine = function(foldLine) {
|
7254 |
+
this.foldLine = foldLine;
|
7255 |
+
this.subFolds.forEach(function(fold) {
|
7256 |
+
fold.setFoldLine(foldLine);
|
7257 |
+
});
|
7258 |
+
};
|
7259 |
+
|
7260 |
+
this.clone = function() {
|
7261 |
+
var range = this.range.clone();
|
7262 |
+
var fold = new Fold(range, this.placeholder);
|
7263 |
+
this.subFolds.forEach(function(subFold) {
|
7264 |
+
fold.subFolds.push(subFold.clone());
|
7265 |
+
});
|
7266 |
+
fold.collapseChildren = this.collapseChildren;
|
7267 |
+
return fold;
|
7268 |
+
};
|
7269 |
+
|
7270 |
+
this.addSubFold = function(fold) {
|
7271 |
+
if (this.range.isEqual(fold))
|
7272 |
+
return;
|
7273 |
+
|
7274 |
+
if (!this.range.containsRange(fold))
|
7275 |
+
throw new Error("A fold can't intersect already existing fold" + fold.range + this.range);
|
7276 |
+
consumeRange(fold, this.start);
|
7277 |
+
|
7278 |
+
var row = fold.start.row,
|
7279 |
+
column = fold.start.column;
|
7280 |
+
for (var i = 0, cmp = -1; i < this.subFolds.length; i++) {
|
7281 |
+
cmp = this.subFolds[i].range.compare(row, column);
|
7282 |
+
if (cmp != 1)
|
7283 |
+
break;
|
7284 |
+
}
|
7285 |
+
var afterStart = this.subFolds[i];
|
7286 |
+
|
7287 |
+
if (cmp == 0)
|
7288 |
+
return afterStart.addSubFold(fold);
|
7289 |
+
var row = fold.range.end.row,
|
7290 |
+
column = fold.range.end.column;
|
7291 |
+
for (var j = i, cmp = -1; j < this.subFolds.length; j++) {
|
7292 |
+
cmp = this.subFolds[j].range.compare(row, column);
|
7293 |
+
if (cmp != 1)
|
7294 |
+
break;
|
7295 |
+
}
|
7296 |
+
var afterEnd = this.subFolds[j];
|
7297 |
+
|
7298 |
+
if (cmp == 0)
|
7299 |
+
throw new Error("A fold can't intersect already existing fold" + fold.range + this.range);
|
7300 |
+
|
7301 |
+
var consumedFolds = this.subFolds.splice(i, j - i, fold);
|
7302 |
+
fold.setFoldLine(this.foldLine);
|
7303 |
+
|
7304 |
+
return fold;
|
7305 |
+
};
|
7306 |
+
|
7307 |
+
this.restoreRange = function(range) {
|
7308 |
+
return restoreRange(range, this.start);
|
7309 |
+
};
|
7310 |
+
|
7311 |
+
}).call(Fold.prototype);
|
7312 |
+
|
7313 |
+
function consumePoint(point, anchor) {
|
7314 |
+
point.row -= anchor.row;
|
7315 |
+
if (point.row == 0)
|
7316 |
+
point.column -= anchor.column;
|
7317 |
+
}
|
7318 |
+
|
7319 |
+
function consumeRange(range, anchor) {
|
7320 |
+
consumePoint(range.start, anchor);
|
7321 |
+
consumePoint(range.end, anchor);
|
7322 |
+
}
|
7323 |
+
|
7324 |
+
function restorePoint(point, anchor) {
|
7325 |
+
if (point.row == 0)
|
7326 |
+
point.column += anchor.column;
|
7327 |
+
point.row += anchor.row;
|
7328 |
+
}
|
7329 |
+
|
7330 |
+
function restoreRange(range, anchor) {
|
7331 |
+
restorePoint(range.start, anchor);
|
7332 |
+
restorePoint(range.end, anchor);
|
7333 |
+
}
|
7334 |
+
|
7335 |
+
});
|
7336 |
+
|
7337 |
+
ace.define("ace/edit_session/folding", ["require", "exports", "module", "ace/range", "ace/edit_session/fold_line", "ace/edit_session/fold", "ace/token_iterator"], function(require, exports, module) {
|
7338 |
+
"use strict";
|
7339 |
+
|
7340 |
+
var Range = require("../range").Range;
|
7341 |
+
var FoldLine = require("./fold_line").FoldLine;
|
7342 |
+
var Fold = require("./fold").Fold;
|
7343 |
+
var TokenIterator = require("../token_iterator").TokenIterator;
|
7344 |
+
|
7345 |
+
function Folding() {
|
7346 |
+
this.getFoldAt = function(row, column, side) {
|
7347 |
+
var foldLine = this.getFoldLine(row);
|
7348 |
+
if (!foldLine)
|
7349 |
+
return null;
|
7350 |
+
|
7351 |
+
var folds = foldLine.folds;
|
7352 |
+
for (var i = 0; i < folds.length; i++) {
|
7353 |
+
var fold = folds[i];
|
7354 |
+
if (fold.range.contains(row, column)) {
|
7355 |
+
if (side == 1 && fold.range.isEnd(row, column)) {
|
7356 |
+
continue;
|
7357 |
+
} else if (side == -1 && fold.range.isStart(row, column)) {
|
7358 |
+
continue;
|
7359 |
+
}
|
7360 |
+
return fold;
|
7361 |
+
}
|
7362 |
+
}
|
7363 |
+
};
|
7364 |
+
this.getFoldsInRange = function(range) {
|
7365 |
+
var start = range.start;
|
7366 |
+
var end = range.end;
|
7367 |
+
var foldLines = this.$foldData;
|
7368 |
+
var foundFolds = [];
|
7369 |
+
|
7370 |
+
start.column += 1;
|
7371 |
+
end.column -= 1;
|
7372 |
+
|
7373 |
+
for (var i = 0; i < foldLines.length; i++) {
|
7374 |
+
var cmp = foldLines[i].range.compareRange(range);
|
7375 |
+
if (cmp == 2) {
|
7376 |
+
continue;
|
7377 |
+
} else if (cmp == -2) {
|
7378 |
+
break;
|
7379 |
+
}
|
7380 |
+
|
7381 |
+
var folds = foldLines[i].folds;
|
7382 |
+
for (var j = 0; j < folds.length; j++) {
|
7383 |
+
var fold = folds[j];
|
7384 |
+
cmp = fold.range.compareRange(range);
|
7385 |
+
if (cmp == -2) {
|
7386 |
+
break;
|
7387 |
+
} else if (cmp == 2) {
|
7388 |
+
continue;
|
7389 |
+
} else
|
7390 |
+
if (cmp == 42) {
|
7391 |
+
break;
|
7392 |
+
}
|
7393 |
+
foundFolds.push(fold);
|
7394 |
+
}
|
7395 |
+
}
|
7396 |
+
start.column -= 1;
|
7397 |
+
end.column += 1;
|
7398 |
+
|
7399 |
+
return foundFolds;
|
7400 |
+
};
|
7401 |
+
|
7402 |
+
this.getFoldsInRangeList = function(ranges) {
|
7403 |
+
if (Array.isArray(ranges)) {
|
7404 |
+
var folds = [];
|
7405 |
+
ranges.forEach(function(range) {
|
7406 |
+
folds = folds.concat(this.getFoldsInRange(range));
|
7407 |
+
}, this);
|
7408 |
+
} else {
|
7409 |
+
var folds = this.getFoldsInRange(ranges);
|
7410 |
+
}
|
7411 |
+
return folds;
|
7412 |
+
}
|
7413 |
+
this.getAllFolds = function() {
|
7414 |
+
var folds = [];
|
7415 |
+
var foldLines = this.$foldData;
|
7416 |
+
|
7417 |
+
for (var i = 0; i < foldLines.length; i++)
|
7418 |
+
for (var j = 0; j < foldLines[i].folds.length; j++)
|
7419 |
+
folds.push(foldLines[i].folds[j]);
|
7420 |
+
|
7421 |
+
return folds;
|
7422 |
+
};
|
7423 |
+
this.getFoldStringAt = function(row, column, trim, foldLine) {
|
7424 |
+
foldLine = foldLine || this.getFoldLine(row);
|
7425 |
+
if (!foldLine)
|
7426 |
+
return null;
|
7427 |
+
|
7428 |
+
var lastFold = {
|
7429 |
+
end: {
|
7430 |
+
column: 0
|
7431 |
+
}
|
7432 |
+
};
|
7433 |
+
var str, fold;
|
7434 |
+
for (var i = 0; i < foldLine.folds.length; i++) {
|
7435 |
+
fold = foldLine.folds[i];
|
7436 |
+
var cmp = fold.range.compareEnd(row, column);
|
7437 |
+
if (cmp == -1) {
|
7438 |
+
str = this
|
7439 |
+
.getLine(fold.start.row)
|
7440 |
+
.substring(lastFold.end.column, fold.start.column);
|
7441 |
+
break;
|
7442 |
+
} else if (cmp === 0) {
|
7443 |
+
return null;
|
7444 |
+
}
|
7445 |
+
lastFold = fold;
|
7446 |
+
}
|
7447 |
+
if (!str)
|
7448 |
+
str = this.getLine(fold.start.row).substring(lastFold.end.column);
|
7449 |
+
|
7450 |
+
if (trim == -1)
|
7451 |
+
return str.substring(0, column - lastFold.end.column);
|
7452 |
+
else if (trim == 1)
|
7453 |
+
return str.substring(column - lastFold.end.column);
|
7454 |
+
else
|
7455 |
+
return str;
|
7456 |
+
};
|
7457 |
+
|
7458 |
+
this.getFoldLine = function(docRow, startFoldLine) {
|
7459 |
+
var foldData = this.$foldData;
|
7460 |
+
var i = 0;
|
7461 |
+
if (startFoldLine)
|
7462 |
+
i = foldData.indexOf(startFoldLine);
|
7463 |
+
if (i == -1)
|
7464 |
+
i = 0;
|
7465 |
+
for (i; i < foldData.length; i++) {
|
7466 |
+
var foldLine = foldData[i];
|
7467 |
+
if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) {
|
7468 |
+
return foldLine;
|
7469 |
+
} else if (foldLine.end.row > docRow) {
|
7470 |
+
return null;
|
7471 |
+
}
|
7472 |
+
}
|
7473 |
+
return null;
|
7474 |
+
};
|
7475 |
+
this.getNextFoldLine = function(docRow, startFoldLine) {
|
7476 |
+
var foldData = this.$foldData;
|
7477 |
+
var i = 0;
|
7478 |
+
if (startFoldLine)
|
7479 |
+
i = foldData.indexOf(startFoldLine);
|
7480 |
+
if (i == -1)
|
7481 |
+
i = 0;
|
7482 |
+
for (i; i < foldData.length; i++) {
|
7483 |
+
var foldLine = foldData[i];
|
7484 |
+
if (foldLine.end.row >= docRow) {
|
7485 |
+
return foldLine;
|
7486 |
+
}
|
7487 |
+
}
|
7488 |
+
return null;
|
7489 |
+
};
|
7490 |
+
|
7491 |
+
this.getFoldedRowCount = function(first, last) {
|
7492 |
+
var foldData = this.$foldData,
|
7493 |
+
rowCount = last - first + 1;
|
7494 |
+
for (var i = 0; i < foldData.length; i++) {
|
7495 |
+
var foldLine = foldData[i],
|
7496 |
+
end = foldLine.end.row,
|
7497 |
+
start = foldLine.start.row;
|
7498 |
+
if (end >= last) {
|
7499 |
+
if (start < last) {
|
7500 |
+
if (start >= first)
|
7501 |
+
rowCount -= last - start;
|
7502 |
+
else
|
7503 |
+
rowCount = 0; //in one fold
|
7504 |
+
}
|
7505 |
+
break;
|
7506 |
+
} else if (end >= first) {
|
7507 |
+
if (start >= first) //fold inside range
|
7508 |
+
rowCount -= end - start;
|
7509 |
+
else
|
7510 |
+
rowCount -= end - first + 1;
|
7511 |
+
}
|
7512 |
+
}
|
7513 |
+
return rowCount;
|
7514 |
+
};
|
7515 |
+
|
7516 |
+
this.$addFoldLine = function(foldLine) {
|
7517 |
+
this.$foldData.push(foldLine);
|
7518 |
+
this.$foldData.sort(function(a, b) {
|
7519 |
+
return a.start.row - b.start.row;
|
7520 |
+
});
|
7521 |
+
return foldLine;
|
7522 |
+
};
|
7523 |
+
this.addFold = function(placeholder, range) {
|
7524 |
+
var foldData = this.$foldData;
|
7525 |
+
var added = false;
|
7526 |
+
var fold;
|
7527 |
+
|
7528 |
+
if (placeholder instanceof Fold)
|
7529 |
+
fold = placeholder;
|
7530 |
+
else {
|
7531 |
+
fold = new Fold(range, placeholder);
|
7532 |
+
fold.collapseChildren = range.collapseChildren;
|
7533 |
+
}
|
7534 |
+
this.$clipRangeToDocument(fold.range);
|
7535 |
+
|
7536 |
+
var startRow = fold.start.row;
|
7537 |
+
var startColumn = fold.start.column;
|
7538 |
+
var endRow = fold.end.row;
|
7539 |
+
var endColumn = fold.end.column;
|
7540 |
+
if (!(startRow < endRow ||
|
7541 |
+
startRow == endRow && startColumn <= endColumn - 2))
|
7542 |
+
throw new Error("The range has to be at least 2 characters width");
|
7543 |
+
|
7544 |
+
var startFold = this.getFoldAt(startRow, startColumn, 1);
|
7545 |
+
var endFold = this.getFoldAt(endRow, endColumn, -1);
|
7546 |
+
if (startFold && endFold == startFold)
|
7547 |
+
return startFold.addSubFold(fold);
|
7548 |
+
|
7549 |
+
if (startFold && !startFold.range.isStart(startRow, startColumn))
|
7550 |
+
this.removeFold(startFold);
|
7551 |
+
|
7552 |
+
if (endFold && !endFold.range.isEnd(endRow, endColumn))
|
7553 |
+
this.removeFold(endFold);
|
7554 |
+
var folds = this.getFoldsInRange(fold.range);
|
7555 |
+
if (folds.length > 0) {
|
7556 |
+
this.removeFolds(folds);
|
7557 |
+
folds.forEach(function(subFold) {
|
7558 |
+
fold.addSubFold(subFold);
|
7559 |
+
});
|
7560 |
+
}
|
7561 |
+
|
7562 |
+
for (var i = 0; i < foldData.length; i++) {
|
7563 |
+
var foldLine = foldData[i];
|
7564 |
+
if (endRow == foldLine.start.row) {
|
7565 |
+
foldLine.addFold(fold);
|
7566 |
+
added = true;
|
7567 |
+
break;
|
7568 |
+
} else if (startRow == foldLine.end.row) {
|
7569 |
+
foldLine.addFold(fold);
|
7570 |
+
added = true;
|
7571 |
+
if (!fold.sameRow) {
|
7572 |
+
var foldLineNext = foldData[i + 1];
|
7573 |
+
if (foldLineNext && foldLineNext.start.row == endRow) {
|
7574 |
+
foldLine.merge(foldLineNext);
|
7575 |
+
break;
|
7576 |
+
}
|
7577 |
+
}
|
7578 |
+
break;
|
7579 |
+
} else if (endRow <= foldLine.start.row) {
|
7580 |
+
break;
|
7581 |
+
}
|
7582 |
+
}
|
7583 |
+
|
7584 |
+
if (!added)
|
7585 |
+
foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold));
|
7586 |
+
|
7587 |
+
if (this.$useWrapMode)
|
7588 |
+
this.$updateWrapData(foldLine.start.row, foldLine.start.row);
|
7589 |
+
else
|
7590 |
+
this.$updateRowLengthCache(foldLine.start.row, foldLine.start.row);
|
7591 |
+
this.$modified = true;
|
7592 |
+
this._emit("changeFold", {
|
7593 |
+
data: fold,
|
7594 |
+
action: "add"
|
7595 |
+
});
|
7596 |
+
|
7597 |
+
return fold;
|
7598 |
+
};
|
7599 |
+
|
7600 |
+
this.addFolds = function(folds) {
|
7601 |
+
folds.forEach(function(fold) {
|
7602 |
+
this.addFold(fold);
|
7603 |
+
}, this);
|
7604 |
+
};
|
7605 |
+
|
7606 |
+
this.removeFold = function(fold) {
|
7607 |
+
var foldLine = fold.foldLine;
|
7608 |
+
var startRow = foldLine.start.row;
|
7609 |
+
var endRow = foldLine.end.row;
|
7610 |
+
|
7611 |
+
var foldLines = this.$foldData;
|
7612 |
+
var folds = foldLine.folds;
|
7613 |
+
if (folds.length == 1) {
|
7614 |
+
foldLines.splice(foldLines.indexOf(foldLine), 1);
|
7615 |
+
} else
|
7616 |
+
if (foldLine.range.isEnd(fold.end.row, fold.end.column)) {
|
7617 |
+
folds.pop();
|
7618 |
+
foldLine.end.row = folds[folds.length - 1].end.row;
|
7619 |
+
foldLine.end.column = folds[folds.length - 1].end.column;
|
7620 |
+
} else
|
7621 |
+
if (foldLine.range.isStart(fold.start.row, fold.start.column)) {
|
7622 |
+
folds.shift();
|
7623 |
+
foldLine.start.row = folds[0].start.row;
|
7624 |
+
foldLine.start.column = folds[0].start.column;
|
7625 |
+
} else
|
7626 |
+
if (fold.sameRow) {
|
7627 |
+
folds.splice(folds.indexOf(fold), 1);
|
7628 |
+
} else {
|
7629 |
+
var newFoldLine = foldLine.split(fold.start.row, fold.start.column);
|
7630 |
+
folds = newFoldLine.folds;
|
7631 |
+
folds.shift();
|
7632 |
+
newFoldLine.start.row = folds[0].start.row;
|
7633 |
+
newFoldLine.start.column = folds[0].start.column;
|
7634 |
+
}
|
7635 |
+
|
7636 |
+
if (!this.$updating) {
|
7637 |
+
if (this.$useWrapMode)
|
7638 |
+
this.$updateWrapData(startRow, endRow);
|
7639 |
+
else
|
7640 |
+
this.$updateRowLengthCache(startRow, endRow);
|
7641 |
+
}
|
7642 |
+
this.$modified = true;
|
7643 |
+
this._emit("changeFold", {
|
7644 |
+
data: fold,
|
7645 |
+
action: "remove"
|
7646 |
+
});
|
7647 |
+
};
|
7648 |
+
|
7649 |
+
this.removeFolds = function(folds) {
|
7650 |
+
var cloneFolds = [];
|
7651 |
+
for (var i = 0; i < folds.length; i++) {
|
7652 |
+
cloneFolds.push(folds[i]);
|
7653 |
+
}
|
7654 |
+
|
7655 |
+
cloneFolds.forEach(function(fold) {
|
7656 |
+
this.removeFold(fold);
|
7657 |
+
}, this);
|
7658 |
+
this.$modified = true;
|
7659 |
+
};
|
7660 |
+
|
7661 |
+
this.expandFold = function(fold) {
|
7662 |
+
this.removeFold(fold);
|
7663 |
+
fold.subFolds.forEach(function(subFold) {
|
7664 |
+
fold.restoreRange(subFold);
|
7665 |
+
this.addFold(subFold);
|
7666 |
+
}, this);
|
7667 |
+
if (fold.collapseChildren > 0) {
|
7668 |
+
this.foldAll(fold.start.row + 1, fold.end.row, fold.collapseChildren - 1);
|
7669 |
+
}
|
7670 |
+
fold.subFolds = [];
|
7671 |
+
};
|
7672 |
+
|
7673 |
+
this.expandFolds = function(folds) {
|
7674 |
+
folds.forEach(function(fold) {
|
7675 |
+
this.expandFold(fold);
|
7676 |
+
}, this);
|
7677 |
+
};
|
7678 |
+
|
7679 |
+
this.unfold = function(location, expandInner) {
|
7680 |
+
var range, folds;
|
7681 |
+
if (location == null) {
|
7682 |
+
range = new Range(0, 0, this.getLength(), 0);
|
7683 |
+
expandInner = true;
|
7684 |
+
} else if (typeof location == "number")
|
7685 |
+
range = new Range(location, 0, location, this.getLine(location).length);
|
7686 |
+
else if ("row" in location)
|
7687 |
+
range = Range.fromPoints(location, location);
|
7688 |
+
else
|
7689 |
+
range = location;
|
7690 |
+
|
7691 |
+
folds = this.getFoldsInRangeList(range);
|
7692 |
+
if (expandInner) {
|
7693 |
+
this.removeFolds(folds);
|
7694 |
+
} else {
|
7695 |
+
var subFolds = folds;
|
7696 |
+
while (subFolds.length) {
|
7697 |
+
this.expandFolds(subFolds);
|
7698 |
+
subFolds = this.getFoldsInRangeList(range);
|
7699 |
+
}
|
7700 |
+
}
|
7701 |
+
if (folds.length)
|
7702 |
+
return folds;
|
7703 |
+
};
|
7704 |
+
this.isRowFolded = function(docRow, startFoldRow) {
|
7705 |
+
return !!this.getFoldLine(docRow, startFoldRow);
|
7706 |
+
};
|
7707 |
+
|
7708 |
+
this.getRowFoldEnd = function(docRow, startFoldRow) {
|
7709 |
+
var foldLine = this.getFoldLine(docRow, startFoldRow);
|
7710 |
+
return foldLine ? foldLine.end.row : docRow;
|
7711 |
+
};
|
7712 |
+
|
7713 |
+
this.getRowFoldStart = function(docRow, startFoldRow) {
|
7714 |
+
var foldLine = this.getFoldLine(docRow, startFoldRow);
|
7715 |
+
return foldLine ? foldLine.start.row : docRow;
|
7716 |
+
};
|
7717 |
+
|
7718 |
+
this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
|
7719 |
+
if (startRow == null)
|
7720 |
+
startRow = foldLine.start.row;
|
7721 |
+
if (startColumn == null)
|
7722 |
+
startColumn = 0;
|
7723 |
+
if (endRow == null)
|
7724 |
+
endRow = foldLine.end.row;
|
7725 |
+
if (endColumn == null)
|
7726 |
+
endColumn = this.getLine(endRow).length;
|
7727 |
+
var doc = this.doc;
|
7728 |
+
var textLine = "";
|
7729 |
+
|
7730 |
+
foldLine.walk(function(placeholder, row, column, lastColumn) {
|
7731 |
+
if (row < startRow)
|
7732 |
+
return;
|
7733 |
+
if (row == startRow) {
|
7734 |
+
if (column < startColumn)
|
7735 |
+
return;
|
7736 |
+
lastColumn = Math.max(startColumn, lastColumn);
|
7737 |
+
}
|
7738 |
+
|
7739 |
+
if (placeholder != null) {
|
7740 |
+
textLine += placeholder;
|
7741 |
+
} else {
|
7742 |
+
textLine += doc.getLine(row).substring(lastColumn, column);
|
7743 |
+
}
|
7744 |
+
}, endRow, endColumn);
|
7745 |
+
return textLine;
|
7746 |
+
};
|
7747 |
+
|
7748 |
+
this.getDisplayLine = function(row, endColumn, startRow, startColumn) {
|
7749 |
+
var foldLine = this.getFoldLine(row);
|
7750 |
+
|
7751 |
+
if (!foldLine) {
|
7752 |
+
var line;
|
7753 |
+
line = this.doc.getLine(row);
|
7754 |
+
return line.substring(startColumn || 0, endColumn || line.length);
|
7755 |
+
} else {
|
7756 |
+
return this.getFoldDisplayLine(
|
7757 |
+
foldLine, row, endColumn, startRow, startColumn);
|
7758 |
+
}
|
7759 |
+
};
|
7760 |
+
|
7761 |
+
this.$cloneFoldData = function() {
|
7762 |
+
var fd = [];
|
7763 |
+
fd = this.$foldData.map(function(foldLine) {
|
7764 |
+
var folds = foldLine.folds.map(function(fold) {
|
7765 |
+
return fold.clone();
|
7766 |
+
});
|
7767 |
+
return new FoldLine(fd, folds);
|
7768 |
+
});
|
7769 |
+
|
7770 |
+
return fd;
|
7771 |
+
};
|
7772 |
+
|
7773 |
+
this.toggleFold = function(tryToUnfold) {
|
7774 |
+
var selection = this.selection;
|
7775 |
+
var range = selection.getRange();
|
7776 |
+
var fold;
|
7777 |
+
var bracketPos;
|
7778 |
+
|
7779 |
+
if (range.isEmpty()) {
|
7780 |
+
var cursor = range.start;
|
7781 |
+
fold = this.getFoldAt(cursor.row, cursor.column);
|
7782 |
+
|
7783 |
+
if (fold) {
|
7784 |
+
this.expandFold(fold);
|
7785 |
+
return;
|
7786 |
+
} else if (bracketPos = this.findMatchingBracket(cursor)) {
|
7787 |
+
if (range.comparePoint(bracketPos) == 1) {
|
7788 |
+
range.end = bracketPos;
|
7789 |
+
} else {
|
7790 |
+
range.start = bracketPos;
|
7791 |
+
range.start.column++;
|
7792 |
+
range.end.column--;
|
7793 |
+
}
|
7794 |
+
} else if (bracketPos = this.findMatchingBracket({
|
7795 |
+
row: cursor.row,
|
7796 |
+
column: cursor.column + 1
|
7797 |
+
})) {
|
7798 |
+
if (range.comparePoint(bracketPos) == 1)
|
7799 |
+
range.end = bracketPos;
|
7800 |
+
else
|
7801 |
+
range.start = bracketPos;
|
7802 |
+
|
7803 |
+
range.start.column++;
|
7804 |
+
} else {
|
7805 |
+
range = this.getCommentFoldRange(cursor.row, cursor.column) || range;
|
7806 |
+
}
|
7807 |
+
} else {
|
7808 |
+
var folds = this.getFoldsInRange(range);
|
7809 |
+
if (tryToUnfold && folds.length) {
|
7810 |
+
this.expandFolds(folds);
|
7811 |
+
return;
|
7812 |
+
} else if (folds.length == 1) {
|
7813 |
+
fold = folds[0];
|
7814 |
+
}
|
7815 |
+
}
|
7816 |
+
|
7817 |
+
if (!fold)
|
7818 |
+
fold = this.getFoldAt(range.start.row, range.start.column);
|
7819 |
+
|
7820 |
+
if (fold && fold.range.toString() == range.toString()) {
|
7821 |
+
this.expandFold(fold);
|
7822 |
+
return;
|
7823 |
+
}
|
7824 |
+
|
7825 |
+
var placeholder = "...";
|
7826 |
+
if (!range.isMultiLine()) {
|
7827 |
+
placeholder = this.getTextRange(range);
|
7828 |
+
if (placeholder.length < 4)
|
7829 |
+
return;
|
7830 |
+
placeholder = placeholder.trim().substring(0, 2) + "..";
|
7831 |
+
}
|
7832 |
+
|
7833 |
+
this.addFold(placeholder, range);
|
7834 |
+
};
|
7835 |
+
|
7836 |
+
this.getCommentFoldRange = function(row, column, dir) {
|
7837 |
+
var iterator = new TokenIterator(this, row, column);
|
7838 |
+
var token = iterator.getCurrentToken();
|
7839 |
+
if (token && /^comment|string/.test(token.type)) {
|
7840 |
+
var range = new Range();
|
7841 |
+
var re = new RegExp(token.type.replace(/\..*/, "\\."));
|
7842 |
+
if (dir != 1) {
|
7843 |
+
do {
|
7844 |
+
token = iterator.stepBackward();
|
7845 |
+
} while (token && re.test(token.type));
|
7846 |
+
iterator.stepForward();
|
7847 |
+
}
|
7848 |
+
|
7849 |
+
range.start.row = iterator.getCurrentTokenRow();
|
7850 |
+
range.start.column = iterator.getCurrentTokenColumn() + 2;
|
7851 |
+
|
7852 |
+
iterator = new TokenIterator(this, row, column);
|
7853 |
+
|
7854 |
+
if (dir != -1) {
|
7855 |
+
do {
|
7856 |
+
token = iterator.stepForward();
|
7857 |
+
} while (token && re.test(token.type));
|
7858 |
+
token = iterator.stepBackward();
|
7859 |
+
} else
|
7860 |
+
token = iterator.getCurrentToken();
|
7861 |
+
|
7862 |
+
range.end.row = iterator.getCurrentTokenRow();
|
7863 |
+
range.end.column = iterator.getCurrentTokenColumn() + token.value.length - 2;
|
7864 |
+
return range;
|
7865 |
+
}
|
7866 |
+
};
|
7867 |
+
|
7868 |
+
this.foldAll = function(startRow, endRow, depth) {
|
7869 |
+
if (depth == undefined)
|
7870 |
+
depth = 100000; // JSON.stringify doesn't hanle Infinity
|
7871 |
+
var foldWidgets = this.foldWidgets;
|
7872 |
+
if (!foldWidgets)
|
7873 |
+
return; // mode doesn't support folding
|
7874 |
+
endRow = endRow || this.getLength();
|
7875 |
+
startRow = startRow || 0;
|
7876 |
+
for (var row = startRow; row < endRow; row++) {
|
7877 |
+
if (foldWidgets[row] == null)
|
7878 |
+
foldWidgets[row] = this.getFoldWidget(row);
|
7879 |
+
if (foldWidgets[row] != "start")
|
7880 |
+
continue;
|
7881 |
+
|
7882 |
+
var range = this.getFoldWidgetRange(row);
|
7883 |
+
if (range && range.isMultiLine() && range.end.row <= endRow && range.start.row >= startRow) {
|
7884 |
+
row = range.end.row;
|
7885 |
+
try {
|
7886 |
+
var fold = this.addFold("...", range);
|
7887 |
+
if (fold)
|
7888 |
+
fold.collapseChildren = depth;
|
7889 |
+
} catch (e) {}
|
7890 |
+
}
|
7891 |
+
}
|
7892 |
+
};
|
7893 |
+
this.$foldStyles = {
|
7894 |
+
"manual": 1,
|
7895 |
+
"markbegin": 1,
|
7896 |
+
"markbeginend": 1
|
7897 |
+
};
|
7898 |
+
this.$foldStyle = "markbegin";
|
7899 |
+
this.setFoldStyle = function(style) {
|
7900 |
+
if (!this.$foldStyles[style])
|
7901 |
+
throw new Error("invalid fold style: " + style + "[" + Object.keys(this.$foldStyles).join(", ") + "]");
|
7902 |
+
|
7903 |
+
if (this.$foldStyle == style)
|
7904 |
+
return;
|
7905 |
+
|
7906 |
+
this.$foldStyle = style;
|
7907 |
+
|
7908 |
+
if (style == "manual")
|
7909 |
+
this.unfold();
|
7910 |
+
var mode = this.$foldMode;
|
7911 |
+
this.$setFolding(null);
|
7912 |
+
this.$setFolding(mode);
|
7913 |
+
};
|
7914 |
+
|
7915 |
+
this.$setFolding = function(foldMode) {
|
7916 |
+
if (this.$foldMode == foldMode)
|
7917 |
+
return;
|
7918 |
+
|
7919 |
+
this.$foldMode = foldMode;
|
7920 |
+
|
7921 |
+
this.removeListener('change', this.$updateFoldWidgets);
|
7922 |
+
this._emit("changeAnnotation");
|
7923 |
+
|
7924 |
+
if (!foldMode || this.$foldStyle == "manual") {
|
7925 |
+
this.foldWidgets = null;
|
7926 |
+
return;
|
7927 |
+
}
|
7928 |
+
|
7929 |
+
this.foldWidgets = [];
|
7930 |
+
this.getFoldWidget = foldMode.getFoldWidget.bind(foldMode, this, this.$foldStyle);
|
7931 |
+
this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle);
|
7932 |
+
|
7933 |
+
this.$updateFoldWidgets = this.updateFoldWidgets.bind(this);
|
7934 |
+
this.on('change', this.$updateFoldWidgets);
|
7935 |
+
|
7936 |
+
};
|
7937 |
+
|
7938 |
+
this.getParentFoldRangeData = function(row, ignoreCurrent) {
|
7939 |
+
var fw = this.foldWidgets;
|
7940 |
+
if (!fw || (ignoreCurrent && fw[row]))
|
7941 |
+
return {};
|
7942 |
+
|
7943 |
+
var i = row - 1,
|
7944 |
+
firstRange;
|
7945 |
+
while (i >= 0) {
|
7946 |
+
var c = fw[i];
|
7947 |
+
if (c == null)
|
7948 |
+
c = fw[i] = this.getFoldWidget(i);
|
7949 |
+
|
7950 |
+
if (c == "start") {
|
7951 |
+
var range = this.getFoldWidgetRange(i);
|
7952 |
+
if (!firstRange)
|
7953 |
+
firstRange = range;
|
7954 |
+
if (range && range.end.row >= row)
|
7955 |
+
break;
|
7956 |
+
}
|
7957 |
+
i--;
|
7958 |
+
}
|
7959 |
+
|
7960 |
+
return {
|
7961 |
+
range: i !== -1 && range,
|
7962 |
+
firstRange: firstRange
|
7963 |
+
};
|
7964 |
+
}
|
7965 |
+
|
7966 |
+
this.onFoldWidgetClick = function(row, e) {
|
7967 |
+
e = e.domEvent;
|
7968 |
+
var options = {
|
7969 |
+
children: e.shiftKey,
|
7970 |
+
all: e.ctrlKey || e.metaKey,
|
7971 |
+
siblings: e.altKey
|
7972 |
+
};
|
7973 |
+
|
7974 |
+
var range = this.$toggleFoldWidget(row, options);
|
7975 |
+
if (!range) {
|
7976 |
+
var el = (e.target || e.srcElement)
|
7977 |
+
if (el && /ace_fold-widget/.test(el.className))
|
7978 |
+
el.className += " ace_invalid";
|
7979 |
+
}
|
7980 |
+
};
|
7981 |
+
|
7982 |
+
this.$toggleFoldWidget = function(row, options) {
|
7983 |
+
if (!this.getFoldWidget)
|
7984 |
+
return;
|
7985 |
+
var type = this.getFoldWidget(row);
|
7986 |
+
var line = this.getLine(row);
|
7987 |
+
|
7988 |
+
var dir = type === "end" ? -1 : 1;
|
7989 |
+
var fold = this.getFoldAt(row, dir === -1 ? 0 : line.length, dir);
|
7990 |
+
|
7991 |
+
if (fold) {
|
7992 |
+
if (options.children || options.all)
|
7993 |
+
this.removeFold(fold);
|
7994 |
+
else
|
7995 |
+
this.expandFold(fold);
|
7996 |
+
return;
|
7997 |
+
}
|
7998 |
+
|
7999 |
+
var range = this.getFoldWidgetRange(row, true);
|
8000 |
+
if (range && !range.isMultiLine()) {
|
8001 |
+
fold = this.getFoldAt(range.start.row, range.start.column, 1);
|
8002 |
+
if (fold && range.isEqual(fold.range)) {
|
8003 |
+
this.removeFold(fold);
|
8004 |
+
return;
|
8005 |
+
}
|
8006 |
+
}
|
8007 |
+
|
8008 |
+
if (options.siblings) {
|
8009 |
+
var data = this.getParentFoldRangeData(row);
|
8010 |
+
if (data.range) {
|
8011 |
+
var startRow = data.range.start.row + 1;
|
8012 |
+
var endRow = data.range.end.row;
|
8013 |
+
}
|
8014 |
+
this.foldAll(startRow, endRow, options.all ? 10000 : 0);
|
8015 |
+
} else if (options.children) {
|
8016 |
+
endRow = range ? range.end.row : this.getLength();
|
8017 |
+
this.foldAll(row + 1, range.end.row, options.all ? 10000 : 0);
|
8018 |
+
} else if (range) {
|
8019 |
+
if (options.all)
|
8020 |
+
range.collapseChildren = 10000;
|
8021 |
+
this.addFold("...", range);
|
8022 |
+
}
|
8023 |
+
|
8024 |
+
return range;
|
8025 |
+
};
|
8026 |
+
|
8027 |
+
|
8028 |
+
|
8029 |
+
this.toggleFoldWidget = function(toggleParent) {
|
8030 |
+
var row = this.selection.getCursor().row;
|
8031 |
+
row = this.getRowFoldStart(row);
|
8032 |
+
var range = this.$toggleFoldWidget(row, {});
|
8033 |
+
|
8034 |
+
if (range)
|
8035 |
+
return;
|
8036 |
+
var data = this.getParentFoldRangeData(row, true);
|
8037 |
+
range = data.range || data.firstRange;
|
8038 |
+
|
8039 |
+
if (range) {
|
8040 |
+
row = range.start.row;
|
8041 |
+
var fold = this.getFoldAt(row, this.getLine(row).length, 1);
|
8042 |
+
|
8043 |
+
if (fold) {
|
8044 |
+
this.removeFold(fold);
|
8045 |
+
} else {
|
8046 |
+
this.addFold("...", range);
|
8047 |
+
}
|
8048 |
+
}
|
8049 |
+
};
|
8050 |
+
|
8051 |
+
this.updateFoldWidgets = function(e) {
|
8052 |
+
var delta = e.data;
|
8053 |
+
var range = delta.range;
|
8054 |
+
var firstRow = range.start.row;
|
8055 |
+
var len = range.end.row - firstRow;
|
8056 |
+
|
8057 |
+
if (len === 0) {
|
8058 |
+
this.foldWidgets[firstRow] = null;
|
8059 |
+
} else if (delta.action == "removeText" || delta.action == "removeLines") {
|
8060 |
+
this.foldWidgets.splice(firstRow, len + 1, null);
|
8061 |
+
} else {
|
8062 |
+
var args = Array(len + 1);
|
8063 |
+
args.unshift(firstRow, 1);
|
8064 |
+
this.foldWidgets.splice.apply(this.foldWidgets, args);
|
8065 |
+
}
|
8066 |
+
};
|
8067 |
+
|
8068 |
+
}
|
8069 |
+
|
8070 |
+
exports.Folding = Folding;
|
8071 |
+
|
8072 |
+
});
|
8073 |
+
|
8074 |
+
ace.define("ace/edit_session/bracket_match", ["require", "exports", "module", "ace/token_iterator", "ace/range"], function(require, exports, module) {
|
8075 |
+
"use strict";
|
8076 |
+
|
8077 |
+
var TokenIterator = require("../token_iterator").TokenIterator;
|
8078 |
+
var Range = require("../range").Range;
|
8079 |
+
|
8080 |
+
|
8081 |
+
function BracketMatch() {
|
8082 |
+
|
8083 |
+
this.findMatchingBracket = function(position, chr) {
|
8084 |
+
if (position.column == 0) return null;
|
8085 |
+
|
8086 |
+
var charBeforeCursor = chr || this.getLine(position.row).charAt(position.column - 1);
|
8087 |
+
if (charBeforeCursor == "") return null;
|
8088 |
+
|
8089 |
+
var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
|
8090 |
+
if (!match)
|
8091 |
+
return null;
|
8092 |
+
|
8093 |
+
if (match[1])
|
8094 |
+
return this.$findClosingBracket(match[1], position);
|
8095 |
+
else
|
8096 |
+
return this.$findOpeningBracket(match[2], position);
|
8097 |
+
};
|
8098 |
+
|
8099 |
+
this.getBracketRange = function(pos) {
|
8100 |
+
var line = this.getLine(pos.row);
|
8101 |
+
var before = true,
|
8102 |
+
range;
|
8103 |
+
|
8104 |
+
var chr = line.charAt(pos.column - 1);
|
8105 |
+
var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
|
8106 |
+
if (!match) {
|
8107 |
+
chr = line.charAt(pos.column);
|
8108 |
+
pos = {
|
8109 |
+
row: pos.row,
|
8110 |
+
column: pos.column + 1
|
8111 |
+
};
|
8112 |
+
match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
|
8113 |
+
before = false;
|
8114 |
+
}
|
8115 |
+
if (!match)
|
8116 |
+
return null;
|
8117 |
+
|
8118 |
+
if (match[1]) {
|
8119 |
+
var bracketPos = this.$findClosingBracket(match[1], pos);
|
8120 |
+
if (!bracketPos)
|
8121 |
+
return null;
|
8122 |
+
range = Range.fromPoints(pos, bracketPos);
|
8123 |
+
if (!before) {
|
8124 |
+
range.end.column++;
|
8125 |
+
range.start.column--;
|
8126 |
+
}
|
8127 |
+
range.cursor = range.end;
|
8128 |
+
} else {
|
8129 |
+
var bracketPos = this.$findOpeningBracket(match[2], pos);
|
8130 |
+
if (!bracketPos)
|
8131 |
+
return null;
|
8132 |
+
range = Range.fromPoints(bracketPos, pos);
|
8133 |
+
if (!before) {
|
8134 |
+
range.start.column++;
|
8135 |
+
range.end.column--;
|
8136 |
+
}
|
8137 |
+
range.cursor = range.start;
|
8138 |
+
}
|
8139 |
+
|
8140 |
+
return range;
|
8141 |
+
};
|
8142 |
+
|
8143 |
+
this.$brackets = {
|
8144 |
+
")": "(",
|
8145 |
+
"(": ")",
|
8146 |
+
"]": "[",
|
8147 |
+
"[": "]",
|
8148 |
+
"{": "}",
|
8149 |
+
"}": "{"
|
8150 |
+
};
|
8151 |
+
|
8152 |
+
this.$findOpeningBracket = function(bracket, position, typeRe) {
|
8153 |
+
var openBracket = this.$brackets[bracket];
|
8154 |
+
var depth = 1;
|
8155 |
+
|
8156 |
+
var iterator = new TokenIterator(this, position.row, position.column);
|
8157 |
+
var token = iterator.getCurrentToken();
|
8158 |
+
if (!token)
|
8159 |
+
token = iterator.stepForward();
|
8160 |
+
if (!token)
|
8161 |
+
return;
|
8162 |
+
|
8163 |
+
if (!typeRe) {
|
8164 |
+
typeRe = new RegExp(
|
8165 |
+
"(\\.?" +
|
8166 |
+
token.type.replace(".", "\\.").replace("rparen", ".paren")
|
8167 |
+
.replace(/\b(?:end|start|begin)\b/, "") + ")+"
|
8168 |
+
);
|
8169 |
+
}
|
8170 |
+
var valueIndex = position.column - iterator.getCurrentTokenColumn() - 2;
|
8171 |
+
var value = token.value;
|
8172 |
+
|
8173 |
+
while (true) {
|
8174 |
+
|
8175 |
+
while (valueIndex >= 0) {
|
8176 |
+
var chr = value.charAt(valueIndex);
|
8177 |
+
if (chr == openBracket) {
|
8178 |
+
depth -= 1;
|
8179 |
+
if (depth == 0) {
|
8180 |
+
return {
|
8181 |
+
row: iterator.getCurrentTokenRow(),
|
8182 |
+
column: valueIndex + iterator.getCurrentTokenColumn()
|
8183 |
+
};
|
8184 |
+
}
|
8185 |
+
} else if (chr == bracket) {
|
8186 |
+
depth += 1;
|
8187 |
+
}
|
8188 |
+
valueIndex -= 1;
|
8189 |
+
}
|
8190 |
+
do {
|
8191 |
+
token = iterator.stepBackward();
|
8192 |
+
} while (token && !typeRe.test(token.type));
|
8193 |
+
|
8194 |
+
if (token == null)
|
8195 |
+
break;
|
8196 |
+
|
8197 |
+
value = token.value;
|
8198 |
+
valueIndex = value.length - 1;
|
8199 |
+
}
|
8200 |
+
|
8201 |
+
return null;
|
8202 |
+
};
|
8203 |
+
|
8204 |
+
this.$findClosingBracket = function(bracket, position, typeRe) {
|
8205 |
+
var closingBracket = this.$brackets[bracket];
|
8206 |
+
var depth = 1;
|
8207 |
+
|
8208 |
+
var iterator = new TokenIterator(this, position.row, position.column);
|
8209 |
+
var token = iterator.getCurrentToken();
|
8210 |
+
if (!token)
|
8211 |
+
token = iterator.stepForward();
|
8212 |
+
if (!token)
|
8213 |
+
return;
|
8214 |
+
|
8215 |
+
if (!typeRe) {
|
8216 |
+
typeRe = new RegExp(
|
8217 |
+
"(\\.?" +
|
8218 |
+
token.type.replace(".", "\\.").replace("lparen", ".paren")
|
8219 |
+
.replace(/\b(?:end|start|begin)\b/, "") + ")+"
|
8220 |
+
);
|
8221 |
+
}
|
8222 |
+
var valueIndex = position.column - iterator.getCurrentTokenColumn();
|
8223 |
+
|
8224 |
+
while (true) {
|
8225 |
+
|
8226 |
+
var value = token.value;
|
8227 |
+
var valueLength = value.length;
|
8228 |
+
while (valueIndex < valueLength) {
|
8229 |
+
var chr = value.charAt(valueIndex);
|
8230 |
+
if (chr == closingBracket) {
|
8231 |
+
depth -= 1;
|
8232 |
+
if (depth == 0) {
|
8233 |
+
return {
|
8234 |
+
row: iterator.getCurrentTokenRow(),
|
8235 |
+
column: valueIndex + iterator.getCurrentTokenColumn()
|
8236 |
+
};
|
8237 |
+
}
|
8238 |
+
} else if (chr == bracket) {
|
8239 |
+
depth += 1;
|
8240 |
+
}
|
8241 |
+
valueIndex += 1;
|
8242 |
+
}
|
8243 |
+
do {
|
8244 |
+
token = iterator.stepForward();
|
8245 |
+
} while (token && !typeRe.test(token.type));
|
8246 |
+
|
8247 |
+
if (token == null)
|
8248 |
+
break;
|
8249 |
+
|
8250 |
+
valueIndex = 0;
|
8251 |
+
}
|
8252 |
+
|
8253 |
+
return null;
|
8254 |
+
};
|
8255 |
+
}
|
8256 |
+
exports.BracketMatch = BracketMatch;
|
8257 |
+
|
8258 |
+
});
|
8259 |
+
|
8260 |
+
ace.define("ace/edit_session", ["require", "exports", "module", "ace/lib/oop", "ace/lib/lang", "ace/config", "ace/lib/event_emitter", "ace/selection", "ace/mode/text", "ace/range", "ace/document", "ace/background_tokenizer", "ace/search_highlight", "ace/edit_session/folding", "ace/edit_session/bracket_match"], function(require, exports, module) {
|
8261 |
+
"use strict";
|
8262 |
+
|
8263 |
+
var oop = require("./lib/oop");
|
8264 |
+
var lang = require("./lib/lang");
|
8265 |
+
var config = require("./config");
|
8266 |
+
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
8267 |
+
var Selection = require("./selection").Selection;
|
8268 |
+
var TextMode = require("./mode/text").Mode;
|
8269 |
+
var Range = require("./range").Range;
|
8270 |
+
var Document = require("./document").Document;
|
8271 |
+
var BackgroundTokenizer = require("./background_tokenizer").BackgroundTokenizer;
|
8272 |
+
var SearchHighlight = require("./search_highlight").SearchHighlight;
|
8273 |
+
|
8274 |
+
var EditSession = function(text, mode) {
|
8275 |
+
this.$breakpoints = [];
|
8276 |
+
this.$decorations = [];
|
8277 |
+
this.$frontMarkers = {};
|
8278 |
+
this.$backMarkers = {};
|
8279 |
+
this.$markerId = 1;
|
8280 |
+
this.$undoSelect = true;
|
8281 |
+
|
8282 |
+
this.$foldData = [];
|
8283 |
+
this.$foldData.toString = function() {
|
8284 |
+
return this.join("\n");
|
8285 |
+
}
|
8286 |
+
this.on("changeFold", this.onChangeFold.bind(this));
|
8287 |
+
this.$onChange = this.onChange.bind(this);
|
8288 |
+
|
8289 |
+
if (typeof text != "object" || !text.getLine)
|
8290 |
+
text = new Document(text);
|
8291 |
+
|
8292 |
+
this.setDocument(text);
|
8293 |
+
this.selection = new Selection(this);
|
8294 |
+
|
8295 |
+
config.resetOptions(this);
|
8296 |
+
this.setMode(mode);
|
8297 |
+
config._signal("session", this);
|
8298 |
+
};
|
8299 |
+
|
8300 |
+
|
8301 |
+
(function() {
|
8302 |
+
|
8303 |
+
oop.implement(this, EventEmitter);
|
8304 |
+
this.setDocument = function(doc) {
|
8305 |
+
if (this.doc)
|
8306 |
+
this.doc.removeListener("change", this.$onChange);
|
8307 |
+
|
8308 |
+
this.doc = doc;
|
8309 |
+
doc.on("change", this.$onChange);
|
8310 |
+
|
8311 |
+
if (this.bgTokenizer)
|
8312 |
+
this.bgTokenizer.setDocument(this.getDocument());
|
8313 |
+
|
8314 |
+
this.resetCaches();
|
8315 |
+
};
|
8316 |
+
this.getDocument = function() {
|
8317 |
+
return this.doc;
|
8318 |
+
};
|
8319 |
+
this.$resetRowCache = function(docRow) {
|
8320 |
+
if (!docRow) {
|
8321 |
+
this.$docRowCache = [];
|
8322 |
+
this.$screenRowCache = [];
|
8323 |
+
return;
|
8324 |
+
}
|
8325 |
+
var l = this.$docRowCache.length;
|
8326 |
+
var i = this.$getRowCacheIndex(this.$docRowCache, docRow) + 1;
|
8327 |
+
if (l > i) {
|
8328 |
+
this.$docRowCache.splice(i, l);
|
8329 |
+
this.$screenRowCache.splice(i, l);
|
8330 |
+
}
|
8331 |
+
};
|
8332 |
+
|
8333 |
+
this.$getRowCacheIndex = function(cacheArray, val) {
|
8334 |
+
var low = 0;
|
8335 |
+
var hi = cacheArray.length - 1;
|
8336 |
+
|
8337 |
+
while (low <= hi) {
|
8338 |
+
var mid = (low + hi) >> 1;
|
8339 |
+
var c = cacheArray[mid];
|
8340 |
+
|
8341 |
+
if (val > c)
|
8342 |
+
low = mid + 1;
|
8343 |
+
else if (val < c)
|
8344 |
+
hi = mid - 1;
|
8345 |
+
else
|
8346 |
+
return mid;
|
8347 |
+
}
|
8348 |
+
|
8349 |
+
return low - 1;
|
8350 |
+
};
|
8351 |
+
|
8352 |
+
this.resetCaches = function() {
|
8353 |
+
this.$modified = true;
|
8354 |
+
this.$wrapData = [];
|
8355 |
+
this.$rowLengthCache = [];
|
8356 |
+
this.$resetRowCache(0);
|
8357 |
+
if (this.bgTokenizer)
|
8358 |
+
this.bgTokenizer.start(0);
|
8359 |
+
};
|
8360 |
+
|
8361 |
+
this.onChangeFold = function(e) {
|
8362 |
+
var fold = e.data;
|
8363 |
+
this.$resetRowCache(fold.start.row);
|
8364 |
+
};
|
8365 |
+
|
8366 |
+
this.onChange = function(e) {
|
8367 |
+
var delta = e.data;
|
8368 |
+
this.$modified = true;
|
8369 |
+
|
8370 |
+
this.$resetRowCache(delta.range.start.row);
|
8371 |
+
|
8372 |
+
var removedFolds = this.$updateInternalDataOnChange(e);
|
8373 |
+
if (!this.$fromUndo && this.$undoManager && !delta.ignore) {
|
8374 |
+
this.$deltasDoc.push(delta);
|
8375 |
+
if (removedFolds && removedFolds.length != 0) {
|
8376 |
+
this.$deltasFold.push({
|
8377 |
+
action: "removeFolds",
|
8378 |
+
folds: removedFolds
|
8379 |
+
});
|
8380 |
+
}
|
8381 |
+
|
8382 |
+
this.$informUndoManager.schedule();
|
8383 |
+
}
|
8384 |
+
|
8385 |
+
this.bgTokenizer && this.bgTokenizer.$updateOnChange(delta);
|
8386 |
+
this._signal("change", e);
|
8387 |
+
};
|
8388 |
+
this.setValue = function(text) {
|
8389 |
+
this.doc.setValue(text);
|
8390 |
+
this.selection.moveTo(0, 0);
|
8391 |
+
|
8392 |
+
this.$resetRowCache(0);
|
8393 |
+
this.$deltas = [];
|
8394 |
+
this.$deltasDoc = [];
|
8395 |
+
this.$deltasFold = [];
|
8396 |
+
this.setUndoManager(this.$undoManager);
|
8397 |
+
this.getUndoManager().reset();
|
8398 |
+
};
|
8399 |
+
this.getValue =
|
8400 |
+
this.toString = function() {
|
8401 |
+
return this.doc.getValue();
|
8402 |
+
};
|
8403 |
+
this.getSelection = function() {
|
8404 |
+
return this.selection;
|
8405 |
+
};
|
8406 |
+
this.getState = function(row) {
|
8407 |
+
return this.bgTokenizer.getState(row);
|
8408 |
+
};
|
8409 |
+
this.getTokens = function(row) {
|
8410 |
+
return this.bgTokenizer.getTokens(row);
|
8411 |
+
};
|
8412 |
+
this.getTokenAt = function(row, column) {
|
8413 |
+
var tokens = this.bgTokenizer.getTokens(row);
|
8414 |
+
var token, c = 0;
|
8415 |
+
if (column == null) {
|
8416 |
+
i = tokens.length - 1;
|
8417 |
+
c = this.getLine(row).length;
|
8418 |
+
} else {
|
8419 |
+
for (var i = 0; i < tokens.length; i++) {
|
8420 |
+
c += tokens[i].value.length;
|
8421 |
+
if (c >= column)
|
8422 |
+
break;
|
8423 |
+
}
|
8424 |
+
}
|
8425 |
+
token = tokens[i];
|
8426 |
+
if (!token)
|
8427 |
+
return null;
|
8428 |
+
token.index = i;
|
8429 |
+
token.start = c - token.value.length;
|
8430 |
+
return token;
|
8431 |
+
};
|
8432 |
+
this.setUndoManager = function(undoManager) {
|
8433 |
+
this.$undoManager = undoManager;
|
8434 |
+
this.$deltas = [];
|
8435 |
+
this.$deltasDoc = [];
|
8436 |
+
this.$deltasFold = [];
|
8437 |
+
|
8438 |
+
if (this.$informUndoManager)
|
8439 |
+
this.$informUndoManager.cancel();
|
8440 |
+
|
8441 |
+
if (undoManager) {
|
8442 |
+
var self = this;
|
8443 |
+
|
8444 |
+
this.$syncInformUndoManager = function() {
|
8445 |
+
self.$informUndoManager.cancel();
|
8446 |
+
|
8447 |
+
if (self.$deltasFold.length) {
|
8448 |
+
self.$deltas.push({
|
8449 |
+
group: "fold",
|
8450 |
+
deltas: self.$deltasFold
|
8451 |
+
});
|
8452 |
+
self.$deltasFold = [];
|
8453 |
+
}
|
8454 |
+
|
8455 |
+
if (self.$deltasDoc.length) {
|
8456 |
+
self.$deltas.push({
|
8457 |
+
group: "doc",
|
8458 |
+
deltas: self.$deltasDoc
|
8459 |
+
});
|
8460 |
+
self.$deltasDoc = [];
|
8461 |
+
}
|
8462 |
+
|
8463 |
+
if (self.$deltas.length > 0) {
|
8464 |
+
undoManager.execute({
|
8465 |
+
action: "aceupdate",
|
8466 |
+
args: [self.$deltas, self],
|
8467 |
+
merge: self.mergeUndoDeltas
|
8468 |
+
});
|
8469 |
+
}
|
8470 |
+
self.mergeUndoDeltas = false;
|
8471 |
+
self.$deltas = [];
|
8472 |
+
};
|
8473 |
+
this.$informUndoManager = lang.delayedCall(this.$syncInformUndoManager);
|
8474 |
+
}
|
8475 |
+
};
|
8476 |
+
this.markUndoGroup = function() {
|
8477 |
+
if (this.$syncInformUndoManager)
|
8478 |
+
this.$syncInformUndoManager();
|
8479 |
+
};
|
8480 |
+
|
8481 |
+
this.$defaultUndoManager = {
|
8482 |
+
undo: function() {},
|
8483 |
+
redo: function() {},
|
8484 |
+
reset: function() {}
|
8485 |
+
};
|
8486 |
+
this.getUndoManager = function() {
|
8487 |
+
return this.$undoManager || this.$defaultUndoManager;
|
8488 |
+
};
|
8489 |
+
this.getTabString = function() {
|
8490 |
+
if (this.getUseSoftTabs()) {
|
8491 |
+
return lang.stringRepeat(" ", this.getTabSize());
|
8492 |
+
} else {
|
8493 |
+
return "\t";
|
8494 |
+
}
|
8495 |
+
};
|
8496 |
+
this.setUseSoftTabs = function(val) {
|
8497 |
+
this.setOption("useSoftTabs", val);
|
8498 |
+
};
|
8499 |
+
this.getUseSoftTabs = function() {
|
8500 |
+
return this.$useSoftTabs && !this.$mode.$indentWithTabs;
|
8501 |
+
};
|
8502 |
+
this.setTabSize = function(tabSize) {
|
8503 |
+
this.setOption("tabSize", tabSize);
|
8504 |
+
};
|
8505 |
+
this.getTabSize = function() {
|
8506 |
+
return this.$tabSize;
|
8507 |
+
};
|
8508 |
+
this.isTabStop = function(position) {
|
8509 |
+
return this.$useSoftTabs && (position.column % this.$tabSize === 0);
|
8510 |
+
};
|
8511 |
+
|
8512 |
+
this.$overwrite = false;
|
8513 |
+
this.setOverwrite = function(overwrite) {
|
8514 |
+
this.setOption("overwrite", overwrite);
|
8515 |
+
};
|
8516 |
+
this.getOverwrite = function() {
|
8517 |
+
return this.$overwrite;
|
8518 |
+
};
|
8519 |
+
this.toggleOverwrite = function() {
|
8520 |
+
this.setOverwrite(!this.$overwrite);
|
8521 |
+
};
|
8522 |
+
this.addGutterDecoration = function(row, className) {
|
8523 |
+
if (!this.$decorations[row])
|
8524 |
+
this.$decorations[row] = "";
|
8525 |
+
this.$decorations[row] += " " + className;
|
8526 |
+
this._signal("changeBreakpoint", {});
|
8527 |
+
};
|
8528 |
+
this.removeGutterDecoration = function(row, className) {
|
8529 |
+
this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
|
8530 |
+
this._signal("changeBreakpoint", {});
|
8531 |
+
};
|
8532 |
+
this.getBreakpoints = function() {
|
8533 |
+
return this.$breakpoints;
|
8534 |
+
};
|
8535 |
+
this.setBreakpoints = function(rows) {
|
8536 |
+
this.$breakpoints = [];
|
8537 |
+
for (var i = 0; i < rows.length; i++) {
|
8538 |
+
this.$breakpoints[rows[i]] = "ace_breakpoint";
|
8539 |
+
}
|
8540 |
+
this._signal("changeBreakpoint", {});
|
8541 |
+
};
|
8542 |
+
this.clearBreakpoints = function() {
|
8543 |
+
this.$breakpoints = [];
|
8544 |
+
this._signal("changeBreakpoint", {});
|
8545 |
+
};
|
8546 |
+
this.setBreakpoint = function(row, className) {
|
8547 |
+
if (className === undefined)
|
8548 |
+
className = "ace_breakpoint";
|
8549 |
+
if (className)
|
8550 |
+
this.$breakpoints[row] = className;
|
8551 |
+
else
|
8552 |
+
delete this.$breakpoints[row];
|
8553 |
+
this._signal("changeBreakpoint", {});
|
8554 |
+
};
|
8555 |
+
this.clearBreakpoint = function(row) {
|
8556 |
+
delete this.$breakpoints[row];
|
8557 |
+
this._signal("changeBreakpoint", {});
|
8558 |
+
};
|
8559 |
+
this.addMarker = function(range, clazz, type, inFront) {
|
8560 |
+
var id = this.$markerId++;
|
8561 |
+
|
8562 |
+
var marker = {
|
8563 |
+
range: range,
|
8564 |
+
type: type || "line",
|
8565 |
+
renderer: typeof type == "function" ? type : null,
|
8566 |
+
clazz: clazz,
|
8567 |
+
inFront: !! inFront,
|
8568 |
+
id: id
|
8569 |
+
};
|
8570 |
+
|
8571 |
+
if (inFront) {
|
8572 |
+
this.$frontMarkers[id] = marker;
|
8573 |
+
this._signal("changeFrontMarker");
|
8574 |
+
} else {
|
8575 |
+
this.$backMarkers[id] = marker;
|
8576 |
+
this._signal("changeBackMarker");
|
8577 |
+
}
|
8578 |
+
|
8579 |
+
return id;
|
8580 |
+
};
|
8581 |
+
this.addDynamicMarker = function(marker, inFront) {
|
8582 |
+
if (!marker.update)
|
8583 |
+
return;
|
8584 |
+
var id = this.$markerId++;
|
8585 |
+
marker.id = id;
|
8586 |
+
marker.inFront = !! inFront;
|
8587 |
+
|
8588 |
+
if (inFront) {
|
8589 |
+
this.$frontMarkers[id] = marker;
|
8590 |
+
this._signal("changeFrontMarker");
|
8591 |
+
} else {
|
8592 |
+
this.$backMarkers[id] = marker;
|
8593 |
+
this._signal("changeBackMarker");
|
8594 |
+
}
|
8595 |
+
|
8596 |
+
return marker;
|
8597 |
+
};
|
8598 |
+
this.removeMarker = function(markerId) {
|
8599 |
+
var marker = this.$frontMarkers[markerId] || this.$backMarkers[markerId];
|
8600 |
+
if (!marker)
|
8601 |
+
return;
|
8602 |
+
|
8603 |
+
var markers = marker.inFront ? this.$frontMarkers : this.$backMarkers;
|
8604 |
+
if (marker) {
|
8605 |
+
delete(markers[markerId]);
|
8606 |
+
this._signal(marker.inFront ? "changeFrontMarker" : "changeBackMarker");
|
8607 |
+
}
|
8608 |
+
};
|
8609 |
+
this.getMarkers = function(inFront) {
|
8610 |
+
return inFront ? this.$frontMarkers : this.$backMarkers;
|
8611 |
+
};
|
8612 |
+
|
8613 |
+
this.highlight = function(re) {
|
8614 |
+
if (!this.$searchHighlight) {
|
8615 |
+
var highlight = new SearchHighlight(null, "ace_selected-word", "text");
|
8616 |
+
this.$searchHighlight = this.addDynamicMarker(highlight);
|
8617 |
+
}
|
8618 |
+
this.$searchHighlight.setRegexp(re);
|
8619 |
+
};
|
8620 |
+
this.highlightLines = function(startRow, endRow, clazz, inFront) {
|
8621 |
+
if (typeof endRow != "number") {
|
8622 |
+
clazz = endRow;
|
8623 |
+
endRow = startRow;
|
8624 |
+
}
|
8625 |
+
if (!clazz)
|
8626 |
+
clazz = "ace_step";
|
8627 |
+
|
8628 |
+
var range = new Range(startRow, 0, endRow, Infinity);
|
8629 |
+
range.id = this.addMarker(range, clazz, "fullLine", inFront);
|
8630 |
+
return range;
|
8631 |
+
};
|
8632 |
+
this.setAnnotations = function(annotations) {
|
8633 |
+
this.$annotations = annotations;
|
8634 |
+
this._signal("changeAnnotation", {});
|
8635 |
+
};
|
8636 |
+
this.getAnnotations = function() {
|
8637 |
+
return this.$annotations || [];
|
8638 |
+
};
|
8639 |
+
this.clearAnnotations = function() {
|
8640 |
+
this.setAnnotations([]);
|
8641 |
+
};
|
8642 |
+
this.$detectNewLine = function(text) {
|
8643 |
+
var match = text.match(/^.*?(\r?\n)/m);
|
8644 |
+
if (match) {
|
8645 |
+
this.$autoNewLine = match[1];
|
8646 |
+
} else {
|
8647 |
+
this.$autoNewLine = "\n";
|
8648 |
+
}
|
8649 |
+
};
|
8650 |
+
this.getWordRange = function(row, column) {
|
8651 |
+
var line = this.getLine(row);
|
8652 |
+
|
8653 |
+
var inToken = false;
|
8654 |
+
if (column > 0)
|
8655 |
+
inToken = !! line.charAt(column - 1).match(this.tokenRe);
|
8656 |
+
|
8657 |
+
if (!inToken)
|
8658 |
+
inToken = !! line.charAt(column).match(this.tokenRe);
|
8659 |
+
|
8660 |
+
if (inToken)
|
8661 |
+
var re = this.tokenRe;
|
8662 |
+
else if (/^\s+$/.test(line.slice(column - 1, column + 1)))
|
8663 |
+
var re = /\s/;
|
8664 |
+
else
|
8665 |
+
var re = this.nonTokenRe;
|
8666 |
+
|
8667 |
+
var start = column;
|
8668 |
+
if (start > 0) {
|
8669 |
+
do {
|
8670 |
+
start--;
|
8671 |
+
}
|
8672 |
+
while (start >= 0 && line.charAt(start).match(re));
|
8673 |
+
start++;
|
8674 |
+
}
|
8675 |
+
|
8676 |
+
var end = column;
|
8677 |
+
while (end < line.length && line.charAt(end).match(re)) {
|
8678 |
+
end++;
|
8679 |
+
}
|
8680 |
+
|
8681 |
+
return new Range(row, start, row, end);
|
8682 |
+
};
|
8683 |
+
this.getAWordRange = function(row, column) {
|
8684 |
+
var wordRange = this.getWordRange(row, column);
|
8685 |
+
var line = this.getLine(wordRange.end.row);
|
8686 |
+
|
8687 |
+
while (line.charAt(wordRange.end.column).match(/[ \t]/)) {
|
8688 |
+
wordRange.end.column += 1;
|
8689 |
+
}
|
8690 |
+
return wordRange;
|
8691 |
+
};
|
8692 |
+
this.setNewLineMode = function(newLineMode) {
|
8693 |
+
this.doc.setNewLineMode(newLineMode);
|
8694 |
+
};
|
8695 |
+
this.getNewLineMode = function() {
|
8696 |
+
return this.doc.getNewLineMode();
|
8697 |
+
};
|
8698 |
+
this.setUseWorker = function(useWorker) {
|
8699 |
+
this.setOption("useWorker", useWorker);
|
8700 |
+
};
|
8701 |
+
this.getUseWorker = function() {
|
8702 |
+
return this.$useWorker;
|
8703 |
+
};
|
8704 |
+
this.onReloadTokenizer = function(e) {
|
8705 |
+
var rows = e.data;
|
8706 |
+
this.bgTokenizer.start(rows.first);
|
8707 |
+
this._signal("tokenizerUpdate", e);
|
8708 |
+
};
|
8709 |
+
|
8710 |
+
this.$modes = {};
|
8711 |
+
this.$mode = null;
|
8712 |
+
this.$modeId = null;
|
8713 |
+
this.setMode = function(mode, cb) {
|
8714 |
+
if (mode && typeof mode === "object") {
|
8715 |
+
if (mode.getTokenizer)
|
8716 |
+
return this.$onChangeMode(mode);
|
8717 |
+
var options = mode;
|
8718 |
+
var path = options.path;
|
8719 |
+
} else {
|
8720 |
+
path = mode || "ace/mode/text";
|
8721 |
+
}
|
8722 |
+
if (!this.$modes["ace/mode/text"])
|
8723 |
+
this.$modes["ace/mode/text"] = new TextMode();
|
8724 |
+
|
8725 |
+
if (this.$modes[path] && !options) {
|
8726 |
+
this.$onChangeMode(this.$modes[path]);
|
8727 |
+
cb && cb();
|
8728 |
+
return;
|
8729 |
+
}
|
8730 |
+
this.$modeId = path;
|
8731 |
+
config.loadModule(["mode", path], function(m) {
|
8732 |
+
if (this.$modeId !== path)
|
8733 |
+
return cb && cb();
|
8734 |
+
if (this.$modes[path] && !options)
|
8735 |
+
return this.$onChangeMode(this.$modes[path]);
|
8736 |
+
if (m && m.Mode) {
|
8737 |
+
m = new m.Mode(options);
|
8738 |
+
if (!options) {
|
8739 |
+
this.$modes[path] = m;
|
8740 |
+
m.$id = path;
|
8741 |
+
}
|
8742 |
+
this.$onChangeMode(m);
|
8743 |
+
cb && cb();
|
8744 |
+
}
|
8745 |
+
}.bind(this));
|
8746 |
+
if (!this.$mode)
|
8747 |
+
this.$onChangeMode(this.$modes["ace/mode/text"], true);
|
8748 |
+
};
|
8749 |
+
|
8750 |
+
this.$onChangeMode = function(mode, $isPlaceholder) {
|
8751 |
+
if (!$isPlaceholder)
|
8752 |
+
this.$modeId = mode.$id;
|
8753 |
+
if (this.$mode === mode)
|
8754 |
+
return;
|
8755 |
+
|
8756 |
+
this.$mode = mode;
|
8757 |
+
|
8758 |
+
this.$stopWorker();
|
8759 |
+
|
8760 |
+
if (this.$useWorker)
|
8761 |
+
this.$startWorker();
|
8762 |
+
|
8763 |
+
var tokenizer = mode.getTokenizer();
|
8764 |
+
|
8765 |
+
if (tokenizer.addEventListener !== undefined) {
|
8766 |
+
var onReloadTokenizer = this.onReloadTokenizer.bind(this);
|
8767 |
+
tokenizer.addEventListener("update", onReloadTokenizer);
|
8768 |
+
}
|
8769 |
+
|
8770 |
+
if (!this.bgTokenizer) {
|
8771 |
+
this.bgTokenizer = new BackgroundTokenizer(tokenizer);
|
8772 |
+
var _self = this;
|
8773 |
+
this.bgTokenizer.addEventListener("update", function(e) {
|
8774 |
+
_self._signal("tokenizerUpdate", e);
|
8775 |
+
});
|
8776 |
+
} else {
|
8777 |
+
this.bgTokenizer.setTokenizer(tokenizer);
|
8778 |
+
}
|
8779 |
+
|
8780 |
+
this.bgTokenizer.setDocument(this.getDocument());
|
8781 |
+
|
8782 |
+
this.tokenRe = mode.tokenRe;
|
8783 |
+
this.nonTokenRe = mode.nonTokenRe;
|
8784 |
+
|
8785 |
+
|
8786 |
+
if (!$isPlaceholder) {
|
8787 |
+
if (mode.attachToSession)
|
8788 |
+
mode.attachToSession(this);
|
8789 |
+
this.$options.wrapMethod.set.call(this, this.$wrapMethod);
|
8790 |
+
this.$setFolding(mode.foldingRules);
|
8791 |
+
this.bgTokenizer.start(0);
|
8792 |
+
this._emit("changeMode");
|
8793 |
+
}
|
8794 |
+
};
|
8795 |
+
|
8796 |
+
this.$stopWorker = function() {
|
8797 |
+
if (this.$worker) {
|
8798 |
+
this.$worker.terminate();
|
8799 |
+
this.$worker = null;
|
8800 |
+
}
|
8801 |
+
};
|
8802 |
+
|
8803 |
+
this.$startWorker = function() {
|
8804 |
+
try {
|
8805 |
+
this.$worker = this.$mode.createWorker(this);
|
8806 |
+
} catch (e) {
|
8807 |
+
if (typeof console == "object") {
|
8808 |
+
console.log("Could not load worker");
|
8809 |
+
console.log(e);
|
8810 |
+
}
|
8811 |
+
this.$worker = null;
|
8812 |
+
}
|
8813 |
+
};
|
8814 |
+
this.getMode = function() {
|
8815 |
+
return this.$mode;
|
8816 |
+
};
|
8817 |
+
|
8818 |
+
this.$scrollTop = 0;
|
8819 |
+
this.setScrollTop = function(scrollTop) {
|
8820 |
+
if (this.$scrollTop === scrollTop || isNaN(scrollTop))
|
8821 |
+
return;
|
8822 |
+
|
8823 |
+
this.$scrollTop = scrollTop;
|
8824 |
+
this._signal("changeScrollTop", scrollTop);
|
8825 |
+
};
|
8826 |
+
this.getScrollTop = function() {
|
8827 |
+
return this.$scrollTop;
|
8828 |
+
};
|
8829 |
+
|
8830 |
+
this.$scrollLeft = 0;
|
8831 |
+
this.setScrollLeft = function(scrollLeft) {
|
8832 |
+
if (this.$scrollLeft === scrollLeft || isNaN(scrollLeft))
|
8833 |
+
return;
|
8834 |
+
|
8835 |
+
this.$scrollLeft = scrollLeft;
|
8836 |
+
this._signal("changeScrollLeft", scrollLeft);
|
8837 |
+
};
|
8838 |
+
this.getScrollLeft = function() {
|
8839 |
+
return this.$scrollLeft;
|
8840 |
+
};
|
8841 |
+
this.getScreenWidth = function() {
|
8842 |
+
this.$computeWidth();
|
8843 |
+
if (this.lineWidgets)
|
8844 |
+
return Math.max(this.getLineWidgetMaxWidth(), this.screenWidth);
|
8845 |
+
return this.screenWidth;
|
8846 |
+
};
|
8847 |
+
|
8848 |
+
this.getLineWidgetMaxWidth = function() {
|
8849 |
+
if (this.lineWidgetsWidth != null) return this.lineWidgetsWidth;
|
8850 |
+
var width = 0;
|
8851 |
+
this.lineWidgets.forEach(function(w) {
|
8852 |
+
if (w && w.screenWidth > width)
|
8853 |
+
width = w.screenWidth;
|
8854 |
+
});
|
8855 |
+
return this.lineWidgetWidth = width;
|
8856 |
+
};
|
8857 |
+
|
8858 |
+
this.$computeWidth = function(force) {
|
8859 |
+
if (this.$modified || force) {
|
8860 |
+
this.$modified = false;
|
8861 |
+
|
8862 |
+
if (this.$useWrapMode)
|
8863 |
+
return this.screenWidth = this.$wrapLimit;
|
8864 |
+
|
8865 |
+
var lines = this.doc.getAllLines();
|
8866 |
+
var cache = this.$rowLengthCache;
|
8867 |
+
var longestScreenLine = 0;
|
8868 |
+
var foldIndex = 0;
|
8869 |
+
var foldLine = this.$foldData[foldIndex];
|
8870 |
+
var foldStart = foldLine ? foldLine.start.row : Infinity;
|
8871 |
+
var len = lines.length;
|
8872 |
+
|
8873 |
+
for (var i = 0; i < len; i++) {
|
8874 |
+
if (i > foldStart) {
|
8875 |
+
i = foldLine.end.row + 1;
|
8876 |
+
if (i >= len)
|
8877 |
+
break;
|
8878 |
+
foldLine = this.$foldData[foldIndex++];
|
8879 |
+
foldStart = foldLine ? foldLine.start.row : Infinity;
|
8880 |
+
}
|
8881 |
+
|
8882 |
+
if (cache[i] == null)
|
8883 |
+
cache[i] = this.$getStringScreenWidth(lines[i])[0];
|
8884 |
+
|
8885 |
+
if (cache[i] > longestScreenLine)
|
8886 |
+
longestScreenLine = cache[i];
|
8887 |
+
}
|
8888 |
+
this.screenWidth = longestScreenLine;
|
8889 |
+
}
|
8890 |
+
};
|
8891 |
+
this.getLine = function(row) {
|
8892 |
+
return this.doc.getLine(row);
|
8893 |
+
};
|
8894 |
+
this.getLines = function(firstRow, lastRow) {
|
8895 |
+
return this.doc.getLines(firstRow, lastRow);
|
8896 |
+
};
|
8897 |
+
this.getLength = function() {
|
8898 |
+
return this.doc.getLength();
|
8899 |
+
};
|
8900 |
+
this.getTextRange = function(range) {
|
8901 |
+
return this.doc.getTextRange(range || this.selection.getRange());
|
8902 |
+
};
|
8903 |
+
this.insert = function(position, text) {
|
8904 |
+
return this.doc.insert(position, text);
|
8905 |
+
};
|
8906 |
+
this.remove = function(range) {
|
8907 |
+
return this.doc.remove(range);
|
8908 |
+
};
|
8909 |
+
this.undoChanges = function(deltas, dontSelect) {
|
8910 |
+
if (!deltas.length)
|
8911 |
+
return;
|
8912 |
+
|
8913 |
+
this.$fromUndo = true;
|
8914 |
+
var lastUndoRange = null;
|
8915 |
+
for (var i = deltas.length - 1; i != -1; i--) {
|
8916 |
+
var delta = deltas[i];
|
8917 |
+
if (delta.group == "doc") {
|
8918 |
+
this.doc.revertDeltas(delta.deltas);
|
8919 |
+
lastUndoRange =
|
8920 |
+
this.$getUndoSelection(delta.deltas, true, lastUndoRange);
|
8921 |
+
} else {
|
8922 |
+
delta.deltas.forEach(function(foldDelta) {
|
8923 |
+
this.addFolds(foldDelta.folds);
|
8924 |
+
}, this);
|
8925 |
+
}
|
8926 |
+
}
|
8927 |
+
this.$fromUndo = false;
|
8928 |
+
lastUndoRange &&
|
8929 |
+
this.$undoSelect && !dontSelect &&
|
8930 |
+
this.selection.setSelectionRange(lastUndoRange);
|
8931 |
+
return lastUndoRange;
|
8932 |
+
};
|
8933 |
+
this.redoChanges = function(deltas, dontSelect) {
|
8934 |
+
if (!deltas.length)
|
8935 |
+
return;
|
8936 |
+
|
8937 |
+
this.$fromUndo = true;
|
8938 |
+
var lastUndoRange = null;
|
8939 |
+
for (var i = 0; i < deltas.length; i++) {
|
8940 |
+
var delta = deltas[i];
|
8941 |
+
if (delta.group == "doc") {
|
8942 |
+
this.doc.applyDeltas(delta.deltas);
|
8943 |
+
lastUndoRange =
|
8944 |
+
this.$getUndoSelection(delta.deltas, false, lastUndoRange);
|
8945 |
+
}
|
8946 |
+
}
|
8947 |
+
this.$fromUndo = false;
|
8948 |
+
lastUndoRange &&
|
8949 |
+
this.$undoSelect && !dontSelect &&
|
8950 |
+
this.selection.setSelectionRange(lastUndoRange);
|
8951 |
+
return lastUndoRange;
|
8952 |
+
};
|
8953 |
+
this.setUndoSelect = function(enable) {
|
8954 |
+
this.$undoSelect = enable;
|
8955 |
+
};
|
8956 |
+
|
8957 |
+
this.$getUndoSelection = function(deltas, isUndo, lastUndoRange) {
|
8958 |
+
function isInsert(delta) {
|
8959 |
+
var insert =
|
8960 |
+
delta.action === "insertText" || delta.action === "insertLines";
|
8961 |
+
return isUndo ? !insert : insert;
|
8962 |
+
}
|
8963 |
+
|
8964 |
+
var delta = deltas[0];
|
8965 |
+
var range, point;
|
8966 |
+
var lastDeltaIsInsert = false;
|
8967 |
+
if (isInsert(delta)) {
|
8968 |
+
range = Range.fromPoints(delta.range.start, delta.range.end);
|
8969 |
+
lastDeltaIsInsert = true;
|
8970 |
+
} else {
|
8971 |
+
range = Range.fromPoints(delta.range.start, delta.range.start);
|
8972 |
+
lastDeltaIsInsert = false;
|
8973 |
+
}
|
8974 |
+
|
8975 |
+
for (var i = 1; i < deltas.length; i++) {
|
8976 |
+
delta = deltas[i];
|
8977 |
+
if (isInsert(delta)) {
|
8978 |
+
point = delta.range.start;
|
8979 |
+
if (range.compare(point.row, point.column) == -1) {
|
8980 |
+
range.setStart(delta.range.start);
|
8981 |
+
}
|
8982 |
+
point = delta.range.end;
|
8983 |
+
if (range.compare(point.row, point.column) == 1) {
|
8984 |
+
range.setEnd(delta.range.end);
|
8985 |
+
}
|
8986 |
+
lastDeltaIsInsert = true;
|
8987 |
+
} else {
|
8988 |
+
point = delta.range.start;
|
8989 |
+
if (range.compare(point.row, point.column) == -1) {
|
8990 |
+
range =
|
8991 |
+
Range.fromPoints(delta.range.start, delta.range.start);
|
8992 |
+
}
|
8993 |
+
lastDeltaIsInsert = false;
|
8994 |
+
}
|
8995 |
+
}
|
8996 |
+
if (lastUndoRange != null) {
|
8997 |
+
if (Range.comparePoints(lastUndoRange.start, range.start) === 0) {
|
8998 |
+
lastUndoRange.start.column += range.end.column - range.start.column;
|
8999 |
+
lastUndoRange.end.column += range.end.column - range.start.column;
|
9000 |
+
}
|
9001 |
+
|
9002 |
+
var cmp = lastUndoRange.compareRange(range);
|
9003 |
+
if (cmp == 1) {
|
9004 |
+
range.setStart(lastUndoRange.start);
|
9005 |
+
} else if (cmp == -1) {
|
9006 |
+
range.setEnd(lastUndoRange.end);
|
9007 |
+
}
|
9008 |
+
}
|
9009 |
+
|
9010 |
+
return range;
|
9011 |
+
};
|
9012 |
+
this.replace = function(range, text) {
|
9013 |
+
return this.doc.replace(range, text);
|
9014 |
+
};
|
9015 |
+
this.moveText = function(fromRange, toPosition, copy) {
|
9016 |
+
var text = this.getTextRange(fromRange);
|
9017 |
+
var folds = this.getFoldsInRange(fromRange);
|
9018 |
+
|
9019 |
+
var toRange = Range.fromPoints(toPosition, toPosition);
|
9020 |
+
if (!copy) {
|
9021 |
+
this.remove(fromRange);
|
9022 |
+
var rowDiff = fromRange.start.row - fromRange.end.row;
|
9023 |
+
var collDiff = rowDiff ? -fromRange.end.column : fromRange.start.column - fromRange.end.column;
|
9024 |
+
if (collDiff) {
|
9025 |
+
if (toRange.start.row == fromRange.end.row && toRange.start.column > fromRange.end.column)
|
9026 |
+
toRange.start.column += collDiff;
|
9027 |
+
if (toRange.end.row == fromRange.end.row && toRange.end.column > fromRange.end.column)
|
9028 |
+
toRange.end.column += collDiff;
|
9029 |
+
}
|
9030 |
+
if (rowDiff && toRange.start.row >= fromRange.end.row) {
|
9031 |
+
toRange.start.row += rowDiff;
|
9032 |
+
toRange.end.row += rowDiff;
|
9033 |
+
}
|
9034 |
+
}
|
9035 |
+
|
9036 |
+
toRange.end = this.insert(toRange.start, text);
|
9037 |
+
if (folds.length) {
|
9038 |
+
var oldStart = fromRange.start;
|
9039 |
+
var newStart = toRange.start;
|
9040 |
+
var rowDiff = newStart.row - oldStart.row;
|
9041 |
+
var collDiff = newStart.column - oldStart.column;
|
9042 |
+
this.addFolds(folds.map(function(x) {
|
9043 |
+
x = x.clone();
|
9044 |
+
if (x.start.row == oldStart.row)
|
9045 |
+
x.start.column += collDiff;
|
9046 |
+
if (x.end.row == oldStart.row)
|
9047 |
+
x.end.column += collDiff;
|
9048 |
+
x.start.row += rowDiff;
|
9049 |
+
x.end.row += rowDiff;
|
9050 |
+
return x;
|
9051 |
+
}));
|
9052 |
+
}
|
9053 |
+
|
9054 |
+
return toRange;
|
9055 |
+
};
|
9056 |
+
this.indentRows = function(startRow, endRow, indentString) {
|
9057 |
+
indentString = indentString.replace(/\t/g, this.getTabString());
|
9058 |
+
for (var row = startRow; row <= endRow; row++)
|
9059 |
+
this.insert({
|
9060 |
+
row: row,
|
9061 |
+
column: 0
|
9062 |
+
}, indentString);
|
9063 |
+
};
|
9064 |
+
this.outdentRows = function(range) {
|
9065 |
+
var rowRange = range.collapseRows();
|
9066 |
+
var deleteRange = new Range(0, 0, 0, 0);
|
9067 |
+
var size = this.getTabSize();
|
9068 |
+
|
9069 |
+
for (var i = rowRange.start.row; i <= rowRange.end.row; ++i) {
|
9070 |
+
var line = this.getLine(i);
|
9071 |
+
|
9072 |
+
deleteRange.start.row = i;
|
9073 |
+
deleteRange.end.row = i;
|
9074 |
+
for (var j = 0; j < size; ++j)
|
9075 |
+
if (line.charAt(j) != ' ')
|
9076 |
+
break;
|
9077 |
+
if (j < size && line.charAt(j) == '\t') {
|
9078 |
+
deleteRange.start.column = j;
|
9079 |
+
deleteRange.end.column = j + 1;
|
9080 |
+
} else {
|
9081 |
+
deleteRange.start.column = 0;
|
9082 |
+
deleteRange.end.column = j;
|
9083 |
+
}
|
9084 |
+
this.remove(deleteRange);
|
9085 |
+
}
|
9086 |
+
};
|
9087 |
+
|
9088 |
+
this.$moveLines = function(firstRow, lastRow, dir) {
|
9089 |
+
firstRow = this.getRowFoldStart(firstRow);
|
9090 |
+
lastRow = this.getRowFoldEnd(lastRow);
|
9091 |
+
if (dir < 0) {
|
9092 |
+
var row = this.getRowFoldStart(firstRow + dir);
|
9093 |
+
if (row < 0) return 0;
|
9094 |
+
var diff = row - firstRow;
|
9095 |
+
} else if (dir > 0) {
|
9096 |
+
var row = this.getRowFoldEnd(lastRow + dir);
|
9097 |
+
if (row > this.doc.getLength() - 1) return 0;
|
9098 |
+
var diff = row - lastRow;
|
9099 |
+
} else {
|
9100 |
+
firstRow = this.$clipRowToDocument(firstRow);
|
9101 |
+
lastRow = this.$clipRowToDocument(lastRow);
|
9102 |
+
var diff = lastRow - firstRow + 1;
|
9103 |
+
}
|
9104 |
+
|
9105 |
+
var range = new Range(firstRow, 0, lastRow, Number.MAX_VALUE);
|
9106 |
+
var folds = this.getFoldsInRange(range).map(function(x) {
|
9107 |
+
x = x.clone();
|
9108 |
+
x.start.row += diff;
|
9109 |
+
x.end.row += diff;
|
9110 |
+
return x;
|
9111 |
+
});
|
9112 |
+
|
9113 |
+
var lines = dir == 0 ? this.doc.getLines(firstRow, lastRow) : this.doc.removeLines(firstRow, lastRow);
|
9114 |
+
this.doc.insertLines(firstRow + diff, lines);
|
9115 |
+
folds.length && this.addFolds(folds);
|
9116 |
+
return diff;
|
9117 |
+
};
|
9118 |
+
this.moveLinesUp = function(firstRow, lastRow) {
|
9119 |
+
return this.$moveLines(firstRow, lastRow, -1);
|
9120 |
+
};
|
9121 |
+
this.moveLinesDown = function(firstRow, lastRow) {
|
9122 |
+
return this.$moveLines(firstRow, lastRow, 1);
|
9123 |
+
};
|
9124 |
+
this.duplicateLines = function(firstRow, lastRow) {
|
9125 |
+
return this.$moveLines(firstRow, lastRow, 0);
|
9126 |
+
};
|
9127 |
+
|
9128 |
+
|
9129 |
+
this.$clipRowToDocument = function(row) {
|
9130 |
+
return Math.max(0, Math.min(row, this.doc.getLength() - 1));
|
9131 |
+
};
|
9132 |
+
|
9133 |
+
this.$clipColumnToRow = function(row, column) {
|
9134 |
+
if (column < 0)
|
9135 |
+
return 0;
|
9136 |
+
return Math.min(this.doc.getLine(row).length, column);
|
9137 |
+
};
|
9138 |
+
|
9139 |
+
|
9140 |
+
this.$clipPositionToDocument = function(row, column) {
|
9141 |
+
column = Math.max(0, column);
|
9142 |
+
|
9143 |
+
if (row < 0) {
|
9144 |
+
row = 0;
|
9145 |
+
column = 0;
|
9146 |
+
} else {
|
9147 |
+
var len = this.doc.getLength();
|
9148 |
+
if (row >= len) {
|
9149 |
+
row = len - 1;
|
9150 |
+
column = this.doc.getLine(len - 1).length;
|
9151 |
+
} else {
|
9152 |
+
column = Math.min(this.doc.getLine(row).length, column);
|
9153 |
+
}
|
9154 |
+
}
|
9155 |
+
|
9156 |
+
return {
|
9157 |
+
row: row,
|
9158 |
+
column: column
|
9159 |
+
};
|
9160 |
+
};
|
9161 |
+
|
9162 |
+
this.$clipRangeToDocument = function(range) {
|
9163 |
+
if (range.start.row < 0) {
|
9164 |
+
range.start.row = 0;
|
9165 |
+
range.start.column = 0;
|
9166 |
+
} else {
|
9167 |
+
range.start.column = this.$clipColumnToRow(
|
9168 |
+
range.start.row,
|
9169 |
+
range.start.column
|
9170 |
+
);
|
9171 |
+
}
|
9172 |
+
|
9173 |
+
var len = this.doc.getLength() - 1;
|
9174 |
+
if (range.end.row > len) {
|
9175 |
+
range.end.row = len;
|
9176 |
+
range.end.column = this.doc.getLine(len).length;
|
9177 |
+
} else {
|
9178 |
+
range.end.column = this.$clipColumnToRow(
|
9179 |
+
range.end.row,
|
9180 |
+
range.end.column
|
9181 |
+
);
|
9182 |
+
}
|
9183 |
+
return range;
|
9184 |
+
};
|
9185 |
+
this.$wrapLimit = 80;
|
9186 |
+
this.$useWrapMode = false;
|
9187 |
+
this.$wrapLimitRange = {
|
9188 |
+
min: null,
|
9189 |
+
max: null
|
9190 |
+
};
|
9191 |
+
this.setUseWrapMode = function(useWrapMode) {
|
9192 |
+
if (useWrapMode != this.$useWrapMode) {
|
9193 |
+
this.$useWrapMode = useWrapMode;
|
9194 |
+
this.$modified = true;
|
9195 |
+
this.$resetRowCache(0);
|
9196 |
+
if (useWrapMode) {
|
9197 |
+
var len = this.getLength();
|
9198 |
+
this.$wrapData = Array(len);
|
9199 |
+
this.$updateWrapData(0, len - 1);
|
9200 |
+
}
|
9201 |
+
|
9202 |
+
this._signal("changeWrapMode");
|
9203 |
+
}
|
9204 |
+
};
|
9205 |
+
this.getUseWrapMode = function() {
|
9206 |
+
return this.$useWrapMode;
|
9207 |
+
};
|
9208 |
+
this.setWrapLimitRange = function(min, max) {
|
9209 |
+
if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {
|
9210 |
+
this.$wrapLimitRange = {
|
9211 |
+
min: min,
|
9212 |
+
max: max
|
9213 |
+
};
|
9214 |
+
this.$modified = true;
|
9215 |
+
this._signal("changeWrapMode");
|
9216 |
+
}
|
9217 |
+
};
|
9218 |
+
this.adjustWrapLimit = function(desiredLimit, $printMargin) {
|
9219 |
+
var limits = this.$wrapLimitRange;
|
9220 |
+
if (limits.max < 0)
|
9221 |
+
limits = {
|
9222 |
+
min: $printMargin,
|
9223 |
+
max: $printMargin
|
9224 |
+
};
|
9225 |
+
var wrapLimit = this.$constrainWrapLimit(desiredLimit, limits.min, limits.max);
|
9226 |
+
if (wrapLimit != this.$wrapLimit && wrapLimit > 1) {
|
9227 |
+
this.$wrapLimit = wrapLimit;
|
9228 |
+
this.$modified = true;
|
9229 |
+
if (this.$useWrapMode) {
|
9230 |
+
this.$updateWrapData(0, this.getLength() - 1);
|
9231 |
+
this.$resetRowCache(0);
|
9232 |
+
this._signal("changeWrapLimit");
|
9233 |
+
}
|
9234 |
+
return true;
|
9235 |
+
}
|
9236 |
+
return false;
|
9237 |
+
};
|
9238 |
+
|
9239 |
+
this.$constrainWrapLimit = function(wrapLimit, min, max) {
|
9240 |
+
if (min)
|
9241 |
+
wrapLimit = Math.max(min, wrapLimit);
|
9242 |
+
|
9243 |
+
if (max)
|
9244 |
+
wrapLimit = Math.min(max, wrapLimit);
|
9245 |
+
|
9246 |
+
return wrapLimit;
|
9247 |
+
};
|
9248 |
+
this.getWrapLimit = function() {
|
9249 |
+
return this.$wrapLimit;
|
9250 |
+
};
|
9251 |
+
this.setWrapLimit = function(limit) {
|
9252 |
+
this.setWrapLimitRange(limit, limit);
|
9253 |
+
};
|
9254 |
+
this.getWrapLimitRange = function() {
|
9255 |
+
return {
|
9256 |
+
min: this.$wrapLimitRange.min,
|
9257 |
+
max: this.$wrapLimitRange.max
|
9258 |
+
};
|
9259 |
+
};
|
9260 |
+
|
9261 |
+
this.$updateInternalDataOnChange = function(e) {
|
9262 |
+
var useWrapMode = this.$useWrapMode;
|
9263 |
+
var len;
|
9264 |
+
var action = e.data.action;
|
9265 |
+
var firstRow = e.data.range.start.row;
|
9266 |
+
var lastRow = e.data.range.end.row;
|
9267 |
+
var start = e.data.range.start;
|
9268 |
+
var end = e.data.range.end;
|
9269 |
+
var removedFolds = null;
|
9270 |
+
|
9271 |
+
if (action.indexOf("Lines") != -1) {
|
9272 |
+
if (action == "insertLines") {
|
9273 |
+
lastRow = firstRow + (e.data.lines.length);
|
9274 |
+
} else {
|
9275 |
+
lastRow = firstRow;
|
9276 |
+
}
|
9277 |
+
len = e.data.lines ? e.data.lines.length : lastRow - firstRow;
|
9278 |
+
} else {
|
9279 |
+
len = lastRow - firstRow;
|
9280 |
+
}
|
9281 |
+
|
9282 |
+
this.$updating = true;
|
9283 |
+
if (len != 0) {
|
9284 |
+
if (action.indexOf("remove") != -1) {
|
9285 |
+
this[useWrapMode ? "$wrapData" : "$rowLengthCache"].splice(firstRow, len);
|
9286 |
+
|
9287 |
+
var foldLines = this.$foldData;
|
9288 |
+
removedFolds = this.getFoldsInRange(e.data.range);
|
9289 |
+
this.removeFolds(removedFolds);
|
9290 |
+
|
9291 |
+
var foldLine = this.getFoldLine(end.row);
|
9292 |
+
var idx = 0;
|
9293 |
+
if (foldLine) {
|
9294 |
+
foldLine.addRemoveChars(end.row, end.column, start.column - end.column);
|
9295 |
+
foldLine.shiftRow(-len);
|
9296 |
+
|
9297 |
+
var foldLineBefore = this.getFoldLine(firstRow);
|
9298 |
+
if (foldLineBefore && foldLineBefore !== foldLine) {
|
9299 |
+
foldLineBefore.merge(foldLine);
|
9300 |
+
foldLine = foldLineBefore;
|
9301 |
+
}
|
9302 |
+
idx = foldLines.indexOf(foldLine) + 1;
|
9303 |
+
}
|
9304 |
+
|
9305 |
+
for (idx; idx < foldLines.length; idx++) {
|
9306 |
+
var foldLine = foldLines[idx];
|
9307 |
+
if (foldLine.start.row >= end.row) {
|
9308 |
+
foldLine.shiftRow(-len);
|
9309 |
+
}
|
9310 |
+
}
|
9311 |
+
|
9312 |
+
lastRow = firstRow;
|
9313 |
+
} else {
|
9314 |
+
var args = Array(len);
|
9315 |
+
args.unshift(firstRow, 0);
|
9316 |
+
var arr = useWrapMode ? this.$wrapData : this.$rowLengthCache
|
9317 |
+
arr.splice.apply(arr, args);
|
9318 |
+
var foldLines = this.$foldData;
|
9319 |
+
var foldLine = this.getFoldLine(firstRow);
|
9320 |
+
var idx = 0;
|
9321 |
+
if (foldLine) {
|
9322 |
+
var cmp = foldLine.range.compareInside(start.row, start.column);
|
9323 |
+
if (cmp == 0) {
|
9324 |
+
foldLine = foldLine.split(start.row, start.column);
|
9325 |
+
if (foldLine) {
|
9326 |
+
foldLine.shiftRow(len);
|
9327 |
+
foldLine.addRemoveChars(lastRow, 0, end.column - start.column);
|
9328 |
+
}
|
9329 |
+
} else
|
9330 |
+
if (cmp == -1) {
|
9331 |
+
foldLine.addRemoveChars(firstRow, 0, end.column - start.column);
|
9332 |
+
foldLine.shiftRow(len);
|
9333 |
+
}
|
9334 |
+
idx = foldLines.indexOf(foldLine) + 1;
|
9335 |
+
}
|
9336 |
+
|
9337 |
+
for (idx; idx < foldLines.length; idx++) {
|
9338 |
+
var foldLine = foldLines[idx];
|
9339 |
+
if (foldLine.start.row >= firstRow) {
|
9340 |
+
foldLine.shiftRow(len);
|
9341 |
+
}
|
9342 |
+
}
|
9343 |
+
}
|
9344 |
+
} else {
|
9345 |
+
len = Math.abs(e.data.range.start.column - e.data.range.end.column);
|
9346 |
+
if (action.indexOf("remove") != -1) {
|
9347 |
+
removedFolds = this.getFoldsInRange(e.data.range);
|
9348 |
+
this.removeFolds(removedFolds);
|
9349 |
+
|
9350 |
+
len = -len;
|
9351 |
+
}
|
9352 |
+
var foldLine = this.getFoldLine(firstRow);
|
9353 |
+
if (foldLine) {
|
9354 |
+
foldLine.addRemoveChars(firstRow, start.column, len);
|
9355 |
+
}
|
9356 |
+
}
|
9357 |
+
|
9358 |
+
if (useWrapMode && this.$wrapData.length != this.doc.getLength()) {
|
9359 |
+
console.error("doc.getLength() and $wrapData.length have to be the same!");
|
9360 |
+
}
|
9361 |
+
this.$updating = false;
|
9362 |
+
|
9363 |
+
if (useWrapMode)
|
9364 |
+
this.$updateWrapData(firstRow, lastRow);
|
9365 |
+
else
|
9366 |
+
this.$updateRowLengthCache(firstRow, lastRow);
|
9367 |
+
|
9368 |
+
return removedFolds;
|
9369 |
+
};
|
9370 |
+
|
9371 |
+
this.$updateRowLengthCache = function(firstRow, lastRow, b) {
|
9372 |
+
this.$rowLengthCache[firstRow] = null;
|
9373 |
+
this.$rowLengthCache[lastRow] = null;
|
9374 |
+
};
|
9375 |
+
|
9376 |
+
this.$updateWrapData = function(firstRow, lastRow) {
|
9377 |
+
var lines = this.doc.getAllLines();
|
9378 |
+
var tabSize = this.getTabSize();
|
9379 |
+
var wrapData = this.$wrapData;
|
9380 |
+
var wrapLimit = this.$wrapLimit;
|
9381 |
+
var tokens;
|
9382 |
+
var foldLine;
|
9383 |
+
|
9384 |
+
var row = firstRow;
|
9385 |
+
lastRow = Math.min(lastRow, lines.length - 1);
|
9386 |
+
while (row <= lastRow) {
|
9387 |
+
foldLine = this.getFoldLine(row, foldLine);
|
9388 |
+
if (!foldLine) {
|
9389 |
+
tokens = this.$getDisplayTokens(lines[row]);
|
9390 |
+
wrapData[row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize);
|
9391 |
+
row++;
|
9392 |
+
} else {
|
9393 |
+
tokens = [];
|
9394 |
+
foldLine.walk(function(placeholder, row, column, lastColumn) {
|
9395 |
+
var walkTokens;
|
9396 |
+
if (placeholder != null) {
|
9397 |
+
walkTokens = this.$getDisplayTokens(
|
9398 |
+
placeholder, tokens.length);
|
9399 |
+
walkTokens[0] = PLACEHOLDER_START;
|
9400 |
+
for (var i = 1; i < walkTokens.length; i++) {
|
9401 |
+
walkTokens[i] = PLACEHOLDER_BODY;
|
9402 |
+
}
|
9403 |
+
} else {
|
9404 |
+
walkTokens = this.$getDisplayTokens(
|
9405 |
+
lines[row].substring(lastColumn, column),
|
9406 |
+
tokens.length);
|
9407 |
+
}
|
9408 |
+
tokens = tokens.concat(walkTokens);
|
9409 |
+
}.bind(this),
|
9410 |
+
foldLine.end.row,
|
9411 |
+
lines[foldLine.end.row].length + 1
|
9412 |
+
);
|
9413 |
+
|
9414 |
+
wrapData[foldLine.start.row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize);
|
9415 |
+
row = foldLine.end.row + 1;
|
9416 |
+
}
|
9417 |
+
}
|
9418 |
+
};
|
9419 |
+
var CHAR = 1,
|
9420 |
+
CHAR_EXT = 2,
|
9421 |
+
PLACEHOLDER_START = 3,
|
9422 |
+
PLACEHOLDER_BODY = 4,
|
9423 |
+
PUNCTUATION = 9,
|
9424 |
+
SPACE = 10,
|
9425 |
+
TAB = 11,
|
9426 |
+
TAB_SPACE = 12;
|
9427 |
+
|
9428 |
+
|
9429 |
+
this.$computeWrapSplits = function(tokens, wrapLimit) {
|
9430 |
+
if (tokens.length == 0) {
|
9431 |
+
return [];
|
9432 |
+
}
|
9433 |
+
|
9434 |
+
var splits = [];
|
9435 |
+
var displayLength = tokens.length;
|
9436 |
+
var lastSplit = 0,
|
9437 |
+
lastDocSplit = 0;
|
9438 |
+
|
9439 |
+
var isCode = this.$wrapAsCode;
|
9440 |
+
|
9441 |
+
function addSplit(screenPos) {
|
9442 |
+
var displayed = tokens.slice(lastSplit, screenPos);
|
9443 |
+
var len = displayed.length;
|
9444 |
+
displayed.join("").
|
9445 |
+
replace(/12/g, function() {
|
9446 |
+
len -= 1;
|
9447 |
+
}).
|
9448 |
+
replace(/2/g, function() {
|
9449 |
+
len -= 1;
|
9450 |
+
});
|
9451 |
+
|
9452 |
+
lastDocSplit += len;
|
9453 |
+
splits.push(lastDocSplit);
|
9454 |
+
lastSplit = screenPos;
|
9455 |
+
}
|
9456 |
+
|
9457 |
+
while (displayLength - lastSplit > wrapLimit) {
|
9458 |
+
var split = lastSplit + wrapLimit;
|
9459 |
+
if (tokens[split - 1] >= SPACE && tokens[split] >= SPACE) {
|
9460 |
+
addSplit(split);
|
9461 |
+
continue;
|
9462 |
+
}
|
9463 |
+
if (tokens[split] == PLACEHOLDER_START || tokens[split] == PLACEHOLDER_BODY) {
|
9464 |
+
for (split; split != lastSplit - 1; split--) {
|
9465 |
+
if (tokens[split] == PLACEHOLDER_START) {
|
9466 |
+
break;
|
9467 |
+
}
|
9468 |
+
}
|
9469 |
+
if (split > lastSplit) {
|
9470 |
+
addSplit(split);
|
9471 |
+
continue;
|
9472 |
+
}
|
9473 |
+
split = lastSplit + wrapLimit;
|
9474 |
+
for (split; split < tokens.length; split++) {
|
9475 |
+
if (tokens[split] != PLACEHOLDER_BODY) {
|
9476 |
+
break;
|
9477 |
+
}
|
9478 |
+
}
|
9479 |
+
if (split == tokens.length) {
|
9480 |
+
break; // Breaks the while-loop.
|
9481 |
+
}
|
9482 |
+
addSplit(split);
|
9483 |
+
continue;
|
9484 |
+
}
|
9485 |
+
var minSplit = Math.max(split - (isCode ? 10 : wrapLimit - (wrapLimit >> 2)), lastSplit - 1);
|
9486 |
+
while (split > minSplit && tokens[split] < PLACEHOLDER_START) {
|
9487 |
+
split--;
|
9488 |
+
}
|
9489 |
+
if (isCode) {
|
9490 |
+
while (split > minSplit && tokens[split] < PLACEHOLDER_START) {
|
9491 |
+
split--;
|
9492 |
+
}
|
9493 |
+
while (split > minSplit && tokens[split] == PUNCTUATION) {
|
9494 |
+
split--;
|
9495 |
+
}
|
9496 |
+
} else {
|
9497 |
+
while (split > minSplit && tokens[split] < SPACE) {
|
9498 |
+
split--;
|
9499 |
+
}
|
9500 |
+
}
|
9501 |
+
if (split > minSplit) {
|
9502 |
+
addSplit(++split);
|
9503 |
+
continue;
|
9504 |
+
}
|
9505 |
+
split = lastSplit + wrapLimit;
|
9506 |
+
if (tokens[split] == CHAR_EXT)
|
9507 |
+
split--;
|
9508 |
+
addSplit(split);
|
9509 |
+
}
|
9510 |
+
return splits;
|
9511 |
+
};
|
9512 |
+
this.$getDisplayTokens = function(str, offset) {
|
9513 |
+
var arr = [];
|
9514 |
+
var tabSize;
|
9515 |
+
offset = offset || 0;
|
9516 |
+
|
9517 |
+
for (var i = 0; i < str.length; i++) {
|
9518 |
+
var c = str.charCodeAt(i);
|
9519 |
+
if (c == 9) {
|
9520 |
+
tabSize = this.getScreenTabSize(arr.length + offset);
|
9521 |
+
arr.push(TAB);
|
9522 |
+
for (var n = 1; n < tabSize; n++) {
|
9523 |
+
arr.push(TAB_SPACE);
|
9524 |
+
}
|
9525 |
+
} else if (c == 32) {
|
9526 |
+
arr.push(SPACE);
|
9527 |
+
} else if ((c > 39 && c < 48) || (c > 57 && c < 64)) {
|
9528 |
+
arr.push(PUNCTUATION);
|
9529 |
+
} else if (c >= 0x1100 && isFullWidth(c)) {
|
9530 |
+
arr.push(CHAR, CHAR_EXT);
|
9531 |
+
} else {
|
9532 |
+
arr.push(CHAR);
|
9533 |
+
}
|
9534 |
+
}
|
9535 |
+
return arr;
|
9536 |
+
};
|
9537 |
+
this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
|
9538 |
+
if (maxScreenColumn == 0)
|
9539 |
+
return [0, 0];
|
9540 |
+
if (maxScreenColumn == null)
|
9541 |
+
maxScreenColumn = Infinity;
|
9542 |
+
screenColumn = screenColumn || 0;
|
9543 |
+
|
9544 |
+
var c, column;
|
9545 |
+
for (column = 0; column < str.length; column++) {
|
9546 |
+
c = str.charCodeAt(column);
|
9547 |
+
if (c == 9) {
|
9548 |
+
screenColumn += this.getScreenTabSize(screenColumn);
|
9549 |
+
} else if (c >= 0x1100 && isFullWidth(c)) {
|
9550 |
+
screenColumn += 2;
|
9551 |
+
} else {
|
9552 |
+
screenColumn += 1;
|
9553 |
+
}
|
9554 |
+
if (screenColumn > maxScreenColumn) {
|
9555 |
+
break;
|
9556 |
+
}
|
9557 |
+
}
|
9558 |
+
|
9559 |
+
return [screenColumn, column];
|
9560 |
+
};
|
9561 |
+
|
9562 |
+
this.lineWidgets = null;
|
9563 |
+
this.getRowLength = function(row) {
|
9564 |
+
if (this.lineWidgets)
|
9565 |
+
var h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
|
9566 |
+
else
|
9567 |
+
h = 0
|
9568 |
+
if (!this.$useWrapMode || !this.$wrapData[row]) {
|
9569 |
+
return 1 + h;
|
9570 |
+
} else {
|
9571 |
+
return this.$wrapData[row].length + 1 + h;
|
9572 |
+
}
|
9573 |
+
};
|
9574 |
+
this.getRowLineCount = function(row) {
|
9575 |
+
if (!this.$useWrapMode || !this.$wrapData[row]) {
|
9576 |
+
return 1;
|
9577 |
+
} else {
|
9578 |
+
return this.$wrapData[row].length + 1;
|
9579 |
+
}
|
9580 |
+
};
|
9581 |
+
this.getScreenLastRowColumn = function(screenRow) {
|
9582 |
+
var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE);
|
9583 |
+
return this.documentToScreenColumn(pos.row, pos.column);
|
9584 |
+
};
|
9585 |
+
this.getDocumentLastRowColumn = function(docRow, docColumn) {
|
9586 |
+
var screenRow = this.documentToScreenRow(docRow, docColumn);
|
9587 |
+
return this.getScreenLastRowColumn(screenRow);
|
9588 |
+
};
|
9589 |
+
this.getDocumentLastRowColumnPosition = function(docRow, docColumn) {
|
9590 |
+
var screenRow = this.documentToScreenRow(docRow, docColumn);
|
9591 |
+
return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10);
|
9592 |
+
};
|
9593 |
+
this.getRowSplitData = function(row) {
|
9594 |
+
if (!this.$useWrapMode) {
|
9595 |
+
return undefined;
|
9596 |
+
} else {
|
9597 |
+
return this.$wrapData[row];
|
9598 |
+
}
|
9599 |
+
};
|
9600 |
+
this.getScreenTabSize = function(screenColumn) {
|
9601 |
+
return this.$tabSize - screenColumn % this.$tabSize;
|
9602 |
+
};
|
9603 |
+
|
9604 |
+
|
9605 |
+
this.screenToDocumentRow = function(screenRow, screenColumn) {
|
9606 |
+
return this.screenToDocumentPosition(screenRow, screenColumn).row;
|
9607 |
+
};
|
9608 |
+
|
9609 |
+
|
9610 |
+
this.screenToDocumentColumn = function(screenRow, screenColumn) {
|
9611 |
+
return this.screenToDocumentPosition(screenRow, screenColumn).column;
|
9612 |
+
};
|
9613 |
+
this.screenToDocumentPosition = function(screenRow, screenColumn) {
|
9614 |
+
if (screenRow < 0)
|
9615 |
+
return {
|
9616 |
+
row: 0,
|
9617 |
+
column: 0
|
9618 |
+
};
|
9619 |
+
|
9620 |
+
var line;
|
9621 |
+
var docRow = 0;
|
9622 |
+
var docColumn = 0;
|
9623 |
+
var column;
|
9624 |
+
var row = 0;
|
9625 |
+
var rowLength = 0;
|
9626 |
+
|
9627 |
+
var rowCache = this.$screenRowCache;
|
9628 |
+
var i = this.$getRowCacheIndex(rowCache, screenRow);
|
9629 |
+
var l = rowCache.length;
|
9630 |
+
if (l && i >= 0) {
|
9631 |
+
var row = rowCache[i];
|
9632 |
+
var docRow = this.$docRowCache[i];
|
9633 |
+
var doCache = screenRow > rowCache[l - 1];
|
9634 |
+
} else {
|
9635 |
+
var doCache = !l;
|
9636 |
+
}
|
9637 |
+
|
9638 |
+
var maxRow = this.getLength() - 1;
|
9639 |
+
var foldLine = this.getNextFoldLine(docRow);
|
9640 |
+
var foldStart = foldLine ? foldLine.start.row : Infinity;
|
9641 |
+
|
9642 |
+
while (row <= screenRow) {
|
9643 |
+
rowLength = this.getRowLength(docRow);
|
9644 |
+
if (row + rowLength > screenRow || docRow >= maxRow) {
|
9645 |
+
break;
|
9646 |
+
} else {
|
9647 |
+
row += rowLength;
|
9648 |
+
docRow++;
|
9649 |
+
if (docRow > foldStart) {
|
9650 |
+
docRow = foldLine.end.row + 1;
|
9651 |
+
foldLine = this.getNextFoldLine(docRow, foldLine);
|
9652 |
+
foldStart = foldLine ? foldLine.start.row : Infinity;
|
9653 |
+
}
|
9654 |
+
}
|
9655 |
+
|
9656 |
+
if (doCache) {
|
9657 |
+
this.$docRowCache.push(docRow);
|
9658 |
+
this.$screenRowCache.push(row);
|
9659 |
+
}
|
9660 |
+
}
|
9661 |
+
|
9662 |
+
if (foldLine && foldLine.start.row <= docRow) {
|
9663 |
+
line = this.getFoldDisplayLine(foldLine);
|
9664 |
+
docRow = foldLine.start.row;
|
9665 |
+
} else if (row + rowLength <= screenRow || docRow > maxRow) {
|
9666 |
+
return {
|
9667 |
+
row: maxRow,
|
9668 |
+
column: this.getLine(maxRow).length
|
9669 |
+
};
|
9670 |
+
} else {
|
9671 |
+
line = this.getLine(docRow);
|
9672 |
+
foldLine = null;
|
9673 |
+
}
|
9674 |
+
|
9675 |
+
if (this.$useWrapMode) {
|
9676 |
+
var splits = this.$wrapData[docRow];
|
9677 |
+
if (splits) {
|
9678 |
+
var splitIndex = Math.floor(screenRow - row);
|
9679 |
+
column = splits[splitIndex];
|
9680 |
+
if (splitIndex > 0 && splits.length) {
|
9681 |
+
docColumn = splits[splitIndex - 1] || splits[splits.length - 1];
|
9682 |
+
line = line.substring(docColumn);
|
9683 |
+
}
|
9684 |
+
}
|
9685 |
+
}
|
9686 |
+
|
9687 |
+
docColumn += this.$getStringScreenWidth(line, screenColumn)[1];
|
9688 |
+
if (this.$useWrapMode && docColumn >= column)
|
9689 |
+
docColumn = column - 1;
|
9690 |
+
|
9691 |
+
if (foldLine)
|
9692 |
+
return foldLine.idxToPosition(docColumn);
|
9693 |
+
|
9694 |
+
return {
|
9695 |
+
row: docRow,
|
9696 |
+
column: docColumn
|
9697 |
+
};
|
9698 |
+
};
|
9699 |
+
this.documentToScreenPosition = function(docRow, docColumn) {
|
9700 |
+
if (typeof docColumn === "undefined")
|
9701 |
+
var pos = this.$clipPositionToDocument(docRow.row, docRow.column);
|
9702 |
+
else
|
9703 |
+
pos = this.$clipPositionToDocument(docRow, docColumn);
|
9704 |
+
|
9705 |
+
docRow = pos.row;
|
9706 |
+
docColumn = pos.column;
|
9707 |
+
|
9708 |
+
var screenRow = 0;
|
9709 |
+
var foldStartRow = null;
|
9710 |
+
var fold = null;
|
9711 |
+
fold = this.getFoldAt(docRow, docColumn, 1);
|
9712 |
+
if (fold) {
|
9713 |
+
docRow = fold.start.row;
|
9714 |
+
docColumn = fold.start.column;
|
9715 |
+
}
|
9716 |
+
|
9717 |
+
var rowEnd, row = 0;
|
9718 |
+
|
9719 |
+
|
9720 |
+
var rowCache = this.$docRowCache;
|
9721 |
+
var i = this.$getRowCacheIndex(rowCache, docRow);
|
9722 |
+
var l = rowCache.length;
|
9723 |
+
if (l && i >= 0) {
|
9724 |
+
var row = rowCache[i];
|
9725 |
+
var screenRow = this.$screenRowCache[i];
|
9726 |
+
var doCache = docRow > rowCache[l - 1];
|
9727 |
+
} else {
|
9728 |
+
var doCache = !l;
|
9729 |
+
}
|
9730 |
+
|
9731 |
+
var foldLine = this.getNextFoldLine(row);
|
9732 |
+
var foldStart = foldLine ? foldLine.start.row : Infinity;
|
9733 |
+
|
9734 |
+
while (row < docRow) {
|
9735 |
+
if (row >= foldStart) {
|
9736 |
+
rowEnd = foldLine.end.row + 1;
|
9737 |
+
if (rowEnd > docRow)
|
9738 |
+
break;
|
9739 |
+
foldLine = this.getNextFoldLine(rowEnd, foldLine);
|
9740 |
+
foldStart = foldLine ? foldLine.start.row : Infinity;
|
9741 |
+
} else {
|
9742 |
+
rowEnd = row + 1;
|
9743 |
+
}
|
9744 |
+
|
9745 |
+
screenRow += this.getRowLength(row);
|
9746 |
+
row = rowEnd;
|
9747 |
+
|
9748 |
+
if (doCache) {
|
9749 |
+
this.$docRowCache.push(row);
|
9750 |
+
this.$screenRowCache.push(screenRow);
|
9751 |
+
}
|
9752 |
+
}
|
9753 |
+
var textLine = "";
|
9754 |
+
if (foldLine && row >= foldStart) {
|
9755 |
+
textLine = this.getFoldDisplayLine(foldLine, docRow, docColumn);
|
9756 |
+
foldStartRow = foldLine.start.row;
|
9757 |
+
} else {
|
9758 |
+
textLine = this.getLine(docRow).substring(0, docColumn);
|
9759 |
+
foldStartRow = docRow;
|
9760 |
+
}
|
9761 |
+
if (this.$useWrapMode) {
|
9762 |
+
var wrapRow = this.$wrapData[foldStartRow];
|
9763 |
+
if (wrapRow) {
|
9764 |
+
var screenRowOffset = 0;
|
9765 |
+
while (textLine.length >= wrapRow[screenRowOffset]) {
|
9766 |
+
screenRow++;
|
9767 |
+
screenRowOffset++;
|
9768 |
+
}
|
9769 |
+
textLine = textLine.substring(
|
9770 |
+
wrapRow[screenRowOffset - 1] || 0, textLine.length
|
9771 |
+
);
|
9772 |
+
}
|
9773 |
+
}
|
9774 |
+
|
9775 |
+
return {
|
9776 |
+
row: screenRow,
|
9777 |
+
column: this.$getStringScreenWidth(textLine)[0]
|
9778 |
+
};
|
9779 |
+
};
|
9780 |
+
this.documentToScreenColumn = function(row, docColumn) {
|
9781 |
+
return this.documentToScreenPosition(row, docColumn).column;
|
9782 |
+
};
|
9783 |
+
this.documentToScreenRow = function(docRow, docColumn) {
|
9784 |
+
return this.documentToScreenPosition(docRow, docColumn).row;
|
9785 |
+
};
|
9786 |
+
this.getScreenLength = function() {
|
9787 |
+
var screenRows = 0;
|
9788 |
+
var fold = null;
|
9789 |
+
if (!this.$useWrapMode) {
|
9790 |
+
screenRows = this.getLength();
|
9791 |
+
var foldData = this.$foldData;
|
9792 |
+
for (var i = 0; i < foldData.length; i++) {
|
9793 |
+
fold = foldData[i];
|
9794 |
+
screenRows -= fold.end.row - fold.start.row;
|
9795 |
+
}
|
9796 |
+
} else {
|
9797 |
+
var lastRow = this.$wrapData.length;
|
9798 |
+
var row = 0,
|
9799 |
+
i = 0;
|
9800 |
+
var fold = this.$foldData[i++];
|
9801 |
+
var foldStart = fold ? fold.start.row : Infinity;
|
9802 |
+
|
9803 |
+
while (row < lastRow) {
|
9804 |
+
var splits = this.$wrapData[row];
|
9805 |
+
screenRows += splits ? splits.length + 1 : 1;
|
9806 |
+
row++;
|
9807 |
+
if (row > foldStart) {
|
9808 |
+
row = fold.end.row + 1;
|
9809 |
+
fold = this.$foldData[i++];
|
9810 |
+
foldStart = fold ? fold.start.row : Infinity;
|
9811 |
+
}
|
9812 |
+
}
|
9813 |
+
}
|
9814 |
+
if (this.lineWidgets)
|
9815 |
+
screenRows += this.$getWidgetScreenLength();
|
9816 |
+
|
9817 |
+
return screenRows;
|
9818 |
+
};
|
9819 |
+
this.$setFontMetrics = function(fm) {};
|
9820 |
+
|
9821 |
+
this.destroy = function() {
|
9822 |
+
if (this.bgTokenizer) {
|
9823 |
+
this.bgTokenizer.setDocument(null);
|
9824 |
+
this.bgTokenizer = null;
|
9825 |
+
}
|
9826 |
+
this.$stopWorker();
|
9827 |
+
};
|
9828 |
+
|
9829 |
+
function isFullWidth(c) {
|
9830 |
+
if (c < 0x1100)
|
9831 |
+
return false;
|
9832 |
+
return c >= 0x1100 && c <= 0x115F ||
|
9833 |
+
c >= 0x11A3 && c <= 0x11A7 ||
|
9834 |
+
c >= 0x11FA && c <= 0x11FF ||
|
9835 |
+
c >= 0x2329 && c <= 0x232A ||
|
9836 |
+
c >= 0x2E80 && c <= 0x2E99 ||
|
9837 |
+
c >= 0x2E9B && c <= 0x2EF3 ||
|
9838 |
+
c >= 0x2F00 && c <= 0x2FD5 ||
|
9839 |
+
c >= 0x2FF0 && c <= 0x2FFB ||
|
9840 |
+
c >= 0x3000 && c <= 0x303E ||
|
9841 |
+
c >= 0x3041 && c <= 0x3096 ||
|
9842 |
+
c >= 0x3099 && c <= 0x30FF ||
|
9843 |
+
c >= 0x3105 && c <= 0x312D ||
|
9844 |
+
c >= 0x3131 && c <= 0x318E ||
|
9845 |
+
c >= 0x3190 && c <= 0x31BA ||
|
9846 |
+
c >= 0x31C0 && c <= 0x31E3 ||
|
9847 |
+
c >= 0x31F0 && c <= 0x321E ||
|
9848 |
+
c >= 0x3220 && c <= 0x3247 ||
|
9849 |
+
c >= 0x3250 && c <= 0x32FE ||
|
9850 |
+
c >= 0x3300 && c <= 0x4DBF ||
|
9851 |
+
c >= 0x4E00 && c <= 0xA48C ||
|
9852 |
+
c >= 0xA490 && c <= 0xA4C6 ||
|
9853 |
+
c >= 0xA960 && c <= 0xA97C ||
|
9854 |
+
c >= 0xAC00 && c <= 0xD7A3 ||
|
9855 |
+
c >= 0xD7B0 && c <= 0xD7C6 ||
|
9856 |
+
c >= 0xD7CB && c <= 0xD7FB ||
|
9857 |
+
c >= 0xF900 && c <= 0xFAFF ||
|
9858 |
+
c >= 0xFE10 && c <= 0xFE19 ||
|
9859 |
+
c >= 0xFE30 && c <= 0xFE52 ||
|
9860 |
+
c >= 0xFE54 && c <= 0xFE66 ||
|
9861 |
+
c >= 0xFE68 && c <= 0xFE6B ||
|
9862 |
+
c >= 0xFF01 && c <= 0xFF60 ||
|
9863 |
+
c >= 0xFFE0 && c <= 0xFFE6;
|
9864 |
+
};
|
9865 |
+
|
9866 |
+
}).call(EditSession.prototype);
|
9867 |
+
|
9868 |
+
require("./edit_session/folding").Folding.call(EditSession.prototype);
|
9869 |
+
require("./edit_session/bracket_match").BracketMatch.call(EditSession.prototype);
|
9870 |
+
|
9871 |
+
|
9872 |
+
config.defineOptions(EditSession.prototype, "session", {
|
9873 |
+
wrap: {
|
9874 |
+
set: function(value) {
|
9875 |
+
if (!value || value == "off")
|
9876 |
+
value = false;
|
9877 |
+
else if (value == "free")
|
9878 |
+
value = true;
|
9879 |
+
else if (value == "printMargin")
|
9880 |
+
value = -1;
|
9881 |
+
else if (typeof value == "string")
|
9882 |
+
value = parseInt(value, 10) || false;
|
9883 |
+
|
9884 |
+
if (this.$wrap == value)
|
9885 |
+
return;
|
9886 |
+
if (!value) {
|
9887 |
+
this.setUseWrapMode(false);
|
9888 |
+
} else {
|
9889 |
+
var col = typeof value == "number" ? value : null;
|
9890 |
+
this.setWrapLimitRange(col, col);
|
9891 |
+
this.setUseWrapMode(true);
|
9892 |
+
}
|
9893 |
+
this.$wrap = value;
|
9894 |
+
},
|
9895 |
+
get: function() {
|
9896 |
+
if (this.getUseWrapMode()) {
|
9897 |
+
if (this.$wrap == -1)
|
9898 |
+
return "printMargin";
|
9899 |
+
if (!this.getWrapLimitRange().min)
|
9900 |
+
return "free";
|
9901 |
+
return this.$wrap;
|
9902 |
+
}
|
9903 |
+
return "off";
|
9904 |
+
},
|
9905 |
+
handlesSet: true
|
9906 |
+
},
|
9907 |
+
wrapMethod: {
|
9908 |
+
set: function(val) {
|
9909 |
+
val = val == "auto" ? this.$mode.type != "text" : val != "text";
|
9910 |
+
if (val != this.$wrapAsCode) {
|
9911 |
+
this.$wrapAsCode = val;
|
9912 |
+
if (this.$useWrapMode) {
|
9913 |
+
this.$modified = true;
|
9914 |
+
this.$resetRowCache(0);
|
9915 |
+
this.$updateWrapData(0, this.getLength() - 1);
|
9916 |
+
}
|
9917 |
+
}
|
9918 |
+
},
|
9919 |
+
initialValue: "auto"
|
9920 |
+
},
|
9921 |
+
firstLineNumber: {
|
9922 |
+
set: function() {
|
9923 |
+
this._signal("changeBreakpoint");
|
9924 |
+
},
|
9925 |
+
initialValue: 1
|
9926 |
+
},
|
9927 |
+
useWorker: {
|
9928 |
+
set: function(useWorker) {
|
9929 |
+
this.$useWorker = useWorker;
|
9930 |
+
|
9931 |
+
this.$stopWorker();
|
9932 |
+
if (useWorker)
|
9933 |
+
this.$startWorker();
|
9934 |
+
},
|
9935 |
+
initialValue: true
|
9936 |
+
},
|
9937 |
+
useSoftTabs: {
|
9938 |
+
initialValue: true
|
9939 |
+
},
|
9940 |
+
tabSize: {
|
9941 |
+
set: function(tabSize) {
|
9942 |
+
if (isNaN(tabSize) || this.$tabSize === tabSize) return;
|
9943 |
+
|
9944 |
+
this.$modified = true;
|
9945 |
+
this.$rowLengthCache = [];
|
9946 |
+
this.$tabSize = tabSize;
|
9947 |
+
this._signal("changeTabSize");
|
9948 |
+
},
|
9949 |
+
initialValue: 4,
|
9950 |
+
handlesSet: true
|
9951 |
+
},
|
9952 |
+
overwrite: {
|
9953 |
+
set: function(val) {
|
9954 |
+
this._signal("changeOverwrite");
|
9955 |
+
},
|
9956 |
+
initialValue: false
|
9957 |
+
},
|
9958 |
+
newLineMode: {
|
9959 |
+
set: function(val) {
|
9960 |
+
this.doc.setNewLineMode(val)
|
9961 |
+
},
|
9962 |
+
get: function() {
|
9963 |
+
return this.doc.getNewLineMode()
|
9964 |
+
},
|
9965 |
+
handlesSet: true
|
9966 |
+
},
|
9967 |
+
mode: {
|
9968 |
+
set: function(val) {
|
9969 |
+
this.setMode(val)
|
9970 |
+
},
|
9971 |
+
get: function() {
|
9972 |
+
return this.$modeId
|
9973 |
+
}
|
9974 |
+
}
|
9975 |
+
});
|
9976 |
+
|
9977 |
+
exports.EditSession = EditSession;
|
9978 |
+
});
|
9979 |
+
|
9980 |
+
ace.define("ace/search", ["require", "exports", "module", "ace/lib/lang", "ace/lib/oop", "ace/range"], function(require, exports, module) {
|
9981 |
+
"use strict";
|
9982 |
+
|
9983 |
+
var lang = require("./lib/lang");
|
9984 |
+
var oop = require("./lib/oop");
|
9985 |
+
var Range = require("./range").Range;
|
9986 |
+
|
9987 |
+
var Search = function() {
|
9988 |
+
this.$options = {};
|
9989 |
+
};
|
9990 |
+
|
9991 |
+
(function() {
|
9992 |
+
this.set = function(options) {
|
9993 |
+
oop.mixin(this.$options, options);
|
9994 |
+
return this;
|
9995 |
+
};
|
9996 |
+
this.getOptions = function() {
|
9997 |
+
return lang.copyObject(this.$options);
|
9998 |
+
};
|
9999 |
+
this.setOptions = function(options) {
|
10000 |
+
this.$options = options;
|
10001 |
+
};
|
10002 |
+
this.find = function(session) {
|
10003 |
+
var iterator = this.$matchIterator(session, this.$options);
|
10004 |
+
|
10005 |
+
if (!iterator)
|
10006 |
+
return false;
|
10007 |
+
|
10008 |
+
var firstRange = null;
|
10009 |
+
iterator.forEach(function(range, row, offset) {
|
10010 |
+
if (!range.start) {
|
10011 |
+
var column = range.offset + (offset || 0);
|
10012 |
+
firstRange = new Range(row, column, row, column + range.length);
|
10013 |
+
} else
|
10014 |
+
firstRange = range;
|
10015 |
+
return true;
|
10016 |
+
});
|
10017 |
+
|
10018 |
+
return firstRange;
|
10019 |
+
};
|
10020 |
+
this.findAll = function(session) {
|
10021 |
+
var options = this.$options;
|
10022 |
+
if (!options.needle)
|
10023 |
+
return [];
|
10024 |
+
this.$assembleRegExp(options);
|
10025 |
+
|
10026 |
+
var range = options.range;
|
10027 |
+
var lines = range ? session.getLines(range.start.row, range.end.row) : session.doc.getAllLines();
|
10028 |
+
|
10029 |
+
var ranges = [];
|
10030 |
+
var re = options.re;
|
10031 |
+
if (options.$isMultiLine) {
|
10032 |
+
var len = re.length;
|
10033 |
+
var maxRow = lines.length - len;
|
10034 |
+
var prevRange;
|
10035 |
+
outer: for (var row = re.offset || 0; row <= maxRow; row++) {
|
10036 |
+
for (var j = 0; j < len; j++)
|
10037 |
+
if (lines[row + j].search(re[j]) == -1)
|
10038 |
+
continue outer;
|
10039 |
+
|
10040 |
+
var startLine = lines[row];
|
10041 |
+
var line = lines[row + len - 1];
|
10042 |
+
var startIndex = startLine.length - startLine.match(re[0])[0].length;
|
10043 |
+
var endIndex = line.match(re[len - 1])[0].length;
|
10044 |
+
|
10045 |
+
if (prevRange && prevRange.end.row === row &&
|
10046 |
+
prevRange.end.column > startIndex
|
10047 |
+
) {
|
10048 |
+
continue;
|
10049 |
+
}
|
10050 |
+
ranges.push(prevRange = new Range(
|
10051 |
+
row, startIndex, row + len - 1, endIndex
|
10052 |
+
));
|
10053 |
+
if (len > 2)
|
10054 |
+
row = row + len - 2;
|
10055 |
+
}
|
10056 |
+
} else {
|
10057 |
+
for (var i = 0; i < lines.length; i++) {
|
10058 |
+
var matches = lang.getMatchOffsets(lines[i], re);
|
10059 |
+
for (var j = 0; j < matches.length; j++) {
|
10060 |
+
var match = matches[j];
|
10061 |
+
ranges.push(new Range(i, match.offset, i, match.offset + match.length));
|
10062 |
+
}
|
10063 |
+
}
|
10064 |
+
}
|
10065 |
+
|
10066 |
+
if (range) {
|
10067 |
+
var startColumn = range.start.column;
|
10068 |
+
var endColumn = range.start.column;
|
10069 |
+
var i = 0,
|
10070 |
+
j = ranges.length - 1;
|
10071 |
+
while (i < j && ranges[i].start.column < startColumn && ranges[i].start.row == range.start.row)
|
10072 |
+
i++;
|
10073 |
+
|
10074 |
+
while (i < j && ranges[j].end.column > endColumn && ranges[j].end.row == range.end.row)
|
10075 |
+
j--;
|
10076 |
+
|
10077 |
+
ranges = ranges.slice(i, j + 1);
|
10078 |
+
for (i = 0, j = ranges.length; i < j; i++) {
|
10079 |
+
ranges[i].start.row += range.start.row;
|
10080 |
+
ranges[i].end.row += range.start.row;
|
10081 |
+
}
|
10082 |
+
}
|
10083 |
+
|
10084 |
+
return ranges;
|
10085 |
+
};
|
10086 |
+
this.replace = function(input, replacement) {
|
10087 |
+
var options = this.$options;
|
10088 |
+
|
10089 |
+
var re = this.$assembleRegExp(options);
|
10090 |
+
if (options.$isMultiLine)
|
10091 |
+
return replacement;
|
10092 |
+
|
10093 |
+
if (!re)
|
10094 |
+
return;
|
10095 |
+
|
10096 |
+
var match = re.exec(input);
|
10097 |
+
if (!match || match[0].length != input.length)
|
10098 |
+
return null;
|
10099 |
+
|
10100 |
+
replacement = input.replace(re, replacement);
|
10101 |
+
if (options.preserveCase) {
|
10102 |
+
replacement = replacement.split("");
|
10103 |
+
for (var i = Math.min(input.length, input.length); i--;) {
|
10104 |
+
var ch = input[i];
|
10105 |
+
if (ch && ch.toLowerCase() != ch)
|
10106 |
+
replacement[i] = replacement[i].toUpperCase();
|
10107 |
+
else
|
10108 |
+
replacement[i] = replacement[i].toLowerCase();
|
10109 |
+
}
|
10110 |
+
replacement = replacement.join("");
|
10111 |
+
}
|
10112 |
+
|
10113 |
+
return replacement;
|
10114 |
+
};
|
10115 |
+
|
10116 |
+
this.$matchIterator = function(session, options) {
|
10117 |
+
var re = this.$assembleRegExp(options);
|
10118 |
+
if (!re)
|
10119 |
+
return false;
|
10120 |
+
|
10121 |
+
var self = this,
|
10122 |
+
callback, backwards = options.backwards;
|
10123 |
+
|
10124 |
+
if (options.$isMultiLine) {
|
10125 |
+
var len = re.length;
|
10126 |
+
var matchIterator = function(line, row, offset) {
|
10127 |
+
var startIndex = line.search(re[0]);
|
10128 |
+
if (startIndex == -1)
|
10129 |
+
return;
|
10130 |
+
for (var i = 1; i < len; i++) {
|
10131 |
+
line = session.getLine(row + i);
|
10132 |
+
if (line.search(re[i]) == -1)
|
10133 |
+
return;
|
10134 |
+
}
|
10135 |
+
|
10136 |
+
var endIndex = line.match(re[len - 1])[0].length;
|
10137 |
+
|
10138 |
+
var range = new Range(row, startIndex, row + len - 1, endIndex);
|
10139 |
+
if (re.offset == 1) {
|
10140 |
+
range.start.row--;
|
10141 |
+
range.start.column = Number.MAX_VALUE;
|
10142 |
+
} else if (offset)
|
10143 |
+
range.start.column += offset;
|
10144 |
+
|
10145 |
+
if (callback(range))
|
10146 |
+
return true;
|
10147 |
+
};
|
10148 |
+
} else if (backwards) {
|
10149 |
+
var matchIterator = function(line, row, startIndex) {
|
10150 |
+
var matches = lang.getMatchOffsets(line, re);
|
10151 |
+
for (var i = matches.length - 1; i >= 0; i--)
|
10152 |
+
if (callback(matches[i], row, startIndex))
|
10153 |
+
return true;
|
10154 |
+
};
|
10155 |
+
} else {
|
10156 |
+
var matchIterator = function(line, row, startIndex) {
|
10157 |
+
var matches = lang.getMatchOffsets(line, re);
|
10158 |
+
for (var i = 0; i < matches.length; i++)
|
10159 |
+
if (callback(matches[i], row, startIndex))
|
10160 |
+
return true;
|
10161 |
+
};
|
10162 |
+
}
|
10163 |
+
|
10164 |
+
return {
|
10165 |
+
forEach: function(_callback) {
|
10166 |
+
callback = _callback;
|
10167 |
+
self.$lineIterator(session, options).forEach(matchIterator);
|
10168 |
+
}
|
10169 |
+
};
|
10170 |
+
};
|
10171 |
+
|
10172 |
+
this.$assembleRegExp = function(options, $disableFakeMultiline) {
|
10173 |
+
if (options.needle instanceof RegExp)
|
10174 |
+
return options.re = options.needle;
|
10175 |
+
|
10176 |
+
var needle = options.needle;
|
10177 |
+
|
10178 |
+
if (!options.needle)
|
10179 |
+
return options.re = false;
|
10180 |
+
|
10181 |
+
if (!options.regExp)
|
10182 |
+
needle = lang.escapeRegExp(needle);
|
10183 |
+
|
10184 |
+
if (options.wholeWord)
|
10185 |
+
needle = "\\b" + needle + "\\b";
|
10186 |
+
|
10187 |
+
var modifier = options.caseSensitive ? "gm" : "gmi";
|
10188 |
+
|
10189 |
+
options.$isMultiLine = !$disableFakeMultiline && /[\n\r]/.test(needle);
|
10190 |
+
if (options.$isMultiLine)
|
10191 |
+
return options.re = this.$assembleMultilineRegExp(needle, modifier);
|
10192 |
+
|
10193 |
+
try {
|
10194 |
+
var re = new RegExp(needle, modifier);
|
10195 |
+
} catch (e) {
|
10196 |
+
re = false;
|
10197 |
+
}
|
10198 |
+
return options.re = re;
|
10199 |
+
};
|
10200 |
+
|
10201 |
+
this.$assembleMultilineRegExp = function(needle, modifier) {
|
10202 |
+
var parts = needle.replace(/\r\n|\r|\n/g, "$\n^").split("\n");
|
10203 |
+
var re = [];
|
10204 |
+
for (var i = 0; i < parts.length; i++) try {
|
10205 |
+
re.push(new RegExp(parts[i], modifier));
|
10206 |
+
} catch (e) {
|
10207 |
+
return false;
|
10208 |
+
}
|
10209 |
+
if (parts[0] == "") {
|
10210 |
+
re.shift();
|
10211 |
+
re.offset = 1;
|
10212 |
+
} else {
|
10213 |
+
re.offset = 0;
|
10214 |
+
}
|
10215 |
+
return re;
|
10216 |
+
};
|
10217 |
+
|
10218 |
+
this.$lineIterator = function(session, options) {
|
10219 |
+
var backwards = options.backwards == true;
|
10220 |
+
var skipCurrent = options.skipCurrent != false;
|
10221 |
+
|
10222 |
+
var range = options.range;
|
10223 |
+
var start = options.start;
|
10224 |
+
if (!start)
|
10225 |
+
start = range ? range[backwards ? "end" : "start"] : session.selection.getRange();
|
10226 |
+
|
10227 |
+
if (start.start)
|
10228 |
+
start = start[skipCurrent != backwards ? "end" : "start"];
|
10229 |
+
|
10230 |
+
var firstRow = range ? range.start.row : 0;
|
10231 |
+
var lastRow = range ? range.end.row : session.getLength() - 1;
|
10232 |
+
|
10233 |
+
var forEach = backwards ? function(callback) {
|
10234 |
+
var row = start.row;
|
10235 |
+
|
10236 |
+
var line = session.getLine(row).substring(0, start.column);
|
10237 |
+
if (callback(line, row))
|
10238 |
+
return;
|
10239 |
+
|
10240 |
+
for (row--; row >= firstRow; row--)
|
10241 |
+
if (callback(session.getLine(row), row))
|
10242 |
+
return;
|
10243 |
+
|
10244 |
+
if (options.wrap == false)
|
10245 |
+
return;
|
10246 |
+
|
10247 |
+
for (row = lastRow, firstRow = start.row; row >= firstRow; row--)
|
10248 |
+
if (callback(session.getLine(row), row))
|
10249 |
+
return;
|
10250 |
+
} : function(callback) {
|
10251 |
+
var row = start.row;
|
10252 |
+
|
10253 |
+
var line = session.getLine(row).substr(start.column);
|
10254 |
+
if (callback(line, row, start.column))
|
10255 |
+
return;
|
10256 |
+
|
10257 |
+
for (row = row + 1; row <= lastRow; row++)
|
10258 |
+
if (callback(session.getLine(row), row))
|
10259 |
+
return;
|
10260 |
+
|
10261 |
+
if (options.wrap == false)
|
10262 |
+
return;
|
10263 |
+
|
10264 |
+
for (row = firstRow, lastRow = start.row; row <= lastRow; row++)
|
10265 |
+
if (callback(session.getLine(row), row))
|
10266 |
+
return;
|
10267 |
+
};
|
10268 |
+
|
10269 |
+
return {
|
10270 |
+
forEach: forEach
|
10271 |
+
};
|
10272 |
+
};
|
10273 |
+
|
10274 |
+
}).call(Search.prototype);
|
10275 |
+
|
10276 |
+
exports.Search = Search;
|
10277 |
+
});
|
10278 |
+
|
10279 |
+
ace.define("ace/keyboard/hash_handler", ["require", "exports", "module", "ace/lib/keys", "ace/lib/useragent"], function(require, exports, module) {
|
10280 |
+
"use strict";
|
10281 |
+
|
10282 |
+
var keyUtil = require("../lib/keys");
|
10283 |
+
var useragent = require("../lib/useragent");
|
10284 |
+
var KEY_MODS = keyUtil.KEY_MODS;
|
10285 |
+
|
10286 |
+
function HashHandler(config, platform) {
|
10287 |
+
this.platform = platform || (useragent.isMac ? "mac" : "win");
|
10288 |
+
this.commands = {};
|
10289 |
+
this.commandKeyBinding = {};
|
10290 |
+
this.addCommands(config);
|
10291 |
+
this.$singleCommand = true;
|
10292 |
+
}
|
10293 |
+
|
10294 |
+
function MultiHashHandler(config, platform) {
|
10295 |
+
HashHandler.call(this, config, platform);
|
10296 |
+
this.$singleCommand = false;
|
10297 |
+
}
|
10298 |
+
|
10299 |
+
MultiHashHandler.prototype = HashHandler.prototype;
|
10300 |
+
|
10301 |
+
(function() {
|
10302 |
+
|
10303 |
+
|
10304 |
+
this.addCommand = function(command) {
|
10305 |
+
if (this.commands[command.name])
|
10306 |
+
this.removeCommand(command);
|
10307 |
+
|
10308 |
+
this.commands[command.name] = command;
|
10309 |
+
|
10310 |
+
if (command.bindKey)
|
10311 |
+
this._buildKeyHash(command);
|
10312 |
+
};
|
10313 |
+
|
10314 |
+
this.removeCommand = function(command, keepCommand) {
|
10315 |
+
var name = command && (typeof command === 'string' ? command : command.name);
|
10316 |
+
command = this.commands[name];
|
10317 |
+
if (!keepCommand)
|
10318 |
+
delete this.commands[name];
|
10319 |
+
var ckb = this.commandKeyBinding;
|
10320 |
+
for (var keyId in ckb) {
|
10321 |
+
var cmdGroup = ckb[keyId];
|
10322 |
+
if (cmdGroup == command) {
|
10323 |
+
delete ckb[keyId];
|
10324 |
+
} else if (Array.isArray(cmdGroup)) {
|
10325 |
+
var i = cmdGroup.indexOf(command);
|
10326 |
+
if (i != -1) {
|
10327 |
+
cmdGroup.splice(i, 1);
|
10328 |
+
if (cmdGroup.length == 1)
|
10329 |
+
ckb[keyId] = cmdGroup[0];
|
10330 |
+
}
|
10331 |
+
}
|
10332 |
+
}
|
10333 |
+
};
|
10334 |
+
|
10335 |
+
this.bindKey = function(key, command, asDefault) {
|
10336 |
+
if (typeof key == "object")
|
10337 |
+
key = key[this.platform];
|
10338 |
+
if (!key)
|
10339 |
+
return;
|
10340 |
+
if (typeof command == "function")
|
10341 |
+
return this.addCommand({
|
10342 |
+
exec: command,
|
10343 |
+
bindKey: key,
|
10344 |
+
name: command.name || key
|
10345 |
+
});
|
10346 |
+
|
10347 |
+
key.split("|").forEach(function(keyPart) {
|
10348 |
+
var chain = "";
|
10349 |
+
if (keyPart.indexOf(" ") != -1) {
|
10350 |
+
var parts = keyPart.split(/\s+/);
|
10351 |
+
keyPart = parts.pop();
|
10352 |
+
parts.forEach(function(keyPart) {
|
10353 |
+
var binding = this.parseKeys(keyPart);
|
10354 |
+
var id = KEY_MODS[binding.hashId] + binding.key;
|
10355 |
+
chain += (chain ? " " : "") + id;
|
10356 |
+
this._addCommandToBinding(chain, "chainKeys");
|
10357 |
+
}, this);
|
10358 |
+
chain += " ";
|
10359 |
+
}
|
10360 |
+
var binding = this.parseKeys(keyPart);
|
10361 |
+
var id = KEY_MODS[binding.hashId] + binding.key;
|
10362 |
+
this._addCommandToBinding(chain + id, command, asDefault);
|
10363 |
+
}, this);
|
10364 |
+
};
|
10365 |
+
|
10366 |
+
this._addCommandToBinding = function(keyId, command, asDefault) {
|
10367 |
+
var ckb = this.commandKeyBinding,
|
10368 |
+
i;
|
10369 |
+
if (!command) {
|
10370 |
+
delete ckb[keyId];
|
10371 |
+
} else if (!ckb[keyId] || this.$singleCommand) {
|
10372 |
+
ckb[keyId] = command;
|
10373 |
+
} else {
|
10374 |
+
if (!Array.isArray(ckb[keyId])) {
|
10375 |
+
ckb[keyId] = [ckb[keyId]];
|
10376 |
+
} else if ((i = ckb[keyId].indexOf(command)) != -1) {
|
10377 |
+
ckb[keyId].splice(i, 1);
|
10378 |
+
}
|
10379 |
+
|
10380 |
+
if (asDefault || command.isDefault)
|
10381 |
+
ckb[keyId].unshift(command);
|
10382 |
+
else
|
10383 |
+
ckb[keyId].push(command);
|
10384 |
+
}
|
10385 |
+
};
|
10386 |
+
|
10387 |
+
this.addCommands = function(commands) {
|
10388 |
+
commands && Object.keys(commands).forEach(function(name) {
|
10389 |
+
var command = commands[name];
|
10390 |
+
if (!command)
|
10391 |
+
return;
|
10392 |
+
|
10393 |
+
if (typeof command === "string")
|
10394 |
+
return this.bindKey(command, name);
|
10395 |
+
|
10396 |
+
if (typeof command === "function")
|
10397 |
+
command = {
|
10398 |
+
exec: command
|
10399 |
+
};
|
10400 |
+
|
10401 |
+
if (typeof command !== "object")
|
10402 |
+
return;
|
10403 |
+
|
10404 |
+
if (!command.name)
|
10405 |
+
command.name = name;
|
10406 |
+
|
10407 |
+
this.addCommand(command);
|
10408 |
+
}, this);
|
10409 |
+
};
|
10410 |
+
|
10411 |
+
this.removeCommands = function(commands) {
|
10412 |
+
Object.keys(commands).forEach(function(name) {
|
10413 |
+
this.removeCommand(commands[name]);
|
10414 |
+
}, this);
|
10415 |
+
};
|
10416 |
+
|
10417 |
+
this.bindKeys = function(keyList) {
|
10418 |
+
Object.keys(keyList).forEach(function(key) {
|
10419 |
+
this.bindKey(key, keyList[key]);
|
10420 |
+
}, this);
|
10421 |
+
};
|
10422 |
+
|
10423 |
+
this._buildKeyHash = function(command) {
|
10424 |
+
this.bindKey(command.bindKey, command);
|
10425 |
+
};
|
10426 |
+
this.parseKeys = function(keys) {
|
10427 |
+
var parts = keys.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(x) {
|
10428 |
+
return x
|
10429 |
+
});
|
10430 |
+
var key = parts.pop();
|
10431 |
+
|
10432 |
+
var keyCode = keyUtil[key];
|
10433 |
+
if (keyUtil.FUNCTION_KEYS[keyCode])
|
10434 |
+
key = keyUtil.FUNCTION_KEYS[keyCode].toLowerCase();
|
10435 |
+
else if (!parts.length)
|
10436 |
+
return {
|
10437 |
+
key: key,
|
10438 |
+
hashId: -1
|
10439 |
+
};
|
10440 |
+
else if (parts.length == 1 && parts[0] == "shift")
|
10441 |
+
return {
|
10442 |
+
key: key.toUpperCase(),
|
10443 |
+
hashId: -1
|
10444 |
+
};
|
10445 |
+
|
10446 |
+
var hashId = 0;
|
10447 |
+
for (var i = parts.length; i--;) {
|
10448 |
+
var modifier = keyUtil.KEY_MODS[parts[i]];
|
10449 |
+
if (modifier == null) {
|
10450 |
+
if (typeof console != "undefined")
|
10451 |
+
console.error("invalid modifier " + parts[i] + " in " + keys);
|
10452 |
+
return false;
|
10453 |
+
}
|
10454 |
+
hashId |= modifier;
|
10455 |
+
}
|
10456 |
+
return {
|
10457 |
+
key: key,
|
10458 |
+
hashId: hashId
|
10459 |
+
};
|
10460 |
+
};
|
10461 |
+
|
10462 |
+
this.findKeyCommand = function findKeyCommand(hashId, keyString) {
|
10463 |
+
var key = KEY_MODS[hashId] + keyString;
|
10464 |
+
return this.commandKeyBinding[key];
|
10465 |
+
};
|
10466 |
+
|
10467 |
+
this.handleKeyboard = function(data, hashId, keyString, keyCode) {
|
10468 |
+
var key = KEY_MODS[hashId] + keyString;
|
10469 |
+
var command = this.commandKeyBinding[key];
|
10470 |
+
if (data.$keyChain) {
|
10471 |
+
data.$keyChain += " " + key;
|
10472 |
+
command = this.commandKeyBinding[data.$keyChain] || command;
|
10473 |
+
}
|
10474 |
+
|
10475 |
+
if (command) {
|
10476 |
+
if (command == "chainKeys" || command[command.length - 1] == "chainKeys") {
|
10477 |
+
data.$keyChain = data.$keyChain || key;
|
10478 |
+
return {
|
10479 |
+
command: "null"
|
10480 |
+
};
|
10481 |
+
}
|
10482 |
+
}
|
10483 |
+
|
10484 |
+
if (data.$keyChain && keyCode > 0)
|
10485 |
+
data.$keyChain = "";
|
10486 |
+
return {
|
10487 |
+
command: command
|
10488 |
+
};
|
10489 |
+
};
|
10490 |
+
|
10491 |
+
}).call(HashHandler.prototype);
|
10492 |
+
|
10493 |
+
exports.HashHandler = HashHandler;
|
10494 |
+
exports.MultiHashHandler = MultiHashHandler;
|
10495 |
+
});
|
10496 |
+
|
10497 |
+
ace.define("ace/commands/command_manager", ["require", "exports", "module", "ace/lib/oop", "ace/keyboard/hash_handler", "ace/lib/event_emitter"], function(require, exports, module) {
|
10498 |
+
"use strict";
|
10499 |
+
|
10500 |
+
var oop = require("../lib/oop");
|
10501 |
+
var MultiHashHandler = require("../keyboard/hash_handler").MultiHashHandler;
|
10502 |
+
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
10503 |
+
|
10504 |
+
var CommandManager = function(platform, commands) {
|
10505 |
+
MultiHashHandler.call(this, commands, platform);
|
10506 |
+
this.byName = this.commands;
|
10507 |
+
this.setDefaultHandler("exec", function(e) {
|
10508 |
+
return e.command.exec(e.editor, e.args || {});
|
10509 |
+
});
|
10510 |
+
};
|
10511 |
+
|
10512 |
+
oop.inherits(CommandManager, MultiHashHandler);
|
10513 |
+
|
10514 |
+
(function() {
|
10515 |
+
|
10516 |
+
oop.implement(this, EventEmitter);
|
10517 |
+
|
10518 |
+
this.exec = function(command, editor, args) {
|
10519 |
+
if (Array.isArray(command)) {
|
10520 |
+
for (var i = command.length; i--;) {
|
10521 |
+
if (this.exec(command[i], editor, args)) return true;
|
10522 |
+
}
|
10523 |
+
return false;
|
10524 |
+
}
|
10525 |
+
|
10526 |
+
if (typeof command === "string")
|
10527 |
+
command = this.commands[command];
|
10528 |
+
|
10529 |
+
if (!command)
|
10530 |
+
return false;
|
10531 |
+
|
10532 |
+
if (editor && editor.$readOnly && !command.readOnly)
|
10533 |
+
return false;
|
10534 |
+
|
10535 |
+
var e = {
|
10536 |
+
editor: editor,
|
10537 |
+
command: command,
|
10538 |
+
args: args
|
10539 |
+
};
|
10540 |
+
e.returnValue = this._emit("exec", e);
|
10541 |
+
this._signal("afterExec", e);
|
10542 |
+
|
10543 |
+
return e.returnValue === false ? false : true;
|
10544 |
+
};
|
10545 |
+
|
10546 |
+
this.toggleRecording = function(editor) {
|
10547 |
+
if (this.$inReplay)
|
10548 |
+
return;
|
10549 |
+
|
10550 |
+
editor && editor._emit("changeStatus");
|
10551 |
+
if (this.recording) {
|
10552 |
+
this.macro.pop();
|
10553 |
+
this.removeEventListener("exec", this.$addCommandToMacro);
|
10554 |
+
|
10555 |
+
if (!this.macro.length)
|
10556 |
+
this.macro = this.oldMacro;
|
10557 |
+
|
10558 |
+
return this.recording = false;
|
10559 |
+
}
|
10560 |
+
if (!this.$addCommandToMacro) {
|
10561 |
+
this.$addCommandToMacro = function(e) {
|
10562 |
+
this.macro.push([e.command, e.args]);
|
10563 |
+
}.bind(this);
|
10564 |
+
}
|
10565 |
+
|
10566 |
+
this.oldMacro = this.macro;
|
10567 |
+
this.macro = [];
|
10568 |
+
this.on("exec", this.$addCommandToMacro);
|
10569 |
+
return this.recording = true;
|
10570 |
+
};
|
10571 |
+
|
10572 |
+
this.replay = function(editor) {
|
10573 |
+
if (this.$inReplay || !this.macro)
|
10574 |
+
return;
|
10575 |
+
|
10576 |
+
if (this.recording)
|
10577 |
+
return this.toggleRecording(editor);
|
10578 |
+
|
10579 |
+
try {
|
10580 |
+
this.$inReplay = true;
|
10581 |
+
this.macro.forEach(function(x) {
|
10582 |
+
if (typeof x == "string")
|
10583 |
+
this.exec(x, editor);
|
10584 |
+
else
|
10585 |
+
this.exec(x[0], editor, x[1]);
|
10586 |
+
}, this);
|
10587 |
+
} finally {
|
10588 |
+
this.$inReplay = false;
|
10589 |
+
}
|
10590 |
+
};
|
10591 |
+
|
10592 |
+
this.trimMacro = function(m) {
|
10593 |
+
return m.map(function(x) {
|
10594 |
+
if (typeof x[0] != "string")
|
10595 |
+
x[0] = x[0].name;
|
10596 |
+
if (!x[1])
|
10597 |
+
x = x[0];
|
10598 |
+
return x;
|
10599 |
+
});
|
10600 |
+
};
|
10601 |
+
|
10602 |
+
}).call(CommandManager.prototype);
|
10603 |
+
|
10604 |
+
exports.CommandManager = CommandManager;
|
10605 |
+
|
10606 |
+
});
|
10607 |
+
|
10608 |
+
ace.define("ace/commands/default_commands", ["require", "exports", "module", "ace/lib/lang", "ace/config", "ace/range"], function(require, exports, module) {
|
10609 |
+
"use strict";
|
10610 |
+
|
10611 |
+
var lang = require("../lib/lang");
|
10612 |
+
var config = require("../config");
|
10613 |
+
var Range = require("../range").Range;
|
10614 |
+
|
10615 |
+
function bindKey(win, mac) {
|
10616 |
+
return {
|
10617 |
+
win: win,
|
10618 |
+
mac: mac
|
10619 |
+
};
|
10620 |
+
}
|
10621 |
+
exports.commands = [{
|
10622 |
+
name: "showSettingsMenu",
|
10623 |
+
bindKey: bindKey("Ctrl-,", "Command-,"),
|
10624 |
+
exec: function(editor) {
|
10625 |
+
config.loadModule("ace/ext/settings_menu", function(module) {
|
10626 |
+
module.init(editor);
|
10627 |
+
editor.showSettingsMenu();
|
10628 |
+
});
|
10629 |
+
},
|
10630 |
+
readOnly: true
|
10631 |
+
}, {
|
10632 |
+
name: "goToNextError",
|
10633 |
+
bindKey: bindKey("Alt-E", "Ctrl-E"),
|
10634 |
+
exec: function(editor) {
|
10635 |
+
config.loadModule("ace/ext/error_marker", function(module) {
|
10636 |
+
module.showErrorMarker(editor, 1);
|
10637 |
+
});
|
10638 |
+
},
|
10639 |
+
scrollIntoView: "animate",
|
10640 |
+
readOnly: true
|
10641 |
+
}, {
|
10642 |
+
name: "goToPreviousError",
|
10643 |
+
bindKey: bindKey("Alt-Shift-E", "Ctrl-Shift-E"),
|
10644 |
+
exec: function(editor) {
|
10645 |
+
config.loadModule("ace/ext/error_marker", function(module) {
|
10646 |
+
module.showErrorMarker(editor, -1);
|
10647 |
+
});
|
10648 |
+
},
|
10649 |
+
scrollIntoView: "animate",
|
10650 |
+
readOnly: true
|
10651 |
+
}, {
|
10652 |
+
name: "selectall",
|
10653 |
+
bindKey: bindKey("Ctrl-A", "Command-A"),
|
10654 |
+
exec: function(editor) {
|
10655 |
+
editor.selectAll();
|
10656 |
+
},
|
10657 |
+
readOnly: true
|
10658 |
+
}, {
|
10659 |
+
name: "centerselection",
|
10660 |
+
bindKey: bindKey(null, "Ctrl-L"),
|
10661 |
+
exec: function(editor) {
|
10662 |
+
editor.centerSelection();
|
10663 |
+
},
|
10664 |
+
readOnly: true
|
10665 |
+
}, {
|
10666 |
+
name: "gotoline",
|
10667 |
+
bindKey: bindKey("Ctrl-L", "Command-L"),
|
10668 |
+
exec: function(editor) {
|
10669 |
+
var line = parseInt(prompt("Enter line number:"), 10);
|
10670 |
+
if (!isNaN(line)) {
|
10671 |
+
editor.gotoLine(line);
|
10672 |
+
}
|
10673 |
+
},
|
10674 |
+
readOnly: true
|
10675 |
+
}, {
|
10676 |
+
name: "fold",
|
10677 |
+
bindKey: bindKey("Alt-L|Ctrl-F1", "Command-Alt-L|Command-F1"),
|
10678 |
+
exec: function(editor) {
|
10679 |
+
editor.session.toggleFold(false);
|
10680 |
+
},
|
10681 |
+
scrollIntoView: "center",
|
10682 |
+
readOnly: true
|
10683 |
+
}, {
|
10684 |
+
name: "unfold",
|
10685 |
+
bindKey: bindKey("Alt-Shift-L|Ctrl-Shift-F1", "Command-Alt-Shift-L|Command-Shift-F1"),
|
10686 |
+
exec: function(editor) {
|
10687 |
+
editor.session.toggleFold(true);
|
10688 |
+
},
|
10689 |
+
scrollIntoView: "center",
|
10690 |
+
readOnly: true
|
10691 |
+
}, {
|
10692 |
+
name: "toggleFoldWidget",
|
10693 |
+
bindKey: bindKey("F2", "F2"),
|
10694 |
+
exec: function(editor) {
|
10695 |
+
editor.session.toggleFoldWidget();
|
10696 |
+
},
|
10697 |
+
scrollIntoView: "center",
|
10698 |
+
readOnly: true
|
10699 |
+
}, {
|
10700 |
+
name: "toggleParentFoldWidget",
|
10701 |
+
bindKey: bindKey("Alt-F2", "Alt-F2"),
|
10702 |
+
exec: function(editor) {
|
10703 |
+
editor.session.toggleFoldWidget(true);
|
10704 |
+
},
|
10705 |
+
scrollIntoView: "center",
|
10706 |
+
readOnly: true
|
10707 |
+
}, {
|
10708 |
+
name: "foldall",
|
10709 |
+
bindKey: bindKey("Ctrl-Alt-0", "Ctrl-Command-Option-0"),
|
10710 |
+
exec: function(editor) {
|
10711 |
+
editor.session.foldAll();
|
10712 |
+
},
|
10713 |
+
scrollIntoView: "center",
|
10714 |
+
readOnly: true
|
10715 |
+
}, {
|
10716 |
+
name: "foldOther",
|
10717 |
+
bindKey: bindKey("Alt-0", "Command-Option-0"),
|
10718 |
+
exec: function(editor) {
|
10719 |
+
editor.session.foldAll();
|
10720 |
+
editor.session.unfold(editor.selection.getAllRanges());
|
10721 |
+
},
|
10722 |
+
scrollIntoView: "center",
|
10723 |
+
readOnly: true
|
10724 |
+
}, {
|
10725 |
+
name: "unfoldall",
|
10726 |
+
bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"),
|
10727 |
+
exec: function(editor) {
|
10728 |
+
editor.session.unfold();
|
10729 |
+
},
|
10730 |
+
scrollIntoView: "center",
|
10731 |
+
readOnly: true
|
10732 |
+
}, {
|
10733 |
+
name: "findnext",
|
10734 |
+
bindKey: bindKey("Ctrl-K", "Command-G"),
|
10735 |
+
exec: function(editor) {
|
10736 |
+
editor.findNext();
|
10737 |
+
},
|
10738 |
+
multiSelectAction: "forEach",
|
10739 |
+
scrollIntoView: "center",
|
10740 |
+
readOnly: true
|
10741 |
+
}, {
|
10742 |
+
name: "findprevious",
|
10743 |
+
bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
|
10744 |
+
exec: function(editor) {
|
10745 |
+
editor.findPrevious();
|
10746 |
+
},
|
10747 |
+
multiSelectAction: "forEach",
|
10748 |
+
scrollIntoView: "center",
|
10749 |
+
readOnly: true
|
10750 |
+
}, {
|
10751 |
+
name: "selectOrFindNext",
|
10752 |
+
bindKey: bindKey("Alt-K", "Ctrl-G"),
|
10753 |
+
exec: function(editor) {
|
10754 |
+
if (editor.selection.isEmpty())
|
10755 |
+
editor.selection.selectWord();
|
10756 |
+
else
|
10757 |
+
editor.findNext();
|
10758 |
+
},
|
10759 |
+
readOnly: true
|
10760 |
+
}, {
|
10761 |
+
name: "selectOrFindPrevious",
|
10762 |
+
bindKey: bindKey("Alt-Shift-K", "Ctrl-Shift-G"),
|
10763 |
+
exec: function(editor) {
|
10764 |
+
if (editor.selection.isEmpty())
|
10765 |
+
editor.selection.selectWord();
|
10766 |
+
else
|
10767 |
+
editor.findPrevious();
|
10768 |
+
},
|
10769 |
+
readOnly: true
|
10770 |
+
}, {
|
10771 |
+
name: "find",
|
10772 |
+
bindKey: bindKey("Ctrl-F", "Command-F"),
|
10773 |
+
exec: function(editor) {
|
10774 |
+
config.loadModule("ace/ext/searchbox", function(e) {
|
10775 |
+
e.Search(editor)
|
10776 |
+
});
|
10777 |
+
},
|
10778 |
+
readOnly: true
|
10779 |
+
}, {
|
10780 |
+
name: "overwrite",
|
10781 |
+
bindKey: "Insert",
|
10782 |
+
exec: function(editor) {
|
10783 |
+
editor.toggleOverwrite();
|
10784 |
+
},
|
10785 |
+
readOnly: true
|
10786 |
+
}, {
|
10787 |
+
name: "selecttostart",
|
10788 |
+
bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"),
|
10789 |
+
exec: function(editor) {
|
10790 |
+
editor.getSelection().selectFileStart();
|
10791 |
+
},
|
10792 |
+
multiSelectAction: "forEach",
|
10793 |
+
readOnly: true,
|
10794 |
+
scrollIntoView: "animate",
|
10795 |
+
aceCommandGroup: "fileJump"
|
10796 |
+
}, {
|
10797 |
+
name: "gotostart",
|
10798 |
+
bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
|
10799 |
+
exec: function(editor) {
|
10800 |
+
editor.navigateFileStart();
|
10801 |
+
},
|
10802 |
+
multiSelectAction: "forEach",
|
10803 |
+
readOnly: true,
|
10804 |
+
scrollIntoView: "animate",
|
10805 |
+
aceCommandGroup: "fileJump"
|
10806 |
+
}, {
|
10807 |
+
name: "selectup",
|
10808 |
+
bindKey: bindKey("Shift-Up", "Shift-Up"),
|
10809 |
+
exec: function(editor) {
|
10810 |
+
editor.getSelection().selectUp();
|
10811 |
+
},
|
10812 |
+
multiSelectAction: "forEach",
|
10813 |
+
readOnly: true
|
10814 |
+
}, {
|
10815 |
+
name: "golineup",
|
10816 |
+
bindKey: bindKey("Up", "Up|Ctrl-P"),
|
10817 |
+
exec: function(editor, args) {
|
10818 |
+
editor.navigateUp(args.times);
|
10819 |
+
},
|
10820 |
+
multiSelectAction: "forEach",
|
10821 |
+
readOnly: true
|
10822 |
+
}, {
|
10823 |
+
name: "selecttoend",
|
10824 |
+
bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-Down"),
|
10825 |
+
exec: function(editor) {
|
10826 |
+
editor.getSelection().selectFileEnd();
|
10827 |
+
},
|
10828 |
+
multiSelectAction: "forEach",
|
10829 |
+
readOnly: true,
|
10830 |
+
scrollIntoView: "animate",
|
10831 |
+
aceCommandGroup: "fileJump"
|
10832 |
+
}, {
|
10833 |
+
name: "gotoend",
|
10834 |
+
bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
|
10835 |
+
exec: function(editor) {
|
10836 |
+
editor.navigateFileEnd();
|
10837 |
+
},
|
10838 |
+
multiSelectAction: "forEach",
|
10839 |
+
readOnly: true,
|
10840 |
+
scrollIntoView: "animate",
|
10841 |
+
aceCommandGroup: "fileJump"
|
10842 |
+
}, {
|
10843 |
+
name: "selectdown",
|
10844 |
+
bindKey: bindKey("Shift-Down", "Shift-Down"),
|
10845 |
+
exec: function(editor) {
|
10846 |
+
editor.getSelection().selectDown();
|
10847 |
+
},
|
10848 |
+
multiSelectAction: "forEach",
|
10849 |
+
scrollIntoView: "cursor",
|
10850 |
+
readOnly: true
|
10851 |
+
}, {
|
10852 |
+
name: "golinedown",
|
10853 |
+
bindKey: bindKey("Down", "Down|Ctrl-N"),
|
10854 |
+
exec: function(editor, args) {
|
10855 |
+
editor.navigateDown(args.times);
|
10856 |
+
},
|
10857 |
+
multiSelectAction: "forEach",
|
10858 |
+
scrollIntoView: "cursor",
|
10859 |
+
readOnly: true
|
10860 |
+
}, {
|
10861 |
+
name: "selectwordleft",
|
10862 |
+
bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
|
10863 |
+
exec: function(editor) {
|
10864 |
+
editor.getSelection().selectWordLeft();
|
10865 |
+
},
|
10866 |
+
multiSelectAction: "forEach",
|
10867 |
+
scrollIntoView: "cursor",
|
10868 |
+
readOnly: true
|
10869 |
+
}, {
|
10870 |
+
name: "gotowordleft",
|
10871 |
+
bindKey: bindKey("Ctrl-Left", "Option-Left"),
|
10872 |
+
exec: function(editor) {
|
10873 |
+
editor.navigateWordLeft();
|
10874 |
+
},
|
10875 |
+
multiSelectAction: "forEach",
|
10876 |
+
scrollIntoView: "cursor",
|
10877 |
+
readOnly: true
|
10878 |
+
}, {
|
10879 |
+
name: "selecttolinestart",
|
10880 |
+
bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"),
|
10881 |
+
exec: function(editor) {
|
10882 |
+
editor.getSelection().selectLineStart();
|
10883 |
+
},
|
10884 |
+
multiSelectAction: "forEach",
|
10885 |
+
scrollIntoView: "cursor",
|
10886 |
+
readOnly: true
|
10887 |
+
}, {
|
10888 |
+
name: "gotolinestart",
|
10889 |
+
bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
|
10890 |
+
exec: function(editor) {
|
10891 |
+
editor.navigateLineStart();
|
10892 |
+
},
|
10893 |
+
multiSelectAction: "forEach",
|
10894 |
+
scrollIntoView: "cursor",
|
10895 |
+
readOnly: true
|
10896 |
+
}, {
|
10897 |
+
name: "selectleft",
|
10898 |
+
bindKey: bindKey("Shift-Left", "Shift-Left"),
|
10899 |
+
exec: function(editor) {
|
10900 |
+
editor.getSelection().selectLeft();
|
10901 |
+
},
|
10902 |
+
multiSelectAction: "forEach",
|
10903 |
+
scrollIntoView: "cursor",
|
10904 |
+
readOnly: true
|
10905 |
+
}, {
|
10906 |
+
name: "gotoleft",
|
10907 |
+
bindKey: bindKey("Left", "Left|Ctrl-B"),
|
10908 |
+
exec: function(editor, args) {
|
10909 |
+
editor.navigateLeft(args.times);
|
10910 |
+
},
|
10911 |
+
multiSelectAction: "forEach",
|
10912 |
+
scrollIntoView: "cursor",
|
10913 |
+
readOnly: true
|
10914 |
+
}, {
|
10915 |
+
name: "selectwordright",
|
10916 |
+
bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
|
10917 |
+
exec: function(editor) {
|
10918 |
+
editor.getSelection().selectWordRight();
|
10919 |
+
},
|
10920 |
+
multiSelectAction: "forEach",
|
10921 |
+
scrollIntoView: "cursor",
|
10922 |
+
readOnly: true
|
10923 |
+
}, {
|
10924 |
+
name: "gotowordright",
|
10925 |
+
bindKey: bindKey("Ctrl-Right", "Option-Right"),
|
10926 |
+
exec: function(editor) {
|
10927 |
+
editor.navigateWordRight();
|
10928 |
+
},
|
10929 |
+
multiSelectAction: "forEach",
|
10930 |
+
scrollIntoView: "cursor",
|
10931 |
+
readOnly: true
|
10932 |
+
}, {
|
10933 |
+
name: "selecttolineend",
|
10934 |
+
bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"),
|
10935 |
+
exec: function(editor) {
|
10936 |
+
editor.getSelection().selectLineEnd();
|
10937 |
+
},
|
10938 |
+
multiSelectAction: "forEach",
|
10939 |
+
scrollIntoView: "cursor",
|
10940 |
+
readOnly: true
|
10941 |
+
}, {
|
10942 |
+
name: "gotolineend",
|
10943 |
+
bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
|
10944 |
+
exec: function(editor) {
|
10945 |
+
editor.navigateLineEnd();
|
10946 |
+
},
|
10947 |
+
multiSelectAction: "forEach",
|
10948 |
+
scrollIntoView: "cursor",
|
10949 |
+
readOnly: true
|
10950 |
+
}, {
|
10951 |
+
name: "selectright",
|
10952 |
+
bindKey: bindKey("Shift-Right", "Shift-Right"),
|
10953 |
+
exec: function(editor) {
|
10954 |
+
editor.getSelection().selectRight();
|
10955 |
+
},
|
10956 |
+
multiSelectAction: "forEach",
|
10957 |
+
scrollIntoView: "cursor",
|
10958 |
+
readOnly: true
|
10959 |
+
}, {
|
10960 |
+
name: "gotoright",
|
10961 |
+
bindKey: bindKey("Right", "Right|Ctrl-F"),
|
10962 |
+
exec: function(editor, args) {
|
10963 |
+
editor.navigateRight(args.times);
|
10964 |
+
},
|
10965 |
+
multiSelectAction: "forEach",
|
10966 |
+
scrollIntoView: "cursor",
|
10967 |
+
readOnly: true
|
10968 |
+
}, {
|
10969 |
+
name: "selectpagedown",
|
10970 |
+
bindKey: "Shift-PageDown",
|
10971 |
+
exec: function(editor) {
|
10972 |
+
editor.selectPageDown();
|
10973 |
+
},
|
10974 |
+
readOnly: true
|
10975 |
+
}, {
|
10976 |
+
name: "pagedown",
|
10977 |
+
bindKey: bindKey(null, "Option-PageDown"),
|
10978 |
+
exec: function(editor) {
|
10979 |
+
editor.scrollPageDown();
|
10980 |
+
},
|
10981 |
+
readOnly: true
|
10982 |
+
}, {
|
10983 |
+
name: "gotopagedown",
|
10984 |
+
bindKey: bindKey("PageDown", "PageDown|Ctrl-V"),
|
10985 |
+
exec: function(editor) {
|
10986 |
+
editor.gotoPageDown();
|
10987 |
+
},
|
10988 |
+
readOnly: true
|
10989 |
+
}, {
|
10990 |
+
name: "selectpageup",
|
10991 |
+
bindKey: "Shift-PageUp",
|
10992 |
+
exec: function(editor) {
|
10993 |
+
editor.selectPageUp();
|
10994 |
+
},
|
10995 |
+
readOnly: true
|
10996 |
+
}, {
|
10997 |
+
name: "pageup",
|
10998 |
+
bindKey: bindKey(null, "Option-PageUp"),
|
10999 |
+
exec: function(editor) {
|
11000 |
+
editor.scrollPageUp();
|
11001 |
+
},
|
11002 |
+
readOnly: true
|
11003 |
+
}, {
|
11004 |
+
name: "gotopageup",
|
11005 |
+
bindKey: "PageUp",
|
11006 |
+
exec: function(editor) {
|
11007 |
+
editor.gotoPageUp();
|
11008 |
+
},
|
11009 |
+
readOnly: true
|
11010 |
+
}, {
|
11011 |
+
name: "scrollup",
|
11012 |
+
bindKey: bindKey("Ctrl-Up", null),
|
11013 |
+
exec: function(e) {
|
11014 |
+
e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight);
|
11015 |
+
},
|
11016 |
+
readOnly: true
|
11017 |
+
}, {
|
11018 |
+
name: "scrolldown",
|
11019 |
+
bindKey: bindKey("Ctrl-Down", null),
|
11020 |
+
exec: function(e) {
|
11021 |
+
e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight);
|
11022 |
+
},
|
11023 |
+
readOnly: true
|
11024 |
+
}, {
|
11025 |
+
name: "selectlinestart",
|
11026 |
+
bindKey: "Shift-Home",
|
11027 |
+
exec: function(editor) {
|
11028 |
+
editor.getSelection().selectLineStart();
|
11029 |
+
},
|
11030 |
+
multiSelectAction: "forEach",
|
11031 |
+
scrollIntoView: "cursor",
|
11032 |
+
readOnly: true
|
11033 |
+
}, {
|
11034 |
+
name: "selectlineend",
|
11035 |
+
bindKey: "Shift-End",
|
11036 |
+
exec: function(editor) {
|
11037 |
+
editor.getSelection().selectLineEnd();
|
11038 |
+
},
|
11039 |
+
multiSelectAction: "forEach",
|
11040 |
+
scrollIntoView: "cursor",
|
11041 |
+
readOnly: true
|
11042 |
+
}, {
|
11043 |
+
name: "togglerecording",
|
11044 |
+
bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"),
|
11045 |
+
exec: function(editor) {
|
11046 |
+
editor.commands.toggleRecording(editor);
|
11047 |
+
},
|
11048 |
+
readOnly: true
|
11049 |
+
}, {
|
11050 |
+
name: "replaymacro",
|
11051 |
+
bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"),
|
11052 |
+
exec: function(editor) {
|
11053 |
+
editor.commands.replay(editor);
|
11054 |
+
},
|
11055 |
+
readOnly: true
|
11056 |
+
}, {
|
11057 |
+
name: "jumptomatching",
|
11058 |
+
bindKey: bindKey("Ctrl-P", "Ctrl-P"),
|
11059 |
+
exec: function(editor) {
|
11060 |
+
editor.jumpToMatching();
|
11061 |
+
},
|
11062 |
+
multiSelectAction: "forEach",
|
11063 |
+
readOnly: true
|
11064 |
+
}, {
|
11065 |
+
name: "selecttomatching",
|
11066 |
+
bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"),
|
11067 |
+
exec: function(editor) {
|
11068 |
+
editor.jumpToMatching(true);
|
11069 |
+
},
|
11070 |
+
multiSelectAction: "forEach",
|
11071 |
+
readOnly: true
|
11072 |
+
}, {
|
11073 |
+
name: "passKeysToBrowser",
|
11074 |
+
bindKey: bindKey("null", "null"),
|
11075 |
+
exec: function() {},
|
11076 |
+
passEvent: true,
|
11077 |
+
readOnly: true
|
11078 |
+
}, {
|
11079 |
+
name: "cut",
|
11080 |
+
exec: function(editor) {
|
11081 |
+
var range = editor.getSelectionRange();
|
11082 |
+
editor._emit("cut", range);
|
11083 |
+
|
11084 |
+
if (!editor.selection.isEmpty()) {
|
11085 |
+
editor.session.remove(range);
|
11086 |
+
editor.clearSelection();
|
11087 |
+
}
|
11088 |
+
},
|
11089 |
+
scrollIntoView: "cursor",
|
11090 |
+
multiSelectAction: "forEach"
|
11091 |
+
}, {
|
11092 |
+
name: "removeline",
|
11093 |
+
bindKey: bindKey("Ctrl-D", "Command-D"),
|
11094 |
+
exec: function(editor) {
|
11095 |
+
editor.removeLines();
|
11096 |
+
},
|
11097 |
+
scrollIntoView: "cursor",
|
11098 |
+
multiSelectAction: "forEachLine"
|
11099 |
+
}, {
|
11100 |
+
name: "duplicateSelection",
|
11101 |
+
bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"),
|
11102 |
+
exec: function(editor) {
|
11103 |
+
editor.duplicateSelection();
|
11104 |
+
},
|
11105 |
+
scrollIntoView: "cursor",
|
11106 |
+
multiSelectAction: "forEach"
|
11107 |
+
}, {
|
11108 |
+
name: "sortlines",
|
11109 |
+
bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"),
|
11110 |
+
exec: function(editor) {
|
11111 |
+
editor.sortLines();
|
11112 |
+
},
|
11113 |
+
scrollIntoView: "selection",
|
11114 |
+
multiSelectAction: "forEachLine"
|
11115 |
+
}, {
|
11116 |
+
name: "togglecomment",
|
11117 |
+
bindKey: bindKey("Ctrl-/", "Command-/"),
|
11118 |
+
exec: function(editor) {
|
11119 |
+
editor.toggleCommentLines();
|
11120 |
+
},
|
11121 |
+
multiSelectAction: "forEachLine",
|
11122 |
+
scrollIntoView: "selectionPart"
|
11123 |
+
}, {
|
11124 |
+
name: "toggleBlockComment",
|
11125 |
+
bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"),
|
11126 |
+
exec: function(editor) {
|
11127 |
+
editor.toggleBlockComment();
|
11128 |
+
},
|
11129 |
+
multiSelectAction: "forEach",
|
11130 |
+
scrollIntoView: "selectionPart"
|
11131 |
+
}, {
|
11132 |
+
name: "modifyNumberUp",
|
11133 |
+
bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"),
|
11134 |
+
exec: function(editor) {
|
11135 |
+
editor.modifyNumber(1);
|
11136 |
+
},
|
11137 |
+
multiSelectAction: "forEach"
|
11138 |
+
}, {
|
11139 |
+
name: "modifyNumberDown",
|
11140 |
+
bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"),
|
11141 |
+
exec: function(editor) {
|
11142 |
+
editor.modifyNumber(-1);
|
11143 |
+
},
|
11144 |
+
multiSelectAction: "forEach"
|
11145 |
+
}, {
|
11146 |
+
name: "replace",
|
11147 |
+
bindKey: bindKey("Ctrl-H", "Command-Option-F"),
|
11148 |
+
exec: function(editor) {
|
11149 |
+
config.loadModule("ace/ext/searchbox", function(e) {
|
11150 |
+
e.Search(editor, true)
|
11151 |
+
});
|
11152 |
+
}
|
11153 |
+
}, {
|
11154 |
+
name: "undo",
|
11155 |
+
bindKey: bindKey("Ctrl-Z", "Command-Z"),
|
11156 |
+
exec: function(editor) {
|
11157 |
+
editor.undo();
|
11158 |
+
}
|
11159 |
+
}, {
|
11160 |
+
name: "redo",
|
11161 |
+
bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"),
|
11162 |
+
exec: function(editor) {
|
11163 |
+
editor.redo();
|
11164 |
+
}
|
11165 |
+
}, {
|
11166 |
+
name: "copylinesup",
|
11167 |
+
bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"),
|
11168 |
+
exec: function(editor) {
|
11169 |
+
editor.copyLinesUp();
|
11170 |
+
},
|
11171 |
+
scrollIntoView: "cursor"
|
11172 |
+
}, {
|
11173 |
+
name: "movelinesup",
|
11174 |
+
bindKey: bindKey("Alt-Up", "Option-Up"),
|
11175 |
+
exec: function(editor) {
|
11176 |
+
editor.moveLinesUp();
|
11177 |
+
},
|
11178 |
+
scrollIntoView: "cursor"
|
11179 |
+
}, {
|
11180 |
+
name: "copylinesdown",
|
11181 |
+
bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"),
|
11182 |
+
exec: function(editor) {
|
11183 |
+
editor.copyLinesDown();
|
11184 |
+
},
|
11185 |
+
scrollIntoView: "cursor"
|
11186 |
+
}, {
|
11187 |
+
name: "movelinesdown",
|
11188 |
+
bindKey: bindKey("Alt-Down", "Option-Down"),
|
11189 |
+
exec: function(editor) {
|
11190 |
+
editor.moveLinesDown();
|
11191 |
+
},
|
11192 |
+
scrollIntoView: "cursor"
|
11193 |
+
}, {
|
11194 |
+
name: "del",
|
11195 |
+
bindKey: bindKey("Delete", "Delete|Ctrl-D|Shift-Delete"),
|
11196 |
+
exec: function(editor) {
|
11197 |
+
editor.remove("right");
|
11198 |
+
},
|
11199 |
+
multiSelectAction: "forEach",
|
11200 |
+
scrollIntoView: "cursor"
|
11201 |
+
}, {
|
11202 |
+
name: "backspace",
|
11203 |
+
bindKey: bindKey(
|
11204 |
+
"Shift-Backspace|Backspace",
|
11205 |
+
"Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"
|
11206 |
+
),
|
11207 |
+
exec: function(editor) {
|
11208 |
+
editor.remove("left");
|
11209 |
+
},
|
11210 |
+
multiSelectAction: "forEach",
|
11211 |
+
scrollIntoView: "cursor"
|
11212 |
+
}, {
|
11213 |
+
name: "cut_or_delete",
|
11214 |
+
bindKey: bindKey("Shift-Delete", null),
|
11215 |
+
exec: function(editor) {
|
11216 |
+
if (editor.selection.isEmpty()) {
|
11217 |
+
editor.remove("left");
|
11218 |
+
} else {
|
11219 |
+
return false;
|
11220 |
+
}
|
11221 |
+
},
|
11222 |
+
multiSelectAction: "forEach",
|
11223 |
+
scrollIntoView: "cursor"
|
11224 |
+
}, {
|
11225 |
+
name: "removetolinestart",
|
11226 |
+
bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
|
11227 |
+
exec: function(editor) {
|
11228 |
+
editor.removeToLineStart();
|
11229 |
+
},
|
11230 |
+
multiSelectAction: "forEach",
|
11231 |
+
scrollIntoView: "cursor"
|
11232 |
+
}, {
|
11233 |
+
name: "removetolineend",
|
11234 |
+
bindKey: bindKey("Alt-Delete", "Ctrl-K"),
|
11235 |
+
exec: function(editor) {
|
11236 |
+
editor.removeToLineEnd();
|
11237 |
+
},
|
11238 |
+
multiSelectAction: "forEach",
|
11239 |
+
scrollIntoView: "cursor"
|
11240 |
+
}, {
|
11241 |
+
name: "removewordleft",
|
11242 |
+
bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
|
11243 |
+
exec: function(editor) {
|
11244 |
+
editor.removeWordLeft();
|
11245 |
+
},
|
11246 |
+
multiSelectAction: "forEach",
|
11247 |
+
scrollIntoView: "cursor"
|
11248 |
+
}, {
|
11249 |
+
name: "removewordright",
|
11250 |
+
bindKey: bindKey("Ctrl-Delete", "Alt-Delete"),
|
11251 |
+
exec: function(editor) {
|
11252 |
+
editor.removeWordRight();
|
11253 |
+
},
|
11254 |
+
multiSelectAction: "forEach",
|
11255 |
+
scrollIntoView: "cursor"
|
11256 |
+
}, {
|
11257 |
+
name: "outdent",
|
11258 |
+
bindKey: bindKey("Shift-Tab", "Shift-Tab"),
|
11259 |
+
exec: function(editor) {
|
11260 |
+
editor.blockOutdent();
|
11261 |
+
},
|
11262 |
+
multiSelectAction: "forEach",
|
11263 |
+
scrollIntoView: "selectionPart"
|
11264 |
+
}, {
|
11265 |
+
name: "indent",
|
11266 |
+
bindKey: bindKey("Tab", "Tab"),
|
11267 |
+
exec: function(editor) {
|
11268 |
+
editor.indent();
|
11269 |
+
},
|
11270 |
+
multiSelectAction: "forEach",
|
11271 |
+
scrollIntoView: "selectionPart"
|
11272 |
+
}, {
|
11273 |
+
name: "blockoutdent",
|
11274 |
+
bindKey: bindKey("Ctrl-[", "Ctrl-["),
|
11275 |
+
exec: function(editor) {
|
11276 |
+
editor.blockOutdent();
|
11277 |
+
},
|
11278 |
+
multiSelectAction: "forEachLine",
|
11279 |
+
scrollIntoView: "selectionPart"
|
11280 |
+
}, {
|
11281 |
+
name: "blockindent",
|
11282 |
+
bindKey: bindKey("Ctrl-]", "Ctrl-]"),
|
11283 |
+
exec: function(editor) {
|
11284 |
+
editor.blockIndent();
|
11285 |
+
},
|
11286 |
+
multiSelectAction: "forEachLine",
|
11287 |
+
scrollIntoView: "selectionPart"
|
11288 |
+
}, {
|
11289 |
+
name: "insertstring",
|
11290 |
+
exec: function(editor, str) {
|
11291 |
+
editor.insert(str);
|
11292 |
+
},
|
11293 |
+
multiSelectAction: "forEach",
|
11294 |
+
scrollIntoView: "cursor"
|
11295 |
+
}, {
|
11296 |
+
name: "inserttext",
|
11297 |
+
exec: function(editor, args) {
|
11298 |
+
editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
|
11299 |
+
},
|
11300 |
+
multiSelectAction: "forEach",
|
11301 |
+
scrollIntoView: "cursor"
|
11302 |
+
}, {
|
11303 |
+
name: "splitline",
|
11304 |
+
bindKey: bindKey(null, "Ctrl-O"),
|
11305 |
+
exec: function(editor) {
|
11306 |
+
editor.splitLine();
|
11307 |
+
},
|
11308 |
+
multiSelectAction: "forEach",
|
11309 |
+
scrollIntoView: "cursor"
|
11310 |
+
}, {
|
11311 |
+
name: "transposeletters",
|
11312 |
+
bindKey: bindKey("Ctrl-T", "Ctrl-T"),
|
11313 |
+
exec: function(editor) {
|
11314 |
+
editor.transposeLetters();
|
11315 |
+
},
|
11316 |
+
multiSelectAction: function(editor) {
|
11317 |
+
editor.transposeSelections(1);
|
11318 |
+
},
|
11319 |
+
scrollIntoView: "cursor"
|
11320 |
+
}, {
|
11321 |
+
name: "touppercase",
|
11322 |
+
bindKey: bindKey("Ctrl-U", "Ctrl-U"),
|
11323 |
+
exec: function(editor) {
|
11324 |
+
editor.toUpperCase();
|
11325 |
+
},
|
11326 |
+
multiSelectAction: "forEach",
|
11327 |
+
scrollIntoView: "cursor"
|
11328 |
+
}, {
|
11329 |
+
name: "tolowercase",
|
11330 |
+
bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"),
|
11331 |
+
exec: function(editor) {
|
11332 |
+
editor.toLowerCase();
|
11333 |
+
},
|
11334 |
+
multiSelectAction: "forEach",
|
11335 |
+
scrollIntoView: "cursor"
|
11336 |
+
}, {
|
11337 |
+
name: "expandtoline",
|
11338 |
+
bindKey: bindKey("Ctrl-Shift-L", "Command-Shift-L"),
|
11339 |
+
exec: function(editor) {
|
11340 |
+
var range = editor.selection.getRange();
|
11341 |
+
|
11342 |
+
range.start.column = range.end.column = 0;
|
11343 |
+
range.end.row++;
|
11344 |
+
editor.selection.setRange(range, false);
|
11345 |
+
},
|
11346 |
+
multiSelectAction: "forEach",
|
11347 |
+
scrollIntoView: "cursor",
|
11348 |
+
readOnly: true
|
11349 |
+
}, {
|
11350 |
+
name: "joinlines",
|
11351 |
+
bindKey: bindKey(null, null),
|
11352 |
+
exec: function(editor) {
|
11353 |
+
var isBackwards = editor.selection.isBackwards();
|
11354 |
+
var selectionStart = isBackwards ? editor.selection.getSelectionLead() : editor.selection.getSelectionAnchor();
|
11355 |
+
var selectionEnd = isBackwards ? editor.selection.getSelectionAnchor() : editor.selection.getSelectionLead();
|
11356 |
+
var firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length
|
11357 |
+
var selectedText = editor.session.doc.getTextRange(editor.selection.getRange());
|
11358 |
+
var selectedCount = selectedText.replace(/\n\s*/, " ").length;
|
11359 |
+
var insertLine = editor.session.doc.getLine(selectionStart.row);
|
11360 |
+
|
11361 |
+
for (var i = selectionStart.row + 1; i <= selectionEnd.row + 1; i++) {
|
11362 |
+
var curLine = lang.stringTrimLeft(lang.stringTrimRight(editor.session.doc.getLine(i)));
|
11363 |
+
if (curLine.length !== 0) {
|
11364 |
+
curLine = " " + curLine;
|
11365 |
+
}
|
11366 |
+
insertLine += curLine;
|
11367 |
+
};
|
11368 |
+
|
11369 |
+
if (selectionEnd.row + 1 < (editor.session.doc.getLength() - 1)) {
|
11370 |
+
insertLine += editor.session.doc.getNewLineCharacter();
|
11371 |
+
}
|
11372 |
+
|
11373 |
+
editor.clearSelection();
|
11374 |
+
editor.session.doc.replace(new Range(selectionStart.row, 0, selectionEnd.row + 2, 0), insertLine);
|
11375 |
+
|
11376 |
+
if (selectedCount > 0) {
|
11377 |
+
editor.selection.moveCursorTo(selectionStart.row, selectionStart.column);
|
11378 |
+
editor.selection.selectTo(selectionStart.row, selectionStart.column + selectedCount);
|
11379 |
+
} else {
|
11380 |
+
firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length > firstLineEndCol ? (firstLineEndCol + 1) : firstLineEndCol;
|
11381 |
+
editor.selection.moveCursorTo(selectionStart.row, firstLineEndCol);
|
11382 |
+
}
|
11383 |
+
},
|
11384 |
+
multiSelectAction: "forEach",
|
11385 |
+
readOnly: true
|
11386 |
+
}, {
|
11387 |
+
name: "invertSelection",
|
11388 |
+
bindKey: bindKey(null, null),
|
11389 |
+
exec: function(editor) {
|
11390 |
+
var endRow = editor.session.doc.getLength() - 1;
|
11391 |
+
var endCol = editor.session.doc.getLine(endRow).length;
|
11392 |
+
var ranges = editor.selection.rangeList.ranges;
|
11393 |
+
var newRanges = [];
|
11394 |
+
if (ranges.length < 1) {
|
11395 |
+
ranges = [editor.selection.getRange()];
|
11396 |
+
}
|
11397 |
+
|
11398 |
+
for (var i = 0; i < ranges.length; i++) {
|
11399 |
+
if (i == (ranges.length - 1)) {
|
11400 |
+
if (!(ranges[i].end.row === endRow && ranges[i].end.column === endCol)) {
|
11401 |
+
newRanges.push(new Range(ranges[i].end.row, ranges[i].end.column, endRow, endCol));
|
11402 |
+
}
|
11403 |
+
}
|
11404 |
+
|
11405 |
+
if (i === 0) {
|
11406 |
+
if (!(ranges[i].start.row === 0 && ranges[i].start.column === 0)) {
|
11407 |
+
newRanges.push(new Range(0, 0, ranges[i].start.row, ranges[i].start.column));
|
11408 |
+
}
|
11409 |
+
} else {
|
11410 |
+
newRanges.push(new Range(ranges[i - 1].end.row, ranges[i - 1].end.column, ranges[i].start.row, ranges[i].start.column));
|
11411 |
+
}
|
11412 |
+
}
|
11413 |
+
|
11414 |
+
editor.exitMultiSelectMode();
|
11415 |
+
editor.clearSelection();
|
11416 |
+
|
11417 |
+
for (var i = 0; i < newRanges.length; i++) {
|
11418 |
+
editor.selection.addRange(newRanges[i], false);
|
11419 |
+
}
|
11420 |
+
},
|
11421 |
+
readOnly: true,
|
11422 |
+
scrollIntoView: "none"
|
11423 |
+
}];
|
11424 |
+
|
11425 |
+
});
|
11426 |
+
|
11427 |
+
ace.define("ace/editor", ["require", "exports", "module", "ace/lib/fixoldbrowsers", "ace/lib/oop", "ace/lib/dom", "ace/lib/lang", "ace/lib/useragent", "ace/keyboard/textinput", "ace/mouse/mouse_handler", "ace/mouse/fold_handler", "ace/keyboard/keybinding", "ace/edit_session", "ace/search", "ace/range", "ace/lib/event_emitter", "ace/commands/command_manager", "ace/commands/default_commands", "ace/config", "ace/token_iterator"], function(require, exports, module) {
|
11428 |
+
"use strict";
|
11429 |
+
|
11430 |
+
require("./lib/fixoldbrowsers");
|
11431 |
+
|
11432 |
+
var oop = require("./lib/oop");
|
11433 |
+
var dom = require("./lib/dom");
|
11434 |
+
var lang = require("./lib/lang");
|
11435 |
+
var useragent = require("./lib/useragent");
|
11436 |
+
var TextInput = require("./keyboard/textinput").TextInput;
|
11437 |
+
var MouseHandler = require("./mouse/mouse_handler").MouseHandler;
|
11438 |
+
var FoldHandler = require("./mouse/fold_handler").FoldHandler;
|
11439 |
+
var KeyBinding = require("./keyboard/keybinding").KeyBinding;
|
11440 |
+
var EditSession = require("./edit_session").EditSession;
|
11441 |
+
var Search = require("./search").Search;
|
11442 |
+
var Range = require("./range").Range;
|
11443 |
+
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
11444 |
+
var CommandManager = require("./commands/command_manager").CommandManager;
|
11445 |
+
var defaultCommands = require("./commands/default_commands").commands;
|
11446 |
+
var config = require("./config");
|
11447 |
+
var TokenIterator = require("./token_iterator").TokenIterator;
|
11448 |
+
var Editor = function(renderer, session) {
|
11449 |
+
var container = renderer.getContainerElement();
|
11450 |
+
this.container = container;
|
11451 |
+
this.renderer = renderer;
|
11452 |
+
|
11453 |
+
this.commands = new CommandManager(useragent.isMac ? "mac" : "win", defaultCommands);
|
11454 |
+
this.textInput = new TextInput(renderer.getTextAreaContainer(), this);
|
11455 |
+
this.renderer.textarea = this.textInput.getElement();
|
11456 |
+
this.keyBinding = new KeyBinding(this);
|
11457 |
+
this.$mouseHandler = new MouseHandler(this);
|
11458 |
+
new FoldHandler(this);
|
11459 |
+
|
11460 |
+
this.$blockScrolling = 0;
|
11461 |
+
this.$search = new Search().set({
|
11462 |
+
wrap: true
|
11463 |
+
});
|
11464 |
+
|
11465 |
+
this.$historyTracker = this.$historyTracker.bind(this);
|
11466 |
+
this.commands.on("exec", this.$historyTracker);
|
11467 |
+
|
11468 |
+
this.$initOperationListeners();
|
11469 |
+
|
11470 |
+
this._$emitInputEvent = lang.delayedCall(function() {
|
11471 |
+
this._signal("input", {});
|
11472 |
+
if (this.session && this.session.bgTokenizer)
|
11473 |
+
this.session.bgTokenizer.scheduleStart();
|
11474 |
+
}.bind(this));
|
11475 |
+
|
11476 |
+
this.on("change", function(_, _self) {
|
11477 |
+
_self._$emitInputEvent.schedule(31);
|
11478 |
+
});
|
11479 |
+
|
11480 |
+
this.setSession(session || new EditSession(""));
|
11481 |
+
config.resetOptions(this);
|
11482 |
+
config._signal("editor", this);
|
11483 |
+
};
|
11484 |
+
|
11485 |
+
(function() {
|
11486 |
+
|
11487 |
+
oop.implement(this, EventEmitter);
|
11488 |
+
|
11489 |
+
this.$initOperationListeners = function() {
|
11490 |
+
function last(a) {
|
11491 |
+
return a[a.length - 1]
|
11492 |
+
}
|
11493 |
+
|
11494 |
+
this.selections = [];
|
11495 |
+
this.commands.on("exec", this.startOperation.bind(this), true);
|
11496 |
+
this.commands.on("afterExec", this.endOperation.bind(this), true);
|
11497 |
+
|
11498 |
+
this.$opResetTimer = lang.delayedCall(this.endOperation.bind(this));
|
11499 |
+
|
11500 |
+
this.on("change", function() {
|
11501 |
+
this.curOp || this.startOperation();
|
11502 |
+
this.curOp.docChanged = true;
|
11503 |
+
}.bind(this), true);
|
11504 |
+
|
11505 |
+
this.on("changeSelection", function() {
|
11506 |
+
this.curOp || this.startOperation();
|
11507 |
+
this.curOp.selectionChanged = true;
|
11508 |
+
}.bind(this), true);
|
11509 |
+
};
|
11510 |
+
|
11511 |
+
this.curOp = null;
|
11512 |
+
this.prevOp = {};
|
11513 |
+
this.startOperation = function(commadEvent) {
|
11514 |
+
if (this.curOp) {
|
11515 |
+
if (!commadEvent || this.curOp.command)
|
11516 |
+
return;
|
11517 |
+
this.prevOp = this.curOp;
|
11518 |
+
}
|
11519 |
+
if (!commadEvent) {
|
11520 |
+
this.previousCommand = null;
|
11521 |
+
commadEvent = {};
|
11522 |
+
}
|
11523 |
+
|
11524 |
+
this.$opResetTimer.schedule();
|
11525 |
+
this.curOp = {
|
11526 |
+
command: commadEvent.command || {},
|
11527 |
+
args: commadEvent.args,
|
11528 |
+
scrollTop: this.renderer.scrollTop
|
11529 |
+
};
|
11530 |
+
};
|
11531 |
+
|
11532 |
+
this.endOperation = function(e) {
|
11533 |
+
if (this.curOp) {
|
11534 |
+
if (e && e.returnValue === false)
|
11535 |
+
return this.curOp = null;
|
11536 |
+
|
11537 |
+
var command = this.curOp.command;
|
11538 |
+
if (command && command.scrollIntoView) {
|
11539 |
+
switch (command.scrollIntoView) {
|
11540 |
+
case "center":
|
11541 |
+
this.renderer.scrollCursorIntoView(null, 0.5);
|
11542 |
+
break;
|
11543 |
+
case "animate":
|
11544 |
+
case "cursor":
|
11545 |
+
this.renderer.scrollCursorIntoView();
|
11546 |
+
break;
|
11547 |
+
case "selectionPart":
|
11548 |
+
var range = this.selection.getRange();
|
11549 |
+
var config = this.renderer.layerConfig;
|
11550 |
+
if (range.start.row >= config.lastRow || range.end.row <= config.firstRow) {
|
11551 |
+
this.renderer.scrollSelectionIntoView(this.selection.anchor, this.selection.lead);
|
11552 |
+
}
|
11553 |
+
break;
|
11554 |
+
default:
|
11555 |
+
break;
|
11556 |
+
}
|
11557 |
+
if (command.scrollIntoView == "animate")
|
11558 |
+
this.renderer.animateScrolling(this.curOp.scrollTop);
|
11559 |
+
}
|
11560 |
+
|
11561 |
+
this.prevOp = this.curOp;
|
11562 |
+
this.curOp = null;
|
11563 |
+
}
|
11564 |
+
};
|
11565 |
+
this.$mergeableCommands = ["backspace", "del", "insertstring"];
|
11566 |
+
this.$historyTracker = function(e) {
|
11567 |
+
if (!this.$mergeUndoDeltas)
|
11568 |
+
return;
|
11569 |
+
|
11570 |
+
var prev = this.prevOp;
|
11571 |
+
var mergeableCommands = this.$mergeableCommands;
|
11572 |
+
var shouldMerge = prev.command && (e.command.name == prev.command.name);
|
11573 |
+
if (e.command.name == "insertstring") {
|
11574 |
+
var text = e.args;
|
11575 |
+
if (this.mergeNextCommand === undefined)
|
11576 |
+
this.mergeNextCommand = true;
|
11577 |
+
|
11578 |
+
shouldMerge = shouldMerge && this.mergeNextCommand // previous command allows to coalesce with
|
11579 |
+
&& (!/\s/.test(text) || /\s/.test(prev.args)); // previous insertion was of same type
|
11580 |
+
|
11581 |
+
this.mergeNextCommand = true;
|
11582 |
+
} else {
|
11583 |
+
shouldMerge = shouldMerge && mergeableCommands.indexOf(e.command.name) !== -1; // the command is mergeable
|
11584 |
+
}
|
11585 |
+
|
11586 |
+
if (
|
11587 |
+
this.$mergeUndoDeltas != "always" && Date.now() - this.sequenceStartTime > 2000
|
11588 |
+
) {
|
11589 |
+
shouldMerge = false; // the sequence is too long
|
11590 |
+
}
|
11591 |
+
|
11592 |
+
if (shouldMerge)
|
11593 |
+
this.session.mergeUndoDeltas = true;
|
11594 |
+
else if (mergeableCommands.indexOf(e.command.name) !== -1)
|
11595 |
+
this.sequenceStartTime = Date.now();
|
11596 |
+
};
|
11597 |
+
this.setKeyboardHandler = function(keyboardHandler, cb) {
|
11598 |
+
if (keyboardHandler && typeof keyboardHandler === "string") {
|
11599 |
+
this.$keybindingId = keyboardHandler;
|
11600 |
+
var _self = this;
|
11601 |
+
config.loadModule(["keybinding", keyboardHandler], function(module) {
|
11602 |
+
if (_self.$keybindingId == keyboardHandler)
|
11603 |
+
_self.keyBinding.setKeyboardHandler(module && module.handler);
|
11604 |
+
cb && cb();
|
11605 |
+
});
|
11606 |
+
} else {
|
11607 |
+
this.$keybindingId = null;
|
11608 |
+
this.keyBinding.setKeyboardHandler(keyboardHandler);
|
11609 |
+
cb && cb();
|
11610 |
+
}
|
11611 |
+
};
|
11612 |
+
this.getKeyboardHandler = function() {
|
11613 |
+
return this.keyBinding.getKeyboardHandler();
|
11614 |
+
};
|
11615 |
+
this.setSession = function(session) {
|
11616 |
+
if (this.session == session)
|
11617 |
+
return;
|
11618 |
+
|
11619 |
+
var oldSession = this.session;
|
11620 |
+
if (oldSession) {
|
11621 |
+
this.session.removeEventListener("change", this.$onDocumentChange);
|
11622 |
+
this.session.removeEventListener("changeMode", this.$onChangeMode);
|
11623 |
+
this.session.removeEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
|
11624 |
+
this.session.removeEventListener("changeTabSize", this.$onChangeTabSize);
|
11625 |
+
this.session.removeEventListener("changeWrapLimit", this.$onChangeWrapLimit);
|
11626 |
+
this.session.removeEventListener("changeWrapMode", this.$onChangeWrapMode);
|
11627 |
+
this.session.removeEventListener("onChangeFold", this.$onChangeFold);
|
11628 |
+
this.session.removeEventListener("changeFrontMarker", this.$onChangeFrontMarker);
|
11629 |
+
this.session.removeEventListener("changeBackMarker", this.$onChangeBackMarker);
|
11630 |
+
this.session.removeEventListener("changeBreakpoint", this.$onChangeBreakpoint);
|
11631 |
+
this.session.removeEventListener("changeAnnotation", this.$onChangeAnnotation);
|
11632 |
+
this.session.removeEventListener("changeOverwrite", this.$onCursorChange);
|
11633 |
+
this.session.removeEventListener("changeScrollTop", this.$onScrollTopChange);
|
11634 |
+
this.session.removeEventListener("changeScrollLeft", this.$onScrollLeftChange);
|
11635 |
+
|
11636 |
+
var selection = this.session.getSelection();
|
11637 |
+
selection.removeEventListener("changeCursor", this.$onCursorChange);
|
11638 |
+
selection.removeEventListener("changeSelection", this.$onSelectionChange);
|
11639 |
+
}
|
11640 |
+
|
11641 |
+
this.session = session;
|
11642 |
+
if (session) {
|
11643 |
+
this.$onDocumentChange = this.onDocumentChange.bind(this);
|
11644 |
+
session.addEventListener("change", this.$onDocumentChange);
|
11645 |
+
this.renderer.setSession(session);
|
11646 |
+
|
11647 |
+
this.$onChangeMode = this.onChangeMode.bind(this);
|
11648 |
+
session.addEventListener("changeMode", this.$onChangeMode);
|
11649 |
+
|
11650 |
+
this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this);
|
11651 |
+
session.addEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
|
11652 |
+
|
11653 |
+
this.$onChangeTabSize = this.renderer.onChangeTabSize.bind(this.renderer);
|
11654 |
+
session.addEventListener("changeTabSize", this.$onChangeTabSize);
|
11655 |
+
|
11656 |
+
this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this);
|
11657 |
+
session.addEventListener("changeWrapLimit", this.$onChangeWrapLimit);
|
11658 |
+
|
11659 |
+
this.$onChangeWrapMode = this.onChangeWrapMode.bind(this);
|
11660 |
+
session.addEventListener("changeWrapMode", this.$onChangeWrapMode);
|
11661 |
+
|
11662 |
+
this.$onChangeFold = this.onChangeFold.bind(this);
|
11663 |
+
session.addEventListener("changeFold", this.$onChangeFold);
|
11664 |
+
|
11665 |
+
this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this);
|
11666 |
+
this.session.addEventListener("changeFrontMarker", this.$onChangeFrontMarker);
|
11667 |
+
|
11668 |
+
this.$onChangeBackMarker = this.onChangeBackMarker.bind(this);
|
11669 |
+
this.session.addEventListener("changeBackMarker", this.$onChangeBackMarker);
|
11670 |
+
|
11671 |
+
this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this);
|
11672 |
+
this.session.addEventListener("changeBreakpoint", this.$onChangeBreakpoint);
|
11673 |
+
|
11674 |
+
this.$onChangeAnnotation = this.onChangeAnnotation.bind(this);
|
11675 |
+
this.session.addEventListener("changeAnnotation", this.$onChangeAnnotation);
|
11676 |
+
|
11677 |
+
this.$onCursorChange = this.onCursorChange.bind(this);
|
11678 |
+
this.session.addEventListener("changeOverwrite", this.$onCursorChange);
|
11679 |
+
|
11680 |
+
this.$onScrollTopChange = this.onScrollTopChange.bind(this);
|
11681 |
+
this.session.addEventListener("changeScrollTop", this.$onScrollTopChange);
|
11682 |
+
|
11683 |
+
this.$onScrollLeftChange = this.onScrollLeftChange.bind(this);
|
11684 |
+
this.session.addEventListener("changeScrollLeft", this.$onScrollLeftChange);
|
11685 |
+
|
11686 |
+
this.selection = session.getSelection();
|
11687 |
+
this.selection.addEventListener("changeCursor", this.$onCursorChange);
|
11688 |
+
|
11689 |
+
this.$onSelectionChange = this.onSelectionChange.bind(this);
|
11690 |
+
this.selection.addEventListener("changeSelection", this.$onSelectionChange);
|
11691 |
+
|
11692 |
+
this.onChangeMode();
|
11693 |
+
|
11694 |
+
this.$blockScrolling += 1;
|
11695 |
+
this.onCursorChange();
|
11696 |
+
this.$blockScrolling -= 1;
|
11697 |
+
|
11698 |
+
this.onScrollTopChange();
|
11699 |
+
this.onScrollLeftChange();
|
11700 |
+
this.onSelectionChange();
|
11701 |
+
this.onChangeFrontMarker();
|
11702 |
+
this.onChangeBackMarker();
|
11703 |
+
this.onChangeBreakpoint();
|
11704 |
+
this.onChangeAnnotation();
|
11705 |
+
this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
|
11706 |
+
this.renderer.updateFull();
|
11707 |
+
} else {
|
11708 |
+
this.selection = null;
|
11709 |
+
this.renderer.setSession(session);
|
11710 |
+
}
|
11711 |
+
|
11712 |
+
this._signal("changeSession", {
|
11713 |
+
session: session,
|
11714 |
+
oldSession: oldSession
|
11715 |
+
});
|
11716 |
+
|
11717 |
+
oldSession && oldSession._signal("changeEditor", {
|
11718 |
+
oldEditor: this
|
11719 |
+
});
|
11720 |
+
session && session._signal("changeEditor", {
|
11721 |
+
editor: this
|
11722 |
+
});
|
11723 |
+
};
|
11724 |
+
this.getSession = function() {
|
11725 |
+
return this.session;
|
11726 |
+
};
|
11727 |
+
this.setValue = function(val, cursorPos) {
|
11728 |
+
this.session.doc.setValue(val);
|
11729 |
+
|
11730 |
+
if (!cursorPos)
|
11731 |
+
this.selectAll();
|
11732 |
+
else if (cursorPos == 1)
|
11733 |
+
this.navigateFileEnd();
|
11734 |
+
else if (cursorPos == -1)
|
11735 |
+
this.navigateFileStart();
|
11736 |
+
|
11737 |
+
return val;
|
11738 |
+
};
|
11739 |
+
this.getValue = function() {
|
11740 |
+
return this.session.getValue();
|
11741 |
+
};
|
11742 |
+
this.getSelection = function() {
|
11743 |
+
return this.selection;
|
11744 |
+
};
|
11745 |
+
this.resize = function(force) {
|
11746 |
+
this.renderer.onResize(force);
|
11747 |
+
};
|
11748 |
+
this.setTheme = function(theme, cb) {
|
11749 |
+
this.renderer.setTheme(theme, cb);
|
11750 |
+
};
|
11751 |
+
this.getTheme = function() {
|
11752 |
+
return this.renderer.getTheme();
|
11753 |
+
};
|
11754 |
+
this.setStyle = function(style) {
|
11755 |
+
this.renderer.setStyle(style);
|
11756 |
+
};
|
11757 |
+
this.unsetStyle = function(style) {
|
11758 |
+
this.renderer.unsetStyle(style);
|
11759 |
+
};
|
11760 |
+
this.getFontSize = function() {
|
11761 |
+
return this.getOption("fontSize") ||
|
11762 |
+
dom.computedStyle(this.container, "fontSize");
|
11763 |
+
};
|
11764 |
+
this.setFontSize = function(size) {
|
11765 |
+
this.setOption("fontSize", size);
|
11766 |
+
};
|
11767 |
+
|
11768 |
+
this.$highlightBrackets = function() {
|
11769 |
+
if (this.session.$bracketHighlight) {
|
11770 |
+
this.session.removeMarker(this.session.$bracketHighlight);
|
11771 |
+
this.session.$bracketHighlight = null;
|
11772 |
+
}
|
11773 |
+
|
11774 |
+
if (this.$highlightPending) {
|
11775 |
+
return;
|
11776 |
+
}
|
11777 |
+
var self = this;
|
11778 |
+
this.$highlightPending = true;
|
11779 |
+
setTimeout(function() {
|
11780 |
+
self.$highlightPending = false;
|
11781 |
+
var session = self.session;
|
11782 |
+
if (!session || !session.bgTokenizer) return;
|
11783 |
+
var pos = session.findMatchingBracket(self.getCursorPosition());
|
11784 |
+
if (pos) {
|
11785 |
+
var range = new Range(pos.row, pos.column, pos.row, pos.column + 1);
|
11786 |
+
} else if (session.$mode.getMatching) {
|
11787 |
+
var range = session.$mode.getMatching(self.session);
|
11788 |
+
}
|
11789 |
+
if (range)
|
11790 |
+
session.$bracketHighlight = session.addMarker(range, "ace_bracket", "text");
|
11791 |
+
}, 50);
|
11792 |
+
};
|
11793 |
+
this.$highlightTags = function() {
|
11794 |
+
if (this.$highlightTagPending)
|
11795 |
+
return;
|
11796 |
+
var self = this;
|
11797 |
+
this.$highlightTagPending = true;
|
11798 |
+
setTimeout(function() {
|
11799 |
+
self.$highlightTagPending = false;
|
11800 |
+
|
11801 |
+
var session = self.session;
|
11802 |
+
if (!session || !session.bgTokenizer) return;
|
11803 |
+
|
11804 |
+
var pos = self.getCursorPosition();
|
11805 |
+
var iterator = new TokenIterator(self.session, pos.row, pos.column);
|
11806 |
+
var token = iterator.getCurrentToken();
|
11807 |
+
|
11808 |
+
if (!token || token.type.indexOf('tag-name') === -1) {
|
11809 |
+
session.removeMarker(session.$tagHighlight);
|
11810 |
+
session.$tagHighlight = null;
|
11811 |
+
return;
|
11812 |
+
}
|
11813 |
+
|
11814 |
+
var tag = token.value;
|
11815 |
+
var depth = 0;
|
11816 |
+
var prevToken = iterator.stepBackward();
|
11817 |
+
|
11818 |
+
if (prevToken.value == '<') {
|
11819 |
+
do {
|
11820 |
+
prevToken = token;
|
11821 |
+
token = iterator.stepForward();
|
11822 |
+
|
11823 |
+
if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) {
|
11824 |
+
if (prevToken.value === '<') {
|
11825 |
+
depth++;
|
11826 |
+
} else if (prevToken.value === '</') {
|
11827 |
+
depth--;
|
11828 |
+
}
|
11829 |
+
}
|
11830 |
+
|
11831 |
+
} while (token && depth >= 0);
|
11832 |
+
} else {
|
11833 |
+
do {
|
11834 |
+
token = prevToken;
|
11835 |
+
prevToken = iterator.stepBackward();
|
11836 |
+
|
11837 |
+
if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) {
|
11838 |
+
if (prevToken.value === '<') {
|
11839 |
+
depth++;
|
11840 |
+
} else if (prevToken.value === '</') {
|
11841 |
+
depth--;
|
11842 |
+
}
|
11843 |
+
}
|
11844 |
+
} while (prevToken && depth <= 0);
|
11845 |
+
iterator.stepForward();
|
11846 |
+
}
|
11847 |
+
|
11848 |
+
if (!token) {
|
11849 |
+
session.removeMarker(session.$tagHighlight);
|
11850 |
+
session.$tagHighlight = null;
|
11851 |
+
return;
|
11852 |
+
}
|
11853 |
+
|
11854 |
+
var row = iterator.getCurrentTokenRow();
|
11855 |
+
var column = iterator.getCurrentTokenColumn();
|
11856 |
+
var range = new Range(row, column, row, column + token.value.length);
|
11857 |
+
if (session.$tagHighlight && range.compareRange(session.$backMarkers[session.$tagHighlight].range) !== 0) {
|
11858 |
+
session.removeMarker(session.$tagHighlight);
|
11859 |
+
session.$tagHighlight = null;
|
11860 |
+
}
|
11861 |
+
|
11862 |
+
if (range && !session.$tagHighlight)
|
11863 |
+
session.$tagHighlight = session.addMarker(range, "ace_bracket", "text");
|
11864 |
+
}, 50);
|
11865 |
+
};
|
11866 |
+
this.focus = function() {
|
11867 |
+
var _self = this;
|
11868 |
+
setTimeout(function() {
|
11869 |
+
_self.textInput.focus();
|
11870 |
+
});
|
11871 |
+
this.textInput.focus();
|
11872 |
+
};
|
11873 |
+
this.isFocused = function() {
|
11874 |
+
return this.textInput.isFocused();
|
11875 |
+
};
|
11876 |
+
this.blur = function() {
|
11877 |
+
this.textInput.blur();
|
11878 |
+
};
|
11879 |
+
this.onFocus = function(e) {
|
11880 |
+
if (this.$isFocused)
|
11881 |
+
return;
|
11882 |
+
this.$isFocused = true;
|
11883 |
+
this.renderer.showCursor();
|
11884 |
+
this.renderer.visualizeFocus();
|
11885 |
+
this._emit("focus", e);
|
11886 |
+
};
|
11887 |
+
this.onBlur = function(e) {
|
11888 |
+
if (!this.$isFocused)
|
11889 |
+
return;
|
11890 |
+
this.$isFocused = false;
|
11891 |
+
this.renderer.hideCursor();
|
11892 |
+
this.renderer.visualizeBlur();
|
11893 |
+
this._emit("blur", e);
|
11894 |
+
};
|
11895 |
+
|
11896 |
+
this.$cursorChange = function() {
|
11897 |
+
this.renderer.updateCursor();
|
11898 |
+
};
|
11899 |
+
this.onDocumentChange = function(e) {
|
11900 |
+
var delta = e.data;
|
11901 |
+
var range = delta.range;
|
11902 |
+
var lastRow;
|
11903 |
+
|
11904 |
+
if (range.start.row == range.end.row && delta.action != "insertLines" && delta.action != "removeLines")
|
11905 |
+
lastRow = range.end.row;
|
11906 |
+
else
|
11907 |
+
lastRow = Infinity;
|
11908 |
+
this.renderer.updateLines(range.start.row, lastRow, this.session.$useWrapMode);
|
11909 |
+
|
11910 |
+
this._signal("change", e);
|
11911 |
+
this.$cursorChange();
|
11912 |
+
this.$updateHighlightActiveLine();
|
11913 |
+
};
|
11914 |
+
|
11915 |
+
this.onTokenizerUpdate = function(e) {
|
11916 |
+
var rows = e.data;
|
11917 |
+
this.renderer.updateLines(rows.first, rows.last);
|
11918 |
+
};
|
11919 |
+
|
11920 |
+
|
11921 |
+
this.onScrollTopChange = function() {
|
11922 |
+
this.renderer.scrollToY(this.session.getScrollTop());
|
11923 |
+
};
|
11924 |
+
|
11925 |
+
this.onScrollLeftChange = function() {
|
11926 |
+
this.renderer.scrollToX(this.session.getScrollLeft());
|
11927 |
+
};
|
11928 |
+
this.onCursorChange = function() {
|
11929 |
+
this.$cursorChange();
|
11930 |
+
|
11931 |
+
if (!this.$blockScrolling) {
|
11932 |
+
this.renderer.scrollCursorIntoView();
|
11933 |
+
}
|
11934 |
+
|
11935 |
+
this.$highlightBrackets();
|
11936 |
+
this.$highlightTags();
|
11937 |
+
this.$updateHighlightActiveLine();
|
11938 |
+
this._signal("changeSelection");
|
11939 |
+
};
|
11940 |
+
|
11941 |
+
this.$updateHighlightActiveLine = function() {
|
11942 |
+
var session = this.getSession();
|
11943 |
+
|
11944 |
+
var highlight;
|
11945 |
+
if (this.$highlightActiveLine) {
|
11946 |
+
if ((this.$selectionStyle != "line" || !this.selection.isMultiLine()))
|
11947 |
+
highlight = this.getCursorPosition();
|
11948 |
+
if (this.renderer.$maxLines && this.session.getLength() === 1 && !(this.renderer.$minLines > 1))
|
11949 |
+
highlight = false;
|
11950 |
+
}
|
11951 |
+
|
11952 |
+
if (session.$highlightLineMarker && !highlight) {
|
11953 |
+
session.removeMarker(session.$highlightLineMarker.id);
|
11954 |
+
session.$highlightLineMarker = null;
|
11955 |
+
} else if (!session.$highlightLineMarker && highlight) {
|
11956 |
+
var range = new Range(highlight.row, highlight.column, highlight.row, Infinity);
|
11957 |
+
range.id = session.addMarker(range, "ace_active-line", "screenLine");
|
11958 |
+
session.$highlightLineMarker = range;
|
11959 |
+
} else if (highlight) {
|
11960 |
+
session.$highlightLineMarker.start.row = highlight.row;
|
11961 |
+
session.$highlightLineMarker.end.row = highlight.row;
|
11962 |
+
session.$highlightLineMarker.start.column = highlight.column;
|
11963 |
+
session._signal("changeBackMarker");
|
11964 |
+
}
|
11965 |
+
};
|
11966 |
+
|
11967 |
+
this.onSelectionChange = function(e) {
|
11968 |
+
var session = this.session;
|
11969 |
+
|
11970 |
+
if (session.$selectionMarker) {
|
11971 |
+
session.removeMarker(session.$selectionMarker);
|
11972 |
+
}
|
11973 |
+
session.$selectionMarker = null;
|
11974 |
+
|
11975 |
+
if (!this.selection.isEmpty()) {
|
11976 |
+
var range = this.selection.getRange();
|
11977 |
+
var style = this.getSelectionStyle();
|
11978 |
+
session.$selectionMarker = session.addMarker(range, "ace_selection", style);
|
11979 |
+
} else {
|
11980 |
+
this.$updateHighlightActiveLine();
|
11981 |
+
}
|
11982 |
+
|
11983 |
+
var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp();
|
11984 |
+
this.session.highlight(re);
|
11985 |
+
|
11986 |
+
this._signal("changeSelection");
|
11987 |
+
};
|
11988 |
+
|
11989 |
+
this.$getSelectionHighLightRegexp = function() {
|
11990 |
+
var session = this.session;
|
11991 |
+
|
11992 |
+
var selection = this.getSelectionRange();
|
11993 |
+
if (selection.isEmpty() || selection.isMultiLine())
|
11994 |
+
return;
|
11995 |
+
|
11996 |
+
var startOuter = selection.start.column - 1;
|
11997 |
+
var endOuter = selection.end.column + 1;
|
11998 |
+
var line = session.getLine(selection.start.row);
|
11999 |
+
var lineCols = line.length;
|
12000 |
+
var needle = line.substring(Math.max(startOuter, 0),
|
12001 |
+
Math.min(endOuter, lineCols));
|
12002 |
+
if ((startOuter >= 0 && /^[\w\d]/.test(needle)) ||
|
12003 |
+
(endOuter <= lineCols && /[\w\d]$/.test(needle)))
|
12004 |
+
return;
|
12005 |
+
|
12006 |
+
needle = line.substring(selection.start.column, selection.end.column);
|
12007 |
+
if (!/^[\w\d]+$/.test(needle))
|
12008 |
+
return;
|
12009 |
+
|
12010 |
+
var re = this.$search.$assembleRegExp({
|
12011 |
+
wholeWord: true,
|
12012 |
+
caseSensitive: true,
|
12013 |
+
needle: needle
|
12014 |
+
});
|
12015 |
+
|
12016 |
+
return re;
|
12017 |
+
};
|
12018 |
+
|
12019 |
+
|
12020 |
+
this.onChangeFrontMarker = function() {
|
12021 |
+
this.renderer.updateFrontMarkers();
|
12022 |
+
};
|
12023 |
+
|
12024 |
+
this.onChangeBackMarker = function() {
|
12025 |
+
this.renderer.updateBackMarkers();
|
12026 |
+
};
|
12027 |
+
|
12028 |
+
|
12029 |
+
this.onChangeBreakpoint = function() {
|
12030 |
+
this.renderer.updateBreakpoints();
|
12031 |
+
};
|
12032 |
+
|
12033 |
+
this.onChangeAnnotation = function() {
|
12034 |
+
this.renderer.setAnnotations(this.session.getAnnotations());
|
12035 |
+
};
|
12036 |
+
|
12037 |
+
|
12038 |
+
this.onChangeMode = function(e) {
|
12039 |
+
this.renderer.updateText();
|
12040 |
+
this._emit("changeMode", e);
|
12041 |
+
};
|
12042 |
+
|
12043 |
+
|
12044 |
+
this.onChangeWrapLimit = function() {
|
12045 |
+
this.renderer.updateFull();
|
12046 |
+
};
|
12047 |
+
|
12048 |
+
this.onChangeWrapMode = function() {
|
12049 |
+
this.renderer.onResize(true);
|
12050 |
+
};
|
12051 |
+
|
12052 |
+
|
12053 |
+
this.onChangeFold = function() {
|
12054 |
+
this.$updateHighlightActiveLine();
|
12055 |
+
this.renderer.updateFull();
|
12056 |
+
};
|
12057 |
+
this.getSelectedText = function() {
|
12058 |
+
return this.session.getTextRange(this.getSelectionRange());
|
12059 |
+
};
|
12060 |
+
this.getCopyText = function() {
|
12061 |
+
var text = this.getSelectedText();
|
12062 |
+
this._signal("copy", text);
|
12063 |
+
return text;
|
12064 |
+
};
|
12065 |
+
this.onCopy = function() {
|
12066 |
+
this.commands.exec("copy", this);
|
12067 |
+
};
|
12068 |
+
this.onCut = function() {
|
12069 |
+
this.commands.exec("cut", this);
|
12070 |
+
};
|
12071 |
+
this.onPaste = function(text) {
|
12072 |
+
if (this.$readOnly)
|
12073 |
+
return;
|
12074 |
+
var e = {
|
12075 |
+
text: text
|
12076 |
+
};
|
12077 |
+
this._signal("paste", e);
|
12078 |
+
this.insert(e.text, true);
|
12079 |
+
};
|
12080 |
+
|
12081 |
+
this.execCommand = function(command, args) {
|
12082 |
+
return this.commands.exec(command, this, args);
|
12083 |
+
};
|
12084 |
+
this.insert = function(text, pasted) {
|
12085 |
+
var session = this.session;
|
12086 |
+
var mode = session.getMode();
|
12087 |
+
var cursor = this.getCursorPosition();
|
12088 |
+
|
12089 |
+
if (this.getBehavioursEnabled() && !pasted) {
|
12090 |
+
var transform = mode.transformAction(session.getState(cursor.row), 'insertion', this, session, text);
|
12091 |
+
if (transform) {
|
12092 |
+
if (text !== transform.text) {
|
12093 |
+
this.session.mergeUndoDeltas = false;
|
12094 |
+
this.$mergeNextCommand = false;
|
12095 |
+
}
|
12096 |
+
text = transform.text;
|
12097 |
+
|
12098 |
+
}
|
12099 |
+
}
|
12100 |
+
|
12101 |
+
if (text == "\t")
|
12102 |
+
text = this.session.getTabString();
|
12103 |
+
if (!this.selection.isEmpty()) {
|
12104 |
+
var range = this.getSelectionRange();
|
12105 |
+
cursor = this.session.remove(range);
|
12106 |
+
this.clearSelection();
|
12107 |
+
} else if (this.session.getOverwrite()) {
|
12108 |
+
var range = new Range.fromPoints(cursor, cursor);
|
12109 |
+
range.end.column += text.length;
|
12110 |
+
this.session.remove(range);
|
12111 |
+
}
|
12112 |
+
|
12113 |
+
if (text == "\n" || text == "\r\n") {
|
12114 |
+
var line = session.getLine(cursor.row);
|
12115 |
+
if (cursor.column > line.search(/\S|$/)) {
|
12116 |
+
var d = line.substr(cursor.column).search(/\S|$/);
|
12117 |
+
session.doc.removeInLine(cursor.row, cursor.column, cursor.column + d);
|
12118 |
+
}
|
12119 |
+
}
|
12120 |
+
this.clearSelection();
|
12121 |
+
|
12122 |
+
var start = cursor.column;
|
12123 |
+
var lineState = session.getState(cursor.row);
|
12124 |
+
var line = session.getLine(cursor.row);
|
12125 |
+
var shouldOutdent = mode.checkOutdent(lineState, line, text);
|
12126 |
+
var end = session.insert(cursor, text);
|
12127 |
+
|
12128 |
+
if (transform && transform.selection) {
|
12129 |
+
if (transform.selection.length == 2) { // Transform relative to the current column
|
12130 |
+
this.selection.setSelectionRange(
|
12131 |
+
new Range(cursor.row, start + transform.selection[0],
|
12132 |
+
cursor.row, start + transform.selection[1]));
|
12133 |
+
} else { // Transform relative to the current row.
|
12134 |
+
this.selection.setSelectionRange(
|
12135 |
+
new Range(cursor.row + transform.selection[0],
|
12136 |
+
transform.selection[1],
|
12137 |
+
cursor.row + transform.selection[2],
|
12138 |
+
transform.selection[3]));
|
12139 |
+
}
|
12140 |
+
}
|
12141 |
+
|
12142 |
+
if (session.getDocument().isNewLine(text)) {
|
12143 |
+
var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
|
12144 |
+
|
12145 |
+
session.insert({
|
12146 |
+
row: cursor.row + 1,
|
12147 |
+
column: 0
|
12148 |
+
}, lineIndent);
|
12149 |
+
}
|
12150 |
+
if (shouldOutdent)
|
12151 |
+
mode.autoOutdent(lineState, session, cursor.row);
|
12152 |
+
};
|
12153 |
+
|
12154 |
+
this.onTextInput = function(text) {
|
12155 |
+
this.keyBinding.onTextInput(text);
|
12156 |
+
};
|
12157 |
+
|
12158 |
+
this.onCommandKey = function(e, hashId, keyCode) {
|
12159 |
+
this.keyBinding.onCommandKey(e, hashId, keyCode);
|
12160 |
+
};
|
12161 |
+
this.setOverwrite = function(overwrite) {
|
12162 |
+
this.session.setOverwrite(overwrite);
|
12163 |
+
};
|
12164 |
+
this.getOverwrite = function() {
|
12165 |
+
return this.session.getOverwrite();
|
12166 |
+
};
|
12167 |
+
this.toggleOverwrite = function() {
|
12168 |
+
this.session.toggleOverwrite();
|
12169 |
+
};
|
12170 |
+
this.setScrollSpeed = function(speed) {
|
12171 |
+
this.setOption("scrollSpeed", speed);
|
12172 |
+
};
|
12173 |
+
this.getScrollSpeed = function() {
|
12174 |
+
return this.getOption("scrollSpeed");
|
12175 |
+
};
|
12176 |
+
this.setDragDelay = function(dragDelay) {
|
12177 |
+
this.setOption("dragDelay", dragDelay);
|
12178 |
+
};
|
12179 |
+
this.getDragDelay = function() {
|
12180 |
+
return this.getOption("dragDelay");
|
12181 |
+
};
|
12182 |
+
this.setSelectionStyle = function(val) {
|
12183 |
+
this.setOption("selectionStyle", val);
|
12184 |
+
};
|
12185 |
+
this.getSelectionStyle = function() {
|
12186 |
+
return this.getOption("selectionStyle");
|
12187 |
+
};
|
12188 |
+
this.setHighlightActiveLine = function(shouldHighlight) {
|
12189 |
+
this.setOption("highlightActiveLine", shouldHighlight);
|
12190 |
+
};
|
12191 |
+
this.getHighlightActiveLine = function() {
|
12192 |
+
return this.getOption("highlightActiveLine");
|
12193 |
+
};
|
12194 |
+
this.setHighlightGutterLine = function(shouldHighlight) {
|
12195 |
+
this.setOption("highlightGutterLine", shouldHighlight);
|
12196 |
+
};
|
12197 |
+
|
12198 |
+
this.getHighlightGutterLine = function() {
|
12199 |
+
return this.getOption("highlightGutterLine");
|
12200 |
+
};
|
12201 |
+
this.setHighlightSelectedWord = function(shouldHighlight) {
|
12202 |
+
this.setOption("highlightSelectedWord", shouldHighlight);
|
12203 |
+
};
|
12204 |
+
this.getHighlightSelectedWord = function() {
|
12205 |
+
return this.$highlightSelectedWord;
|
12206 |
+
};
|
12207 |
+
|
12208 |
+
this.setAnimatedScroll = function(shouldAnimate) {
|
12209 |
+
this.renderer.setAnimatedScroll(shouldAnimate);
|
12210 |
+
};
|
12211 |
+
|
12212 |
+
this.getAnimatedScroll = function() {
|
12213 |
+
return this.renderer.getAnimatedScroll();
|
12214 |
+
};
|
12215 |
+
this.setShowInvisibles = function(showInvisibles) {
|
12216 |
+
this.renderer.setShowInvisibles(showInvisibles);
|
12217 |
+
};
|
12218 |
+
this.getShowInvisibles = function() {
|
12219 |
+
return this.renderer.getShowInvisibles();
|
12220 |
+
};
|
12221 |
+
|
12222 |
+
this.setDisplayIndentGuides = function(display) {
|
12223 |
+
this.renderer.setDisplayIndentGuides(display);
|
12224 |
+
};
|
12225 |
+
|
12226 |
+
this.getDisplayIndentGuides = function() {
|
12227 |
+
return this.renderer.getDisplayIndentGuides();
|
12228 |
+
};
|
12229 |
+
this.setShowPrintMargin = function(showPrintMargin) {
|
12230 |
+
this.renderer.setShowPrintMargin(showPrintMargin);
|
12231 |
+
};
|
12232 |
+
this.getShowPrintMargin = function() {
|
12233 |
+
return this.renderer.getShowPrintMargin();
|
12234 |
+
};
|
12235 |
+
this.setPrintMarginColumn = function(showPrintMargin) {
|
12236 |
+
this.renderer.setPrintMarginColumn(showPrintMargin);
|
12237 |
+
};
|
12238 |
+
this.getPrintMarginColumn = function() {
|
12239 |
+
return this.renderer.getPrintMarginColumn();
|
12240 |
+
};
|
12241 |
+
this.setReadOnly = function(readOnly) {
|
12242 |
+
this.setOption("readOnly", readOnly);
|
12243 |
+
};
|
12244 |
+
this.getReadOnly = function() {
|
12245 |
+
return this.getOption("readOnly");
|
12246 |
+
};
|
12247 |
+
this.setBehavioursEnabled = function(enabled) {
|
12248 |
+
this.setOption("behavioursEnabled", enabled);
|
12249 |
+
};
|
12250 |
+
this.getBehavioursEnabled = function() {
|
12251 |
+
return this.getOption("behavioursEnabled");
|
12252 |
+
};
|
12253 |
+
this.setWrapBehavioursEnabled = function(enabled) {
|
12254 |
+
this.setOption("wrapBehavioursEnabled", enabled);
|
12255 |
+
};
|
12256 |
+
this.getWrapBehavioursEnabled = function() {
|
12257 |
+
return this.getOption("wrapBehavioursEnabled");
|
12258 |
+
};
|
12259 |
+
this.setShowFoldWidgets = function(show) {
|
12260 |
+
this.setOption("showFoldWidgets", show);
|
12261 |
+
|
12262 |
+
};
|
12263 |
+
this.getShowFoldWidgets = function() {
|
12264 |
+
return this.getOption("showFoldWidgets");
|
12265 |
+
};
|
12266 |
+
|
12267 |
+
this.setFadeFoldWidgets = function(fade) {
|
12268 |
+
this.setOption("fadeFoldWidgets", fade);
|
12269 |
+
};
|
12270 |
+
|
12271 |
+
this.getFadeFoldWidgets = function() {
|
12272 |
+
return this.getOption("fadeFoldWidgets");
|
12273 |
+
};
|
12274 |
+
this.remove = function(dir) {
|
12275 |
+
if (this.selection.isEmpty()) {
|
12276 |
+
if (dir == "left")
|
12277 |
+
this.selection.selectLeft();
|
12278 |
+
else
|
12279 |
+
this.selection.selectRight();
|
12280 |
+
}
|
12281 |
+
|
12282 |
+
var range = this.getSelectionRange();
|
12283 |
+
if (this.getBehavioursEnabled()) {
|
12284 |
+
var session = this.session;
|
12285 |
+
var state = session.getState(range.start.row);
|
12286 |
+
var new_range = session.getMode().transformAction(state, 'deletion', this, session, range);
|
12287 |
+
|
12288 |
+
if (range.end.column === 0) {
|
12289 |
+
var text = session.getTextRange(range);
|
12290 |
+
if (text[text.length - 1] == "\n") {
|
12291 |
+
var line = session.getLine(range.end.row);
|
12292 |
+
if (/^\s+$/.test(line)) {
|
12293 |
+
range.end.column = line.length;
|
12294 |
+
}
|
12295 |
+
}
|
12296 |
+
}
|
12297 |
+
if (new_range)
|
12298 |
+
range = new_range;
|
12299 |
+
}
|
12300 |
+
|
12301 |
+
this.session.remove(range);
|
12302 |
+
this.clearSelection();
|
12303 |
+
};
|
12304 |
+
this.removeWordRight = function() {
|
12305 |
+
if (this.selection.isEmpty())
|
12306 |
+
this.selection.selectWordRight();
|
12307 |
+
|
12308 |
+
this.session.remove(this.getSelectionRange());
|
12309 |
+
this.clearSelection();
|
12310 |
+
};
|
12311 |
+
this.removeWordLeft = function() {
|
12312 |
+
if (this.selection.isEmpty())
|
12313 |
+
this.selection.selectWordLeft();
|
12314 |
+
|
12315 |
+
this.session.remove(this.getSelectionRange());
|
12316 |
+
this.clearSelection();
|
12317 |
+
};
|
12318 |
+
this.removeToLineStart = function() {
|
12319 |
+
if (this.selection.isEmpty())
|
12320 |
+
this.selection.selectLineStart();
|
12321 |
+
|
12322 |
+
this.session.remove(this.getSelectionRange());
|
12323 |
+
this.clearSelection();
|
12324 |
+
};
|
12325 |
+
this.removeToLineEnd = function() {
|
12326 |
+
if (this.selection.isEmpty())
|
12327 |
+
this.selection.selectLineEnd();
|
12328 |
+
|
12329 |
+
var range = this.getSelectionRange();
|
12330 |
+
if (range.start.column == range.end.column && range.start.row == range.end.row) {
|
12331 |
+
range.end.column = 0;
|
12332 |
+
range.end.row++;
|
12333 |
+
}
|
12334 |
+
|
12335 |
+
this.session.remove(range);
|
12336 |
+
this.clearSelection();
|
12337 |
+
};
|
12338 |
+
this.splitLine = function() {
|
12339 |
+
if (!this.selection.isEmpty()) {
|
12340 |
+
this.session.remove(this.getSelectionRange());
|
12341 |
+
this.clearSelection();
|
12342 |
+
}
|
12343 |
+
|
12344 |
+
var cursor = this.getCursorPosition();
|
12345 |
+
this.insert("\n");
|
12346 |
+
this.moveCursorToPosition(cursor);
|
12347 |
+
};
|
12348 |
+
this.transposeLetters = function() {
|
12349 |
+
if (!this.selection.isEmpty()) {
|
12350 |
+
return;
|
12351 |
+
}
|
12352 |
+
|
12353 |
+
var cursor = this.getCursorPosition();
|
12354 |
+
var column = cursor.column;
|
12355 |
+
if (column === 0)
|
12356 |
+
return;
|
12357 |
+
|
12358 |
+
var line = this.session.getLine(cursor.row);
|
12359 |
+
var swap, range;
|
12360 |
+
if (column < line.length) {
|
12361 |
+
swap = line.charAt(column) + line.charAt(column - 1);
|
12362 |
+
range = new Range(cursor.row, column - 1, cursor.row, column + 1);
|
12363 |
+
} else {
|
12364 |
+
swap = line.charAt(column - 1) + line.charAt(column - 2);
|
12365 |
+
range = new Range(cursor.row, column - 2, cursor.row, column);
|
12366 |
+
}
|
12367 |
+
this.session.replace(range, swap);
|
12368 |
+
};
|
12369 |
+
this.toLowerCase = function() {
|
12370 |
+
var originalRange = this.getSelectionRange();
|
12371 |
+
if (this.selection.isEmpty()) {
|
12372 |
+
this.selection.selectWord();
|
12373 |
+
}
|
12374 |
+
|
12375 |
+
var range = this.getSelectionRange();
|
12376 |
+
var text = this.session.getTextRange(range);
|
12377 |
+
this.session.replace(range, text.toLowerCase());
|
12378 |
+
this.selection.setSelectionRange(originalRange);
|
12379 |
+
};
|
12380 |
+
this.toUpperCase = function() {
|
12381 |
+
var originalRange = this.getSelectionRange();
|
12382 |
+
if (this.selection.isEmpty()) {
|
12383 |
+
this.selection.selectWord();
|
12384 |
+
}
|
12385 |
+
|
12386 |
+
var range = this.getSelectionRange();
|
12387 |
+
var text = this.session.getTextRange(range);
|
12388 |
+
this.session.replace(range, text.toUpperCase());
|
12389 |
+
this.selection.setSelectionRange(originalRange);
|
12390 |
+
};
|
12391 |
+
this.indent = function() {
|
12392 |
+
var session = this.session;
|
12393 |
+
var range = this.getSelectionRange();
|
12394 |
+
|
12395 |
+
if (range.start.row < range.end.row) {
|
12396 |
+
var rows = this.$getSelectedRows();
|
12397 |
+
session.indentRows(rows.first, rows.last, "\t");
|
12398 |
+
return;
|
12399 |
+
} else if (range.start.column < range.end.column) {
|
12400 |
+
var text = session.getTextRange(range);
|
12401 |
+
if (!/^\s+$/.test(text)) {
|
12402 |
+
var rows = this.$getSelectedRows();
|
12403 |
+
session.indentRows(rows.first, rows.last, "\t");
|
12404 |
+
return;
|
12405 |
+
}
|
12406 |
+
}
|
12407 |
+
|
12408 |
+
var line = session.getLine(range.start.row);
|
12409 |
+
var position = range.start;
|
12410 |
+
var size = session.getTabSize();
|
12411 |
+
var column = session.documentToScreenColumn(position.row, position.column);
|
12412 |
+
|
12413 |
+
if (this.session.getUseSoftTabs()) {
|
12414 |
+
var count = (size - column % size);
|
12415 |
+
var indentString = lang.stringRepeat(" ", count);
|
12416 |
+
} else {
|
12417 |
+
var count = column % size;
|
12418 |
+
while (line[range.start.column] == " " && count) {
|
12419 |
+
range.start.column--;
|
12420 |
+
count--;
|
12421 |
+
}
|
12422 |
+
this.selection.setSelectionRange(range);
|
12423 |
+
indentString = "\t";
|
12424 |
+
}
|
12425 |
+
return this.insert(indentString);
|
12426 |
+
};
|
12427 |
+
this.blockIndent = function() {
|
12428 |
+
var rows = this.$getSelectedRows();
|
12429 |
+
this.session.indentRows(rows.first, rows.last, "\t");
|
12430 |
+
};
|
12431 |
+
this.blockOutdent = function() {
|
12432 |
+
var selection = this.session.getSelection();
|
12433 |
+
this.session.outdentRows(selection.getRange());
|
12434 |
+
};
|
12435 |
+
this.sortLines = function() {
|
12436 |
+
var rows = this.$getSelectedRows();
|
12437 |
+
var session = this.session;
|
12438 |
+
|
12439 |
+
var lines = [];
|
12440 |
+
for (i = rows.first; i <= rows.last; i++)
|
12441 |
+
lines.push(session.getLine(i));
|
12442 |
+
|
12443 |
+
lines.sort(function(a, b) {
|
12444 |
+
if (a.toLowerCase() < b.toLowerCase()) return -1;
|
12445 |
+
if (a.toLowerCase() > b.toLowerCase()) return 1;
|
12446 |
+
return 0;
|
12447 |
+
});
|
12448 |
+
|
12449 |
+
var deleteRange = new Range(0, 0, 0, 0);
|
12450 |
+
for (var i = rows.first; i <= rows.last; i++) {
|
12451 |
+
var line = session.getLine(i);
|
12452 |
+
deleteRange.start.row = i;
|
12453 |
+
deleteRange.end.row = i;
|
12454 |
+
deleteRange.end.column = line.length;
|
12455 |
+
session.replace(deleteRange, lines[i - rows.first]);
|
12456 |
+
}
|
12457 |
+
};
|
12458 |
+
this.toggleCommentLines = function() {
|
12459 |
+
var state = this.session.getState(this.getCursorPosition().row);
|
12460 |
+
var rows = this.$getSelectedRows();
|
12461 |
+
this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);
|
12462 |
+
};
|
12463 |
+
|
12464 |
+
this.toggleBlockComment = function() {
|
12465 |
+
var cursor = this.getCursorPosition();
|
12466 |
+
var state = this.session.getState(cursor.row);
|
12467 |
+
var range = this.getSelectionRange();
|
12468 |
+
this.session.getMode().toggleBlockComment(state, this.session, range, cursor);
|
12469 |
+
};
|
12470 |
+
this.getNumberAt = function(row, column) {
|
12471 |
+
var _numberRx = /[\-]?[0-9]+(?:\.[0-9]+)?/g;
|
12472 |
+
_numberRx.lastIndex = 0;
|
12473 |
+
|
12474 |
+
var s = this.session.getLine(row);
|
12475 |
+
while (_numberRx.lastIndex < column) {
|
12476 |
+
var m = _numberRx.exec(s);
|
12477 |
+
if (m.index <= column && m.index + m[0].length >= column) {
|
12478 |
+
var number = {
|
12479 |
+
value: m[0],
|
12480 |
+
start: m.index,
|
12481 |
+
end: m.index + m[0].length
|
12482 |
+
};
|
12483 |
+
return number;
|
12484 |
+
}
|
12485 |
+
}
|
12486 |
+
return null;
|
12487 |
+
};
|
12488 |
+
this.modifyNumber = function(amount) {
|
12489 |
+
var row = this.selection.getCursor().row;
|
12490 |
+
var column = this.selection.getCursor().column;
|
12491 |
+
var charRange = new Range(row, column - 1, row, column);
|
12492 |
+
|
12493 |
+
var c = this.session.getTextRange(charRange);
|
12494 |
+
if (!isNaN(parseFloat(c)) && isFinite(c)) {
|
12495 |
+
var nr = this.getNumberAt(row, column);
|
12496 |
+
if (nr) {
|
12497 |
+
var fp = nr.value.indexOf(".") >= 0 ? nr.start + nr.value.indexOf(".") + 1 : nr.end;
|
12498 |
+
var decimals = nr.start + nr.value.length - fp;
|
12499 |
+
|
12500 |
+
var t = parseFloat(nr.value);
|
12501 |
+
t *= Math.pow(10, decimals);
|
12502 |
+
|
12503 |
+
|
12504 |
+
if (fp !== nr.end && column < fp) {
|
12505 |
+
amount *= Math.pow(10, nr.end - column - 1);
|
12506 |
+
} else {
|
12507 |
+
amount *= Math.pow(10, nr.end - column);
|
12508 |
+
}
|
12509 |
+
|
12510 |
+
t += amount;
|
12511 |
+
t /= Math.pow(10, decimals);
|
12512 |
+
var nnr = t.toFixed(decimals);
|
12513 |
+
var replaceRange = new Range(row, nr.start, row, nr.end);
|
12514 |
+
this.session.replace(replaceRange, nnr);
|
12515 |
+
this.moveCursorTo(row, Math.max(nr.start + 1, column + nnr.length - nr.value.length));
|
12516 |
+
|
12517 |
+
}
|
12518 |
+
}
|
12519 |
+
};
|
12520 |
+
this.removeLines = function() {
|
12521 |
+
var rows = this.$getSelectedRows();
|
12522 |
+
var range;
|
12523 |
+
if (rows.first === 0 || rows.last + 1 < this.session.getLength())
|
12524 |
+
range = new Range(rows.first, 0, rows.last + 1, 0);
|
12525 |
+
else
|
12526 |
+
range = new Range(
|
12527 |
+
rows.first - 1, this.session.getLine(rows.first - 1).length,
|
12528 |
+
rows.last, this.session.getLine(rows.last).length
|
12529 |
+
);
|
12530 |
+
this.session.remove(range);
|
12531 |
+
this.clearSelection();
|
12532 |
+
};
|
12533 |
+
|
12534 |
+
this.duplicateSelection = function() {
|
12535 |
+
var sel = this.selection;
|
12536 |
+
var doc = this.session;
|
12537 |
+
var range = sel.getRange();
|
12538 |
+
var reverse = sel.isBackwards();
|
12539 |
+
if (range.isEmpty()) {
|
12540 |
+
var row = range.start.row;
|
12541 |
+
doc.duplicateLines(row, row);
|
12542 |
+
} else {
|
12543 |
+
var point = reverse ? range.start : range.end;
|
12544 |
+
var endPoint = doc.insert(point, doc.getTextRange(range), false);
|
12545 |
+
range.start = point;
|
12546 |
+
range.end = endPoint;
|
12547 |
+
|
12548 |
+
sel.setSelectionRange(range, reverse);
|
12549 |
+
}
|
12550 |
+
};
|
12551 |
+
this.moveLinesDown = function() {
|
12552 |
+
this.$moveLines(function(firstRow, lastRow) {
|
12553 |
+
return this.session.moveLinesDown(firstRow, lastRow);
|
12554 |
+
});
|
12555 |
+
};
|
12556 |
+
this.moveLinesUp = function() {
|
12557 |
+
this.$moveLines(function(firstRow, lastRow) {
|
12558 |
+
return this.session.moveLinesUp(firstRow, lastRow);
|
12559 |
+
});
|
12560 |
+
};
|
12561 |
+
this.moveText = function(range, toPosition, copy) {
|
12562 |
+
return this.session.moveText(range, toPosition, copy);
|
12563 |
+
};
|
12564 |
+
this.copyLinesUp = function() {
|
12565 |
+
this.$moveLines(function(firstRow, lastRow) {
|
12566 |
+
this.session.duplicateLines(firstRow, lastRow);
|
12567 |
+
return 0;
|
12568 |
+
});
|
12569 |
+
};
|
12570 |
+
this.copyLinesDown = function() {
|
12571 |
+
this.$moveLines(function(firstRow, lastRow) {
|
12572 |
+
return this.session.duplicateLines(firstRow, lastRow);
|
12573 |
+
});
|
12574 |
+
};
|
12575 |
+
this.$moveLines = function(mover) {
|
12576 |
+
var selection = this.selection;
|
12577 |
+
if (!selection.inMultiSelectMode || this.inVirtualSelectionMode) {
|
12578 |
+
var range = selection.toOrientedRange();
|
12579 |
+
var rows = this.$getSelectedRows(range);
|
12580 |
+
var linesMoved = mover.call(this, rows.first, rows.last);
|
12581 |
+
range.moveBy(linesMoved, 0);
|
12582 |
+
selection.fromOrientedRange(range);
|
12583 |
+
} else {
|
12584 |
+
var ranges = selection.rangeList.ranges;
|
12585 |
+
selection.rangeList.detach(this.session);
|
12586 |
+
|
12587 |
+
for (var i = ranges.length; i--;) {
|
12588 |
+
var rangeIndex = i;
|
12589 |
+
var rows = ranges[i].collapseRows();
|
12590 |
+
var last = rows.end.row;
|
12591 |
+
var first = rows.start.row;
|
12592 |
+
while (i--) {
|
12593 |
+
rows = ranges[i].collapseRows();
|
12594 |
+
if (first - rows.end.row <= 1)
|
12595 |
+
first = rows.end.row;
|
12596 |
+
else
|
12597 |
+
break;
|
12598 |
+
}
|
12599 |
+
i++;
|
12600 |
+
|
12601 |
+
var linesMoved = mover.call(this, first, last);
|
12602 |
+
while (rangeIndex >= i) {
|
12603 |
+
ranges[rangeIndex].moveBy(linesMoved, 0);
|
12604 |
+
rangeIndex--;
|
12605 |
+
}
|
12606 |
+
}
|
12607 |
+
selection.fromOrientedRange(selection.ranges[0]);
|
12608 |
+
selection.rangeList.attach(this.session);
|
12609 |
+
}
|
12610 |
+
};
|
12611 |
+
this.$getSelectedRows = function() {
|
12612 |
+
var range = this.getSelectionRange().collapseRows();
|
12613 |
+
|
12614 |
+
return {
|
12615 |
+
first: this.session.getRowFoldStart(range.start.row),
|
12616 |
+
last: this.session.getRowFoldEnd(range.end.row)
|
12617 |
+
};
|
12618 |
+
};
|
12619 |
+
|
12620 |
+
this.onCompositionStart = function(text) {
|
12621 |
+
this.renderer.showComposition(this.getCursorPosition());
|
12622 |
+
};
|
12623 |
+
|
12624 |
+
this.onCompositionUpdate = function(text) {
|
12625 |
+
this.renderer.setCompositionText(text);
|
12626 |
+
};
|
12627 |
+
|
12628 |
+
this.onCompositionEnd = function() {
|
12629 |
+
this.renderer.hideComposition();
|
12630 |
+
};
|
12631 |
+
this.getFirstVisibleRow = function() {
|
12632 |
+
return this.renderer.getFirstVisibleRow();
|
12633 |
+
};
|
12634 |
+
this.getLastVisibleRow = function() {
|
12635 |
+
return this.renderer.getLastVisibleRow();
|
12636 |
+
};
|
12637 |
+
this.isRowVisible = function(row) {
|
12638 |
+
return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());
|
12639 |
+
};
|
12640 |
+
this.isRowFullyVisible = function(row) {
|
12641 |
+
return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow());
|
12642 |
+
};
|
12643 |
+
this.$getVisibleRowCount = function() {
|
12644 |
+
return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
|
12645 |
+
};
|
12646 |
+
|
12647 |
+
this.$moveByPage = function(dir, select) {
|
12648 |
+
var renderer = this.renderer;
|
12649 |
+
var config = this.renderer.layerConfig;
|
12650 |
+
var rows = dir * Math.floor(config.height / config.lineHeight);
|
12651 |
+
|
12652 |
+
this.$blockScrolling++;
|
12653 |
+
if (select === true) {
|
12654 |
+
this.selection.$moveSelection(function() {
|
12655 |
+
this.moveCursorBy(rows, 0);
|
12656 |
+
});
|
12657 |
+
} else if (select === false) {
|
12658 |
+
this.selection.moveCursorBy(rows, 0);
|
12659 |
+
this.selection.clearSelection();
|
12660 |
+
}
|
12661 |
+
this.$blockScrolling--;
|
12662 |
+
|
12663 |
+
var scrollTop = renderer.scrollTop;
|
12664 |
+
|
12665 |
+
renderer.scrollBy(0, rows * config.lineHeight);
|
12666 |
+
if (select != null)
|
12667 |
+
renderer.scrollCursorIntoView(null, 0.5);
|
12668 |
+
|
12669 |
+
renderer.animateScrolling(scrollTop);
|
12670 |
+
};
|
12671 |
+
this.selectPageDown = function() {
|
12672 |
+
this.$moveByPage(1, true);
|
12673 |
+
};
|
12674 |
+
this.selectPageUp = function() {
|
12675 |
+
this.$moveByPage(-1, true);
|
12676 |
+
};
|
12677 |
+
this.gotoPageDown = function() {
|
12678 |
+
this.$moveByPage(1, false);
|
12679 |
+
};
|
12680 |
+
this.gotoPageUp = function() {
|
12681 |
+
this.$moveByPage(-1, false);
|
12682 |
+
};
|
12683 |
+
this.scrollPageDown = function() {
|
12684 |
+
this.$moveByPage(1);
|
12685 |
+
};
|
12686 |
+
this.scrollPageUp = function() {
|
12687 |
+
this.$moveByPage(-1);
|
12688 |
+
};
|
12689 |
+
this.scrollToRow = function(row) {
|
12690 |
+
this.renderer.scrollToRow(row);
|
12691 |
+
};
|
12692 |
+
this.scrollToLine = function(line, center, animate, callback) {
|
12693 |
+
this.renderer.scrollToLine(line, center, animate, callback);
|
12694 |
+
};
|
12695 |
+
this.centerSelection = function() {
|
12696 |
+
var range = this.getSelectionRange();
|
12697 |
+
var pos = {
|
12698 |
+
row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2),
|
12699 |
+
column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2)
|
12700 |
+
};
|
12701 |
+
this.renderer.alignCursor(pos, 0.5);
|
12702 |
+
};
|
12703 |
+
this.getCursorPosition = function() {
|
12704 |
+
return this.selection.getCursor();
|
12705 |
+
};
|
12706 |
+
this.getCursorPositionScreen = function() {
|
12707 |
+
return this.session.documentToScreenPosition(this.getCursorPosition());
|
12708 |
+
};
|
12709 |
+
this.getSelectionRange = function() {
|
12710 |
+
return this.selection.getRange();
|
12711 |
+
};
|
12712 |
+
this.selectAll = function() {
|
12713 |
+
this.$blockScrolling += 1;
|
12714 |
+
this.selection.selectAll();
|
12715 |
+
this.$blockScrolling -= 1;
|
12716 |
+
};
|
12717 |
+
this.clearSelection = function() {
|
12718 |
+
this.selection.clearSelection();
|
12719 |
+
};
|
12720 |
+
this.moveCursorTo = function(row, column) {
|
12721 |
+
this.selection.moveCursorTo(row, column);
|
12722 |
+
};
|
12723 |
+
this.moveCursorToPosition = function(pos) {
|
12724 |
+
this.selection.moveCursorToPosition(pos);
|
12725 |
+
};
|
12726 |
+
this.jumpToMatching = function(select, expand) {
|
12727 |
+
var cursor = this.getCursorPosition();
|
12728 |
+
var iterator = new TokenIterator(this.session, cursor.row, cursor.column);
|
12729 |
+
var prevToken = iterator.getCurrentToken();
|
12730 |
+
var token = prevToken || iterator.stepForward();
|
12731 |
+
|
12732 |
+
if (!token) return;
|
12733 |
+
var matchType;
|
12734 |
+
var found = false;
|
12735 |
+
var depth = {};
|
12736 |
+
var i = cursor.column - token.start;
|
12737 |
+
var bracketType;
|
12738 |
+
var brackets = {
|
12739 |
+
")": "(",
|
12740 |
+
"(": "(",
|
12741 |
+
"]": "[",
|
12742 |
+
"[": "[",
|
12743 |
+
"{": "{",
|
12744 |
+
"}": "{"
|
12745 |
+
};
|
12746 |
+
|
12747 |
+
do {
|
12748 |
+
if (token.value.match(/[{}()\[\]]/g)) {
|
12749 |
+
for (; i < token.value.length && !found; i++) {
|
12750 |
+
if (!brackets[token.value[i]]) {
|
12751 |
+
continue;
|
12752 |
+
}
|
12753 |
+
|
12754 |
+
bracketType = brackets[token.value[i]] + '.' + token.type.replace("rparen", "lparen");
|
12755 |
+
|
12756 |
+
if (isNaN(depth[bracketType])) {
|
12757 |
+
depth[bracketType] = 0;
|
12758 |
+
}
|
12759 |
+
|
12760 |
+
switch (token.value[i]) {
|
12761 |
+
case '(':
|
12762 |
+
case '[':
|
12763 |
+
case '{':
|
12764 |
+
depth[bracketType]++;
|
12765 |
+
break;
|
12766 |
+
case ')':
|
12767 |
+
case ']':
|
12768 |
+
case '}':
|
12769 |
+
depth[bracketType]--;
|
12770 |
+
|
12771 |
+
if (depth[bracketType] === -1) {
|
12772 |
+
matchType = 'bracket';
|
12773 |
+
found = true;
|
12774 |
+
}
|
12775 |
+
break;
|
12776 |
+
}
|
12777 |
+
}
|
12778 |
+
} else if (token && token.type.indexOf('tag-name') !== -1) {
|
12779 |
+
if (isNaN(depth[token.value])) {
|
12780 |
+
depth[token.value] = 0;
|
12781 |
+
}
|
12782 |
+
|
12783 |
+
if (prevToken.value === '<') {
|
12784 |
+
depth[token.value]++;
|
12785 |
+
} else if (prevToken.value === '</') {
|
12786 |
+
depth[token.value]--;
|
12787 |
+
}
|
12788 |
+
|
12789 |
+
if (depth[token.value] === -1) {
|
12790 |
+
matchType = 'tag';
|
12791 |
+
found = true;
|
12792 |
+
}
|
12793 |
+
}
|
12794 |
+
|
12795 |
+
if (!found) {
|
12796 |
+
prevToken = token;
|
12797 |
+
token = iterator.stepForward();
|
12798 |
+
i = 0;
|
12799 |
+
}
|
12800 |
+
} while (token && !found);
|
12801 |
+
if (!matchType)
|
12802 |
+
return;
|
12803 |
+
|
12804 |
+
var range, pos;
|
12805 |
+
if (matchType === 'bracket') {
|
12806 |
+
range = this.session.getBracketRange(cursor);
|
12807 |
+
if (!range) {
|
12808 |
+
range = new Range(
|
12809 |
+
iterator.getCurrentTokenRow(),
|
12810 |
+
iterator.getCurrentTokenColumn() + i - 1,
|
12811 |
+
iterator.getCurrentTokenRow(),
|
12812 |
+
iterator.getCurrentTokenColumn() + i - 1
|
12813 |
+
);
|
12814 |
+
pos = range.start;
|
12815 |
+
if (expand || pos.row === cursor.row && Math.abs(pos.column - cursor.column) < 2)
|
12816 |
+
range = this.session.getBracketRange(pos);
|
12817 |
+
}
|
12818 |
+
} else if (matchType === 'tag') {
|
12819 |
+
if (token && token.type.indexOf('tag-name') !== -1)
|
12820 |
+
var tag = token.value;
|
12821 |
+
else
|
12822 |
+
return;
|
12823 |
+
|
12824 |
+
range = new Range(
|
12825 |
+
iterator.getCurrentTokenRow(),
|
12826 |
+
iterator.getCurrentTokenColumn() - 2,
|
12827 |
+
iterator.getCurrentTokenRow(),
|
12828 |
+
iterator.getCurrentTokenColumn() - 2
|
12829 |
+
);
|
12830 |
+
if (range.compare(cursor.row, cursor.column) === 0) {
|
12831 |
+
found = false;
|
12832 |
+
do {
|
12833 |
+
token = prevToken;
|
12834 |
+
prevToken = iterator.stepBackward();
|
12835 |
+
|
12836 |
+
if (prevToken) {
|
12837 |
+
if (prevToken.type.indexOf('tag-close') !== -1) {
|
12838 |
+
range.setEnd(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1);
|
12839 |
+
}
|
12840 |
+
|
12841 |
+
if (token.value === tag && token.type.indexOf('tag-name') !== -1) {
|
12842 |
+
if (prevToken.value === '<') {
|
12843 |
+
depth[tag]++;
|
12844 |
+
} else if (prevToken.value === '</') {
|
12845 |
+
depth[tag]--;
|
12846 |
+
}
|
12847 |
+
|
12848 |
+
if (depth[tag] === 0)
|
12849 |
+
found = true;
|
12850 |
+
}
|
12851 |
+
}
|
12852 |
+
} while (prevToken && !found);
|
12853 |
+
}
|
12854 |
+
if (token && token.type.indexOf('tag-name')) {
|
12855 |
+
pos = range.start;
|
12856 |
+
if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2)
|
12857 |
+
pos = range.end;
|
12858 |
+
}
|
12859 |
+
}
|
12860 |
+
|
12861 |
+
pos = range && range.cursor || pos;
|
12862 |
+
if (pos) {
|
12863 |
+
if (select) {
|
12864 |
+
if (range && expand) {
|
12865 |
+
this.selection.setRange(range);
|
12866 |
+
} else if (range && range.isEqual(this.getSelectionRange())) {
|
12867 |
+
this.clearSelection();
|
12868 |
+
} else {
|
12869 |
+
this.selection.selectTo(pos.row, pos.column);
|
12870 |
+
}
|
12871 |
+
} else {
|
12872 |
+
this.selection.moveTo(pos.row, pos.column);
|
12873 |
+
}
|
12874 |
+
}
|
12875 |
+
};
|
12876 |
+
this.gotoLine = function(lineNumber, column, animate) {
|
12877 |
+
this.selection.clearSelection();
|
12878 |
+
this.session.unfold({
|
12879 |
+
row: lineNumber - 1,
|
12880 |
+
column: column || 0
|
12881 |
+
});
|
12882 |
+
|
12883 |
+
this.$blockScrolling += 1;
|
12884 |
+
this.exitMultiSelectMode && this.exitMultiSelectMode();
|
12885 |
+
this.moveCursorTo(lineNumber - 1, column || 0);
|
12886 |
+
this.$blockScrolling -= 1;
|
12887 |
+
|
12888 |
+
if (!this.isRowFullyVisible(lineNumber - 1))
|
12889 |
+
this.scrollToLine(lineNumber - 1, true, animate);
|
12890 |
+
};
|
12891 |
+
this.navigateTo = function(row, column) {
|
12892 |
+
this.selection.moveTo(row, column);
|
12893 |
+
};
|
12894 |
+
this.navigateUp = function(times) {
|
12895 |
+
if (this.selection.isMultiLine() && !this.selection.isBackwards()) {
|
12896 |
+
var selectionStart = this.selection.anchor.getPosition();
|
12897 |
+
return this.moveCursorToPosition(selectionStart);
|
12898 |
+
}
|
12899 |
+
this.selection.clearSelection();
|
12900 |
+
this.selection.moveCursorBy(-times || -1, 0);
|
12901 |
+
};
|
12902 |
+
this.navigateDown = function(times) {
|
12903 |
+
if (this.selection.isMultiLine() && this.selection.isBackwards()) {
|
12904 |
+
var selectionEnd = this.selection.anchor.getPosition();
|
12905 |
+
return this.moveCursorToPosition(selectionEnd);
|
12906 |
+
}
|
12907 |
+
this.selection.clearSelection();
|
12908 |
+
this.selection.moveCursorBy(times || 1, 0);
|
12909 |
+
};
|
12910 |
+
this.navigateLeft = function(times) {
|
12911 |
+
if (!this.selection.isEmpty()) {
|
12912 |
+
var selectionStart = this.getSelectionRange().start;
|
12913 |
+
this.moveCursorToPosition(selectionStart);
|
12914 |
+
} else {
|
12915 |
+
times = times || 1;
|
12916 |
+
while (times--) {
|
12917 |
+
this.selection.moveCursorLeft();
|
12918 |
+
}
|
12919 |
+
}
|
12920 |
+
this.clearSelection();
|
12921 |
+
};
|
12922 |
+
this.navigateRight = function(times) {
|
12923 |
+
if (!this.selection.isEmpty()) {
|
12924 |
+
var selectionEnd = this.getSelectionRange().end;
|
12925 |
+
this.moveCursorToPosition(selectionEnd);
|
12926 |
+
} else {
|
12927 |
+
times = times || 1;
|
12928 |
+
while (times--) {
|
12929 |
+
this.selection.moveCursorRight();
|
12930 |
+
}
|
12931 |
+
}
|
12932 |
+
this.clearSelection();
|
12933 |
+
};
|
12934 |
+
this.navigateLineStart = function() {
|
12935 |
+
this.selection.moveCursorLineStart();
|
12936 |
+
this.clearSelection();
|
12937 |
+
};
|
12938 |
+
this.navigateLineEnd = function() {
|
12939 |
+
this.selection.moveCursorLineEnd();
|
12940 |
+
this.clearSelection();
|
12941 |
+
};
|
12942 |
+
this.navigateFileEnd = function() {
|
12943 |
+
this.selection.moveCursorFileEnd();
|
12944 |
+
this.clearSelection();
|
12945 |
+
};
|
12946 |
+
this.navigateFileStart = function() {
|
12947 |
+
this.selection.moveCursorFileStart();
|
12948 |
+
this.clearSelection();
|
12949 |
+
};
|
12950 |
+
this.navigateWordRight = function() {
|
12951 |
+
this.selection.moveCursorWordRight();
|
12952 |
+
this.clearSelection();
|
12953 |
+
};
|
12954 |
+
this.navigateWordLeft = function() {
|
12955 |
+
this.selection.moveCursorWordLeft();
|
12956 |
+
this.clearSelection();
|
12957 |
+
};
|
12958 |
+
this.replace = function(replacement, options) {
|
12959 |
+
if (options)
|
12960 |
+
this.$search.set(options);
|
12961 |
+
|
12962 |
+
var range = this.$search.find(this.session);
|
12963 |
+
var replaced = 0;
|
12964 |
+
if (!range)
|
12965 |
+
return replaced;
|
12966 |
+
|
12967 |
+
if (this.$tryReplace(range, replacement)) {
|
12968 |
+
replaced = 1;
|
12969 |
+
}
|
12970 |
+
if (range !== null) {
|
12971 |
+
this.selection.setSelectionRange(range);
|
12972 |
+
this.renderer.scrollSelectionIntoView(range.start, range.end);
|
12973 |
+
}
|
12974 |
+
|
12975 |
+
return replaced;
|
12976 |
+
};
|
12977 |
+
this.replaceAll = function(replacement, options) {
|
12978 |
+
if (options) {
|
12979 |
+
this.$search.set(options);
|
12980 |
+
}
|
12981 |
+
|
12982 |
+
var ranges = this.$search.findAll(this.session);
|
12983 |
+
var replaced = 0;
|
12984 |
+
if (!ranges.length)
|
12985 |
+
return replaced;
|
12986 |
+
|
12987 |
+
this.$blockScrolling += 1;
|
12988 |
+
|
12989 |
+
var selection = this.getSelectionRange();
|
12990 |
+
this.selection.moveTo(0, 0);
|
12991 |
+
|
12992 |
+
for (var i = ranges.length - 1; i >= 0; --i) {
|
12993 |
+
if (this.$tryReplace(ranges[i], replacement)) {
|
12994 |
+
replaced++;
|
12995 |
+
}
|
12996 |
+
}
|
12997 |
+
|
12998 |
+
this.selection.setSelectionRange(selection);
|
12999 |
+
this.$blockScrolling -= 1;
|
13000 |
+
|
13001 |
+
return replaced;
|
13002 |
+
};
|
13003 |
+
|
13004 |
+
this.$tryReplace = function(range, replacement) {
|
13005 |
+
var input = this.session.getTextRange(range);
|
13006 |
+
replacement = this.$search.replace(input, replacement);
|
13007 |
+
if (replacement !== null) {
|
13008 |
+
range.end = this.session.replace(range, replacement);
|
13009 |
+
return range;
|
13010 |
+
} else {
|
13011 |
+
return null;
|
13012 |
+
}
|
13013 |
+
};
|
13014 |
+
this.getLastSearchOptions = function() {
|
13015 |
+
return this.$search.getOptions();
|
13016 |
+
};
|
13017 |
+
this.find = function(needle, options, animate) {
|
13018 |
+
if (!options)
|
13019 |
+
options = {};
|
13020 |
+
|
13021 |
+
if (typeof needle == "string" || needle instanceof RegExp)
|
13022 |
+
options.needle = needle;
|
13023 |
+
else if (typeof needle == "object")
|
13024 |
+
oop.mixin(options, needle);
|
13025 |
+
|
13026 |
+
var range = this.selection.getRange();
|
13027 |
+
if (options.needle == null) {
|
13028 |
+
needle = this.session.getTextRange(range) || this.$search.$options.needle;
|
13029 |
+
if (!needle) {
|
13030 |
+
range = this.session.getWordRange(range.start.row, range.start.column);
|
13031 |
+
needle = this.session.getTextRange(range);
|
13032 |
+
}
|
13033 |
+
this.$search.set({
|
13034 |
+
needle: needle
|
13035 |
+
});
|
13036 |
+
}
|
13037 |
+
|
13038 |
+
this.$search.set(options);
|
13039 |
+
if (!options.start)
|
13040 |
+
this.$search.set({
|
13041 |
+
start: range
|
13042 |
+
});
|
13043 |
+
|
13044 |
+
var newRange = this.$search.find(this.session);
|
13045 |
+
if (options.preventScroll)
|
13046 |
+
return newRange;
|
13047 |
+
if (newRange) {
|
13048 |
+
this.revealRange(newRange, animate);
|
13049 |
+
return newRange;
|
13050 |
+
}
|
13051 |
+
if (options.backwards)
|
13052 |
+
range.start = range.end;
|
13053 |
+
else
|
13054 |
+
range.end = range.start;
|
13055 |
+
this.selection.setRange(range);
|
13056 |
+
};
|
13057 |
+
this.findNext = function(options, animate) {
|
13058 |
+
this.find({
|
13059 |
+
skipCurrent: true,
|
13060 |
+
backwards: false
|
13061 |
+
}, options, animate);
|
13062 |
+
};
|
13063 |
+
this.findPrevious = function(options, animate) {
|
13064 |
+
this.find(options, {
|
13065 |
+
skipCurrent: true,
|
13066 |
+
backwards: true
|
13067 |
+
}, animate);
|
13068 |
+
};
|
13069 |
+
|
13070 |
+
this.revealRange = function(range, animate) {
|
13071 |
+
this.$blockScrolling += 1;
|
13072 |
+
this.session.unfold(range);
|
13073 |
+
this.selection.setSelectionRange(range);
|
13074 |
+
this.$blockScrolling -= 1;
|
13075 |
+
|
13076 |
+
var scrollTop = this.renderer.scrollTop;
|
13077 |
+
this.renderer.scrollSelectionIntoView(range.start, range.end, 0.5);
|
13078 |
+
if (animate !== false)
|
13079 |
+
this.renderer.animateScrolling(scrollTop);
|
13080 |
+
};
|
13081 |
+
this.undo = function() {
|
13082 |
+
this.$blockScrolling++;
|
13083 |
+
this.session.getUndoManager().undo();
|
13084 |
+
this.$blockScrolling--;
|
13085 |
+
this.renderer.scrollCursorIntoView(null, 0.5);
|
13086 |
+
};
|
13087 |
+
this.redo = function() {
|
13088 |
+
this.$blockScrolling++;
|
13089 |
+
this.session.getUndoManager().redo();
|
13090 |
+
this.$blockScrolling--;
|
13091 |
+
this.renderer.scrollCursorIntoView(null, 0.5);
|
13092 |
+
};
|
13093 |
+
this.destroy = function() {
|
13094 |
+
this.renderer.destroy();
|
13095 |
+
this._signal("destroy", this);
|
13096 |
+
if (this.session) {
|
13097 |
+
this.session.destroy();
|
13098 |
+
}
|
13099 |
+
};
|
13100 |
+
this.setAutoScrollEditorIntoView = function(enable) {
|
13101 |
+
if (!enable)
|
13102 |
+
return;
|
13103 |
+
var rect;
|
13104 |
+
var self = this;
|
13105 |
+
var shouldScroll = false;
|
13106 |
+
if (!this.$scrollAnchor)
|
13107 |
+
this.$scrollAnchor = document.createElement("div");
|
13108 |
+
var scrollAnchor = this.$scrollAnchor;
|
13109 |
+
scrollAnchor.style.cssText = "position:absolute";
|
13110 |
+
this.container.insertBefore(scrollAnchor, this.container.firstChild);
|
13111 |
+
var onChangeSelection = this.on("changeSelection", function() {
|
13112 |
+
shouldScroll = true;
|
13113 |
+
});
|
13114 |
+
var onBeforeRender = this.renderer.on("beforeRender", function() {
|
13115 |
+
if (shouldScroll)
|
13116 |
+
rect = self.renderer.container.getBoundingClientRect();
|
13117 |
+
});
|
13118 |
+
var onAfterRender = this.renderer.on("afterRender", function() {
|
13119 |
+
if (shouldScroll && rect && (self.isFocused() || self.searchBox && self.searchBox.isFocused())) {
|
13120 |
+
var renderer = self.renderer;
|
13121 |
+
var pos = renderer.$cursorLayer.$pixelPos;
|
13122 |
+
var config = renderer.layerConfig;
|
13123 |
+
var top = pos.top - config.offset;
|
13124 |
+
if (pos.top >= 0 && top + rect.top < 0) {
|
13125 |
+
shouldScroll = true;
|
13126 |
+
} else if (pos.top < config.height &&
|
13127 |
+
pos.top + rect.top + config.lineHeight > window.innerHeight) {
|
13128 |
+
shouldScroll = false;
|
13129 |
+
} else {
|
13130 |
+
shouldScroll = null;
|
13131 |
+
}
|
13132 |
+
if (shouldScroll != null) {
|
13133 |
+
scrollAnchor.style.top = top + "px";
|
13134 |
+
scrollAnchor.style.left = pos.left + "px";
|
13135 |
+
scrollAnchor.style.height = config.lineHeight + "px";
|
13136 |
+
scrollAnchor.scrollIntoView(shouldScroll);
|
13137 |
+
}
|
13138 |
+
shouldScroll = rect = null;
|
13139 |
+
}
|
13140 |
+
});
|
13141 |
+
this.setAutoScrollEditorIntoView = function(enable) {
|
13142 |
+
if (enable)
|
13143 |
+
return;
|
13144 |
+
delete this.setAutoScrollEditorIntoView;
|
13145 |
+
this.removeEventListener("changeSelection", onChangeSelection);
|
13146 |
+
this.renderer.removeEventListener("afterRender", onAfterRender);
|
13147 |
+
this.renderer.removeEventListener("beforeRender", onBeforeRender);
|
13148 |
+
};
|
13149 |
+
};
|
13150 |
+
|
13151 |
+
|
13152 |
+
this.$resetCursorStyle = function() {
|
13153 |
+
var style = this.$cursorStyle || "ace";
|
13154 |
+
var cursorLayer = this.renderer.$cursorLayer;
|
13155 |
+
if (!cursorLayer)
|
13156 |
+
return;
|
13157 |
+
cursorLayer.setSmoothBlinking(/smooth/.test(style));
|
13158 |
+
cursorLayer.isBlinking = !this.$readOnly && style != "wide";
|
13159 |
+
dom.setCssClass(cursorLayer.element, "ace_slim-cursors", /slim/.test(style));
|
13160 |
+
};
|
13161 |
+
|
13162 |
+
}).call(Editor.prototype);
|
13163 |
+
|
13164 |
+
|
13165 |
+
|
13166 |
+
config.defineOptions(Editor.prototype, "editor", {
|
13167 |
+
selectionStyle: {
|
13168 |
+
set: function(style) {
|
13169 |
+
this.onSelectionChange();
|
13170 |
+
this._signal("changeSelectionStyle", {
|
13171 |
+
data: style
|
13172 |
+
});
|
13173 |
+
},
|
13174 |
+
initialValue: "line"
|
13175 |
+
},
|
13176 |
+
highlightActiveLine: {
|
13177 |
+
set: function() {
|
13178 |
+
this.$updateHighlightActiveLine();
|
13179 |
+
},
|
13180 |
+
initialValue: true
|
13181 |
+
},
|
13182 |
+
highlightSelectedWord: {
|
13183 |
+
set: function(shouldHighlight) {
|
13184 |
+
this.$onSelectionChange();
|
13185 |
+
},
|
13186 |
+
initialValue: true
|
13187 |
+
},
|
13188 |
+
readOnly: {
|
13189 |
+
set: function(readOnly) {
|
13190 |
+
this.$resetCursorStyle();
|
13191 |
+
},
|
13192 |
+
initialValue: false
|
13193 |
+
},
|
13194 |
+
cursorStyle: {
|
13195 |
+
set: function(val) {
|
13196 |
+
this.$resetCursorStyle();
|
13197 |
+
},
|
13198 |
+
values: ["ace", "slim", "smooth", "wide"],
|
13199 |
+
initialValue: "ace"
|
13200 |
+
},
|
13201 |
+
mergeUndoDeltas: {
|
13202 |
+
values: [false, true, "always"],
|
13203 |
+
initialValue: true
|
13204 |
+
},
|
13205 |
+
behavioursEnabled: {
|
13206 |
+
initialValue: true
|
13207 |
+
},
|
13208 |
+
wrapBehavioursEnabled: {
|
13209 |
+
initialValue: true
|
13210 |
+
},
|
13211 |
+
autoScrollEditorIntoView: {
|
13212 |
+
set: function(val) {
|
13213 |
+
this.setAutoScrollEditorIntoView(val)
|
13214 |
+
}
|
13215 |
+
},
|
13216 |
+
|
13217 |
+
hScrollBarAlwaysVisible: "renderer",
|
13218 |
+
vScrollBarAlwaysVisible: "renderer",
|
13219 |
+
highlightGutterLine: "renderer",
|
13220 |
+
animatedScroll: "renderer",
|
13221 |
+
showInvisibles: "renderer",
|
13222 |
+
showPrintMargin: "renderer",
|
13223 |
+
printMarginColumn: "renderer",
|
13224 |
+
printMargin: "renderer",
|
13225 |
+
fadeFoldWidgets: "renderer",
|
13226 |
+
showFoldWidgets: "renderer",
|
13227 |
+
showLineNumbers: "renderer",
|
13228 |
+
showGutter: "renderer",
|
13229 |
+
displayIndentGuides: "renderer",
|
13230 |
+
fontSize: "renderer",
|
13231 |
+
fontFamily: "renderer",
|
13232 |
+
maxLines: "renderer",
|
13233 |
+
minLines: "renderer",
|
13234 |
+
scrollPastEnd: "renderer",
|
13235 |
+
fixedWidthGutter: "renderer",
|
13236 |
+
theme: "renderer",
|
13237 |
+
|
13238 |
+
scrollSpeed: "$mouseHandler",
|
13239 |
+
dragDelay: "$mouseHandler",
|
13240 |
+
dragEnabled: "$mouseHandler",
|
13241 |
+
focusTimout: "$mouseHandler",
|
13242 |
+
tooltipFollowsMouse: "$mouseHandler",
|
13243 |
+
|
13244 |
+
firstLineNumber: "session",
|
13245 |
+
overwrite: "session",
|
13246 |
+
newLineMode: "session",
|
13247 |
+
useWorker: "session",
|
13248 |
+
useSoftTabs: "session",
|
13249 |
+
tabSize: "session",
|
13250 |
+
wrap: "session",
|
13251 |
+
foldStyle: "session",
|
13252 |
+
mode: "session"
|
13253 |
+
});
|
13254 |
+
|
13255 |
+
exports.Editor = Editor;
|
13256 |
+
});
|
13257 |
+
|
13258 |
+
ace.define("ace/undomanager", ["require", "exports", "module"], function(require, exports, module) {
|
13259 |
+
"use strict";
|
13260 |
+
var UndoManager = function() {
|
13261 |
+
this.reset();
|
13262 |
+
};
|
13263 |
+
|
13264 |
+
(function() {
|
13265 |
+
this.execute = function(options) {
|
13266 |
+
var deltas = options.args[0];
|
13267 |
+
this.$doc = options.args[1];
|
13268 |
+
if (options.merge && this.hasUndo()) {
|
13269 |
+
this.dirtyCounter--;
|
13270 |
+
deltas = this.$undoStack.pop().concat(deltas);
|
13271 |
+
}
|
13272 |
+
this.$undoStack.push(deltas);
|
13273 |
+
this.$redoStack = [];
|
13274 |
+
|
13275 |
+
if (this.dirtyCounter < 0) {
|
13276 |
+
this.dirtyCounter = NaN;
|
13277 |
+
}
|
13278 |
+
this.dirtyCounter++;
|
13279 |
+
};
|
13280 |
+
this.undo = function(dontSelect) {
|
13281 |
+
var deltas = this.$undoStack.pop();
|
13282 |
+
var undoSelectionRange = null;
|
13283 |
+
if (deltas) {
|
13284 |
+
undoSelectionRange =
|
13285 |
+
this.$doc.undoChanges(deltas, dontSelect);
|
13286 |
+
this.$redoStack.push(deltas);
|
13287 |
+
this.dirtyCounter--;
|
13288 |
+
}
|
13289 |
+
|
13290 |
+
return undoSelectionRange;
|
13291 |
+
};
|
13292 |
+
this.redo = function(dontSelect) {
|
13293 |
+
var deltas = this.$redoStack.pop();
|
13294 |
+
var redoSelectionRange = null;
|
13295 |
+
if (deltas) {
|
13296 |
+
redoSelectionRange =
|
13297 |
+
this.$doc.redoChanges(deltas, dontSelect);
|
13298 |
+
this.$undoStack.push(deltas);
|
13299 |
+
this.dirtyCounter++;
|
13300 |
+
}
|
13301 |
+
|
13302 |
+
return redoSelectionRange;
|
13303 |
+
};
|
13304 |
+
this.reset = function() {
|
13305 |
+
this.$undoStack = [];
|
13306 |
+
this.$redoStack = [];
|
13307 |
+
this.dirtyCounter = 0;
|
13308 |
+
};
|
13309 |
+
this.hasUndo = function() {
|
13310 |
+
return this.$undoStack.length > 0;
|
13311 |
+
};
|
13312 |
+
this.hasRedo = function() {
|
13313 |
+
return this.$redoStack.length > 0;
|
13314 |
+
};
|
13315 |
+
this.markClean = function() {
|
13316 |
+
this.dirtyCounter = 0;
|
13317 |
+
};
|
13318 |
+
this.isClean = function() {
|
13319 |
+
return this.dirtyCounter === 0;
|
13320 |
+
};
|
13321 |
+
|
13322 |
+
}).call(UndoManager.prototype);
|
13323 |
+
|
13324 |
+
exports.UndoManager = UndoManager;
|
13325 |
+
});
|
13326 |
+
|
13327 |
+
ace.define("ace/layer/gutter", ["require", "exports", "module", "ace/lib/dom", "ace/lib/oop", "ace/lib/lang", "ace/lib/event_emitter"], function(require, exports, module) {
|
13328 |
+
"use strict";
|
13329 |
+
|
13330 |
+
var dom = require("../lib/dom");
|
13331 |
+
var oop = require("../lib/oop");
|
13332 |
+
var lang = require("../lib/lang");
|
13333 |
+
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
13334 |
+
|
13335 |
+
var Gutter = function(parentEl) {
|
13336 |
+
this.element = dom.createElement("div");
|
13337 |
+
this.element.className = "ace_layer ace_gutter-layer";
|
13338 |
+
parentEl.appendChild(this.element);
|
13339 |
+
this.setShowFoldWidgets(this.$showFoldWidgets);
|
13340 |
+
|
13341 |
+
this.gutterWidth = 0;
|
13342 |
+
|
13343 |
+
this.$annotations = [];
|
13344 |
+
this.$updateAnnotations = this.$updateAnnotations.bind(this);
|
13345 |
+
|
13346 |
+
this.$cells = [];
|
13347 |
+
};
|
13348 |
+
|
13349 |
+
(function() {
|
13350 |
+
|
13351 |
+
oop.implement(this, EventEmitter);
|
13352 |
+
|
13353 |
+
this.setSession = function(session) {
|
13354 |
+
if (this.session)
|
13355 |
+
this.session.removeEventListener("change", this.$updateAnnotations);
|
13356 |
+
this.session = session;
|
13357 |
+
if (session)
|
13358 |
+
session.on("change", this.$updateAnnotations);
|
13359 |
+
};
|
13360 |
+
|
13361 |
+
this.addGutterDecoration = function(row, className) {
|
13362 |
+
if (window.console)
|
13363 |
+
console.warn && console.warn("deprecated use session.addGutterDecoration");
|
13364 |
+
this.session.addGutterDecoration(row, className);
|
13365 |
+
};
|
13366 |
+
|
13367 |
+
this.removeGutterDecoration = function(row, className) {
|
13368 |
+
if (window.console)
|
13369 |
+
console.warn && console.warn("deprecated use session.removeGutterDecoration");
|
13370 |
+
this.session.removeGutterDecoration(row, className);
|
13371 |
+
};
|
13372 |
+
|
13373 |
+
this.setAnnotations = function(annotations) {
|
13374 |
+
this.$annotations = [];
|
13375 |
+
for (var i = 0; i < annotations.length; i++) {
|
13376 |
+
var annotation = annotations[i];
|
13377 |
+
var row = annotation.row;
|
13378 |
+
var rowInfo = this.$annotations[row];
|
13379 |
+
if (!rowInfo)
|
13380 |
+
rowInfo = this.$annotations[row] = {
|
13381 |
+
text: []
|
13382 |
+
};
|
13383 |
+
|
13384 |
+
var annoText = annotation.text;
|
13385 |
+
annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || "";
|
13386 |
+
|
13387 |
+
if (rowInfo.text.indexOf(annoText) === -1)
|
13388 |
+
rowInfo.text.push(annoText);
|
13389 |
+
|
13390 |
+
var type = annotation.type;
|
13391 |
+
if (type == "error")
|
13392 |
+
rowInfo.className = " ace_error";
|
13393 |
+
else if (type == "warning" && rowInfo.className != " ace_error")
|
13394 |
+
rowInfo.className = " ace_warning";
|
13395 |
+
else if (type == "info" && (!rowInfo.className))
|
13396 |
+
rowInfo.className = " ace_info";
|
13397 |
+
}
|
13398 |
+
};
|
13399 |
+
|
13400 |
+
this.$updateAnnotations = function(e) {
|
13401 |
+
if (!this.$annotations.length)
|
13402 |
+
return;
|
13403 |
+
var delta = e.data;
|
13404 |
+
var range = delta.range;
|
13405 |
+
var firstRow = range.start.row;
|
13406 |
+
var len = range.end.row - firstRow;
|
13407 |
+
if (len === 0) {} else if (delta.action == "removeText" || delta.action == "removeLines") {
|
13408 |
+
this.$annotations.splice(firstRow, len + 1, null);
|
13409 |
+
} else {
|
13410 |
+
var args = new Array(len + 1);
|
13411 |
+
args.unshift(firstRow, 1);
|
13412 |
+
this.$annotations.splice.apply(this.$annotations, args);
|
13413 |
+
}
|
13414 |
+
};
|
13415 |
+
|
13416 |
+
this.update = function(config) {
|
13417 |
+
var session = this.session;
|
13418 |
+
var firstRow = config.firstRow;
|
13419 |
+
var lastRow = Math.min(config.lastRow + config.gutterOffset, // needed to compensate for hor scollbar
|
13420 |
+
session.getLength() - 1);
|
13421 |
+
var fold = session.getNextFoldLine(firstRow);
|
13422 |
+
var foldStart = fold ? fold.start.row : Infinity;
|
13423 |
+
var foldWidgets = this.$showFoldWidgets && session.foldWidgets;
|
13424 |
+
var breakpoints = session.$breakpoints;
|
13425 |
+
var decorations = session.$decorations;
|
13426 |
+
var firstLineNumber = session.$firstLineNumber;
|
13427 |
+
var lastLineNumber = 0;
|
13428 |
+
|
13429 |
+
var gutterRenderer = session.gutterRenderer || this.$renderer;
|
13430 |
+
|
13431 |
+
var cell = null;
|
13432 |
+
var index = -1;
|
13433 |
+
var row = firstRow;
|
13434 |
+
while (true) {
|
13435 |
+
if (row > foldStart) {
|
13436 |
+
row = fold.end.row + 1;
|
13437 |
+
fold = session.getNextFoldLine(row, fold);
|
13438 |
+
foldStart = fold ? fold.start.row : Infinity;
|
13439 |
+
}
|
13440 |
+
if (row > lastRow) {
|
13441 |
+
while (this.$cells.length > index + 1) {
|
13442 |
+
cell = this.$cells.pop();
|
13443 |
+
this.element.removeChild(cell.element);
|
13444 |
+
}
|
13445 |
+
break;
|
13446 |
+
}
|
13447 |
+
|
13448 |
+
cell = this.$cells[++index];
|
13449 |
+
if (!cell) {
|
13450 |
+
cell = {
|
13451 |
+
element: null,
|
13452 |
+
textNode: null,
|
13453 |
+
foldWidget: null
|
13454 |
+
};
|
13455 |
+
cell.element = dom.createElement("div");
|
13456 |
+
cell.textNode = document.createTextNode('');
|
13457 |
+
cell.element.appendChild(cell.textNode);
|
13458 |
+
this.element.appendChild(cell.element);
|
13459 |
+
this.$cells[index] = cell;
|
13460 |
+
}
|
13461 |
+
|
13462 |
+
var className = "ace_gutter-cell ";
|
13463 |
+
if (breakpoints[row])
|
13464 |
+
className += breakpoints[row];
|
13465 |
+
if (decorations[row])
|
13466 |
+
className += decorations[row];
|
13467 |
+
if (this.$annotations[row])
|
13468 |
+
className += this.$annotations[row].className;
|
13469 |
+
if (cell.element.className != className)
|
13470 |
+
cell.element.className = className;
|
13471 |
+
|
13472 |
+
var height = session.getRowLength(row) * config.lineHeight + "px";
|
13473 |
+
if (height != cell.element.style.height)
|
13474 |
+
cell.element.style.height = height;
|
13475 |
+
|
13476 |
+
if (foldWidgets) {
|
13477 |
+
var c = foldWidgets[row];
|
13478 |
+
if (c == null)
|
13479 |
+
c = foldWidgets[row] = session.getFoldWidget(row);
|
13480 |
+
}
|
13481 |
+
|
13482 |
+
if (c) {
|
13483 |
+
if (!cell.foldWidget) {
|
13484 |
+
cell.foldWidget = dom.createElement("span");
|
13485 |
+
cell.element.appendChild(cell.foldWidget);
|
13486 |
+
}
|
13487 |
+
var className = "ace_fold-widget ace_" + c;
|
13488 |
+
if (c == "start" && row == foldStart && row < fold.end.row)
|
13489 |
+
className += " ace_closed";
|
13490 |
+
else
|
13491 |
+
className += " ace_open";
|
13492 |
+
if (cell.foldWidget.className != className)
|
13493 |
+
cell.foldWidget.className = className;
|
13494 |
+
|
13495 |
+
var height = config.lineHeight + "px";
|
13496 |
+
if (cell.foldWidget.style.height != height)
|
13497 |
+
cell.foldWidget.style.height = height;
|
13498 |
+
} else {
|
13499 |
+
if (cell.foldWidget) {
|
13500 |
+
cell.element.removeChild(cell.foldWidget);
|
13501 |
+
cell.foldWidget = null;
|
13502 |
+
}
|
13503 |
+
}
|
13504 |
+
|
13505 |
+
var text = lastLineNumber = gutterRenderer ? gutterRenderer.getText(session, row) : row + firstLineNumber;
|
13506 |
+
if (text != cell.textNode.data)
|
13507 |
+
cell.textNode.data = text;
|
13508 |
+
|
13509 |
+
row++;
|
13510 |
+
}
|
13511 |
+
|
13512 |
+
this.element.style.height = config.minHeight + "px";
|
13513 |
+
|
13514 |
+
if (this.$fixedWidth || session.$useWrapMode)
|
13515 |
+
lastLineNumber = session.getLength() + firstLineNumber;
|
13516 |
+
|
13517 |
+
var gutterWidth = gutterRenderer ? gutterRenderer.getWidth(session, lastLineNumber, config) : lastLineNumber.toString().length * config.characterWidth;
|
13518 |
+
|
13519 |
+
var padding = this.$padding || this.$computePadding();
|
13520 |
+
gutterWidth += padding.left + padding.right;
|
13521 |
+
if (gutterWidth !== this.gutterWidth && !isNaN(gutterWidth)) {
|
13522 |
+
this.gutterWidth = gutterWidth;
|
13523 |
+
this.element.style.width = Math.ceil(this.gutterWidth) + "px";
|
13524 |
+
this._emit("changeGutterWidth", gutterWidth);
|
13525 |
+
}
|
13526 |
+
};
|
13527 |
+
|
13528 |
+
this.$fixedWidth = false;
|
13529 |
+
|
13530 |
+
this.$showLineNumbers = true;
|
13531 |
+
this.$renderer = "";
|
13532 |
+
this.setShowLineNumbers = function(show) {
|
13533 |
+
this.$renderer = !show && {
|
13534 |
+
getWidth: function() {
|
13535 |
+
return ""
|
13536 |
+
},
|
13537 |
+
getText: function() {
|
13538 |
+
return ""
|
13539 |
+
}
|
13540 |
+
};
|
13541 |
+
};
|
13542 |
+
|
13543 |
+
this.getShowLineNumbers = function() {
|
13544 |
+
return this.$showLineNumbers;
|
13545 |
+
};
|
13546 |
+
|
13547 |
+
this.$showFoldWidgets = true;
|
13548 |
+
this.setShowFoldWidgets = function(show) {
|
13549 |
+
if (show)
|
13550 |
+
dom.addCssClass(this.element, "ace_folding-enabled");
|
13551 |
+
else
|
13552 |
+
dom.removeCssClass(this.element, "ace_folding-enabled");
|
13553 |
+
|
13554 |
+
this.$showFoldWidgets = show;
|
13555 |
+
this.$padding = null;
|
13556 |
+
};
|
13557 |
+
|
13558 |
+
this.getShowFoldWidgets = function() {
|
13559 |
+
return this.$showFoldWidgets;
|
13560 |
+
};
|
13561 |
+
|
13562 |
+
this.$computePadding = function() {
|
13563 |
+
if (!this.element.firstChild)
|
13564 |
+
return {
|
13565 |
+
left: 0,
|
13566 |
+
right: 0
|
13567 |
+
};
|
13568 |
+
var style = dom.computedStyle(this.element.firstChild);
|
13569 |
+
this.$padding = {};
|
13570 |
+
this.$padding.left = parseInt(style.paddingLeft) + 1 || 0;
|
13571 |
+
this.$padding.right = parseInt(style.paddingRight) || 0;
|
13572 |
+
return this.$padding;
|
13573 |
+
};
|
13574 |
+
|
13575 |
+
this.getRegion = function(point) {
|
13576 |
+
var padding = this.$padding || this.$computePadding();
|
13577 |
+
var rect = this.element.getBoundingClientRect();
|
13578 |
+
if (point.x < padding.left + rect.left)
|
13579 |
+
return "markers";
|
13580 |
+
if (this.$showFoldWidgets && point.x > rect.right - padding.right)
|
13581 |
+
return "foldWidgets";
|
13582 |
+
};
|
13583 |
+
|
13584 |
+
}).call(Gutter.prototype);
|
13585 |
+
|
13586 |
+
exports.Gutter = Gutter;
|
13587 |
+
|
13588 |
+
});
|
13589 |
+
|
13590 |
+
ace.define("ace/layer/marker", ["require", "exports", "module", "ace/range", "ace/lib/dom"], function(require, exports, module) {
|
13591 |
+
"use strict";
|
13592 |
+
|
13593 |
+
var Range = require("../range").Range;
|
13594 |
+
var dom = require("../lib/dom");
|
13595 |
+
|
13596 |
+
var Marker = function(parentEl) {
|
13597 |
+
this.element = dom.createElement("div");
|
13598 |
+
this.element.className = "ace_layer ace_marker-layer";
|
13599 |
+
parentEl.appendChild(this.element);
|
13600 |
+
};
|
13601 |
+
|
13602 |
+
(function() {
|
13603 |
+
|
13604 |
+
this.$padding = 0;
|
13605 |
+
|
13606 |
+
this.setPadding = function(padding) {
|
13607 |
+
this.$padding = padding;
|
13608 |
+
};
|
13609 |
+
this.setSession = function(session) {
|
13610 |
+
this.session = session;
|
13611 |
+
};
|
13612 |
+
|
13613 |
+
this.setMarkers = function(markers) {
|
13614 |
+
this.markers = markers;
|
13615 |
+
};
|
13616 |
+
|
13617 |
+
this.update = function(config) {
|
13618 |
+
var config = config || this.config;
|
13619 |
+
if (!config)
|
13620 |
+
return;
|
13621 |
+
|
13622 |
+
this.config = config;
|
13623 |
+
|
13624 |
+
|
13625 |
+
var html = [];
|
13626 |
+
for (var key in this.markers) {
|
13627 |
+
var marker = this.markers[key];
|
13628 |
+
|
13629 |
+
if (!marker.range) {
|
13630 |
+
marker.update(html, this, this.session, config);
|
13631 |
+
continue;
|
13632 |
+
}
|
13633 |
+
|
13634 |
+
var range = marker.range.clipRows(config.firstRow, config.lastRow);
|
13635 |
+
if (range.isEmpty()) continue;
|
13636 |
+
|
13637 |
+
range = range.toScreenRange(this.session);
|
13638 |
+
if (marker.renderer) {
|
13639 |
+
var top = this.$getTop(range.start.row, config);
|
13640 |
+
var left = this.$padding + range.start.column * config.characterWidth;
|
13641 |
+
marker.renderer(html, range, left, top, config);
|
13642 |
+
} else if (marker.type == "fullLine") {
|
13643 |
+
this.drawFullLineMarker(html, range, marker.clazz, config);
|
13644 |
+
} else if (marker.type == "screenLine") {
|
13645 |
+
this.drawScreenLineMarker(html, range, marker.clazz, config);
|
13646 |
+
} else if (range.isMultiLine()) {
|
13647 |
+
if (marker.type == "text")
|
13648 |
+
this.drawTextMarker(html, range, marker.clazz, config);
|
13649 |
+
else
|
13650 |
+
this.drawMultiLineMarker(html, range, marker.clazz, config);
|
13651 |
+
} else {
|
13652 |
+
this.drawSingleLineMarker(html, range, marker.clazz + " ace_start", config);
|
13653 |
+
}
|
13654 |
+
}
|
13655 |
+
this.element.innerHTML = html.join("");
|
13656 |
+
};
|
13657 |
+
|
13658 |
+
this.$getTop = function(row, layerConfig) {
|
13659 |
+
return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
|
13660 |
+
};
|
13661 |
+
this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig, extraStyle) {
|
13662 |
+
var row = range.start.row;
|
13663 |
+
|
13664 |
+
var lineRange = new Range(
|
13665 |
+
row, range.start.column,
|
13666 |
+
row, this.session.getScreenLastRowColumn(row)
|
13667 |
+
);
|
13668 |
+
this.drawSingleLineMarker(stringBuilder, lineRange, clazz + " ace_start", layerConfig, 1, extraStyle);
|
13669 |
+
row = range.end.row;
|
13670 |
+
lineRange = new Range(row, 0, row, range.end.column);
|
13671 |
+
this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 0, extraStyle);
|
13672 |
+
|
13673 |
+
for (row = range.start.row + 1; row < range.end.row; row++) {
|
13674 |
+
lineRange.start.row = row;
|
13675 |
+
lineRange.end.row = row;
|
13676 |
+
lineRange.end.column = this.session.getScreenLastRowColumn(row);
|
13677 |
+
this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, extraStyle);
|
13678 |
+
}
|
13679 |
+
};
|
13680 |
+
this.drawMultiLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {
|
13681 |
+
var padding = this.$padding;
|
13682 |
+
var height = config.lineHeight;
|
13683 |
+
var top = this.$getTop(range.start.row, config);
|
13684 |
+
var left = padding + range.start.column * config.characterWidth;
|
13685 |
+
extraStyle = extraStyle || "";
|
13686 |
+
|
13687 |
+
stringBuilder.push(
|
13688 |
+
"<div class='", clazz, " ace_start' style='",
|
13689 |
+
"height:", height, "px;",
|
13690 |
+
"right:0;",
|
13691 |
+
"top:", top, "px;",
|
13692 |
+
"left:", left, "px;", extraStyle, "'></div>"
|
13693 |
+
);
|
13694 |
+
top = this.$getTop(range.end.row, config);
|
13695 |
+
var width = range.end.column * config.characterWidth;
|
13696 |
+
|
13697 |
+
stringBuilder.push(
|
13698 |
+
"<div class='", clazz, "' style='",
|
13699 |
+
"height:", height, "px;",
|
13700 |
+
"width:", width, "px;",
|
13701 |
+
"top:", top, "px;",
|
13702 |
+
"left:", padding, "px;", extraStyle, "'></div>"
|
13703 |
+
);
|
13704 |
+
height = (range.end.row - range.start.row - 1) * config.lineHeight;
|
13705 |
+
if (height < 0)
|
13706 |
+
return;
|
13707 |
+
top = this.$getTop(range.start.row + 1, config);
|
13708 |
+
|
13709 |
+
stringBuilder.push(
|
13710 |
+
"<div class='", clazz, "' style='",
|
13711 |
+
"height:", height, "px;",
|
13712 |
+
"right:0;",
|
13713 |
+
"top:", top, "px;",
|
13714 |
+
"left:", padding, "px;", extraStyle, "'></div>"
|
13715 |
+
);
|
13716 |
+
};
|
13717 |
+
this.drawSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength, extraStyle) {
|
13718 |
+
var height = config.lineHeight;
|
13719 |
+
var width = (range.end.column + (extraLength || 0) - range.start.column) * config.characterWidth;
|
13720 |
+
|
13721 |
+
var top = this.$getTop(range.start.row, config);
|
13722 |
+
var left = this.$padding + range.start.column * config.characterWidth;
|
13723 |
+
|
13724 |
+
stringBuilder.push(
|
13725 |
+
"<div class='", clazz, "' style='",
|
13726 |
+
"height:", height, "px;",
|
13727 |
+
"width:", width, "px;",
|
13728 |
+
"top:", top, "px;",
|
13729 |
+
"left:", left, "px;", extraStyle || "", "'></div>"
|
13730 |
+
);
|
13731 |
+
};
|
13732 |
+
|
13733 |
+
this.drawFullLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {
|
13734 |
+
var top = this.$getTop(range.start.row, config);
|
13735 |
+
var height = config.lineHeight;
|
13736 |
+
if (range.start.row != range.end.row)
|
13737 |
+
height += this.$getTop(range.end.row, config) - top;
|
13738 |
+
|
13739 |
+
stringBuilder.push(
|
13740 |
+
"<div class='", clazz, "' style='",
|
13741 |
+
"height:", height, "px;",
|
13742 |
+
"top:", top, "px;",
|
13743 |
+
"left:0;right:0;", extraStyle || "", "'></div>"
|
13744 |
+
);
|
13745 |
+
};
|
13746 |
+
|
13747 |
+
this.drawScreenLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {
|
13748 |
+
var top = this.$getTop(range.start.row, config);
|
13749 |
+
var height = config.lineHeight;
|
13750 |
+
|
13751 |
+
stringBuilder.push(
|
13752 |
+
"<div class='", clazz, "' style='",
|
13753 |
+
"height:", height, "px;",
|
13754 |
+
"top:", top, "px;",
|
13755 |
+
"left:0;right:0;", extraStyle || "", "'></div>"
|
13756 |
+
);
|
13757 |
+
};
|
13758 |
+
|
13759 |
+
}).call(Marker.prototype);
|
13760 |
+
|
13761 |
+
exports.Marker = Marker;
|
13762 |
+
|
13763 |
+
});
|
13764 |
+
|
13765 |
+
ace.define("ace/layer/text", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/lang", "ace/lib/useragent", "ace/lib/event_emitter"], function(require, exports, module) {
|
13766 |
+
"use strict";
|
13767 |
+
|
13768 |
+
var oop = require("../lib/oop");
|
13769 |
+
var dom = require("../lib/dom");
|
13770 |
+
var lang = require("../lib/lang");
|
13771 |
+
var useragent = require("../lib/useragent");
|
13772 |
+
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
13773 |
+
|
13774 |
+
var Text = function(parentEl) {
|
13775 |
+
this.element = dom.createElement("div");
|
13776 |
+
this.element.className = "ace_layer ace_text-layer";
|
13777 |
+
parentEl.appendChild(this.element);
|
13778 |
+
this.$updateEolChar = this.$updateEolChar.bind(this);
|
13779 |
+
};
|
13780 |
+
|
13781 |
+
(function() {
|
13782 |
+
|
13783 |
+
oop.implement(this, EventEmitter);
|
13784 |
+
|
13785 |
+
this.EOF_CHAR = "\xB6";
|
13786 |
+
this.EOL_CHAR_LF = "\xAC";
|
13787 |
+
this.EOL_CHAR_CRLF = "\xa4";
|
13788 |
+
this.EOL_CHAR = this.EOL_CHAR_LF;
|
13789 |
+
this.TAB_CHAR = "\u2192"; //"\u21E5";
|
13790 |
+
this.SPACE_CHAR = "\xB7";
|
13791 |
+
this.$padding = 0;
|
13792 |
+
|
13793 |
+
this.$updateEolChar = function() {
|
13794 |
+
var EOL_CHAR = this.session.doc.getNewLineCharacter() == "\n" ? this.EOL_CHAR_LF : this.EOL_CHAR_CRLF;
|
13795 |
+
if (this.EOL_CHAR != EOL_CHAR) {
|
13796 |
+
this.EOL_CHAR = EOL_CHAR;
|
13797 |
+
return true;
|
13798 |
+
}
|
13799 |
+
}
|
13800 |
+
|
13801 |
+
this.setPadding = function(padding) {
|
13802 |
+
this.$padding = padding;
|
13803 |
+
this.element.style.padding = "0 " + padding + "px";
|
13804 |
+
};
|
13805 |
+
|
13806 |
+
this.getLineHeight = function() {
|
13807 |
+
return this.$fontMetrics.$characterSize.height || 0;
|
13808 |
+
};
|
13809 |
+
|
13810 |
+
this.getCharacterWidth = function() {
|
13811 |
+
return this.$fontMetrics.$characterSize.width || 0;
|
13812 |
+
};
|
13813 |
+
|
13814 |
+
this.$setFontMetrics = function(measure) {
|
13815 |
+
this.$fontMetrics = measure;
|
13816 |
+
this.$fontMetrics.on("changeCharacterSize", function(e) {
|
13817 |
+
this._signal("changeCharacterSize", e);
|
13818 |
+
}.bind(this));
|
13819 |
+
this.$pollSizeChanges();
|
13820 |
+
}
|
13821 |
+
|
13822 |
+
this.checkForSizeChanges = function() {
|
13823 |
+
this.$fontMetrics.checkForSizeChanges();
|
13824 |
+
};
|
13825 |
+
this.$pollSizeChanges = function() {
|
13826 |
+
return this.$pollSizeChangesTimer = this.$fontMetrics.$pollSizeChanges();
|
13827 |
+
};
|
13828 |
+
this.setSession = function(session) {
|
13829 |
+
this.session = session;
|
13830 |
+
if (session)
|
13831 |
+
this.$computeTabString();
|
13832 |
+
};
|
13833 |
+
|
13834 |
+
this.showInvisibles = false;
|
13835 |
+
this.setShowInvisibles = function(showInvisibles) {
|
13836 |
+
if (this.showInvisibles == showInvisibles)
|
13837 |
+
return false;
|
13838 |
+
|
13839 |
+
this.showInvisibles = showInvisibles;
|
13840 |
+
this.$computeTabString();
|
13841 |
+
return true;
|
13842 |
+
};
|
13843 |
+
|
13844 |
+
this.displayIndentGuides = true;
|
13845 |
+
this.setDisplayIndentGuides = function(display) {
|
13846 |
+
if (this.displayIndentGuides == display)
|
13847 |
+
return false;
|
13848 |
+
|
13849 |
+
this.displayIndentGuides = display;
|
13850 |
+
this.$computeTabString();
|
13851 |
+
return true;
|
13852 |
+
};
|
13853 |
+
|
13854 |
+
this.$tabStrings = [];
|
13855 |
+
this.onChangeTabSize =
|
13856 |
+
this.$computeTabString = function() {
|
13857 |
+
var tabSize = this.session.getTabSize();
|
13858 |
+
this.tabSize = tabSize;
|
13859 |
+
var tabStr = this.$tabStrings = [0];
|
13860 |
+
for (var i = 1; i < tabSize + 1; i++) {
|
13861 |
+
if (this.showInvisibles) {
|
13862 |
+
tabStr.push("<span class='ace_invisible ace_invisible_tab'>" + this.TAB_CHAR + lang.stringRepeat("\xa0", i - 1) + "</span>");
|
13863 |
+
} else {
|
13864 |
+
tabStr.push(lang.stringRepeat("\xa0", i));
|
13865 |
+
}
|
13866 |
+
}
|
13867 |
+
if (this.displayIndentGuides) {
|
13868 |
+
this.$indentGuideRe = /\s\S| \t|\t |\s$/;
|
13869 |
+
var className = "ace_indent-guide";
|
13870 |
+
var spaceClass = "";
|
13871 |
+
var tabClass = "";
|
13872 |
+
if (this.showInvisibles) {
|
13873 |
+
className += " ace_invisible";
|
13874 |
+
spaceClass = " ace_invisible_space";
|
13875 |
+
tabClass = " ace_invisible_tab";
|
13876 |
+
var spaceContent = lang.stringRepeat(this.SPACE_CHAR, this.tabSize);
|
13877 |
+
var tabContent = this.TAB_CHAR + lang.stringRepeat("\xa0", this.tabSize - 1);
|
13878 |
+
} else {
|
13879 |
+
var spaceContent = lang.stringRepeat("\xa0", this.tabSize);
|
13880 |
+
var tabContent = spaceContent;
|
13881 |
+
}
|
13882 |
+
|
13883 |
+
this.$tabStrings[" "] = "<span class='" + className + spaceClass + "'>" + spaceContent + "</span>";
|
13884 |
+
this.$tabStrings["\t"] = "<span class='" + className + tabClass + "'>" + tabContent + "</span>";
|
13885 |
+
}
|
13886 |
+
};
|
13887 |
+
|
13888 |
+
this.updateLines = function(config, firstRow, lastRow) {
|
13889 |
+
if (this.config.lastRow != config.lastRow ||
|
13890 |
+
this.config.firstRow != config.firstRow) {
|
13891 |
+
this.scrollLines(config);
|
13892 |
+
}
|
13893 |
+
this.config = config;
|
13894 |
+
|
13895 |
+
var first = Math.max(firstRow, config.firstRow);
|
13896 |
+
var last = Math.min(lastRow, config.lastRow);
|
13897 |
+
|
13898 |
+
var lineElements = this.element.childNodes;
|
13899 |
+
var lineElementsIdx = 0;
|
13900 |
+
|
13901 |
+
for (var row = config.firstRow; row < first; row++) {
|
13902 |
+
var foldLine = this.session.getFoldLine(row);
|
13903 |
+
if (foldLine) {
|
13904 |
+
if (foldLine.containsRow(first)) {
|
13905 |
+
first = foldLine.start.row;
|
13906 |
+
break;
|
13907 |
+
} else {
|
13908 |
+
row = foldLine.end.row;
|
13909 |
+
}
|
13910 |
+
}
|
13911 |
+
lineElementsIdx++;
|
13912 |
+
}
|
13913 |
+
|
13914 |
+
var row = first;
|
13915 |
+
var foldLine = this.session.getNextFoldLine(row);
|
13916 |
+
var foldStart = foldLine ? foldLine.start.row : Infinity;
|
13917 |
+
|
13918 |
+
while (true) {
|
13919 |
+
if (row > foldStart) {
|
13920 |
+
row = foldLine.end.row + 1;
|
13921 |
+
foldLine = this.session.getNextFoldLine(row, foldLine);
|
13922 |
+
foldStart = foldLine ? foldLine.start.row : Infinity;
|
13923 |
+
}
|
13924 |
+
if (row > last)
|
13925 |
+
break;
|
13926 |
+
|
13927 |
+
var lineElement = lineElements[lineElementsIdx++];
|
13928 |
+
if (lineElement) {
|
13929 |
+
var html = [];
|
13930 |
+
this.$renderLine(
|
13931 |
+
html, row, !this.$useLineGroups(), row == foldStart ? foldLine : false
|
13932 |
+
);
|
13933 |
+
lineElement.style.height = config.lineHeight * this.session.getRowLength(row) + "px";
|
13934 |
+
lineElement.innerHTML = html.join("");
|
13935 |
+
}
|
13936 |
+
row++;
|
13937 |
+
}
|
13938 |
+
};
|
13939 |
+
|
13940 |
+
this.scrollLines = function(config) {
|
13941 |
+
var oldConfig = this.config;
|
13942 |
+
this.config = config;
|
13943 |
+
|
13944 |
+
if (!oldConfig || oldConfig.lastRow < config.firstRow)
|
13945 |
+
return this.update(config);
|
13946 |
+
|
13947 |
+
if (config.lastRow < oldConfig.firstRow)
|
13948 |
+
return this.update(config);
|
13949 |
+
|
13950 |
+
var el = this.element;
|
13951 |
+
if (oldConfig.firstRow < config.firstRow)
|
13952 |
+
for (var row = this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row > 0; row--)
|
13953 |
+
el.removeChild(el.firstChild);
|
13954 |
+
|
13955 |
+
if (oldConfig.lastRow > config.lastRow)
|
13956 |
+
for (var row = this.session.getFoldedRowCount(config.lastRow + 1, oldConfig.lastRow); row > 0; row--)
|
13957 |
+
el.removeChild(el.lastChild);
|
13958 |
+
|
13959 |
+
if (config.firstRow < oldConfig.firstRow) {
|
13960 |
+
var fragment = this.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1);
|
13961 |
+
if (el.firstChild)
|
13962 |
+
el.insertBefore(fragment, el.firstChild);
|
13963 |
+
else
|
13964 |
+
el.appendChild(fragment);
|
13965 |
+
}
|
13966 |
+
|
13967 |
+
if (config.lastRow > oldConfig.lastRow) {
|
13968 |
+
var fragment = this.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow);
|
13969 |
+
el.appendChild(fragment);
|
13970 |
+
}
|
13971 |
+
};
|
13972 |
+
|
13973 |
+
this.$renderLinesFragment = function(config, firstRow, lastRow) {
|
13974 |
+
var fragment = this.element.ownerDocument.createDocumentFragment();
|
13975 |
+
var row = firstRow;
|
13976 |
+
var foldLine = this.session.getNextFoldLine(row);
|
13977 |
+
var foldStart = foldLine ? foldLine.start.row : Infinity;
|
13978 |
+
|
13979 |
+
while (true) {
|
13980 |
+
if (row > foldStart) {
|
13981 |
+
row = foldLine.end.row + 1;
|
13982 |
+
foldLine = this.session.getNextFoldLine(row, foldLine);
|
13983 |
+
foldStart = foldLine ? foldLine.start.row : Infinity;
|
13984 |
+
}
|
13985 |
+
if (row > lastRow)
|
13986 |
+
break;
|
13987 |
+
|
13988 |
+
var container = dom.createElement("div");
|
13989 |
+
|
13990 |
+
var html = [];
|
13991 |
+
this.$renderLine(html, row, false, row == foldStart ? foldLine : false);
|
13992 |
+
container.innerHTML = html.join("");
|
13993 |
+
if (this.$useLineGroups()) {
|
13994 |
+
container.className = 'ace_line_group';
|
13995 |
+
fragment.appendChild(container);
|
13996 |
+
container.style.height = config.lineHeight * this.session.getRowLength(row) + "px";
|
13997 |
+
|
13998 |
+
} else {
|
13999 |
+
while (container.firstChild)
|
14000 |
+
fragment.appendChild(container.firstChild);
|
14001 |
+
}
|
14002 |
+
|
14003 |
+
row++;
|
14004 |
+
}
|
14005 |
+
return fragment;
|
14006 |
+
};
|
14007 |
+
|
14008 |
+
this.update = function(config) {
|
14009 |
+
this.config = config;
|
14010 |
+
|
14011 |
+
var html = [];
|
14012 |
+
var firstRow = config.firstRow,
|
14013 |
+
lastRow = config.lastRow;
|
14014 |
+
|
14015 |
+
var row = firstRow;
|
14016 |
+
var foldLine = this.session.getNextFoldLine(row);
|
14017 |
+
var foldStart = foldLine ? foldLine.start.row : Infinity;
|
14018 |
+
|
14019 |
+
while (true) {
|
14020 |
+
if (row > foldStart) {
|
14021 |
+
row = foldLine.end.row + 1;
|
14022 |
+
foldLine = this.session.getNextFoldLine(row, foldLine);
|
14023 |
+
foldStart = foldLine ? foldLine.start.row : Infinity;
|
14024 |
+
}
|
14025 |
+
if (row > lastRow)
|
14026 |
+
break;
|
14027 |
+
|
14028 |
+
if (this.$useLineGroups())
|
14029 |
+
html.push("<div class='ace_line_group' style='height:", config.lineHeight * this.session.getRowLength(row), "px'>")
|
14030 |
+
|
14031 |
+
this.$renderLine(html, row, false, row == foldStart ? foldLine : false);
|
14032 |
+
|
14033 |
+
if (this.$useLineGroups())
|
14034 |
+
html.push("</div>"); // end the line group
|
14035 |
+
|
14036 |
+
row++;
|
14037 |
+
}
|
14038 |
+
this.element.innerHTML = html.join("");
|
14039 |
+
};
|
14040 |
+
|
14041 |
+
this.$textToken = {
|
14042 |
+
"text": true,
|
14043 |
+
"rparen": true,
|
14044 |
+
"lparen": true
|
14045 |
+
};
|
14046 |
+
|
14047 |
+
this.$renderToken = function(stringBuilder, screenColumn, token, value) {
|
14048 |
+
var self = this;
|
14049 |
+
var replaceReg = /\t|&|<|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g;
|
14050 |
+
var replaceFunc = function(c, a, b, tabIdx, idx4) {
|
14051 |
+
if (a) {
|
14052 |
+
return self.showInvisibles ?
|
14053 |
+
"<span class='ace_invisible ace_invisible_space'>" + lang.stringRepeat(self.SPACE_CHAR, c.length) + "</span>" :
|
14054 |
+
lang.stringRepeat("\xa0", c.length);
|
14055 |
+
} else if (c == "&") {
|
14056 |
+
return "&";
|
14057 |
+
} else if (c == "<") {
|
14058 |
+
return "<";
|
14059 |
+
} else if (c == "\t") {
|
14060 |
+
var tabSize = self.session.getScreenTabSize(screenColumn + tabIdx);
|
14061 |
+
screenColumn += tabSize - 1;
|
14062 |
+
return self.$tabStrings[tabSize];
|
14063 |
+
} else if (c == "\u3000") {
|
14064 |
+
var classToUse = self.showInvisibles ? "ace_cjk ace_invisible ace_invisible_space" : "ace_cjk";
|
14065 |
+
var space = self.showInvisibles ? self.SPACE_CHAR : "";
|
14066 |
+
screenColumn += 1;
|
14067 |
+
return "<span class='" + classToUse + "' style='width:" +
|
14068 |
+
(self.config.characterWidth * 2) +
|
14069 |
+
"px'>" + space + "</span>";
|
14070 |
+
} else if (b) {
|
14071 |
+
return "<span class='ace_invisible ace_invisible_space ace_invalid'>" + self.SPACE_CHAR + "</span>";
|
14072 |
+
} else {
|
14073 |
+
screenColumn += 1;
|
14074 |
+
return "<span class='ace_cjk' style='width:" +
|
14075 |
+
(self.config.characterWidth * 2) +
|
14076 |
+
"px'>" + c + "</span>";
|
14077 |
+
}
|
14078 |
+
};
|
14079 |
+
|
14080 |
+
var output = value.replace(replaceReg, replaceFunc);
|
14081 |
+
|
14082 |
+
if (!this.$textToken[token.type]) {
|
14083 |
+
var classes = "ace_" + token.type.replace(/\./g, " ace_");
|
14084 |
+
var style = "";
|
14085 |
+
if (token.type == "fold")
|
14086 |
+
style = " style='width:" + (token.value.length * this.config.characterWidth) + "px;' ";
|
14087 |
+
stringBuilder.push("<span class='", classes, "'", style, ">", output, "</span>");
|
14088 |
+
} else {
|
14089 |
+
stringBuilder.push(output);
|
14090 |
+
}
|
14091 |
+
return screenColumn + value.length;
|
14092 |
+
};
|
14093 |
+
|
14094 |
+
this.renderIndentGuide = function(stringBuilder, value, max) {
|
14095 |
+
var cols = value.search(this.$indentGuideRe);
|
14096 |
+
if (cols <= 0 || cols >= max)
|
14097 |
+
return value;
|
14098 |
+
if (value[0] == " ") {
|
14099 |
+
cols -= cols % this.tabSize;
|
14100 |
+
stringBuilder.push(lang.stringRepeat(this.$tabStrings[" "], cols / this.tabSize));
|
14101 |
+
return value.substr(cols);
|
14102 |
+
} else if (value[0] == "\t") {
|
14103 |
+
stringBuilder.push(lang.stringRepeat(this.$tabStrings["\t"], cols));
|
14104 |
+
return value.substr(cols);
|
14105 |
+
}
|
14106 |
+
return value;
|
14107 |
+
};
|
14108 |
+
|
14109 |
+
this.$renderWrappedLine = function(stringBuilder, tokens, splits, onlyContents) {
|
14110 |
+
var chars = 0;
|
14111 |
+
var split = 0;
|
14112 |
+
var splitChars = splits[0];
|
14113 |
+
var screenColumn = 0;
|
14114 |
+
|
14115 |
+
for (var i = 0; i < tokens.length; i++) {
|
14116 |
+
var token = tokens[i];
|
14117 |
+
var value = token.value;
|
14118 |
+
if (i == 0 && this.displayIndentGuides) {
|
14119 |
+
chars = value.length;
|
14120 |
+
value = this.renderIndentGuide(stringBuilder, value, splitChars);
|
14121 |
+
if (!value)
|
14122 |
+
continue;
|
14123 |
+
chars -= value.length;
|
14124 |
+
}
|
14125 |
+
|
14126 |
+
if (chars + value.length < splitChars) {
|
14127 |
+
screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
|
14128 |
+
chars += value.length;
|
14129 |
+
} else {
|
14130 |
+
while (chars + value.length >= splitChars) {
|
14131 |
+
screenColumn = this.$renderToken(
|
14132 |
+
stringBuilder, screenColumn,
|
14133 |
+
token, value.substring(0, splitChars - chars)
|
14134 |
+
);
|
14135 |
+
value = value.substring(splitChars - chars);
|
14136 |
+
chars = splitChars;
|
14137 |
+
|
14138 |
+
if (!onlyContents) {
|
14139 |
+
stringBuilder.push("</div>",
|
14140 |
+
"<div class='ace_line' style='height:",
|
14141 |
+
this.config.lineHeight, "px'>"
|
14142 |
+
);
|
14143 |
+
}
|
14144 |
+
|
14145 |
+
split++;
|
14146 |
+
screenColumn = 0;
|
14147 |
+
splitChars = splits[split] || Number.MAX_VALUE;
|
14148 |
+
}
|
14149 |
+
if (value.length != 0) {
|
14150 |
+
chars += value.length;
|
14151 |
+
screenColumn = this.$renderToken(
|
14152 |
+
stringBuilder, screenColumn, token, value
|
14153 |
+
);
|
14154 |
+
}
|
14155 |
+
}
|
14156 |
+
}
|
14157 |
+
};
|
14158 |
+
|
14159 |
+
this.$renderSimpleLine = function(stringBuilder, tokens) {
|
14160 |
+
var screenColumn = 0;
|
14161 |
+
var token = tokens[0];
|
14162 |
+
var value = token.value;
|
14163 |
+
if (this.displayIndentGuides)
|
14164 |
+
value = this.renderIndentGuide(stringBuilder, value);
|
14165 |
+
if (value)
|
14166 |
+
screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
|
14167 |
+
for (var i = 1; i < tokens.length; i++) {
|
14168 |
+
token = tokens[i];
|
14169 |
+
value = token.value;
|
14170 |
+
screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
|
14171 |
+
}
|
14172 |
+
};
|
14173 |
+
this.$renderLine = function(stringBuilder, row, onlyContents, foldLine) {
|
14174 |
+
if (!foldLine && foldLine != false)
|
14175 |
+
foldLine = this.session.getFoldLine(row);
|
14176 |
+
|
14177 |
+
if (foldLine)
|
14178 |
+
var tokens = this.$getFoldLineTokens(row, foldLine);
|
14179 |
+
else
|
14180 |
+
var tokens = this.session.getTokens(row);
|
14181 |
+
|
14182 |
+
|
14183 |
+
if (!onlyContents) {
|
14184 |
+
stringBuilder.push(
|
14185 |
+
"<div class='ace_line' style='height:",
|
14186 |
+
this.config.lineHeight * (
|
14187 |
+
this.$useLineGroups() ? 1 : this.session.getRowLength(row)
|
14188 |
+
), "px'>"
|
14189 |
+
);
|
14190 |
+
}
|
14191 |
+
|
14192 |
+
if (tokens.length) {
|
14193 |
+
var splits = this.session.getRowSplitData(row);
|
14194 |
+
if (splits && splits.length)
|
14195 |
+
this.$renderWrappedLine(stringBuilder, tokens, splits, onlyContents);
|
14196 |
+
else
|
14197 |
+
this.$renderSimpleLine(stringBuilder, tokens);
|
14198 |
+
}
|
14199 |
+
|
14200 |
+
if (this.showInvisibles) {
|
14201 |
+
if (foldLine)
|
14202 |
+
row = foldLine.end.row
|
14203 |
+
|
14204 |
+
stringBuilder.push(
|
14205 |
+
"<span class='ace_invisible ace_invisible_eol'>",
|
14206 |
+
row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR,
|
14207 |
+
"</span>"
|
14208 |
+
);
|
14209 |
+
}
|
14210 |
+
if (!onlyContents)
|
14211 |
+
stringBuilder.push("</div>");
|
14212 |
+
};
|
14213 |
+
|
14214 |
+
this.$getFoldLineTokens = function(row, foldLine) {
|
14215 |
+
var session = this.session;
|
14216 |
+
var renderTokens = [];
|
14217 |
+
|
14218 |
+
function addTokens(tokens, from, to) {
|
14219 |
+
var idx = 0,
|
14220 |
+
col = 0;
|
14221 |
+
while ((col + tokens[idx].value.length) < from) {
|
14222 |
+
col += tokens[idx].value.length;
|
14223 |
+
idx++;
|
14224 |
+
|
14225 |
+
if (idx == tokens.length)
|
14226 |
+
return;
|
14227 |
+
}
|
14228 |
+
if (col != from) {
|
14229 |
+
var value = tokens[idx].value.substring(from - col);
|
14230 |
+
if (value.length > (to - from))
|
14231 |
+
value = value.substring(0, to - from);
|
14232 |
+
|
14233 |
+
renderTokens.push({
|
14234 |
+
type: tokens[idx].type,
|
14235 |
+
value: value
|
14236 |
+
});
|
14237 |
+
|
14238 |
+
col = from + value.length;
|
14239 |
+
idx += 1;
|
14240 |
+
}
|
14241 |
+
|
14242 |
+
while (col < to && idx < tokens.length) {
|
14243 |
+
var value = tokens[idx].value;
|
14244 |
+
if (value.length + col > to) {
|
14245 |
+
renderTokens.push({
|
14246 |
+
type: tokens[idx].type,
|
14247 |
+
value: value.substring(0, to - col)
|
14248 |
+
});
|
14249 |
+
} else
|
14250 |
+
renderTokens.push(tokens[idx]);
|
14251 |
+
col += value.length;
|
14252 |
+
idx += 1;
|
14253 |
+
}
|
14254 |
+
}
|
14255 |
+
|
14256 |
+
var tokens = session.getTokens(row);
|
14257 |
+
foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
|
14258 |
+
if (placeholder != null) {
|
14259 |
+
renderTokens.push({
|
14260 |
+
type: "fold",
|
14261 |
+
value: placeholder
|
14262 |
+
});
|
14263 |
+
} else {
|
14264 |
+
if (isNewRow)
|
14265 |
+
tokens = session.getTokens(row);
|
14266 |
+
|
14267 |
+
if (tokens.length)
|
14268 |
+
addTokens(tokens, lastColumn, column);
|
14269 |
+
}
|
14270 |
+
}, foldLine.end.row, this.session.getLine(foldLine.end.row).length);
|
14271 |
+
|
14272 |
+
return renderTokens;
|
14273 |
+
};
|
14274 |
+
|
14275 |
+
this.$useLineGroups = function() {
|
14276 |
+
return this.session.getUseWrapMode();
|
14277 |
+
};
|
14278 |
+
|
14279 |
+
this.destroy = function() {
|
14280 |
+
clearInterval(this.$pollSizeChangesTimer);
|
14281 |
+
if (this.$measureNode)
|
14282 |
+
this.$measureNode.parentNode.removeChild(this.$measureNode);
|
14283 |
+
delete this.$measureNode;
|
14284 |
+
};
|
14285 |
+
|
14286 |
+
}).call(Text.prototype);
|
14287 |
+
|
14288 |
+
exports.Text = Text;
|
14289 |
+
|
14290 |
+
});
|
14291 |
+
|
14292 |
+
ace.define("ace/layer/cursor", ["require", "exports", "module", "ace/lib/dom"], function(require, exports, module) {
|
14293 |
+
"use strict";
|
14294 |
+
|
14295 |
+
var dom = require("../lib/dom");
|
14296 |
+
var IE8;
|
14297 |
+
|
14298 |
+
var Cursor = function(parentEl) {
|
14299 |
+
this.element = dom.createElement("div");
|
14300 |
+
this.element.className = "ace_layer ace_cursor-layer";
|
14301 |
+
parentEl.appendChild(this.element);
|
14302 |
+
|
14303 |
+
if (IE8 === undefined)
|
14304 |
+
IE8 = "opacity" in this.element;
|
14305 |
+
|
14306 |
+
this.isVisible = false;
|
14307 |
+
this.isBlinking = true;
|
14308 |
+
this.blinkInterval = 1000;
|
14309 |
+
this.smoothBlinking = false;
|
14310 |
+
|
14311 |
+
this.cursors = [];
|
14312 |
+
this.cursor = this.addCursor();
|
14313 |
+
dom.addCssClass(this.element, "ace_hidden-cursors");
|
14314 |
+
this.$updateCursors = this.$updateVisibility.bind(this);
|
14315 |
+
};
|
14316 |
+
|
14317 |
+
(function() {
|
14318 |
+
|
14319 |
+
this.$updateVisibility = function(val) {
|
14320 |
+
var cursors = this.cursors;
|
14321 |
+
for (var i = cursors.length; i--;)
|
14322 |
+
cursors[i].style.visibility = val ? "" : "hidden";
|
14323 |
+
};
|
14324 |
+
this.$updateOpacity = function(val) {
|
14325 |
+
var cursors = this.cursors;
|
14326 |
+
for (var i = cursors.length; i--;)
|
14327 |
+
cursors[i].style.opacity = val ? "" : "0";
|
14328 |
+
};
|
14329 |
+
|
14330 |
+
|
14331 |
+
this.$padding = 0;
|
14332 |
+
this.setPadding = function(padding) {
|
14333 |
+
this.$padding = padding;
|
14334 |
+
};
|
14335 |
+
|
14336 |
+
this.setSession = function(session) {
|
14337 |
+
this.session = session;
|
14338 |
+
};
|
14339 |
+
|
14340 |
+
this.setBlinking = function(blinking) {
|
14341 |
+
if (blinking != this.isBlinking) {
|
14342 |
+
this.isBlinking = blinking;
|
14343 |
+
this.restartTimer();
|
14344 |
+
}
|
14345 |
+
};
|
14346 |
+
|
14347 |
+
this.setBlinkInterval = function(blinkInterval) {
|
14348 |
+
if (blinkInterval != this.blinkInterval) {
|
14349 |
+
this.blinkInterval = blinkInterval;
|
14350 |
+
this.restartTimer();
|
14351 |
+
}
|
14352 |
+
};
|
14353 |
+
|
14354 |
+
this.setSmoothBlinking = function(smoothBlinking) {
|
14355 |
+
if (smoothBlinking != this.smoothBlinking && !IE8) {
|
14356 |
+
this.smoothBlinking = smoothBlinking;
|
14357 |
+
dom.setCssClass(this.element, "ace_smooth-blinking", smoothBlinking);
|
14358 |
+
this.$updateCursors(true);
|
14359 |
+
this.$updateCursors = (smoothBlinking ? this.$updateOpacity : this.$updateVisibility).bind(this);
|
14360 |
+
this.restartTimer();
|
14361 |
+
}
|
14362 |
+
};
|
14363 |
+
|
14364 |
+
this.addCursor = function() {
|
14365 |
+
var el = dom.createElement("div");
|
14366 |
+
el.className = "ace_cursor";
|
14367 |
+
this.element.appendChild(el);
|
14368 |
+
this.cursors.push(el);
|
14369 |
+
return el;
|
14370 |
+
};
|
14371 |
+
|
14372 |
+
this.removeCursor = function() {
|
14373 |
+
if (this.cursors.length > 1) {
|
14374 |
+
var el = this.cursors.pop();
|
14375 |
+
el.parentNode.removeChild(el);
|
14376 |
+
return el;
|
14377 |
+
}
|
14378 |
+
};
|
14379 |
+
|
14380 |
+
this.hideCursor = function() {
|
14381 |
+
this.isVisible = false;
|
14382 |
+
dom.addCssClass(this.element, "ace_hidden-cursors");
|
14383 |
+
this.restartTimer();
|
14384 |
+
};
|
14385 |
+
|
14386 |
+
this.showCursor = function() {
|
14387 |
+
this.isVisible = true;
|
14388 |
+
dom.removeCssClass(this.element, "ace_hidden-cursors");
|
14389 |
+
this.restartTimer();
|
14390 |
+
};
|
14391 |
+
|
14392 |
+
this.restartTimer = function() {
|
14393 |
+
var update = this.$updateCursors;
|
14394 |
+
clearInterval(this.intervalId);
|
14395 |
+
clearTimeout(this.timeoutId);
|
14396 |
+
if (this.smoothBlinking) {
|
14397 |
+
dom.removeCssClass(this.element, "ace_smooth-blinking");
|
14398 |
+
}
|
14399 |
+
|
14400 |
+
update(true);
|
14401 |
+
|
14402 |
+
if (!this.isBlinking || !this.blinkInterval || !this.isVisible)
|
14403 |
+
return;
|
14404 |
+
|
14405 |
+
if (this.smoothBlinking) {
|
14406 |
+
setTimeout(function() {
|
14407 |
+
dom.addCssClass(this.element, "ace_smooth-blinking");
|
14408 |
+
}.bind(this));
|
14409 |
+
}
|
14410 |
+
|
14411 |
+
var blink = function() {
|
14412 |
+
this.timeoutId = setTimeout(function() {
|
14413 |
+
update(false);
|
14414 |
+
}, 0.6 * this.blinkInterval);
|
14415 |
+
}.bind(this);
|
14416 |
+
|
14417 |
+
this.intervalId = setInterval(function() {
|
14418 |
+
update(true);
|
14419 |
+
blink();
|
14420 |
+
}, this.blinkInterval);
|
14421 |
+
|
14422 |
+
blink();
|
14423 |
+
};
|
14424 |
+
|
14425 |
+
this.getPixelPosition = function(position, onScreen) {
|
14426 |
+
if (!this.config || !this.session)
|
14427 |
+
return {
|
14428 |
+
left: 0,
|
14429 |
+
top: 0
|
14430 |
+
};
|
14431 |
+
|
14432 |
+
if (!position)
|
14433 |
+
position = this.session.selection.getCursor();
|
14434 |
+
var pos = this.session.documentToScreenPosition(position);
|
14435 |
+
var cursorLeft = this.$padding + pos.column * this.config.characterWidth;
|
14436 |
+
var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) *
|
14437 |
+
this.config.lineHeight;
|
14438 |
+
|
14439 |
+
return {
|
14440 |
+
left: cursorLeft,
|
14441 |
+
top: cursorTop
|
14442 |
+
};
|
14443 |
+
};
|
14444 |
+
|
14445 |
+
this.update = function(config) {
|
14446 |
+
this.config = config;
|
14447 |
+
|
14448 |
+
var selections = this.session.$selectionMarkers;
|
14449 |
+
var i = 0,
|
14450 |
+
cursorIndex = 0;
|
14451 |
+
|
14452 |
+
if (selections === undefined || selections.length === 0) {
|
14453 |
+
selections = [{
|
14454 |
+
cursor: null
|
14455 |
+
}];
|
14456 |
+
}
|
14457 |
+
|
14458 |
+
for (var i = 0, n = selections.length; i < n; i++) {
|
14459 |
+
var pixelPos = this.getPixelPosition(selections[i].cursor, true);
|
14460 |
+
if ((pixelPos.top > config.height + config.offset ||
|
14461 |
+
pixelPos.top < 0) && i > 1) {
|
14462 |
+
continue;
|
14463 |
+
}
|
14464 |
+
|
14465 |
+
var style = (this.cursors[cursorIndex++] || this.addCursor()).style;
|
14466 |
+
|
14467 |
+
style.left = pixelPos.left + "px";
|
14468 |
+
style.top = pixelPos.top + "px";
|
14469 |
+
style.width = config.characterWidth + "px";
|
14470 |
+
style.height = config.lineHeight + "px";
|
14471 |
+
}
|
14472 |
+
while (this.cursors.length > cursorIndex)
|
14473 |
+
this.removeCursor();
|
14474 |
+
|
14475 |
+
var overwrite = this.session.getOverwrite();
|
14476 |
+
this.$setOverwrite(overwrite);
|
14477 |
+
this.$pixelPos = pixelPos;
|
14478 |
+
this.restartTimer();
|
14479 |
+
};
|
14480 |
+
|
14481 |
+
this.$setOverwrite = function(overwrite) {
|
14482 |
+
if (overwrite != this.overwrite) {
|
14483 |
+
this.overwrite = overwrite;
|
14484 |
+
if (overwrite)
|
14485 |
+
dom.addCssClass(this.element, "ace_overwrite-cursors");
|
14486 |
+
else
|
14487 |
+
dom.removeCssClass(this.element, "ace_overwrite-cursors");
|
14488 |
+
}
|
14489 |
+
};
|
14490 |
+
|
14491 |
+
this.destroy = function() {
|
14492 |
+
clearInterval(this.intervalId);
|
14493 |
+
clearTimeout(this.timeoutId);
|
14494 |
+
};
|
14495 |
+
|
14496 |
+
}).call(Cursor.prototype);
|
14497 |
+
|
14498 |
+
exports.Cursor = Cursor;
|
14499 |
+
|
14500 |
+
});
|
14501 |
+
|
14502 |
+
ace.define("ace/scrollbar", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/event", "ace/lib/event_emitter"], function(require, exports, module) {
|
14503 |
+
"use strict";
|
14504 |
+
|
14505 |
+
var oop = require("./lib/oop");
|
14506 |
+
var dom = require("./lib/dom");
|
14507 |
+
var event = require("./lib/event");
|
14508 |
+
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
14509 |
+
var ScrollBar = function(parent) {
|
14510 |
+
this.element = dom.createElement("div");
|
14511 |
+
this.element.className = "ace_scrollbar ace_scrollbar" + this.classSuffix;
|
14512 |
+
|
14513 |
+
this.inner = dom.createElement("div");
|
14514 |
+
this.inner.className = "ace_scrollbar-inner";
|
14515 |
+
this.element.appendChild(this.inner);
|
14516 |
+
|
14517 |
+
parent.appendChild(this.element);
|
14518 |
+
|
14519 |
+
this.setVisible(false);
|
14520 |
+
this.skipEvent = false;
|
14521 |
+
|
14522 |
+
event.addListener(this.element, "scroll", this.onScroll.bind(this));
|
14523 |
+
event.addListener(this.element, "mousedown", event.preventDefault);
|
14524 |
+
};
|
14525 |
+
|
14526 |
+
(function() {
|
14527 |
+
oop.implement(this, EventEmitter);
|
14528 |
+
|
14529 |
+
this.setVisible = function(isVisible) {
|
14530 |
+
this.element.style.display = isVisible ? "" : "none";
|
14531 |
+
this.isVisible = isVisible;
|
14532 |
+
};
|
14533 |
+
}).call(ScrollBar.prototype);
|
14534 |
+
var VScrollBar = function(parent, renderer) {
|
14535 |
+
ScrollBar.call(this, parent);
|
14536 |
+
this.scrollTop = 0;
|
14537 |
+
renderer.$scrollbarWidth =
|
14538 |
+
this.width = dom.scrollbarWidth(parent.ownerDocument);
|
14539 |
+
this.inner.style.width =
|
14540 |
+
this.element.style.width = (this.width || 15) + 5 + "px";
|
14541 |
+
};
|
14542 |
+
|
14543 |
+
oop.inherits(VScrollBar, ScrollBar);
|
14544 |
+
|
14545 |
+
(function() {
|
14546 |
+
|
14547 |
+
this.classSuffix = '-v';
|
14548 |
+
this.onScroll = function() {
|
14549 |
+
if (!this.skipEvent) {
|
14550 |
+
this.scrollTop = this.element.scrollTop;
|
14551 |
+
this._emit("scroll", {
|
14552 |
+
data: this.scrollTop
|
14553 |
+
});
|
14554 |
+
}
|
14555 |
+
this.skipEvent = false;
|
14556 |
+
};
|
14557 |
+
this.getWidth = function() {
|
14558 |
+
return this.isVisible ? this.width : 0;
|
14559 |
+
};
|
14560 |
+
this.setHeight = function(height) {
|
14561 |
+
this.element.style.height = height + "px";
|
14562 |
+
};
|
14563 |
+
this.setInnerHeight = function(height) {
|
14564 |
+
this.inner.style.height = height + "px";
|
14565 |
+
};
|
14566 |
+
this.setScrollHeight = function(height) {
|
14567 |
+
this.inner.style.height = height + "px";
|
14568 |
+
};
|
14569 |
+
this.setScrollTop = function(scrollTop) {
|
14570 |
+
if (this.scrollTop != scrollTop) {
|
14571 |
+
this.skipEvent = true;
|
14572 |
+
this.scrollTop = this.element.scrollTop = scrollTop;
|
14573 |
+
}
|
14574 |
+
};
|
14575 |
+
|
14576 |
+
}).call(VScrollBar.prototype);
|
14577 |
+
var HScrollBar = function(parent, renderer) {
|
14578 |
+
ScrollBar.call(this, parent);
|
14579 |
+
this.scrollLeft = 0;
|
14580 |
+
this.height = renderer.$scrollbarWidth;
|
14581 |
+
this.inner.style.height =
|
14582 |
+
this.element.style.height = (this.height || 15) + 5 + "px";
|
14583 |
+
};
|
14584 |
+
|
14585 |
+
oop.inherits(HScrollBar, ScrollBar);
|
14586 |
+
|
14587 |
+
(function() {
|
14588 |
+
|
14589 |
+
this.classSuffix = '-h';
|
14590 |
+
this.onScroll = function() {
|
14591 |
+
if (!this.skipEvent) {
|
14592 |
+
this.scrollLeft = this.element.scrollLeft;
|
14593 |
+
this._emit("scroll", {
|
14594 |
+
data: this.scrollLeft
|
14595 |
+
});
|
14596 |
+
}
|
14597 |
+
this.skipEvent = false;
|
14598 |
+
};
|
14599 |
+
this.getHeight = function() {
|
14600 |
+
return this.isVisible ? this.height : 0;
|
14601 |
+
};
|
14602 |
+
this.setWidth = function(width) {
|
14603 |
+
this.element.style.width = width + "px";
|
14604 |
+
};
|
14605 |
+
this.setInnerWidth = function(width) {
|
14606 |
+
this.inner.style.width = width + "px";
|
14607 |
+
};
|
14608 |
+
this.setScrollWidth = function(width) {
|
14609 |
+
this.inner.style.width = width + "px";
|
14610 |
+
};
|
14611 |
+
this.setScrollLeft = function(scrollLeft) {
|
14612 |
+
if (this.scrollLeft != scrollLeft) {
|
14613 |
+
this.skipEvent = true;
|
14614 |
+
this.scrollLeft = this.element.scrollLeft = scrollLeft;
|
14615 |
+
}
|
14616 |
+
};
|
14617 |
+
|
14618 |
+
}).call(HScrollBar.prototype);
|
14619 |
+
|
14620 |
+
|
14621 |
+
exports.ScrollBar = VScrollBar; // backward compatibility
|
14622 |
+
exports.ScrollBarV = VScrollBar; // backward compatibility
|
14623 |
+
exports.ScrollBarH = HScrollBar; // backward compatibility
|
14624 |
+
|
14625 |
+
exports.VScrollBar = VScrollBar;
|
14626 |
+
exports.HScrollBar = HScrollBar;
|
14627 |
+
});
|
14628 |
+
|
14629 |
+
ace.define("ace/renderloop", ["require", "exports", "module", "ace/lib/event"], function(require, exports, module) {
|
14630 |
+
"use strict";
|
14631 |
+
|
14632 |
+
var event = require("./lib/event");
|
14633 |
+
|
14634 |
+
|
14635 |
+
var RenderLoop = function(onRender, win) {
|
14636 |
+
this.onRender = onRender;
|
14637 |
+
this.pending = false;
|
14638 |
+
this.changes = 0;
|
14639 |
+
this.window = win || window;
|
14640 |
+
};
|
14641 |
+
|
14642 |
+
(function() {
|
14643 |
+
|
14644 |
+
|
14645 |
+
this.schedule = function(change) {
|
14646 |
+
this.changes = this.changes | change;
|
14647 |
+
if (!this.pending && this.changes) {
|
14648 |
+
this.pending = true;
|
14649 |
+
var _self = this;
|
14650 |
+
event.nextFrame(function() {
|
14651 |
+
_self.pending = false;
|
14652 |
+
var changes;
|
14653 |
+
while (changes = _self.changes) {
|
14654 |
+
_self.changes = 0;
|
14655 |
+
_self.onRender(changes);
|
14656 |
+
}
|
14657 |
+
}, this.window);
|
14658 |
+
}
|
14659 |
+
};
|
14660 |
+
|
14661 |
+
}).call(RenderLoop.prototype);
|
14662 |
+
|
14663 |
+
exports.RenderLoop = RenderLoop;
|
14664 |
+
});
|
14665 |
+
|
14666 |
+
ace.define("ace/layer/font_metrics", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/lang", "ace/lib/useragent", "ace/lib/event_emitter"], function(require, exports, module) {
|
14667 |
+
|
14668 |
+
var oop = require("../lib/oop");
|
14669 |
+
var dom = require("../lib/dom");
|
14670 |
+
var lang = require("../lib/lang");
|
14671 |
+
var useragent = require("../lib/useragent");
|
14672 |
+
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
14673 |
+
|
14674 |
+
var CHAR_COUNT = 0;
|
14675 |
+
|
14676 |
+
var FontMetrics = exports.FontMetrics = function(parentEl, interval) {
|
14677 |
+
this.el = dom.createElement("div");
|
14678 |
+
this.$setMeasureNodeStyles(this.el.style, true);
|
14679 |
+
|
14680 |
+
this.$main = dom.createElement("div");
|
14681 |
+
this.$setMeasureNodeStyles(this.$main.style);
|
14682 |
+
|
14683 |
+
this.$measureNode = dom.createElement("div");
|
14684 |
+
this.$setMeasureNodeStyles(this.$measureNode.style);
|
14685 |
+
|
14686 |
+
|
14687 |
+
this.el.appendChild(this.$main);
|
14688 |
+
this.el.appendChild(this.$measureNode);
|
14689 |
+
parentEl.appendChild(this.el);
|
14690 |
+
|
14691 |
+
if (!CHAR_COUNT)
|
14692 |
+
this.$testFractionalRect();
|
14693 |
+
this.$measureNode.innerHTML = lang.stringRepeat("X", CHAR_COUNT);
|
14694 |
+
|
14695 |
+
this.$characterSize = {
|
14696 |
+
width: 0,
|
14697 |
+
height: 0
|
14698 |
+
};
|
14699 |
+
this.checkForSizeChanges();
|
14700 |
+
};
|
14701 |
+
|
14702 |
+
(function() {
|
14703 |
+
|
14704 |
+
oop.implement(this, EventEmitter);
|
14705 |
+
|
14706 |
+
this.$characterSize = {
|
14707 |
+
width: 0,
|
14708 |
+
height: 0
|
14709 |
+
};
|
14710 |
+
|
14711 |
+
this.$testFractionalRect = function() {
|
14712 |
+
var el = dom.createElement("div");
|
14713 |
+
this.$setMeasureNodeStyles(el.style);
|
14714 |
+
el.style.width = "0.2px";
|
14715 |
+
document.documentElement.appendChild(el);
|
14716 |
+
var w = el.getBoundingClientRect().width;
|
14717 |
+
if (w > 0 && w < 1)
|
14718 |
+
CHAR_COUNT = 50;
|
14719 |
+
else
|
14720 |
+
CHAR_COUNT = 100;
|
14721 |
+
el.parentNode.removeChild(el);
|
14722 |
+
};
|
14723 |
+
|
14724 |
+
this.$setMeasureNodeStyles = function(style, isRoot) {
|
14725 |
+
style.width = style.height = "auto";
|
14726 |
+
style.left = style.top = "-100px";
|
14727 |
+
style.visibility = "hidden";
|
14728 |
+
style.position = "fixed";
|
14729 |
+
style.whiteSpace = "pre";
|
14730 |
+
|
14731 |
+
if (useragent.isIE < 8) {
|
14732 |
+
style["font-family"] = "inherit";
|
14733 |
+
} else {
|
14734 |
+
style.font = "inherit";
|
14735 |
+
}
|
14736 |
+
style.overflow = isRoot ? "hidden" : "visible";
|
14737 |
+
};
|
14738 |
+
|
14739 |
+
this.checkForSizeChanges = function() {
|
14740 |
+
var size = this.$measureSizes();
|
14741 |
+
if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) {
|
14742 |
+
this.$measureNode.style.fontWeight = "bold";
|
14743 |
+
var boldSize = this.$measureSizes();
|
14744 |
+
this.$measureNode.style.fontWeight = "";
|
14745 |
+
this.$characterSize = size;
|
14746 |
+
this.charSizes = Object.create(null);
|
14747 |
+
this.allowBoldFonts = boldSize && boldSize.width === size.width && boldSize.height === size.height;
|
14748 |
+
this._emit("changeCharacterSize", {
|
14749 |
+
data: size
|
14750 |
+
});
|
14751 |
+
}
|
14752 |
+
};
|
14753 |
+
|
14754 |
+
this.$pollSizeChanges = function() {
|
14755 |
+
if (this.$pollSizeChangesTimer)
|
14756 |
+
return this.$pollSizeChangesTimer;
|
14757 |
+
var self = this;
|
14758 |
+
return this.$pollSizeChangesTimer = setInterval(function() {
|
14759 |
+
self.checkForSizeChanges();
|
14760 |
+
}, 500);
|
14761 |
+
};
|
14762 |
+
|
14763 |
+
this.setPolling = function(val) {
|
14764 |
+
if (val) {
|
14765 |
+
this.$pollSizeChanges();
|
14766 |
+
} else {
|
14767 |
+
if (this.$pollSizeChangesTimer)
|
14768 |
+
this.$pollSizeChangesTimer;
|
14769 |
+
}
|
14770 |
+
};
|
14771 |
+
|
14772 |
+
this.$measureSizes = function() {
|
14773 |
+
if (CHAR_COUNT === 50) {
|
14774 |
+
var rect = null;
|
14775 |
+
try {
|
14776 |
+
rect = this.$measureNode.getBoundingClientRect();
|
14777 |
+
} catch (e) {
|
14778 |
+
rect = {
|
14779 |
+
width: 0,
|
14780 |
+
height: 0
|
14781 |
+
};
|
14782 |
+
};
|
14783 |
+
var size = {
|
14784 |
+
height: rect.height,
|
14785 |
+
width: rect.width / CHAR_COUNT
|
14786 |
+
};
|
14787 |
+
} else {
|
14788 |
+
var size = {
|
14789 |
+
height: this.$measureNode.clientHeight,
|
14790 |
+
width: this.$measureNode.clientWidth / CHAR_COUNT
|
14791 |
+
};
|
14792 |
+
}
|
14793 |
+
if (size.width === 0 || size.height === 0)
|
14794 |
+
return null;
|
14795 |
+
return size;
|
14796 |
+
};
|
14797 |
+
|
14798 |
+
this.$measureCharWidth = function(ch) {
|
14799 |
+
this.$main.innerHTML = lang.stringRepeat(ch, CHAR_COUNT);
|
14800 |
+
var rect = this.$main.getBoundingClientRect();
|
14801 |
+
return rect.width / CHAR_COUNT;
|
14802 |
+
};
|
14803 |
+
|
14804 |
+
this.getCharacterWidth = function(ch) {
|
14805 |
+
var w = this.charSizes[ch];
|
14806 |
+
if (w === undefined) {
|
14807 |
+
this.charSizes[ch] = this.$measureCharWidth(ch) / this.$characterSize.width;
|
14808 |
+
}
|
14809 |
+
return w;
|
14810 |
+
};
|
14811 |
+
|
14812 |
+
this.destroy = function() {
|
14813 |
+
clearInterval(this.$pollSizeChangesTimer);
|
14814 |
+
if (this.el && this.el.parentNode)
|
14815 |
+
this.el.parentNode.removeChild(this.el);
|
14816 |
+
};
|
14817 |
+
|
14818 |
+
}).call(FontMetrics.prototype);
|
14819 |
+
|
14820 |
+
});
|
14821 |
+
|
14822 |
+
ace.define("ace/virtual_renderer", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/config", "ace/lib/useragent", "ace/layer/gutter", "ace/layer/marker", "ace/layer/text", "ace/layer/cursor", "ace/scrollbar", "ace/scrollbar", "ace/renderloop", "ace/layer/font_metrics", "ace/lib/event_emitter"], function(require, exports, module) {
|
14823 |
+
"use strict";
|
14824 |
+
|
14825 |
+
var oop = require("./lib/oop");
|
14826 |
+
var dom = require("./lib/dom");
|
14827 |
+
var config = require("./config");
|
14828 |
+
var useragent = require("./lib/useragent");
|
14829 |
+
var GutterLayer = require("./layer/gutter").Gutter;
|
14830 |
+
var MarkerLayer = require("./layer/marker").Marker;
|
14831 |
+
var TextLayer = require("./layer/text").Text;
|
14832 |
+
var CursorLayer = require("./layer/cursor").Cursor;
|
14833 |
+
var HScrollBar = require("./scrollbar").HScrollBar;
|
14834 |
+
var VScrollBar = require("./scrollbar").VScrollBar;
|
14835 |
+
var RenderLoop = require("./renderloop").RenderLoop;
|
14836 |
+
var FontMetrics = require("./layer/font_metrics").FontMetrics;
|
14837 |
+
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
14838 |
+
var editorCss = ".ace_editor {\
|
14839 |
+
position: relative;\
|
14840 |
+
overflow: hidden;\
|
14841 |
+
font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;\
|
14842 |
+
direction: ltr;\
|
14843 |
+
}\
|
14844 |
+
.ace_scroller {\
|
14845 |
+
position: absolute;\
|
14846 |
+
overflow: hidden;\
|
14847 |
+
top: 0;\
|
14848 |
+
bottom: 0;\
|
14849 |
+
background-color: inherit;\
|
14850 |
+
-ms-user-select: none;\
|
14851 |
+
-moz-user-select: none;\
|
14852 |
+
-webkit-user-select: none;\
|
14853 |
+
user-select: none;\
|
14854 |
+
cursor: text;\
|
14855 |
+
}\
|
14856 |
+
.ace_content {\
|
14857 |
+
position: absolute;\
|
14858 |
+
-moz-box-sizing: border-box;\
|
14859 |
+
-webkit-box-sizing: border-box;\
|
14860 |
+
box-sizing: border-box;\
|
14861 |
+
min-width: 100%;\
|
14862 |
+
}\
|
14863 |
+
.ace_dragging .ace_scroller:before{\
|
14864 |
+
position: absolute;\
|
14865 |
+
top: 0;\
|
14866 |
+
left: 0;\
|
14867 |
+
right: 0;\
|
14868 |
+
bottom: 0;\
|
14869 |
+
content: '';\
|
14870 |
+
background: rgba(250, 250, 250, 0.01);\
|
14871 |
+
z-index: 1000;\
|
14872 |
+
}\
|
14873 |
+
.ace_dragging.ace_dark .ace_scroller:before{\
|
14874 |
+
background: rgba(0, 0, 0, 0.01);\
|
14875 |
+
}\
|
14876 |
+
.ace_selecting, .ace_selecting * {\
|
14877 |
+
cursor: text !important;\
|
14878 |
+
}\
|
14879 |
+
.ace_gutter {\
|
14880 |
+
position: absolute;\
|
14881 |
+
overflow : hidden;\
|
14882 |
+
width: auto;\
|
14883 |
+
top: 0;\
|
14884 |
+
bottom: 0;\
|
14885 |
+
left: 0;\
|
14886 |
+
cursor: default;\
|
14887 |
+
z-index: 4;\
|
14888 |
+
-ms-user-select: none;\
|
14889 |
+
-moz-user-select: none;\
|
14890 |
+
-webkit-user-select: none;\
|
14891 |
+
user-select: none;\
|
14892 |
+
}\
|
14893 |
+
.ace_gutter-active-line {\
|
14894 |
+
position: absolute;\
|
14895 |
+
left: 0;\
|
14896 |
+
right: 0;\
|
14897 |
+
}\
|
14898 |
+
.ace_scroller.ace_scroll-left {\
|
14899 |
+
box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;\
|
14900 |
+
}\
|
14901 |
+
.ace_gutter-cell {\
|
14902 |
+
padding-left: 19px;\
|
14903 |
+
padding-right: 6px;\
|
14904 |
+
background-repeat: no-repeat;\
|
14905 |
+
}\
|
14906 |
+
.ace_gutter-cell.ace_error {\
|
14907 |
+
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==\");\
|
14908 |
+
background-repeat: no-repeat;\
|
14909 |
+
background-position: 2px center;\
|
14910 |
+
}\
|
14911 |
+
.ace_gutter-cell.ace_warning {\
|
14912 |
+
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==\");\
|
14913 |
+
background-position: 2px center;\
|
14914 |
+
}\
|
14915 |
+
.ace_gutter-cell.ace_info {\
|
14916 |
+
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=\");\
|
14917 |
+
background-position: 2px center;\
|
14918 |
+
}\
|
14919 |
+
.ace_dark .ace_gutter-cell.ace_info {\
|
14920 |
+
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC\");\
|
14921 |
+
}\
|
14922 |
+
.ace_scrollbar {\
|
14923 |
+
position: absolute;\
|
14924 |
+
right: 0;\
|
14925 |
+
bottom: 0;\
|
14926 |
+
z-index: 6;\
|
14927 |
+
}\
|
14928 |
+
.ace_scrollbar-inner {\
|
14929 |
+
position: absolute;\
|
14930 |
+
cursor: text;\
|
14931 |
+
left: 0;\
|
14932 |
+
top: 0;\
|
14933 |
+
}\
|
14934 |
+
.ace_scrollbar-v{\
|
14935 |
+
overflow-x: hidden;\
|
14936 |
+
overflow-y: scroll;\
|
14937 |
+
top: 0;\
|
14938 |
+
}\
|
14939 |
+
.ace_scrollbar-h {\
|
14940 |
+
overflow-x: scroll;\
|
14941 |
+
overflow-y: hidden;\
|
14942 |
+
left: 0;\
|
14943 |
+
}\
|
14944 |
+
.ace_print-margin {\
|
14945 |
+
position: absolute;\
|
14946 |
+
height: 100%;\
|
14947 |
+
}\
|
14948 |
+
.ace_text-input {\
|
14949 |
+
position: absolute;\
|
14950 |
+
z-index: 0;\
|
14951 |
+
width: 0.5em;\
|
14952 |
+
height: 1em;\
|
14953 |
+
opacity: 0;\
|
14954 |
+
background: transparent;\
|
14955 |
+
-moz-appearance: none;\
|
14956 |
+
appearance: none;\
|
14957 |
+
border: none;\
|
14958 |
+
resize: none;\
|
14959 |
+
outline: none;\
|
14960 |
+
overflow: hidden;\
|
14961 |
+
font: inherit;\
|
14962 |
+
padding: 0 1px;\
|
14963 |
+
margin: 0 -1px;\
|
14964 |
+
text-indent: -1em;\
|
14965 |
+
-ms-user-select: text;\
|
14966 |
+
-moz-user-select: text;\
|
14967 |
+
-webkit-user-select: text;\
|
14968 |
+
user-select: text;\
|
14969 |
+
}\
|
14970 |
+
.ace_text-input.ace_composition {\
|
14971 |
+
background: inherit;\
|
14972 |
+
color: inherit;\
|
14973 |
+
z-index: 1000;\
|
14974 |
+
opacity: 1;\
|
14975 |
+
text-indent: 0;\
|
14976 |
+
}\
|
14977 |
+
.ace_layer {\
|
14978 |
+
z-index: 1;\
|
14979 |
+
position: absolute;\
|
14980 |
+
overflow: hidden;\
|
14981 |
+
white-space: pre;\
|
14982 |
+
height: 100%;\
|
14983 |
+
width: 100%;\
|
14984 |
+
-moz-box-sizing: border-box;\
|
14985 |
+
-webkit-box-sizing: border-box;\
|
14986 |
+
box-sizing: border-box;\
|
14987 |
+
pointer-events: none;\
|
14988 |
+
}\
|
14989 |
+
.ace_gutter-layer {\
|
14990 |
+
position: relative;\
|
14991 |
+
width: auto;\
|
14992 |
+
text-align: right;\
|
14993 |
+
pointer-events: auto;\
|
14994 |
+
}\
|
14995 |
+
.ace_text-layer {\
|
14996 |
+
font: inherit !important;\
|
14997 |
+
}\
|
14998 |
+
.ace_cjk {\
|
14999 |
+
display: inline-block;\
|
15000 |
+
text-align: center;\
|
15001 |
+
}\
|
15002 |
+
.ace_cursor-layer {\
|
15003 |
+
z-index: 4;\
|
15004 |
+
}\
|
15005 |
+
.ace_cursor {\
|
15006 |
+
z-index: 4;\
|
15007 |
+
position: absolute;\
|
15008 |
+
-moz-box-sizing: border-box;\
|
15009 |
+
-webkit-box-sizing: border-box;\
|
15010 |
+
box-sizing: border-box;\
|
15011 |
+
border-left: 2px solid\
|
15012 |
+
}\
|
15013 |
+
.ace_slim-cursors .ace_cursor {\
|
15014 |
+
border-left-width: 1px;\
|
15015 |
+
}\
|
15016 |
+
.ace_overwrite-cursors .ace_cursor {\
|
15017 |
+
border-left-width: 0;\
|
15018 |
+
border-bottom: 1px solid;\
|
15019 |
+
}\
|
15020 |
+
.ace_hidden-cursors .ace_cursor {\
|
15021 |
+
opacity: 0.2;\
|
15022 |
+
}\
|
15023 |
+
.ace_smooth-blinking .ace_cursor {\
|
15024 |
+
-webkit-transition: opacity 0.18s;\
|
15025 |
+
transition: opacity 0.18s;\
|
15026 |
+
}\
|
15027 |
+
.ace_editor.ace_multiselect .ace_cursor {\
|
15028 |
+
border-left-width: 1px;\
|
15029 |
+
}\
|
15030 |
+
.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {\
|
15031 |
+
position: absolute;\
|
15032 |
+
z-index: 3;\
|
15033 |
+
}\
|
15034 |
+
.ace_marker-layer .ace_selection {\
|
15035 |
+
position: absolute;\
|
15036 |
+
z-index: 5;\
|
15037 |
+
}\
|
15038 |
+
.ace_marker-layer .ace_bracket {\
|
15039 |
+
position: absolute;\
|
15040 |
+
z-index: 6;\
|
15041 |
+
}\
|
15042 |
+
.ace_marker-layer .ace_active-line {\
|
15043 |
+
position: absolute;\
|
15044 |
+
z-index: 2;\
|
15045 |
+
}\
|
15046 |
+
.ace_marker-layer .ace_selected-word {\
|
15047 |
+
position: absolute;\
|
15048 |
+
z-index: 4;\
|
15049 |
+
-moz-box-sizing: border-box;\
|
15050 |
+
-webkit-box-sizing: border-box;\
|
15051 |
+
box-sizing: border-box;\
|
15052 |
+
}\
|
15053 |
+
.ace_line .ace_fold {\
|
15054 |
+
-moz-box-sizing: border-box;\
|
15055 |
+
-webkit-box-sizing: border-box;\
|
15056 |
+
box-sizing: border-box;\
|
15057 |
+
display: inline-block;\
|
15058 |
+
height: 11px;\
|
15059 |
+
margin-top: -2px;\
|
15060 |
+
vertical-align: middle;\
|
15061 |
+
background-image:\
|
15062 |
+
url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII=\"),\
|
15063 |
+
url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=\");\
|
15064 |
+
background-repeat: no-repeat, repeat-x;\
|
15065 |
+
background-position: center center, top left;\
|
15066 |
+
color: transparent;\
|
15067 |
+
border: 1px solid black;\
|
15068 |
+
border-radius: 2px;\
|
15069 |
+
cursor: pointer;\
|
15070 |
+
pointer-events: auto;\
|
15071 |
+
}\
|
15072 |
+
.ace_dark .ace_fold {\
|
15073 |
+
}\
|
15074 |
+
.ace_fold:hover{\
|
15075 |
+
background-image:\
|
15076 |
+
url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII=\"),\
|
15077 |
+
url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC\");\
|
15078 |
+
}\
|
15079 |
+
.ace_tooltip {\
|
15080 |
+
background-color: #FFF;\
|
15081 |
+
background-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.1));\
|
15082 |
+
background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));\
|
15083 |
+
border: 1px solid gray;\
|
15084 |
+
border-radius: 1px;\
|
15085 |
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\
|
15086 |
+
color: black;\
|
15087 |
+
max-width: 100%;\
|
15088 |
+
padding: 3px 4px;\
|
15089 |
+
position: fixed;\
|
15090 |
+
z-index: 999999;\
|
15091 |
+
-moz-box-sizing: border-box;\
|
15092 |
+
-webkit-box-sizing: border-box;\
|
15093 |
+
box-sizing: border-box;\
|
15094 |
+
cursor: default;\
|
15095 |
+
white-space: pre;\
|
15096 |
+
word-wrap: break-word;\
|
15097 |
+
line-height: normal;\
|
15098 |
+
font-style: normal;\
|
15099 |
+
font-weight: normal;\
|
15100 |
+
letter-spacing: normal;\
|
15101 |
+
pointer-events: none;\
|
15102 |
+
}\
|
15103 |
+
.ace_folding-enabled > .ace_gutter-cell {\
|
15104 |
+
padding-right: 13px;\
|
15105 |
+
}\
|
15106 |
+
.ace_fold-widget {\
|
15107 |
+
-moz-box-sizing: border-box;\
|
15108 |
+
-webkit-box-sizing: border-box;\
|
15109 |
+
box-sizing: border-box;\
|
15110 |
+
margin: 0 -12px 0 1px;\
|
15111 |
+
display: none;\
|
15112 |
+
width: 11px;\
|
15113 |
+
vertical-align: top;\
|
15114 |
+
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==\");\
|
15115 |
+
background-repeat: no-repeat;\
|
15116 |
+
background-position: center;\
|
15117 |
+
border-radius: 3px;\
|
15118 |
+
border: 1px solid transparent;\
|
15119 |
+
cursor: pointer;\
|
15120 |
+
}\
|
15121 |
+
.ace_folding-enabled .ace_fold-widget {\
|
15122 |
+
display: inline-block; \
|
15123 |
+
}\
|
15124 |
+
.ace_fold-widget.ace_end {\
|
15125 |
+
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==\");\
|
15126 |
+
}\
|
15127 |
+
.ace_fold-widget.ace_closed {\
|
15128 |
+
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==\");\
|
15129 |
+
}\
|
15130 |
+
.ace_fold-widget:hover {\
|
15131 |
+
border: 1px solid rgba(0, 0, 0, 0.3);\
|
15132 |
+
background-color: rgba(255, 255, 255, 0.2);\
|
15133 |
+
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\
|
15134 |
+
}\
|
15135 |
+
.ace_fold-widget:active {\
|
15136 |
+
border: 1px solid rgba(0, 0, 0, 0.4);\
|
15137 |
+
background-color: rgba(0, 0, 0, 0.05);\
|
15138 |
+
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\
|
15139 |
+
}\
|
15140 |
+
.ace_dark .ace_fold-widget {\
|
15141 |
+
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC\");\
|
15142 |
+
}\
|
15143 |
+
.ace_dark .ace_fold-widget.ace_end {\
|
15144 |
+
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==\");\
|
15145 |
+
}\
|
15146 |
+
.ace_dark .ace_fold-widget.ace_closed {\
|
15147 |
+
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==\");\
|
15148 |
+
}\
|
15149 |
+
.ace_dark .ace_fold-widget:hover {\
|
15150 |
+
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\
|
15151 |
+
background-color: rgba(255, 255, 255, 0.1);\
|
15152 |
+
}\
|
15153 |
+
.ace_dark .ace_fold-widget:active {\
|
15154 |
+
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\
|
15155 |
+
}\
|
15156 |
+
.ace_fold-widget.ace_invalid {\
|
15157 |
+
background-color: #FFB4B4;\
|
15158 |
+
border-color: #DE5555;\
|
15159 |
+
}\
|
15160 |
+
.ace_fade-fold-widgets .ace_fold-widget {\
|
15161 |
+
-webkit-transition: opacity 0.4s ease 0.05s;\
|
15162 |
+
transition: opacity 0.4s ease 0.05s;\
|
15163 |
+
opacity: 0;\
|
15164 |
+
}\
|
15165 |
+
.ace_fade-fold-widgets:hover .ace_fold-widget {\
|
15166 |
+
-webkit-transition: opacity 0.05s ease 0.05s;\
|
15167 |
+
transition: opacity 0.05s ease 0.05s;\
|
15168 |
+
opacity:1;\
|
15169 |
+
}\
|
15170 |
+
.ace_underline {\
|
15171 |
+
text-decoration: underline;\
|
15172 |
+
}\
|
15173 |
+
.ace_bold {\
|
15174 |
+
font-weight: bold;\
|
15175 |
+
}\
|
15176 |
+
.ace_nobold .ace_bold {\
|
15177 |
+
font-weight: normal;\
|
15178 |
+
}\
|
15179 |
+
.ace_italic {\
|
15180 |
+
font-style: italic;\
|
15181 |
+
}\
|
15182 |
+
.ace_error-marker {\
|
15183 |
+
background-color: rgba(255, 0, 0,0.2);\
|
15184 |
+
position: absolute;\
|
15185 |
+
z-index: 9;\
|
15186 |
+
}\
|
15187 |
+
.ace_highlight-marker {\
|
15188 |
+
background-color: rgba(255, 255, 0,0.2);\
|
15189 |
+
position: absolute;\
|
15190 |
+
z-index: 8;\
|
15191 |
+
}\
|
15192 |
+
";
|
15193 |
+
|
15194 |
+
dom.importCssString(editorCss, "ace_editor");
|
15195 |
+
|
15196 |
+
var VirtualRenderer = function(container, theme) {
|
15197 |
+
var _self = this;
|
15198 |
+
|
15199 |
+
this.container = container || dom.createElement("div");
|
15200 |
+
this.$keepTextAreaAtCursor = !useragent.isOldIE;
|
15201 |
+
|
15202 |
+
dom.addCssClass(this.container, "ace_editor");
|
15203 |
+
|
15204 |
+
this.setTheme(theme);
|
15205 |
+
|
15206 |
+
this.$gutter = dom.createElement("div");
|
15207 |
+
this.$gutter.className = "ace_gutter";
|
15208 |
+
this.container.appendChild(this.$gutter);
|
15209 |
+
|
15210 |
+
this.scroller = dom.createElement("div");
|
15211 |
+
this.scroller.className = "ace_scroller";
|
15212 |
+
this.container.appendChild(this.scroller);
|
15213 |
+
|
15214 |
+
this.content = dom.createElement("div");
|
15215 |
+
this.content.className = "ace_content";
|
15216 |
+
this.scroller.appendChild(this.content);
|
15217 |
+
|
15218 |
+
this.$gutterLayer = new GutterLayer(this.$gutter);
|
15219 |
+
this.$gutterLayer.on("changeGutterWidth", this.onGutterResize.bind(this));
|
15220 |
+
|
15221 |
+
this.$markerBack = new MarkerLayer(this.content);
|
15222 |
+
|
15223 |
+
var textLayer = this.$textLayer = new TextLayer(this.content);
|
15224 |
+
this.canvas = textLayer.element;
|
15225 |
+
|
15226 |
+
this.$markerFront = new MarkerLayer(this.content);
|
15227 |
+
|
15228 |
+
this.$cursorLayer = new CursorLayer(this.content);
|
15229 |
+
this.$horizScroll = false;
|
15230 |
+
this.$vScroll = false;
|
15231 |
+
|
15232 |
+
this.scrollBar =
|
15233 |
+
this.scrollBarV = new VScrollBar(this.container, this);
|
15234 |
+
this.scrollBarH = new HScrollBar(this.container, this);
|
15235 |
+
this.scrollBarV.addEventListener("scroll", function(e) {
|
15236 |
+
if (!_self.$scrollAnimation)
|
15237 |
+
_self.session.setScrollTop(e.data - _self.scrollMargin.top);
|
15238 |
+
});
|
15239 |
+
this.scrollBarH.addEventListener("scroll", function(e) {
|
15240 |
+
if (!_self.$scrollAnimation)
|
15241 |
+
_self.session.setScrollLeft(e.data - _self.scrollMargin.left);
|
15242 |
+
});
|
15243 |
+
|
15244 |
+
this.scrollTop = 0;
|
15245 |
+
this.scrollLeft = 0;
|
15246 |
+
|
15247 |
+
this.cursorPos = {
|
15248 |
+
row: 0,
|
15249 |
+
column: 0
|
15250 |
+
};
|
15251 |
+
|
15252 |
+
this.$fontMetrics = new FontMetrics(this.container, 500);
|
15253 |
+
this.$textLayer.$setFontMetrics(this.$fontMetrics);
|
15254 |
+
this.$textLayer.addEventListener("changeCharacterSize", function(e) {
|
15255 |
+
_self.updateCharacterSize();
|
15256 |
+
_self.onResize(true, _self.gutterWidth, _self.$size.width, _self.$size.height);
|
15257 |
+
_self._signal("changeCharacterSize", e);
|
15258 |
+
});
|
15259 |
+
|
15260 |
+
this.$size = {
|
15261 |
+
width: 0,
|
15262 |
+
height: 0,
|
15263 |
+
scrollerHeight: 0,
|
15264 |
+
scrollerWidth: 0,
|
15265 |
+
$dirty: true
|
15266 |
+
};
|
15267 |
+
|
15268 |
+
this.layerConfig = {
|
15269 |
+
width: 1,
|
15270 |
+
padding: 0,
|
15271 |
+
firstRow: 0,
|
15272 |
+
firstRowScreen: 0,
|
15273 |
+
lastRow: 0,
|
15274 |
+
lineHeight: 0,
|
15275 |
+
characterWidth: 0,
|
15276 |
+
minHeight: 1,
|
15277 |
+
maxHeight: 1,
|
15278 |
+
offset: 0,
|
15279 |
+
height: 1,
|
15280 |
+
gutterOffset: 1
|
15281 |
+
};
|
15282 |
+
|
15283 |
+
this.scrollMargin = {
|
15284 |
+
left: 0,
|
15285 |
+
right: 0,
|
15286 |
+
top: 0,
|
15287 |
+
bottom: 0,
|
15288 |
+
v: 0,
|
15289 |
+
h: 0
|
15290 |
+
};
|
15291 |
+
|
15292 |
+
this.$loop = new RenderLoop(
|
15293 |
+
this.$renderChanges.bind(this),
|
15294 |
+
this.container.ownerDocument.defaultView
|
15295 |
+
);
|
15296 |
+
this.$loop.schedule(this.CHANGE_FULL);
|
15297 |
+
|
15298 |
+
this.updateCharacterSize();
|
15299 |
+
this.setPadding(4);
|
15300 |
+
config.resetOptions(this);
|
15301 |
+
config._emit("renderer", this);
|
15302 |
+
};
|
15303 |
+
|
15304 |
+
(function() {
|
15305 |
+
|
15306 |
+
this.CHANGE_CURSOR = 1;
|
15307 |
+
this.CHANGE_MARKER = 2;
|
15308 |
+
this.CHANGE_GUTTER = 4;
|
15309 |
+
this.CHANGE_SCROLL = 8;
|
15310 |
+
this.CHANGE_LINES = 16;
|
15311 |
+
this.CHANGE_TEXT = 32;
|
15312 |
+
this.CHANGE_SIZE = 64;
|
15313 |
+
this.CHANGE_MARKER_BACK = 128;
|
15314 |
+
this.CHANGE_MARKER_FRONT = 256;
|
15315 |
+
this.CHANGE_FULL = 512;
|
15316 |
+
this.CHANGE_H_SCROLL = 1024;
|
15317 |
+
|
15318 |
+
oop.implement(this, EventEmitter);
|
15319 |
+
|
15320 |
+
this.updateCharacterSize = function() {
|
15321 |
+
if (this.$textLayer.allowBoldFonts != this.$allowBoldFonts) {
|
15322 |
+
this.$allowBoldFonts = this.$textLayer.allowBoldFonts;
|
15323 |
+
this.setStyle("ace_nobold", !this.$allowBoldFonts);
|
15324 |
+
}
|
15325 |
+
|
15326 |
+
this.layerConfig.characterWidth =
|
15327 |
+
this.characterWidth = this.$textLayer.getCharacterWidth();
|
15328 |
+
this.layerConfig.lineHeight =
|
15329 |
+
this.lineHeight = this.$textLayer.getLineHeight();
|
15330 |
+
this.$updatePrintMargin();
|
15331 |
+
};
|
15332 |
+
this.setSession = function(session) {
|
15333 |
+
if (this.session)
|
15334 |
+
this.session.doc.off("changeNewLineMode", this.onChangeNewLineMode);
|
15335 |
+
|
15336 |
+
this.session = session;
|
15337 |
+
if (session && this.scrollMargin.top && session.getScrollTop() <= 0)
|
15338 |
+
session.setScrollTop(-this.scrollMargin.top);
|
15339 |
+
|
15340 |
+
this.$cursorLayer.setSession(session);
|
15341 |
+
this.$markerBack.setSession(session);
|
15342 |
+
this.$markerFront.setSession(session);
|
15343 |
+
this.$gutterLayer.setSession(session);
|
15344 |
+
this.$textLayer.setSession(session);
|
15345 |
+
if (!session)
|
15346 |
+
return;
|
15347 |
+
|
15348 |
+
this.$loop.schedule(this.CHANGE_FULL);
|
15349 |
+
this.session.$setFontMetrics(this.$fontMetrics);
|
15350 |
+
|
15351 |
+
this.onChangeNewLineMode = this.onChangeNewLineMode.bind(this);
|
15352 |
+
this.onChangeNewLineMode()
|
15353 |
+
this.session.doc.on("changeNewLineMode", this.onChangeNewLineMode);
|
15354 |
+
};
|
15355 |
+
this.updateLines = function(firstRow, lastRow, force) {
|
15356 |
+
if (lastRow === undefined)
|
15357 |
+
lastRow = Infinity;
|
15358 |
+
|
15359 |
+
if (!this.$changedLines) {
|
15360 |
+
this.$changedLines = {
|
15361 |
+
firstRow: firstRow,
|
15362 |
+
lastRow: lastRow
|
15363 |
+
};
|
15364 |
+
} else {
|
15365 |
+
if (this.$changedLines.firstRow > firstRow)
|
15366 |
+
this.$changedLines.firstRow = firstRow;
|
15367 |
+
|
15368 |
+
if (this.$changedLines.lastRow < lastRow)
|
15369 |
+
this.$changedLines.lastRow = lastRow;
|
15370 |
+
}
|
15371 |
+
if (this.$changedLines.lastRow < this.layerConfig.firstRow) {
|
15372 |
+
if (force)
|
15373 |
+
this.$changedLines.lastRow = this.layerConfig.lastRow;
|
15374 |
+
else
|
15375 |
+
return;
|
15376 |
+
}
|
15377 |
+
if (this.$changedLines.firstRow > this.layerConfig.lastRow)
|
15378 |
+
return;
|
15379 |
+
this.$loop.schedule(this.CHANGE_LINES);
|
15380 |
+
};
|
15381 |
+
|
15382 |
+
this.onChangeNewLineMode = function() {
|
15383 |
+
this.$loop.schedule(this.CHANGE_TEXT);
|
15384 |
+
this.$textLayer.$updateEolChar();
|
15385 |
+
};
|
15386 |
+
|
15387 |
+
this.onChangeTabSize = function() {
|
15388 |
+
this.$loop.schedule(this.CHANGE_TEXT | this.CHANGE_MARKER);
|
15389 |
+
this.$textLayer.onChangeTabSize();
|
15390 |
+
};
|
15391 |
+
this.updateText = function() {
|
15392 |
+
this.$loop.schedule(this.CHANGE_TEXT);
|
15393 |
+
};
|
15394 |
+
this.updateFull = function(force) {
|
15395 |
+
if (force)
|
15396 |
+
this.$renderChanges(this.CHANGE_FULL, true);
|
15397 |
+
else
|
15398 |
+
this.$loop.schedule(this.CHANGE_FULL);
|
15399 |
+
};
|
15400 |
+
this.updateFontSize = function() {
|
15401 |
+
this.$textLayer.checkForSizeChanges();
|
15402 |
+
};
|
15403 |
+
|
15404 |
+
this.$changes = 0;
|
15405 |
+
this.$updateSizeAsync = function() {
|
15406 |
+
if (this.$loop.pending)
|
15407 |
+
this.$size.$dirty = true;
|
15408 |
+
else
|
15409 |
+
this.onResize();
|
15410 |
+
};
|
15411 |
+
this.onResize = function(force, gutterWidth, width, height) {
|
15412 |
+
if (this.resizing > 2)
|
15413 |
+
return;
|
15414 |
+
else if (this.resizing > 0)
|
15415 |
+
this.resizing++;
|
15416 |
+
else
|
15417 |
+
this.resizing = force ? 1 : 0;
|
15418 |
+
var el = this.container;
|
15419 |
+
if (!height)
|
15420 |
+
height = el.clientHeight || el.scrollHeight;
|
15421 |
+
if (!width)
|
15422 |
+
width = el.clientWidth || el.scrollWidth;
|
15423 |
+
var changes = this.$updateCachedSize(force, gutterWidth, width, height);
|
15424 |
+
|
15425 |
+
|
15426 |
+
if (!this.$size.scrollerHeight || (!width && !height))
|
15427 |
+
return this.resizing = 0;
|
15428 |
+
|
15429 |
+
if (force)
|
15430 |
+
this.$gutterLayer.$padding = null;
|
15431 |
+
|
15432 |
+
if (force)
|
15433 |
+
this.$renderChanges(changes | this.$changes, true);
|
15434 |
+
else
|
15435 |
+
this.$loop.schedule(changes | this.$changes);
|
15436 |
+
|
15437 |
+
if (this.resizing)
|
15438 |
+
this.resizing = 0;
|
15439 |
+
};
|
15440 |
+
|
15441 |
+
this.$updateCachedSize = function(force, gutterWidth, width, height) {
|
15442 |
+
height -= (this.$extraHeight || 0);
|
15443 |
+
var changes = 0;
|
15444 |
+
var size = this.$size;
|
15445 |
+
var oldSize = {
|
15446 |
+
width: size.width,
|
15447 |
+
height: size.height,
|
15448 |
+
scrollerHeight: size.scrollerHeight,
|
15449 |
+
scrollerWidth: size.scrollerWidth
|
15450 |
+
};
|
15451 |
+
if (height && (force || size.height != height)) {
|
15452 |
+
size.height = height;
|
15453 |
+
changes |= this.CHANGE_SIZE;
|
15454 |
+
|
15455 |
+
size.scrollerHeight = size.height;
|
15456 |
+
if (this.$horizScroll)
|
15457 |
+
size.scrollerHeight -= this.scrollBarH.getHeight();
|
15458 |
+
this.scrollBarV.element.style.bottom = this.scrollBarH.getHeight() + "px";
|
15459 |
+
|
15460 |
+
changes = changes | this.CHANGE_SCROLL;
|
15461 |
+
}
|
15462 |
+
|
15463 |
+
if (width && (force || size.width != width)) {
|
15464 |
+
changes |= this.CHANGE_SIZE;
|
15465 |
+
size.width = width;
|
15466 |
+
|
15467 |
+
if (gutterWidth == null)
|
15468 |
+
gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;
|
15469 |
+
|
15470 |
+
this.gutterWidth = gutterWidth;
|
15471 |
+
|
15472 |
+
this.scrollBarH.element.style.left =
|
15473 |
+
this.scroller.style.left = gutterWidth + "px";
|
15474 |
+
size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBarV.getWidth());
|
15475 |
+
|
15476 |
+
this.scrollBarH.element.style.right =
|
15477 |
+
this.scroller.style.right = this.scrollBarV.getWidth() + "px";
|
15478 |
+
this.scroller.style.bottom = this.scrollBarH.getHeight() + "px";
|
15479 |
+
|
15480 |
+
if (this.session && this.session.getUseWrapMode() && this.adjustWrapLimit() || force)
|
15481 |
+
changes |= this.CHANGE_FULL;
|
15482 |
+
}
|
15483 |
+
|
15484 |
+
size.$dirty = !width || !height;
|
15485 |
+
|
15486 |
+
if (changes)
|
15487 |
+
this._signal("resize", oldSize);
|
15488 |
+
|
15489 |
+
return changes;
|
15490 |
+
};
|
15491 |
+
|
15492 |
+
this.onGutterResize = function() {
|
15493 |
+
var gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;
|
15494 |
+
if (gutterWidth != this.gutterWidth)
|
15495 |
+
this.$changes |= this.$updateCachedSize(true, gutterWidth, this.$size.width, this.$size.height);
|
15496 |
+
|
15497 |
+
if (this.session.getUseWrapMode() && this.adjustWrapLimit()) {
|
15498 |
+
this.$loop.schedule(this.CHANGE_FULL);
|
15499 |
+
} else if (this.$size.$dirty) {
|
15500 |
+
this.$loop.schedule(this.CHANGE_FULL);
|
15501 |
+
} else {
|
15502 |
+
this.$computeLayerConfig();
|
15503 |
+
this.$loop.schedule(this.CHANGE_MARKER);
|
15504 |
+
}
|
15505 |
+
};
|
15506 |
+
this.adjustWrapLimit = function() {
|
15507 |
+
var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
|
15508 |
+
var limit = Math.floor(availableWidth / this.characterWidth);
|
15509 |
+
return this.session.adjustWrapLimit(limit, this.$showPrintMargin && this.$printMarginColumn);
|
15510 |
+
};
|
15511 |
+
this.setAnimatedScroll = function(shouldAnimate) {
|
15512 |
+
this.setOption("animatedScroll", shouldAnimate);
|
15513 |
+
};
|
15514 |
+
this.getAnimatedScroll = function() {
|
15515 |
+
return this.$animatedScroll;
|
15516 |
+
};
|
15517 |
+
this.setShowInvisibles = function(showInvisibles) {
|
15518 |
+
this.setOption("showInvisibles", showInvisibles);
|
15519 |
+
};
|
15520 |
+
this.getShowInvisibles = function() {
|
15521 |
+
return this.getOption("showInvisibles");
|
15522 |
+
};
|
15523 |
+
this.getDisplayIndentGuides = function() {
|
15524 |
+
return this.getOption("displayIndentGuides");
|
15525 |
+
};
|
15526 |
+
|
15527 |
+
this.setDisplayIndentGuides = function(display) {
|
15528 |
+
this.setOption("displayIndentGuides", display);
|
15529 |
+
};
|
15530 |
+
this.setShowPrintMargin = function(showPrintMargin) {
|
15531 |
+
this.setOption("showPrintMargin", showPrintMargin);
|
15532 |
+
};
|
15533 |
+
this.getShowPrintMargin = function() {
|
15534 |
+
return this.getOption("showPrintMargin");
|
15535 |
+
};
|
15536 |
+
this.setPrintMarginColumn = function(showPrintMargin) {
|
15537 |
+
this.setOption("printMarginColumn", showPrintMargin);
|
15538 |
+
};
|
15539 |
+
this.getPrintMarginColumn = function() {
|
15540 |
+
return this.getOption("printMarginColumn");
|
15541 |
+
};
|
15542 |
+
this.getShowGutter = function() {
|
15543 |
+
return this.getOption("showGutter");
|
15544 |
+
};
|
15545 |
+
this.setShowGutter = function(show) {
|
15546 |
+
return this.setOption("showGutter", show);
|
15547 |
+
};
|
15548 |
+
|
15549 |
+
this.getFadeFoldWidgets = function() {
|
15550 |
+
return this.getOption("fadeFoldWidgets")
|
15551 |
+
};
|
15552 |
+
|
15553 |
+
this.setFadeFoldWidgets = function(show) {
|
15554 |
+
this.setOption("fadeFoldWidgets", show);
|
15555 |
+
};
|
15556 |
+
|
15557 |
+
this.setHighlightGutterLine = function(shouldHighlight) {
|
15558 |
+
this.setOption("highlightGutterLine", shouldHighlight);
|
15559 |
+
};
|
15560 |
+
|
15561 |
+
this.getHighlightGutterLine = function() {
|
15562 |
+
return this.getOption("highlightGutterLine");
|
15563 |
+
};
|
15564 |
+
|
15565 |
+
this.$updateGutterLineHighlight = function() {
|
15566 |
+
var pos = this.$cursorLayer.$pixelPos;
|
15567 |
+
var height = this.layerConfig.lineHeight;
|
15568 |
+
if (this.session.getUseWrapMode()) {
|
15569 |
+
var cursor = this.session.selection.getCursor();
|
15570 |
+
cursor.column = 0;
|
15571 |
+
pos = this.$cursorLayer.getPixelPosition(cursor, true);
|
15572 |
+
height *= this.session.getRowLength(cursor.row);
|
15573 |
+
}
|
15574 |
+
this.$gutterLineHighlight.style.top = pos.top - this.layerConfig.offset + "px";
|
15575 |
+
this.$gutterLineHighlight.style.height = height + "px";
|
15576 |
+
};
|
15577 |
+
|
15578 |
+
this.$updatePrintMargin = function() {
|
15579 |
+
if (!this.$showPrintMargin && !this.$printMarginEl)
|
15580 |
+
return;
|
15581 |
+
|
15582 |
+
if (!this.$printMarginEl) {
|
15583 |
+
var containerEl = dom.createElement("div");
|
15584 |
+
containerEl.className = "ace_layer ace_print-margin-layer";
|
15585 |
+
this.$printMarginEl = dom.createElement("div");
|
15586 |
+
this.$printMarginEl.className = "ace_print-margin";
|
15587 |
+
containerEl.appendChild(this.$printMarginEl);
|
15588 |
+
this.content.insertBefore(containerEl, this.content.firstChild);
|
15589 |
+
}
|
15590 |
+
|
15591 |
+
var style = this.$printMarginEl.style;
|
15592 |
+
style.left = ((this.characterWidth * this.$printMarginColumn) + this.$padding) + "px";
|
15593 |
+
style.visibility = this.$showPrintMargin ? "visible" : "hidden";
|
15594 |
+
|
15595 |
+
if (this.session && this.session.$wrap == -1)
|
15596 |
+
this.adjustWrapLimit();
|
15597 |
+
};
|
15598 |
+
this.getContainerElement = function() {
|
15599 |
+
return this.container;
|
15600 |
+
};
|
15601 |
+
this.getMouseEventTarget = function() {
|
15602 |
+
return this.content;
|
15603 |
+
};
|
15604 |
+
this.getTextAreaContainer = function() {
|
15605 |
+
return this.container;
|
15606 |
+
};
|
15607 |
+
this.$moveTextAreaToCursor = function() {
|
15608 |
+
if (!this.$keepTextAreaAtCursor)
|
15609 |
+
return;
|
15610 |
+
var config = this.layerConfig;
|
15611 |
+
var posTop = this.$cursorLayer.$pixelPos.top;
|
15612 |
+
var posLeft = this.$cursorLayer.$pixelPos.left;
|
15613 |
+
posTop -= config.offset;
|
15614 |
+
|
15615 |
+
var h = this.lineHeight;
|
15616 |
+
if (posTop < 0 || posTop > config.height - h)
|
15617 |
+
return;
|
15618 |
+
|
15619 |
+
var w = this.characterWidth;
|
15620 |
+
if (this.$composition) {
|
15621 |
+
var val = this.textarea.value.replace(/^\x01+/, "");
|
15622 |
+
w *= (this.session.$getStringScreenWidth(val)[0] + 2);
|
15623 |
+
h += 2;
|
15624 |
+
}
|
15625 |
+
posLeft -= this.scrollLeft;
|
15626 |
+
if (posLeft > this.$size.scrollerWidth - w)
|
15627 |
+
posLeft = this.$size.scrollerWidth - w;
|
15628 |
+
|
15629 |
+
posLeft += this.gutterWidth;
|
15630 |
+
|
15631 |
+
this.textarea.style.height = h + "px";
|
15632 |
+
this.textarea.style.width = w + "px";
|
15633 |
+
this.textarea.style.left = Math.min(posLeft, this.$size.scrollerWidth - w) + "px";
|
15634 |
+
this.textarea.style.top = Math.min(posTop, this.$size.height - h) + "px";
|
15635 |
+
};
|
15636 |
+
this.getFirstVisibleRow = function() {
|
15637 |
+
return this.layerConfig.firstRow;
|
15638 |
+
};
|
15639 |
+
this.getFirstFullyVisibleRow = function() {
|
15640 |
+
return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);
|
15641 |
+
};
|
15642 |
+
this.getLastFullyVisibleRow = function() {
|
15643 |
+
var flint = Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight);
|
15644 |
+
return this.layerConfig.firstRow - 1 + flint;
|
15645 |
+
};
|
15646 |
+
this.getLastVisibleRow = function() {
|
15647 |
+
return this.layerConfig.lastRow;
|
15648 |
+
};
|
15649 |
+
|
15650 |
+
this.$padding = null;
|
15651 |
+
this.setPadding = function(padding) {
|
15652 |
+
this.$padding = padding;
|
15653 |
+
this.$textLayer.setPadding(padding);
|
15654 |
+
this.$cursorLayer.setPadding(padding);
|
15655 |
+
this.$markerFront.setPadding(padding);
|
15656 |
+
this.$markerBack.setPadding(padding);
|
15657 |
+
this.$loop.schedule(this.CHANGE_FULL);
|
15658 |
+
this.$updatePrintMargin();
|
15659 |
+
};
|
15660 |
+
|
15661 |
+
this.setScrollMargin = function(top, bottom, left, right) {
|
15662 |
+
var sm = this.scrollMargin;
|
15663 |
+
sm.top = top | 0;
|
15664 |
+
sm.bottom = bottom | 0;
|
15665 |
+
sm.right = right | 0;
|
15666 |
+
sm.left = left | 0;
|
15667 |
+
sm.v = sm.top + sm.bottom;
|
15668 |
+
sm.h = sm.left + sm.right;
|
15669 |
+
if (sm.top && this.scrollTop <= 0 && this.session)
|
15670 |
+
this.session.setScrollTop(-sm.top);
|
15671 |
+
this.updateFull();
|
15672 |
+
};
|
15673 |
+
this.getHScrollBarAlwaysVisible = function() {
|
15674 |
+
return this.$hScrollBarAlwaysVisible;
|
15675 |
+
};
|
15676 |
+
this.setHScrollBarAlwaysVisible = function(alwaysVisible) {
|
15677 |
+
this.setOption("hScrollBarAlwaysVisible", alwaysVisible);
|
15678 |
+
};
|
15679 |
+
this.getVScrollBarAlwaysVisible = function() {
|
15680 |
+
return this.$hScrollBarAlwaysVisible;
|
15681 |
+
};
|
15682 |
+
this.setVScrollBarAlwaysVisible = function(alwaysVisible) {
|
15683 |
+
this.setOption("vScrollBarAlwaysVisible", alwaysVisible);
|
15684 |
+
};
|
15685 |
+
|
15686 |
+
this.$updateScrollBarV = function() {
|
15687 |
+
var scrollHeight = this.layerConfig.maxHeight;
|
15688 |
+
var scrollerHeight = this.$size.scrollerHeight;
|
15689 |
+
if (!this.$maxLines && this.$scrollPastEnd) {
|
15690 |
+
scrollHeight -= (scrollerHeight - this.lineHeight) * this.$scrollPastEnd;
|
15691 |
+
if (this.scrollTop > scrollHeight - scrollerHeight) {
|
15692 |
+
scrollHeight = this.scrollTop + scrollerHeight;
|
15693 |
+
this.scrollBarV.scrollTop = null;
|
15694 |
+
}
|
15695 |
+
}
|
15696 |
+
this.scrollBarV.setScrollHeight(scrollHeight + this.scrollMargin.v);
|
15697 |
+
this.scrollBarV.setScrollTop(this.scrollTop + this.scrollMargin.top);
|
15698 |
+
};
|
15699 |
+
this.$updateScrollBarH = function() {
|
15700 |
+
this.scrollBarH.setScrollWidth(this.layerConfig.width + 2 * this.$padding + this.scrollMargin.h);
|
15701 |
+
this.scrollBarH.setScrollLeft(this.scrollLeft + this.scrollMargin.left);
|
15702 |
+
};
|
15703 |
+
|
15704 |
+
this.$frozen = false;
|
15705 |
+
this.freeze = function() {
|
15706 |
+
this.$frozen = true;
|
15707 |
+
};
|
15708 |
+
|
15709 |
+
this.unfreeze = function() {
|
15710 |
+
this.$frozen = false;
|
15711 |
+
};
|
15712 |
+
|
15713 |
+
this.$renderChanges = function(changes, force) {
|
15714 |
+
if (this.$changes) {
|
15715 |
+
changes |= this.$changes;
|
15716 |
+
this.$changes = 0;
|
15717 |
+
}
|
15718 |
+
if ((!this.session || !this.container.offsetWidth || this.$frozen) || (!changes && !force)) {
|
15719 |
+
this.$changes |= changes;
|
15720 |
+
return;
|
15721 |
+
}
|
15722 |
+
if (this.$size.$dirty) {
|
15723 |
+
this.$changes |= changes;
|
15724 |
+
return this.onResize(true);
|
15725 |
+
}
|
15726 |
+
if (!this.lineHeight) {
|
15727 |
+
this.$textLayer.checkForSizeChanges();
|
15728 |
+
}
|
15729 |
+
|
15730 |
+
this._signal("beforeRender");
|
15731 |
+
var config = this.layerConfig;
|
15732 |
+
if (changes & this.CHANGE_FULL ||
|
15733 |
+
changes & this.CHANGE_SIZE ||
|
15734 |
+
changes & this.CHANGE_TEXT ||
|
15735 |
+
changes & this.CHANGE_LINES ||
|
15736 |
+
changes & this.CHANGE_SCROLL ||
|
15737 |
+
changes & this.CHANGE_H_SCROLL
|
15738 |
+
) {
|
15739 |
+
changes |= this.$computeLayerConfig();
|
15740 |
+
if (config.firstRow != this.layerConfig.firstRow && config.firstRowScreen == this.layerConfig.firstRowScreen) {
|
15741 |
+
var st = this.scrollTop + (config.firstRow - this.layerConfig.firstRow) * this.lineHeight;
|
15742 |
+
if (st > 0) {
|
15743 |
+
this.scrollTop = st;
|
15744 |
+
changes = changes | this.CHANGE_SCROLL;
|
15745 |
+
changes |= this.$computeLayerConfig();
|
15746 |
+
}
|
15747 |
+
}
|
15748 |
+
config = this.layerConfig;
|
15749 |
+
this.$updateScrollBarV();
|
15750 |
+
if (changes & this.CHANGE_H_SCROLL)
|
15751 |
+
this.$updateScrollBarH();
|
15752 |
+
this.$gutterLayer.element.style.marginTop = (-config.offset) + "px";
|
15753 |
+
this.content.style.marginTop = (-config.offset) + "px";
|
15754 |
+
this.content.style.width = config.width + 2 * this.$padding + "px";
|
15755 |
+
this.content.style.height = config.minHeight + "px";
|
15756 |
+
}
|
15757 |
+
if (changes & this.CHANGE_H_SCROLL) {
|
15758 |
+
this.content.style.marginLeft = -this.scrollLeft + "px";
|
15759 |
+
this.scroller.className = this.scrollLeft <= 0 ? "ace_scroller" : "ace_scroller ace_scroll-left";
|
15760 |
+
}
|
15761 |
+
if (changes & this.CHANGE_FULL) {
|
15762 |
+
this.$textLayer.update(config);
|
15763 |
+
if (this.$showGutter)
|
15764 |
+
this.$gutterLayer.update(config);
|
15765 |
+
this.$markerBack.update(config);
|
15766 |
+
this.$markerFront.update(config);
|
15767 |
+
this.$cursorLayer.update(config);
|
15768 |
+
this.$moveTextAreaToCursor();
|
15769 |
+
this.$highlightGutterLine && this.$updateGutterLineHighlight();
|
15770 |
+
this._signal("afterRender");
|
15771 |
+
return;
|
15772 |
+
}
|
15773 |
+
if (changes & this.CHANGE_SCROLL) {
|
15774 |
+
if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES)
|
15775 |
+
this.$textLayer.update(config);
|
15776 |
+
else
|
15777 |
+
this.$textLayer.scrollLines(config);
|
15778 |
+
|
15779 |
+
if (this.$showGutter)
|
15780 |
+
this.$gutterLayer.update(config);
|
15781 |
+
this.$markerBack.update(config);
|
15782 |
+
this.$markerFront.update(config);
|
15783 |
+
this.$cursorLayer.update(config);
|
15784 |
+
this.$highlightGutterLine && this.$updateGutterLineHighlight();
|
15785 |
+
this.$moveTextAreaToCursor();
|
15786 |
+
this._signal("afterRender");
|
15787 |
+
return;
|
15788 |
+
}
|
15789 |
+
|
15790 |
+
if (changes & this.CHANGE_TEXT) {
|
15791 |
+
this.$textLayer.update(config);
|
15792 |
+
if (this.$showGutter)
|
15793 |
+
this.$gutterLayer.update(config);
|
15794 |
+
} else if (changes & this.CHANGE_LINES) {
|
15795 |
+
if (this.$updateLines() || (changes & this.CHANGE_GUTTER) && this.$showGutter)
|
15796 |
+
this.$gutterLayer.update(config);
|
15797 |
+
} else if (changes & this.CHANGE_TEXT || changes & this.CHANGE_GUTTER) {
|
15798 |
+
if (this.$showGutter)
|
15799 |
+
this.$gutterLayer.update(config);
|
15800 |
+
}
|
15801 |
+
|
15802 |
+
if (changes & this.CHANGE_CURSOR) {
|
15803 |
+
this.$cursorLayer.update(config);
|
15804 |
+
this.$moveTextAreaToCursor();
|
15805 |
+
this.$highlightGutterLine && this.$updateGutterLineHighlight();
|
15806 |
+
}
|
15807 |
+
|
15808 |
+
if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) {
|
15809 |
+
this.$markerFront.update(config);
|
15810 |
+
}
|
15811 |
+
|
15812 |
+
if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) {
|
15813 |
+
this.$markerBack.update(config);
|
15814 |
+
}
|
15815 |
+
|
15816 |
+
this._signal("afterRender");
|
15817 |
+
};
|
15818 |
+
|
15819 |
+
|
15820 |
+
this.$autosize = function() {
|
15821 |
+
var height = this.session.getScreenLength() * this.lineHeight;
|
15822 |
+
var maxHeight = this.$maxLines * this.lineHeight;
|
15823 |
+
var desiredHeight = Math.max(
|
15824 |
+
(this.$minLines || 1) * this.lineHeight,
|
15825 |
+
Math.min(maxHeight, height)
|
15826 |
+
) + this.scrollMargin.v + (this.$extraHeight || 0);
|
15827 |
+
var vScroll = height > maxHeight;
|
15828 |
+
|
15829 |
+
if (desiredHeight != this.desiredHeight ||
|
15830 |
+
this.$size.height != this.desiredHeight || vScroll != this.$vScroll) {
|
15831 |
+
if (vScroll != this.$vScroll) {
|
15832 |
+
this.$vScroll = vScroll;
|
15833 |
+
this.scrollBarV.setVisible(vScroll);
|
15834 |
+
}
|
15835 |
+
|
15836 |
+
var w = this.container.clientWidth;
|
15837 |
+
this.container.style.height = desiredHeight + "px";
|
15838 |
+
this.$updateCachedSize(true, this.$gutterWidth, w, desiredHeight);
|
15839 |
+
this.desiredHeight = desiredHeight;
|
15840 |
+
|
15841 |
+
this._signal("autosize");
|
15842 |
+
}
|
15843 |
+
};
|
15844 |
+
|
15845 |
+
this.$computeLayerConfig = function() {
|
15846 |
+
if (this.$maxLines && this.lineHeight > 1)
|
15847 |
+
this.$autosize();
|
15848 |
+
|
15849 |
+
var session = this.session;
|
15850 |
+
var size = this.$size;
|
15851 |
+
|
15852 |
+
var hideScrollbars = size.height <= 2 * this.lineHeight;
|
15853 |
+
var screenLines = this.session.getScreenLength();
|
15854 |
+
var maxHeight = screenLines * this.lineHeight;
|
15855 |
+
|
15856 |
+
var offset = this.scrollTop % this.lineHeight;
|
15857 |
+
var minHeight = size.scrollerHeight + this.lineHeight;
|
15858 |
+
|
15859 |
+
var longestLine = this.$getLongestLine();
|
15860 |
+
|
15861 |
+
var horizScroll = !hideScrollbars && (this.$hScrollBarAlwaysVisible ||
|
15862 |
+
size.scrollerWidth - longestLine - 2 * this.$padding < 0);
|
15863 |
+
|
15864 |
+
var hScrollChanged = this.$horizScroll !== horizScroll;
|
15865 |
+
if (hScrollChanged) {
|
15866 |
+
this.$horizScroll = horizScroll;
|
15867 |
+
this.scrollBarH.setVisible(horizScroll);
|
15868 |
+
}
|
15869 |
+
|
15870 |
+
var scrollPastEnd = !this.$maxLines && this.$scrollPastEnd ? (size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd : 0;
|
15871 |
+
maxHeight += scrollPastEnd;
|
15872 |
+
|
15873 |
+
this.session.setScrollTop(Math.max(-this.scrollMargin.top,
|
15874 |
+
Math.min(this.scrollTop, maxHeight - size.scrollerHeight + this.scrollMargin.bottom)));
|
15875 |
+
|
15876 |
+
this.session.setScrollLeft(Math.max(-this.scrollMargin.left, Math.min(this.scrollLeft,
|
15877 |
+
longestLine + 2 * this.$padding - size.scrollerWidth + this.scrollMargin.right)));
|
15878 |
+
|
15879 |
+
var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible ||
|
15880 |
+
size.scrollerHeight - maxHeight + scrollPastEnd < 0 || this.scrollTop);
|
15881 |
+
var vScrollChanged = this.$vScroll !== vScroll;
|
15882 |
+
if (vScrollChanged) {
|
15883 |
+
this.$vScroll = vScroll;
|
15884 |
+
this.scrollBarV.setVisible(vScroll);
|
15885 |
+
}
|
15886 |
+
|
15887 |
+
var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
|
15888 |
+
var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight));
|
15889 |
+
var lastRow = firstRow + lineCount;
|
15890 |
+
var firstRowScreen, firstRowHeight;
|
15891 |
+
var lineHeight = this.lineHeight;
|
15892 |
+
firstRow = session.screenToDocumentRow(firstRow, 0);
|
15893 |
+
var foldLine = session.getFoldLine(firstRow);
|
15894 |
+
if (foldLine) {
|
15895 |
+
firstRow = foldLine.start.row;
|
15896 |
+
}
|
15897 |
+
|
15898 |
+
firstRowScreen = session.documentToScreenRow(firstRow, 0);
|
15899 |
+
firstRowHeight = session.getRowLength(firstRow) * lineHeight;
|
15900 |
+
|
15901 |
+
lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1);
|
15902 |
+
minHeight = size.scrollerHeight + session.getRowLength(lastRow) * lineHeight +
|
15903 |
+
firstRowHeight;
|
15904 |
+
|
15905 |
+
offset = this.scrollTop - firstRowScreen * lineHeight;
|
15906 |
+
|
15907 |
+
var changes = 0;
|
15908 |
+
if (this.layerConfig.width != longestLine)
|
15909 |
+
changes = this.CHANGE_H_SCROLL;
|
15910 |
+
if (hScrollChanged || vScrollChanged) {
|
15911 |
+
changes = this.$updateCachedSize(true, this.gutterWidth, size.width, size.height);
|
15912 |
+
this._signal("scrollbarVisibilityChanged");
|
15913 |
+
if (vScrollChanged)
|
15914 |
+
longestLine = this.$getLongestLine();
|
15915 |
+
}
|
15916 |
+
|
15917 |
+
this.layerConfig = {
|
15918 |
+
width: longestLine,
|
15919 |
+
padding: this.$padding,
|
15920 |
+
firstRow: firstRow,
|
15921 |
+
firstRowScreen: firstRowScreen,
|
15922 |
+
lastRow: lastRow,
|
15923 |
+
lineHeight: lineHeight,
|
15924 |
+
characterWidth: this.characterWidth,
|
15925 |
+
minHeight: minHeight,
|
15926 |
+
maxHeight: maxHeight,
|
15927 |
+
offset: offset,
|
15928 |
+
gutterOffset: Math.max(0, Math.ceil((offset + size.height - size.scrollerHeight) / lineHeight)),
|
15929 |
+
height: this.$size.scrollerHeight
|
15930 |
+
};
|
15931 |
+
|
15932 |
+
return changes;
|
15933 |
+
};
|
15934 |
+
|
15935 |
+
this.$updateLines = function() {
|
15936 |
+
var firstRow = this.$changedLines.firstRow;
|
15937 |
+
var lastRow = this.$changedLines.lastRow;
|
15938 |
+
this.$changedLines = null;
|
15939 |
+
|
15940 |
+
var layerConfig = this.layerConfig;
|
15941 |
+
|
15942 |
+
if (firstRow > layerConfig.lastRow + 1) {
|
15943 |
+
return;
|
15944 |
+
}
|
15945 |
+
if (lastRow < layerConfig.firstRow) {
|
15946 |
+
return;
|
15947 |
+
}
|
15948 |
+
if (lastRow === Infinity) {
|
15949 |
+
if (this.$showGutter)
|
15950 |
+
this.$gutterLayer.update(layerConfig);
|
15951 |
+
this.$textLayer.update(layerConfig);
|
15952 |
+
return;
|
15953 |
+
}
|
15954 |
+
this.$textLayer.updateLines(layerConfig, firstRow, lastRow);
|
15955 |
+
return true;
|
15956 |
+
};
|
15957 |
+
|
15958 |
+
this.$getLongestLine = function() {
|
15959 |
+
var charCount = this.session.getScreenWidth();
|
15960 |
+
if (this.showInvisibles && !this.session.$useWrapMode)
|
15961 |
+
charCount += 1;
|
15962 |
+
|
15963 |
+
return Math.max(this.$size.scrollerWidth - 2 * this.$padding, Math.round(charCount * this.characterWidth));
|
15964 |
+
};
|
15965 |
+
this.updateFrontMarkers = function() {
|
15966 |
+
this.$markerFront.setMarkers(this.session.getMarkers(true));
|
15967 |
+
this.$loop.schedule(this.CHANGE_MARKER_FRONT);
|
15968 |
+
};
|
15969 |
+
this.updateBackMarkers = function() {
|
15970 |
+
this.$markerBack.setMarkers(this.session.getMarkers());
|
15971 |
+
this.$loop.schedule(this.CHANGE_MARKER_BACK);
|
15972 |
+
};
|
15973 |
+
this.addGutterDecoration = function(row, className) {
|
15974 |
+
this.$gutterLayer.addGutterDecoration(row, className);
|
15975 |
+
};
|
15976 |
+
this.removeGutterDecoration = function(row, className) {
|
15977 |
+
this.$gutterLayer.removeGutterDecoration(row, className);
|
15978 |
+
};
|
15979 |
+
this.updateBreakpoints = function(rows) {
|
15980 |
+
this.$loop.schedule(this.CHANGE_GUTTER);
|
15981 |
+
};
|
15982 |
+
this.setAnnotations = function(annotations) {
|
15983 |
+
this.$gutterLayer.setAnnotations(annotations);
|
15984 |
+
this.$loop.schedule(this.CHANGE_GUTTER);
|
15985 |
+
};
|
15986 |
+
this.updateCursor = function() {
|
15987 |
+
this.$loop.schedule(this.CHANGE_CURSOR);
|
15988 |
+
};
|
15989 |
+
this.hideCursor = function() {
|
15990 |
+
this.$cursorLayer.hideCursor();
|
15991 |
+
};
|
15992 |
+
this.showCursor = function() {
|
15993 |
+
this.$cursorLayer.showCursor();
|
15994 |
+
};
|
15995 |
+
|
15996 |
+
this.scrollSelectionIntoView = function(anchor, lead, offset) {
|
15997 |
+
this.scrollCursorIntoView(anchor, offset);
|
15998 |
+
this.scrollCursorIntoView(lead, offset);
|
15999 |
+
};
|
16000 |
+
this.scrollCursorIntoView = function(cursor, offset, $viewMargin) {
|
16001 |
+
if (this.$size.scrollerHeight === 0)
|
16002 |
+
return;
|
16003 |
+
|
16004 |
+
var pos = this.$cursorLayer.getPixelPosition(cursor);
|
16005 |
+
|
16006 |
+
var left = pos.left;
|
16007 |
+
var top = pos.top;
|
16008 |
+
|
16009 |
+
var topMargin = $viewMargin && $viewMargin.top || 0;
|
16010 |
+
var bottomMargin = $viewMargin && $viewMargin.bottom || 0;
|
16011 |
+
|
16012 |
+
var scrollTop = this.$scrollAnimation ? this.session.getScrollTop() : this.scrollTop;
|
16013 |
+
|
16014 |
+
if (scrollTop + topMargin > top) {
|
16015 |
+
if (offset)
|
16016 |
+
top -= offset * this.$size.scrollerHeight;
|
16017 |
+
if (top === 0)
|
16018 |
+
top = -this.scrollMargin.top;
|
16019 |
+
this.session.setScrollTop(top);
|
16020 |
+
} else if (scrollTop + this.$size.scrollerHeight - bottomMargin < top + this.lineHeight) {
|
16021 |
+
if (offset)
|
16022 |
+
top += offset * this.$size.scrollerHeight;
|
16023 |
+
this.session.setScrollTop(top + this.lineHeight - this.$size.scrollerHeight);
|
16024 |
+
}
|
16025 |
+
|
16026 |
+
var scrollLeft = this.scrollLeft;
|
16027 |
+
|
16028 |
+
if (scrollLeft > left) {
|
16029 |
+
if (left < this.$padding + 2 * this.layerConfig.characterWidth)
|
16030 |
+
left = -this.scrollMargin.left;
|
16031 |
+
this.session.setScrollLeft(left);
|
16032 |
+
} else if (scrollLeft + this.$size.scrollerWidth < left + this.characterWidth) {
|
16033 |
+
this.session.setScrollLeft(Math.round(left + this.characterWidth - this.$size.scrollerWidth));
|
16034 |
+
} else if (scrollLeft <= this.$padding && left - scrollLeft < this.characterWidth) {
|
16035 |
+
this.session.setScrollLeft(0);
|
16036 |
+
}
|
16037 |
+
};
|
16038 |
+
this.getScrollTop = function() {
|
16039 |
+
return this.session.getScrollTop();
|
16040 |
+
};
|
16041 |
+
this.getScrollLeft = function() {
|
16042 |
+
return this.session.getScrollLeft();
|
16043 |
+
};
|
16044 |
+
this.getScrollTopRow = function() {
|
16045 |
+
return this.scrollTop / this.lineHeight;
|
16046 |
+
};
|
16047 |
+
this.getScrollBottomRow = function() {
|
16048 |
+
return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1);
|
16049 |
+
};
|
16050 |
+
this.scrollToRow = function(row) {
|
16051 |
+
this.session.setScrollTop(row * this.lineHeight);
|
16052 |
+
};
|
16053 |
+
|
16054 |
+
this.alignCursor = function(cursor, alignment) {
|
16055 |
+
if (typeof cursor == "number")
|
16056 |
+
cursor = {
|
16057 |
+
row: cursor,
|
16058 |
+
column: 0
|
16059 |
+
};
|
16060 |
+
|
16061 |
+
var pos = this.$cursorLayer.getPixelPosition(cursor);
|
16062 |
+
var h = this.$size.scrollerHeight - this.lineHeight;
|
16063 |
+
var offset = pos.top - h * (alignment || 0);
|
16064 |
+
|
16065 |
+
this.session.setScrollTop(offset);
|
16066 |
+
return offset;
|
16067 |
+
};
|
16068 |
+
|
16069 |
+
this.STEPS = 8;
|
16070 |
+
this.$calcSteps = function(fromValue, toValue) {
|
16071 |
+
var i = 0;
|
16072 |
+
var l = this.STEPS;
|
16073 |
+
var steps = [];
|
16074 |
+
|
16075 |
+
var func = function(t, x_min, dx) {
|
16076 |
+
return dx * (Math.pow(t - 1, 3) + 1) + x_min;
|
16077 |
+
};
|
16078 |
+
|
16079 |
+
for (i = 0; i < l; ++i)
|
16080 |
+
steps.push(func(i / this.STEPS, fromValue, toValue - fromValue));
|
16081 |
+
|
16082 |
+
return steps;
|
16083 |
+
};
|
16084 |
+
this.scrollToLine = function(line, center, animate, callback) {
|
16085 |
+
var pos = this.$cursorLayer.getPixelPosition({
|
16086 |
+
row: line,
|
16087 |
+
column: 0
|
16088 |
+
});
|
16089 |
+
var offset = pos.top;
|
16090 |
+
if (center)
|
16091 |
+
offset -= this.$size.scrollerHeight / 2;
|
16092 |
+
|
16093 |
+
var initialScroll = this.scrollTop;
|
16094 |
+
this.session.setScrollTop(offset);
|
16095 |
+
if (animate !== false)
|
16096 |
+
this.animateScrolling(initialScroll, callback);
|
16097 |
+
};
|
16098 |
+
|
16099 |
+
this.animateScrolling = function(fromValue, callback) {
|
16100 |
+
var toValue = this.scrollTop;
|
16101 |
+
if (!this.$animatedScroll)
|
16102 |
+
return;
|
16103 |
+
var _self = this;
|
16104 |
+
|
16105 |
+
if (fromValue == toValue)
|
16106 |
+
return;
|
16107 |
+
|
16108 |
+
if (this.$scrollAnimation) {
|
16109 |
+
var oldSteps = this.$scrollAnimation.steps;
|
16110 |
+
if (oldSteps.length) {
|
16111 |
+
fromValue = oldSteps[0];
|
16112 |
+
if (fromValue == toValue)
|
16113 |
+
return;
|
16114 |
+
}
|
16115 |
+
}
|
16116 |
+
|
16117 |
+
var steps = _self.$calcSteps(fromValue, toValue);
|
16118 |
+
this.$scrollAnimation = {
|
16119 |
+
from: fromValue,
|
16120 |
+
to: toValue,
|
16121 |
+
steps: steps
|
16122 |
+
};
|
16123 |
+
|
16124 |
+
clearInterval(this.$timer);
|
16125 |
+
|
16126 |
+
_self.session.setScrollTop(steps.shift());
|
16127 |
+
_self.session.$scrollTop = toValue;
|
16128 |
+
this.$timer = setInterval(function() {
|
16129 |
+
if (steps.length) {
|
16130 |
+
_self.session.setScrollTop(steps.shift());
|
16131 |
+
_self.session.$scrollTop = toValue;
|
16132 |
+
} else if (toValue != null) {
|
16133 |
+
_self.session.$scrollTop = -1;
|
16134 |
+
_self.session.setScrollTop(toValue);
|
16135 |
+
toValue = null;
|
16136 |
+
} else {
|
16137 |
+
_self.$timer = clearInterval(_self.$timer);
|
16138 |
+
_self.$scrollAnimation = null;
|
16139 |
+
callback && callback();
|
16140 |
+
}
|
16141 |
+
}, 10);
|
16142 |
+
};
|
16143 |
+
this.scrollToY = function(scrollTop) {
|
16144 |
+
if (this.scrollTop !== scrollTop) {
|
16145 |
+
this.$loop.schedule(this.CHANGE_SCROLL);
|
16146 |
+
this.scrollTop = scrollTop;
|
16147 |
+
}
|
16148 |
+
};
|
16149 |
+
this.scrollToX = function(scrollLeft) {
|
16150 |
+
if (this.scrollLeft !== scrollLeft)
|
16151 |
+
this.scrollLeft = scrollLeft;
|
16152 |
+
this.$loop.schedule(this.CHANGE_H_SCROLL);
|
16153 |
+
};
|
16154 |
+
this.scrollTo = function(x, y) {
|
16155 |
+
this.session.setScrollTop(y);
|
16156 |
+
this.session.setScrollLeft(y);
|
16157 |
+
};
|
16158 |
+
this.scrollBy = function(deltaX, deltaY) {
|
16159 |
+
deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY);
|
16160 |
+
deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX);
|
16161 |
+
};
|
16162 |
+
this.isScrollableBy = function(deltaX, deltaY) {
|
16163 |
+
if (deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top)
|
16164 |
+
return true;
|
16165 |
+
if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight - this.layerConfig.maxHeight < -1 + this.scrollMargin.bottom)
|
16166 |
+
return true;
|
16167 |
+
if (deltaX < 0 && this.session.getScrollLeft() >= 1 - this.scrollMargin.left)
|
16168 |
+
return true;
|
16169 |
+
if (deltaX > 0 && this.session.getScrollLeft() + this.$size.scrollerWidth - this.layerConfig.width < -1 + this.scrollMargin.right)
|
16170 |
+
return true;
|
16171 |
+
};
|
16172 |
+
|
16173 |
+
this.pixelToScreenCoordinates = function(x, y) {
|
16174 |
+
var canvasPos = this.scroller.getBoundingClientRect();
|
16175 |
+
|
16176 |
+
var offset = (x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth;
|
16177 |
+
var row = Math.floor((y + this.scrollTop - canvasPos.top) / this.lineHeight);
|
16178 |
+
var col = Math.round(offset);
|
16179 |
+
|
16180 |
+
return {
|
16181 |
+
row: row,
|
16182 |
+
column: col,
|
16183 |
+
side: offset - col > 0 ? 1 : -1
|
16184 |
+
};
|
16185 |
+
};
|
16186 |
+
|
16187 |
+
this.screenToTextCoordinates = function(x, y) {
|
16188 |
+
var canvasPos = this.scroller.getBoundingClientRect();
|
16189 |
+
|
16190 |
+
var col = Math.round(
|
16191 |
+
(x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth
|
16192 |
+
);
|
16193 |
+
|
16194 |
+
var row = (y + this.scrollTop - canvasPos.top) / this.lineHeight;
|
16195 |
+
|
16196 |
+
return this.session.screenToDocumentPosition(row, Math.max(col, 0));
|
16197 |
+
};
|
16198 |
+
this.textToScreenCoordinates = function(row, column) {
|
16199 |
+
var canvasPos = this.scroller.getBoundingClientRect();
|
16200 |
+
var pos = this.session.documentToScreenPosition(row, column);
|
16201 |
+
|
16202 |
+
var x = this.$padding + Math.round(pos.column * this.characterWidth);
|
16203 |
+
var y = pos.row * this.lineHeight;
|
16204 |
+
|
16205 |
+
return {
|
16206 |
+
pageX: canvasPos.left + x - this.scrollLeft,
|
16207 |
+
pageY: canvasPos.top + y - this.scrollTop
|
16208 |
+
};
|
16209 |
+
};
|
16210 |
+
this.visualizeFocus = function() {
|
16211 |
+
dom.addCssClass(this.container, "ace_focus");
|
16212 |
+
};
|
16213 |
+
this.visualizeBlur = function() {
|
16214 |
+
dom.removeCssClass(this.container, "ace_focus");
|
16215 |
+
};
|
16216 |
+
this.showComposition = function(position) {
|
16217 |
+
if (!this.$composition)
|
16218 |
+
this.$composition = {
|
16219 |
+
keepTextAreaAtCursor: this.$keepTextAreaAtCursor,
|
16220 |
+
cssText: this.textarea.style.cssText
|
16221 |
+
};
|
16222 |
+
|
16223 |
+
this.$keepTextAreaAtCursor = true;
|
16224 |
+
dom.addCssClass(this.textarea, "ace_composition");
|
16225 |
+
this.textarea.style.cssText = "";
|
16226 |
+
this.$moveTextAreaToCursor();
|
16227 |
+
};
|
16228 |
+
this.setCompositionText = function(text) {
|
16229 |
+
this.$moveTextAreaToCursor();
|
16230 |
+
};
|
16231 |
+
this.hideComposition = function() {
|
16232 |
+
if (!this.$composition)
|
16233 |
+
return;
|
16234 |
+
|
16235 |
+
dom.removeCssClass(this.textarea, "ace_composition");
|
16236 |
+
this.$keepTextAreaAtCursor = this.$composition.keepTextAreaAtCursor;
|
16237 |
+
this.textarea.style.cssText = this.$composition.cssText;
|
16238 |
+
this.$composition = null;
|
16239 |
+
};
|
16240 |
+
this.setTheme = function(theme, cb) {
|
16241 |
+
var _self = this;
|
16242 |
+
this.$themeId = theme;
|
16243 |
+
_self._dispatchEvent('themeChange', {
|
16244 |
+
theme: theme
|
16245 |
+
});
|
16246 |
+
|
16247 |
+
if (!theme || typeof theme == "string") {
|
16248 |
+
var moduleName = theme || this.$options.theme.initialValue;
|
16249 |
+
config.loadModule(["theme", moduleName], afterLoad);
|
16250 |
+
} else {
|
16251 |
+
afterLoad(theme);
|
16252 |
+
}
|
16253 |
+
|
16254 |
+
function afterLoad(module) {
|
16255 |
+
if (_self.$themeId != theme)
|
16256 |
+
return cb && cb();
|
16257 |
+
if (!module.cssClass)
|
16258 |
+
return;
|
16259 |
+
dom.importCssString(
|
16260 |
+
module.cssText,
|
16261 |
+
module.cssClass,
|
16262 |
+
_self.container.ownerDocument
|
16263 |
+
);
|
16264 |
+
|
16265 |
+
if (_self.theme)
|
16266 |
+
dom.removeCssClass(_self.container, _self.theme.cssClass);
|
16267 |
+
|
16268 |
+
var padding = "padding" in module ? module.padding : "padding" in (_self.theme || {}) ? 4 : _self.$padding;
|
16269 |
+
if (_self.$padding && padding != _self.$padding)
|
16270 |
+
_self.setPadding(padding);
|
16271 |
+
_self.$theme = module.cssClass;
|
16272 |
+
|
16273 |
+
_self.theme = module;
|
16274 |
+
dom.addCssClass(_self.container, module.cssClass);
|
16275 |
+
dom.setCssClass(_self.container, "ace_dark", module.isDark);
|
16276 |
+
if (_self.$size) {
|
16277 |
+
_self.$size.width = 0;
|
16278 |
+
_self.$updateSizeAsync();
|
16279 |
+
}
|
16280 |
+
|
16281 |
+
_self._dispatchEvent('themeLoaded', {
|
16282 |
+
theme: module
|
16283 |
+
});
|
16284 |
+
cb && cb();
|
16285 |
+
}
|
16286 |
+
};
|
16287 |
+
this.getTheme = function() {
|
16288 |
+
return this.$themeId;
|
16289 |
+
};
|
16290 |
+
this.setStyle = function(style, include) {
|
16291 |
+
dom.setCssClass(this.container, style, include !== false);
|
16292 |
+
};
|
16293 |
+
this.unsetStyle = function(style) {
|
16294 |
+
dom.removeCssClass(this.container, style);
|
16295 |
+
};
|
16296 |
+
|
16297 |
+
this.setCursorStyle = function(style) {
|
16298 |
+
if (this.scroller.style.cursor != style)
|
16299 |
+
this.scroller.style.cursor = style;
|
16300 |
+
};
|
16301 |
+
this.setMouseCursor = function(cursorStyle) {
|
16302 |
+
this.scroller.style.cursor = cursorStyle;
|
16303 |
+
};
|
16304 |
+
this.destroy = function() {
|
16305 |
+
this.$textLayer.destroy();
|
16306 |
+
this.$cursorLayer.destroy();
|
16307 |
+
};
|
16308 |
+
|
16309 |
+
}).call(VirtualRenderer.prototype);
|
16310 |
+
|
16311 |
+
|
16312 |
+
config.defineOptions(VirtualRenderer.prototype, "renderer", {
|
16313 |
+
animatedScroll: {
|
16314 |
+
initialValue: false
|
16315 |
+
},
|
16316 |
+
showInvisibles: {
|
16317 |
+
set: function(value) {
|
16318 |
+
if (this.$textLayer.setShowInvisibles(value))
|
16319 |
+
this.$loop.schedule(this.CHANGE_TEXT);
|
16320 |
+
},
|
16321 |
+
initialValue: false
|
16322 |
+
},
|
16323 |
+
showPrintMargin: {
|
16324 |
+
set: function() {
|
16325 |
+
this.$updatePrintMargin();
|
16326 |
+
},
|
16327 |
+
initialValue: true
|
16328 |
+
},
|
16329 |
+
printMarginColumn: {
|
16330 |
+
set: function() {
|
16331 |
+
this.$updatePrintMargin();
|
16332 |
+
},
|
16333 |
+
initialValue: 80
|
16334 |
+
},
|
16335 |
+
printMargin: {
|
16336 |
+
set: function(val) {
|
16337 |
+
if (typeof val == "number")
|
16338 |
+
this.$printMarginColumn = val;
|
16339 |
+
this.$showPrintMargin = !! val;
|
16340 |
+
this.$updatePrintMargin();
|
16341 |
+
},
|
16342 |
+
get: function() {
|
16343 |
+
return this.$showPrintMargin && this.$printMarginColumn;
|
16344 |
+
}
|
16345 |
+
},
|
16346 |
+
showGutter: {
|
16347 |
+
set: function(show) {
|
16348 |
+
this.$gutter.style.display = show ? "block" : "none";
|
16349 |
+
this.$loop.schedule(this.CHANGE_FULL);
|
16350 |
+
this.onGutterResize();
|
16351 |
+
},
|
16352 |
+
initialValue: true
|
16353 |
+
},
|
16354 |
+
fadeFoldWidgets: {
|
16355 |
+
set: function(show) {
|
16356 |
+
dom.setCssClass(this.$gutter, "ace_fade-fold-widgets", show);
|
16357 |
+
},
|
16358 |
+
initialValue: false
|
16359 |
+
},
|
16360 |
+
showFoldWidgets: {
|
16361 |
+
set: function(show) {
|
16362 |
+
this.$gutterLayer.setShowFoldWidgets(show)
|
16363 |
+
},
|
16364 |
+
initialValue: true
|
16365 |
+
},
|
16366 |
+
showLineNumbers: {
|
16367 |
+
set: function(show) {
|
16368 |
+
this.$gutterLayer.setShowLineNumbers(show);
|
16369 |
+
this.$loop.schedule(this.CHANGE_GUTTER);
|
16370 |
+
},
|
16371 |
+
initialValue: true
|
16372 |
+
},
|
16373 |
+
displayIndentGuides: {
|
16374 |
+
set: function(show) {
|
16375 |
+
if (this.$textLayer.setDisplayIndentGuides(show))
|
16376 |
+
this.$loop.schedule(this.CHANGE_TEXT);
|
16377 |
+
},
|
16378 |
+
initialValue: true
|
16379 |
+
},
|
16380 |
+
highlightGutterLine: {
|
16381 |
+
set: function(shouldHighlight) {
|
16382 |
+
if (!this.$gutterLineHighlight) {
|
16383 |
+
this.$gutterLineHighlight = dom.createElement("div");
|
16384 |
+
this.$gutterLineHighlight.className = "ace_gutter-active-line";
|
16385 |
+
this.$gutter.appendChild(this.$gutterLineHighlight);
|
16386 |
+
return;
|
16387 |
+
}
|
16388 |
+
|
16389 |
+
this.$gutterLineHighlight.style.display = shouldHighlight ? "" : "none";
|
16390 |
+
if (this.$cursorLayer.$pixelPos)
|
16391 |
+
this.$updateGutterLineHighlight();
|
16392 |
+
},
|
16393 |
+
initialValue: false,
|
16394 |
+
value: true
|
16395 |
+
},
|
16396 |
+
hScrollBarAlwaysVisible: {
|
16397 |
+
set: function(val) {
|
16398 |
+
if (!this.$hScrollBarAlwaysVisible || !this.$horizScroll)
|
16399 |
+
this.$loop.schedule(this.CHANGE_SCROLL);
|
16400 |
+
},
|
16401 |
+
initialValue: false
|
16402 |
+
},
|
16403 |
+
vScrollBarAlwaysVisible: {
|
16404 |
+
set: function(val) {
|
16405 |
+
if (!this.$vScrollBarAlwaysVisible || !this.$vScroll)
|
16406 |
+
this.$loop.schedule(this.CHANGE_SCROLL);
|
16407 |
+
},
|
16408 |
+
initialValue: false
|
16409 |
+
},
|
16410 |
+
fontSize: {
|
16411 |
+
set: function(size) {
|
16412 |
+
if (typeof size == "number")
|
16413 |
+
size = size + "px";
|
16414 |
+
this.container.style.fontSize = size;
|
16415 |
+
this.updateFontSize();
|
16416 |
+
},
|
16417 |
+
initialValue: 12
|
16418 |
+
},
|
16419 |
+
fontFamily: {
|
16420 |
+
set: function(name) {
|
16421 |
+
this.container.style.fontFamily = name;
|
16422 |
+
this.updateFontSize();
|
16423 |
+
}
|
16424 |
+
},
|
16425 |
+
maxLines: {
|
16426 |
+
set: function(val) {
|
16427 |
+
this.updateFull();
|
16428 |
+
}
|
16429 |
+
},
|
16430 |
+
minLines: {
|
16431 |
+
set: function(val) {
|
16432 |
+
this.updateFull();
|
16433 |
+
}
|
16434 |
+
},
|
16435 |
+
scrollPastEnd: {
|
16436 |
+
set: function(val) {
|
16437 |
+
val = +val || 0;
|
16438 |
+
if (this.$scrollPastEnd == val)
|
16439 |
+
return;
|
16440 |
+
this.$scrollPastEnd = val;
|
16441 |
+
this.$loop.schedule(this.CHANGE_SCROLL);
|
16442 |
+
},
|
16443 |
+
initialValue: 0,
|
16444 |
+
handlesSet: true
|
16445 |
+
},
|
16446 |
+
fixedWidthGutter: {
|
16447 |
+
set: function(val) {
|
16448 |
+
this.$gutterLayer.$fixedWidth = !! val;
|
16449 |
+
this.$loop.schedule(this.CHANGE_GUTTER);
|
16450 |
+
}
|
16451 |
+
},
|
16452 |
+
theme: {
|
16453 |
+
set: function(val) {
|
16454 |
+
this.setTheme(val)
|
16455 |
+
},
|
16456 |
+
get: function() {
|
16457 |
+
return this.$themeId || this.theme;
|
16458 |
+
},
|
16459 |
+
initialValue: "./theme/textmate",
|
16460 |
+
handlesSet: true
|
16461 |
+
}
|
16462 |
+
});
|
16463 |
+
|
16464 |
+
exports.VirtualRenderer = VirtualRenderer;
|
16465 |
+
});
|
16466 |
+
|
16467 |
+
ace.define("ace/worker/worker_client", ["require", "exports", "module", "ace/lib/oop", "ace/lib/net", "ace/lib/event_emitter", "ace/config"], function(require, exports, module) {
|
16468 |
+
"use strict";
|
16469 |
+
|
16470 |
+
var oop = require("../lib/oop");
|
16471 |
+
var net = require("../lib/net");
|
16472 |
+
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
16473 |
+
var config = require("../config");
|
16474 |
+
|
16475 |
+
var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
|
16476 |
+
this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this);
|
16477 |
+
this.changeListener = this.changeListener.bind(this);
|
16478 |
+
this.onMessage = this.onMessage.bind(this);
|
16479 |
+
if (require.nameToUrl && !require.toUrl)
|
16480 |
+
require.toUrl = require.nameToUrl;
|
16481 |
+
|
16482 |
+
if (config.get("packaged") || !require.toUrl) {
|
16483 |
+
workerUrl = workerUrl || config.moduleUrl(mod, "worker");
|
16484 |
+
} else {
|
16485 |
+
var normalizePath = this.$normalizePath;
|
16486 |
+
workerUrl = workerUrl || normalizePath(require.toUrl("ace/worker/worker.js", null, "_"));
|
16487 |
+
|
16488 |
+
var tlns = {};
|
16489 |
+
topLevelNamespaces.forEach(function(ns) {
|
16490 |
+
tlns[ns] = normalizePath(require.toUrl(ns, null, "_").replace(/(\.js)?(\?.*)?$/, ""));
|
16491 |
+
});
|
16492 |
+
}
|
16493 |
+
|
16494 |
+
try {
|
16495 |
+
this.$worker = new Worker(workerUrl);
|
16496 |
+
} catch (e) {
|
16497 |
+
if (e instanceof window.DOMException) {
|
16498 |
+
var blob = this.$workerBlob(workerUrl);
|
16499 |
+
var URL = window.URL || window.webkitURL;
|
16500 |
+
var blobURL = URL.createObjectURL(blob);
|
16501 |
+
|
16502 |
+
this.$worker = new Worker(blobURL);
|
16503 |
+
URL.revokeObjectURL(blobURL);
|
16504 |
+
} else {
|
16505 |
+
throw e;
|
16506 |
+
}
|
16507 |
+
}
|
16508 |
+
this.$worker.postMessage({
|
16509 |
+
init: true,
|
16510 |
+
tlns: tlns,
|
16511 |
+
module: mod,
|
16512 |
+
classname: classname
|
16513 |
+
});
|
16514 |
+
|
16515 |
+
this.callbackId = 1;
|
16516 |
+
this.callbacks = {};
|
16517 |
+
|
16518 |
+
this.$worker.onmessage = this.onMessage;
|
16519 |
+
};
|
16520 |
+
|
16521 |
+
(function() {
|
16522 |
+
|
16523 |
+
oop.implement(this, EventEmitter);
|
16524 |
+
|
16525 |
+
this.onMessage = function(e) {
|
16526 |
+
var msg = e.data;
|
16527 |
+
switch (msg.type) {
|
16528 |
+
case "event":
|
16529 |
+
this._signal(msg.name, {
|
16530 |
+
data: msg.data
|
16531 |
+
});
|
16532 |
+
break;
|
16533 |
+
case "call":
|
16534 |
+
var callback = this.callbacks[msg.id];
|
16535 |
+
if (callback) {
|
16536 |
+
callback(msg.data);
|
16537 |
+
delete this.callbacks[msg.id];
|
16538 |
+
}
|
16539 |
+
break;
|
16540 |
+
case "error":
|
16541 |
+
this.reportError(msg.data);
|
16542 |
+
break;
|
16543 |
+
case "log":
|
16544 |
+
window.console && console.log && console.log.apply(console, msg.data);
|
16545 |
+
break;
|
16546 |
+
}
|
16547 |
+
};
|
16548 |
+
|
16549 |
+
this.reportError = function(err) {
|
16550 |
+
window.console && console.error && console.error(err);
|
16551 |
+
};
|
16552 |
+
|
16553 |
+
this.$normalizePath = function(path) {
|
16554 |
+
return net.qualifyURL(path);
|
16555 |
+
};
|
16556 |
+
|
16557 |
+
this.terminate = function() {
|
16558 |
+
this._signal("terminate", {});
|
16559 |
+
this.deltaQueue = null;
|
16560 |
+
this.$worker.terminate();
|
16561 |
+
this.$worker = null;
|
16562 |
+
if (this.$doc)
|
16563 |
+
this.$doc.off("change", this.changeListener);
|
16564 |
+
this.$doc = null;
|
16565 |
+
};
|
16566 |
+
|
16567 |
+
this.send = function(cmd, args) {
|
16568 |
+
this.$worker.postMessage({
|
16569 |
+
command: cmd,
|
16570 |
+
args: args
|
16571 |
+
});
|
16572 |
+
};
|
16573 |
+
|
16574 |
+
this.call = function(cmd, args, callback) {
|
16575 |
+
if (callback) {
|
16576 |
+
var id = this.callbackId++;
|
16577 |
+
this.callbacks[id] = callback;
|
16578 |
+
args.push(id);
|
16579 |
+
}
|
16580 |
+
this.send(cmd, args);
|
16581 |
+
};
|
16582 |
+
|
16583 |
+
this.emit = function(event, data) {
|
16584 |
+
try {
|
16585 |
+
this.$worker.postMessage({
|
16586 |
+
event: event,
|
16587 |
+
data: {
|
16588 |
+
data: data.data
|
16589 |
+
}
|
16590 |
+
});
|
16591 |
+
} catch (ex) {
|
16592 |
+
console.error(ex.stack);
|
16593 |
+
}
|
16594 |
+
};
|
16595 |
+
|
16596 |
+
this.attachToDocument = function(doc) {
|
16597 |
+
if (this.$doc)
|
16598 |
+
this.terminate();
|
16599 |
+
|
16600 |
+
this.$doc = doc;
|
16601 |
+
this.call("setValue", [doc.getValue()]);
|
16602 |
+
doc.on("change", this.changeListener);
|
16603 |
+
};
|
16604 |
+
|
16605 |
+
this.changeListener = function(e) {
|
16606 |
+
if (!this.deltaQueue) {
|
16607 |
+
this.deltaQueue = [e.data];
|
16608 |
+
setTimeout(this.$sendDeltaQueue, 0);
|
16609 |
+
} else
|
16610 |
+
this.deltaQueue.push(e.data);
|
16611 |
+
};
|
16612 |
+
|
16613 |
+
this.$sendDeltaQueue = function() {
|
16614 |
+
var q = this.deltaQueue;
|
16615 |
+
if (!q) return;
|
16616 |
+
this.deltaQueue = null;
|
16617 |
+
if (q.length > 20 && q.length > this.$doc.getLength() >> 1) {
|
16618 |
+
this.call("setValue", [this.$doc.getValue()]);
|
16619 |
+
} else
|
16620 |
+
this.emit("change", {
|
16621 |
+
data: q
|
16622 |
+
});
|
16623 |
+
};
|
16624 |
+
|
16625 |
+
this.$workerBlob = function(workerUrl) {
|
16626 |
+
var script = "importScripts('" + net.qualifyURL(workerUrl) + "');";
|
16627 |
+
try {
|
16628 |
+
return new Blob([script], {
|
16629 |
+
"type": "application/javascript"
|
16630 |
+
});
|
16631 |
+
} catch (e) { // Backwards-compatibility
|
16632 |
+
var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;
|
16633 |
+
var blobBuilder = new BlobBuilder();
|
16634 |
+
blobBuilder.append(script);
|
16635 |
+
return blobBuilder.getBlob("application/javascript");
|
16636 |
+
}
|
16637 |
+
};
|
16638 |
+
|
16639 |
+
}).call(WorkerClient.prototype);
|
16640 |
+
|
16641 |
+
|
16642 |
+
var UIWorkerClient = function(topLevelNamespaces, mod, classname) {
|
16643 |
+
this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this);
|
16644 |
+
this.changeListener = this.changeListener.bind(this);
|
16645 |
+
this.callbackId = 1;
|
16646 |
+
this.callbacks = {};
|
16647 |
+
this.messageBuffer = [];
|
16648 |
+
|
16649 |
+
var main = null;
|
16650 |
+
var emitSync = false;
|
16651 |
+
var sender = Object.create(EventEmitter);
|
16652 |
+
var _self = this;
|
16653 |
+
|
16654 |
+
this.$worker = {};
|
16655 |
+
this.$worker.terminate = function() {};
|
16656 |
+
this.$worker.postMessage = function(e) {
|
16657 |
+
_self.messageBuffer.push(e);
|
16658 |
+
if (main) {
|
16659 |
+
if (emitSync)
|
16660 |
+
setTimeout(processNext);
|
16661 |
+
else
|
16662 |
+
processNext();
|
16663 |
+
}
|
16664 |
+
};
|
16665 |
+
this.setEmitSync = function(val) {
|
16666 |
+
emitSync = val
|
16667 |
+
};
|
16668 |
+
|
16669 |
+
var processNext = function() {
|
16670 |
+
var msg = _self.messageBuffer.shift();
|
16671 |
+
if (msg.command)
|
16672 |
+
main[msg.command].apply(main, msg.args);
|
16673 |
+
else if (msg.event)
|
16674 |
+
sender._signal(msg.event, msg.data);
|
16675 |
+
};
|
16676 |
+
|
16677 |
+
sender.postMessage = function(msg) {
|
16678 |
+
_self.onMessage({
|
16679 |
+
data: msg
|
16680 |
+
});
|
16681 |
+
};
|
16682 |
+
sender.callback = function(data, callbackId) {
|
16683 |
+
this.postMessage({
|
16684 |
+
type: "call",
|
16685 |
+
id: callbackId,
|
16686 |
+
data: data
|
16687 |
+
});
|
16688 |
+
};
|
16689 |
+
sender.emit = function(name, data) {
|
16690 |
+
this.postMessage({
|
16691 |
+
type: "event",
|
16692 |
+
name: name,
|
16693 |
+
data: data
|
16694 |
+
});
|
16695 |
+
};
|
16696 |
+
|
16697 |
+
config.loadModule(["worker", mod], function(Main) {
|
16698 |
+
main = new Main[classname](sender);
|
16699 |
+
while (_self.messageBuffer.length)
|
16700 |
+
processNext();
|
16701 |
+
});
|
16702 |
+
};
|
16703 |
+
|
16704 |
+
UIWorkerClient.prototype = WorkerClient.prototype;
|
16705 |
+
|
16706 |
+
exports.UIWorkerClient = UIWorkerClient;
|
16707 |
+
exports.WorkerClient = WorkerClient;
|
16708 |
+
|
16709 |
+
});
|
16710 |
+
|
16711 |
+
ace.define("ace/placeholder", ["require", "exports", "module", "ace/range", "ace/lib/event_emitter", "ace/lib/oop"], function(require, exports, module) {
|
16712 |
+
"use strict";
|
16713 |
+
|
16714 |
+
var Range = require("./range").Range;
|
16715 |
+
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
16716 |
+
var oop = require("./lib/oop");
|
16717 |
+
|
16718 |
+
var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) {
|
16719 |
+
var _self = this;
|
16720 |
+
this.length = length;
|
16721 |
+
this.session = session;
|
16722 |
+
this.doc = session.getDocument();
|
16723 |
+
this.mainClass = mainClass;
|
16724 |
+
this.othersClass = othersClass;
|
16725 |
+
this.$onUpdate = this.onUpdate.bind(this);
|
16726 |
+
this.doc.on("change", this.$onUpdate);
|
16727 |
+
this.$others = others;
|
16728 |
+
|
16729 |
+
this.$onCursorChange = function() {
|
16730 |
+
setTimeout(function() {
|
16731 |
+
_self.onCursorChange();
|
16732 |
+
});
|
16733 |
+
};
|
16734 |
+
|
16735 |
+
this.$pos = pos;
|
16736 |
+
var undoStack = session.getUndoManager().$undoStack || session.getUndoManager().$undostack || {
|
16737 |
+
length: -1
|
16738 |
+
};
|
16739 |
+
this.$undoStackDepth = undoStack.length;
|
16740 |
+
this.setup();
|
16741 |
+
|
16742 |
+
session.selection.on("changeCursor", this.$onCursorChange);
|
16743 |
+
};
|
16744 |
+
|
16745 |
+
(function() {
|
16746 |
+
|
16747 |
+
oop.implement(this, EventEmitter);
|
16748 |
+
this.setup = function() {
|
16749 |
+
var _self = this;
|
16750 |
+
var doc = this.doc;
|
16751 |
+
var session = this.session;
|
16752 |
+
var pos = this.$pos;
|
16753 |
+
|
16754 |
+
this.selectionBefore = session.selection.toJSON();
|
16755 |
+
if (session.selection.inMultiSelectMode)
|
16756 |
+
session.selection.toSingleRange();
|
16757 |
+
|
16758 |
+
this.pos = doc.createAnchor(pos.row, pos.column);
|
16759 |
+
this.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false);
|
16760 |
+
this.pos.on("change", function(event) {
|
16761 |
+
session.removeMarker(_self.markerId);
|
16762 |
+
_self.markerId = session.addMarker(new Range(event.value.row, event.value.column, event.value.row, event.value.column + _self.length), _self.mainClass, null, false);
|
16763 |
+
});
|
16764 |
+
this.others = [];
|
16765 |
+
this.$others.forEach(function(other) {
|
16766 |
+
var anchor = doc.createAnchor(other.row, other.column);
|
16767 |
+
_self.others.push(anchor);
|
16768 |
+
});
|
16769 |
+
session.setUndoSelect(false);
|
16770 |
+
};
|
16771 |
+
this.showOtherMarkers = function() {
|
16772 |
+
if (this.othersActive) return;
|
16773 |
+
var session = this.session;
|
16774 |
+
var _self = this;
|
16775 |
+
this.othersActive = true;
|
16776 |
+
this.others.forEach(function(anchor) {
|
16777 |
+
anchor.markerId = session.addMarker(new Range(anchor.row, anchor.column, anchor.row, anchor.column + _self.length), _self.othersClass, null, false);
|
16778 |
+
anchor.on("change", function(event) {
|
16779 |
+
session.removeMarker(anchor.markerId);
|
16780 |
+
anchor.markerId = session.addMarker(new Range(event.value.row, event.value.column, event.value.row, event.value.column + _self.length), _self.othersClass, null, false);
|
16781 |
+
});
|
16782 |
+
});
|
16783 |
+
};
|
16784 |
+
this.hideOtherMarkers = function() {
|
16785 |
+
if (!this.othersActive) return;
|
16786 |
+
this.othersActive = false;
|
16787 |
+
for (var i = 0; i < this.others.length; i++) {
|
16788 |
+
this.session.removeMarker(this.others[i].markerId);
|
16789 |
+
}
|
16790 |
+
};
|
16791 |
+
this.onUpdate = function(event) {
|
16792 |
+
var delta = event.data;
|
16793 |
+
var range = delta.range;
|
16794 |
+
if (range.start.row !== range.end.row) return;
|
16795 |
+
if (range.start.row !== this.pos.row) return;
|
16796 |
+
if (this.$updating) return;
|
16797 |
+
this.$updating = true;
|
16798 |
+
var lengthDiff = delta.action === "insertText" ? range.end.column - range.start.column : range.start.column - range.end.column;
|
16799 |
+
|
16800 |
+
if (range.start.column >= this.pos.column && range.start.column <= this.pos.column + this.length + 1) {
|
16801 |
+
var distanceFromStart = range.start.column - this.pos.column;
|
16802 |
+
this.length += lengthDiff;
|
16803 |
+
if (!this.session.$fromUndo) {
|
16804 |
+
if (delta.action === "insertText") {
|
16805 |
+
for (var i = this.others.length - 1; i >= 0; i--) {
|
16806 |
+
var otherPos = this.others[i];
|
16807 |
+
var newPos = {
|
16808 |
+
row: otherPos.row,
|
16809 |
+
column: otherPos.column + distanceFromStart
|
16810 |
+
};
|
16811 |
+
if (otherPos.row === range.start.row && range.start.column < otherPos.column)
|
16812 |
+
newPos.column += lengthDiff;
|
16813 |
+
this.doc.insert(newPos, delta.text);
|
16814 |
+
}
|
16815 |
+
} else if (delta.action === "removeText") {
|
16816 |
+
for (var i = this.others.length - 1; i >= 0; i--) {
|
16817 |
+
var otherPos = this.others[i];
|
16818 |
+
var newPos = {
|
16819 |
+
row: otherPos.row,
|
16820 |
+
column: otherPos.column + distanceFromStart
|
16821 |
+
};
|
16822 |
+
if (otherPos.row === range.start.row && range.start.column < otherPos.column)
|
16823 |
+
newPos.column += lengthDiff;
|
16824 |
+
this.doc.remove(new Range(newPos.row, newPos.column, newPos.row, newPos.column - lengthDiff));
|
16825 |
+
}
|
16826 |
+
}
|
16827 |
+
if (range.start.column === this.pos.column && delta.action === "insertText") {
|
16828 |
+
setTimeout(function() {
|
16829 |
+
this.pos.setPosition(this.pos.row, this.pos.column - lengthDiff);
|
16830 |
+
for (var i = 0; i < this.others.length; i++) {
|
16831 |
+
var other = this.others[i];
|
16832 |
+
var newPos = {
|
16833 |
+
row: other.row,
|
16834 |
+
column: other.column - lengthDiff
|
16835 |
+
};
|
16836 |
+
if (other.row === range.start.row && range.start.column < other.column)
|
16837 |
+
newPos.column += lengthDiff;
|
16838 |
+
other.setPosition(newPos.row, newPos.column);
|
16839 |
+
}
|
16840 |
+
}.bind(this), 0);
|
16841 |
+
} else if (range.start.column === this.pos.column && delta.action === "removeText") {
|
16842 |
+
setTimeout(function() {
|
16843 |
+
for (var i = 0; i < this.others.length; i++) {
|
16844 |
+
var other = this.others[i];
|
16845 |
+
if (other.row === range.start.row && range.start.column < other.column) {
|
16846 |
+
other.setPosition(other.row, other.column - lengthDiff);
|
16847 |
+
}
|
16848 |
+
}
|
16849 |
+
}.bind(this), 0);
|
16850 |
+
}
|
16851 |
+
}
|
16852 |
+
this.pos._emit("change", {
|
16853 |
+
value: this.pos
|
16854 |
+
});
|
16855 |
+
for (var i = 0; i < this.others.length; i++) {
|
16856 |
+
this.others[i]._emit("change", {
|
16857 |
+
value: this.others[i]
|
16858 |
+
});
|
16859 |
+
}
|
16860 |
+
}
|
16861 |
+
this.$updating = false;
|
16862 |
+
};
|
16863 |
+
|
16864 |
+
this.onCursorChange = function(event) {
|
16865 |
+
if (this.$updating || !this.session) return;
|
16866 |
+
var pos = this.session.selection.getCursor();
|
16867 |
+
if (pos.row === this.pos.row && pos.column >= this.pos.column && pos.column <= this.pos.column + this.length) {
|
16868 |
+
this.showOtherMarkers();
|
16869 |
+
this._emit("cursorEnter", event);
|
16870 |
+
} else {
|
16871 |
+
this.hideOtherMarkers();
|
16872 |
+
this._emit("cursorLeave", event);
|
16873 |
+
}
|
16874 |
+
};
|
16875 |
+
this.detach = function() {
|
16876 |
+
this.session.removeMarker(this.markerId);
|
16877 |
+
this.hideOtherMarkers();
|
16878 |
+
this.doc.removeEventListener("change", this.$onUpdate);
|
16879 |
+
this.session.selection.removeEventListener("changeCursor", this.$onCursorChange);
|
16880 |
+
this.pos.detach();
|
16881 |
+
for (var i = 0; i < this.others.length; i++) {
|
16882 |
+
this.others[i].detach();
|
16883 |
+
}
|
16884 |
+
this.session.setUndoSelect(true);
|
16885 |
+
this.session = null;
|
16886 |
+
};
|
16887 |
+
this.cancel = function() {
|
16888 |
+
if (this.$undoStackDepth === -1)
|
16889 |
+
throw Error("Canceling placeholders only supported with undo manager attached to session.");
|
16890 |
+
var undoManager = this.session.getUndoManager();
|
16891 |
+
var undosRequired = (undoManager.$undoStack || undoManager.$undostack).length - this.$undoStackDepth;
|
16892 |
+
for (var i = 0; i < undosRequired; i++) {
|
16893 |
+
undoManager.undo(true);
|
16894 |
+
}
|
16895 |
+
if (this.selectionBefore)
|
16896 |
+
this.session.selection.fromJSON(this.selectionBefore);
|
16897 |
+
};
|
16898 |
+
}).call(PlaceHolder.prototype);
|
16899 |
+
|
16900 |
+
|
16901 |
+
exports.PlaceHolder = PlaceHolder;
|
16902 |
+
});
|
16903 |
+
|
16904 |
+
ace.define("ace/mouse/multi_select_handler", ["require", "exports", "module", "ace/lib/event", "ace/lib/useragent"], function(require, exports, module) {
|
16905 |
+
|
16906 |
+
var event = require("../lib/event");
|
16907 |
+
var useragent = require("../lib/useragent");
|
16908 |
+
|
16909 |
+
function isSamePoint(p1, p2) {
|
16910 |
+
return p1.row == p2.row && p1.column == p2.column;
|
16911 |
+
}
|
16912 |
+
|
16913 |
+
function onMouseDown(e) {
|
16914 |
+
var ev = e.domEvent;
|
16915 |
+
var alt = ev.altKey;
|
16916 |
+
var shift = ev.shiftKey;
|
16917 |
+
var ctrl = ev.ctrlKey;
|
16918 |
+
var accel = e.getAccelKey();
|
16919 |
+
var button = e.getButton();
|
16920 |
+
|
16921 |
+
if (ctrl && useragent.isMac)
|
16922 |
+
button = ev.button;
|
16923 |
+
|
16924 |
+
if (e.editor.inMultiSelectMode && button == 2) {
|
16925 |
+
e.editor.textInput.onContextMenu(e.domEvent);
|
16926 |
+
return;
|
16927 |
+
}
|
16928 |
+
|
16929 |
+
if (!ctrl && !alt && !accel) {
|
16930 |
+
if (button === 0 && e.editor.inMultiSelectMode)
|
16931 |
+
e.editor.exitMultiSelectMode();
|
16932 |
+
return;
|
16933 |
+
}
|
16934 |
+
|
16935 |
+
if (button !== 0)
|
16936 |
+
return;
|
16937 |
+
|
16938 |
+
var editor = e.editor;
|
16939 |
+
var selection = editor.selection;
|
16940 |
+
var isMultiSelect = editor.inMultiSelectMode;
|
16941 |
+
var pos = e.getDocumentPosition();
|
16942 |
+
var cursor = selection.getCursor();
|
16943 |
+
var inSelection = e.inSelection() || (selection.isEmpty() && isSamePoint(pos, cursor));
|
16944 |
+
|
16945 |
+
var mouseX = e.x,
|
16946 |
+
mouseY = e.y;
|
16947 |
+
var onMouseSelection = function(e) {
|
16948 |
+
mouseX = e.clientX;
|
16949 |
+
mouseY = e.clientY;
|
16950 |
+
};
|
16951 |
+
|
16952 |
+
var session = editor.session;
|
16953 |
+
var screenAnchor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);
|
16954 |
+
var screenCursor = screenAnchor;
|
16955 |
+
|
16956 |
+
var selectionMode;
|
16957 |
+
if (editor.$mouseHandler.$enableJumpToDef) {
|
16958 |
+
if (ctrl && alt || accel && alt)
|
16959 |
+
selectionMode = "add";
|
16960 |
+
else if (alt)
|
16961 |
+
selectionMode = "block";
|
16962 |
+
} else {
|
16963 |
+
if (accel && !alt) {
|
16964 |
+
selectionMode = "add";
|
16965 |
+
if (!isMultiSelect && shift)
|
16966 |
+
return;
|
16967 |
+
} else if (alt) {
|
16968 |
+
selectionMode = "block";
|
16969 |
+
}
|
16970 |
+
}
|
16971 |
+
|
16972 |
+
if (selectionMode && useragent.isMac && ev.ctrlKey) {
|
16973 |
+
editor.$mouseHandler.cancelContextMenu();
|
16974 |
+
}
|
16975 |
+
|
16976 |
+
if (selectionMode == "add") {
|
16977 |
+
if (!isMultiSelect && inSelection)
|
16978 |
+
return; // dragging
|
16979 |
+
|
16980 |
+
if (!isMultiSelect) {
|
16981 |
+
var range = selection.toOrientedRange();
|
16982 |
+
editor.addSelectionMarker(range);
|
16983 |
+
}
|
16984 |
+
|
16985 |
+
var oldRange = selection.rangeList.rangeAtPoint(pos);
|
16986 |
+
|
16987 |
+
|
16988 |
+
editor.$blockScrolling++;
|
16989 |
+
editor.inVirtualSelectionMode = true;
|
16990 |
+
|
16991 |
+
if (shift) {
|
16992 |
+
oldRange = null;
|
16993 |
+
range = selection.ranges[0];
|
16994 |
+
editor.removeSelectionMarker(range);
|
16995 |
+
}
|
16996 |
+
editor.once("mouseup", function() {
|
16997 |
+
var tmpSel = selection.toOrientedRange();
|
16998 |
+
|
16999 |
+
if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor))
|
17000 |
+
selection.substractPoint(tmpSel.cursor);
|
17001 |
+
else {
|
17002 |
+
if (shift) {
|
17003 |
+
selection.substractPoint(range.cursor);
|
17004 |
+
} else if (range) {
|
17005 |
+
editor.removeSelectionMarker(range);
|
17006 |
+
selection.addRange(range);
|
17007 |
+
}
|
17008 |
+
selection.addRange(tmpSel);
|
17009 |
+
}
|
17010 |
+
editor.$blockScrolling--;
|
17011 |
+
editor.inVirtualSelectionMode = false;
|
17012 |
+
});
|
17013 |
+
|
17014 |
+
} else if (selectionMode == "block") {
|
17015 |
+
e.stop();
|
17016 |
+
editor.inVirtualSelectionMode = true;
|
17017 |
+
var initialRange;
|
17018 |
+
var rectSel = [];
|
17019 |
+
var blockSelect = function() {
|
17020 |
+
var newCursor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);
|
17021 |
+
var cursor = session.screenToDocumentPosition(newCursor.row, newCursor.column);
|
17022 |
+
|
17023 |
+
if (isSamePoint(screenCursor, newCursor) && isSamePoint(cursor, selection.lead))
|
17024 |
+
return;
|
17025 |
+
screenCursor = newCursor;
|
17026 |
+
|
17027 |
+
editor.selection.moveToPosition(cursor);
|
17028 |
+
editor.renderer.scrollCursorIntoView();
|
17029 |
+
|
17030 |
+
editor.removeSelectionMarkers(rectSel);
|
17031 |
+
rectSel = selection.rectangularRangeBlock(screenCursor, screenAnchor);
|
17032 |
+
if (editor.$mouseHandler.$clickSelection && rectSel.length == 1 && rectSel[0].isEmpty())
|
17033 |
+
rectSel[0] = editor.$mouseHandler.$clickSelection.clone();
|
17034 |
+
rectSel.forEach(editor.addSelectionMarker, editor);
|
17035 |
+
editor.updateSelectionMarkers();
|
17036 |
+
};
|
17037 |
+
|
17038 |
+
if (isMultiSelect && !accel) {
|
17039 |
+
selection.toSingleRange();
|
17040 |
+
} else if (!isMultiSelect && accel) {
|
17041 |
+
initialRange = selection.toOrientedRange();
|
17042 |
+
editor.addSelectionMarker(initialRange);
|
17043 |
+
}
|
17044 |
+
|
17045 |
+
if (shift)
|
17046 |
+
screenAnchor = session.documentToScreenPosition(selection.lead);
|
17047 |
+
else
|
17048 |
+
selection.moveToPosition(pos);
|
17049 |
+
|
17050 |
+
screenCursor = {
|
17051 |
+
row: -1,
|
17052 |
+
column: -1
|
17053 |
+
};
|
17054 |
+
|
17055 |
+
var onMouseSelectionEnd = function(e) {
|
17056 |
+
clearInterval(timerId);
|
17057 |
+
editor.removeSelectionMarkers(rectSel);
|
17058 |
+
if (!rectSel.length)
|
17059 |
+
rectSel = [selection.toOrientedRange()];
|
17060 |
+
editor.$blockScrolling++;
|
17061 |
+
if (initialRange) {
|
17062 |
+
editor.removeSelectionMarker(initialRange);
|
17063 |
+
selection.toSingleRange(initialRange);
|
17064 |
+
}
|
17065 |
+
for (var i = 0; i < rectSel.length; i++)
|
17066 |
+
selection.addRange(rectSel[i]);
|
17067 |
+
editor.inVirtualSelectionMode = false;
|
17068 |
+
editor.$mouseHandler.$clickSelection = null;
|
17069 |
+
editor.$blockScrolling--;
|
17070 |
+
};
|
17071 |
+
|
17072 |
+
var onSelectionInterval = blockSelect;
|
17073 |
+
|
17074 |
+
event.capture(editor.container, onMouseSelection, onMouseSelectionEnd);
|
17075 |
+
var timerId = setInterval(function() {
|
17076 |
+
onSelectionInterval();
|
17077 |
+
}, 20);
|
17078 |
+
|
17079 |
+
return e.preventDefault();
|
17080 |
+
}
|
17081 |
+
}
|
17082 |
+
|
17083 |
+
|
17084 |
+
exports.onMouseDown = onMouseDown;
|
17085 |
+
|
17086 |
+
});
|
17087 |
+
|
17088 |
+
ace.define("ace/commands/multi_select_commands", ["require", "exports", "module", "ace/keyboard/hash_handler"], function(require, exports, module) {
|
17089 |
+
exports.defaultCommands = [{
|
17090 |
+
name: "addCursorAbove",
|
17091 |
+
exec: function(editor) {
|
17092 |
+
editor.selectMoreLines(-1);
|
17093 |
+
},
|
17094 |
+
bindKey: {
|
17095 |
+
win: "Ctrl-Alt-Up",
|
17096 |
+
mac: "Ctrl-Alt-Up"
|
17097 |
+
},
|
17098 |
+
readonly: true
|
17099 |
+
}, {
|
17100 |
+
name: "addCursorBelow",
|
17101 |
+
exec: function(editor) {
|
17102 |
+
editor.selectMoreLines(1);
|
17103 |
+
},
|
17104 |
+
bindKey: {
|
17105 |
+
win: "Ctrl-Alt-Down",
|
17106 |
+
mac: "Ctrl-Alt-Down"
|
17107 |
+
},
|
17108 |
+
readonly: true
|
17109 |
+
}, {
|
17110 |
+
name: "addCursorAboveSkipCurrent",
|
17111 |
+
exec: function(editor) {
|
17112 |
+
editor.selectMoreLines(-1, true);
|
17113 |
+
},
|
17114 |
+
bindKey: {
|
17115 |
+
win: "Ctrl-Alt-Shift-Up",
|
17116 |
+
mac: "Ctrl-Alt-Shift-Up"
|
17117 |
+
},
|
17118 |
+
readonly: true
|
17119 |
+
}, {
|
17120 |
+
name: "addCursorBelowSkipCurrent",
|
17121 |
+
exec: function(editor) {
|
17122 |
+
editor.selectMoreLines(1, true);
|
17123 |
+
},
|
17124 |
+
bindKey: {
|
17125 |
+
win: "Ctrl-Alt-Shift-Down",
|
17126 |
+
mac: "Ctrl-Alt-Shift-Down"
|
17127 |
+
},
|
17128 |
+
readonly: true
|
17129 |
+
}, {
|
17130 |
+
name: "selectMoreBefore",
|
17131 |
+
exec: function(editor) {
|
17132 |
+
editor.selectMore(-1);
|
17133 |
+
},
|
17134 |
+
bindKey: {
|
17135 |
+
win: "Ctrl-Alt-Left",
|
17136 |
+
mac: "Ctrl-Alt-Left"
|
17137 |
+
},
|
17138 |
+
readonly: true
|
17139 |
+
}, {
|
17140 |
+
name: "selectMoreAfter",
|
17141 |
+
exec: function(editor) {
|
17142 |
+
editor.selectMore(1);
|
17143 |
+
},
|
17144 |
+
bindKey: {
|
17145 |
+
win: "Ctrl-Alt-Right",
|
17146 |
+
mac: "Ctrl-Alt-Right"
|
17147 |
+
},
|
17148 |
+
readonly: true
|
17149 |
+
}, {
|
17150 |
+
name: "selectNextBefore",
|
17151 |
+
exec: function(editor) {
|
17152 |
+
editor.selectMore(-1, true);
|
17153 |
+
},
|
17154 |
+
bindKey: {
|
17155 |
+
win: "Ctrl-Alt-Shift-Left",
|
17156 |
+
mac: "Ctrl-Alt-Shift-Left"
|
17157 |
+
},
|
17158 |
+
readonly: true
|
17159 |
+
}, {
|
17160 |
+
name: "selectNextAfter",
|
17161 |
+
exec: function(editor) {
|
17162 |
+
editor.selectMore(1, true);
|
17163 |
+
},
|
17164 |
+
bindKey: {
|
17165 |
+
win: "Ctrl-Alt-Shift-Right",
|
17166 |
+
mac: "Ctrl-Alt-Shift-Right"
|
17167 |
+
},
|
17168 |
+
readonly: true
|
17169 |
+
}, {
|
17170 |
+
name: "splitIntoLines",
|
17171 |
+
exec: function(editor) {
|
17172 |
+
editor.multiSelect.splitIntoLines();
|
17173 |
+
},
|
17174 |
+
bindKey: {
|
17175 |
+
win: "Ctrl-Alt-L",
|
17176 |
+
mac: "Ctrl-Alt-L"
|
17177 |
+
},
|
17178 |
+
readonly: true
|
17179 |
+
}, {
|
17180 |
+
name: "alignCursors",
|
17181 |
+
exec: function(editor) {
|
17182 |
+
editor.alignCursors();
|
17183 |
+
},
|
17184 |
+
bindKey: {
|
17185 |
+
win: "Ctrl-Alt-A",
|
17186 |
+
mac: "Ctrl-Alt-A"
|
17187 |
+
}
|
17188 |
+
}, {
|
17189 |
+
name: "findAll",
|
17190 |
+
exec: function(editor) {
|
17191 |
+
editor.findAll();
|
17192 |
+
},
|
17193 |
+
bindKey: {
|
17194 |
+
win: "Ctrl-Alt-K",
|
17195 |
+
mac: "Ctrl-Alt-G"
|
17196 |
+
},
|
17197 |
+
readonly: true
|
17198 |
+
}];
|
17199 |
+
exports.multiSelectCommands = [{
|
17200 |
+
name: "singleSelection",
|
17201 |
+
bindKey: "esc",
|
17202 |
+
exec: function(editor) {
|
17203 |
+
editor.exitMultiSelectMode();
|
17204 |
+
},
|
17205 |
+
readonly: true,
|
17206 |
+
isAvailable: function(editor) {
|
17207 |
+
return editor && editor.inMultiSelectMode
|
17208 |
+
}
|
17209 |
+
}];
|
17210 |
+
|
17211 |
+
var HashHandler = require("../keyboard/hash_handler").HashHandler;
|
17212 |
+
exports.keyboardHandler = new HashHandler(exports.multiSelectCommands);
|
17213 |
+
|
17214 |
+
});
|
17215 |
+
|
17216 |
+
ace.define("ace/multi_select", ["require", "exports", "module", "ace/range_list", "ace/range", "ace/selection", "ace/mouse/multi_select_handler", "ace/lib/event", "ace/lib/lang", "ace/commands/multi_select_commands", "ace/search", "ace/edit_session", "ace/editor", "ace/config"], function(require, exports, module) {
|
17217 |
+
|
17218 |
+
var RangeList = require("./range_list").RangeList;
|
17219 |
+
var Range = require("./range").Range;
|
17220 |
+
var Selection = require("./selection").Selection;
|
17221 |
+
var onMouseDown = require("./mouse/multi_select_handler").onMouseDown;
|
17222 |
+
var event = require("./lib/event");
|
17223 |
+
var lang = require("./lib/lang");
|
17224 |
+
var commands = require("./commands/multi_select_commands");
|
17225 |
+
exports.commands = commands.defaultCommands.concat(commands.multiSelectCommands);
|
17226 |
+
var Search = require("./search").Search;
|
17227 |
+
var search = new Search();
|
17228 |
+
|
17229 |
+
function find(session, needle, dir) {
|
17230 |
+
search.$options.wrap = true;
|
17231 |
+
search.$options.needle = needle;
|
17232 |
+
search.$options.backwards = dir == -1;
|
17233 |
+
return search.find(session);
|
17234 |
+
}
|
17235 |
+
var EditSession = require("./edit_session").EditSession;
|
17236 |
+
(function() {
|
17237 |
+
this.getSelectionMarkers = function() {
|
17238 |
+
return this.$selectionMarkers;
|
17239 |
+
};
|
17240 |
+
}).call(EditSession.prototype);
|
17241 |
+
(function() {
|
17242 |
+
this.ranges = null;
|
17243 |
+
this.rangeList = null;
|
17244 |
+
this.addRange = function(range, $blockChangeEvents) {
|
17245 |
+
if (!range)
|
17246 |
+
return;
|
17247 |
+
|
17248 |
+
if (!this.inMultiSelectMode && this.rangeCount === 0) {
|
17249 |
+
var oldRange = this.toOrientedRange();
|
17250 |
+
this.rangeList.add(oldRange);
|
17251 |
+
this.rangeList.add(range);
|
17252 |
+
if (this.rangeList.ranges.length != 2) {
|
17253 |
+
this.rangeList.removeAll();
|
17254 |
+
return $blockChangeEvents || this.fromOrientedRange(range);
|
17255 |
+
}
|
17256 |
+
this.rangeList.removeAll();
|
17257 |
+
this.rangeList.add(oldRange);
|
17258 |
+
this.$onAddRange(oldRange);
|
17259 |
+
}
|
17260 |
+
|
17261 |
+
if (!range.cursor)
|
17262 |
+
range.cursor = range.end;
|
17263 |
+
|
17264 |
+
var removed = this.rangeList.add(range);
|
17265 |
+
|
17266 |
+
this.$onAddRange(range);
|
17267 |
+
|
17268 |
+
if (removed.length)
|
17269 |
+
this.$onRemoveRange(removed);
|
17270 |
+
|
17271 |
+
if (this.rangeCount > 1 && !this.inMultiSelectMode) {
|
17272 |
+
this._signal("multiSelect");
|
17273 |
+
this.inMultiSelectMode = true;
|
17274 |
+
this.session.$undoSelect = false;
|
17275 |
+
this.rangeList.attach(this.session);
|
17276 |
+
}
|
17277 |
+
|
17278 |
+
return $blockChangeEvents || this.fromOrientedRange(range);
|
17279 |
+
};
|
17280 |
+
|
17281 |
+
this.toSingleRange = function(range) {
|
17282 |
+
range = range || this.ranges[0];
|
17283 |
+
var removed = this.rangeList.removeAll();
|
17284 |
+
if (removed.length)
|
17285 |
+
this.$onRemoveRange(removed);
|
17286 |
+
|
17287 |
+
range && this.fromOrientedRange(range);
|
17288 |
+
};
|
17289 |
+
this.substractPoint = function(pos) {
|
17290 |
+
var removed = this.rangeList.substractPoint(pos);
|
17291 |
+
if (removed) {
|
17292 |
+
this.$onRemoveRange(removed);
|
17293 |
+
return removed[0];
|
17294 |
+
}
|
17295 |
+
};
|
17296 |
+
this.mergeOverlappingRanges = function() {
|
17297 |
+
var removed = this.rangeList.merge();
|
17298 |
+
if (removed.length)
|
17299 |
+
this.$onRemoveRange(removed);
|
17300 |
+
else if (this.ranges[0])
|
17301 |
+
this.fromOrientedRange(this.ranges[0]);
|
17302 |
+
};
|
17303 |
+
|
17304 |
+
this.$onAddRange = function(range) {
|
17305 |
+
this.rangeCount = this.rangeList.ranges.length;
|
17306 |
+
this.ranges.unshift(range);
|
17307 |
+
this._signal("addRange", {
|
17308 |
+
range: range
|
17309 |
+
});
|
17310 |
+
};
|
17311 |
+
|
17312 |
+
this.$onRemoveRange = function(removed) {
|
17313 |
+
this.rangeCount = this.rangeList.ranges.length;
|
17314 |
+
if (this.rangeCount == 1 && this.inMultiSelectMode) {
|
17315 |
+
var lastRange = this.rangeList.ranges.pop();
|
17316 |
+
removed.push(lastRange);
|
17317 |
+
this.rangeCount = 0;
|
17318 |
+
}
|
17319 |
+
|
17320 |
+
for (var i = removed.length; i--;) {
|
17321 |
+
var index = this.ranges.indexOf(removed[i]);
|
17322 |
+
this.ranges.splice(index, 1);
|
17323 |
+
}
|
17324 |
+
|
17325 |
+
this._signal("removeRange", {
|
17326 |
+
ranges: removed
|
17327 |
+
});
|
17328 |
+
|
17329 |
+
if (this.rangeCount === 0 && this.inMultiSelectMode) {
|
17330 |
+
this.inMultiSelectMode = false;
|
17331 |
+
this._signal("singleSelect");
|
17332 |
+
this.session.$undoSelect = true;
|
17333 |
+
this.rangeList.detach(this.session);
|
17334 |
+
}
|
17335 |
+
|
17336 |
+
lastRange = lastRange || this.ranges[0];
|
17337 |
+
if (lastRange && !lastRange.isEqual(this.getRange()))
|
17338 |
+
this.fromOrientedRange(lastRange);
|
17339 |
+
};
|
17340 |
+
this.$initRangeList = function() {
|
17341 |
+
if (this.rangeList)
|
17342 |
+
return;
|
17343 |
+
|
17344 |
+
this.rangeList = new RangeList();
|
17345 |
+
this.ranges = [];
|
17346 |
+
this.rangeCount = 0;
|
17347 |
+
};
|
17348 |
+
this.getAllRanges = function() {
|
17349 |
+
return this.rangeCount ? this.rangeList.ranges.concat() : [this.getRange()];
|
17350 |
+
};
|
17351 |
+
|
17352 |
+
this.splitIntoLines = function() {
|
17353 |
+
if (this.rangeCount > 1) {
|
17354 |
+
var ranges = this.rangeList.ranges;
|
17355 |
+
var lastRange = ranges[ranges.length - 1];
|
17356 |
+
var range = Range.fromPoints(ranges[0].start, lastRange.end);
|
17357 |
+
|
17358 |
+
this.toSingleRange();
|
17359 |
+
this.setSelectionRange(range, lastRange.cursor == lastRange.start);
|
17360 |
+
} else {
|
17361 |
+
var range = this.getRange();
|
17362 |
+
var isBackwards = this.isBackwards();
|
17363 |
+
var startRow = range.start.row;
|
17364 |
+
var endRow = range.end.row;
|
17365 |
+
if (startRow == endRow) {
|
17366 |
+
if (isBackwards)
|
17367 |
+
var start = range.end,
|
17368 |
+
end = range.start;
|
17369 |
+
else
|
17370 |
+
var start = range.start,
|
17371 |
+
end = range.end;
|
17372 |
+
|
17373 |
+
this.addRange(Range.fromPoints(end, end));
|
17374 |
+
this.addRange(Range.fromPoints(start, start));
|
17375 |
+
return;
|
17376 |
+
}
|
17377 |
+
|
17378 |
+
var rectSel = [];
|
17379 |
+
var r = this.getLineRange(startRow, true);
|
17380 |
+
r.start.column = range.start.column;
|
17381 |
+
rectSel.push(r);
|
17382 |
+
|
17383 |
+
for (var i = startRow + 1; i < endRow; i++)
|
17384 |
+
rectSel.push(this.getLineRange(i, true));
|
17385 |
+
|
17386 |
+
r = this.getLineRange(endRow, true);
|
17387 |
+
r.end.column = range.end.column;
|
17388 |
+
rectSel.push(r);
|
17389 |
+
|
17390 |
+
rectSel.forEach(this.addRange, this);
|
17391 |
+
}
|
17392 |
+
};
|
17393 |
+
this.toggleBlockSelection = function() {
|
17394 |
+
if (this.rangeCount > 1) {
|
17395 |
+
var ranges = this.rangeList.ranges;
|
17396 |
+
var lastRange = ranges[ranges.length - 1];
|
17397 |
+
var range = Range.fromPoints(ranges[0].start, lastRange.end);
|
17398 |
+
|
17399 |
+
this.toSingleRange();
|
17400 |
+
this.setSelectionRange(range, lastRange.cursor == lastRange.start);
|
17401 |
+
} else {
|
17402 |
+
var cursor = this.session.documentToScreenPosition(this.selectionLead);
|
17403 |
+
var anchor = this.session.documentToScreenPosition(this.selectionAnchor);
|
17404 |
+
|
17405 |
+
var rectSel = this.rectangularRangeBlock(cursor, anchor);
|
17406 |
+
rectSel.forEach(this.addRange, this);
|
17407 |
+
}
|
17408 |
+
};
|
17409 |
+
this.rectangularRangeBlock = function(screenCursor, screenAnchor, includeEmptyLines) {
|
17410 |
+
var rectSel = [];
|
17411 |
+
|
17412 |
+
var xBackwards = screenCursor.column < screenAnchor.column;
|
17413 |
+
if (xBackwards) {
|
17414 |
+
var startColumn = screenCursor.column;
|
17415 |
+
var endColumn = screenAnchor.column;
|
17416 |
+
} else {
|
17417 |
+
var startColumn = screenAnchor.column;
|
17418 |
+
var endColumn = screenCursor.column;
|
17419 |
+
}
|
17420 |
+
|
17421 |
+
var yBackwards = screenCursor.row < screenAnchor.row;
|
17422 |
+
if (yBackwards) {
|
17423 |
+
var startRow = screenCursor.row;
|
17424 |
+
var endRow = screenAnchor.row;
|
17425 |
+
} else {
|
17426 |
+
var startRow = screenAnchor.row;
|
17427 |
+
var endRow = screenCursor.row;
|
17428 |
+
}
|
17429 |
+
|
17430 |
+
if (startColumn < 0)
|
17431 |
+
startColumn = 0;
|
17432 |
+
if (startRow < 0)
|
17433 |
+
startRow = 0;
|
17434 |
+
|
17435 |
+
if (startRow == endRow)
|
17436 |
+
includeEmptyLines = true;
|
17437 |
+
|
17438 |
+
for (var row = startRow; row <= endRow; row++) {
|
17439 |
+
var range = Range.fromPoints(
|
17440 |
+
this.session.screenToDocumentPosition(row, startColumn),
|
17441 |
+
this.session.screenToDocumentPosition(row, endColumn)
|
17442 |
+
);
|
17443 |
+
if (range.isEmpty()) {
|
17444 |
+
if (docEnd && isSamePoint(range.end, docEnd))
|
17445 |
+
break;
|
17446 |
+
var docEnd = range.end;
|
17447 |
+
}
|
17448 |
+
range.cursor = xBackwards ? range.start : range.end;
|
17449 |
+
rectSel.push(range);
|
17450 |
+
}
|
17451 |
+
|
17452 |
+
if (yBackwards)
|
17453 |
+
rectSel.reverse();
|
17454 |
+
|
17455 |
+
if (!includeEmptyLines) {
|
17456 |
+
var end = rectSel.length - 1;
|
17457 |
+
while (rectSel[end].isEmpty() && end > 0)
|
17458 |
+
end--;
|
17459 |
+
if (end > 0) {
|
17460 |
+
var start = 0;
|
17461 |
+
while (rectSel[start].isEmpty())
|
17462 |
+
start++;
|
17463 |
+
}
|
17464 |
+
for (var i = end; i >= start; i--) {
|
17465 |
+
if (rectSel[i].isEmpty())
|
17466 |
+
rectSel.splice(i, 1);
|
17467 |
+
}
|
17468 |
+
}
|
17469 |
+
|
17470 |
+
return rectSel;
|
17471 |
+
};
|
17472 |
+
}).call(Selection.prototype);
|
17473 |
+
var Editor = require("./editor").Editor;
|
17474 |
+
(function() {
|
17475 |
+
this.updateSelectionMarkers = function() {
|
17476 |
+
this.renderer.updateCursor();
|
17477 |
+
this.renderer.updateBackMarkers();
|
17478 |
+
};
|
17479 |
+
this.addSelectionMarker = function(orientedRange) {
|
17480 |
+
if (!orientedRange.cursor)
|
17481 |
+
orientedRange.cursor = orientedRange.end;
|
17482 |
+
|
17483 |
+
var style = this.getSelectionStyle();
|
17484 |
+
orientedRange.marker = this.session.addMarker(orientedRange, "ace_selection", style);
|
17485 |
+
|
17486 |
+
this.session.$selectionMarkers.push(orientedRange);
|
17487 |
+
this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
|
17488 |
+
return orientedRange;
|
17489 |
+
};
|
17490 |
+
this.removeSelectionMarker = function(range) {
|
17491 |
+
if (!range.marker)
|
17492 |
+
return;
|
17493 |
+
this.session.removeMarker(range.marker);
|
17494 |
+
var index = this.session.$selectionMarkers.indexOf(range);
|
17495 |
+
if (index != -1)
|
17496 |
+
this.session.$selectionMarkers.splice(index, 1);
|
17497 |
+
this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
|
17498 |
+
};
|
17499 |
+
|
17500 |
+
this.removeSelectionMarkers = function(ranges) {
|
17501 |
+
var markerList = this.session.$selectionMarkers;
|
17502 |
+
for (var i = ranges.length; i--;) {
|
17503 |
+
var range = ranges[i];
|
17504 |
+
if (!range.marker)
|
17505 |
+
continue;
|
17506 |
+
this.session.removeMarker(range.marker);
|
17507 |
+
var index = markerList.indexOf(range);
|
17508 |
+
if (index != -1)
|
17509 |
+
markerList.splice(index, 1);
|
17510 |
+
}
|
17511 |
+
this.session.selectionMarkerCount = markerList.length;
|
17512 |
+
};
|
17513 |
+
|
17514 |
+
this.$onAddRange = function(e) {
|
17515 |
+
this.addSelectionMarker(e.range);
|
17516 |
+
this.renderer.updateCursor();
|
17517 |
+
this.renderer.updateBackMarkers();
|
17518 |
+
};
|
17519 |
+
|
17520 |
+
this.$onRemoveRange = function(e) {
|
17521 |
+
this.removeSelectionMarkers(e.ranges);
|
17522 |
+
this.renderer.updateCursor();
|
17523 |
+
this.renderer.updateBackMarkers();
|
17524 |
+
};
|
17525 |
+
|
17526 |
+
this.$onMultiSelect = function(e) {
|
17527 |
+
if (this.inMultiSelectMode)
|
17528 |
+
return;
|
17529 |
+
this.inMultiSelectMode = true;
|
17530 |
+
|
17531 |
+
this.setStyle("ace_multiselect");
|
17532 |
+
this.keyBinding.addKeyboardHandler(commands.keyboardHandler);
|
17533 |
+
this.commands.setDefaultHandler("exec", this.$onMultiSelectExec);
|
17534 |
+
|
17535 |
+
this.renderer.updateCursor();
|
17536 |
+
this.renderer.updateBackMarkers();
|
17537 |
+
};
|
17538 |
+
|
17539 |
+
this.$onSingleSelect = function(e) {
|
17540 |
+
if (this.session.multiSelect.inVirtualMode)
|
17541 |
+
return;
|
17542 |
+
this.inMultiSelectMode = false;
|
17543 |
+
|
17544 |
+
this.unsetStyle("ace_multiselect");
|
17545 |
+
this.keyBinding.removeKeyboardHandler(commands.keyboardHandler);
|
17546 |
+
|
17547 |
+
this.commands.removeDefaultHandler("exec", this.$onMultiSelectExec);
|
17548 |
+
this.renderer.updateCursor();
|
17549 |
+
this.renderer.updateBackMarkers();
|
17550 |
+
this._emit("changeSelection");
|
17551 |
+
};
|
17552 |
+
|
17553 |
+
this.$onMultiSelectExec = function(e) {
|
17554 |
+
var command = e.command;
|
17555 |
+
var editor = e.editor;
|
17556 |
+
if (!editor.multiSelect)
|
17557 |
+
return;
|
17558 |
+
if (!command.multiSelectAction) {
|
17559 |
+
var result = command.exec(editor, e.args || {});
|
17560 |
+
editor.multiSelect.addRange(editor.multiSelect.toOrientedRange());
|
17561 |
+
editor.multiSelect.mergeOverlappingRanges();
|
17562 |
+
} else if (command.multiSelectAction == "forEach") {
|
17563 |
+
result = editor.forEachSelection(command, e.args);
|
17564 |
+
} else if (command.multiSelectAction == "forEachLine") {
|
17565 |
+
result = editor.forEachSelection(command, e.args, true);
|
17566 |
+
} else if (command.multiSelectAction == "single") {
|
17567 |
+
editor.exitMultiSelectMode();
|
17568 |
+
result = command.exec(editor, e.args || {});
|
17569 |
+
} else {
|
17570 |
+
result = command.multiSelectAction(editor, e.args || {});
|
17571 |
+
}
|
17572 |
+
return result;
|
17573 |
+
};
|
17574 |
+
this.forEachSelection = function(cmd, args, options) {
|
17575 |
+
if (this.inVirtualSelectionMode)
|
17576 |
+
return;
|
17577 |
+
var keepOrder = options && options.keepOrder;
|
17578 |
+
var $byLines = options == true || options && options.$byLines
|
17579 |
+
var session = this.session;
|
17580 |
+
var selection = this.selection;
|
17581 |
+
var rangeList = selection.rangeList;
|
17582 |
+
var ranges = (keepOrder ? selection : rangeList).ranges;
|
17583 |
+
var result;
|
17584 |
+
|
17585 |
+
if (!ranges.length)
|
17586 |
+
return cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});
|
17587 |
+
|
17588 |
+
var reg = selection._eventRegistry;
|
17589 |
+
selection._eventRegistry = {};
|
17590 |
+
|
17591 |
+
var tmpSel = new Selection(session);
|
17592 |
+
this.inVirtualSelectionMode = true;
|
17593 |
+
for (var i = ranges.length; i--;) {
|
17594 |
+
if ($byLines) {
|
17595 |
+
while (i > 0 && ranges[i].start.row == ranges[i - 1].end.row)
|
17596 |
+
i--;
|
17597 |
+
}
|
17598 |
+
tmpSel.fromOrientedRange(ranges[i]);
|
17599 |
+
tmpSel.index = i;
|
17600 |
+
this.selection = session.selection = tmpSel;
|
17601 |
+
var cmdResult = cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});
|
17602 |
+
if (!result && cmdResult !== undefined)
|
17603 |
+
result = cmdResult;
|
17604 |
+
tmpSel.toOrientedRange(ranges[i]);
|
17605 |
+
}
|
17606 |
+
tmpSel.detach();
|
17607 |
+
|
17608 |
+
this.selection = session.selection = selection;
|
17609 |
+
this.inVirtualSelectionMode = false;
|
17610 |
+
selection._eventRegistry = reg;
|
17611 |
+
selection.mergeOverlappingRanges();
|
17612 |
+
|
17613 |
+
var anim = this.renderer.$scrollAnimation;
|
17614 |
+
this.onCursorChange();
|
17615 |
+
this.onSelectionChange();
|
17616 |
+
if (anim && anim.from == anim.to)
|
17617 |
+
this.renderer.animateScrolling(anim.from);
|
17618 |
+
|
17619 |
+
return result;
|
17620 |
+
};
|
17621 |
+
this.exitMultiSelectMode = function() {
|
17622 |
+
if (!this.inMultiSelectMode || this.inVirtualSelectionMode)
|
17623 |
+
return;
|
17624 |
+
this.multiSelect.toSingleRange();
|
17625 |
+
};
|
17626 |
+
|
17627 |
+
this.getSelectedText = function() {
|
17628 |
+
var text = "";
|
17629 |
+
if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {
|
17630 |
+
var ranges = this.multiSelect.rangeList.ranges;
|
17631 |
+
var buf = [];
|
17632 |
+
for (var i = 0; i < ranges.length; i++) {
|
17633 |
+
buf.push(this.session.getTextRange(ranges[i]));
|
17634 |
+
}
|
17635 |
+
var nl = this.session.getDocument().getNewLineCharacter();
|
17636 |
+
text = buf.join(nl);
|
17637 |
+
if (text.length == (buf.length - 1) * nl.length)
|
17638 |
+
text = "";
|
17639 |
+
} else if (!this.selection.isEmpty()) {
|
17640 |
+
text = this.session.getTextRange(this.getSelectionRange());
|
17641 |
+
}
|
17642 |
+
return text;
|
17643 |
+
};
|
17644 |
+
|
17645 |
+
this.$checkMultiselectChange = function(e, anchor) {
|
17646 |
+
if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {
|
17647 |
+
var range = this.multiSelect.ranges[0];
|
17648 |
+
if (this.multiSelect.isEmpty() && anchor == this.multiSelect.anchor)
|
17649 |
+
return;
|
17650 |
+
var pos = anchor == this.multiSelect.anchor ? range.cursor == range.start ? range.end : range.start : range.cursor;
|
17651 |
+
if (!isSamePoint(pos, anchor))
|
17652 |
+
this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange());
|
17653 |
+
}
|
17654 |
+
};
|
17655 |
+
this.onPaste = function(text) {
|
17656 |
+
if (this.$readOnly)
|
17657 |
+
return;
|
17658 |
+
|
17659 |
+
|
17660 |
+
var e = {
|
17661 |
+
text: text
|
17662 |
+
};
|
17663 |
+
this._signal("paste", e);
|
17664 |
+
text = e.text;
|
17665 |
+
if (!this.inMultiSelectMode || this.inVirtualSelectionMode)
|
17666 |
+
return this.insert(text);
|
17667 |
+
|
17668 |
+
var lines = text.split(/\r\n|\r|\n/);
|
17669 |
+
var ranges = this.selection.rangeList.ranges;
|
17670 |
+
|
17671 |
+
if (lines.length > ranges.length || lines.length < 2 || !lines[1])
|
17672 |
+
return this.commands.exec("insertstring", this, text);
|
17673 |
+
|
17674 |
+
for (var i = ranges.length; i--;) {
|
17675 |
+
var range = ranges[i];
|
17676 |
+
if (!range.isEmpty())
|
17677 |
+
this.session.remove(range);
|
17678 |
+
|
17679 |
+
this.session.insert(range.start, lines[i]);
|
17680 |
+
}
|
17681 |
+
};
|
17682 |
+
this.findAll = function(needle, options, additive) {
|
17683 |
+
options = options || {};
|
17684 |
+
options.needle = needle || options.needle;
|
17685 |
+
if (options.needle == undefined) {
|
17686 |
+
var range = this.selection.isEmpty() ? this.selection.getWordRange() : this.selection.getRange();
|
17687 |
+
options.needle = this.session.getTextRange(range);
|
17688 |
+
}
|
17689 |
+
this.$search.set(options);
|
17690 |
+
|
17691 |
+
var ranges = this.$search.findAll(this.session);
|
17692 |
+
if (!ranges.length)
|
17693 |
+
return 0;
|
17694 |
+
|
17695 |
+
this.$blockScrolling += 1;
|
17696 |
+
var selection = this.multiSelect;
|
17697 |
+
|
17698 |
+
if (!additive)
|
17699 |
+
selection.toSingleRange(ranges[0]);
|
17700 |
+
|
17701 |
+
for (var i = ranges.length; i--;)
|
17702 |
+
selection.addRange(ranges[i], true);
|
17703 |
+
if (range && selection.rangeList.rangeAtPoint(range.start))
|
17704 |
+
selection.addRange(range, true);
|
17705 |
+
|
17706 |
+
this.$blockScrolling -= 1;
|
17707 |
+
|
17708 |
+
return ranges.length;
|
17709 |
+
};
|
17710 |
+
this.selectMoreLines = function(dir, skip) {
|
17711 |
+
var range = this.selection.toOrientedRange();
|
17712 |
+
var isBackwards = range.cursor == range.end;
|
17713 |
+
|
17714 |
+
var screenLead = this.session.documentToScreenPosition(range.cursor);
|
17715 |
+
if (this.selection.$desiredColumn)
|
17716 |
+
screenLead.column = this.selection.$desiredColumn;
|
17717 |
+
|
17718 |
+
var lead = this.session.screenToDocumentPosition(screenLead.row + dir, screenLead.column);
|
17719 |
+
|
17720 |
+
if (!range.isEmpty()) {
|
17721 |
+
var screenAnchor = this.session.documentToScreenPosition(isBackwards ? range.end : range.start);
|
17722 |
+
var anchor = this.session.screenToDocumentPosition(screenAnchor.row + dir, screenAnchor.column);
|
17723 |
+
} else {
|
17724 |
+
var anchor = lead;
|
17725 |
+
}
|
17726 |
+
|
17727 |
+
if (isBackwards) {
|
17728 |
+
var newRange = Range.fromPoints(lead, anchor);
|
17729 |
+
newRange.cursor = newRange.start;
|
17730 |
+
} else {
|
17731 |
+
var newRange = Range.fromPoints(anchor, lead);
|
17732 |
+
newRange.cursor = newRange.end;
|
17733 |
+
}
|
17734 |
+
|
17735 |
+
newRange.desiredColumn = screenLead.column;
|
17736 |
+
if (!this.selection.inMultiSelectMode) {
|
17737 |
+
this.selection.addRange(range);
|
17738 |
+
} else {
|
17739 |
+
if (skip)
|
17740 |
+
var toRemove = range.cursor;
|
17741 |
+
}
|
17742 |
+
|
17743 |
+
this.selection.addRange(newRange);
|
17744 |
+
if (toRemove)
|
17745 |
+
this.selection.substractPoint(toRemove);
|
17746 |
+
};
|
17747 |
+
this.transposeSelections = function(dir) {
|
17748 |
+
var session = this.session;
|
17749 |
+
var sel = session.multiSelect;
|
17750 |
+
var all = sel.ranges;
|
17751 |
+
|
17752 |
+
for (var i = all.length; i--;) {
|
17753 |
+
var range = all[i];
|
17754 |
+
if (range.isEmpty()) {
|
17755 |
+
var tmp = session.getWordRange(range.start.row, range.start.column);
|
17756 |
+
range.start.row = tmp.start.row;
|
17757 |
+
range.start.column = tmp.start.column;
|
17758 |
+
range.end.row = tmp.end.row;
|
17759 |
+
range.end.column = tmp.end.column;
|
17760 |
+
}
|
17761 |
+
}
|
17762 |
+
sel.mergeOverlappingRanges();
|
17763 |
+
|
17764 |
+
var words = [];
|
17765 |
+
for (var i = all.length; i--;) {
|
17766 |
+
var range = all[i];
|
17767 |
+
words.unshift(session.getTextRange(range));
|
17768 |
+
}
|
17769 |
+
|
17770 |
+
if (dir < 0)
|
17771 |
+
words.unshift(words.pop());
|
17772 |
+
else
|
17773 |
+
words.push(words.shift());
|
17774 |
+
|
17775 |
+
for (var i = all.length; i--;) {
|
17776 |
+
var range = all[i];
|
17777 |
+
var tmp = range.clone();
|
17778 |
+
session.replace(range, words[i]);
|
17779 |
+
range.start.row = tmp.start.row;
|
17780 |
+
range.start.column = tmp.start.column;
|
17781 |
+
}
|
17782 |
+
};
|
17783 |
+
this.selectMore = function(dir, skip, stopAtFirst) {
|
17784 |
+
var session = this.session;
|
17785 |
+
var sel = session.multiSelect;
|
17786 |
+
|
17787 |
+
var range = sel.toOrientedRange();
|
17788 |
+
if (range.isEmpty()) {
|
17789 |
+
range = session.getWordRange(range.start.row, range.start.column);
|
17790 |
+
range.cursor = dir == -1 ? range.start : range.end;
|
17791 |
+
this.multiSelect.addRange(range);
|
17792 |
+
if (stopAtFirst)
|
17793 |
+
return;
|
17794 |
+
}
|
17795 |
+
var needle = session.getTextRange(range);
|
17796 |
+
|
17797 |
+
var newRange = find(session, needle, dir);
|
17798 |
+
if (newRange) {
|
17799 |
+
newRange.cursor = dir == -1 ? newRange.start : newRange.end;
|
17800 |
+
this.$blockScrolling += 1;
|
17801 |
+
this.session.unfold(newRange);
|
17802 |
+
this.multiSelect.addRange(newRange);
|
17803 |
+
this.$blockScrolling -= 1;
|
17804 |
+
this.renderer.scrollCursorIntoView(null, 0.5);
|
17805 |
+
}
|
17806 |
+
if (skip)
|
17807 |
+
this.multiSelect.substractPoint(range.cursor);
|
17808 |
+
};
|
17809 |
+
this.alignCursors = function() {
|
17810 |
+
var session = this.session;
|
17811 |
+
var sel = session.multiSelect;
|
17812 |
+
var ranges = sel.ranges;
|
17813 |
+
var row = -1;
|
17814 |
+
var sameRowRanges = ranges.filter(function(r) {
|
17815 |
+
if (r.cursor.row == row)
|
17816 |
+
return true;
|
17817 |
+
row = r.cursor.row;
|
17818 |
+
});
|
17819 |
+
|
17820 |
+
if (!ranges.length || sameRowRanges.length == ranges.length - 1) {
|
17821 |
+
var range = this.selection.getRange();
|
17822 |
+
var fr = range.start.row,
|
17823 |
+
lr = range.end.row;
|
17824 |
+
var guessRange = fr == lr;
|
17825 |
+
if (guessRange) {
|
17826 |
+
var max = this.session.getLength();
|
17827 |
+
var line;
|
17828 |
+
do {
|
17829 |
+
line = this.session.getLine(lr);
|
17830 |
+
} while (/[=:]/.test(line) && ++lr < max);
|
17831 |
+
do {
|
17832 |
+
line = this.session.getLine(fr);
|
17833 |
+
} while (/[=:]/.test(line) && --fr > 0);
|
17834 |
+
|
17835 |
+
if (fr < 0) fr = 0;
|
17836 |
+
if (lr >= max) lr = max - 1;
|
17837 |
+
}
|
17838 |
+
var lines = this.session.doc.removeLines(fr, lr);
|
17839 |
+
lines = this.$reAlignText(lines, guessRange);
|
17840 |
+
this.session.doc.insert({
|
17841 |
+
row: fr,
|
17842 |
+
column: 0
|
17843 |
+
}, lines.join("\n") + "\n");
|
17844 |
+
if (!guessRange) {
|
17845 |
+
range.start.column = 0;
|
17846 |
+
range.end.column = lines[lines.length - 1].length;
|
17847 |
+
}
|
17848 |
+
this.selection.setRange(range);
|
17849 |
+
} else {
|
17850 |
+
sameRowRanges.forEach(function(r) {
|
17851 |
+
sel.substractPoint(r.cursor);
|
17852 |
+
});
|
17853 |
+
|
17854 |
+
var maxCol = 0;
|
17855 |
+
var minSpace = Infinity;
|
17856 |
+
var spaceOffsets = ranges.map(function(r) {
|
17857 |
+
var p = r.cursor;
|
17858 |
+
var line = session.getLine(p.row);
|
17859 |
+
var spaceOffset = line.substr(p.column).search(/\S/g);
|
17860 |
+
if (spaceOffset == -1)
|
17861 |
+
spaceOffset = 0;
|
17862 |
+
|
17863 |
+
if (p.column > maxCol)
|
17864 |
+
maxCol = p.column;
|
17865 |
+
if (spaceOffset < minSpace)
|
17866 |
+
minSpace = spaceOffset;
|
17867 |
+
return spaceOffset;
|
17868 |
+
});
|
17869 |
+
ranges.forEach(function(r, i) {
|
17870 |
+
var p = r.cursor;
|
17871 |
+
var l = maxCol - p.column;
|
17872 |
+
var d = spaceOffsets[i] - minSpace;
|
17873 |
+
if (l > d)
|
17874 |
+
session.insert(p, lang.stringRepeat(" ", l - d));
|
17875 |
+
else
|
17876 |
+
session.remove(new Range(p.row, p.column, p.row, p.column - l + d));
|
17877 |
+
|
17878 |
+
r.start.column = r.end.column = maxCol;
|
17879 |
+
r.start.row = r.end.row = p.row;
|
17880 |
+
r.cursor = r.end;
|
17881 |
+
});
|
17882 |
+
sel.fromOrientedRange(ranges[0]);
|
17883 |
+
this.renderer.updateCursor();
|
17884 |
+
this.renderer.updateBackMarkers();
|
17885 |
+
}
|
17886 |
+
};
|
17887 |
+
|
17888 |
+
this.$reAlignText = function(lines, forceLeft) {
|
17889 |
+
var isLeftAligned = true,
|
17890 |
+
isRightAligned = true;
|
17891 |
+
var startW, textW, endW;
|
17892 |
+
|
17893 |
+
return lines.map(function(line) {
|
17894 |
+
var m = line.match(/(\s*)(.*?)(\s*)([=:].*)/);
|
17895 |
+
if (!m)
|
17896 |
+
return [line];
|
17897 |
+
|
17898 |
+
if (startW == null) {
|
17899 |
+
startW = m[1].length;
|
17900 |
+
textW = m[2].length;
|
17901 |
+
endW = m[3].length;
|
17902 |
+
return m;
|
17903 |
+
}
|
17904 |
+
|
17905 |
+
if (startW + textW + endW != m[1].length + m[2].length + m[3].length)
|
17906 |
+
isRightAligned = false;
|
17907 |
+
if (startW != m[1].length)
|
17908 |
+
isLeftAligned = false;
|
17909 |
+
|
17910 |
+
if (startW > m[1].length)
|
17911 |
+
startW = m[1].length;
|
17912 |
+
if (textW < m[2].length)
|
17913 |
+
textW = m[2].length;
|
17914 |
+
if (endW > m[3].length)
|
17915 |
+
endW = m[3].length;
|
17916 |
+
|
17917 |
+
return m;
|
17918 |
+
}).map(forceLeft ? alignLeft :
|
17919 |
+
isLeftAligned ? isRightAligned ? alignRight : alignLeft : unAlign);
|
17920 |
+
|
17921 |
+
function spaces(n) {
|
17922 |
+
return lang.stringRepeat(" ", n);
|
17923 |
+
}
|
17924 |
+
|
17925 |
+
function alignLeft(m) {
|
17926 |
+
return !m[2] ? m[0] : spaces(startW) + m[2] + spaces(textW - m[2].length + endW) + m[4].replace(/^([=:])\s+/, "$1 ");
|
17927 |
+
}
|
17928 |
+
|
17929 |
+
function alignRight(m) {
|
17930 |
+
return !m[2] ? m[0] : spaces(startW + textW - m[2].length) + m[2] + spaces(endW, " ") + m[4].replace(/^([=:])\s+/, "$1 ");
|
17931 |
+
}
|
17932 |
+
|
17933 |
+
function unAlign(m) {
|
17934 |
+
return !m[2] ? m[0] : spaces(startW) + m[2] + spaces(endW) + m[4].replace(/^([=:])\s+/, "$1 ");
|
17935 |
+
}
|
17936 |
+
};
|
17937 |
+
}).call(Editor.prototype);
|
17938 |
+
|
17939 |
+
|
17940 |
+
function isSamePoint(p1, p2) {
|
17941 |
+
return p1.row == p2.row && p1.column == p2.column;
|
17942 |
+
}
|
17943 |
+
exports.onSessionChange = function(e) {
|
17944 |
+
var session = e.session;
|
17945 |
+
if (session && !session.multiSelect) {
|
17946 |
+
session.$selectionMarkers = [];
|
17947 |
+
session.selection.$initRangeList();
|
17948 |
+
session.multiSelect = session.selection;
|
17949 |
+
}
|
17950 |
+
this.multiSelect = session && session.multiSelect;
|
17951 |
+
|
17952 |
+
var oldSession = e.oldSession;
|
17953 |
+
if (oldSession) {
|
17954 |
+
oldSession.multiSelect.off("addRange", this.$onAddRange);
|
17955 |
+
oldSession.multiSelect.off("removeRange", this.$onRemoveRange);
|
17956 |
+
oldSession.multiSelect.off("multiSelect", this.$onMultiSelect);
|
17957 |
+
oldSession.multiSelect.off("singleSelect", this.$onSingleSelect);
|
17958 |
+
oldSession.multiSelect.lead.off("change", this.$checkMultiselectChange);
|
17959 |
+
oldSession.multiSelect.anchor.off("change", this.$checkMultiselectChange);
|
17960 |
+
}
|
17961 |
+
|
17962 |
+
if (session) {
|
17963 |
+
session.multiSelect.on("addRange", this.$onAddRange);
|
17964 |
+
session.multiSelect.on("removeRange", this.$onRemoveRange);
|
17965 |
+
session.multiSelect.on("multiSelect", this.$onMultiSelect);
|
17966 |
+
session.multiSelect.on("singleSelect", this.$onSingleSelect);
|
17967 |
+
session.multiSelect.lead.on("change", this.$checkMultiselectChange);
|
17968 |
+
session.multiSelect.anchor.on("change", this.$checkMultiselectChange);
|
17969 |
+
}
|
17970 |
+
|
17971 |
+
if (session && this.inMultiSelectMode != session.selection.inMultiSelectMode) {
|
17972 |
+
if (session.selection.inMultiSelectMode)
|
17973 |
+
this.$onMultiSelect();
|
17974 |
+
else
|
17975 |
+
this.$onSingleSelect();
|
17976 |
+
}
|
17977 |
+
};
|
17978 |
+
|
17979 |
+
function MultiSelect(editor) {
|
17980 |
+
if (editor.$multiselectOnSessionChange)
|
17981 |
+
return;
|
17982 |
+
editor.$onAddRange = editor.$onAddRange.bind(editor);
|
17983 |
+
editor.$onRemoveRange = editor.$onRemoveRange.bind(editor);
|
17984 |
+
editor.$onMultiSelect = editor.$onMultiSelect.bind(editor);
|
17985 |
+
editor.$onSingleSelect = editor.$onSingleSelect.bind(editor);
|
17986 |
+
editor.$multiselectOnSessionChange = exports.onSessionChange.bind(editor);
|
17987 |
+
editor.$checkMultiselectChange = editor.$checkMultiselectChange.bind(editor);
|
17988 |
+
|
17989 |
+
editor.$multiselectOnSessionChange(editor);
|
17990 |
+
editor.on("changeSession", editor.$multiselectOnSessionChange);
|
17991 |
+
|
17992 |
+
editor.on("mousedown", onMouseDown);
|
17993 |
+
editor.commands.addCommands(commands.defaultCommands);
|
17994 |
+
|
17995 |
+
addAltCursorListeners(editor);
|
17996 |
+
}
|
17997 |
+
|
17998 |
+
function addAltCursorListeners(editor) {
|
17999 |
+
var el = editor.textInput.getElement();
|
18000 |
+
var altCursor = false;
|
18001 |
+
event.addListener(el, "keydown", function(e) {
|
18002 |
+
if (e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey)) {
|
18003 |
+
if (!altCursor) {
|
18004 |
+
editor.renderer.setMouseCursor("crosshair");
|
18005 |
+
altCursor = true;
|
18006 |
+
}
|
18007 |
+
} else if (altCursor) {
|
18008 |
+
reset();
|
18009 |
+
}
|
18010 |
+
});
|
18011 |
+
|
18012 |
+
event.addListener(el, "keyup", reset);
|
18013 |
+
event.addListener(el, "blur", reset);
|
18014 |
+
|
18015 |
+
function reset(e) {
|
18016 |
+
if (altCursor) {
|
18017 |
+
editor.renderer.setMouseCursor("");
|
18018 |
+
altCursor = false;
|
18019 |
+
}
|
18020 |
+
}
|
18021 |
+
}
|
18022 |
+
|
18023 |
+
exports.MultiSelect = MultiSelect;
|
18024 |
+
|
18025 |
+
|
18026 |
+
require("./config").defineOptions(Editor.prototype, "editor", {
|
18027 |
+
enableMultiselect: {
|
18028 |
+
set: function(val) {
|
18029 |
+
MultiSelect(this);
|
18030 |
+
if (val) {
|
18031 |
+
this.on("changeSession", this.$multiselectOnSessionChange);
|
18032 |
+
this.on("mousedown", onMouseDown);
|
18033 |
+
} else {
|
18034 |
+
this.off("changeSession", this.$multiselectOnSessionChange);
|
18035 |
+
this.off("mousedown", onMouseDown);
|
18036 |
+
}
|
18037 |
+
},
|
18038 |
+
value: true
|
18039 |
+
}
|
18040 |
+
});
|
18041 |
+
|
18042 |
+
|
18043 |
+
|
18044 |
+
});
|
18045 |
+
|
18046 |
+
ace.define("ace/mode/folding/fold_mode", ["require", "exports", "module", "ace/range"], function(require, exports, module) {
|
18047 |
+
"use strict";
|
18048 |
+
|
18049 |
+
var Range = require("../../range").Range;
|
18050 |
+
|
18051 |
+
var FoldMode = exports.FoldMode = function() {};
|
18052 |
+
|
18053 |
+
(function() {
|
18054 |
+
|
18055 |
+
this.foldingStartMarker = null;
|
18056 |
+
this.foldingStopMarker = null;
|
18057 |
+
this.getFoldWidget = function(session, foldStyle, row) {
|
18058 |
+
var line = session.getLine(row);
|
18059 |
+
if (this.foldingStartMarker.test(line))
|
18060 |
+
return "start";
|
18061 |
+
if (foldStyle == "markbeginend" && this.foldingStopMarker && this.foldingStopMarker.test(line))
|
18062 |
+
return "end";
|
18063 |
+
return "";
|
18064 |
+
};
|
18065 |
+
|
18066 |
+
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
18067 |
+
return null;
|
18068 |
+
};
|
18069 |
+
|
18070 |
+
this.indentationBlock = function(session, row, column) {
|
18071 |
+
var re = /\S/;
|
18072 |
+
var line = session.getLine(row);
|
18073 |
+
var startLevel = line.search(re);
|
18074 |
+
if (startLevel == -1)
|
18075 |
+
return;
|
18076 |
+
|
18077 |
+
var startColumn = column || line.length;
|
18078 |
+
var maxRow = session.getLength();
|
18079 |
+
var startRow = row;
|
18080 |
+
var endRow = row;
|
18081 |
+
|
18082 |
+
while (++row < maxRow) {
|
18083 |
+
var level = session.getLine(row).search(re);
|
18084 |
+
|
18085 |
+
if (level == -1)
|
18086 |
+
continue;
|
18087 |
+
|
18088 |
+
if (level <= startLevel)
|
18089 |
+
break;
|
18090 |
+
|
18091 |
+
endRow = row;
|
18092 |
+
}
|
18093 |
+
|
18094 |
+
if (endRow > startRow) {
|
18095 |
+
var endColumn = session.getLine(endRow).length;
|
18096 |
+
return new Range(startRow, startColumn, endRow, endColumn);
|
18097 |
+
}
|
18098 |
+
};
|
18099 |
+
|
18100 |
+
this.openingBracketBlock = function(session, bracket, row, column, typeRe) {
|
18101 |
+
var start = {
|
18102 |
+
row: row,
|
18103 |
+
column: column + 1
|
18104 |
+
};
|
18105 |
+
var end = session.$findClosingBracket(bracket, start, typeRe);
|
18106 |
+
if (!end)
|
18107 |
+
return;
|
18108 |
+
|
18109 |
+
var fw = session.foldWidgets[end.row];
|
18110 |
+
if (fw == null)
|
18111 |
+
fw = session.getFoldWidget(end.row);
|
18112 |
+
|
18113 |
+
if (fw == "start" && end.row > start.row) {
|
18114 |
+
end.row--;
|
18115 |
+
end.column = session.getLine(end.row).length;
|
18116 |
+
}
|
18117 |
+
return Range.fromPoints(start, end);
|
18118 |
+
};
|
18119 |
+
|
18120 |
+
this.closingBracketBlock = function(session, bracket, row, column, typeRe) {
|
18121 |
+
var end = {
|
18122 |
+
row: row,
|
18123 |
+
column: column
|
18124 |
+
};
|
18125 |
+
var start = session.$findOpeningBracket(bracket, end);
|
18126 |
+
|
18127 |
+
if (!start)
|
18128 |
+
return;
|
18129 |
+
|
18130 |
+
start.column++;
|
18131 |
+
end.column--;
|
18132 |
+
|
18133 |
+
return Range.fromPoints(start, end);
|
18134 |
+
};
|
18135 |
+
}).call(FoldMode.prototype);
|
18136 |
+
|
18137 |
+
});
|
18138 |
+
|
18139 |
+
ace.define("ace/theme/textmate", ["require", "exports", "module", "ace/lib/dom"], function(require, exports, module) {
|
18140 |
+
"use strict";
|
18141 |
+
|
18142 |
+
exports.isDark = false;
|
18143 |
+
exports.cssClass = "ace-tm";
|
18144 |
+
exports.cssText = ".ace-tm .ace_gutter {\
|
18145 |
+
background: #f0f0f0;\
|
18146 |
+
color: #333;\
|
18147 |
+
}\
|
18148 |
+
.ace-tm .ace_print-margin {\
|
18149 |
+
width: 1px;\
|
18150 |
+
background: #e8e8e8;\
|
18151 |
+
}\
|
18152 |
+
.ace-tm .ace_fold {\
|
18153 |
+
background-color: #6B72E6;\
|
18154 |
+
}\
|
18155 |
+
.ace-tm {\
|
18156 |
+
background-color: #FFFFFF;\
|
18157 |
+
color: black;\
|
18158 |
+
}\
|
18159 |
+
.ace-tm .ace_cursor {\
|
18160 |
+
color: black;\
|
18161 |
+
}\
|
18162 |
+
.ace-tm .ace_invisible {\
|
18163 |
+
color: rgb(191, 191, 191);\
|
18164 |
+
}\
|
18165 |
+
.ace-tm .ace_storage,\
|
18166 |
+
.ace-tm .ace_keyword {\
|
18167 |
+
color: blue;\
|
18168 |
+
}\
|
18169 |
+
.ace-tm .ace_constant {\
|
18170 |
+
color: rgb(197, 6, 11);\
|
18171 |
+
}\
|
18172 |
+
.ace-tm .ace_constant.ace_buildin {\
|
18173 |
+
color: rgb(88, 72, 246);\
|
18174 |
+
}\
|
18175 |
+
.ace-tm .ace_constant.ace_language {\
|
18176 |
+
color: rgb(88, 92, 246);\
|
18177 |
+
}\
|
18178 |
+
.ace-tm .ace_constant.ace_library {\
|
18179 |
+
color: rgb(6, 150, 14);\
|
18180 |
+
}\
|
18181 |
+
.ace-tm .ace_invalid {\
|
18182 |
+
background-color: rgba(255, 0, 0, 0.1);\
|
18183 |
+
color: red;\
|
18184 |
+
}\
|
18185 |
+
.ace-tm .ace_support.ace_function {\
|
18186 |
+
color: rgb(60, 76, 114);\
|
18187 |
+
}\
|
18188 |
+
.ace-tm .ace_support.ace_constant {\
|
18189 |
+
color: rgb(6, 150, 14);\
|
18190 |
+
}\
|
18191 |
+
.ace-tm .ace_support.ace_type,\
|
18192 |
+
.ace-tm .ace_support.ace_class {\
|
18193 |
+
color: rgb(109, 121, 222);\
|
18194 |
+
}\
|
18195 |
+
.ace-tm .ace_keyword.ace_operator {\
|
18196 |
+
color: rgb(104, 118, 135);\
|
18197 |
+
}\
|
18198 |
+
.ace-tm .ace_string {\
|
18199 |
+
color: rgb(3, 106, 7);\
|
18200 |
+
}\
|
18201 |
+
.ace-tm .ace_comment {\
|
18202 |
+
color: rgb(76, 136, 107);\
|
18203 |
+
}\
|
18204 |
+
.ace-tm .ace_comment.ace_doc {\
|
18205 |
+
color: rgb(0, 102, 255);\
|
18206 |
+
}\
|
18207 |
+
.ace-tm .ace_comment.ace_doc.ace_tag {\
|
18208 |
+
color: rgb(128, 159, 191);\
|
18209 |
+
}\
|
18210 |
+
.ace-tm .ace_constant.ace_numeric {\
|
18211 |
+
color: rgb(0, 0, 205);\
|
18212 |
+
}\
|
18213 |
+
.ace-tm .ace_variable {\
|
18214 |
+
color: rgb(49, 132, 149);\
|
18215 |
+
}\
|
18216 |
+
.ace-tm .ace_xml-pe {\
|
18217 |
+
color: rgb(104, 104, 91);\
|
18218 |
+
}\
|
18219 |
+
.ace-tm .ace_entity.ace_name.ace_function {\
|
18220 |
+
color: #0000A2;\
|
18221 |
+
}\
|
18222 |
+
.ace-tm .ace_heading {\
|
18223 |
+
color: rgb(12, 7, 255);\
|
18224 |
+
}\
|
18225 |
+
.ace-tm .ace_list {\
|
18226 |
+
color:rgb(185, 6, 144);\
|
18227 |
+
}\
|
18228 |
+
.ace-tm .ace_meta.ace_tag {\
|
18229 |
+
color:rgb(0, 22, 142);\
|
18230 |
+
}\
|
18231 |
+
.ace-tm .ace_string.ace_regex {\
|
18232 |
+
color: rgb(255, 0, 0)\
|
18233 |
+
}\
|
18234 |
+
.ace-tm .ace_marker-layer .ace_selection {\
|
18235 |
+
background: rgb(181, 213, 255);\
|
18236 |
+
}\
|
18237 |
+
.ace-tm.ace_multiselect .ace_selection.ace_start {\
|
18238 |
+
box-shadow: 0 0 3px 0px white;\
|
18239 |
+
border-radius: 2px;\
|
18240 |
+
}\
|
18241 |
+
.ace-tm .ace_marker-layer .ace_step {\
|
18242 |
+
background: rgb(252, 255, 0);\
|
18243 |
+
}\
|
18244 |
+
.ace-tm .ace_marker-layer .ace_stack {\
|
18245 |
+
background: rgb(164, 229, 101);\
|
18246 |
+
}\
|
18247 |
+
.ace-tm .ace_marker-layer .ace_bracket {\
|
18248 |
+
margin: -1px 0 0 -1px;\
|
18249 |
+
border: 1px solid rgb(192, 192, 192);\
|
18250 |
+
}\
|
18251 |
+
.ace-tm .ace_marker-layer .ace_active-line {\
|
18252 |
+
background: rgba(0, 0, 0, 0.07);\
|
18253 |
+
}\
|
18254 |
+
.ace-tm .ace_gutter-active-line {\
|
18255 |
+
background-color : #dcdcdc;\
|
18256 |
+
}\
|
18257 |
+
.ace-tm .ace_marker-layer .ace_selected-word {\
|
18258 |
+
background: rgb(250, 250, 255);\
|
18259 |
+
border: 1px solid rgb(200, 200, 250);\
|
18260 |
+
}\
|
18261 |
+
.ace-tm .ace_indent-guide {\
|
18262 |
+
background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\
|
18263 |
+
}\
|
18264 |
+
";
|
18265 |
+
|
18266 |
+
var dom = require("../lib/dom");
|
18267 |
+
dom.importCssString(exports.cssText, exports.cssClass);
|
18268 |
+
});
|
18269 |
+
|
18270 |
+
ace.define("ace/line_widgets", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/range"], function(require, exports, module) {
|
18271 |
+
"use strict";
|
18272 |
+
|
18273 |
+
var oop = require("./lib/oop");
|
18274 |
+
var dom = require("./lib/dom");
|
18275 |
+
var Range = require("./range").Range;
|
18276 |
+
|
18277 |
+
|
18278 |
+
function LineWidgets(session) {
|
18279 |
+
this.session = session;
|
18280 |
+
this.session.widgetManager = this;
|
18281 |
+
this.session.getRowLength = this.getRowLength;
|
18282 |
+
this.session.$getWidgetScreenLength = this.$getWidgetScreenLength;
|
18283 |
+
this.updateOnChange = this.updateOnChange.bind(this);
|
18284 |
+
this.renderWidgets = this.renderWidgets.bind(this);
|
18285 |
+
this.measureWidgets = this.measureWidgets.bind(this);
|
18286 |
+
this.session._changedWidgets = [];
|
18287 |
+
this.$onChangeEditor = this.$onChangeEditor.bind(this);
|
18288 |
+
|
18289 |
+
this.session.on("change", this.updateOnChange);
|
18290 |
+
this.session.on("changeEditor", this.$onChangeEditor);
|
18291 |
+
}
|
18292 |
+
|
18293 |
+
(function() {
|
18294 |
+
this.getRowLength = function(row) {
|
18295 |
+
var h;
|
18296 |
+
if (this.lineWidgets)
|
18297 |
+
h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
|
18298 |
+
else
|
18299 |
+
h = 0;
|
18300 |
+
if (!this.$useWrapMode || !this.$wrapData[row]) {
|
18301 |
+
return 1 + h;
|
18302 |
+
} else {
|
18303 |
+
return this.$wrapData[row].length + 1 + h;
|
18304 |
+
}
|
18305 |
+
};
|
18306 |
+
|
18307 |
+
this.$getWidgetScreenLength = function() {
|
18308 |
+
var screenRows = 0;
|
18309 |
+
this.lineWidgets.forEach(function(w) {
|
18310 |
+
if (w && w.rowCount)
|
18311 |
+
screenRows += w.rowCount;
|
18312 |
+
});
|
18313 |
+
return screenRows;
|
18314 |
+
};
|
18315 |
+
|
18316 |
+
this.$onChangeEditor = function(e) {
|
18317 |
+
this.attach(e.editor);
|
18318 |
+
};
|
18319 |
+
|
18320 |
+
this.attach = function(editor) {
|
18321 |
+
if (editor && editor.widgetManager && editor.widgetManager != this)
|
18322 |
+
editor.widgetManager.detach();
|
18323 |
+
|
18324 |
+
if (this.editor == editor)
|
18325 |
+
return;
|
18326 |
+
|
18327 |
+
this.detach();
|
18328 |
+
this.editor = editor;
|
18329 |
+
|
18330 |
+
if (editor) {
|
18331 |
+
editor.widgetManager = this;
|
18332 |
+
editor.renderer.on("beforeRender", this.measureWidgets);
|
18333 |
+
editor.renderer.on("afterRender", this.renderWidgets);
|
18334 |
+
}
|
18335 |
+
};
|
18336 |
+
this.detach = function(e) {
|
18337 |
+
var editor = this.editor;
|
18338 |
+
if (!editor)
|
18339 |
+
return;
|
18340 |
+
|
18341 |
+
this.editor = null;
|
18342 |
+
editor.widgetManager = null;
|
18343 |
+
|
18344 |
+
editor.renderer.off("beforeRender", this.measureWidgets);
|
18345 |
+
editor.renderer.off("afterRender", this.renderWidgets);
|
18346 |
+
var lineWidgets = this.session.lineWidgets;
|
18347 |
+
lineWidgets && lineWidgets.forEach(function(w) {
|
18348 |
+
if (w && w.el && w.el.parentNode) {
|
18349 |
+
w._inDocument = false;
|
18350 |
+
w.el.parentNode.removeChild(w.el);
|
18351 |
+
}
|
18352 |
+
});
|
18353 |
+
};
|
18354 |
+
|
18355 |
+
this.updateOnChange = function(e) {
|
18356 |
+
var lineWidgets = this.session.lineWidgets;
|
18357 |
+
if (!lineWidgets) return;
|
18358 |
+
|
18359 |
+
var delta = e.data;
|
18360 |
+
var range = delta.range;
|
18361 |
+
var startRow = range.start.row;
|
18362 |
+
var len = range.end.row - startRow;
|
18363 |
+
|
18364 |
+
if (len === 0) {} else if (delta.action == "removeText" || delta.action == "removeLines") {
|
18365 |
+
var removed = lineWidgets.splice(startRow + 1, len);
|
18366 |
+
removed.forEach(function(w) {
|
18367 |
+
w && this.removeLineWidget(w);
|
18368 |
+
}, this);
|
18369 |
+
this.$updateRows();
|
18370 |
+
} else {
|
18371 |
+
var args = new Array(len);
|
18372 |
+
args.unshift(startRow, 0);
|
18373 |
+
lineWidgets.splice.apply(lineWidgets, args);
|
18374 |
+
this.$updateRows();
|
18375 |
+
}
|
18376 |
+
};
|
18377 |
+
|
18378 |
+
this.$updateRows = function() {
|
18379 |
+
var lineWidgets = this.session.lineWidgets;
|
18380 |
+
if (!lineWidgets) return;
|
18381 |
+
var noWidgets = true;
|
18382 |
+
lineWidgets.forEach(function(w, i) {
|
18383 |
+
if (w) {
|
18384 |
+
noWidgets = false;
|
18385 |
+
w.row = i;
|
18386 |
+
}
|
18387 |
+
});
|
18388 |
+
if (noWidgets)
|
18389 |
+
this.session.lineWidgets = null;
|
18390 |
+
};
|
18391 |
+
|
18392 |
+
this.addLineWidget = function(w) {
|
18393 |
+
if (!this.session.lineWidgets)
|
18394 |
+
this.session.lineWidgets = new Array(this.session.getLength());
|
18395 |
+
|
18396 |
+
this.session.lineWidgets[w.row] = w;
|
18397 |
+
|
18398 |
+
var renderer = this.editor.renderer;
|
18399 |
+
if (w.html && !w.el) {
|
18400 |
+
w.el = dom.createElement("div");
|
18401 |
+
w.el.innerHTML = w.html;
|
18402 |
+
}
|
18403 |
+
if (w.el) {
|
18404 |
+
dom.addCssClass(w.el, "ace_lineWidgetContainer");
|
18405 |
+
w.el.style.position = "absolute";
|
18406 |
+
w.el.style.zIndex = 5;
|
18407 |
+
renderer.container.appendChild(w.el);
|
18408 |
+
w._inDocument = true;
|
18409 |
+
}
|
18410 |
+
|
18411 |
+
if (!w.coverGutter) {
|
18412 |
+
w.el.style.zIndex = 3;
|
18413 |
+
}
|
18414 |
+
if (!w.pixelHeight) {
|
18415 |
+
w.pixelHeight = w.el.offsetHeight;
|
18416 |
+
}
|
18417 |
+
if (w.rowCount == null)
|
18418 |
+
w.rowCount = w.pixelHeight / renderer.layerConfig.lineHeight;
|
18419 |
+
|
18420 |
+
this.session._emit("changeFold", {
|
18421 |
+
data: {
|
18422 |
+
start: {
|
18423 |
+
row: w.row
|
18424 |
+
}
|
18425 |
+
}
|
18426 |
+
});
|
18427 |
+
|
18428 |
+
this.$updateRows();
|
18429 |
+
this.renderWidgets(null, renderer);
|
18430 |
+
return w;
|
18431 |
+
};
|
18432 |
+
|
18433 |
+
this.removeLineWidget = function(w) {
|
18434 |
+
w._inDocument = false;
|
18435 |
+
if (w.el && w.el.parentNode)
|
18436 |
+
w.el.parentNode.removeChild(w.el);
|
18437 |
+
if (w.editor && w.editor.destroy) try {
|
18438 |
+
w.editor.destroy();
|
18439 |
+
} catch (e) {}
|
18440 |
+
if (this.session.lineWidgets)
|
18441 |
+
this.session.lineWidgets[w.row] = undefined;
|
18442 |
+
this.session._emit("changeFold", {
|
18443 |
+
data: {
|
18444 |
+
start: {
|
18445 |
+
row: w.row
|
18446 |
+
}
|
18447 |
+
}
|
18448 |
+
});
|
18449 |
+
this.$updateRows();
|
18450 |
+
};
|
18451 |
+
|
18452 |
+
this.onWidgetChanged = function(w) {
|
18453 |
+
this.session._changedWidgets.push(w);
|
18454 |
+
this.editor && this.editor.renderer.updateFull();
|
18455 |
+
};
|
18456 |
+
|
18457 |
+
this.measureWidgets = function(e, renderer) {
|
18458 |
+
var changedWidgets = this.session._changedWidgets;
|
18459 |
+
var config = renderer.layerConfig;
|
18460 |
+
|
18461 |
+
if (!changedWidgets || !changedWidgets.length) return;
|
18462 |
+
var min = Infinity;
|
18463 |
+
for (var i = 0; i < changedWidgets.length; i++) {
|
18464 |
+
var w = changedWidgets[i];
|
18465 |
+
if (!w._inDocument) {
|
18466 |
+
w._inDocument = true;
|
18467 |
+
renderer.container.appendChild(w.el);
|
18468 |
+
}
|
18469 |
+
|
18470 |
+
w.h = w.el.offsetHeight;
|
18471 |
+
|
18472 |
+
if (!w.fixedWidth) {
|
18473 |
+
w.w = w.el.offsetWidth;
|
18474 |
+
w.screenWidth = Math.ceil(w.w / config.characterWidth);
|
18475 |
+
}
|
18476 |
+
|
18477 |
+
var rowCount = w.h / config.lineHeight;
|
18478 |
+
if (w.coverLine) {
|
18479 |
+
rowCount -= this.session.getRowLineCount(w.row);
|
18480 |
+
if (rowCount < 0)
|
18481 |
+
rowCount = 0;
|
18482 |
+
}
|
18483 |
+
if (w.rowCount != rowCount) {
|
18484 |
+
w.rowCount = rowCount;
|
18485 |
+
if (w.row < min)
|
18486 |
+
min = w.row;
|
18487 |
+
}
|
18488 |
+
}
|
18489 |
+
if (min != Infinity) {
|
18490 |
+
this.session._emit("changeFold", {
|
18491 |
+
data: {
|
18492 |
+
start: {
|
18493 |
+
row: min
|
18494 |
+
}
|
18495 |
+
}
|
18496 |
+
});
|
18497 |
+
this.session.lineWidgetWidth = null;
|
18498 |
+
}
|
18499 |
+
this.session._changedWidgets = [];
|
18500 |
+
};
|
18501 |
+
|
18502 |
+
this.renderWidgets = function(e, renderer) {
|
18503 |
+
var config = renderer.layerConfig;
|
18504 |
+
var lineWidgets = this.session.lineWidgets;
|
18505 |
+
if (!lineWidgets)
|
18506 |
+
return;
|
18507 |
+
var first = Math.min(this.firstRow, config.firstRow);
|
18508 |
+
var last = Math.max(this.lastRow, config.lastRow, lineWidgets.length);
|
18509 |
+
|
18510 |
+
while (first > 0 && !lineWidgets[first])
|
18511 |
+
first--;
|
18512 |
+
|
18513 |
+
this.firstRow = config.firstRow;
|
18514 |
+
this.lastRow = config.lastRow;
|
18515 |
+
|
18516 |
+
renderer.$cursorLayer.config = config;
|
18517 |
+
for (var i = first; i <= last; i++) {
|
18518 |
+
var w = lineWidgets[i];
|
18519 |
+
if (!w || !w.el) continue;
|
18520 |
+
|
18521 |
+
if (!w._inDocument) {
|
18522 |
+
w._inDocument = true;
|
18523 |
+
renderer.container.appendChild(w.el);
|
18524 |
+
}
|
18525 |
+
var top = renderer.$cursorLayer.getPixelPosition({
|
18526 |
+
row: i,
|
18527 |
+
column: 0
|
18528 |
+
}, true).top;
|
18529 |
+
if (!w.coverLine)
|
18530 |
+
top += config.lineHeight * this.session.getRowLineCount(w.row);
|
18531 |
+
w.el.style.top = top - config.offset + "px";
|
18532 |
+
|
18533 |
+
var left = w.coverGutter ? 0 : renderer.gutterWidth;
|
18534 |
+
if (!w.fixedWidth)
|
18535 |
+
left -= renderer.scrollLeft;
|
18536 |
+
w.el.style.left = left + "px";
|
18537 |
+
|
18538 |
+
if (w.fixedWidth) {
|
18539 |
+
w.el.style.right = renderer.scrollBar.getWidth() + "px";
|
18540 |
+
} else {
|
18541 |
+
w.el.style.right = "";
|
18542 |
+
}
|
18543 |
+
}
|
18544 |
+
};
|
18545 |
+
|
18546 |
+
}).call(LineWidgets.prototype);
|
18547 |
+
|
18548 |
+
|
18549 |
+
exports.LineWidgets = LineWidgets;
|
18550 |
+
|
18551 |
+
});
|
18552 |
+
|
18553 |
+
ace.define("ace/ext/error_marker", ["require", "exports", "module", "ace/line_widgets", "ace/lib/dom", "ace/range"], function(require, exports, module) {
|
18554 |
+
"use strict";
|
18555 |
+
var LineWidgets = require("../line_widgets").LineWidgets;
|
18556 |
+
var dom = require("../lib/dom");
|
18557 |
+
var Range = require("../range").Range;
|
18558 |
+
|
18559 |
+
function binarySearch(array, needle, comparator) {
|
18560 |
+
var first = 0;
|
18561 |
+
var last = array.length - 1;
|
18562 |
+
|
18563 |
+
while (first <= last) {
|
18564 |
+
var mid = (first + last) >> 1;
|
18565 |
+
var c = comparator(needle, array[mid]);
|
18566 |
+
if (c > 0)
|
18567 |
+
first = mid + 1;
|
18568 |
+
else if (c < 0)
|
18569 |
+
last = mid - 1;
|
18570 |
+
else
|
18571 |
+
return mid;
|
18572 |
+
}
|
18573 |
+
return -(first + 1);
|
18574 |
+
}
|
18575 |
+
|
18576 |
+
function findAnnotations(session, row, dir) {
|
18577 |
+
var annotations = session.getAnnotations().sort(Range.comparePoints);
|
18578 |
+
if (!annotations.length)
|
18579 |
+
return;
|
18580 |
+
|
18581 |
+
var i = binarySearch(annotations, {
|
18582 |
+
row: row,
|
18583 |
+
column: -1
|
18584 |
+
}, Range.comparePoints);
|
18585 |
+
if (i < 0)
|
18586 |
+
i = -i - 1;
|
18587 |
+
|
18588 |
+
if (i >= annotations.length - 1)
|
18589 |
+
i = dir > 0 ? 0 : annotations.length - 1;
|
18590 |
+
else if (i === 0 && dir < 0)
|
18591 |
+
i = annotations.length - 1;
|
18592 |
+
|
18593 |
+
var annotation = annotations[i];
|
18594 |
+
if (!annotation || !dir)
|
18595 |
+
return;
|
18596 |
+
|
18597 |
+
if (annotation.row === row) {
|
18598 |
+
do {
|
18599 |
+
annotation = annotations[i += dir];
|
18600 |
+
} while (annotation && annotation.row === row);
|
18601 |
+
if (!annotation)
|
18602 |
+
return annotations.slice();
|
18603 |
+
}
|
18604 |
+
|
18605 |
+
|
18606 |
+
var matched = [];
|
18607 |
+
row = annotation.row;
|
18608 |
+
do {
|
18609 |
+
matched[dir < 0 ? "unshift" : "push"](annotation);
|
18610 |
+
annotation = annotations[i += dir];
|
18611 |
+
} while (annotation && annotation.row == row);
|
18612 |
+
return matched.length && matched;
|
18613 |
+
}
|
18614 |
+
|
18615 |
+
exports.showErrorMarker = function(editor, dir) {
|
18616 |
+
var session = editor.session;
|
18617 |
+
if (!session.widgetManager) {
|
18618 |
+
session.widgetManager = new LineWidgets(session);
|
18619 |
+
session.widgetManager.attach(editor);
|
18620 |
+
}
|
18621 |
+
|
18622 |
+
var pos = editor.getCursorPosition();
|
18623 |
+
var row = pos.row;
|
18624 |
+
var oldWidget = session.lineWidgets && session.lineWidgets[row];
|
18625 |
+
if (oldWidget) {
|
18626 |
+
oldWidget.destroy();
|
18627 |
+
} else {
|
18628 |
+
row -= dir;
|
18629 |
+
}
|
18630 |
+
var annotations = findAnnotations(session, row, dir);
|
18631 |
+
var gutterAnno;
|
18632 |
+
if (annotations) {
|
18633 |
+
var annotation = annotations[0];
|
18634 |
+
pos.column = (annotation.pos && typeof annotation.column != "number" ? annotation.pos.sc : annotation.column) || 0;
|
18635 |
+
pos.row = annotation.row;
|
18636 |
+
gutterAnno = editor.renderer.$gutterLayer.$annotations[pos.row];
|
18637 |
+
} else if (oldWidget) {
|
18638 |
+
return;
|
18639 |
+
} else {
|
18640 |
+
gutterAnno = {
|
18641 |
+
text: ["Looks good!"],
|
18642 |
+
className: "ace_ok"
|
18643 |
+
};
|
18644 |
+
}
|
18645 |
+
editor.session.unfold(pos.row);
|
18646 |
+
editor.selection.moveToPosition(pos);
|
18647 |
+
|
18648 |
+
var w = {
|
18649 |
+
row: pos.row,
|
18650 |
+
fixedWidth: true,
|
18651 |
+
coverGutter: true,
|
18652 |
+
el: dom.createElement("div")
|
18653 |
+
};
|
18654 |
+
var el = w.el.appendChild(dom.createElement("div"));
|
18655 |
+
var arrow = w.el.appendChild(dom.createElement("div"));
|
18656 |
+
arrow.className = "error_widget_arrow " + gutterAnno.className;
|
18657 |
+
|
18658 |
+
var left = editor.renderer.$cursorLayer
|
18659 |
+
.getPixelPosition(pos).left;
|
18660 |
+
arrow.style.left = left + editor.renderer.gutterWidth - 5 + "px";
|
18661 |
+
|
18662 |
+
w.el.className = "error_widget_wrapper";
|
18663 |
+
el.className = "error_widget " + gutterAnno.className;
|
18664 |
+
el.innerHTML = gutterAnno.text.join("<br>");
|
18665 |
+
|
18666 |
+
el.appendChild(dom.createElement("div"));
|
18667 |
+
|
18668 |
+
var kb = function(_, hashId, keyString) {
|
18669 |
+
if (hashId === 0 && (keyString === "esc" || keyString === "return")) {
|
18670 |
+
w.destroy();
|
18671 |
+
return {
|
18672 |
+
command: "null"
|
18673 |
+
};
|
18674 |
+
}
|
18675 |
+
};
|
18676 |
+
|
18677 |
+
w.destroy = function() {
|
18678 |
+
if (editor.$mouseHandler.isMousePressed)
|
18679 |
+
return;
|
18680 |
+
editor.keyBinding.removeKeyboardHandler(kb);
|
18681 |
+
session.widgetManager.removeLineWidget(w);
|
18682 |
+
editor.off("changeSelection", w.destroy);
|
18683 |
+
editor.off("changeSession", w.destroy);
|
18684 |
+
editor.off("mouseup", w.destroy);
|
18685 |
+
editor.off("change", w.destroy);
|
18686 |
+
};
|
18687 |
+
|
18688 |
+
editor.keyBinding.addKeyboardHandler(kb);
|
18689 |
+
editor.on("changeSelection", w.destroy);
|
18690 |
+
editor.on("changeSession", w.destroy);
|
18691 |
+
editor.on("mouseup", w.destroy);
|
18692 |
+
editor.on("change", w.destroy);
|
18693 |
+
|
18694 |
+
editor.session.widgetManager.addLineWidget(w);
|
18695 |
+
|
18696 |
+
w.el.onmousedown = editor.focus.bind(editor);
|
18697 |
+
|
18698 |
+
editor.renderer.scrollCursorIntoView(null, 0.5, {
|
18699 |
+
bottom: w.el.offsetHeight
|
18700 |
+
});
|
18701 |
+
};
|
18702 |
+
|
18703 |
+
|
18704 |
+
dom.importCssString("\
|
18705 |
+
.error_widget_wrapper {\
|
18706 |
+
background: inherit;\
|
18707 |
+
color: inherit;\
|
18708 |
+
border:none\
|
18709 |
+
}\
|
18710 |
+
.error_widget {\
|
18711 |
+
border-top: solid 2px;\
|
18712 |
+
border-bottom: solid 2px;\
|
18713 |
+
margin: 5px 0;\
|
18714 |
+
padding: 10px 40px;\
|
18715 |
+
white-space: pre-wrap;\
|
18716 |
+
}\
|
18717 |
+
.error_widget.ace_error, .error_widget_arrow.ace_error{\
|
18718 |
+
border-color: #ff5a5a\
|
18719 |
+
}\
|
18720 |
+
.error_widget.ace_warning, .error_widget_arrow.ace_warning{\
|
18721 |
+
border-color: #F1D817\
|
18722 |
+
}\
|
18723 |
+
.error_widget.ace_info, .error_widget_arrow.ace_info{\
|
18724 |
+
border-color: #5a5a5a\
|
18725 |
+
}\
|
18726 |
+
.error_widget.ace_ok, .error_widget_arrow.ace_ok{\
|
18727 |
+
border-color: #5aaa5a\
|
18728 |
+
}\
|
18729 |
+
.error_widget_arrow {\
|
18730 |
+
position: absolute;\
|
18731 |
+
border: solid 5px;\
|
18732 |
+
border-top-color: transparent!important;\
|
18733 |
+
border-right-color: transparent!important;\
|
18734 |
+
border-left-color: transparent!important;\
|
18735 |
+
top: -5px;\
|
18736 |
+
}\
|
18737 |
+
", "");
|
18738 |
+
|
18739 |
+
});
|
18740 |
+
|
18741 |
+
ace.define("ace/ace", ["require", "exports", "module", "ace/lib/fixoldbrowsers", "ace/lib/dom", "ace/lib/event", "ace/editor", "ace/edit_session", "ace/undomanager", "ace/virtual_renderer", "ace/worker/worker_client", "ace/keyboard/hash_handler", "ace/placeholder", "ace/multi_select", "ace/mode/folding/fold_mode", "ace/theme/textmate", "ace/ext/error_marker", "ace/config"], function(require, exports, module) {
|
18742 |
+
"use strict";
|
18743 |
+
|
18744 |
+
require("./lib/fixoldbrowsers");
|
18745 |
+
|
18746 |
+
var dom = require("./lib/dom");
|
18747 |
+
var event = require("./lib/event");
|
18748 |
+
|
18749 |
+
var Editor = require("./editor").Editor;
|
18750 |
+
var EditSession = require("./edit_session").EditSession;
|
18751 |
+
var UndoManager = require("./undomanager").UndoManager;
|
18752 |
+
var Renderer = require("./virtual_renderer").VirtualRenderer;
|
18753 |
+
require("./worker/worker_client");
|
18754 |
+
require("./keyboard/hash_handler");
|
18755 |
+
require("./placeholder");
|
18756 |
+
require("./multi_select");
|
18757 |
+
require("./mode/folding/fold_mode");
|
18758 |
+
require("./theme/textmate");
|
18759 |
+
require("./ext/error_marker");
|
18760 |
+
|
18761 |
+
exports.config = require("./config");
|
18762 |
+
exports.require = require;
|
18763 |
+
exports.edit = function(el) {
|
18764 |
+
if (typeof(el) == "string") {
|
18765 |
+
var _id = el;
|
18766 |
+
el = document.getElementById(_id);
|
18767 |
+
if (!el)
|
18768 |
+
throw new Error("ace.edit can't find div #" + _id);
|
18769 |
+
}
|
18770 |
+
|
18771 |
+
if (el && el.env && el.env.editor instanceof Editor)
|
18772 |
+
return el.env.editor;
|
18773 |
+
|
18774 |
+
var value = "";
|
18775 |
+
if (el && /input|textarea/i.test(el.tagName)) {
|
18776 |
+
var oldNode = el;
|
18777 |
+
value = oldNode.value;
|
18778 |
+
el = dom.createElement("pre");
|
18779 |
+
oldNode.parentNode.replaceChild(el, oldNode);
|
18780 |
+
} else {
|
18781 |
+
value = dom.getInnerText(el);
|
18782 |
+
el.innerHTML = '';
|
18783 |
+
}
|
18784 |
+
|
18785 |
+
var doc = exports.createEditSession(value);
|
18786 |
+
|
18787 |
+
var editor = new Editor(new Renderer(el));
|
18788 |
+
editor.setSession(doc);
|
18789 |
+
|
18790 |
+
var env = {
|
18791 |
+
document: doc,
|
18792 |
+
editor: editor,
|
18793 |
+
onResize: editor.resize.bind(editor, null)
|
18794 |
+
};
|
18795 |
+
if (oldNode) env.textarea = oldNode;
|
18796 |
+
event.addListener(window, "resize", env.onResize);
|
18797 |
+
editor.on("destroy", function() {
|
18798 |
+
event.removeListener(window, "resize", env.onResize);
|
18799 |
+
env.editor.container.env = null; // prevent memory leak on old ie
|
18800 |
+
});
|
18801 |
+
editor.container.env = editor.env = env;
|
18802 |
+
return editor;
|
18803 |
+
};
|
18804 |
+
exports.createEditSession = function(text, mode) {
|
18805 |
+
var doc = new EditSession(text, mode);
|
18806 |
+
doc.setUndoManager(new UndoManager());
|
18807 |
+
return doc;
|
18808 |
+
}
|
18809 |
+
exports.EditSession = EditSession;
|
18810 |
+
exports.UndoManager = UndoManager;
|
18811 |
+
});
|
18812 |
+
(function() {
|
18813 |
+
ace.require(["ace/ace"], function(a) {
|
18814 |
+
a && a.config.init(true);
|
18815 |
+
if (!window.ace)
|
18816 |
+
window.ace = a;
|
18817 |
+
for (var key in a)
|
18818 |
+
if (a.hasOwnProperty(key))
|
18819 |
+
window.ace[key] = a[key];
|
18820 |
+
});
|
18821 |
+
})();
|
18822 |
+
ace.define("ace/ext/beautify/php_rules", ["require", "exports", "module", "ace/token_iterator"], function(require, exports, module) {
|
18823 |
+
"use strict";
|
18824 |
+
var TokenIterator = require("ace/token_iterator").TokenIterator;
|
18825 |
+
exports.newLines = [{
|
18826 |
+
type: 'support.php_tag',
|
18827 |
+
value: '<?php'
|
18828 |
+
}, {
|
18829 |
+
type: 'support.php_tag',
|
18830 |
+
value: '<?'
|
18831 |
+
}, {
|
18832 |
+
type: 'support.php_tag',
|
18833 |
+
value: '?>'
|
18834 |
+
}, {
|
18835 |
+
type: 'paren.lparen',
|
18836 |
+
value: '{',
|
18837 |
+
indent: true
|
18838 |
+
}, {
|
18839 |
+
type: 'paren.rparen',
|
18840 |
+
breakBefore: true,
|
18841 |
+
value: '}',
|
18842 |
+
indent: false
|
18843 |
+
}, {
|
18844 |
+
type: 'paren.rparen',
|
18845 |
+
breakBefore: true,
|
18846 |
+
value: '})',
|
18847 |
+
indent: false,
|
18848 |
+
dontBreak: true
|
18849 |
+
}, {
|
18850 |
+
type: 'comment'
|
18851 |
+
}, {
|
18852 |
+
type: 'text',
|
18853 |
+
value: ';'
|
18854 |
+
}, {
|
18855 |
+
type: 'text',
|
18856 |
+
value: ':',
|
18857 |
+
context: 'php'
|
18858 |
+
}, {
|
18859 |
+
type: 'keyword',
|
18860 |
+
value: 'case',
|
18861 |
+
indent: true,
|
18862 |
+
dontBreak: true
|
18863 |
+
}, {
|
18864 |
+
type: 'keyword',
|
18865 |
+
value: 'default',
|
18866 |
+
indent: true,
|
18867 |
+
dontBreak: true
|
18868 |
+
}, {
|
18869 |
+
type: 'keyword',
|
18870 |
+
value: 'break',
|
18871 |
+
indent: false,
|
18872 |
+
dontBreak: true
|
18873 |
+
}, {
|
18874 |
+
type: 'punctuation.doctype.end',
|
18875 |
+
value: '>'
|
18876 |
+
}, {
|
18877 |
+
type: 'meta.tag.punctuation.end',
|
18878 |
+
value: '>'
|
18879 |
+
}, {
|
18880 |
+
type: 'meta.tag.punctuation.begin',
|
18881 |
+
value: '<',
|
18882 |
+
blockTag: true,
|
18883 |
+
indent: true,
|
18884 |
+
dontBreak: true
|
18885 |
+
}, {
|
18886 |
+
type: 'meta.tag.punctuation.begin',
|
18887 |
+
value: '</',
|
18888 |
+
indent: false,
|
18889 |
+
breakBefore: true,
|
18890 |
+
dontBreak: true
|
18891 |
+
}, {
|
18892 |
+
type: 'punctuation.operator',
|
18893 |
+
value: ';'
|
18894 |
+
}];
|
18895 |
+
|
18896 |
+
exports.spaces = [{
|
18897 |
+
type: 'xml-pe',
|
18898 |
+
prepend: true
|
18899 |
+
}, {
|
18900 |
+
type: 'entity.other.attribute-name',
|
18901 |
+
prepend: true
|
18902 |
+
}, {
|
18903 |
+
type: 'storage.type',
|
18904 |
+
value: 'var',
|
18905 |
+
append: true
|
18906 |
+
}, {
|
18907 |
+
type: 'storage.type',
|
18908 |
+
value: 'function',
|
18909 |
+
append: true
|
18910 |
+
}, {
|
18911 |
+
type: 'keyword.operator',
|
18912 |
+
value: '='
|
18913 |
+
}, {
|
18914 |
+
type: 'keyword',
|
18915 |
+
value: 'as',
|
18916 |
+
prepend: true,
|
18917 |
+
append: true
|
18918 |
+
}, {
|
18919 |
+
type: 'keyword',
|
18920 |
+
value: 'function',
|
18921 |
+
append: true
|
18922 |
+
}, {
|
18923 |
+
type: 'support.function',
|
18924 |
+
next: /[^\(]/,
|
18925 |
+
append: true
|
18926 |
+
}, {
|
18927 |
+
type: 'keyword',
|
18928 |
+
value: 'or',
|
18929 |
+
append: true,
|
18930 |
+
prepend: true
|
18931 |
+
}, {
|
18932 |
+
type: 'keyword',
|
18933 |
+
value: 'and',
|
18934 |
+
append: true,
|
18935 |
+
prepend: true
|
18936 |
+
}, {
|
18937 |
+
type: 'keyword',
|
18938 |
+
value: 'case',
|
18939 |
+
append: true
|
18940 |
+
}, {
|
18941 |
+
type: 'keyword.operator',
|
18942 |
+
value: '||',
|
18943 |
+
append: true,
|
18944 |
+
prepend: true
|
18945 |
+
}, {
|
18946 |
+
type: 'keyword.operator',
|
18947 |
+
value: '&&',
|
18948 |
+
append: true,
|
18949 |
+
prepend: true
|
18950 |
+
}];
|
18951 |
+
exports.singleTags = ['!doctype', 'area', 'base', 'br', 'hr', 'input', 'img', 'link', 'meta'];
|
18952 |
+
|
18953 |
+
exports.transform = function(iterator, maxPos, context) {
|
18954 |
+
var token = iterator.getCurrentToken();
|
18955 |
+
|
18956 |
+
var newLines = exports.newLines;
|
18957 |
+
var spaces = exports.spaces;
|
18958 |
+
var singleTags = exports.singleTags;
|
18959 |
+
|
18960 |
+
var code = '';
|
18961 |
+
|
18962 |
+
var indentation = 0;
|
18963 |
+
var dontBreak = false;
|
18964 |
+
var tag;
|
18965 |
+
var lastTag;
|
18966 |
+
var lastToken = {};
|
18967 |
+
var nextTag;
|
18968 |
+
var nextToken = {};
|
18969 |
+
var breakAdded = false;
|
18970 |
+
var value = '';
|
18971 |
+
|
18972 |
+
while (token !== null) {
|
18973 |
+
console.log(token);
|
18974 |
+
|
18975 |
+
if (!token) {
|
18976 |
+
token = iterator.stepForward();
|
18977 |
+
continue;
|
18978 |
+
}
|
18979 |
+
if (token.type == 'support.php_tag' && token.value != '?>') {
|
18980 |
+
context = 'php';
|
18981 |
+
} else if (token.type == 'support.php_tag' && token.value == '?>') {
|
18982 |
+
context = 'html';
|
18983 |
+
} else if (token.type == 'meta.tag.name.style' && context != 'css') {
|
18984 |
+
context = 'css';
|
18985 |
+
} else if (token.type == 'meta.tag.name.style' && context == 'css') {
|
18986 |
+
context = 'html';
|
18987 |
+
} else if (token.type == 'meta.tag.name.script' && context != 'js') {
|
18988 |
+
context = 'js';
|
18989 |
+
} else if (token.type == 'meta.tag.name.script' && context == 'js') {
|
18990 |
+
context = 'html';
|
18991 |
+
}
|
18992 |
+
|
18993 |
+
nextToken = iterator.stepForward();
|
18994 |
+
if (nextToken && nextToken.type.indexOf('meta.tag.name') == 0) {
|
18995 |
+
nextTag = nextToken.value;
|
18996 |
+
}
|
18997 |
+
if (lastToken.type == 'support.php_tag' && lastToken.value == '<?=') {
|
18998 |
+
dontBreak = true;
|
18999 |
+
}
|
19000 |
+
if (token.type == 'meta.tag.name') {
|
19001 |
+
token.value = token.value.toLowerCase();
|
19002 |
+
}
|
19003 |
+
if (token.type == 'text') {
|
19004 |
+
token.value = token.value.trim();
|
19005 |
+
}
|
19006 |
+
if (!token.value) {
|
19007 |
+
token = nextToken;
|
19008 |
+
continue;
|
19009 |
+
}
|
19010 |
+
value = token.value;
|
19011 |
+
for (var i in spaces) {
|
19012 |
+
if (
|
19013 |
+
token.type == spaces[i].type &&
|
19014 |
+
(!spaces[i].value || token.value == spaces[i].value) &&
|
19015 |
+
(
|
19016 |
+
nextToken &&
|
19017 |
+
(!spaces[i].next || spaces[i].next.test(nextToken.value))
|
19018 |
+
)
|
19019 |
+
) {
|
19020 |
+
if (spaces[i].prepend) {
|
19021 |
+
value = ' ' + token.value;
|
19022 |
+
}
|
19023 |
+
|
19024 |
+
if (spaces[i].append) {
|
19025 |
+
value += ' ';
|
19026 |
+
}
|
19027 |
+
}
|
19028 |
+
}
|
19029 |
+
if (token.type.indexOf('meta.tag.name') == 0) {
|
19030 |
+
tag = token.value;
|
19031 |
+
}
|
19032 |
+
breakAdded = false;
|
19033 |
+
for (i in newLines) {
|
19034 |
+
if (
|
19035 |
+
token.type == newLines[i].type &&
|
19036 |
+
(!newLines[i].value ||
|
19037 |
+
token.value == newLines[i].value
|
19038 |
+
) &&
|
19039 |
+
(!newLines[i].blockTag ||
|
19040 |
+
singleTags.indexOf(nextTag) === -1
|
19041 |
+
) &&
|
19042 |
+
(!newLines[i].context ||
|
19043 |
+
newLines[i].context === context
|
19044 |
+
)
|
19045 |
+
) {
|
19046 |
+
if (newLines[i].indent === false) {
|
19047 |
+
indentation--;
|
19048 |
+
}
|
19049 |
+
|
19050 |
+
if (
|
19051 |
+
newLines[i].breakBefore &&
|
19052 |
+
(!newLines[i].prev || newLines[i].prev.test(lastToken.value))
|
19053 |
+
) {
|
19054 |
+
code += "\n";
|
19055 |
+
breakAdded = true;
|
19056 |
+
for (i = 0; i < indentation; i++) {
|
19057 |
+
code += "\t";
|
19058 |
+
}
|
19059 |
+
}
|
19060 |
+
|
19061 |
+
break;
|
19062 |
+
}
|
19063 |
+
}
|
19064 |
+
|
19065 |
+
if (dontBreak === false) {
|
19066 |
+
for (i in newLines) {
|
19067 |
+
if (
|
19068 |
+
lastToken.type == newLines[i].type &&
|
19069 |
+
(!newLines[i].value || lastToken.value == newLines[i].value) &&
|
19070 |
+
(!newLines[i].blockTag ||
|
19071 |
+
singleTags.indexOf(tag) === -1
|
19072 |
+
) &&
|
19073 |
+
(!newLines[i].context ||
|
19074 |
+
newLines[i].context === context
|
19075 |
+
)
|
19076 |
+
) {
|
19077 |
+
if (newLines[i].indent === true) {
|
19078 |
+
indentation++;
|
19079 |
+
}
|
19080 |
+
|
19081 |
+
if (!newLines[i].dontBreak && !breakAdded) {
|
19082 |
+
code += "\n";
|
19083 |
+
for (i = 0; i < indentation; i++) {
|
19084 |
+
code += "\t";
|
19085 |
+
}
|
19086 |
+
}
|
19087 |
+
|
19088 |
+
break;
|
19089 |
+
}
|
19090 |
+
}
|
19091 |
+
}
|
19092 |
+
|
19093 |
+
code += value;
|
19094 |
+
if (lastToken.type == 'support.php_tag' && lastToken.value == '?>') {
|
19095 |
+
dontBreak = false;
|
19096 |
+
}
|
19097 |
+
lastTag = tag;
|
19098 |
+
|
19099 |
+
lastToken = token;
|
19100 |
+
|
19101 |
+
token = nextToken;
|
19102 |
+
|
19103 |
+
if (token === null) {
|
19104 |
+
break;
|
19105 |
+
}
|
19106 |
+
}
|
19107 |
+
|
19108 |
+
return code;
|
19109 |
+
};
|
19110 |
+
|
19111 |
+
|
19112 |
+
|
19113 |
+
});
|
19114 |
+
|
19115 |
+
ace.define("ace/ext/beautify", ["require", "exports", "module", "ace/token_iterator", "ace/ext/beautify/php_rules"], function(require, exports, module) {
|
19116 |
+
"use strict";
|
19117 |
+
var TokenIterator = require("ace/token_iterator").TokenIterator;
|
19118 |
+
|
19119 |
+
var phpTransform = require("./beautify/php_rules").transform;
|
19120 |
+
|
19121 |
+
exports.beautify = function(session) {
|
19122 |
+
var iterator = new TokenIterator(session, 0, 0);
|
19123 |
+
var token = iterator.getCurrentToken();
|
19124 |
+
|
19125 |
+
var context = session.$modeId.split("/").pop();
|
19126 |
+
|
19127 |
+
var code = phpTransform(iterator, context);
|
19128 |
+
session.doc.setValue(code);
|
19129 |
+
};
|
19130 |
+
|
19131 |
+
exports.commands = [{
|
19132 |
+
name: "beautify",
|
19133 |
+
exec: function(editor) {
|
19134 |
+
exports.beautify(editor.session);
|
19135 |
+
},
|
19136 |
+
bindKey: "Ctrl-Shift-B"
|
19137 |
+
}]
|
19138 |
+
|
19139 |
+
});
|
19140 |
+
(function() {
|
19141 |
+
ace.require(["ace/ext/beautify"], function() {});
|
19142 |
+
})();
|
19143 |
+
ace.define("ace/mode/css_highlight_rules", ["require", "exports", "module", "ace/lib/oop", "ace/lib/lang", "ace/mode/text_highlight_rules"], function(require, exports, module) {
|
19144 |
+
"use strict";
|
19145 |
+
|
19146 |
+
var oop = require("../lib/oop");
|
19147 |
+
var lang = require("../lib/lang");
|
19148 |
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
19149 |
+
var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index";
|
19150 |
+
var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
|
19151 |
+
var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero";
|
19152 |
+
var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
|
19153 |
+
var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
|
19154 |
+
|
19155 |
+
var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
19156 |
+
var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
|
19157 |
+
var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
|
19158 |
+
|
19159 |
+
var CssHighlightRules = function() {
|
19160 |
+
|
19161 |
+
var keywordMapper = this.createKeywordMapper({
|
19162 |
+
"support.function": supportFunction,
|
19163 |
+
"support.constant": supportConstant,
|
19164 |
+
"support.type": supportType,
|
19165 |
+
"support.constant.color": supportConstantColor,
|
19166 |
+
"support.constant.fonts": supportConstantFonts
|
19167 |
+
}, "text", true);
|
19168 |
+
|
19169 |
+
this.$rules = {
|
19170 |
+
"start": [{
|
19171 |
+
token: "comment", // multi line comment
|
19172 |
+
regex: "\\/\\*",
|
19173 |
+
push: "comment"
|
19174 |
+
}, {
|
19175 |
+
token: "paren.lparen",
|
19176 |
+
regex: "\\{",
|
19177 |
+
push: "ruleset"
|
19178 |
+
}, {
|
19179 |
+
token: "string",
|
19180 |
+
regex: "@.*?{",
|
19181 |
+
push: "media"
|
19182 |
+
}, {
|
19183 |
+
token: "keyword",
|
19184 |
+
regex: "#[a-z0-9-_]+"
|
19185 |
+
}, {
|
19186 |
+
token: "variable",
|
19187 |
+
regex: "\\.[a-z0-9-_]+"
|
19188 |
+
}, {
|
19189 |
+
token: "string",
|
19190 |
+
regex: ":[a-z0-9-_]+"
|
19191 |
+
}, {
|
19192 |
+
token: "constant",
|
19193 |
+
regex: "[a-z0-9-_]+"
|
19194 |
+
}, {
|
19195 |
+
caseInsensitive: true
|
19196 |
+
}],
|
19197 |
+
|
19198 |
+
"media": [{
|
19199 |
+
token: "comment", // multi line comment
|
19200 |
+
regex: "\\/\\*",
|
19201 |
+
push: "comment"
|
19202 |
+
}, {
|
19203 |
+
token: "paren.lparen",
|
19204 |
+
regex: "\\{",
|
19205 |
+
push: "ruleset"
|
19206 |
+
}, {
|
19207 |
+
token: "string",
|
19208 |
+
regex: "\\}",
|
19209 |
+
next: "pop"
|
19210 |
+
}, {
|
19211 |
+
token: "keyword",
|
19212 |
+
regex: "#[a-z0-9-_]+"
|
19213 |
+
}, {
|
19214 |
+
token: "variable",
|
19215 |
+
regex: "\\.[a-z0-9-_]+"
|
19216 |
+
}, {
|
19217 |
+
token: "string",
|
19218 |
+
regex: ":[a-z0-9-_]+"
|
19219 |
+
}, {
|
19220 |
+
token: "constant",
|
19221 |
+
regex: "[a-z0-9-_]+"
|
19222 |
+
}, {
|
19223 |
+
caseInsensitive: true
|
19224 |
+
}],
|
19225 |
+
|
19226 |
+
"comment": [{
|
19227 |
+
token: "comment",
|
19228 |
+
regex: "\\*\\/",
|
19229 |
+
next: "pop"
|
19230 |
+
}, {
|
19231 |
+
defaultToken: "comment"
|
19232 |
+
}],
|
19233 |
+
|
19234 |
+
"ruleset": [{
|
19235 |
+
token: "paren.rparen",
|
19236 |
+
regex: "\\}",
|
19237 |
+
next: "pop"
|
19238 |
+
}, {
|
19239 |
+
token: "comment", // multi line comment
|
19240 |
+
regex: "\\/\\*",
|
19241 |
+
push: "comment"
|
19242 |
+
}, {
|
19243 |
+
token: "string", // single line
|
19244 |
+
regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
19245 |
+
}, {
|
19246 |
+
token: "string", // single line
|
19247 |
+
regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
19248 |
+
}, {
|
19249 |
+
token: ["constant.numeric", "keyword"],
|
19250 |
+
regex: "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
|
19251 |
+
}, {
|
19252 |
+
token: "constant.numeric",
|
19253 |
+
regex: numRe
|
19254 |
+
}, {
|
19255 |
+
token: "constant.numeric", // hex6 color
|
19256 |
+
regex: "#[a-f0-9]{6}"
|
19257 |
+
}, {
|
19258 |
+
token: "constant.numeric", // hex3 color
|
19259 |
+
regex: "#[a-f0-9]{3}"
|
19260 |
+
}, {
|
19261 |
+
token: ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
|
19262 |
+
regex: pseudoElements
|
19263 |
+
}, {
|
19264 |
+
token: ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
|
19265 |
+
regex: pseudoClasses
|
19266 |
+
}, {
|
19267 |
+
token: ["support.function", "string", "support.function"],
|
19268 |
+
regex: "(url\\()(.*)(\\))"
|
19269 |
+
}, {
|
19270 |
+
token: keywordMapper,
|
19271 |
+
regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
|
19272 |
+
}, {
|
19273 |
+
caseInsensitive: true
|
19274 |
+
}]
|
19275 |
+
};
|
19276 |
+
|
19277 |
+
this.normalizeRules();
|
19278 |
+
};
|
19279 |
+
|
19280 |
+
oop.inherits(CssHighlightRules, TextHighlightRules);
|
19281 |
+
|
19282 |
+
exports.CssHighlightRules = CssHighlightRules;
|
19283 |
+
|
19284 |
+
});
|
19285 |
+
|
19286 |
+
ace.define("ace/mode/matching_brace_outdent", ["require", "exports", "module", "ace/range"], function(require, exports, module) {
|
19287 |
+
"use strict";
|
19288 |
+
|
19289 |
+
var Range = require("../range").Range;
|
19290 |
+
|
19291 |
+
var MatchingBraceOutdent = function() {};
|
19292 |
+
|
19293 |
+
(function() {
|
19294 |
+
|
19295 |
+
this.checkOutdent = function(line, input) {
|
19296 |
+
if (!/^\s+$/.test(line))
|
19297 |
+
return false;
|
19298 |
+
|
19299 |
+
return /^\s*\}/.test(input);
|
19300 |
+
};
|
19301 |
+
|
19302 |
+
this.autoOutdent = function(doc, row) {
|
19303 |
+
var line = doc.getLine(row);
|
19304 |
+
var match = line.match(/^(\s*\})/);
|
19305 |
+
|
19306 |
+
if (!match) return 0;
|
19307 |
+
|
19308 |
+
var column = match[1].length;
|
19309 |
+
var openBracePos = doc.findMatchingBracket({
|
19310 |
+
row: row,
|
19311 |
+
column: column
|
19312 |
+
});
|
19313 |
+
|
19314 |
+
if (!openBracePos || openBracePos.row == row) return 0;
|
19315 |
+
|
19316 |
+
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
19317 |
+
doc.replace(new Range(row, 0, row, column - 1), indent);
|
19318 |
+
};
|
19319 |
+
|
19320 |
+
this.$getIndent = function(line) {
|
19321 |
+
return line.match(/^\s*/)[0];
|
19322 |
+
};
|
19323 |
+
|
19324 |
+
}).call(MatchingBraceOutdent.prototype);
|
19325 |
+
|
19326 |
+
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
19327 |
+
});
|
19328 |
+
|
19329 |
+
ace.define("ace/mode/behaviour/cstyle", ["require", "exports", "module", "ace/lib/oop", "ace/mode/behaviour", "ace/token_iterator", "ace/lib/lang"], function(require, exports, module) {
|
19330 |
+
"use strict";
|
19331 |
+
|
19332 |
+
var oop = require("../../lib/oop");
|
19333 |
+
var Behaviour = require("../behaviour").Behaviour;
|
19334 |
+
var TokenIterator = require("../../token_iterator").TokenIterator;
|
19335 |
+
var lang = require("../../lib/lang");
|
19336 |
+
|
19337 |
+
var SAFE_INSERT_IN_TOKENS = ["text", "paren.rparen", "punctuation.operator"];
|
19338 |
+
var SAFE_INSERT_BEFORE_TOKENS = ["text", "paren.rparen", "punctuation.operator", "comment"];
|
19339 |
+
|
19340 |
+
var context;
|
19341 |
+
var contextCache = {};
|
19342 |
+
var initContext = function(editor) {
|
19343 |
+
var id = -1;
|
19344 |
+
if (editor.multiSelect) {
|
19345 |
+
id = editor.selection.index;
|
19346 |
+
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
|
19347 |
+
contextCache = {
|
19348 |
+
rangeCount: editor.multiSelect.rangeCount
|
19349 |
+
};
|
19350 |
+
}
|
19351 |
+
if (contextCache[id])
|
19352 |
+
return context = contextCache[id];
|
19353 |
+
context = contextCache[id] = {
|
19354 |
+
autoInsertedBrackets: 0,
|
19355 |
+
autoInsertedRow: -1,
|
19356 |
+
autoInsertedLineEnd: "",
|
19357 |
+
maybeInsertedBrackets: 0,
|
19358 |
+
maybeInsertedRow: -1,
|
19359 |
+
maybeInsertedLineStart: "",
|
19360 |
+
maybeInsertedLineEnd: ""
|
19361 |
+
};
|
19362 |
+
};
|
19363 |
+
|
19364 |
+
var CstyleBehaviour = function() {
|
19365 |
+
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
19366 |
+
var cursor = editor.getCursorPosition();
|
19367 |
+
var line = session.doc.getLine(cursor.row);
|
19368 |
+
if (text == '{') {
|
19369 |
+
initContext(editor);
|
19370 |
+
var selection = editor.getSelectionRange();
|
19371 |
+
var selected = session.doc.getTextRange(selection);
|
19372 |
+
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
19373 |
+
return {
|
19374 |
+
text: '{' + selected + '}',
|
19375 |
+
selection: false
|
19376 |
+
};
|
19377 |
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
19378 |
+
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
19379 |
+
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
19380 |
+
return {
|
19381 |
+
text: '{}',
|
19382 |
+
selection: [1, 1]
|
19383 |
+
};
|
19384 |
+
} else {
|
19385 |
+
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
19386 |
+
return {
|
19387 |
+
text: '{',
|
19388 |
+
selection: [1, 1]
|
19389 |
+
};
|
19390 |
+
}
|
19391 |
+
}
|
19392 |
+
} else if (text == '}') {
|
19393 |
+
initContext(editor);
|
19394 |
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
19395 |
+
if (rightChar == '}') {
|
19396 |
+
var matching = session.$findOpeningBracket('}', {
|
19397 |
+
column: cursor.column + 1,
|
19398 |
+
row: cursor.row
|
19399 |
+
});
|
19400 |
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
19401 |
+
CstyleBehaviour.popAutoInsertedClosing();
|
19402 |
+
return {
|
19403 |
+
text: '',
|
19404 |
+
selection: [1, 1]
|
19405 |
+
};
|
19406 |
+
}
|
19407 |
+
}
|
19408 |
+
} else if (text == "\n" || text == "\r\n") {
|
19409 |
+
initContext(editor);
|
19410 |
+
var closing = "";
|
19411 |
+
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
19412 |
+
closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
|
19413 |
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
19414 |
+
}
|
19415 |
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
19416 |
+
if (rightChar === '}') {
|
19417 |
+
var openBracePos = session.findMatchingBracket({
|
19418 |
+
row: cursor.row,
|
19419 |
+
column: cursor.column + 1
|
19420 |
+
}, '}');
|
19421 |
+
if (!openBracePos)
|
19422 |
+
return null;
|
19423 |
+
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
19424 |
+
} else if (closing) {
|
19425 |
+
var next_indent = this.$getIndent(line);
|
19426 |
+
} else {
|
19427 |
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
19428 |
+
return;
|
19429 |
+
}
|
19430 |
+
var indent = next_indent + session.getTabString();
|
19431 |
+
|
19432 |
+
return {
|
19433 |
+
text: '\n' + indent + '\n' + next_indent + closing,
|
19434 |
+
selection: [1, indent.length, 1, indent.length]
|
19435 |
+
};
|
19436 |
+
} else {
|
19437 |
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
19438 |
+
}
|
19439 |
+
});
|
19440 |
+
|
19441 |
+
this.add("braces", "deletion", function(state, action, editor, session, range) {
|
19442 |
+
var selected = session.doc.getTextRange(range);
|
19443 |
+
if (!range.isMultiLine() && selected == '{') {
|
19444 |
+
initContext(editor);
|
19445 |
+
var line = session.doc.getLine(range.start.row);
|
19446 |
+
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
19447 |
+
if (rightChar == '}') {
|
19448 |
+
range.end.column++;
|
19449 |
+
return range;
|
19450 |
+
} else {
|
19451 |
+
context.maybeInsertedBrackets--;
|
19452 |
+
}
|
19453 |
+
}
|
19454 |
+
});
|
19455 |
+
|
19456 |
+
this.add("parens", "insertion", function(state, action, editor, session, text) {
|
19457 |
+
if (text == '(') {
|
19458 |
+
initContext(editor);
|
19459 |
+
var selection = editor.getSelectionRange();
|
19460 |
+
var selected = session.doc.getTextRange(selection);
|
19461 |
+
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
19462 |
+
return {
|
19463 |
+
text: '(' + selected + ')',
|
19464 |
+
selection: false
|
19465 |
+
};
|
19466 |
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
19467 |
+
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
19468 |
+
return {
|
19469 |
+
text: '()',
|
19470 |
+
selection: [1, 1]
|
19471 |
+
};
|
19472 |
+
}
|
19473 |
+
} else if (text == ')') {
|
19474 |
+
initContext(editor);
|
19475 |
+
var cursor = editor.getCursorPosition();
|
19476 |
+
var line = session.doc.getLine(cursor.row);
|
19477 |
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
19478 |
+
if (rightChar == ')') {
|
19479 |
+
var matching = session.$findOpeningBracket(')', {
|
19480 |
+
column: cursor.column + 1,
|
19481 |
+
row: cursor.row
|
19482 |
+
});
|
19483 |
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
19484 |
+
CstyleBehaviour.popAutoInsertedClosing();
|
19485 |
+
return {
|
19486 |
+
text: '',
|
19487 |
+
selection: [1, 1]
|
19488 |
+
};
|
19489 |
+
}
|
19490 |
+
}
|
19491 |
+
}
|
19492 |
+
});
|
19493 |
+
|
19494 |
+
this.add("parens", "deletion", function(state, action, editor, session, range) {
|
19495 |
+
var selected = session.doc.getTextRange(range);
|
19496 |
+
if (!range.isMultiLine() && selected == '(') {
|
19497 |
+
initContext(editor);
|
19498 |
+
var line = session.doc.getLine(range.start.row);
|
19499 |
+
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
19500 |
+
if (rightChar == ')') {
|
19501 |
+
range.end.column++;
|
19502 |
+
return range;
|
19503 |
+
}
|
19504 |
+
}
|
19505 |
+
});
|
19506 |
+
|
19507 |
+
this.add("brackets", "insertion", function(state, action, editor, session, text) {
|
19508 |
+
if (text == '[') {
|
19509 |
+
initContext(editor);
|
19510 |
+
var selection = editor.getSelectionRange();
|
19511 |
+
var selected = session.doc.getTextRange(selection);
|
19512 |
+
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
19513 |
+
return {
|
19514 |
+
text: '[' + selected + ']',
|
19515 |
+
selection: false
|
19516 |
+
};
|
19517 |
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
19518 |
+
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
19519 |
+
return {
|
19520 |
+
text: '[]',
|
19521 |
+
selection: [1, 1]
|
19522 |
+
};
|
19523 |
+
}
|
19524 |
+
} else if (text == ']') {
|
19525 |
+
initContext(editor);
|
19526 |
+
var cursor = editor.getCursorPosition();
|
19527 |
+
var line = session.doc.getLine(cursor.row);
|
19528 |
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
19529 |
+
if (rightChar == ']') {
|
19530 |
+
var matching = session.$findOpeningBracket(']', {
|
19531 |
+
column: cursor.column + 1,
|
19532 |
+
row: cursor.row
|
19533 |
+
});
|
19534 |
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
19535 |
+
CstyleBehaviour.popAutoInsertedClosing();
|
19536 |
+
return {
|
19537 |
+
text: '',
|
19538 |
+
selection: [1, 1]
|
19539 |
+
};
|
19540 |
+
}
|
19541 |
+
}
|
19542 |
+
}
|
19543 |
+
});
|
19544 |
+
|
19545 |
+
this.add("brackets", "deletion", function(state, action, editor, session, range) {
|
19546 |
+
var selected = session.doc.getTextRange(range);
|
19547 |
+
if (!range.isMultiLine() && selected == '[') {
|
19548 |
+
initContext(editor);
|
19549 |
+
var line = session.doc.getLine(range.start.row);
|
19550 |
+
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
19551 |
+
if (rightChar == ']') {
|
19552 |
+
range.end.column++;
|
19553 |
+
return range;
|
19554 |
+
}
|
19555 |
+
}
|
19556 |
+
});
|
19557 |
+
|
19558 |
+
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
|
19559 |
+
if (text == '"' || text == "'") {
|
19560 |
+
initContext(editor);
|
19561 |
+
var quote = text;
|
19562 |
+
var selection = editor.getSelectionRange();
|
19563 |
+
var selected = session.doc.getTextRange(selection);
|
19564 |
+
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
19565 |
+
return {
|
19566 |
+
text: quote + selected + quote,
|
19567 |
+
selection: false
|
19568 |
+
};
|
19569 |
+
} else {
|
19570 |
+
var cursor = editor.getCursorPosition();
|
19571 |
+
var line = session.doc.getLine(cursor.row);
|
19572 |
+
var leftChar = line.substring(cursor.column - 1, cursor.column);
|
19573 |
+
if (leftChar == '\\') {
|
19574 |
+
return null;
|
19575 |
+
}
|
19576 |
+
var tokens = session.getTokens(selection.start.row);
|
19577 |
+
var col = 0,
|
19578 |
+
token;
|
19579 |
+
var quotepos = -1; // Track whether we're inside an open quote.
|
19580 |
+
|
19581 |
+
for (var x = 0; x < tokens.length; x++) {
|
19582 |
+
token = tokens[x];
|
19583 |
+
if (token.type == "string") {
|
19584 |
+
quotepos = -1;
|
19585 |
+
} else if (quotepos < 0) {
|
19586 |
+
quotepos = token.value.indexOf(quote);
|
19587 |
+
}
|
19588 |
+
if ((token.value.length + col) > selection.start.column) {
|
19589 |
+
break;
|
19590 |
+
}
|
19591 |
+
col += tokens[x].value.length;
|
19592 |
+
}
|
19593 |
+
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length + col - 1) && token.value.lastIndexOf(quote) === token.value.length - 1)))) {
|
19594 |
+
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
19595 |
+
return;
|
19596 |
+
return {
|
19597 |
+
text: quote + quote,
|
19598 |
+
selection: [1, 1]
|
19599 |
+
};
|
19600 |
+
} else if (token && token.type === "string") {
|
19601 |
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
19602 |
+
if (rightChar == quote) {
|
19603 |
+
return {
|
19604 |
+
text: '',
|
19605 |
+
selection: [1, 1]
|
19606 |
+
};
|
19607 |
+
}
|
19608 |
+
}
|
19609 |
+
}
|
19610 |
+
}
|
19611 |
+
});
|
19612 |
+
|
19613 |
+
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
|
19614 |
+
var selected = session.doc.getTextRange(range);
|
19615 |
+
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
19616 |
+
initContext(editor);
|
19617 |
+
var line = session.doc.getLine(range.start.row);
|
19618 |
+
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
19619 |
+
if (rightChar == selected) {
|
19620 |
+
range.end.column++;
|
19621 |
+
return range;
|
19622 |
+
}
|
19623 |
+
}
|
19624 |
+
});
|
19625 |
+
|
19626 |
+
};
|
19627 |
+
|
19628 |
+
|
19629 |
+
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
19630 |
+
var cursor = editor.getCursorPosition();
|
19631 |
+
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
19632 |
+
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
19633 |
+
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
19634 |
+
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
19635 |
+
return false;
|
19636 |
+
}
|
19637 |
+
iterator.stepForward();
|
19638 |
+
return iterator.getCurrentTokenRow() !== cursor.row ||
|
19639 |
+
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
19640 |
+
};
|
19641 |
+
|
19642 |
+
CstyleBehaviour.$matchTokenType = function(token, types) {
|
19643 |
+
return types.indexOf(token.type || token) > -1;
|
19644 |
+
};
|
19645 |
+
|
19646 |
+
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
19647 |
+
var cursor = editor.getCursorPosition();
|
19648 |
+
var line = session.doc.getLine(cursor.row);
|
19649 |
+
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
|
19650 |
+
context.autoInsertedBrackets = 0;
|
19651 |
+
context.autoInsertedRow = cursor.row;
|
19652 |
+
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
19653 |
+
context.autoInsertedBrackets++;
|
19654 |
+
};
|
19655 |
+
|
19656 |
+
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
19657 |
+
var cursor = editor.getCursorPosition();
|
19658 |
+
var line = session.doc.getLine(cursor.row);
|
19659 |
+
if (!this.isMaybeInsertedClosing(cursor, line))
|
19660 |
+
context.maybeInsertedBrackets = 0;
|
19661 |
+
context.maybeInsertedRow = cursor.row;
|
19662 |
+
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
19663 |
+
context.maybeInsertedLineEnd = line.substr(cursor.column);
|
19664 |
+
context.maybeInsertedBrackets++;
|
19665 |
+
};
|
19666 |
+
|
19667 |
+
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
19668 |
+
return context.autoInsertedBrackets > 0 &&
|
19669 |
+
cursor.row === context.autoInsertedRow &&
|
19670 |
+
bracket === context.autoInsertedLineEnd[0] &&
|
19671 |
+
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
19672 |
+
};
|
19673 |
+
|
19674 |
+
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
19675 |
+
return context.maybeInsertedBrackets > 0 &&
|
19676 |
+
cursor.row === context.maybeInsertedRow &&
|
19677 |
+
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
|
19678 |
+
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
|
19679 |
+
};
|
19680 |
+
|
19681 |
+
CstyleBehaviour.popAutoInsertedClosing = function() {
|
19682 |
+
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
19683 |
+
context.autoInsertedBrackets--;
|
19684 |
+
};
|
19685 |
+
|
19686 |
+
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
19687 |
+
if (context) {
|
19688 |
+
context.maybeInsertedBrackets = 0;
|
19689 |
+
context.maybeInsertedRow = -1;
|
19690 |
+
}
|
19691 |
+
};
|
19692 |
+
|
19693 |
+
|
19694 |
+
|
19695 |
+
oop.inherits(CstyleBehaviour, Behaviour);
|
19696 |
+
|
19697 |
+
exports.CstyleBehaviour = CstyleBehaviour;
|
19698 |
+
});
|
19699 |
+
|
19700 |
+
ace.define("ace/mode/behaviour/css", ["require", "exports", "module", "ace/lib/oop", "ace/mode/behaviour", "ace/mode/behaviour/cstyle", "ace/token_iterator"], function(require, exports, module) {
|
19701 |
+
"use strict";
|
19702 |
+
|
19703 |
+
var oop = require("../../lib/oop");
|
19704 |
+
var Behaviour = require("../behaviour").Behaviour;
|
19705 |
+
var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
|
19706 |
+
var TokenIterator = require("../../token_iterator").TokenIterator;
|
19707 |
+
|
19708 |
+
var CssBehaviour = function() {
|
19709 |
+
|
19710 |
+
this.inherit(CstyleBehaviour);
|
19711 |
+
|
19712 |
+
this.add("colon", "insertion", function(state, action, editor, session, text) {
|
19713 |
+
if (text === ':') {
|
19714 |
+
var cursor = editor.getCursorPosition();
|
19715 |
+
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
19716 |
+
var token = iterator.getCurrentToken();
|
19717 |
+
if (token && token.value.match(/\s+/)) {
|
19718 |
+
token = iterator.stepBackward();
|
19719 |
+
}
|
19720 |
+
if (token && token.type === 'support.type') {
|
19721 |
+
var line = session.doc.getLine(cursor.row);
|
19722 |
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
19723 |
+
if (rightChar === ':') {
|
19724 |
+
return {
|
19725 |
+
text: '',
|
19726 |
+
selection: [1, 1]
|
19727 |
+
}
|
19728 |
+
}
|
19729 |
+
if (!line.substring(cursor.column).match(/^\s*;/)) {
|
19730 |
+
return {
|
19731 |
+
text: ':;',
|
19732 |
+
selection: [1, 1]
|
19733 |
+
}
|
19734 |
+
}
|
19735 |
+
}
|
19736 |
+
}
|
19737 |
+
});
|
19738 |
+
|
19739 |
+
this.add("colon", "deletion", function(state, action, editor, session, range) {
|
19740 |
+
var selected = session.doc.getTextRange(range);
|
19741 |
+
if (!range.isMultiLine() && selected === ':') {
|
19742 |
+
var cursor = editor.getCursorPosition();
|
19743 |
+
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
19744 |
+
var token = iterator.getCurrentToken();
|
19745 |
+
if (token && token.value.match(/\s+/)) {
|
19746 |
+
token = iterator.stepBackward();
|
19747 |
+
}
|
19748 |
+
if (token && token.type === 'support.type') {
|
19749 |
+
var line = session.doc.getLine(range.start.row);
|
19750 |
+
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
19751 |
+
if (rightChar === ';') {
|
19752 |
+
range.end.column++;
|
19753 |
+
return range;
|
19754 |
+
}
|
19755 |
+
}
|
19756 |
+
}
|
19757 |
+
});
|
19758 |
+
|
19759 |
+
this.add("semicolon", "insertion", function(state, action, editor, session, text) {
|
19760 |
+
if (text === ';') {
|
19761 |
+
var cursor = editor.getCursorPosition();
|
19762 |
+
var line = session.doc.getLine(cursor.row);
|
19763 |
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
19764 |
+
if (rightChar === ';') {
|
19765 |
+
return {
|
19766 |
+
text: '',
|
19767 |
+
selection: [1, 1]
|
19768 |
+
}
|
19769 |
+
}
|
19770 |
+
}
|
19771 |
+
});
|
19772 |
+
|
19773 |
+
}
|
19774 |
+
oop.inherits(CssBehaviour, CstyleBehaviour);
|
19775 |
+
|
19776 |
+
exports.CssBehaviour = CssBehaviour;
|
19777 |
+
});
|
19778 |
+
|
19779 |
+
ace.define("ace/mode/folding/cstyle", ["require", "exports", "module", "ace/lib/oop", "ace/range", "ace/mode/folding/fold_mode"], function(require, exports, module) {
|
19780 |
+
"use strict";
|
19781 |
+
|
19782 |
+
var oop = require("../../lib/oop");
|
19783 |
+
var Range = require("../../range").Range;
|
19784 |
+
var BaseFoldMode = require("./fold_mode").FoldMode;
|
19785 |
+
|
19786 |
+
var FoldMode = exports.FoldMode = function(commentRegex) {
|
19787 |
+
if (commentRegex) {
|
19788 |
+
this.foldingStartMarker = new RegExp(
|
19789 |
+
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
19790 |
+
);
|
19791 |
+
this.foldingStopMarker = new RegExp(
|
19792 |
+
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
19793 |
+
);
|
19794 |
+
}
|
19795 |
+
};
|
19796 |
+
oop.inherits(FoldMode, BaseFoldMode);
|
19797 |
+
|
19798 |
+
(function() {
|
19799 |
+
|
19800 |
+
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
19801 |
+
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
19802 |
+
|
19803 |
+
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
19804 |
+
var line = session.getLine(row);
|
19805 |
+
var match = line.match(this.foldingStartMarker);
|
19806 |
+
if (match) {
|
19807 |
+
var i = match.index;
|
19808 |
+
|
19809 |
+
if (match[1])
|
19810 |
+
return this.openingBracketBlock(session, match[1], row, i);
|
19811 |
+
|
19812 |
+
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
19813 |
+
|
19814 |
+
if (range && !range.isMultiLine()) {
|
19815 |
+
if (forceMultiline) {
|
19816 |
+
range = this.getSectionRange(session, row);
|
19817 |
+
} else if (foldStyle != "all")
|
19818 |
+
range = null;
|
19819 |
+
}
|
19820 |
+
|
19821 |
+
return range;
|
19822 |
+
}
|
19823 |
+
|
19824 |
+
if (foldStyle === "markbegin")
|
19825 |
+
return;
|
19826 |
+
|
19827 |
+
var match = line.match(this.foldingStopMarker);
|
19828 |
+
if (match) {
|
19829 |
+
var i = match.index + match[0].length;
|
19830 |
+
|
19831 |
+
if (match[1])
|
19832 |
+
return this.closingBracketBlock(session, match[1], row, i);
|
19833 |
+
|
19834 |
+
return session.getCommentFoldRange(row, i, -1);
|
19835 |
+
}
|
19836 |
+
};
|
19837 |
+
|
19838 |
+
this.getSectionRange = function(session, row) {
|
19839 |
+
var line = session.getLine(row);
|
19840 |
+
var startIndent = line.search(/\S/);
|
19841 |
+
var startRow = row;
|
19842 |
+
var startColumn = line.length;
|
19843 |
+
row = row + 1;
|
19844 |
+
var endRow = row;
|
19845 |
+
var maxRow = session.getLength();
|
19846 |
+
while (++row < maxRow) {
|
19847 |
+
line = session.getLine(row);
|
19848 |
+
var indent = line.search(/\S/);
|
19849 |
+
if (indent === -1)
|
19850 |
+
continue;
|
19851 |
+
if (startIndent > indent)
|
19852 |
+
break;
|
19853 |
+
var subRange = this.getFoldWidgetRange(session, "all", row);
|
19854 |
+
|
19855 |
+
if (subRange) {
|
19856 |
+
if (subRange.start.row <= startRow) {
|
19857 |
+
break;
|
19858 |
+
} else if (subRange.isMultiLine()) {
|
19859 |
+
row = subRange.end.row;
|
19860 |
+
} else if (startIndent == indent) {
|
19861 |
+
break;
|
19862 |
+
}
|
19863 |
+
}
|
19864 |
+
endRow = row;
|
19865 |
+
}
|
19866 |
+
|
19867 |
+
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
19868 |
+
};
|
19869 |
+
|
19870 |
+
}).call(FoldMode.prototype);
|
19871 |
+
|
19872 |
+
});
|
19873 |
+
|
19874 |
+
ace.define("ace/mode/css", ["require", "exports", "module", "ace/lib/oop", "ace/mode/text", "ace/mode/css_highlight_rules", "ace/mode/matching_brace_outdent", "ace/worker/worker_client", "ace/mode/behaviour/css", "ace/mode/folding/cstyle"], function(require, exports, module) {
|
19875 |
+
"use strict";
|
19876 |
+
|
19877 |
+
var oop = require("../lib/oop");
|
19878 |
+
var TextMode = require("./text").Mode;
|
19879 |
+
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
|
19880 |
+
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
19881 |
+
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
19882 |
+
var CssBehaviour = require("./behaviour/css").CssBehaviour;
|
19883 |
+
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
19884 |
+
|
19885 |
+
var Mode = function() {
|
19886 |
+
this.HighlightRules = CssHighlightRules;
|
19887 |
+
this.$outdent = new MatchingBraceOutdent();
|
19888 |
+
this.$behaviour = new CssBehaviour();
|
19889 |
+
this.foldingRules = new CStyleFoldMode();
|
19890 |
+
};
|
19891 |
+
oop.inherits(Mode, TextMode);
|
19892 |
+
|
19893 |
+
(function() {
|
19894 |
+
|
19895 |
+
this.foldingRules = "cStyle";
|
19896 |
+
this.blockComment = {
|
19897 |
+
start: "/*",
|
19898 |
+
end: "*/"
|
19899 |
+
};
|
19900 |
+
|
19901 |
+
this.getNextLineIndent = function(state, line, tab) {
|
19902 |
+
var indent = this.$getIndent(line);
|
19903 |
+
var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
|
19904 |
+
if (tokens.length && tokens[tokens.length - 1].type == "comment") {
|
19905 |
+
return indent;
|
19906 |
+
}
|
19907 |
+
|
19908 |
+
var match = line.match(/^.*\{\s*$/);
|
19909 |
+
if (match) {
|
19910 |
+
indent += tab;
|
19911 |
+
}
|
19912 |
+
|
19913 |
+
return indent;
|
19914 |
+
};
|
19915 |
+
|
19916 |
+
this.checkOutdent = function(state, line, input) {
|
19917 |
+
return this.$outdent.checkOutdent(line, input);
|
19918 |
+
};
|
19919 |
+
|
19920 |
+
this.autoOutdent = function(state, doc, row) {
|
19921 |
+
this.$outdent.autoOutdent(doc, row);
|
19922 |
+
};
|
19923 |
+
|
19924 |
+
this.createWorker = function(session) {
|
19925 |
+
var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
|
19926 |
+
worker.attachToDocument(session.getDocument());
|
19927 |
+
|
19928 |
+
worker.on("csslint", function(e) {
|
19929 |
+
session.setAnnotations(e.data);
|
19930 |
+
});
|
19931 |
+
|
19932 |
+
worker.on("terminate", function() {
|
19933 |
+
session.clearAnnotations();
|
19934 |
+
});
|
19935 |
+
|
19936 |
+
return worker;
|
19937 |
+
};
|
19938 |
+
|
19939 |
+
this.$id = "ace/mode/css";
|
19940 |
+
}).call(Mode.prototype);
|
19941 |
+
|
19942 |
+
exports.Mode = Mode;
|
19943 |
+
|
19944 |
+
});
|
js/ace.min.js
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*! PopUp Free - v4.7.02
|
2 |
+
* https://wordpress.org/plugins/wordpress-popup/
|
3 |
+
* Copyright (c) 2014; * Licensed GPLv2+ */
|
4 |
+
(function(){function e(e){var t=function(e,t){return s("",e,t)},r=i;e&&(i[e]||(i[e]={}),r=i[e]),r.define&&r.define.packaged||(n.original=r.define,r.define=n,r.define.packaged=!0),r.require&&r.require.packaged||(s.original=r.require,r.require=t,r.require.packaged=!0)}var t="ace",i=function(){return this}();if(t||"undefined"==typeof requirejs){var n=function(e,t,i){return"string"!=typeof e?(n.original?n.original.apply(window,arguments):(console.error("dropping module because define wasn't a string."),console.trace()),void 0):(2==arguments.length&&(i=t),n.modules||(n.modules={},n.payloads={}),n.payloads[e]=i,n.modules[e]=null,void 0)},s=function(e,t,i){if("[object Array]"===Object.prototype.toString.call(t)){for(var n=[],r=0,a=t.length;a>r;++r){var l=o(e,t[r]);if(!l&&s.original)return s.original.apply(window,arguments);n.push(l)}i&&i.apply(null,n)}else{if("string"==typeof t){var h=o(e,t);return!h&&s.original?s.original.apply(window,arguments):(i&&i(),h)}if(s.original)return s.original.apply(window,arguments)}},r=function(e,t){if(-1!==t.indexOf("!")){var i=t.split("!");return r(e,i[0])+"!"+r(e,i[1])}if("."==t.charAt(0)){var n=e.split("/").slice(0,-1).join("/");for(t=n+"/"+t;-1!==t.indexOf(".")&&s!=t;){var s=t;t=t.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return t},o=function(e,t){t=r(e,t);var i=n.modules[t];if(!i){if(i=n.payloads[t],"function"==typeof i){var o={},a={id:t,uri:"",exports:o,packaged:!0},l=function(e,i){return s(t,e,i)},h=i(l,o,a);o=h||a.exports,n.modules[t]=o,delete n.payloads[t]}i=n.modules[t]=o||i}return i};e(t)}})(),ace.define("ace/lib/regexp",["require","exports","module"],function(){"use strict";function e(e){return(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":"")}function t(e,t,i){if(Array.prototype.indexOf)return e.indexOf(t,i);for(var n=i||0;e.length>n;n++)if(e[n]===t)return n;return-1}var i={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},n=void 0===i.exec.call(/()??/,"")[1],s=function(){var e=/^/g;return i.test.call(e,""),!e.lastIndex}();s&&n||(RegExp.prototype.exec=function(r){var o,a,l=i.exec.apply(this,arguments);if("string"==typeof r&&l){if(!n&&l.length>1&&t(l,"")>-1&&(a=RegExp(this.source,i.replace.call(e(this),"g","")),i.replace.call(r.slice(l.index),a,function(){for(var e=1;arguments.length-2>e;e++)void 0===arguments[e]&&(l[e]=void 0)})),this._xregexp&&this._xregexp.captureNames)for(var h=1;l.length>h;h++)o=this._xregexp.captureNames[h-1],o&&(l[o]=l[h]);!s&&this.global&&!l[0].length&&this.lastIndex>l.index&&this.lastIndex--}return l},s||(RegExp.prototype.test=function(e){var t=i.exec.call(this,e);return t&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--,!!t}))}),ace.define("ace/lib/es5-shim",["require","exports","module"],function(){function e(){}function t(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(t){}}function i(e){return e=+e,e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}Function.prototype.bind||(Function.prototype.bind=function(t){var i=this;if("function"!=typeof i)throw new TypeError("Function.prototype.bind called on incompatible "+i);var n=u.call(arguments,1),s=function(){if(this instanceof s){var e=i.apply(this,n.concat(u.call(arguments)));return Object(e)===e?e:this}return i.apply(t,n.concat(u.call(arguments)))};return i.prototype&&(e.prototype=i.prototype,s.prototype=new e,e.prototype=null),s});var n,s,r,o,a,l=Function.prototype.call,h=Array.prototype,c=Object.prototype,u=h.slice,d=l.bind(c.toString),g=l.bind(c.hasOwnProperty);if((a=g(c,"__defineGetter__"))&&(n=l.bind(c.__defineGetter__),s=l.bind(c.__defineSetter__),r=l.bind(c.__lookupGetter__),o=l.bind(c.__lookupSetter__)),2!=[1,2].splice(0).length)if(function(){function e(e){var t=Array(e+2);return t[0]=t[1]=0,t}var t,i=[];return i.splice.apply(i,e(20)),i.splice.apply(i,e(26)),t=i.length,i.splice(5,0,"XXX"),t+1==i.length,t+1==i.length?!0:void 0}()){var f=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?f.apply(this,[void 0===e?0:e,void 0===t?this.length-e:t].concat(u.call(arguments,2))):[]}}else Array.prototype.splice=function(e,t){var i=this.length;e>0?e>i&&(e=i):void 0==e?e=0:0>e&&(e=Math.max(i+e,0)),i>e+t||(t=i-e);var n=this.slice(e,e+t),s=u.call(arguments,2),r=s.length;if(e===i)r&&this.push.apply(this,s);else{var o=Math.min(t,i-e),a=e+o,l=a+r-o,h=i-a,c=i-o;if(a>l)for(var d=0;h>d;++d)this[l+d]=this[a+d];else if(l>a)for(d=h;d--;)this[l+d]=this[a+d];if(r&&e===c)this.length=c,this.push.apply(this,s);else for(this.length=c+r,d=0;r>d;++d)this[e+d]=s[d]}return n};Array.isArray||(Array.isArray=function(e){return"[object Array]"==d(e)});var m=Object("a"),p="a"!=m[0]||!(0 in m);if(Array.prototype.forEach||(Array.prototype.forEach=function(e){var t=T(this),i=p&&"[object String]"==d(this)?this.split(""):t,n=arguments[1],s=-1,r=i.length>>>0;if("[object Function]"!=d(e))throw new TypeError;for(;r>++s;)s in i&&e.call(n,i[s],s,t)}),Array.prototype.map||(Array.prototype.map=function(e){var t=T(this),i=p&&"[object String]"==d(this)?this.split(""):t,n=i.length>>>0,s=Array(n),r=arguments[1];if("[object Function]"!=d(e))throw new TypeError(e+" is not a function");for(var o=0;n>o;o++)o in i&&(s[o]=e.call(r,i[o],o,t));return s}),Array.prototype.filter||(Array.prototype.filter=function(e){var t,i=T(this),n=p&&"[object String]"==d(this)?this.split(""):i,s=n.length>>>0,r=[],o=arguments[1];if("[object Function]"!=d(e))throw new TypeError(e+" is not a function");for(var a=0;s>a;a++)a in n&&(t=n[a],e.call(o,t,a,i)&&r.push(t));return r}),Array.prototype.every||(Array.prototype.every=function(e){var t=T(this),i=p&&"[object String]"==d(this)?this.split(""):t,n=i.length>>>0,s=arguments[1];if("[object Function]"!=d(e))throw new TypeError(e+" is not a function");for(var r=0;n>r;r++)if(r in i&&!e.call(s,i[r],r,t))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(e){var t=T(this),i=p&&"[object String]"==d(this)?this.split(""):t,n=i.length>>>0,s=arguments[1];if("[object Function]"!=d(e))throw new TypeError(e+" is not a function");for(var r=0;n>r;r++)if(r in i&&e.call(s,i[r],r,t))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(e){var t=T(this),i=p&&"[object String]"==d(this)?this.split(""):t,n=i.length>>>0;if("[object Function]"!=d(e))throw new TypeError(e+" is not a function");if(!n&&1==arguments.length)throw new TypeError("reduce of empty array with no initial value");var s,r=0;if(arguments.length>=2)s=arguments[1];else for(;;){if(r in i){s=i[r++];break}if(++r>=n)throw new TypeError("reduce of empty array with no initial value")}for(;n>r;r++)r in i&&(s=e.call(void 0,s,i[r],r,t));return s}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(e){var t=T(this),i=p&&"[object String]"==d(this)?this.split(""):t,n=i.length>>>0;if("[object Function]"!=d(e))throw new TypeError(e+" is not a function");if(!n&&1==arguments.length)throw new TypeError("reduceRight of empty array with no initial value");var s,r=n-1;if(arguments.length>=2)s=arguments[1];else for(;;){if(r in i){s=i[r--];break}if(0>--r)throw new TypeError("reduceRight of empty array with no initial value")}do r in this&&(s=e.call(void 0,s,i[r],r,t));while(r--);return s}),Array.prototype.indexOf&&-1==[0,1].indexOf(1,2)||(Array.prototype.indexOf=function(e){var t=p&&"[object String]"==d(this)?this.split(""):T(this),n=t.length>>>0;if(!n)return-1;var s=0;for(arguments.length>1&&(s=i(arguments[1])),s=s>=0?s:Math.max(0,n+s);n>s;s++)if(s in t&&t[s]===e)return s;return-1}),Array.prototype.lastIndexOf&&-1==[0,1].lastIndexOf(0,-3)||(Array.prototype.lastIndexOf=function(e){var t=p&&"[object String]"==d(this)?this.split(""):T(this),n=t.length>>>0;if(!n)return-1;var s=n-1;for(arguments.length>1&&(s=Math.min(s,i(arguments[1]))),s=s>=0?s:n-Math.abs(s);s>=0;s--)if(s in t&&e===t[s])return s;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(e){return e.__proto__||(e.constructor?e.constructor.prototype:c)}),!Object.getOwnPropertyDescriptor){var A="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(e,t){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError(A+e);if(g(e,t)){var i,n,s;if(i={enumerable:!0,configurable:!0},a){var l=e.__proto__;e.__proto__=c;var n=r(e,t),s=o(e,t);if(e.__proto__=l,n||s)return n&&(i.get=n),s&&(i.set=s),i}return i.value=e[t],i}}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(e){return Object.keys(e)}),!Object.create){var v;v=null===Object.prototype.__proto__?function(){return{__proto__:null}}:function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(e,t){var i;if(null===e)i=v();else{if("object"!=typeof e)throw new TypeError("typeof prototype["+typeof e+"] != 'object'");var n=function(){};n.prototype=e,i=new n,i.__proto__=e}return void 0!==t&&Object.defineProperties(i,t),i}}if(Object.defineProperty){var C=t({}),F="undefined"==typeof document||t(document.createElement("div"));if(!C||!F)var w=Object.defineProperty}if(!Object.defineProperty||w){var E="Property description must be an object: ",b="Object.defineProperty called on non-object: ",y="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(e,t,i){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError(b+e);if("object"!=typeof i&&"function"!=typeof i||null===i)throw new TypeError(E+i);if(w)try{return w.call(Object,e,t,i)}catch(l){}if(g(i,"value"))if(a&&(r(e,t)||o(e,t))){var h=e.__proto__;e.__proto__=c,delete e[t],e[t]=i.value,e.__proto__=h}else e[t]=i.value;else{if(!a)throw new TypeError(y);g(i,"get")&&n(e,t,i.get),g(i,"set")&&s(e,t,i.set)}return e}}Object.defineProperties||(Object.defineProperties=function(e,t){for(var i in t)g(t,i)&&Object.defineProperty(e,i,t[i]);return e}),Object.seal||(Object.seal=function(e){return e}),Object.freeze||(Object.freeze=function(e){return e});try{Object.freeze(function(){})}catch($){Object.freeze=function(e){return function(t){return"function"==typeof t?t:e(t)}}(Object.freeze)}if(Object.preventExtensions||(Object.preventExtensions=function(e){return e}),Object.isSealed||(Object.isSealed=function(){return!1}),Object.isFrozen||(Object.isFrozen=function(){return!1}),Object.isExtensible||(Object.isExtensible=function(e){if(Object(e)===e)throw new TypeError;for(var t="";g(e,t);)t+="?";e[t]=!0;var i=g(e,t);return delete e[t],i}),!Object.keys){var B=!0,D=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],S=D.length;for(var k in{toString:null})B=!1;Object.keys=function(e){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError("Object.keys called on a non-object");var t=[];for(var i in e)g(e,i)&&t.push(i);if(B)for(var n=0,s=S;s>n;n++){var r=D[n];g(e,r)&&t.push(r)}return t}}Date.now||(Date.now=function(){return(new Date).getTime()});var x=" \n\f\r \u2028\u2029";if(!String.prototype.trim||x.trim()){x="["+x+"]";var L=RegExp("^"+x+x+"*"),R=RegExp(x+x+"*$");String.prototype.trim=function(){return(this+"").replace(L,"").replace(R,"")}}var T=function(e){if(null==e)throw new TypeError("can't convert "+e+" to object");return Object(e)}}),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/regexp","ace/lib/es5-shim"],function(e){"use strict";e("./regexp"),e("./es5-shim")}),ace.define("ace/lib/dom",["require","exports","module"],function(e,t){"use strict";if("undefined"!=typeof document){var i="http://www.w3.org/1999/xhtml";t.getDocumentHead=function(e){return e||(e=document),e.head||e.getElementsByTagName("head")[0]||e.documentElement},t.createElement=function(e,t){return document.createElementNS?document.createElementNS(t||i,e):document.createElement(e)},t.hasCssClass=function(e,t){var i=(e.className||"").split(/\s+/g);return-1!==i.indexOf(t)},t.addCssClass=function(e,i){t.hasCssClass(e,i)||(e.className+=" "+i)},t.removeCssClass=function(e,t){for(var i=e.className.split(/\s+/g);;){var n=i.indexOf(t);if(-1==n)break;i.splice(n,1)}e.className=i.join(" ")},t.toggleCssClass=function(e,t){for(var i=e.className.split(/\s+/g),n=!0;;){var s=i.indexOf(t);if(-1==s)break;n=!1,i.splice(s,1)}return n&&i.push(t),e.className=i.join(" "),n},t.setCssClass=function(e,i,n){n?t.addCssClass(e,i):t.removeCssClass(e,i)},t.hasCssString=function(e,t){var i,n=0;if(t=t||document,t.createStyleSheet&&(i=t.styleSheets)){for(;i.length>n;)if(i[n++].owningElement.id===e)return!0}else if(i=t.getElementsByTagName("style"))for(;i.length>n;)if(i[n++].id===e)return!0;return!1},t.importCssString=function(e,n,s){if(s=s||document,n&&t.hasCssString(n,s))return null;var r;s.createStyleSheet?(r=s.createStyleSheet(),r.cssText=e,n&&(r.owningElement.id=n)):(r=s.createElementNS?s.createElementNS(i,"style"):s.createElement("style"),r.appendChild(s.createTextNode(e)),n&&(r.id=n),t.getDocumentHead(s).appendChild(r))},t.importCssStylsheet=function(e,i){if(i.createStyleSheet)i.createStyleSheet(e);else{var n=t.createElement("link");n.rel="stylesheet",n.href=e,t.getDocumentHead(i).appendChild(n)}},t.getInnerWidth=function(e){return parseInt(t.computedStyle(e,"paddingLeft"),10)+parseInt(t.computedStyle(e,"paddingRight"),10)+e.clientWidth},t.getInnerHeight=function(e){return parseInt(t.computedStyle(e,"paddingTop"),10)+parseInt(t.computedStyle(e,"paddingBottom"),10)+e.clientHeight},void 0!==window.pageYOffset?(t.getPageScrollTop=function(){return window.pageYOffset},t.getPageScrollLeft=function(){return window.pageXOffset}):(t.getPageScrollTop=function(){return document.body.scrollTop},t.getPageScrollLeft=function(){return document.body.scrollLeft}),t.computedStyle=window.getComputedStyle?function(e,t){return t?(window.getComputedStyle(e,"")||{})[t]||"":window.getComputedStyle(e,"")||{}}:function(e,t){return t?e.currentStyle[t]:e.currentStyle},t.scrollbarWidth=function(e){var i=t.createElement("ace_inner");i.style.width="100%",i.style.minWidth="0px",i.style.height="200px",i.style.display="block";var n=t.createElement("ace_outer"),s=n.style;s.position="absolute",s.left="-10000px",s.overflow="hidden",s.width="200px",s.minWidth="0px",s.height="150px",s.display="block",n.appendChild(i);var r=e.documentElement;r.appendChild(n);var o=i.offsetWidth;s.overflow="scroll";var a=i.offsetWidth;return o==a&&(a=n.clientWidth),r.removeChild(n),o-a},t.setInnerHtml=function(e,t){var i=e.cloneNode(!1);return i.innerHTML=t,e.parentNode.replaceChild(i,e),i},"textContent"in document.documentElement?(t.setInnerText=function(e,t){e.textContent=t},t.getInnerText=function(e){return e.textContent}):(t.setInnerText=function(e,t){e.innerText=t},t.getInnerText=function(e){return e.innerText}),t.getParentWindow=function(e){return e.defaultView||e.parentWindow}}}),ace.define("ace/lib/oop",["require","exports","module"],function(e,t){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var i in t)e[i]=t[i];return e},t.implement=function(e,i){t.mixin(e,i)}}),ace.define("ace/lib/keys",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/oop"],function(e,t){"use strict";e("./fixoldbrowsers");var i=e("./oop"),n=function(){var e,t,n={MODIFIER_KEYS:{16:"Shift",17:"Ctrl",18:"Alt",224:"Meta"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,"super":8,meta:8,command:8,cmd: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",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",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:".",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}};for(t in n.FUNCTION_KEYS)e=n.FUNCTION_KEYS[t].toLowerCase(),n[e]=parseInt(t,10);for(t in n.PRINTABLE_KEYS)e=n.PRINTABLE_KEYS[t].toLowerCase(),n[e]=parseInt(t,10);return i.mixin(n,n.MODIFIER_KEYS),i.mixin(n,n.PRINTABLE_KEYS),i.mixin(n,n.FUNCTION_KEYS),n.enter=n["return"],n.escape=n.esc,n.del=n["delete"],n[173]="-",function(){for(var e=["cmd","ctrl","alt","shift"],t=Math.pow(2,e.length);t--;)n.KEY_MODS[t]=e.filter(function(e){return t&n.KEY_MODS[e]}).join("-")+"-"}(),n.KEY_MODS[0]="",n.KEY_MODS[-1]="input",n}();i.mixin(t,n),t.keyCodeToString=function(e){var t=n[e];return"string"!=typeof t&&(t=String.fromCharCode(e)),t.toLowerCase()}}),ace.define("ace/lib/useragent",["require","exports","module"],function(e,t){"use strict";if(t.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},t.getOS=function(){return t.isMac?t.OS.MAC:t.isLinux?t.OS.LINUX:t.OS.WINDOWS},"object"==typeof navigator){var i=(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase(),n=navigator.userAgent;t.isWin="win"==i,t.isMac="mac"==i,t.isLinux="linux"==i,t.isIE="Microsoft Internet Explorer"==navigator.appName||navigator.appName.indexOf("MSAppHost")>=0?parseFloat((n.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((n.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),t.isOldIE=t.isIE&&9>t.isIE,t.isGecko=t.isMozilla=(window.Controllers||window.controllers)&&"Gecko"===window.navigator.product,t.isOldGecko=t.isGecko&&4>parseInt((n.match(/rv\:(\d+)/)||[])[1],10),t.isOpera=window.opera&&"[object Opera]"==Object.prototype.toString.call(window.opera),t.isWebKit=parseFloat(n.split("WebKit/")[1])||void 0,t.isChrome=parseFloat(n.split(" Chrome/")[1])||void 0,t.isAIR=n.indexOf("AdobeAIR")>=0,t.isIPad=n.indexOf("iPad")>=0,t.isTouchPad=n.indexOf("TouchPad")>=0,t.isChromeOS=n.indexOf(" CrOS ")>=0}}),ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t){"use strict";function i(e,t,i){var l=r(t);if(!s.isMac&&o){if((o[91]||o[92])&&(l|=8),o.altGr){if(3==(3&l))return;o.altGr=0}if(18===i||17===i){var h="location"in t?t.location:t.keyLocation;if(17===i&&1===h)a=t.timeStamp;else if(18===i&&3===l&&2===h){var c=-a;a=t.timeStamp,c+=a,3>c&&(o.altGr=!0)}}}if(i in n.MODIFIER_KEYS){switch(n.MODIFIER_KEYS[i]){case"Alt":l=2;break;case"Shift":l=4;break;case"Ctrl":l=1;break;default:l=8}i=-1}if(8&l&&(91===i||93===i)&&(i=-1),!l&&13===i){var h="location"in t?t.location:t.keyLocation;if(3===h&&(e(t,l,-i),t.defaultPrevented))return}if(s.isChromeOS&&8&l){if(e(t,l,i),t.defaultPrevented)return;l&=-9}return l||i in n.FUNCTION_KEYS||i in n.PRINTABLE_KEYS?e(t,l,i):!1}var n=e("./keys"),s=e("./useragent");t.addListener=function(e,t,i){if(e.addEventListener)return e.addEventListener(t,i,!1);if(e.attachEvent){var n=function(){i.call(e,window.event)};i._wrapper=n,e.attachEvent("on"+t,n)}},t.removeListener=function(e,t,i){return e.removeEventListener?e.removeEventListener(t,i,!1):(e.detachEvent&&e.detachEvent("on"+t,i._wrapper||i),void 0)},t.stopEvent=function(e){return t.stopPropagation(e),t.preventDefault(e),!1},t.stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},t.preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},t.getButton=function(e){return"dblclick"==e.type?0:"contextmenu"==e.type||s.isMac&&e.ctrlKey&&!e.altKey&&!e.shiftKey?2:e.preventDefault?e.button:{1:0,2:2,4:1}[e.button]},t.capture=function(e,i,n){function s(e){i&&i(e),n&&n(e),t.removeListener(document,"mousemove",i,!0),t.removeListener(document,"mouseup",s,!0),t.removeListener(document,"dragstart",s,!0)}return t.addListener(document,"mousemove",i,!0),t.addListener(document,"mouseup",s,!0),t.addListener(document,"dragstart",s,!0),s},t.addMouseWheelListener=function(e,i){"onmousewheel"in e?t.addListener(e,"mousewheel",function(e){var t=8;void 0!==e.wheelDeltaX?(e.wheelX=-e.wheelDeltaX/t,e.wheelY=-e.wheelDeltaY/t):(e.wheelX=0,e.wheelY=-e.wheelDelta/t),i(e)}):"onwheel"in e?t.addListener(e,"wheel",function(e){var t=.35;switch(e.deltaMode){case e.DOM_DELTA_PIXEL:e.wheelX=e.deltaX*t||0,e.wheelY=e.deltaY*t||0;break;case e.DOM_DELTA_LINE:case e.DOM_DELTA_PAGE:e.wheelX=5*(e.deltaX||0),e.wheelY=5*(e.deltaY||0)}i(e)}):t.addListener(e,"DOMMouseScroll",function(e){e.axis&&e.axis==e.HORIZONTAL_AXIS?(e.wheelX=5*(e.detail||0),e.wheelY=0):(e.wheelX=0,e.wheelY=5*(e.detail||0)),i(e)})},t.addMultiMouseDownListener=function(e,i,n,r){var o,a,l,h=0,c={2:"dblclick",3:"tripleclick",4:"quadclick"};t.addListener(e,"mousedown",function(e){if(0!==t.getButton(e)?h=0:e.detail>1?(h++,h>4&&(h=1)):h=1,s.isIE){var u=Math.abs(e.clientX-o)>5||Math.abs(e.clientY-a)>5;(!l||u)&&(h=1),l&&clearTimeout(l),l=setTimeout(function(){l=null},i[h-1]||600),1==h&&(o=e.clientX,a=e.clientY)}if(e._clicks=h,n[r]("mousedown",e),h>4)h=0;else if(h>1)return n[r](c[h],e)}),s.isOldIE&&t.addListener(e,"dblclick",function(e){h=2,l&&clearTimeout(l),l=setTimeout(function(){l=null},i[h-1]||600),n[r]("mousedown",e),n[r](c[h],e)})};var r=!s.isMac||!s.isOpera||"KeyboardEvent"in window?function(e){return 0|(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0)}:function(e){return 0|(e.metaKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.ctrlKey?8:0)};t.getModifierString=function(e){return n.KEY_MODS[r(e)]};var o=null,a=0;if(t.addCommandKeyListener=function(e,n){var r=t.addListener;if(s.isOldGecko||s.isOpera&&!("KeyboardEvent"in window)){var a=null;r(e,"keydown",function(e){a=e.keyCode}),r(e,"keypress",function(e){return i(n,e,a)})}else{var l=null;r(e,"keydown",function(e){o[e.keyCode]=!0;var t=i(n,e,e.keyCode);return l=e.defaultPrevented,t}),r(e,"keypress",function(e){l&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(t.stopEvent(e),l=null)}),r(e,"keyup",function(e){o[e.keyCode]=null}),o||(o=Object.create(null),r(window,"focus",function(){o=Object.create(null)}))}},window.postMessage&&!s.isOldIE){var l=1;t.nextTick=function(e,i){i=i||window;var n="zero-timeout-message-"+l;t.addListener(i,"message",function s(r){r.data==n&&(t.stopPropagation(r),t.removeListener(i,"message",s),e())}),i.postMessage(n,"*")}}t.nextFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame,t.nextFrame=t.nextFrame?t.nextFrame.bind(window):function(e){setTimeout(e,17)}}),ace.define("ace/lib/lang",["require","exports","module"],function(e,t){"use strict";t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){for(var i="";t>0;)1&t&&(i+=e),(t>>=1)&&(e+=e);return i};var i=/^\s\s*/,n=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(i,"")},t.stringTrimRight=function(e){return e.replace(n,"")},t.copyObject=function(e){var t={};for(var i in e)t[i]=e[i];return t},t.copyArray=function(e){for(var t=[],i=0,n=e.length;n>i;i++)t[i]=e[i]&&"object"==typeof e[i]?this.copyObject(e[i]):e[i];return t},t.deepCopy=function(e){if("object"!=typeof e||!e)return e;var i=e.constructor;if(i===RegExp)return e;var n=i();for(var s in e)n[s]="object"==typeof e[s]?t.deepCopy(e[s]):e[s];return n},t.arrayToMap=function(e){for(var t={},i=0;e.length>i;i++)t[e[i]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var i in e)t[i]=e[i];return t},t.arrayRemove=function(e,t){for(var i=0;e.length>=i;i++)t===e[i]&&e.splice(i,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},t.escapeHTML=function(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},t.getMatchOffsets=function(e,t){var i=[];return e.replace(t,function(e){i.push({offset:arguments[arguments.length-2],length:e.length})}),i},t.deferredCall=function(e){var t=null,i=function(){t=null,e()},n=function(e){return n.cancel(),t=setTimeout(i,e||0),n};return n.schedule=n,n.call=function(){return this.cancel(),e(),n},n.cancel=function(){return clearTimeout(t),t=null,n},n.isPending=function(){return t},n},t.delayedCall=function(e,t){var i=null,n=function(){i=null,e()},s=function(e){null==i&&(i=setTimeout(n,e||t))};return s.delay=function(e){i&&clearTimeout(i),i=setTimeout(n,e||t)},s.schedule=s,s.call=function(){this.cancel(),e()},s.cancel=function(){i&&clearTimeout(i),i=null},s.isPending=function(){return i},s}}),ace.define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/dom","ace/lib/lang"],function(e,t){"use strict";var i=e("../lib/event"),n=e("../lib/useragent"),s=e("../lib/dom"),r=e("../lib/lang"),o=18>n.isChrome,a=n.isIE,l=function(e,t){function l(e){if(!m){if(S)t=0,i=e?0:u.value.length-1;else var t=e?2:1,i=2;try{u.setSelectionRange(t,i)}catch(n){}}}function h(){m||(u.value=d,n.isWebKit&&w.schedule())}function c(){clearTimeout(z),z=setTimeout(function(){p&&(u.style.cssText=p,p=""),null==t.renderer.$keepTextAreaAtCursor&&(t.renderer.$keepTextAreaAtCursor=!0,t.renderer.$moveTextAreaToCursor())},n.isOldIE?200:0)}var u=s.createElement("textarea");u.className="ace_text-input",n.isTouchPad&&u.setAttribute("x-palm-disable-auto-cap",!0),u.wrap="off",u.autocorrect="off",u.autocapitalize="off",u.spellcheck=!1,u.style.opacity="0",n.isOldIE&&(u.style.top="-100px"),e.insertBefore(u,e.firstChild);var d="",g=!1,f=!1,m=!1,p="",A=!0;try{var v=document.activeElement===u}catch(C){}i.addListener(u,"blur",function(e){t.onBlur(e),v=!1}),i.addListener(u,"focus",function(e){v=!0,t.onFocus(e),l()}),this.focus=function(){u.focus()},this.blur=function(){u.blur()},this.isFocused=function(){return v};var F=r.delayedCall(function(){v&&l(A)}),w=r.delayedCall(function(){m||(u.value=d,v&&l())});n.isWebKit||t.addEventListener("changeSelection",function(){t.selection.isEmpty()!=A&&(A=!A,F.schedule())}),h(),v&&t.onFocus();var E=function(e){return 0===e.selectionStart&&e.selectionEnd===e.value.length};if(!u.setSelectionRange&&u.createTextRange&&(u.setSelectionRange=function(e,t){var i=this.createTextRange();i.collapse(!0),i.moveStart("character",e),i.moveEnd("character",t),i.select()},E=function(e){try{var t=e.ownerDocument.selection.createRange()}catch(i){}return t&&t.parentElement()==e?t.text==e.value:!1}),n.isOldIE){var b=!1,y=function(e){if(!b){var t=u.value;if(!m&&t&&t!=d){if(e&&t==d[0])return $.schedule();x(t),b=!0,h(),b=!1}}},$=r.delayedCall(y);i.addListener(u,"propertychange",y);var B={13:1,27:1};i.addListener(u,"keyup",function(e){return!m||u.value&&!B[e.keyCode]||setTimeout(P,0),129>(u.value.charCodeAt(0)||0)?$.call():(m?W():I(),void 0)}),i.addListener(u,"keydown",function(){$.schedule(50)})}var D=function(){g?g=!1:E(u)?(t.selectAll(),l()):S&&l(t.selection.isEmpty())},S=null;this.setInputHandler=function(e){S=e},this.getInputHandler=function(){return S};var k=!1,x=function(e){S&&(e=S(e),S=null),f?(l(),e&&t.onPaste(e),f=!1):e==d.charAt(0)?k?t.execCommand("del",{source:"ace"}):t.execCommand("backspace",{source:"ace"}):(e.substring(0,2)==d?e=e.substr(2):e.charAt(0)==d.charAt(0)?e=e.substr(1):e.charAt(e.length-1)==d.charAt(0)&&(e=e.slice(0,-1)),e.charAt(e.length-1)==d.charAt(0)&&(e=e.slice(0,-1)),e&&t.onTextInput(e)),k&&(k=!1)},L=function(){if(!m){var e=u.value;x(e),h()}},R=function(e,t){var i=e.clipboardData||window.clipboardData;if(i&&!o){var n=a?"Text":"text/plain";return t?i.setData(n,t)!==!1:i.getData(n)}},T=function(e,n){var s=t.getCopyText();return s?(R(e,s)?(n?t.onCut():t.onCopy(),i.preventDefault(e)):(g=!0,u.value=s,u.select(),setTimeout(function(){g=!1,h(),l(),n?t.onCut():t.onCopy()})),void 0):i.preventDefault(e)},M=function(e){T(e,!0)},_=function(e){T(e,!1)},O=function(e){var s=R(e);"string"==typeof s?(s&&t.onPaste(s),n.isIE&&setTimeout(l),i.preventDefault(e)):(u.value="",f=!0)};i.addCommandKeyListener(u,t.onCommandKey.bind(t)),i.addListener(u,"select",D),i.addListener(u,"input",L),i.addListener(u,"cut",M),i.addListener(u,"copy",_),i.addListener(u,"paste",O),"oncut"in u&&"oncopy"in u&&"onpaste"in u||i.addListener(e,"keydown",function(e){if((!n.isMac||e.metaKey)&&e.ctrlKey)switch(e.keyCode){case 67:_(e);break;case 86:O(e);break;case 88:M(e)}});var I=function(){m||!t.onCompositionStart||t.$readOnly||(m={},t.onCompositionStart(),setTimeout(W,0),t.on("mousedown",P),t.selection.isEmpty()||(t.insert(""),t.session.markUndoGroup(),t.selection.clearSelection()),t.session.markUndoGroup())},W=function(){if(m&&t.onCompositionUpdate&&!t.$readOnly){var e=u.value.replace(/\x01/g,"");if(m.lastValue!==e&&(t.onCompositionUpdate(e),m.lastValue&&t.undo(),m.lastValue=e,m.lastValue)){var i=t.selection.getRange();t.insert(m.lastValue),t.session.markUndoGroup(),m.range=t.selection.getRange(),t.selection.setRange(i),t.selection.clearSelection()}}},P=function(e){if(t.onCompositionEnd&&!t.$readOnly){var i=m;m=!1;var n=setTimeout(function(){n=null;var e=u.value.replace(/\x01/g,"");m||(e==i.lastValue?h():!i.lastValue&&e&&(h(),x(e)))});S=function(e){return n&&clearTimeout(n),e=e.replace(/\x01/g,""),e==i.lastValue?"":(i.lastValue&&n&&t.undo(),e)},t.onCompositionEnd(),t.removeListener("mousedown",P),"compositionend"==e.type&&i.range&&t.selection.setRange(i.range)}},H=r.delayedCall(W,50);i.addListener(u,"compositionstart",I),n.isGecko?i.addListener(u,"text",function(){H.schedule()}):(i.addListener(u,"keyup",function(){H.schedule()}),i.addListener(u,"keydown",function(){H.schedule()})),i.addListener(u,"compositionend",P),this.getElement=function(){return u},this.setReadOnly=function(e){u.readOnly=e},this.onContextMenu=function(e){k=!0,l(t.selection.isEmpty()),t._emit("nativecontextmenu",{target:t,domEvent:e}),this.moveToMouse(e,!0)},this.moveToMouse=function(e,r){if(r||!n.isOldIE){p||(p=u.style.cssText),u.style.cssText=(r?"z-index:100000;":"")+"height:"+u.style.height+";"+(n.isIE?"opacity:0.1;":"");var o=t.container.getBoundingClientRect(),a=s.computedStyle(t.container),l=o.top+(parseInt(a.borderTopWidth)||0),h=o.left+(parseInt(o.borderLeftWidth)||0),d=o.bottom-l-u.clientHeight-2,g=function(e){u.style.left=e.clientX-h-2+"px",u.style.top=Math.min(e.clientY-l-2,d)+"px"};g(e),"mousedown"==e.type&&(t.renderer.$keepTextAreaAtCursor&&(t.renderer.$keepTextAreaAtCursor=null),n.isWin&&!n.isOldIE&&i.capture(t.container,g,c))}},this.onContextMenuClose=c;var z,N=function(e){t.textInput.onContextMenu(e),c()};i.addListener(t.renderer.scroller,"contextmenu",N),i.addListener(u,"contextmenu",N)};t.TextInput=l}),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(e,t){"use strict";function i(e){e.$clickSelection=null;var t=e.editor;t.setDefaultHandler("mousedown",this.onMouseDown.bind(e)),t.setDefaultHandler("dblclick",this.onDoubleClick.bind(e)),t.setDefaultHandler("tripleclick",this.onTripleClick.bind(e)),t.setDefaultHandler("quadclick",this.onQuadClick.bind(e)),t.setDefaultHandler("mousewheel",this.onMouseWheel.bind(e));var i=["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"];i.forEach(function(t){e[t]=this[t]},this),e.selectByLines=this.extendSelectionBy.bind(e,"getLineRange"),e.selectByWords=this.extendSelectionBy.bind(e,"getWordRange")}function n(e,t,i,n){return Math.sqrt(Math.pow(i-e,2)+Math.pow(n-t,2))}function s(e,t){if(e.start.row==e.end.row)var i=2*t.column-e.start.column-e.end.column;else if(e.start.row!=e.end.row-1||e.start.column||e.end.column)var i=2*t.row-e.start.row-e.end.row;else var i=t.column-4;return 0>i?{cursor:e.start,anchor:e.end}:{cursor:e.end,anchor:e.start}
|
5 |
+
}e("../lib/dom"),e("../lib/event"),e("../lib/useragent");var r=0;(function(){this.onMouseDown=function(e){var t=e.inSelection(),i=e.getDocumentPosition();this.mousedownEvent=e;var n=this.editor,s=e.getButton();if(0!==s){var r=n.getSelectionRange(),o=r.isEmpty();return o&&n.selection.moveToPosition(i),n.textInput.onContextMenu(e.domEvent),void 0}return this.mousedownEvent.time=Date.now(),!t||n.isFocused()||(n.focus(),!this.$focusTimout||this.$clickSelection||n.inMultiSelectMode)?(this.captureMouse(e),this.startSelect(i,e.domEvent._clicks>1),e.preventDefault()):(this.setState("focusWait"),this.captureMouse(e),void 0)},this.startSelect=function(e,t){e=e||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var i=this.editor;this.mousedownEvent.getShiftKey()?i.selection.selectToPosition(e):t||i.selection.moveToPosition(e),t||this.select(),i.renderer.scroller.setCapture&&i.renderer.scroller.setCapture(),i.setStyle("ace_selecting"),this.setState("select")},this.select=function(){var e,t=this.editor,i=t.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var n=this.$clickSelection.comparePoint(i);if(-1==n)e=this.$clickSelection.end;else if(1==n)e=this.$clickSelection.start;else{var r=s(this.$clickSelection,i);i=r.cursor,e=r.anchor}t.selection.setSelectionAnchor(e.row,e.column)}t.selection.selectToPosition(i),t.renderer.scrollCursorIntoView()},this.extendSelectionBy=function(e){var t,i=this.editor,n=i.renderer.screenToTextCoordinates(this.x,this.y),r=i.selection[e](n.row,n.column);if(this.$clickSelection){var o=this.$clickSelection.comparePoint(r.start),a=this.$clickSelection.comparePoint(r.end);if(-1==o&&0>=a)t=this.$clickSelection.end,(r.end.row!=n.row||r.end.column!=n.column)&&(n=r.start);else if(1==a&&o>=0)t=this.$clickSelection.start,(r.start.row!=n.row||r.start.column!=n.column)&&(n=r.end);else if(-1==o&&1==a)n=r.end,t=r.start;else{var l=s(this.$clickSelection,n);n=l.cursor,t=l.anchor}i.selection.setSelectionAnchor(t.row,t.column)}i.selection.selectToPosition(n),i.renderer.scrollCursorIntoView()},this.selectEnd=this.selectAllEnd=this.selectByWordsEnd=this.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting"),this.editor.renderer.scroller.releaseCapture&&this.editor.renderer.scroller.releaseCapture()},this.focusWait=function(){var e=n(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),t=Date.now();(e>r||t-this.mousedownEvent.time>this.$focusTimout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},this.onDoubleClick=function(e){var t=e.getDocumentPosition(),i=this.editor,n=i.session,s=n.getBracketRange(t);s?(s.isEmpty()&&(s.start.column--,s.end.column++),this.setState("select")):(s=i.selection.getWordRange(t.row,t.column),this.setState("selectByWords")),this.$clickSelection=s,this.select()},this.onTripleClick=function(e){var t=e.getDocumentPosition(),i=this.editor;this.setState("selectByLines");var n=i.getSelectionRange();n.isMultiLine()&&n.contains(t.row,t.column)?(this.$clickSelection=i.selection.getLineRange(n.start.row),this.$clickSelection.end=i.selection.getLineRange(n.end.row).end):this.$clickSelection=i.selection.getLineRange(t.row),this.select()},this.onQuadClick=function(){var e=this.editor;e.selectAll(),this.$clickSelection=e.getSelectionRange(),this.setState("selectAll")},this.onMouseWheel=function(e){if(!e.getAccelKey()){e.getShiftKey()&&e.wheelY&&!e.wheelX&&(e.wheelX=e.wheelY,e.wheelY=0);var t=e.domEvent.timeStamp,i=t-(this.$lastScrollTime||0),n=this.editor,s=n.renderer.isScrollableBy(e.wheelX*e.speed,e.wheelY*e.speed);return s||200>i?(this.$lastScrollTime=t,n.renderer.scrollBy(e.wheelX*e.speed,e.wheelY*e.speed),e.stop()):void 0}}}).call(i.prototype),t.DefaultHandlers=i}),ace.define("ace/tooltip",["require","exports","module","ace/lib/oop","ace/lib/dom"],function(e,t){"use strict";function i(e){this.isOpen=!1,this.$element=null,this.$parentNode=e}e("./lib/oop");var n=e("./lib/dom");(function(){this.$init=function(){return this.$element=n.createElement("div"),this.$element.className="ace_tooltip",this.$element.style.display="none",this.$parentNode.appendChild(this.$element),this.$element},this.getElement=function(){return this.$element||this.$init()},this.setText=function(e){n.setInnerText(this.getElement(),e)},this.setHtml=function(e){this.getElement().innerHTML=e},this.setPosition=function(e,t){this.getElement().style.left=e+"px",this.getElement().style.top=t+"px"},this.setClassName=function(e){n.addCssClass(this.getElement(),e)},this.show=function(e,t,i){null!=e&&this.setText(e),null!=t&&null!=i&&this.setPosition(t,i),this.isOpen||(this.getElement().style.display="block",this.isOpen=!0)},this.hide=function(){this.isOpen&&(this.getElement().style.display="none",this.isOpen=!1)},this.getHeight=function(){return this.getElement().offsetHeight},this.getWidth=function(){return this.getElement().offsetWidth}}).call(i.prototype),t.Tooltip=i}),ace.define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event","ace/tooltip"],function(e,t){"use strict";function i(e){function t(){var t=u.getDocumentPosition().row,n=l.$annotations[t];if(!n)return i();var s=a.session.getLength();if(t==s){var o=a.renderer.pixelToScreenCoordinates(0,u.y).row,c=u.$pos;if(o>a.session.documentToScreenRow(c.row,c.column))return i()}if(d!=n)if(d=n.text.join("<br/>"),h.setHtml(d),h.show(),a.on("mousewheel",i),e.$tooltipFollowsMouse)r(u);else{var g=l.$cells[a.session.documentToScreenRow(t,0)].element,f=g.getBoundingClientRect(),m=h.getElement().style;m.left=f.right+"px",m.top=f.bottom+"px"}}function i(){c&&(c=clearTimeout(c)),d&&(h.hide(),d=null,a.removeEventListener("mousewheel",i))}function r(e){h.setPosition(e.x,e.y)}var a=e.editor,l=a.renderer.$gutterLayer,h=new n(a.container);e.editor.setDefaultHandler("guttermousedown",function(t){if(a.isFocused()&&0==t.getButton()){var i=l.getRegion(t);if("foldWidgets"!=i){var n=t.getDocumentPosition().row,s=a.session.selection;if(t.getShiftKey())s.selectTo(n,0);else{if(2==t.domEvent.detail)return a.selectAll(),t.preventDefault();e.$clickSelection=a.selection.getLineRange(n)}return e.setState("selectByLines"),e.captureMouse(t),t.preventDefault()}}});var c,u,d;e.editor.setDefaultHandler("guttermousemove",function(n){var o=n.domEvent.target||n.domEvent.srcElement;return s.hasCssClass(o,"ace_fold-widget")?i():(d&&e.$tooltipFollowsMouse&&r(n),u=n,c||(c=setTimeout(function(){c=null,u&&!e.isMousePressed?t():i()},50)),void 0)}),o.addListener(a.renderer.$gutter,"mouseout",function(){u=null,d&&!c&&(c=setTimeout(function(){c=null,i()},50))}),a.on("changeSession",i)}function n(e){a.call(this,e)}var s=e("../lib/dom"),r=e("../lib/oop"),o=e("../lib/event"),a=e("../tooltip").Tooltip;r.inherits(n,a),function(){this.setPosition=function(e,t){var i=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,s=this.getWidth(),r=this.getHeight();e+=15,t+=15,e+s>i&&(e-=e+s-i),t+r>n&&(t-=20+r),a.prototype.setPosition.call(this,e,t)}}.call(n.prototype),t.GutterHandler=i}),ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,t){"use strict";var i=e("../lib/event"),n=e("../lib/useragent"),s=t.MouseEvent=function(e,t){this.domEvent=e,this.editor=t,this.x=this.clientX=e.clientX,this.y=this.clientY=e.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1};(function(){this.stopPropagation=function(){i.stopPropagation(this.domEvent),this.propagationStopped=!0},this.preventDefault=function(){i.preventDefault(this.domEvent),this.defaultPrevented=!0},this.stop=function(){this.stopPropagation(),this.preventDefault()},this.getDocumentPosition=function(){return this.$pos?this.$pos:(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY),this.$pos)},this.inSelection=function(){if(null!==this.$inSelection)return this.$inSelection;var e=this.editor,t=e.getSelectionRange();if(t.isEmpty())this.$inSelection=!1;else{var i=this.getDocumentPosition();this.$inSelection=t.contains(i.row,i.column)}return this.$inSelection},this.getButton=function(){return i.getButton(this.domEvent)},this.getShiftKey=function(){return this.domEvent.shiftKey},this.getAccelKey=n.isMac?function(){return this.domEvent.metaKey}:function(){return this.domEvent.ctrlKey}}).call(s.prototype)}),ace.define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(e,t){"use strict";function i(e){function t(e,t){var i=Date.now(),s=!t||e.row!=t.row,r=!t||e.column!=t.column;if(!S||s||r)p.$blockScrolling+=1,p.moveCursorToPosition(e),p.$blockScrolling-=1,S=i,k={x:F,y:w};else{var o=n(k.x,k.y,F,w);o>h?S=null:i-S>=l&&(p.renderer.scrollCursorIntoView(),S=null)}}function i(e,t){var i=Date.now(),n=p.renderer.layerConfig.lineHeight,s=p.renderer.layerConfig.characterWidth,r=p.renderer.scroller.getBoundingClientRect(),o={x:{left:F-r.left,right:r.right-F},y:{top:w-r.top,bottom:r.bottom-w}},l=Math.min(o.x.left,o.x.right),h=Math.min(o.y.top,o.y.bottom),c={row:e.row,column:e.column};2>=l/s&&(c.column+=o.x.left<o.x.right?-3:2),1>=h/n&&(c.row+=o.y.top<o.y.bottom?-1:1);var u=e.row!=c.row,d=e.column!=c.column,g=!t||e.row!=t.row;u||d&&!g?D?i-D>=a&&p.renderer.scrollCursorIntoView(c):D=i:D=null}function c(){var e=y;y=p.renderer.screenToTextCoordinates(F,w),t(y,e),i(y,e)}function u(){b=p.selection.toOrientedRange(),C=p.session.addMarker(b,"ace_selection",p.getSelectionStyle()),p.clearSelection(),p.isFocused()&&p.renderer.$cursorLayer.setBlinking(!1),clearInterval(E),c(),E=setInterval(c,20),L=0,r.addListener(document,"mousemove",g)}function d(){clearInterval(E),p.session.removeMarker(C),C=null,p.$blockScrolling+=1,p.selection.fromOrientedRange(b),p.$blockScrolling-=1,p.isFocused()&&!B&&p.renderer.$cursorLayer.setBlinking(!p.getReadOnly()),b=null,y=null,L=0,D=null,S=null,r.removeListener(document,"mousemove",g)}function g(){null==R&&(R=setTimeout(function(){null!=R&&C&&d()},20))}function f(e){var t=e.types;return!t||Array.prototype.some.call(t,function(e){return"text/plain"==e||"Text"==e})}function m(e){var t=["copy","copymove","all","uninitialized"],i=["move","copymove","linkmove","all","uninitialized"],n=o.isMac?e.altKey:e.ctrlKey,s="uninitialized";try{s=e.dataTransfer.effectAllowed.toLowerCase()}catch(e){}var r="none";return n&&t.indexOf(s)>=0?r="copy":i.indexOf(s)>=0?r="move":t.indexOf(s)>=0&&(r="copy"),r}var p=e.editor,A=s.createElement("img");A.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",o.isOpera&&(A.style.cssText="width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;");var v=["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"];v.forEach(function(t){e[t]=this[t]},this),p.addEventListener("mousedown",this.onMouseDown.bind(e));var C,F,w,E,b,y,$,B,D,S,k,x=p.container,L=0;this.onDragStart=function(e){if(this.cancelDrag||!x.draggable){var t=this;return setTimeout(function(){t.startSelect(),t.captureMouse(e)},0),e.preventDefault()}b=p.getSelectionRange();var i=e.dataTransfer;i.effectAllowed=p.getReadOnly()?"copy":"copyMove",o.isOpera&&(p.container.appendChild(A),A.scrollTop=0),i.setDragImage&&i.setDragImage(A,0,0),o.isOpera&&p.container.removeChild(A),i.clearData(),i.setData("Text",p.session.getTextRange()),B=!0,this.setState("drag")},this.onDragEnd=function(e){if(x.draggable=!1,B=!1,this.setState(null),!p.getReadOnly()){var t=e.dataTransfer.dropEffect;$||"move"!=t||p.session.remove(p.getSelectionRange()),p.renderer.$cursorLayer.setBlinking(!0)}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(e){return!p.getReadOnly()&&f(e.dataTransfer)?(F=e.clientX,w=e.clientY,C||u(),L++,e.dataTransfer.dropEffect=$=m(e),r.preventDefault(e)):void 0},this.onDragOver=function(e){return!p.getReadOnly()&&f(e.dataTransfer)?(F=e.clientX,w=e.clientY,C||(u(),L++),null!==R&&(R=null),e.dataTransfer.dropEffect=$=m(e),r.preventDefault(e)):void 0},this.onDragLeave=function(e){return L--,0>=L&&C?(d(),$=null,r.preventDefault(e)):void 0},this.onDrop=function(e){if(y){var t=e.dataTransfer;if(B)switch($){case"move":b=b.contains(y.row,y.column)?{start:y,end:y}:p.moveText(b,y);break;case"copy":b=p.moveText(b,y,!0)}else{var i=t.getData("Text");b={start:y,end:p.session.insert(y,i)},p.focus(),$=null}return d(),r.preventDefault(e)}},r.addListener(x,"dragstart",this.onDragStart.bind(e)),r.addListener(x,"dragend",this.onDragEnd.bind(e)),r.addListener(x,"dragenter",this.onDragEnter.bind(e)),r.addListener(x,"dragover",this.onDragOver.bind(e)),r.addListener(x,"dragleave",this.onDragLeave.bind(e)),r.addListener(x,"drop",this.onDrop.bind(e));var R=null}function n(e,t,i,n){return Math.sqrt(Math.pow(i-e,2)+Math.pow(n-t,2))}var s=e("../lib/dom"),r=e("../lib/event"),o=e("../lib/useragent"),a=200,l=200,h=5;(function(){this.dragWait=function(){var e=Date.now()-this.mousedownEvent.time;e>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var e=this.editor.container;e.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(){this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly()),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var e=this.editor,t=e.container;t.draggable=!0,e.renderer.$cursorLayer.setBlinking(!1),e.setStyle("ace_dragging");var i=o.isWin?"default":"move";e.renderer.setCursorStyle(i),this.setState("dragReady")},this.onMouseDrag=function(){var e=this.editor.container;if(o.isIE&&"dragReady"==this.state){var t=n(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);t>3&&e.dragDrop()}if("dragWait"===this.state){var t=n(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);t>0&&(e.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(e){if(this.$dragEnabled){this.mousedownEvent=e;var t=this.editor,i=e.inSelection(),n=e.getButton(),s=e.domEvent.detail||1;if(1===s&&0===n&&i){if(e.editor.inMultiSelectMode&&(e.getAccelKey()||e.getShiftKey()))return;this.mousedownEvent.time=Date.now();var r=e.domEvent.target||e.domEvent.srcElement;if("unselectable"in r&&(r.unselectable="on"),t.getDragDelay()){if(o.isWebKit){this.cancelDrag=!0;var a=t.container;a.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(e,this.onMouseDrag.bind(this)),e.defaultPrevented=!0}}}}).call(i.prototype),t.DragdropHandler=i}),ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(e,t){"use strict";var i=e("./dom");t.get=function(e,t){var i=new XMLHttpRequest;i.open("GET",e,!0),i.onreadystatechange=function(){4===i.readyState&&t(i.responseText)},i.send(null)},t.loadScript=function(e,t){var n=i.getDocumentHead(),s=document.createElement("script");s.src=e,n.appendChild(s),s.onload=s.onreadystatechange=function(e,i){(i||!s.readyState||"loaded"==s.readyState||"complete"==s.readyState)&&(s=s.onload=s.onreadystatechange=null,i||t())}},t.qualifyURL=function(e){var t=document.createElement("a");return t.href=e,t.href}}),ace.define("ace/lib/event_emitter",["require","exports","module"],function(e,t){"use strict";var i={},n=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};i._emit=i._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var i=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(i.length||r){"object"==typeof t&&t||(t={}),t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=n),t.preventDefault||(t.preventDefault=s),i=i.slice();for(var o=0;i.length>o&&(i[o](t,this),!t.propagationStopped);o++);return r&&!t.defaultPrevented?r(t,this):void 0}},i._signal=function(e,t){var i=(this._eventRegistry||{})[e];if(i){i=i.slice();for(var n=0;i.length>n;n++)i[n](t,this)}},i.once=function(e,t){var i=this;t&&this.addEventListener(e,function n(){i.removeEventListener(e,n),t.apply(null,arguments)})},i.setDefaultHandler=function(e,t){var i=this._defaultHandlers;if(i||(i=this._defaultHandlers={_disabled_:{}}),i[e]){var n=i[e],s=i._disabled_[e];s||(i._disabled_[e]=s=[]),s.push(n);var r=s.indexOf(t);-1!=r&&s.splice(r,1)}i[e]=t},i.removeDefaultHandler=function(e,t){var i=this._defaultHandlers;if(i){var n=i._disabled_[e];if(i[e]==t)i[e],n&&this.setDefaultHandler(e,n.pop());else if(n){var s=n.indexOf(t);-1!=s&&n.splice(s,1)}}},i.on=i.addEventListener=function(e,t,i){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];return n||(n=this._eventRegistry[e]=[]),-1==n.indexOf(t)&&n[i?"unshift":"push"](t),t},i.off=i.removeListener=i.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var i=this._eventRegistry[e];if(i){var n=i.indexOf(t);-1!==n&&i.splice(n,1)}},i.removeAllListeners=function(e){this._eventRegistry&&(this._eventRegistry[e]=[])},t.EventEmitter=i}),ace.define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/lib/net","ace/lib/event_emitter"],function(e,t,i){"no use strict";function n(n){if(c.packaged=n||e.packaged||i.packaged||h.define&&define.packaged,!h.document)return"";for(var r={},o="",a=document.currentScript||document._currentScript,l=a&&a.ownerDocument||document,u=l.getElementsByTagName("script"),d=0;u.length>d;d++){var g=u[d],f=g.src||g.getAttribute("src");if(f){for(var m=g.attributes,p=0,A=m.length;A>p;p++){var v=m[p];0===v.name.indexOf("data-ace-")&&(r[s(v.name.replace(/^data-ace-/,""))]=v.value)}var C=f.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/);C&&(o=C[1])}}o&&(r.base=r.base||o,r.packaged=!0),r.basePath=r.base,r.workerPath=r.workerPath||r.base,r.modePath=r.modePath||r.base,r.themePath=r.themePath||r.base,delete r.base;for(var F in r)r[F]!==void 0&&t.set(F,r[F])}function s(e){return e.replace(/-(.)/g,function(e,t){return t.toUpperCase()})}var r=e("./lib/lang"),o=e("./lib/oop"),a=e("./lib/net"),l=e("./lib/event_emitter").EventEmitter,h=function(){return this}(),c={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:"",suffix:".js",$moduleUrls:{}};t.get=function(e){if(!c.hasOwnProperty(e))throw Error("Unknown config key: "+e);return c[e]},t.set=function(e,t){if(!c.hasOwnProperty(e))throw Error("Unknown config key: "+e);c[e]=t},t.all=function(){return r.copyObject(c)},o.implement(t,l),t.moduleUrl=function(e,t){if(c.$moduleUrls[e])return c.$moduleUrls[e];var i=e.split("/");t=t||i[i.length-2]||"";var n="snippets"==t?"/":"-",s=i[i.length-1];if("worker"==t&&"-"==n){var r=RegExp("^"+t+"[\\-_]|[\\-_]"+t+"$","g");s=s.replace(r,"")}(!s||s==t)&&i.length>1&&(s=i[i.length-2]);var o=c[t+"Path"];return null==o?o=c.basePath:"/"==n&&(t=n=""),o&&"/"!=o.slice(-1)&&(o+="/"),o+t+n+s+this.get("suffix")},t.setModuleUrl=function(e,t){return c.$moduleUrls[e]=t},t.$loading={},t.loadModule=function(i,n){var s,r;Array.isArray(i)&&(r=i[0],i=i[1]);try{s=e(i)}catch(o){}if(s&&!t.$loading[i])return n&&n(s);if(t.$loading[i]||(t.$loading[i]=[]),t.$loading[i].push(n),!(t.$loading[i].length>1)){var l=function(){e([i],function(e){t._emit("load.module",{name:i,module:e});var n=t.$loading[i];t.$loading[i]=null,n.forEach(function(t){t&&t(e)})})};return t.get("packaged")?(a.loadScript(t.moduleUrl(i,r),l),void 0):l()}},n(!0),t.init=n;var u={setOptions:function(e){Object.keys(e).forEach(function(t){this.setOption(t,e[t])},this)},getOptions:function(e){var t={};return e?Array.isArray(e)||(t=e,e=Object.keys(t)):e=Object.keys(this.$options),e.forEach(function(e){t[e]=this.getOption(e)},this),t},setOption:function(e,t){if(this["$"+e]!==t){var i=this.$options[e];if(!i)return"undefined"!=typeof console&&console.warn&&console.warn('misspelled option "'+e+'"'),void 0;if(i.forwardTo)return this[i.forwardTo]&&this[i.forwardTo].setOption(e,t);i.handlesSet||(this["$"+e]=t),i&&i.set&&i.set.call(this,t)}},getOption:function(e){var t=this.$options[e];return t?t.forwardTo?this[t.forwardTo]&&this[t.forwardTo].getOption(e):t&&t.get?t.get.call(this):this["$"+e]:("undefined"!=typeof console&&console.warn&&console.warn('misspelled option "'+e+'"'),void 0)}},d={};t.defineOptions=function(e,t,i){return e.$options||(d[t]=e.$options={}),Object.keys(i).forEach(function(t){var n=i[t];"string"==typeof n&&(n={forwardTo:n}),n.name||(n.name=t),e.$options[n.name]=n,"initialValue"in n&&(e["$"+n.name]=n.initialValue)}),o.implement(e,u),this},t.resetOptions=function(e){Object.keys(e.$options).forEach(function(t){var i=e.$options[t];"value"in i&&e.setOption(t,i.value)})},t.setDefaultValue=function(e,i,n){var s=d[e]||(d[e]={});s[i]&&(s.forwardTo?t.setDefaultValue(s.forwardTo,i,n):s[i].value=n)},t.setDefaultValues=function(e,i){Object.keys(i).forEach(function(n){t.setDefaultValue(e,n,i[n])})}}),ace.define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop_handler","ace/config"],function(e,t){"use strict";var i=e("../lib/event"),n=e("../lib/useragent"),s=e("./default_handlers").DefaultHandlers,r=e("./default_gutter_handler").GutterHandler,o=e("./mouse_event").MouseEvent,a=e("./dragdrop_handler").DragdropHandler,l=e("../config"),h=function(e){var t=this;this.editor=e,new s(this),new r(this),new a(this);var o=function(t){!e.isFocused()&&e.textInput&&e.textInput.moveToMouse(t),e.focus()},l=e.renderer.getMouseEventTarget();i.addListener(l,"click",this.onMouseEvent.bind(this,"click")),i.addListener(l,"mousemove",this.onMouseMove.bind(this,"mousemove")),i.addMultiMouseDownListener(l,[400,300,250],this,"onMouseEvent"),e.renderer.scrollBarV&&(i.addMultiMouseDownListener(e.renderer.scrollBarV.inner,[400,300,250],this,"onMouseEvent"),i.addMultiMouseDownListener(e.renderer.scrollBarH.inner,[400,300,250],this,"onMouseEvent"),n.isIE&&(i.addListener(e.renderer.scrollBarV.element,"mousedown",o),i.addListener(e.renderer.scrollBarH.element,"mousemove",o))),i.addMouseWheelListener(e.container,this.onMouseWheel.bind(this,"mousewheel"));var h=e.renderer.$gutter;i.addListener(h,"mousedown",this.onMouseEvent.bind(this,"guttermousedown")),i.addListener(h,"click",this.onMouseEvent.bind(this,"gutterclick")),i.addListener(h,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick")),i.addListener(h,"mousemove",this.onMouseEvent.bind(this,"guttermousemove")),i.addListener(l,"mousedown",o),i.addListener(h,"mousedown",function(t){return e.focus(),i.preventDefault(t)}),e.on("mousemove",function(i){if(!t.state&&!t.$dragDelay&&t.$dragEnabled){var n=e.renderer.screenToTextCoordinates(i.x,i.y),s=e.session.selection.getRange(),r=e.renderer;!s.isEmpty()&&s.insideStart(n.row,n.column)?r.setCursorStyle("default"):r.setCursorStyle("")}})};(function(){this.onMouseEvent=function(e,t){this.editor._emit(e,new o(t,this.editor))},this.onMouseMove=function(e,t){var i=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;i&&i.length&&this.editor._emit(e,new o(t,this.editor))},this.onMouseWheel=function(e,t){var i=new o(t,this.editor);i.speed=2*this.$scrollSpeed,i.wheelX=t.wheelX,i.wheelY=t.wheelY,this.editor._emit(e,i)},this.setState=function(e){this.state=e},this.captureMouse=function(e,t){this.x=e.x,this.y=e.y,this.isMousePressed=!0;var s=this.editor.renderer;s.$keepTextAreaAtCursor&&(s.$keepTextAreaAtCursor=null);var r=this,a=function(e){if(e){if(n.isWebKit&&!e.which&&r.releaseMouse)return r.releaseMouse();r.x=e.clientX,r.y=e.clientY,t&&t(e),r.mouseEvent=new o(e,r.editor),r.$mouseMoved=!0}},l=function(e){clearInterval(c),h(),r[r.state+"End"]&&r[r.state+"End"](e),r.state="",null==s.$keepTextAreaAtCursor&&(s.$keepTextAreaAtCursor=!0,s.$moveTextAreaToCursor()),r.isMousePressed=!1,r.$onCaptureMouseMove=r.releaseMouse=null,e&&r.onMouseEvent("mouseup",e)},h=function(){r[r.state]&&r[r.state](),r.$mouseMoved=!1};if(n.isOldIE&&"dblclick"==e.domEvent.type)return setTimeout(function(){l(e)});r.$onCaptureMouseMove=a,r.releaseMouse=i.capture(this.editor.container,a,l);var c=setInterval(h,20)},this.releaseMouse=null,this.cancelContextMenu=function(){var e=function(t){t&&t.domEvent&&"contextmenu"!=t.domEvent.type||(this.editor.off("nativecontextmenu",e),t&&t.domEvent&&i.stopEvent(t.domEvent))}.bind(this);setTimeout(e,10),this.editor.on("nativecontextmenu",e)}}).call(h.prototype),l.defineOptions(h.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:n.isMac?150:0},dragEnabled:{initialValue:!0},focusTimout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),t.MouseHandler=h}),ace.define("ace/mouse/fold_handler",["require","exports","module"],function(e,t){"use strict";function i(e){e.on("click",function(t){var i=t.getDocumentPosition(),n=e.session,s=n.getFoldAt(i.row,i.column,1);s&&(t.getAccelKey()?n.removeFold(s):n.expandFold(s),t.stop())}),e.on("gutterclick",function(t){var i=e.renderer.$gutterLayer.getRegion(t);if("foldWidgets"==i){var n=t.getDocumentPosition().row,s=e.session;s.foldWidgets&&s.foldWidgets[n]&&e.session.onFoldWidgetClick(n,t),e.isFocused()||e.focus(),t.stop()}}),e.on("gutterdblclick",function(t){var i=e.renderer.$gutterLayer.getRegion(t);if("foldWidgets"==i){var n=t.getDocumentPosition().row,s=e.session,r=s.getParentFoldRangeData(n,!0),o=r.range||r.firstRange;if(o){n=o.start.row;var a=s.getFoldAt(n,s.getLine(n).length,1);a?s.removeFold(a):(s.addFold("...",o),e.renderer.scrollCursorIntoView({row:o.start.row,column:0}))}t.stop()}})}t.FoldHandler=i}),ace.define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(e,t){"use strict";var i=e("../lib/keys"),n=e("../lib/event"),s=function(e){this.$editor=e,this.$data={editor:e},this.$handlers=[],this.setDefaultHandler(e.commands)};(function(){this.setDefaultHandler=function(e){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=e,this.addKeyboardHandler(e,0)},this.setKeyboardHandler=function(e){var t=this.$handlers;if(t[t.length-1]!=e){for(;t[t.length-1]&&t[t.length-1]!=this.$defaultHandler;)this.removeKeyboardHandler(t[t.length-1]);this.addKeyboardHandler(e,1)}},this.addKeyboardHandler=function(e,t){if(e){"function"!=typeof e||e.handleKeyboard||(e.handleKeyboard=e);var i=this.$handlers.indexOf(e);-1!=i&&this.$handlers.splice(i,1),void 0==t?this.$handlers.push(e):this.$handlers.splice(t,0,e),-1==i&&e.attach&&e.attach(this.$editor)}},this.removeKeyboardHandler=function(e){var t=this.$handlers.indexOf(e);return-1==t?!1:(this.$handlers.splice(t,1),e.detach&&e.detach(this.$editor),!0)},this.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},this.getStatusText=function(){var e=this.$data,t=e.editor;return this.$handlers.map(function(i){return i.getStatusText&&i.getStatusText(t,e)||""}).filter(Boolean).join(" ")},this.$callKeyboardHandlers=function(e,t,i,s){for(var r,o=!1,a=this.$editor.commands,l=this.$handlers.length;l--&&(r=this.$handlers[l].handleKeyboard(this.$data,e,t,i,s),!(r&&r.command&&(o="null"==r.command?!0:a.exec(r.command,this.$editor,r.args,s),o&&s&&-1!=e&&1!=r.passEvent&&1!=r.command.passEvent&&n.stopEvent(s),o))););return o},this.onCommandKey=function(e,t,n){var s=i.keyCodeToString(n);this.$callKeyboardHandlers(t,s,n,e)},this.onTextInput=function(e){var t=this.$callKeyboardHandlers(-1,e);t||this.$editor.commands.exec("insertstring",this.$editor,e)}}).call(s.prototype),t.KeyBinding=s}),ace.define("ace/range",["require","exports","module"],function(e,t){"use strict";var i=function(e,t){return e.row-t.row||e.column-t.column},n=function(e,t,i,n){this.start={row:e,column:t},this.end={row:i,column:n}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(e,t){return 0==this.compare(e,t)},this.compareRange=function(e){var t,i=e.end,n=e.start;return t=this.compare(i.row,i.column),1==t?(t=this.compare(n.row,n.column),1==t?2:0==t?1:0):-1==t?-2:(t=this.compare(n.row,n.column),-1==t?-1:1==t?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return 0==this.comparePoint(e.start)&&0==this.comparePoint(e.end)},this.intersects=function(e){var t=this.compareRange(e);return-1==t||0==t||1==t},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){"object"==typeof e?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){"object"==typeof e?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return 0==this.compare(e,t)?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return 0==this.compare(e,t)?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return 0==this.compare(e,t)?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return this.isMultiLine()||e!==this.start.row?this.start.row>e?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?this.end.column>=t?0:1:0:this.start.column>t?-1:t>this.end.column?1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var i={row:t+1,column:0};else if(e>this.end.row)var i={row:e,column:0};if(this.start.row>t)var s={row:t+1,column:0};else if(e>this.start.row)var s={row:e,column:0};return n.fromPoints(s||this.start,i||this.end)},this.extend=function(e,t){var i=this.compare(e,t);if(0==i)return this;if(-1==i)var s={row:e,column:t};else var r={row:e,column:t};return n.fromPoints(s||this.start,r||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 n.fromPoints(this.start,this.end)},this.collapseRows=function(){return 0==this.end.column?new n(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new n(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),i=e.documentToScreenPosition(this.end);return new n(t.row,t.column,i.row,i.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(n.prototype),n.fromPoints=function(e,t){return new n(e.row,e.column,t.row,t.column)},n.comparePoints=i,n.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=n}),ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(e,t){"use strict";var i=e("./lib/oop"),n=e("./lib/lang"),s=e("./lib/event_emitter").EventEmitter,r=e("./range").Range,o=function(e){this.session=e,this.doc=e.getDocument(),this.clearSelection(),this.lead=this.selectionLead=this.doc.createAnchor(0,0),this.anchor=this.selectionAnchor=this.doc.createAnchor(0,0);var t=this;this.lead.on("change",function(e){t._emit("changeCursor"),t.$isEmpty||t._emit("changeSelection"),t.$keepDesiredColumnOnChange||e.old.column==e.value.column||(t.$desiredColumn=null)}),this.selectionAnchor.on("change",function(){t.$isEmpty||t._emit("changeSelection")})};(function(){i.implement(this,s),this.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},this.isMultiLine=function(){return this.isEmpty()?!1:this.getRange().isMultiLine()},this.getCursor=function(){return this.lead.getPosition()
|
6 |
+
},this.setSelectionAnchor=function(e,t){this.anchor.setPosition(e,t),this.$isEmpty&&(this.$isEmpty=!1,this._emit("changeSelection"))},this.getSelectionAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},this.getSelectionLead=function(){return this.lead.getPosition()},this.shiftSelection=function(e){if(this.$isEmpty)return this.moveCursorTo(this.lead.row,this.lead.column+e),void 0;var t=this.getSelectionAnchor(),i=this.getSelectionLead(),n=this.isBackwards();n&&0===t.column||this.setSelectionAnchor(t.row,t.column+e),(n||0!==i.column)&&this.$moveSelection(function(){this.moveCursorTo(i.row,i.column+e)})},this.isBackwards=function(){var e=this.anchor,t=this.lead;return e.row>t.row||e.row==t.row&&e.column>t.column},this.getRange=function(){var e=this.anchor,t=this.lead;return this.isEmpty()?r.fromPoints(t,t):this.isBackwards()?r.fromPoints(t,e):r.fromPoints(e,t)},this.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},this.selectAll=function(){var e=this.doc.getLength()-1;this.setSelectionAnchor(0,0),this.moveCursorTo(e,this.doc.getLine(e).length)},this.setRange=this.setSelectionRange=function(e,t){t?(this.setSelectionAnchor(e.end.row,e.end.column),this.selectTo(e.start.row,e.start.column)):(this.setSelectionAnchor(e.start.row,e.start.column),this.selectTo(e.end.row,e.end.column)),this.getRange().isEmpty()&&(this.$isEmpty=!0),this.$desiredColumn=null},this.$moveSelection=function(e){var t=this.lead;this.$isEmpty&&this.setSelectionAnchor(t.row,t.column),e.call(this)},this.selectTo=function(e,t){this.$moveSelection(function(){this.moveCursorTo(e,t)})},this.selectToPosition=function(e){this.$moveSelection(function(){this.moveCursorToPosition(e)})},this.moveTo=function(e,t){this.clearSelection(),this.moveCursorTo(e,t)},this.moveToPosition=function(e){this.clearSelection(),this.moveCursorToPosition(e)},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.getWordRange=function(e,t){if(t===void 0){var i=e||this.lead;e=i.row,t=i.column}return this.session.getWordRange(e,t)},this.selectWord=function(){this.setSelectionRange(this.getWordRange())},this.selectAWord=function(){var e=this.getCursor(),t=this.session.getAWordRange(e.row,e.column);this.setSelectionRange(t)},this.getLineRange=function(e,t){var i,n="number"==typeof e?e:this.lead.row,s=this.session.getFoldLine(n);return s?(n=s.start.row,i=s.end.row):i=n,t===!0?new r(n,0,i,this.session.getLine(i).length):new r(n,0,i+1,0)},this.selectLine=function(){this.setSelectionRange(this.getLineRange())},this.moveCursorUp=function(){this.moveCursorBy(-1,0)},this.moveCursorDown=function(){this.moveCursorBy(1,0)},this.moveCursorLeft=function(){var e,t=this.lead.getPosition();if(e=this.session.getFoldAt(t.row,t.column,-1))this.moveCursorTo(e.start.row,e.start.column);else if(0===t.column)t.row>0&&this.moveCursorTo(t.row-1,this.doc.getLine(t.row-1).length);else{var i=this.session.getTabSize();this.session.isTabStop(t)&&this.doc.getLine(t.row).slice(t.column-i,t.column).split(" ").length-1==i?this.moveCursorBy(0,-i):this.moveCursorBy(0,-1)}},this.moveCursorRight=function(){var e,t=this.lead.getPosition();if(e=this.session.getFoldAt(t.row,t.column,1))this.moveCursorTo(e.end.row,e.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row<this.doc.getLength()-1&&this.moveCursorTo(this.lead.row+1,0);else{var i=this.session.getTabSize(),t=this.lead;this.session.isTabStop(t)&&this.doc.getLine(t.row).slice(t.column,t.column+i).split(" ").length-1==i?this.moveCursorBy(0,i):this.moveCursorBy(0,1)}},this.moveCursorLineStart=function(){var e=this.lead.row,t=this.lead.column,i=this.session.documentToScreenRow(e,t),n=this.session.screenToDocumentPosition(i,0),s=this.session.getDisplayLine(e,null,n.row,n.column),r=s.match(/^\s*/);r[0].length==t||this.session.$useEmacsStyleLineStart||(n.column+=r[0].length),this.moveCursorToPosition(n)},this.moveCursorLineEnd=function(){var e=this.lead,t=this.session.getDocumentLastRowColumnPosition(e.row,e.column);if(this.lead.column==t.column){var i=this.session.getLine(t.row);if(t.column==i.length){var n=i.search(/\s+$/);n>0&&(t.column=n)}}this.moveCursorTo(t.row,t.column)},this.moveCursorFileEnd=function(){var e=this.doc.getLength()-1,t=this.doc.getLine(e).length;this.moveCursorTo(e,t)},this.moveCursorFileStart=function(){this.moveCursorTo(0,0)},this.moveCursorLongWordRight=function(){var e,t=this.lead.row,i=this.lead.column,n=this.doc.getLine(t),s=n.substring(i);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var r=this.session.getFoldAt(t,i,1);return r?(this.moveCursorTo(r.end.row,r.end.column),void 0):((e=this.session.nonTokenRe.exec(s))&&(i+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,s=n.substring(i)),i>=n.length?(this.moveCursorTo(t,n.length),this.moveCursorRight(),this.doc.getLength()-1>t&&this.moveCursorWordRight(),void 0):((e=this.session.tokenRe.exec(s))&&(i+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(t,i),void 0))},this.moveCursorLongWordLeft=function(){var e,t=this.lead.row,i=this.lead.column;if(e=this.session.getFoldAt(t,i,-1))return this.moveCursorTo(e.start.row,e.start.column),void 0;var s=this.session.getFoldStringAt(t,i,-1);null==s&&(s=this.doc.getLine(t).substring(0,i));var r,o=n.stringReverse(s);return this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,(r=this.session.nonTokenRe.exec(o))&&(i-=this.session.nonTokenRe.lastIndex,o=o.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0),0>=i?(this.moveCursorTo(t,0),this.moveCursorLeft(),t>0&&this.moveCursorWordLeft(),void 0):((r=this.session.tokenRe.exec(o))&&(i-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(t,i),void 0)},this.$shortWordEndIndex=function(e){var t,i,n=0,s=/\s/,r=this.session.tokenRe;if(r.lastIndex=0,t=this.session.tokenRe.exec(e))n=this.session.tokenRe.lastIndex;else{for(;(i=e[n])&&s.test(i);)n++;if(1>n)for(r.lastIndex=0;(i=e[n])&&!r.test(i);)if(r.lastIndex=0,n++,s.test(i)){if(n>2){n--;break}for(;(i=e[n])&&s.test(i);)n++;if(n>2)break}}return r.lastIndex=0,n},this.moveCursorShortWordRight=function(){var e=this.lead.row,t=this.lead.column,i=this.doc.getLine(e),n=i.substring(t),s=this.session.getFoldAt(e,t,1);if(s)return this.moveCursorTo(s.end.row,s.end.column);if(t==i.length){var r=this.doc.getLength();do e++,n=this.doc.getLine(e);while(r>e&&/^\s*$/.test(n));/^\s+/.test(n)||(n=""),t=0}var o=this.$shortWordEndIndex(n);this.moveCursorTo(e,t+o)},this.moveCursorShortWordLeft=function(){var e,t=this.lead.row,i=this.lead.column;if(e=this.session.getFoldAt(t,i,-1))return this.moveCursorTo(e.start.row,e.start.column);var s=this.session.getLine(t).substring(0,i);if(0===i){do t--,s=this.doc.getLine(t);while(t>0&&/^\s*$/.test(s));i=s.length,/\s+$/.test(s)||(s="")}var r=n.stringReverse(s),o=this.$shortWordEndIndex(r);return this.moveCursorTo(t,i-o)},this.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},this.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},this.moveCursorBy=function(e,t){var i=this.session.documentToScreenPosition(this.lead.row,this.lead.column);0===t&&(this.$desiredColumn?i.column=this.$desiredColumn:this.$desiredColumn=i.column);var n=this.session.screenToDocumentPosition(i.row+e,i.column);0!==e&&0===t&&n.row===this.lead.row&&n.column===this.lead.column&&this.session.lineWidgets&&this.session.lineWidgets[n.row]&&n.row++,this.moveCursorTo(n.row,n.column+t,0===t)},this.moveCursorToPosition=function(e){this.moveCursorTo(e.row,e.column)},this.moveCursorTo=function(e,t,i){var n=this.session.getFoldAt(e,t,1);n&&(e=n.start.row,t=n.start.column),this.$keepDesiredColumnOnChange=!0,this.lead.setPosition(e,t),this.$keepDesiredColumnOnChange=!1,i||(this.$desiredColumn=null)},this.moveCursorToScreen=function(e,t,i){var n=this.session.screenToDocumentPosition(e,t);this.moveCursorTo(n.row,n.column,i)},this.detach=function(){this.lead.detach(),this.anchor.detach(),this.session=this.doc=null},this.fromOrientedRange=function(e){this.setSelectionRange(e,e.cursor==e.start),this.$desiredColumn=e.desiredColumn||this.$desiredColumn},this.toOrientedRange=function(e){var t=this.getRange();return e?(e.start.column=t.start.column,e.start.row=t.start.row,e.end.column=t.end.column,e.end.row=t.end.row):e=t,e.cursor=this.isBackwards()?e.start:e.end,e.desiredColumn=this.$desiredColumn,e},this.getRangeOfMovements=function(e){var t=this.getCursor();try{e.call(null,this);var i=this.getCursor();return r.fromPoints(t,i)}catch(n){return r.fromPoints(t,t)}finally{this.moveCursorToPosition(t)}},this.toJSON=function(){if(this.rangeCount)var e=this.ranges.map(function(e){var t=e.clone();return t.isBackwards=e.cursor==e.start,t});else{var e=this.getRange();e.isBackwards=this.isBackwards()}return e},this.fromJSON=function(e){if(void 0==e.start){if(this.rangeList){this.toSingleRange(e[0]);for(var t=e.length;t--;){var i=r.fromPoints(e[t].start,e[t].end);e.isBackwards&&(i.cursor=i.start),this.addRange(i,!0)}return}e=e[0]}this.rangeList&&this.toSingleRange(e),this.setSelectionRange(e,e.isBackwards)},this.isEqual=function(e){if((e.length||this.rangeCount)&&e.length!=this.rangeCount)return!1;if(!e.length||!this.ranges)return this.getRange().isEqual(e);for(var t=this.ranges.length;t--;)if(!this.ranges[t].isEqual(e[t]))return!1;return!0}}).call(o.prototype),t.Selection=o}),ace.define("ace/tokenizer",["require","exports","module"],function(e,t){"use strict";var i=2e3,n=function(e){this.states=e,this.regExps={},this.matchMappings={};for(var t in this.states){for(var i=this.states[t],n=[],s=0,r=this.matchMappings[t]={defaultToken:"text"},o="g",a=[],l=0;i.length>l;l++){var h=i[l];if(h.defaultToken&&(r.defaultToken=h.defaultToken),h.caseInsensitive&&(o="gi"),null!=h.regex){h.regex instanceof RegExp&&(h.regex=(""+h.regex).slice(1,-1));var c=h.regex,u=RegExp("(?:("+c+")|(.))").exec("a").length-2;Array.isArray(h.token)?1==h.token.length||1==u?h.token=h.token[0]:u-1!=h.token.length?(this.reportError("number of classes and regexp groups doesn't match",{rule:h,groupCount:u-1}),h.token=h.token[0]):(h.tokenArray=h.token,h.token=null,h.onMatch=this.$arrayTokens):"function"!=typeof h.token||h.onMatch||(h.onMatch=u>1?this.$applyToken:h.token),u>1&&(/\\\d/.test(h.regex)?c=h.regex.replace(/\\([0-9]+)/g,function(e,t){return"\\"+(parseInt(t,10)+s+1)}):(u=1,c=this.removeCapturingGroups(h.regex)),h.splitRegex||"string"==typeof h.token||a.push(h)),r[s]=l,s+=u,n.push(c),h.onMatch||(h.onMatch=null)}}n.length||(r[0]=0,n.push("$")),a.forEach(function(e){e.splitRegex=this.createSplitterRegexp(e.regex,o)},this),this.regExps[t]=RegExp("("+n.join(")|(")+")|($)",o)}};(function(){this.$setMaxTokenCount=function(e){i=0|e},this.$applyToken=function(e){var t=this.splitRegex.exec(e).slice(1),i=this.token.apply(this,t);if("string"==typeof i)return[{type:i,value:e}];for(var n=[],s=0,r=i.length;r>s;s++)t[s]&&(n[n.length]={type:i[s],value:t[s]});return n},this.$arrayTokens=function(e){if(!e)return[];var t=this.splitRegex.exec(e);if(!t)return"text";for(var i=[],n=this.tokenArray,s=0,r=n.length;r>s;s++)t[s+1]&&(i[i.length]={type:n[s],value:t[s+1]});return i},this.removeCapturingGroups=function(e){var t=e.replace(/\[(?:\\.|[^\]])*?\]|\\.|\(\?[:=!]|(\()/g,function(e,t){return t?"(?:":e});return t},this.createSplitterRegexp=function(e,t){if(-1!=e.indexOf("(?=")){var i=0,n=!1,s={};e.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(e,t,r,o,a,l){return n?n="]"!=a:a?n=!0:o?(i==s.stack&&(s.end=l+1,s.stack=-1),i--):r&&(i++,1!=r.length&&(s.stack=i,s.start=l)),e}),null!=s.end&&/^\)*$/.test(e.substr(s.end))&&(e=e.substring(0,s.start)+e.substr(s.end))}return RegExp(e,(t||"").replace("g",""))},this.getLineTokens=function(e,t){if(t&&"string"!=typeof t){var n=t.slice(0);t=n[0],"#tmp"===t&&(n.shift(),t=n.shift())}else var n=[];var s=t||"start",r=this.states[s];r||(s="start",r=this.states[s]);var o=this.matchMappings[s],a=this.regExps[s];a.lastIndex=0;for(var l,h=[],c=0,u=0,d={type:null,value:""};l=a.exec(e);){var g=o.defaultToken,f=null,m=l[0],p=a.lastIndex;if(p-m.length>c){var A=e.substring(c,p-m.length);d.type==g?d.value+=A:(d.type&&h.push(d),d={type:g,value:A})}for(var v=0;l.length-2>v;v++)if(void 0!==l[v+1]){f=r[o[v]],g=f.onMatch?f.onMatch(m,s,n):f.token,f.next&&(s="string"==typeof f.next?f.next:f.next(s,n),r=this.states[s],r||(this.reportError("state doesn't exist",s),s="start",r=this.states[s]),o=this.matchMappings[s],c=p,a=this.regExps[s],a.lastIndex=p);break}if(m)if("string"==typeof g)f&&f.merge===!1||d.type!==g?(d.type&&h.push(d),d={type:g,value:m}):d.value+=m;else if(g){d.type&&h.push(d),d={type:null,value:""};for(var v=0;g.length>v;v++)h.push(g[v])}if(c==e.length)break;if(c=p,u++>i){for(u>2*e.length&&this.reportError("infinite loop with in ace tokenizer",{startState:t,line:e});e.length>c;)d.type&&h.push(d),d={value:e.substring(c,c+=2e3),type:"overflow"};s="start",n=[];break}}return d.type&&h.push(d),n.length>1&&n[0]!==s&&n.unshift("#tmp",s),{tokens:h,state:n.length?n:s}},this.reportError=function(e,t){var i=Error(e);i.data=t,"object"==typeof console&&console.error&&console.error(i),setTimeout(function(){throw i})}}).call(n.prototype),t.Tokenizer=n}),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/lang"],function(e,t){"use strict";var i=e("../lib/lang"),n=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}};(function(){this.addRules=function(e,t){if(t)for(var i in e){for(var n=e[i],s=0;n.length>s;s++){var r=n[s];(r.next||r.onMatch)&&("string"!=typeof r.next?r.nextState&&0!==r.nextState.indexOf(t)&&(r.nextState=t+r.nextState):0!==r.next.indexOf(t)&&(r.next=t+r.next))}this.$rules[t+i]=n}else for(var i in e)this.$rules[i]=e[i]},this.getRules=function(){return this.$rules},this.embedRules=function(e,t,n,s,r){var o="function"==typeof e?(new e).getRules():e;if(s)for(var a=0;s.length>a;a++)s[a]=t+s[a];else{s=[];for(var l in o)s.push(t+l)}if(this.addRules(o,t),n)for(var h=Array.prototype[r?"push":"unshift"],a=0;s.length>a;a++)h.apply(this.$rules[s[a]],i.deepCopy(n));this.$embeds||(this.$embeds=[]),this.$embeds.push(t)},this.getEmbeds=function(){return this.$embeds};var e=function(e,t){return("start"!=e||t.length)&&t.unshift(this.nextState,e),this.nextState},t=function(e,t){return t.shift(),t.shift()||"start"};this.normalizeRules=function(){function i(r){var o=s[r];o.processed=!0;for(var a=0;o.length>a;a++){var l=o[a];!l.regex&&l.start&&(l.regex=l.start,l.next||(l.next=[]),l.next.push({defaultToken:l.token},{token:l.token+".end",regex:l.end||l.start,next:"pop"}),l.token=l.token+".start",l.push=!0);var h=l.next||l.push;if(h&&Array.isArray(h)){var c=l.stateName;c||(c=l.token,"string"!=typeof c&&(c=c[0]||""),s[c]&&(c+=n++)),s[c]=h,l.next=c,i(c)}else"pop"==h&&(l.next=t);if(l.push&&(l.nextState=l.next||l.push,l.next=e,delete l.push),l.rules)for(var u in l.rules)s[u]?s[u].push&&s[u].push.apply(s[u],l.rules[u]):s[u]=l.rules[u];if(l.include||"string"==typeof l)var d=l.include||l,g=s[d];else Array.isArray(l)&&(g=l);if(g){var f=[a,1].concat(g);l.noEscape&&(f=f.filter(function(e){return!e.next})),o.splice.apply(o,f),a--,g=null}l.keywordMap&&(l.token=this.createKeywordMapper(l.keywordMap,l.defaultToken||"text",l.caseInsensitive),delete l.defaultToken)}}var n=0,s=this.$rules;Object.keys(s).forEach(i,this)},this.createKeywordMapper=function(e,t,i,n){var s=Object.create(null);return Object.keys(e).forEach(function(t){var r=e[t];i&&(r=r.toLowerCase());for(var o=r.split(n||"|"),a=o.length;a--;)s[o[a]]=t}),Object.getPrototypeOf(s)&&(s.__proto__=null),this.$keywordList=Object.keys(s),e=null,i?function(e){return s[e.toLowerCase()]||t}:function(e){return s[e]||t}},this.getKeywords=function(){return this.$keywords}}).call(n.prototype),t.TextHighlightRules=n}),ace.define("ace/mode/behaviour",["require","exports","module"],function(e,t){"use strict";var i=function(){this.$behaviours={}};(function(){this.add=function(e,t,i){switch(void 0){case this.$behaviours:this.$behaviours={};case this.$behaviours[e]:this.$behaviours[e]={}}this.$behaviours[e][t]=i},this.addBehaviours=function(e){for(var t in e)for(var i in e[t])this.add(t,i,e[t][i])},this.remove=function(e){this.$behaviours&&this.$behaviours[e]&&delete this.$behaviours[e]},this.inherit=function(e,t){if("function"==typeof e)var i=(new e).getBehaviours(t);else var i=e.getBehaviours(t);this.addBehaviours(i)},this.getBehaviours=function(e){if(e){for(var t={},i=0;e.length>i;i++)this.$behaviours[e[i]]&&(t[e[i]]=this.$behaviours[e[i]]);return t}return this.$behaviours}}).call(i.prototype),t.Behaviour=i}),ace.define("ace/unicode",["require","exports","module"],function(e,t){"use strict";function i(e){var i=/\w{4}/g;for(var n in e)t.packages[n]=e[n].replace(i,"\\u$&")}t.packages={},i({L:"0041-005A0061-007A00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D03860388-038A038C038E-03A103A3-03F503F7-0481048A-05250531-055605590561-058705D0-05EA05F0-05F20621-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280904-0939093D09500958-0961097109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510D0-10FA10FC1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209421022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2D00-2D252D30-2D652D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A65FA662-A66EA67F-A697A6A0-A6E5A717-A71FA722-A788A78BA78CA7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",Ll:"0061-007A00AA00B500BA00DF-00F600F8-00FF01010103010501070109010B010D010F01110113011501170119011B011D011F01210123012501270129012B012D012F01310133013501370138013A013C013E014001420144014601480149014B014D014F01510153015501570159015B015D015F01610163016501670169016B016D016F0171017301750177017A017C017E-0180018301850188018C018D019201950199-019B019E01A101A301A501A801AA01AB01AD01B001B401B601B901BA01BD-01BF01C601C901CC01CE01D001D201D401D601D801DA01DC01DD01DF01E101E301E501E701E901EB01ED01EF01F001F301F501F901FB01FD01FF02010203020502070209020B020D020F02110213021502170219021B021D021F02210223022502270229022B022D022F02310233-0239023C023F0240024202470249024B024D024F-02930295-02AF037103730377037B-037D039003AC-03CE03D003D103D5-03D703D903DB03DD03DF03E103E303E503E703E903EB03ED03EF-03F303F503F803FB03FC0430-045F04610463046504670469046B046D046F04710473047504770479047B047D047F0481048B048D048F04910493049504970499049B049D049F04A104A304A504A704A904AB04AD04AF04B104B304B504B704B904BB04BD04BF04C204C404C604C804CA04CC04CE04CF04D104D304D504D704D904DB04DD04DF04E104E304E504E704E904EB04ED04EF04F104F304F504F704F904FB04FD04FF05010503050505070509050B050D050F05110513051505170519051B051D051F0521052305250561-05871D00-1D2B1D62-1D771D79-1D9A1E011E031E051E071E091E0B1E0D1E0F1E111E131E151E171E191E1B1E1D1E1F1E211E231E251E271E291E2B1E2D1E2F1E311E331E351E371E391E3B1E3D1E3F1E411E431E451E471E491E4B1E4D1E4F1E511E531E551E571E591E5B1E5D1E5F1E611E631E651E671E691E6B1E6D1E6F1E711E731E751E771E791E7B1E7D1E7F1E811E831E851E871E891E8B1E8D1E8F1E911E931E95-1E9D1E9F1EA11EA31EA51EA71EA91EAB1EAD1EAF1EB11EB31EB51EB71EB91EBB1EBD1EBF1EC11EC31EC51EC71EC91ECB1ECD1ECF1ED11ED31ED51ED71ED91EDB1EDD1EDF1EE11EE31EE51EE71EE91EEB1EED1EEF1EF11EF31EF51EF71EF91EFB1EFD1EFF-1F071F10-1F151F20-1F271F30-1F371F40-1F451F50-1F571F60-1F671F70-1F7D1F80-1F871F90-1F971FA0-1FA71FB0-1FB41FB61FB71FBE1FC2-1FC41FC61FC71FD0-1FD31FD61FD71FE0-1FE71FF2-1FF41FF61FF7210A210E210F2113212F21342139213C213D2146-2149214E21842C30-2C5E2C612C652C662C682C6A2C6C2C712C732C742C76-2C7C2C812C832C852C872C892C8B2C8D2C8F2C912C932C952C972C992C9B2C9D2C9F2CA12CA32CA52CA72CA92CAB2CAD2CAF2CB12CB32CB52CB72CB92CBB2CBD2CBF2CC12CC32CC52CC72CC92CCB2CCD2CCF2CD12CD32CD52CD72CD92CDB2CDD2CDF2CE12CE32CE42CEC2CEE2D00-2D25A641A643A645A647A649A64BA64DA64FA651A653A655A657A659A65BA65DA65FA663A665A667A669A66BA66DA681A683A685A687A689A68BA68DA68FA691A693A695A697A723A725A727A729A72BA72DA72F-A731A733A735A737A739A73BA73DA73FA741A743A745A747A749A74BA74DA74FA751A753A755A757A759A75BA75DA75FA761A763A765A767A769A76BA76DA76FA771-A778A77AA77CA77FA781A783A785A787A78CFB00-FB06FB13-FB17FF41-FF5A",Lu:"0041-005A00C0-00D600D8-00DE01000102010401060108010A010C010E01100112011401160118011A011C011E01200122012401260128012A012C012E01300132013401360139013B013D013F0141014301450147014A014C014E01500152015401560158015A015C015E01600162016401660168016A016C016E017001720174017601780179017B017D018101820184018601870189-018B018E-0191019301940196-0198019C019D019F01A001A201A401A601A701A901AC01AE01AF01B1-01B301B501B701B801BC01C401C701CA01CD01CF01D101D301D501D701D901DB01DE01E001E201E401E601E801EA01EC01EE01F101F401F6-01F801FA01FC01FE02000202020402060208020A020C020E02100212021402160218021A021C021E02200222022402260228022A022C022E02300232023A023B023D023E02410243-02460248024A024C024E03700372037603860388-038A038C038E038F0391-03A103A3-03AB03CF03D2-03D403D803DA03DC03DE03E003E203E403E603E803EA03EC03EE03F403F703F903FA03FD-042F04600462046404660468046A046C046E04700472047404760478047A047C047E0480048A048C048E04900492049404960498049A049C049E04A004A204A404A604A804AA04AC04AE04B004B204B404B604B804BA04BC04BE04C004C104C304C504C704C904CB04CD04D004D204D404D604D804DA04DC04DE04E004E204E404E604E804EA04EC04EE04F004F204F404F604F804FA04FC04FE05000502050405060508050A050C050E05100512051405160518051A051C051E0520052205240531-055610A0-10C51E001E021E041E061E081E0A1E0C1E0E1E101E121E141E161E181E1A1E1C1E1E1E201E221E241E261E281E2A1E2C1E2E1E301E321E341E361E381E3A1E3C1E3E1E401E421E441E461E481E4A1E4C1E4E1E501E521E541E561E581E5A1E5C1E5E1E601E621E641E661E681E6A1E6C1E6E1E701E721E741E761E781E7A1E7C1E7E1E801E821E841E861E881E8A1E8C1E8E1E901E921E941E9E1EA01EA21EA41EA61EA81EAA1EAC1EAE1EB01EB21EB41EB61EB81EBA1EBC1EBE1EC01EC21EC41EC61EC81ECA1ECC1ECE1ED01ED21ED41ED61ED81EDA1EDC1EDE1EE01EE21EE41EE61EE81EEA1EEC1EEE1EF01EF21EF41EF61EF81EFA1EFC1EFE1F08-1F0F1F18-1F1D1F28-1F2F1F38-1F3F1F48-1F4D1F591F5B1F5D1F5F1F68-1F6F1FB8-1FBB1FC8-1FCB1FD8-1FDB1FE8-1FEC1FF8-1FFB21022107210B-210D2110-211221152119-211D212421262128212A-212D2130-2133213E213F214521832C00-2C2E2C602C62-2C642C672C692C6B2C6D-2C702C722C752C7E-2C802C822C842C862C882C8A2C8C2C8E2C902C922C942C962C982C9A2C9C2C9E2CA02CA22CA42CA62CA82CAA2CAC2CAE2CB02CB22CB42CB62CB82CBA2CBC2CBE2CC02CC22CC42CC62CC82CCA2CCC2CCE2CD02CD22CD42CD62CD82CDA2CDC2CDE2CE02CE22CEB2CEDA640A642A644A646A648A64AA64CA64EA650A652A654A656A658A65AA65CA65EA662A664A666A668A66AA66CA680A682A684A686A688A68AA68CA68EA690A692A694A696A722A724A726A728A72AA72CA72EA732A734A736A738A73AA73CA73EA740A742A744A746A748A74AA74CA74EA750A752A754A756A758A75AA75CA75EA760A762A764A766A768A76AA76CA76EA779A77BA77DA77EA780A782A784A786A78BFF21-FF3A",Lt:"01C501C801CB01F21F88-1F8F1F98-1F9F1FA8-1FAF1FBC1FCC1FFC",Lm:"02B0-02C102C6-02D102E0-02E402EC02EE0374037A0559064006E506E607F407F507FA081A0824082809710E460EC610FC17D718431AA71C78-1C7D1D2C-1D611D781D9B-1DBF2071207F2090-20942C7D2D6F2E2F30053031-3035303B309D309E30FC-30FEA015A4F8-A4FDA60CA67FA717-A71FA770A788A9CFAA70AADDFF70FF9EFF9F",Lo:"01BB01C0-01C3029405D0-05EA05F0-05F20621-063F0641-064A066E066F0671-06D306D506EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA0800-08150904-0939093D09500958-096109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E450E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10D0-10FA1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317DC1820-18421844-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C771CE9-1CEC1CEE-1CF12135-21382D30-2D652D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE3006303C3041-3096309F30A1-30FA30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A014A016-A48CA4D0-A4F7A500-A60BA610-A61FA62AA62BA66EA6A0-A6E5A7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2AA00-AA28AA40-AA42AA44-AA4BAA60-AA6FAA71-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADBAADCABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF66-FF6FFF71-FF9DFFA0-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",M:"0300-036F0483-04890591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DE-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0903093C093E-094E0951-0955096209630981-098309BC09BE-09C409C709C809CB-09CD09D709E209E30A01-0A030A3C0A3E-0A420A470A480A4B-0A4D0A510A700A710A750A81-0A830ABC0ABE-0AC50AC7-0AC90ACB-0ACD0AE20AE30B01-0B030B3C0B3E-0B440B470B480B4B-0B4D0B560B570B620B630B820BBE-0BC20BC6-0BC80BCA-0BCD0BD70C01-0C030C3E-0C440C46-0C480C4A-0C4D0C550C560C620C630C820C830CBC0CBE-0CC40CC6-0CC80CCA-0CCD0CD50CD60CE20CE30D020D030D3E-0D440D46-0D480D4A-0D4D0D570D620D630D820D830DCA0DCF-0DD40DD60DD8-0DDF0DF20DF30E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F3E0F3F0F71-0F840F860F870F90-0F970F99-0FBC0FC6102B-103E1056-1059105E-10601062-10641067-106D1071-10741082-108D108F109A-109D135F1712-17141732-1734175217531772177317B6-17D317DD180B-180D18A91920-192B1930-193B19B0-19C019C819C91A17-1A1B1A55-1A5E1A60-1A7C1A7F1B00-1B041B34-1B441B6B-1B731B80-1B821BA1-1BAA1C24-1C371CD0-1CD21CD4-1CE81CED1CF21DC0-1DE61DFD-1DFF20D0-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66F-A672A67CA67DA6F0A6F1A802A806A80BA823-A827A880A881A8B4-A8C4A8E0-A8F1A926-A92DA947-A953A980-A983A9B3-A9C0AA29-AA36AA43AA4CAA4DAA7BAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE3-ABEAABECABEDFB1EFE00-FE0FFE20-FE26",Mn:"0300-036F0483-04870591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DF-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0902093C0941-0948094D0951-095509620963098109BC09C1-09C409CD09E209E30A010A020A3C0A410A420A470A480A4B-0A4D0A510A700A710A750A810A820ABC0AC1-0AC50AC70AC80ACD0AE20AE30B010B3C0B3F0B41-0B440B4D0B560B620B630B820BC00BCD0C3E-0C400C46-0C480C4A-0C4D0C550C560C620C630CBC0CBF0CC60CCC0CCD0CE20CE30D41-0D440D4D0D620D630DCA0DD2-0DD40DD60E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F71-0F7E0F80-0F840F860F870F90-0F970F99-0FBC0FC6102D-10301032-10371039103A103D103E10581059105E-10601071-1074108210851086108D109D135F1712-17141732-1734175217531772177317B7-17BD17C617C9-17D317DD180B-180D18A91920-19221927192819321939-193B1A171A181A561A58-1A5E1A601A621A65-1A6C1A73-1A7C1A7F1B00-1B031B341B36-1B3A1B3C1B421B6B-1B731B801B811BA2-1BA51BA81BA91C2C-1C331C361C371CD0-1CD21CD4-1CE01CE2-1CE81CED1DC0-1DE61DFD-1DFF20D0-20DC20E120E5-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66FA67CA67DA6F0A6F1A802A806A80BA825A826A8C4A8E0-A8F1A926-A92DA947-A951A980-A982A9B3A9B6-A9B9A9BCAA29-AA2EAA31AA32AA35AA36AA43AA4CAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE5ABE8ABEDFB1EFE00-FE0FFE20-FE26",Mc:"0903093E-09400949-094C094E0982098309BE-09C009C709C809CB09CC09D70A030A3E-0A400A830ABE-0AC00AC90ACB0ACC0B020B030B3E0B400B470B480B4B0B4C0B570BBE0BBF0BC10BC20BC6-0BC80BCA-0BCC0BD70C01-0C030C41-0C440C820C830CBE0CC0-0CC40CC70CC80CCA0CCB0CD50CD60D020D030D3E-0D400D46-0D480D4A-0D4C0D570D820D830DCF-0DD10DD8-0DDF0DF20DF30F3E0F3F0F7F102B102C10311038103B103C105610571062-10641067-106D108310841087-108C108F109A-109C17B617BE-17C517C717C81923-19261929-192B193019311933-193819B0-19C019C819C91A19-1A1B1A551A571A611A631A641A6D-1A721B041B351B3B1B3D-1B411B431B441B821BA11BA61BA71BAA1C24-1C2B1C341C351CE11CF2A823A824A827A880A881A8B4-A8C3A952A953A983A9B4A9B5A9BAA9BBA9BD-A9C0AA2FAA30AA33AA34AA4DAA7BABE3ABE4ABE6ABE7ABE9ABEAABEC",Me:"0488048906DE20DD-20E020E2-20E4A670-A672",N:"0030-003900B200B300B900BC-00BE0660-066906F0-06F907C0-07C90966-096F09E6-09EF09F4-09F90A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BF20C66-0C6F0C78-0C7E0CE6-0CEF0D66-0D750E50-0E590ED0-0ED90F20-0F331040-10491090-10991369-137C16EE-16F017E0-17E917F0-17F91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C5920702074-20792080-20892150-21822185-21892460-249B24EA-24FF2776-27932CFD30073021-30293038-303A3192-31953220-32293251-325F3280-328932B1-32BFA620-A629A6E6-A6EFA830-A835A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",Nd:"0030-00390660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",Nl:"16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF",No:"00B200B300B900BC-00BE09F4-09F90BF0-0BF20C78-0C7E0D70-0D750F2A-0F331369-137C17F0-17F920702074-20792080-20892150-215F21892460-249B24EA-24FF2776-27932CFD3192-31953220-32293251-325F3280-328932B1-32BFA830-A835",P:"0021-00230025-002A002C-002F003A003B003F0040005B-005D005F007B007D00A100AB00B700BB00BF037E0387055A-055F0589058A05BE05C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F3A-0F3D0F850FD0-0FD4104A-104F10FB1361-13681400166D166E169B169C16EB-16ED1735173617D4-17D617D8-17DA1800-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD32010-20272030-20432045-20512053-205E207D207E208D208E2329232A2768-277527C527C627E6-27EF2983-299829D8-29DB29FC29FD2CF9-2CFC2CFE2CFF2E00-2E2E2E302E313001-30033008-30113014-301F3030303D30A030FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFD3EFD3FFE10-FE19FE30-FE52FE54-FE61FE63FE68FE6AFE6BFF01-FF03FF05-FF0AFF0C-FF0FFF1AFF1BFF1FFF20FF3B-FF3DFF3FFF5BFF5DFF5F-FF65",Pd:"002D058A05BE140018062010-20152E172E1A301C303030A0FE31FE32FE58FE63FF0D",Ps:"0028005B007B0F3A0F3C169B201A201E2045207D208D23292768276A276C276E27702772277427C527E627E827EA27EC27EE2983298529872989298B298D298F299129932995299729D829DA29FC2E222E242E262E283008300A300C300E3010301430163018301A301DFD3EFE17FE35FE37FE39FE3BFE3DFE3FFE41FE43FE47FE59FE5BFE5DFF08FF3BFF5BFF5FFF62",Pe:"0029005D007D0F3B0F3D169C2046207E208E232A2769276B276D276F27712773277527C627E727E927EB27ED27EF298429862988298A298C298E2990299229942996299829D929DB29FD2E232E252E272E293009300B300D300F3011301530173019301B301E301FFD3FFE18FE36FE38FE3AFE3CFE3EFE40FE42FE44FE48FE5AFE5CFE5EFF09FF3DFF5DFF60FF63",Pi:"00AB2018201B201C201F20392E022E042E092E0C2E1C2E20",Pf:"00BB2019201D203A2E032E052E0A2E0D2E1D2E21",Pc:"005F203F20402054FE33FE34FE4D-FE4FFF3F",Po:"0021-00230025-0027002A002C002E002F003A003B003F0040005C00A100B700BF037E0387055A-055F058905C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F850FD0-0FD4104A-104F10FB1361-1368166D166E16EB-16ED1735173617D4-17D617D8-17DA1800-18051807-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD3201620172020-20272030-2038203B-203E2041-20432047-205120532055-205E2CF9-2CFC2CFE2CFF2E002E012E06-2E082E0B2E0E-2E162E182E192E1B2E1E2E1F2E2A-2E2E2E302E313001-3003303D30FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFE10-FE16FE19FE30FE45FE46FE49-FE4CFE50-FE52FE54-FE57FE5F-FE61FE68FE6AFE6BFF01-FF03FF05-FF07FF0AFF0CFF0EFF0FFF1AFF1BFF1FFF20FF3CFF61FF64FF65",S:"0024002B003C-003E005E0060007C007E00A2-00A900AC00AE-00B100B400B600B800D700F702C2-02C502D2-02DF02E5-02EB02ED02EF-02FF03750384038503F604820606-0608060B060E060F06E906FD06FE07F609F209F309FA09FB0AF10B700BF3-0BFA0C7F0CF10CF20D790E3F0F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-139917DB194019E0-19FF1B61-1B6A1B74-1B7C1FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE20442052207A-207C208A-208C20A0-20B8210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B2140-2144214A-214D214F2190-2328232B-23E82400-24262440-244A249C-24E92500-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE27C0-27C427C7-27CA27CC27D0-27E527F0-29822999-29D729DC-29FB29FE-2B4C2B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F309B309C319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A700-A716A720A721A789A78AA828-A82BA836-A839AA77-AA79FB29FDFCFDFDFE62FE64-FE66FE69FF04FF0BFF1C-FF1EFF3EFF40FF5CFF5EFFE0-FFE6FFE8-FFEEFFFCFFFD",Sm:"002B003C-003E007C007E00AC00B100D700F703F60606-060820442052207A-207C208A-208C2140-2144214B2190-2194219A219B21A021A321A621AE21CE21CF21D221D421F4-22FF2308-230B23202321237C239B-23B323DC-23E125B725C125F8-25FF266F27C0-27C427C7-27CA27CC27D0-27E527F0-27FF2900-29822999-29D729DC-29FB29FE-2AFF2B30-2B442B47-2B4CFB29FE62FE64-FE66FF0BFF1C-FF1EFF5CFF5EFFE2FFE9-FFEC",Sc:"002400A2-00A5060B09F209F309FB0AF10BF90E3F17DB20A0-20B8A838FDFCFE69FF04FFE0FFE1FFE5FFE6",Sk:"005E006000A800AF00B400B802C2-02C502D2-02DF02E5-02EB02ED02EF-02FF0375038403851FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE309B309CA700-A716A720A721A789A78AFF3EFF40FFE3",So:"00A600A700A900AE00B000B60482060E060F06E906FD06FE07F609FA0B700BF3-0BF80BFA0C7F0CF10CF20D790F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-1399194019E0-19FF1B61-1B6A1B74-1B7C210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B214A214C214D214F2195-2199219C-219F21A121A221A421A521A7-21AD21AF-21CD21D021D121D321D5-21F32300-2307230C-231F2322-2328232B-237B237D-239A23B4-23DB23E2-23E82400-24262440-244A249C-24E92500-25B625B8-25C025C2-25F72600-266E2670-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE2800-28FF2B00-2B2F2B452B462B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A828-A82BA836A837A839AA77-AA79FDFDFFE4FFE8FFEDFFEEFFFCFFFD",Z:"002000A01680180E2000-200A20282029202F205F3000",Zs:"002000A01680180E2000-200A202F205F3000",Zl:"2028",Zp:"2029",C:"0000-001F007F-009F00AD03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-0605061C061D0620065F06DD070E070F074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17B417B517DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF200B-200F202A-202E2060-206F20722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-F8FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFD-FF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFFBFFFEFFFF",Cc:"0000-001F007F-009F",Cf:"00AD0600-060306DD070F17B417B5200B-200F202A-202E2060-2064206A-206FFEFFFFF9-FFFB",Co:"E000-F8FF",Cs:"D800-DFFF",Cn:"03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-05FF06040605061C061D0620065F070E074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF2065-206920722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-D7FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFDFEFEFF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFF8FFFEFFFF"})
|
7 |
+
}),ace.define("ace/token_iterator",["require","exports","module"],function(e,t){"use strict";var i=function(e,t,i){this.$session=e,this.$row=t,this.$rowTokens=e.getTokens(t);var n=e.getTokenAt(t,i);this.$tokenIndex=n?n.index:-1};(function(){this.stepBackward=function(){for(this.$tokenIndex-=1;0>this.$tokenIndex;){if(this.$row-=1,0>this.$row)return this.$row=0,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1}return this.$rowTokens[this.$tokenIndex]},this.stepForward=function(){this.$tokenIndex+=1;for(var e;this.$tokenIndex>=this.$rowTokens.length;){if(this.$row+=1,e||(e=this.$session.getLength()),this.$row>=e)return this.$row=e-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},this.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},this.getCurrentTokenRow=function(){return this.$row},this.getCurrentTokenColumn=function(){var e=this.$rowTokens,t=this.$tokenIndex,i=e[t].start;if(void 0!==i)return i;for(i=0;t>0;)t-=1,i+=e[t].value.length;return i}}).call(i.prototype),t.TokenIterator=i}),ace.define("ace/mode/text",["require","exports","module","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/behaviour","ace/unicode","ace/lib/lang","ace/token_iterator","ace/range"],function(e,t){"use strict";var i=e("../tokenizer").Tokenizer,n=e("./text_highlight_rules").TextHighlightRules,s=e("./behaviour").Behaviour,r=e("../unicode"),o=e("../lib/lang"),a=e("../token_iterator").TokenIterator,l=e("../range").Range,h=function(){this.HighlightRules=n,this.$behaviour=new s};(function(){this.tokenRe=RegExp("^["+r.packages.L+r.packages.Mn+r.packages.Mc+r.packages.Nd+r.packages.Pc+"\\$_]+","g"),this.nonTokenRe=RegExp("^(?:[^"+r.packages.L+r.packages.Mn+r.packages.Mc+r.packages.Nd+r.packages.Pc+"\\$_]|\\s])+","g"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=this.$highlightRules||new this.HighlightRules,this.$tokenizer=new i(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(e,t,i,n){function s(e){for(var t=i;n>=t;t++)e(r.getLine(t),t)}var r=t.doc,a=!0,l=!0,h=1/0,c=t.getTabSize(),u=!1;if(this.lineCommentStart){if(Array.isArray(this.lineCommentStart))var d=this.lineCommentStart.map(o.escapeRegExp).join("|"),g=this.lineCommentStart[0];else var d=o.escapeRegExp(this.lineCommentStart),g=this.lineCommentStart;d=RegExp("^(\\s*)(?:"+d+") ?"),u=t.getUseSoftTabs();var f=function(e,t){var i=e.match(d);if(i){var n=i[1].length,s=i[0].length;v(e,n,s)||" "!=i[0][s-1]||s--,r.removeInLine(t,n,s)}},m=g+" ",p=function(e,t){(!a||/\S/.test(e))&&(v(e,h,h)?r.insertInLine({row:t,column:h},m):r.insertInLine({row:t,column:h},g))},A=function(e){return d.test(e)},v=function(e,t,i){for(var n=0;t--&&" "==e.charAt(t);)n++;if(0!=n%c)return!1;for(var n=0;" "==e.charAt(i++);)n++;return c>2?n%c!=c-1:0==n%c}}else{if(!this.blockComment)return!1;var g=this.blockComment.start,C=this.blockComment.end,d=RegExp("^(\\s*)(?:"+o.escapeRegExp(g)+")"),F=RegExp("(?:"+o.escapeRegExp(C)+")\\s*$"),p=function(e,t){A(e,t)||(!a||/\S/.test(e))&&(r.insertInLine({row:t,column:e.length},C),r.insertInLine({row:t,column:h},g))},f=function(e,t){var i;(i=e.match(F))&&r.removeInLine(t,e.length-i[0].length,e.length),(i=e.match(d))&&r.removeInLine(t,i[1].length,i[0].length)},A=function(e,i){if(d.test(e))return!0;for(var n=t.getTokens(i),s=0;n.length>s;s++)if("comment"===n[s].type)return!0}}var w=1/0;s(function(e,t){var i=e.search(/\S/);-1!==i?(h>i&&(h=i),l&&!A(e,t)&&(l=!1)):w>e.length&&(w=e.length)}),1/0==h&&(h=w,a=!1,l=!1),u&&0!=h%c&&(h=Math.floor(h/c)*c),s(l?f:p)},this.toggleBlockComment=function(e,t,i,n){var s=this.blockComment;if(s){!s.start&&s[0]&&(s=s[0]);var r=new a(t,n.row,n.column),o=r.getCurrentToken();t.selection;var h,c,u=t.selection.toOrientedRange();if(o&&/comment/.test(o.type)){for(var d,g;o&&/comment/.test(o.type);){var f=o.value.indexOf(s.start);if(-1!=f){var m=r.getCurrentTokenRow(),p=r.getCurrentTokenColumn()+f;d=new l(m,p,m,p+s.start.length);break}o=r.stepBackward()}for(var r=new a(t,n.row,n.column),o=r.getCurrentToken();o&&/comment/.test(o.type);){var f=o.value.indexOf(s.end);if(-1!=f){var m=r.getCurrentTokenRow(),p=r.getCurrentTokenColumn()+f;g=new l(m,p,m,p+s.end.length);break}o=r.stepForward()}g&&t.remove(g),d&&(t.remove(d),h=d.start.row,c=-s.start.length)}else c=s.start.length,h=i.start.row,t.insert(i.end,s.end),t.insert(i.start,s.start);u.start.row==h&&(u.start.column+=c),u.end.row==h&&(u.end.column+=c),t.selection.fromOrientedRange(u)}},this.getNextLineIndent=function(e,t){return this.$getIndent(t)},this.checkOutdent=function(){return!1},this.autoOutdent=function(){},this.$getIndent=function(e){return e.match(/^\s*/)[0]},this.createWorker=function(){return null},this.createModeDelegates=function(e){this.$embeds=[],this.$modes={};for(var t in e)e[t]&&(this.$embeds.push(t),this.$modes[t]=new e[t]);for(var i=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"],t=0;i.length>t;t++)(function(e){var n=i[t],s=e[n];e[i[t]]=function(){return this.$delegator(n,arguments,s)}})(this)},this.$delegator=function(e,t,i){var n=t[0];"string"!=typeof n&&(n=n[0]);for(var s=0;this.$embeds.length>s;s++)if(this.$modes[this.$embeds[s]]){var r=n.split(this.$embeds[s]);if(!r[0]&&r[1]){t[0]=r[1];var o=this.$modes[this.$embeds[s]];return o[e].apply(o,t)}}var a=i.apply(this,t);return i?a:void 0},this.transformAction=function(e,t){if(this.$behaviour){var i=this.$behaviour.getBehaviours();for(var n in i)if(i[n][t]){var s=i[n][t].apply(this,arguments);if(s)return s}}},this.getKeywords=function(e){if(!this.completionKeywords){var t=this.$tokenizer.rules,i=[];for(var n in t)for(var s=t[n],r=0,o=s.length;o>r;r++)if("string"==typeof s[r].token)/keyword|support|storage/.test(s[r].token)&&i.push(s[r].regex);else if("object"==typeof s[r].token)for(var a=0,l=s[r].token.length;l>a;a++)if(/keyword|support|storage/.test(s[r].token[a])){var n=s[r].regex.match(/\(.+?\)/g)[a];i.push(n.substr(1,n.length-2))}this.completionKeywords=i}return e?i.concat(this.$keywordList||[]):this.$keywordList},this.$createKeywordList=function(){return this.$highlightRules||this.getTokenizer(),this.$keywordList=this.$highlightRules.$keywordList||[]},this.getCompletions=function(){var e=this.$keywordList||this.$createKeywordList();return e.map(function(e){return{name:e,value:e,score:0,meta:"keyword"}})},this.$id="ace/mode/text"}).call(h.prototype),t.Mode=h}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t){"use strict";var i=e("./lib/oop"),n=e("./lib/event_emitter").EventEmitter,s=t.Anchor=function(e,t,i){this.$onChange=this.onChange.bind(this),this.attach(e),i===void 0?this.setPosition(t.row,t.column):this.setPosition(t,i)};(function(){i.implement(this,n),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(e){var t=e.data,i=t.range;if(!(i.start.row==i.end.row&&i.start.row!=this.row||i.start.row>this.row||i.start.row==this.row&&i.start.column>this.column)){var n=this.row,s=this.column,r=i.start,o=i.end;"insertText"===t.action?r.row===n&&s>=r.column?r.column===s&&this.$insertRight||(r.row===o.row?s+=o.column-r.column:(s-=r.column,n+=o.row-r.row)):r.row!==o.row&&n>r.row&&(n+=o.row-r.row):"insertLines"===t.action?r.row===n&&0===s&&this.$insertRight||n>=r.row&&(n+=o.row-r.row):"removeText"===t.action?r.row===n&&s>r.column?s=o.column>=s?r.column:Math.max(0,s-(o.column-r.column)):r.row!==o.row&&n>r.row?(o.row===n&&(s=Math.max(0,s-o.column)+r.column),n-=o.row-r.row):o.row===n&&(n-=o.row-r.row,s=Math.max(0,s-o.column)+r.column):"removeLines"==t.action&&n>=r.row&&(n>=o.row?n-=o.row-r.row:(n=r.row,s=0)),this.setPosition(n,s,!0)}},this.setPosition=function(e,t,i){var n;if(n=i?{row:e,column:t}:this.$clipPositionToDocument(e,t),this.row!=n.row||this.column!=n.column){var s={row:this.row,column:this.column};this.row=n.row,this.column=n.column,this._signal("change",{old:s,value:n})}},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(e,t){var i={};return e>=this.document.getLength()?(i.row=Math.max(0,this.document.getLength()-1),i.column=this.document.getLine(i.row).length):0>e?(i.row=0,i.column=0):(i.row=e,i.column=Math.min(this.document.getLine(i.row).length,Math.max(0,t))),0>t&&(i.column=0),i}}).call(s.prototype)}),ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,t){"use strict";var i=e("./lib/oop"),n=e("./lib/event_emitter").EventEmitter,s=e("./range").Range,r=e("./anchor").Anchor,o=function(e){this.$lines=[],0===e.length?this.$lines=[""]:Array.isArray(e)?this._insertLines(0,e):this.insert({row:0,column:0},e)};(function(){i.implement(this,n),this.setValue=function(e){var t=this.getLength();this.remove(new s(0,0,t,this.getLine(t-1).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new r(this,e,t)},this.$split=0==="aaa".split(/a/).length?function(e){return e.replace(/\r\n|\r/g,"\n").split("\n")}:function(e){return e.split(/\r\n|\r|\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(e){this.$newLineMode!==e&&(this.$newLineMode=e,this._signal("changeNewLineMode"))},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return"\r\n"==e||"\r"==e||"\n"==e},this.getLine=function(e){return this.$lines[e]||""},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){if(e.start.row==e.end.row)return this.getLine(e.start.row).substring(e.start.column,e.end.column);var t=this.getLines(e.start.row,e.end.row);t[0]=(t[0]||"").substring(e.start.column);var i=t.length-1;return e.end.row-e.start.row==i&&(t[i]=t[i].substring(0,e.end.column)),t.join(this.getNewLineCharacter())},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):0>e.row&&(e.row=0),e},this.insert=function(e,t){if(!t||0===t.length)return e;e=this.$clipPosition(e),1>=this.getLength()&&this.$detectNewLine(t);var i=this.$split(t),n=i.splice(0,1)[0],s=0==i.length?null:i.splice(i.length-1,1)[0];return e=this.insertInLine(e,n),null!==s&&(e=this.insertNewLine(e),e=this._insertLines(e.row,i),e=this.insertInLine(e,s||"")),e},this.insertLines=function(e,t){return e>=this.getLength()?this.insert({row:e,column:0},"\n"+t.join("\n")):this._insertLines(Math.max(e,0),t)},this._insertLines=function(e,t){if(0==t.length)return{row:e,column:0};for(;t.length>61440;){var i=this._insertLines(e,t.slice(0,61440));t=t.slice(61440),e=i.row}var n=[e,0];n.push.apply(n,t),this.$lines.splice.apply(this.$lines,n);var r=new s(e,0,e+t.length,0),o={action:"insertLines",range:r,lines:t};return this._signal("change",{data:o}),r.end},this.insertNewLine=function(e){e=this.$clipPosition(e);var t=this.$lines[e.row]||"";this.$lines[e.row]=t.substring(0,e.column),this.$lines.splice(e.row+1,0,t.substring(e.column,t.length));var i={row:e.row+1,column:0},n={action:"insertText",range:s.fromPoints(e,i),text:this.getNewLineCharacter()};return this._signal("change",{data:n}),i},this.insertInLine=function(e,t){if(0==t.length)return e;var i=this.$lines[e.row]||"";this.$lines[e.row]=i.substring(0,e.column)+t+i.substring(e.column);var n={row:e.row,column:e.column+t.length},r={action:"insertText",range:s.fromPoints(e,n),text:t};return this._signal("change",{data:r}),n},this.remove=function(e){if(e instanceof s||(e=s.fromPoints(e.start,e.end)),e.start=this.$clipPosition(e.start),e.end=this.$clipPosition(e.end),e.isEmpty())return e.start;var t=e.start.row,i=e.end.row;if(e.isMultiLine()){var n=0==e.start.column?t:t+1,r=i-1;e.end.column>0&&this.removeInLine(i,0,e.end.column),r>=n&&this._removeLines(n,r),n!=t&&(this.removeInLine(t,e.start.column,this.getLine(t).length),this.removeNewLine(e.start.row))}else this.removeInLine(t,e.start.column,e.end.column);return e.start},this.removeInLine=function(e,t,i){if(t!=i){var n=new s(e,t,e,i),r=this.getLine(e),o=r.substring(t,i),a=r.substring(0,t)+r.substring(i,r.length);this.$lines.splice(e,1,a);var l={action:"removeText",range:n,text:o};return this._signal("change",{data:l}),n.start}},this.removeLines=function(e,t){return 0>e||t>=this.getLength()?this.remove(new s(e,0,t+1,0)):this._removeLines(e,t)},this._removeLines=function(e,t){var i=new s(e,0,t+1,0),n=this.$lines.splice(e,t-e+1),r={action:"removeLines",range:i,nl:this.getNewLineCharacter(),lines:n};return this._signal("change",{data:r}),n},this.removeNewLine=function(e){var t=this.getLine(e),i=this.getLine(e+1),n=new s(e,t.length,e+1,0),r=t+i;this.$lines.splice(e,2,r);var o={action:"removeText",range:n,text:this.getNewLineCharacter()};this._signal("change",{data:o})},this.replace=function(e,t){if(e instanceof s||(e=s.fromPoints(e.start,e.end)),0==t.length&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;if(this.remove(e),t)var i=this.insert(e.start,t);else i=e.start;return i},this.applyDeltas=function(e){for(var t=0;e.length>t;t++){var i=e[t],n=s.fromPoints(i.range.start,i.range.end);"insertLines"==i.action?this.insertLines(n.start.row,i.lines):"insertText"==i.action?this.insert(n.start,i.text):"removeLines"==i.action?this._removeLines(n.start.row,n.end.row-1):"removeText"==i.action&&this.remove(n)}},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--){var i=e[t],n=s.fromPoints(i.range.start,i.range.end);"insertLines"==i.action?this._removeLines(n.start.row,n.end.row-1):"insertText"==i.action?this.remove(n):"removeLines"==i.action?this._insertLines(n.start.row,i.lines):"removeText"==i.action&&this.insert(n.start,i.text)}},this.indexToPosition=function(e,t){for(var i=this.$lines||this.getAllLines(),n=this.getNewLineCharacter().length,s=t||0,r=i.length;r>s;s++)if(e-=i[s].length+n,0>e)return{row:s,column:e+i[s].length+n};return{row:r-1,column:i[r-1].length}},this.positionToIndex=function(e,t){for(var i=this.$lines||this.getAllLines(),n=this.getNewLineCharacter().length,s=0,r=Math.min(e.row,i.length),o=t||0;r>o;++o)s+=i[o].length+n;return s+e.column}}).call(o.prototype),t.Document=o}),ace.define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t){"use strict";var i=e("./lib/oop"),n=e("./lib/event_emitter").EventEmitter,s=function(e){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=e;var t=this;this.$worker=function(){if(t.running){for(var e=new Date,i=t.currentLine,n=-1,s=t.doc;t.lines[i];)i++;var r=i,o=s.getLength(),a=0;for(t.running=!1;o>i;){t.$tokenizeRow(i),n=i;do i++;while(t.lines[i]);if(a++,0===a%5&&new Date-e>20){t.running=setTimeout(t.$worker,20);break}}t.currentLine=i,n>=r&&t.fireUpdateEvent(r,n)}}};(function(){i.implement(this,n),this.setTokenizer=function(e){this.tokenizer=e,this.lines=[],this.states=[],this.start(0)},this.setDocument=function(e){this.doc=e,this.lines=[],this.states=[],this.stop()},this.fireUpdateEvent=function(e,t){var i={first:e,last:t};this._signal("update",{data:i})},this.start=function(e){this.currentLine=Math.min(e||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},this.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},this.$updateOnChange=function(e){var t=e.range,i=t.start.row,n=t.end.row-i;if(0===n)this.lines[i]=null;else if("removeText"==e.action||"removeLines"==e.action)this.lines.splice(i,n+1,null),this.states.splice(i,n+1,null);else{var s=Array(n+1);s.unshift(i,1),this.lines.splice.apply(this.lines,s),this.states.splice.apply(this.states,s)}this.currentLine=Math.min(i,this.currentLine,this.doc.getLength()),this.stop()},this.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},this.getTokens=function(e){return this.lines[e]||this.$tokenizeRow(e)},this.getState=function(e){return this.currentLine==e&&this.$tokenizeRow(e),this.states[e]||"start"},this.$tokenizeRow=function(e){var t=this.doc.getLine(e),i=this.states[e-1],n=this.tokenizer.getLineTokens(t,i,e);return this.states[e]+""!=n.state+""?(this.states[e]=n.state,this.lines[e+1]=null,this.currentLine>e+1&&(this.currentLine=e+1)):this.currentLine==e&&(this.currentLine=e+1),this.lines[e]=n.tokens}}).call(s.prototype),t.BackgroundTokenizer=s}),ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t){"use strict";var i=e("./lib/lang");e("./lib/oop");var n=e("./range").Range,s=function(e,t,i){this.setRegexp(e),this.clazz=t,this.type=i||"text"};(function(){this.MAX_RANGES=500,this.setRegexp=function(e){this.regExp+""!=e+""&&(this.regExp=e,this.cache=[])},this.update=function(e,t,s,r){if(this.regExp)for(var o=r.firstRow,a=r.lastRow,l=o;a>=l;l++){var h=this.cache[l];null==h&&(h=i.getMatchOffsets(s.getLine(l),this.regExp),h.length>this.MAX_RANGES&&(h=h.slice(0,this.MAX_RANGES)),h=h.map(function(e){return new n(l,e.offset,l,e.offset+e.length)}),this.cache[l]=h.length?h:"");for(var c=h.length;c--;)t.drawSingleLineMarker(e,h[c].toScreenRange(s),this.clazz,r)}}}).call(s.prototype),t.SearchHighlight=s}),ace.define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(e,t){"use strict";function i(e,t){this.foldData=e,Array.isArray(t)?this.folds=t:t=this.folds=[t];var i=t[t.length-1];this.range=new n(t[0].start.row,t[0].start.column,i.end.row,i.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(e){e.setFoldLine(this)},this)}var n=e("../range").Range;(function(){this.shiftRow=function(e){this.start.row+=e,this.end.row+=e,this.folds.forEach(function(t){t.start.row+=e,t.end.row+=e})},this.addFold=function(e){if(e.sameRow){if(e.start.row<this.startRow||e.endRow>this.endRow)throw Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(e),this.folds.sort(function(e,t){return-e.range.compareEnd(t.start.row,t.start.column)}),this.range.compareEnd(e.start.row,e.start.column)>0?(this.end.row=e.end.row,this.end.column=e.end.column):0>this.range.compareStart(e.end.row,e.end.column)&&(this.start.row=e.start.row,this.start.column=e.start.column)}else if(e.start.row==this.end.row)this.folds.push(e),this.end.row=e.end.row,this.end.column=e.end.column;else{if(e.end.row!=this.start.row)throw Error("Trying to add fold to FoldRow that doesn't have a matching row");this.folds.unshift(e),this.start.row=e.start.row,this.start.column=e.start.column}e.foldLine=this},this.containsRow=function(e){return e>=this.start.row&&this.end.row>=e},this.walk=function(e,t,i){var n,s,r,o=0,a=this.folds,l=!0;null==t&&(t=this.end.row,i=this.end.column);for(var h=0;a.length>h;h++){if(n=a[h],s=n.range.compareStart(t,i),-1==s)return e(null,t,i,o,l),void 0;if(r=e(null,n.start.row,n.start.column,o,l),r=!r&&e(n.placeholder,n.start.row,n.start.column,o),r||0===s)return;l=!n.sameRow,o=n.end.column}e(null,t,i,o,l)},this.getNextFoldTo=function(e,t){for(var i,n,s=0;this.folds.length>s;s++){if(i=this.folds[s],n=i.range.compareEnd(e,t),-1==n)return{fold:i,kind:"after"};if(0===n)return{fold:i,kind:"inside"}}return null},this.addRemoveChars=function(e,t,i){var n,s,r=this.getNextFoldTo(e,t);if(r)if(n=r.fold,"inside"==r.kind&&n.start.column!=t&&n.start.row!=e)window.console&&window.console.log(e,t,n);else if(n.start.row==e){s=this.folds;var o=s.indexOf(n);for(0===o&&(this.start.column+=i),o;s.length>o;o++){if(n=s[o],n.start.column+=i,!n.sameRow)return;n.end.column+=i}this.end.column+=i}},this.split=function(e,t){var n=this.getNextFoldTo(e,t);if(!n||"inside"==n.kind)return null;var s=n.fold,r=this.folds,o=this.foldData,a=r.indexOf(s),l=r[a-1];this.end.row=l.end.row,this.end.column=l.end.column,r=r.splice(a,r.length-a);var h=new i(o,r);return o.splice(o.indexOf(this)+1,0,h),h},this.merge=function(e){for(var t=e.folds,i=0;t.length>i;i++)this.addFold(t[i]);var n=this.foldData;n.splice(n.indexOf(e),1)},this.toString=function(){var e=[""+this.range+": ["];return this.folds.forEach(function(t){e.push(" "+(""+t))}),e.push("]"),e.join("\n")},this.idxToPosition=function(e){for(var t=0,i=0;this.folds.length>i;i++){var n=this.folds[i];if(e-=n.start.column-t,0>e)return{row:n.start.row,column:n.start.column+e};if(e-=n.placeholder.length,0>e)return n.start;t=n.end.column}return{row:this.end.row,column:this.end.column+e}}}).call(i.prototype),t.FoldLine=i}),ace.define("ace/range_list",["require","exports","module","ace/range"],function(e,t){"use strict";var i=e("./range").Range,n=i.comparePoints,s=function(){this.ranges=[]};(function(){this.comparePoints=n,this.pointIndex=function(e,t,i){for(var s=this.ranges,r=i||0;s.length>r;r++){var o=s[r],a=n(e,o.end);if(!(a>0)){var l=n(e,o.start);return 0===a?t&&0!==l?-r-2:r:l>0||0===l&&!t?r:-r-1}}return-r-1},this.add=function(e){var t=!e.isEmpty(),i=this.pointIndex(e.start,t);0>i&&(i=-i-1);var n=this.pointIndex(e.end,t,i);return 0>n?n=-n-1:n++,this.ranges.splice(i,n-i,e)},this.addList=function(e){for(var t=[],i=e.length;i--;)t.push.call(t,this.add(e[i]));return t},this.substractPoint=function(e){var t=this.pointIndex(e);return t>=0?this.ranges.splice(t,1):void 0},this.merge=function(){var e=[],t=this.ranges;t=t.sort(function(e,t){return n(e.start,t.start)});for(var i,s=t[0],r=1;t.length>r;r++){i=s,s=t[r];var o=n(i.end,s.start);0>o||(0!=o||i.isEmpty()||s.isEmpty())&&(0>n(i.end,s.end)&&(i.end.row=s.end.row,i.end.column=s.end.column),t.splice(r,1),e.push(s),s=i,r--)}return this.ranges=t,e},this.contains=function(e,t){return this.pointIndex({row:e,column:t})>=0},this.containsPoint=function(e){return this.pointIndex(e)>=0},this.rangeAtPoint=function(e){var t=this.pointIndex(e);return t>=0?this.ranges[t]:void 0},this.clipRows=function(e,t){var i=this.ranges;if(i[0].start.row>t||e>i[i.length-1].start.row)return[];var n=this.pointIndex({row:e,column:0});0>n&&(n=-n-1);var s=this.pointIndex({row:t,column:0},n);0>s&&(s=-s-1);for(var r=[],o=n;s>o;o++)r.push(i[o]);return r},this.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},this.attach=function(e){this.session&&this.detach(),this.session=e,this.onChange=this.$onChange.bind(this),this.session.on("change",this.onChange)},this.detach=function(){this.session&&(this.session.removeListener("change",this.onChange),this.session=null)},this.$onChange=function(e){var t=e.data.range;if("i"==e.data.action[0])var i=t.start,n=t.end;else var n=t.start,i=t.end;for(var s=i.row,r=n.row,o=r-s,a=-i.column+n.column,l=this.ranges,h=0,c=l.length;c>h;h++){var u=l[h];if(!(s>u.end.row)){if(u.start.row>s)break;if(u.start.row==s&&u.start.column>=i.column&&(u.start.column==i.column&&this.$insertRight||(u.start.column+=a,u.start.row+=o)),u.end.row==s&&u.end.column>=i.column){if(u.end.column==i.column&&this.$insertRight)continue;u.end.column==i.column&&a>0&&c-1>h&&u.end.column>u.start.column&&u.end.column==l[h+1].start.column&&(u.end.column-=a),u.end.column+=a,u.end.row+=o}}}if(0!=o&&c>h)for(;c>h;h++){var u=l[h];u.start.row+=o,u.end.row+=o}}}).call(s.prototype),t.RangeList=s}),ace.define("ace/edit_session/fold",["require","exports","module","ace/range","ace/range_list","ace/lib/oop"],function(e,t){"use strict";function i(e,t){e.row-=t.row,0==e.row&&(e.column-=t.column)}function n(e,t){i(e.start,t),i(e.end,t)}function s(e,t){0==e.row&&(e.column+=t.column),e.row+=t.row}function r(e,t){s(e.start,t),s(e.end,t)}e("../range").Range;var o=e("../range_list").RangeList,a=e("../lib/oop"),l=t.Fold=function(e,t){this.foldLine=null,this.placeholder=t,this.range=e,this.start=e.start,this.end=e.end,this.sameRow=e.start.row==e.end.row,this.subFolds=this.ranges=[]};a.inherits(l,o),function(){this.toString=function(){return'"'+this.placeholder+'" '+(""+this.range)},this.setFoldLine=function(e){this.foldLine=e,this.subFolds.forEach(function(t){t.setFoldLine(e)})},this.clone=function(){var e=this.range.clone(),t=new l(e,this.placeholder);return this.subFolds.forEach(function(e){t.subFolds.push(e.clone())}),t.collapseChildren=this.collapseChildren,t},this.addSubFold=function(e){if(!this.range.isEqual(e)){if(!this.range.containsRange(e))throw Error("A fold can't intersect already existing fold"+e.range+this.range);n(e,this.start);for(var t=e.start.row,i=e.start.column,s=0,r=-1;this.subFolds.length>s&&(r=this.subFolds[s].range.compare(t,i),1==r);s++);var o=this.subFolds[s];if(0==r)return o.addSubFold(e);for(var t=e.range.end.row,i=e.range.end.column,a=s,r=-1;this.subFolds.length>a&&(r=this.subFolds[a].range.compare(t,i),1==r);a++);if(this.subFolds[a],0==r)throw Error("A fold can't intersect already existing fold"+e.range+this.range);return this.subFolds.splice(s,a-s,e),e.setFoldLine(this.foldLine),e}},this.restoreRange=function(e){return r(e,this.start)}}.call(l.prototype)}),ace.define("ace/edit_session/folding",["require","exports","module","ace/range","ace/edit_session/fold_line","ace/edit_session/fold","ace/token_iterator"],function(e,t){"use strict";function i(){this.getFoldAt=function(e,t,i){var n=this.getFoldLine(e);if(!n)return null;for(var s=n.folds,r=0;s.length>r;r++){var o=s[r];if(o.range.contains(e,t)){if(1==i&&o.range.isEnd(e,t))continue;if(-1==i&&o.range.isStart(e,t))continue;return o}}},this.getFoldsInRange=function(e){var t=e.start,i=e.end,n=this.$foldData,s=[];t.column+=1,i.column-=1;for(var r=0;n.length>r;r++){var o=n[r].range.compareRange(e);if(2!=o){if(-2==o)break;for(var a=n[r].folds,l=0;a.length>l;l++){var h=a[l];if(o=h.range.compareRange(e),-2==o)break;if(2!=o){if(42==o)break;s.push(h)}}}}return t.column-=1,i.column+=1,s},this.getFoldsInRangeList=function(e){if(Array.isArray(e)){var t=[];e.forEach(function(e){t=t.concat(this.getFoldsInRange(e))},this)}else var t=this.getFoldsInRange(e);return t},this.getAllFolds=function(){for(var e=[],t=this.$foldData,i=0;t.length>i;i++)for(var n=0;t[i].folds.length>n;n++)e.push(t[i].folds[n]);return e},this.getFoldStringAt=function(e,t,i,n){if(n=n||this.getFoldLine(e),!n)return null;for(var s,r,o={end:{column:0}},a=0;n.folds.length>a;a++){r=n.folds[a];var l=r.range.compareEnd(e,t);if(-1==l){s=this.getLine(r.start.row).substring(o.end.column,r.start.column);break}if(0===l)return null;o=r}return s||(s=this.getLine(r.start.row).substring(o.end.column)),-1==i?s.substring(0,t-o.end.column):1==i?s.substring(t-o.end.column):s},this.getFoldLine=function(e,t){var i=this.$foldData,n=0;for(t&&(n=i.indexOf(t)),-1==n&&(n=0),n;i.length>n;n++){var s=i[n];if(e>=s.start.row&&s.end.row>=e)return s;if(s.end.row>e)return null}return null},this.getNextFoldLine=function(e,t){var i=this.$foldData,n=0;for(t&&(n=i.indexOf(t)),-1==n&&(n=0),n;i.length>n;n++){var s=i[n];if(s.end.row>=e)return s}return null},this.getFoldedRowCount=function(e,t){for(var i=this.$foldData,n=t-e+1,s=0;i.length>s;s++){var r=i[s],o=r.end.row,a=r.start.row;if(o>=t){t>a&&(a>=e?n-=t-a:n=0);break}o>=e&&(n-=a>=e?o-a:o-e+1)}return n},this.$addFoldLine=function(e){return this.$foldData.push(e),this.$foldData.sort(function(e,t){return e.start.row-t.start.row}),e},this.addFold=function(e,t){var i,n=this.$foldData,o=!1;e instanceof r?i=e:(i=new r(t,e),i.collapseChildren=t.collapseChildren),this.$clipRangeToDocument(i.range);var a=i.start.row,l=i.start.column,h=i.end.row,c=i.end.column;if(!(h>a||a==h&&c-2>=l))throw Error("The range has to be at least 2 characters width");var u=this.getFoldAt(a,l,1),d=this.getFoldAt(h,c,-1);if(u&&d==u)return u.addSubFold(i);u&&!u.range.isStart(a,l)&&this.removeFold(u),d&&!d.range.isEnd(h,c)&&this.removeFold(d);var g=this.getFoldsInRange(i.range);g.length>0&&(this.removeFolds(g),g.forEach(function(e){i.addSubFold(e)}));for(var f=0;n.length>f;f++){var m=n[f];if(h==m.start.row){m.addFold(i),o=!0;break}if(a==m.end.row){if(m.addFold(i),o=!0,!i.sameRow){var p=n[f+1];if(p&&p.start.row==h){m.merge(p);break}}break}if(m.start.row>=h)break}return o||(m=this.$addFoldLine(new s(this.$foldData,i))),this.$useWrapMode?this.$updateWrapData(m.start.row,m.start.row):this.$updateRowLengthCache(m.start.row,m.start.row),this.$modified=!0,this._emit("changeFold",{data:i,action:"add"}),i},this.addFolds=function(e){e.forEach(function(e){this.addFold(e)},this)},this.removeFold=function(e){var t=e.foldLine,i=t.start.row,n=t.end.row,s=this.$foldData,r=t.folds;if(1==r.length)s.splice(s.indexOf(t),1);else if(t.range.isEnd(e.end.row,e.end.column))r.pop(),t.end.row=r[r.length-1].end.row,t.end.column=r[r.length-1].end.column;else if(t.range.isStart(e.start.row,e.start.column))r.shift(),t.start.row=r[0].start.row,t.start.column=r[0].start.column;else if(e.sameRow)r.splice(r.indexOf(e),1);else{var o=t.split(e.start.row,e.start.column);r=o.folds,r.shift(),o.start.row=r[0].start.row,o.start.column=r[0].start.column}this.$updating||(this.$useWrapMode?this.$updateWrapData(i,n):this.$updateRowLengthCache(i,n)),this.$modified=!0,this._emit("changeFold",{data:e,action:"remove"})},this.removeFolds=function(e){for(var t=[],i=0;e.length>i;i++)t.push(e[i]);t.forEach(function(e){this.removeFold(e)},this),this.$modified=!0},this.expandFold=function(e){this.removeFold(e),e.subFolds.forEach(function(t){e.restoreRange(t),this.addFold(t)},this),e.collapseChildren>0&&this.foldAll(e.start.row+1,e.end.row,e.collapseChildren-1),e.subFolds=[]},this.expandFolds=function(e){e.forEach(function(e){this.expandFold(e)},this)},this.unfold=function(e,t){var i,s;if(null==e?(i=new n(0,0,this.getLength(),0),t=!0):i="number"==typeof e?new n(e,0,e,this.getLine(e).length):"row"in e?n.fromPoints(e,e):e,s=this.getFoldsInRangeList(i),t)this.removeFolds(s);else for(var r=s;r.length;)this.expandFolds(r),r=this.getFoldsInRangeList(i);return s.length?s:void 0},this.isRowFolded=function(e,t){return!!this.getFoldLine(e,t)},this.getRowFoldEnd=function(e,t){var i=this.getFoldLine(e,t);return i?i.end.row:e},this.getRowFoldStart=function(e,t){var i=this.getFoldLine(e,t);return i?i.start.row:e},this.getFoldDisplayLine=function(e,t,i,n,s){null==n&&(n=e.start.row),null==s&&(s=0),null==t&&(t=e.end.row),null==i&&(i=this.getLine(t).length);var r=this.doc,o="";return e.walk(function(e,t,i,a){if(!(n>t)){if(t==n){if(s>i)return;a=Math.max(s,a)}o+=null!=e?e:r.getLine(t).substring(a,i)}},t,i),o},this.getDisplayLine=function(e,t,i,n){var s=this.getFoldLine(e);if(s)return this.getFoldDisplayLine(s,e,t,i,n);var r;return r=this.doc.getLine(e),r.substring(n||0,t||r.length)},this.$cloneFoldData=function(){var e=[];return e=this.$foldData.map(function(t){var i=t.folds.map(function(e){return e.clone()});return new s(e,i)})},this.toggleFold=function(e){var t,i,n=this.selection,s=n.getRange();if(s.isEmpty()){var r=s.start;if(t=this.getFoldAt(r.row,r.column))return this.expandFold(t),void 0;(i=this.findMatchingBracket(r))?1==s.comparePoint(i)?s.end=i:(s.start=i,s.start.column++,s.end.column--):(i=this.findMatchingBracket({row:r.row,column:r.column+1}))?(1==s.comparePoint(i)?s.end=i:s.start=i,s.start.column++):s=this.getCommentFoldRange(r.row,r.column)||s}else{var o=this.getFoldsInRange(s);if(e&&o.length)return this.expandFolds(o),void 0;1==o.length&&(t=o[0])}if(t||(t=this.getFoldAt(s.start.row,s.start.column)),t&&""+t.range==""+s)return this.expandFold(t),void 0;var a="...";
|
8 |
+
if(!s.isMultiLine()){if(a=this.getTextRange(s),4>a.length)return;a=a.trim().substring(0,2)+".."}this.addFold(a,s)},this.getCommentFoldRange=function(e,t,i){var s=new o(this,e,t),r=s.getCurrentToken();if(r&&/^comment|string/.test(r.type)){var a=new n,l=RegExp(r.type.replace(/\..*/,"\\."));if(1!=i){do r=s.stepBackward();while(r&&l.test(r.type));s.stepForward()}if(a.start.row=s.getCurrentTokenRow(),a.start.column=s.getCurrentTokenColumn()+2,s=new o(this,e,t),-1!=i){do r=s.stepForward();while(r&&l.test(r.type));r=s.stepBackward()}else r=s.getCurrentToken();return a.end.row=s.getCurrentTokenRow(),a.end.column=s.getCurrentTokenColumn()+r.value.length-2,a}},this.foldAll=function(e,t,i){void 0==i&&(i=1e5);var n=this.foldWidgets;if(n){t=t||this.getLength(),e=e||0;for(var s=e;t>s;s++)if(null==n[s]&&(n[s]=this.getFoldWidget(s)),"start"==n[s]){var r=this.getFoldWidgetRange(s);if(r&&r.isMultiLine()&&t>=r.end.row&&r.start.row>=e){s=r.end.row;try{var o=this.addFold("...",r);o&&(o.collapseChildren=i)}catch(a){}}}}},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle="markbegin",this.setFoldStyle=function(e){if(!this.$foldStyles[e])throw Error("invalid fold style: "+e+"["+Object.keys(this.$foldStyles).join(", ")+"]");if(this.$foldStyle!=e){this.$foldStyle=e,"manual"==e&&this.unfold();var t=this.$foldMode;this.$setFolding(null),this.$setFolding(t)}},this.$setFolding=function(e){if(this.$foldMode!=e){if(this.$foldMode=e,this.removeListener("change",this.$updateFoldWidgets),this._emit("changeAnnotation"),!e||"manual"==this.$foldStyle)return this.foldWidgets=null,void 0;this.foldWidgets=[],this.getFoldWidget=e.getFoldWidget.bind(e,this,this.$foldStyle),this.getFoldWidgetRange=e.getFoldWidgetRange.bind(e,this,this.$foldStyle),this.$updateFoldWidgets=this.updateFoldWidgets.bind(this),this.on("change",this.$updateFoldWidgets)}},this.getParentFoldRangeData=function(e,t){var i=this.foldWidgets;if(!i||t&&i[e])return{};for(var n,s=e-1;s>=0;){var r=i[s];if(null==r&&(r=i[s]=this.getFoldWidget(s)),"start"==r){var o=this.getFoldWidgetRange(s);if(n||(n=o),o&&o.end.row>=e)break}s--}return{range:-1!==s&&o,firstRange:n}},this.onFoldWidgetClick=function(e,t){t=t.domEvent;var i={children:t.shiftKey,all:t.ctrlKey||t.metaKey,siblings:t.altKey},n=this.$toggleFoldWidget(e,i);if(!n){var s=t.target||t.srcElement;s&&/ace_fold-widget/.test(s.className)&&(s.className+=" ace_invalid")}},this.$toggleFoldWidget=function(e,t){if(this.getFoldWidget){var i=this.getFoldWidget(e),n=this.getLine(e),s="end"===i?-1:1,r=this.getFoldAt(e,-1===s?0:n.length,s);if(r)return t.children||t.all?this.removeFold(r):this.expandFold(r),void 0;var o=this.getFoldWidgetRange(e,!0);if(o&&!o.isMultiLine()&&(r=this.getFoldAt(o.start.row,o.start.column,1),r&&o.isEqual(r.range)))return this.removeFold(r),void 0;if(t.siblings){var a=this.getParentFoldRangeData(e);if(a.range)var l=a.range.start.row+1,h=a.range.end.row;this.foldAll(l,h,t.all?1e4:0)}else t.children?(h=o?o.end.row:this.getLength(),this.foldAll(e+1,o.end.row,t.all?1e4:0)):o&&(t.all&&(o.collapseChildren=1e4),this.addFold("...",o));return o}},this.toggleFoldWidget=function(){var e=this.selection.getCursor().row;e=this.getRowFoldStart(e);var t=this.$toggleFoldWidget(e,{});if(!t){var i=this.getParentFoldRangeData(e,!0);if(t=i.range||i.firstRange){e=t.start.row;var n=this.getFoldAt(e,this.getLine(e).length,1);n?this.removeFold(n):this.addFold("...",t)}}},this.updateFoldWidgets=function(e){var t=e.data,i=t.range,n=i.start.row,s=i.end.row-n;if(0===s)this.foldWidgets[n]=null;else if("removeText"==t.action||"removeLines"==t.action)this.foldWidgets.splice(n,s+1,null);else{var r=Array(s+1);r.unshift(n,1),this.foldWidgets.splice.apply(this.foldWidgets,r)}}}var n=e("../range").Range,s=e("./fold_line").FoldLine,r=e("./fold").Fold,o=e("../token_iterator").TokenIterator;t.Folding=i}),ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(e,t){"use strict";function i(){this.findMatchingBracket=function(e,t){if(0==e.column)return null;var i=t||this.getLine(e.row).charAt(e.column-1);if(""==i)return null;var n=i.match(/([\(\[\{])|([\)\]\}])/);return n?n[1]?this.$findClosingBracket(n[1],e):this.$findOpeningBracket(n[2],e):null},this.getBracketRange=function(e){var t,i=this.getLine(e.row),n=!0,r=i.charAt(e.column-1),o=r&&r.match(/([\(\[\{])|([\)\]\}])/);if(o||(r=i.charAt(e.column),e={row:e.row,column:e.column+1},o=r&&r.match(/([\(\[\{])|([\)\]\}])/),n=!1),!o)return null;if(o[1]){var a=this.$findClosingBracket(o[1],e);if(!a)return null;t=s.fromPoints(e,a),n||(t.end.column++,t.start.column--),t.cursor=t.end}else{var a=this.$findOpeningBracket(o[2],e);if(!a)return null;t=s.fromPoints(a,e),n||(t.start.column++,t.end.column--),t.cursor=t.start}return t},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{"},this.$findOpeningBracket=function(e,t,i){var s=this.$brackets[e],r=1,o=new n(this,t.row,t.column),a=o.getCurrentToken();if(a||(a=o.stepForward()),a){i||(i=RegExp("(\\.?"+a.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end|start|begin)\b/,"")+")+"));for(var l=t.column-o.getCurrentTokenColumn()-2,h=a.value;;){for(;l>=0;){var c=h.charAt(l);if(c==s){if(r-=1,0==r)return{row:o.getCurrentTokenRow(),column:l+o.getCurrentTokenColumn()}}else c==e&&(r+=1);l-=1}do a=o.stepBackward();while(a&&!i.test(a.type));if(null==a)break;h=a.value,l=h.length-1}return null}},this.$findClosingBracket=function(e,t,i){var s=this.$brackets[e],r=1,o=new n(this,t.row,t.column),a=o.getCurrentToken();if(a||(a=o.stepForward()),a){i||(i=RegExp("(\\.?"+a.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:end|start|begin)\b/,"")+")+"));for(var l=t.column-o.getCurrentTokenColumn();;){for(var h=a.value,c=h.length;c>l;){var u=h.charAt(l);if(u==s){if(r-=1,0==r)return{row:o.getCurrentTokenRow(),column:l+o.getCurrentTokenColumn()}}else u==e&&(r+=1);l+=1}do a=o.stepForward();while(a&&!i.test(a.type));if(null==a)break;l=0}return null}}}var n=e("../token_iterator").TokenIterator,s=e("../range").Range;t.BracketMatch=i}),ace.define("ace/edit_session",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/config","ace/lib/event_emitter","ace/selection","ace/mode/text","ace/range","ace/document","ace/background_tokenizer","ace/search_highlight","ace/edit_session/folding","ace/edit_session/bracket_match"],function(e,t){"use strict";var i=e("./lib/oop"),n=e("./lib/lang"),s=e("./config"),r=e("./lib/event_emitter").EventEmitter,o=e("./selection").Selection,a=e("./mode/text").Mode,l=e("./range").Range,h=e("./document").Document,c=e("./background_tokenizer").BackgroundTokenizer,u=e("./search_highlight").SearchHighlight,d=function(e,t){this.$breakpoints=[],this.$decorations=[],this.$frontMarkers={},this.$backMarkers={},this.$markerId=1,this.$undoSelect=!0,this.$foldData=[],this.$foldData.toString=function(){return this.join("\n")},this.on("changeFold",this.onChangeFold.bind(this)),this.$onChange=this.onChange.bind(this),"object"==typeof e&&e.getLine||(e=new h(e)),this.setDocument(e),this.selection=new o(this),s.resetOptions(this),this.setMode(t),s._signal("session",this)};(function(){function e(e){return 4352>e?!1:e>=4352&&4447>=e||e>=4515&&4519>=e||e>=4602&&4607>=e||e>=9001&&9002>=e||e>=11904&&11929>=e||e>=11931&&12019>=e||e>=12032&&12245>=e||e>=12272&&12283>=e||e>=12288&&12350>=e||e>=12353&&12438>=e||e>=12441&&12543>=e||e>=12549&&12589>=e||e>=12593&&12686>=e||e>=12688&&12730>=e||e>=12736&&12771>=e||e>=12784&&12830>=e||e>=12832&&12871>=e||e>=12880&&13054>=e||e>=13056&&19903>=e||e>=19968&&42124>=e||e>=42128&&42182>=e||e>=43360&&43388>=e||e>=44032&&55203>=e||e>=55216&&55238>=e||e>=55243&&55291>=e||e>=63744&&64255>=e||e>=65040&&65049>=e||e>=65072&&65106>=e||e>=65108&&65126>=e||e>=65128&&65131>=e||e>=65281&&65376>=e||e>=65504&&65510>=e}i.implement(this,r),this.setDocument=function(e){this.doc&&this.doc.removeListener("change",this.$onChange),this.doc=e,e.on("change",this.$onChange),this.bgTokenizer&&this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},this.getDocument=function(){return this.doc},this.$resetRowCache=function(e){if(!e)return this.$docRowCache=[],this.$screenRowCache=[],void 0;var t=this.$docRowCache.length,i=this.$getRowCacheIndex(this.$docRowCache,e)+1;t>i&&(this.$docRowCache.splice(i,t),this.$screenRowCache.splice(i,t))},this.$getRowCacheIndex=function(e,t){for(var i=0,n=e.length-1;n>=i;){var s=i+n>>1,r=e[s];if(t>r)i=s+1;else{if(!(r>t))return s;n=s-1}}return i-1},this.resetCaches=function(){this.$modified=!0,this.$wrapData=[],this.$rowLengthCache=[],this.$resetRowCache(0),this.bgTokenizer&&this.bgTokenizer.start(0)},this.onChangeFold=function(e){var t=e.data;this.$resetRowCache(t.start.row)},this.onChange=function(e){var t=e.data;this.$modified=!0,this.$resetRowCache(t.range.start.row);var i=this.$updateInternalDataOnChange(e);this.$fromUndo||!this.$undoManager||t.ignore||(this.$deltasDoc.push(t),i&&0!=i.length&&this.$deltasFold.push({action:"removeFolds",folds:i}),this.$informUndoManager.schedule()),this.bgTokenizer&&this.bgTokenizer.$updateOnChange(t),this._signal("change",e)},this.setValue=function(e){this.doc.setValue(e),this.selection.moveTo(0,0),this.$resetRowCache(0),this.$deltas=[],this.$deltasDoc=[],this.$deltasFold=[],this.setUndoManager(this.$undoManager),this.getUndoManager().reset()},this.getValue=this.toString=function(){return this.doc.getValue()},this.getSelection=function(){return this.selection},this.getState=function(e){return this.bgTokenizer.getState(e)},this.getTokens=function(e){return this.bgTokenizer.getTokens(e)},this.getTokenAt=function(e,t){var i,n=this.bgTokenizer.getTokens(e),s=0;if(null==t)r=n.length-1,s=this.getLine(e).length;else for(var r=0;n.length>r&&(s+=n[r].value.length,!(s>=t));r++);return(i=n[r])?(i.index=r,i.start=s-i.value.length,i):null},this.setUndoManager=function(e){if(this.$undoManager=e,this.$deltas=[],this.$deltasDoc=[],this.$deltasFold=[],this.$informUndoManager&&this.$informUndoManager.cancel(),e){var t=this;this.$syncInformUndoManager=function(){t.$informUndoManager.cancel(),t.$deltasFold.length&&(t.$deltas.push({group:"fold",deltas:t.$deltasFold}),t.$deltasFold=[]),t.$deltasDoc.length&&(t.$deltas.push({group:"doc",deltas:t.$deltasDoc}),t.$deltasDoc=[]),t.$deltas.length>0&&e.execute({action:"aceupdate",args:[t.$deltas,t],merge:t.mergeUndoDeltas}),t.mergeUndoDeltas=!1,t.$deltas=[]},this.$informUndoManager=n.delayedCall(this.$syncInformUndoManager)}},this.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},this.$defaultUndoManager={undo:function(){},redo:function(){},reset:function(){}},this.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},this.getTabString=function(){return this.getUseSoftTabs()?n.stringRepeat(" ",this.getTabSize()):" "},this.setUseSoftTabs=function(e){this.setOption("useSoftTabs",e)},this.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},this.setTabSize=function(e){this.setOption("tabSize",e)},this.getTabSize=function(){return this.$tabSize},this.isTabStop=function(e){return this.$useSoftTabs&&0===e.column%this.$tabSize},this.$overwrite=!1,this.setOverwrite=function(e){this.setOption("overwrite",e)},this.getOverwrite=function(){return this.$overwrite},this.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},this.addGutterDecoration=function(e,t){this.$decorations[e]||(this.$decorations[e]=""),this.$decorations[e]+=" "+t,this._signal("changeBreakpoint",{})},this.removeGutterDecoration=function(e,t){this.$decorations[e]=(this.$decorations[e]||"").replace(" "+t,""),this._signal("changeBreakpoint",{})},this.getBreakpoints=function(){return this.$breakpoints},this.setBreakpoints=function(e){this.$breakpoints=[];for(var t=0;e.length>t;t++)this.$breakpoints[e[t]]="ace_breakpoint";this._signal("changeBreakpoint",{})},this.clearBreakpoints=function(){this.$breakpoints=[],this._signal("changeBreakpoint",{})},this.setBreakpoint=function(e,t){void 0===t&&(t="ace_breakpoint"),t?this.$breakpoints[e]=t:delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},this.clearBreakpoint=function(e){delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},this.addMarker=function(e,t,i,n){var s=this.$markerId++,r={range:e,type:i||"line",renderer:"function"==typeof i?i:null,clazz:t,inFront:!!n,id:s};return n?(this.$frontMarkers[s]=r,this._signal("changeFrontMarker")):(this.$backMarkers[s]=r,this._signal("changeBackMarker")),s},this.addDynamicMarker=function(e,t){if(e.update){var i=this.$markerId++;return e.id=i,e.inFront=!!t,t?(this.$frontMarkers[i]=e,this._signal("changeFrontMarker")):(this.$backMarkers[i]=e,this._signal("changeBackMarker")),e}},this.removeMarker=function(e){var t=this.$frontMarkers[e]||this.$backMarkers[e];if(t){var i=t.inFront?this.$frontMarkers:this.$backMarkers;t&&(delete i[e],this._signal(t.inFront?"changeFrontMarker":"changeBackMarker"))}},this.getMarkers=function(e){return e?this.$frontMarkers:this.$backMarkers},this.highlight=function(e){if(!this.$searchHighlight){var t=new u(null,"ace_selected-word","text");this.$searchHighlight=this.addDynamicMarker(t)}this.$searchHighlight.setRegexp(e)},this.highlightLines=function(e,t,i,n){"number"!=typeof t&&(i=t,t=e),i||(i="ace_step");var s=new l(e,0,t,1/0);return s.id=this.addMarker(s,i,"fullLine",n),s},this.setAnnotations=function(e){this.$annotations=e,this._signal("changeAnnotation",{})},this.getAnnotations=function(){return this.$annotations||[]},this.clearAnnotations=function(){this.setAnnotations([])},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r?\n)/m);this.$autoNewLine=t?t[1]:"\n"},this.getWordRange=function(e,t){var i=this.getLine(e),n=!1;if(t>0&&(n=!!i.charAt(t-1).match(this.tokenRe)),n||(n=!!i.charAt(t).match(this.tokenRe)),n)var s=this.tokenRe;else if(/^\s+$/.test(i.slice(t-1,t+1)))var s=/\s/;else var s=this.nonTokenRe;var r=t;if(r>0){do r--;while(r>=0&&i.charAt(r).match(s));r++}for(var o=t;i.length>o&&i.charAt(o).match(s);)o++;return new l(e,r,e,o)},this.getAWordRange=function(e,t){for(var i=this.getWordRange(e,t),n=this.getLine(i.end.row);n.charAt(i.end.column).match(/[ \t]/);)i.end.column+=1;return i},this.setNewLineMode=function(e){this.doc.setNewLineMode(e)},this.getNewLineMode=function(){return this.doc.getNewLineMode()},this.setUseWorker=function(e){this.setOption("useWorker",e)},this.getUseWorker=function(){return this.$useWorker},this.onReloadTokenizer=function(e){var t=e.data;this.bgTokenizer.start(t.first),this._signal("tokenizerUpdate",e)},this.$modes={},this.$mode=null,this.$modeId=null,this.setMode=function(e,t){if(e&&"object"==typeof e){if(e.getTokenizer)return this.$onChangeMode(e);var i=e,n=i.path}else n=e||"ace/mode/text";return this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new a),this.$modes[n]&&!i?(this.$onChangeMode(this.$modes[n]),t&&t(),void 0):(this.$modeId=n,s.loadModule(["mode",n],function(e){return this.$modeId!==n?t&&t():this.$modes[n]&&!i?this.$onChangeMode(this.$modes[n]):(e&&e.Mode&&(e=new e.Mode(i),i||(this.$modes[n]=e,e.$id=n),this.$onChangeMode(e),t&&t()),void 0)}.bind(this)),this.$mode||this.$onChangeMode(this.$modes["ace/mode/text"],!0),void 0)},this.$onChangeMode=function(e,t){if(t||(this.$modeId=e.$id),this.$mode!==e){this.$mode=e,this.$stopWorker(),this.$useWorker&&this.$startWorker();var i=e.getTokenizer();if(void 0!==i.addEventListener){var n=this.onReloadTokenizer.bind(this);i.addEventListener("update",n)}if(this.bgTokenizer)this.bgTokenizer.setTokenizer(i);else{this.bgTokenizer=new c(i);var s=this;this.bgTokenizer.addEventListener("update",function(e){s._signal("tokenizerUpdate",e)})}this.bgTokenizer.setDocument(this.getDocument()),this.tokenRe=e.tokenRe,this.nonTokenRe=e.nonTokenRe,t||(e.attachToSession&&e.attachToSession(this),this.$options.wrapMethod.set.call(this,this.$wrapMethod),this.$setFolding(e.foldingRules),this.bgTokenizer.start(0),this._emit("changeMode"))}},this.$stopWorker=function(){this.$worker&&(this.$worker.terminate(),this.$worker=null)},this.$startWorker=function(){try{this.$worker=this.$mode.createWorker(this)}catch(e){"object"==typeof console&&(console.log("Could not load worker"),console.log(e)),this.$worker=null}},this.getMode=function(){return this.$mode},this.$scrollTop=0,this.setScrollTop=function(e){this.$scrollTop===e||isNaN(e)||(this.$scrollTop=e,this._signal("changeScrollTop",e))},this.getScrollTop=function(){return this.$scrollTop},this.$scrollLeft=0,this.setScrollLeft=function(e){this.$scrollLeft===e||isNaN(e)||(this.$scrollLeft=e,this._signal("changeScrollLeft",e))},this.getScrollLeft=function(){return this.$scrollLeft},this.getScreenWidth=function(){return this.$computeWidth(),this.lineWidgets?Math.max(this.getLineWidgetMaxWidth(),this.screenWidth):this.screenWidth},this.getLineWidgetMaxWidth=function(){if(null!=this.lineWidgetsWidth)return this.lineWidgetsWidth;var e=0;return this.lineWidgets.forEach(function(t){t&&t.screenWidth>e&&(e=t.screenWidth)}),this.lineWidgetWidth=e},this.$computeWidth=function(e){if(this.$modified||e){if(this.$modified=!1,this.$useWrapMode)return this.screenWidth=this.$wrapLimit;for(var t=this.doc.getAllLines(),i=this.$rowLengthCache,n=0,s=0,r=this.$foldData[s],o=r?r.start.row:1/0,a=t.length,l=0;a>l;l++){if(l>o){if(l=r.end.row+1,l>=a)break;r=this.$foldData[s++],o=r?r.start.row:1/0}null==i[l]&&(i[l]=this.$getStringScreenWidth(t[l])[0]),i[l]>n&&(n=i[l])}this.screenWidth=n}},this.getLine=function(e){return this.doc.getLine(e)},this.getLines=function(e,t){return this.doc.getLines(e,t)},this.getLength=function(){return this.doc.getLength()},this.getTextRange=function(e){return this.doc.getTextRange(e||this.selection.getRange())},this.insert=function(e,t){return this.doc.insert(e,t)},this.remove=function(e){return this.doc.remove(e)},this.undoChanges=function(e,t){if(e.length){this.$fromUndo=!0;for(var i=null,n=e.length-1;-1!=n;n--){var s=e[n];"doc"==s.group?(this.doc.revertDeltas(s.deltas),i=this.$getUndoSelection(s.deltas,!0,i)):s.deltas.forEach(function(e){this.addFolds(e.folds)},this)}return this.$fromUndo=!1,i&&this.$undoSelect&&!t&&this.selection.setSelectionRange(i),i}},this.redoChanges=function(e,t){if(e.length){this.$fromUndo=!0;for(var i=null,n=0;e.length>n;n++){var s=e[n];"doc"==s.group&&(this.doc.applyDeltas(s.deltas),i=this.$getUndoSelection(s.deltas,!1,i))}return this.$fromUndo=!1,i&&this.$undoSelect&&!t&&this.selection.setSelectionRange(i),i}},this.setUndoSelect=function(e){this.$undoSelect=e},this.$getUndoSelection=function(e,t,i){function n(e){var i="insertText"===e.action||"insertLines"===e.action;return t?!i:i}var s,r,o=e[0],a=!1;n(o)?(s=l.fromPoints(o.range.start,o.range.end),a=!0):(s=l.fromPoints(o.range.start,o.range.start),a=!1);for(var h=1;e.length>h;h++)o=e[h],n(o)?(r=o.range.start,-1==s.compare(r.row,r.column)&&s.setStart(o.range.start),r=o.range.end,1==s.compare(r.row,r.column)&&s.setEnd(o.range.end),a=!0):(r=o.range.start,-1==s.compare(r.row,r.column)&&(s=l.fromPoints(o.range.start,o.range.start)),a=!1);if(null!=i){0===l.comparePoints(i.start,s.start)&&(i.start.column+=s.end.column-s.start.column,i.end.column+=s.end.column-s.start.column);var c=i.compareRange(s);1==c?s.setStart(i.start):-1==c&&s.setEnd(i.end)}return s},this.replace=function(e,t){return this.doc.replace(e,t)},this.moveText=function(e,t,i){var n=this.getTextRange(e),s=this.getFoldsInRange(e),r=l.fromPoints(t,t);if(!i){this.remove(e);var o=e.start.row-e.end.row,a=o?-e.end.column:e.start.column-e.end.column;a&&(r.start.row==e.end.row&&r.start.column>e.end.column&&(r.start.column+=a),r.end.row==e.end.row&&r.end.column>e.end.column&&(r.end.column+=a)),o&&r.start.row>=e.end.row&&(r.start.row+=o,r.end.row+=o)}if(r.end=this.insert(r.start,n),s.length){var h=e.start,c=r.start,o=c.row-h.row,a=c.column-h.column;this.addFolds(s.map(function(e){return e=e.clone(),e.start.row==h.row&&(e.start.column+=a),e.end.row==h.row&&(e.end.column+=a),e.start.row+=o,e.end.row+=o,e}))}return r},this.indentRows=function(e,t,i){i=i.replace(/\t/g,this.getTabString());for(var n=e;t>=n;n++)this.insert({row:n,column:0},i)},this.outdentRows=function(e){for(var t=e.collapseRows(),i=new l(0,0,0,0),n=this.getTabSize(),s=t.start.row;t.end.row>=s;++s){var r=this.getLine(s);i.start.row=s,i.end.row=s;for(var o=0;n>o&&" "==r.charAt(o);++o);n>o&&" "==r.charAt(o)?(i.start.column=o,i.end.column=o+1):(i.start.column=0,i.end.column=o),this.remove(i)}},this.$moveLines=function(e,t,i){if(e=this.getRowFoldStart(e),t=this.getRowFoldEnd(t),0>i){var n=this.getRowFoldStart(e+i);if(0>n)return 0;var s=n-e}else if(i>0){var n=this.getRowFoldEnd(t+i);if(n>this.doc.getLength()-1)return 0;var s=n-t}else{e=this.$clipRowToDocument(e),t=this.$clipRowToDocument(t);var s=t-e+1}var r=new l(e,0,t,Number.MAX_VALUE),o=this.getFoldsInRange(r).map(function(e){return e=e.clone(),e.start.row+=s,e.end.row+=s,e}),a=0==i?this.doc.getLines(e,t):this.doc.removeLines(e,t);return this.doc.insertLines(e+s,a),o.length&&this.addFolds(o),s},this.moveLinesUp=function(e,t){return this.$moveLines(e,t,-1)},this.moveLinesDown=function(e,t){return this.$moveLines(e,t,1)},this.duplicateLines=function(e,t){return this.$moveLines(e,t,0)},this.$clipRowToDocument=function(e){return Math.max(0,Math.min(e,this.doc.getLength()-1))},this.$clipColumnToRow=function(e,t){return 0>t?0:Math.min(this.doc.getLine(e).length,t)},this.$clipPositionToDocument=function(e,t){if(t=Math.max(0,t),0>e)e=0,t=0;else{var i=this.doc.getLength();e>=i?(e=i-1,t=this.doc.getLine(i-1).length):t=Math.min(this.doc.getLine(e).length,t)}return{row:e,column:t}},this.$clipRangeToDocument=function(e){0>e.start.row?(e.start.row=0,e.start.column=0):e.start.column=this.$clipColumnToRow(e.start.row,e.start.column);var t=this.doc.getLength()-1;return e.end.row>t?(e.end.row=t,e.end.column=this.doc.getLine(t).length):e.end.column=this.$clipColumnToRow(e.end.row,e.end.column),e},this.$wrapLimit=80,this.$useWrapMode=!1,this.$wrapLimitRange={min:null,max:null},this.setUseWrapMode=function(e){if(e!=this.$useWrapMode){if(this.$useWrapMode=e,this.$modified=!0,this.$resetRowCache(0),e){var t=this.getLength();this.$wrapData=Array(t),this.$updateWrapData(0,t-1)}this._signal("changeWrapMode")}},this.getUseWrapMode=function(){return this.$useWrapMode},this.setWrapLimitRange=function(e,t){(this.$wrapLimitRange.min!==e||this.$wrapLimitRange.max!==t)&&(this.$wrapLimitRange={min:e,max:t},this.$modified=!0,this._signal("changeWrapMode"))},this.adjustWrapLimit=function(e,t){var i=this.$wrapLimitRange;0>i.max&&(i={min:t,max:t});var n=this.$constrainWrapLimit(e,i.min,i.max);return n!=this.$wrapLimit&&n>1?(this.$wrapLimit=n,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0):!1},this.$constrainWrapLimit=function(e,t,i){return t&&(e=Math.max(t,e)),i&&(e=Math.min(i,e)),e},this.getWrapLimit=function(){return this.$wrapLimit},this.setWrapLimit=function(e){this.setWrapLimitRange(e,e)},this.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},this.$updateInternalDataOnChange=function(e){var t,i=this.$useWrapMode,n=e.data.action,s=e.data.range.start.row,r=e.data.range.end.row,o=e.data.range.start,a=e.data.range.end,l=null;if(-1!=n.indexOf("Lines")?(r="insertLines"==n?s+e.data.lines.length:s,t=e.data.lines?e.data.lines.length:r-s):t=r-s,this.$updating=!0,0!=t)if(-1!=n.indexOf("remove")){this[i?"$wrapData":"$rowLengthCache"].splice(s,t);var h=this.$foldData;l=this.getFoldsInRange(e.data.range),this.removeFolds(l);var c=this.getFoldLine(a.row),u=0;if(c){c.addRemoveChars(a.row,a.column,o.column-a.column),c.shiftRow(-t);var d=this.getFoldLine(s);d&&d!==c&&(d.merge(c),c=d),u=h.indexOf(c)+1}for(u;h.length>u;u++){var c=h[u];c.start.row>=a.row&&c.shiftRow(-t)}r=s}else{var g=Array(t);g.unshift(s,0);var f=i?this.$wrapData:this.$rowLengthCache;f.splice.apply(f,g);var h=this.$foldData,c=this.getFoldLine(s),u=0;if(c){var m=c.range.compareInside(o.row,o.column);0==m?(c=c.split(o.row,o.column),c&&(c.shiftRow(t),c.addRemoveChars(r,0,a.column-o.column))):-1==m&&(c.addRemoveChars(s,0,a.column-o.column),c.shiftRow(t)),u=h.indexOf(c)+1}for(u;h.length>u;u++){var c=h[u];c.start.row>=s&&c.shiftRow(t)}}else{t=Math.abs(e.data.range.start.column-e.data.range.end.column),-1!=n.indexOf("remove")&&(l=this.getFoldsInRange(e.data.range),this.removeFolds(l),t=-t);var c=this.getFoldLine(s);c&&c.addRemoveChars(s,o.column,t)}return i&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,i?this.$updateWrapData(s,r):this.$updateRowLengthCache(s,r),l},this.$updateRowLengthCache=function(e,t){this.$rowLengthCache[e]=null,this.$rowLengthCache[t]=null},this.$updateWrapData=function(e,t){var i,n,s=this.doc.getAllLines(),r=this.getTabSize(),o=this.$wrapData,a=this.$wrapLimit,l=e;for(t=Math.min(t,s.length-1);t>=l;)n=this.getFoldLine(l,n),n?(i=[],n.walk(function(e,t,n,r){var o;if(null!=e){o=this.$getDisplayTokens(e,i.length),o[0]=h;for(var a=1;o.length>a;a++)o[a]=d}else o=this.$getDisplayTokens(s[t].substring(r,n),i.length);i=i.concat(o)}.bind(this),n.end.row,s[n.end.row].length+1),o[n.start.row]=this.$computeWrapSplits(i,a,r),l=n.end.row+1):(i=this.$getDisplayTokens(s[l]),o[l]=this.$computeWrapSplits(i,a,r),l++)};var t=1,o=2,h=3,d=4,g=9,f=10,m=11,p=12;this.$computeWrapSplits=function(e,t){function i(t){var i=e.slice(r,t),s=i.length;i.join("").replace(/12/g,function(){s-=1}).replace(/2/g,function(){s-=1}),a+=s,n.push(a),r=t}if(0==e.length)return[];for(var n=[],s=e.length,r=0,a=0,l=this.$wrapAsCode;s-r>t;){var c=r+t;if(e[c-1]>=f&&e[c]>=f)i(c);else if(e[c]!=h&&e[c]!=d){for(var u=Math.max(c-(l?10:t-(t>>2)),r-1);c>u&&h>e[c];)c--;if(l){for(;c>u&&h>e[c];)c--;for(;c>u&&e[c]==g;)c--}else for(;c>u&&f>e[c];)c--;c>u?i(++c):(c=r+t,e[c]==o&&c--,i(c))}else{for(c;c!=r-1&&e[c]!=h;c--);if(c>r){i(c);continue}for(c=r+t;e.length>c&&e[c]==d;c++);if(c==e.length)break;i(c)}}return n},this.$getDisplayTokens=function(i,n){var s,r=[];n=n||0;for(var a=0;i.length>a;a++){var l=i.charCodeAt(a);if(9==l){s=this.getScreenTabSize(r.length+n),r.push(m);for(var h=1;s>h;h++)r.push(p)}else 32==l?r.push(f):l>39&&48>l||l>57&&64>l?r.push(g):l>=4352&&e(l)?r.push(t,o):r.push(t)}return r},this.$getStringScreenWidth=function(t,i,n){if(0==i)return[0,0];null==i&&(i=1/0),n=n||0;var s,r;for(r=0;t.length>r&&(s=t.charCodeAt(r),n+=9==s?this.getScreenTabSize(n):s>=4352&&e(s)?2:1,!(n>i));r++);return[n,r]},this.lineWidgets=null,this.getRowLength=function(e){if(this.lineWidgets)var t=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0;else t=0;return this.$useWrapMode&&this.$wrapData[e]?this.$wrapData[e].length+1+t:1+t},this.getRowLineCount=function(e){return this.$useWrapMode&&this.$wrapData[e]?this.$wrapData[e].length+1:1},this.getScreenLastRowColumn=function(e){var t=this.screenToDocumentPosition(e,Number.MAX_VALUE);return this.documentToScreenColumn(t.row,t.column)},this.getDocumentLastRowColumn=function(e,t){var i=this.documentToScreenRow(e,t);return this.getScreenLastRowColumn(i)},this.getDocumentLastRowColumnPosition=function(e,t){var i=this.documentToScreenRow(e,t);return this.screenToDocumentPosition(i,Number.MAX_VALUE/10)},this.getRowSplitData=function(e){return this.$useWrapMode?this.$wrapData[e]:void 0},this.getScreenTabSize=function(e){return this.$tabSize-e%this.$tabSize},this.screenToDocumentRow=function(e,t){return this.screenToDocumentPosition(e,t).row},this.screenToDocumentColumn=function(e,t){return this.screenToDocumentPosition(e,t).column},this.screenToDocumentPosition=function(e,t){if(0>e)return{row:0,column:0};var i,n,s=0,r=0,o=0,a=0,l=this.$screenRowCache,h=this.$getRowCacheIndex(l,e),c=l.length;if(c&&h>=0)var o=l[h],s=this.$docRowCache[h],u=e>l[c-1];else var u=!c;for(var d=this.getLength()-1,g=this.getNextFoldLine(s),f=g?g.start.row:1/0;e>=o&&(a=this.getRowLength(s),!(o+a>e||s>=d));)o+=a,s++,s>f&&(s=g.end.row+1,g=this.getNextFoldLine(s,g),f=g?g.start.row:1/0),u&&(this.$docRowCache.push(s),this.$screenRowCache.push(o));if(g&&s>=g.start.row)i=this.getFoldDisplayLine(g),s=g.start.row;else{if(e>=o+a||s>d)return{row:d,column:this.getLine(d).length};i=this.getLine(s),g=null}if(this.$useWrapMode){var m=this.$wrapData[s];if(m){var p=Math.floor(e-o);n=m[p],p>0&&m.length&&(r=m[p-1]||m[m.length-1],i=i.substring(r))}}return r+=this.$getStringScreenWidth(i,t)[1],this.$useWrapMode&&r>=n&&(r=n-1),g?g.idxToPosition(r):{row:s,column:r}},this.documentToScreenPosition=function(e,t){if(t===void 0)var i=this.$clipPositionToDocument(e.row,e.column);else i=this.$clipPositionToDocument(e,t);e=i.row,t=i.column;var n=0,s=null,r=null;r=this.getFoldAt(e,t,1),r&&(e=r.start.row,t=r.start.column);var o,a=0,l=this.$docRowCache,h=this.$getRowCacheIndex(l,e),c=l.length;if(c&&h>=0)var a=l[h],n=this.$screenRowCache[h],u=e>l[c-1];else var u=!c;for(var d=this.getNextFoldLine(a),g=d?d.start.row:1/0;e>a;){if(a>=g){if(o=d.end.row+1,o>e)break;d=this.getNextFoldLine(o,d),g=d?d.start.row:1/0}else o=a+1;n+=this.getRowLength(a),a=o,u&&(this.$docRowCache.push(a),this.$screenRowCache.push(n))}var f="";if(d&&a>=g?(f=this.getFoldDisplayLine(d,e,t),s=d.start.row):(f=this.getLine(e).substring(0,t),s=e),this.$useWrapMode){var m=this.$wrapData[s];if(m){for(var p=0;f.length>=m[p];)n++,p++;f=f.substring(m[p-1]||0,f.length)}}return{row:n,column:this.$getStringScreenWidth(f)[0]}},this.documentToScreenColumn=function(e,t){return this.documentToScreenPosition(e,t).column},this.documentToScreenRow=function(e,t){return this.documentToScreenPosition(e,t).row},this.getScreenLength=function(){var e=0,t=null;if(this.$useWrapMode)for(var i=this.$wrapData.length,n=0,s=0,t=this.$foldData[s++],r=t?t.start.row:1/0;i>n;){var o=this.$wrapData[n];e+=o?o.length+1:1,n++,n>r&&(n=t.end.row+1,t=this.$foldData[s++],r=t?t.start.row:1/0)}else{e=this.getLength();for(var a=this.$foldData,s=0;a.length>s;s++)t=a[s],e-=t.end.row-t.start.row}return this.lineWidgets&&(e+=this.$getWidgetScreenLength()),e},this.$setFontMetrics=function(){},this.destroy=function(){this.bgTokenizer&&(this.bgTokenizer.setDocument(null),this.bgTokenizer=null),this.$stopWorker()}}).call(d.prototype),e("./edit_session/folding").Folding.call(d.prototype),e("./edit_session/bracket_match").BracketMatch.call(d.prototype),s.defineOptions(d.prototype,"session",{wrap:{set:function(e){if(e&&"off"!=e?"free"==e?e=!0:"printMargin"==e?e=-1:"string"==typeof e&&(e=parseInt(e,10)||!1):e=!1,this.$wrap!=e){if(e){var t="number"==typeof e?e:null;this.setWrapLimitRange(t,t),this.setUseWrapMode(!0)}else this.setUseWrapMode(!1);this.$wrap=e}},get:function(){return this.getUseWrapMode()?-1==this.$wrap?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(e){e="auto"==e?"text"!=this.$mode.type:"text"!=e,e!=this.$wrapAsCode&&(this.$wrapAsCode=e,this.$useWrapMode&&(this.$modified=!0,this.$resetRowCache(0),this.$updateWrapData(0,this.getLength()-1)))},initialValue:"auto"},firstLineNumber:{set:function(){this._signal("changeBreakpoint")},initialValue:1},useWorker:{set:function(e){this.$useWorker=e,this.$stopWorker(),e&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(e){isNaN(e)||this.$tabSize===e||(this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=e,this._signal("changeTabSize"))},initialValue:4,handlesSet:!0},overwrite:{set:function(){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(e){this.doc.setNewLineMode(e)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(e){this.setMode(e)},get:function(){return this.$modeId}}}),t.EditSession=d}),ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t){"use strict";var i=e("./lib/lang"),n=e("./lib/oop"),s=e("./range").Range,r=function(){this.$options={}};(function(){this.set=function(e){return n.mixin(this.$options,e),this},this.getOptions=function(){return i.copyObject(this.$options)
|
9 |
+
},this.setOptions=function(e){this.$options=e},this.find=function(e){var t=this.$matchIterator(e,this.$options);if(!t)return!1;var i=null;return t.forEach(function(e,t,n){if(e.start)i=e;else{var r=e.offset+(n||0);i=new s(t,r,t,r+e.length)}return!0}),i},this.findAll=function(e){var t=this.$options;if(!t.needle)return[];this.$assembleRegExp(t);var n=t.range,r=n?e.getLines(n.start.row,n.end.row):e.doc.getAllLines(),o=[],a=t.re;if(t.$isMultiLine){var l,h=a.length,c=r.length-h;e:for(var u=a.offset||0;c>=u;u++){for(var d=0;h>d;d++)if(-1==r[u+d].search(a[d]))continue e;var g=r[u],f=r[u+h-1],m=g.length-g.match(a[0])[0].length,p=f.match(a[h-1])[0].length;l&&l.end.row===u&&l.end.column>m||(o.push(l=new s(u,m,u+h-1,p)),h>2&&(u=u+h-2))}}else for(var A=0;r.length>A;A++)for(var v=i.getMatchOffsets(r[A],a),d=0;v.length>d;d++){var C=v[d];o.push(new s(A,C.offset,A,C.offset+C.length))}if(n){for(var F=n.start.column,w=n.start.column,A=0,d=o.length-1;d>A&&F>o[A].start.column&&o[A].start.row==n.start.row;)A++;for(;d>A&&o[d].end.column>w&&o[d].end.row==n.end.row;)d--;for(o=o.slice(A,d+1),A=0,d=o.length;d>A;A++)o[A].start.row+=n.start.row,o[A].end.row+=n.start.row}return o},this.replace=function(e,t){var i=this.$options,n=this.$assembleRegExp(i);if(i.$isMultiLine)return t;if(n){var s=n.exec(e);if(!s||s[0].length!=e.length)return null;if(t=e.replace(n,t),i.preserveCase){t=t.split("");for(var r=Math.min(e.length,e.length);r--;){var o=e[r];t[r]=o&&o.toLowerCase()!=o?t[r].toUpperCase():t[r].toLowerCase()}t=t.join("")}return t}},this.$matchIterator=function(e,t){var n=this.$assembleRegExp(t);if(!n)return!1;var r,o=this,a=t.backwards;if(t.$isMultiLine)var l=n.length,h=function(t,i,o){var a=t.search(n[0]);if(-1!=a){for(var h=1;l>h;h++)if(t=e.getLine(i+h),-1==t.search(n[h]))return;var c=t.match(n[l-1])[0].length,u=new s(i,a,i+l-1,c);return 1==n.offset?(u.start.row--,u.start.column=Number.MAX_VALUE):o&&(u.start.column+=o),r(u)?!0:void 0}};else if(a)var h=function(e,t,s){for(var o=i.getMatchOffsets(e,n),a=o.length-1;a>=0;a--)if(r(o[a],t,s))return!0};else var h=function(e,t,s){for(var o=i.getMatchOffsets(e,n),a=0;o.length>a;a++)if(r(o[a],t,s))return!0};return{forEach:function(i){r=i,o.$lineIterator(e,t).forEach(h)}}},this.$assembleRegExp=function(e,t){if(e.needle instanceof RegExp)return e.re=e.needle;var n=e.needle;if(!e.needle)return e.re=!1;e.regExp||(n=i.escapeRegExp(n)),e.wholeWord&&(n="\\b"+n+"\\b");var s=e.caseSensitive?"gm":"gmi";if(e.$isMultiLine=!t&&/[\n\r]/.test(n),e.$isMultiLine)return e.re=this.$assembleMultilineRegExp(n,s);try{var r=RegExp(n,s)}catch(o){r=!1}return e.re=r},this.$assembleMultilineRegExp=function(e,t){for(var i=e.replace(/\r\n|\r|\n/g,"$\n^").split("\n"),n=[],s=0;i.length>s;s++)try{n.push(RegExp(i[s],t))}catch(r){return!1}return""==i[0]?(n.shift(),n.offset=1):n.offset=0,n},this.$lineIterator=function(e,t){var i=1==t.backwards,n=0!=t.skipCurrent,s=t.range,r=t.start;r||(r=s?s[i?"end":"start"]:e.selection.getRange()),r.start&&(r=r[n!=i?"end":"start"]);var o=s?s.start.row:0,a=s?s.end.row:e.getLength()-1,l=i?function(i){var n=r.row,s=e.getLine(n).substring(0,r.column);if(!i(s,n)){for(n--;n>=o;n--)if(i(e.getLine(n),n))return;if(0!=t.wrap)for(n=a,o=r.row;n>=o;n--)if(i(e.getLine(n),n))return}}:function(i){var n=r.row,s=e.getLine(n).substr(r.column);if(!i(s,n,r.column)){for(n+=1;a>=n;n++)if(i(e.getLine(n),n))return;if(0!=t.wrap)for(n=o,a=r.row;a>=n;n++)if(i(e.getLine(n),n))return}};return{forEach:l}}}).call(r.prototype),t.Search=r}),ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t){"use strict";function i(e,t){this.platform=t||(r.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(e),this.$singleCommand=!0}function n(e,t){i.call(this,e,t),this.$singleCommand=!1}var s=e("../lib/keys"),r=e("../lib/useragent"),o=s.KEY_MODS;n.prototype=i.prototype,function(){this.addCommand=function(e){this.commands[e.name]&&this.removeCommand(e),this.commands[e.name]=e,e.bindKey&&this._buildKeyHash(e)},this.removeCommand=function(e,t){var i=e&&("string"==typeof e?e:e.name);e=this.commands[i],t||delete this.commands[i];var n=this.commandKeyBinding;for(var s in n){var r=n[s];if(r==e)delete n[s];else if(Array.isArray(r)){var o=r.indexOf(e);-1!=o&&(r.splice(o,1),1==r.length&&(n[s]=r[0]))}}},this.bindKey=function(e,t,i){return"object"==typeof e&&(e=e[this.platform]),e?"function"==typeof t?this.addCommand({exec:t,bindKey:e,name:t.name||e}):(e.split("|").forEach(function(e){var n="";if(-1!=e.indexOf(" ")){var s=e.split(/\s+/);e=s.pop(),s.forEach(function(e){var t=this.parseKeys(e),i=o[t.hashId]+t.key;n+=(n?" ":"")+i,this._addCommandToBinding(n,"chainKeys")},this),n+=" "}var r=this.parseKeys(e),a=o[r.hashId]+r.key;this._addCommandToBinding(n+a,t,i)},this),void 0):void 0},this._addCommandToBinding=function(e,t,i){var n,s=this.commandKeyBinding;t?!s[e]||this.$singleCommand?s[e]=t:(Array.isArray(s[e])?-1!=(n=s[e].indexOf(t))&&s[e].splice(n,1):s[e]=[s[e]],i||t.isDefault?s[e].unshift(t):s[e].push(t)):delete s[e]},this.addCommands=function(e){e&&Object.keys(e).forEach(function(t){var i=e[t];if(i){if("string"==typeof i)return this.bindKey(i,t);"function"==typeof i&&(i={exec:i}),"object"==typeof i&&(i.name||(i.name=t),this.addCommand(i))}},this)},this.removeCommands=function(e){Object.keys(e).forEach(function(t){this.removeCommand(e[t])},this)},this.bindKeys=function(e){Object.keys(e).forEach(function(t){this.bindKey(t,e[t])},this)},this._buildKeyHash=function(e){this.bindKey(e.bindKey,e)},this.parseKeys=function(e){var t=e.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(e){return e}),i=t.pop(),n=s[i];if(s.FUNCTION_KEYS[n])i=s.FUNCTION_KEYS[n].toLowerCase();else{if(!t.length)return{key:i,hashId:-1};if(1==t.length&&"shift"==t[0])return{key:i.toUpperCase(),hashId:-1}}for(var r=0,o=t.length;o--;){var a=s.KEY_MODS[t[o]];if(null==a)return"undefined"!=typeof console&&console.error("invalid modifier "+t[o]+" in "+e),!1;r|=a}return{key:i,hashId:r}},this.findKeyCommand=function(e,t){var i=o[e]+t;return this.commandKeyBinding[i]},this.handleKeyboard=function(e,t,i,n){var s=o[t]+i,r=this.commandKeyBinding[s];return e.$keyChain&&(e.$keyChain+=" "+s,r=this.commandKeyBinding[e.$keyChain]||r),!r||"chainKeys"!=r&&"chainKeys"!=r[r.length-1]?(e.$keyChain&&n>0&&(e.$keyChain=""),{command:r}):(e.$keyChain=e.$keyChain||s,{command:"null"})}}.call(i.prototype),t.HashHandler=i,t.MultiHashHandler=n}),ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(e,t){"use strict";var i=e("../lib/oop"),n=e("../keyboard/hash_handler").MultiHashHandler,s=e("../lib/event_emitter").EventEmitter,r=function(e,t){n.call(this,t,e),this.byName=this.commands,this.setDefaultHandler("exec",function(e){return e.command.exec(e.editor,e.args||{})})};i.inherits(r,n),function(){i.implement(this,s),this.exec=function(e,t,i){if(Array.isArray(e)){for(var n=e.length;n--;)if(this.exec(e[n],t,i))return!0;return!1}if("string"==typeof e&&(e=this.commands[e]),!e)return!1;if(t&&t.$readOnly&&!e.readOnly)return!1;var s={editor:t,command:e,args:i};return s.returnValue=this._emit("exec",s),this._signal("afterExec",s),s.returnValue===!1?!1:!0},this.toggleRecording=function(e){return this.$inReplay?void 0:(e&&e._emit("changeStatus"),this.recording?(this.macro.pop(),this.removeEventListener("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=function(e){this.macro.push([e.command,e.args])}.bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0))},this.replay=function(e){if(!this.$inReplay&&this.macro){if(this.recording)return this.toggleRecording(e);try{this.$inReplay=!0,this.macro.forEach(function(t){"string"==typeof t?this.exec(t,e):this.exec(t[0],e,t[1])},this)}finally{this.$inReplay=!1}}},this.trimMacro=function(e){return e.map(function(e){return"string"!=typeof e[0]&&(e[0]=e[0].name),e[1]||(e=e[0]),e})}}.call(r.prototype),t.CommandManager=r}),ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(e,t){"use strict";function i(e,t){return{win:e,mac:t}}var n=e("../lib/lang"),s=e("../config"),r=e("../range").Range;t.commands=[{name:"showSettingsMenu",bindKey:i("Ctrl-,","Command-,"),exec:function(e){s.loadModule("ace/ext/settings_menu",function(t){t.init(e),e.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",bindKey:i("Alt-E","Ctrl-E"),exec:function(e){s.loadModule("ace/ext/error_marker",function(t){t.showErrorMarker(e,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",bindKey:i("Alt-Shift-E","Ctrl-Shift-E"),exec:function(e){s.loadModule("ace/ext/error_marker",function(t){t.showErrorMarker(e,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",bindKey:i("Ctrl-A","Command-A"),exec:function(e){e.selectAll()},readOnly:!0},{name:"centerselection",bindKey:i(null,"Ctrl-L"),exec:function(e){e.centerSelection()},readOnly:!0},{name:"gotoline",bindKey:i("Ctrl-L","Command-L"),exec:function(e){var t=parseInt(prompt("Enter line number:"),10);isNaN(t)||e.gotoLine(t)},readOnly:!0},{name:"fold",bindKey:i("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(e){e.session.toggleFold(!1)},scrollIntoView:"center",readOnly:!0},{name:"unfold",bindKey:i("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(e){e.session.toggleFold(!0)},scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",bindKey:i("F2","F2"),exec:function(e){e.session.toggleFoldWidget()},scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",bindKey:i("Alt-F2","Alt-F2"),exec:function(e){e.session.toggleFoldWidget(!0)},scrollIntoView:"center",readOnly:!0},{name:"foldall",bindKey:i("Ctrl-Alt-0","Ctrl-Command-Option-0"),exec:function(e){e.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",bindKey:i("Alt-0","Command-Option-0"),exec:function(e){e.session.foldAll(),e.session.unfold(e.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",bindKey:i("Alt-Shift-0","Command-Option-Shift-0"),exec:function(e){e.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",bindKey:i("Ctrl-K","Command-G"),exec:function(e){e.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",bindKey:i("Ctrl-Shift-K","Command-Shift-G"),exec:function(e){e.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",bindKey:i("Alt-K","Ctrl-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findNext()},readOnly:!0},{name:"selectOrFindPrevious",bindKey:i("Alt-Shift-K","Ctrl-Shift-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findPrevious()},readOnly:!0},{name:"find",bindKey:i("Ctrl-F","Command-F"),exec:function(e){s.loadModule("ace/ext/searchbox",function(t){t.Search(e)})},readOnly:!0},{name:"overwrite",bindKey:"Insert",exec:function(e){e.toggleOverwrite()},readOnly:!0},{name:"selecttostart",bindKey:i("Ctrl-Shift-Home","Command-Shift-Up"),exec:function(e){e.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotostart",bindKey:i("Ctrl-Home","Command-Home|Command-Up"),exec:function(e){e.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectup",bindKey:i("Shift-Up","Shift-Up"),exec:function(e){e.getSelection().selectUp()},multiSelectAction:"forEach",readOnly:!0},{name:"golineup",bindKey:i("Up","Up|Ctrl-P"),exec:function(e,t){e.navigateUp(t.times)},multiSelectAction:"forEach",readOnly:!0},{name:"selecttoend",bindKey:i("Ctrl-Shift-End","Command-Shift-Down"),exec:function(e){e.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotoend",bindKey:i("Ctrl-End","Command-End|Command-Down"),exec:function(e){e.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectdown",bindKey:i("Shift-Down","Shift-Down"),exec:function(e){e.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",bindKey:i("Down","Down|Ctrl-N"),exec:function(e,t){e.navigateDown(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",bindKey:i("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(e){e.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",bindKey:i("Ctrl-Left","Option-Left"),exec:function(e){e.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",bindKey:i("Alt-Shift-Left","Command-Shift-Left"),exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolinestart",bindKey:i("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(e){e.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",bindKey:i("Shift-Left","Shift-Left"),exec:function(e){e.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",bindKey:i("Left","Left|Ctrl-B"),exec:function(e,t){e.navigateLeft(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",bindKey:i("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(e){e.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",bindKey:i("Ctrl-Right","Option-Right"),exec:function(e){e.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",bindKey:i("Alt-Shift-Right","Command-Shift-Right"),exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolineend",bindKey:i("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(e){e.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",bindKey:i("Shift-Right","Shift-Right"),exec:function(e){e.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",bindKey:i("Right","Right|Ctrl-F"),exec:function(e,t){e.navigateRight(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",bindKey:"Shift-PageDown",exec:function(e){e.selectPageDown()},readOnly:!0},{name:"pagedown",bindKey:i(null,"Option-PageDown"),exec:function(e){e.scrollPageDown()},readOnly:!0},{name:"gotopagedown",bindKey:i("PageDown","PageDown|Ctrl-V"),exec:function(e){e.gotoPageDown()},readOnly:!0},{name:"selectpageup",bindKey:"Shift-PageUp",exec:function(e){e.selectPageUp()},readOnly:!0},{name:"pageup",bindKey:i(null,"Option-PageUp"),exec:function(e){e.scrollPageUp()},readOnly:!0},{name:"gotopageup",bindKey:"PageUp",exec:function(e){e.gotoPageUp()},readOnly:!0},{name:"scrollup",bindKey:i("Ctrl-Up",null),exec:function(e){e.renderer.scrollBy(0,-2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",bindKey:i("Ctrl-Down",null),exec:function(e){e.renderer.scrollBy(0,2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",bindKey:"Shift-Home",exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",bindKey:"Shift-End",exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",bindKey:i("Ctrl-Alt-E","Command-Option-E"),exec:function(e){e.commands.toggleRecording(e)},readOnly:!0},{name:"replaymacro",bindKey:i("Ctrl-Shift-E","Command-Shift-E"),exec:function(e){e.commands.replay(e)},readOnly:!0},{name:"jumptomatching",bindKey:i("Ctrl-P","Ctrl-P"),exec:function(e){e.jumpToMatching()},multiSelectAction:"forEach",readOnly:!0},{name:"selecttomatching",bindKey:i("Ctrl-Shift-P","Ctrl-Shift-P"),exec:function(e){e.jumpToMatching(!0)},multiSelectAction:"forEach",readOnly:!0},{name:"passKeysToBrowser",bindKey:i("null","null"),exec:function(){},passEvent:!0,readOnly:!0},{name:"cut",exec:function(e){var t=e.getSelectionRange();e._emit("cut",t),e.selection.isEmpty()||(e.session.remove(t),e.clearSelection())},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"removeline",bindKey:i("Ctrl-D","Command-D"),exec:function(e){e.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",bindKey:i("Ctrl-Shift-D","Command-Shift-D"),exec:function(e){e.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",bindKey:i("Ctrl-Alt-S","Command-Alt-S"),exec:function(e){e.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",bindKey:i("Ctrl-/","Command-/"),exec:function(e){e.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",bindKey:i("Ctrl-Shift-/","Command-Shift-/"),exec:function(e){e.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",bindKey:i("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(e){e.modifyNumber(1)},multiSelectAction:"forEach"},{name:"modifyNumberDown",bindKey:i("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(e){e.modifyNumber(-1)},multiSelectAction:"forEach"},{name:"replace",bindKey:i("Ctrl-H","Command-Option-F"),exec:function(e){s.loadModule("ace/ext/searchbox",function(t){t.Search(e,!0)})}},{name:"undo",bindKey:i("Ctrl-Z","Command-Z"),exec:function(e){e.undo()}},{name:"redo",bindKey:i("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(e){e.redo()}},{name:"copylinesup",bindKey:i("Alt-Shift-Up","Command-Option-Up"),exec:function(e){e.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",bindKey:i("Alt-Up","Option-Up"),exec:function(e){e.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",bindKey:i("Alt-Shift-Down","Command-Option-Down"),exec:function(e){e.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",bindKey:i("Alt-Down","Option-Down"),exec:function(e){e.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",bindKey:i("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(e){e.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",bindKey:i("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(e){e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",bindKey:i("Shift-Delete",null),exec:function(e){return e.selection.isEmpty()?(e.remove("left"),void 0):!1},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",bindKey:i("Alt-Backspace","Command-Backspace"),exec:function(e){e.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",bindKey:i("Alt-Delete","Ctrl-K"),exec:function(e){e.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",bindKey:i("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(e){e.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",bindKey:i("Ctrl-Delete","Alt-Delete"),exec:function(e){e.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",bindKey:i("Shift-Tab","Shift-Tab"),exec:function(e){e.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",bindKey:i("Tab","Tab"),exec:function(e){e.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",bindKey:i("Ctrl-[","Ctrl-["),exec:function(e){e.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",bindKey:i("Ctrl-]","Ctrl-]"),exec:function(e){e.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",exec:function(e,t){e.insert(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",exec:function(e,t){e.insert(n.stringRepeat(t.text||"",t.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",bindKey:i(null,"Ctrl-O"),exec:function(e){e.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",bindKey:i("Ctrl-T","Ctrl-T"),exec:function(e){e.transposeLetters()},multiSelectAction:function(e){e.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",bindKey:i("Ctrl-U","Ctrl-U"),exec:function(e){e.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",bindKey:i("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(e){e.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"expandtoline",bindKey:i("Ctrl-Shift-L","Command-Shift-L"),exec:function(e){var t=e.selection.getRange();t.start.column=t.end.column=0,t.end.row++,e.selection.setRange(t,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"joinlines",bindKey:i(null,null),exec:function(e){for(var t=e.selection.isBackwards(),i=t?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),s=t?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),o=e.session.doc.getLine(i.row).length,a=e.session.doc.getTextRange(e.selection.getRange()),l=a.replace(/\n\s*/," ").length,h=e.session.doc.getLine(i.row),c=i.row+1;s.row+1>=c;c++){var u=n.stringTrimLeft(n.stringTrimRight(e.session.doc.getLine(c)));0!==u.length&&(u=" "+u),h+=u}s.row+1<e.session.doc.getLength()-1&&(h+=e.session.doc.getNewLineCharacter()),e.clearSelection(),e.session.doc.replace(new r(i.row,0,s.row+2,0),h),l>0?(e.selection.moveCursorTo(i.row,i.column),e.selection.selectTo(i.row,i.column+l)):(o=e.session.doc.getLine(i.row).length>o?o+1:o,e.selection.moveCursorTo(i.row,o))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",bindKey:i(null,null),exec:function(e){var t=e.session.doc.getLength()-1,i=e.session.doc.getLine(t).length,n=e.selection.rangeList.ranges,s=[];1>n.length&&(n=[e.selection.getRange()]);for(var o=0;n.length>o;o++)o==n.length-1&&(n[o].end.row!==t||n[o].end.column!==i)&&s.push(new r(n[o].end.row,n[o].end.column,t,i)),0===o?(0!==n[o].start.row||0!==n[o].start.column)&&s.push(new r(0,0,n[o].start.row,n[o].start.column)):s.push(new r(n[o-1].end.row,n[o-1].end.column,n[o].start.row,n[o].start.column));e.exitMultiSelectMode(),e.clearSelection();for(var o=0;s.length>o;o++)e.selection.addRange(s[o],!1)},readOnly:!0,scrollIntoView:"none"}]}),ace.define("ace/editor",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands","ace/config","ace/token_iterator"],function(e,t){"use strict";e("./lib/fixoldbrowsers");var i=e("./lib/oop"),n=e("./lib/dom"),s=e("./lib/lang"),r=e("./lib/useragent"),o=e("./keyboard/textinput").TextInput,a=e("./mouse/mouse_handler").MouseHandler,l=e("./mouse/fold_handler").FoldHandler,h=e("./keyboard/keybinding").KeyBinding,c=e("./edit_session").EditSession,u=e("./search").Search,d=e("./range").Range,g=e("./lib/event_emitter").EventEmitter,f=e("./commands/command_manager").CommandManager,m=e("./commands/default_commands").commands,p=e("./config"),A=e("./token_iterator").TokenIterator,v=function(e,t){var i=e.getContainerElement();this.container=i,this.renderer=e,this.commands=new f(r.isMac?"mac":"win",m),this.textInput=new o(e.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.keyBinding=new h(this),this.$mouseHandler=new a(this),new l(this),this.$blockScrolling=0,this.$search=(new u).set({wrap:!0}),this.$historyTracker=this.$historyTracker.bind(this),this.commands.on("exec",this.$historyTracker),this.$initOperationListeners(),this._$emitInputEvent=s.delayedCall(function(){this._signal("input",{}),this.session&&this.session.bgTokenizer&&this.session.bgTokenizer.scheduleStart()}.bind(this)),this.on("change",function(e,t){t._$emitInputEvent.schedule(31)}),this.setSession(t||new c("")),p.resetOptions(this),p._signal("editor",this)};(function(){i.implement(this,g),this.$initOperationListeners=function(){this.selections=[],this.commands.on("exec",this.startOperation.bind(this),!0),this.commands.on("afterExec",this.endOperation.bind(this),!0),this.$opResetTimer=s.delayedCall(this.endOperation.bind(this)),this.on("change",function(){this.curOp||this.startOperation(),this.curOp.docChanged=!0}.bind(this),!0),this.on("changeSelection",function(){this.curOp||this.startOperation(),this.curOp.selectionChanged=!0}.bind(this),!0)},this.curOp=null,this.prevOp={},this.startOperation=function(e){if(this.curOp){if(!e||this.curOp.command)return;this.prevOp=this.curOp}e||(this.previousCommand=null,e={}),this.$opResetTimer.schedule(),this.curOp={command:e.command||{},args:e.args,scrollTop:this.renderer.scrollTop}},this.endOperation=function(e){if(this.curOp){if(e&&e.returnValue===!1)return this.curOp=null;var t=this.curOp.command;if(t&&t.scrollIntoView){switch(t.scrollIntoView){case"center":this.renderer.scrollCursorIntoView(null,.5);break;case"animate":case"cursor":this.renderer.scrollCursorIntoView();break;case"selectionPart":var i=this.selection.getRange(),n=this.renderer.layerConfig;(i.start.row>=n.lastRow||i.end.row<=n.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead);break;default:}"animate"==t.scrollIntoView&&this.renderer.animateScrolling(this.curOp.scrollTop)}this.prevOp=this.curOp,this.curOp=null}},this.$mergeableCommands=["backspace","del","insertstring"],this.$historyTracker=function(e){if(this.$mergeUndoDeltas){var t=this.prevOp,i=this.$mergeableCommands,n=t.command&&e.command.name==t.command.name;if("insertstring"==e.command.name){var s=e.args;void 0===this.mergeNextCommand&&(this.mergeNextCommand=!0),n=n&&this.mergeNextCommand&&(!/\s/.test(s)||/\s/.test(t.args)),this.mergeNextCommand=!0}else n=n&&-1!==i.indexOf(e.command.name);"always"!=this.$mergeUndoDeltas&&Date.now()-this.sequenceStartTime>2e3&&(n=!1),n?this.session.mergeUndoDeltas=!0:-1!==i.indexOf(e.command.name)&&(this.sequenceStartTime=Date.now())}},this.setKeyboardHandler=function(e,t){if(e&&"string"==typeof e){this.$keybindingId=e;var i=this;p.loadModule(["keybinding",e],function(n){i.$keybindingId==e&&i.keyBinding.setKeyboardHandler(n&&n.handler),t&&t()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(e),t&&t()},this.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},this.setSession=function(e){if(this.session!=e){var t=this.session;if(t){this.session.removeEventListener("change",this.$onDocumentChange),this.session.removeEventListener("changeMode",this.$onChangeMode),this.session.removeEventListener("tokenizerUpdate",this.$onTokenizerUpdate),this.session.removeEventListener("changeTabSize",this.$onChangeTabSize),this.session.removeEventListener("changeWrapLimit",this.$onChangeWrapLimit),this.session.removeEventListener("changeWrapMode",this.$onChangeWrapMode),this.session.removeEventListener("onChangeFold",this.$onChangeFold),this.session.removeEventListener("changeFrontMarker",this.$onChangeFrontMarker),this.session.removeEventListener("changeBackMarker",this.$onChangeBackMarker),this.session.removeEventListener("changeBreakpoint",this.$onChangeBreakpoint),this.session.removeEventListener("changeAnnotation",this.$onChangeAnnotation),this.session.removeEventListener("changeOverwrite",this.$onCursorChange),this.session.removeEventListener("changeScrollTop",this.$onScrollTopChange),this.session.removeEventListener("changeScrollLeft",this.$onScrollLeftChange);var i=this.session.getSelection();i.removeEventListener("changeCursor",this.$onCursorChange),i.removeEventListener("changeSelection",this.$onSelectionChange)}this.session=e,e?(this.$onDocumentChange=this.onDocumentChange.bind(this),e.addEventListener("change",this.$onDocumentChange),this.renderer.setSession(e),this.$onChangeMode=this.onChangeMode.bind(this),e.addEventListener("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),e.addEventListener("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),e.addEventListener("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),e.addEventListener("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),e.addEventListener("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),e.addEventListener("changeFold",this.$onChangeFold),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.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.addEventListener("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.addEventListener("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.addEventListener("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.addEventListener("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.addEventListener("changeScrollLeft",this.$onScrollLeftChange),this.selection=e.getSelection(),this.selection.addEventListener("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.addEventListener("changeSelection",this.$onSelectionChange),this.onChangeMode(),this.$blockScrolling+=1,this.onCursorChange(),this.$blockScrolling-=1,this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull()):(this.selection=null,this.renderer.setSession(e)),this._signal("changeSession",{session:e,oldSession:t}),t&&t._signal("changeEditor",{oldEditor:this}),e&&e._signal("changeEditor",{editor:this})}},this.getSession=function(){return this.session},this.setValue=function(e,t){return this.session.doc.setValue(e),t?1==t?this.navigateFileEnd():-1==t&&this.navigateFileStart():this.selectAll(),e},this.getValue=function(){return this.session.getValue()},this.getSelection=function(){return this.selection},this.resize=function(e){this.renderer.onResize(e)},this.setTheme=function(e,t){this.renderer.setTheme(e,t)},this.getTheme=function(){return this.renderer.getTheme()},this.setStyle=function(e){this.renderer.setStyle(e)},this.unsetStyle=function(e){this.renderer.unsetStyle(e)},this.getFontSize=function(){return this.getOption("fontSize")||n.computedStyle(this.container,"fontSize")},this.setFontSize=function(e){this.setOption("fontSize",e)},this.$highlightBrackets=function(){if(this.session.$bracketHighlight&&(this.session.removeMarker(this.session.$bracketHighlight),this.session.$bracketHighlight=null),!this.$highlightPending){var e=this;this.$highlightPending=!0,setTimeout(function(){e.$highlightPending=!1;var t=e.session;if(t&&t.bgTokenizer){var i=t.findMatchingBracket(e.getCursorPosition());if(i)var n=new d(i.row,i.column,i.row,i.column+1);
|
10 |
+
else if(t.$mode.getMatching)var n=t.$mode.getMatching(e.session);n&&(t.$bracketHighlight=t.addMarker(n,"ace_bracket","text"))}},50)}},this.$highlightTags=function(){if(!this.$highlightTagPending){var e=this;this.$highlightTagPending=!0,setTimeout(function(){e.$highlightTagPending=!1;var t=e.session;if(t&&t.bgTokenizer){var i=e.getCursorPosition(),n=new A(e.session,i.row,i.column),s=n.getCurrentToken();if(!s||-1===s.type.indexOf("tag-name"))return t.removeMarker(t.$tagHighlight),t.$tagHighlight=null,void 0;var r=s.value,o=0,a=n.stepBackward();if("<"==a.value){do a=s,s=n.stepForward(),s&&s.value===r&&-1!==s.type.indexOf("tag-name")&&("<"===a.value?o++:"</"===a.value&&o--);while(s&&o>=0)}else{do s=a,a=n.stepBackward(),s&&s.value===r&&-1!==s.type.indexOf("tag-name")&&("<"===a.value?o++:"</"===a.value&&o--);while(a&&0>=o);n.stepForward()}if(!s)return t.removeMarker(t.$tagHighlight),t.$tagHighlight=null,void 0;var l=n.getCurrentTokenRow(),h=n.getCurrentTokenColumn(),c=new d(l,h,l,h+s.value.length);t.$tagHighlight&&0!==c.compareRange(t.$backMarkers[t.$tagHighlight].range)&&(t.removeMarker(t.$tagHighlight),t.$tagHighlight=null),c&&!t.$tagHighlight&&(t.$tagHighlight=t.addMarker(c,"ace_bracket","text"))}},50)}},this.focus=function(){var e=this;setTimeout(function(){e.textInput.focus()}),this.textInput.focus()},this.isFocused=function(){return this.textInput.isFocused()},this.blur=function(){this.textInput.blur()},this.onFocus=function(e){this.$isFocused||(this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus",e))},this.onBlur=function(e){this.$isFocused&&(this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur",e))},this.$cursorChange=function(){this.renderer.updateCursor()},this.onDocumentChange=function(e){var t,i=e.data,n=i.range;t=n.start.row==n.end.row&&"insertLines"!=i.action&&"removeLines"!=i.action?n.end.row:1/0,this.renderer.updateLines(n.start.row,t,this.session.$useWrapMode),this._signal("change",e),this.$cursorChange(),this.$updateHighlightActiveLine()},this.onTokenizerUpdate=function(e){var t=e.data;this.renderer.updateLines(t.first,t.last)},this.onScrollTopChange=function(){this.renderer.scrollToY(this.session.getScrollTop())},this.onScrollLeftChange=function(){this.renderer.scrollToX(this.session.getScrollLeft())},this.onCursorChange=function(){this.$cursorChange(),this.$blockScrolling||this.renderer.scrollCursorIntoView(),this.$highlightBrackets(),this.$highlightTags(),this.$updateHighlightActiveLine(),this._signal("changeSelection")},this.$updateHighlightActiveLine=function(){var e,t=this.getSession();if(this.$highlightActiveLine&&("line"==this.$selectionStyle&&this.selection.isMultiLine()||(e=this.getCursorPosition()),!this.renderer.$maxLines||1!==this.session.getLength()||this.renderer.$minLines>1||(e=!1)),t.$highlightLineMarker&&!e)t.removeMarker(t.$highlightLineMarker.id),t.$highlightLineMarker=null;else if(!t.$highlightLineMarker&&e){var i=new d(e.row,e.column,e.row,1/0);i.id=t.addMarker(i,"ace_active-line","screenLine"),t.$highlightLineMarker=i}else e&&(t.$highlightLineMarker.start.row=e.row,t.$highlightLineMarker.end.row=e.row,t.$highlightLineMarker.start.column=e.column,t._signal("changeBackMarker"))},this.onSelectionChange=function(){var e=this.session;if(e.$selectionMarker&&e.removeMarker(e.$selectionMarker),e.$selectionMarker=null,this.selection.isEmpty())this.$updateHighlightActiveLine();else{var t=this.selection.getRange(),i=this.getSelectionStyle();e.$selectionMarker=e.addMarker(t,"ace_selection",i)}var n=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(n),this._signal("changeSelection")},this.$getSelectionHighLightRegexp=function(){var e=this.session,t=this.getSelectionRange();if(!t.isEmpty()&&!t.isMultiLine()){var i=t.start.column-1,n=t.end.column+1,s=e.getLine(t.start.row),r=s.length,o=s.substring(Math.max(i,0),Math.min(n,r));if(!(i>=0&&/^[\w\d]/.test(o)||r>=n&&/[\w\d]$/.test(o))&&(o=s.substring(t.start.column,t.end.column),/^[\w\d]+$/.test(o))){var a=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:o});return a}}},this.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},this.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},this.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},this.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},this.onChangeMode=function(e){this.renderer.updateText(),this._emit("changeMode",e)},this.onChangeWrapLimit=function(){this.renderer.updateFull()},this.onChangeWrapMode=function(){this.renderer.onResize(!0)},this.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},this.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},this.getCopyText=function(){var e=this.getSelectedText();return this._signal("copy",e),e},this.onCopy=function(){this.commands.exec("copy",this)},this.onCut=function(){this.commands.exec("cut",this)},this.onPaste=function(e){if(!this.$readOnly){var t={text:e};this._signal("paste",t),this.insert(t.text,!0)}},this.execCommand=function(e,t){return this.commands.exec(e,this,t)},this.insert=function(e,t){var i=this.session,n=i.getMode(),s=this.getCursorPosition();if(this.getBehavioursEnabled()&&!t){var r=n.transformAction(i.getState(s.row),"insertion",this,i,e);r&&(e!==r.text&&(this.session.mergeUndoDeltas=!1,this.$mergeNextCommand=!1),e=r.text)}if(" "==e&&(e=this.session.getTabString()),this.selection.isEmpty()){if(this.session.getOverwrite()){var o=new d.fromPoints(s,s);o.end.column+=e.length,this.session.remove(o)}}else{var o=this.getSelectionRange();s=this.session.remove(o),this.clearSelection()}if("\n"==e||"\r\n"==e){var a=i.getLine(s.row);if(s.column>a.search(/\S|$/)){var l=a.substr(s.column).search(/\S|$/);i.doc.removeInLine(s.row,s.column,s.column+l)}}this.clearSelection();var h=s.column,c=i.getState(s.row),a=i.getLine(s.row),u=n.checkOutdent(c,a,e);if(i.insert(s,e),r&&r.selection&&(2==r.selection.length?this.selection.setSelectionRange(new d(s.row,h+r.selection[0],s.row,h+r.selection[1])):this.selection.setSelectionRange(new d(s.row+r.selection[0],r.selection[1],s.row+r.selection[2],r.selection[3]))),i.getDocument().isNewLine(e)){var g=n.getNextLineIndent(c,a.slice(0,s.column),i.getTabString());i.insert({row:s.row+1,column:0},g)}u&&n.autoOutdent(c,i,s.row)},this.onTextInput=function(e){this.keyBinding.onTextInput(e)},this.onCommandKey=function(e,t,i){this.keyBinding.onCommandKey(e,t,i)},this.setOverwrite=function(e){this.session.setOverwrite(e)},this.getOverwrite=function(){return this.session.getOverwrite()},this.toggleOverwrite=function(){this.session.toggleOverwrite()},this.setScrollSpeed=function(e){this.setOption("scrollSpeed",e)},this.getScrollSpeed=function(){return this.getOption("scrollSpeed")},this.setDragDelay=function(e){this.setOption("dragDelay",e)},this.getDragDelay=function(){return this.getOption("dragDelay")},this.setSelectionStyle=function(e){this.setOption("selectionStyle",e)},this.getSelectionStyle=function(){return this.getOption("selectionStyle")},this.setHighlightActiveLine=function(e){this.setOption("highlightActiveLine",e)},this.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},this.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},this.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},this.setHighlightSelectedWord=function(e){this.setOption("highlightSelectedWord",e)},this.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},this.setAnimatedScroll=function(e){this.renderer.setAnimatedScroll(e)},this.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},this.setShowInvisibles=function(e){this.renderer.setShowInvisibles(e)},this.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},this.setDisplayIndentGuides=function(e){this.renderer.setDisplayIndentGuides(e)},this.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},this.setShowPrintMargin=function(e){this.renderer.setShowPrintMargin(e)},this.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},this.setPrintMarginColumn=function(e){this.renderer.setPrintMarginColumn(e)},this.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},this.setReadOnly=function(e){this.setOption("readOnly",e)},this.getReadOnly=function(){return this.getOption("readOnly")},this.setBehavioursEnabled=function(e){this.setOption("behavioursEnabled",e)},this.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},this.setWrapBehavioursEnabled=function(e){this.setOption("wrapBehavioursEnabled",e)},this.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},this.setShowFoldWidgets=function(e){this.setOption("showFoldWidgets",e)},this.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},this.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},this.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},this.remove=function(e){this.selection.isEmpty()&&("left"==e?this.selection.selectLeft():this.selection.selectRight());var t=this.getSelectionRange();if(this.getBehavioursEnabled()){var i=this.session,n=i.getState(t.start.row),s=i.getMode().transformAction(n,"deletion",this,i,t);if(0===t.end.column){var r=i.getTextRange(t);if("\n"==r[r.length-1]){var o=i.getLine(t.end.row);/^\s+$/.test(o)&&(t.end.column=o.length)}}s&&(t=s)}this.session.remove(t),this.clearSelection()},this.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var e=this.getSelectionRange();e.start.column==e.end.column&&e.start.row==e.end.row&&(e.end.column=0,e.end.row++),this.session.remove(e),this.clearSelection()},this.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var e=this.getCursorPosition();this.insert("\n"),this.moveCursorToPosition(e)},this.transposeLetters=function(){if(this.selection.isEmpty()){var e=this.getCursorPosition(),t=e.column;if(0!==t){var i,n,s=this.session.getLine(e.row);s.length>t?(i=s.charAt(t)+s.charAt(t-1),n=new d(e.row,t-1,e.row,t+1)):(i=s.charAt(t-1)+s.charAt(t-2),n=new d(e.row,t-2,e.row,t)),this.session.replace(n,i)}}},this.toLowerCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var t=this.getSelectionRange(),i=this.session.getTextRange(t);this.session.replace(t,i.toLowerCase()),this.selection.setSelectionRange(e)},this.toUpperCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var t=this.getSelectionRange(),i=this.session.getTextRange(t);this.session.replace(t,i.toUpperCase()),this.selection.setSelectionRange(e)},this.indent=function(){var e=this.session,t=this.getSelectionRange();if(t.start.row<t.end.row){var i=this.$getSelectedRows();return e.indentRows(i.first,i.last," "),void 0}if(t.start.column<t.end.column){var n=e.getTextRange(t);if(!/^\s+$/.test(n)){var i=this.$getSelectedRows();return e.indentRows(i.first,i.last," "),void 0}}var r=e.getLine(t.start.row),o=t.start,a=e.getTabSize(),l=e.documentToScreenColumn(o.row,o.column);if(this.session.getUseSoftTabs())var h=a-l%a,c=s.stringRepeat(" ",h);else{for(var h=l%a;" "==r[t.start.column]&&h;)t.start.column--,h--;this.selection.setSelectionRange(t),c=" "}return this.insert(c)},this.blockIndent=function(){var e=this.$getSelectedRows();this.session.indentRows(e.first,e.last," ")},this.blockOutdent=function(){var e=this.session.getSelection();this.session.outdentRows(e.getRange())},this.sortLines=function(){var e=this.$getSelectedRows(),t=this.session,i=[];for(s=e.first;e.last>=s;s++)i.push(t.getLine(s));i.sort(function(e,t){return e.toLowerCase()<t.toLowerCase()?-1:e.toLowerCase()>t.toLowerCase()?1:0});for(var n=new d(0,0,0,0),s=e.first;e.last>=s;s++){var r=t.getLine(s);n.start.row=s,n.end.row=s,n.end.column=r.length,t.replace(n,i[s-e.first])}},this.toggleCommentLines=function(){var e=this.session.getState(this.getCursorPosition().row),t=this.$getSelectedRows();this.session.getMode().toggleCommentLines(e,this.session,t.first,t.last)},this.toggleBlockComment=function(){var e=this.getCursorPosition(),t=this.session.getState(e.row),i=this.getSelectionRange();this.session.getMode().toggleBlockComment(t,this.session,i,e)},this.getNumberAt=function(e,t){var i=/[\-]?[0-9]+(?:\.[0-9]+)?/g;i.lastIndex=0;for(var n=this.session.getLine(e);t>i.lastIndex;){var s=i.exec(n);if(t>=s.index&&s.index+s[0].length>=t){var r={value:s[0],start:s.index,end:s.index+s[0].length};return r}}return null},this.modifyNumber=function(e){var t=this.selection.getCursor().row,i=this.selection.getCursor().column,n=new d(t,i-1,t,i),s=this.session.getTextRange(n);if(!isNaN(parseFloat(s))&&isFinite(s)){var r=this.getNumberAt(t,i);if(r){var o=r.value.indexOf(".")>=0?r.start+r.value.indexOf(".")+1:r.end,a=r.start+r.value.length-o,l=parseFloat(r.value);l*=Math.pow(10,a),e*=o!==r.end&&o>i?Math.pow(10,r.end-i-1):Math.pow(10,r.end-i),l+=e,l/=Math.pow(10,a);var h=l.toFixed(a),c=new d(t,r.start,t,r.end);this.session.replace(c,h),this.moveCursorTo(t,Math.max(r.start+1,i+h.length-r.value.length))}}},this.removeLines=function(){var e,t=this.$getSelectedRows();e=0===t.first||t.last+1<this.session.getLength()?new d(t.first,0,t.last+1,0):new d(t.first-1,this.session.getLine(t.first-1).length,t.last,this.session.getLine(t.last).length),this.session.remove(e),this.clearSelection()},this.duplicateSelection=function(){var e=this.selection,t=this.session,i=e.getRange(),n=e.isBackwards();if(i.isEmpty()){var s=i.start.row;t.duplicateLines(s,s)}else{var r=n?i.start:i.end,o=t.insert(r,t.getTextRange(i),!1);i.start=r,i.end=o,e.setSelectionRange(i,n)}},this.moveLinesDown=function(){this.$moveLines(function(e,t){return this.session.moveLinesDown(e,t)})},this.moveLinesUp=function(){this.$moveLines(function(e,t){return this.session.moveLinesUp(e,t)})},this.moveText=function(e,t,i){return this.session.moveText(e,t,i)},this.copyLinesUp=function(){this.$moveLines(function(e,t){return this.session.duplicateLines(e,t),0})},this.copyLinesDown=function(){this.$moveLines(function(e,t){return this.session.duplicateLines(e,t)})},this.$moveLines=function(e){var t=this.selection;if(!t.inMultiSelectMode||this.inVirtualSelectionMode){var i=t.toOrientedRange(),n=this.$getSelectedRows(i),s=e.call(this,n.first,n.last);i.moveBy(s,0),t.fromOrientedRange(i)}else{var r=t.rangeList.ranges;t.rangeList.detach(this.session);for(var o=r.length;o--;){for(var a=o,n=r[o].collapseRows(),l=n.end.row,h=n.start.row;o--&&(n=r[o].collapseRows(),1>=h-n.end.row);)h=n.end.row;o++;for(var s=e.call(this,h,l);a>=o;)r[a].moveBy(s,0),a--}t.fromOrientedRange(t.ranges[0]),t.rangeList.attach(this.session)}},this.$getSelectedRows=function(){var e=this.getSelectionRange().collapseRows();return{first:this.session.getRowFoldStart(e.start.row),last:this.session.getRowFoldEnd(e.end.row)}},this.onCompositionStart=function(){this.renderer.showComposition(this.getCursorPosition())},this.onCompositionUpdate=function(e){this.renderer.setCompositionText(e)},this.onCompositionEnd=function(){this.renderer.hideComposition()},this.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},this.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},this.isRowVisible=function(e){return e>=this.getFirstVisibleRow()&&this.getLastVisibleRow()>=e},this.isRowFullyVisible=function(e){return e>=this.renderer.getFirstFullyVisibleRow()&&this.renderer.getLastFullyVisibleRow()>=e},this.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},this.$moveByPage=function(e,t){var i=this.renderer,n=this.renderer.layerConfig,s=e*Math.floor(n.height/n.lineHeight);this.$blockScrolling++,t===!0?this.selection.$moveSelection(function(){this.moveCursorBy(s,0)}):t===!1&&(this.selection.moveCursorBy(s,0),this.selection.clearSelection()),this.$blockScrolling--;var r=i.scrollTop;i.scrollBy(0,s*n.lineHeight),null!=t&&i.scrollCursorIntoView(null,.5),i.animateScrolling(r)},this.selectPageDown=function(){this.$moveByPage(1,!0)},this.selectPageUp=function(){this.$moveByPage(-1,!0)},this.gotoPageDown=function(){this.$moveByPage(1,!1)},this.gotoPageUp=function(){this.$moveByPage(-1,!1)},this.scrollPageDown=function(){this.$moveByPage(1)},this.scrollPageUp=function(){this.$moveByPage(-1)},this.scrollToRow=function(e){this.renderer.scrollToRow(e)},this.scrollToLine=function(e,t,i,n){this.renderer.scrollToLine(e,t,i,n)},this.centerSelection=function(){var e=this.getSelectionRange(),t={row:Math.floor(e.start.row+(e.end.row-e.start.row)/2),column:Math.floor(e.start.column+(e.end.column-e.start.column)/2)};this.renderer.alignCursor(t,.5)},this.getCursorPosition=function(){return this.selection.getCursor()},this.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},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(e,t){this.selection.moveCursorTo(e,t)},this.moveCursorToPosition=function(e){this.selection.moveCursorToPosition(e)},this.jumpToMatching=function(e,t){var i=this.getCursorPosition(),n=new A(this.session,i.row,i.column),s=n.getCurrentToken(),r=s||n.stepForward();if(r){var o,a,l=!1,h={},c=i.column-r.start,u={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(r.value.match(/[{}()\[\]]/g)){for(;r.value.length>c&&!l;c++)if(u[r.value[c]])switch(a=u[r.value[c]]+"."+r.type.replace("rparen","lparen"),isNaN(h[a])&&(h[a]=0),r.value[c]){case"(":case"[":case"{":h[a]++;break;case")":case"]":case"}":h[a]--,-1===h[a]&&(o="bracket",l=!0)}}else r&&-1!==r.type.indexOf("tag-name")&&(isNaN(h[r.value])&&(h[r.value]=0),"<"===s.value?h[r.value]++:"</"===s.value&&h[r.value]--,-1===h[r.value]&&(o="tag",l=!0));l||(s=r,r=n.stepForward(),c=0)}while(r&&!l);if(o){var g,f;if("bracket"===o)g=this.session.getBracketRange(i),g||(g=new d(n.getCurrentTokenRow(),n.getCurrentTokenColumn()+c-1,n.getCurrentTokenRow(),n.getCurrentTokenColumn()+c-1),f=g.start,(t||f.row===i.row&&2>Math.abs(f.column-i.column))&&(g=this.session.getBracketRange(f)));else if("tag"===o){if(!r||-1===r.type.indexOf("tag-name"))return;var m=r.value;if(g=new d(n.getCurrentTokenRow(),n.getCurrentTokenColumn()-2,n.getCurrentTokenRow(),n.getCurrentTokenColumn()-2),0===g.compare(i.row,i.column)){l=!1;do r=s,s=n.stepBackward(),s&&(-1!==s.type.indexOf("tag-close")&&g.setEnd(n.getCurrentTokenRow(),n.getCurrentTokenColumn()+1),r.value===m&&-1!==r.type.indexOf("tag-name")&&("<"===s.value?h[m]++:"</"===s.value&&h[m]--,0===h[m]&&(l=!0)));while(s&&!l)}r&&r.type.indexOf("tag-name")&&(f=g.start,f.row==i.row&&2>Math.abs(f.column-i.column)&&(f=g.end))}f=g&&g.cursor||f,f&&(e?g&&t?this.selection.setRange(g):g&&g.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(f.row,f.column):this.selection.moveTo(f.row,f.column))}}},this.gotoLine=function(e,t,i){this.selection.clearSelection(),this.session.unfold({row:e-1,column:t||0}),this.$blockScrolling+=1,this.exitMultiSelectMode&&this.exitMultiSelectMode(),this.moveCursorTo(e-1,t||0),this.$blockScrolling-=1,this.isRowFullyVisible(e-1)||this.scrollToLine(e-1,!0,i)},this.navigateTo=function(e,t){this.selection.moveTo(e,t)},this.navigateUp=function(e){if(this.selection.isMultiLine()&&!this.selection.isBackwards()){var t=this.selection.anchor.getPosition();return this.moveCursorToPosition(t)}this.selection.clearSelection(),this.selection.moveCursorBy(-e||-1,0)},this.navigateDown=function(e){if(this.selection.isMultiLine()&&this.selection.isBackwards()){var t=this.selection.anchor.getPosition();return this.moveCursorToPosition(t)}this.selection.clearSelection(),this.selection.moveCursorBy(e||1,0)},this.navigateLeft=function(e){if(this.selection.isEmpty())for(e=e||1;e--;)this.selection.moveCursorLeft();else{var t=this.getSelectionRange().start;this.moveCursorToPosition(t)}this.clearSelection()},this.navigateRight=function(e){if(this.selection.isEmpty())for(e=e||1;e--;)this.selection.moveCursorRight();else{var t=this.getSelectionRange().end;this.moveCursorToPosition(t)}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(e,t){t&&this.$search.set(t);var i=this.$search.find(this.session),n=0;return i?(this.$tryReplace(i,e)&&(n=1),null!==i&&(this.selection.setSelectionRange(i),this.renderer.scrollSelectionIntoView(i.start,i.end)),n):n},this.replaceAll=function(e,t){t&&this.$search.set(t);var i=this.$search.findAll(this.session),n=0;if(!i.length)return n;this.$blockScrolling+=1;var s=this.getSelectionRange();this.selection.moveTo(0,0);for(var r=i.length-1;r>=0;--r)this.$tryReplace(i[r],e)&&n++;return this.selection.setSelectionRange(s),this.$blockScrolling-=1,n},this.$tryReplace=function(e,t){var i=this.session.getTextRange(e);return t=this.$search.replace(i,t),null!==t?(e.end=this.session.replace(e,t),e):null},this.getLastSearchOptions=function(){return this.$search.getOptions()},this.find=function(e,t,n){t||(t={}),"string"==typeof e||e instanceof RegExp?t.needle=e:"object"==typeof e&&i.mixin(t,e);var s=this.selection.getRange();null==t.needle&&(e=this.session.getTextRange(s)||this.$search.$options.needle,e||(s=this.session.getWordRange(s.start.row,s.start.column),e=this.session.getTextRange(s)),this.$search.set({needle:e})),this.$search.set(t),t.start||this.$search.set({start:s});var r=this.$search.find(this.session);return t.preventScroll?r:r?(this.revealRange(r,n),r):(t.backwards?s.start=s.end:s.end=s.start,this.selection.setRange(s),void 0)},this.findNext=function(e,t){this.find({skipCurrent:!0,backwards:!1},e,t)},this.findPrevious=function(e,t){this.find(e,{skipCurrent:!0,backwards:!0},t)},this.revealRange=function(e,t){this.$blockScrolling+=1,this.session.unfold(e),this.selection.setSelectionRange(e),this.$blockScrolling-=1;var i=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(e.start,e.end,.5),t!==!1&&this.renderer.animateScrolling(i)},this.undo=function(){this.$blockScrolling++,this.session.getUndoManager().undo(),this.$blockScrolling--,this.renderer.scrollCursorIntoView(null,.5)},this.redo=function(){this.$blockScrolling++,this.session.getUndoManager().redo(),this.$blockScrolling--,this.renderer.scrollCursorIntoView(null,.5)},this.destroy=function(){this.renderer.destroy(),this._signal("destroy",this),this.session&&this.session.destroy()},this.setAutoScrollEditorIntoView=function(e){if(e){var t,i=this,n=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var s=this.$scrollAnchor;s.style.cssText="position:absolute",this.container.insertBefore(s,this.container.firstChild);var r=this.on("changeSelection",function(){n=!0}),o=this.renderer.on("beforeRender",function(){n&&(t=i.renderer.container.getBoundingClientRect())}),a=this.renderer.on("afterRender",function(){if(n&&t&&(i.isFocused()||i.searchBox&&i.searchBox.isFocused())){var e=i.renderer,r=e.$cursorLayer.$pixelPos,o=e.layerConfig,a=r.top-o.offset;n=r.top>=0&&0>a+t.top?!0:r.top<o.height&&r.top+t.top+o.lineHeight>window.innerHeight?!1:null,null!=n&&(s.style.top=a+"px",s.style.left=r.left+"px",s.style.height=o.lineHeight+"px",s.scrollIntoView(n)),n=t=null}});this.setAutoScrollEditorIntoView=function(e){e||(delete this.setAutoScrollEditorIntoView,this.removeEventListener("changeSelection",r),this.renderer.removeEventListener("afterRender",a),this.renderer.removeEventListener("beforeRender",o))}}},this.$resetCursorStyle=function(){var e=this.$cursorStyle||"ace",t=this.renderer.$cursorLayer;t&&(t.setSmoothBlinking(/smooth/.test(e)),t.isBlinking=!this.$readOnly&&"wide"!=e,n.setCssClass(t.element,"ace_slim-cursors",/slim/.test(e)))}}).call(v.prototype),p.defineOptions(v.prototype,"editor",{selectionStyle:{set:function(e){this.onSelectionChange(),this._signal("changeSelectionStyle",{data:e})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(){this.$resetCursorStyle()},initialValue:!1},cursorStyle:{set:function(){this.$resetCursorStyle()},values:["ace","slim","smooth","wide"],initialValue:"ace"},mergeUndoDeltas:{values:[!1,!0,"always"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},autoScrollEditorIntoView:{set:function(e){this.setAutoScrollEditorIntoView(e)}},hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",showLineNumbers:"renderer",showGutter:"renderer",displayIndentGuides:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",theme:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",dragEnabled:"$mouseHandler",focusTimout:"$mouseHandler",tooltipFollowsMouse:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",tabSize:"session",wrap:"session",foldStyle:"session",mode:"session"}),t.Editor=v}),ace.define("ace/undomanager",["require","exports","module"],function(e,t){"use strict";var i=function(){this.reset()};(function(){this.execute=function(e){var t=e.args[0];this.$doc=e.args[1],e.merge&&this.hasUndo()&&(this.dirtyCounter--,t=this.$undoStack.pop().concat(t)),this.$undoStack.push(t),this.$redoStack=[],0>this.dirtyCounter&&(this.dirtyCounter=0/0),this.dirtyCounter++},this.undo=function(e){var t=this.$undoStack.pop(),i=null;return t&&(i=this.$doc.undoChanges(t,e),this.$redoStack.push(t),this.dirtyCounter--),i},this.redo=function(e){var t=this.$redoStack.pop(),i=null;return t&&(i=this.$doc.redoChanges(t,e),this.$undoStack.push(t),this.dirtyCounter++),i},this.reset=function(){this.$undoStack=[],this.$redoStack=[],this.dirtyCounter=0},this.hasUndo=function(){return this.$undoStack.length>0},this.hasRedo=function(){return this.$redoStack.length>0},this.markClean=function(){this.dirtyCounter=0},this.isClean=function(){return 0===this.dirtyCounter}}).call(i.prototype),t.UndoManager=i}),ace.define("ace/layer/gutter",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter"],function(e,t){"use strict";var i=e("../lib/dom"),n=e("../lib/oop"),s=e("../lib/lang"),r=e("../lib/event_emitter").EventEmitter,o=function(e){this.element=i.createElement("div"),this.element.className="ace_layer ace_gutter-layer",e.appendChild(this.element),this.setShowFoldWidgets(this.$showFoldWidgets),this.gutterWidth=0,this.$annotations=[],this.$updateAnnotations=this.$updateAnnotations.bind(this),this.$cells=[]};(function(){n.implement(this,r),this.setSession=function(e){this.session&&this.session.removeEventListener("change",this.$updateAnnotations),this.session=e,e&&e.on("change",this.$updateAnnotations)},this.addGutterDecoration=function(e,t){window.console&&console.warn&&console.warn("deprecated use session.addGutterDecoration"),this.session.addGutterDecoration(e,t)},this.removeGutterDecoration=function(e,t){window.console&&console.warn&&console.warn("deprecated use session.removeGutterDecoration"),this.session.removeGutterDecoration(e,t)},this.setAnnotations=function(e){this.$annotations=[];for(var t=0;e.length>t;t++){var i=e[t],n=i.row,r=this.$annotations[n];r||(r=this.$annotations[n]={text:[]});var o=i.text;o=o?s.escapeHTML(o):i.html||"",-1===r.text.indexOf(o)&&r.text.push(o);var a=i.type;"error"==a?r.className=" ace_error":"warning"==a&&" ace_error"!=r.className?r.className=" ace_warning":"info"!=a||r.className||(r.className=" ace_info")}},this.$updateAnnotations=function(e){if(this.$annotations.length){var t=e.data,i=t.range,n=i.start.row,s=i.end.row-n;if(0===s);else if("removeText"==t.action||"removeLines"==t.action)this.$annotations.splice(n,s+1,null);else{var r=Array(s+1);r.unshift(n,1),this.$annotations.splice.apply(this.$annotations,r)}}},this.update=function(e){for(var t=this.session,n=e.firstRow,s=Math.min(e.lastRow+e.gutterOffset,t.getLength()-1),r=t.getNextFoldLine(n),o=r?r.start.row:1/0,a=this.$showFoldWidgets&&t.foldWidgets,l=t.$breakpoints,h=t.$decorations,c=t.$firstLineNumber,u=0,d=t.gutterRenderer||this.$renderer,g=null,f=-1,m=n;;){if(m>o&&(m=r.end.row+1,r=t.getNextFoldLine(m,r),o=r?r.start.row:1/0),m>s){for(;this.$cells.length>f+1;)g=this.$cells.pop(),this.element.removeChild(g.element);break}g=this.$cells[++f],g||(g={element:null,textNode:null,foldWidget:null},g.element=i.createElement("div"),g.textNode=document.createTextNode(""),g.element.appendChild(g.textNode),this.element.appendChild(g.element),this.$cells[f]=g);var p="ace_gutter-cell ";l[m]&&(p+=l[m]),h[m]&&(p+=h[m]),this.$annotations[m]&&(p+=this.$annotations[m].className),g.element.className!=p&&(g.element.className=p);var A=t.getRowLength(m)*e.lineHeight+"px";if(A!=g.element.style.height&&(g.element.style.height=A),a){var v=a[m];null==v&&(v=a[m]=t.getFoldWidget(m))}if(v){g.foldWidget||(g.foldWidget=i.createElement("span"),g.element.appendChild(g.foldWidget));var p="ace_fold-widget ace_"+v;p+="start"==v&&m==o&&r.end.row>m?" ace_closed":" ace_open",g.foldWidget.className!=p&&(g.foldWidget.className=p);var A=e.lineHeight+"px";g.foldWidget.style.height!=A&&(g.foldWidget.style.height=A)}else g.foldWidget&&(g.element.removeChild(g.foldWidget),g.foldWidget=null);var C=u=d?d.getText(t,m):m+c;C!=g.textNode.data&&(g.textNode.data=C),m++}this.element.style.height=e.minHeight+"px",(this.$fixedWidth||t.$useWrapMode)&&(u=t.getLength()+c);var F=d?d.getWidth(t,u,e):(""+u).length*e.characterWidth,w=this.$padding||this.$computePadding();F+=w.left+w.right,F===this.gutterWidth||isNaN(F)||(this.gutterWidth=F,this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._emit("changeGutterWidth",F))},this.$fixedWidth=!1,this.$showLineNumbers=!0,this.$renderer="",this.setShowLineNumbers=function(e){this.$renderer=!e&&{getWidth:function(){return""},getText:function(){return""}}},this.getShowLineNumbers=function(){return this.$showLineNumbers},this.$showFoldWidgets=!0,this.setShowFoldWidgets=function(e){e?i.addCssClass(this.element,"ace_folding-enabled"):i.removeCssClass(this.element,"ace_folding-enabled"),this.$showFoldWidgets=e,this.$padding=null},this.getShowFoldWidgets=function(){return this.$showFoldWidgets},this.$computePadding=function(){if(!this.element.firstChild)return{left:0,right:0};var e=i.computedStyle(this.element.firstChild);return this.$padding={},this.$padding.left=parseInt(e.paddingLeft)+1||0,this.$padding.right=parseInt(e.paddingRight)||0,this.$padding
|
11 |
+
},this.getRegion=function(e){var t=this.$padding||this.$computePadding(),i=this.element.getBoundingClientRect();return e.x<t.left+i.left?"markers":this.$showFoldWidgets&&e.x>i.right-t.right?"foldWidgets":void 0}}).call(o.prototype),t.Gutter=o}),ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(e,t){"use strict";var i=e("../range").Range,n=e("../lib/dom"),s=function(e){this.element=n.createElement("div"),this.element.className="ace_layer ace_marker-layer",e.appendChild(this.element)};(function(){this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setMarkers=function(e){this.markers=e},this.update=function(e){var e=e||this.config;if(e){this.config=e;var t=[];for(var i in this.markers){var n=this.markers[i];if(n.range){var s=n.range.clipRows(e.firstRow,e.lastRow);if(!s.isEmpty())if(s=s.toScreenRange(this.session),n.renderer){var r=this.$getTop(s.start.row,e),o=this.$padding+s.start.column*e.characterWidth;n.renderer(t,s,o,r,e)}else"fullLine"==n.type?this.drawFullLineMarker(t,s,n.clazz,e):"screenLine"==n.type?this.drawScreenLineMarker(t,s,n.clazz,e):s.isMultiLine()?"text"==n.type?this.drawTextMarker(t,s,n.clazz,e):this.drawMultiLineMarker(t,s,n.clazz,e):this.drawSingleLineMarker(t,s,n.clazz+" ace_start",e)}else n.update(t,this,this.session,e)}this.element.innerHTML=t.join("")}},this.$getTop=function(e,t){return(e-t.firstRowScreen)*t.lineHeight},this.drawTextMarker=function(e,t,n,s,r){var o=t.start.row,a=new i(o,t.start.column,o,this.session.getScreenLastRowColumn(o));for(this.drawSingleLineMarker(e,a,n+" ace_start",s,1,r),o=t.end.row,a=new i(o,0,o,t.end.column),this.drawSingleLineMarker(e,a,n,s,0,r),o=t.start.row+1;t.end.row>o;o++)a.start.row=o,a.end.row=o,a.end.column=this.session.getScreenLastRowColumn(o),this.drawSingleLineMarker(e,a,n,s,1,r)},this.drawMultiLineMarker=function(e,t,i,n,s){var r=this.$padding,o=n.lineHeight,a=this.$getTop(t.start.row,n),l=r+t.start.column*n.characterWidth;s=s||"",e.push("<div class='",i," ace_start' style='","height:",o,"px;","right:0;","top:",a,"px;","left:",l,"px;",s,"'></div>"),a=this.$getTop(t.end.row,n);var h=t.end.column*n.characterWidth;e.push("<div class='",i,"' style='","height:",o,"px;","width:",h,"px;","top:",a,"px;","left:",r,"px;",s,"'></div>"),o=(t.end.row-t.start.row-1)*n.lineHeight,0>o||(a=this.$getTop(t.start.row+1,n),e.push("<div class='",i,"' style='","height:",o,"px;","right:0;","top:",a,"px;","left:",r,"px;",s,"'></div>"))},this.drawSingleLineMarker=function(e,t,i,n,s,r){var o=n.lineHeight,a=(t.end.column+(s||0)-t.start.column)*n.characterWidth,l=this.$getTop(t.start.row,n),h=this.$padding+t.start.column*n.characterWidth;e.push("<div class='",i,"' style='","height:",o,"px;","width:",a,"px;","top:",l,"px;","left:",h,"px;",r||"","'></div>")},this.drawFullLineMarker=function(e,t,i,n,s){var r=this.$getTop(t.start.row,n),o=n.lineHeight;t.start.row!=t.end.row&&(o+=this.$getTop(t.end.row,n)-r),e.push("<div class='",i,"' style='","height:",o,"px;","top:",r,"px;","left:0;right:0;",s||"","'></div>")},this.drawScreenLineMarker=function(e,t,i,n,s){var r=this.$getTop(t.start.row,n),o=n.lineHeight;e.push("<div class='",i,"' style='","height:",o,"px;","top:",r,"px;","left:0;right:0;",s||"","'></div>")}}).call(s.prototype),t.Marker=s}),ace.define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/lib/event_emitter"],function(e,t){"use strict";var i=e("../lib/oop"),n=e("../lib/dom"),s=e("../lib/lang");e("../lib/useragent");var r=e("../lib/event_emitter").EventEmitter,o=function(e){this.element=n.createElement("div"),this.element.className="ace_layer ace_text-layer",e.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this)};(function(){i.implement(this,r),this.EOF_CHAR="¶",this.EOL_CHAR_LF="¬",this.EOL_CHAR_CRLF="¤",this.EOL_CHAR=this.EOL_CHAR_LF,this.TAB_CHAR="→",this.SPACE_CHAR="·",this.$padding=0,this.$updateEolChar=function(){var e="\n"==this.session.doc.getNewLineCharacter()?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;return this.EOL_CHAR!=e?(this.EOL_CHAR=e,!0):void 0},this.setPadding=function(e){this.$padding=e,this.element.style.padding="0 "+e+"px"},this.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},this.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},this.$setFontMetrics=function(e){this.$fontMetrics=e,this.$fontMetrics.on("changeCharacterSize",function(e){this._signal("changeCharacterSize",e)}.bind(this)),this.$pollSizeChanges()},this.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},this.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},this.setSession=function(e){this.session=e,e&&this.$computeTabString()},this.showInvisibles=!1,this.setShowInvisibles=function(e){return this.showInvisibles==e?!1:(this.showInvisibles=e,this.$computeTabString(),!0)},this.displayIndentGuides=!0,this.setDisplayIndentGuides=function(e){return this.displayIndentGuides==e?!1:(this.displayIndentGuides=e,this.$computeTabString(),!0)},this.$tabStrings=[],this.onChangeTabSize=this.$computeTabString=function(){var e=this.session.getTabSize();this.tabSize=e;for(var t=this.$tabStrings=[0],i=1;e+1>i;i++)this.showInvisibles?t.push("<span class='ace_invisible ace_invisible_tab'>"+this.TAB_CHAR+s.stringRepeat(" ",i-1)+"</span>"):t.push(s.stringRepeat(" ",i));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var n="ace_indent-guide",r="",o="";if(this.showInvisibles){n+=" ace_invisible",r=" ace_invisible_space",o=" ace_invisible_tab";var a=s.stringRepeat(this.SPACE_CHAR,this.tabSize),l=this.TAB_CHAR+s.stringRepeat(" ",this.tabSize-1)}else var a=s.stringRepeat(" ",this.tabSize),l=a;this.$tabStrings[" "]="<span class='"+n+r+"'>"+a+"</span>",this.$tabStrings[" "]="<span class='"+n+o+"'>"+l+"</span>"}},this.updateLines=function(e,t,i){(this.config.lastRow!=e.lastRow||this.config.firstRow!=e.firstRow)&&this.scrollLines(e),this.config=e;for(var n=Math.max(t,e.firstRow),s=Math.min(i,e.lastRow),r=this.element.childNodes,o=0,a=e.firstRow;n>a;a++){var l=this.session.getFoldLine(a);if(l){if(l.containsRow(n)){n=l.start.row;break}a=l.end.row}o++}for(var a=n,l=this.session.getNextFoldLine(a),h=l?l.start.row:1/0;;){if(a>h&&(a=l.end.row+1,l=this.session.getNextFoldLine(a,l),h=l?l.start.row:1/0),a>s)break;var c=r[o++];if(c){var u=[];this.$renderLine(u,a,!this.$useLineGroups(),a==h?l:!1),c.style.height=e.lineHeight*this.session.getRowLength(a)+"px",c.innerHTML=u.join("")}a++}},this.scrollLines=function(e){var t=this.config;if(this.config=e,!t||t.lastRow<e.firstRow)return this.update(e);if(e.lastRow<t.firstRow)return this.update(e);var i=this.element;if(t.firstRow<e.firstRow)for(var n=this.session.getFoldedRowCount(t.firstRow,e.firstRow-1);n>0;n--)i.removeChild(i.firstChild);if(t.lastRow>e.lastRow)for(var n=this.session.getFoldedRowCount(e.lastRow+1,t.lastRow);n>0;n--)i.removeChild(i.lastChild);if(e.firstRow<t.firstRow){var s=this.$renderLinesFragment(e,e.firstRow,t.firstRow-1);i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s)}if(e.lastRow>t.lastRow){var s=this.$renderLinesFragment(e,t.lastRow+1,e.lastRow);i.appendChild(s)}},this.$renderLinesFragment=function(e,t,i){for(var s=this.element.ownerDocument.createDocumentFragment(),r=t,o=this.session.getNextFoldLine(r),a=o?o.start.row:1/0;;){if(r>a&&(r=o.end.row+1,o=this.session.getNextFoldLine(r,o),a=o?o.start.row:1/0),r>i)break;var l=n.createElement("div"),h=[];if(this.$renderLine(h,r,!1,r==a?o:!1),l.innerHTML=h.join(""),this.$useLineGroups())l.className="ace_line_group",s.appendChild(l),l.style.height=e.lineHeight*this.session.getRowLength(r)+"px";else for(;l.firstChild;)s.appendChild(l.firstChild);r++}return s},this.update=function(e){this.config=e;for(var t=[],i=e.firstRow,n=e.lastRow,s=i,r=this.session.getNextFoldLine(s),o=r?r.start.row:1/0;;){if(s>o&&(s=r.end.row+1,r=this.session.getNextFoldLine(s,r),o=r?r.start.row:1/0),s>n)break;this.$useLineGroups()&&t.push("<div class='ace_line_group' style='height:",e.lineHeight*this.session.getRowLength(s),"px'>"),this.$renderLine(t,s,!1,s==o?r:!1),this.$useLineGroups()&&t.push("</div>"),s++}this.element.innerHTML=t.join("")},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderToken=function(e,t,i,n){var r=this,o=/\t|&|<|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g,a=function(e,i,n,o){if(i)return r.showInvisibles?"<span class='ace_invisible ace_invisible_space'>"+s.stringRepeat(r.SPACE_CHAR,e.length)+"</span>":s.stringRepeat(" ",e.length);if("&"==e)return"&";if("<"==e)return"<";if(" "==e){var a=r.session.getScreenTabSize(t+o);return t+=a-1,r.$tabStrings[a]}if(" "==e){var l=r.showInvisibles?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",h=r.showInvisibles?r.SPACE_CHAR:"";return t+=1,"<span class='"+l+"' style='width:"+2*r.config.characterWidth+"px'>"+h+"</span>"}return n?"<span class='ace_invisible ace_invisible_space ace_invalid'>"+r.SPACE_CHAR+"</span>":(t+=1,"<span class='ace_cjk' style='width:"+2*r.config.characterWidth+"px'>"+e+"</span>")},l=n.replace(o,a);if(this.$textToken[i.type])e.push(l);else{var h="ace_"+i.type.replace(/\./g," ace_"),c="";"fold"==i.type&&(c=" style='width:"+i.value.length*this.config.characterWidth+"px;' "),e.push("<span class='",h,"'",c,">",l,"</span>")}return t+n.length},this.renderIndentGuide=function(e,t,i){var n=t.search(this.$indentGuideRe);return 0>=n||n>=i?t:" "==t[0]?(n-=n%this.tabSize,e.push(s.stringRepeat(this.$tabStrings[" "],n/this.tabSize)),t.substr(n)):" "==t[0]?(e.push(s.stringRepeat(this.$tabStrings[" "],n)),t.substr(n)):t},this.$renderWrappedLine=function(e,t,i,n){for(var s=0,r=0,o=i[0],a=0,l=0;t.length>l;l++){var h=t[l],c=h.value;if(0==l&&this.displayIndentGuides){if(s=c.length,c=this.renderIndentGuide(e,c,o),!c)continue;s-=c.length}if(o>s+c.length)a=this.$renderToken(e,a,h,c),s+=c.length;else{for(;s+c.length>=o;)a=this.$renderToken(e,a,h,c.substring(0,o-s)),c=c.substring(o-s),s=o,n||e.push("</div>","<div class='ace_line' style='height:",this.config.lineHeight,"px'>"),r++,a=0,o=i[r]||Number.MAX_VALUE;0!=c.length&&(s+=c.length,a=this.$renderToken(e,a,h,c))}}},this.$renderSimpleLine=function(e,t){var i=0,n=t[0],s=n.value;this.displayIndentGuides&&(s=this.renderIndentGuide(e,s)),s&&(i=this.$renderToken(e,i,n,s));for(var r=1;t.length>r;r++)n=t[r],s=n.value,i=this.$renderToken(e,i,n,s)},this.$renderLine=function(e,t,i,n){if(n||0==n||(n=this.session.getFoldLine(t)),n)var s=this.$getFoldLineTokens(t,n);else var s=this.session.getTokens(t);if(i||e.push("<div class='ace_line' style='height:",this.config.lineHeight*(this.$useLineGroups()?1:this.session.getRowLength(t)),"px'>"),s.length){var r=this.session.getRowSplitData(t);r&&r.length?this.$renderWrappedLine(e,s,r,i):this.$renderSimpleLine(e,s)}this.showInvisibles&&(n&&(t=n.end.row),e.push("<span class='ace_invisible ace_invisible_eol'>",t==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,"</span>")),i||e.push("</div>")},this.$getFoldLineTokens=function(e,t){function i(e,t,i){for(var n=0,r=0;t>r+e[n].value.length;)if(r+=e[n].value.length,n++,n==e.length)return;if(r!=t){var o=e[n].value.substring(t-r);o.length>i-t&&(o=o.substring(0,i-t)),s.push({type:e[n].type,value:o}),r=t+o.length,n+=1}for(;i>r&&e.length>n;){var o=e[n].value;o.length+r>i?s.push({type:e[n].type,value:o.substring(0,i-r)}):s.push(e[n]),r+=o.length,n+=1}}var n=this.session,s=[],r=n.getTokens(e);return t.walk(function(e,t,o,a,l){null!=e?s.push({type:"fold",value:e}):(l&&(r=n.getTokens(t)),r.length&&i(r,a,o))},t.end.row,this.session.getLine(t.end.row).length),s},this.$useLineGroups=function(){return this.session.getUseWrapMode()},this.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$measureNode&&this.$measureNode.parentNode.removeChild(this.$measureNode),delete this.$measureNode}}).call(o.prototype),t.Text=o}),ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(e,t){"use strict";var i,n=e("../lib/dom"),s=function(e){this.element=n.createElement("div"),this.element.className="ace_layer ace_cursor-layer",e.appendChild(this.element),void 0===i&&(i="opacity"in this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),n.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateVisibility.bind(this)};(function(){this.$updateVisibility=function(e){for(var t=this.cursors,i=t.length;i--;)t[i].style.visibility=e?"":"hidden"},this.$updateOpacity=function(e){for(var t=this.cursors,i=t.length;i--;)t[i].style.opacity=e?"":"0"},this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setBlinking=function(e){e!=this.isBlinking&&(this.isBlinking=e,this.restartTimer())},this.setBlinkInterval=function(e){e!=this.blinkInterval&&(this.blinkInterval=e,this.restartTimer())},this.setSmoothBlinking=function(e){e==this.smoothBlinking||i||(this.smoothBlinking=e,n.setCssClass(this.element,"ace_smooth-blinking",e),this.$updateCursors(!0),this.$updateCursors=(e?this.$updateOpacity:this.$updateVisibility).bind(this),this.restartTimer())},this.addCursor=function(){var e=n.createElement("div");return e.className="ace_cursor",this.element.appendChild(e),this.cursors.push(e),e},this.removeCursor=function(){if(this.cursors.length>1){var e=this.cursors.pop();return e.parentNode.removeChild(e),e}},this.hideCursor=function(){this.isVisible=!1,n.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.showCursor=function(){this.isVisible=!0,n.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.restartTimer=function(){var e=this.$updateCursors;if(clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.smoothBlinking&&n.removeCssClass(this.element,"ace_smooth-blinking"),e(!0),this.isBlinking&&this.blinkInterval&&this.isVisible){this.smoothBlinking&&setTimeout(function(){n.addCssClass(this.element,"ace_smooth-blinking")}.bind(this));var t=function(){this.timeoutId=setTimeout(function(){e(!1)},.6*this.blinkInterval)}.bind(this);this.intervalId=setInterval(function(){e(!0),t()},this.blinkInterval),t()}},this.getPixelPosition=function(e,t){if(!this.config||!this.session)return{left:0,top:0};e||(e=this.session.selection.getCursor());var i=this.session.documentToScreenPosition(e),n=this.$padding+i.column*this.config.characterWidth,s=(i.row-(t?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:n,top:s}},this.update=function(e){this.config=e;var t=this.session.$selectionMarkers,i=0,n=0;(void 0===t||0===t.length)&&(t=[{cursor:null}]);for(var i=0,s=t.length;s>i;i++){var r=this.getPixelPosition(t[i].cursor,!0);if(!((r.top>e.height+e.offset||0>r.top)&&i>1)){var o=(this.cursors[n++]||this.addCursor()).style;o.left=r.left+"px",o.top=r.top+"px",o.width=e.characterWidth+"px",o.height=e.lineHeight+"px"}}for(;this.cursors.length>n;)this.removeCursor();var a=this.session.getOverwrite();this.$setOverwrite(a),this.$pixelPos=r,this.restartTimer()},this.$setOverwrite=function(e){e!=this.overwrite&&(this.overwrite=e,e?n.addCssClass(this.element,"ace_overwrite-cursors"):n.removeCssClass(this.element,"ace_overwrite-cursors"))},this.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)}}).call(s.prototype),t.Cursor=s}),ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(e,t){"use strict";var i=e("./lib/oop"),n=e("./lib/dom"),s=e("./lib/event"),r=e("./lib/event_emitter").EventEmitter,o=function(e){this.element=n.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+this.classSuffix,this.inner=n.createElement("div"),this.inner.className="ace_scrollbar-inner",this.element.appendChild(this.inner),e.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,s.addListener(this.element,"scroll",this.onScroll.bind(this)),s.addListener(this.element,"mousedown",s.preventDefault)};(function(){i.implement(this,r),this.setVisible=function(e){this.element.style.display=e?"":"none",this.isVisible=e}}).call(o.prototype);var a=function(e,t){o.call(this,e),this.scrollTop=0,t.$scrollbarWidth=this.width=n.scrollbarWidth(e.ownerDocument),this.inner.style.width=this.element.style.width=(this.width||15)+5+"px"};i.inherits(a,o),function(){this.classSuffix="-v",this.onScroll=function(){this.skipEvent||(this.scrollTop=this.element.scrollTop,this._emit("scroll",{data:this.scrollTop})),this.skipEvent=!1},this.getWidth=function(){return this.isVisible?this.width:0},this.setHeight=function(e){this.element.style.height=e+"px"},this.setInnerHeight=function(e){this.inner.style.height=e+"px"},this.setScrollHeight=function(e){this.inner.style.height=e+"px"},this.setScrollTop=function(e){this.scrollTop!=e&&(this.skipEvent=!0,this.scrollTop=this.element.scrollTop=e)}}.call(a.prototype);var l=function(e,t){o.call(this,e),this.scrollLeft=0,this.height=t.$scrollbarWidth,this.inner.style.height=this.element.style.height=(this.height||15)+5+"px"};i.inherits(l,o),function(){this.classSuffix="-h",this.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},this.getHeight=function(){return this.isVisible?this.height:0},this.setWidth=function(e){this.element.style.width=e+"px"},this.setInnerWidth=function(e){this.inner.style.width=e+"px"},this.setScrollWidth=function(e){this.inner.style.width=e+"px"},this.setScrollLeft=function(e){this.scrollLeft!=e&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=e)}}.call(l.prototype),t.ScrollBar=a,t.ScrollBarV=a,t.ScrollBarH=l,t.VScrollBar=a,t.HScrollBar=l}),ace.define("ace/renderloop",["require","exports","module","ace/lib/event"],function(e,t){"use strict";var i=e("./lib/event"),n=function(e,t){this.onRender=e,this.pending=!1,this.changes=0,this.window=t||window};(function(){this.schedule=function(e){if(this.changes=this.changes|e,!this.pending&&this.changes){this.pending=!0;var t=this;i.nextFrame(function(){t.pending=!1;for(var e;e=t.changes;)t.changes=0,t.onRender(e)},this.window)}}}).call(n.prototype),t.RenderLoop=n}),ace.define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/lib/event_emitter"],function(e,t){var i=e("../lib/oop"),n=e("../lib/dom"),s=e("../lib/lang"),r=e("../lib/useragent"),o=e("../lib/event_emitter").EventEmitter,a=0,l=t.FontMetrics=function(e){this.el=n.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=n.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=n.createElement("div"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),e.appendChild(this.el),a||this.$testFractionalRect(),this.$measureNode.innerHTML=s.stringRepeat("X",a),this.$characterSize={width:0,height:0},this.checkForSizeChanges()};(function(){i.implement(this,o),this.$characterSize={width:0,height:0},this.$testFractionalRect=function(){var e=n.createElement("div");this.$setMeasureNodeStyles(e.style),e.style.width="0.2px",document.documentElement.appendChild(e);var t=e.getBoundingClientRect().width;a=t>0&&1>t?50:100,e.parentNode.removeChild(e)},this.$setMeasureNodeStyles=function(e,t){e.width=e.height="auto",e.left=e.top="-100px",e.visibility="hidden",e.position="fixed",e.whiteSpace="pre",8>r.isIE?e["font-family"]="inherit":e.font="inherit",e.overflow=t?"hidden":"visible"},this.checkForSizeChanges=function(){var e=this.$measureSizes();if(e&&(this.$characterSize.width!==e.width||this.$characterSize.height!==e.height)){this.$measureNode.style.fontWeight="bold";var t=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=e,this.charSizes=Object.create(null),this.allowBoldFonts=t&&t.width===e.width&&t.height===e.height,this._emit("changeCharacterSize",{data:e})}},this.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer)return this.$pollSizeChangesTimer;var e=this;return this.$pollSizeChangesTimer=setInterval(function(){e.checkForSizeChanges()},500)},this.setPolling=function(e){e?this.$pollSizeChanges():this.$pollSizeChangesTimer&&this.$pollSizeChangesTimer},this.$measureSizes=function(){if(50===a){var e=null;try{e=this.$measureNode.getBoundingClientRect()}catch(t){e={width:0,height:0}}var i={height:e.height,width:e.width/a}}else var i={height:this.$measureNode.clientHeight,width:this.$measureNode.clientWidth/a};return 0===i.width||0===i.height?null:i},this.$measureCharWidth=function(e){this.$main.innerHTML=s.stringRepeat(e,a);var t=this.$main.getBoundingClientRect();return t.width/a},this.getCharacterWidth=function(e){var t=this.charSizes[e];return void 0===t&&(this.charSizes[e]=this.$measureCharWidth(e)/this.$characterSize.width),t},this.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)}}).call(l.prototype)}),ace.define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/config","ace/lib/useragent","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter"],function(e,t){"use strict";var i=e("./lib/oop"),n=e("./lib/dom"),s=e("./config"),r=e("./lib/useragent"),o=e("./layer/gutter").Gutter,a=e("./layer/marker").Marker,l=e("./layer/text").Text,h=e("./layer/cursor").Cursor,c=e("./scrollbar").HScrollBar,u=e("./scrollbar").VScrollBar,d=e("./renderloop").RenderLoop,g=e("./layer/font_metrics").FontMetrics,f=e("./lib/event_emitter").EventEmitter,m='.ace_editor {position: relative;overflow: hidden;font: 12px/normal \'Monaco\', \'Menlo\', \'Ubuntu Mono\', \'Consolas\', \'source-code-pro\', monospace;direction: ltr;}.ace_scroller {position: absolute;overflow: hidden;top: 0;bottom: 0;background-color: inherit;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;cursor: text;}.ace_content {position: absolute;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;min-width: 100%;}.ace_dragging .ace_scroller:before{position: absolute;top: 0;left: 0;right: 0;bottom: 0;content: \'\';background: rgba(250, 250, 250, 0.01);z-index: 1000;}.ace_dragging.ace_dark .ace_scroller:before{background: rgba(0, 0, 0, 0.01);}.ace_selecting, .ace_selecting * {cursor: text !important;}.ace_gutter {position: absolute;overflow : hidden;width: auto;top: 0;bottom: 0;left: 0;cursor: default;z-index: 4;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;}.ace_gutter-active-line {position: absolute;left: 0;right: 0;}.ace_scroller.ace_scroll-left {box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;}.ace_gutter-cell {padding-left: 19px;padding-right: 6px;background-repeat: no-repeat;}.ace_gutter-cell.ace_error {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==");background-repeat: no-repeat;background-position: 2px center;}.ace_gutter-cell.ace_warning {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==");background-position: 2px center;}.ace_gutter-cell.ace_info {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");background-position: 2px center;}.ace_dark .ace_gutter-cell.ace_info {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUh
|