WP Better Emails - Version 0.4

Version Description

  • Fix deprecation notices
  • Fix TinyMCE plugins
  • Remove live preview
Download this release

Release Info

Developer nlemoine
Plugin Icon 128x128 WP Better Emails
Version 0.4
Comparing to
See all releases

Code changes from version 0.3 to 0.4

Files changed (64) hide show
  1. css/wpbe-admin-style.css → assets/css/wpbe.scss +3 -0
  2. js/wpbe-admin-script.js → assets/js/admin.js +26 -19
  3. assets/js/plugins/codemirror/code.js +40 -0
  4. assets/js/plugins/codemirror/code.scss +10 -0
  5. assets/js/plugins/codemirror/plugin.js +63 -0
  6. assets/js/plugins/codemirror/source.html +14 -0
  7. assets/js/plugins/fullpage.js +1 -0
  8. dist/css/wpbe.css +1 -0
  9. dist/js/admin.js +1 -0
  10. dist/js/plugins/codemirror/code.css +1 -0
  11. dist/js/plugins/codemirror/code.js +1 -0
  12. dist/js/plugins/codemirror/plugin.js +1 -0
  13. dist/js/plugins/codemirror/source.html +14 -0
  14. dist/js/plugins/fullpage.js +1 -0
  15. dist/mix-manifest.json +9 -0
  16. package.json +39 -0
  17. readme.txt +12 -6
  18. templates/template-1.html +0 -60
  19. templates/template-1.php +0 -55
  20. templates/template.php +55 -0
  21. tinymce-plugins/3.3.x/fullpage/css/fullpage.css +0 -182
  22. tinymce-plugins/3.3.x/fullpage/editor_plugin.js +0 -1
  23. tinymce-plugins/3.3.x/fullpage/editor_plugin_src.js +0 -182
  24. tinymce-plugins/3.3.x/fullpage/fullpage.htm +0 -571
  25. tinymce-plugins/3.3.x/fullpage/js/fullpage.js +0 -471
  26. tinymce-plugins/3.3.x/fullpage/langs/en_dlg.js +0 -85
  27. tinymce-plugins/3.4.x/fullpage/css/fullpage.css +0 -143
  28. tinymce-plugins/3.4.x/fullpage/editor_plugin.js +0 -1
  29. tinymce-plugins/3.4.x/fullpage/editor_plugin_src.js +0 -399
  30. tinymce-plugins/3.4.x/fullpage/fullpage.htm +0 -259
  31. tinymce-plugins/3.4.x/fullpage/js/fullpage.js +0 -232
  32. tinymce-plugins/3.4.x/fullpage/langs/en_dlg.js +0 -85
  33. tinymce-plugins/cmseditor/editor_plugin.js +0 -84
  34. tinymce-plugins/cmseditor/img/ed-bg.gif +0 -0
  35. tinymce-plugins/cmseditor/img/html.gif +0 -0
  36. tinymce-plugins/cmseditor/js/LICENSE +0 -19
  37. tinymce-plugins/cmseditor/js/README.md +0 -6
  38. tinymce-plugins/cmseditor/js/codemirror-compressed.js +0 -1
  39. tinymce-plugins/cmseditor/js/lib/codemirror.css +0 -82
  40. tinymce-plugins/cmseditor/js/lib/codemirror.js +0 -2157
  41. tinymce-plugins/cmseditor/js/lib/overlay.js +0 -51
  42. tinymce-plugins/cmseditor/js/lib/runmode.js +0 -27
  43. tinymce-plugins/cmseditor/js/mode/css/css.js +0 -124
  44. tinymce-plugins/cmseditor/js/mode/css/index.html +0 -56
  45. tinymce-plugins/cmseditor/js/mode/htmlmixed/htmlmixed.js +0 -79
  46. tinymce-plugins/cmseditor/js/mode/htmlmixed/index.html +0 -52
  47. tinymce-plugins/cmseditor/js/mode/javascript/index.html +0 -78
  48. tinymce-plugins/cmseditor/js/mode/javascript/javascript.js +0 -348
  49. tinymce-plugins/cmseditor/js/mode/php/index.html +0 -49
  50. tinymce-plugins/cmseditor/js/mode/php/php.js +0 -115
  51. tinymce-plugins/cmseditor/js/mode/xml/index.html +0 -42
  52. tinymce-plugins/cmseditor/js/mode/xml/xml.js +0 -231
  53. tinymce-plugins/cmseditor/js/mode/xmlpure/index.html +0 -60
  54. tinymce-plugins/cmseditor/js/mode/xmlpure/xmlpure.js +0 -481
  55. tinymce-plugins/cmseditor/js/theme/default.css +0 -19
  56. tinymce-plugins/cmseditor/js/theme/elegant.css +0 -9
  57. tinymce-plugins/cmseditor/js/theme/neat.css +0 -8
  58. tinymce-plugins/cmseditor/js/theme/night.css +0 -20
  59. tinymce-plugins/cmseditor/langs/en.js +0 -3
  60. tinymce-plugins/cmseditor/langs/en_dlg.js +0 -3
  61. views/help.php +12 -0
  62. webpack.mix.js +33 -0
  63. wpbe-options.php +7 -9
  64. wpbe.php +60 -135
css/wpbe-admin-style.css → assets/css/wpbe.scss RENAMED
@@ -1,3 +1,6 @@
 
 
 
1
  #wpbe_preview_email {
2
  vertical-align: middle;
3
  }
1
+ // @import '../../node_modules/codemirror/lib/codemirror.css';
2
+ // @import '../../node_modules/codemirror/theme/monokai.css';
3
+
4
  #wpbe_preview_email {
5
  vertical-align: middle;
6
  }
js/wpbe-admin-script.js → assets/js/admin.js RENAMED
@@ -1,61 +1,68 @@
1
- jQuery(document).ready(function($){
 
 
2
 
3
  // Send email preview
4
- $('#wpbe_send_preview').on('click', this, function(e) {
5
  e.preventDefault();
6
- var email = $('#wpbe_email_preview_field').val(), message = $('#wpbe_preview_message'), loading = $('#wpbe_ajax_loading');
 
 
7
  $.ajax({
8
  type: 'post',
9
- url: wpbe_ajax_vars.url,
10
  data: {
11
  action: wpbe_ajax_vars.action,
12
  preview_email: email,
13
  _ajax_nonce: wpbe_ajax_vars.nonce
14
  },
15
- beforeSend: function() {
16
  loading.css('visibility', 'visible');
17
  },
18
- complete: function() {
19
  loading.css('visibility', 'hidden');
20
  },
21
- success: function(data) {
 
22
  message.append(data);
23
  }
24
  });
25
  });
26
 
27
  // Trigger help
28
- $('.wpbe_help').on('click', this, function(e){
29
  e.preventDefault();
30
  $('#contextual-help-link').trigger('click');
31
  });
32
 
33
  // Thickbox preview
34
- $('#wpbe_preview_template').on('click', this, function(e) {
35
  e.preventDefault();
36
 
37
- var $this = $(this),
38
- title = $this.attr('title'),
39
- href = $this.attr('href');
40
 
41
  // Open TB
42
  tb_show(title, href);
43
- var $previewIframe = $('#TB_iframeContent');
44
 
45
- if( !$previewIframe.length )
46
  return;
 
47
 
48
- var template;
49
- if (typeof(tinyMCE) != 'undefined') {
50
- if( tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden() )
51
  template = tinyMCE.activeEditor.getContent();
52
- else
53
  template = $('.wpbe_template').val();
 
54
  }
55
 
56
  $previewIframe = $previewIframe[$previewIframe.length - 1].contentWindow || frame[$previewIframe.length - 1];
57
  $previewIframe.document.open();
58
- $previewIframe.document.write( template );
59
  $previewIframe.document.close();
60
  });
61
 
1
+ const $ = jQuery;
2
+
3
+ $(document).ready(() => {
4
 
5
  // Send email preview
6
+ $('#wpbe_send_preview').on('click', this, (e) => {
7
  e.preventDefault();
8
+ const email = $('#wpbe_email_preview_field').val();
9
+ const message = $('#wpbe_preview_message');
10
+ const loading = $('#wpbe_ajax_loading');
11
  $.ajax({
12
  type: 'post',
13
+ url: ajaxurl,
14
  data: {
15
  action: wpbe_ajax_vars.action,
16
  preview_email: email,
17
  _ajax_nonce: wpbe_ajax_vars.nonce
18
  },
19
+ beforeSend: () => {
20
  loading.css('visibility', 'visible');
21
  },
22
+ complete: () => {
23
  loading.css('visibility', 'hidden');
24
  },
25
+ success: data => {
26
+ message.empty();
27
  message.append(data);
28
  }
29
  });
30
  });
31
 
32
  // Trigger help
33
+ $('.wpbe_help').on('click', this, e => {
34
  e.preventDefault();
35
  $('#contextual-help-link').trigger('click');
36
  });
37
 
38
  // Thickbox preview
39
+ $('#wpbe_preview_template').on('click', e => {
40
  e.preventDefault();
41
 
42
+ const $this = $(e.target);
43
+ const title = $this.attr('title');
44
+ const href = $this.attr('href');
45
 
46
  // Open TB
47
  tb_show(title, href);
48
+ const $previewIframe = $('#TB_iframeContent');
49
 
50
+ if (!$previewIframe.length) {
51
  return;
52
+ }
53
 
54
+ let template;
55
+ if (typeof tinyMCE != 'undefined') {
56
+ if (tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden()) {
57
  template = tinyMCE.activeEditor.getContent();
58
+ } else {
59
  template = $('.wpbe_template').val();
60
+ }
61
  }
62
 
63
  $previewIframe = $previewIframe[$previewIframe.length - 1].contentWindow || frame[$previewIframe.length - 1];
64
  $previewIframe.document.open();
65
+ $previewIframe.document.write(template);
66
  $previewIframe.document.close();
67
  });
68
 
assets/js/plugins/codemirror/code.js ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import CodeMirror from "codemirror/lib/codemirror";
2
+
3
+ import "codemirror/addon/fold/xml-fold";
4
+ import "codemirror/addon/edit/matchtags";
5
+ import "codemirror/addon/edit/matchbrackets";
6
+ import "codemirror/addon/selection/active-line";
7
+
8
+ import "codemirror/mode/xml/xml";
9
+ import "codemirror/mode/javascript/javascript";
10
+ import "codemirror/mode/css/css";
11
+ import "codemirror/mode/htmlmixed/htmlmixed";
12
+
13
+ window.addEventListener("load", () => {
14
+ const tinymce = parent.tinymce;
15
+ editor = tinymce.activeEditor;
16
+ const html = editor.getContent({
17
+ source_view: true,
18
+ });
19
+
20
+ codeMirrorInstance = CodeMirror(document.body, {
21
+ indentOnInit: true,
22
+ lineNumbers: true,
23
+ styleActiveLine: true,
24
+ matchBrackets: true,
25
+ matchTags: {
26
+ bothTags: true,
27
+ },
28
+ theme: "monokai",
29
+ mode: "htmlmixed",
30
+ value: html,
31
+ });
32
+
33
+ const last = codeMirrorInstance.lineCount();
34
+ codeMirrorInstance.operation(() => {
35
+ for (let i = 0; i < last; ++i) {
36
+ codeMirrorInstance.indentLine(i);
37
+ }
38
+ });
39
+
40
+ });
assets/js/plugins/codemirror/code.scss ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ @import '../../../../node_modules/codemirror/lib/codemirror.css';
2
+ @import '../../../../node_modules/codemirror/theme/monokai.css';
3
+
4
+ html,body { height:100%; }
5
+ body {
6
+ margin: 0;
7
+ }
8
+ .CodeMirror {
9
+ height: 100%;
10
+ }
assets/js/plugins/codemirror/plugin.js ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tinymce.PluginManager.add("codemirror", function(editor, url) {
2
+ function showSourceEditor() {
3
+ editor.focus();
4
+ editor.selection.collapse(true);
5
+
6
+ const defaults = {
7
+ width: 800,
8
+ height: 500,
9
+ fullscreen: true,
10
+ };
11
+
12
+ const settings = {
13
+ ...defaults,
14
+ };
15
+
16
+ const buttonsConfig = [
17
+ {
18
+ text: "Ok",
19
+ subtype: "primary",
20
+ onclick: function() {
21
+ const doc = document.querySelectorAll(".mce-container-body>iframe")[0];
22
+ doc.contentWindow.submit();
23
+ win.close();
24
+ },
25
+ },
26
+ {
27
+ text: "Cancel",
28
+ onclick: "close",
29
+ },
30
+ ];
31
+
32
+ const config = {
33
+ title: "HTML source code",
34
+ url: url + "/source.html",
35
+ width: settings.width,
36
+ height: settings.width,
37
+ resizable: true,
38
+ maximizable: true,
39
+ fullScreen: true,
40
+ saveCursorPosition: false,
41
+ buttons: buttonsConfig,
42
+ };
43
+
44
+ const win = editor.windowManager.open(config);
45
+
46
+ win.fullscreen(true);
47
+ }
48
+
49
+ // Add a button to the button bar
50
+ editor.addButton("code", {
51
+ title: "Source code",
52
+ icon: "code",
53
+ onclick: showSourceEditor,
54
+ });
55
+
56
+ // Add a menu item to the tools menu
57
+ editor.addMenuItem("code", {
58
+ icon: "code",
59
+ text: "Source code",
60
+ context: "tools",
61
+ onclick: showSourceEditor,
62
+ });
63
+ });
assets/js/plugins/codemirror/source.html ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <link rel="stylesheet" href="code.css" />
5
+ <script>
6
+ var codeMirrorInstance, editor;
7
+ function submit() {
8
+ codeMirrorInstance && editor.setContent(codeMirrorInstance.getValue());
9
+ }
10
+ </script>
11
+ <script src="code.js"></script>
12
+ </head>
13
+ <body></body>
14
+ </html>
assets/js/plugins/fullpage.js ADDED
@@ -0,0 +1 @@
 
1
+ import 'tinymce/plugins/fullpage';
dist/css/wpbe.css ADDED
@@ -0,0 +1 @@
 
1
+ #wpbe_ajax_loading,#wpbe_preview_email{vertical-align:middle}#wpbe_preview_message{width:80%}#wpbe_support{color:#777;border-top:1px solid #dfdfdf}#wpbe_template_tbl{border:1px solid #ccc;overflow:auto}#wpbe_template{width:100%;height:410px}#wpbe_template_container{width:80%}#wpbe_preview_template{font-weight:400}
dist/js/admin.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=0)}({0:function(e,t,n){n("iA/y"),n("mH3F"),e.exports=n("AgjY")},AgjY:function(e,t){},"iA/y":function(e,t){var n=this;var r=jQuery;r(document).ready((function(){r("#wpbe_send_preview").on("click",n,(function(e){e.preventDefault();var t=r("#wpbe_email_preview_field").val(),n=r("#wpbe_preview_message"),i=r("#wpbe_ajax_loading");r.ajax({type:"post",url:ajaxurl,data:{action:wpbe_ajax_vars.action,preview_email:t,_ajax_nonce:wpbe_ajax_vars.nonce},beforeSend:function(){i.css("visibility","visible")},complete:function(){i.css("visibility","hidden")},success:function(e){n.empty(),n.append(e)}})})),r(".wpbe_help").on("click",n,(function(e){e.preventDefault(),r("#contextual-help-link").trigger("click")})),r("#wpbe_preview_template").on("click",(function(e){e.preventDefault();var t=r(e.target),n=t.attr("title"),i=t.attr("href");tb_show(n,i);var o,a=r("#TB_iframeContent");a.length&&("undefined"!=typeof tinyMCE&&(o=tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden()?tinyMCE.activeEditor.getContent():r(".wpbe_template").val()),function(e){throw new Error('"'+e+'" is read-only')}("$previewIframe"),(a=a[a.length-1].contentWindow||frame[a.length-1]).document.open(),a.document.write(o),a.document.close())}))}))},mH3F:function(e,t){}});
dist/js/plugins/codemirror/code.css ADDED
@@ -0,0 +1 @@
 
1
+ .CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}.CodeMirror-lines{padding:4px 0}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor-mark{background-color:rgba(20,255,20,.5)}.cm-animate-fat-cursor,.cm-fat-cursor-mark{-webkit-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite}.cm-animate-fat-cursor{width:auto;border:0;background-color:#7e7}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-type,.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-invalidchar,.cm-s-default .cm-error{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:none;position:relative}.CodeMirror-sizer{position:relative;border-right:50px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none;outline:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-50px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:none!important;border:none!important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{border-radius:0;border-width:0;background:transparent;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;font-variant-ligatures:contextual}.CodeMirror-wrap pre.CodeMirror-line,.CodeMirror-wrap pre.CodeMirror-line-like{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;padding:.1px}.CodeMirror-rtl pre{direction:rtl}.CodeMirror-code{outline:none}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}.CodeMirror-focused div.CodeMirror-cursors,div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:""}span.CodeMirror-selectedtext{background:none}.cm-s-monokai.CodeMirror{background:#272822;color:#f8f8f2}.cm-s-monokai div.CodeMirror-selected{background:#49483e}.cm-s-monokai .CodeMirror-line::selection,.cm-s-monokai .CodeMirror-line>span::selection,.cm-s-monokai .CodeMirror-line>span>span::selection{background:rgba(73,72,62,.99)}.cm-s-monokai .CodeMirror-line::-moz-selection,.cm-s-monokai .CodeMirror-line>span::-moz-selection,.cm-s-monokai .CodeMirror-line>span>span::-moz-selection{background:rgba(73,72,62,.99)}.cm-s-monokai .CodeMirror-gutters{background:#272822;border-right:0}.cm-s-monokai .CodeMirror-guttermarker{color:#fff}.cm-s-monokai .CodeMirror-guttermarker-subtle,.cm-s-monokai .CodeMirror-linenumber{color:#d0d0d0}.cm-s-monokai .CodeMirror-cursor{border-left:1px solid #f8f8f0}.cm-s-monokai span.cm-comment{color:#75715e}.cm-s-monokai span.cm-atom,.cm-s-monokai span.cm-number{color:#ae81ff}.cm-s-monokai span.cm-comment.cm-attribute{color:#97b757}.cm-s-monokai span.cm-comment.cm-def{color:#bc9262}.cm-s-monokai span.cm-comment.cm-tag{color:#bc6283}.cm-s-monokai span.cm-comment.cm-type{color:#5998a6}.cm-s-monokai span.cm-attribute,.cm-s-monokai span.cm-property{color:#a6e22e}.cm-s-monokai span.cm-keyword{color:#f92672}.cm-s-monokai span.cm-builtin{color:#66d9ef}.cm-s-monokai span.cm-string{color:#e6db74}.cm-s-monokai span.cm-variable{color:#f8f8f2}.cm-s-monokai span.cm-variable-2{color:#9effff}.cm-s-monokai span.cm-type,.cm-s-monokai span.cm-variable-3{color:#66d9ef}.cm-s-monokai span.cm-def{color:#fd971f}.cm-s-monokai span.cm-bracket{color:#f8f8f2}.cm-s-monokai span.cm-tag{color:#f92672}.cm-s-monokai span.cm-header,.cm-s-monokai span.cm-link{color:#ae81ff}.cm-s-monokai span.cm-error{background:#f92672;color:#f8f8f0}.cm-s-monokai .CodeMirror-activeline-background{background:#373831}.cm-s-monokai .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}body,html{height:100%}body{margin:0}.CodeMirror{height:100%}
dist/js/plugins/codemirror/code.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=2)}({"+dQi":function(e,t,r){!function(e){"use strict";e.defineMode("javascript",(function(t,r){var n,i,o=t.indentUnit,a=r.statementIndent,l=r.jsonld,s=r.json||l,c=r.typescript,u=r.wordCharacters||/[\w$\xa1-\uffff]/,d=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("keyword d"),o=e("operator"),a={type:"atom",style:"atom"};return{if:e("if"),while:t,with:t,else:r,do:r,try:r,finally:r,return:i,break:i,continue:i,new:e("new"),delete:n,void:n,throw:n,debugger:e("debugger"),var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:o,typeof:o,instanceof:o,true:a,false:a,null:a,undefined:a,NaN:a,Infinity:a,this:e("this"),class:e("class"),super:e("atom"),yield:n,export:e("export"),import:e("import"),extends:n,await:n}}(),f=/[+\-*&%=<>!?|~^@]/,h=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function p(e,t,r){return n=e,i=r,t}function g(e,t){var r,n=e.next();if('"'==n||"'"==n)return t.tokenize=(r=n,function(e,t){var n,i=!1;if(l&&"@"==e.peek()&&e.match(h))return t.tokenize=g,p("jsonld-keyword","meta");for(;null!=(n=e.next())&&(n!=r||i);)i=!i&&"\\"==n;return i||(t.tokenize=g),p("string","string")}),t.tokenize(e,t);if("."==n&&e.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return p("number","number");if("."==n&&e.match(".."))return p("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return p(n);if("="==n&&e.eat(">"))return p("=>","operator");if("0"==n&&e.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return p("number","number");if(/\d/.test(n))return e.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),p("number","number");if("/"==n)return e.eat("*")?(t.tokenize=m,m(e,t)):e.eat("/")?(e.skipToEnd(),p("comment","comment")):qe(e,t,1)?(function(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),p("regexp","string-2")):(e.eat("="),p("operator","operator",e.current()));if("`"==n)return t.tokenize=v,v(e,t);if("#"==n&&"!"==e.peek())return e.skipToEnd(),p("meta","meta");if("#"==n&&e.eatWhile(u))return p("variable","property");if("<"==n&&e.match("!--")||"-"==n&&e.match("->")&&!/\S/.test(e.string.slice(0,e.start)))return e.skipToEnd(),p("comment","comment");if(f.test(n))return">"==n&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=n&&"="!=n||e.eat("="):/[<>*+\-|&?]/.test(n)&&(e.eat(n),">"==n&&e.eat(n))),"?"==n&&e.eat(".")?p("."):p("operator","operator",e.current());if(u.test(n)){e.eatWhile(u);var i=e.current();if("."!=t.lastType){if(d.propertyIsEnumerable(i)){var o=d[i];return p(o.type,o.style,i)}if("async"==i&&e.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return p("async","keyword",i)}return p("variable","variable",i)}}function m(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=g;break}n="*"==r}return p("comment","comment")}function v(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=g;break}n=!n&&"\\"==r}return p("quasi","string-2",e.current())}function y(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(r<0)){if(c){var n=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,r));n&&(r=n.index)}for(var i=0,o=!1,a=r-1;a>=0;--a){var l=e.string.charAt(a),s="([{}])".indexOf(l);if(s>=0&&s<3){if(!i){++a;break}if(0==--i){"("==l&&(o=!0);break}}else if(s>=3&&s<6)++i;else if(u.test(l))o=!0;else if(/["'\/`]/.test(l))for(;;--a){if(0==a)return;if(e.string.charAt(a-1)==l&&"\\"!=e.string.charAt(a-2)){a--;break}}else if(o&&!i){++a;break}}o&&!i&&(t.fatArrowAt=a)}}var b={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function w(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function x(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(r=n.vars;r;r=r.next)if(r.name==t)return!0}var k={state:null,column:null,marked:null,cc:null};function C(){for(var e=arguments.length-1;e>=0;e--)k.cc.push(arguments[e])}function S(){return C.apply(null,arguments),!0}function L(e,t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}function T(e){var t=k.state;if(k.marked="def",t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var n=function e(t,r){if(r){if(r.block){var n=e(t,r.prev);return n?n==r.prev?r:new N(n,r.vars,!0):null}return L(t,r.vars)?r:new N(r.prev,new A(t,r.vars),!1)}return null}(e,t.context);if(null!=n)return void(t.context=n)}else if(!L(e,t.localVars))return void(t.localVars=new A(e,t.localVars));r.globalVars&&!L(e,t.globalVars)&&(t.globalVars=new A(e,t.globalVars))}function M(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function N(e,t,r){this.prev=e,this.vars=t,this.block=r}function A(e,t){this.name=e,this.next=t}var O=new A("this",new A("arguments",null));function D(){k.state.context=new N(k.state.context,k.state.localVars,!1),k.state.localVars=O}function z(){k.state.context=new N(k.state.context,k.state.localVars,!0),k.state.localVars=null}function W(){k.state.localVars=k.state.context.vars,k.state.context=k.state.context.prev}function P(e,t){var r=function(){var r=k.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented;r.lexical=new w(n,k.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function F(){var e=k.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function H(e){return function t(r){return r==e?S():";"==e||"}"==r||")"==r||"]"==r?C():S(t)}}function E(e,t){return"var"==e?S(P("vardef",t),ye,H(";"),F):"keyword a"==e?S(P("form"),j,E,F):"keyword b"==e?S(P("form"),E,F):"keyword d"==e?k.stream.match(/^\s*$/,!1)?S():S(P("stat"),K,H(";"),F):"debugger"==e?S(H(";")):"{"==e?S(P("}"),z,oe,F,W):";"==e?S():"if"==e?("else"==k.state.lexical.info&&k.state.cc[k.state.cc.length-1]==F&&k.state.cc.pop()(),S(P("form"),j,E,F,Se)):"function"==e?S(Ne):"for"==e?S(P("form"),Le,E,F):"class"==e||c&&"interface"==t?(k.marked="keyword",S(P("form","class"==e?e:t),We,F)):"variable"==e?c&&"declare"==t?(k.marked="keyword",S(E)):c&&("module"==t||"enum"==t||"type"==t)&&k.stream.match(/^\s*\w/,!1)?(k.marked="keyword","enum"==t?S(Ue):"type"==t?S(Oe,H("operator"),ue,H(";")):S(P("form"),be,H("{"),P("}"),oe,F,F)):c&&"namespace"==t?(k.marked="keyword",S(P("form"),B,E,F)):c&&"abstract"==t?(k.marked="keyword",S(E)):S(P("stat"),Q):"switch"==e?S(P("form"),j,H("{"),P("}","switch"),z,oe,F,F,W):"case"==e?S(B,H(":")):"default"==e?S(H(":")):"catch"==e?S(P("form"),D,I,E,F,W):"export"==e?S(P("stat"),Ee,F):"import"==e?S(P("stat"),Be,F):"async"==e?S(E):"@"==t?S(B,E):C(P("stat"),B,H(";"),F)}function I(e){if("("==e)return S(De,H(")"))}function B(e,t){return V(e,t,!1)}function R(e,t){return V(e,t,!0)}function j(e){return"("!=e?C():S(P(")"),K,H(")"),F)}function V(e,t,r){if(k.state.fatArrowAt==k.stream.start){var n=r?X:$;if("("==e)return S(D,P(")"),ne(De,")"),F,H("=>"),n,W);if("variable"==e)return C(D,be,H("=>"),n,W)}var i=r?U:G;return b.hasOwnProperty(e)?S(i):"function"==e?S(Ne,i):"class"==e||c&&"interface"==t?(k.marked="keyword",S(P("form"),ze,F)):"keyword c"==e||"async"==e?S(r?R:B):"("==e?S(P(")"),K,H(")"),F,i):"operator"==e||"spread"==e?S(r?R:B):"["==e?S(P("]"),Ge,F,i):"{"==e?ie(ee,"}",null,i):"quasi"==e?C(_,i):"new"==e?S(function(e){return function(t){return"."==t?S(e?Z:Y):"variable"==t&&c?S(ge,e?U:G):C(e?R:B)}}(r)):"import"==e?S(B):S()}function K(e){return e.match(/[;\}\)\],]/)?C():C(B)}function G(e,t){return","==e?S(K):U(e,t,!1)}function U(e,t,r){var n=0==r?G:U,i=0==r?B:R;return"=>"==e?S(D,r?X:$,W):"operator"==e?/\+\+|--/.test(t)||c&&"!"==t?S(n):c&&"<"==t&&k.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?S(P(">"),ne(ue,">"),F,n):"?"==t?S(B,H(":"),i):S(i):"quasi"==e?C(_,n):";"!=e?"("==e?ie(R,")","call",n):"."==e?S(J,n):"["==e?S(P("]"),K,H("]"),F,n):c&&"as"==t?(k.marked="keyword",S(ue,n)):"regexp"==e?(k.state.lastType=k.marked="operator",k.stream.backUp(k.stream.pos-k.stream.start-1),S(i)):void 0:void 0}function _(e,t){return"quasi"!=e?C():"${"!=t.slice(t.length-2)?S(_):S(B,q)}function q(e){if("}"==e)return k.marked="string-2",k.state.tokenize=v,S(_)}function $(e){return y(k.stream,k.state),C("{"==e?E:B)}function X(e){return y(k.stream,k.state),C("{"==e?E:R)}function Y(e,t){if("target"==t)return k.marked="keyword",S(G)}function Z(e,t){if("target"==t)return k.marked="keyword",S(U)}function Q(e){return":"==e?S(F,E):C(G,H(";"),F)}function J(e){if("variable"==e)return k.marked="property",S()}function ee(e,t){return"async"==e?(k.marked="property",S(ee)):"variable"==e||"keyword"==k.style?(k.marked="property","get"==t||"set"==t?S(te):(c&&k.state.fatArrowAt==k.stream.start&&(r=k.stream.match(/^\s*:\s*/,!1))&&(k.state.fatArrowAt=k.stream.pos+r[0].length),S(re))):"number"==e||"string"==e?(k.marked=l?"property":k.style+" property",S(re)):"jsonld-keyword"==e?S(re):c&&M(t)?(k.marked="keyword",S(ee)):"["==e?S(B,ae,H("]"),re):"spread"==e?S(R,re):"*"==t?(k.marked="keyword",S(ee)):":"==e?C(re):void 0;var r}function te(e){return"variable"!=e?C(re):(k.marked="property",S(Ne))}function re(e){return":"==e?S(R):"("==e?C(Ne):void 0}function ne(e,t,r){function n(i,o){if(r?r.indexOf(i)>-1:","==i){var a=k.state.lexical;return"call"==a.info&&(a.pos=(a.pos||0)+1),S((function(r,n){return r==t||n==t?C():C(e)}),n)}return i==t||o==t?S():r&&r.indexOf(";")>-1?C(e):S(H(t))}return function(r,i){return r==t||i==t?S():C(e,n)}}function ie(e,t,r){for(var n=3;n<arguments.length;n++)k.cc.push(arguments[n]);return S(P(t,r),ne(e,t),F)}function oe(e){return"}"==e?S():C(E,oe)}function ae(e,t){if(c){if(":"==e)return S(ue);if("?"==t)return S(ae)}}function le(e,t){if(c&&(":"==e||"in"==t))return S(ue)}function se(e){if(c&&":"==e)return k.stream.match(/^\s*\w+\s+is\b/,!1)?S(B,ce,ue):S(ue)}function ce(e,t){if("is"==t)return k.marked="keyword",S()}function ue(e,t){return"keyof"==t||"typeof"==t||"infer"==t?(k.marked="keyword",S("typeof"==t?R:ue)):"variable"==e||"void"==t?(k.marked="type",S(pe)):"|"==t||"&"==t?S(ue):"string"==e||"number"==e||"atom"==e?S(pe):"["==e?S(P("]"),ne(ue,"]",","),F,pe):"{"==e?S(P("}"),ne(fe,"}",",;"),F,pe):"("==e?S(ne(he,")"),de,pe):"<"==e?S(ne(ue,">"),ue):void 0}function de(e){if("=>"==e)return S(ue)}function fe(e,t){return"variable"==e||"keyword"==k.style?(k.marked="property",S(fe)):"?"==t||"number"==e||"string"==e?S(fe):":"==e?S(ue):"["==e?S(H("variable"),le,H("]"),fe):"("==e?C(Ae,fe):void 0}function he(e,t){return"variable"==e&&k.stream.match(/^\s*[?:]/,!1)||"?"==t?S(he):":"==e?S(ue):"spread"==e?S(he):C(ue)}function pe(e,t){return"<"==t?S(P(">"),ne(ue,">"),F,pe):"|"==t||"."==e||"&"==t?S(ue):"["==e?S(ue,H("]"),pe):"extends"==t||"implements"==t?(k.marked="keyword",S(ue)):"?"==t?S(ue,H(":"),ue):void 0}function ge(e,t){if("<"==t)return S(P(">"),ne(ue,">"),F,pe)}function me(){return C(ue,ve)}function ve(e,t){if("="==t)return S(ue)}function ye(e,t){return"enum"==t?(k.marked="keyword",S(Ue)):C(be,ae,ke,Ce)}function be(e,t){return c&&M(t)?(k.marked="keyword",S(be)):"variable"==e?(T(t),S()):"spread"==e?S(be):"["==e?ie(xe,"]"):"{"==e?ie(we,"}"):void 0}function we(e,t){return"variable"!=e||k.stream.match(/^\s*:/,!1)?("variable"==e&&(k.marked="property"),"spread"==e?S(be):"}"==e?C():"["==e?S(B,H("]"),H(":"),we):S(H(":"),be,ke)):(T(t),S(ke))}function xe(){return C(be,ke)}function ke(e,t){if("="==t)return S(R)}function Ce(e){if(","==e)return S(ye)}function Se(e,t){if("keyword b"==e&&"else"==t)return S(P("form","else"),E,F)}function Le(e,t){return"await"==t?S(Le):"("==e?S(P(")"),Te,F):void 0}function Te(e){return"var"==e?S(ye,Me):"variable"==e?S(Me):C(Me)}function Me(e,t){return")"==e?S():";"==e?S(Me):"in"==t||"of"==t?(k.marked="keyword",S(B,Me)):C(B,Me)}function Ne(e,t){return"*"==t?(k.marked="keyword",S(Ne)):"variable"==e?(T(t),S(Ne)):"("==e?S(D,P(")"),ne(De,")"),F,se,E,W):c&&"<"==t?S(P(">"),ne(me,">"),F,Ne):void 0}function Ae(e,t){return"*"==t?(k.marked="keyword",S(Ae)):"variable"==e?(T(t),S(Ae)):"("==e?S(D,P(")"),ne(De,")"),F,se,W):c&&"<"==t?S(P(">"),ne(me,">"),F,Ae):void 0}function Oe(e,t){return"keyword"==e||"variable"==e?(k.marked="type",S(Oe)):"<"==t?S(P(">"),ne(me,">"),F):void 0}function De(e,t){return"@"==t&&S(B,De),"spread"==e?S(De):c&&M(t)?(k.marked="keyword",S(De)):c&&"this"==e?S(ae,ke):C(be,ae,ke)}function ze(e,t){return"variable"==e?We(e,t):Pe(e,t)}function We(e,t){if("variable"==e)return T(t),S(Pe)}function Pe(e,t){return"<"==t?S(P(">"),ne(me,">"),F,Pe):"extends"==t||"implements"==t||c&&","==e?("implements"==t&&(k.marked="keyword"),S(c?ue:B,Pe)):"{"==e?S(P("}"),Fe,F):void 0}function Fe(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||c&&M(t))&&k.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(k.marked="keyword",S(Fe)):"variable"==e||"keyword"==k.style?(k.marked="property",S(He,Fe)):"number"==e||"string"==e?S(He,Fe):"["==e?S(B,ae,H("]"),He,Fe):"*"==t?(k.marked="keyword",S(Fe)):c&&"("==e?C(Ae,Fe):";"==e||","==e?S(Fe):"}"==e?S():"@"==t?S(B,Fe):void 0}function He(e,t){if("?"==t)return S(He);if(":"==e)return S(ue,ke);if("="==t)return S(R);var r=k.state.lexical.prev;return C(r&&"interface"==r.info?Ae:Ne)}function Ee(e,t){return"*"==t?(k.marked="keyword",S(Ke,H(";"))):"default"==t?(k.marked="keyword",S(B,H(";"))):"{"==e?S(ne(Ie,"}"),Ke,H(";")):C(E)}function Ie(e,t){return"as"==t?(k.marked="keyword",S(H("variable"))):"variable"==e?C(R,Ie):void 0}function Be(e){return"string"==e?S():"("==e?C(B):C(Re,je,Ke)}function Re(e,t){return"{"==e?ie(Re,"}"):("variable"==e&&T(t),"*"==t&&(k.marked="keyword"),S(Ve))}function je(e){if(","==e)return S(Re,je)}function Ve(e,t){if("as"==t)return k.marked="keyword",S(Re)}function Ke(e,t){if("from"==t)return k.marked="keyword",S(B)}function Ge(e){return"]"==e?S():C(ne(R,"]"))}function Ue(){return C(P("form"),be,H("{"),P("}"),ne(_e,"}"),F,F)}function _e(){return C(be,ke)}function qe(e,t,r){return t.tokenize==g&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}return W.lex=!0,F.lex=!0,{startState:function(e){var t={tokenize:g,lastType:"sof",cc:[],lexical:new w((e||0)-o,0,"block",!1),localVars:r.localVars,context:r.localVars&&new N(null,null,!1),indented:e||0};return r.globalVars&&"object"==typeof r.globalVars&&(t.globalVars=r.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),y(e,t)),t.tokenize!=m&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==n?r:(t.lastType="operator"!=n||"++"!=i&&"--"!=i?n:"incdec",function(e,t,r,n,i){var o=e.cc;for(k.state=e,k.stream=i,k.marked=null,k.cc=o,k.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;)if((o.length?o.pop():s?B:E)(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return k.marked?k.marked:"variable"==r&&x(e,n)?"variable-2":t}}(t,r,n,i,e))},indent:function(t,n){if(t.tokenize==m)return e.Pass;if(t.tokenize!=g)return 0;var i,l=n&&n.charAt(0),s=t.lexical;if(!/^\s*else\b/.test(n))for(var c=t.cc.length-1;c>=0;--c){var u=t.cc[c];if(u==F)s=s.prev;else if(u!=Se)break}for(;("stat"==s.type||"form"==s.type)&&("}"==l||(i=t.cc[t.cc.length-1])&&(i==G||i==U)&&!/^[,\.=+\-*:?[\(]/.test(n));)s=s.prev;a&&")"==s.type&&"stat"==s.prev.type&&(s=s.prev);var d=s.type,h=l==d;return"vardef"==d?s.indented+("operator"==t.lastType||","==t.lastType?s.info.length+1:0):"form"==d&&"{"==l?s.indented:"form"==d?s.indented+o:"stat"==d?s.indented+(function(e,t){return"operator"==e.lastType||","==e.lastType||f.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}(t,n)?a||o:0):"switch"!=s.info||h||0==r.doubleIndentSwitch?s.align?s.column+(h?0:1):s.indented+(h?0:o):s.indented+(/^(?:case|default)\b/.test(n)?o:2*o)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:s?null:"/*",blockCommentEnd:s?null:"*/",blockCommentContinue:s?null:" * ",lineComment:s?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:s?"json":"javascript",jsonldMode:l,jsonMode:s,expressionAllowed:qe,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=B&&t!=R||e.cc.pop()}}})),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}(r("VrN/"))},"19PJ":function(e,t,r){"use strict";r.r(t);var n=r("VrN/"),i=r.n(n);r("osHv"),r("jwo+"),r("jDMi"),r("McUL"),r("1eCo"),r("+dQi"),r("ewDg"),r("1p+/");window.addEventListener("load",(function(){var e=parent.tinymce;editor=e.activeEditor;var t=editor.getContent({source_view:!0});codeMirrorInstance=i()(document.body,{indentOnInit:!0,lineNumbers:!0,styleActiveLine:!0,matchBrackets:!0,matchTags:{bothTags:!0},theme:"monokai",mode:"htmlmixed",value:t});var r=codeMirrorInstance.lineCount();codeMirrorInstance.operation((function(){for(var e=0;e<r;++e)codeMirrorInstance.indentLine(e)}))}))},"1eCo":function(e,t,r){!function(e){"use strict";var t={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},r={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};e.defineMode("xml",(function(n,i){var o,a,l=n.indentUnit,s={},c=i.htmlMode?t:r;for(var u in c)s[u]=c[u];for(var u in i)s[u]=i[u];function d(e,t){function r(r){return t.tokenize=r,r(e,t)}var n=e.next();return"<"==n?e.eat("!")?e.eat("[")?e.match("CDATA[")?r(h("atom","]]>")):null:e.match("--")?r(h("comment","--\x3e")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),r(function e(t){return function(r,n){for(var i;null!=(i=r.next());){if("<"==i)return n.tokenize=e(t+1),n.tokenize(r,n);if(">"==i){if(1==t){n.tokenize=d;break}return n.tokenize=e(t-1),n.tokenize(r,n)}}return"meta"}}(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=h("meta","?>"),"meta"):(o=e.eat("/")?"closeTag":"openTag",t.tokenize=f,"tag bracket"):"&"==n?(e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"))?"atom":"error":(e.eatWhile(/[^&<]/),null)}function f(e,t){var r,n,i=e.next();if(">"==i||"/"==i&&e.eat(">"))return t.tokenize=d,o=">"==i?"endTag":"selfcloseTag","tag bracket";if("="==i)return o="equals",null;if("<"==i){t.tokenize=d,t.state=v,t.tagName=t.tagStart=null;var a=t.tokenize(e,t);return a?a+" tag error":"tag error"}return/[\'\"]/.test(i)?(t.tokenize=(r=i,(n=function(e,t){for(;!e.eol();)if(e.next()==r){t.tokenize=f;break}return"string"}).isInAttribute=!0,n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function h(e,t){return function(r,n){for(;!r.eol();){if(r.match(t)){n.tokenize=d;break}r.next()}return e}}function p(e,t,r){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r,(s.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function g(e){e.context&&(e.context=e.context.prev)}function m(e,t){for(var r;;){if(!e.context)return;if(r=e.context.tagName,!s.contextGrabbers.hasOwnProperty(r)||!s.contextGrabbers[r].hasOwnProperty(t))return;g(e)}}function v(e,t,r){return"openTag"==e?(r.tagStart=t.column(),y):"closeTag"==e?b:v}function y(e,t,r){return"word"==e?(r.tagName=t.current(),a="tag",k):s.allowMissingTagName&&"endTag"==e?(a="tag bracket",k(e,0,r)):(a="error",y)}function b(e,t,r){if("word"==e){var n=t.current();return r.context&&r.context.tagName!=n&&s.implicitlyClosed.hasOwnProperty(r.context.tagName)&&g(r),r.context&&r.context.tagName==n||!1===s.matchClosing?(a="tag",w):(a="tag error",x)}return s.allowMissingTagName&&"endTag"==e?(a="tag bracket",w(e,0,r)):(a="error",x)}function w(e,t,r){return"endTag"!=e?(a="error",w):(g(r),v)}function x(e,t,r){return a="error",w(e,0,r)}function k(e,t,r){if("word"==e)return a="attribute",C;if("endTag"==e||"selfcloseTag"==e){var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||s.autoSelfClosers.hasOwnProperty(n)?m(r,n):(m(r,n),r.context=new p(r,n,i==r.indented)),v}return a="error",k}function C(e,t,r){return"equals"==e?S:(s.allowMissing||(a="error"),k(e,0,r))}function S(e,t,r){return"string"==e?L:"word"==e&&s.allowUnquoted?(a="string",k):(a="error",k(e,0,r))}function L(e,t,r){return"string"==e?L:k(e,0,r)}return d.isInText=!0,{startState:function(e){var t={tokenize:d,state:v,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;o=null;var r=t.tokenize(e,t);return(r||o)&&"comment"!=r&&(a=null,t.state=t.state(o||r,e,t),a&&(r="error"==a?r+" error":a)),r},indent:function(t,r,n){var i=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+l;if(i&&i.noIndent)return e.Pass;if(t.tokenize!=f&&t.tokenize!=d)return n?n.match(/^(\s*)/)[0].length:0;if(t.tagName)return!1!==s.multilineTagIndentPastTag?t.tagStart+t.tagName.length+2:t.tagStart+l*(s.multilineTagIndentFactor||1);if(s.alignCDATA&&/<!\[CDATA\[/.test(r))return 0;var o=r&&/^<(\/)?([\w_:\.-]*)/.exec(r);if(o&&o[1])for(;i;){if(i.tagName==o[2]){i=i.prev;break}if(!s.implicitlyClosed.hasOwnProperty(i.tagName))break;i=i.prev}else if(o)for(;i;){var a=s.contextGrabbers[i.tagName];if(!a||!a.hasOwnProperty(o[2]))break;i=i.prev}for(;i&&i.prev&&!i.startOfLine;)i=i.prev;return i?i.indent+l:t.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:s.htmlMode?"html":"xml",helperType:s.htmlMode?"html":"xml",skipAttribute:function(e){e.state==S&&(e.state=k)},xmlCurrentTag:function(e){return e.tagName?{name:e.tagName,close:"closeTag"==e.type}:null},xmlCurrentContext:function(e){for(var t=[],r=e.context;r;r=r.prev)r.tagName&&t.push(r.tagName);return t.reverse()}}})),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}(r("VrN/"))},"1p+/":function(e,t,r){!function(e){"use strict";var t={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]},r={};function n(e,t){var n=e.match(function(e){var t=r[e];return t||(r[e]=new RegExp("\\s+"+e+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*"))}(t));return n?/^\s*(.*?)\s*$/.exec(n[2])[1]:""}function i(e,t){return new RegExp((t?"^":"")+"</s*"+e+"s*>","i")}function o(e,t){for(var r in e)for(var n=t[r]||(t[r]=[]),i=e[r],o=i.length-1;o>=0;o--)n.unshift(i[o])}e.defineMode("htmlmixed",(function(r,a){var l=e.getMode(r,{name:"xml",htmlMode:!0,multilineTagIndentFactor:a.multilineTagIndentFactor,multilineTagIndentPastTag:a.multilineTagIndentPastTag}),s={},c=a&&a.tags,u=a&&a.scriptTypes;if(o(t,s),c&&o(c,s),u)for(var d=u.length-1;d>=0;d--)s.script.unshift(["type",u[d].matches,u[d].mode]);function f(t,o){var a,c=l.token(t,o.htmlState),u=/\btag\b/.test(c);if(u&&!/[<>\s\/]/.test(t.current())&&(a=o.htmlState.tagName&&o.htmlState.tagName.toLowerCase())&&s.hasOwnProperty(a))o.inTag=a+" ";else if(o.inTag&&u&&/>$/.test(t.current())){var d=/^([\S]+) (.*)/.exec(o.inTag);o.inTag=null;var h=">"==t.current()&&function(e,t){for(var r=0;r<e.length;r++){var i=e[r];if(!i[0]||i[1].test(n(t,i[0])))return i[2]}}(s[d[1]],d[2]),p=e.getMode(r,h),g=i(d[1],!0),m=i(d[1],!1);o.token=function(e,t){return e.match(g,!1)?(t.token=f,t.localState=t.localMode=null,null):function(e,t,r){var n=e.current(),i=n.search(t);return i>-1?e.backUp(n.length-i):n.match(/<\/?$/)&&(e.backUp(n.length),e.match(t,!1)||e.match(n)),r}(e,m,t.localMode.token(e,t.localState))},o.localMode=p,o.localState=e.startState(p,l.indent(o.htmlState,"",""))}else o.inTag&&(o.inTag+=t.current(),t.eol()&&(o.inTag+=" "));return c}return{startState:function(){return{token:f,inTag:null,localMode:null,localState:null,htmlState:e.startState(l)}},copyState:function(t){var r;return t.localState&&(r=e.copyState(t.localMode,t.localState)),{token:t.token,inTag:t.inTag,localMode:t.localMode,localState:r,htmlState:e.copyState(l,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,r,n){return!t.localMode||/^\s*<\//.test(r)?l.indent(t.htmlState,r,n):t.localMode.indent?t.localMode.indent(t.localState,r,n):e.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||l}}}}),"xml","javascript","css"),e.defineMIME("text/html","htmlmixed")}(r("VrN/"),r("1eCo"),r("+dQi"),r("ewDg"))},2:function(e,t,r){e.exports=r("19PJ")},McUL:function(e,t,r){!function(e){"use strict";var t="CodeMirror-activeline-background";function r(e){for(var r=0;r<e.state.activeLines.length;r++)e.removeLineClass(e.state.activeLines[r],"wrap","CodeMirror-activeline"),e.removeLineClass(e.state.activeLines[r],"background",t),e.removeLineClass(e.state.activeLines[r],"gutter","CodeMirror-activeline-gutter")}function n(e,n){for(var i=[],o=0;o<n.length;o++){var a=n[o],l=e.getOption("styleActiveLine");if("object"==typeof l&&l.nonEmpty?a.anchor.line==a.head.line:a.empty()){var s=e.getLineHandleVisualStart(a.head.line);i[i.length-1]!=s&&i.push(s)}}(function(e,t){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0})(e.state.activeLines,i)||e.operation((function(){r(e);for(var n=0;n<i.length;n++)e.addLineClass(i[n],"wrap","CodeMirror-activeline"),e.addLineClass(i[n],"background",t),e.addLineClass(i[n],"gutter","CodeMirror-activeline-gutter");e.state.activeLines=i}))}function i(e,t){n(e,t.ranges)}e.defineOption("styleActiveLine",!1,(function(t,o,a){var l=a!=e.Init&&a;o!=l&&(l&&(t.off("beforeSelectionChange",i),r(t),delete t.state.activeLines),o&&(t.state.activeLines=[],n(t,t.listSelections()),t.on("beforeSelectionChange",i)))}))}(r("VrN/"))},"VrN/":function(e,t,r){e.exports=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,r=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),a=n||i||o,l=a&&(n?document.documentMode||6:+(o||i)[1]),s=!o&&/WebKit\//.test(e),c=s&&/Qt\/\d+\.\d+/.test(e),u=!o&&/Chrome\//.test(e),d=/Opera\//.test(e),f=/Apple Computer/.test(navigator.vendor),h=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),g=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),m=/Android/.test(e),v=g||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=g||/Mac/.test(t),b=/\bCrOS\b/.test(e),w=/win/i.test(t),x=d&&e.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(d=!1,s=!0);var k=y&&(c||d&&(null==x||x<12.11)),C=r||a&&l>=9;function S(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var L,T=function(e,t){var r=e.className,n=S(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}};function M(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function N(e,t){return M(e).appendChild(t)}function A(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function O(e,t,r,n){var i=A(e,t,r,n);return i.setAttribute("role","presentation"),i}function D(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function z(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function W(e,t){var r=e.className;S(t).test(r)||(e.className+=(r?" ":"")+t)}function P(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!S(r[n]).test(t)&&(t+=" "+r[n]);return t}L=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(e){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var F=function(e){e.select()};function H(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function E(e,t,r){for(var n in t||(t={}),e)!e.hasOwnProperty(n)||!1===r&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function I(e,t,r,n,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=n||0,a=i||0;;){var l=e.indexOf("\t",o);if(l<0||l>=t)return a+(t-o);a+=l-o,a+=r-a%r,o=l+1}}g?F=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:a&&(F=function(e){try{e.select()}catch(e){}});var B=function(){this.id=null,this.f=null,this.time=0,this.handler=H(this.onTimeout,this)};function R(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}B.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},B.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=r)};var j={toString:function(){return"CodeMirror.Pass"}},V={scroll:!1},K={origin:"*mouse"},G={origin:"+move"};function U(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);-1==o&&(o=e.length);var a=o-n;if(o==e.length||i+a>=t)return n+Math.min(a,t-i);if(i+=o-n,n=o+1,(i+=r-i%r)>=t)return n}}var _=[""];function q(e){for(;_.length<=e;)_.push($(_)+" ");return _[e]}function $(e){return e[e.length-1]}function X(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Y(){}function Z(e,t){var r;return Object.create?r=Object.create(e):(Y.prototype=e,r=new Y),t&&E(t,r),r}var Q=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function J(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Q.test(e))}function ee(e,t){return t?!!(t.source.indexOf("\\w")>-1&&J(e))||t.test(e):J(e)}function te(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var re=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ne(e){return e.charCodeAt(0)>=768&&re.test(e)}function ie(e,t,r){for(;(r<0?t>0:t<e.length)&&ne(e.charAt(t));)t+=r;return t}function oe(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var i=(t+r)/2,o=n<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+n}}var ae=null;function le(e,t,r){var n;ae=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==r?n=i:ae=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:ae=i)}return null!=n?n:ae}var se=function(){var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,r=/[LRr]/,n=/[Lb1n]/,i=/[1n]/;function o(e,t,r){this.level=e,this.from=t,this.to=r}return function(a,l){var s="ltr"==l?"L":"R";if(0==a.length||"ltr"==l&&!e.test(a))return!1;for(var c,u=a.length,d=[],f=0;f<u;++f)d.push((c=a.charCodeAt(f))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(c):1424<=c&&c<=1524?"R":1536<=c&&c<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(c-1536):1774<=c&&c<=2220?"r":8192<=c&&c<=8203?"w":8204==c?"b":"L");for(var h=0,p=s;h<u;++h){var g=d[h];"m"==g?d[h]=p:p=g}for(var m=0,v=s;m<u;++m){var y=d[m];"1"==y&&"r"==v?d[m]="n":r.test(y)&&(v=y,"r"==y&&(d[m]="R"))}for(var b=1,w=d[0];b<u-1;++b){var x=d[b];"+"==x&&"1"==w&&"1"==d[b+1]?d[b]="1":","!=x||w!=d[b+1]||"1"!=w&&"n"!=w||(d[b]=w),w=x}for(var k=0;k<u;++k){var C=d[k];if(","==C)d[k]="N";else if("%"==C){var S=void 0;for(S=k+1;S<u&&"%"==d[S];++S);for(var L=k&&"!"==d[k-1]||S<u&&"1"==d[S]?"1":"N",T=k;T<S;++T)d[T]=L;k=S-1}}for(var M=0,N=s;M<u;++M){var A=d[M];"L"==N&&"1"==A?d[M]="L":r.test(A)&&(N=A)}for(var O=0;O<u;++O)if(t.test(d[O])){var D=void 0;for(D=O+1;D<u&&t.test(d[D]);++D);for(var z="L"==(O?d[O-1]:s),W=z==("L"==(D<u?d[D]:s))?z?"L":"R":s,P=O;P<D;++P)d[P]=W;O=D-1}for(var F,H=[],E=0;E<u;)if(n.test(d[E])){var I=E;for(++E;E<u&&n.test(d[E]);++E);H.push(new o(0,I,E))}else{var B=E,R=H.length,j="rtl"==l?1:0;for(++E;E<u&&"L"!=d[E];++E);for(var V=B;V<E;)if(i.test(d[V])){B<V&&(H.splice(R,0,new o(1,B,V)),R+=j);var K=V;for(++V;V<E&&i.test(d[V]);++V);H.splice(R,0,new o(2,K,V)),R+=j,B=V}else++V;B<E&&H.splice(R,0,new o(1,B,E))}return"ltr"==l&&(1==H[0].level&&(F=a.match(/^\s+/))&&(H[0].from=F[0].length,H.unshift(new o(0,0,F[0].length))),1==$(H).level&&(F=a.match(/\s+$/))&&($(H).to-=F[0].length,H.push(new o(0,u-F[0].length,u)))),"rtl"==l?H.reverse():H}}();function ce(e,t){var r=e.order;return null==r&&(r=e.order=se(e.text,t)),r}var ue=[],de=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||ue).concat(r)}};function fe(e,t){return e._handlers&&e._handlers[t]||ue}function he(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,i=n&&n[t];if(i){var o=R(i,r);o>-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function pe(e,t){var r=fe(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function ge(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),pe(e,r||t.type,e,t),xe(t)||t.codemirrorIgnore}function me(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==R(r,t[n])&&r.push(t[n])}function ve(e,t){return fe(e,t).length>0}function ye(e){e.prototype.on=function(e,t){de(this,e,t)},e.prototype.off=function(e,t){he(this,e,t)}}function be(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function we(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function xe(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function ke(e){be(e),we(e)}function Ce(e){return e.target||e.srcElement}function Se(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var Le,Te,Me=function(){if(a&&l<9)return!1;var e=A("div");return"draggable"in e||"dragDrop"in e}();function Ne(e){if(null==Le){var t=A("span","​");N(e,A("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Le=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&l<8))}var r=Le?A("span","​"):A("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Ae(e){if(null!=Te)return Te;var t=N(e,document.createTextNode("AخA")),r=L(t,0,1).getBoundingClientRect(),n=L(t,1,2).getBoundingClientRect();return M(e),!(!r||r.left==r.right)&&(Te=n.right-r.right<3)}var Oe,De=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},ze=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},We="oncopy"in(Oe=A("div"))||(Oe.setAttribute("oncopy","return;"),"function"==typeof Oe.oncopy),Pe=null,Fe={},He={};function Ee(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Fe[e]=t}function Ie(e){if("string"==typeof e&&He.hasOwnProperty(e))e=He[e];else if(e&&"string"==typeof e.name&&He.hasOwnProperty(e.name)){var t=He[e.name];"string"==typeof t&&(t={name:t}),(e=Z(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ie("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ie("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Be(e,t){t=Ie(t);var r=Fe[t.name];if(!r)return Be(e,"text/plain");var n=r(e,t);if(Re.hasOwnProperty(t.name)){var i=Re[t.name];for(var o in i)i.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)n[a]=t.modeProps[a];return n}var Re={};function je(e,t){E(t,Re.hasOwnProperty(e)?Re[e]:Re[e]={})}function Ve(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Ke(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function Ge(e,t,r){return!e.startState||e.startState(t,r)}var Ue=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};function _e(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function qe(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,(function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i})),n}function $e(e,t,r){var n=[];return e.iter(t,r,(function(e){n.push(e.text)})),n}function Xe(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function Ye(e){if(null==e.parent)return null;for(var t=e.parent,r=R(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function Ze(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var a=0;a<e.lines.length;++a){var l=e.lines[a].height;if(t<l)break;t-=l}return r+a}function Qe(e,t){return t>=e.first&&t<e.first+e.size}function Je(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function et(e,t,r){if(void 0===r&&(r=null),!(this instanceof et))return new et(e,t,r);this.line=e,this.ch=t,this.sticky=r}function tt(e,t){return e.line-t.line||e.ch-t.ch}function rt(e,t){return e.sticky==t.sticky&&0==tt(e,t)}function nt(e){return et(e.line,e.ch)}function it(e,t){return tt(e,t)<0?t:e}function ot(e,t){return tt(e,t)<0?e:t}function at(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function lt(e,t){if(t.line<e.first)return et(e.first,0);var r=e.first+e.size-1;return t.line>r?et(r,_e(e,r).text.length):function(e,t){var r=e.ch;return null==r||r>t?et(e.line,t):r<0?et(e.line,0):e}(t,_e(e,t.line).text.length)}function st(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=lt(e,t[n]);return r}Ue.prototype.eol=function(){return this.pos>=this.string.length},Ue.prototype.sol=function(){return this.pos==this.lineStart},Ue.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ue.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ue.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Ue.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ue.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ue.prototype.skipToEnd=function(){this.pos=this.string.length},Ue.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ue.prototype.backUp=function(e){this.pos-=e},Ue.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=I(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?I(this.string,this.lineStart,this.tabSize):0)},Ue.prototype.indentation=function(){return I(this.string,null,this.tabSize)-(this.lineStart?I(this.string,this.lineStart,this.tabSize):0)},Ue.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Ue.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ue.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ue.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ue.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ct=function(e,t){this.state=e,this.lookAhead=t},ut=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function dt(e,t,r,n){var i=[e.state.modeGen],o={};wt(e,t.text,e.doc.mode,r,(function(e,t){return i.push(e,t)}),o,n);for(var a=r.state,l=function(n){r.baseTokens=i;var l=e.state.overlays[n],s=1,c=0;r.state=!0,wt(e,t.text,l.mode,r,(function(e,t){for(var r=s;c<e;){var n=i[s];n>e&&i.splice(s,1,e,i[s+1],n),s+=2,c=Math.min(e,n)}if(t)if(l.opaque)i.splice(r,s-r,e,"overlay "+t),s=r+2;else for(;r<s;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"overlay "+t}}),o),r.state=a,r.baseTokens=null,r.baseTokenPos=1},s=0;s<e.state.overlays.length;++s)l(s);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function ft(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=ht(e,Ye(t)),i=t.text.length>e.options.maxHighlightLength&&Ve(e.doc.mode,n.state),o=dt(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function ht(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new ut(n,!0,t);var o=function(e,t,r){for(var n,i,o=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=_e(o,l-1),c=s.stateAfter;if(c&&(!r||l+(c instanceof ct?c.lookAhead:0)<=o.modeFrontier))return l;var u=I(s.text,null,e.options.tabSize);(null==i||n>u)&&(i=l-1,n=u)}return i}(e,t,r),a=o>n.first&&_e(n,o-1).stateAfter,l=a?ut.fromSaved(n,a,o):new ut(n,Ge(n.mode),o);return n.iter(o,t,(function(r){pt(e,r.text,l);var n=l.line;r.stateAfter=n==t-1||n%5==0||n>=i.viewFrom&&n<i.viewTo?l.save():null,l.nextLine()})),r&&(n.modeFrontier=l.line),l}function pt(e,t,r,n){var i=e.doc.mode,o=new Ue(t,e.options.tabSize,r);for(o.start=o.pos=n||0,""==t&&gt(i,r.state);!o.eol();)mt(i,o,r.state),o.start=o.pos}function gt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=Ke(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function mt(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=Ke(e,r).mode);var o=e.token(t,r);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}ut.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ut.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ut.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ut.fromSaved=function(e,t,r){return t instanceof ct?new ut(e,Ve(e.mode,t.state),r,t.lookAhead):new ut(e,Ve(e.mode,t),r)},ut.prototype.save=function(e){var t=!1!==e?Ve(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ct(t,this.maxLookAhead):t};var vt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function yt(e,t,r,n){var i,o,a=e.doc,l=a.mode,s=_e(a,(t=lt(a,t)).line),c=ht(e,t.line,r),u=new Ue(s.text,e.options.tabSize,c);for(n&&(o=[]);(n||u.pos<t.ch)&&!u.eol();)u.start=u.pos,i=mt(l,u,c.state),n&&o.push(new vt(u,i,Ve(a.mode,c.state)));return n?o:new vt(u,i,c.state)}function bt(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[n])||(t[n]+=" "+r[2])}return e}function wt(e,t,r,n,i,o,a){var l=r.flattenSpans;null==l&&(l=e.options.flattenSpans);var s,c=0,u=null,d=new Ue(t,e.options.tabSize,n),f=e.options.addModeClass&&[null];for(""==t&&bt(gt(r,n.state),o);!d.eol();){if(d.pos>e.options.maxHighlightLength?(l=!1,a&&pt(e,t,n,d.pos),d.pos=t.length,s=null):s=bt(mt(r,d,n.state,f),o),f){var h=f[0].name;h&&(s="m-"+(s?h+" "+s:h))}if(!l||u!=s){for(;c<d.start;)i(c=Math.min(d.start,c+5e3),u);u=s}d.start=d.pos}for(;c<d.pos;){var p=Math.min(d.pos,c+5e3);i(p,u),c=p}}var xt=!1,kt=!1;function Ct(e,t,r){this.marker=e,this.from=t,this.to=r}function St(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Lt(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Tt(e,t){if(t.full)return null;var r=Qe(e,t.from.line)&&_e(e,t.from.line).markedSpans,n=Qe(e,t.to.line)&&_e(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,a=0==tt(t.from,t.to),l=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;if(null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new Ct(a,o.from,l?null:o.to))}}return n}(r,i,a),s=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;if(null==o.to||(a.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new Ct(a,l?null:o.from-t,null==o.to?null:o.to-t))}}return n}(n,o,a),c=1==t.text.length,u=$(t.text).length+(c?i:0);if(l)for(var d=0;d<l.length;++d){var f=l[d];if(null==f.to){var h=St(s,f.marker);h?c&&(f.to=null==h.to?null:h.to+u):f.to=i}}if(s)for(var p=0;p<s.length;++p){var g=s[p];null!=g.to&&(g.to+=u),null==g.from?St(l,g.marker)||(g.from=u,c&&(l||(l=[])).push(g)):(g.from+=u,c&&(l||(l=[])).push(g))}l&&(l=Mt(l)),s&&s!=l&&(s=Mt(s));var m=[l];if(!c){var v,y=t.text.length-2;if(y>0&&l)for(var b=0;b<l.length;++b)null==l[b].to&&(v||(v=[])).push(new Ct(l[b].marker,null,null));for(var w=0;w<y;++w)m.push(v);m.push(s)}return m}function Mt(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Nt(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function At(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function Ot(e){return e.inclusiveLeft?-1:0}function Dt(e){return e.inclusiveRight?1:0}function zt(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=tt(n.from,i.from)||Ot(e)-Ot(t);if(o)return-o;var a=tt(n.to,i.to)||Dt(e)-Dt(t);return a||t.id-e.id}function Wt(e,t){var r,n=kt&&e.markedSpans;if(n)for(var i=void 0,o=0;o<n.length;++o)(i=n[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!r||zt(r,i.marker)<0)&&(r=i.marker);return r}function Pt(e){return Wt(e,!0)}function Ft(e){return Wt(e,!1)}function Ht(e,t){var r,n=kt&&e.markedSpans;if(n)for(var i=0;i<n.length;++i){var o=n[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!r||zt(r,o.marker)<0)&&(r=o.marker)}return r}function Et(e,t,r,n,i){var o=_e(e,t),a=kt&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var c=s.marker.find(0),u=tt(c.from,r)||Ot(s.marker)-Ot(i),d=tt(c.to,n)||Dt(s.marker)-Dt(i);if(!(u>=0&&d<=0||u<=0&&d>=0)&&(u<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?tt(c.to,r)>=0:tt(c.to,r)>0)||u>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?tt(c.from,n)<=0:tt(c.from,n)<0)))return!0}}}function It(e){for(var t;t=Pt(e);)e=t.find(-1,!0).line;return e}function Bt(e,t){var r=_e(e,t),n=It(r);return r==n?t:Ye(n)}function Rt(e,t){if(t>e.lastLine())return t;var r,n=_e(e,t);if(!jt(e,n))return t;for(;r=Ft(n);)n=r.find(1,!0).line;return Ye(n)+1}function jt(e,t){var r=kt&&t.markedSpans;if(r)for(var n=void 0,i=0;i<r.length;++i)if((n=r[i]).marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Vt(e,t,n))return!0}}function Vt(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Vt(e,n.line,St(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&Vt(e,t,i))return!0}function Kt(e){for(var t=0,r=(e=It(e)).parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;o=(r=o).parent)for(var a=0;a<o.children.length;++a){var l=o.children[a];if(l==r)break;t+=l.height}return t}function Gt(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=Pt(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=Ft(n);){var o=t.find(0,!0);r-=n.text.length-o.from.ch,r+=(n=o.to.line).text.length-o.to.ch}return r}function Ut(e){var t=e.display,r=e.doc;t.maxLine=_e(r,r.first),t.maxLineLength=Gt(t.maxLine),t.maxLineChanged=!0,r.iter((function(e){var r=Gt(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)}))}var _t=function(e,t,r){this.text=e,At(this,t),this.height=r?r(this):1};function qt(e){e.parent=null,Nt(e)}_t.prototype.lineNo=function(){return Ye(this)},ye(_t);var $t={},Xt={};function Yt(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Xt:$t;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Zt(e,t){var r=O("span",null,null,s?"padding-right: .1px":null),n={pre:O("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;n.pos=0,n.addToken=Jt,Ae(e.display.measure)&&(a=ce(o,e.doc.direction))&&(n.addToken=er(n.addToken,a)),n.map=[],rr(o,n,ft(e,o,t!=e.display.externalMeasured&&Ye(o))),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=P(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=P(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Ne(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(s){var l=n.content.lastChild;(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return pe(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=P(n.pre.className,n.textClass||"")),n}function Qt(e){var t=A("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Jt(e,t,r,n,i,o,s){if(t){var c,u=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}(t,e.trailingSpace):t,d=e.cm.state.specialChars,f=!1;if(d.test(t)){c=document.createDocumentFragment();for(var h=0;;){d.lastIndex=h;var p=d.exec(t),g=p?p.index-h:t.length-h;if(g){var m=document.createTextNode(u.slice(h,h+g));a&&l<9?c.appendChild(A("span",[m])):c.appendChild(m),e.map.push(e.pos,e.pos+g,m),e.col+=g,e.pos+=g}if(!p)break;h+=g+1;var v=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;(v=c.appendChild(A("span",q(b),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?((v=c.appendChild(A("span","\r"==p[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",p[0]),e.col+=1):((v=e.cm.options.specialCharPlaceholder(p[0])).setAttribute("cm-text",p[0]),a&&l<9?c.appendChild(A("span",[v])):c.appendChild(v),e.col+=1);e.map.push(e.pos,e.pos+1,v),e.pos++}}else e.col+=t.length,c=document.createTextNode(u),e.map.push(e.pos,e.pos+t.length,c),a&&l<9&&(f=!0),e.pos+=t.length;if(e.trailingSpace=32==u.charCodeAt(t.length-1),r||n||i||f||o||s){var w=r||"";n&&(w+=n),i&&(w+=i);var x=A("span",[c],w,o);if(s)for(var k in s)s.hasOwnProperty(k)&&"style"!=k&&"class"!=k&&x.setAttribute(k,s[k]);return e.content.appendChild(x)}e.content.appendChild(c)}}function er(e,t){return function(r,n,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border";for(var c=r.pos,u=c+n.length;;){for(var d=void 0,f=0;f<t.length&&!((d=t[f]).to>c&&d.from<=c);f++);if(d.to>=u)return e(r,n,i,o,a,l,s);e(r,n.slice(0,d.to-c),i,o,null,l,s),o=null,n=n.slice(d.to-c),c=d.to}}}function tr(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function rr(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a,l,s,c,u,d,f,h=i.length,p=0,g=1,m="",v=0;;){if(v==p){s=c=u=l="",f=null,d=null,v=1/0;for(var y=[],b=void 0,w=0;w<n.length;++w){var x=n[w],k=x.marker;if("bookmark"==k.type&&x.from==p&&k.widgetNode)y.push(k);else if(x.from<=p&&(null==x.to||x.to>p||k.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),k.className&&(s+=" "+k.className),k.css&&(l=(l?l+";":"")+k.css),k.startStyle&&x.from==p&&(u+=" "+k.startStyle),k.endStyle&&x.to==v&&(b||(b=[])).push(k.endStyle,x.to),k.title&&((f||(f={})).title=k.title),k.attributes)for(var C in k.attributes)(f||(f={}))[C]=k.attributes[C];k.collapsed&&(!d||zt(d.marker,k)<0)&&(d=x)}else x.from>p&&v>x.from&&(v=x.from)}if(b)for(var S=0;S<b.length;S+=2)b[S+1]==v&&(c+=" "+b[S]);if(!d||d.from==p)for(var L=0;L<y.length;++L)tr(t,0,y[L]);if(d&&(d.from||0)==p){if(tr(t,(null==d.to?h+1:d.to)-p,d.marker,null==d.from),null==d.to)return;d.to==p&&(d=!1)}}if(p>=h)break;for(var T=Math.min(h,v);;){if(m){var M=p+m.length;if(!d){var N=M>T?m.slice(0,T-p):m;t.addToken(t,N,a?a+s:s,u,p+N.length==v?c:"",l,f)}if(M>=T){m=m.slice(T-p),p=T;break}p=M,u=""}m=i.slice(o,o=r[g++]),a=Yt(r[g++],t.cm.options)}}else for(var A=1;A<r.length;A+=2)t.addToken(t,i.slice(o,o=r[A]),Yt(r[A+1],t.cm.options))}function nr(e,t,r){this.line=t,this.rest=function(e){for(var t,r;t=Ft(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}(t),this.size=this.rest?Ye($(this.rest))-r+1:1,this.node=this.text=null,this.hidden=jt(e,t)}function ir(e,t,r){for(var n,i=[],o=t;o<r;o=n){var a=new nr(e.doc,_e(e.doc,o),o);n=o+a.size,i.push(a)}return i}var or=null,ar=null;function lr(e,t){var r=fe(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);or?n=or.delayedCallbacks:ar?n=ar:(n=ar=[],setTimeout(sr,0));for(var o=function(e){n.push((function(){return r[e].apply(null,i)}))},a=0;a<r.length;++a)o(a)}}function sr(){var e=ar;ar=null;for(var t=0;t<e.length;++t)e[t]()}function cr(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?fr(e,t):"gutter"==o?pr(e,t,r,n):"class"==o?hr(e,t):"widget"==o&&gr(e,t,n)}t.changes=null}function ur(e){return e.node==e.text&&(e.node=A("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),a&&l<8&&(e.node.style.zIndex=2)),e.node}function dr(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Zt(e,t)}function fr(e,t){var r=t.text.className,n=dr(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,hr(e,t)):r&&(t.text.className=r)}function hr(e,t){!function(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=ur(t);t.background=n.insertBefore(A("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?ur(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function pr(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=ur(t);t.gutterBackground=A("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var a=ur(t),l=t.gutter=A("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(l),a.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=l.appendChild(A("div",Je(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<e.display.gutterSpecs.length;++s){var c=e.display.gutterSpecs[s].className,u=o.hasOwnProperty(c)&&o[c];u&&l.appendChild(A("div",[u],"CodeMirror-gutter-elt","left: "+n.gutterLeft[c]+"px; width: "+n.gutterWidth[c]+"px"))}}}function gr(e,t,r){t.alignable&&(t.alignable=null);for(var n=S("CodeMirror-linewidget"),i=t.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,n.test(i.className)&&t.node.removeChild(i);vr(e,t,r)}function mr(e,t,r,n){var i=dr(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),hr(e,t),pr(e,t,r,n),vr(e,t,n),t.node}function vr(e,t,r){if(yr(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)yr(e,t.rest[n],t,r,!1)}function yr(e,t,r,n,i){if(t.widgets)for(var o=ur(r),a=0,l=t.widgets;a<l.length;++a){var s=l[a],c=A("div",[s.node],"CodeMirror-linewidget"+(s.className?" "+s.className:""));s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),br(s,c,r,n),e.display.input.setUneditable(c),i&&s.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),lr(s,"redraw")}}function br(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function wr(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!D(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),N(t.display.measure,A("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function xr(e,t){for(var r=Ce(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function kr(e){return e.lineSpace.offsetTop}function Cr(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Sr(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=N(e.measure,A("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function Lr(e){return 50-e.display.nativeBarWidth}function Tr(e){return e.display.scroller.clientWidth-Lr(e)-e.display.barWidth}function Mr(e){return e.display.scroller.clientHeight-Lr(e)-e.display.barHeight}function Nr(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var i=0;i<e.rest.length;i++)if(Ye(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Ar(e,t,r,n){return zr(e,Dr(e,t),r,n)}function Or(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[un(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Dr(e,t){var r=Ye(t),n=Or(e,r);n&&!n.text?n=null:n&&n.changes&&(cr(e,n,r,on(e)),e.curOp.forceUpdate=!0),n||(n=function(e,t){var r=Ye(t=It(t)),n=e.display.externalMeasured=new nr(e.doc,t,r);n.lineN=r;var i=n.built=Zt(e,n);return n.text=i.pre,N(e.display.lineMeasure,i.pre),n}(e,t));var i=Nr(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function zr(e,t,r,n,i){t.before&&(r=-1);var o,s=r+(n||"");return t.cache.hasOwnProperty(s)?o=t.cache[s]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(function(e,t,r){var n=e.options.lineWrapping,i=n&&Tr(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],c=a[l+1];Math.abs(s.bottom-c.bottom)>2&&o.push((s.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,r,n){var i,o=Fr(t.map,r,n),s=o.node,c=o.start,u=o.end,d=o.collapse;if(3==s.nodeType){for(var f=0;f<4;f++){for(;c&&ne(t.line.text.charAt(o.coverStart+c));)--c;for(;o.coverStart+u<o.coverEnd&&ne(t.line.text.charAt(o.coverStart+u));)++u;if((i=a&&l<9&&0==c&&u==o.coverEnd-o.coverStart?s.parentNode.getBoundingClientRect():Hr(L(s,c,u).getClientRects(),n)).left||i.right||0==c)break;u=c,c-=1,d="right"}a&&l<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=Pe)return Pe;var t=N(e,A("span","x")),r=t.getBoundingClientRect(),n=L(t,0,1).getBoundingClientRect();return Pe=Math.abs(r.left-n.left)>1}(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}(e.display.measure,i))}else{var h;c>0&&(d=n="right"),i=e.options.lineWrapping&&(h=s.getClientRects()).length>1?h["right"==n?h.length-1:0]:s.getBoundingClientRect()}if(a&&l<9&&!c&&(!i||!i.left&&!i.right)){var p=s.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+nn(e.display),top:p.top,bottom:p.bottom}:Pr}for(var g=i.top-t.rect.top,m=i.bottom-t.rect.top,v=(g+m)/2,y=t.view.measure.heights,b=0;b<y.length-1&&!(v<y[b]);b++);var w=b?y[b-1]:0,x=y[b],k={left:("right"==d?i.right:i.left)-t.rect.left,right:("left"==d?i.left:i.right)-t.rect.left,top:w,bottom:x};return i.left||i.right||(k.bogus=!0),e.options.singleCursorHeightPerLine||(k.rtop=g,k.rbottom=m),k}(e,t,r,n)).bogus||(t.cache[s]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Wr,Pr={left:0,right:0,top:0,bottom:0};function Fr(e,t,r){for(var n,i,o,a,l,s,c=0;c<e.length;c+=3)if(l=e[c],s=e[c+1],t<l?(i=0,o=1,a="left"):t<s?o=1+(i=t-l):(c==e.length-3||t==s&&e[c+3]>t)&&(i=(o=s-l)-1,t>=s&&(a="right")),null!=i){if(n=e[c+2],l==s&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)n=e[2+(c-=3)],a="left";if("right"==r&&i==s-l)for(;c<e.length-3&&e[c+3]==e[c+4]&&!e[c+5].insertLeft;)n=e[(c+=3)+2],a="right";break}return{node:n,start:i,end:o,collapse:a,coverStart:l,coverEnd:s}}function Hr(e,t){var r=Pr;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var i=e.length-1;i>=0&&(r=e[i]).left==r.right;i--);return r}function Er(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Ir(e){e.display.externalMeasure=null,M(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Er(e.display.view[t])}function Br(e){Ir(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Rr(){return u&&m?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function jr(){return u&&m?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Vr(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=wr(e.widgets[r]));return t}function Kr(e,t,r,n,i){if(!i){var o=Vr(t);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var a=Kt(t);if("local"==n?a+=kr(e.display):a-=e.display.viewOffset,"page"==n||"window"==n){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==n?0:jr());var s=l.left+("window"==n?0:Rr());r.left+=s,r.right+=s}return r.top+=a,r.bottom+=a,r}function Gr(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=Rr(),i-=jr();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:n-a.left,top:i-a.top}}function Ur(e,t,r,n,i){return n||(n=_e(e.doc,t.line)),Kr(e,n,Ar(e,n,t.ch,i),r)}function _r(e,t,r,n,i,o){function a(t,a){var l=zr(e,i,t,a?"right":"left",o);return a?l.left=l.right:l.right=l.left,Kr(e,n,l,r)}n=n||_e(e.doc,t.line),i||(i=Dr(e,n));var l=ce(n,e.doc.direction),s=t.ch,c=t.sticky;if(s>=n.text.length?(s=n.text.length,c="before"):s<=0&&(s=0,c="after"),!l)return a("before"==c?s-1:s,"before"==c);function u(e,t,r){return a(r?e-1:e,1==l[t].level!=r)}var d=le(l,s,c),f=ae,h=u(s,d,"before"==c);return null!=f&&(h.other=u(s,f,"before"!=c)),h}function qr(e,t){var r=0;t=lt(e.doc,t),e.options.lineWrapping||(r=nn(e.display)*t.ch);var n=_e(e.doc,t.line),i=Kt(n)+kr(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function $r(e,t,r,n,i){var o=et(e,t,r);return o.xRel=i,n&&(o.outside=n),o}function Xr(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return $r(n.first,0,null,-1,-1);var i=Ze(n,r),o=n.first+n.size-1;if(i>o)return $r(n.first+n.size-1,_e(n,o).text.length,null,1,1);t<0&&(t=0);for(var a=_e(n,i);;){var l=Jr(e,a,i,t,r),s=Ht(a,l.ch+(l.xRel>0||l.outside>0?1:0));if(!s)return l;var c=s.find(1);if(c.line==i)return c;a=_e(n,i=c.line)}}function Yr(e,t,r,n){n-=Vr(t);var i=t.text.length,o=oe((function(t){return zr(e,r,t-1).bottom<=n}),i,0);return{begin:o,end:i=oe((function(t){return zr(e,r,t).top>n}),o,i)}}function Zr(e,t,r,n){return r||(r=Dr(e,t)),Yr(e,t,r,Kr(e,t,zr(e,r,n),"line").top)}function Qr(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function Jr(e,t,r,n,i){i-=Kt(t);var o=Dr(e,t),a=Vr(t),l=0,s=t.text.length,c=!0,u=ce(t,e.doc.direction);if(u){var d=(e.options.lineWrapping?tn:en)(e,t,r,o,u,n,i);l=(c=1!=d.level)?d.from:d.to-1,s=c?d.to:d.from-1}var f,h,p=null,g=null,m=oe((function(t){var r=zr(e,o,t);return r.top+=a,r.bottom+=a,!!Qr(r,n,i,!1)&&(r.top<=i&&r.left<=n&&(p=t,g=r),!0)}),l,s),v=!1;if(g){var y=n-g.left<g.right-n,b=y==c;m=p+(b?0:1),h=b?"after":"before",f=y?g.left:g.right}else{c||m!=s&&m!=l||m++,h=0==m?"after":m==t.text.length?"before":zr(e,o,m-(c?1:0)).bottom+a<=i==c?"after":"before";var w=_r(e,et(r,m,h),"line",t,o);f=w.left,v=i<w.top?-1:i>=w.bottom?1:0}return $r(r,m=ie(t.text,m,1),h,v,n-f)}function en(e,t,r,n,i,o,a){var l=oe((function(l){var s=i[l],c=1!=s.level;return Qr(_r(e,et(r,c?s.to:s.from,c?"before":"after"),"line",t,n),o,a,!0)}),0,i.length-1),s=i[l];if(l>0){var c=1!=s.level,u=_r(e,et(r,c?s.from:s.to,c?"after":"before"),"line",t,n);Qr(u,o,a,!0)&&u.top>a&&(s=i[l-1])}return s}function tn(e,t,r,n,i,o,a){var l=Yr(e,t,n,a),s=l.begin,c=l.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var u=null,d=null,f=0;f<i.length;f++){var h=i[f];if(!(h.from>=c||h.to<=s)){var p=zr(e,n,1!=h.level?Math.min(c,h.to)-1:Math.max(s,h.from)).right,g=p<o?o-p+1e9:p-o;(!u||d>g)&&(u=h,d=g)}}return u||(u=i[i.length-1]),u.from<s&&(u={from:s,to:u.to,level:u.level}),u.to>c&&(u={from:u.from,to:c,level:u.level}),u}function rn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Wr){Wr=A("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Wr.appendChild(document.createTextNode("x")),Wr.appendChild(A("br"));Wr.appendChild(document.createTextNode("x"))}N(e.measure,Wr);var r=Wr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),M(e.measure),r||1}function nn(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=A("span","xxxxxxxxxx"),r=A("pre",[t],"CodeMirror-line-like");N(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function on(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className;r[l]=o.offsetLeft+o.clientLeft+i,n[l]=o.clientWidth}return{fixedPos:an(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function an(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ln(e){var t=rn(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/nn(e.display)-3);return function(i){if(jt(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function sn(e){var t=e.doc,r=ln(e);t.iter((function(e){var t=r(e);t!=e.height&&Xe(e,t)}))}function cn(e,t,r,n){var i=e.display;if(!r&&"true"==Ce(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(e){return null}var s,c=Xr(e,o,a);if(n&&c.xRel>0&&(s=_e(e.doc,c.line).text).length==c.ch){var u=I(s,s.length,e.options.tabSize)-s.length;c=et(c.line,Math.max(0,Math.round((o-Sr(e.display).left)/nn(e.display))-u))}return c}function un(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if((t-=r[n].size)<0)return n}function dn(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)kt&&Bt(e.doc,t)<i.viewTo&&hn(e);else if(r<=i.viewFrom)kt&&Rt(e.doc,r+n)>i.viewFrom?hn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)hn(e);else if(t<=i.viewFrom){var o=pn(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):hn(e)}else if(r>=i.viewTo){var a=pn(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):hn(e)}else{var l=pn(e,t,t,-1),s=pn(e,r,r+n,1);l&&s?(i.view=i.view.slice(0,l.index).concat(ir(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=n):hn(e)}var c=i.externalMeasured;c&&(r<c.lineN?c.lineN+=n:t<c.lineN+c.size&&(i.externalMeasured=null))}function fn(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[un(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==R(a,r)&&a.push(r)}}}function hn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function pn(e,t,r,n){var i,o=un(e,t),a=e.display.view;if(!kt||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var l=e.display.viewFrom,s=0;s<o;s++)l+=a[s].size;if(l!=t){if(n>0){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,r+=i}for(;Bt(e.doc,r)!=r;){if(o==(n<0?0:a.length-1))return null;r+=n*a[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function gn(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function mn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function vn(e,t){void 0===t&&(t=!0);for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),a=0;a<r.sel.ranges.length;a++)if(t||a!=r.sel.primIndex){var l=r.sel.ranges[a];if(!(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)){var s=l.empty();(s||e.options.showCursorWhenSelecting)&&yn(e,l.head,i),s||wn(e,l,o)}}return n}function yn(e,t,r){var n=_r(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(A("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(A("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function bn(e,t){return e.top-t.top||e.left-t.left}function wn(e,t,r){var n=e.display,i=e.doc,o=document.createDocumentFragment(),a=Sr(e.display),l=a.left,s=Math.max(n.sizerWidth,Tr(e)-n.sizer.offsetLeft)-a.right,c="ltr"==i.direction;function u(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),o.appendChild(A("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?s-e:r)+"px;\n height: "+(n-t)+"px"))}function d(t,r,n){var o,a,d=_e(i,t),f=d.text.length;function h(r,n){return Ur(e,et(t,r),"div",d,n)}function p(t,r,n){var i=Zr(e,d,null,t),o="ltr"==r==("after"==n)?"left":"right";return h("after"==n?i.begin:i.end-(/\s/.test(d.text.charAt(i.end-1))?2:1),o)[o]}var g=ce(d,i.direction);return function(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<r&&a.to>t||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr",o),i=!0)}i||n(t,r,"ltr")}(g,r||0,null==n?f:n,(function(e,t,i,d){var m="ltr"==i,v=h(e,m?"left":"right"),y=h(t-1,m?"right":"left"),b=null==r&&0==e,w=null==n&&t==f,x=0==d,k=!g||d==g.length-1;if(y.top-v.top<=3){var C=(c?w:b)&&k,S=(c?b:w)&&x?l:(m?v:y).left,L=C?s:(m?y:v).right;u(S,v.top,L-S,v.bottom)}else{var T,M,N,A;m?(T=c&&b&&x?l:v.left,M=c?s:p(e,i,"before"),N=c?l:p(t,i,"after"),A=c&&w&&k?s:y.right):(T=c?p(e,i,"before"):l,M=!c&&b&&x?s:v.right,N=!c&&w&&k?l:y.left,A=c?p(t,i,"after"):s),u(T,v.top,M-T,v.bottom),v.bottom<y.top&&u(l,v.bottom,null,y.top),u(N,y.top,A-N,y.bottom)}(!o||bn(v,o)<0)&&(o=v),bn(y,o)<0&&(o=y),(!a||bn(v,a)<0)&&(a=v),bn(y,a)<0&&(a=y)})),{start:o,end:a}}var f=t.from(),h=t.to();if(f.line==h.line)d(f.line,f.ch,h.ch);else{var p=_e(i,f.line),g=_e(i,h.line),m=It(p)==It(g),v=d(f.line,f.ch,m?p.text.length+1:null).end,y=d(h.line,m?0:null,h.ch).start;m&&(v.top<y.top-2?(u(v.right,v.top,null,v.bottom),u(l,y.top,y.left,y.bottom)):u(v.right,v.top,y.left-v.right,v.bottom)),v.bottom<y.top&&u(l,v.bottom,null,y.top)}r.appendChild(o)}function xn(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval((function(){e.hasFocus()||Ln(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function kn(e){e.state.focused||(e.display.input.focus(),Sn(e))}function Cn(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ln(e))}),100)}function Sn(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(pe(e,"focus",e,t),e.state.focused=!0,W(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),s&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),xn(e))}function Ln(e,t){e.state.delayingBlurEvent||(e.state.focused&&(pe(e,"blur",e,t),e.state.focused=!1,T(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function Tn(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],o=e.options.lineWrapping,s=void 0,c=0;if(!i.hidden){if(a&&l<8){var u=i.node.offsetTop+i.node.offsetHeight;s=u-r,r=u}else{var d=i.node.getBoundingClientRect();s=d.bottom-d.top,!o&&i.text.firstChild&&(c=i.text.firstChild.getBoundingClientRect().right-d.left-1)}var f=i.line.height-s;if((f>.005||f<-.005)&&(Xe(i.line,s),Mn(i.line),i.rest))for(var h=0;h<i.rest.length;h++)Mn(i.rest[h]);if(c>e.display.sizerWidth){var p=Math.ceil(c/nn(e.display));p>e.display.maxLineLength&&(e.display.maxLineLength=p,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function Mn(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function Nn(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-kr(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=Ze(t,n),a=Ze(t,i);if(r&&r.ensure){var l=r.ensure.from.line,s=r.ensure.to.line;l<o?(o=l,a=Ze(t,Kt(_e(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=Ze(t,Kt(_e(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function An(e,t){var r=e.display,n=rn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,o=Mr(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Cr(r),s=t.top<n,c=t.bottom>l-n;if(t.top<i)a.scrollTop=s?0:t.top;else if(t.bottom>i+o){var u=Math.min(t.top,(c?l:t.bottom)-o);u!=i&&(a.scrollTop=u)}var d=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,f=Tr(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),h=t.right-t.left>f;return h&&(t.right=t.left+f),t.left<10?a.scrollLeft=0:t.left<d?a.scrollLeft=Math.max(0,t.left-(h?0:10)):t.right>f+d-3&&(a.scrollLeft=t.right+(h?0:10)-f),a}function On(e,t){null!=t&&(Wn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Dn(e){Wn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function zn(e,t,r){null==t&&null==r||Wn(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function Wn(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Pn(e,qr(e,t.from),qr(e,t.to),t.margin))}function Pn(e,t,r,n){var i=An(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});zn(e,i.scrollLeft,i.scrollTop)}function Fn(e,t){Math.abs(e.doc.scrollTop-t)<2||(r||si(e,{top:t}),Hn(e,t,!0),r&&si(e),ni(e,100))}function Hn(e,t,r){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function En(e,t,r,n){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,di(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function In(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Cr(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Lr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Bn=function(e,t,r){this.cm=r;var n=this.vert=A("div",[A("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=A("div",[A("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),de(n,"scroll",(function(){n.clientHeight&&t(n.scrollTop,"vertical")})),de(i,"scroll",(function(){i.clientWidth&&t(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,a&&l<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Bn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},Bn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Bn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Bn.prototype.zeroWidthHack=function(){var e=y&&!h?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new B,this.disableVert=new B},Bn.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto",t.set(1e3,(function n(){var i=e.getBoundingClientRect();("vert"==r?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,n)}))},Bn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Rn=function(){};function jn(e,t){t||(t=In(e));var r=e.display.barWidth,n=e.display.barHeight;Vn(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&Tn(e),Vn(e,In(e)),r=e.display.barWidth,n=e.display.barHeight}function Vn(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}Rn.prototype.update=function(){return{bottom:0,right:0}},Rn.prototype.setScrollLeft=function(){},Rn.prototype.setScrollTop=function(){},Rn.prototype.clear=function(){};var Kn={native:Bn,null:Rn};function Gn(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&T(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Kn[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),de(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,r){"horizontal"==r?En(e,t):Fn(e,t)}),e),e.display.scrollbars.addClass&&W(e.display.wrapper,e.display.scrollbars.addClass)}var Un=0;function _n(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Un},t=e.curOp,or?or.ops.push(t):t.ownsGroup=or={ops:[t],delayedCallbacks:[]}}function qn(e){var t=e.curOp;t&&function(e,t){var r=e.ownsGroup;if(r)try{!function(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}(r)}finally{or=null,t(r)}}(t,(function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;!function(e){for(var t=e.ops,r=0;r<t.length;r++)$n(t[r]);for(var n=0;n<t.length;n++)Xn(t[n]);for(var i=0;i<t.length;i++)Yn(t[i]);for(var o=0;o<t.length;o++)Zn(t[o]);for(var a=0;a<t.length;a++)Qn(t[a])}(e)}))}function $n(e){var t=e.cm,r=t.display;!function(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Lr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Lr(e)+"px",t.scrollbarsClipped=!0)}(t),e.updateMaxLine&&Ut(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new oi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Xn(e){e.updatedDisplay=e.mustUpdate&&ai(e.cm,e.update)}function Yn(e){var t=e.cm,r=t.display;e.updatedDisplay&&Tn(t),e.barMeasure=In(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ar(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Lr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Tr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Zn(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&En(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==z();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&jn(t,e.barMeasure),e.updatedDisplay&&ui(t,e.barMeasure),e.selectionChanged&&xn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&kn(e.cm)}function Qn(e){var t=e.cm,r=t.display,n=t.doc;e.updatedDisplay&&li(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=e.scrollTop&&Hn(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&En(t,e.scrollLeft,!0,!0),e.scrollToPos&&function(e,t){if(!ge(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=A("div","​",null,"position: absolute;\n top: "+(t.top-r.viewOffset-kr(e.display))+"px;\n height: "+(t.bottom-t.top+Lr(e)+r.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,r,n){var i;null==n&&(n=0),e.options.lineWrapping||t!=r||(r="before"==(t=t.ch?et(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?et(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var a=!1,l=_r(e,t),s=r&&r!=t?_r(e,r):l,c=An(e,i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-n,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+n}),u=e.doc.scrollTop,d=e.doc.scrollLeft;if(null!=c.scrollTop&&(Fn(e,c.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(a=!0)),null!=c.scrollLeft&&(En(e,c.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return i}(t,lt(n,e.scrollToPos.from),lt(n,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var a=0;a<i.length;++a)i[a].lines.length||pe(i[a],"hide");if(o)for(var l=0;l<o.length;++l)o[l].lines.length&&pe(o[l],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&pe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Jn(e,t){if(e.curOp)return t();_n(e);try{return t()}finally{qn(e)}}function ei(e,t){return function(){if(e.curOp)return t.apply(e,arguments);_n(e);try{return t.apply(e,arguments)}finally{qn(e)}}}function ti(e){return function(){if(this.curOp)return e.apply(this,arguments);_n(this);try{return e.apply(this,arguments)}finally{qn(this)}}}function ri(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);_n(t);try{return e.apply(this,arguments)}finally{qn(t)}}}function ni(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,H(ii,e))}function ii(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=ht(e,t.highlightFrontier),i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(o){if(n.line>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength?Ve(t.mode,n.state):null,s=dt(e,o,n,!0);l&&(n.state=l),o.styles=s.styles;var c=o.styleClasses,u=s.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),f=0;!d&&f<a.length;++f)d=a[f]!=o.styles[f];d&&i.push(n.line),o.stateAfter=n.save(),n.nextLine()}else o.text.length<=e.options.maxHighlightLength&&pt(e,o.text,n),o.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)return ni(e,e.options.workDelay),!0})),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&Jn(e,(function(){for(var t=0;t<i.length;t++)fn(e,i[t],"text")}))}}var oi=function(e,t,r){var n=e.display;this.viewport=t,this.visible=Nn(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Tr(e),this.force=r,this.dims=on(e),this.events=[]};function ai(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return hn(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==gn(e))return!1;fi(e)&&(hn(e),t.dims=on(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>a&&r.viewTo-a<20&&(a=Math.min(i,r.viewTo)),kt&&(o=Bt(e.doc,o),a=Rt(e.doc,a));var l=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;!function(e,t,r){var n=e.display;0==n.view.length||t>=n.viewTo||r<=n.viewFrom?(n.view=ir(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=ir(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(un(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(ir(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,un(e,r)))),n.viewTo=r}(e,o,a),r.viewOffset=Kt(_e(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var c=gn(e);if(!l&&0==c&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var u=function(e){if(e.hasFocus())return null;var t=z();if(!t||!D(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&D(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}(e);return c>4&&(r.lineDiv.style.display="none"),function(e,t,r){var n=e.display,i=e.options.lineNumbers,o=n.lineDiv,a=o.firstChild;function l(t){var r=t.nextSibling;return s&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var c=n.view,u=n.viewFrom,d=0;d<c.length;d++){var f=c[d];if(f.hidden);else if(f.node&&f.node.parentNode==o){for(;a!=f.node;)a=l(a);var h=i&&null!=t&&t<=u&&f.lineNumber;f.changes&&(R(f.changes,"gutter")>-1&&(h=!1),cr(e,f,u,r)),h&&(M(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(Je(e.options,u)))),a=f.node.nextSibling}else{var p=mr(e,f,u,r);o.insertBefore(p,a)}u+=f.size}for(;a;)a=l(a)}(e,r.updateLineNumbers,t.dims),c>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(e){if(e&&e.activeElt&&e.activeElt!=z()&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&D(document.body,e.anchorNode)&&D(document.body,e.focusNode))){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}(u),M(r.cursorDiv),M(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,l&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,ni(e,400)),r.updateLineNumbers=null,!0}function li(e,t){for(var r=t.viewport,n=!0;;n=!1){if(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Tr(e))n&&(t.visible=Nn(e.display,e.doc,r));else if(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Cr(e.display)-Mr(e),r.top)}),t.visible=Nn(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!ai(e,t))break;Tn(e);var i=In(e);mn(e),jn(e,i),ui(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function si(e,t){var r=new oi(e,t);if(ai(e,r)){Tn(e),li(e,r);var n=In(e);mn(e),jn(e,n),ui(e,n),r.finish()}}function ci(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ui(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Lr(e)+"px"}function di(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=an(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a<r.length;a++)if(!r[a].hidden){e.options.fixedGutter&&(r[a].gutter&&(r[a].gutter.style.left=o),r[a].gutterBackground&&(r[a].gutterBackground.style.left=o));var l=r[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function fi(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=Je(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(A("div",[A("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-a)+1,n.lineNumWidth=n.lineNumInnerWidth+a,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",ci(e.display),!0}return!1}function hi(e,t){for(var r=[],n=!1,i=0;i<e.length;i++){var o=e[i],a=null;if("string"!=typeof o&&(a=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue;n=!0}r.push({className:o,style:a})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function pi(e){var t=e.gutters,r=e.gutterSpecs;M(t),e.lineGutter=null;for(var n=0;n<r.length;++n){var i=r[n],o=i.className,a=i.style,l=t.appendChild(A("div",null,"CodeMirror-gutter "+o));a&&(l.style.cssText=a),"CodeMirror-linenumbers"==o&&(e.lineGutter=l,l.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",ci(e)}function gi(e){pi(e.display),dn(e),di(e)}function mi(e,t,n,i){var o=this;this.input=n,o.scrollbarFiller=A("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=A("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=O("div",null,"CodeMirror-code"),o.selectionDiv=A("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=A("div",null,"CodeMirror-cursors"),o.measure=A("div",null,"CodeMirror-measure"),o.lineMeasure=A("div",null,"CodeMirror-measure"),o.lineSpace=O("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var c=O("div",[o.lineSpace],"CodeMirror-lines");o.mover=A("div",[c],null,"position: relative"),o.sizer=A("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=A("div",null,null,"position: absolute; height: 50px; width: 1px;"),o.gutters=A("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=A("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=A("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),a&&l<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),s||r&&v||(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=hi(i.gutters,i.lineNumbers),pi(o),n.init(o)}oi.prototype.signal=function(e,t){ve(e,t)&&this.events.push(arguments)},oi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)pe.apply(null,this.events[e])};var vi=0,yi=null;function bi(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}}function wi(e){var t=bi(e);return t.x*=yi,t.y*=yi,t}function xi(e,t){var n=bi(t),i=n.x,o=n.y,a=e.display,l=a.scroller,c=l.scrollWidth>l.clientWidth,u=l.scrollHeight>l.clientHeight;if(i&&c||o&&u){if(o&&y&&s)e:for(var f=t.target,h=a.view;f!=l;f=f.parentNode)for(var p=0;p<h.length;p++)if(h[p].node==f){e.display.currentWheelTarget=f;break e}if(i&&!r&&!d&&null!=yi)return o&&u&&Fn(e,Math.max(0,l.scrollTop+o*yi)),En(e,Math.max(0,l.scrollLeft+i*yi)),(!o||o&&u)&&be(t),void(a.wheelStartX=null);if(o&&null!=yi){var g=o*yi,m=e.doc.scrollTop,v=m+a.wrapper.clientHeight;g<0?m=Math.max(0,m+g-50):v=Math.min(e.doc.height,v+g+50),si(e,{top:m,bottom:v})}vi<20&&(null==a.wheelStartX?(a.wheelStartX=l.scrollLeft,a.wheelStartY=l.scrollTop,a.wheelDX=i,a.wheelDY=o,setTimeout((function(){if(null!=a.wheelStartX){var e=l.scrollLeft-a.wheelStartX,t=l.scrollTop-a.wheelStartY,r=t&&a.wheelDY&&t/a.wheelDY||e&&a.wheelDX&&e/a.wheelDX;a.wheelStartX=a.wheelStartY=null,r&&(yi=(yi*vi+r)/(vi+1),++vi)}}),200)):(a.wheelDX+=i,a.wheelDY+=o))}}a?yi=-.53:r?yi=15:u?yi=-.7:f&&(yi=-1/3);var ki=function(e,t){this.ranges=e,this.primIndex=t};ki.prototype.primary=function(){return this.ranges[this.primIndex]},ki.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(!rt(r.anchor,n.anchor)||!rt(r.head,n.head))return!1}return!0},ki.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Ci(nt(this.ranges[t].anchor),nt(this.ranges[t].head));return new ki(e,this.primIndex)},ki.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},ki.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(tt(t,n.from())>=0&&tt(e,n.to())<=0)return r}return-1};var Ci=function(e,t){this.anchor=e,this.head=t};function Si(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r];t.sort((function(e,t){return tt(e.from(),t.from())})),r=R(t,i);for(var o=1;o<t.length;o++){var a=t[o],l=t[o-1],s=tt(l.to(),a.from());if(n&&!a.empty()?s>0:s>=0){var c=ot(l.from(),a.from()),u=it(l.to(),a.to()),d=l.empty()?a.from()==a.head:l.from()==l.head;o<=r&&--r,t.splice(--o,2,new Ci(d?u:c,d?c:u))}}return new ki(t,r)}function Li(e,t){return new ki([new Ci(e,t||e)],0)}function Ti(e){return e.text?et(e.from.line+e.text.length-1,$(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Mi(e,t){if(tt(e,t.from)<0)return e;if(tt(e,t.to)<=0)return Ti(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Ti(t).ch-t.to.ch),et(r,n)}function Ni(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new Ci(Mi(i.anchor,t),Mi(i.head,t)))}return Si(e.cm,r,e.sel.primIndex)}function Ai(e,t,r){return e.line==t.line?et(r.line,e.ch-t.ch+r.ch):et(r.line+(e.line-t.line),e.ch)}function Oi(e){e.doc.mode=Be(e.options,e.doc.modeOption),Di(e)}function Di(e){e.doc.iter((function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)})),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,ni(e,100),e.state.modeGen++,e.curOp&&dn(e)}function zi(e,t){return 0==t.from.ch&&0==t.to.ch&&""==$(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Wi(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){!function(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Nt(e),At(e,r);var i=n?n(e):1;i!=e.height&&Xe(e,i)}(e,r,i,n),lr(e,"change",e,t)}function a(e,t){for(var r=[],o=e;o<t;++o)r.push(new _t(c[o],i(o),n));return r}var l=t.from,s=t.to,c=t.text,u=_e(e,l.line),d=_e(e,s.line),f=$(c),h=i(c.length-1),p=s.line-l.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(zi(e,t)){var g=a(0,c.length-1);o(d,d.text,h),p&&e.remove(l.line,p),g.length&&e.insert(l.line,g)}else if(u==d)if(1==c.length)o(u,u.text.slice(0,l.ch)+f+u.text.slice(s.ch),h);else{var m=a(1,c.length-1);m.push(new _t(f+u.text.slice(s.ch),h,n)),o(u,u.text.slice(0,l.ch)+c[0],i(0)),e.insert(l.line+1,m)}else if(1==c.length)o(u,u.text.slice(0,l.ch)+c[0]+d.text.slice(s.ch),i(0)),e.remove(l.line+1,p);else{o(u,u.text.slice(0,l.ch)+c[0],i(0)),o(d,f+d.text.slice(s.ch),h);var v=a(1,c.length-1);p>1&&e.remove(l.line+1,p-1),e.insert(l.line+1,v)}lr(e,"change",e,t)}function Pi(e,t,r){!function e(n,i,o){if(n.linked)for(var a=0;a<n.linked.length;++a){var l=n.linked[a];if(l.doc!=i){var s=o&&l.sharedHist;r&&!s||(t(l.doc,s),e(l.doc,n,s))}}}(e,null,!0)}function Fi(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,sn(e),Oi(e),Hi(e),e.options.lineWrapping||Ut(e),e.options.mode=t.modeOption,dn(e)}function Hi(e){("rtl"==e.doc.direction?W:T)(e.display.lineDiv,"CodeMirror-rtl")}function Ei(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ii(e,t){var r={from:nt(t.from),to:Ti(t),text:qe(e,t.from,t.to)};return Ki(e,r,t.from.line,t.to.line+1),Pi(e,(function(e){return Ki(e,r,t.from.line,t.to.line+1)}),!0),r}function Bi(e){for(;e.length&&$(e).ranges;)e.pop()}function Ri(e,t,r,n){var i=e.history;i.undone.length=0;var o,a,l=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(Bi(e.done),$(e.done)):e.done.length&&!$(e.done).ranges?$(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),$(e.done)):void 0}(i,i.lastOp==n)))a=$(o.changes),0==tt(t.from,t.to)&&0==tt(t.from,a.to)?a.to=Ti(t):o.changes.push(Ii(e,t));else{var s=$(i.done);for(s&&s.ranges||Vi(e.sel,i.done),o={changes:[Ii(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,a||pe(e,"historyAdded")}function ji(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||function(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,$(i.done),t))?i.done[i.done.length-1]=t:Vi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&!1!==n.clearRedo&&Bi(i.undone)}function Vi(e,t){var r=$(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Ki(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),(function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o}))}function Gi(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function Ui(e,t){var r=function(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],i=0;i<t.text.length;++i)n.push(Gi(r[i]));return n}(e,t),n=Tt(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],a=n[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue e;o.push(s)}else a&&(r[i]=a)}return r}function _i(e,t,r){for(var n=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)n.push(r?ki.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];n.push({changes:l});for(var s=0;s<a.length;++s){var c=a[s],u=void 0;if(l.push({from:c.from,to:c.to,text:c.text}),t)for(var d in c)(u=d.match(/^spans_(\d+)$/))&&R(t,Number(u[1]))>-1&&($(l)[d]=c[d],delete c[d])}}}return n}function qi(e,t,r,n){if(n){var i=e.anchor;if(r){var o=tt(t,i)<0;o!=tt(r,i)<0?(i=t,t=r):o!=tt(t,r)<0&&(t=r)}return new Ci(i,t)}return new Ci(r||t,t)}function $i(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Ji(e,new ki([qi(e.sel.primary(),t,r,i)],0),n)}function Xi(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)n[o]=qi(e.sel.ranges[o],t[o],null,i);Ji(e,Si(e.cm,n,e.sel.primIndex),r)}function Yi(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Ji(e,Si(e.cm,i,e.sel.primIndex),n)}function Zi(e,t,r,n){Ji(e,Li(t,r),n)}function Qi(e,t,r){var n=e.history.done,i=$(n);i&&i.ranges?(n[n.length-1]=t,eo(e,t,r)):Ji(e,t,r)}function Ji(e,t,r){eo(e,t,r),ji(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function eo(e,t,r){(ve(e,"beforeSelectionChange")||e.cm&&ve(e.cm,"beforeSelectionChange"))&&(t=function(e,t,r){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new Ci(lt(e,t[r].anchor),lt(e,t[r].head))},origin:r&&r.origin};return pe(e,"beforeSelectionChange",e,n),e.cm&&pe(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?Si(e.cm,n.ranges,n.ranges.length-1):t}(e,t,r));var n=r&&r.bias||(tt(t.primary().head,e.sel.primary().head)<0?-1:1);to(e,no(e,t,n,!0)),r&&!1===r.scroll||!e.cm||Dn(e.cm)}function to(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,me(e.cm)),lr(e,"cursorActivity",e))}function ro(e){to(e,no(e,e.sel,null,!1))}function no(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=oo(e,a.anchor,l&&l.anchor,r,n),c=oo(e,a.head,l&&l.head,r,n);(i||s!=a.anchor||c!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new Ci(s,c))}return i?Si(e.cm,i,t.primIndex):t}function io(e,t,r,n,i){var o=_e(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker,c="selectLeft"in s?!s.selectLeft:s.inclusiveLeft,u="selectRight"in s?!s.selectRight:s.inclusiveRight;if((null==l.from||(c?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(u?l.to>=t.ch:l.to>t.ch))){if(i&&(pe(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(r){var d=s.find(n<0?1:-1),f=void 0;if((n<0?u:c)&&(d=ao(e,d,-n,d&&d.line==t.line?o:null)),d&&d.line==t.line&&(f=tt(d,r))&&(n<0?f<0:f>0))return io(e,d,t,n,i)}var h=s.find(n<0?-1:1);return(n<0?c:u)&&(h=ao(e,h,n,h.line==t.line?o:null)),h?io(e,h,t,n,i):null}}return t}function oo(e,t,r,n,i){var o=n||1,a=io(e,t,r,o,i)||!i&&io(e,t,r,o,!0)||io(e,t,r,-o,i)||!i&&io(e,t,r,-o,!0);return a||(e.cantEdit=!0,et(e.first,0))}function ao(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?lt(e,et(t.line-1)):null:r>0&&t.ch==(n||_e(e,t.line)).text.length?t.line<e.first+e.size-1?et(t.line+1,0):null:new et(t.line,t.ch+r)}function lo(e){e.setSelection(et(e.firstLine(),0),et(e.lastLine()),V)}function so(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return r&&(n.update=function(t,r,i,o){t&&(n.from=lt(e,t)),r&&(n.to=lt(e,r)),i&&(n.text=i),void 0!==o&&(n.origin=o)}),pe(e,"beforeChange",e,n),e.cm&&pe(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function co(e,t,r){if(e.cm){if(!e.cm.curOp)return ei(e.cm,co)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"))||(t=so(e,t,!0))){var n=xt&&!r&&function(e,t,r){var n=null;if(e.iter(t.line,r.line+1,(function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=R(n,r)||(n||(n=[])).push(r)}})),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var a=n[o],l=a.find(0),s=0;s<i.length;++s){var c=i[s];if(!(tt(c.to,l.from)<0||tt(c.from,l.to)>0)){var u=[s,1],d=tt(c.from,l.from),f=tt(c.to,l.to);(d<0||!a.inclusiveLeft&&!d)&&u.push({from:c.from,to:l.from}),(f>0||!a.inclusiveRight&&!f)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-3}}return i}(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)uo(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else uo(e,t)}}function uo(e,t){if(1!=t.text.length||""!=t.text[0]||0!=tt(t.from,t.to)){var r=Ni(e,t);Ri(e,t,r,e.cm?e.cm.curOp.id:NaN),po(e,t,r,Tt(e,t));var n=[];Pi(e,(function(e,r){r||-1!=R(n,e.history)||(yo(e.history,t),n.push(e.history)),po(e,t,null,Tt(e,t))}))}}function fo(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(!n||r){for(var i,o=e.history,a=e.sel,l="undo"==t?o.done:o.undone,s="undo"==t?o.undone:o.done,c=0;c<l.length&&(i=l[c],r?!i.ranges||i.equals(e.sel):i.ranges);c++);if(c!=l.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(!(i=l.pop()).ranges){if(n)return void l.push(i);break}if(Vi(i,s),r&&!i.equals(e.sel))return void Ji(e,i,{clearRedo:!1});a=i}var u=[];Vi(a,s),s.push({changes:u,generation:o.generation}),o.generation=i.generation||++o.maxGeneration;for(var d=ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"),f=function(r){var n=i.changes[r];if(n.origin=t,d&&!so(e,n,!1))return l.length=0,{};u.push(Ii(e,n));var o=r?Ni(e,n):$(l);po(e,n,o,Ui(e,n)),!r&&e.cm&&e.cm.scrollIntoView({from:n.from,to:Ti(n)});var a=[];Pi(e,(function(e,t){t||-1!=R(a,e.history)||(yo(e.history,n),a.push(e.history)),po(e,n,null,Ui(e,n))}))},h=i.changes.length-1;h>=0;--h){var p=f(h);if(p)return p.v}}}}function ho(e,t){if(0!=t&&(e.first+=t,e.sel=new ki(X(e.sel.ranges,(function(e){return new Ci(et(e.anchor.line+t,e.anchor.ch),et(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){dn(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)fn(e.cm,n,"gutter")}}function po(e,t,r,n){if(e.cm&&!e.cm.curOp)return ei(e.cm,po)(e,t,r,n);if(t.to.line<e.first)ho(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);ho(e,i),t={from:et(e.first,0),to:et(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:et(o,_e(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=qe(e,t.from,t.to),r||(r=Ni(e,t)),e.cm?function(e,t,r){var n=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line;e.options.lineWrapping||(s=Ye(It(_e(n,o.line))),n.iter(s,a.line+1,(function(e){if(e==i.maxLine)return l=!0,!0}))),n.sel.contains(t.from,t.to)>-1&&me(e),Wi(n,t,r,ln(e)),e.options.lineWrapping||(n.iter(s,o.line+t.text.length,(function(e){var t=Gt(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)})),l&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var r=e.first,n=t-1;n>r;n--){var i=_e(e,n).stateAfter;if(i&&(!(i instanceof ct)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}}(n,o.line),ni(e,400);var c=t.text.length-(a.line-o.line)-1;t.full?dn(e):o.line!=a.line||1!=t.text.length||zi(e.doc,t)?dn(e,o.line,a.line+1,c):fn(e,o.line,"text");var u=ve(e,"changes"),d=ve(e,"change");if(d||u){var f={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};d&&lr(e,"change",e,f),u&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}(e.cm,t,n):Wi(e,t,n),eo(e,r,V),e.cantEdit&&oo(e,et(e.firstLine(),0))&&(e.cantEdit=!1)}}function go(e,t,r,n,i){var o;n||(n=r),tt(n,r)<0&&(r=(o=[n,r])[0],n=o[1]),"string"==typeof t&&(t=e.splitLines(t)),co(e,{from:r,to:n,text:t,origin:i})}function mo(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function vo(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var l=0;l<o.ranges.length;l++)mo(o.ranges[l].anchor,t,r,n),mo(o.ranges[l].head,t,r,n)}else{for(var s=0;s<o.changes.length;++s){var c=o.changes[s];if(r<c.from.line)c.from=et(c.from.line+n,c.from.ch),c.to=et(c.to.line+n,c.to.ch);else if(t<=c.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function yo(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;vo(e.done,r,n,i),vo(e.undone,r,n,i)}function bo(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=_e(e,at(e,t)):i=Ye(t),null==i?null:(n(o,i)&&e.cm&&fn(e.cm,i,r),o)}function wo(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}function xo(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}Ci.prototype.from=function(){return ot(this.anchor,this.head)},Ci.prototype.to=function(){return it(this.anchor,this.head)},Ci.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},wo.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var i=this.lines[r];this.height-=i.height,qt(i),lr(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}},xo.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(e<i){var o=Math.min(t,i-e),a=n.height;if(n.removeInner(e,o),this.height-=a-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof wo))){var l=[];this.collapse(l),this.children=[new wo(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(var a=i.lines.length%25+25,l=a;l<i.lines.length;){var s=new wo(i.lines.slice(l,l+=25));i.height-=s.height,this.children.splice(++n,0,s),s.parent=this}i.lines=i.lines.slice(0,a),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=new xo(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var r=R(e.parent.children,e);e.parent.children.splice(r+1,0,t)}else{var n=new xo(e.children);n.parent=e,e.children=[n,t],e=n}t.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<o){var a=Math.min(t,o-e);if(i.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var ko=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};function Co(e,t,r){Kt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&On(e,r)}ko.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=Ye(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=wr(this);Xe(r,Math.max(0,r.height-o)),e&&(Jn(e,(function(){Co(e,r,-o),fn(e,n,"widget")})),lr(e,"lineWidgetCleared",e,this,n))}},ko.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=wr(this)-t;i&&(jt(this.doc,n)||Xe(n,n.height+i),r&&Jn(r,(function(){r.curOp.forceUpdate=!0,Co(r,n,i),lr(r,"lineWidgetChanged",r,e,Ye(n))})))},ye(ko);var So=0,Lo=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++So};function To(e,t,r,n,i){if(n&&n.shared)return function(e,t,r,n,i){(n=E(n)).shared=!1;var o=[To(e,t,r,n,i)],a=o[0],l=n.widgetNode;return Pi(e,(function(e){l&&(n.widgetNode=l.cloneNode(!0)),o.push(To(e,lt(e,t),lt(e,r),n,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;a=$(o)})),new Mo(o,a)}(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return ei(e.cm,To)(e,t,r,n,i);var o=new Lo(e,i),a=tt(t,r);if(n&&E(n,o,!1),a>0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=O("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Et(e,t.line,t,r,o)||t.line!=r.line&&Et(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");kt=!0}o.addToHistory&&Ri(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var l,s=t.line,c=e.cm;if(e.iter(s,r.line+1,(function(e){c&&o.collapsed&&!c.options.lineWrapping&&It(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&Xe(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new Ct(o,s==t.line?t.ch:null,s==r.line?r.ch:null)),++s})),o.collapsed&&e.iter(t.line,r.line+1,(function(t){jt(e,t)&&Xe(t,0)})),o.clearOnEnter&&de(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(xt=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++So,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)dn(c,t.line,r.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var u=t.line;u<=r.line;u++)fn(c,u,"text");o.atomic&&ro(c.doc),lr(c,"markerAdded",c,o)}return o}Lo.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&_n(e),ve(this,"clear")){var r=this.find();r&&lr(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],l=St(a.markedSpans,this);e&&!this.collapsed?fn(e,Ye(a),"text"):e&&(null!=l.to&&(i=Ye(a)),null!=l.from&&(n=Ye(a))),a.markedSpans=Lt(a.markedSpans,l),null==l.from&&this.collapsed&&!jt(this.doc,a)&&e&&Xe(a,rn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var s=0;s<this.lines.length;++s){var c=It(this.lines[s]),u=Gt(c);u>e.display.maxLineLength&&(e.display.maxLine=c,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&dn(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&ro(e.doc)),e&&lr(e,"markerCleared",e,this,n,i),t&&qn(e),this.parent&&this.parent.clear()}},Lo.prototype.find=function(e,t){var r,n;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],a=St(o.markedSpans,this);if(null!=a.from&&(r=et(t?o:Ye(o),a.from),-1==e))return r;if(null!=a.to&&(n=et(t?o:Ye(o),a.to),1==e))return n}return r&&{from:r,to:n}},Lo.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;t&&n&&Jn(n,(function(){var i=t.line,o=Ye(t.line),a=Or(n,o);if(a&&(Er(a),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!jt(r.doc,i)&&null!=r.height){var l=r.height;r.height=null;var s=wr(r)-l;s&&Xe(i,i.height+s)}lr(n,"markerChanged",n,e)}))},Lo.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=R(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Lo.prototype.detachLine=function(e){if(this.lines.splice(R(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ye(Lo);var Mo=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};function No(e){return e.findMarks(et(e.first,0),e.clipPos(et(e.lastLine())),(function(e){return e.parent}))}function Ao(e){for(var t=function(t){var r=e[t],n=[r.primary.doc];Pi(r.primary.doc,(function(e){return n.push(e)}));for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==R(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}},r=0;r<e.length;r++)t(r)}Mo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();lr(this,"clear")}},Mo.prototype.find=function(e,t){return this.primary.find(e,t)},ye(Mo);var Oo=0,Do=function(e,t,r,n,i){if(!(this instanceof Do))return new Do(e,t,r,n,i);null==r&&(r=0),xo.call(this,[new wo([new _t("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var o=et(r,0);this.sel=Li(o),this.history=new Ei(null),this.id=++Oo,this.modeOption=t,this.lineSep=n,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Wi(this,{from:o,to:o,text:e}),Ji(this,Li(o),V)};Do.prototype=Z(xo.prototype,{constructor:Do,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=$e(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:ri((function(e){var t=et(this.first,0),r=this.first+this.size-1;co(this,{from:t,to:et(r,_e(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&zn(this.cm,0,0),Ji(this,Li(t),V)})),replaceRange:function(e,t,r,n){go(this,e,t=lt(this,t),r=r?lt(this,r):t,n)},getRange:function(e,t,r){var n=qe(this,lt(this,e),lt(this,t));return!1===r?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Qe(this,e))return _e(this,e)},getLineNumber:function(e){return Ye(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=_e(this,e)),It(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return lt(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ri((function(e,t,r){Zi(this,lt(this,"number"==typeof e?et(e,t||0):e),null,r)})),setSelection:ri((function(e,t,r){Zi(this,lt(this,e),lt(this,t||e),r)})),extendSelection:ri((function(e,t,r){$i(this,lt(this,e),t&&lt(this,t),r)})),extendSelections:ri((function(e,t){Xi(this,st(this,e),t)})),extendSelectionsBy:ri((function(e,t){Xi(this,st(this,X(this.sel.ranges,e)),t)})),setSelections:ri((function(e,t,r){if(e.length){for(var n=[],i=0;i<e.length;i++)n[i]=new Ci(lt(this,e[i].anchor),lt(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Ji(this,Si(this.cm,n,t),r)}})),addSelection:ri((function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new Ci(lt(this,e),lt(this,t||e))),Ji(this,Si(this.cm,n,n.length-1),r)})),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=qe(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=qe(this,r[n].from(),r[n].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:ri((function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];n[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:r}}for(var l=t&&"end"!=t&&function(e,t,r){for(var n=[],i=et(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=Ai(l.from,i,o),c=Ai(Ti(l),i,o);if(i=l.to,o=c,"around"==r){var u=e.sel.ranges[a],d=tt(u.head,u.anchor)<0;n[a]=new Ci(d?c:s,d?s:c)}else n[a]=new Ci(s,s)}return new ki(n,e.sel.primIndex)}(this,n,t),s=n.length-1;s>=0;s--)co(this,n[s]);l?Qi(this,l):this.cm&&Dn(this.cm)})),undo:ri((function(){fo(this,"undo")})),redo:ri((function(){fo(this,"redo")})),undoSelection:ri((function(){fo(this,"undo",!0)})),redoSelection:ri((function(){fo(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){var e=this;this.history=new Ei(this.history.maxGeneration),Pi(this,(function(t){return t.history=e.history}),!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:_i(this.history.done),undone:_i(this.history.undone)}},setHistory:function(e){var t=this.history=new Ei(this.history.maxGeneration);t.done=_i(e.done.slice(0),null,!0),t.undone=_i(e.undone.slice(0),null,!0)},setGutterMarker:ri((function(e,t,r){return bo(this,e,"gutter",(function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&te(n)&&(e.gutterMarkers=null),!0}))})),clearGutter:ri((function(e){var t=this;this.iter((function(r){r.gutterMarkers&&r.gutterMarkers[e]&&bo(t,r,"gutter",(function(){return r.gutterMarkers[e]=null,te(r.gutterMarkers)&&(r.gutterMarkers=null),!0}))}))})),lineInfo:function(e){var t;if("number"==typeof e){if(!Qe(this,e))return null;if(t=e,!(e=_e(this,e)))return null}else if(null==(t=Ye(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:ri((function(e,t,r){return bo(this,e,"gutter"==t?"gutter":"class",(function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(S(r).test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0}))})),removeLineClass:ri((function(e,t,r){return bo(this,e,"gutter"==t?"gutter":"class",(function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var o=i.match(S(r));if(!o)return!1;var a=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0}))})),addLineWidget:ri((function(e,t,r){return function(e,t,r,n){var i=new ko(e,r,n),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),bo(e,t,"widget",(function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!jt(e,t)){var n=Kt(t)<e.scrollTop;Xe(t,t.height+wr(i)),n&&On(o,i.height),o.curOp.forceUpdate=!0}return!0})),o&&lr(o,"lineWidgetAdded",o,i,"number"==typeof t?t:Ye(t)),i}(this,e,t,r)})),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return To(this,lt(this,e),lt(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return To(this,e=lt(this,e),e,r,"bookmark")},findMarksAt:function(e){var t=[],r=_e(this,(e=lt(this,e)).line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=lt(this,e),t=lt(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,(function(o){var a=o.markedSpans;if(a)for(var l=0;l<a.length;l++){var s=a[l];null!=s.to&&i==e.line&&e.ch>=s.to||null==s.from&&i!=e.line||null!=s.from&&i==t.line&&s.from>=t.ch||r&&!r(s.marker)||n.push(s.marker.parent||s.marker)}++i})),n},getAllMarks:function(){var e=[];return this.iter((function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)})),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter((function(i){var o=i.text.length+n;if(o>e)return t=e,!0;e-=o,++r})),lt(this,et(r,t))},indexFromPos:function(e){var t=(e=lt(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,(function(e){t+=e.text.length+r})),t},copy:function(e){var t=new Do($e(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new Do($e(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(tt(o,a)){var l=To(e,o,a,n.primary,n.primary.type);n.markers.push(l),l.parent=n}}}(n,No(this)),n},unlinkDoc:function(e){if(e instanceof Ma&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t)if(this.linked[t].doc==e){this.linked.splice(t,1),e.unlinkDoc(this),Ao(No(this));break}if(e.history==this.history){var r=[e.id];Pi(e,(function(e){return r.push(e.id)}),!0),e.history=new Ei(null),e.history.done=_i(this.history.done,r),e.history.undone=_i(this.history.undone,r)}},iterLinkedDocs:function(e){Pi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):De(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:ri((function(e){var t;"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter((function(e){return e.order=null})),this.cm&&Jn(t=this.cm,(function(){Hi(t),dn(t)})))}))}),Do.prototype.eachLine=Do.prototype.iter;var zo=0;function Wo(e){var t=this;if(Po(t),!ge(t,e)&&!xr(t.display,e)){be(e),a&&(zo=+new Date);var r=cn(t,e,!0),n=e.dataTransfer.files;if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),l=0,s=function(){++l==i&&ei(t,(function(){var e={from:r=lt(t.doc,r),to:r,text:t.doc.splitLines(o.filter((function(e){return null!=e})).join(t.doc.lineSeparator())),origin:"paste"};co(t.doc,e),Qi(t.doc,Li(lt(t.doc,r),lt(t.doc,Ti(e))))}))()},c=function(e,r){if(t.options.allowDropFileTypes&&-1==R(t.options.allowDropFileTypes,e.type))s();else{var n=new FileReader;n.onerror=function(){return s()},n.onload=function(){var e=n.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(o[r]=e),s()},n.readAsText(e)}},u=0;u<n.length;u++)c(n[u],u);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var d=e.dataTransfer.getData("Text");if(d){var f;if(t.state.draggingText&&!t.state.draggingText.copy&&(f=t.listSelections()),eo(t.doc,Li(r,r)),f)for(var h=0;h<f.length;++h)go(t.doc,"",f[h].anchor,f[h].head,"drag");t.replaceSelection(d,"around","paste"),t.display.input.focus()}}catch(e){}}}}function Po(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Fo(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),r=[],n=0;n<t.length;n++){var i=t[n].CodeMirror;i&&r.push(i)}r.length&&r[0].operation((function(){for(var t=0;t<r.length;t++)e(r[t])}))}}var Ho=!1;function Eo(){var e;Ho||(de(window,"resize",(function(){null==e&&(e=setTimeout((function(){e=null,Fo(Io)}),100))})),de(window,"blur",(function(){return Fo(Ln)})),Ho=!0)}function Io(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Bo={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Ro=0;Ro<10;Ro++)Bo[Ro+48]=Bo[Ro+96]=String(Ro);for(var jo=65;jo<=90;jo++)Bo[jo]=String.fromCharCode(jo);for(var Vo=1;Vo<=12;Vo++)Bo[Vo+111]=Bo[Vo+63235]="F"+Vo;var Ko={};function Go(e){var t,r,n,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var a=0;a<o.length-1;a++){var l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else{if(!/^s(hift)?$/i.test(l))throw new Error("Unrecognized modifier name: "+l);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Uo(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=X(r.split(" "),Go),o=0;o<i.length;o++){var a=void 0,l=void 0;o==i.length-1?(l=i.join(" "),a=n):(l=i.slice(0,o+1).join(" "),a="...");var s=t[l];if(s){if(s!=a)throw new Error("Inconsistent bindings for "+l)}else t[l]=a}delete e[r]}for(var c in t)e[c]=t[c];return e}function _o(e,t,r,n){var i=(t=Yo(t)).call?t.call(e,n):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return _o(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var a=_o(e,t.fallthrough[o],r,n);if(a)return a}}}function qo(e){var t="string"==typeof e?e:Bo[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function $o(e,t,r){var n=e;return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(k?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(k?t.ctrlKey:t.metaKey)&&"Mod"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function Xo(e,t){if(d&&34==e.keyCode&&e.char)return!1;var r=Bo[e.keyCode];return null!=r&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(r=e.code),$o(r,e,t))}function Yo(e){return"string"==typeof e?Ko[e]:e}function Zo(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&tt(o.from,$(n).to)<=0;){var a=n.pop();if(tt(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}Jn(e,(function(){for(var t=n.length-1;t>=0;t--)go(e.doc,"",n[t].from,n[t].to,"+delete");Dn(e)}))}function Qo(e,t,r){var n=ie(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Jo(e,t,r){var n=Qo(e,t.ch,r);return null==n?null:new et(t.line,n,r<0?"after":"before")}function ea(e,t,r,n,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=ce(r,t.doc.direction);if(o){var a,l=i<0?$(o):o[0],s=i<0==(1==l.level)?"after":"before";if(l.level>0||"rtl"==t.doc.direction){var c=Dr(t,r);a=i<0?r.text.length-1:0;var u=zr(t,c,a).top;a=oe((function(e){return zr(t,c,e).top==u}),i<0==(1==l.level)?l.from:l.to-1,a),"before"==s&&(a=Qo(r,a,1))}else a=i<0?l.to:l.from;return new et(n,a,s)}}return new et(n,i<0?r.text.length:0,i<0?"before":"after")}Ko.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ko.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ko.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ko.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ko.default=y?Ko.macDefault:Ko.pcDefault;var ta={selectAll:lo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),V)},killLine:function(e){return Zo(e,(function(t){if(t.empty()){var r=_e(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:et(t.head.line+1,0)}:{from:t.head,to:et(t.head.line,r)}}return{from:t.from(),to:t.to()}}))},deleteLine:function(e){return Zo(e,(function(t){return{from:et(t.from().line,0),to:lt(e.doc,et(t.to().line+1,0))}}))},delLineLeft:function(e){return Zo(e,(function(e){return{from:et(e.from().line,0),to:e.from()}}))},delWrappedLineLeft:function(e){return Zo(e,(function(t){var r=e.charCoords(t.head,"div").top+5;return{from:e.coordsChar({left:0,top:r},"div"),to:t.from()}}))},delWrappedLineRight:function(e){return Zo(e,(function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}}))},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(et(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(et(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy((function(t){return ra(e,t.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy((function(t){return na(e,t.head)}),{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy((function(t){return function(e,t){var r=_e(e.doc,t),n=function(e){for(var t;t=Ft(e);)e=t.find(1,!0).line;return e}(r);return n!=r&&(t=Ye(n)),ea(!0,e,r,t,-1)}(e,t.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")}),G)},goLineLeft:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")}),G)},goLineLeftSmart:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?na(e,t.head):n}),G)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),a=I(e.getLine(o.line),o.ch,n);t.push(q(n-a%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Jn(e,(function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++)if(t[n].empty()){var i=t[n].head,o=_e(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new et(i.line,i.ch-1)),i.ch>0)i=new et(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),et(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=_e(e.doc,i.line-1).text;a&&(i=new et(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),et(i.line-1,a.length-1),i,"+transpose"))}r.push(new Ci(i,i))}e.setSelections(r)}))},newlineAndIndent:function(e){return Jn(e,(function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);Dn(e)}))},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ra(e,t){var r=_e(e.doc,t),n=It(r);return n!=r&&(t=Ye(n)),ea(!0,e,n,t,1)}function na(e,t){var r=ra(e,t.line),n=_e(e.doc,r.line),i=ce(n,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(r.ch,n.text.search(/\S/)),a=t.line==r.line&&t.ch<=o&&t.ch;return et(r.line,a?0:o,r.sticky)}return r}function ia(e,t,r){if("string"==typeof t&&!(t=ta[t]))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=j}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}var oa=new B;function aa(e,t,r,n){var i=e.state.keySeq;if(i){if(qo(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:oa.set(50,(function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())})),la(e,i+" "+t,r,n))return!0}return la(e,t,r,n)}function la(e,t,r,n){var i=function(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=_o(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&_o(t,e.options.extraKeys,r,e)||_o(t,e.options.keyMap,r,e)}(e,t,n);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&lr(e,"keyHandled",e,t,r),"handled"!=i&&"multi"!=i||(be(r),xn(e)),!!i}function sa(e,t){var r=Xo(t,!0);return!!r&&(t.shiftKey&&!e.state.keySeq?aa(e,"Shift-"+r,t,(function(t){return ia(e,t,!0)}))||aa(e,r,t,(function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return ia(e,t)})):aa(e,r,t,(function(t){return ia(e,t)})))}var ca=null;function ua(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField()||(t.curOp.focus=z(),ge(t,e)))){a&&l<11&&27==e.keyCode&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=16==n||e.shiftKey;var i=sa(t,e);d&&(ca=i?n:null,i||88!=n||We||!(y?e.metaKey:e.ctrlKey)||t.replaceSelection("",null,"cut")),r&&!y&&!i&&46==n&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=n||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||function(e){var t=e.display.lineDiv;function r(e){18!=e.keyCode&&e.altKey||(T(t,"CodeMirror-crosshair"),he(document,"keyup",r),he(document,"mouseover",r))}W(t,"CodeMirror-crosshair"),de(document,"keyup",r),de(document,"mouseover",r)}(t)}}function da(e){16==e.keyCode&&(this.doc.sel.shift=!1),ge(this,e)}function fa(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField()||xr(t.display,e)||ge(t,e)||e.ctrlKey&&!e.altKey||y&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(d&&r==ca)return ca=null,void be(e);if(!d||e.which&&!(e.which<10)||!sa(t,e)){var i=String.fromCharCode(null==n?r:n);"\b"!=i&&(function(e,t,r){return aa(e,"'"+r+"'",t,(function(t){return ia(e,t,!0)}))}(t,e,i)||t.display.input.onKeyPress(e))}}}var ha,pa,ga=function(e,t,r){this.time=e,this.pos=t,this.button=r};function ma(e){var t=this,r=t.display;if(!(ge(t,e)||r.activeTouch&&r.input.supportsTouch()))if(r.input.ensurePolled(),r.shift=e.shiftKey,xr(r,e))s||(r.scroller.draggable=!1,setTimeout((function(){return r.scroller.draggable=!0}),100));else if(!ba(t,e)){var n=cn(t,e),i=Se(e),o=n?function(e,t){var r=+new Date;return pa&&pa.compare(r,e,t)?(ha=pa=null,"triple"):ha&&ha.compare(r,e,t)?(pa=new ga(r,e,t),ha=null,"double"):(ha=new ga(r,e,t),pa=null,"single")}(n,i):"single";window.focus(),1==i&&t.state.selectingText&&t.state.selectingText(e),n&&function(e,t,r,n,i){var o="Click";return"double"==n?o="Double"+o:"triple"==n&&(o="Triple"+o),aa(e,$o(o=(1==t?"Left":2==t?"Middle":"Right")+o,i),i,(function(t){if("string"==typeof t&&(t=ta[t]),!t)return!1;var n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n=t(e,r)!=j}finally{e.state.suppressEdits=!1}return n}))}(t,i,n,o,e)||(1==i?n?function(e,t,r,n){a?setTimeout(H(kn,e),0):e.curOp.focus=z();var i,o=function(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(null==i.unit){var o=b?r.shiftKey&&r.metaKey:r.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}return(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||r.shiftKey),null==i.addNew&&(i.addNew=y?r.metaKey:r.ctrlKey),null==i.moveOnDrag&&(i.moveOnDrag=!(y?r.altKey:r.ctrlKey)),i}(e,r,n),c=e.doc.sel;e.options.dragDrop&&Me&&!e.isReadOnly()&&"single"==r&&(i=c.contains(t))>-1&&(tt((i=c.ranges[i]).from(),t)<0||t.xRel>0)&&(tt(i.to(),t)>0||t.xRel<0)?function(e,t,r,n){var i=e.display,o=!1,c=ei(e,(function(t){s&&(i.scroller.draggable=!1),e.state.draggingText=!1,he(i.wrapper.ownerDocument,"mouseup",c),he(i.wrapper.ownerDocument,"mousemove",u),he(i.scroller,"dragstart",d),he(i.scroller,"drop",c),o||(be(t),n.addNew||$i(e.doc,r,null,null,n.extend),s&&!f||a&&9==l?setTimeout((function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()}),20):i.input.focus())})),u=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},d=function(){return o=!0};s&&(i.scroller.draggable=!0),e.state.draggingText=c,c.copy=!n.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),de(i.wrapper.ownerDocument,"mouseup",c),de(i.wrapper.ownerDocument,"mousemove",u),de(i.scroller,"dragstart",d),de(i.scroller,"drop",c),Cn(e),setTimeout((function(){return i.input.focus()}),20)}(e,n,t,o):function(e,t,r,n){var i=e.display,o=e.doc;be(t);var a,l,s=o.sel,c=s.ranges;if(n.addNew&&!n.extend?(l=o.sel.contains(r),a=l>-1?c[l]:new Ci(r,r)):(a=o.sel.primary(),l=o.sel.primIndex),"rectangle"==n.unit)n.addNew||(a=new Ci(r,r)),r=cn(e,t,!0,!0),l=-1;else{var u=va(e,r,n.unit);a=n.extend?qi(a,u.anchor,u.head,n.extend):u}n.addNew?-1==l?(l=c.length,Ji(o,Si(e,c.concat([a]),l),{scroll:!1,origin:"*mouse"})):c.length>1&&c[l].empty()&&"char"==n.unit&&!n.extend?(Ji(o,Si(e,c.slice(0,l).concat(c.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):Yi(o,l,a,K):(l=0,Ji(o,new ki([a],0),K),s=o.sel);var d=r;function f(t){if(0!=tt(d,t))if(d=t,"rectangle"==n.unit){for(var i=[],c=e.options.tabSize,u=I(_e(o,r.line).text,r.ch,c),f=I(_e(o,t.line).text,t.ch,c),h=Math.min(u,f),p=Math.max(u,f),g=Math.min(r.line,t.line),m=Math.min(e.lastLine(),Math.max(r.line,t.line));g<=m;g++){var v=_e(o,g).text,y=U(v,h,c);h==p?i.push(new Ci(et(g,y),et(g,y))):v.length>y&&i.push(new Ci(et(g,y),et(g,U(v,p,c))))}i.length||i.push(new Ci(r,r)),Ji(o,Si(e,s.ranges.slice(0,l).concat(i),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,w=a,x=va(e,t,n.unit),k=w.anchor;tt(x.anchor,k)>0?(b=x.head,k=ot(w.from(),x.anchor)):(b=x.anchor,k=it(w.to(),x.head));var C=s.ranges.slice(0);C[l]=function(e,t){var r=t.anchor,n=t.head,i=_e(e.doc,r.line);if(0==tt(r,n)&&r.sticky==n.sticky)return t;var o=ce(i);if(!o)return t;var a=le(o,r.ch,r.sticky),l=o[a];if(l.from!=r.ch&&l.to!=r.ch)return t;var s,c=a+(l.from==r.ch==(1!=l.level)?0:1);if(0==c||c==o.length)return t;if(n.line!=r.line)s=(n.line-r.line)*("ltr"==e.doc.direction?1:-1)>0;else{var u=le(o,n.ch,n.sticky),d=u-a||(n.ch-r.ch)*(1==l.level?-1:1);s=u==c-1||u==c?d<0:d>0}var f=o[c+(s?-1:0)],h=s==(1==f.level),p=h?f.from:f.to,g=h?"after":"before";return r.ch==p&&r.sticky==g?t:new Ci(new et(r.line,p,g),n)}(e,new Ci(lt(o,k),b)),Ji(o,Si(e,C,l),K)}}var h=i.wrapper.getBoundingClientRect(),p=0;function g(t){e.state.selectingText=!1,p=1/0,t&&(be(t),i.input.focus()),he(i.wrapper.ownerDocument,"mousemove",m),he(i.wrapper.ownerDocument,"mouseup",v),o.history.lastSelOrigin=null}var m=ei(e,(function(t){0!==t.buttons&&Se(t)?function t(r){var a=++p,l=cn(e,r,!0,"rectangle"==n.unit);if(l)if(0!=tt(l,d)){e.curOp.focus=z(),f(l);var s=Nn(i,o);(l.line>=s.to||l.line<s.from)&&setTimeout(ei(e,(function(){p==a&&t(r)})),150)}else{var c=r.clientY<h.top?-20:r.clientY>h.bottom?20:0;c&&setTimeout(ei(e,(function(){p==a&&(i.scroller.scrollTop+=c,t(r))})),50)}}(t):g(t)})),v=ei(e,g);e.state.selectingText=v,de(i.wrapper.ownerDocument,"mousemove",m),de(i.wrapper.ownerDocument,"mouseup",v)}(e,n,t,o)}(t,n,o,e):Ce(e)==r.scroller&&be(e):2==i?(n&&$i(t.doc,n),setTimeout((function(){return r.input.focus()}),20)):3==i&&(C?t.display.input.onContextMenu(e):Cn(t)))}}function va(e,t,r){if("char"==r)return new Ci(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new Ci(et(t.line,0),lt(e.doc,et(t.line+1,0)));var n=r(e,t);return new Ci(n.from,n.to)}function ya(e,t,r,n){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&be(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!ve(e,r))return xe(t);o-=l.top-a.viewOffset;for(var s=0;s<e.display.gutterSpecs.length;++s){var c=a.gutters.childNodes[s];if(c&&c.getBoundingClientRect().right>=i)return pe(e,r,e,Ze(e.doc,o),e.display.gutterSpecs[s].className,t),xe(t)}}function ba(e,t){return ya(e,t,"gutterClick",!0)}function wa(e,t){xr(e.display,t)||function(e,t){return!!ve(e,"gutterContextMenu")&&ya(e,t,"gutterContextMenu",!1)}(e,t)||ge(e,t,"contextmenu")||C||e.display.input.onContextMenu(t)}function xa(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Br(e)}ga.prototype.compare=function(e,t,r){return this.time+400>e&&0==tt(t,this.pos)&&r==this.button};var ka={toString:function(){return"CodeMirror.Init"}},Ca={},Sa={};function La(e,t,r){if(!t!=!(r&&r!=ka)){var n=e.display.dragFunctions,i=t?de:he;i(e.display.scroller,"dragstart",n.start),i(e.display.scroller,"dragenter",n.enter),i(e.display.scroller,"dragover",n.over),i(e.display.scroller,"dragleave",n.leave),i(e.display.scroller,"drop",n.drop)}}function Ta(e){e.options.lineWrapping?(W(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),Ut(e)),sn(e),dn(e),Br(e),setTimeout((function(){return jn(e)}),100)}function Ma(e,t){var r=this;if(!(this instanceof Ma))return new Ma(e,t);this.options=t=t?E(t):{},E(Ca,t,!1);var n=t.value;"string"==typeof n?n=new Do(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new Ma.inputStyles[t.inputStyle](this),o=this.display=new mi(e,n,i,t);for(var c in o.wrapper.CodeMirror=this,xa(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Gn(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new B,keySeq:null,specialChars:null},t.autofocus&&!v&&o.input.focus(),a&&l<11&&setTimeout((function(){return r.display.input.reset(!0)}),20),function(e){var t=e.display;de(t.scroller,"mousedown",ei(e,ma)),de(t.scroller,"dblclick",a&&l<11?ei(e,(function(t){if(!ge(e,t)){var r=cn(e,t);if(r&&!ba(e,t)&&!xr(e.display,t)){be(t);var n=e.findWordAt(r);$i(e.doc,n.anchor,n.head)}}})):function(t){return ge(e,t)||be(t)}),de(t.scroller,"contextmenu",(function(t){return wa(e,t)})),de(t.input.getField(),"contextmenu",(function(r){t.scroller.contains(r.target)||wa(e,r)}));var r,n={end:0};function i(){t.activeTouch&&(r=setTimeout((function(){return t.activeTouch=null}),1e3),(n=t.activeTouch).end=+new Date)}function o(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}de(t.scroller,"touchstart",(function(i){if(!ge(e,i)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(i)&&!ba(e,i)){t.input.ensurePolled(),clearTimeout(r);var o=+new Date;t.activeTouch={start:o,moved:!1,prev:o-n.end<=300?n:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}})),de(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),de(t.scroller,"touchend",(function(r){var n=t.activeTouch;if(n&&!xr(t,r)&&null!=n.left&&!n.moved&&new Date-n.start<300){var a,l=e.coordsChar(t.activeTouch,"page");a=!n.prev||o(n,n.prev)?new Ci(l,l):!n.prev.prev||o(n,n.prev.prev)?e.findWordAt(l):new Ci(et(l.line,0),lt(e.doc,et(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),be(r)}i()})),de(t.scroller,"touchcancel",i),de(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(Fn(e,t.scroller.scrollTop),En(e,t.scroller.scrollLeft,!0),pe(e,"scroll",e))})),de(t.scroller,"mousewheel",(function(t){return xi(e,t)})),de(t.scroller,"DOMMouseScroll",(function(t){return xi(e,t)})),de(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){ge(e,t)||ke(t)},over:function(t){ge(e,t)||(function(e,t){var r=cn(e,t);if(r){var n=document.createDocumentFragment();yn(e,r,n),e.display.dragCursor||(e.display.dragCursor=A("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),N(e.display.dragCursor,n)}}(e,t),ke(t))},start:function(t){return function(e,t){if(a&&(!e.state.draggingText||+new Date-zo<100))ke(t);else if(!ge(e,t)&&!xr(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f)){var r=A("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",d&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),d&&r.parentNode.removeChild(r)}}(e,t)},drop:ei(e,Wo),leave:function(t){ge(e,t)||Po(e)}};var s=t.input.getField();de(s,"keyup",(function(t){return da.call(e,t)})),de(s,"keydown",ei(e,ua)),de(s,"keypress",ei(e,fa)),de(s,"focus",(function(t){return Sn(e,t)})),de(s,"blur",(function(t){return Ln(e,t)}))}(this),Eo(),_n(this),this.curOp.forceUpdate=!0,Fi(this,n),t.autofocus&&!v||this.hasFocus()?setTimeout((function(){r.hasFocus()&&!r.state.focused&&Sn(r)}),20):Ln(this),Sa)Sa.hasOwnProperty(c)&&Sa[c](this,t[c],ka);fi(this),t.finishInit&&t.finishInit(this);for(var u=0;u<Na.length;++u)Na[u](this);qn(this),s&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}Ma.defaults=Ca,Ma.optionHandlers=Sa;var Na=[];function Aa(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=ht(e,t).state:r="prev");var a=e.options.tabSize,l=_e(o,t),s=I(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var c,u=l.text.match(/^\s*/)[0];if(n||/\S/.test(l.text)){if("smart"==r&&((c=o.mode.indent(i,l.text.slice(u.length),l.text))==j||c>150)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?I(_e(o,t-1).text,null,a):0:"add"==r?c=s+e.options.indentUnit:"subtract"==r?c=s-e.options.indentUnit:"number"==typeof r&&(c=s+r),c=Math.max(0,c);var d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h)f+=a,d+="\t";if(f<c&&(d+=q(c-f)),d!=u)return go(o,d,et(t,0),et(t,u.length),"+input"),l.stateAfter=null,!0;for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p];if(g.head.line==t&&g.head.ch<u.length){var m=et(t,u.length);Yi(o,p,new Ci(m,m));break}}}Ma.defineInitHook=function(e){return Na.push(e)};var Oa=null;function Da(e){Oa=e}function za(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var a=+new Date-200,l="paste"==i||e.state.pasteIncoming>a,s=De(t),c=null;if(l&&n.ranges.length>1)if(Oa&&Oa.text.join("\n")==t){if(n.ranges.length%Oa.text.length==0){c=[];for(var u=0;u<Oa.text.length;u++)c.push(o.splitLines(Oa.text[u]))}}else s.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(c=X(s,(function(e){return[e]})));for(var d=e.curOp.updateInput,f=n.ranges.length-1;f>=0;f--){var h=n.ranges[f],p=h.from(),g=h.to();h.empty()&&(r&&r>0?p=et(p.line,p.ch-r):e.state.overwrite&&!l?g=et(g.line,Math.min(_e(o,g.line).text.length,g.ch+$(s).length)):l&&Oa&&Oa.lineWise&&Oa.text.join("\n")==s.join("\n")&&(p=g=et(p.line,0)));var m={from:p,to:g,text:c?c[f%c.length]:s,origin:i||(l?"paste":e.state.cutIncoming>a?"cut":"+input")};co(e.doc,m),lr(e,"inputRead",e,m)}t&&!l&&Pa(e,t),Dn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Wa(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Jn(t,(function(){return za(t,r,0,null,"paste")})),!0}function Pa(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(t.indexOf(o.electricChars.charAt(l))>-1){a=Aa(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(_e(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Aa(e,i.head.line,"smart"));a&&lr(e,"electricInput",e,i.head.line)}}}function Fa(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:et(i,0),head:et(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function Ha(e,t,r,n){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function Ea(){var e=A("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=A("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return s?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),Ha(e),t}function Ia(e,t,r,n,i){var o=t,a=r,l=_e(e,t.line),s=i&&"rtl"==e.direction?-r:r;function c(o){var a,c;if("codepoint"==n){var u=l.text.charCodeAt(t.ch+(n>0?0:-1));a=isNaN(u)?null:new et(t.line,Math.max(0,Math.min(l.text.length,t.ch+r*(u>=55296&&u<56320?2:1))),-r)}else a=i?function(e,t,r,n){var i=ce(t,e.doc.direction);if(!i)return Jo(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var o=le(i,r.ch,r.sticky),a=i[o];if("ltr"==e.doc.direction&&a.level%2==0&&(n>0?a.to>r.ch:a.from<r.ch))return Jo(t,r,n);var l,s=function(e,r){return Qo(t,e instanceof et?e.ch:e,r)},c=function(r){return e.options.lineWrapping?(l=l||Dr(e,t),Zr(e,t,l,r)):{begin:0,end:t.text.length}},u=c("before"==r.sticky?s(r,-1):r.ch);if("rtl"==e.doc.direction||1==a.level){var d=1==a.level==n<0,f=s(r,d?1:-1);if(null!=f&&(d?f<=a.to&&f<=u.end:f>=a.from&&f>=u.begin)){var h=d?"before":"after";return new et(r.line,f,h)}}var p=function(e,t,n){for(var o=function(e,t){return t?new et(r.line,s(e,1),"before"):new et(r.line,e,"after")};e>=0&&e<i.length;e+=t){var a=i[e],l=t>0==(1!=a.level),c=l?n.begin:s(n.end,-1);if(a.from<=c&&c<a.to)return o(c,l);if(c=l?a.from:s(a.to,-1),n.begin<=c&&c<n.end)return o(c,l)}},g=p(o+n,n,u);if(g)return g;var m=n>0?u.end:s(u.begin,-1);return null==m||n>0&&m==t.text.length||!(g=p(n>0?0:i.length-1,n,c(m)))?null:g}(e.cm,l,t,r):Jo(l,t,r);if(null==a){if(o||(c=t.line+s)<e.first||c>=e.first+e.size||(t=new et(c,t.ch,t.sticky),!(l=_e(e,c))))return!1;t=ea(i,e.cm,l,t.line,s)}else t=a;return!0}if("char"==n||"codepoint"==n)c();else if("column"==n)c(!0);else if("word"==n||"group"==n)for(var u=null,d="group"==n,f=e.cm&&e.cm.getHelper(t,"wordChars"),h=!0;!(r<0)||c(!h);h=!1){var p=l.text.charAt(t.ch)||"\n",g=ee(p,f)?"w":d&&"\n"==p?"n":!d||/\s/.test(p)?null:"p";if(!d||h||g||(g="s"),u&&u!=g){r<0&&(r=1,c(),t.sticky="after");break}if(g&&(u=g),r>0&&!c(!h))break}var m=oo(e,t,o,a,!0);return rt(o,m)&&(m.hitSide=!0),m}function Ba(e,t,r,n){var i,o,a=e.doc,l=t.left;if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),c=Math.max(s-.5*rn(e.display),3);i=(r>0?t.bottom:t.top)+r*c}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;(o=Xr(e,l,i)).outside;){if(r<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*r}return o}var Ra=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new B,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function ja(e,t){var r=Or(e,t.line);if(!r||r.hidden)return null;var n=_e(e.doc,t.line),i=Nr(r,n,t.line),o=ce(n,e.doc.direction),a="left";o&&(a=le(o,t.ch)%2?"right":"left");var l=Fr(i.map,t.ch,a);return l.offset="right"==l.collapse?l.end:l.start,l}function Va(e,t){return t&&(e.bad=!0),e}function Ka(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return Va(e.clipPos(et(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return Ga(o,t,r)}}function Ga(e,t,r){var n=e.text.firstChild,i=!1;if(!t||!D(n,t))return Va(et(Ye(e.line),0),!0);if(t==n&&(i=!0,t=n.childNodes[r],r=0,!t)){var o=e.rest?$(e.rest):e.line;return Va(et(Ye(o),o.text.length),i)}var a=3==t.nodeType?t:null,l=t;for(a||1!=t.childNodes.length||3!=t.firstChild.nodeType||(a=t.firstChild,r&&(r=a.nodeValue.length));l.parentNode!=n;)l=l.parentNode;var s=e.measure,c=s.maps;function u(t,r,n){for(var i=-1;i<(c?c.length:0);i++)for(var o=i<0?s.map:c[i],a=0;a<o.length;a+=3){var l=o[a+2];if(l==t||l==r){var u=Ye(i<0?e.line:e.rest[i]),d=o[a]+n;return(n<0||l!=t)&&(d=o[a+(n?1:0)]),et(u,d)}}}var d=u(a,l,r);if(d)return Va(d,i);for(var f=l.nextSibling,h=a?a.nodeValue.length-r:0;f;f=f.nextSibling){if(d=u(f,f.firstChild,0))return Va(et(d.line,d.ch-h),i);h+=f.textContent.length}for(var p=l.previousSibling,g=r;p;p=p.previousSibling){if(d=u(p,p.firstChild,-1))return Va(et(d.line,d.ch+g),i);g+=p.textContent.length}}Ra.prototype.init=function(e){var t=this,r=this,n=r.cm,i=r.div=e.lineDiv;function o(e){for(var t=e.target;t;t=t.parentNode){if(t==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(t.className))break}return!1}function a(e){if(o(e)&&!ge(n,e)){if(n.somethingSelected())Da({lineWise:!1,text:n.getSelections()}),"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=Fa(n);Da({lineWise:!0,text:t.text}),"cut"==e.type&&n.operation((function(){n.setSelections(t.ranges,0,V),n.replaceSelection("",null,"cut")}))}if(e.clipboardData){e.clipboardData.clearData();var a=Oa.text.join("\n");if(e.clipboardData.setData("Text",a),e.clipboardData.getData("Text")==a)return void e.preventDefault()}var l=Ea(),s=l.firstChild;n.display.lineSpace.insertBefore(l,n.display.lineSpace.firstChild),s.value=Oa.text.join("\n");var c=document.activeElement;F(s),setTimeout((function(){n.display.lineSpace.removeChild(l),c.focus(),c==i&&r.showPrimarySelection()}),50)}}Ha(i,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize),de(i,"paste",(function(e){!o(e)||ge(n,e)||Wa(e,n)||l<=11&&setTimeout(ei(n,(function(){return t.updateFromDOM()})),20)})),de(i,"compositionstart",(function(e){t.composing={data:e.data,done:!1}})),de(i,"compositionupdate",(function(e){t.composing||(t.composing={data:e.data,done:!1})})),de(i,"compositionend",(function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)})),de(i,"touchstart",(function(){return r.forceCompositionEnd()})),de(i,"input",(function(){t.composing||t.readFromDOMSoon()})),de(i,"copy",a),de(i,"cut",a)},Ra.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Ra.prototype.prepareSelection=function(){var e=vn(this.cm,!1);return e.focus=document.activeElement==this.div,e},Ra.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Ra.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Ra.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),i=n.from(),o=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||o.line<t.display.viewFrom)e.removeAllRanges();else{var a=Ka(t,e.anchorNode,e.anchorOffset),l=Ka(t,e.focusNode,e.focusOffset);if(!a||a.bad||!l||l.bad||0!=tt(ot(a,l),i)||0!=tt(it(a,l),o)){var s=t.display.view,c=i.line>=t.display.viewFrom&&ja(t,i)||{node:s[0].measure.map[2],offset:0},u=o.line<t.display.viewTo&&ja(t,o);if(!u){var d=s[s.length-1].measure,f=d.maps?d.maps[d.maps.length-1]:d.map;u={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}if(c&&u){var h,p=e.rangeCount&&e.getRangeAt(0);try{h=L(c.node,c.offset,u.offset,u.node)}catch(e){}h&&(!r&&t.state.focused?(e.collapse(c.node,c.offset),h.collapsed||(e.removeAllRanges(),e.addRange(h))):(e.removeAllRanges(),e.addRange(h)),p&&null==e.anchorNode?e.addRange(p):r&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},Ra.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation((function(){return e.cm.curOp.selectionChanged=!0}))}),20)},Ra.prototype.showMultipleSelections=function(e){N(this.cm.display.cursorDiv,e.cursors),N(this.cm.display.selectionDiv,e.selection)},Ra.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Ra.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return D(this.div,t)},Ra.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&document.activeElement==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Ra.prototype.blur=function(){this.div.blur()},Ra.prototype.getField=function(){return this.div},Ra.prototype.supportsTouch=function(){return!0},Ra.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Jn(this.cm,(function(){return e.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,(function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}))},Ra.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Ra.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(m&&u&&this.cm.display.gutterSpecs.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var r=Ka(t,e.anchorNode,e.anchorOffset),n=Ka(t,e.focusNode,e.focusOffset);r&&n&&Jn(t,(function(){Ji(t.doc,Li(r,n),V),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)}))}}},Ra.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,r,n=this.cm,i=n.display,o=n.doc.sel.primary(),a=o.from(),l=o.to();if(0==a.ch&&a.line>n.firstLine()&&(a=et(a.line-1,_e(n.doc,a.line-1).length)),l.ch==_e(n.doc,l.line).text.length&&l.line<n.lastLine()&&(l=et(l.line+1,0)),a.line<i.viewFrom||l.line>i.viewTo-1)return!1;a.line==i.viewFrom||0==(e=un(n,a.line))?(t=Ye(i.view[0].line),r=i.view[0].node):(t=Ye(i.view[e].line),r=i.view[e-1].node.nextSibling);var s,c,u=un(n,l.line);if(u==i.view.length-1?(s=i.viewTo-1,c=i.lineDiv.lastChild):(s=Ye(i.view[u+1].line)-1,c=i.view[u+1].node.previousSibling),!r)return!1;for(var d=n.doc.splitLines(function(e,t,r,n,i){var o="",a=!1,l=e.doc.lineSeparator(),s=!1;function c(){a&&(o+=l,s&&(o+=l),a=s=!1)}function u(e){e&&(c(),o+=e)}function d(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(r)return void u(r);var o,f=t.getAttribute("cm-marker");if(f){var h=e.findMarks(et(n,0),et(i+1,0),(m=+f,function(e){return e.id==m}));return void(h.length&&(o=h[0].find(0))&&u(qe(e.doc,o.from,o.to).join(l)))}if("false"==t.getAttribute("contenteditable"))return;var p=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;p&&c();for(var g=0;g<t.childNodes.length;g++)d(t.childNodes[g]);/^(pre|p)$/i.test(t.nodeName)&&(s=!0),p&&(a=!0)}else 3==t.nodeType&&u(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var m}for(;d(t),t!=r;)t=t.nextSibling,s=!1;return o}(n,r,c,t,s)),f=qe(n.doc,et(t,0),et(s,_e(n.doc,s).text.length));d.length>1&&f.length>1;)if($(d)==$(f))d.pop(),f.pop(),s--;else{if(d[0]!=f[0])break;d.shift(),f.shift(),t++}for(var h=0,p=0,g=d[0],m=f[0],v=Math.min(g.length,m.length);h<v&&g.charCodeAt(h)==m.charCodeAt(h);)++h;for(var y=$(d),b=$(f),w=Math.min(y.length-(1==d.length?h:0),b.length-(1==f.length?h:0));p<w&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;if(1==d.length&&1==f.length&&t==a.line)for(;h&&h>a.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)h--,p++;d[d.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),d[0]=d[0].slice(h).replace(/\u200b+$/,"");var x=et(t,h),k=et(s,f.length?$(f).length-p:0);return d.length>1||d[0]||tt(x,k)?(go(n.doc,d,x,k,"+input"),!0):void 0},Ra.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ra.prototype.reset=function(){this.forceCompositionEnd()},Ra.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Ra.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},Ra.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Jn(this.cm,(function(){return dn(e.cm)}))},Ra.prototype.setUneditable=function(e){e.contentEditable="false"},Ra.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||ei(this.cm,za)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Ra.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Ra.prototype.onContextMenu=function(){},Ra.prototype.resetPosition=function(){},Ra.prototype.needsContentAttribute=!0;var Ua=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new B,this.hasSelection=!1,this.composing=null};Ua.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!ge(n,e)){if(n.somethingSelected())Da({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var t=Fa(n);Da({lineWise:!0,text:t.text}),"cut"==e.type?n.setSelections(t.ranges,null,V):(r.prevInput="",i.value=t.text.join("\n"),F(i))}"cut"==e.type&&(n.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(i.style.width="0px"),de(i,"input",(function(){a&&l>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()})),de(i,"paste",(function(e){ge(n,e)||Wa(e,n)||(n.state.pasteIncoming=+new Date,r.fastPoll())})),de(i,"cut",o),de(i,"copy",o),de(e.scroller,"paste",(function(t){if(!xr(e,t)&&!ge(n,t)){if(!i.dispatchEvent)return n.state.pasteIncoming=+new Date,void r.focus();var o=new Event("paste");o.clipboardData=t.clipboardData,i.dispatchEvent(o)}})),de(e.lineSpace,"selectstart",(function(t){xr(e,t)||be(t)})),de(i,"compositionstart",(function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}})),de(i,"compositionend",(function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)}))},Ua.prototype.createField=function(e){this.wrapper=Ea(),this.textarea=this.wrapper.firstChild},Ua.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ua.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=vn(e);if(e.options.moveInputWithCursor){var i=_r(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return n},Ua.prototype.showSelection=function(e){var t=this.cm.display;N(t.cursorDiv,e.cursors),N(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ua.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&F(this.textarea),a&&l>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",a&&l>=9&&(this.hasSelection=null))}},Ua.prototype.getField=function(){return this.textarea},Ua.prototype.supportsTouch=function(){return!1},Ua.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||z()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ua.prototype.blur=function(){this.textarea.blur()},Ua.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ua.prototype.receivedFocus=function(){this.slowPoll()},Ua.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},Ua.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,(function r(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,r))}))},Ua.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||ze(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(a&&l>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||n||(n="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var s=0,c=Math.min(n.length,i.length);s<c&&n.charCodeAt(s)==i.charCodeAt(s);)++s;return Jn(t,(function(){za(t,i.slice(s),n.length-s,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?r.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},Ua.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ua.prototype.onKeyPress=function(){a&&l>=9&&(this.hasSelection=null),this.fastPoll()},Ua.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=cn(r,e),c=n.scroller.scrollTop;if(o&&!d){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(o)&&ei(r,Ji)(r.doc,Li(o),V);var u,f=i.style.cssText,h=t.wrapper.style.cssText,p=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(u=window.scrollY),n.input.focus(),s&&window.scrollTo(null,u),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=v,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll),a&&l>=9&&m(),C){ke(e);var g=function(){he(window,"mouseup",g),setTimeout(v,20)};de(window,"mouseup",g)}else setTimeout(v,50)}function m(){if(null!=i.selectionStart){var e=r.somethingSelected(),o="​"+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"​",i.selectionStart=1,i.selectionEnd=o.length,n.selForContextMenu=r.doc.sel}}function v(){if(t.contextMenuPending==v&&(t.contextMenuPending=!1,t.wrapper.style.cssText=h,i.style.cssText=f,a&&l<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=c),null!=i.selectionStart)){(!a||a&&l<9)&&m();var e=0,o=function(){n.selForContextMenu==r.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"​"==t.prevInput?ei(r,lo)(r):e++<10?n.detectingSelectAll=setTimeout(o,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(o,200)}}},Ua.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},Ua.prototype.setUneditable=function(){},Ua.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function r(r,n,i,o){e.defaults[r]=n,i&&(t[r]=o?function(e,t,r){r!=ka&&i(e,t,r)}:i)}e.defineOption=r,e.Init=ka,r("value","",(function(e,t){return e.setValue(t)}),!0),r("mode",null,(function(e,t){e.doc.modeOption=t,Oi(e)}),!0),r("indentUnit",2,Oi,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,(function(e){Di(e),Br(e),dn(e)}),!0),r("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter((function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,r.push(et(n,o))}n++}));for(var i=r.length-1;i>=0;i--)go(e.doc,t,r[i],et(r[i].line,r[i].ch+t.length))}})),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=ka&&e.refresh()})),r("specialCharPlaceholder",Qt,(function(e){return e.refresh()}),!0),r("electricChars",!0),r("inputStyle",v?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),r("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),r("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),r("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),r("rtlMoveVisually",!w),r("wholeLineUpdateBefore",!0),r("theme","default",(function(e){xa(e),gi(e)}),!0),r("keyMap","default",(function(e,t,r){var n=Yo(t),i=r!=ka&&Yo(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)})),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Ta,!0),r("gutters",[],(function(e,t){e.display.gutterSpecs=hi(t,e.options.lineNumbers),gi(e)}),!0),r("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?an(e.display)+"px":"0",e.refresh()}),!0),r("coverGutterNextToScrollbar",!1,(function(e){return jn(e)}),!0),r("scrollbarStyle","native",(function(e){Gn(e),jn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),r("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=hi(e.options.gutters,t),gi(e)}),!0),r("firstLineNumber",1,gi,!0),r("lineNumberFormatter",(function(e){return e}),gi,!0),r("showCursorWhenSelecting",!1,mn,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,(function(e,t){"nocursor"==t&&(Ln(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),r("screenReaderLabel",null,(function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)})),r("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),r("dragDrop",!0,La),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,mn,!0),r("singleCursorHeightPerLine",!0,mn,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Di,!0),r("addModeClass",!1,Di,!0),r("pollInterval",100),r("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),r("historyEventDelay",1250),r("viewportMargin",10,(function(e){return e.refresh()}),!0),r("maxHighlightLength",1e4,Di,!0),r("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),r("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),r("autofocus",null),r("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),r("phrases",null)}(Ma),function(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,r){var n=this.options,i=n[e];n[e]==r&&"mode"!=e||(n[e]=r,t.hasOwnProperty(e)&&ei(this,t[e])(this,r,i),pe(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Yo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:ti((function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");!function(e,t,r){for(var n=0,i=r(t);n<e.length&&r(e[n])<=i;)n++;e.splice(n,0,t)}(this.state.overlays,{mode:n,modeSpec:t,opaque:r&&r.opaque,priority:r&&r.priority||0},(function(e){return e.priority})),this.state.modeGen++,dn(this)})),removeOverlay:ti((function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void dn(this)}})),indentLine:ti((function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),Qe(this.doc,e)&&Aa(this,e,t,r)})),indentSelection:ti((function(e){for(var t=this.doc.sel.ranges,r=-1,n=0;n<t.length;n++){var i=t[n];if(i.empty())i.head.line>r&&(Aa(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&Dn(this));else{var o=i.from(),a=i.to(),l=Math.max(r,o.line);r=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=l;s<r;++s)Aa(this,s,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[n].from().ch>0&&Yi(this.doc,n,new Ci(o,c[n].to()),V)}}})),getTokenAt:function(e,t){return yt(this,e,t)},getLineTokens:function(e,t){return yt(this,et(e),t,!0)},getTokenTypeAt:function(e){e=lt(this.doc,e);var t,r=ft(this,_e(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var a=n+i>>1;if((a?r[2*a-1]:0)>=o)i=a;else{if(!(r[2*a+1]<o)){t=r[2*a+2];break}n=a+1}}var l=t?t.indexOf("overlay "):-1;return l<0?t:0==l?null:t.slice(0,l-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!r.hasOwnProperty(t))return n;var i=r[t],o=this.getModeAt(e);if("string"==typeof o[t])i[o[t]]&&n.push(i[o[t]]);else if(o[t])for(var a=0;a<o[t].length;a++){var l=i[o[t][a]];l&&n.push(l)}else o.helperType&&i[o.helperType]?n.push(i[o.helperType]):i[o.name]&&n.push(i[o.name]);for(var s=0;s<i._global.length;s++){var c=i._global[s];c.pred(o,this)&&-1==R(n,c.val)&&n.push(c.val)}return n},getStateAfter:function(e,t){var r=this.doc;return ht(this,(e=at(r,null==e?r.first+r.size-1:e))+1,t).state},cursorCoords:function(e,t){var r=this.doc.sel.primary();return _r(this,null==e?r.head:"object"==typeof e?lt(this.doc,e):e?r.from():r.to(),t||"page")},charCoords:function(e,t){return Ur(this,lt(this.doc,e),t||"page")},coordsChar:function(e,t){return Xr(this,(e=Gr(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Gr(this,{top:e,left:0},t||"page").top,Ze(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,r){var n,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),n=_e(this.doc,e)}else n=e;return Kr(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-Kt(n):0)},defaultTextHeight:function(){return rn(this.display)},defaultCharWidth:function(){return nn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o,a,l,s=this.display,c=(e=_r(this,lt(this.doc,e))).bottom,u=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),s.sizer.appendChild(t),"over"==n)c=e.top;else if("above"==n||"near"==n){var d=Math.max(s.wrapper.clientHeight,this.doc.height),f=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>d)&&e.top>t.offsetHeight?c=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=d&&(c=e.bottom),u+t.offsetWidth>f&&(u=f-t.offsetWidth)}t.style.top=c+"px",t.style.left=t.style.right="","right"==i?(u=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?u=0:"middle"==i&&(u=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),r&&(o=this,a={left:u,top:c,right:u+t.offsetWidth,bottom:c+t.offsetHeight},null!=(l=An(o,a)).scrollTop&&Fn(o,l.scrollTop),null!=l.scrollLeft&&En(o,l.scrollLeft))},triggerOnKeyDown:ti(ua),triggerOnKeyPress:ti(fa),triggerOnKeyUp:da,triggerOnMouseDown:ti(ma),execCommand:function(e){if(ta.hasOwnProperty(e))return ta[e].call(null,this)},triggerElectric:ti((function(e){Pa(this,e)})),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=lt(this.doc,e),a=0;a<t&&!(o=Ia(this.doc,o,i,r,n)).hitSide;++a);return o},moveH:ti((function(e,t){var r=this;this.extendSelectionsBy((function(n){return r.display.shift||r.doc.extend||n.empty()?Ia(r.doc,n.head,e,t,r.options.rtlMoveVisually):e<0?n.from():n.to()}),G)})),deleteH:ti((function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Zo(this,(function(r){var i=Ia(n,r.head,e,t,!1);return e<0?{from:i,to:r.head}:{from:r.head,to:i}}))})),findPosV:function(e,t,r,n){var i=1,o=n;t<0&&(i=-1,t=-t);for(var a=lt(this.doc,e),l=0;l<t;++l){var s=_r(this,a,"div");if(null==o?o=s.left:s.left=o,(a=Ba(this,s,i,r)).hitSide)break}return a},moveV:ti((function(e,t){var r=this,n=this.doc,i=[],o=!this.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy((function(a){if(o)return e<0?a.from():a.to();var l=_r(r,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left);var s=Ba(r,l,e,t);return"page"==t&&a==n.sel.primary()&&On(r,Ur(r,s,"div").top-l.top),s}),G),i.length)for(var a=0;a<n.sel.ranges.length;a++)n.sel.ranges[a].goalColumn=i[a]})),findWordAt:function(e){var t=_e(this.doc,e.line).text,r=e.ch,n=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&n!=t.length||!r?++n:--r;for(var o=t.charAt(r),a=ee(o,i)?function(e){return ee(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!ee(e)};r>0&&a(t.charAt(r-1));)--r;for(;n<t.length&&a(t.charAt(n));)++n}return new Ci(et(e.line,r),et(e.line,n))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?W(this.display.cursorDiv,"CodeMirror-overwrite"):T(this.display.cursorDiv,"CodeMirror-overwrite"),pe(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==z()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ti((function(e,t){zn(this,e,t)})),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Lr(this)-this.display.barHeight,width:e.scrollWidth-Lr(this)-this.display.barWidth,clientHeight:Mr(this),clientWidth:Tr(this)}},scrollIntoView:ti((function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:et(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?function(e,t){Wn(e),e.curOp.scrollToPos=t}(this,e):Pn(this,e.from,e.to,e.margin)})),setSize:ti((function(e,t){var r=this,n=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&Ir(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,(function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){fn(r,i,"widget");break}++i})),this.curOp.forceUpdate=!0,pe(this,"refresh",this)})),operation:function(e){return Jn(this,e)},startOperation:function(){return _n(this)},endOperation:function(){return qn(this)},refresh:ti((function(){var e=this.display.cachedTextHeight;dn(this),this.curOp.forceUpdate=!0,Br(this),zn(this,this.doc.scrollLeft,this.doc.scrollTop),ci(this.display),(null==e||Math.abs(e-rn(this.display))>.5||this.options.lineWrapping)&&sn(this),pe(this,"refresh",this)})),swapDoc:ti((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Fi(this,e),Br(this),this.display.input.reset(),zn(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,lr(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ye(e),e.registerHelper=function(t,n,i){r.hasOwnProperty(t)||(r[t]=e[t]={_global:[]}),r[t][n]=i},e.registerGlobalHelper=function(t,n,i,o){e.registerHelper(t,n,o),r[t]._global.push({pred:i,val:o})}}(Ma);var _a="iter insert remove copy getEditor constructor".split(" ");for(var qa in Do.prototype)Do.prototype.hasOwnProperty(qa)&&R(_a,qa)<0&&(Ma.prototype[qa]=function(e){return function(){return e.apply(this.doc,arguments)}}(Do.prototype[qa]));return ye(Do),Ma.inputStyles={textarea:Ua,contenteditable:Ra},Ma.defineMode=function(e){Ma.defaults.mode||"null"==e||(Ma.defaults.mode=e),Ee.apply(this,arguments)},Ma.defineMIME=function(e,t){He[e]=t},Ma.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),Ma.defineMIME("text/plain","null"),Ma.defineExtension=function(e,t){Ma.prototype[e]=t},Ma.defineDocExtension=function(e,t){Do.prototype[e]=t},Ma.fromTextArea=function(e,t){if((t=t?E(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var r=z();t.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}function n(){e.value=l.getValue()}var i;if(e.form&&(de(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var a=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=a}}catch(e){}}t.finishInit=function(r){r.save=n,r.getTextArea=function(){return e},r.toTextArea=function(){r.toTextArea=isNaN,n(),e.parentNode.removeChild(r.getWrapperElement()),e.style.display="",e.form&&(he(e.form,"submit",n),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=i))}},e.style.display="none";var l=Ma((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return l},function(e){e.off=he,e.on=de,e.wheelEventPixels=wi,e.Doc=Do,e.splitLines=De,e.countColumn=I,e.findColumn=U,e.isWordChar=J,e.Pass=j,e.signal=pe,e.Line=_t,e.changeEnd=Ti,e.scrollbarModel=Kn,e.Pos=et,e.cmpPos=tt,e.modes=Fe,e.mimeModes=He,e.resolveMode=Ie,e.getMode=Be,e.modeExtensions=Re,e.extendMode=je,e.copyState=Ve,e.startState=Ge,e.innerMode=Ke,e.commands=ta,e.keyMap=Ko,e.keyName=Xo,e.isModifierKey=qo,e.lookupKey=_o,e.normalizeKeyMap=Uo,e.StringStream=Ue,e.SharedTextMarker=Mo,e.TextMarker=Lo,e.LineWidget=ko,e.e_preventDefault=be,e.e_stopPropagation=we,e.e_stop=ke,e.addClass=W,e.contains=D,e.rmClass=T,e.keyNames=Bo}(Ma),Ma.version="5.58.1",Ma}()},ewDg:function(e,t,r){!function(e){"use strict";function t(e){for(var t={},r=0;r<e.length;++r)t[e[r].toLowerCase()]=!0;return t}e.defineMode("css",(function(t,r){var n=r.inline;r.propertyKeywords||(r=e.resolveMode("text/css"));var i,o,a=t.indentUnit,l=r.tokenHooks,s=r.documentTypes||{},c=r.mediaTypes||{},u=r.mediaFeatures||{},d=r.mediaValueKeywords||{},f=r.propertyKeywords||{},h=r.nonStandardPropertyKeywords||{},p=r.fontProperties||{},g=r.counterDescriptors||{},m=r.colorKeywords||{},v=r.valueKeywords||{},y=r.allowNested,b=r.lineComment,w=!0===r.supportsAtComponent;function x(e,t){return i=t,e}function k(e,t){var r=e.next();if(l[r]){var n=l[r](e,t);if(!1!==n)return n}return"@"==r?(e.eatWhile(/[\w\\\-]/),x("def",e.current())):"="==r||("~"==r||"|"==r)&&e.eat("=")?x(null,"compare"):'"'==r||"'"==r?(t.tokenize=C(r),t.tokenize(e,t)):"#"==r?(e.eatWhile(/[\w\\\-]/),x("atom","hash")):"!"==r?(e.match(/^\s*\w*/),x("keyword","important")):/\d/.test(r)||"."==r&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),x("number","unit")):"-"!==r?/[,+>*\/]/.test(r)?x(null,"select-op"):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?x("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?x(null,r):e.match(/[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/.test(e.current().toLowerCase())&&(t.tokenize=S),x("variable callee","variable")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),x("property","word")):x(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),x("number","unit")):e.match(/^-[\w\\\-]*/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?x("variable-2","variable-definition"):x("variable-2","variable")):e.match(/^\w+-/)?x("meta","meta"):void 0}function C(e){return function(t,r){for(var n,i=!1;null!=(n=t.next());){if(n==e&&!i){")"==e&&t.backUp(1);break}i=!i&&"\\"==n}return(n==e||!i&&")"!=e)&&(r.tokenize=null),x("string","string")}}function S(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=C(")"),x(null,"(")}function L(e,t,r){this.type=e,this.indent=t,this.prev=r}function T(e,t,r,n){return e.context=new L(r,t.indentation()+(!1===n?0:a),e.context),r}function M(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function N(e,t,r){return D[r.context.type](e,t,r)}function A(e,t,r,n){for(var i=n||1;i>0;i--)r.context=r.context.prev;return N(e,t,r)}function O(e){var t=e.current().toLowerCase();o=v.hasOwnProperty(t)?"atom":m.hasOwnProperty(t)?"keyword":"variable"}var D={top:function(e,t,r){if("{"==e)return T(r,t,"block");if("}"==e&&r.context.prev)return M(r);if(w&&/@component/i.test(e))return T(r,t,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return T(r,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return T(r,t,"atBlock");if(/^@(font-face|counter-style)/i.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return T(r,t,"at");if("hash"==e)o="builtin";else if("word"==e)o="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return T(r,t,"interpolation");if(":"==e)return"pseudo";if(y&&"("==e)return T(r,t,"parens")}return r.context.type},block:function(e,t,r){if("word"==e){var n=t.current().toLowerCase();return f.hasOwnProperty(n)?(o="property","maybeprop"):h.hasOwnProperty(n)?(o="string-2","maybeprop"):y?(o=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(o+=" error","maybeprop")}return"meta"==e?"block":y||"hash"!=e&&"qualifier"!=e?D.top(e,t,r):(o="error","block")},maybeprop:function(e,t,r){return":"==e?T(r,t,"prop"):N(e,t,r)},prop:function(e,t,r){if(";"==e)return M(r);if("{"==e&&y)return T(r,t,"propBlock");if("}"==e||"{"==e)return A(e,t,r);if("("==e)return T(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if("word"==e)O(t);else if("interpolation"==e)return T(r,t,"interpolation")}else o+=" error";return"prop"},propBlock:function(e,t,r){return"}"==e?M(r):"word"==e?(o="property","maybeprop"):r.context.type},parens:function(e,t,r){return"{"==e||"}"==e?A(e,t,r):")"==e?M(r):"("==e?T(r,t,"parens"):"interpolation"==e?T(r,t,"interpolation"):("word"==e&&O(t),"parens")},pseudo:function(e,t,r){return"meta"==e?"pseudo":"word"==e?(o="variable-3",r.context.type):N(e,t,r)},documentTypes:function(e,t,r){return"word"==e&&s.hasOwnProperty(t.current())?(o="tag",r.context.type):D.atBlock(e,t,r)},atBlock:function(e,t,r){if("("==e)return T(r,t,"atBlock_parens");if("}"==e||";"==e)return A(e,t,r);if("{"==e)return M(r)&&T(r,t,y?"block":"top");if("interpolation"==e)return T(r,t,"interpolation");if("word"==e){var n=t.current().toLowerCase();o="only"==n||"not"==n||"and"==n||"or"==n?"keyword":c.hasOwnProperty(n)?"attribute":u.hasOwnProperty(n)?"property":d.hasOwnProperty(n)?"keyword":f.hasOwnProperty(n)?"property":h.hasOwnProperty(n)?"string-2":v.hasOwnProperty(n)?"atom":m.hasOwnProperty(n)?"keyword":"error"}return r.context.type},atComponentBlock:function(e,t,r){return"}"==e?A(e,t,r):"{"==e?M(r)&&T(r,t,y?"block":"top",!1):("word"==e&&(o="error"),r.context.type)},atBlock_parens:function(e,t,r){return")"==e?M(r):"{"==e||"}"==e?A(e,t,r,2):D.atBlock(e,t,r)},restricted_atBlock_before:function(e,t,r){return"{"==e?T(r,t,"restricted_atBlock"):"word"==e&&"@counter-style"==r.stateArg?(o="variable","restricted_atBlock_before"):N(e,t,r)},restricted_atBlock:function(e,t,r){return"}"==e?(r.stateArg=null,M(r)):"word"==e?(o="@font-face"==r.stateArg&&!p.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==r.stateArg&&!g.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},keyframes:function(e,t,r){return"word"==e?(o="variable","keyframes"):"{"==e?T(r,t,"top"):N(e,t,r)},at:function(e,t,r){return";"==e?M(r):"{"==e||"}"==e?A(e,t,r):("word"==e?o="tag":"hash"==e&&(o="builtin"),"at")},interpolation:function(e,t,r){return"}"==e?M(r):"{"==e||";"==e?A(e,t,r):("word"==e?o="variable":"variable"!=e&&"("!=e&&")"!=e&&(o="error"),"interpolation")}};return{startState:function(e){return{tokenize:null,state:n?"block":"top",stateArg:null,context:new L(n?"block":"top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||k)(e,t);return r&&"object"==typeof r&&(i=r[1],r=r[0]),o=r,"comment"!=i&&(t.state=D[t.state](i,e,t)),o},indent:function(e,t){var r=e.context,n=t&&t.charAt(0),i=r.indent;return"prop"!=r.type||"}"!=n&&")"!=n||(r=r.prev),r.prev&&("}"!=n||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"restricted_atBlock"!=r.type?(")"!=n||"parens"!=r.type&&"atBlock_parens"!=r.type)&&("{"!=n||"at"!=r.type&&"atBlock"!=r.type)||(i=Math.max(0,r.indent-a)):i=(r=r.prev).indent),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:b,fold:"brace"}}));var r=["domain","regexp","url","url-prefix"],n=t(r),i=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],o=t(i),a=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover","prefers-color-scheme"],l=t(a),s=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive","dark","light"],c=t(s),u=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","all","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","binding","bleed","block-size","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","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","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","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","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","inset","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","left","letter-spacing","line-break","line-height","line-height-step","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","place-content","place-items","place-self","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotate","rotation","rotation-point","row-gap","ruby-align","ruby-overhang","ruby-position","ruby-span","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-type","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-orientation","text-outline","text-overflow","text-rendering","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","touch-action","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-select","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","paint-order","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],d=t(u),f=["border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","margin-block","margin-block-end","margin-block-start","margin-inline","margin-inline-end","margin-inline-start","padding-block","padding-block-end","padding-block-start","padding-inline","padding-inline-end","padding-inline-start","scroll-snap-stop","scrollbar-3d-light-color","scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-track-color","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","shape-inside","zoom"],h=t(f),p=t(["font-display","font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]),g=t(["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"]),m=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],v=t(m),y=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","manipulation","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiple_mask_images","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","opacity","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","square-button","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],b=t(y),w=r.concat(i).concat(a).concat(s).concat(u).concat(f).concat(m).concat(y);function x(e,t){for(var r,n=!1;null!=(r=e.next());){if(n&&"/"==r){t.tokenize=null;break}n="*"==r}return["comment","comment"]}e.registerHelper("hintWords","css",w),e.defineMIME("text/css",{documentTypes:n,mediaTypes:o,mediaFeatures:l,mediaValueKeywords:c,propertyKeywords:d,nonStandardPropertyKeywords:h,fontProperties:p,counterDescriptors:g,colorKeywords:v,valueKeywords:b,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=x,x(e,t))}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:o,mediaFeatures:l,mediaValueKeywords:c,propertyKeywords:d,nonStandardPropertyKeywords:h,colorKeywords:v,valueKeywords:b,fontProperties:p,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=x,x(e,t)):["operator","operator"]},":":function(e){return!!e.match(/\s*\{/,!1)&&[null,null]},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return!!e.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:o,mediaFeatures:l,mediaValueKeywords:c,propertyKeywords:d,nonStandardPropertyKeywords:h,colorKeywords:v,valueKeywords:b,fontProperties:p,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=x,x(e,t)):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:!e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i,!1)&&(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),e.defineMIME("text/x-gss",{documentTypes:n,mediaTypes:o,mediaFeatures:l,propertyKeywords:d,nonStandardPropertyKeywords:h,fontProperties:p,counterDescriptors:g,colorKeywords:v,valueKeywords:b,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=x,x(e,t))}},name:"css",helperType:"gss"})}(r("VrN/"))},jDMi:function(e,t,r){!function(e){var t=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),r=e.Pos,n={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function i(e){return e&&e.bracketRegex||/[(){}[\]]/}function o(e,t,o){var l=e.getLineHandle(t.line),s=t.ch-1,c=o&&o.afterCursor;null==c&&(c=/(^| )cm-fat-cursor($| )/.test(e.getWrapperElement().className));var u=i(o),d=!c&&s>=0&&u.test(l.text.charAt(s))&&n[l.text.charAt(s)]||u.test(l.text.charAt(s+1))&&n[l.text.charAt(++s)];if(!d)return null;var f=">"==d.charAt(1)?1:-1;if(o&&o.strict&&f>0!=(s==t.ch))return null;var h=e.getTokenTypeAt(r(t.line,s+1)),p=a(e,r(t.line,s+(f>0?1:0)),f,h||null,o);return null==p?null:{from:r(t.line,s),to:p&&p.pos,match:p&&p.ch==d.charAt(0),forward:f>0}}function a(e,t,o,a,l){for(var s=l&&l.maxScanLineLength||1e4,c=l&&l.maxScanLines||1e3,u=[],d=i(l),f=o>0?Math.min(t.line+c,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-c),h=t.line;h!=f;h+=o){var p=e.getLine(h);if(p){var g=o>0?0:p.length-1,m=o>0?p.length:-1;if(!(p.length>s))for(h==t.line&&(g=t.ch-(o<0?1:0));g!=m;g+=o){var v=p.charAt(g);if(d.test(v)&&(void 0===a||e.getTokenTypeAt(r(h,g+1))==a)){var y=n[v];if(y&&">"==y.charAt(1)==o>0)u.push(v);else{if(!u.length)return{pos:r(h,g),ch:v};u.pop()}}}}}return h-o!=(o>0?e.lastLine():e.firstLine())&&null}function l(e,n,i){for(var a=e.state.matchBrackets.maxHighlightLineLength||1e3,l=[],s=e.listSelections(),c=0;c<s.length;c++){var u=s[c].empty()&&o(e,s[c].head,i);if(u&&e.getLine(u.from.line).length<=a){var d=u.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";l.push(e.markText(u.from,r(u.from.line,u.from.ch+1),{className:d})),u.to&&e.getLine(u.to.line).length<=a&&l.push(e.markText(u.to,r(u.to.line,u.to.ch+1),{className:d}))}}if(l.length){t&&e.state.focused&&e.focus();var f=function(){e.operation((function(){for(var e=0;e<l.length;e++)l[e].clear()}))};if(!n)return f;setTimeout(f,800)}}function s(e){e.operation((function(){e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null),e.state.matchBrackets.currentlyHighlighted=l(e,!1,e.state.matchBrackets)}))}e.defineOption("matchBrackets",!1,(function(t,r,n){function i(e){e.state.matchBrackets&&e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null)}n&&n!=e.Init&&(t.off("cursorActivity",s),t.off("focus",s),t.off("blur",i),i(t)),r&&(t.state.matchBrackets="object"==typeof r?r:{},t.on("cursorActivity",s),t.on("focus",s),t.on("blur",i))})),e.defineExtension("matchBrackets",(function(){l(this,!0)})),e.defineExtension("findMatchingBracket",(function(e,t,r){return(r||"boolean"==typeof t)&&(r?(r.strict=t,t=r):t=t?{strict:!0}:null),o(this,e,t)})),e.defineExtension("scanForBracket",(function(e,t,r,n){return a(this,e,t,r,n)}))}(r("VrN/"))},"jwo+":function(e,t,r){!function(e){"use strict";function t(e){e.state.tagHit&&e.state.tagHit.clear(),e.state.tagOther&&e.state.tagOther.clear(),e.state.tagHit=e.state.tagOther=null}function r(r){r.state.failedTagMatch=!1,r.operation((function(){if(t(r),!r.somethingSelected()){var n=r.getCursor(),i=r.getViewport();i.from=Math.min(i.from,n.line),i.to=Math.max(n.line+1,i.to);var o=e.findMatchingTag(r,n,i);if(o){if(r.state.matchBothTags){var a="open"==o.at?o.open:o.close;a&&(r.state.tagHit=r.markText(a.from,a.to,{className:"CodeMirror-matchingtag"}))}var l="close"==o.at?o.open:o.close;l?r.state.tagOther=r.markText(l.from,l.to,{className:"CodeMirror-matchingtag"}):r.state.failedTagMatch=!0}}}))}function n(e){e.state.failedTagMatch&&r(e)}e.defineOption("matchTags",!1,(function(i,o,a){a&&a!=e.Init&&(i.off("cursorActivity",r),i.off("viewportChange",n),t(i)),o&&(i.state.matchBothTags="object"==typeof o&&o.bothTags,i.on("cursorActivity",r),i.on("viewportChange",n),r(i))})),e.commands.toMatchingTag=function(t){var r=e.findMatchingTag(t,t.getCursor());if(r){var n="close"==r.at?r.open:r.close;n&&t.extendSelection(n.to,n.from)}}}(r("VrN/"),r("osHv"))},osHv:function(e,t,r){!function(e){"use strict";var t=e.Pos;function r(e,t){return e.line-t.line||e.ch-t.ch}var n="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",i=new RegExp("<(/?)(["+n+"]["+n+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");function o(e,t,r,n){this.line=t,this.ch=r,this.cm=e,this.text=e.getLine(t),this.min=n?Math.max(n.from,e.firstLine()):e.firstLine(),this.max=n?Math.min(n.to-1,e.lastLine()):e.lastLine()}function a(e,r){var n=e.cm.getTokenTypeAt(t(e.line,r));return n&&/\btag\b/.test(n)}function l(e){if(!(e.line>=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function s(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function c(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(l(e))continue;return}if(a(e,t+1)){var r=e.text.lastIndexOf("/",t),n=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,n?"selfClose":"regular"}e.ch=t+1}}function u(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(s(e))continue;return}if(a(e,t+1)){i.lastIndex=t,e.ch=t;var r=i.exec(e.text);if(r&&r.index==t)return r}else e.ch=t}}function d(e){for(;;){i.lastIndex=e.ch;var t=i.exec(e.text);if(!t){if(l(e))continue;return}if(a(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}function f(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(s(e))continue;return}if(a(e,t+1)){var r=e.text.lastIndexOf("/",t),n=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,n?"selfClose":"regular"}e.ch=t}}function h(e,r){for(var n=[];;){var i,o=d(e),a=e.line,l=e.ch-(o?o[0].length:0);if(!o||!(i=c(e)))return;if("selfClose"!=i)if(o[1]){for(var s=n.length-1;s>=0;--s)if(n[s]==o[2]){n.length=s;break}if(s<0&&(!r||r==o[2]))return{tag:o[2],from:t(a,l),to:t(e.line,e.ch)}}else n.push(o[2])}}function p(e,r){for(var n=[];;){var i=f(e);if(!i)return;if("selfClose"!=i){var o=e.line,a=e.ch,l=u(e);if(!l)return;if(l[1])n.push(l[2]);else{for(var s=n.length-1;s>=0;--s)if(n[s]==l[2]){n.length=s;break}if(s<0&&(!r||r==l[2]))return{tag:l[2],from:t(e.line,e.ch),to:t(o,a)}}}else u(e)}}e.registerHelper("fold","xml",(function(e,n){for(var i=new o(e,n.line,0);;){var a=d(i);if(!a||i.line!=n.line)return;var l=c(i);if(!l)return;if(!a[1]&&"selfClose"!=l){var s=t(i.line,i.ch),u=h(i,a[2]);return u&&r(u.from,s)>0?{from:s,to:u.from}:null}}})),e.findMatchingTag=function(e,n,i){var a=new o(e,n.line,n.ch,i);if(-1!=a.text.indexOf(">")||-1!=a.text.indexOf("<")){var l=c(a),s=l&&t(a.line,a.ch),d=l&&u(a);if(l&&d&&!(r(a,n)>0)){var f={from:t(a.line,a.ch),to:s,tag:d[2]};return"selfClose"==l?{open:f,close:null,at:"open"}:d[1]?{open:p(a,d[2]),close:f,at:"close"}:{open:f,close:h(a=new o(e,s.line,s.ch,i),d[2]),at:"open"}}}},e.findEnclosingTag=function(e,t,r,n){for(var i=new o(e,t.line,t.ch,r);;){var a=p(i,n);if(!a)break;var l=h(new o(e,t.line,t.ch,r),a.tag);if(l)return{open:a,close:l}}},e.scanForClosingTag=function(e,t,r,n){return h(new o(e,t.line,t.ch,n?{from:0,to:n}:null),r)}}(r("VrN/"))}});
dist/js/plugins/codemirror/plugin.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=1)}({1:function(e,t,r){e.exports=r("NFo0")},NFo0:function(e,t){function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}tinymce.PluginManager.add("codemirror",(function(e,t){function o(){e.focus(),e.selection.collapse(!0);var o=function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?r(Object(o),!0).forEach((function(t){n(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}({},{width:800,height:500,fullscreen:!0}),c=[{text:"Ok",subtype:"primary",onclick:function(){document.querySelectorAll(".mce-container-body>iframe")[0].contentWindow.submit(),u.close()}},{text:"Cancel",onclick:"close"}],i={title:"HTML source code",url:t+"/source.html",width:o.width,height:o.width,resizable:!0,maximizable:!0,fullScreen:!0,saveCursorPosition:!1,buttons:c},u=e.windowManager.open(i);u.fullscreen(!0)}e.addButton("code",{title:"Source code",icon:"code",onclick:o}),e.addMenuItem("code",{icon:"code",text:"Source code",context:"tools",onclick:o})}))}});
dist/js/plugins/codemirror/source.html ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <link rel="stylesheet" href="code.css" />
5
+ <script>
6
+ var codeMirrorInstance, editor;
7
+ function submit() {
8
+ codeMirrorInstance && editor.setContent(codeMirrorInstance.getValue());
9
+ }
10
+ </script>
11
+ <script src="code.js"></script>
12
+ </head>
13
+ <body></body>
14
+ </html>
dist/js/plugins/fullpage.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){var t={};function n(l){if(t[l])return t[l].exports;var r=t[l]={i:l,l:!1,exports:{}};return e[l].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,l){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:l})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var l=Object.create(null);if(n.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(l,r,function(t){return e[t]}.bind(null,r));return l},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=3)}({"2kmj":function(e,t,n){"use strict";n.r(t);n("5FW9")},3:function(e,t,n){e.exports=n("2kmj")},"5FW9":function(e,t,n){n("a2iX")},a2iX:function(e,t){!function(){"use strict";var e=function(t){var n=t,l=function(){return n};return{get:l,set:function(e){n=e},clone:function(){return e(l())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.util.Tools"),l=tinymce.util.Tools.resolve("tinymce.html.DomParser"),r=tinymce.util.Tools.resolve("tinymce.html.Node"),i=tinymce.util.Tools.resolve("tinymce.html.Serializer"),o=function(e){return e.getParam("fullpage_hide_in_source_view")},a=function(e){return e.getParam("fullpage_default_xml_pi")},c=function(e){return e.getParam("fullpage_default_encoding")},u=function(e){return e.getParam("fullpage_default_font_family")},s=function(e){return e.getParam("fullpage_default_font_size")},d=function(e){return e.getParam("fullpage_default_text_color")},f=function(e){return e.getParam("fullpage_default_title")},m=function(e){return e.getParam("fullpage_default_doctype","<!DOCTYPE html>")},g=function(e){return l({validate:!1,root_name:"#document"}).parse(e)},p=g,y=function(e,t){var l,r,i=g(t),o={};function a(e,t){return e.attr(t)||""}return o.fontface=u(e),o.fontsize=s(e),7===(l=i.firstChild).type&&(o.xml_pi=!0,(r=/encoding="([^"]+)"/.exec(l.value))&&(o.docencoding=r[1])),(l=i.getAll("#doctype")[0])&&(o.doctype="<!DOCTYPE"+l.value+">"),(l=i.getAll("title")[0])&&l.firstChild&&(o.title=l.firstChild.value),n.each(i.getAll("meta"),(function(e){var t,n=e.attr("name"),l=e.attr("http-equiv");n?o[n.toLowerCase()]=e.attr("content"):"Content-Type"===l&&(t=/charset\s*=\s*(.*)\s*/gi.exec(e.attr("content")))&&(o.docencoding=t[1])})),(l=i.getAll("html")[0])&&(o.langcode=a(l,"lang")||a(l,"xml:lang")),o.stylesheets=[],n.each(i.getAll("link"),(function(e){"stylesheet"===e.attr("rel")&&o.stylesheets.push(e.attr("href"))})),(l=i.getAll("body")[0])&&(o.langdir=a(l,"dir"),o.style=a(l,"style"),o.visited_color=a(l,"vlink"),o.link_color=a(l,"link"),o.active_color=a(l,"alink")),o},h=function(e,t,l){var o,a,c,u,s,d=e.dom;function f(e,t,n){e.attr(t,n||void 0)}function m(e){a.firstChild?a.insert(e,a.firstChild):a.append(e)}o=g(l),(a=o.getAll("head")[0])||(u=o.getAll("html")[0],a=new r("head",1),u.firstChild?u.insert(a,u.firstChild,!0):u.append(a)),u=o.firstChild,t.xml_pi?(s='version="1.0"',t.docencoding&&(s+=' encoding="'+t.docencoding+'"'),7!==u.type&&(u=new r("xml",7),o.insert(u,o.firstChild,!0)),u.value=s):u&&7===u.type&&u.remove(),u=o.getAll("#doctype")[0],t.doctype?(u||(u=new r("#doctype",10),t.xml_pi?o.insert(u,o.firstChild):m(u)),u.value=t.doctype.substring(9,t.doctype.length-1)):u&&u.remove(),u=null,n.each(o.getAll("meta"),(function(e){"Content-Type"===e.attr("http-equiv")&&(u=e)})),t.docencoding?(u||((u=new r("meta",1)).attr("http-equiv","Content-Type"),u.shortEnded=!0,m(u)),u.attr("content","text/html; charset="+t.docencoding)):u&&u.remove(),u=o.getAll("title")[0],t.title?(u?u.empty():m(u=new r("title",1)),u.append(new r("#text",3)).value=t.title):u&&u.remove(),n.each("keywords,description,author,copyright,robots".split(","),(function(e){var n,l,i=o.getAll("meta"),a=t[e];for(n=0;n<i.length;n++)if((l=i[n]).attr("name")===e)return void(a?l.attr("content",a):l.remove());a&&((u=new r("meta",1)).attr("name",e),u.attr("content",a),u.shortEnded=!0,m(u))}));var p={};return n.each(o.getAll("link"),(function(e){"stylesheet"===e.attr("rel")&&(p[e.attr("href")]=e)})),n.each(t.stylesheets,(function(e){p[e]||((u=new r("link",1)).attr({rel:"stylesheet",text:"text/css",href:e}),u.shortEnded=!0,m(u)),delete p[e]})),n.each(p,(function(e){e.remove()})),(u=o.getAll("body")[0])&&(f(u,"dir",t.langdir),f(u,"style",t.style),f(u,"vlink",t.visited_color),f(u,"link",t.link_color),f(u,"alink",t.active_color),d.setAttribs(e.getBody(),{style:t.style,dir:t.dir,vLink:t.visited_color,link:t.link_color,aLink:t.active_color})),(u=o.getAll("html")[0])&&(f(u,"lang",t.langcode),f(u,"xml:lang",t.langcode)),a.firstChild||a.remove(),(c=i({validate:!1,indent:!0,apply_source_formatting:!0,indent_before:"head,html,body,meta,title,script,link,style",indent_after:"head,html,body,meta,title,script,link,style"}).serialize(o)).substring(0,c.indexOf("</body>"))},v=function(e,t){var l=y(e,t.get());e.windowManager.open({title:"Document properties",data:l,defaults:{type:"textbox",size:40},body:[{name:"title",label:"Title"},{name:"keywords",label:"Keywords"},{name:"description",label:"Description"},{name:"robots",label:"Robots"},{name:"author",label:"Author"},{name:"docencoding",label:"Encoding"}],onSubmit:function(r){var i=h(e,n.extend(l,r.data),t.get());t.set(i)}})},_=function(e,t){e.addCommand("mceFullPageProperties",(function(){v(e,t)}))},b=function(e,t){return n.each(e,(function(e){t=t.replace(e,(function(e){return"\x3c!--mce:protected "+escape(e)+"--\x3e"}))})),t},x=function(e){return e.replace(/<!--mce:protected ([\s\S]*?)-->/g,(function(e,t){return unescape(t)}))},k=n.each,C=function(e){return e.replace(/<\/?[A-Z]+/g,(function(e){return e.toLowerCase()}))},A=function(e){var t,n="",l="";if(a(e)){var r=c(e);n+='<?xml version="1.0" encoding="'+(r||"ISO-8859-1")+'" ?>\n'}return n+=m(e),n+="\n<html>\n<head>\n",(t=f(e))&&(n+="<title>"+t+"</title>\n"),(t=c(e))&&(n+='<meta http-equiv="Content-Type" content="text/html; charset='+t+'" />\n'),(t=u(e))&&(l+="font-family: "+t+";"),(t=s(e))&&(l+="font-size: "+t+";"),(t=d(e))&&(l+="color: "+t+";"),n+="</head>\n<body"+(l?' style="'+l+'"':"")+">\n"},P=function(e,t,l){e.on("BeforeSetContent",(function(r){!function(e,t,l,r){var i,a,c,u,s,d="",f=e.dom;if(!(r.selection||(c=b(e.settings.protect,r.content),"raw"===r.format&&t.get()||r.source_view&&o(e)))){0!==c.length||r.source_view||(c=n.trim(t.get())+"\n"+n.trim(c)+"\n"+n.trim(l.get())),-1!==(i=(c=c.replace(/<(\/?)BODY/gi,"<$1body")).indexOf("<body"))?(i=c.indexOf(">",i),t.set(C(c.substring(0,i+1))),-1===(a=c.indexOf("</body",i))&&(a=c.length),r.content=n.trim(c.substring(i+1,a)),l.set(C(c.substring(a)))):(t.set(A(e)),l.set("\n</body>\n</html>")),u=p(t.get()),k(u.getAll("style"),(function(e){e.firstChild&&(d+=e.firstChild.value)})),(s=u.getAll("body")[0])&&f.setAttribs(e.getBody(),{style:s.attr("style")||"",dir:s.attr("dir")||"",vLink:s.attr("vlink")||"",link:s.attr("link")||"",aLink:s.attr("alink")||""}),f.remove("fullpage_styles");var m=e.getDoc().getElementsByTagName("head")[0];d&&(f.add(m,"style",{id:"fullpage_styles"},d),(s=f.get("fullpage_styles")).styleSheet&&(s.styleSheet.cssText=d));var g={};n.each(m.getElementsByTagName("link"),(function(e){"stylesheet"===e.rel&&e.getAttribute("data-mce-fullpage")&&(g[e.href]=e)})),n.each(u.getAll("link"),(function(e){var t=e.attr("href");if(!t)return!0;g[t]||"stylesheet"!==e.attr("rel")||f.add(m,"link",{rel:"stylesheet",text:"text/css",href:t,"data-mce-fullpage":"1"}),delete g[t]})),n.each(g,(function(e){e.parentNode.removeChild(e)}))}}(e,t,l,r)})),e.on("GetContent",(function(r){!function(e,t,l,r){r.selection||r.source_view&&o(e)||(r.content=x(n.trim(t)+"\n"+n.trim(r.content)+"\n"+n.trim(l)))}(e,t.get(),l.get(),r)}))},w=function(e){e.addButton("fullpage",{title:"Document properties",cmd:"mceFullPageProperties"}),e.addMenuItem("fullpage",{text:"Document properties",cmd:"mceFullPageProperties",context:"file"})};t.add("fullpage",(function(t){var n=e(""),l=e("");_(t,n),w(t),P(t,n,l)}))}()}});
dist/mix-manifest.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "/js/admin.js": "/js/admin.js?id=1f9d48fec8187d384ca4",
3
+ "/css/wpbe.css": "/css/wpbe.css?id=b1978b22a98892621385",
4
+ "/js/plugins/codemirror/code.css": "/js/plugins/codemirror/code.css?id=5ba0c58006d1fab76a50",
5
+ "/js/plugins/codemirror/code.js": "/js/plugins/codemirror/code.js?id=2964a2352ccb85588d79",
6
+ "/js/plugins/codemirror/plugin.js": "/js/plugins/codemirror/plugin.js?id=df5927faecd4837b5e55",
7
+ "/js/plugins/fullpage.js": "/js/plugins/fullpage.js?id=a4cc33b397cb22d6e160",
8
+ "/js/plugins/codemirror/source.html": "/js/plugins/codemirror/source.html?id=353a2ea6ecc94494c0fd"
9
+ }
package.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "wp-better-emails",
3
+ "version": "1.0.0",
4
+ "description": "=== WP Better Emails === Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=7Q49VJQNRCQ8E&lc=FR&item_name=ArtyShow&item_number=wp%2dbetter%2demails&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted Tags: email, emails, html emails, templates, notification, wp_mail, wpmu, multisite, html template Requires at least: 2.8 Tested up to: 4.4.1 Stable tag: 0.3",
5
+ "main": "index.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/nlemoine/wp-better-emails.git"
9
+ },
10
+ "author": "",
11
+ "license": "ISC",
12
+ "bugs": {
13
+ "url": "https://github.com/nlemoine/wp-better-emails/issues"
14
+ },
15
+ "homepage": "https://github.com/nlemoine/wp-better-emails#readme",
16
+ "dependencies": {
17
+ "codemirror": "^5.58.1",
18
+ "laravel-mix": "^5.0.5",
19
+ "tinymce": "4-latest",
20
+ "tinymce-codemirror": "git+https://gitlab.com/tinymce-plugins/tinymce-codemirror.git#master"
21
+ },
22
+ "scripts": {
23
+ "dev": "npm run development",
24
+ "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
25
+ "watch": "npm run development -- --watch",
26
+ "watch-poll": "npm run watch -- --watch-poll",
27
+ "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
28
+ "prod": "npm run production",
29
+ "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
30
+ },
31
+ "devDependencies": {
32
+ "cross-env": "^7.0.2",
33
+ "resolve-url-loader": "^3.1.1",
34
+ "rimraf": "^3.0.2",
35
+ "sass": "^1.26.11",
36
+ "sass-loader": "^10.0.2",
37
+ "vue-template-compiler": "^2.6.12"
38
+ }
39
+ }
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === WP Better Emails ===
2
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=7Q49VJQNRCQ8E&lc=FR&item_name=ArtyShow&item_number=wp%2dbetter%2demails&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
3
- Tags: email, emails, email template, email templates, emails templates, html template, html emails, html template, templates, notification, wp_mail, wpmu, multisite, wpmandrill, mandrill, wordpress email, worpress email template
4
- Requires at least: 2.8
5
- Tested up to: 4.8
6
- Stable tag: 0.3
7
 
8
- Adds a customizable good looking HTML email template to all WP default text/plain emails and lets you set
9
  a custom sender name and email address.
10
 
11
  == Description ==
@@ -152,6 +152,12 @@ You can place this function in your functions.php theme file or in a plugin.
152
 
153
  == Changelog ==
154
 
 
 
 
 
 
 
155
  = 0.3 =
156
 
157
  * Add proper multisite support: options are saved network wide
1
  === WP Better Emails ===
2
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=7Q49VJQNRCQ8E&lc=FR&item_name=wp-better-emails&item_number=wp%2dbetter%2demails&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
3
+ Tags: email, emails, html emails, templates, notification, wp_mail, wpmu, multisite, html template
4
+ Requires at least: 4.8
5
+ Tested up to: 5.5.1
6
+ Stable tag: 0.4
7
 
8
+ Adds a customizable good looking HTML template to all WP default text/plain emails and lets you set
9
  a custom sender name and email address.
10
 
11
  == Description ==
152
 
153
  == Changelog ==
154
 
155
+ = 0.4 =
156
+
157
+ * Fix deprecation notices
158
+ * Fix TinyMCE plugins
159
+ * Remove live preview
160
+
161
  = 0.3 =
162
 
163
  * Add proper multisite support: options are saved network wide
templates/template-1.html DELETED
@@ -1,60 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html;UTF-8" />
5
- </head>
6
- <body style="margin: 0px; background-color: #F4F3F4; font-family: Helvetica, Arial, sans-serif; font-size:12px;" text="#444444" bgcolor="#F4F3F4" link="#21759B" alink="#21759B" vlink="#21759B" marginheight="0" topmargin="0" marginwidth="0" leftmargin="0">
7
- <table cellpadding="0" cellspacing="0" width="100%" bgcolor="#F4F3F4" border="0">
8
- <tr>
9
- <td style="padding:15px;">
10
- <center>
11
- <table width="550" cellpadding="0" bgcolor="#ffffff" cellspacing="0">
12
- <tr>
13
- <td align="left">
14
- <div style="border:solid 1px #d9d9d9;">
15
- <table id="header" width="100%" border="0" cellpadding="0" bgcolor="#ffffff" cellspacing="0" style="line-height:1.6;font-size:12px;font-family: Helvetica, Arial, sans-serif;border:solid 1px #FFFFFF;color:#444;">
16
- <tr>
17
- <td colspan="2" background="%blog_url%/wp-admin/images/white-grad-active.png" height="30" style="color: #ffffff;" valign="bottom">.</td>
18
- </tr>
19
- <tr>
20
- <td style="line-height:32px;padding-left:30px;" valign="baseline"><span style="font-size:32px;"><a href="%blog_url%" style="text-decoration:none;" target="_blank">Wordpress 3.2.1</a></span></td>
21
- <td style="padding-right:30px;" align="right" valign="baseline"><span style="font-size:14px;color:#777777">Un site utilisant WordPress</span></td>
22
- </tr>
23
- </table>
24
- <table id="content" width="490" border="0" cellpadding="0" bgcolor="#ffffff" cellspacing="0" style="margin-top:15px;margin-right:30px; margin-left:30px;color:#444;line-height:1.6;font-size:12px;font-family: Arial, sans-serif;color: #444;">
25
- <tr>
26
- <td colspan="2" style="border-top: solid 1px #d9d9d9">
27
- <div style="padding:15px 0;">
28
- Hey !<br />
29
-
30
- <br />
31
- Das ist eine Test-E-Mail zur Vorschau Ihrer Design-Vorlage in HTML.<br />
32
- <br />
33
- Sollten Sie wenig Erfahrung mit HTML/CSS-Codes haben, empfehle ich Ihnen, die Standard-Einstellungen der Design-Vorlage beizubehalten. Es wurde in gebräuchlichen E-Mail-Anwendungen getestet. Zum Beispiel: Gmail, Yahoo Mail, Hotmail/Live, Thunderbird, Apple Mail, Outlook und viele andere.<br />
34
- <br />
35
- Sollten bei Ihnen Probleme auftreten oder haben Sie Verbesserungsvorschläge für das Plug-in? Kontaktieren Sie mich.
36
- </div>
37
- </td>
38
- </tr>
39
- </table>
40
- <table id="footer" width="490" border="0" cellpadding="0" bgcolor="#ffffff" cellspacing="0" style="line-height:1.5;font-size:12px;font-family: Arial, sans-serif;margin-right:30px;margin-left:30px;">
41
- <tr style="font-size:11px;color:#999999;">
42
- <td style="border-top: solid 1px #d9d9d9;" colspan="2">
43
- <div style="padding-top:15px; padding-bottom:1px;"><img height="13" width="13" style="vertical-align: middle;" src="%blog_url%/wp-admin/images/date-button.gif" alt="Datum" /> Email sent %date% @ %time%</div>
44
- <div><img height="12" width="12" style="vertical-align: middle;" src="%blog_url%/wp-admin/images/comment-grey-bubble.png" alt="Kontakt" /> For any requests, please contact <a href="mailto:plugins@artyshow-studio.fr">plugins@artyshow-studio.fr</a></div>
45
- </td>
46
- </tr>
47
- <tr>
48
- <td colspan="2" height="15" style="color: #ffffff;">.</td>
49
- </tr>
50
- </table>
51
- </div>
52
- </td>
53
- </tr>
54
- </table>
55
- </center>
56
- </td>
57
- </tr>
58
- </table>
59
- </body>
60
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/template-1.php DELETED
@@ -1,55 +0,0 @@
1
- <?php
2
- $template = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html>
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html;' . get_option('blog_charset') . '" />
6
- </head>
7
- <body style="margin: 0px; background-color: #F4F3F4; font-family: Helvetica, Arial, sans-serif; font-size:12px;" text="#444444" bgcolor="#F4F3F4" link="#21759B" alink="#21759B" vlink="#21759B" marginheight="0" topmargin="0" marginwidth="0" leftmargin="0">
8
- <table cellpadding="0" cellspacing="0" width="100%" bgcolor="#F4F3F4" border="0">
9
- <tr>
10
- <td style="padding:15px;">
11
- <center>
12
- <table width="550" cellpadding="0" bgcolor="#ffffff" cellspacing="0" align="center">
13
- <tr>
14
- <td align="left">
15
- <div style="border:solid 1px #d9d9d9;">
16
- <table id="header" width="100%" border="0" cellpadding="0" bgcolor="#ffffff" cellspacing="0" style="line-height:1.6;font-size:12px;font-family: Helvetica, Arial, sans-serif;border:solid 1px #FFFFFF;color:#444;">
17
- <tr>
18
- <td colspan="2" background="' . admin_url('images/white-grad-active.png') . '" height="30" style="color:#ffffff;" valign="bottom">.</td>
19
- </tr>
20
- <tr>
21
- <td style="line-height:32px;padding-left:30px;" valign="baseline"><span style="font-size:32px;"><a href="%blog_url%" style="text-decoration:none;" target="_blank">%blog_name%</a></span></td>
22
- <td style="padding-right:30px;" align="right" valign="baseline"><span style="font-size:14px;color:#777777">%blog_description%</span></td>
23
- </tr>
24
- </table>
25
- <table id="content" width="490" border="0" cellpadding="0" bgcolor="#ffffff" cellspacing="0" style="margin-top:15px;margin-right:30px; margin-left:30px;color:#444;line-height:1.6;font-size:12px;font-family: Arial, sans-serif;color: #444;">
26
- <tr>
27
- <td colspan="2" style="border-top: solid 1px #d9d9d9">
28
- <div style="padding:15px 0;">
29
- %content%
30
- </div>
31
- </td>
32
- </tr>
33
- </table>
34
- <table id="footer" width="490" border="0" cellpadding="0" bgcolor="#ffffff" cellspacing="0" style="line-height:1.5;font-size:12px;font-family: Arial, sans-serif;margin-right:30px;margin-left:30px;">
35
- <tr style="font-size:11px;color:#999999;">
36
- <td style="border-top: solid 1px #d9d9d9;" colspan="2">
37
- <div style="padding-top:15px; padding-bottom:1px;"><img height="13" width="13" style="vertical-align: middle;" src="' . admin_url('images/date-button.gif') . '" alt="' . esc_attr__('Date', 'wp-better-emails') . '" /> ' . esc_attr__('Email sent', 'wp-better-emails') . ' %date% @ %time%</div>
38
- <div><img height="12" width="12" style="vertical-align: middle;" src="' . admin_url('images/comment-grey-bubble.png') . '" alt="' . esc_attr__('Contact', 'wp-better-emails') . '" /> ' . __('For any requests, please contact', 'wp-better-emails') . ' <a href="mailto:%admin_email%">%admin_email%</a></div>
39
- </td>
40
- </tr>
41
- <tr>
42
- <td colspan="2" style="color:#ffffff;" height="15">.</td>
43
- </tr>
44
- </table>
45
- </div>
46
- </td>
47
- </tr>
48
- </table>
49
- </center>
50
- </td>
51
- </tr>
52
- </table>
53
- </body>
54
- </html>';
55
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/template.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $template = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html;' . get_option('blog_charset') . '" />
6
+ </head>
7
+ <body style="margin: 0px; background-color: #F4F3F4; font-family: Helvetica, Arial, sans-serif; font-size:12px;" text="#444444" bgcolor="#F4F3F4" link="#21759B" alink="#21759B" vlink="#21759B" marginheight="0" topmargin="0" marginwidth="0" leftmargin="0">
8
+ <table cellpadding="0" cellspacing="0" width="100%" bgcolor="#F4F3F4" border="0">
9
+ <tr>
10
+ <td style="padding:15px;">
11
+ <center>
12
+ <table width="550" cellpadding="0" bgcolor="#ffffff" cellspacing="0" align="center">
13
+ <tr>
14
+ <td align="left">
15
+ <div style="border:solid 1px #d9d9d9;">
16
+ <table id="header" width="100%" border="0" cellpadding="0" bgcolor="#ffffff" cellspacing="0" style="line-height:1.6;font-size:12px;font-family: Helvetica, Arial, sans-serif;border:solid 1px #FFFFFF;color:#444;">
17
+ <tr>
18
+ <td colspan="2" background="' . admin_url('images/white-grad-active.png') . '" height="30" style="color:#ffffff;" valign="bottom">.</td>
19
+ </tr>
20
+ <tr>
21
+ <td style="line-height:32px;padding-left:30px;" valign="baseline"><span style="font-size:32px;"><a href="%blog_url%" style="text-decoration:none;" target="_blank">%blog_name%</a></span></td>
22
+ <td style="padding-right:30px;" align="right" valign="baseline"><span style="font-size:14px;color:#777777">%blog_description%</span></td>
23
+ </tr>
24
+ </table>
25
+ <table id="content" width="490" border="0" cellpadding="0" bgcolor="#ffffff" cellspacing="0" style="margin-top:15px;margin-right:30px; margin-left:30px;color:#444;line-height:1.6;font-size:12px;font-family: Arial, sans-serif;color: #444;">
26
+ <tr>
27
+ <td colspan="2" style="border-top: solid 1px #d9d9d9">
28
+ <div style="padding:15px 0;">
29
+ %content%
30
+ </div>
31
+ </td>
32
+ </tr>
33
+ </table>
34
+ <table id="footer" width="490" border="0" cellpadding="0" bgcolor="#ffffff" cellspacing="0" style="line-height:1.5;font-size:12px;font-family: Arial, sans-serif;margin-right:30px;margin-left:30px;">
35
+ <tr style="font-size:11px;color:#999999;">
36
+ <td style="border-top: solid 1px #d9d9d9;" colspan="2">
37
+ <div style="padding-top:15px; padding-bottom:1px;"><span style="filter: grayscale(100%);">📆</span> ' . esc_attr__('Email sent', 'wp-better-emails') . ' %date% @ %time%</div>
38
+ <div><span style="filter: grayscale(100%);">ℹ️</span> ' . __('For any requests, please contact', 'wp-better-emails') . ' <a href="mailto:%admin_email%">%admin_email%</a></div>
39
+ </td>
40
+ </tr>
41
+ <tr>
42
+ <td colspan="2" style="color:#ffffff;" height="15">.</td>
43
+ </tr>
44
+ </table>
45
+ </div>
46
+ </td>
47
+ </tr>
48
+ </table>
49
+ </center>
50
+ </td>
51
+ </tr>
52
+ </table>
53
+ </body>
54
+ </html>';
55
+ ?>
tinymce-plugins/3.3.x/fullpage/css/fullpage.css DELETED
@@ -1,182 +0,0 @@
1
- /* Hide the advanced tab */
2
- #advanced_tab {
3
- display: none;
4
- }
5
-
6
- #metatitle, #metakeywords, #metadescription, #metaauthor, #metacopyright {
7
- width: 280px;
8
- }
9
-
10
- #doctype, #docencoding {
11
- width: 200px;
12
- }
13
-
14
- #langcode {
15
- width: 30px;
16
- }
17
-
18
- #bgimage {
19
- width: 220px;
20
- }
21
-
22
- #fontface {
23
- width: 240px;
24
- }
25
-
26
- #leftmargin, #rightmargin, #topmargin, #bottommargin {
27
- width: 50px;
28
- }
29
-
30
- .panel_wrapper div.current {
31
- height: 400px;
32
- }
33
-
34
- #stylesheet, #style {
35
- width: 240px;
36
- }
37
-
38
- /* Head list classes */
39
-
40
- .headlistwrapper {
41
- width: 100%;
42
- }
43
-
44
- .addbutton, .removebutton, .moveupbutton, .movedownbutton {
45
- border-top: 1px solid;
46
- border-left: 1px solid;
47
- border-bottom: 1px solid;
48
- border-right: 1px solid;
49
- border-color: #F0F0EE;
50
- cursor: default;
51
- display: block;
52
- width: 20px;
53
- height: 20px;
54
- }
55
-
56
- #doctypes {
57
- width: 200px;
58
- }
59
-
60
- .addbutton:hover, .removebutton:hover, .moveupbutton:hover, .movedownbutton:hover {
61
- border: 1px solid #0A246A;
62
- background-color: #B6BDD2;
63
- }
64
-
65
- .addbutton {
66
- background-image: url('../images/add.gif');
67
- float: left;
68
- margin-right: 3px;
69
- }
70
-
71
- .removebutton {
72
- background-image: url('../images/remove.gif');
73
- float: left;
74
- }
75
-
76
- .moveupbutton {
77
- background-image: url('../images/move_up.gif');
78
- float: left;
79
- margin-right: 3px;
80
- }
81
-
82
- .movedownbutton {
83
- background-image: url('../images/move_down.gif');
84
- float: left;
85
- }
86
-
87
- .selected {
88
- border: 1px solid #0A246A;
89
- background-color: #B6BDD2;
90
- }
91
-
92
- .toolbar {
93
- width: 100%;
94
- }
95
-
96
- #headlist {
97
- width: 100%;
98
- margin-top: 3px;
99
- font-size: 11px;
100
- }
101
-
102
- #info, #title_element, #meta_element, #script_element, #style_element, #base_element, #link_element, #comment_element, #unknown_element {
103
- display: none;
104
- }
105
-
106
- #addmenu {
107
- position: absolute;
108
- border: 1px solid gray;
109
- display: none;
110
- z-index: 100;
111
- background-color: white;
112
- }
113
-
114
- #addmenu a {
115
- display: block;
116
- width: 100%;
117
- line-height: 20px;
118
- text-decoration: none;
119
- background-color: white;
120
- }
121
-
122
- #addmenu a:hover {
123
- background-color: #B6BDD2;
124
- color: black;
125
- }
126
-
127
- #addmenu span {
128
- padding-left: 10px;
129
- padding-right: 10px;
130
- }
131
-
132
- #updateElementPanel {
133
- display: none;
134
- }
135
-
136
- #script_element .panel_wrapper div.current {
137
- height: 108px;
138
- }
139
-
140
- #style_element .panel_wrapper div.current {
141
- height: 108px;
142
- }
143
-
144
- #link_element .panel_wrapper div.current {
145
- height: 140px;
146
- }
147
-
148
- #element_script_value {
149
- width: 100%;
150
- height: 100px;
151
- }
152
-
153
- #element_comment_value {
154
- width: 100%;
155
- height: 120px;
156
- }
157
-
158
- #element_style_value {
159
- width: 100%;
160
- height: 100px;
161
- }
162
-
163
- #element_title, #element_script_src, #element_meta_name, #element_meta_content, #element_base_href, #element_link_href, #element_link_title {
164
- width: 250px;
165
- }
166
-
167
- .updateElementButton {
168
- margin-top: 3px;
169
- }
170
-
171
- /* MSIE specific styles */
172
-
173
- * html .addbutton, * html .removebutton, * html .moveupbutton, * html .movedownbutton {
174
- width: 22px;
175
- height: 22px;
176
- }
177
-
178
- textarea {
179
- height: 55px;
180
- }
181
-
182
- .panel_wrapper div.current {height:420px;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/3.3.x/fullpage/editor_plugin.js DELETED
@@ -1 +0,0 @@
1
- (function(){tinymce.create("tinymce.plugins.FullPagePlugin",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceFullPageProperties",function(){a.windowManager.open({file:b+"/fullpage.htm",width:430+parseInt(a.getLang("fullpage.delta_width",0)),height:495+parseInt(a.getLang("fullpage.delta_height",0)),inline:1},{plugin_url:b,head_html:c.head})});a.addButton("fullpage",{title:"fullpage.desc",cmd:"mceFullPageProperties"});a.onBeforeSetContent.add(c._setContent,c);a.onSetContent.add(c._setBodyAttribs,c);a.onGetContent.add(c._getContent,c)},getInfo:function(){return{longname:"Fullpage",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_setBodyAttribs:function(d,a){var l,c,e,g,b,h,j,f=this.head.match(/body(.*?)>/i);if(f&&f[1]){l=f[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);if(l){for(c=0,e=l.length;c<e;c++){g=l[c].split("=");b=g[0].replace(/\s/,"");h=g[1];if(h){h=h.replace(/^\s+/,"").replace(/\s+$/,"");j=h.match(/^["'](.*)["']$/);if(j){h=j[1]}}else{h=b}d.dom.setAttrib(d.getBody(),"style",h)}}}},_createSerializer:function(){return new tinymce.dom.Serializer({dom:this.editor.dom,apply_source_formatting:true})},_setContent:function(d,b){var i=this,a,l,f=b.content,h,j="";if(b.format=="raw"&&i.head){return}if(b.source_view&&d.getParam("fullpage_hide_in_source_view")){return}f=f.replace(/<(\/?)BODY/gi,"<$1body");a=f.indexOf("<body");if(a!=-1){a=f.indexOf(">",a);i.head=f.substring(0,a+1);var k=0,g;i.css="";while((k=i.head.indexOf("<style",k))!=-1){k=f.indexOf(">",k)+1;if((g=i.head.indexOf("</style",k))==-1){break}i.css+=i.head.substring(k,g);k=g}l=f.indexOf("</body",a);if(l==-1){l=f.length}b.content=f.substring(a+1,l);i.foot=f.substring(l);function e(c){return c.replace(/<\/?[A-Z]+/g,function(m){return m.toLowerCase()})}i.head=e(i.head);i.foot=e(i.foot)}else{i.head="";if(d.getParam("fullpage_default_xml_pi")){i.head+='<?xml version="1.0" encoding="'+d.getParam("fullpage_default_encoding","ISO-8859-1")+'" ?>\n'}i.head+=d.getParam("fullpage_default_doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');i.head+="\n<html>\n<head>\n<title>"+d.getParam("fullpage_default_title","Untitled document")+"</title>\n";if(h=d.getParam("fullpage_default_encoding")){i.head+='<meta http-equiv="Content-Type" content="'+h+'" />\n'}if(h=d.getParam("fullpage_default_font_family")){j+="font-family: "+h+";"}if(h=d.getParam("fullpage_default_font_size")){j+="font-size: "+h+";"}if(h=d.getParam("fullpage_default_text_color")){j+="color: "+h+";"}i.head+="</head>\n<body"+(j?' style="'+j+'"':"")+">\n";i.foot="\n</body>\n</html>"}},_getContent:function(a,c){var b=this;if(!c.source_view||!a.getParam("fullpage_hide_in_source_view")){c.content=tinymce.trim(b.head)+"\n"+tinymce.trim(c.content)+"\n"+tinymce.trim(b.foot);if(b.css){b._setStyle(a,b.css)}}},_setStyle:function(a,b){a.dom.remove("injectedCSS");var d=a.dom.doc,c=d.createElement("style");c.type="text/css";c.id="injectedCSS";if(c.styleSheet){c.styleSheet.cssText=b}else{c.appendChild(d.createTextNode(b))}d.getElementsByTagName("head")[0].appendChild(c)}});tinymce.PluginManager.add("fullpage",tinymce.plugins.FullPagePlugin)})();
 
tinymce-plugins/3.3.x/fullpage/editor_plugin_src.js DELETED
@@ -1,182 +0,0 @@
1
- /**
2
- * editor_plugin_src.js
3
- *
4
- * Copyright 2009, Moxiecode Systems AB
5
- * Released under LGPL License.
6
- *
7
- * License: http://tinymce.moxiecode.com/license
8
- * Contributing: http://tinymce.moxiecode.com/contributing
9
- */
10
-
11
- (function() {
12
- tinymce.create('tinymce.plugins.FullPagePlugin', {
13
- init : function(ed, url) {
14
- var t = this;
15
-
16
- t.editor = ed;
17
-
18
- // Register commands
19
- ed.addCommand('mceFullPageProperties', function() {
20
- ed.windowManager.open({
21
- file : url + '/fullpage.htm',
22
- width : 430 + parseInt(ed.getLang('fullpage.delta_width', 0)),
23
- height : 495 + parseInt(ed.getLang('fullpage.delta_height', 0)),
24
- inline : 1
25
- }, {
26
- plugin_url : url,
27
- head_html : t.head
28
- });
29
- });
30
-
31
- // Register buttons
32
- ed.addButton('fullpage', {title : 'fullpage.desc', cmd : 'mceFullPageProperties'});
33
-
34
- ed.onBeforeSetContent.add(t._setContent, t);
35
- ed.onSetContent.add(t._setBodyAttribs, t);
36
- ed.onGetContent.add(t._getContent, t);
37
- },
38
-
39
- getInfo : function() {
40
- return {
41
- longname : 'Fullpage',
42
- author : 'Moxiecode Systems AB',
43
- authorurl : 'http://tinymce.moxiecode.com',
44
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage',
45
- version : tinymce.majorVersion + "." + tinymce.minorVersion
46
- };
47
- },
48
-
49
- // Private plugin internal methods
50
-
51
- _setBodyAttribs : function(ed, o) {
52
- var bdattr, i, len, kv, k, v, t, attr = this.head.match(/body(.*?)>/i);
53
-
54
- if (attr && attr[1]) {
55
- bdattr = attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);
56
-
57
- if (bdattr) {
58
- for(i = 0, len = bdattr.length; i < len; i++) {
59
- kv = bdattr[i].split('=');
60
- k = kv[0].replace(/\s/,'');
61
- v = kv[1];
62
-
63
- if (v) {
64
- v = v.replace(/^\s+/,'').replace(/\s+$/,'');
65
- t = v.match(/^["'](.*)["']$/);
66
-
67
- if (t)
68
- v = t[1];
69
- } else
70
- v = k;
71
-
72
- ed.dom.setAttrib(ed.getBody(), 'style', v);
73
- }
74
- }
75
- }
76
- },
77
-
78
- _createSerializer : function() {
79
- return new tinymce.dom.Serializer({
80
- dom : this.editor.dom,
81
- apply_source_formatting : true
82
- });
83
- },
84
-
85
- _setContent : function(ed, o) {
86
- var t = this, sp, ep, c = o.content, v, st = '';
87
-
88
- // Ignore raw updated if we already have a head, this will fix issues with undo/redo keeping the head/foot separate
89
- if (o.format == 'raw' && t.head)
90
- return;
91
-
92
- if (o.source_view && ed.getParam('fullpage_hide_in_source_view'))
93
- return;
94
-
95
- // Parse out head, body and footer
96
- c = c.replace(/<(\/?)BODY/gi, '<$1body');
97
- sp = c.indexOf('<body');
98
-
99
- if (sp != -1) {
100
- sp = c.indexOf('>', sp);
101
- t.head = c.substring(0, sp + 1);
102
-
103
- // Concatenate all <style>'s text into t.css
104
- var ss = 0, es;
105
- t.css = '';
106
- while ((ss = t.head.indexOf('<style', ss)) != -1) {
107
- ss = c.indexOf('>', ss) + 1;
108
- if ( (es = t.head.indexOf('</style', ss)) == -1)
109
- break;
110
- t.css += t.head.substring(ss, es);
111
- ss = es;
112
- }
113
-
114
- ep = c.indexOf('</body', sp);
115
- if (ep == -1)
116
- ep = c.length;
117
-
118
- o.content = c.substring(sp + 1, ep);
119
- t.foot = c.substring(ep);
120
-
121
- function low(s) {
122
- return s.replace(/<\/?[A-Z]+/g, function(a) {
123
- return a.toLowerCase();
124
- })
125
- };
126
-
127
- t.head = low(t.head);
128
- t.foot = low(t.foot);
129
- } else {
130
- t.head = '';
131
- if (ed.getParam('fullpage_default_xml_pi'))
132
- t.head += '<?xml version="1.0" encoding="' + ed.getParam('fullpage_default_encoding', 'ISO-8859-1') + '" ?>\n';
133
-
134
- t.head += ed.getParam('fullpage_default_doctype', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
135
- t.head += '\n<html>\n<head>\n<title>' + ed.getParam('fullpage_default_title', 'Untitled document') + '</title>\n';
136
-
137
- if (v = ed.getParam('fullpage_default_encoding'))
138
- t.head += '<meta http-equiv="Content-Type" content="' + v + '" />\n';
139
-
140
- if (v = ed.getParam('fullpage_default_font_family'))
141
- st += 'font-family: ' + v + ';';
142
-
143
- if (v = ed.getParam('fullpage_default_font_size'))
144
- st += 'font-size: ' + v + ';';
145
-
146
- if (v = ed.getParam('fullpage_default_text_color'))
147
- st += 'color: ' + v + ';';
148
-
149
- t.head += '</head>\n<body' + (st ? ' style="' + st + '"' : '') + '>\n';
150
- t.foot = '\n</body>\n</html>';
151
- }
152
- },
153
-
154
- _getContent : function(ed, o) {
155
- var t = this;
156
-
157
- if (!o.source_view || !ed.getParam('fullpage_hide_in_source_view')) {
158
- o.content = tinymce.trim(t.head) + '\n' + tinymce.trim(o.content) + '\n' + tinymce.trim(t.foot);
159
-
160
- if (t.css)
161
- t._setStyle(ed, t.css);
162
- }
163
- },
164
-
165
- _setStyle : function(ed, css) {
166
- ed.dom.remove('injectedCSS');
167
- var doc = ed.dom.doc, style = doc.createElement('style');
168
- style.type = 'text/css';
169
- style.id = 'injectedCSS';
170
-
171
- if (style.styleSheet) // IE
172
- style.styleSheet.cssText = css;
173
- else // other browsers
174
- style.appendChild(doc.createTextNode(css));
175
-
176
- doc.getElementsByTagName('head')[0].appendChild(style);
177
- }
178
- });
179
-
180
- // Register plugin
181
- tinymce.PluginManager.add('fullpage', tinymce.plugins.FullPagePlugin);
182
- })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/3.3.x/fullpage/fullpage.htm DELETED
@@ -1,571 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <title>{#fullpage_dlg.title}</title>
5
- <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
6
- <script type="text/javascript" src="../../utils/mctabs.js"></script>
7
- <script type="text/javascript" src="../../utils/form_utils.js"></script>
8
- <script type="text/javascript" src="js/fullpage.js"></script>
9
- <link href="css/fullpage.css" rel="stylesheet" type="text/css" />
10
- </head>
11
- <body id="advlink" style="display: none">
12
- <form onsubmit="updateAction();return false;" name="fullpage" action="#">
13
- <div class="tabs">
14
- <ul>
15
- <li id="meta_tab" class="current"><span><a href="javascript:mcTabs.displayTab('meta_tab','meta_panel');" onmousedown="return false;">{#fullpage_dlg.meta_tab}</a></span></li>
16
- <li id="appearance_tab"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{#fullpage_dlg.appearance_tab}</a></span></li>
17
- <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#fullpage_dlg.advanced_tab}</a></span></li>
18
- </ul>
19
- </div>
20
-
21
- <div class="panel_wrapper">
22
- <div id="meta_panel" class="panel current">
23
- <fieldset>
24
- <legend>{#fullpage_dlg.meta_props}</legend>
25
-
26
- <table border="0" cellpadding="4" cellspacing="0">
27
- <tr>
28
- <td class="nowrap"><label for="metatitle">{#fullpage_dlg.meta_title}</label>&nbsp;</td>
29
- <td><input type="text" id="metatitle" name="metatitle" value="" class="mceFocus" /></td>
30
- </tr>
31
- <tr>
32
- <td class="nowrap"><label for="metakeywords">{#fullpage_dlg.meta_keywords}</label>&nbsp;</td>
33
- <td><textarea id="metakeywords" name="metakeywords" rows="4"></textarea></td>
34
- </tr>
35
- <tr>
36
- <td class="nowrap"><label for="metadescription">{#fullpage_dlg.meta_description}</label>&nbsp;</td>
37
- <td><textarea id="metadescription" name="metadescription" rows="4"></textarea></td>
38
- </tr>
39
- <tr>
40
- <td class="nowrap"><label for="metaauthor">{#fullpage_dlg.author}</label>&nbsp;</td>
41
- <td><input type="text" id="metaauthor" name="metaauthor" value="" /></td>
42
- </tr>
43
- <tr>
44
- <td class="nowrap"><label for="metacopyright">{#fullpage_dlg.copyright}</label>&nbsp;</td>
45
- <td><input type="text" id="metacopyright" name="metacopyright" value="" /></td>
46
- </tr>
47
- <tr>
48
- <td class="nowrap"><label for="metarobots">{#fullpage_dlg.meta_robots}</label>&nbsp;</td>
49
- <td>
50
- <select id="metarobots" name="metarobots">
51
- <option value="">{#not_set}</option>
52
- <option value="index,follow">{#fullpage_dlg.meta_index_follow}</option>
53
- <option value="index,nofollow">{#fullpage_dlg.meta_index_nofollow}</option>
54
- <option value="noindex,follow">{#fullpage_dlg.meta_noindex_follow}</option>
55
- <option value="noindex,nofollow">{#fullpage_dlg.meta_noindex_nofollow}</option>
56
- </select>
57
- </td>
58
- </tr>
59
- </table>
60
- </fieldset>
61
-
62
- <fieldset>
63
- <legend>{#fullpage_dlg.langprops}</legend>
64
-
65
- <table border="0" cellpadding="4" cellspacing="0">
66
- <tr>
67
- <td class="column1"><label for="docencoding">{#fullpage_dlg.encoding}</label></td>
68
- <td>
69
- <select id="docencoding" name="docencoding">
70
- <option value="">{#not_set}</option>
71
- </select>
72
- </td>
73
- </tr>
74
- <tr>
75
- <td class="nowrap"><label for="doctypes">{#fullpage_dlg.doctypes}</label>&nbsp;</td>
76
- <td>
77
- <select id="doctypes" name="doctypes">
78
- <option value="">{#not_set}</option>
79
- </select>
80
- </td>
81
- </tr>
82
- <tr>
83
- <td class="nowrap"><label for="langcode">{#fullpage_dlg.langcode}</label>&nbsp;</td>
84
- <td><input type="text" id="langcode" name="langcode" value="" /></td>
85
- </tr>
86
- <tr>
87
- <td class="column1"><label for="langdir">{#fullpage_dlg.langdir}</label></td>
88
- <td>
89
- <select id="langdir" name="langdir">
90
- <option value="">{#not_set}</option>
91
- <option value="ltr">{#fullpage_dlg.ltr}</option>
92
- <option value="rtl">{#fullpage_dlg.rtl}</option>
93
- </select>
94
- </td>
95
- </tr>
96
- <tr>
97
- <td class="nowrap"><label for="xml_pi">{#fullpage_dlg.xml_pi}</label>&nbsp;</td>
98
- <td><input type="checkbox" id="xml_pi" name="xml_pi" class="checkbox" /></td>
99
- </tr>
100
- </table>
101
- </fieldset>
102
- </div>
103
-
104
- <div id="appearance_panel" class="panel">
105
- <fieldset>
106
- <legend>{#fullpage_dlg.appearance_textprops}</legend>
107
-
108
- <table border="0" cellpadding="4" cellspacing="0">
109
- <tr>
110
- <td class="column1"><label for="fontface">{#fullpage_dlg.fontface}</label></td>
111
- <td>
112
- <select id="fontface" name="fontface" onchange="changedStyleField(this);">
113
- <option value="">{#not_set}</option>
114
- </select>
115
- </td>
116
- </tr>
117
-
118
- <tr>
119
- <td class="column1"><label for="fontsize">{#fullpage_dlg.fontsize}</label></td>
120
- <td>
121
- <select id="fontsize" name="fontsize" onchange="changedStyleField(this);">
122
- <option value="">{#not_set}</option>
123
- </select>
124
- </td>
125
- </tr>
126
-
127
- <tr>
128
- <td class="column1"><label for="textcolor">{#fullpage_dlg.textcolor}</label></td>
129
- <td>
130
- <table border="0" cellpadding="0" cellspacing="0">
131
- <tr>
132
- <td><input id="textcolor" name="textcolor" type="text" value="" size="9" onchange="updateColor('textcolor_pick','textcolor');changedStyleField(this);" /></td>
133
- <td id="textcolor_pickcontainer">&nbsp;</td>
134
- </tr>
135
- </table>
136
- </td>
137
- </tr>
138
- </table>
139
- </fieldset>
140
-
141
- <fieldset>
142
- <legend>{#fullpage_dlg.appearance_bgprops}</legend>
143
-
144
- <table border="0" cellpadding="4" cellspacing="0">
145
- <tr>
146
- <td class="column1"><label for="bgimage">{#fullpage_dlg.bgimage}</label></td>
147
- <td>
148
- <table border="0" cellpadding="0" cellspacing="0">
149
- <tr>
150
- <td><input id="bgimage" name="bgimage" type="text" value="" onchange="changedStyleField(this);" /></td>
151
- <td id="bgimage_pickcontainer">&nbsp;</td>
152
- </tr>
153
- </table>
154
- </td>
155
- </tr>
156
- <tr>
157
- <td class="column1"><label for="bgcolor">{#fullpage_dlg.bgcolor}</label></td>
158
- <td>
159
- <table border="0" cellpadding="0" cellspacing="0">
160
- <tr>
161
- <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedStyleField(this);" /></td>
162
- <td id="bgcolor_pickcontainer">&nbsp;</td>
163
- </tr>
164
- </table>
165
- </td>
166
- </tr>
167
- </table>
168
- </fieldset>
169
-
170
- <fieldset>
171
- <legend>{#fullpage_dlg.appearance_marginprops}</legend>
172
-
173
- <table border="0" cellpadding="4" cellspacing="0">
174
- <tr>
175
- <td class="column1"><label for="leftmargin">{#fullpage_dlg.left_margin}</label></td>
176
- <td><input id="leftmargin" name="leftmargin" type="text" value="" onchange="changedStyleField(this);" /></td>
177
- <td class="column1"><label for="rightmargin">{#fullpage_dlg.right_margin}</label></td>
178
- <td><input id="rightmargin" name="rightmargin" type="text" value="" onchange="changedStyleField(this);" /></td>
179
- </tr>
180
- <tr>
181
- <td class="column1"><label for="topmargin">{#fullpage_dlg.top_margin}</label></td>
182
- <td><input id="topmargin" name="topmargin" type="text" value="" onchange="changedStyleField(this);" /></td>
183
- <td class="column1"><label for="bottommargin">{#fullpage_dlg.bottom_margin}</label></td>
184
- <td><input id="bottommargin" name="bottommargin" type="text" value="" onchange="changedStyleField(this);" /></td>
185
- </tr>
186
- </table>
187
- </fieldset>
188
-
189
- <fieldset>
190
- <legend>{#fullpage_dlg.appearance_linkprops}</legend>
191
-
192
- <table border="0" cellpadding="4" cellspacing="0">
193
- <tr>
194
- <td class="column1"><label for="link_color">{#fullpage_dlg.link_color}</label></td>
195
- <td>
196
- <table border="0" cellpadding="0" cellspacing="0">
197
- <tr>
198
- <td><input id="link_color" name="link_color" type="text" value="" size="9" onchange="updateColor('link_color_pick','link_color');changedStyleField(this);" /></td>
199
- <td id="link_color_pickcontainer">&nbsp;</td>
200
- </tr>
201
- </table>
202
- </td>
203
-
204
- <td class="column1"><label for="visited_color">{#fullpage_dlg.visited_color}</label></td>
205
- <td>
206
- <table border="0" cellpadding="0" cellspacing="0">
207
- <tr>
208
- <td><input id="visited_color" name="visited_color" type="text" value="" size="9" onchange="updateColor('visited_color_pick','visited_color');changedStyleField(this);" /></td>
209
- <td id="visited_color_pickcontainer">&nbsp;</td>
210
- </tr>
211
- </table>
212
- </td>
213
- </tr>
214
-
215
- <tr>
216
- <td class="column1"><label for="active_color">{#fullpage_dlg.active_color}</label></td>
217
- <td>
218
- <table border="0" cellpadding="0" cellspacing="0">
219
- <tr>
220
- <td><input id="active_color" name="active_color" type="text" value="" size="9" onchange="updateColor('active_color_pick','active_color');changedStyleField(this);" /></td>
221
- <td id="active_color_pickcontainer">&nbsp;</td>
222
- </tr>
223
- </table>
224
- </td>
225
-
226
- <td>&nbsp;</td>
227
- <td>&nbsp;</td>
228
-
229
- <!-- <td class="column1"><label for="hover_color">{#fullpage_dlg.hover_color}</label></td>
230
- <td>
231
- <table border="0" cellpadding="0" cellspacing="0">
232
- <tr>
233
- <td><input id="hover_color" name="hover_color" type="text" value="" size="9" onchange="changedStyleField(this);" /></td>
234
- <td id="hover_color_pickcontainer">&nbsp;</td>
235
- </tr>
236
- </table>
237
- </td> -->
238
- </tr>
239
- </table>
240
- </fieldset>
241
-
242
- <fieldset>
243
- <legend>{#fullpage_dlg.appearance_style}</legend>
244
-
245
- <table border="0" cellpadding="4" cellspacing="0">
246
- <tr>
247
- <td class="column1"><label for="stylesheet">{#fullpage_dlg.stylesheet}</label></td>
248
- <td><table border="0" cellpadding="0" cellspacing="0">
249
- <tr>
250
- <td><input id="stylesheet" name="stylesheet" type="text" value="" /></td>
251
- <td id="stylesheet_browsercontainer">&nbsp;</td>
252
- </tr>
253
- </table></td>
254
- </tr>
255
- <tr>
256
- <td class="column1"><label for="style">{#fullpage_dlg.style}</label></td>
257
- <td><input id="style" name="style" type="text" value="" onchange="changedStyleField(this);" /></td>
258
- </tr>
259
- </table>
260
- </fieldset>
261
- </div>
262
-
263
- <div id="advanced_panel" class="panel">
264
- <div id="addmenu">
265
- <table border="0" cellpadding="0" cellspacing="0">
266
- <tr><td><a href="javascript:addHeadElm('title');" onmousedown="return false;"><span>{#fullpage_dlg.add_title}</span></a></td></tr>
267
- <tr><td><a href="javascript:addHeadElm('meta');" onmousedown="return false;"><span>{#fullpage_dlg.add_meta}</span></a></td></tr>
268
- <tr><td><a href="javascript:addHeadElm('script');" onmousedown="return false;"><span>{#fullpage_dlg.add_script}</span></a></td></tr>
269
- <tr><td><a href="javascript:addHeadElm('style');" onmousedown="return false;"><span>{#fullpage_dlg.add_style}</span></a></td></tr>
270
- <tr><td><a href="javascript:addHeadElm('link');" onmousedown="return false;"><span>{#fullpage_dlg.add_link}</span></a></td></tr>
271
- <tr><td><a href="javascript:addHeadElm('base');" onmousedown="return false;"><span>{#fullpage_dlg.add_base}</span></a></td></tr>
272
- <tr><td><a href="javascript:addHeadElm('comment');" onmousedown="return false;"><span>{#fullpage_dlg.add_comment}</span></a></td></tr>
273
- </table>
274
- </div>
275
-
276
- <fieldset>
277
- <legend>{#fullpage_dlg.head_elements}</legend>
278
-
279
- <div class="headlistwrapper">
280
- <div class="toolbar">
281
- <div style="float: left">
282
- <a id="addbutton" href="javascript:showAddMenu();" onmousedown="return false;" class="addbutton" title="{#fullpage_dlg.add}"></a>
283
- <a href="#" onmousedown="return false;" class="removebutton" title="{#fullpage_dlg.remove}"></a>
284
- </div>
285
- <div style="float: right">
286
- <a href="#" onmousedown="return false;" class="moveupbutton" title="{#fullpage_dlg.moveup}"></a>
287
- <a href="#" onmousedown="return false;" class="movedownbutton" title="{#fullpage_dlg.movedown}"></a>
288
- </div>
289
- <br style="clear: both" />
290
- </div>
291
- <select id="headlist" size="26" onchange="updateHeadElm(this.options[this.selectedIndex].value);">
292
- <option value="title_0">&lt;title&gt;Some title bla bla bla&lt;/title&gt;</option>
293
- <option value="meta_1">&lt;meta name="keywords"&gt;Some bla bla bla&lt;/meta&gt;</option>
294
- <option value="meta_2">&lt;meta name="description"&gt;Some bla bla bla bla bla bla bla bla bla&lt;/meta&gt;</option>
295
- <option value="script_3">&lt;script language=&quot;javascript&quot;&gt;...&lt;/script&gt;</option>
296
- <option value="style_4">&lt;style&gt;...&lt;/style&gt;</option>
297
- <option value="base_5">&lt;base href="." /&gt;</option>
298
- <option value="comment_6">&lt;!-- ... --&gt;</option>
299
- <option value="link_7">&lt;link href="." /&gt;</option>
300
- </select>
301
- </div>
302
- </fieldset>
303
-
304
- <fieldset id="meta_element">
305
- <legend>{#fullpage_dlg.meta_element}</legend>
306
-
307
- <table border="0" cellpadding="4" cellspacing="0">
308
- <tr>
309
- <td class="column1"><label for="element_meta_type">{#fullpage_dlg.type}</label></td>
310
- <td><select id="element_meta_type">
311
- <option value="name">name</option>
312
- <option value="http-equiv">http-equiv</option>
313
- </select></td>
314
- </tr>
315
- <tr>
316
- <td class="column1"><label for="element_meta_name">{#fullpage_dlg.name}</label></td>
317
- <td><input id="element_meta_name" name="element_meta_name" type="text" value="" /></td>
318
- </tr>
319
- <tr>
320
- <td class="column1"><label for="element_meta_content">{#fullpage_dlg.content}</label></td>
321
- <td><input id="element_meta_content" name="element_meta_content" type="text" value="" /></td>
322
- </tr>
323
- </table>
324
-
325
- <input type="button" id="meta_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
326
- </fieldset>
327
-
328
- <fieldset id="title_element">
329
- <legend>{#fullpage_dlg.title_element}</legend>
330
-
331
- <table border="0" cellpadding="4" cellspacing="0">
332
- <tr>
333
- <td class="column1"><label for="element_title">{#fullpage_dlg.meta_title}</label></td>
334
- <td><input id="element_title" name="element_title" type="text" value="" /></td>
335
- </tr>
336
- </table>
337
-
338
- <input type="button" id="title_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
339
- </fieldset>
340
-
341
- <fieldset id="script_element">
342
- <legend>{#fullpage_dlg.script_element}</legend>
343
-
344
- <div class="tabs">
345
- <ul>
346
- <li id="script_props_tab" class="current"><span><a href="javascript:mcTabs.displayTab('script_props_tab','script_props_panel');" onmousedown="return false;">{#fullpage_dlg.properties}</a></span></li>
347
- <li id="script_value_tab"><span><a href="javascript:mcTabs.displayTab('script_value_tab','script_value_panel');" onmousedown="return false;">{#fullpage_dlg.value}</a></span></li>
348
- </ul>
349
- </div>
350
-
351
- <br style="clear: both" />
352
-
353
- <div class="panel_wrapper">
354
- <div id="script_props_panel" class="panel current">
355
- <table border="0" cellpadding="4" cellspacing="0">
356
- <tr>
357
- <td class="column1"><label for="element_script_type">{#fullpage_dlg.type}</label></td>
358
- <td><select id="element_script_type">
359
- <option value="text/javascript">text/javascript</option>
360
- <option value="text/jscript">text/jscript</option>
361
- <option value="text/vbscript">text/vbscript</option>
362
- <option value="text/vbs">text/vbs</option>
363
- <option value="text/ecmascript">text/ecmascript</option>
364
- <option value="text/xml">text/xml</option>
365
- </select></td>
366
- </tr>
367
- <tr>
368
- <td class="column1"><label for="element_script_src">{#fullpage_dlg.src}</label></td>
369
- <td><table border="0" cellpadding="0" cellspacing="0">
370
- <tr>
371
- <td><input id="element_script_src" name="element_script_src" type="text" value="" /></td>
372
- <td id="script_src_pickcontainer">&nbsp;</td>
373
- </tr>
374
- </table></td>
375
- </tr>
376
- <tr>
377
- <td class="column1"><label for="element_script_charset">{#fullpage_dlg.charset}</label></td>
378
- <td><select id="element_script_charset"><option value="">{#not_set}</option></select></td>
379
- </tr>
380
- <tr>
381
- <td class="column1"><label for="element_script_defer">{#fullpage_dlg.defer}</label></td>
382
- <td><input type="checkbox" id="element_script_defer" name="element_script_defer" class="checkbox" /></td>
383
- </tr>
384
- </table>
385
- </div>
386
-
387
- <div id="script_value_panel" class="panel">
388
- <textarea id="element_script_value"></textarea>
389
- </div>
390
- </div>
391
-
392
- <input type="button" id="script_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
393
- </fieldset>
394
-
395
- <fieldset id="style_element">
396
- <legend>{#fullpage_dlg.style_element}</legend>
397
-
398
- <div class="tabs">
399
- <ul>
400
- <li id="style_props_tab" class="current"><span><a href="javascript:mcTabs.displayTab('style_props_tab','style_props_panel');" onmousedown="return false;">{#fullpage_dlg.properties}</a></span></li>
401
- <li id="style_value_tab"><span><a href="javascript:mcTabs.displayTab('style_value_tab','style_value_panel');" onmousedown="return false;">{#fullpage_dlg.value}</a></span></li>
402
- </ul>
403
- </div>
404
-
405
- <br style="clear: both" />
406
-
407
- <div class="panel_wrapper">
408
- <div id="style_props_panel" class="panel current">
409
- <table border="0" cellpadding="4" cellspacing="0">
410
- <tr>
411
- <td class="column1"><label for="element_style_type">{#fullpage_dlg.type}</label></td>
412
- <td><select id="element_style_type">
413
- <option value="text/css">text/css</option>
414
- </select></td>
415
- </tr>
416
- <tr>
417
- <td class="column1"><label for="element_style_media">{#fullpage_dlg.media}</label></td>
418
- <td><select id="element_style_media"></select></td>
419
- </tr>
420
- </table>
421
- </div>
422
-
423
- <div id="style_value_panel" class="panel">
424
- <textarea id="element_style_value"></textarea>
425
- </div>
426
- </div>
427
-
428
- <input type="button" id="style_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
429
- </fieldset>
430
-
431
- <fieldset id="base_element">
432
- <legend>{#fullpage_dlg.base_element}</legend>
433
-
434
- <table border="0" cellpadding="4" cellspacing="0">
435
- <tr>
436
- <td class="column1"><label for="element_base_href">{#fullpage_dlg.href}</label></td>
437
- <td><input id="element_base_href" name="element_base_href" type="text" value="" /></td>
438
- </tr>
439
- <tr>
440
- <td class="column1"><label for="element_base_target">{#fullpage_dlg.target}</label></td>
441
- <td><input id="element_base_target" name="element_base_target" type="text" value="" /></td>
442
- </tr>
443
- </table>
444
-
445
- <input type="button" id="base_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
446
- </fieldset>
447
-
448
- <fieldset id="link_element">
449
- <legend>{#fullpage_dlg.link_element}</legend>
450
-
451
- <div class="tabs">
452
- <ul>
453
- <li id="link_general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('link_general_tab','link_general_panel');" onmousedown="return false;">{#fullpage_dlg.general_props}</a></span></li>
454
- <li id="link_advanced_tab"><span><a href="javascript:mcTabs.displayTab('link_advanced_tab','link_advanced_panel');" onmousedown="return false;">{#fullpage_dlg.advanced_props}</a></span></li>
455
- </ul>
456
- </div>
457
-
458
- <br style="clear: both" />
459
-
460
- <div class="panel_wrapper">
461
- <div id="link_general_panel" class="panel current">
462
- <table border="0" cellpadding="4" cellspacing="0">
463
- <tr>
464
- <td class="column1"><label for="element_link_href">{#fullpage_dlg.href}</label></td>
465
- <td><table border="0" cellpadding="0" cellspacing="0">
466
- <tr>
467
- <td><input id="element_link_href" name="element_link_href" type="text" value="" /></td>
468
- <td id="link_href_pickcontainer">&nbsp;</td>
469
- </tr>
470
- </table></td>
471
- </tr>
472
- <tr>
473
- <td class="column1"><label for="element_link_title">{#fullpage_dlg.meta_title}</label></td>
474
- <td><input id="element_link_title" name="element_link_title" type="text" value="" /></td>
475
- </tr>
476
- <tr>
477
- <td class="column1"><label for="element_link_type">{#fullpage_dlg.type}</label></td>
478
- <td><select id="element_link_type" name="element_link_type">
479
- <option value="text/css">text/css</option>
480
- <option value="text/javascript">text/javascript</option>
481
- </select></td>
482
- </tr>
483
- <tr>
484
- <td class="column1"><label for="element_link_media">{#fullpage_dlg.media}</label></td>
485
- <td><select id="element_link_media" name="element_link_media"></select></td>
486
- </tr>
487
- <tr>
488
- <td><label for="element_style_rel">{#fullpage_dlg.rel}</label></td>
489
- <td><select id="element_style_rel" name="element_style_rel">
490
- <option value="">{#not_set}</option>
491
- <option value="stylesheet">Stylesheet</option>
492
- <option value="alternate">Alternate</option>
493
- <option value="designates">Designates</option>
494
- <option value="start">Start</option>
495
- <option value="next">Next</option>
496
- <option value="prev">Prev</option>
497
- <option value="contents">Contents</option>
498
- <option value="index">Index</option>
499
- <option value="glossary">Glossary</option>
500
- <option value="copyright">Copyright</option>
501
- <option value="chapter">Chapter</option>
502
- <option value="subsection">Subsection</option>
503
- <option value="appendix">Appendix</option>
504
- <option value="help">Help</option>
505
- <option value="bookmark">Bookmark</option>
506
- </select>
507
- </td>
508
- </tr>
509
- </table>
510
- </div>
511
-
512
- <div id="link_advanced_panel" class="panel">
513
- <table border="0" cellpadding="4" cellspacing="0">
514
- <tr>
515
- <td class="column1"><label for="element_link_charset">{#fullpage_dlg.charset}</label></td>
516
- <td><select id="element_link_charset"><option value="">{#not_set}</option></select></td>
517
- </tr>
518
- <tr>
519
- <td class="column1"><label for="element_link_hreflang">{#fullpage_dlg.hreflang}</label></td>
520
- <td><input id="element_link_hreflang" name="element_link_hreflang" type="text" value="" /></td>
521
- </tr>
522
- <tr>
523
- <td class="column1"><label for="element_link_target">{#fullpage_dlg.target}</label></td>
524
- <td><input id="element_link_target" name="element_link_target" type="text" value="" /></td>
525
- </tr>
526
- <tr>
527
- <td><label for="element_style_rev">{#fullpage_dlg.rev}</label></td>
528
- <td><select id="element_style_rev" name="element_style_rev">
529
- <option value="">{#not_set}</option>
530
- <option value="alternate">Alternate</option>
531
- <option value="designates">Designates</option>
532
- <option value="stylesheet">Stylesheet</option>
533
- <option value="start">Start</option>
534
- <option value="next">Next</option>
535
- <option value="prev">Prev</option>
536
- <option value="contents">Contents</option>
537
- <option value="index">Index</option>
538
- <option value="glossary">Glossary</option>
539
- <option value="copyright">Copyright</option>
540
- <option value="chapter">Chapter</option>
541
- <option value="subsection">Subsection</option>
542
- <option value="appendix">Appendix</option>
543
- <option value="help">Help</option>
544
- <option value="bookmark">Bookmark</option>
545
- </select>
546
- </td>
547
- </tr>
548
- </table>
549
- </div>
550
- </div>
551
-
552
- <input type="button" id="link_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
553
- </fieldset>
554
-
555
- <fieldset id="comment_element">
556
- <legend>{#fullpage_dlg.comment_element}</legend>
557
-
558
- <textarea id="element_comment_value"></textarea>
559
-
560
- <input type="button" id="comment_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
561
- </fieldset>
562
- </div>
563
- </div>
564
-
565
- <div class="mceActionPanel">
566
- <input type="submit" id="insert" name="update" value="{#update}" />
567
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
568
- </div>
569
- </form>
570
- </body>
571
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/3.3.x/fullpage/js/fullpage.js DELETED
@@ -1,471 +0,0 @@
1
- /**
2
- * fullpage.js
3
- *
4
- * Copyright 2009, Moxiecode Systems AB
5
- * Released under LGPL License.
6
- *
7
- * License: http://tinymce.moxiecode.com/license
8
- * Contributing: http://tinymce.moxiecode.com/contributing
9
- */
10
-
11
- tinyMCEPopup.requireLangPack();
12
-
13
- var doc;
14
-
15
- var defaultDocTypes =
16
- 'XHTML 1.0 Transitional=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">,' +
17
- 'XHTML 1.0 Frameset=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">,' +
18
- 'XHTML 1.0 Strict=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">,' +
19
- 'XHTML 1.1=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">,' +
20
- 'HTML 4.01 Transitional=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">,' +
21
- 'HTML 4.01 Strict=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">,' +
22
- 'HTML 4.01 Frameset=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">';
23
-
24
- var defaultEncodings =
25
- 'Western european (iso-8859-1)=iso-8859-1,' +
26
- 'Central European (iso-8859-2)=iso-8859-2,' +
27
- 'Unicode (UTF-8)=utf-8,' +
28
- 'Chinese traditional (Big5)=big5,' +
29
- 'Cyrillic (iso-8859-5)=iso-8859-5,' +
30
- 'Japanese (iso-2022-jp)=iso-2022-jp,' +
31
- 'Greek (iso-8859-7)=iso-8859-7,' +
32
- 'Korean (iso-2022-kr)=iso-2022-kr,' +
33
- 'ASCII (us-ascii)=us-ascii';
34
-
35
- var defaultMediaTypes =
36
- 'all=all,' +
37
- 'screen=screen,' +
38
- 'print=print,' +
39
- 'tty=tty,' +
40
- 'tv=tv,' +
41
- 'projection=projection,' +
42
- 'handheld=handheld,' +
43
- 'braille=braille,' +
44
- 'aural=aural';
45
-
46
- var defaultFontNames = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';
47
- var defaultFontSizes = '10px,11px,12px,13px,14px,15px,16px';
48
-
49
- function init() {
50
- var f = document.forms['fullpage'], el = f.elements, e, i, p, doctypes, encodings, mediaTypes, fonts, ed = tinyMCEPopup.editor, dom = tinyMCEPopup.dom, style;
51
-
52
- // Setup doctype select box
53
- doctypes = ed.getParam("fullpage_doctypes", defaultDocTypes).split(',');
54
- for (i=0; i<doctypes.length; i++) {
55
- p = doctypes[i].split('=');
56
-
57
- if (p.length > 1)
58
- addSelectValue(f, 'doctypes', p[0], p[1]);
59
- }
60
-
61
- // Setup fonts select box
62
- fonts = ed.getParam("fullpage_fonts", defaultFontNames).split(';');
63
- for (i=0; i<fonts.length; i++) {
64
- p = fonts[i].split('=');
65
-
66
- if (p.length > 1)
67
- addSelectValue(f, 'fontface', p[0], p[1]);
68
- }
69
-
70
- // Setup fontsize select box
71
- fonts = ed.getParam("fullpage_fontsizes", defaultFontSizes).split(',');
72
- for (i=0; i<fonts.length; i++)
73
- addSelectValue(f, 'fontsize', fonts[i], fonts[i]);
74
-
75
- // Setup mediatype select boxs
76
- mediaTypes = ed.getParam("fullpage_media_types", defaultMediaTypes).split(',');
77
- for (i=0; i<mediaTypes.length; i++) {
78
- p = mediaTypes[i].split('=');
79
-
80
- if (p.length > 1) {
81
- addSelectValue(f, 'element_style_media', p[0], p[1]);
82
- addSelectValue(f, 'element_link_media', p[0], p[1]);
83
- }
84
- }
85
-
86
- // Setup encodings select box
87
- encodings = ed.getParam("fullpage_encodings", defaultEncodings).split(',');
88
- for (i=0; i<encodings.length; i++) {
89
- p = encodings[i].split('=');
90
-
91
- if (p.length > 1) {
92
- addSelectValue(f, 'docencoding', p[0], p[1]);
93
- addSelectValue(f, 'element_script_charset', p[0], p[1]);
94
- addSelectValue(f, 'element_link_charset', p[0], p[1]);
95
- }
96
- }
97
-
98
- document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
99
- document.getElementById('link_color_pickcontainer').innerHTML = getColorPickerHTML('link_color_pick','link_color');
100
- //document.getElementById('hover_color_pickcontainer').innerHTML = getColorPickerHTML('hover_color_pick','hover_color');
101
- document.getElementById('visited_color_pickcontainer').innerHTML = getColorPickerHTML('visited_color_pick','visited_color');
102
- document.getElementById('active_color_pickcontainer').innerHTML = getColorPickerHTML('active_color_pick','active_color');
103
- document.getElementById('textcolor_pickcontainer').innerHTML = getColorPickerHTML('textcolor_pick','textcolor');
104
- document.getElementById('stylesheet_browsercontainer').innerHTML = getBrowserHTML('stylesheetbrowser','stylesheet','file','fullpage');
105
- document.getElementById('link_href_pickcontainer').innerHTML = getBrowserHTML('link_href_browser','element_link_href','file','fullpage');
106
- document.getElementById('script_src_pickcontainer').innerHTML = getBrowserHTML('script_src_browser','element_script_src','file','fullpage');
107
- document.getElementById('bgimage_pickcontainer').innerHTML = getBrowserHTML('bgimage_browser','bgimage','image','fullpage');
108
-
109
- // Resize some elements
110
- if (isVisible('stylesheetbrowser'))
111
- document.getElementById('stylesheet').style.width = '220px';
112
-
113
- if (isVisible('link_href_browser'))
114
- document.getElementById('element_link_href').style.width = '230px';
115
-
116
- if (isVisible('bgimage_browser'))
117
- document.getElementById('bgimage').style.width = '210px';
118
-
119
- // Add iframe
120
- dom.add(document.body, 'iframe', {id : 'documentIframe', src : 'javascript:""', style : {display : 'none'}});
121
- doc = dom.get('documentIframe').contentWindow.document;
122
- h = tinyMCEPopup.getWindowArg('head_html');
123
-
124
- // Preprocess the HTML disable scripts and urls
125
- h = h.replace(/<script>/gi, '<script type="text/javascript">');
126
- h = h.replace(/type=([\"\'])?/gi, 'type=$1-mce-');
127
- h = h.replace(/(src=|href=)/g, '_mce_$1');
128
-
129
- // Write in the content in the iframe
130
- doc.write(h + '</body></html>');
131
- doc.close();
132
-
133
- // Parse xml and doctype
134
- xmlVer = getReItem(/<\?\s*?xml.*?version\s*?=\s*?"(.*?)".*?\?>/gi, h, 1);
135
- xmlEnc = getReItem(/<\?\s*?xml.*?encoding\s*?=\s*?"(.*?)".*?\?>/gi, h, 1);
136
- docType = getReItem(/<\!DOCTYPE.*?>/gi, h.replace(/\n/g, ''), 0).replace(/ +/g, ' ');
137
- f.langcode.value = getReItem(/lang="(.*?)"/gi, h, 1);
138
-
139
- // Parse title
140
- if (e = doc.getElementsByTagName('title')[0])
141
- el.metatitle.value = e.textContent || e.text;
142
-
143
- // Parse meta
144
- tinymce.each(doc.getElementsByTagName('meta'), function(n) {
145
- var na = (n.getAttribute('name', 2) || '').toLowerCase(), va = n.getAttribute('content', 2), eq = n.getAttribute('httpEquiv', 2) || '';
146
-
147
- e = el['meta' + na];
148
-
149
- if (na == 'robots') {
150
- selectByValue(f, 'metarobots', tinymce.trim(va), true, true);
151
- return;
152
- }
153
-
154
- switch (eq.toLowerCase()) {
155
- case "content-type":
156
- tmp = getReItem(/charset\s*=\s*(.*)\s*/gi, va, 1);
157
-
158
- // Override XML encoding
159
- if (tmp != "")
160
- xmlEnc = tmp;
161
-
162
- return;
163
- }
164
-
165
- if (e)
166
- e.value = va;
167
- });
168
-
169
- selectByValue(f, 'doctypes', docType, true, true);
170
- selectByValue(f, 'docencoding', xmlEnc, true, true);
171
- selectByValue(f, 'langdir', doc.body.getAttribute('dir', 2) || '', true, true);
172
-
173
- if (xmlVer != '')
174
- el.xml_pi.checked = true;
175
-
176
- // Parse appearance
177
-
178
- // Parse primary stylesheet
179
- tinymce.each(doc.getElementsByTagName("link"), function(l) {
180
- var m = l.getAttribute('media', 2) || '', t = l.getAttribute('type', 2) || '';
181
-
182
- if (t == "-mce-text/css" && (m == "" || m == "screen" || m == "all") && (l.getAttribute('rel', 2) || '') == "stylesheet") {
183
- f.stylesheet.value = l.getAttribute('_mce_href', 2) || '';
184
- return false;
185
- }
186
- });
187
-
188
- // Get from style elements
189
- tinymce.each(doc.getElementsByTagName("style"), function(st) {
190
- var tmp = parseStyleElement(st);
191
-
192
- for (x=0; x<tmp.length; x++) {
193
- if (tmp[x].rule.indexOf('a:visited') != -1 && tmp[x].data['color'])
194
- f.visited_color.value = tmp[x].data['color'];
195
-
196
- if (tmp[x].rule.indexOf('a:link') != -1 && tmp[x].data['color'])
197
- f.link_color.value = tmp[x].data['color'];
198
-
199
- if (tmp[x].rule.indexOf('a:active') != -1 && tmp[x].data['color'])
200
- f.active_color.value = tmp[x].data['color'];
201
- }
202
- });
203
-
204
- f.textcolor.value = tinyMCEPopup.dom.getAttrib(doc.body, "text");
205
- f.active_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "alink");
206
- f.link_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "link");
207
- f.visited_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "vlink");
208
- f.bgcolor.value = tinyMCEPopup.dom.getAttrib(doc.body, "bgcolor");
209
- f.bgimage.value = tinyMCEPopup.dom.getAttrib(doc.body, "background");
210
-
211
- // Get from style info
212
- style = tinyMCEPopup.dom.parseStyle(tinyMCEPopup.dom.getAttrib(doc.body, 'style'));
213
-
214
- if (style['font-family'])
215
- selectByValue(f, 'fontface', style['font-family'], true, true);
216
- else
217
- selectByValue(f, 'fontface', ed.getParam("fullpage_default_fontface", ""), true, true);
218
-
219
- if (style['font-size'])
220
- selectByValue(f, 'fontsize', style['font-size'], true, true);
221
- else
222
- selectByValue(f, 'fontsize', ed.getParam("fullpage_default_fontsize", ""), true, true);
223
-
224
- if (style['color'])
225
- f.textcolor.value = convertRGBToHex(style['color']);
226
-
227
- if (style['background-image'])
228
- f.bgimage.value = style['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
229
-
230
- if (style['background-color'])
231
- f.bgcolor.value = style['background-color'];
232
-
233
- if (style['margin']) {
234
- tmp = style['margin'].replace(/[^0-9 ]/g, '');
235
- tmp = tmp.split(/ +/);
236
- f.topmargin.value = tmp.length > 0 ? tmp[0] : '';
237
- f.rightmargin.value = tmp.length > 1 ? tmp[1] : tmp[0];
238
- f.bottommargin.value = tmp.length > 2 ? tmp[2] : tmp[0];
239
- f.leftmargin.value = tmp.length > 3 ? tmp[3] : tmp[0];
240
- }
241
-
242
- if (style['margin-left'])
243
- f.leftmargin.value = style['margin-left'].replace(/[^0-9]/g, '');
244
-
245
- if (style['margin-right'])
246
- f.rightmargin.value = style['margin-right'].replace(/[^0-9]/g, '');
247
-
248
- if (style['margin-top'])
249
- f.topmargin.value = style['margin-top'].replace(/[^0-9]/g, '');
250
-
251
- if (style['margin-bottom'])
252
- f.bottommargin.value = style['margin-bottom'].replace(/[^0-9]/g, '');
253
-
254
- f.style.value = tinyMCEPopup.dom.serializeStyle(style);
255
-
256
- // Update colors
257
- updateColor('textcolor_pick', 'textcolor');
258
- updateColor('bgcolor_pick', 'bgcolor');
259
- updateColor('visited_color_pick', 'visited_color');
260
- updateColor('active_color_pick', 'active_color');
261
- updateColor('link_color_pick', 'link_color');
262
- }
263
-
264
- function getReItem(r, s, i) {
265
- var c = r.exec(s);
266
-
267
- if (c && c.length > i)
268
- return c[i];
269
-
270
- return '';
271
- }
272
-
273
- function updateAction() {
274
- var f = document.forms[0], nl, i, h, v, s, head, html, l, tmp, addlink = true, ser;
275
-
276
- head = doc.getElementsByTagName('head')[0];
277
-
278
- // Fix scripts without a type
279
- nl = doc.getElementsByTagName('script');
280
- for (i=0; i<nl.length; i++) {
281
- if (tinyMCEPopup.dom.getAttrib(nl[i], '_mce_type') == '')
282
- nl[i].setAttribute('_mce_type', 'text/javascript');
283
- }
284
-
285
- // Get primary stylesheet
286
- nl = doc.getElementsByTagName("link");
287
- for (i=0; i<nl.length; i++) {
288
- l = nl[i];
289
-
290
- tmp = tinyMCEPopup.dom.getAttrib(l, 'media');
291
-
292
- if (tinyMCEPopup.dom.getAttrib(l, '_mce_type') == "text/css" && (tmp == "" || tmp == "screen" || tmp == "all") && tinyMCEPopup.dom.getAttrib(l, 'rel') == "stylesheet") {
293
- addlink = false;
294
-
295
- if (f.stylesheet.value == '')
296
- l.parentNode.removeChild(l);
297
- else
298
- l.setAttribute('_mce_href', f.stylesheet.value);
299
-
300
- break;
301
- }
302
- }
303
-
304
- // Add new link
305
- if (f.stylesheet.value != '') {
306
- l = doc.createElement('link');
307
-
308
- l.setAttribute('type', 'text/css');
309
- l.setAttribute('_mce_href', f.stylesheet.value);
310
- l.setAttribute('rel', 'stylesheet');
311
-
312
- head.appendChild(l);
313
- }
314
-
315
- setMeta(head, 'keywords', f.metakeywords.value);
316
- setMeta(head, 'description', f.metadescription.value);
317
- setMeta(head, 'author', f.metaauthor.value);
318
- setMeta(head, 'copyright', f.metacopyright.value);
319
- setMeta(head, 'robots', getSelectValue(f, 'metarobots'));
320
- setMeta(head, 'Content-Type', getSelectValue(f, 'docencoding'));
321
-
322
- doc.body.dir = getSelectValue(f, 'langdir');
323
- doc.body.style.cssText = f.style.value;
324
-
325
- doc.body.setAttribute('vLink', f.visited_color.value);
326
- doc.body.setAttribute('link', f.link_color.value);
327
- doc.body.setAttribute('text', f.textcolor.value);
328
- doc.body.setAttribute('aLink', f.active_color.value);
329
-
330
- doc.body.style.fontFamily = getSelectValue(f, 'fontface');
331
- doc.body.style.fontSize = getSelectValue(f, 'fontsize');
332
- doc.body.style.backgroundColor = f.bgcolor.value;
333
-
334
- if (f.leftmargin.value != '')
335
- doc.body.style.marginLeft = f.leftmargin.value + 'px';
336
-
337
- if (f.rightmargin.value != '')
338
- doc.body.style.marginRight = f.rightmargin.value + 'px';
339
-
340
- if (f.bottommargin.value != '')
341
- doc.body.style.marginBottom = f.bottommargin.value + 'px';
342
-
343
- if (f.topmargin.value != '')
344
- doc.body.style.marginTop = f.topmargin.value + 'px';
345
-
346
- html = doc.getElementsByTagName('html')[0];
347
- html.setAttribute('lang', f.langcode.value);
348
- html.setAttribute('xml:lang', f.langcode.value);
349
-
350
- if (f.bgimage.value != '')
351
- doc.body.style.backgroundImage = "url('" + f.bgimage.value + "')";
352
- else
353
- doc.body.style.backgroundImage = '';
354
-
355
- ser = tinyMCEPopup.editor.plugins.fullpage._createSerializer();
356
- ser.setRules('-title,meta[http-equiv|name|content],base[href|target],link[href|rel|type|title|media],style[type],script[type|language|src],html[lang|xml::lang|xmlns],body[style|dir|vlink|link|text|alink],head');
357
-
358
- h = ser.serialize(doc.documentElement);
359
- h = h.substring(0, h.lastIndexOf('</body>'));
360
-
361
- if (h.indexOf('<title>') == -1)
362
- h = h.replace(/<head.*?>/, '$&\n' + '<title>' + tinyMCEPopup.dom.encode(f.metatitle.value) + '</title>');
363
- else
364
- h = h.replace(/<title>(.*?)<\/title>/, '<title>' + tinyMCEPopup.dom.encode(f.metatitle.value) + '</title>');
365
-
366
- if ((v = getSelectValue(f, 'doctypes')) != '')
367
- h = v + '\n' + h;
368
-
369
- if (f.xml_pi.checked) {
370
- s = '<?xml version="1.0"';
371
-
372
- if ((v = getSelectValue(f, 'docencoding')) != '')
373
- s += ' encoding="' + v + '"';
374
-
375
- s += '?>\n';
376
- h = s + h;
377
- }
378
-
379
- h = h.replace(/type=\"\-mce\-/gi, 'type="');
380
-
381
- tinyMCEPopup.editor.plugins.fullpage.head = h;
382
- tinyMCEPopup.editor.plugins.fullpage._setBodyAttribs(tinyMCEPopup.editor, {});
383
- tinyMCEPopup.close();
384
- }
385
-
386
- function changedStyleField(field) {
387
- }
388
-
389
- function setMeta(he, k, v) {
390
- var nl, i, m;
391
-
392
- nl = he.getElementsByTagName('meta');
393
- for (i=0; i<nl.length; i++) {
394
- if (k == 'Content-Type' && tinyMCEPopup.dom.getAttrib(nl[i], 'http-equiv') == k) {
395
- if (v == '')
396
- nl[i].parentNode.removeChild(nl[i]);
397
- else
398
- nl[i].setAttribute('content', "text/html; charset=" + v);
399
-
400
- return;
401
- }
402
-
403
- if (tinyMCEPopup.dom.getAttrib(nl[i], 'name') == k) {
404
- if (v == '')
405
- nl[i].parentNode.removeChild(nl[i]);
406
- else
407
- nl[i].setAttribute('content', v);
408
- return;
409
- }
410
- }
411
-
412
- if (v == '')
413
- return;
414
-
415
- m = doc.createElement('meta');
416
-
417
- if (k == 'Content-Type')
418
- m.httpEquiv = k;
419
- else
420
- m.setAttribute('name', k);
421
-
422
- m.setAttribute('content', v);
423
- he.appendChild(m);
424
- }
425
-
426
- function parseStyleElement(e) {
427
- var v = e.innerHTML;
428
- var p, i, r;
429
-
430
- v = v.replace(/<!--/gi, '');
431
- v = v.replace(/-->/gi, '');
432
- v = v.replace(/[\n\r]/gi, '');
433
- v = v.replace(/\s+/gi, ' ');
434
-
435
- r = [];
436
- p = v.split(/{|}/);
437
-
438
- for (i=0; i<p.length; i+=2) {
439
- if (p[i] != "")
440
- r[r.length] = {rule : tinymce.trim(p[i]), data : tinyMCEPopup.dom.parseStyle(p[i+1])};
441
- }
442
-
443
- return r;
444
- }
445
-
446
- function serializeStyleElement(d) {
447
- var i, s, st;
448
-
449
- s = '<!--\n';
450
-
451
- for (i=0; i<d.length; i++) {
452
- s += d[i].rule + ' {\n';
453
-
454
- st = tinyMCE.serializeStyle(d[i].data);
455
-
456
- if (st != '')
457
- st += ';';
458
-
459
- s += st.replace(/;/g, ';\n');
460
- s += '}\n';
461
-
462
- if (i != d.length - 1)
463
- s += '\n';
464
- }
465
-
466
- s += '\n-->';
467
-
468
- return s;
469
- }
470
-
471
- tinyMCEPopup.onInit.add(init);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/3.3.x/fullpage/langs/en_dlg.js DELETED
@@ -1,85 +0,0 @@
1
- tinyMCE.addI18n('en.fullpage_dlg',{
2
- title:"Document properties",
3
- meta_tab:"General",
4
- appearance_tab:"Appearance",
5
- advanced_tab:"Advanced",
6
- meta_props:"Meta information",
7
- langprops:"Language and encoding",
8
- meta_title:"Title",
9
- meta_keywords:"Keywords",
10
- meta_description:"Description",
11
- meta_robots:"Robots",
12
- doctypes:"Doctype",
13
- langcode:"Language code",
14
- langdir:"Language direction",
15
- ltr:"Left to right",
16
- rtl:"Right to left",
17
- xml_pi:"XML declaration",
18
- encoding:"Character encoding",
19
- appearance_bgprops:"Background properties",
20
- appearance_marginprops:"Body margins",
21
- appearance_linkprops:"Link colors",
22
- appearance_textprops:"Text properties",
23
- bgcolor:"Background color",
24
- bgimage:"Background image",
25
- left_margin:"Left margin",
26
- right_margin:"Right margin",
27
- top_margin:"Top margin",
28
- bottom_margin:"Bottom margin",
29
- text_color:"Text color",
30
- font_size:"Font size",
31
- font_face:"Font face",
32
- link_color:"Link color",
33
- hover_color:"Hover color",
34
- visited_color:"Visited color",
35
- active_color:"Active color",
36
- textcolor:"Color",
37
- fontsize:"Font size",
38
- fontface:"Font family",
39
- meta_index_follow:"Index and follow the links",
40
- meta_index_nofollow:"Index and don't follow the links",
41
- meta_noindex_follow:"Do not index but follow the links",
42
- meta_noindex_nofollow:"Do not index and don\'t follow the links",
43
- appearance_style:"Stylesheet and style properties",
44
- stylesheet:"Stylesheet",
45
- style:"Style",
46
- author:"Author",
47
- copyright:"Copyright",
48
- add:"Add new element",
49
- remove:"Remove selected element",
50
- moveup:"Move selected element up",
51
- movedown:"Move selected element down",
52
- head_elements:"Head elements",
53
- info:"Information",
54
- add_title:"Title element",
55
- add_meta:"Meta element",
56
- add_script:"Script element",
57
- add_style:"Style element",
58
- add_link:"Link element",
59
- add_base:"Base element",
60
- add_comment:"Comment node",
61
- title_element:"Title element",
62
- script_element:"Script element",
63
- style_element:"Style element",
64
- base_element:"Base element",
65
- link_element:"Link element",
66
- meta_element:"Meta element",
67
- comment_element:"Comment",
68
- src:"Src",
69
- language:"Language",
70
- href:"Href",
71
- target:"Target",
72
- type:"Type",
73
- charset:"Charset",
74
- defer:"Defer",
75
- media:"Media",
76
- properties:"Properties",
77
- name:"Name",
78
- value:"Value",
79
- content:"Content",
80
- rel:"Rel",
81
- rev:"Rev",
82
- hreflang:"Href lang",
83
- general_props:"General",
84
- advanced_props:"Advanced"
85
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/3.4.x/fullpage/css/fullpage.css DELETED
@@ -1,143 +0,0 @@
1
- /* Hide the advanced tab */
2
- #advanced_tab {
3
- display: none;
4
- }
5
-
6
- #metatitle, #metakeywords, #metadescription, #metaauthor, #metacopyright {
7
- width: 280px;
8
- }
9
-
10
- #doctype, #docencoding {
11
- width: 200px;
12
- }
13
-
14
- #langcode {
15
- width: 30px;
16
- }
17
-
18
- #bgimage {
19
- width: 220px;
20
- }
21
-
22
- #fontface {
23
- width: 240px;
24
- }
25
-
26
- #leftmargin, #rightmargin, #topmargin, #bottommargin {
27
- width: 50px;
28
- }
29
-
30
- .panel_wrapper div.current {
31
- height: 400px;
32
- }
33
-
34
- #stylesheet, #style {
35
- width: 240px;
36
- }
37
-
38
- #doctypes {
39
- width: 200px;
40
- }
41
-
42
- /* Head list classes */
43
-
44
- .headlistwrapper {
45
- width: 100%;
46
- }
47
-
48
- .selected {
49
- border: 1px solid #0A246A;
50
- background-color: #B6BDD2;
51
- }
52
-
53
- .toolbar {
54
- width: 100%;
55
- }
56
-
57
- #headlist {
58
- width: 100%;
59
- margin-top: 3px;
60
- font-size: 11px;
61
- }
62
-
63
- #info, #title_element, #meta_element, #script_element, #style_element, #base_element, #link_element, #comment_element, #unknown_element {
64
- display: none;
65
- }
66
-
67
- #addmenu {
68
- position: absolute;
69
- border: 1px solid gray;
70
- display: none;
71
- z-index: 100;
72
- background-color: white;
73
- }
74
-
75
- #addmenu a {
76
- display: block;
77
- width: 100%;
78
- line-height: 20px;
79
- text-decoration: none;
80
- background-color: white;
81
- }
82
-
83
- #addmenu a:hover {
84
- background-color: #B6BDD2;
85
- color: black;
86
- }
87
-
88
- #addmenu span {
89
- padding-left: 10px;
90
- padding-right: 10px;
91
- }
92
-
93
- #updateElementPanel {
94
- display: none;
95
- }
96
-
97
- #script_element .panel_wrapper div.current {
98
- height: 108px;
99
- }
100
-
101
- #style_element .panel_wrapper div.current {
102
- height: 108px;
103
- }
104
-
105
- #link_element .panel_wrapper div.current {
106
- height: 140px;
107
- }
108
-
109
- #element_script_value {
110
- width: 100%;
111
- height: 100px;
112
- }
113
-
114
- #element_comment_value {
115
- width: 100%;
116
- height: 120px;
117
- }
118
-
119
- #element_style_value {
120
- width: 100%;
121
- height: 100px;
122
- }
123
-
124
- #element_title, #element_script_src, #element_meta_name, #element_meta_content, #element_base_href, #element_link_href, #element_link_title {
125
- width: 250px;
126
- }
127
-
128
- .updateElementButton {
129
- margin-top: 3px;
130
- }
131
-
132
- /* MSIE specific styles */
133
-
134
- * html .addbutton, * html .removebutton, * html .moveupbutton, * html .movedownbutton {
135
- width: 22px;
136
- height: 22px;
137
- }
138
-
139
- textarea {
140
- height: 55px;
141
- }
142
-
143
- .panel_wrapper div.current {height:420px;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/3.4.x/fullpage/editor_plugin.js DELETED
@@ -1 +0,0 @@
1
- (function(){var b=tinymce.each,a=tinymce.html.Node;tinymce.create("tinymce.plugins.FullPagePlugin",{init:function(c,d){var e=this;e.editor=c;c.addCommand("mceFullPageProperties",function(){c.windowManager.open({file:d+"/fullpage.htm",width:430+parseInt(c.getLang("fullpage.delta_width",0)),height:495+parseInt(c.getLang("fullpage.delta_height",0)),inline:1},{plugin_url:d,data:e._htmlToData()})});c.addButton("fullpage",{title:"fullpage.desc",cmd:"mceFullPageProperties"});c.onBeforeSetContent.add(e._setContent,e);c.onGetContent.add(e._getContent,e)},getInfo:function(){return{longname:"Fullpage",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_htmlToData:function(){var f=this._parseHeader(),h={},c,i,g,e=this.editor;function d(l,j){var k=l.attr(j);return k||""}h.fontface=e.getParam("fullpage_default_fontface","");h.fontsize=e.getParam("fullpage_default_fontsize","");i=f.firstChild;if(i.type==7){h.xml_pi=true;g=/encoding="([^"]+)"/.exec(i.value);if(g){h.docencoding=g[1]}}i=f.getAll("#doctype")[0];if(i){h.doctype="<!DOCTYPE"+i.value+">"}i=f.getAll("title")[0];if(i&&i.firstChild){h.metatitle=i.firstChild.value}b(f.getAll("meta"),function(m){var k=m.attr("name"),j=m.attr("http-equiv"),l;if(k){h["meta"+k.toLowerCase()]=m.attr("content")}else{if(j=="Content-Type"){l=/charset\s*=\s*(.*)\s*/gi.exec(m.attr("content"));if(l){h.docencoding=l[1]}}}});i=f.getAll("html")[0];if(i){h.langcode=d(i,"lang")||d(i,"xml:lang")}i=f.getAll("link")[0];if(i&&i.attr("rel")=="stylesheet"){h.stylesheet=i.attr("href")}i=f.getAll("body")[0];if(i){h.langdir=d(i,"dir");h.style=d(i,"style");h.visited_color=d(i,"vlink");h.link_color=d(i,"link");h.active_color=d(i,"alink")}return h},_dataToHtml:function(g){var f,d,h,j,k,e=this.editor.dom;function c(n,l,m){n.attr(l,m?m:undefined)}function i(l){if(d.firstChild){d.insert(l,d.firstChild)}else{d.append(l)}}f=this._parseHeader();d=f.getAll("head")[0];if(!d){j=f.getAll("html")[0];d=new a("head",1);if(j.firstChild){j.insert(d,j.firstChild,true)}else{j.append(d)}}j=f.firstChild;if(g.xml_pi){k='version="1.0"';if(g.docencoding){k+=' encoding="'+g.docencoding+'"'}if(j.type!=7){j=new a("xml",7);f.insert(j,f.firstChild,true)}j.value=k}else{if(j&&j.type==7){j.remove()}}j=f.getAll("#doctype")[0];if(g.doctype){if(!j){j=new a("#doctype",10);if(g.xml_pi){f.insert(j,f.firstChild)}else{i(j)}}j.value=g.doctype.substring(9,g.doctype.length-1)}else{if(j){j.remove()}}j=f.getAll("title")[0];if(g.metatitle){if(!j){j=new a("title",1);j.append(new a("#text",3)).value=g.metatitle;i(j)}}if(g.docencoding){j=null;b(f.getAll("meta"),function(l){if(l.attr("http-equiv")=="Content-Type"){j=l}});if(!j){j=new a("meta",1);j.attr("http-equiv","Content-Type");j.shortEnded=true;i(j)}j.attr("content","text/html; charset="+g.docencoding)}b("keywords,description,author,copyright,robots".split(","),function(m){var l=f.getAll("meta"),n,p,o=g["meta"+m];for(n=0;n<l.length;n++){p=l[n];if(p.attr("name")==m){if(o){p.attr("content",o)}else{p.remove()}return}}if(o){j=new a("meta",1);j.attr("name",m);j.attr("content",o);j.shortEnded=true;i(j)}});j=f.getAll("link")[0];if(j&&j.attr("rel")=="stylesheet"){if(g.stylesheet){j.attr("href",g.stylesheet)}else{j.remove()}}else{if(g.stylesheet){j=new a("link",1);j.attr({rel:"stylesheet",text:"text/css",href:g.stylesheet});j.shortEnded=true;i(j)}}j=f.getAll("body")[0];if(j){c(j,"dir",g.langdir);c(j,"style",g.style);c(j,"vlink",g.visited_color);c(j,"link",g.link_color);c(j,"alink",g.active_color);e.setAttribs(this.editor.getBody(),{style:g.style,dir:g.dir,vLink:g.visited_color,link:g.link_color,aLink:g.active_color})}j=f.getAll("html")[0];if(j){c(j,"lang",g.langcode);c(j,"xml:lang",g.langcode)}h=new tinymce.html.Serializer({validate:false,indent:true,apply_source_formatting:true,indent_before:"head,html,body,meta,title,script,link,style",indent_after:"head,html,body,meta,title,script,link,style"}).serialize(f);this.head=h.substring(0,h.indexOf("</body>"))},_parseHeader:function(){return new tinymce.html.DomParser({validate:false,root_name:"#document"}).parse(this.head)},_setContent:function(g,d){var m=this,i,c,h=d.content,f,l="",e=m.editor.dom,j;function k(n){return n.replace(/<\/?[A-Z]+/g,function(o){return o.toLowerCase()})}if(d.format=="raw"&&m.head){return}if(d.source_view&&g.getParam("fullpage_hide_in_source_view")){return}h=h.replace(/<(\/?)BODY/gi,"<$1body");i=h.indexOf("<body");if(i!=-1){i=h.indexOf(">",i);m.head=k(h.substring(0,i+1));c=h.indexOf("</body",i);if(c==-1){c=h.length}d.content=h.substring(i+1,c);m.foot=k(h.substring(c))}else{m.head=this._getDefaultHeader();m.foot="\n</body>\n</html>"}f=m._parseHeader();b(f.getAll("style"),function(n){if(n.firstChild){l+=n.firstChild.value}});j=f.getAll("body")[0];if(j){e.setAttribs(m.editor.getBody(),{style:j.attr("style")||"",dir:j.attr("dir")||"",vLink:j.attr("vlink")||"",link:j.attr("link")||"",aLink:j.attr("alink")||""})}if(l){e.add(m.editor.getDoc().getElementsByTagName("head")[0],"style",{id:"fullpage_styles"},l)}else{e.remove("fullpage_styles")}},_getDefaultHeader:function(){var f="",c=this.editor,e,d="";if(c.getParam("fullpage_default_xml_pi")){f+='<?xml version="1.0" encoding="'+c.getParam("fullpage_default_encoding","ISO-8859-1")+'" ?>\n'}f+=c.getParam("fullpage_default_doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');f+="\n<html>\n<head>\n";if(e=c.getParam("fullpage_default_title")){f+="<title>"+e+"</title>\n"}if(e=c.getParam("fullpage_default_encoding")){f+='<meta http-equiv="Content-Type" content="text/html; charset='+e+'" />\n'}if(e=c.getParam("fullpage_default_font_family")){d+="font-family: "+e+";"}if(e=c.getParam("fullpage_default_font_size")){d+="font-size: "+e+";"}if(e=c.getParam("fullpage_default_text_color")){d+="color: "+e+";"}f+="</head>\n<body"+(d?' style="'+d+'"':"")+">\n";return f},_getContent:function(d,e){var c=this;if(!e.source_view||!d.getParam("fullpage_hide_in_source_view")){e.content=tinymce.trim(c.head)+"\n"+tinymce.trim(e.content)+"\n"+tinymce.trim(c.foot)}}});tinymce.PluginManager.add("fullpage",tinymce.plugins.FullPagePlugin)})();
 
tinymce-plugins/3.4.x/fullpage/editor_plugin_src.js DELETED
@@ -1,399 +0,0 @@
1
- /**
2
- * editor_plugin_src.js
3
- *
4
- * Copyright 2009, Moxiecode Systems AB
5
- * Released under LGPL License.
6
- *
7
- * License: http://tinymce.moxiecode.com/license
8
- * Contributing: http://tinymce.moxiecode.com/contributing
9
- */
10
-
11
- (function() {
12
- var each = tinymce.each, Node = tinymce.html.Node;
13
-
14
- tinymce.create('tinymce.plugins.FullPagePlugin', {
15
- init : function(ed, url) {
16
- var t = this;
17
-
18
- t.editor = ed;
19
-
20
- // Register commands
21
- ed.addCommand('mceFullPageProperties', function() {
22
- ed.windowManager.open({
23
- file : url + '/fullpage.htm',
24
- width : 430 + parseInt(ed.getLang('fullpage.delta_width', 0)),
25
- height : 495 + parseInt(ed.getLang('fullpage.delta_height', 0)),
26
- inline : 1
27
- }, {
28
- plugin_url : url,
29
- data : t._htmlToData()
30
- });
31
- });
32
-
33
- // Register buttons
34
- ed.addButton('fullpage', {title : 'fullpage.desc', cmd : 'mceFullPageProperties'});
35
-
36
- ed.onBeforeSetContent.add(t._setContent, t);
37
- ed.onGetContent.add(t._getContent, t);
38
- },
39
-
40
- getInfo : function() {
41
- return {
42
- longname : 'Fullpage',
43
- author : 'Moxiecode Systems AB',
44
- authorurl : 'http://tinymce.moxiecode.com',
45
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage',
46
- version : tinymce.majorVersion + "." + tinymce.minorVersion
47
- };
48
- },
49
-
50
- // Private plugin internal methods
51
-
52
- _htmlToData : function() {
53
- var headerFragment = this._parseHeader(), data = {}, nodes, elm, matches, editor = this.editor;
54
-
55
- function getAttr(elm, name) {
56
- var value = elm.attr(name);
57
-
58
- return value || '';
59
- };
60
-
61
- // Default some values
62
- data.fontface = editor.getParam("fullpage_default_fontface", "");
63
- data.fontsize = editor.getParam("fullpage_default_fontsize", "");
64
-
65
- // Parse XML PI
66
- elm = headerFragment.firstChild;
67
- if (elm.type == 7) {
68
- data.xml_pi = true;
69
- matches = /encoding="([^"]+)"/.exec(elm.value);
70
- if (matches)
71
- data.docencoding = matches[1];
72
- }
73
-
74
- // Parse doctype
75
- elm = headerFragment.getAll('#doctype')[0];
76
- if (elm)
77
- data.doctype = '<!DOCTYPE' + elm.value + ">";
78
-
79
- // Parse title element
80
- elm = headerFragment.getAll('title')[0];
81
- if (elm && elm.firstChild) {
82
- data.metatitle = elm.firstChild.value;
83
- }
84
-
85
- // Parse meta elements
86
- each(headerFragment.getAll('meta'), function(meta) {
87
- var name = meta.attr('name'), httpEquiv = meta.attr('http-equiv'), matches;
88
-
89
- if (name)
90
- data['meta' + name.toLowerCase()] = meta.attr('content');
91
- else if (httpEquiv == "Content-Type") {
92
- matches = /charset\s*=\s*(.*)\s*/gi.exec(meta.attr('content'));
93
-
94
- if (matches)
95
- data.docencoding = matches[1];
96
- }
97
- });
98
-
99
- // Parse html attribs
100
- elm = headerFragment.getAll('html')[0];
101
- if (elm)
102
- data.langcode = getAttr(elm, 'lang') || getAttr(elm, 'xml:lang');
103
-
104
- // Parse stylesheet
105
- elm = headerFragment.getAll('link')[0];
106
- if (elm && elm.attr('rel') == 'stylesheet')
107
- data.stylesheet = elm.attr('href');
108
-
109
- // Parse body parts
110
- elm = headerFragment.getAll('body')[0];
111
- if (elm) {
112
- data.langdir = getAttr(elm, 'dir');
113
- data.style = getAttr(elm, 'style');
114
- data.visited_color = getAttr(elm, 'vlink');
115
- data.link_color = getAttr(elm, 'link');
116
- data.active_color = getAttr(elm, 'alink');
117
- }
118
-
119
- return data;
120
- },
121
-
122
- _dataToHtml : function(data) {
123
- var headerFragment, headElement, html, elm, value, dom = this.editor.dom;
124
-
125
- function setAttr(elm, name, value) {
126
- elm.attr(name, value ? value : undefined);
127
- };
128
-
129
- function addHeadNode(node) {
130
- if (headElement.firstChild)
131
- headElement.insert(node, headElement.firstChild);
132
- else
133
- headElement.append(node);
134
- };
135
-
136
- headerFragment = this._parseHeader();
137
- headElement = headerFragment.getAll('head')[0];
138
- if (!headElement) {
139
- elm = headerFragment.getAll('html')[0];
140
- headElement = new Node('head', 1);
141
-
142
- if (elm.firstChild)
143
- elm.insert(headElement, elm.firstChild, true);
144
- else
145
- elm.append(headElement);
146
- }
147
-
148
- // Add/update/remove XML-PI
149
- elm = headerFragment.firstChild;
150
- if (data.xml_pi) {
151
- value = 'version="1.0"';
152
-
153
- if (data.docencoding)
154
- value += ' encoding="' + data.docencoding + '"';
155
-
156
- if (elm.type != 7) {
157
- elm = new Node('xml', 7);
158
- headerFragment.insert(elm, headerFragment.firstChild, true);
159
- }
160
-
161
- elm.value = value;
162
- } else if (elm && elm.type == 7)
163
- elm.remove();
164
-
165
- // Add/update/remove doctype
166
- elm = headerFragment.getAll('#doctype')[0];
167
- if (data.doctype) {
168
- if (!elm) {
169
- elm = new Node('#doctype', 10);
170
-
171
- if (data.xml_pi)
172
- headerFragment.insert(elm, headerFragment.firstChild);
173
- else
174
- addHeadNode(elm);
175
- }
176
-
177
- elm.value = data.doctype.substring(9, data.doctype.length - 1);
178
- } else if (elm)
179
- elm.remove();
180
-
181
- // Add/update/remove title
182
- elm = headerFragment.getAll('title')[0];
183
- if (data.metatitle) {
184
- if (!elm) {
185
- elm = new Node('title', 1);
186
- elm.append(new Node('#text', 3)).value = data.metatitle;
187
- addHeadNode(elm);
188
- }
189
- }
190
-
191
- // Add meta encoding
192
- if (data.docencoding) {
193
- elm = null;
194
- each(headerFragment.getAll('meta'), function(meta) {
195
- if (meta.attr('http-equiv') == 'Content-Type')
196
- elm = meta;
197
- });
198
-
199
- if (!elm) {
200
- elm = new Node('meta', 1);
201
- elm.attr('http-equiv', 'Content-Type');
202
- elm.shortEnded = true;
203
- addHeadNode(elm);
204
- }
205
-
206
- elm.attr('content', 'text/html; charset=' + data.docencoding);
207
- }
208
-
209
- // Add/update/remove meta
210
- each('keywords,description,author,copyright,robots'.split(','), function(name) {
211
- var nodes = headerFragment.getAll('meta'), i, meta, value = data['meta' + name];
212
-
213
- for (i = 0; i < nodes.length; i++) {
214
- meta = nodes[i];
215
-
216
- if (meta.attr('name') == name) {
217
- if (value)
218
- meta.attr('content', value);
219
- else
220
- meta.remove();
221
-
222
- return;
223
- }
224
- }
225
-
226
- if (value) {
227
- elm = new Node('meta', 1);
228
- elm.attr('name', name);
229
- elm.attr('content', value);
230
- elm.shortEnded = true;
231
-
232
- addHeadNode(elm);
233
- }
234
- });
235
-
236
- // Add/update/delete link
237
- elm = headerFragment.getAll('link')[0];
238
- if (elm && elm.attr('rel') == 'stylesheet') {
239
- if (data.stylesheet)
240
- elm.attr('href', data.stylesheet);
241
- else
242
- elm.remove();
243
- } else if (data.stylesheet) {
244
- elm = new Node('link', 1);
245
- elm.attr({
246
- rel : 'stylesheet',
247
- text : 'text/css',
248
- href : data.stylesheet
249
- });
250
- elm.shortEnded = true;
251
-
252
- addHeadNode(elm);
253
- }
254
-
255
- // Update body attributes
256
- elm = headerFragment.getAll('body')[0];
257
- if (elm) {
258
- setAttr(elm, 'dir', data.langdir);
259
- setAttr(elm, 'style', data.style);
260
- setAttr(elm, 'vlink', data.visited_color);
261
- setAttr(elm, 'link', data.link_color);
262
- setAttr(elm, 'alink', data.active_color);
263
-
264
- // Update iframe body as well
265
- dom.setAttribs(this.editor.getBody(), {
266
- style : data.style,
267
- dir : data.dir,
268
- vLink : data.visited_color,
269
- link : data.link_color,
270
- aLink : data.active_color
271
- });
272
- }
273
-
274
- // Set html attributes
275
- elm = headerFragment.getAll('html')[0];
276
- if (elm) {
277
- setAttr(elm, 'lang', data.langcode);
278
- setAttr(elm, 'xml:lang', data.langcode);
279
- }
280
-
281
- // Serialize header fragment and crop away body part
282
- html = new tinymce.html.Serializer({
283
- validate: false,
284
- indent: true,
285
- apply_source_formatting : true,
286
- indent_before: 'head,html,body,meta,title,script,link,style',
287
- indent_after: 'head,html,body,meta,title,script,link,style'
288
- }).serialize(headerFragment);
289
-
290
- this.head = html.substring(0, html.indexOf('</body>'));
291
- },
292
-
293
- _parseHeader : function() {
294
- // Parse the contents with a DOM parser
295
- return new tinymce.html.DomParser({
296
- validate: false,
297
- root_name: '#document'
298
- }).parse(this.head);
299
- },
300
-
301
- _setContent : function(ed, o) {
302
- var self = this, startPos, endPos, content = o.content, headerFragment, styles = '', dom = self.editor.dom, elm;
303
-
304
- function low(s) {
305
- return s.replace(/<\/?[A-Z]+/g, function(a) {
306
- return a.toLowerCase();
307
- })
308
- };
309
-
310
- // Ignore raw updated if we already have a head, this will fix issues with undo/redo keeping the head/foot separate
311
- if (o.format == 'raw' && self.head)
312
- return;
313
-
314
- if (o.source_view && ed.getParam('fullpage_hide_in_source_view'))
315
- return;
316
-
317
- // Parse out head, body and footer
318
- content = content.replace(/<(\/?)BODY/gi, '<$1body');
319
- startPos = content.indexOf('<body');
320
-
321
- if (startPos != -1) {
322
- startPos = content.indexOf('>', startPos);
323
- self.head = low(content.substring(0, startPos + 1));
324
-
325
- endPos = content.indexOf('</body', startPos);
326
- if (endPos == -1)
327
- endPos = content.length;
328
-
329
- o.content = content.substring(startPos + 1, endPos);
330
- self.foot = low(content.substring(endPos));
331
- } else {
332
- self.head = this._getDefaultHeader();
333
- self.foot = '\n</body>\n</html>';
334
- }
335
-
336
- // Parse header and update iframe
337
- headerFragment = self._parseHeader();
338
- each(headerFragment.getAll('style'), function(node) {
339
- if (node.firstChild)
340
- styles += node.firstChild.value;
341
- });
342
-
343
- elm = headerFragment.getAll('body')[0];
344
- if (elm) {
345
- dom.setAttribs(self.editor.getBody(), {
346
- style : elm.attr('style') || '',
347
- dir : elm.attr('dir') || '',
348
- vLink : elm.attr('vlink') || '',
349
- link : elm.attr('link') || '',
350
- aLink : elm.attr('alink') || ''
351
- });
352
- }
353
-
354
- if (styles)
355
- dom.add(self.editor.getDoc().getElementsByTagName('head')[0], 'style', {id : 'fullpage_styles'}, styles);
356
- else
357
- dom.remove('fullpage_styles');
358
- },
359
-
360
- _getDefaultHeader : function() {
361
- var header = '', editor = this.editor, value, styles = '';
362
-
363
- if (editor.getParam('fullpage_default_xml_pi'))
364
- header += '<?xml version="1.0" encoding="' + editor.getParam('fullpage_default_encoding', 'ISO-8859-1') + '" ?>\n';
365
-
366
- header += editor.getParam('fullpage_default_doctype', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
367
- header += '\n<html>\n<head>\n';
368
-
369
- if (value = editor.getParam('fullpage_default_title'))
370
- header += '<title>' + value + '</title>\n';
371
-
372
- if (value = editor.getParam('fullpage_default_encoding'))
373
- header += '<meta http-equiv="Content-Type" content="text/html; charset=' + value + '" />\n';
374
-
375
- if (value = editor.getParam('fullpage_default_font_family'))
376
- styles += 'font-family: ' + value + ';';
377
-
378
- if (value = editor.getParam('fullpage_default_font_size'))
379
- styles += 'font-size: ' + value + ';';
380
-
381
- if (value = editor.getParam('fullpage_default_text_color'))
382
- styles += 'color: ' + value + ';';
383
-
384
- header += '</head>\n<body' + (styles ? ' style="' + styles + '"' : '') + '>\n';
385
-
386
- return header;
387
- },
388
-
389
- _getContent : function(ed, o) {
390
- var self = this;
391
-
392
- if (!o.source_view || !ed.getParam('fullpage_hide_in_source_view'))
393
- o.content = tinymce.trim(self.head) + '\n' + tinymce.trim(o.content) + '\n' + tinymce.trim(self.foot);
394
- }
395
- });
396
-
397
- // Register plugin
398
- tinymce.PluginManager.add('fullpage', tinymce.plugins.FullPagePlugin);
399
- })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/3.4.x/fullpage/fullpage.htm DELETED
@@ -1,259 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <title>{#fullpage_dlg.title}</title>
5
- <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
6
- <script type="text/javascript" src="../../utils/mctabs.js"></script>
7
- <script type="text/javascript" src="../../utils/form_utils.js"></script>
8
- <script type="text/javascript" src="js/fullpage.js"></script>
9
- <link href="css/fullpage.css" rel="stylesheet" type="text/css" />
10
- </head>
11
- <body id="fullpage" style="display: none">
12
- <form onsubmit="FullPageDialog.update();return false;" name="fullpage" action="#">
13
- <div class="tabs">
14
- <ul>
15
- <li id="meta_tab" class="current"><span><a href="javascript:mcTabs.displayTab('meta_tab','meta_panel');" onmousedown="return false;">{#fullpage_dlg.meta_tab}</a></span></li>
16
- <li id="appearance_tab"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{#fullpage_dlg.appearance_tab}</a></span></li>
17
- </ul>
18
- </div>
19
-
20
- <div class="panel_wrapper">
21
- <div id="meta_panel" class="panel current">
22
- <fieldset>
23
- <legend>{#fullpage_dlg.meta_props}</legend>
24
-
25
- <table border="0" cellpadding="4" cellspacing="0">
26
- <tr>
27
- <td class="nowrap"><label for="metatitle">{#fullpage_dlg.meta_title}</label>&nbsp;</td>
28
- <td><input type="text" id="metatitle" name="metatitle" value="" class="mceFocus" /></td>
29
- </tr>
30
- <tr>
31
- <td class="nowrap"><label for="metakeywords">{#fullpage_dlg.meta_keywords}</label>&nbsp;</td>
32
- <td><textarea id="metakeywords" name="metakeywords" rows="4"></textarea></td>
33
- </tr>
34
- <tr>
35
- <td class="nowrap"><label for="metadescription">{#fullpage_dlg.meta_description}</label>&nbsp;</td>
36
- <td><textarea id="metadescription" name="metadescription" rows="4"></textarea></td>
37
- </tr>
38
- <tr>
39
- <td class="nowrap"><label for="metaauthor">{#fullpage_dlg.author}</label>&nbsp;</td>
40
- <td><input type="text" id="metaauthor" name="metaauthor" value="" /></td>
41
- </tr>
42
- <tr>
43
- <td class="nowrap"><label for="metacopyright">{#fullpage_dlg.copyright}</label>&nbsp;</td>
44
- <td><input type="text" id="metacopyright" name="metacopyright" value="" /></td>
45
- </tr>
46
- <tr>
47
- <td class="nowrap"><label for="metarobots">{#fullpage_dlg.meta_robots}</label>&nbsp;</td>
48
- <td>
49
- <select id="metarobots" name="metarobots">
50
- <option value="">{#not_set}</option>
51
- <option value="index,follow">{#fullpage_dlg.meta_index_follow}</option>
52
- <option value="index,nofollow">{#fullpage_dlg.meta_index_nofollow}</option>
53
- <option value="noindex,follow">{#fullpage_dlg.meta_noindex_follow}</option>
54
- <option value="noindex,nofollow">{#fullpage_dlg.meta_noindex_nofollow}</option>
55
- </select>
56
- </td>
57
- </tr>
58
- </table>
59
- </fieldset>
60
-
61
- <fieldset>
62
- <legend>{#fullpage_dlg.langprops}</legend>
63
-
64
- <table border="0" cellpadding="4" cellspacing="0">
65
- <tr>
66
- <td class="column1"><label for="docencoding">{#fullpage_dlg.encoding}</label></td>
67
- <td>
68
- <select id="docencoding" name="docencoding">
69
- <option value="">{#not_set}</option>
70
- </select>
71
- </td>
72
- </tr>
73
- <tr>
74
- <td class="nowrap"><label for="doctype">{#fullpage_dlg.doctypes}</label>&nbsp;</td>
75
- <td>
76
- <select id="doctype" name="doctype">
77
- <option value="">{#not_set}</option>
78
- </select>
79
- </td>
80
- </tr>
81
- <tr>
82
- <td class="nowrap"><label for="langcode">{#fullpage_dlg.langcode}</label>&nbsp;</td>
83
- <td><input type="text" id="langcode" name="langcode" value="" /></td>
84
- </tr>
85
- <tr>
86
- <td class="column1"><label for="langdir">{#fullpage_dlg.langdir}</label></td>
87
- <td>
88
- <select id="langdir" name="langdir">
89
- <option value="">{#not_set}</option>
90
- <option value="ltr">{#fullpage_dlg.ltr}</option>
91
- <option value="rtl">{#fullpage_dlg.rtl}</option>
92
- </select>
93
- </td>
94
- </tr>
95
- <tr>
96
- <td class="nowrap"><label for="xml_pi">{#fullpage_dlg.xml_pi}</label>&nbsp;</td>
97
- <td><input type="checkbox" id="xml_pi" name="xml_pi" class="checkbox" /></td>
98
- </tr>
99
- </table>
100
- </fieldset>
101
- </div>
102
-
103
- <div id="appearance_panel" class="panel">
104
- <fieldset>
105
- <legend>{#fullpage_dlg.appearance_textprops}</legend>
106
-
107
- <table border="0" cellpadding="4" cellspacing="0">
108
- <tr>
109
- <td class="column1"><label for="fontface">{#fullpage_dlg.fontface}</label></td>
110
- <td>
111
- <select id="fontface" name="fontface" onchange="FullPageDialog.changedStyleProp();">
112
- <option value="">{#not_set}</option>
113
- </select>
114
- </td>
115
- </tr>
116
-
117
- <tr>
118
- <td class="column1"><label for="fontsize">{#fullpage_dlg.fontsize}</label></td>
119
- <td>
120
- <select id="fontsize" name="fontsize" onchange="FullPageDialog.changedStyleProp();">
121
- <option value="">{#not_set}</option>
122
- </select>
123
- </td>
124
- </tr>
125
-
126
- <tr>
127
- <td class="column1"><label for="textcolor">{#fullpage_dlg.textcolor}</label></td>
128
- <td>
129
- <table border="0" cellpadding="0" cellspacing="0">
130
- <tr>
131
- <td><input id="textcolor" name="textcolor" type="text" value="" size="9" onchange="updateColor('textcolor_pick','textcolor');FullPageDialog.changedStyleProp();" /></td>
132
- <td id="textcolor_pickcontainer">&nbsp;</td>
133
- </tr>
134
- </table>
135
- </td>
136
- </tr>
137
- </table>
138
- </fieldset>
139
-
140
- <fieldset>
141
- <legend>{#fullpage_dlg.appearance_bgprops}</legend>
142
-
143
- <table border="0" cellpadding="4" cellspacing="0">
144
- <tr>
145
- <td class="column1"><label for="bgimage">{#fullpage_dlg.bgimage}</label></td>
146
- <td>
147
- <table border="0" cellpadding="0" cellspacing="0">
148
- <tr>
149
- <td><input id="bgimage" name="bgimage" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>
150
- <td id="bgimage_pickcontainer">&nbsp;</td>
151
- </tr>
152
- </table>
153
- </td>
154
- </tr>
155
- <tr>
156
- <td class="column1"><label for="bgcolor">{#fullpage_dlg.bgcolor}</label></td>
157
- <td>
158
- <table border="0" cellpadding="0" cellspacing="0">
159
- <tr>
160
- <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');FullPageDialog.changedStyleProp();" /></td>
161
- <td id="bgcolor_pickcontainer">&nbsp;</td>
162
- </tr>
163
- </table>
164
- </td>
165
- </tr>
166
- </table>
167
- </fieldset>
168
-
169
- <fieldset>
170
- <legend>{#fullpage_dlg.appearance_marginprops}</legend>
171
-
172
- <table border="0" cellpadding="4" cellspacing="0">
173
- <tr>
174
- <td class="column1"><label for="leftmargin">{#fullpage_dlg.left_margin}</label></td>
175
- <td><input id="leftmargin" name="leftmargin" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>
176
- <td class="column1"><label for="rightmargin">{#fullpage_dlg.right_margin}</label></td>
177
- <td><input id="rightmargin" name="rightmargin" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>
178
- </tr>
179
- <tr>
180
- <td class="column1"><label for="topmargin">{#fullpage_dlg.top_margin}</label></td>
181
- <td><input id="topmargin" name="topmargin" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>
182
- <td class="column1"><label for="bottommargin">{#fullpage_dlg.bottom_margin}</label></td>
183
- <td><input id="bottommargin" name="bottommargin" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>
184
- </tr>
185
- </table>
186
- </fieldset>
187
-
188
- <fieldset>
189
- <legend>{#fullpage_dlg.appearance_linkprops}</legend>
190
-
191
- <table border="0" cellpadding="4" cellspacing="0">
192
- <tr>
193
- <td class="column1"><label for="link_color">{#fullpage_dlg.link_color}</label></td>
194
- <td>
195
- <table border="0" cellpadding="0" cellspacing="0">
196
- <tr>
197
- <td><input id="link_color" name="link_color" type="text" value="" size="9" onchange="updateColor('link_color_pick','link_color');FullPageDialog.changedStyleProp();" /></td>
198
- <td id="link_color_pickcontainer">&nbsp;</td>
199
- </tr>
200
- </table>
201
- </td>
202
-
203
- <td class="column1"><label for="visited_color">{#fullpage_dlg.visited_color}</label></td>
204
- <td>
205
- <table border="0" cellpadding="0" cellspacing="0">
206
- <tr>
207
- <td><input id="visited_color" name="visited_color" type="text" value="" size="9" onchange="updateColor('visited_color_pick','visited_color');FullPageDialog.changedStyleProp();" /></td>
208
- <td id="visited_color_pickcontainer">&nbsp;</td>
209
- </tr>
210
- </table>
211
- </td>
212
- </tr>
213
-
214
- <tr>
215
- <td class="column1"><label for="active_color">{#fullpage_dlg.active_color}</label></td>
216
- <td>
217
- <table border="0" cellpadding="0" cellspacing="0">
218
- <tr>
219
- <td><input id="active_color" name="active_color" type="text" value="" size="9" onchange="updateColor('active_color_pick','active_color');FullPageDialog.changedStyleProp();" /></td>
220
- <td id="active_color_pickcontainer">&nbsp;</td>
221
- </tr>
222
- </table>
223
- </td>
224
-
225
- <td>&nbsp;</td>
226
- <td>&nbsp;</td>
227
- </tr>
228
- </table>
229
- </fieldset>
230
-
231
- <fieldset>
232
- <legend>{#fullpage_dlg.appearance_style}</legend>
233
-
234
- <table border="0" cellpadding="4" cellspacing="0">
235
- <tr>
236
- <td class="column1"><label for="stylesheet">{#fullpage_dlg.stylesheet}</label></td>
237
- <td><table border="0" cellpadding="0" cellspacing="0">
238
- <tr>
239
- <td><input id="stylesheet" name="stylesheet" type="text" value="" /></td>
240
- <td id="stylesheet_browsercontainer">&nbsp;</td>
241
- </tr>
242
- </table></td>
243
- </tr>
244
- <tr>
245
- <td class="column1"><label for="style">{#fullpage_dlg.style}</label></td>
246
- <td><input id="style" name="style" type="text" value="" onchange="FullPageDialog.changedStyle();" /></td>
247
- </tr>
248
- </table>
249
- </fieldset>
250
- </div>
251
- </div>
252
-
253
- <div class="mceActionPanel">
254
- <input type="submit" id="insert" name="update" value="{#update}" />
255
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
256
- </div>
257
- </form>
258
- </body>
259
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/3.4.x/fullpage/js/fullpage.js DELETED
@@ -1,232 +0,0 @@
1
- /**
2
- * fullpage.js
3
- *
4
- * Copyright 2009, Moxiecode Systems AB
5
- * Released under LGPL License.
6
- *
7
- * License: http://tinymce.moxiecode.com/license
8
- * Contributing: http://tinymce.moxiecode.com/contributing
9
- */
10
-
11
- (function() {
12
- tinyMCEPopup.requireLangPack();
13
-
14
- var defaultDocTypes =
15
- 'XHTML 1.0 Transitional=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">,' +
16
- 'XHTML 1.0 Frameset=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">,' +
17
- 'XHTML 1.0 Strict=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">,' +
18
- 'XHTML 1.1=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">,' +
19
- 'HTML 4.01 Transitional=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">,' +
20
- 'HTML 4.01 Strict=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">,' +
21
- 'HTML 4.01 Frameset=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">';
22
-
23
- var defaultEncodings =
24
- 'Western european (iso-8859-1)=iso-8859-1,' +
25
- 'Central European (iso-8859-2)=iso-8859-2,' +
26
- 'Unicode (UTF-8)=utf-8,' +
27
- 'Chinese traditional (Big5)=big5,' +
28
- 'Cyrillic (iso-8859-5)=iso-8859-5,' +
29
- 'Japanese (iso-2022-jp)=iso-2022-jp,' +
30
- 'Greek (iso-8859-7)=iso-8859-7,' +
31
- 'Korean (iso-2022-kr)=iso-2022-kr,' +
32
- 'ASCII (us-ascii)=us-ascii';
33
-
34
- var defaultFontNames = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';
35
- var defaultFontSizes = '10px,11px,12px,13px,14px,15px,16px';
36
-
37
- function setVal(id, value) {
38
- var elm = document.getElementById(id);
39
-
40
- if (elm) {
41
- value = value || '';
42
-
43
- if (elm.nodeName == "SELECT")
44
- selectByValue(document.forms[0], id, value);
45
- else if (elm.type == "checkbox")
46
- elm.checked = !!value;
47
- else
48
- elm.value = value;
49
- }
50
- };
51
-
52
- function getVal(id) {
53
- var elm = document.getElementById(id);
54
-
55
- if (elm.nodeName == "SELECT")
56
- return elm.options[elm.selectedIndex].value;
57
-
58
- if (elm.type == "checkbox")
59
- return elm.checked;
60
-
61
- return elm.value;
62
- };
63
-
64
- window.FullPageDialog = {
65
- changedStyle : function() {
66
- var val, styles = tinyMCEPopup.editor.dom.parseStyle(getVal('style'));
67
-
68
- setVal('fontface', styles['font-face']);
69
- setVal('fontsize', styles['font-size']);
70
- setVal('textcolor', styles['color']);
71
-
72
- if (val = styles['background-image'])
73
- setVal('bgimage', val.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"));
74
- else
75
- setVal('bgimage', '');
76
-
77
- setVal('bgcolor', styles['background-color']);
78
-
79
- // Reset margin form elements
80
- setVal('topmargin', '');
81
- setVal('rightmargin', '');
82
- setVal('bottommargin', '');
83
- setVal('leftmargin', '');
84
-
85
- // Expand margin
86
- if (val = styles['margin']) {
87
- val = val.split(' ');
88
- styles['margin-top'] = val[0] || '';
89
- styles['margin-right'] = val[1] || val[0] || '';
90
- styles['margin-bottom'] = val[2] || val[0] || '';
91
- styles['margin-left'] = val[3] || val[0] || '';
92
- }
93
-
94
- if (val = styles['margin-top'])
95
- setVal('topmargin', val.replace(/px/, ''));
96
-
97
- if (val = styles['margin-right'])
98
- setVal('rightmargin', val.replace(/px/, ''));
99
-
100
- if (val = styles['margin-bottom'])
101
- setVal('bottommargin', val.replace(/px/, ''));
102
-
103
- if (val = styles['margin-left'])
104
- setVal('leftmargin', val.replace(/px/, ''));
105
-
106
- updateColor('bgcolor_pick', 'bgcolor');
107
- updateColor('textcolor_pick', 'textcolor');
108
- },
109
-
110
- changedStyleProp : function() {
111
- var val, dom = tinyMCEPopup.editor.dom, styles = dom.parseStyle(getVal('style'));
112
-
113
- styles['font-face'] = getVal('fontface');
114
- styles['font-size'] = getVal('fontsize');
115
- styles['color'] = getVal('textcolor');
116
- styles['background-color'] = getVal('bgcolor');
117
-
118
- if (val = getVal('bgimage'))
119
- styles['background-image'] = "url('" + val + "')";
120
- else
121
- styles['background-image'] = '';
122
-
123
- delete styles['margin'];
124
-
125
- if (val = getVal('topmargin'))
126
- styles['margin-top'] = val + "px";
127
- else
128
- styles['margin-top'] = '';
129
-
130
- if (val = getVal('rightmargin'))
131
- styles['margin-right'] = val + "px";
132
- else
133
- styles['margin-right'] = '';
134
-
135
- if (val = getVal('bottommargin'))
136
- styles['margin-bottom'] = val + "px";
137
- else
138
- styles['margin-bottom'] = '';
139
-
140
- if (val = getVal('leftmargin'))
141
- styles['margin-left'] = val + "px";
142
- else
143
- styles['margin-left'] = '';
144
-
145
- // Serialize, parse and reserialize this will compress redundant styles
146
- setVal('style', dom.serializeStyle(dom.parseStyle(dom.serializeStyle(styles))));
147
- this.changedStyle();
148
- },
149
-
150
- update : function() {
151
- var data = {};
152
-
153
- tinymce.each(tinyMCEPopup.dom.select('select,input,textarea'), function(node) {
154
- data[node.id] = getVal(node.id);
155
- });
156
-
157
- tinyMCEPopup.editor.plugins.fullpage._dataToHtml(data);
158
- tinyMCEPopup.close();
159
- }
160
- };
161
-
162
- function init() {
163
- var form = document.forms[0], i, item, list, editor = tinyMCEPopup.editor;
164
-
165
- // Setup doctype select box
166
- list = editor.getParam("fullpage_doctypes", defaultDocTypes).split(',');
167
- for (i = 0; i < list.length; i++) {
168
- item = list[i].split('=');
169
-
170
- if (item.length > 1)
171
- addSelectValue(form, 'doctype', item[0], item[1]);
172
- }
173
-
174
- // Setup fonts select box
175
- list = editor.getParam("fullpage_fonts", defaultFontNames).split(';');
176
- for (i = 0; i < list.length; i++) {
177
- item = list[i].split('=');
178
-
179
- if (item.length > 1)
180
- addSelectValue(form, 'fontface', item[0], item[1]);
181
- }
182
-
183
- // Setup fontsize select box
184
- list = editor.getParam("fullpage_fontsizes", defaultFontSizes).split(',');
185
- for (i = 0; i < list.length; i++)
186
- addSelectValue(form, 'fontsize', list[i], list[i]);
187
-
188
- // Setup encodings select box
189
- list = editor.getParam("fullpage_encodings", defaultEncodings).split(',');
190
- for (i = 0; i < list.length; i++) {
191
- item = list[i].split('=');
192
-
193
- if (item.length > 1)
194
- addSelectValue(form, 'docencoding', item[0], item[1]);
195
- }
196
-
197
- // Setup color pickers
198
- document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
199
- document.getElementById('link_color_pickcontainer').innerHTML = getColorPickerHTML('link_color_pick','link_color');
200
- document.getElementById('visited_color_pickcontainer').innerHTML = getColorPickerHTML('visited_color_pick','visited_color');
201
- document.getElementById('active_color_pickcontainer').innerHTML = getColorPickerHTML('active_color_pick','active_color');
202
- document.getElementById('textcolor_pickcontainer').innerHTML = getColorPickerHTML('textcolor_pick','textcolor');
203
- document.getElementById('stylesheet_browsercontainer').innerHTML = getBrowserHTML('stylesheetbrowser','stylesheet','file','fullpage');
204
- document.getElementById('bgimage_pickcontainer').innerHTML = getBrowserHTML('bgimage_browser','bgimage','image','fullpage');
205
-
206
- // Resize some elements
207
- if (isVisible('stylesheetbrowser'))
208
- document.getElementById('stylesheet').style.width = '220px';
209
-
210
- if (isVisible('link_href_browser'))
211
- document.getElementById('element_link_href').style.width = '230px';
212
-
213
- if (isVisible('bgimage_browser'))
214
- document.getElementById('bgimage').style.width = '210px';
215
-
216
- // Update form
217
- tinymce.each(tinyMCEPopup.getWindowArg('data'), function(value, key) {
218
- setVal(key, value);
219
- });
220
-
221
- FullPageDialog.changedStyle();
222
-
223
- // Update colors
224
- updateColor('textcolor_pick', 'textcolor');
225
- updateColor('bgcolor_pick', 'bgcolor');
226
- updateColor('visited_color_pick', 'visited_color');
227
- updateColor('active_color_pick', 'active_color');
228
- updateColor('link_color_pick', 'link_color');
229
- };
230
-
231
- tinyMCEPopup.onInit.add(init);
232
- })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/3.4.x/fullpage/langs/en_dlg.js DELETED
@@ -1,85 +0,0 @@
1
- tinyMCE.addI18n('en.fullpage_dlg',{
2
- title:"Document properties",
3
- meta_tab:"General",
4
- appearance_tab:"Appearance",
5
- advanced_tab:"Advanced",
6
- meta_props:"Meta information",
7
- langprops:"Language and encoding",
8
- meta_title:"Title",
9
- meta_keywords:"Keywords",
10
- meta_description:"Description",
11
- meta_robots:"Robots",
12
- doctypes:"Doctype",
13
- langcode:"Language code",
14
- langdir:"Language direction",
15
- ltr:"Left to right",
16
- rtl:"Right to left",
17
- xml_pi:"XML declaration",
18
- encoding:"Character encoding",
19
- appearance_bgprops:"Background properties",
20
- appearance_marginprops:"Body margins",
21
- appearance_linkprops:"Link colors",
22
- appearance_textprops:"Text properties",
23
- bgcolor:"Background color",
24
- bgimage:"Background image",
25
- left_margin:"Left margin",
26
- right_margin:"Right margin",
27
- top_margin:"Top margin",
28
- bottom_margin:"Bottom margin",
29
- text_color:"Text color",
30
- font_size:"Font size",
31
- font_face:"Font face",
32
- link_color:"Link color",
33
- hover_color:"Hover color",
34
- visited_color:"Visited color",
35
- active_color:"Active color",
36
- textcolor:"Color",
37
- fontsize:"Font size",
38
- fontface:"Font family",
39
- meta_index_follow:"Index and follow the links",
40
- meta_index_nofollow:"Index and don't follow the links",
41
- meta_noindex_follow:"Do not index but follow the links",
42
- meta_noindex_nofollow:"Do not index and don\'t follow the links",
43
- appearance_style:"Stylesheet and style properties",
44
- stylesheet:"Stylesheet",
45
- style:"Style",
46
- author:"Author",
47
- copyright:"Copyright",
48
- add:"Add new element",
49
- remove:"Remove selected element",
50
- moveup:"Move selected element up",
51
- movedown:"Move selected element down",
52
- head_elements:"Head elements",
53
- info:"Information",
54
- add_title:"Title element",
55
- add_meta:"Meta element",
56
- add_script:"Script element",
57
- add_style:"Style element",
58
- add_link:"Link element",
59
- add_base:"Base element",
60
- add_comment:"Comment node",
61
- title_element:"Title element",
62
- script_element:"Script element",
63
- style_element:"Style element",
64
- base_element:"Base element",
65
- link_element:"Link element",
66
- meta_element:"Meta element",
67
- comment_element:"Comment",
68
- src:"Src",
69
- language:"Language",
70
- href:"Href",
71
- target:"Target",
72
- type:"Type",
73
- charset:"Charset",
74
- defer:"Defer",
75
- media:"Media",
76
- properties:"Properties",
77
- name:"Name",
78
- value:"Value",
79
- content:"Content",
80
- rel:"Rel",
81
- rev:"Rev",
82
- hreflang:"Href lang",
83
- general_props:"General",
84
- advanced_props:"Advanced"
85
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/editor_plugin.js DELETED
@@ -1,84 +0,0 @@
1
-
2
- (function() {
3
- tinymce.PluginManager.requireLangPack('cmseditor');
4
- tinymce.create('tinymce.plugins.cmseditor', {
5
- init : function(ed, url) {
6
- var t = this;
7
- t.editor = ed;
8
-
9
- // load JS
10
- tinymce.DOM.add(tinymce.DOM.select('head'), 'script', {src: url + '/js/codemirror-compressed.js'});
11
- //tinymce.DOM.add(tinymce.DOM.select('head'), 'script', {src: url + '/js/lib/codemirror.js'});
12
- //tinymce.DOM.add(tinymce.DOM.select('head'), 'script', {src: url + '/js/mode/xml/xml.js'});
13
- //tinymce.DOM.add(tinymce.DOM.select('head'), 'script', {src: url + '/js/mode/css/css.js'});
14
- //tinymce.DOM.add(tinymce.DOM.select('head'), 'script', {src: url + '/js/mode/javascript/javascript.js'});
15
- //tinymce.DOM.add(tinymce.DOM.select('head'), 'script', {src: url + '/js/mode/htmlmixed/htmlmixed.js'});
16
-
17
- // load CSS
18
- tinymce.DOM.loadCSS(url + '/js/lib/codemirror.css');
19
- tinymce.DOM.loadCSS(url + '/js/theme/default.css');
20
-
21
- ed.addCommand('cmseditor', function() {
22
- t.initEditor();
23
- }, t );
24
-
25
- ed.addButton('cmseditor', {
26
- title : 'CodeMirror Source Editor',
27
- cmd : 'cmseditor',
28
- image : url + '/img/html.gif'
29
- });
30
- },
31
- initEditor : function(){
32
- var t = this, ed = t.editor, id = ed.getElement().id, cm = document.getElementById(id);
33
-
34
- ed.hide();
35
-
36
- t.cmEditor = CodeMirror.fromTextArea( cm, {
37
- matchBrackets: true,
38
- lineNumbers : true,
39
- mode : 'text/html'
40
- });
41
- t.indentAll();
42
- t.cmEditor.refresh();
43
- var close_btn = t.initToolBar();
44
- close_btn.onclick = function() {
45
- t.closeEditor(t);
46
- };
47
- },
48
- initToolBar: function() {
49
- var t = this;
50
- t.cmWrapper = t.cmEditor.getWrapperElement();
51
- t.cmWrapper.style.width = '100%';
52
-
53
- t.cmWrapper.cmToolBar = document.createElement("div");
54
- t.cmWrapper.cmToolBar.style.width = '100%';
55
- t.cmWrapper.cmToolBar.className = 'CodeMirror-ToolBar';
56
- t.cmWrapper.parentNode.insertBefore(t.cmWrapper.cmToolBar, t.cmWrapper);
57
- return tinymce.DOM.add(t.cmWrapper.cmToolBar, 'input', { type: 'button', value: 'x', 'class': 'CodeMirror-ToolBar-close' });
58
- },
59
- closeEditor: function(t) {
60
- var ed = t.editor;
61
- ed.show();
62
- ed.setContent(t.cmEditor.getValue());
63
- t.cmWrapper.parentNode.removeChild(t.cmWrapper.cmToolBar);
64
- t.cmWrapper.parentNode.removeChild(t.cmWrapper);
65
- t.cmEditor = null;
66
- },
67
- indentAll: function() {
68
- var lineCount = this.cmEditor.lineCount();
69
- for(var line = 0; line < lineCount; line++) {
70
- this.cmEditor.indentLine(line);
71
- }
72
- },
73
- getInfo : function() {
74
- return {
75
- longname : 'CodeMirror Source Editor',
76
- author : 'Nicolas Lemoine',
77
- authorurl : 'http://wordpress.org/extend/plugins/wp-better-emails/',
78
- infourl : 'http://wordpress.org/extend/plugins/wp-better-emails/',
79
- version : '0.1'
80
- };
81
- }
82
- });
83
- tinymce.PluginManager.add('cmseditor', tinymce.plugins.cmseditor);
84
- })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/img/ed-bg.gif DELETED
Binary file
tinymce-plugins/cmseditor/img/html.gif DELETED
Binary file
tinymce-plugins/cmseditor/js/LICENSE DELETED
@@ -1,19 +0,0 @@
1
- Copyright (C) 2011 by Marijn Haverbeke <marijnh@gmail.com>
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/README.md DELETED
@@ -1,6 +0,0 @@
1
- # CodeMirror 2
2
-
3
- CodeMirror 2 is a rewrite of [CodeMirror
4
- 1](http://github.com/marijnh/CodeMirror). The docs live
5
- [here](http://codemirror.net/manual.html), and the project page is
6
- [http://codemirror.net/](http://codemirror.net/).
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/codemirror-compressed.js DELETED
@@ -1 +0,0 @@
1
- var CodeMirror=function(){function a(b,c){function bv(a){return a>=0&&a<$.length}function bx(a){ba=null;var b={line:0,ch:0};bH(b,{line:$.length-1,ch:$[$.length-1].text.length},N(a),b,b),ba=new j,bg=!0}function by(a){var b=[];for(var c=0,d=$.length;c<d;++c)b.push($[c].text);return b.join("\n")}function bz(a){function h(){bW(),bg=!0,j(),k()}function i(a){var b=cH(a,!0);if(b&&!G(b,e)){bb||bF(),e=b,ce(d,b),bg=!1;var c=b$();if(b.line>=c.to||b.line<c.from)f=setTimeout(cU(function(){i(a)}),150)}}for(var b=p(a);b!=w;b=b.parentNode)if(b.parentNode==J&&b!=Q)return;var c=bf;bf=null;for(var b=p(a);b!=w;b=b.parentNode)if(b.parentNode==S)return g.onGutterClick&&g.onGutterClick(bw,M(S.childNodes,b)+bl,a),m(a);var d=cH(a);switch(q(a)){case 3:u&&!z&&cI(a);return;case 2:d&&cg(d.line,d.ch,!0);return}if(!d){p(a)==D&&m(a);return}bb||bF(),m(a);if(c&&+(new Date)-c<400)return cn(d.line);cg(d.line,d.ch,!0);var e=d,f,j=r(n,"mousemove",cU(function(a){clearTimeout(f),m(a),i(a)}),!0),k=r(n,"mouseup",cU(function(a){clearTimeout(f);var b=cH(a);b&&ce(d,b),m(a),h()}),!0)}function bA(a){var b=cH(a);if(!b)return;cm(b),m(a),bf=+(new Date)}function bB(a){a.preventDefault();var b=cH(a,!0),c=a.dataTransfer.files;if(!b||g.readOnly)return;if(c&&c.length&&window.FileReader&&window.File){function d(a,c){var d=new FileReader;d.onload=function(){f[c]=d.result,++h==e&&bM(f.join(""),ci(b),ci(b))},d.readAsText(a)}var e=c.length,f=Array(e),h=0;for(var i=0;i<e;++i)d(c[i],i)}else try{var f=a.dataTransfer.getData("Text");f&&bM(f,b,b)}catch(a){}}function bC(a){bb||bF();var b=a.keyCode;v&&b==27&&(a.returnValue=!1);var c=(z?a.metaKey:a.ctrlKey)&&!a.altKey,d=a.ctrlKey||a.altKey||a.metaKey;b==16||a.shiftKey?bd=bd||(bc.inverted?bc.to:bc.from):bd=null;if(g.onKeyEvent&&g.onKeyEvent(bw,l(a)))return;if(b==33||b==34)return cj(b==34),m(a);if(c&&(b==36||b==35||z&&(b==38||b==40)))return ck(b==36||b==38),m(a);if(c&&b==65)return cl(),m(a);if(!g.readOnly){if(!d&&b==13)return;if(!d&&b==9&&cp(a.shiftKey))return m(a);if(c&&b==90)return bJ(),m(a);if(c&&(a.shiftKey&&b==90||b==89))return bK(),m(a)}if(b==36&&g.smartHome)return cq(),m(a);bo=(c?"c":"")+(a.altKey?"a":"")+b;if(bc.inverted&&A[bo]===!0){var e=O(C);e&&(be={anchor:e.start},P(C,e.start,e.start))}!c&&!a.altKey&&(bo=null),bT(bo)}function bD(a){if(g.onKeyEvent&&g.onKeyEvent(bw,l(a)))return;be&&(be=null,bg=!0),a.keyCode==16&&(bd=null)}function bE(a){if(g.onKeyEvent&&g.onKeyEvent(bw,l(a)))return;if(g.electricChars&&Z.electricChars){var b=String.fromCharCode(a.charCode==null?a.keyCode:a.charCode);Z.electricChars.indexOf(b)>-1&&setTimeout(cU(function(){cr(bc.to.line,"smart")}),50)}var c=a.keyCode;c==13?(g.readOnly||co(),m(a)):!a.ctrlKey&&!a.altKey&&!a.metaKey&&c==9&&g.tabMode!="default"?m(a):bT(bo)}function bF(){if(g.readOnly=="nocursor")return;bb||(g.onFocus&&g.onFocus(bw),bb=!0,w.className.search(/\bCodeMirror-focused\b/)==-1&&(w.className+=" CodeMirror-focused"),bk||bV()),bS(),cJ()}function bG(){bb&&(g.onBlur&&g.onBlur(bw),bb=!1,w.className=w.className.replace(" CodeMirror-focused","")),clearInterval(Y),setTimeout(function(){bb||(bd=null)},150)}function bH(a,b,c,d,e){if(ba){var f=[];for(var h=a.line,i=b.line+1;h<i;++h)f.push($[h].text);ba.addChange(a.line,c.length,f);while(ba.done.length>g.undoDepth)ba.done.shift()}bL(a,b,c,d,e)}function bI(a,b){var c=a.pop();if(c){var d=[],e=c.start+c.added;for(var f=c.start;f<e;++f)d.push($[f].text);b.push({start:c.start,added:c.old.length,old:d});var g=ci({line:c.start+c.old.length-1,ch:L(d[d.length-1],c.old[c.old.length-1])});bL({line:c.start,ch:0},{line:e-1,ch:$[e-1].text.length},c.old,g,g),bg=!0}}function bJ(){bI(ba.done,ba.undone)}function bK(){bI(ba.undone,ba.done)}function bL(a,b,c,d,e){function s(a){return a<=Math.min(b.line,b.line+q)?a:a+q}var f=!1,g=br.length;for(var i=a.line;i<=b.line;++i)if($[i].text.length==g){f=!0;break}var j=b.line-a.line,k=$[a.line],l=$[b.line];if(k==l)if(c.length==1)k.replace(a.ch,b.ch,c[0]);else{l=k.split(b.ch,c[c.length-1]);var m=[a.line+1,j];k.replace(a.ch,k.text.length,c[0]);for(var i=1,n=c.length-1;i<n;++i)m.push(new h(c[i]));m.push(l),$.splice.apply($,m)}else if(c.length==1)k.replace(a.ch,k.text.length,c[0]+l.text.slice(b.ch)),$.splice(a.line+1,j);else{var m=[a.line+1,j-1];k.replace(a.ch,k.text.length,c[0]),l.replace(0,b.ch,c[c.length-1]);for(var i=1,n=c.length-1;i<n;++i)m.push(new h(c[i]));$.splice.apply($,m)}for(var i=a.line,n=i+c.length;i<n;++i){var o=$[i].text;o.length>g&&(br=o,g=o.length,bs=null,f=!1)}if(f){g=0,br="",bs=null;for(var i=0,n=$.length;i<n;++i){var o=$[i].text;o.length>g&&(g=o.length,br=o)}}var p=[],q=c.length-j-1;for(var i=0,o=_.length;i<o;++i){var r=_[i];r<a.line?p.push(r):r>b.line&&p.push(r+q)}c.length<5?(cO(a.line,a.line+c.length),p.push(a.line+c.length)):p.push(a.line),_=p,cQ(100),bh.push({from:a.line,to:b.line+1,diff:q}),bi={from:a,to:b,text:c},cf(d,e,s(bc.from.line),s(bc.to.line)),J.style.height=$.length*cE()+2*cF()+"px"}function bM(a,b,c){function d(d){if(H(d,b))return d;if(!H(c,d))return e;var f=d.line+a.length-(c.line-b.line)-1,g=d.ch;return d.line==c.line&&(g+=a[a.length-1].length-(c.ch-(c.line==b.line?b.ch:0))),{line:f,ch:g}}b=ci(b),c?c=ci(c):c=b,a=N(a);var e;return bO(a,b,c,function(a){return e=a,{from:d(bc.from),to:d(bc.to)}}),e}function bN(a,b){bO(N(a),bc.from,bc.to,function(a){return b=="end"?{from:a,to:a}:b=="start"?{from:bc.from,to:bc.from}:{from:bc.from,to:a}})}function bO(a,b,c,d){var e=a.length==1?a[0].length+b.ch:a[a.length-1].length,f=d({line:b.line+a.length-1,ch:e});bH(b,c,a,f.from,f.to)}function bP(a,b){var c=a.line,d=b.line;if(c==d)return $[c].text.slice(a.ch,b.ch);var e=[$[c].text.slice(a.ch)];for(var f=c+1;f<d;++f)e.push($[f].text);return e.push($[d].text.slice(0,b.ch)),e.join("\n")}function bQ(){return bP(bc.from,bc.to)}function bS(){if(bR)return;W.set(2e3,function(){cR(),bU(),bb&&bS(),cS()})}function bT(a){function c(){cR();var d=bU();d&&a&&(d=="moved"&&A[a]==null&&(A[a]=!0),d=="changed"&&(A[a]=!1)),!d&&!b?(b=!0,W.set(80,c)):(bR=!1,bS()),cS()}var b=!1;bR=!0,W.set(20,c)}function bU(){function f(a,c){var d=0;for(;;){var e=b.indexOf("\n",d);if(e==-1||(b.charAt(e-1)=="\r"?e-1:e)>=a)return{line:c,ch:a-d};++c,d=e+1}}if(bk||!bb)return;var a=!1,b=C.value,c=O(C);if(!c)return!1;var a=bp.text!=b,d=be,e=a||c.start!=bp.start||c.end!=(d?bp.start:bp.end);if(!e&&!d)return!1;if(a){bd=be=null;if(g.readOnly)return bg=!0,"changed"}var h=f(c.start,bp.from),i=f(c.end,bp.from);if(d){var j=c.start==d.anchor?i:h,k=bd?bc.to:c.start==d.anchor?h:i;(bc.inverted=H(j,k))?(h=j,i=k):(be=null,h=k,i=j)}h.line==i.line&&h.line==bc.from.line&&h.line==bc.to.line&&!bd&&(bg=!1);if(a){var l=0,m=b.length,n=Math.min(m,bp.text.length),o,p=bp.from,q=-1;while(l<n&&(o=b.charAt(l))==bp.text.charAt(l))++l,o=="\n"&&(p++,q=l);var r=q>-1?l-q:l,s=bp.to-1,t=bp.text.length;for(;;){o=bp.text.charAt(t);if(b.charAt(m)!=o){++m,++t;break}o=="\n"&&s--;if(t<=l||m<=l)break;--m,--t}var q=bp.text.lastIndexOf("\n",t-1),u=q==-1?t:t-q-1;bH({line:p,ch:r},{line:s,ch:u},N(b.slice(l,m)),h,i);if(p!=s||h.line!=p)bg=!0}else cf(h,i);return bp.text=b,bp.start=c.start,bp.end=c.end,a?"changed":e?"moved":!1}function bV(){var a=[],b=Math.max(0,bc.from.line-1),c=Math.min($.length,bc.to.line+2);for(var d=b;d<c;++d)a.push($[d].text);a=C.value=a.join(x);var e=bc.from.ch,f=bc.to.ch;for(var d=b;d<bc.from.line;++d)e+=x.length+$[d].text.length;for(var d=b;d<bc.to.line;++d)f+=x.length+$[d].text.length;bp={text:a,from:b,to:c,start:e,end:f},P(C,e,be?e:f)}function bW(){g.readOnly!="nocursor"&&C.focus()}function bX(){if(!U.getBoundingClientRect)return;var a=U.getBoundingClientRect(),b=window.innerHeight||document.body.offsetHeight||document.documentElement.offsetHeight;(a.top<0||a.bottom>b)&&U.scrollIntoView()}function bY(){var a=cC(bc.inverted?bc.from:bc.to);return bZ(a.x,a.y,a.x,a.yBot)}function bZ(a,b,c,d){var e=cG(),f=cF(),h=cE();b+=f,d+=f,a+=e,c+=e;var i=D.clientHeight,j=D.scrollTop,k=!1,l=!0;b<j?(D.scrollTop=Math.max(0,b-2*h),k=!0):d>j+i&&(D.scrollTop=d+h-i,k=!0);var m=D.clientWidth,n=D.scrollLeft,o=g.fixedGutter?R.clientWidth:0;return a<n+o?(a<50&&(a=0),D.scrollLeft=Math.max(0,a-10-o),k=!0):c>m+n&&(D.scrollLeft=c+10-m,k=!0,c>J.clientWidth&&(l=!1)),k&&g.onScroll&&g.onScroll(bw),l}function b$(){var a=cE(),b=D.scrollTop-cF();return{from:Math.min($.length,Math.max(0,Math.floor(b/a))),to:Math.min($.length,Math.ceil((b+D.clientHeight)/a))}}function b_(a){if(!D.clientWidth){bl=bm=0;return}var b=a===!0?[]:[{from:bl,to:bm,domStart:0}];for(var c=0,d=a.length||0;c<d;++c){var e=a[c],f=[],g=e.diff||0;for(var h=0,i=b.length;h<i;++h){var j=b[h];e.to<=j.from?f.push({from:j.from+g,to:j.to+g,domStart:j.domStart}):j.to<=e.from?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from,domStart:j.domStart}),e.to<j.to&&f.push({from:e.to+g,to:j.to+g,domStart:j.domStart+(e.to-j.from)}))}b=f}var k=b$(),l=Math.min(bl,Math.max(k.from-3,0)),m=Math.min($.length,Math.max(bm,k.to+3)),n=[],o=0,p=bm-bl,q=l,r=0;for(var c=0,d=b.length;c<d;++c){var j=b[c];if(j.to<=l)continue;if(j.from>=m)break;if(j.domStart>o||j.from>q)n.push({from:q,to:j.from,domSize:j.domStart-o,domStart:o}),r+=j.from-q;q=j.to,o=j.domStart+(j.to-j.from)}if(o!=p||q!=m)r+=Math.abs(m-q),n.push({from:q,to:m,domSize:p-o,domStart:o});if(!n.length)return;V.style.display="none",r>(k.to-k.from)*.3?ca(l=Math.max(k.from-10,0),m=Math.min(k.to+7,$.length)):cb(n),V.style.display="";var s=l!=bl||m!=bm||bn!=D.clientHeight;bl=l,bm=m,Q.style.top=l*cE()+"px",s&&(bn=D.clientHeight,J.style.height=$.length*cE()+2*cF()+"px"),(s||n.length)&&cc(),bs==null&&(bs=cz(br)),bs>D.clientWidth?(T.style.width=bs+"px",J.style.width="",J.style.width=D.scrollWidth+"px"):T.style.width=J.style.width="";if(V.childNodes.length!=bm-bl)throw new Error("BAD PATCH! "+JSON.stringify(n)+" size="+(bm-bl)+" nodes="+V.childNodes.length);cd()}function ca(a,b){var c=[],d={line:a,ch:0},e=H(bc.from,d)&&!H(bc.to,d);for(var f=a;f<b;++f){var g=null,h=null;e?(g=0,bc.to.line==f&&(e=!1,h=bc.to.ch)):bc.from.line==f&&(bc.to.line==f?(g=bc.from.ch,h=bc.to.ch):(e=!0,g=bc.from.ch)),c.push($[f].getHTML(g,h,!0))}V.innerHTML=c.join("")}function cb(a){var b=bc.from.line,c=bc.to.line,d=0,e=t&&n.createElement("div");for(var f=0,g=a.length;f<g;++f){var h=a[f],i=h.to-h.from-h.domSize,j=V.childNodes[h.domStart+h.domSize+d]||null;if(t)for(var k=Math.max(-i,h.domSize);k>0;--k)V.removeChild(j?j.previousSibling:V.lastChild);else if(i){for(var k=Math.max(0,i);k>0;--k)V.insertBefore(n.createElement("pre"),j);for(var k=Math.max(0,-i);k>0;--k)V.removeChild(j?j.previousSibling:V.lastChild)}var l=V.childNodes[h.domStart+d],m=b<h.from&&c>=h.from;for(var k=h.from;k<h.to;++k){var o=null,p=null;m?(o=0,c==k&&(m=!1,p=bc.to.ch)):b==k&&(c==k?(o=bc.from.ch,p=bc.to.ch):(m=!0,o=bc.from.ch)),t?(e.innerHTML=$[k].getHTML(o,p,!0),V.insertBefore(e.firstChild,j)):(l.innerHTML=$[k].getHTML(o,p,!1),l.className=$[k].className||"",l=l.nextSibling)}d+=i}}function cc(){if(!g.gutter&&!g.lineNumbers)return;var a=Q.offsetHeight,b=D.clientHeight;R.style.height=(a-b<2?b:a)+"px";var c=[];for(var d=bl;d<Math.max(bm,bl+1);++d){var e=$[d].gutterMarker,f=g.lineNumbers?d+g.firstLineNumber:null;e&&e.text?f=e.text.replace("%N%",f!=null?f:""):f==null&&(f="\u00a0"),c.push(e&&e.style?'<pre class="'+e.style+'">':"<pre>",f,"</pre>")}R.style.display="none",S.innerHTML=c.join("");var h=String($.length).length,i=S.firstChild,j=F(i),k="";while(j.length+k.length<h)k+="\u00a0";k&&i.insertBefore(n.createTextNode(k),i.firstChild),R.style.display="",T.style.marginLeft=R.offsetWidth+"px"}function cd(){var a=bc.inverted?bc.from:bc.to,b=cE(),c=cA(a.line,a.ch);B.style.top=a.line*b-D.scrollTop+"px",B.style.left=c-D.scrollLeft+"px",G(bc.from,bc.to)?(U.style.top=(a.line-bl)*b+"px",U.style.left=c+"px",U.style.display=""):U.style.display="none"}function ce(a,b){var c=bd&&ci(bd);c&&(H(c,a)?a=c:H(b,c)&&(b=c)),cf(a,b)}function cf(a,b,c,d){if(G(bc.from,a)&&G(bc.to,b))return;if(H(b,a)){var e=b;b=a,a=e}G(a,b)?bc.inverted=!1:G(a,bc.to)?bc.inverted=!1:G(b,bc.from)&&(bc.inverted=!0),c==null&&(c=bc.from.line,d=bc.to.line),G(a,b)?G(bc.from,bc.to)||bh.push({from:c,to:d+1}):G(bc.from,bc.to)?bh.push({from:a.line,to:b.line+1}):(G(a,bc.from)||(a.line<c?bh.push({from:a.line,to:Math.min(b.line,c)+1}):bh.push({from:c,to:Math.min(d,a.line)+1})),G(b,bc.to)||(b.line<d?bh.push({from:Math.max(c,a.line),to:d+1}):bh.push({from:Math.max(a.line,d),to:b.line+1}))),bc.from=a,bc.to=b,bj=!0}function cg(a,b,c){var d=ci({line:a,ch:b||0});(c?ce:cf)(d,d)}function ch(a){return Math.max(0,Math.min(a,$.length-1))}function ci(a){if(a.line<0)return{line:0,ch:0};if(a.line>=$.length)return{line:$.length-1,ch:$[$.length-1].text.length};var b=a.ch,c=$[a.line].text.length;return b==null||b>c?{line:a.line,ch:c}:b<0?{line:a.line,ch:0}:a}function cj(a){var b=Math.floor(D.clientHeight/cE()),c=bc.inverted?bc.from:bc.to;cg(c.line+Math.max(b-1,1)*(a?1:-1),c.ch,!0)}function ck(a){var b=a?{line:0,ch:0}:{line:$.length-1,ch:$[$.length-1].text.length};ce(b,b)}function cl(){var a=$.length-1;cf({line:0,ch:0},{line:a,ch:$[a].text.length})}function cm(a){var b=$[a.line].text,c=a.ch,d=a.ch;while(c>0&&/\w/.test(b.charAt(c-1)))--c;while(d<b.length&&/\w/.test(b.charAt(d)))++d;ce({line:a.line,ch:c},{line:a.line,ch:d})}function cn(a){ce({line:a,ch:0},{line:a,ch:$[a].text.length})}function co(){bN("\n","end"),g.enterMode!="flat"&&cr(bc.from.line,g.enterMode=="keep"?"prev":"smart")}function cp(a){function b(a){if(G(bc.from,bc.to))return cr(bc.from.line,a);var b=bc.to.line-(bc.to.ch?0:1);for(var c=bc.from.line;c<=b;++c)cr(c,a)}bd=null;switch(g.tabMode){case"default":return!1;case"indent":b("smart");break;case"classic":if(G(bc.from,bc.to)){a?cr(bc.from.line,"smart"):bN("\t","end");break};case"shift":b(a?"subtract":"add")}return!0}function cq(){var a=Math.max(0,$[bc.from.line].text.search(/\S/));cg(bc.from.line,bc.from.ch<=a&&bc.from.ch?0:a,!0)}function cr(a,b){if(b=="smart")if(!Z.indent)b="prev";else var c=cN(a);var d=$[a],e=d.indentation(),f=d.text.match(/^\s*/)[0],h;b=="prev"?a?h=$[a-1].indentation():h=0:b=="smart"?h=Z.indent(c,d.text.slice(f.length)):b=="add"?h=e+g.indentUnit:b=="subtract"&&(h=e-g.indentUnit),h=Math.max(0,h);var i=h-e;if(!i){if(bc.from.line!=a&&bc.to.line!=a)return;var j=f}else{var j="",k=0;if(g.indentWithTabs)for(var l=Math.floor(h/y);l;--l)k+=y,j+="\t";while(k<h)++k,j+=" "}bM(j,{line:a,ch:0},{line:a,ch:f.length})}function cs(){Z=a.getMode(g,g.mode);for(var b=0,c=$.length;b<c;++b)$[b].stateAfter=null;_=[0],cQ()}function ct(){var a=g.gutter||g.lineNumbers;R.style.display=a?"":"none",a?cc():V.parentNode.style.marginLeft=0}function cu(a,b,c){function e(a,b,c,e){var a=$[a],f=a.addMark(b,c,e);f.line=a,d.push(f)}a=ci(a),b=ci(b);var d=[];if(a.line==b.line)e(a.line,a.ch,b.ch,c);else{e(a.line,a.ch,null,c);for(var f=a.line+1,g=b.line;f<g;++f)e(f,0,null,c);e(b.line,0,b.ch,c)}return bh.push({from:a.line,to:b.line+1}),function(){var a,b;for(var c=0;c<d.length;++c){var e=d[c],f=M($,e.line);e.line.removeMark(e),f>-1&&(a==null&&(a=f),b=f)}a!=null&&bh.push({from:a,to:b+1})}}function cv(a,b,c){return typeof a=="number"&&(a=$[ch(a)]),a.gutterMarker={text:b,style:c},cc(),a}function cw(a){typeof a=="number"&&(a=$[ch(a)]),a.gutterMarker=null,cc()}function cx(a,b){if(typeof a=="number"){var c=a;a=$[ch(a)]}else{var c=M($,a);if(c==-1)return null}return a.className!=b&&(a.className=b,bh.push({from:c,to:c+1})),a}function cy(a){if(typeof a=="number"){var b=a;a=$[a];if(!a)return null}else{var b=M($,a);if(b==-1)return null}var c=a.gutterMarker;return{line:b,text:a.text,markerText:c&&c.text,markerClass:c&&c.style}}function cz(a){return K.innerHTML="<pre><span>x</span></pre>",K.firstChild.firstChild.firstChild.nodeValue=a,K.firstChild.firstChild.offsetWidth||10}function cA(a,b){return b==0?0:(K.innerHTML="<pre><span>"+$[a].getHTML(null,null,!1,b)+"</span></pre>",K.firstChild.firstChild.offsetWidth)}function cB(a,b){function e(a){return K.innerHTML="<pre><span>"+c.getHTML(null,null,!1,a)+"</span></pre>",K.firstChild.firstChild.offsetWidth}if(b<=0)return 0;var c=$[a],d=c.text,f=0,g=0,h=d.length,i,j=Math.min(h,Math.ceil(b/cz("x")));for(;;){var k=e(j);if(k<=b&&j<h)j=Math.min(h,Math.ceil(j*1.2));else{i=k,h=j;break}}if(b>i)return h;j=Math.floor(h*.8),k=e(j),k<b&&(f=j,g=k);for(;;){if(h-f<=1)return i-b>b-g?f:h;var l=Math.ceil((f+h)/2),m=e(l);m>b?(h=l,i=m):(f=l,g=m)}}function cC(a,b){var c=cE(),d=a.line-(b?bl:0);return{x:cA(a.line,a.ch),y:d*c,yBot:(d+1)*c}}function cD(a){var b=cC(a,!0),c=E(T);return{x:c.left+b.x,y:c.top+b.y,yBot:c.top+b.yBot}}function cE(){var a=V.childNodes.length;return a?V.offsetHeight/a||1:(K.innerHTML="<pre>x</pre>",K.firstChild.offsetHeight||1)}function cF(){return T.offsetTop}function cG(){return T.offsetLeft}function cH(a,b){var c=E(D,!0),d,e;try{d=a.clientX,e=a.clientY}catch(a){return null}if(!b&&(d-c.left>D.clientWidth||e-c.top>D.clientHeight))return null;var f=E(T,!0),g=bl+Math.floor((e-f.top)/cE());return ci({line:g,ch:cB(ch(g),d-f.left)})}function cI(a){function e(){var a=N(C.value).join("\n");a!=d&&cU(bN)(a,"end"),B.style.position="relative",C.style.cssText=c,bk=!1,bV(),bS()}var b=cH(a);if(!b||window.opera)return;(G(bc.from,bc.to)||H(b,bc.from)||!H(b,bc.to))&&cU(cg)(b.line,b.ch);var c=C.style.cssText;B.style.position="absolute",C.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(a.clientY-5)+"px; left: "+(a.clientX-5)+"px; z-index: 1000; background: white; "+"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",bk=!0;var d=C.value=bQ();bW(),P(C,0,C.value.length);if(u){o(a);var f=r(window,"mouseup",function(){f(),setTimeout(e,20)},!0)}else setTimeout(e,50)}function cJ(){clearInterval(Y);var a=!0;U.style.visibility="",Y=setInterval(function(){U.style.visibility=(a=!a)?"":"hidden"},650)}function cL(a){function p(a,b,c){if(!a.text)return;var d=a.styles,e=g?0:a.text.length-1,f;for(var i=g?0:d.length-2,j=g?d.length:-2;i!=j;i+=2*h){var k=d[i];if(d[i+1]!=null&&d[i+1]!=m){e+=h*k.length;continue}for(var l=g?0:k.length-1,p=g?k.length:-1;l!=p;l+=h,e+=h)if(e>=b&&e<c&&o.test(f=k.charAt(l))){var q=cK[f];if(q.charAt(1)==">"==g)n.push(f);else{if(n.pop()!=q.charAt(0))return{pos:e,match:!1};if(!n.length)return{pos:e,match:!0}}}}}var b=bc.inverted?bc.from:bc.to,c=$[b.line],d=b.ch-1,e=d>=0&&cK[c.text.charAt(d)]||cK[c.text.charAt(++d)];if(!e)return;var f=e.charAt(0),g=e.charAt(1)==">",h=g?1:-1,i=c.styles;for(var j=d+1,k=0,l=i.length;k<l;k+=2)if((j-=i[k].length)<=0){var m=i[k+1];break}var n=[c.text.charAt(d)],o=/[(){}[\]]/;for(var k=b.line,l=g?Math.min(k+100,$.length):Math.max(-1,k-100);k!=l;k+=h){var c=$[k],q=k==b.line,r=p(c,q&&g?d+1:0,q&&!g?d:c.text.length);if(r)break}r||(r={pos:null,match:!1});var m=r.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",s=cu({line:b.line,ch:d},{line:b.line,ch:d+1},m),t=r.pos!=null?cu({line:k,ch:r.pos},{line:k,ch:r.pos+1},m):function(){},u=cU(function(){s(),t()});a?setTimeout(u,800):bq=u}function cM(a){var b,c;for(var d=a,e=a-40;d>e;--d){if(d==0)return 0;var f=$[d-1];if(f.stateAfter)return d;var g=f.indentation();if(c==null||b>g)c=d-1,b=g}return c}function cN(a){var b=cM(a),c=b&&$[b-1].stateAfter;c?c=e(Z,c):c=f(Z);for(var d=b;d<a;++d){var g=$[d];g.highlight(Z,c),g.stateAfter=e(Z,c)}return a<$.length&&!$[a].stateAfter&&_.push(a),c}function cO(a,b){var c=cN(a);for(var d=a;d<b;++d){var f=$[d];f.highlight(Z,c),f.stateAfter=e(Z,c)}}function cP(){var a=+(new Date)+g.workTime,b=_.length;while(_.length){if(!$[bl].stateAfter)var c=bl;else var c=_.pop();if(c>=$.length)continue;var d=cM(c),h=d&&$[d-1].stateAfter;h?h=e(Z,h):h=f(Z);var i=0,j=Z.compareStates,k=!1;for(var l=d,m=$.length;l<m;++l){var n=$[l],o=n.stateAfter;if(+(new Date)>a){_.push(l),cQ(g.workDelay),k&&bh.push({from:c,to:l+1});return}var p=n.highlight(Z,h);p&&(k=!0),n.stateAfter=e(Z,h);if(j){if(o&&j(o,h))break}else if(p!==!1||!o)i=0;else if(++i>3)break}k&&bh.push({from:c,to:l+1})}b&&g.onHighlightComplete&&g.onHighlightComplete(bw)}function cQ(a){if(!_.length)return;X.set(a,cU(cP))}function cR(){bg=null,bh=[],bi=bj=!1}function cS(){var a=!1;bj&&(a=!bY()),bh.length?b_(bh):bj&&cd(),a&&bY(),bj&&(bX(),cJ()),bb&&!bk&&(bg===!0||bg!==!1&&bj)&&bV(),bj&&g.matchBrackets&&setTimeout(cU(function(){bq&&(bq(),bq=null),cL(!1)}),20);var b=bi;bj&&g.onCursorActivity&&g.onCursorActivity(bw),b&&g.onChange&&bw&&g.onChange(bw,b)}function cU(a){return function(){cT++||cR();try{var b=a.apply(this,arguments)}finally{--cT||cS()}return b}}function cV(a,b,c){this.atOccurrence=!1,c==null&&(c=typeof a=="string"&&a==a.toLowerCase()),b&&typeof b=="object"?b=ci(b):b={line:0,ch:0},this.pos={from:b,to:b};if(typeof a!="string")this.matches=function(b,c){if(b){var d=$[c.line].text.slice(0,c.ch),e=d.match(a),f=0;while(e){var g=d.indexOf(e[0]);f+=g,d=d.slice(g+1);var h=d.match(a);if(h)e=h;else break;f++}}else var d=$[c.line].text.slice(c.ch),e=d.match(a),f=e&&c.ch+d.indexOf(e[0]);if(e)return{from:{line:c.line,ch:f},to:{line:c.line,ch:f+e[0].length},match:e}};else{c&&(a=a.toLowerCase());var d=c?function(a){return a.toLowerCase()}:function(a){return a},e=a.split("\n");e.length==1?this.matches=function(b,c){var e=d($[c.line].text),f=a.length,g;if(b?c.ch>=f&&(g=e.lastIndexOf(a,c.ch-f))!=-1:(g=e.indexOf(a,c.ch))!=-1)return{from:{line:c.line,ch:g},to:{line:c.line,ch:g+f}}}:this.matches=function(a,b){var c=b.line,f=a?e.length-1:0,g=e[f],h=d($[c].text),i=a?h.indexOf(g)+g.length:h.lastIndexOf(g);if(a?i>=b.ch||i!=g.length:i<=b.ch||i!=h.length-g.length)return;for(;;){if(a?!c:c==$.length-1)return;h=d($[c+=a?-1:1].text),g=e[a?--f:++f];if(f>0&&f<e.length-1){if(h!=g)return;continue}var j=a?h.lastIndexOf(g):h.indexOf(g)+g.length;if(a?j!=h.length-g.length:j!=g.length)return;var k={line:b.line,ch:i},l={line:c,ch:j};return{from:a?l:k,to:a?k:l}}}}}var g={},i=a.defaults;for(var k in i)i.hasOwnProperty(k)&&(g[k]=(c&&c.hasOwnProperty(k)?c:i)[k]);var n=g.document,w=n.createElement("div");w.className="CodeMirror",w.innerHTML='<div style="overflow: hidden; position: relative; width: 1px; height: 0px;"><textarea style="position: absolute; width: 2px;" wrap="off"></textarea></div><div class="CodeMirror-scroll cm-s-'+g.theme+'">'+'<div style="position: relative">'+'<div style="position: absolute; height: 0; width: 0; overflow: hidden;"></div>'+'<div style="position: relative">'+'<div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div>'+'<div class="CodeMirror-lines"><div style="position: relative">'+'<pre class="CodeMirror-cursor">&#160;</pre>'+"<div></div>"+"</div></div></div></div></div>",b.appendChild?b.appendChild(w):b(w);var B=w.firstChild,C=B.firstChild,D=w.lastChild,J=D.firstChild,K=J.firstChild,Q=K.nextSibling,R=Q.firstChild,S=R.firstChild,T=R.nextSibling.firstChild,U=T.firstChild,V=U.nextSibling;g.tabindex!=null&&(C.tabindex=g.tabindex),!g.gutter&&!g.lineNumbers&&(R.style.display="none");var W=new s,X=new s,Y,Z,$=[new h("")],_,ba=new j,bb;cs();var bc={from:{line:0,ch:0},to:{line:0,ch:0},inverted:!1},bd,be,bf,bg,bh,bi,bj,bk,bl=0,bm=0,bn=0,bo=null,bp,bq,br="",bs;cU(function(){bx(g.value||""),bg=!1})(),r(D,"mousedown",cU(bz)),u||r(D,"contextmenu",cI),r(J,"dblclick",cU(bA)),r(D,"scroll",function(){b_([]),g.fixedGutter&&(R.style.left=D.scrollLeft+"px"),g.onScroll&&g.onScroll(bw)}),r(window,"resize",function(){b_(!0)}),r(C,"keyup",cU(bD)),r(C,"keydown",cU(bC)),r(C,"keypress",cU(bE)),r(C,"focus",bF),r(C,"blur",bG),r(D,"dragenter",o),r(D,"dragover",o),r(D,"drop",cU(bB)),r(D,"paste",function(){bW(),bT()}),r(C,"paste",function(){bT()}),r(C,"cut",function(){bT()});var bt;try{bt=n.activeElement==C}catch(bu){}bt?setTimeout(bF,20):bG();var bw={getValue:by,setValue:cU(bx),getSelection:bQ,replaceSelection:cU(bN),focus:function(){bW(),bF(),bT()},setOption:function(a,b){g[a]=b,a=="lineNumbers"||a=="gutter"||a=="firstLineNumber"?ct():a=="mode"||a=="indentUnit"?cs():a=="readOnly"&&b=="nocursor"?C.blur():a=="theme"&&(D.className=D.className.replace(/cm-s-\w+/,"cm-s-"+b))},getOption:function(a){return g[a]},undo:cU(bJ),redo:cU(bK),indentLine:cU(function(a,b){bv(a)&&cr(a,b==null?"smart":b?"add":"subtract")}),historySize:function(){return{undo:ba.done.length,redo:ba.undone.length}},matchBrackets:cU(function(){cL(!0)}),getTokenAt:function(a){return a=ci(a),$[a.line].getTokenAt(Z,cN(a.line),a.ch)},getStateAfter:function(a){return a=ch(a==null?$.length-1:a),cN(a+1)},cursorCoords:function(a){return a==null&&(a=bc.inverted),cD(a?bc.from:bc.to)},charCoords:function(a){return cD(ci(a))},coordsChar:function(a){var b=E(T),c=ch(Math.min($.length-1,bl+Math.floor((a.y-b.top)/cE())));return ci({line:c,ch:cB(ch(c),a.x-b.left)})},getSearchCursor:function(a,b,c){return new cV(a,b,c)},markText:cU(function(a,b,c){return cU(cu(a,b,c))}),setMarker:cv,clearMarker:cw,setLineClass:cU(cx),lineInfo:cy,addWidget:function(a,b,c,d){a=cC(ci(a));var e=a.yBot,f=a.x;b.style.position="absolute",J.appendChild(b),b.style.left=f+"px";if(d=="over")e=a.y;else if(d=="near"){var g=Math.max(D.offsetHeight,$.length*cE()),h=Math.max(J.clientWidth,T.clientWidth)-cG();a.yBot+b.offsetHeight>g&&a.y>b.offsetHeight&&(e=a.y-b.offsetHeight),f+b.offsetWidth>h&&(f=h-b.offsetWidth)}b.style.top=e+cF()+"px",b.style.left=f+cG()+"px",c&&bZ(f,e,f+b.offsetWidth,e+b.offsetHeight)},lineCount:function(){return $.length},getCursor:function(a){return a==null&&(a=bc.inverted),I(a?bc.from:bc.to)},somethingSelected:function(){return!G(bc.from,bc.to)},setCursor:cU(function(a,b){b==null&&typeof a.line=="number"?cg(a.line,a.ch):cg(a,b)}),setSelection:cU(function(a,b){cf(ci(a),ci(b||a))}),getLine:function(a){if(bv(a))return $[a].text},setLine:cU(function(a,b){bv(a)&&bM(b,{line:a,ch:0},{line:a,ch:$[a].text.length})}),removeLine:cU(function(a){bv(a)&&bM("",{line:a,ch:0},ci({line:a+1,ch:0}))}),replaceRange:cU(bM),getRange:function(a,b){return bP(ci(a),ci(b))},operation:function(a){return cU(a)()},refresh:function(){b_(!0)},getInputField:function(){return C},getWrapperElement:function(){return w},getScrollerElement:function(){return D},getGutterElement:function(){return R}},bR=!1,cK={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},cT=0;cV.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(a){function d(a){var c={line:a,ch:0};return b.pos={from:c,to:c},b.atOccurrence=!1,!1}var b=this,c=ci(a?this.pos.from:this.pos.to);for(;;){if(this.pos=this.matches(a,c))return this.atOccurrence=!0,this.pos.match||!0;if(a){if(!c.line)return d(0);c={line:c.line-1,ch:$[c.line-1].text.length}}else{if(c.line==$.length-1)return d($.length);c={line:c.line+1,ch:0}}}},from:function(){if(this.atOccurrence)return I(this.pos.from)},to:function(){if(this.atOccurrence)return I(this.pos.to)},replace:function(a){var b=this;this.atOccurrence&&cU(function(){b.pos.to=bM(a,b.pos.from,b.pos.to)})()}};for(var cW in d)d.propertyIsEnumerable(cW)&&!bw.propertyIsEnumerable(cW)&&(bw[cW]=d[cW]);return bw}function e(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function f(a,b,c){return a.startState?a.startState(b,c):!0}function g(a){this.pos=this.start=0,this.string=a}function h(a,b){this.styles=b||[a,null],this.stateAfter=null,this.text=a,this.marked=this.gutterMarker=this.className=null}function i(a,b,c,d){for(var e=0,f=0,g=0;f<b;e+=2){var h=c[e],i=f+h.length;g==0?(i>a&&d.push(h.slice(a-f,Math.min(h.length,b-f)),c[e+1]),i>=a&&(g=1)):g==1&&(i>b?d.push(h.slice(0,b-f),c[e+1]):d.push(h,c[e+1])),f=i}}function j(){this.time=0,this.done=[],this.undone=[]}function k(){o(this)}function l(a){return a.stop||(a.stop=k),a}function m(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function n(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function o(a){m(a),n(a)}function p(a){return a.target||a.srcElement}function q(a){if(a.which)return a.which;if(a.button&1)return 1;if(a.button&2)return 3;if(a.button&4)return 2}function r(a,b,c,d){function e(a){c(a||window.event)}if(typeof a.addEventListener=="function"){a.addEventListener(b,e,!1);if(d)return function(){a.removeEventListener(b,e,!1)}}else{a.attachEvent("on"+b,e);if(d)return function(){a.detachEvent("on"+b,e)}}}function s(){this.id=null}function C(a,b){b==null&&(b=a.search(/[^\s\u00a0]/),b==-1&&(b=a.length));for(var c=0,d=0;c<b;++c)a.charAt(c)=="\t"?d+=y-d%y:++d;return d}function D(a){return a.currentStyle?a.currentStyle:window.getComputedStyle(a,null)}function E(a,b){var c=a.ownerDocument.body,d=0,e=0,f=!1;for(var g=a;g;g=g.offsetParent)d+=g.offsetLeft,e+=g.offsetTop,b&&D(g).position=="fixed"&&(f=!0);var h=b&&!f?null:c;for(var g=a.parentNode;g!=h;g=g.parentNode)g.scrollLeft!=null&&(d-=g.scrollLeft,e-=g.scrollTop);return{left:d,top:e}}function F(a){return a.textContent||a.innerText||a.nodeValue||""}function G(a,b){return a.line==b.line&&a.ch==b.ch}function H(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function I(a){return{line:a.line,ch:a.ch}}function K(a){return J.innerText=J.textContent=a,J.innerHTML}function L(a,b){if(!b)return a?a.length:0;if(!a)return b.length;for(var c=a.length,d=b.length;c>=0&&d>=0;--c,--d)if(a.charAt(c)!=b.charAt(d))break;return d+1}function M(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;c<d;++c)if(a[c]==b)return c;return-1}a.defaults={value:"",mode:null,theme:"default",indentUnit:2,indentWithTabs:!1,tabMode:"classic",enterMode:"indent",electricChars:!0,onKeyEvent:null,lineNumbers:!1,gutter:!1,fixedGutter:!1,firstLineNumber:1,readOnly:!1,smartHome:!0,onChange:null,onCursorActivity:null,onGutterClick:null,onHighlightComplete:null,onFocus:null,onBlur:null,onScroll:null,matchBrackets:!1,workTime:100,workDelay:200,undoDepth:40,tabindex:null,document:window.document};var b={},c={};a.defineMode=function(c,d){!a.defaults.mode&&c!="null"&&(a.defaults.mode=c),b[c]=d},a.defineMIME=function(a,b){c[a]=b},a.getMode=function(d,e){typeof e=="string"&&c.hasOwnProperty(e)&&(e=c[e]);if(typeof e=="string")var f=e,g={};else if(e!=null)var f=e.name,g=e;var h=b[f];return h?h(d,g||{}):(window.console&&console.warn("No mode "+f+" found, falling back to plain text."),a.getMode(d,"text/plain"))},a.listModes=function(){var a=[];for(var c in b)b.propertyIsEnumerable(c)&&a.push(c);return a},a.listMIMEs=function(){var a=[];for(var b in c)c.propertyIsEnumerable(b)&&a.push(b);return a};var d={};a.defineExtension=function(a,b){d[a]=b},a.fromTextArea=function(b,c){function d(){b.value=h.getValue()}c||(c={}),c.value=b.value,!c.tabindex&&b.tabindex&&(c.tabindex=b.tabindex);if(b.form){var e=r(b.form,"submit",d,!0);if(typeof b.form.submit=="function"){var f=b.form.submit;function g(){d(),b.form.submit=f,b.form.submit(),b.form.submit=g}b.form.submit=g}}b.style.display="none";var h=a(function(a){b.parentNode.insertBefore(a,b.nextSibling)},c);return h.save=d,h.toTextArea=function(){d(),b.parentNode.removeChild(h.getWrapperElement()),b.style.display="",b.form&&(e(),typeof b.form.submit=="function"&&(b.form.submit=f))},h},a.startState=f,a.copyState=e,g.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if(typeof a=="string")var c=b==a;else var c=b&&(a.test?a.test(b):a(b));if(c)return++this.pos,b},eatWhile:function(a){var b=this.pos;while(this.eat(a));return this.pos>b},eatSpace:function(){var a=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);if(b>-1)return this.pos=b,!0},backUp:function(a){this.pos-=a},column:function(){return C(this.string,this.start)},indentation:function(){return C(this.string)},match:function(a,b,c){if(typeof a!="string"){var e=this.string.slice(this.pos).match(a);return e&&b!==!1&&(this.pos+=e[0].length),e}function d(a){return c?a.toLowerCase():a}if(d(this.string).indexOf(d(a),this.pos)==this.pos)return b!==!1&&(this.pos+=a.length),!0},current:function(){return this.string.slice(this.start,this.pos)}},a.StringStream=g,h.prototype={replace:function(a,b,c){var d=[],e=this.marked;i(0,a,this.styles,d),c&&d.push(c,null),i(b,this.text.length,this.styles,d),this.styles=d,this.text=this.text.slice(0,a)+c+this.text.slice(b),this.stateAfter=null;if(e){var f=c.length-(b-a),g=this.text.length;function h(a){return a<=Math.min(b,b+f)?a:a+f}for(var j=0;j<e.length;++j){var k=e[j],l=!1;k.from>=g?l=!0:(k.from=h(k.from),k.to!=null&&(k.to=h(k.to)));if(l||k.from>=k.to)e.splice(j,1),j--}}},split:function(a,b){var c=[b,null];return i(a,this.text.length,this.styles,c),new h(b+this.text.slice(a),c)},addMark:function(a,b,c){var d=this.marked,e={from:a,to:b,style:c};return this.marked==null&&(this.marked=[]),this.marked.push(e),this.marked.sort(function(a,b){return a.from-b.from}),e},removeMark:function(a){var b=this.marked;if(!b)return;for(var c=0;c<b.length;++c)if(b[c]==a){b.splice(c,1);break}},highlight:function(a,b){var c=new g(this.text),d=this.styles,e=0,f=!1,h=d[0],i;this.text==""&&a.blankLine&&a.blankLine(b);while(!c.eol()){var j=a.token(c,b),k=this.text.slice(c.start,c.pos);c.start=c.pos,e&&d[e-1]==j?d[e-2]+=k:k&&(!f&&(d[e+1]!=j||e&&d[e-2]!=i)&&(f=!0),d[e++]=k,d[e++]=j,i=h,h=d[e]);if(c.pos>5e3){d[e++]=this.text.slice(c.pos),d[e++]=null;break}}return d.length!=e&&(d.length=e,f=!0),e&&d[e-2]!=i&&(f=!0),f||(d.length<5&&this.text.length<10?null:!1)},getTokenAt:function(a,b,c){var d=this.text,e=new g(d);while(e.pos<c&&!e.eol()){e.start=e.pos;var f=a.token(e,b)}return{start:e.start,end:e.pos,string:e.current(),className:f||null,state:b}},indentation:function(){return C(this.text)},getHTML:function(a,b,c,d){function f(a,b){if(!a)return;b?e.push('<span class="',b,'">',K(a),"</span>"):e.push(K(a))}var e=[];c&&e.push(this.className?'<pre class="'+this.className+'">':"<pre>");var g=this.styles,h=this.text,i=this.marked;a==b&&(a=null);var j=h.length;d!=null&&(j=Math.min(d,j));if(!h&&d==null)f(" ",a!=null&&b==null?"CodeMirror-selected":null);else if(!i&&a==null)for(var k=0,l=0;l<j;k+=2){var m=g[k],n=m.length;l+n>j&&(m=m.slice(0,j-l)),l+=n,f(m,"cm-"+g[k+1])}else{var o=0,k=0,p="",q,r=0,s=-1,t=null;function u(){i&&(s+=1,t=s<i.length?i[s]:null)}u();while(o<j){var v=j,w="";if(a!=null)if(a>o)v=a;else if(b==null||b>o)w=" CodeMirror-selected",b!=null&&(v=Math.min(v,b));while(t&&t.to!=null&&t.to<=o)u();t&&(t.from>o?v=Math.min(v,t.from):(w+=" "+t.style,t.to!=null&&(v=Math.min(v,t.to))));for(;;){var x=o+p.length,y=q;w&&(y=q?q+w:w),f(x>v?p.slice(0,v-o):p,y);if(x>=v){p=p.slice(v-o),o=v;break}o=x,p=g[k++],q="cm-"+g[k++]}}a!=null&&b==null&&f(" ","CodeMirror-selected")}return c&&e.push("</pre>"),e.join("")}},j.prototype={addChange:function(a,b,c){this.undone.length=0;var d=+(new Date),e=this.done[this.done.length-1];if(d-this.time>400||!e||e.start>a+b||e.start+e.added<a-e.added+e.old.length)this.done.push({start:a,added:b,old:c});else{var f=0;if(a<e.start){for(var g=e.start-a-1;g>=0;--g)e.old.unshift(c[g]);e.added+=e.start-a,e.start=a}else e.start<a&&(f=a-e.start,b+=f);for(var g=e.added-f,h=c.length;g<h;++g)e.old.push(c[g]);e.added<b&&(e.added=b)}this.time=d}},s.prototype={set:function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)}};var t=function(){var a=document.createElement("pre");return a.innerHTML=" ",!a.innerHTML}(),u=/gecko\/\d{7}/i.test(navigator.userAgent),v=/MSIE \d/.test(navigator.userAgent),w=/Apple Computer/.test(navigator.vendor),x="\n";(function(){var a=document.createElement("textarea");a.value="foo\nbar",a.value.indexOf("\r")>-1&&(x="\r\n")})();var y=8,z=/Mac/.test(navigator.platform),A={};for(var B=35;B<=40;++B)A[B]=A["c"+B]=!0;var J=document.createElement("div");a.htmlEscape=K;var N,O,P;return"\n\nb".split(/\n/).length!=3?N=function(a){var b=0,c,d=[];while((c=a.indexOf("\n",b))>-1)d.push(a.slice(b,a.charAt(c-1)=="\r"?c-1:c)),b=c+1;return d.push(a.slice(b)),d}:N=function(a){return a.split(/\r?\n/)},a.splitLines=N,window.getSelection?(O=function(a){try{return{start:a.selectionStart,end:a.selectionEnd}}catch(b){return null}},w?P=function(a,b,c){b==c?a.setSelectionRange(b,c):(a.setSelectionRange(b,c-1),window.getSelection().modify("extend","forward","character"))}:P=function(a,b,c){try{a.setSelectionRange(b,c)}catch(d){}}):(O=function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){return null}if(!b||b.parentElement()!=a)return null;var d=a.value,e=d.length,f=a.createTextRange();f.moveToBookmark(b.getBookmark());var g=a.createTextRange();g.collapse(!1);if(f.compareEndPoints("StartToEnd",g)>-1)return{start:e,end:e};var h=-f.moveStart("character",-e);for(var i=d.indexOf("\r");i>-1&&i<h;i=d.indexOf("\r",i+1),h++);if(f.compareEndPoints("EndToEnd",g)>-1)return{start:h,end:e};var j=-f.moveEnd("character",-e);for(var i=d.indexOf("\r");i>-1&&i<j;i=d.indexOf("\r",i+1),j++);return{start:h,end:j}},P=function(a,b,c){var d=a.createTextRange();d.collapse(!0);var e=d.duplicate(),f=0,g=a.value;for(var h=g.indexOf("\n");h>-1&&h<b;h=g.indexOf("\n",h+1))++f;d.move("character",b-f);for(;h>-1&&h<c;h=g.indexOf("\n",h+1))++f;e.move("character",c-f),d.setEndPoint("EndToEnd",e),d.select()}),a.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),a.defineMIME("text/plain","null"),a}();CodeMirror.defineMode("javascript",function(a,b){function g(a,b,c){return b.tokenize=c,c(a,b)}function h(a,b){var c=!1,d;while((d=a.next())!=null){if(d==b&&!c)return!1;c=!c&&d=="\\"}return c}function k(a,b,c){return i=a,j=c,b}function l(a,b){var c=a.next();if(c=='"'||c=="'")return g(a,b,m(c));if(/[\[\]{}\(\),;\:\.]/.test(c))return k(c);if(c=="0"&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),k("number","number");if(/\d/.test(c))return a.match(/^\d*(?:\.\d*)?(?:e[+\-]?\d+)?/),k("number","number");if(c=="/")return a.eat("*")?g(a,b,n):a.eat("/")?(a.skipToEnd(),k("comment","comment")):b.reAllowed?(h(a,"/"),a.eatWhile(/[gimy]/),k("regexp","string")):(a.eatWhile(f),k("operator",null,a.current()));if(f.test(c))return a.eatWhile(f),k("operator",null,a.current());a.eatWhile(/[\w\$_]/);var d=a.current(),i=e.propertyIsEnumerable(d)&&e[d];return i?k(i.type,i.style,d):k("variable","variable",d)}function m(a){return function(b,c){return h(b,a)||(c.tokenize=l),k("string","string")}}function n(a,b){var c=!1,d;while(d=a.next()){if(d=="/"&&c){b.tokenize=l;break}c=d=="*"}return k("comment","comment")}function p(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.prev=e,this.info=f,d!=null&&(this.align=d)}function q(a,b){for(var c=a.localVars;c;c=c.next)if(c.name==b)return!0}function r(a,b,c,e,f){var g=a.cc;s.state=a,s.stream=f,s.marked=null,s.cc=g,a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);for(;;){var h=g.length?g.pop():d?D:C;if(h(c,e)){while(g.length&&g[g.length-1].lex)g.pop()();return s.marked?s.marked:c=="variable"&&q(a,e)?"variable-2":b}}}function t(){for(var a=arguments.length-1;a>=0;a--)s.cc.push(arguments[a])}function u(){return t.apply(null,arguments),!0}function v(a){var b=s.state;if(b.context){s.marked="def";for(var c=b.localVars;c;c=c.next)if(c.name==a)return;b.localVars={name:a,next:b.localVars}}}function x(){s.state.context||(s.state.localVars=w),s.state.context={prev:s.state.context,vars:s.state.localVars}}function y(){s.state.localVars=s.state.context.vars,s.state.context=s.state.context.prev}function z(a,b){var c=function(){var c=s.state;c.lexical=new p(c.indented,s.stream.column(),a,null,c.lexical,b)};return c.lex=!0,c}function A(){var a=s.state;a.lexical.prev&&(a.lexical.type==")"&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function B(a){return function b(b){return b==a?u():a==";"?t():u(arguments.callee)}}function C(a){return a=="var"?u(z("vardef"),K,B(";"),A):a=="keyword a"?u(z("form"),D,C,A):a=="keyword b"?u(z("form"),C,A):a=="{"?u(z("}"),J,A):a==";"?u():a=="function"?u(Q):a=="for"?u(z("form"),B("("),z(")"),M,B(")"),A,C,A):a=="variable"?u(z("stat"),F):a=="switch"?u(z("form"),D,z("}","switch"),B("{"),J,A,A):a=="case"?u(D,B(":")):a=="default"?u(B(":")):a=="catch"?u(z("form"),x,B("("),R,B(")"),C,A,y):t(z("stat"),D,B(";"),A)}function D(a){return o.hasOwnProperty(a)?u(E):a=="function"?u(Q):a=="keyword c"?u(D):a=="("?u(z(")"),D,B(")"),A,E):a=="operator"?u(D):a=="["?u(z("]"),I(D,"]"),A,E):a=="{"?u(z("}"),I(H,"}"),A,E):u()}function E(a,b){if(a=="operator"&&/\+\+|--/.test(b))return u(E);if(a=="operator")return u(D);if(a==";")return;if(a=="(")return u(z(")"),I(D,")"),A,E);if(a==".")return u(G,E);if(a=="[")return u(z("]"),D,B("]"),A,E)}function F(a){return a==":"?u(A,C):t(E,B(";"),A)}function G(a){if(a=="variable")return s.marked="property",u()}function H(a){a=="variable"&&(s.marked="property");if(o.hasOwnProperty(a))return u(B(":"),D)}function I(a,b){function c(d){return d==","?u(a,c):d==b?u():u(B(b))}return function d(d){return d==b?u():t(a,c)}}function J(a){return a=="}"?u():t(C,J)}function K(a,b){return a=="variable"?(v(b),u(L)):u()}function L(a,b){if(b=="=")return u(D,L);if(a==",")return u(K)}function M(a){return a=="var"?u(K,O):a==";"?t(O):a=="variable"?u(N):t(O)}function N(a,b){return b=="in"?u(D):u(E,O)}function O(a,b){return a==";"?u(P):b=="in"?u(D):u(D,B(";"),P)}function P(a){a!=")"&&u(D)}function Q(a,b){if(a=="variable")return v(b),u(Q);if(a=="(")return u(z(")"),x,I(R,")"),A,C,y)}function R(a,b){if(a=="variable")return v(b),u()}var c=a.indentUnit,d=b.json,e=function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("operator"),f={type:"atom",style:"atom"};return{"if":b,"while":b,"with":b,"else":c,"do":c,"try":c,"finally":c,"return":d,"break":d,"continue":d,"new":d,"delete":d,"throw":d,"var":a("var"),"function":a("function"),"catch":a("catch"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),"in":e,"typeof":e,"instanceof":e,"true":f,"false":f,"null":f,"undefined":f,NaN:f,Infinity:f}}(),f=/[+\-*&%=<>!?|]/,i,j,o={atom:!0,number:!0,variable:!0,string:!0,regexp:!0},s={state:null,column:null,marked:null,cc:null},w={name:"this",next:{name:"arguments"}};return A.lex=!0,{startState:function(a){return{tokenize:l,reAllowed:!0,cc:[],lexical:new p((a||0)-c,0,"block",!1),localVars:null,context:null,indented:0}},token:function(a,b){a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation());if(a.eatSpace())return null;var c=b.tokenize(a,b);return i=="comment"?c:(b.reAllowed=i=="operator"||i=="keyword c"||i.match(/^[\[{}\(,;:]$/),r(b,c,i,j,a))},indent:function(a,b){if(a.tokenize!=l)return 0;var d=b&&b.charAt(0),e=a.lexical,f=e.type,g=d==f;return f=="vardef"?e.indented+4:f=="form"&&d=="{"?e.indented:f=="stat"||f=="form"?e.indented+c:e.info=="switch"&&!g?e.indented+(/^(?:case|default)\b/.test(b)?c:2*c):e.align?e.column+(g?0:1):e.indented+(g?0:c)},electricChars:":{}"}}),CodeMirror.defineMIME("text/javascript","javascript"),CodeMirror.defineMIME("application/json",{name:"javascript",json:!0}),CodeMirror.defineMode("xml",function(a,b){function h(a,b){function c(c){return b.tokenize=c,c(a,b)}var d=a.next();if(d=="<"){if(a.eat("!"))return a.eat("[")?a.match("CDATA[")?c(k("atom","]]>")):null:a.match("--")?c(k("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),c(k("meta",">"))):null;if(a.eat("?"))return a.eatWhile(/[\w\._\-]/),b.tokenize=k("meta","?>"),"meta";g=a.eat("/")?"closeTag":"openTag",a.eatSpace(),f="";var e;while(e=a.eat(/[^\s\u00a0=<>\"\'\/?]/))f+=e;return b.tokenize=i,"tag"}return d=="&"?(a.eatWhile(/[^;]/),a.eat(";"),"atom"):(a.eatWhile(/[^&<]/),null)}function i(a,b){var c=a.next();return c==">"||c=="/"&&a.eat(">")?(b.tokenize=h,g=c==">"?"endTag":"selfcloseTag","tag"):c=="="?(g="equals",null):/[\'\"]/.test(c)?(b.tokenize=j(c),b.tokenize(a,b)):(a.eatWhile(/[^\s\u00a0=<>\"\'\/?]/),"word")}function j(a){return function(b,c){while(!b.eol())if(b.next()==a){c.tokenize=i;break}return"string"}}function k(a,b){return function(c,d){while(!c.eol()){if(c.match(b)){d.tokenize=h;break}c.next()}return a}}function n(){for(var a=arguments.length-1;a>=0;a--)l.cc.push(arguments[a])}function o(){return n.apply(null,arguments),!0}function p(a,b){var c=d.doNotIndent.hasOwnProperty(a)||l.context&&l.context.noIndent;l.context={prev:l.context,tagName:a,indent:l.indented,startOfLine:b,noIndent:c}}function q(){l.context&&(l.context=l.context.prev)}function r(a){if(a=="openTag")return l.tagName=f,o(u,s(l.startOfLine));if(a=="closeTag"){var b=!1;return l.context?b=l.context.tagName!=f:b=!0,b&&(m="error"),o(t(b))}return a=="string"?((!l.context||l.context.name!="!cdata")&&p("!cdata"),l.tokenize==h&&q(),o()):o()}function s(a){return function(b){return b=="selfcloseTag"||b=="endTag"&&d.autoSelfClosers.hasOwnProperty(l.tagName.toLowerCase())?o():b=="endTag"?(p(l.tagName,a),o()):o()}}function t(a){return function(b){return a&&(m="error"),b=="endTag"?(q(),o()):n()}}function u(a){return a=="word"?(m="attribute",o(u)):a=="equals"?o(v,u):n()}function v(a){return a=="word"&&d.allowUnquoted?(m="string",o()):a=="string"?o(w):n()}function w(a){return a=="string"?o(w):n()}var c=a.indentUnit,d=b.htmlMode?{autoSelfClosers:{br:!0,img:!0,hr:!0,link:!0,input:!0,meta:!0,col:!0,frame:!0,base:!0,area:!0},doNotIndent:{pre:!0,"!cdata":!0},allowUnquoted:!0}:{autoSelfClosers:{},doNotIndent:{"!cdata":!0},allowUnquoted:!1},e=b.alignCDATA,f,g,l,m;return{startState:function(){return{tokenize:h,cc:[],indented:0,startOfLine:!0,tagName:null,context:null}},token:function(a,b){a.sol()&&(b.startOfLine=!0,b.indented=a.indentation());if(a.eatSpace())return null;m=g=f=null;var c=b.tokenize(a,b);if((c||g)&&c!="comment"){l=b;for(;;){var d=b.cc.pop()||r;if(d(g||c))break}}return b.startOfLine=!1,m||c},indent:function(a,b){var d=a.context;if(d&&d.noIndent)return 0;if(e&&/<!\[CDATA\[/.test(b))return 0;d&&/^<\//.test(b)&&(d=d.prev);while(d&&!d.startOfLine)d=d.prev;return d?d.indent+c:0},compareStates:function(a,b){if(a.indented!=b.indented)return!1;for(var c=a.context,d=b.context;;c=c.prev,d=d.prev){if(!c||!d)return c==d;if(c.tagName!=d.tagName)return!1}},electricChars:"/"}}),CodeMirror.defineMIME("application/xml","xml"),CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:!0}),CodeMirror.defineMode("css",function(a){function d(a,b){return c=b,a}function e(a,b){var c=a.next();if(c=="@")return a.eatWhile(/\w/),d("meta",a.current());if(c=="/"&&a.eat("*"))return b.tokenize=f,f(a,b);if(c=="<"&&a.eat("!"))return b.tokenize=g,g(a,b);if(c=="=")d(null,"compare");else return c!="~"&&c!="|"||!a.eat("=")?c=='"'||c=="'"?(b.tokenize=h(c),b.tokenize(a,b)):c=="#"?(a.eatWhile(/\w/),d("atom","hash")):c=="!"?(a.match(/^\s*\w*/),d("keyword","important")):/\d/.test(c)?(a.eatWhile(/[\w.%]/),d("number","unit")):/[,.+>*\/]/.test(c)?d(null,"select-op"):/[;{}:\[\]]/.test(c)?d(null,c):(a.eatWhile(/[\w\\\-_]/),d("variable","variable")):d(null,"compare")}function f(a,b){var c=!1,f;while((f=a.next())!=null){if(c&&f=="/"){b.tokenize=e;break}c=f=="*"}return d("comment","comment")}function g(a,b){var c=0,f;while((f=a.next())!=null){if(c>=2&&f==">"){b.tokenize=e;break}c=f=="-"?c+1:0}return d("comment","comment")}function h(a){return function(b,c){var f=!1,g;while((g=b.next())!=null){if(g==a&&!f)break;f=!f&&g=="\\"}return f||(c.tokenize=e),d("string","string")}}var b=a.indentUnit,c;return{startState:function(a){return{tokenize:e,baseIndent:a||0,stack:[]}},token:function(a,b){if(a.eatSpace())return null;var d=b.tokenize(a,b),e=b.stack[b.stack.length-1];if(c=="hash"&&e=="rule")d="atom";else if(d=="variable")if(e=="rule")d="number";else if(!e||e=="@media{")d="tag";return e=="rule"&&/^[\{\};]$/.test(c)&&b.stack.pop(),c=="{"?e=="@media"?b.stack[b.stack.length-1]="@media{":b.stack.push("{"):c=="}"?b.stack.pop():c=="@media"?b.stack.push("@media"):e=="{"&&c!="comment"&&b.stack.push("rule"),d},indent:function(a,c){var d=a.stack.length;return/^\}/.test(c)&&(d-=a.stack[a.stack.length-1]=="rule"?2:1),a.baseIndent+d*b},electricChars:"}"}}),CodeMirror.defineMIME("text/css","css"),CodeMirror.defineMode("htmlmixed",function(a,b){function f(a,b){var f=c.token(a,b.htmlState);return f=="tag"&&a.current()==">"&&b.htmlState.context&&(/^script$/i.test(b.htmlState.context.tagName)?(b.token=h,b.localState=d.startState(c.indent(b.htmlState,"")),b.mode="javascript"):/^style$/i.test(b.htmlState.context.tagName)&&(b.token=i,b.localState=e.startState(c.indent(b.htmlState,"")),b.mode="css")),f}function g(a,b,c){var d=a.current(),e=d.search(b);return e>-1&&a.backUp(d.length-e),c}function h(a,b){return a.match(/^<\/\s*script\s*>/i,!1)?(b.token=f,b.curState=null,b.mode="html",f(a,b)):g(a,/<\/\s*script\s*>/,d.token(a,b.localState))}function i(a,b){return a.match(/^<\/\s*style\s*>/i,!1)?(b.token=f,b.localState=null,b.mode="html",f(a,b)):g(a,/<\/\s*style\s*>/,e.token(a,b.localState))}var c=CodeMirror.getMode(a,{name:"xml",htmlMode:!0}),d=CodeMirror.getMode(a,"javascript"),e=CodeMirror.getMode(a,"css");return{startState:function(){var a=c.startState();return{token:f,localState:null,mode:"html",htmlState:a}},copyState:function(a){if(a.localState)var b=CodeMirror.copyState(a.token==i?e:d,a.localState);return{token:a.token,localState:b,mode:a.mode,htmlState:CodeMirror.copyState(c,a.htmlState)}},token:function(a,b){return b.token(a,b)},indent:function(a,b){return a.token==f||/^\s*<\//.test(b)?c.indent(a.htmlState,b):a.token==h?d.indent(a.localState,b):e.indent(a.localState,b)},electricChars:"/{}:"}}),CodeMirror.defineMIME("text/html","htmlmixed")
 
tinymce-plugins/cmseditor/js/lib/codemirror.css DELETED
@@ -1,82 +0,0 @@
1
- .CodeMirror {
2
- line-height: 1em;
3
- font-family: monospace;
4
- }
5
-
6
- .CodeMirror-scroll {
7
- overflow: auto;
8
- height: 380px;
9
- /* This is needed to prevent an IE[67] bug where the scrolled content
10
- is visible outside of the scrolling box. */
11
- position: relative;
12
- }
13
-
14
- .CodeMirror-gutter {
15
- position: absolute; left: 0; top: 0;
16
- background-color: #f7f7f7;
17
- border-right: 1px solid #eee;
18
- min-width: 2em;
19
- height: 100%;
20
- }
21
- .CodeMirror-gutter-text {
22
- color: #aaa;
23
- text-align: right;
24
- padding: .4em .2em .4em .4em;
25
- }
26
- .CodeMirror-lines {
27
- padding: .4em;
28
- }
29
-
30
- .CodeMirror pre {
31
- -moz-border-radius: 0;
32
- -webkit-border-radius: 0;
33
- -o-border-radius: 0;
34
- border-radius: 0;
35
- border-width: 0; margin: 0; padding: 0; background: transparent;
36
- font-family: inherit;
37
- font-size: inherit;
38
- padding: 0; margin: 0;
39
- white-space: pre;
40
- word-wrap: normal;
41
- }
42
-
43
- .CodeMirror textarea {
44
- font-family: inherit !important;
45
- font-size: inherit !important;
46
- }
47
-
48
- .CodeMirror-cursor {
49
- z-index: 10;
50
- position: absolute;
51
- visibility: hidden;
52
- border-left: 1px solid black !important;
53
- }
54
- .CodeMirror-focused .CodeMirror-cursor {
55
- visibility: visible;
56
- }
57
-
58
- span.CodeMirror-selected {
59
- background: #ccc !important;
60
- color: HighlightText !important;
61
- }
62
- .CodeMirror-focused span.CodeMirror-selected {
63
- background: Highlight !important;
64
- }
65
-
66
- .CodeMirror-matchingbracket {color: #0f0 !important;}
67
- .CodeMirror-nonmatchingbracket {color: #f22 !important;}
68
-
69
-
70
- /* Tool bar */
71
-
72
- .CodeMirror-ToolBar {
73
- background: #eee url(../../img/ed-bg.gif) repeat-x;
74
- border: solid 1px #ccc;
75
- height: 30px;
76
- text-align: right;
77
- }
78
- .CodeMirror-ToolBar-close {
79
- margin: 3px;
80
- padding: 2px 3px;
81
- cursor: pointer;
82
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/lib/codemirror.js DELETED
@@ -1,2157 +0,0 @@
1
- // All functions that need access to the editor's state live inside
2
- // the CodeMirror function. Below that, at the bottom of the file,
3
- // some utilities are defined.
4
-
5
- // CodeMirror is the only global var we claim
6
- var CodeMirror = (function() {
7
- // This is the function that produces an editor instance. It's
8
- // closure is used to store the editor state.
9
- function CodeMirror(place, givenOptions) {
10
- // Determine effective options based on given values and defaults.
11
- var options = {}, defaults = CodeMirror.defaults;
12
- for (var opt in defaults)
13
- if (defaults.hasOwnProperty(opt))
14
- options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];
15
-
16
- var targetDocument = options["document"];
17
- // The element in which the editor lives.
18
- var wrapper = targetDocument.createElement("div");
19
- wrapper.className = "CodeMirror";
20
- // This mess creates the base DOM structure for the editor.
21
- wrapper.innerHTML =
22
- '<div style="overflow: hidden; position: relative; width: 1px; height: 0px;">' + // Wraps and hides input textarea
23
- '<textarea style="position: absolute; width: 2px;" wrap="off"></textarea></div>' +
24
- '<div class="CodeMirror-scroll cm-s-' + options.theme + '">' +
25
- '<div style="position: relative">' + // Set to the height of the text, causes scrolling
26
- '<div style="position: absolute; height: 0; width: 0; overflow: hidden;"></div>' +
27
- '<div style="position: relative">' + // Moved around its parent to cover visible view
28
- '<div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div>' +
29
- // Provides positioning relative to (visible) text origin
30
- '<div class="CodeMirror-lines"><div style="position: relative">' +
31
- '<pre class="CodeMirror-cursor">&#160;</pre>' + // Absolutely positioned blinky cursor
32
- '<div></div>' + // This DIV contains the actual code
33
- '</div></div></div></div></div>';
34
- if (place.appendChild) place.appendChild(wrapper); else place(wrapper);
35
- // I've never seen more elegant code in my life.
36
- var inputDiv = wrapper.firstChild, input = inputDiv.firstChild,
37
- scroller = wrapper.lastChild, code = scroller.firstChild,
38
- measure = code.firstChild, mover = measure.nextSibling,
39
- gutter = mover.firstChild, gutterText = gutter.firstChild,
40
- lineSpace = gutter.nextSibling.firstChild,
41
- cursor = lineSpace.firstChild, lineDiv = cursor.nextSibling;
42
- if (options.tabindex != null) input.tabindex = options.tabindex;
43
- if (!options.gutter && !options.lineNumbers) gutter.style.display = "none";
44
-
45
- // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval.
46
- var poll = new Delayed(), highlight = new Delayed(), blinker;
47
-
48
- // mode holds a mode API object. lines an array of Line objects
49
- // (see Line constructor), work an array of lines that should be
50
- // parsed, and history the undo history (instance of History
51
- // constructor).
52
- var mode, lines = [new Line("")], work, history = new History(), focused;
53
- loadMode();
54
- // The selection. These are always maintained to point at valid
55
- // positions. Inverted is used to remember that the user is
56
- // selecting bottom-to-top.
57
- var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false};
58
- // Selection-related flags. shiftSelecting obviously tracks
59
- // whether the user is holding shift. reducedSelection is a hack
60
- // to get around the fact that we can't create inverted
61
- // selections. See below.
62
- var shiftSelecting, reducedSelection, lastDoubleClick;
63
- // Variables used by startOperation/endOperation to track what
64
- // happened during the operation.
65
- var updateInput, changes, textChanged, selectionChanged, leaveInputAlone;
66
- // Current visible range (may be bigger than the view window).
67
- var showingFrom = 0, showingTo = 0, lastHeight = 0, curKeyId = null;
68
- // editing will hold an object describing the things we put in the
69
- // textarea, to help figure out whether something changed.
70
- // bracketHighlighted is used to remember that a backet has been
71
- // marked.
72
- var editing, bracketHighlighted;
73
- // Tracks the maximum line length so that the horizontal scrollbar
74
- // can be kept static when scrolling.
75
- var maxLine = "", maxWidth;
76
-
77
- // Initialize the content.
78
- operation(function(){setValue(options.value || ""); updateInput = false;})();
79
-
80
- // Register our event handlers.
81
- connect(scroller, "mousedown", operation(onMouseDown));
82
- // Gecko browsers fire contextmenu *after* opening the menu, at
83
- // which point we can't mess with it anymore. Context menu is
84
- // handled in onMouseDown for Gecko.
85
- if (!gecko) connect(scroller, "contextmenu", onContextMenu);
86
- connect(code, "dblclick", operation(onDblClick));
87
- connect(scroller, "scroll", function() {updateDisplay([]); if (options.onScroll) options.onScroll(instance);});
88
- connect(window, "resize", function() {updateDisplay(true);});
89
- connect(input, "keyup", operation(onKeyUp));
90
- connect(input, "keydown", operation(onKeyDown));
91
- connect(input, "keypress", operation(onKeyPress));
92
- connect(input, "focus", onFocus);
93
- connect(input, "blur", onBlur);
94
-
95
- connect(scroller, "dragenter", e_stop);
96
- connect(scroller, "dragover", e_stop);
97
- connect(scroller, "drop", operation(onDrop));
98
- connect(scroller, "paste", function(){focusInput(); fastPoll();});
99
- connect(input, "paste", function(){fastPoll();});
100
- connect(input, "cut", function(){fastPoll();});
101
-
102
- // IE throws unspecified error in certain cases, when
103
- // trying to access activeElement before onload
104
- var hasFocus; try { hasFocus = (targetDocument.activeElement == input); } catch(e) { }
105
- if (hasFocus) setTimeout(onFocus, 20);
106
- else onBlur();
107
-
108
- function isLine(l) {return l >= 0 && l < lines.length;}
109
- // The instance object that we'll return. Mostly calls out to
110
- // local functions in the CodeMirror function. Some do some extra
111
- // range checking and/or clipping. operation is used to wrap the
112
- // call so that changes it makes are tracked, and the display is
113
- // updated afterwards.
114
- var instance = {
115
- getValue: getValue,
116
- setValue: operation(setValue),
117
- getSelection: getSelection,
118
- replaceSelection: operation(replaceSelection),
119
- focus: function(){focusInput(); onFocus(); fastPoll();},
120
- setOption: function(option, value) {
121
- options[option] = value;
122
- if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber") gutterChanged();
123
- else if (option == "mode" || option == "indentUnit") loadMode();
124
- else if (option == "readOnly" && value == "nocursor") input.blur();
125
- else if (option == "theme") scroller.className = scroller.className.replace(/cm-s-\w+/, "cm-s-" + value);
126
- },
127
- getOption: function(option) {return options[option];},
128
- undo: operation(undo),
129
- redo: operation(redo),
130
- indentLine: operation(function(n, dir) {
131
- if (isLine(n)) indentLine(n, dir == null ? "smart" : dir ? "add" : "subtract");
132
- }),
133
- historySize: function() {return {undo: history.done.length, redo: history.undone.length};},
134
- matchBrackets: operation(function(){matchBrackets(true);}),
135
- getTokenAt: function(pos) {
136
- pos = clipPos(pos);
137
- return lines[pos.line].getTokenAt(mode, getStateBefore(pos.line), pos.ch);
138
- },
139
- getStateAfter: function(line) {
140
- line = clipLine(line == null ? lines.length - 1: line);
141
- return getStateBefore(line + 1);
142
- },
143
- cursorCoords: function(start){
144
- if (start == null) start = sel.inverted;
145
- return pageCoords(start ? sel.from : sel.to);
146
- },
147
- charCoords: function(pos){return pageCoords(clipPos(pos));},
148
- coordsChar: function(coords) {
149
- var off = eltOffset(lineSpace);
150
- var line = clipLine(Math.min(lines.length - 1, showingFrom + Math.floor((coords.y - off.top) / lineHeight())));
151
- return clipPos({line: line, ch: charFromX(clipLine(line), coords.x - off.left)});
152
- },
153
- getSearchCursor: function(query, pos, caseFold) {return new SearchCursor(query, pos, caseFold);},
154
- markText: operation(function(a, b, c){return operation(markText(a, b, c));}),
155
- setMarker: addGutterMarker,
156
- clearMarker: removeGutterMarker,
157
- setLineClass: operation(setLineClass),
158
- lineInfo: lineInfo,
159
- addWidget: function(pos, node, scroll, where) {
160
- pos = localCoords(clipPos(pos));
161
- var top = pos.yBot, left = pos.x;
162
- node.style.position = "absolute";
163
- code.appendChild(node);
164
- node.style.left = left + "px";
165
- if (where == "over") top = pos.y;
166
- else if (where == "near") {
167
- var vspace = Math.max(scroller.offsetHeight, lines.length * lineHeight()),
168
- hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft();
169
- if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight)
170
- top = pos.y - node.offsetHeight;
171
- if (left + node.offsetWidth > hspace)
172
- left = hspace - node.offsetWidth;
173
- }
174
- node.style.top = (top + paddingTop()) + "px";
175
- node.style.left = (left + paddingLeft()) + "px";
176
- if (scroll)
177
- scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight);
178
- },
179
-
180
- lineCount: function() {return lines.length;},
181
- getCursor: function(start) {
182
- if (start == null) start = sel.inverted;
183
- return copyPos(start ? sel.from : sel.to);
184
- },
185
- somethingSelected: function() {return !posEq(sel.from, sel.to);},
186
- setCursor: operation(function(line, ch) {
187
- if (ch == null && typeof line.line == "number") setCursor(line.line, line.ch);
188
- else setCursor(line, ch);
189
- }),
190
- setSelection: operation(function(from, to) {setSelection(clipPos(from), clipPos(to || from));}),
191
- getLine: function(line) {if (isLine(line)) return lines[line].text;},
192
- setLine: operation(function(line, text) {
193
- if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: lines[line].text.length});
194
- }),
195
- removeLine: operation(function(line) {
196
- if (isLine(line)) replaceRange("", {line: line, ch: 0}, clipPos({line: line+1, ch: 0}));
197
- }),
198
- replaceRange: operation(replaceRange),
199
- getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));},
200
-
201
- operation: function(f){return operation(f)();},
202
- refresh: function(){updateDisplay(true);},
203
- getInputField: function(){return input;},
204
- getWrapperElement: function(){return wrapper;},
205
- getScrollerElement: function(){return scroller;},
206
- getGutterElement: function(){return gutter;}
207
- };
208
-
209
- function setValue(code) {
210
- history = null;
211
- var top = {line: 0, ch: 0};
212
- updateLines(top, {line: lines.length - 1, ch: lines[lines.length-1].text.length},
213
- splitLines(code), top, top);
214
- history = new History();
215
- }
216
- function getValue(code) {
217
- var text = [];
218
- for (var i = 0, l = lines.length; i < l; ++i)
219
- text.push(lines[i].text);
220
- return text.join("\n");
221
- }
222
-
223
- function onMouseDown(e) {
224
- // Check whether this is a click in a widget
225
- for (var n = e_target(e); n != wrapper; n = n.parentNode)
226
- if (n.parentNode == code && n != mover) return;
227
- var ld = lastDoubleClick; lastDoubleClick = null;
228
- // First, see if this is a click in the gutter
229
- for (var n = e_target(e); n != wrapper; n = n.parentNode)
230
- if (n.parentNode == gutterText) {
231
- if (options.onGutterClick)
232
- options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom);
233
- return e_preventDefault(e);
234
- }
235
-
236
- var start = posFromMouse(e);
237
-
238
- switch (e_button(e)) {
239
- case 3:
240
- if (gecko && !mac) onContextMenu(e);
241
- return;
242
- case 2:
243
- if (start) setCursor(start.line, start.ch, true);
244
- return;
245
- }
246
- // For button 1, if it was clicked inside the editor
247
- // (posFromMouse returning non-null), we have to adjust the
248
- // selection.
249
- if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;}
250
-
251
- if (!focused) onFocus();
252
- e_preventDefault(e);
253
- if (ld && +new Date - ld < 400) return selectLine(start.line);
254
-
255
- setCursor(start.line, start.ch, true);
256
- var last = start, going;
257
- // And then we have to see if it's a drag event, in which case
258
- // the dragged-over text must be selected.
259
- function end() {
260
- focusInput();
261
- updateInput = true;
262
- move(); up();
263
- }
264
- function extend(e) {
265
- var cur = posFromMouse(e, true);
266
- if (cur && !posEq(cur, last)) {
267
- if (!focused) onFocus();
268
- last = cur;
269
- setSelectionUser(start, cur);
270
- updateInput = false;
271
- var visible = visibleLines();
272
- if (cur.line >= visible.to || cur.line < visible.from)
273
- going = setTimeout(operation(function(){extend(e);}), 150);
274
- }
275
- }
276
-
277
- var move = connect(targetDocument, "mousemove", operation(function(e) {
278
- clearTimeout(going);
279
- e_preventDefault(e);
280
- extend(e);
281
- }), true);
282
- var up = connect(targetDocument, "mouseup", operation(function(e) {
283
- clearTimeout(going);
284
- var cur = posFromMouse(e);
285
- if (cur) setSelectionUser(start, cur);
286
- e_preventDefault(e);
287
- end();
288
- }), true);
289
- }
290
- function onDblClick(e) {
291
- var pos = posFromMouse(e);
292
- if (!pos) return;
293
- selectWordAt(pos);
294
- e_preventDefault(e);
295
- lastDoubleClick = +new Date;
296
- }
297
- function onDrop(e) {
298
- e.preventDefault();
299
- var pos = posFromMouse(e, true), files = e.dataTransfer.files;
300
- if (!pos || options.readOnly) return;
301
- if (files && files.length && window.FileReader && window.File) {
302
- function loadFile(file, i) {
303
- var reader = new FileReader;
304
- reader.onload = function() {
305
- text[i] = reader.result;
306
- if (++read == n) replaceRange(text.join(""), clipPos(pos), clipPos(pos));
307
- };
308
- reader.readAsText(file);
309
- }
310
- var n = files.length, text = Array(n), read = 0;
311
- for (var i = 0; i < n; ++i) loadFile(files[i], i);
312
- }
313
- else {
314
- try {
315
- var text = e.dataTransfer.getData("Text");
316
- if (text) replaceRange(text, pos, pos);
317
- }
318
- catch(e){}
319
- }
320
- }
321
- function onKeyDown(e) {
322
- if (!focused) onFocus();
323
-
324
- var code = e.keyCode;
325
- // IE does strange things with escape.
326
- if (ie && code == 27) { e.returnValue = false; }
327
- // Tries to detect ctrl on non-mac, cmd on mac.
328
- var mod = (mac ? e.metaKey : e.ctrlKey) && !e.altKey, anyMod = e.ctrlKey || e.altKey || e.metaKey;
329
- if (code == 16 || e.shiftKey) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);
330
- else shiftSelecting = null;
331
- // First give onKeyEvent option a chance to handle this.
332
- if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
333
-
334
- if (code == 33 || code == 34) {scrollPage(code == 34); return e_preventDefault(e);} // page up/down
335
- if (mod && ((code == 36 || code == 35) || // ctrl-home/end
336
- mac && (code == 38 || code == 40))) { // cmd-up/down
337
- scrollEnd(code == 36 || code == 38); return e_preventDefault(e);
338
- }
339
- if (mod && code == 65) {selectAll(); return e_preventDefault(e);} // ctrl-a
340
- if (!options.readOnly) {
341
- if (!anyMod && code == 13) {return;} // enter
342
- if (!anyMod && code == 9 && handleTab(e.shiftKey)) return e_preventDefault(e); // tab
343
- if (mod && code == 90) {undo(); return e_preventDefault(e);} // ctrl-z
344
- if (mod && ((e.shiftKey && code == 90) || code == 89)) {redo(); return e_preventDefault(e);} // ctrl-shift-z, ctrl-y
345
- }
346
- if (code == 36) { if (options.smartHome) { smartHome(); return e_preventDefault(e); } }
347
-
348
- // Key id to use in the movementKeys map. We also pass it to
349
- // fastPoll in order to 'self learn'. We need this because
350
- // reducedSelection, the hack where we collapse the selection to
351
- // its start when it is inverted and a movement key is pressed
352
- // (and later restore it again), shouldn't be used for
353
- // non-movement keys.
354
- curKeyId = (mod ? "c" : "") + (e.altKey ? "a" : "") + code;
355
- if (sel.inverted && movementKeys[curKeyId] === true) {
356
- var range = selRange(input);
357
- if (range) {
358
- reducedSelection = {anchor: range.start};
359
- setSelRange(input, range.start, range.start);
360
- }
361
- }
362
- // Don't save the key as a movementkey unless it had a modifier
363
- if (!mod && !e.altKey) curKeyId = null;
364
- fastPoll(curKeyId);
365
- }
366
- function onKeyUp(e) {
367
- if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
368
- if (reducedSelection) {
369
- reducedSelection = null;
370
- updateInput = true;
371
- }
372
- if (e.keyCode == 16) shiftSelecting = null;
373
- }
374
- function onKeyPress(e) {
375
- if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
376
- if (options.electricChars && mode.electricChars) {
377
- var ch = String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode);
378
- if (mode.electricChars.indexOf(ch) > -1)
379
- setTimeout(operation(function() {indentLine(sel.to.line, "smart");}), 50);
380
- }
381
- var code = e.keyCode;
382
- // Re-stop tab and enter. Necessary on some browsers.
383
- if (code == 13) {if (!options.readOnly) handleEnter(); e_preventDefault(e);}
384
- else if (!e.ctrlKey && !e.altKey && !e.metaKey && code == 9 && options.tabMode != "default") e_preventDefault(e);
385
- else fastPoll(curKeyId);
386
- }
387
-
388
- function onFocus() {
389
- if (options.readOnly == "nocursor") return;
390
- if (!focused) {
391
- if (options.onFocus) options.onFocus(instance);
392
- focused = true;
393
- if (wrapper.className.search(/\bCodeMirror-focused\b/) == -1)
394
- wrapper.className += " CodeMirror-focused";
395
- if (!leaveInputAlone) prepareInput();
396
- }
397
- slowPoll();
398
- restartBlink();
399
- }
400
- function onBlur() {
401
- if (focused) {
402
- if (options.onBlur) options.onBlur(instance);
403
- focused = false;
404
- wrapper.className = wrapper.className.replace(" CodeMirror-focused", "");
405
- }
406
- clearInterval(blinker);
407
- setTimeout(function() {if (!focused) shiftSelecting = null;}, 150);
408
- }
409
-
410
- // Replace the range from from to to by the strings in newText.
411
- // Afterwards, set the selection to selFrom, selTo.
412
- function updateLines(from, to, newText, selFrom, selTo) {
413
- if (history) {
414
- var old = [];
415
- for (var i = from.line, e = to.line + 1; i < e; ++i) old.push(lines[i].text);
416
- history.addChange(from.line, newText.length, old);
417
- while (history.done.length > options.undoDepth) history.done.shift();
418
- }
419
- updateLinesNoUndo(from, to, newText, selFrom, selTo);
420
- }
421
- function unredoHelper(from, to) {
422
- var change = from.pop();
423
- if (change) {
424
- var replaced = [], end = change.start + change.added;
425
- for (var i = change.start; i < end; ++i) replaced.push(lines[i].text);
426
- to.push({start: change.start, added: change.old.length, old: replaced});
427
- var pos = clipPos({line: change.start + change.old.length - 1,
428
- ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])});
429
- updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: lines[end-1].text.length}, change.old, pos, pos);
430
- updateInput = true;
431
- }
432
- }
433
- function undo() {unredoHelper(history.done, history.undone);}
434
- function redo() {unredoHelper(history.undone, history.done);}
435
-
436
- function updateLinesNoUndo(from, to, newText, selFrom, selTo) {
437
- var recomputeMaxLength = false, maxLineLength = maxLine.length;
438
- for (var i = from.line; i <= to.line; ++i) {
439
- if (lines[i].text.length == maxLineLength) {recomputeMaxLength = true; break;}
440
- }
441
-
442
- var nlines = to.line - from.line, firstLine = lines[from.line], lastLine = lines[to.line];
443
- // First adjust the line structure, taking some care to leave highlighting intact.
444
- if (firstLine == lastLine) {
445
- if (newText.length == 1)
446
- firstLine.replace(from.ch, to.ch, newText[0]);
447
- else {
448
- lastLine = firstLine.split(to.ch, newText[newText.length-1]);
449
- var spliceargs = [from.line + 1, nlines];
450
- firstLine.replace(from.ch, firstLine.text.length, newText[0]);
451
- for (var i = 1, e = newText.length - 1; i < e; ++i) spliceargs.push(new Line(newText[i]));
452
- spliceargs.push(lastLine);
453
- lines.splice.apply(lines, spliceargs);
454
- }
455
- }
456
- else if (newText.length == 1) {
457
- firstLine.replace(from.ch, firstLine.text.length, newText[0] + lastLine.text.slice(to.ch));
458
- lines.splice(from.line + 1, nlines);
459
- }
460
- else {
461
- var spliceargs = [from.line + 1, nlines - 1];
462
- firstLine.replace(from.ch, firstLine.text.length, newText[0]);
463
- lastLine.replace(0, to.ch, newText[newText.length-1]);
464
- for (var i = 1, e = newText.length - 1; i < e; ++i) spliceargs.push(new Line(newText[i]));
465
- lines.splice.apply(lines, spliceargs);
466
- }
467
-
468
-
469
- for (var i = from.line, e = i + newText.length; i < e; ++i) {
470
- var l = lines[i].text;
471
- if (l.length > maxLineLength) {
472
- maxLine = l; maxLineLength = l.length; maxWidth = null;
473
- recomputeMaxLength = false;
474
- }
475
- }
476
- if (recomputeMaxLength) {
477
- maxLineLength = 0; maxLine = ""; maxWidth = null;
478
- for (var i = 0, e = lines.length; i < e; ++i) {
479
- var l = lines[i].text;
480
- if (l.length > maxLineLength) {
481
- maxLineLength = l.length; maxLine = l;
482
- }
483
- }
484
- }
485
-
486
- // Add these lines to the work array, so that they will be
487
- // highlighted. Adjust work lines if lines were added/removed.
488
- var newWork = [], lendiff = newText.length - nlines - 1;
489
- for (var i = 0, l = work.length; i < l; ++i) {
490
- var task = work[i];
491
- if (task < from.line) newWork.push(task);
492
- else if (task > to.line) newWork.push(task + lendiff);
493
- }
494
- if (newText.length < 5) {
495
- highlightLines(from.line, from.line + newText.length);
496
- newWork.push(from.line + newText.length);
497
- } else {
498
- newWork.push(from.line);
499
- }
500
- work = newWork;
501
- startWorker(100);
502
- // Remember that these lines changed, for updating the display
503
- changes.push({from: from.line, to: to.line + 1, diff: lendiff});
504
- textChanged = {from: from, to: to, text: newText};
505
-
506
- // Update the selection
507
- function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;}
508
- setSelection(selFrom, selTo, updateLine(sel.from.line), updateLine(sel.to.line));
509
-
510
- // Make sure the scroll-size div has the correct height.
511
- code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + "px";
512
- }
513
-
514
- function replaceRange(code, from, to) {
515
- from = clipPos(from);
516
- if (!to) to = from; else to = clipPos(to);
517
- code = splitLines(code);
518
- function adjustPos(pos) {
519
- if (posLess(pos, from)) return pos;
520
- if (!posLess(to, pos)) return end;
521
- var line = pos.line + code.length - (to.line - from.line) - 1;
522
- var ch = pos.ch;
523
- if (pos.line == to.line)
524
- ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));
525
- return {line: line, ch: ch};
526
- }
527
- var end;
528
- replaceRange1(code, from, to, function(end1) {
529
- end = end1;
530
- return {from: adjustPos(sel.from), to: adjustPos(sel.to)};
531
- });
532
- return end;
533
- }
534
- function replaceSelection(code, collapse) {
535
- replaceRange1(splitLines(code), sel.from, sel.to, function(end) {
536
- if (collapse == "end") return {from: end, to: end};
537
- else if (collapse == "start") return {from: sel.from, to: sel.from};
538
- else return {from: sel.from, to: end};
539
- });
540
- }
541
- function replaceRange1(code, from, to, computeSel) {
542
- var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;
543
- var newSel = computeSel({line: from.line + code.length - 1, ch: endch});
544
- updateLines(from, to, code, newSel.from, newSel.to);
545
- }
546
-
547
- function getRange(from, to) {
548
- var l1 = from.line, l2 = to.line;
549
- if (l1 == l2) return lines[l1].text.slice(from.ch, to.ch);
550
- var code = [lines[l1].text.slice(from.ch)];
551
- for (var i = l1 + 1; i < l2; ++i) code.push(lines[i].text);
552
- code.push(lines[l2].text.slice(0, to.ch));
553
- return code.join("\n");
554
- }
555
- function getSelection() {
556
- return getRange(sel.from, sel.to);
557
- }
558
-
559
- var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll
560
- function slowPoll() {
561
- if (pollingFast) return;
562
- poll.set(2000, function() {
563
- startOperation();
564
- readInput();
565
- if (focused) slowPoll();
566
- endOperation();
567
- });
568
- }
569
- function fastPoll(keyId) {
570
- var missed = false;
571
- pollingFast = true;
572
- function p() {
573
- startOperation();
574
- var changed = readInput();
575
- if (changed && keyId) {
576
- if (changed == "moved" && movementKeys[keyId] == null) movementKeys[keyId] = true;
577
- if (changed == "changed") movementKeys[keyId] = false;
578
- }
579
- if (!changed && !missed) {missed = true; poll.set(80, p);}
580
- else {pollingFast = false; slowPoll();}
581
- endOperation();
582
- }
583
- poll.set(20, p);
584
- }
585
-
586
- // Inspects the textarea, compares its state (content, selection)
587
- // to the data in the editing variable, and updates the editor
588
- // content or cursor if something changed.
589
- function readInput() {
590
- if (leaveInputAlone || !focused) return;
591
- var changed = false, text = input.value, sr = selRange(input);
592
- if (!sr) return false;
593
- var changed = editing.text != text, rs = reducedSelection;
594
- var moved = changed || sr.start != editing.start || sr.end != (rs ? editing.start : editing.end);
595
- if (!moved && !rs) return false;
596
- if (changed) {
597
- shiftSelecting = reducedSelection = null;
598
- if (options.readOnly) {updateInput = true; return "changed";}
599
- }
600
-
601
- // Compute selection start and end based on start/end offsets in textarea
602
- function computeOffset(n, startLine) {
603
- var pos = 0;
604
- for (;;) {
605
- var found = text.indexOf("\n", pos);
606
- if (found == -1 || (text.charAt(found-1) == "\r" ? found - 1 : found) >= n)
607
- return {line: startLine, ch: n - pos};
608
- ++startLine;
609
- pos = found + 1;
610
- }
611
- }
612
- var from = computeOffset(sr.start, editing.from),
613
- to = computeOffset(sr.end, editing.from);
614
- // Here we have to take the reducedSelection hack into account,
615
- // so that you can, for example, press shift-up at the start of
616
- // your selection and have the right thing happen.
617
- if (rs) {
618
- var head = sr.start == rs.anchor ? to : from;
619
- var tail = shiftSelecting ? sel.to : sr.start == rs.anchor ? from : to;
620
- if (sel.inverted = posLess(head, tail)) { from = head; to = tail; }
621
- else { reducedSelection = null; from = tail; to = head; }
622
- }
623
-
624
- // In some cases (cursor on same line as before), we don't have
625
- // to update the textarea content at all.
626
- if (from.line == to.line && from.line == sel.from.line && from.line == sel.to.line && !shiftSelecting)
627
- updateInput = false;
628
-
629
- // Magic mess to extract precise edited range from the changed
630
- // string.
631
- if (changed) {
632
- var start = 0, end = text.length, len = Math.min(end, editing.text.length);
633
- var c, line = editing.from, nl = -1;
634
- while (start < len && (c = text.charAt(start)) == editing.text.charAt(start)) {
635
- ++start;
636
- if (c == "\n") {line++; nl = start;}
637
- }
638
- var ch = nl > -1 ? start - nl : start, endline = editing.to - 1, edend = editing.text.length;
639
- for (;;) {
640
- c = editing.text.charAt(edend);
641
- if (text.charAt(end) != c) {++end; ++edend; break;}
642
- if (c == "\n") endline--;
643
- if (edend <= start || end <= start) break;
644
- --end; --edend;
645
- }
646
- var nl = editing.text.lastIndexOf("\n", edend - 1), endch = nl == -1 ? edend : edend - nl - 1;
647
- updateLines({line: line, ch: ch}, {line: endline, ch: endch}, splitLines(text.slice(start, end)), from, to);
648
- if (line != endline || from.line != line) updateInput = true;
649
- }
650
- else setSelection(from, to);
651
-
652
- editing.text = text; editing.start = sr.start; editing.end = sr.end;
653
- return changed ? "changed" : moved ? "moved" : false;
654
- }
655
-
656
- // Set the textarea content and selection range to match the
657
- // editor state.
658
- function prepareInput() {
659
- var text = [];
660
- var from = Math.max(0, sel.from.line - 1), to = Math.min(lines.length, sel.to.line + 2);
661
- for (var i = from; i < to; ++i) text.push(lines[i].text);
662
- text = input.value = text.join(lineSep);
663
- var startch = sel.from.ch, endch = sel.to.ch;
664
- for (var i = from; i < sel.from.line; ++i)
665
- startch += lineSep.length + lines[i].text.length;
666
- for (var i = from; i < sel.to.line; ++i)
667
- endch += lineSep.length + lines[i].text.length;
668
- editing = {text: text, from: from, to: to, start: startch, end: endch};
669
- setSelRange(input, startch, reducedSelection ? startch : endch);
670
- }
671
- function focusInput() {
672
- if (options.readOnly != "nocursor") input.focus();
673
- }
674
-
675
- function scrollEditorIntoView() {
676
- if (!cursor.getBoundingClientRect) return;
677
- var rect = cursor.getBoundingClientRect();
678
- var winH = window.innerHeight || document.body.offsetHeight || document.documentElement.offsetHeight;
679
- if (rect.top < 0 || rect.bottom > winH) cursor.scrollIntoView();
680
- }
681
- function scrollCursorIntoView() {
682
- var cursor = localCoords(sel.inverted ? sel.from : sel.to);
683
- return scrollIntoView(cursor.x, cursor.y, cursor.x, cursor.yBot);
684
- }
685
- function scrollIntoView(x1, y1, x2, y2) {
686
- var pl = paddingLeft(), pt = paddingTop(), lh = lineHeight();
687
- y1 += pt; y2 += pt; x1 += pl; x2 += pl;
688
- var screen = scroller.clientHeight, screentop = scroller.scrollTop, scrolled = false, result = true;
689
- if (y1 < screentop) {scroller.scrollTop = Math.max(0, y1 - 2*lh); scrolled = true;}
690
- else if (y2 > screentop + screen) {scroller.scrollTop = y2 + lh - screen; scrolled = true;}
691
-
692
- var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;
693
- if (x1 < screenleft) {
694
- if (x1 < 50) x1 = 0;
695
- scroller.scrollLeft = Math.max(0, x1 - 10);
696
- scrolled = true;
697
- }
698
- else if (x2 > screenw + screenleft) {
699
- scroller.scrollLeft = x2 + 10 - screenw;
700
- scrolled = true;
701
- if (x2 > code.clientWidth) result = false;
702
- }
703
- if (scrolled && options.onScroll) options.onScroll(instance);
704
- return result;
705
- }
706
-
707
- function visibleLines() {
708
- var lh = lineHeight(), top = scroller.scrollTop - paddingTop();
709
- return {from: Math.min(lines.length, Math.max(0, Math.floor(top / lh))),
710
- to: Math.min(lines.length, Math.ceil((top + scroller.clientHeight) / lh))};
711
- }
712
- // Uses a set of changes plus the current scroll position to
713
- // determine which DOM updates have to be made, and makes the
714
- // updates.
715
- function updateDisplay(changes) {
716
- if (!scroller.clientWidth) {
717
- showingFrom = showingTo = 0;
718
- return;
719
- }
720
- // First create a range of theoretically intact lines, and punch
721
- // holes in that using the change info.
722
- var intact = changes === true ? [] : [{from: showingFrom, to: showingTo, domStart: 0}];
723
- for (var i = 0, l = changes.length || 0; i < l; ++i) {
724
- var change = changes[i], intact2 = [], diff = change.diff || 0;
725
- for (var j = 0, l2 = intact.length; j < l2; ++j) {
726
- var range = intact[j];
727
- if (change.to <= range.from)
728
- intact2.push({from: range.from + diff, to: range.to + diff, domStart: range.domStart});
729
- else if (range.to <= change.from)
730
- intact2.push(range);
731
- else {
732
- if (change.from > range.from)
733
- intact2.push({from: range.from, to: change.from, domStart: range.domStart})
734
- if (change.to < range.to)
735
- intact2.push({from: change.to + diff, to: range.to + diff,
736
- domStart: range.domStart + (change.to - range.from)});
737
- }
738
- }
739
- intact = intact2;
740
- }
741
-
742
- // Then, determine which lines we'd want to see, and which
743
- // updates have to be made to get there.
744
- var visible = visibleLines();
745
- var from = Math.min(showingFrom, Math.max(visible.from - 3, 0)),
746
- to = Math.min(lines.length, Math.max(showingTo, visible.to + 3)),
747
- updates = [], domPos = 0, domEnd = showingTo - showingFrom, pos = from, changedLines = 0;
748
-
749
- for (var i = 0, l = intact.length; i < l; ++i) {
750
- var range = intact[i];
751
- if (range.to <= from) continue;
752
- if (range.from >= to) break;
753
- if (range.domStart > domPos || range.from > pos) {
754
- updates.push({from: pos, to: range.from, domSize: range.domStart - domPos, domStart: domPos});
755
- changedLines += range.from - pos;
756
- }
757
- pos = range.to;
758
- domPos = range.domStart + (range.to - range.from);
759
- }
760
- if (domPos != domEnd || pos != to) {
761
- changedLines += Math.abs(to - pos);
762
- updates.push({from: pos, to: to, domSize: domEnd - domPos, domStart: domPos});
763
- }
764
-
765
- if (!updates.length) return;
766
- lineDiv.style.display = "none";
767
- // If more than 30% of the screen needs update, just do a full
768
- // redraw (which is quicker than patching)
769
- if (changedLines > (visible.to - visible.from) * .3)
770
- refreshDisplay(from = Math.max(visible.from - 10, 0), to = Math.min(visible.to + 7, lines.length));
771
- // Otherwise, only update the stuff that needs updating.
772
- else
773
- patchDisplay(updates);
774
- lineDiv.style.display = "";
775
-
776
- // Position the mover div to align with the lines it's supposed
777
- // to be showing (which will cover the visible display)
778
- var different = from != showingFrom || to != showingTo || lastHeight != scroller.clientHeight;
779
- showingFrom = from; showingTo = to;
780
- mover.style.top = (from * lineHeight()) + "px";
781
- if (different) {
782
- lastHeight = scroller.clientHeight;
783
- code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + "px";
784
- }
785
- if (different || updates.length) updateGutter();
786
-
787
- if (maxWidth == null) maxWidth = stringWidth(maxLine);
788
- if (maxWidth > scroller.clientWidth) {
789
- lineSpace.style.width = maxWidth + "px";
790
- // Needed to prevent odd wrapping/hiding of widgets placed in here.
791
- code.style.width = "";
792
- code.style.width = scroller.scrollWidth + "px";
793
- } else {
794
- lineSpace.style.width = code.style.width = "";
795
- }
796
-
797
- // Since this is all rather error prone, it is honoured with the
798
- // only assertion in the whole file.
799
- if (lineDiv.childNodes.length != showingTo - showingFrom)
800
- throw new Error("BAD PATCH! " + JSON.stringify(updates) + " size=" + (showingTo - showingFrom) +
801
- " nodes=" + lineDiv.childNodes.length);
802
- updateCursor();
803
- }
804
-
805
- function refreshDisplay(from, to) {
806
- var html = [], start = {line: from, ch: 0}, inSel = posLess(sel.from, start) && !posLess(sel.to, start);
807
- for (var i = from; i < to; ++i) {
808
- var ch1 = null, ch2 = null;
809
- if (inSel) {
810
- ch1 = 0;
811
- if (sel.to.line == i) {inSel = false; ch2 = sel.to.ch;}
812
- }
813
- else if (sel.from.line == i) {
814
- if (sel.to.line == i) {ch1 = sel.from.ch; ch2 = sel.to.ch;}
815
- else {inSel = true; ch1 = sel.from.ch;}
816
- }
817
- html.push(lines[i].getHTML(ch1, ch2, true));
818
- }
819
- lineDiv.innerHTML = html.join("");
820
- }
821
- function patchDisplay(updates) {
822
- // Slightly different algorithm for IE (badInnerHTML), since
823
- // there .innerHTML on PRE nodes is dumb, and discards
824
- // whitespace.
825
- var sfrom = sel.from.line, sto = sel.to.line, off = 0,
826
- scratch = badInnerHTML && targetDocument.createElement("div");
827
- for (var i = 0, e = updates.length; i < e; ++i) {
828
- var rec = updates[i];
829
- var extra = (rec.to - rec.from) - rec.domSize;
830
- var nodeAfter = lineDiv.childNodes[rec.domStart + rec.domSize + off] || null;
831
- if (badInnerHTML)
832
- for (var j = Math.max(-extra, rec.domSize); j > 0; --j)
833
- lineDiv.removeChild(nodeAfter ? nodeAfter.previousSibling : lineDiv.lastChild);
834
- else if (extra) {
835
- for (var j = Math.max(0, extra); j > 0; --j)
836
- lineDiv.insertBefore(targetDocument.createElement("pre"), nodeAfter);
837
- for (var j = Math.max(0, -extra); j > 0; --j)
838
- lineDiv.removeChild(nodeAfter ? nodeAfter.previousSibling : lineDiv.lastChild);
839
- }
840
- var node = lineDiv.childNodes[rec.domStart + off], inSel = sfrom < rec.from && sto >= rec.from;
841
- for (var j = rec.from; j < rec.to; ++j) {
842
- var ch1 = null, ch2 = null;
843
- if (inSel) {
844
- ch1 = 0;
845
- if (sto == j) {inSel = false; ch2 = sel.to.ch;}
846
- }
847
- else if (sfrom == j) {
848
- if (sto == j) {ch1 = sel.from.ch; ch2 = sel.to.ch;}
849
- else {inSel = true; ch1 = sel.from.ch;}
850
- }
851
- if (badInnerHTML) {
852
- scratch.innerHTML = lines[j].getHTML(ch1, ch2, true);
853
- lineDiv.insertBefore(scratch.firstChild, nodeAfter);
854
- }
855
- else {
856
- node.innerHTML = lines[j].getHTML(ch1, ch2, false);
857
- node.className = lines[j].className || "";
858
- node = node.nextSibling;
859
- }
860
- }
861
- off += extra;
862
- }
863
- }
864
-
865
- function updateGutter() {
866
- if (!options.gutter && !options.lineNumbers) return;
867
- var hText = mover.offsetHeight, hEditor = scroller.clientHeight;
868
- gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + "px";
869
- var html = [];
870
- for (var i = showingFrom; i < Math.max(showingTo, showingFrom + 1); ++i) {
871
- var marker = lines[i].gutterMarker;
872
- var text = options.lineNumbers ? i + options.firstLineNumber : null;
873
- if (marker && marker.text)
874
- text = marker.text.replace("%N%", text != null ? text : "");
875
- else if (text == null)
876
- text = "\u00a0";
877
- html.push((marker && marker.style ? '<pre class="' + marker.style + '">' : "<pre>"), text, "</pre>");
878
- }
879
- gutter.style.display = "none";
880
- gutterText.innerHTML = html.join("");
881
- var minwidth = String(lines.length).length, firstNode = gutterText.firstChild, val = eltText(firstNode), pad = "";
882
- while (val.length + pad.length < minwidth) pad += "\u00a0";
883
- if (pad) firstNode.insertBefore(targetDocument.createTextNode(pad), firstNode.firstChild);
884
- gutter.style.display = "";
885
- lineSpace.style.marginLeft = gutter.offsetWidth + "px";
886
- }
887
- function updateCursor() {
888
- var head = sel.inverted ? sel.from : sel.to, lh = lineHeight();
889
- var x = charX(head.line, head.ch);
890
- inputDiv.style.top = (head.line * lh - scroller.scrollTop) + "px";
891
- inputDiv.style.left = (x - scroller.scrollLeft) + "px";
892
- if (posEq(sel.from, sel.to)) {
893
- cursor.style.top = (head.line - showingFrom) * lh + "px";
894
- cursor.style.left = x + "px";
895
- cursor.style.display = "";
896
- }
897
- else cursor.style.display = "none";
898
- }
899
-
900
- function setSelectionUser(from, to) {
901
- var sh = shiftSelecting && clipPos(shiftSelecting);
902
- if (sh) {
903
- if (posLess(sh, from)) from = sh;
904
- else if (posLess(to, sh)) to = sh;
905
- }
906
- setSelection(from, to);
907
- }
908
- // Update the selection. Last two args are only used by
909
- // updateLines, since they have to be expressed in the line
910
- // numbers before the update.
911
- function setSelection(from, to, oldFrom, oldTo) {
912
- if (posEq(sel.from, from) && posEq(sel.to, to)) return;
913
- if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}
914
-
915
- if (posEq(from, to)) sel.inverted = false;
916
- else if (posEq(from, sel.to)) sel.inverted = false;
917
- else if (posEq(to, sel.from)) sel.inverted = true;
918
-
919
- // Some ugly logic used to only mark the lines that actually did
920
- // see a change in selection as changed, rather than the whole
921
- // selected range.
922
- if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}
923
- if (posEq(from, to)) {
924
- if (!posEq(sel.from, sel.to))
925
- changes.push({from: oldFrom, to: oldTo + 1});
926
- }
927
- else if (posEq(sel.from, sel.to)) {
928
- changes.push({from: from.line, to: to.line + 1});
929
- }
930
- else {
931
- if (!posEq(from, sel.from)) {
932
- if (from.line < oldFrom)
933
- changes.push({from: from.line, to: Math.min(to.line, oldFrom) + 1});
934
- else
935
- changes.push({from: oldFrom, to: Math.min(oldTo, from.line) + 1});
936
- }
937
- if (!posEq(to, sel.to)) {
938
- if (to.line < oldTo)
939
- changes.push({from: Math.max(oldFrom, from.line), to: oldTo + 1});
940
- else
941
- changes.push({from: Math.max(from.line, oldTo), to: to.line + 1});
942
- }
943
- }
944
- sel.from = from; sel.to = to;
945
- selectionChanged = true;
946
- }
947
- function setCursor(line, ch, user) {
948
- var pos = clipPos({line: line, ch: ch || 0});
949
- (user ? setSelectionUser : setSelection)(pos, pos);
950
- }
951
-
952
- function clipLine(n) {return Math.max(0, Math.min(n, lines.length-1));}
953
- function clipPos(pos) {
954
- if (pos.line < 0) return {line: 0, ch: 0};
955
- if (pos.line >= lines.length) return {line: lines.length-1, ch: lines[lines.length-1].text.length};
956
- var ch = pos.ch, linelen = lines[pos.line].text.length;
957
- if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};
958
- else if (ch < 0) return {line: pos.line, ch: 0};
959
- else return pos;
960
- }
961
-
962
- function scrollPage(down) {
963
- var linesPerPage = Math.floor(scroller.clientHeight / lineHeight()), head = sel.inverted ? sel.from : sel.to;
964
- setCursor(head.line + (Math.max(linesPerPage - 1, 1) * (down ? 1 : -1)), head.ch, true);
965
- }
966
- function scrollEnd(top) {
967
- var pos = top ? {line: 0, ch: 0} : {line: lines.length - 1, ch: lines[lines.length-1].text.length};
968
- setSelectionUser(pos, pos);
969
- }
970
- function selectAll() {
971
- var endLine = lines.length - 1;
972
- setSelection({line: 0, ch: 0}, {line: endLine, ch: lines[endLine].text.length});
973
- }
974
- function selectWordAt(pos) {
975
- var line = lines[pos.line].text;
976
- var start = pos.ch, end = pos.ch;
977
- while (start > 0 && /\w/.test(line.charAt(start - 1))) --start;
978
- while (end < line.length && /\w/.test(line.charAt(end))) ++end;
979
- setSelectionUser({line: pos.line, ch: start}, {line: pos.line, ch: end});
980
- }
981
- function selectLine(line) {
982
- setSelectionUser({line: line, ch: 0}, {line: line, ch: lines[line].text.length});
983
- }
984
- function handleEnter() {
985
- replaceSelection("\n", "end");
986
- if (options.enterMode != "flat")
987
- indentLine(sel.from.line, options.enterMode == "keep" ? "prev" : "smart");
988
- }
989
- function handleTab(shift) {
990
- function indentSelected(mode) {
991
- if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode);
992
- var e = sel.to.line - (sel.to.ch ? 0 : 1);
993
- for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode);
994
- }
995
- shiftSelecting = null;
996
- switch (options.tabMode) {
997
- case "default":
998
- return false;
999
- case "indent":
1000
- indentSelected("smart");
1001
- break;
1002
- case "classic":
1003
- if (posEq(sel.from, sel.to)) {
1004
- if (shift) indentLine(sel.from.line, "smart");
1005
- else replaceSelection("\t", "end");
1006
- break;
1007
- }
1008
- case "shift":
1009
- indentSelected(shift ? "subtract" : "add");
1010
- break;
1011
- }
1012
- return true;
1013
- }
1014
- function smartHome() {
1015
- var firstNonWS = Math.max(0, lines[sel.from.line].text.search(/\S/));
1016
- setCursor(sel.from.line, sel.from.ch <= firstNonWS && sel.from.ch ? 0 : firstNonWS, true);
1017
- }
1018
-
1019
- function indentLine(n, how) {
1020
- if (how == "smart") {
1021
- if (!mode.indent) how = "prev";
1022
- else var state = getStateBefore(n);
1023
- }
1024
-
1025
- var line = lines[n], curSpace = line.indentation(), curSpaceString = line.text.match(/^\s*/)[0], indentation;
1026
- if (how == "prev") {
1027
- if (n) indentation = lines[n-1].indentation();
1028
- else indentation = 0;
1029
- }
1030
- else if (how == "smart") indentation = mode.indent(state, line.text.slice(curSpaceString.length));
1031
- else if (how == "add") indentation = curSpace + options.indentUnit;
1032
- else if (how == "subtract") indentation = curSpace - options.indentUnit;
1033
- indentation = Math.max(0, indentation);
1034
- var diff = indentation - curSpace;
1035
-
1036
- if (!diff) {
1037
- if (sel.from.line != n && sel.to.line != n) return;
1038
- var indentString = curSpaceString;
1039
- }
1040
- else {
1041
- var indentString = "", pos = 0;
1042
- if (options.indentWithTabs)
1043
- for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";}
1044
- while (pos < indentation) {++pos; indentString += " ";}
1045
- }
1046
-
1047
- replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});
1048
- }
1049
-
1050
- function loadMode() {
1051
- mode = CodeMirror.getMode(options, options.mode);
1052
- for (var i = 0, l = lines.length; i < l; ++i)
1053
- lines[i].stateAfter = null;
1054
- work = [0];
1055
- startWorker();
1056
- }
1057
- function gutterChanged() {
1058
- var visible = options.gutter || options.lineNumbers;
1059
- gutter.style.display = visible ? "" : "none";
1060
- if (visible) updateGutter();
1061
- else lineDiv.parentNode.style.marginLeft = 0;
1062
- }
1063
-
1064
- function markText(from, to, className) {
1065
- from = clipPos(from); to = clipPos(to);
1066
- var accum = [];
1067
- function add(line, from, to, className) {
1068
- var line = lines[line], mark = line.addMark(from, to, className);
1069
- mark.line = line;
1070
- accum.push(mark);
1071
- }
1072
- if (from.line == to.line) add(from.line, from.ch, to.ch, className);
1073
- else {
1074
- add(from.line, from.ch, null, className);
1075
- for (var i = from.line + 1, e = to.line; i < e; ++i)
1076
- add(i, 0, null, className);
1077
- add(to.line, 0, to.ch, className);
1078
- }
1079
- changes.push({from: from.line, to: to.line + 1});
1080
- return function() {
1081
- var start, end;
1082
- for (var i = 0; i < accum.length; ++i) {
1083
- var mark = accum[i], found = indexOf(lines, mark.line);
1084
- mark.line.removeMark(mark);
1085
- if (found > -1) {
1086
- if (start == null) start = found;
1087
- end = found;
1088
- }
1089
- }
1090
- if (start != null) changes.push({from: start, to: end + 1});
1091
- };
1092
- }
1093
-
1094
- function addGutterMarker(line, text, className) {
1095
- if (typeof line == "number") line = lines[clipLine(line)];
1096
- line.gutterMarker = {text: text, style: className};
1097
- updateGutter();
1098
- return line;
1099
- }
1100
- function removeGutterMarker(line) {
1101
- if (typeof line == "number") line = lines[clipLine(line)];
1102
- line.gutterMarker = null;
1103
- updateGutter();
1104
- }
1105
- function setLineClass(line, className) {
1106
- if (typeof line == "number") {
1107
- var no = line;
1108
- line = lines[clipLine(line)];
1109
- }
1110
- else {
1111
- var no = indexOf(lines, line);
1112
- if (no == -1) return null;
1113
- }
1114
- if (line.className != className) {
1115
- line.className = className;
1116
- changes.push({from: no, to: no + 1});
1117
- }
1118
- return line;
1119
- }
1120
-
1121
- function lineInfo(line) {
1122
- if (typeof line == "number") {
1123
- var n = line;
1124
- line = lines[line];
1125
- if (!line) return null;
1126
- }
1127
- else {
1128
- var n = indexOf(lines, line);
1129
- if (n == -1) return null;
1130
- }
1131
- var marker = line.gutterMarker;
1132
- return {line: n, text: line.text, markerText: marker && marker.text, markerClass: marker && marker.style};
1133
- }
1134
-
1135
- function stringWidth(str) {
1136
- measure.innerHTML = "<pre><span>x</span></pre>";
1137
- measure.firstChild.firstChild.firstChild.nodeValue = str;
1138
- return measure.firstChild.firstChild.offsetWidth || 10;
1139
- }
1140
- // These are used to go from pixel positions to character
1141
- // positions, taking varying character widths into account.
1142
- function charX(line, pos) {
1143
- if (pos == 0) return 0;
1144
- measure.innerHTML = "<pre><span>" + lines[line].getHTML(null, null, false, pos) + "</span></pre>";
1145
- return measure.firstChild.firstChild.offsetWidth;
1146
- }
1147
- function charFromX(line, x) {
1148
- if (x <= 0) return 0;
1149
- var lineObj = lines[line], text = lineObj.text;
1150
- function getX(len) {
1151
- measure.innerHTML = "<pre><span>" + lineObj.getHTML(null, null, false, len) + "</span></pre>";
1152
- return measure.firstChild.firstChild.offsetWidth;
1153
- }
1154
- var from = 0, fromX = 0, to = text.length, toX;
1155
- // Guess a suitable upper bound for our search.
1156
- var estimated = Math.min(to, Math.ceil(x / stringWidth("x")));
1157
- for (;;) {
1158
- var estX = getX(estimated);
1159
- if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));
1160
- else {toX = estX; to = estimated; break;}
1161
- }
1162
- if (x > toX) return to;
1163
- // Try to guess a suitable lower bound as well.
1164
- estimated = Math.floor(to * 0.8); estX = getX(estimated);
1165
- if (estX < x) {from = estimated; fromX = estX;}
1166
- // Do a binary search between these bounds.
1167
- for (;;) {
1168
- if (to - from <= 1) return (toX - x > x - fromX) ? from : to;
1169
- var middle = Math.ceil((from + to) / 2), middleX = getX(middle);
1170
- if (middleX > x) {to = middle; toX = middleX;}
1171
- else {from = middle; fromX = middleX;}
1172
- }
1173
- }
1174
-
1175
- function localCoords(pos, inLineWrap) {
1176
- var lh = lineHeight(), line = pos.line - (inLineWrap ? showingFrom : 0);
1177
- return {x: charX(pos.line, pos.ch), y: line * lh, yBot: (line + 1) * lh};
1178
- }
1179
- function pageCoords(pos) {
1180
- var local = localCoords(pos, true), off = eltOffset(lineSpace);
1181
- return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot};
1182
- }
1183
-
1184
- function lineHeight() {
1185
- var nlines = lineDiv.childNodes.length;
1186
- if (nlines) return (lineDiv.offsetHeight / nlines) || 1;
1187
- measure.innerHTML = "<pre>x</pre>";
1188
- return measure.firstChild.offsetHeight || 1;
1189
- }
1190
- function paddingTop() {return lineSpace.offsetTop;}
1191
- function paddingLeft() {return lineSpace.offsetLeft;}
1192
-
1193
- function posFromMouse(e, liberal) {
1194
- var offW = eltOffset(scroller, true), x, y;
1195
- // Fails unpredictably on IE[67] when mouse is dragged around quickly.
1196
- try { x = e.clientX; y = e.clientY; } catch (e) { return null; }
1197
- // This is a mess of a heuristic to try and determine whether a
1198
- // scroll-bar was clicked or not, and to return null if one was
1199
- // (and !liberal).
1200
- if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight))
1201
- return null;
1202
- var offL = eltOffset(lineSpace, true);
1203
- var line = showingFrom + Math.floor((y - offL.top) / lineHeight());
1204
- return clipPos({line: line, ch: charFromX(clipLine(line), x - offL.left)});
1205
- }
1206
- function onContextMenu(e) {
1207
- var pos = posFromMouse(e);
1208
- if (!pos || window.opera) return; // Opera is difficult.
1209
- if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))
1210
- operation(setCursor)(pos.line, pos.ch);
1211
-
1212
- var oldCSS = input.style.cssText;
1213
- inputDiv.style.position = "absolute";
1214
- input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) +
1215
- "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; " +
1216
- "border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
1217
- leaveInputAlone = true;
1218
- var val = input.value = getSelection();
1219
- focusInput();
1220
- setSelRange(input, 0, input.value.length);
1221
- function rehide() {
1222
- var newVal = splitLines(input.value).join("\n");
1223
- if (newVal != val) operation(replaceSelection)(newVal, "end");
1224
- inputDiv.style.position = "relative";
1225
- input.style.cssText = oldCSS;
1226
- leaveInputAlone = false;
1227
- prepareInput();
1228
- slowPoll();
1229
- }
1230
-
1231
- if (gecko) {
1232
- e_stop(e);
1233
- var mouseup = connect(window, "mouseup", function() {
1234
- mouseup();
1235
- setTimeout(rehide, 20);
1236
- }, true);
1237
- }
1238
- else {
1239
- setTimeout(rehide, 50);
1240
- }
1241
- }
1242
-
1243
- // Cursor-blinking
1244
- function restartBlink() {
1245
- clearInterval(blinker);
1246
- var on = true;
1247
- cursor.style.visibility = "";
1248
- blinker = setInterval(function() {
1249
- cursor.style.visibility = (on = !on) ? "" : "hidden";
1250
- }, 650);
1251
- }
1252
-
1253
- var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
1254
- function matchBrackets(autoclear) {
1255
- var head = sel.inverted ? sel.from : sel.to, line = lines[head.line], pos = head.ch - 1;
1256
- var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
1257
- if (!match) return;
1258
- var ch = match.charAt(0), forward = match.charAt(1) == ">", d = forward ? 1 : -1, st = line.styles;
1259
- for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2)
1260
- if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;}
1261
-
1262
- var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;
1263
- function scan(line, from, to) {
1264
- if (!line.text) return;
1265
- var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur;
1266
- for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) {
1267
- var text = st[i];
1268
- if (st[i+1] != null && st[i+1] != style) {pos += d * text.length; continue;}
1269
- for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) {
1270
- if (pos >= from && pos < to && re.test(cur = text.charAt(j))) {
1271
- var match = matching[cur];
1272
- if (match.charAt(1) == ">" == forward) stack.push(cur);
1273
- else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};
1274
- else if (!stack.length) return {pos: pos, match: true};
1275
- }
1276
- }
1277
- }
1278
- }
1279
- for (var i = head.line, e = forward ? Math.min(i + 100, lines.length) : Math.max(-1, i - 100); i != e; i+=d) {
1280
- var line = lines[i], first = i == head.line;
1281
- var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length);
1282
- if (found) break;
1283
- }
1284
- if (!found) found = {pos: null, match: false};
1285
- var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
1286
- var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),
1287
- two = found.pos != null
1288
- ? markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style)
1289
- : function() {};
1290
- var clear = operation(function(){one(); two();});
1291
- if (autoclear) setTimeout(clear, 800);
1292
- else bracketHighlighted = clear;
1293
- }
1294
-
1295
- // Finds the line to start with when starting a parse. Tries to
1296
- // find a line with a stateAfter, so that it can start with a
1297
- // valid state. If that fails, it returns the line with the
1298
- // smallest indentation, which tends to need the least context to
1299
- // parse correctly.
1300
- function findStartLine(n) {
1301
- var minindent, minline;
1302
- for (var search = n, lim = n - 40; search > lim; --search) {
1303
- if (search == 0) return 0;
1304
- var line = lines[search-1];
1305
- if (line.stateAfter) return search;
1306
- var indented = line.indentation();
1307
- if (minline == null || minindent > indented) {
1308
- minline = search - 1;
1309
- minindent = indented;
1310
- }
1311
- }
1312
- return minline;
1313
- }
1314
- function getStateBefore(n) {
1315
- var start = findStartLine(n), state = start && lines[start-1].stateAfter;
1316
- if (!state) state = startState(mode);
1317
- else state = copyState(mode, state);
1318
- for (var i = start; i < n; ++i) {
1319
- var line = lines[i];
1320
- line.highlight(mode, state);
1321
- line.stateAfter = copyState(mode, state);
1322
- }
1323
- if (n < lines.length && !lines[n].stateAfter) work.push(n);
1324
- return state;
1325
- }
1326
- function highlightLines(start, end) {
1327
- var state = getStateBefore(start);
1328
- for (var i = start; i < end; ++i) {
1329
- var line = lines[i];
1330
- line.highlight(mode, state);
1331
- line.stateAfter = copyState(mode, state);
1332
- }
1333
- }
1334
- function highlightWorker() {
1335
- var end = +new Date + options.workTime;
1336
- var foundWork = work.length;
1337
- while (work.length) {
1338
- if (!lines[showingFrom].stateAfter) var task = showingFrom;
1339
- else var task = work.pop();
1340
- if (task >= lines.length) continue;
1341
- var start = findStartLine(task), state = start && lines[start-1].stateAfter;
1342
- if (state) state = copyState(mode, state);
1343
- else state = startState(mode);
1344
-
1345
- var unchanged = 0, compare = mode.compareStates, realChange = false;
1346
- for (var i = start, l = lines.length; i < l; ++i) {
1347
- var line = lines[i], hadState = line.stateAfter;
1348
- if (+new Date > end) {
1349
- work.push(i);
1350
- startWorker(options.workDelay);
1351
- if (realChange) changes.push({from: task, to: i + 1});
1352
- return;
1353
- }
1354
- var changed = line.highlight(mode, state);
1355
- if (changed) realChange = true;
1356
- line.stateAfter = copyState(mode, state);
1357
- if (compare) {
1358
- if (hadState && compare(hadState, state)) break;
1359
- } else {
1360
- if (changed !== false || !hadState) unchanged = 0;
1361
- else if (++unchanged > 3) break;
1362
- }
1363
- }
1364
- if (realChange) changes.push({from: task, to: i + 1});
1365
- }
1366
- if (foundWork && options.onHighlightComplete)
1367
- options.onHighlightComplete(instance);
1368
- }
1369
- function startWorker(time) {
1370
- if (!work.length) return;
1371
- highlight.set(time, operation(highlightWorker));
1372
- }
1373
-
1374
- // Operations are used to wrap changes in such a way that each
1375
- // change won't have to update the cursor and display (which would
1376
- // be awkward, slow, and error-prone), but instead updates are
1377
- // batched and then all combined and executed at once.
1378
- function startOperation() {
1379
- updateInput = null; changes = []; textChanged = selectionChanged = false;
1380
- }
1381
- function endOperation() {
1382
- var reScroll = false;
1383
- if (selectionChanged) reScroll = !scrollCursorIntoView();
1384
- if (changes.length) updateDisplay(changes);
1385
- else if (selectionChanged) updateCursor();
1386
- if (reScroll) scrollCursorIntoView();
1387
- if (selectionChanged) {scrollEditorIntoView(); restartBlink();}
1388
-
1389
- // updateInput can be set to a boolean value to force/prevent an
1390
- // update.
1391
- if (focused && !leaveInputAlone &&
1392
- (updateInput === true || (updateInput !== false && selectionChanged)))
1393
- prepareInput();
1394
-
1395
- if (selectionChanged && options.matchBrackets)
1396
- setTimeout(operation(function() {
1397
- if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;}
1398
- matchBrackets(false);
1399
- }), 20);
1400
- var tc = textChanged; // textChanged can be reset by cursoractivity callback
1401
- if (selectionChanged && options.onCursorActivity)
1402
- options.onCursorActivity(instance);
1403
- if (tc && options.onChange && instance)
1404
- options.onChange(instance, tc);
1405
- }
1406
- var nestedOperation = 0;
1407
- function operation(f) {
1408
- return function() {
1409
- if (!nestedOperation++) startOperation();
1410
- try {var result = f.apply(this, arguments);}
1411
- finally {if (!--nestedOperation) endOperation();}
1412
- return result;
1413
- };
1414
- }
1415
-
1416
- function SearchCursor(query, pos, caseFold) {
1417
- this.atOccurrence = false;
1418
- if (caseFold == null) caseFold = typeof query == "string" && query == query.toLowerCase();
1419
-
1420
- if (pos && typeof pos == "object") pos = clipPos(pos);
1421
- else pos = {line: 0, ch: 0};
1422
- this.pos = {from: pos, to: pos};
1423
-
1424
- // The matches method is filled in based on the type of query.
1425
- // It takes a position and a direction, and returns an object
1426
- // describing the next occurrence of the query, or null if no
1427
- // more matches were found.
1428
- if (typeof query != "string") // Regexp match
1429
- this.matches = function(reverse, pos) {
1430
- if (reverse) {
1431
- var line = lines[pos.line].text.slice(0, pos.ch), match = line.match(query), start = 0;
1432
- while (match) {
1433
- var ind = line.indexOf(match[0]);
1434
- start += ind;
1435
- line = line.slice(ind + 1);
1436
- var newmatch = line.match(query);
1437
- if (newmatch) match = newmatch;
1438
- else break;
1439
- start++;
1440
- }
1441
- }
1442
- else {
1443
- var line = lines[pos.line].text.slice(pos.ch), match = line.match(query),
1444
- start = match && pos.ch + line.indexOf(match[0]);
1445
- }
1446
- if (match)
1447
- return {from: {line: pos.line, ch: start},
1448
- to: {line: pos.line, ch: start + match[0].length},
1449
- match: match};
1450
- };
1451
- else { // String query
1452
- if (caseFold) query = query.toLowerCase();
1453
- var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};
1454
- var target = query.split("\n");
1455
- // Different methods for single-line and multi-line queries
1456
- if (target.length == 1)
1457
- this.matches = function(reverse, pos) {
1458
- var line = fold(lines[pos.line].text), len = query.length, match;
1459
- if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1)
1460
- : (match = line.indexOf(query, pos.ch)) != -1)
1461
- return {from: {line: pos.line, ch: match},
1462
- to: {line: pos.line, ch: match + len}};
1463
- };
1464
- else
1465
- this.matches = function(reverse, pos) {
1466
- var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(lines[ln].text);
1467
- var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));
1468
- if (reverse ? offsetA >= pos.ch || offsetA != match.length
1469
- : offsetA <= pos.ch || offsetA != line.length - match.length)
1470
- return;
1471
- for (;;) {
1472
- if (reverse ? !ln : ln == lines.length - 1) return;
1473
- line = fold(lines[ln += reverse ? -1 : 1].text);
1474
- match = target[reverse ? --idx : ++idx];
1475
- if (idx > 0 && idx < target.length - 1) {
1476
- if (line != match) return;
1477
- else continue;
1478
- }
1479
- var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);
1480
- if (reverse ? offsetB != line.length - match.length : offsetB != match.length)
1481
- return;
1482
- var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB};
1483
- return {from: reverse ? end : start, to: reverse ? start : end};
1484
- }
1485
- };
1486
- }
1487
- }
1488
-
1489
- SearchCursor.prototype = {
1490
- findNext: function() {return this.find(false);},
1491
- findPrevious: function() {return this.find(true);},
1492
-
1493
- find: function(reverse) {
1494
- var self = this, pos = clipPos(reverse ? this.pos.from : this.pos.to);
1495
- function savePosAndFail(line) {
1496
- var pos = {line: line, ch: 0};
1497
- self.pos = {from: pos, to: pos};
1498
- self.atOccurrence = false;
1499
- return false;
1500
- }
1501
-
1502
- for (;;) {
1503
- if (this.pos = this.matches(reverse, pos)) {
1504
- this.atOccurrence = true;
1505
- return this.pos.match || true;
1506
- }
1507
- if (reverse) {
1508
- if (!pos.line) return savePosAndFail(0);
1509
- pos = {line: pos.line-1, ch: lines[pos.line-1].text.length};
1510
- }
1511
- else {
1512
- if (pos.line == lines.length - 1) return savePosAndFail(lines.length);
1513
- pos = {line: pos.line+1, ch: 0};
1514
- }
1515
- }
1516
- },
1517
-
1518
- from: function() {if (this.atOccurrence) return copyPos(this.pos.from);},
1519
- to: function() {if (this.atOccurrence) return copyPos(this.pos.to);},
1520
-
1521
- replace: function(newText) {
1522
- var self = this;
1523
- if (this.atOccurrence)
1524
- operation(function() {
1525
- self.pos.to = replaceRange(newText, self.pos.from, self.pos.to);
1526
- })();
1527
- }
1528
- };
1529
-
1530
- for (var ext in extensions)
1531
- if (extensions.propertyIsEnumerable(ext) &&
1532
- !instance.propertyIsEnumerable(ext))
1533
- instance[ext] = extensions[ext];
1534
- return instance;
1535
- } // (end of function CodeMirror)
1536
-
1537
- // The default configuration options.
1538
- CodeMirror.defaults = {
1539
- value: "",
1540
- mode: null,
1541
- theme: "default",
1542
- indentUnit: 2,
1543
- indentWithTabs: false,
1544
- tabMode: "classic",
1545
- enterMode: "indent",
1546
- electricChars: true,
1547
- onKeyEvent: null,
1548
- lineNumbers: false,
1549
- gutter: false,
1550
- firstLineNumber: 1,
1551
- readOnly: false,
1552
- smartHome: true,
1553
- onChange: null,
1554
- onCursorActivity: null,
1555
- onGutterClick: null,
1556
- onHighlightComplete: null,
1557
- onFocus: null, onBlur: null, onScroll: null,
1558
- matchBrackets: false,
1559
- workTime: 100,
1560
- workDelay: 200,
1561
- undoDepth: 40,
1562
- tabindex: null,
1563
- document: window.document
1564
- };
1565
-
1566
- // Known modes, by name and by MIME
1567
- var modes = {}, mimeModes = {};
1568
- CodeMirror.defineMode = function(name, mode) {
1569
- if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name;
1570
- modes[name] = mode;
1571
- };
1572
- CodeMirror.defineMIME = function(mime, spec) {
1573
- mimeModes[mime] = spec;
1574
- };
1575
- CodeMirror.getMode = function(options, spec) {
1576
- if (typeof spec == "string" && mimeModes.hasOwnProperty(spec))
1577
- spec = mimeModes[spec];
1578
- if (typeof spec == "string")
1579
- var mname = spec, config = {};
1580
- else if (spec != null)
1581
- var mname = spec.name, config = spec;
1582
- var mfactory = modes[mname];
1583
- if (!mfactory) {
1584
- if (window.console) console.warn("No mode " + mname + " found, falling back to plain text.");
1585
- return CodeMirror.getMode(options, "text/plain");
1586
- }
1587
- return mfactory(options, config || {});
1588
- };
1589
- CodeMirror.listModes = function() {
1590
- var list = [];
1591
- for (var m in modes)
1592
- if (modes.propertyIsEnumerable(m)) list.push(m);
1593
- return list;
1594
- };
1595
- CodeMirror.listMIMEs = function() {
1596
- var list = [];
1597
- for (var m in mimeModes)
1598
- if (mimeModes.propertyIsEnumerable(m)) list.push(m);
1599
- return list;
1600
- };
1601
-
1602
- var extensions = {};
1603
- CodeMirror.defineExtension = function(name, func) {
1604
- extensions[name] = func;
1605
- };
1606
-
1607
- CodeMirror.fromTextArea = function(textarea, options) {
1608
- if (!options) options = {};
1609
- options.value = textarea.value;
1610
- if (!options.tabindex && textarea.tabindex)
1611
- options.tabindex = textarea.tabindex;
1612
-
1613
- function save() {textarea.value = instance.getValue();}
1614
- if (textarea.form) {
1615
- // Deplorable hack to make the submit method do the right thing.
1616
- var rmSubmit = connect(textarea.form, "submit", save, true);
1617
- if (typeof textarea.form.submit == "function") {
1618
- var realSubmit = textarea.form.submit;
1619
- function wrappedSubmit() {
1620
- save();
1621
- textarea.form.submit = realSubmit;
1622
- textarea.form.submit();
1623
- textarea.form.submit = wrappedSubmit;
1624
- }
1625
- textarea.form.submit = wrappedSubmit;
1626
- }
1627
- }
1628
-
1629
- textarea.style.display = "none";
1630
- var instance = CodeMirror(function(node) {
1631
- textarea.parentNode.insertBefore(node, textarea.nextSibling);
1632
- }, options);
1633
- instance.save = save;
1634
- instance.toTextArea = function() {
1635
- save();
1636
- textarea.parentNode.removeChild(instance.getWrapperElement());
1637
- textarea.style.display = "";
1638
- if (textarea.form) {
1639
- rmSubmit();
1640
- if (typeof textarea.form.submit == "function")
1641
- textarea.form.submit = realSubmit;
1642
- }
1643
- };
1644
- return instance;
1645
- };
1646
-
1647
- // Utility functions for working with state. Exported because modes
1648
- // sometimes need to do this.
1649
- function copyState(mode, state) {
1650
- if (state === true) return state;
1651
- if (mode.copyState) return mode.copyState(state);
1652
- var nstate = {};
1653
- for (var n in state) {
1654
- var val = state[n];
1655
- if (val instanceof Array) val = val.concat([]);
1656
- nstate[n] = val;
1657
- }
1658
- return nstate;
1659
- }
1660
- CodeMirror.startState = startState;
1661
- function startState(mode, a1, a2) {
1662
- return mode.startState ? mode.startState(a1, a2) : true;
1663
- }
1664
- CodeMirror.copyState = copyState;
1665
-
1666
- // The character stream used by a mode's parser.
1667
- function StringStream(string) {
1668
- this.pos = this.start = 0;
1669
- this.string = string;
1670
- }
1671
- StringStream.prototype = {
1672
- eol: function() {return this.pos >= this.string.length;},
1673
- sol: function() {return this.pos == 0;},
1674
- peek: function() {return this.string.charAt(this.pos);},
1675
- next: function() {
1676
- if (this.pos < this.string.length)
1677
- return this.string.charAt(this.pos++);
1678
- },
1679
- eat: function(match) {
1680
- var ch = this.string.charAt(this.pos);
1681
- if (typeof match == "string") var ok = ch == match;
1682
- else var ok = ch && (match.test ? match.test(ch) : match(ch));
1683
- if (ok) {++this.pos; return ch;}
1684
- },
1685
- eatWhile: function(match) {
1686
- var start = this.pos;
1687
- while (this.eat(match)){}
1688
- return this.pos > start;
1689
- },
1690
- eatSpace: function() {
1691
- var start = this.pos;
1692
- while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
1693
- return this.pos > start;
1694
- },
1695
- skipToEnd: function() {this.pos = this.string.length;},
1696
- skipTo: function(ch) {
1697
- var found = this.string.indexOf(ch, this.pos);
1698
- if (found > -1) {this.pos = found; return true;}
1699
- },
1700
- backUp: function(n) {this.pos -= n;},
1701
- column: function() {return countColumn(this.string, this.start);},
1702
- indentation: function() {return countColumn(this.string);},
1703
- match: function(pattern, consume, caseInsensitive) {
1704
- if (typeof pattern == "string") {
1705
- function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
1706
- if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
1707
- if (consume !== false) this.pos += pattern.length;
1708
- return true;
1709
- }
1710
- }
1711
- else {
1712
- var match = this.string.slice(this.pos).match(pattern);
1713
- if (match && consume !== false) this.pos += match[0].length;
1714
- return match;
1715
- }
1716
- },
1717
- current: function(){return this.string.slice(this.start, this.pos);}
1718
- };
1719
- CodeMirror.StringStream = StringStream;
1720
-
1721
- // Line objects. These hold state related to a line, including
1722
- // highlighting info (the styles array).
1723
- function Line(text, styles) {
1724
- this.styles = styles || [text, null];
1725
- this.stateAfter = null;
1726
- this.text = text;
1727
- this.marked = this.gutterMarker = this.className = null;
1728
- }
1729
- Line.prototype = {
1730
- // Replace a piece of a line, keeping the styles around it intact.
1731
- replace: function(from, to, text) {
1732
- var st = [], mk = this.marked;
1733
- copyStyles(0, from, this.styles, st);
1734
- if (text) st.push(text, null);
1735
- copyStyles(to, this.text.length, this.styles, st);
1736
- this.styles = st;
1737
- this.text = this.text.slice(0, from) + text + this.text.slice(to);
1738
- this.stateAfter = null;
1739
- if (mk) {
1740
- var diff = text.length - (to - from), end = this.text.length;
1741
- function fix(n) {return n <= Math.min(to, to + diff) ? n : n + diff;}
1742
- for (var i = 0; i < mk.length; ++i) {
1743
- var mark = mk[i], del = false;
1744
- if (mark.from >= end) del = true;
1745
- else {mark.from = fix(mark.from); if (mark.to != null) mark.to = fix(mark.to);}
1746
- if (del || mark.from >= mark.to) {mk.splice(i, 1); i--;}
1747
- }
1748
- }
1749
- },
1750
- // Split a line in two, again keeping styles intact.
1751
- split: function(pos, textBefore) {
1752
- var st = [textBefore, null];
1753
- copyStyles(pos, this.text.length, this.styles, st);
1754
- return new Line(textBefore + this.text.slice(pos), st);
1755
- },
1756
- addMark: function(from, to, style) {
1757
- var mk = this.marked, mark = {from: from, to: to, style: style};
1758
- if (this.marked == null) this.marked = [];
1759
- this.marked.push(mark);
1760
- this.marked.sort(function(a, b){return a.from - b.from;});
1761
- return mark;
1762
- },
1763
- removeMark: function(mark) {
1764
- var mk = this.marked;
1765
- if (!mk) return;
1766
- for (var i = 0; i < mk.length; ++i)
1767
- if (mk[i] == mark) {mk.splice(i, 1); break;}
1768
- },
1769
- // Run the given mode's parser over a line, update the styles
1770
- // array, which contains alternating fragments of text and CSS
1771
- // classes.
1772
- highlight: function(mode, state) {
1773
- var stream = new StringStream(this.text), st = this.styles, pos = 0;
1774
- var changed = false, curWord = st[0], prevWord;
1775
- if (this.text == "" && mode.blankLine) mode.blankLine(state);
1776
- while (!stream.eol()) {
1777
- var style = mode.token(stream, state);
1778
- var substr = this.text.slice(stream.start, stream.pos);
1779
- stream.start = stream.pos;
1780
- if (pos && st[pos-1] == style)
1781
- st[pos-2] += substr;
1782
- else if (substr) {
1783
- if (!changed && (st[pos+1] != style || (pos && st[pos-2] != prevWord))) changed = true;
1784
- st[pos++] = substr; st[pos++] = style;
1785
- prevWord = curWord; curWord = st[pos];
1786
- }
1787
- // Give up when line is ridiculously long
1788
- if (stream.pos > 5000) {
1789
- st[pos++] = this.text.slice(stream.pos); st[pos++] = null;
1790
- break;
1791
- }
1792
- }
1793
- if (st.length != pos) {st.length = pos; changed = true;}
1794
- if (pos && st[pos-2] != prevWord) changed = true;
1795
- // Short lines with simple highlights return null, and are
1796
- // counted as changed by the driver because they are likely to
1797
- // highlight the same way in various contexts.
1798
- return changed || (st.length < 5 && this.text.length < 10 ? null : false);
1799
- },
1800
- // Fetch the parser token for a given character. Useful for hacks
1801
- // that want to inspect the mode state (say, for completion).
1802
- getTokenAt: function(mode, state, ch) {
1803
- var txt = this.text, stream = new StringStream(txt);
1804
- while (stream.pos < ch && !stream.eol()) {
1805
- stream.start = stream.pos;
1806
- var style = mode.token(stream, state);
1807
- }
1808
- return {start: stream.start,
1809
- end: stream.pos,
1810
- string: stream.current(),
1811
- className: style || null,
1812
- state: state};
1813
- },
1814
- indentation: function() {return countColumn(this.text);},
1815
- // Produces an HTML fragment for the line, taking selection,
1816
- // marking, and highlighting into account.
1817
- getHTML: function(sfrom, sto, includePre, endAt) {
1818
- var html = [];
1819
- if (includePre)
1820
- html.push(this.className ? '<pre class="' + this.className + '">': "<pre>");
1821
- function span(text, style) {
1822
- if (!text) return;
1823
- if (style) html.push('<span class="', style, '">', htmlEscape(text), "</span>");
1824
- else html.push(htmlEscape(text));
1825
- }
1826
- var st = this.styles, allText = this.text, marked = this.marked;
1827
- if (sfrom == sto) sfrom = null;
1828
- var len = allText.length;
1829
- if (endAt != null) len = Math.min(endAt, len);
1830
-
1831
- if (!allText && endAt == null)
1832
- span(" ", sfrom != null && sto == null ? "CodeMirror-selected" : null);
1833
- else if (!marked && sfrom == null)
1834
- for (var i = 0, ch = 0; ch < len; i+=2) {
1835
- var str = st[i], l = str.length;
1836
- if (ch + l > len) str = str.slice(0, len - ch);
1837
- ch += l;
1838
- span(str, "cm-" + st[i+1]);
1839
- }
1840
- else {
1841
- var pos = 0, i = 0, text = "", style, sg = 0;
1842
- var markpos = -1, mark = null;
1843
- function nextMark() {
1844
- if (marked) {
1845
- markpos += 1;
1846
- mark = (markpos < marked.length) ? marked[markpos] : null;
1847
- }
1848
- }
1849
- nextMark();
1850
- while (pos < len) {
1851
- var upto = len;
1852
- var extraStyle = "";
1853
- if (sfrom != null) {
1854
- if (sfrom > pos) upto = sfrom;
1855
- else if (sto == null || sto > pos) {
1856
- extraStyle = " CodeMirror-selected";
1857
- if (sto != null) upto = Math.min(upto, sto);
1858
- }
1859
- }
1860
- while (mark && mark.to != null && mark.to <= pos) nextMark();
1861
- if (mark) {
1862
- if (mark.from > pos) upto = Math.min(upto, mark.from);
1863
- else {
1864
- extraStyle += " " + mark.style;
1865
- if (mark.to != null) upto = Math.min(upto, mark.to);
1866
- }
1867
- }
1868
- for (;;) {
1869
- var end = pos + text.length;
1870
- var appliedStyle = style;
1871
- if (extraStyle) appliedStyle = style ? style + extraStyle : extraStyle;
1872
- span(end > upto ? text.slice(0, upto - pos) : text, appliedStyle);
1873
- if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}
1874
- pos = end;
1875
- text = st[i++]; style = "cm-" + st[i++];
1876
- }
1877
- }
1878
- if (sfrom != null && sto == null) span(" ", "CodeMirror-selected");
1879
- }
1880
- if (includePre) html.push("</pre>");
1881
- return html.join("");
1882
- }
1883
- };
1884
- // Utility used by replace and split above
1885
- function copyStyles(from, to, source, dest) {
1886
- for (var i = 0, pos = 0, state = 0; pos < to; i+=2) {
1887
- var part = source[i], end = pos + part.length;
1888
- if (state == 0) {
1889
- if (end > from) dest.push(part.slice(from - pos, Math.min(part.length, to - pos)), source[i+1]);
1890
- if (end >= from) state = 1;
1891
- }
1892
- else if (state == 1) {
1893
- if (end > to) dest.push(part.slice(0, to - pos), source[i+1]);
1894
- else dest.push(part, source[i+1]);
1895
- }
1896
- pos = end;
1897
- }
1898
- }
1899
-
1900
- // The history object 'chunks' changes that are made close together
1901
- // and at almost the same time into bigger undoable units.
1902
- function History() {
1903
- this.time = 0;
1904
- this.done = []; this.undone = [];
1905
- }
1906
- History.prototype = {
1907
- addChange: function(start, added, old) {
1908
- this.undone.length = 0;
1909
- var time = +new Date, last = this.done[this.done.length - 1];
1910
- if (time - this.time > 400 || !last ||
1911
- last.start > start + added || last.start + last.added < start - last.added + last.old.length)
1912
- this.done.push({start: start, added: added, old: old});
1913
- else {
1914
- var oldoff = 0;
1915
- if (start < last.start) {
1916
- for (var i = last.start - start - 1; i >= 0; --i)
1917
- last.old.unshift(old[i]);
1918
- last.added += last.start - start;
1919
- last.start = start;
1920
- }
1921
- else if (last.start < start) {
1922
- oldoff = start - last.start;
1923
- added += oldoff;
1924
- }
1925
- for (var i = last.added - oldoff, e = old.length; i < e; ++i)
1926
- last.old.push(old[i]);
1927
- if (last.added < added) last.added = added;
1928
- }
1929
- this.time = time;
1930
- }
1931
- };
1932
-
1933
- function stopMethod() {e_stop(this);}
1934
- // Ensure an event has a stop method.
1935
- function addStop(event) {
1936
- if (!event.stop) event.stop = stopMethod;
1937
- return event;
1938
- }
1939
-
1940
- function e_preventDefault(e) {
1941
- if (e.preventDefault) e.preventDefault();
1942
- else e.returnValue = false;
1943
- }
1944
- function e_stopPropagation(e) {
1945
- if (e.stopPropagation) e.stopPropagation();
1946
- else e.cancelBubble = true;
1947
- }
1948
- function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
1949
- function e_target(e) {return e.target || e.srcElement;}
1950
- function e_button(e) {
1951
- if (e.which) return e.which;
1952
- else if (e.button & 1) return 1;
1953
- else if (e.button & 2) return 3;
1954
- else if (e.button & 4) return 2;
1955
- }
1956
-
1957
- // Event handler registration. If disconnect is true, it'll return a
1958
- // function that unregisters the handler.
1959
- function connect(node, type, handler, disconnect) {
1960
- function wrapHandler(event) {handler(event || window.event);}
1961
- if (typeof node.addEventListener == "function") {
1962
- node.addEventListener(type, wrapHandler, false);
1963
- if (disconnect) return function() {node.removeEventListener(type, wrapHandler, false);};
1964
- }
1965
- else {
1966
- node.attachEvent("on" + type, wrapHandler);
1967
- if (disconnect) return function() {node.detachEvent("on" + type, wrapHandler);};
1968
- }
1969
- }
1970
-
1971
- function Delayed() {this.id = null;}
1972
- Delayed.prototype = {set: function(ms, f) {clearTimeout(this.id); this.id = setTimeout(f, ms);}};
1973
-
1974
- // Some IE versions don't preserve whitespace when setting the
1975
- // innerHTML of a PRE tag.
1976
- var badInnerHTML = (function() {
1977
- var pre = document.createElement("pre");
1978
- pre.innerHTML = " "; return !pre.innerHTML;
1979
- })();
1980
-
1981
- var gecko = /gecko\/\d{7}/i.test(navigator.userAgent);
1982
- var ie = /MSIE \d/.test(navigator.userAgent);
1983
- var safari = /Apple Computer/.test(navigator.vendor);
1984
-
1985
- var lineSep = "\n";
1986
- // Feature-detect whether newlines in textareas are converted to \r\n
1987
- (function () {
1988
- var te = document.createElement("textarea");
1989
- te.value = "foo\nbar";
1990
- if (te.value.indexOf("\r") > -1) lineSep = "\r\n";
1991
- }());
1992
-
1993
- var tabSize = 8;
1994
- var mac = /Mac/.test(navigator.platform);
1995
- var movementKeys = {};
1996
- for (var i = 35; i <= 40; ++i)
1997
- movementKeys[i] = movementKeys["c" + i] = true;
1998
-
1999
- // Counts the column offset in a string, taking tabs into account.
2000
- // Used mostly to find indentation.
2001
- function countColumn(string, end) {
2002
- if (end == null) {
2003
- end = string.search(/[^\s\u00a0]/);
2004
- if (end == -1) end = string.length;
2005
- }
2006
- for (var i = 0, n = 0; i < end; ++i) {
2007
- if (string.charAt(i) == "\t") n += tabSize - (n % tabSize);
2008
- else ++n;
2009
- }
2010
- return n;
2011
- }
2012
-
2013
- function computedStyle(elt) {
2014
- if (elt.currentStyle) return elt.currentStyle;
2015
- return window.getComputedStyle(elt, null);
2016
- }
2017
- // Find the position of an element by following the offsetParent chain.
2018
- // If screen==true, it returns screen (rather than page) coordinates.
2019
- function eltOffset(node, screen) {
2020
- var doc = node.ownerDocument.body;
2021
- var x = 0, y = 0, skipDoc = false;
2022
- for (var n = node; n; n = n.offsetParent) {
2023
- x += n.offsetLeft; y += n.offsetTop;
2024
- if (screen && computedStyle(n).position == "fixed")
2025
- skipDoc = true;
2026
- }
2027
- var e = screen && !skipDoc ? null : doc;
2028
- for (var n = node.parentNode; n != e; n = n.parentNode)
2029
- if (n.scrollLeft != null) { x -= n.scrollLeft; y -= n.scrollTop;}
2030
- return {left: x, top: y};
2031
- }
2032
- // Get a node's text content.
2033
- function eltText(node) {
2034
- return node.textContent || node.innerText || node.nodeValue || "";
2035
- }
2036
-
2037
- // Operations on {line, ch} objects.
2038
- function posEq(a, b) {return a.line == b.line && a.ch == b.ch;}
2039
- function posLess(a, b) {return a.line < b.line || (a.line == b.line && a.ch < b.ch);}
2040
- function copyPos(x) {return {line: x.line, ch: x.ch};}
2041
-
2042
- var escapeElement = document.createElement("div");
2043
- function htmlEscape(str) {
2044
- escapeElement.innerText = escapeElement.textContent = str;
2045
- return escapeElement.innerHTML;
2046
- }
2047
- CodeMirror.htmlEscape = htmlEscape;
2048
-
2049
- // Used to position the cursor after an undo/redo by finding the
2050
- // last edited character.
2051
- function editEnd(from, to) {
2052
- if (!to) return from ? from.length : 0;
2053
- if (!from) return to.length;
2054
- for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j)
2055
- if (from.charAt(i) != to.charAt(j)) break;
2056
- return j + 1;
2057
- }
2058
-
2059
- function indexOf(collection, elt) {
2060
- if (collection.indexOf) return collection.indexOf(elt);
2061
- for (var i = 0, e = collection.length; i < e; ++i)
2062
- if (collection[i] == elt) return i;
2063
- return -1;
2064
- }
2065
-
2066
- // See if "".split is the broken IE version, if so, provide an
2067
- // alternative way to split lines.
2068
- var splitLines, selRange, setSelRange;
2069
- if ("\n\nb".split(/\n/).length != 3)
2070
- splitLines = function(string) {
2071
- var pos = 0, nl, result = [];
2072
- while ((nl = string.indexOf("\n", pos)) > -1) {
2073
- result.push(string.slice(pos, string.charAt(nl-1) == "\r" ? nl - 1 : nl));
2074
- pos = nl + 1;
2075
- }
2076
- result.push(string.slice(pos));
2077
- return result;
2078
- };
2079
- else
2080
- splitLines = function(string){return string.split(/\r?\n/);};
2081
- CodeMirror.splitLines = splitLines;
2082
-
2083
- // Sane model of finding and setting the selection in a textarea
2084
- if (window.getSelection) {
2085
- selRange = function(te) {
2086
- try {return {start: te.selectionStart, end: te.selectionEnd};}
2087
- catch(e) {return null;}
2088
- };
2089
- if (safari)
2090
- // On Safari, selection set with setSelectionRange are in a sort
2091
- // of limbo wrt their anchor. If you press shift-left in them,
2092
- // the anchor is put at the end, and the selection expanded to
2093
- // the left. If you press shift-right, the anchor ends up at the
2094
- // front. This is not what CodeMirror wants, so it does a
2095
- // spurious modify() call to get out of limbo.
2096
- setSelRange = function(te, start, end) {
2097
- if (start == end)
2098
- te.setSelectionRange(start, end);
2099
- else {
2100
- te.setSelectionRange(start, end - 1);
2101
- window.getSelection().modify("extend", "forward", "character");
2102
- }
2103
- };
2104
- else
2105
- setSelRange = function(te, start, end) {
2106
- try {te.setSelectionRange(start, end);}
2107
- catch(e) {} // Fails on Firefox when textarea isn't part of the document
2108
- };
2109
- }
2110
- // IE model. Don't ask.
2111
- else {
2112
- selRange = function(te) {
2113
- try {var range = te.ownerDocument.selection.createRange();}
2114
- catch(e) {return null;}
2115
- if (!range || range.parentElement() != te) return null;
2116
- var val = te.value, len = val.length, localRange = te.createTextRange();
2117
- localRange.moveToBookmark(range.getBookmark());
2118
- var endRange = te.createTextRange();
2119
- endRange.collapse(false);
2120
-
2121
- if (localRange.compareEndPoints("StartToEnd", endRange) > -1)
2122
- return {start: len, end: len};
2123
-
2124
- var start = -localRange.moveStart("character", -len);
2125
- for (var i = val.indexOf("\r"); i > -1 && i < start; i = val.indexOf("\r", i+1), start++) {}
2126
-
2127
- if (localRange.compareEndPoints("EndToEnd", endRange) > -1)
2128
- return {start: start, end: len};
2129
-
2130
- var end = -localRange.moveEnd("character", -len);
2131
- for (var i = val.indexOf("\r"); i > -1 && i < end; i = val.indexOf("\r", i+1), end++) {}
2132
- return {start: start, end: end};
2133
- };
2134
- setSelRange = function(te, start, end) {
2135
- var range = te.createTextRange();
2136
- range.collapse(true);
2137
- var endrange = range.duplicate();
2138
- var newlines = 0, txt = te.value;
2139
- for (var pos = txt.indexOf("\n"); pos > -1 && pos < start; pos = txt.indexOf("\n", pos + 1))
2140
- ++newlines;
2141
- range.move("character", start - newlines);
2142
- for (; pos > -1 && pos < end; pos = txt.indexOf("\n", pos + 1))
2143
- ++newlines;
2144
- endrange.move("character", end - newlines);
2145
- range.setEndPoint("EndToEnd", endrange);
2146
- range.select();
2147
- };
2148
- }
2149
-
2150
- CodeMirror.defineMode("null", function() {
2151
- return {token: function(stream) {stream.skipToEnd();}};
2152
- });
2153
- CodeMirror.defineMIME("text/plain", "null");
2154
-
2155
- return CodeMirror;
2156
- })()
2157
- ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/lib/overlay.js DELETED
@@ -1,51 +0,0 @@
1
- // Utility function that allows modes to be combined. The mode given
2
- // as the base argument takes care of most of the normal mode
3
- // functionality, but a second (typically simple) mode is used, which
4
- // can override the style of text. Both modes get to parse all of the
5
- // text, but when both assign a non-null style to a piece of code, the
6
- // overlay wins, unless the combine argument was true, in which case
7
- // the styles are combined.
8
-
9
- CodeMirror.overlayParser = function(base, overlay, combine) {
10
- return {
11
- startState: function() {
12
- return {
13
- base: CodeMirror.startState(base),
14
- overlay: CodeMirror.startState(overlay),
15
- basePos: 0, baseCur: null,
16
- overlayPos: 0, overlayCur: null
17
- };
18
- },
19
- copyState: function(state) {
20
- return {
21
- base: CodeMirror.copyState(base, state.base),
22
- overlay: CodeMirror.copyState(overlay, state.overlay),
23
- basePos: state.basePos, baseCur: null,
24
- overlayPos: state.overlayPos, overlayCur: null
25
- };
26
- },
27
-
28
- token: function(stream, state) {
29
- if (stream.start == state.basePos) {
30
- state.baseCur = base.token(stream, state.base);
31
- state.basePos = stream.pos;
32
- }
33
- if (stream.start == state.overlayPos) {
34
- stream.pos = stream.start;
35
- state.overlayCur = overlay.token(stream, state.overlay);
36
- state.overlayPos = stream.pos;
37
- }
38
- stream.pos = Math.min(state.basePos, state.overlayPos);
39
- if (stream.eol()) state.basePos = state.overlayPos = 0;
40
-
41
- if (state.overlayCur == null) return state.baseCur;
42
- if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur;
43
- else return state.overlayCur;
44
- },
45
-
46
- indent: function(state, textAfter) {
47
- return base.indent(state.base, textAfter);
48
- },
49
- electricChars: base.electricChars
50
- };
51
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/lib/runmode.js DELETED
@@ -1,27 +0,0 @@
1
- CodeMirror.runMode = function(string, modespec, callback) {
2
- var mode = CodeMirror.getMode({indentUnit: 2}, modespec);
3
- var isNode = callback.nodeType == 1;
4
- if (isNode) {
5
- var node = callback, accum = [];
6
- callback = function(string, style) {
7
- if (string == "\n")
8
- accum.push("<br>");
9
- else if (style)
10
- accum.push("<span class=\"cm-" + CodeMirror.htmlEscape(style) + "\">" + CodeMirror.htmlEscape(string) + "</span>");
11
- else
12
- accum.push(CodeMirror.htmlEscape(string));
13
- }
14
- }
15
- var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode);
16
- for (var i = 0, e = lines.length; i < e; ++i) {
17
- if (i) callback("\n");
18
- var stream = new CodeMirror.StringStream(lines[i]);
19
- while (!stream.eol()) {
20
- var style = mode.token(stream, state);
21
- callback(stream.current(), style);
22
- stream.start = stream.pos;
23
- }
24
- }
25
- if (isNode)
26
- node.innerHTML = accum.join("");
27
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/mode/css/css.js DELETED
@@ -1,124 +0,0 @@
1
- CodeMirror.defineMode("css", function(config) {
2
- var indentUnit = config.indentUnit, type;
3
- function ret(style, tp) {type = tp; return style;}
4
-
5
- function tokenBase(stream, state) {
6
- var ch = stream.next();
7
- if (ch == "@") {stream.eatWhile(/\w/); return ret("meta", stream.current());}
8
- else if (ch == "/" && stream.eat("*")) {
9
- state.tokenize = tokenCComment;
10
- return tokenCComment(stream, state);
11
- }
12
- else if (ch == "<" && stream.eat("!")) {
13
- state.tokenize = tokenSGMLComment;
14
- return tokenSGMLComment(stream, state);
15
- }
16
- else if (ch == "=") ret(null, "compare");
17
- else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare");
18
- else if (ch == "\"" || ch == "'") {
19
- state.tokenize = tokenString(ch);
20
- return state.tokenize(stream, state);
21
- }
22
- else if (ch == "#") {
23
- stream.eatWhile(/\w/);
24
- return ret("atom", "hash");
25
- }
26
- else if (ch == "!") {
27
- stream.match(/^\s*\w*/);
28
- return ret("keyword", "important");
29
- }
30
- else if (/\d/.test(ch)) {
31
- stream.eatWhile(/[\w.%]/);
32
- return ret("number", "unit");
33
- }
34
- else if (/[,.+>*\/]/.test(ch)) {
35
- return ret(null, "select-op");
36
- }
37
- else if (/[;{}:\[\]]/.test(ch)) {
38
- return ret(null, ch);
39
- }
40
- else {
41
- stream.eatWhile(/[\w\\\-_]/);
42
- return ret("variable", "variable");
43
- }
44
- }
45
-
46
- function tokenCComment(stream, state) {
47
- var maybeEnd = false, ch;
48
- while ((ch = stream.next()) != null) {
49
- if (maybeEnd && ch == "/") {
50
- state.tokenize = tokenBase;
51
- break;
52
- }
53
- maybeEnd = (ch == "*");
54
- }
55
- return ret("comment", "comment");
56
- }
57
-
58
- function tokenSGMLComment(stream, state) {
59
- var dashes = 0, ch;
60
- while ((ch = stream.next()) != null) {
61
- if (dashes >= 2 && ch == ">") {
62
- state.tokenize = tokenBase;
63
- break;
64
- }
65
- dashes = (ch == "-") ? dashes + 1 : 0;
66
- }
67
- return ret("comment", "comment");
68
- }
69
-
70
- function tokenString(quote) {
71
- return function(stream, state) {
72
- var escaped = false, ch;
73
- while ((ch = stream.next()) != null) {
74
- if (ch == quote && !escaped)
75
- break;
76
- escaped = !escaped && ch == "\\";
77
- }
78
- if (!escaped) state.tokenize = tokenBase;
79
- return ret("string", "string");
80
- };
81
- }
82
-
83
- return {
84
- startState: function(base) {
85
- return {tokenize: tokenBase,
86
- baseIndent: base || 0,
87
- stack: []};
88
- },
89
-
90
- token: function(stream, state) {
91
- if (stream.eatSpace()) return null;
92
- var style = state.tokenize(stream, state);
93
-
94
- var context = state.stack[state.stack.length-1];
95
- if (type == "hash" && context == "rule") style = "atom";
96
- else if (style == "variable") {
97
- if (context == "rule") style = "number";
98
- else if (!context || context == "@media{") style = "tag";
99
- }
100
-
101
- if (context == "rule" && /^[\{\};]$/.test(type))
102
- state.stack.pop();
103
- if (type == "{") {
104
- if (context == "@media") state.stack[state.stack.length-1] = "@media{";
105
- else state.stack.push("{");
106
- }
107
- else if (type == "}") state.stack.pop();
108
- else if (type == "@media") state.stack.push("@media");
109
- else if (context == "{" && type != "comment") state.stack.push("rule");
110
- return style;
111
- },
112
-
113
- indent: function(state, textAfter) {
114
- var n = state.stack.length;
115
- if (/^\}/.test(textAfter))
116
- n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1;
117
- return state.baseIndent + n * indentUnit;
118
- },
119
-
120
- electricChars: "}"
121
- };
122
- });
123
-
124
- CodeMirror.defineMIME("text/css", "css");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/mode/css/index.html DELETED
@@ -1,56 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>CodeMirror 2: CSS mode</title>
5
- <link rel="stylesheet" href="../../lib/codemirror.css">
6
- <script src="../../lib/codemirror.js"></script>
7
- <script src="css.js"></script>
8
- <link rel="stylesheet" href="../../theme/default.css">
9
- <style>.CodeMirror {background: #f8f8f8;}</style>
10
- <link rel="stylesheet" href="../../css/docs.css">
11
- </head>
12
- <body>
13
- <h1>CodeMirror 2: CSS mode</h1>
14
- <form><textarea id="code" name="code">
15
- /* Some example CSS */
16
-
17
- @import url("something.css");
18
-
19
- body {
20
- margin: 0;
21
- padding: 3em 6em;
22
- font-family: tahoma, arial, sans-serif;
23
- color: #000;
24
- }
25
-
26
- #navigation a {
27
- font-weight: bold;
28
- text-decoration: none !important;
29
- }
30
-
31
- h1 {
32
- font-size: 2.5em;
33
- }
34
-
35
- h2 {
36
- font-size: 1.7em;
37
- }
38
-
39
- h1:before, h2:before {
40
- content: "::";
41
- }
42
-
43
- code {
44
- font-family: courier, monospace;
45
- font-size: 80%;
46
- color: #418A8A;
47
- }
48
- </textarea></form>
49
- <script>
50
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
51
- </script>
52
-
53
- <p><strong>MIME types defined:</strong> <code>text/css</code>.</p>
54
-
55
- </body>
56
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/mode/htmlmixed/htmlmixed.js DELETED
@@ -1,79 +0,0 @@
1
- CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
2
- var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true});
3
- var jsMode = CodeMirror.getMode(config, "javascript");
4
- var cssMode = CodeMirror.getMode(config, "css");
5
-
6
- function html(stream, state) {
7
- var style = htmlMode.token(stream, state.htmlState);
8
- if (style == "tag" && stream.current() == ">" && state.htmlState.context) {
9
- if (/^script$/i.test(state.htmlState.context.tagName)) {
10
- state.token = javascript;
11
- state.localState = jsMode.startState(htmlMode.indent(state.htmlState, ""));
12
- state.mode = "javascript";
13
- }
14
- else if (/^style$/i.test(state.htmlState.context.tagName)) {
15
- state.token = css;
16
- state.localState = cssMode.startState(htmlMode.indent(state.htmlState, ""));
17
- state.mode = "css";
18
- }
19
- }
20
- return style;
21
- }
22
- function maybeBackup(stream, pat, style) {
23
- var cur = stream.current();
24
- var close = cur.search(pat);
25
- if (close > -1) stream.backUp(cur.length - close);
26
- return style;
27
- }
28
- function javascript(stream, state) {
29
- if (stream.match(/^<\/\s*script\s*>/i, false)) {
30
- state.token = html;
31
- state.curState = null;
32
- state.mode = "html";
33
- return html(stream, state);
34
- }
35
- return maybeBackup(stream, /<\/\s*script\s*>/,
36
- jsMode.token(stream, state.localState));
37
- }
38
- function css(stream, state) {
39
- if (stream.match(/^<\/\s*style\s*>/i, false)) {
40
- state.token = html;
41
- state.localState = null;
42
- state.mode = "html";
43
- return html(stream, state);
44
- }
45
- return maybeBackup(stream, /<\/\s*style\s*>/,
46
- cssMode.token(stream, state.localState));
47
- }
48
-
49
- return {
50
- startState: function() {
51
- var state = htmlMode.startState();
52
- return {token: html, localState: null, mode: "html", htmlState: state};
53
- },
54
-
55
- copyState: function(state) {
56
- if (state.localState)
57
- var local = CodeMirror.copyState(state.token == css ? cssMode : jsMode, state.localState);
58
- return {token: state.token, localState: local, mode: state.mode,
59
- htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
60
- },
61
-
62
- token: function(stream, state) {
63
- return state.token(stream, state);
64
- },
65
-
66
- indent: function(state, textAfter) {
67
- if (state.token == html || /^\s*<\//.test(textAfter))
68
- return htmlMode.indent(state.htmlState, textAfter);
69
- else if (state.token == javascript)
70
- return jsMode.indent(state.localState, textAfter);
71
- else
72
- return cssMode.indent(state.localState, textAfter);
73
- },
74
-
75
- electricChars: "/{}:"
76
- }
77
- });
78
-
79
- CodeMirror.defineMIME("text/html", "htmlmixed");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/mode/htmlmixed/index.html DELETED
@@ -1,52 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>CodeMirror 2: HTML mixed mode</title>
5
- <link rel="stylesheet" href="../../lib/codemirror.css">
6
- <script src="../../lib/codemirror.js"></script>
7
- <script src="../xml/xml.js"></script>
8
- <script src="../javascript/javascript.js"></script>
9
- <script src="../css/css.js"></script>
10
- <link rel="stylesheet" href="../../theme/default.css">
11
- <script src="htmlmixed.js"></script>
12
- <link rel="stylesheet" href="../../css/docs.css">
13
- <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
14
- </head>
15
- <body>
16
- <h1>CodeMirror 2: HTML mixed mode</h1>
17
- <form><textarea id="code" name="code">
18
- <html style="color: green">
19
- <!-- this is a comment -->
20
- <head>
21
- <title>Mixed HTML Example</title>
22
- <style type="text/css">
23
- h1 {font-family: comic sans; color: #f0f;}
24
- div {background: yellow !important;}
25
- body {
26
- max-width: 50em;
27
- margin: 1em 2em 1em 5em;
28
- }
29
- </style>
30
- </head>
31
- <body>
32
- <h1>Mixed HTML Example</h1>
33
- <script>
34
- function jsFunc(arg1, arg2) {
35
- if (arg1 && arg2) document.body.innerHTML = "achoo";
36
- }
37
- </script>
38
- </body>
39
- </html>
40
- </textarea></form>
41
- <script>
42
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "text/html", tabMode: "indent"});
43
- </script>
44
-
45
- <p>The HTML mixed mode depends on the XML, JavaScript, and CSS modes.</p>
46
-
47
- <p><strong>MIME types defined:</strong> <code>text/html</code>
48
- (redefined, only takes effect if you load this parser after the
49
- XML parser).</p>
50
-
51
- </body>
52
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/mode/javascript/index.html DELETED
@@ -1,78 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>CodeMirror 2: JavaScript mode</title>
5
- <link rel="stylesheet" href="../../lib/codemirror.css">
6
- <script src="../../lib/codemirror.js"></script>
7
- <script src="javascript.js"></script>
8
- <link rel="stylesheet" href="../../theme/default.css">
9
- <link rel="stylesheet" href="../../css/docs.css">
10
- <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
11
- </head>
12
- <body>
13
- <h1>CodeMirror 2: JavaScript mode</h1>
14
-
15
- <div><textarea id="code" name="code">
16
- // Demo code (the actual new parser character stream implementation)
17
-
18
- function StringStream(string) {
19
- this.pos = 0;
20
- this.string = string;
21
- }
22
-
23
- StringStream.prototype = {
24
- done: function() {return this.pos >= this.string.length;},
25
- peek: function() {return this.string.charAt(this.pos);},
26
- next: function() {
27
- if (this.pos &lt; this.string.length)
28
- return this.string.charAt(this.pos++);
29
- },
30
- eat: function(match) {
31
- var ch = this.string.charAt(this.pos);
32
- if (typeof match == "string") var ok = ch == match;
33
- else var ok = ch &amp;&amp; match.test ? match.test(ch) : match(ch);
34
- if (ok) {this.pos++; return ch;}
35
- },
36
- eatWhile: function(match) {
37
- var start = this.pos;
38
- while (this.eat(match));
39
- if (this.pos > start) return this.string.slice(start, this.pos);
40
- },
41
- backUp: function(n) {this.pos -= n;},
42
- column: function() {return this.pos;},
43
- eatSpace: function() {
44
- var start = this.pos;
45
- while (/\s/.test(this.string.charAt(this.pos))) this.pos++;
46
- return this.pos - start;
47
- },
48
- match: function(pattern, consume, caseInsensitive) {
49
- if (typeof pattern == "string") {
50
- function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
51
- if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
52
- if (consume !== false) this.pos += str.length;
53
- return true;
54
- }
55
- }
56
- else {
57
- var match = this.string.slice(this.pos).match(pattern);
58
- if (match &amp;&amp; consume !== false) this.pos += match[0].length;
59
- return match;
60
- }
61
- }
62
- };
63
- </textarea></div>
64
-
65
- <script>
66
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
67
- lineNumbers: true,
68
- matchBrackets: true
69
- });
70
- </script>
71
-
72
- <p>JavaScript mode supports a single configuration
73
- option, <code>json</code>, which will set the mode to expect JSON
74
- data rather than a JavaScript program.</p>
75
-
76
- <p><strong>MIME types defined:</strong> <code>text/javascript</code>, <code>application/json</code>.</p>
77
- </body>
78
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/mode/javascript/javascript.js DELETED
@@ -1,348 +0,0 @@
1
- CodeMirror.defineMode("javascript", function(config, parserConfig) {
2
- var indentUnit = config.indentUnit;
3
- var jsonMode = parserConfig.json;
4
-
5
- // Tokenizer
6
-
7
- var keywords = function(){
8
- function kw(type) {return {type: type, style: "keyword"};}
9
- var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
10
- var operator = kw("operator"), atom = {type: "atom", style: "atom"};
11
- return {
12
- "if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
13
- "return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C,
14
- "var": kw("var"), "function": kw("function"), "catch": kw("catch"),
15
- "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
16
- "in": operator, "typeof": operator, "instanceof": operator,
17
- "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom
18
- };
19
- }();
20
-
21
- var isOperatorChar = /[+\-*&%=<>!?|]/;
22
-
23
- function chain(stream, state, f) {
24
- state.tokenize = f;
25
- return f(stream, state);
26
- }
27
-
28
- function nextUntilUnescaped(stream, end) {
29
- var escaped = false, next;
30
- while ((next = stream.next()) != null) {
31
- if (next == end && !escaped)
32
- return false;
33
- escaped = !escaped && next == "\\";
34
- }
35
- return escaped;
36
- }
37
-
38
- // Used as scratch variables to communicate multiple values without
39
- // consing up tons of objects.
40
- var type, content;
41
- function ret(tp, style, cont) {
42
- type = tp; content = cont;
43
- return style;
44
- }
45
-
46
- function jsTokenBase(stream, state) {
47
- var ch = stream.next();
48
- if (ch == '"' || ch == "'")
49
- return chain(stream, state, jsTokenString(ch));
50
- else if (/[\[\]{}\(\),;\:\.]/.test(ch))
51
- return ret(ch);
52
- else if (ch == "0" && stream.eat(/x/i)) {
53
- stream.eatWhile(/[\da-f]/i);
54
- return ret("number", "number");
55
- }
56
- else if (/\d/.test(ch)) {
57
- stream.match(/^\d*(?:\.\d*)?(?:e[+\-]?\d+)?/);
58
- return ret("number", "number");
59
- }
60
- else if (ch == "/") {
61
- if (stream.eat("*")) {
62
- return chain(stream, state, jsTokenComment);
63
- }
64
- else if (stream.eat("/")) {
65
- stream.skipToEnd();
66
- return ret("comment", "comment");
67
- }
68
- else if (state.reAllowed) {
69
- nextUntilUnescaped(stream, "/");
70
- stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
71
- return ret("regexp", "string");
72
- }
73
- else {
74
- stream.eatWhile(isOperatorChar);
75
- return ret("operator", null, stream.current());
76
- }
77
- }
78
- else if (isOperatorChar.test(ch)) {
79
- stream.eatWhile(isOperatorChar);
80
- return ret("operator", null, stream.current());
81
- }
82
- else {
83
- stream.eatWhile(/[\w\$_]/);
84
- var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
85
- return known ? ret(known.type, known.style, word) :
86
- ret("variable", "variable", word);
87
- }
88
- }
89
-
90
- function jsTokenString(quote) {
91
- return function(stream, state) {
92
- if (!nextUntilUnescaped(stream, quote))
93
- state.tokenize = jsTokenBase;
94
- return ret("string", "string");
95
- };
96
- }
97
-
98
- function jsTokenComment(stream, state) {
99
- var maybeEnd = false, ch;
100
- while (ch = stream.next()) {
101
- if (ch == "/" && maybeEnd) {
102
- state.tokenize = jsTokenBase;
103
- break;
104
- }
105
- maybeEnd = (ch == "*");
106
- }
107
- return ret("comment", "comment");
108
- }
109
-
110
- // Parser
111
-
112
- var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true};
113
-
114
- function JSLexical(indented, column, type, align, prev, info) {
115
- this.indented = indented;
116
- this.column = column;
117
- this.type = type;
118
- this.prev = prev;
119
- this.info = info;
120
- if (align != null) this.align = align;
121
- }
122
-
123
- function inScope(state, varname) {
124
- for (var v = state.localVars; v; v = v.next)
125
- if (v.name == varname) return true;
126
- }
127
-
128
- function parseJS(state, style, type, content, stream) {
129
- var cc = state.cc;
130
- // Communicate our context to the combinators.
131
- // (Less wasteful than consing up a hundred closures on every call.)
132
- cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
133
-
134
- if (!state.lexical.hasOwnProperty("align"))
135
- state.lexical.align = true;
136
-
137
- while(true) {
138
- var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
139
- if (combinator(type, content)) {
140
- while(cc.length && cc[cc.length - 1].lex)
141
- cc.pop()();
142
- if (cx.marked) return cx.marked;
143
- if (type == "variable" && inScope(state, content)) return "variable-2";
144
- return style;
145
- }
146
- }
147
- }
148
-
149
- // Combinator utils
150
-
151
- var cx = {state: null, column: null, marked: null, cc: null};
152
- function pass() {
153
- for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
154
- }
155
- function cont() {
156
- pass.apply(null, arguments);
157
- return true;
158
- }
159
- function register(varname) {
160
- var state = cx.state;
161
- if (state.context) {
162
- cx.marked = "def";
163
- for (var v = state.localVars; v; v = v.next)
164
- if (v.name == varname) return;
165
- state.localVars = {name: varname, next: state.localVars};
166
- }
167
- }
168
-
169
- // Combinators
170
-
171
- var defaultVars = {name: "this", next: {name: "arguments"}};
172
- function pushcontext() {
173
- if (!cx.state.context) cx.state.localVars = defaultVars;
174
- cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
175
- }
176
- function popcontext() {
177
- cx.state.localVars = cx.state.context.vars;
178
- cx.state.context = cx.state.context.prev;
179
- }
180
- function pushlex(type, info) {
181
- var result = function() {
182
- var state = cx.state;
183
- state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info)
184
- };
185
- result.lex = true;
186
- return result;
187
- }
188
- function poplex() {
189
- var state = cx.state;
190
- if (state.lexical.prev) {
191
- if (state.lexical.type == ")")
192
- state.indented = state.lexical.indented;
193
- state.lexical = state.lexical.prev;
194
- }
195
- }
196
- poplex.lex = true;
197
-
198
- function expect(wanted) {
199
- return function expecting(type) {
200
- if (type == wanted) return cont();
201
- else if (wanted == ";") return pass();
202
- else return cont(arguments.callee);
203
- };
204
- }
205
-
206
- function statement(type) {
207
- if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
208
- if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
209
- if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
210
- if (type == "{") return cont(pushlex("}"), block, poplex);
211
- if (type == ";") return cont();
212
- if (type == "function") return cont(functiondef);
213
- if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
214
- poplex, statement, poplex);
215
- if (type == "variable") return cont(pushlex("stat"), maybelabel);
216
- if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
217
- block, poplex, poplex);
218
- if (type == "case") return cont(expression, expect(":"));
219
- if (type == "default") return cont(expect(":"));
220
- if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
221
- statement, poplex, popcontext);
222
- return pass(pushlex("stat"), expression, expect(";"), poplex);
223
- }
224
- function expression(type) {
225
- if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator);
226
- if (type == "function") return cont(functiondef);
227
- if (type == "keyword c") return cont(expression);
228
- if (type == "(") return cont(pushlex(")"), expression, expect(")"), poplex, maybeoperator);
229
- if (type == "operator") return cont(expression);
230
- if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator);
231
- if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
232
- return cont();
233
- }
234
- function maybeoperator(type, value) {
235
- if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator);
236
- if (type == "operator") return cont(expression);
237
- if (type == ";") return;
238
- if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator);
239
- if (type == ".") return cont(property, maybeoperator);
240
- if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
241
- }
242
- function maybelabel(type) {
243
- if (type == ":") return cont(poplex, statement);
244
- return pass(maybeoperator, expect(";"), poplex);
245
- }
246
- function property(type) {
247
- if (type == "variable") {cx.marked = "property"; return cont();}
248
- }
249
- function objprop(type) {
250
- if (type == "variable") cx.marked = "property";
251
- if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression);
252
- }
253
- function commasep(what, end) {
254
- function proceed(type) {
255
- if (type == ",") return cont(what, proceed);
256
- if (type == end) return cont();
257
- return cont(expect(end));
258
- }
259
- return function commaSeparated(type) {
260
- if (type == end) return cont();
261
- else return pass(what, proceed);
262
- };
263
- }
264
- function block(type) {
265
- if (type == "}") return cont();
266
- return pass(statement, block);
267
- }
268
- function vardef1(type, value) {
269
- if (type == "variable"){register(value); return cont(vardef2);}
270
- return cont();
271
- }
272
- function vardef2(type, value) {
273
- if (value == "=") return cont(expression, vardef2);
274
- if (type == ",") return cont(vardef1);
275
- }
276
- function forspec1(type) {
277
- if (type == "var") return cont(vardef1, forspec2);
278
- if (type == ";") return pass(forspec2);
279
- if (type == "variable") return cont(formaybein);
280
- return pass(forspec2);
281
- }
282
- function formaybein(type, value) {
283
- if (value == "in") return cont(expression);
284
- return cont(maybeoperator, forspec2);
285
- }
286
- function forspec2(type, value) {
287
- if (type == ";") return cont(forspec3);
288
- if (value == "in") return cont(expression);
289
- return cont(expression, expect(";"), forspec3);
290
- }
291
- function forspec3(type) {
292
- if (type != ")") cont(expression);
293
- }
294
- function functiondef(type, value) {
295
- if (type == "variable") {register(value); return cont(functiondef);}
296
- if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext);
297
- }
298
- function funarg(type, value) {
299
- if (type == "variable") {register(value); return cont();}
300
- }
301
-
302
- // Interface
303
-
304
- return {
305
- startState: function(basecolumn) {
306
- return {
307
- tokenize: jsTokenBase,
308
- reAllowed: true,
309
- cc: [],
310
- lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
311
- localVars: null,
312
- context: null,
313
- indented: 0
314
- };
315
- },
316
-
317
- token: function(stream, state) {
318
- if (stream.sol()) {
319
- if (!state.lexical.hasOwnProperty("align"))
320
- state.lexical.align = false;
321
- state.indented = stream.indentation();
322
- }
323
- if (stream.eatSpace()) return null;
324
- var style = state.tokenize(stream, state);
325
- if (type == "comment") return style;
326
- state.reAllowed = type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/);
327
- return parseJS(state, style, type, content, stream);
328
- },
329
-
330
- indent: function(state, textAfter) {
331
- if (state.tokenize != jsTokenBase) return 0;
332
- var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical,
333
- type = lexical.type, closing = firstChar == type;
334
- if (type == "vardef") return lexical.indented + 4;
335
- else if (type == "form" && firstChar == "{") return lexical.indented;
336
- else if (type == "stat" || type == "form") return lexical.indented + indentUnit;
337
- else if (lexical.info == "switch" && !closing)
338
- return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
339
- else if (lexical.align) return lexical.column + (closing ? 0 : 1);
340
- else return lexical.indented + (closing ? 0 : indentUnit);
341
- },
342
-
343
- electricChars: ":{}"
344
- };
345
- });
346
-
347
- CodeMirror.defineMIME("text/javascript", "javascript");
348
- CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/mode/php/index.html DELETED
@@ -1,49 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>CodeMirror 2: PHP mode</title>
5
- <link rel="stylesheet" href="../../lib/codemirror.css">
6
- <script src="../../lib/codemirror.js"></script>
7
- <script src="../xml/xml.js"></script>
8
- <script src="../javascript/javascript.js"></script>
9
- <script src="../css/css.js"></script>
10
- <script src="../clike/clike.js"></script>
11
- <script src="php.js"></script>
12
- <link rel="stylesheet" href="../../theme/default.css">
13
- <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
14
- <link rel="stylesheet" href="../../css/docs.css">
15
- </head>
16
- <body>
17
- <h1>CodeMirror 2: PHP mode</h1>
18
-
19
- <form><textarea id="code" name="code">
20
- <?php
21
- function hello($who) {
22
- return "Hello " . $who;
23
- }
24
- ?>
25
- <p>The program says <?= hello("World") ?>.</p>
26
- <script>
27
- alert("And here is some JS code"); // also colored
28
- </script>
29
- </textarea></form>
30
-
31
- <script>
32
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
33
- lineNumbers: true,
34
- matchBrackets: true,
35
- mode: "application/x-httpd-php",
36
- indentUnit: 8,
37
- indentWithTabs: true,
38
- enterMode: "keep",
39
- tabMode: "shift"
40
- });
41
- </script>
42
-
43
- <p>Simple HTML/PHP mode based on
44
- the <a href="../clike/">C-like</a> mode. Depends on XML,
45
- JavaScript, CSS, and C-like modes.</p>
46
-
47
- <p><strong>MIME types defined:</strong> <code>application/x-httpd-php</code> (HTML with PHP code), <code>text/x-php</code> (plain, non-wrapped PHP code).</p>
48
- </body>
49
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/mode/php/php.js DELETED
@@ -1,115 +0,0 @@
1
- (function() {
2
- function keywords(str) {
3
- var obj = {}, words = str.split(" ");
4
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
5
- return obj;
6
- }
7
- function heredoc(delim) {
8
- return function(stream, state) {
9
- if (stream.match(delim)) state.tokenize = null;
10
- else stream.skipToEnd();
11
- return "string";
12
- }
13
- }
14
- var phpConfig = {
15
- name: "clike",
16
- keywords: keywords("abstract and array as break case catch cfunction class clone const continue declare " +
17
- "default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends " +
18
- "final for foreach function global goto if implements interface instanceof namespace " +
19
- "new or private protected public static switch throw try use var while xor return"),
20
- blockKeywords: keywords("catch do else elseif for foreach if switch try while"),
21
- atoms: keywords("true false null"),
22
- multiLineStrings: true,
23
- hooks: {
24
- "$": function(stream, state) {
25
- stream.eatWhile(/[\w\$_]/);
26
- return "variable-2";
27
- },
28
- "<": function(stream, state) {
29
- if (stream.match(/<</)) {
30
- stream.eatWhile(/[\w\.]/);
31
- state.tokenize = heredoc(stream.current().slice(3));
32
- return state.tokenize(stream, state);
33
- }
34
- return false;
35
- }
36
- }
37
- };
38
-
39
- CodeMirror.defineMode("php", function(config, parserConfig) {
40
- var htmlMode = CodeMirror.getMode(config, "text/html");
41
- var jsMode = CodeMirror.getMode(config, "text/javascript");
42
- var cssMode = CodeMirror.getMode(config, "text/css");
43
- var phpMode = CodeMirror.getMode(config, phpConfig);
44
-
45
- function dispatch(stream, state) { // TODO open PHP inside text/css
46
- if (state.curMode == htmlMode) {
47
- var style = htmlMode.token(stream, state.curState);
48
- if (style == "meta" && /^<\?/.test(stream.current())) {
49
- state.curMode = phpMode;
50
- state.curState = state.php;
51
- state.curClose = /^\?>/;
52
- state.mode = 'php';
53
- }
54
- else if (style == "tag" && stream.current() == ">" && state.curState.context) {
55
- if (/^script$/i.test(state.curState.context.tagName)) {
56
- state.curMode = jsMode;
57
- state.curState = jsMode.startState(htmlMode.indent(state.curState, ""));
58
- state.curClose = /^<\/\s*script\s*>/i;
59
- state.mode = 'javascript';
60
- }
61
- else if (/^style$/i.test(state.curState.context.tagName)) {
62
- state.curMode = cssMode;
63
- state.curState = cssMode.startState(htmlMode.indent(state.curState, ""));
64
- state.curClose = /^<\/\s*style\s*>/i;
65
- state.mode = 'css';
66
- }
67
- }
68
- return style;
69
- }
70
- else if (stream.match(state.curClose, false)) {
71
- state.curMode = htmlMode;
72
- state.curState = state.html;
73
- state.curClose = null;
74
- state.mode = 'html';
75
- return dispatch(stream, state);
76
- }
77
- else return state.curMode.token(stream, state.curState);
78
- }
79
-
80
- return {
81
- startState: function() {
82
- var html = htmlMode.startState();
83
- return {html: html,
84
- php: phpMode.startState(),
85
- curMode: parserConfig.startOpen ? phpMode : htmlMode,
86
- curState: parserConfig.startOpen ? phpMode.startState() : html,
87
- curClose: parserConfig.startOpen ? /^\?>/ : null,
88
- mode: parserConfig.startOpen ? 'php' : 'html'}
89
- },
90
-
91
- copyState: function(state) {
92
- var html = state.html, htmlNew = CodeMirror.copyState(htmlMode, html),
93
- php = state.php, phpNew = CodeMirror.copyState(phpMode, php), cur;
94
- if (state.curState == html) cur = htmlNew;
95
- else if (state.curState == php) cur = phpNew;
96
- else cur = CodeMirror.copyState(state.curMode, state.curState);
97
- return {html: htmlNew, php: phpNew, curMode: state.curMode, curState: cur, curClose: state.curClose};
98
- },
99
-
100
- token: dispatch,
101
-
102
- indent: function(state, textAfter) {
103
- if ((state.curMode != phpMode && /^\s*<\//.test(textAfter)) ||
104
- (state.curMode == phpMode && /^\?>/.test(textAfter)))
105
- return htmlMode.indent(state.html, textAfter);
106
- return state.curMode.indent(state.curState, textAfter);
107
- },
108
-
109
- electricChars: "/{}:"
110
- }
111
- });
112
- CodeMirror.defineMIME("application/x-httpd-php", "php");
113
- CodeMirror.defineMIME("application/x-httpd-php-open", {name: "php", startOpen: true});
114
- CodeMirror.defineMIME("text/x-php", phpConfig);
115
- })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/mode/xml/index.html DELETED
@@ -1,42 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>CodeMirror 2: XML mode</title>
5
- <link rel="stylesheet" href="../../lib/codemirror.css">
6
- <script src="../../lib/codemirror.js"></script>
7
- <script src="xml.js"></script>
8
- <link rel="stylesheet" href="../../theme/default.css">
9
- <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
10
- <link rel="stylesheet" href="../../css/docs.css">
11
- </head>
12
- <body>
13
- <h1>CodeMirror 2: XML mode</h1>
14
- <form><textarea id="code" name="code">
15
- &lt;html style="color: green"&gt;
16
- &lt;!-- this is a comment --&gt;
17
- &lt;head&gt;
18
- &lt;title&gt;HTML Example&lt;/title&gt;
19
- &lt;/head&gt;
20
- &lt;body&gt;
21
- The indentation tries to be &lt;em&gt;somewhat &amp;quot;do what
22
- I mean&amp;quot;&lt;/em&gt;... but might not match your style.
23
- &lt;/body&gt;
24
- &lt;/html&gt;
25
- </textarea></form>
26
- <script>
27
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: {name: "xml", htmlMode: true}});
28
- </script>
29
- <p>The XML mode supports two configuration parameters:</p>
30
- <dl>
31
- <dt><code>htmlMode (boolean)</code></dt>
32
- <dd>This switches the mode to parse HTML instead of XML. This
33
- means attributes do not have to be quoted, and some elements
34
- (such as <code>br</code>) do not require a closing tag.</dd>
35
- <dt><code>alignCDATA (boolean)</code></dt>
36
- <dd>Setting this to true will force the opening tag of CDATA
37
- blocks to not be indented.</dd>
38
- </dl>
39
-
40
- <p><strong>MIME types defined:</strong> <code>application/xml</code>, <code>text/html</code>.</p>
41
- </body>
42
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/mode/xml/xml.js DELETED
@@ -1,231 +0,0 @@
1
- CodeMirror.defineMode("xml", function(config, parserConfig) {
2
- var indentUnit = config.indentUnit;
3
- var Kludges = parserConfig.htmlMode ? {
4
- autoSelfClosers: {"br": true, "img": true, "hr": true, "link": true, "input": true,
5
- "meta": true, "col": true, "frame": true, "base": true, "area": true},
6
- doNotIndent: {"pre": true, "!cdata": true},
7
- allowUnquoted: true
8
- } : {autoSelfClosers: {}, doNotIndent: {"!cdata": true}, allowUnquoted: false};
9
- var alignCDATA = parserConfig.alignCDATA;
10
-
11
- // Return variables for tokenizers
12
- var tagName, type;
13
-
14
- function inText(stream, state) {
15
- function chain(parser) {
16
- state.tokenize = parser;
17
- return parser(stream, state);
18
- }
19
-
20
- var ch = stream.next();
21
- if (ch == "<") {
22
- if (stream.eat("!")) {
23
- if (stream.eat("[")) {
24
- if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
25
- else return null;
26
- }
27
- else if (stream.match("--")) return chain(inBlock("comment", "-->"));
28
- else if (stream.match("DOCTYPE", true, true)) {
29
- stream.eatWhile(/[\w\._\-]/);
30
- return chain(inBlock("meta", ">"));
31
- }
32
- else return null;
33
- }
34
- else if (stream.eat("?")) {
35
- stream.eatWhile(/[\w\._\-]/);
36
- state.tokenize = inBlock("meta", "?>");
37
- return "meta";
38
- }
39
- else {
40
- type = stream.eat("/") ? "closeTag" : "openTag";
41
- stream.eatSpace();
42
- tagName = "";
43
- var c;
44
- while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
45
- state.tokenize = inTag;
46
- return "tag";
47
- }
48
- }
49
- else if (ch == "&") {
50
- stream.eatWhile(/[^;]/);
51
- stream.eat(";");
52
- return "atom";
53
- }
54
- else {
55
- stream.eatWhile(/[^&<]/);
56
- return null;
57
- }
58
- }
59
-
60
- function inTag(stream, state) {
61
- var ch = stream.next();
62
- if (ch == ">" || (ch == "/" && stream.eat(">"))) {
63
- state.tokenize = inText;
64
- type = ch == ">" ? "endTag" : "selfcloseTag";
65
- return "tag";
66
- }
67
- else if (ch == "=") {
68
- type = "equals";
69
- return null;
70
- }
71
- else if (/[\'\"]/.test(ch)) {
72
- state.tokenize = inAttribute(ch);
73
- return state.tokenize(stream, state);
74
- }
75
- else {
76
- stream.eatWhile(/[^\s\u00a0=<>\"\'\/?]/);
77
- return "word";
78
- }
79
- }
80
-
81
- function inAttribute(quote) {
82
- return function(stream, state) {
83
- while (!stream.eol()) {
84
- if (stream.next() == quote) {
85
- state.tokenize = inTag;
86
- break;
87
- }
88
- }
89
- return "string";
90
- };
91
- }
92
-
93
- function inBlock(style, terminator) {
94
- return function(stream, state) {
95
- while (!stream.eol()) {
96
- if (stream.match(terminator)) {
97
- state.tokenize = inText;
98
- break;
99
- }
100
- stream.next();
101
- }
102
- return style;
103
- };
104
- }
105
-
106
- var curState, setStyle;
107
- function pass() {
108
- for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
109
- }
110
- function cont() {
111
- pass.apply(null, arguments);
112
- return true;
113
- }
114
-
115
- function pushContext(tagName, startOfLine) {
116
- var noIndent = Kludges.doNotIndent.hasOwnProperty(tagName) || (curState.context && curState.context.noIndent);
117
- curState.context = {
118
- prev: curState.context,
119
- tagName: tagName,
120
- indent: curState.indented,
121
- startOfLine: startOfLine,
122
- noIndent: noIndent
123
- };
124
- }
125
- function popContext() {
126
- if (curState.context) curState.context = curState.context.prev;
127
- }
128
-
129
- function element(type) {
130
- if (type == "openTag") {curState.tagName = tagName; return cont(attributes, endtag(curState.startOfLine));}
131
- else if (type == "closeTag") {
132
- var err = false;
133
- if (curState.context) {
134
- err = curState.context.tagName != tagName;
135
- popContext();
136
- } else {
137
- err = true;
138
- }
139
- if (err) setStyle = "error";
140
- return cont(endclosetag(err));
141
- }
142
- else if (type == "string") {
143
- if (!curState.context || curState.context.name != "!cdata") pushContext("!cdata");
144
- if (curState.tokenize == inText) popContext();
145
- return cont();
146
- }
147
- else return cont();
148
- }
149
- function endtag(startOfLine) {
150
- return function(type) {
151
- if (type == "selfcloseTag" ||
152
- (type == "endTag" && Kludges.autoSelfClosers.hasOwnProperty(curState.tagName.toLowerCase())))
153
- return cont();
154
- if (type == "endTag") {pushContext(curState.tagName, startOfLine); return cont();}
155
- return cont();
156
- };
157
- }
158
- function endclosetag(err) {
159
- return function(type) {
160
- if (err) setStyle = "error";
161
- if (type == "endTag") return cont();
162
- return pass();
163
- }
164
- }
165
-
166
- function attributes(type) {
167
- if (type == "word") {setStyle = "attribute"; return cont(attributes);}
168
- if (type == "equals") return cont(attvalue, attributes);
169
- return pass();
170
- }
171
- function attvalue(type) {
172
- if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return cont();}
173
- if (type == "string") return cont(attvaluemaybe);
174
- return pass();
175
- }
176
- function attvaluemaybe(type) {
177
- if (type == "string") return cont(attvaluemaybe);
178
- else return pass();
179
- }
180
-
181
- return {
182
- startState: function() {
183
- return {tokenize: inText, cc: [], indented: 0, startOfLine: true, tagName: null, context: null};
184
- },
185
-
186
- token: function(stream, state) {
187
- if (stream.sol()) {
188
- state.startOfLine = true;
189
- state.indented = stream.indentation();
190
- }
191
- if (stream.eatSpace()) return null;
192
-
193
- setStyle = type = tagName = null;
194
- var style = state.tokenize(stream, state);
195
- if ((style || type) && style != "comment") {
196
- curState = state;
197
- while (true) {
198
- var comb = state.cc.pop() || element;
199
- if (comb(type || style)) break;
200
- }
201
- }
202
- state.startOfLine = false;
203
- return setStyle || style;
204
- },
205
-
206
- indent: function(state, textAfter) {
207
- var context = state.context;
208
- if (context && context.noIndent) return 0;
209
- if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
210
- if (context && /^<\//.test(textAfter))
211
- context = context.prev;
212
- while (context && !context.startOfLine)
213
- context = context.prev;
214
- if (context) return context.indent + indentUnit;
215
- else return 0;
216
- },
217
-
218
- compareStates: function(a, b) {
219
- if (a.indented != b.indented || a.tagName != b.tagName) return false;
220
- for (var ca = a.context, cb = b.context; ; ca = ca.prev, cb = cb.prev) {
221
- if (!ca || !cb) return ca == cb;
222
- if (ca.tagName != cb.tagName) return false;
223
- }
224
- },
225
-
226
- electricChars: "/"
227
- };
228
- });
229
-
230
- CodeMirror.defineMIME("application/xml", "xml");
231
- CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/mode/xmlpure/index.html DELETED
@@ -1,60 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>CodeMirror 2: Pure XML mode</title>
5
- <link rel="stylesheet" href="../../lib/codemirror.css">
6
- <script src="../../lib/codemirror.js"></script>
7
- <script src="xmlpure.js"></script>
8
- <link rel="stylesheet" href="../../theme/default.css">
9
- <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
10
- <link rel="stylesheet" href="../../css/docs.css">
11
- </head>
12
- <body>
13
- <h1>CodeMirror 2: XML mode</h1>
14
- <form><textarea id="code" name="code">
15
- &lt;?xml version="1.0" encoding="UTF-8" standalone="no" ?&gt;
16
-
17
- &lt;!-- This is the pure XML mode,
18
- and we're inside a comment! --&gt;
19
-
20
- &lt;catalog&gt;
21
- &lt;books&gt;
22
- &lt;book id="bk01"&gt;
23
- &lt;title&gt;Lord of Light&lt;/title&gt;
24
- &lt;author&gt;Roger Zelazny&lt;/author&gt;
25
- &lt;year&gt;1967&lt;/year&gt;
26
- &lt;description&gt;&lt;![CDATA[This is a great book, really!!]]&gt;&lt;/description&gt;
27
- &lt;/book&gt;
28
- &lt;/books&gt;
29
- &lt;/catalog&gt;
30
- </textarea></form>
31
- <script>
32
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: {name: "xmlpure"}});
33
- </script>
34
-
35
- <p>This is my XML parser, based on the original:</p>
36
- <ul>
37
- <li>No html mode - this is pure xml</li>
38
- <li>Illegal attributes and element names are errors</li>
39
- <li>Attributes must have a value</li>
40
- <li>XML declaration supported (e.g.: <b>&lt;?xml version="1.0" encoding="utf-8" standalone="no" ?&gt;</b>)</li>
41
- <li>CDATA and comment blocks are not indented (except for their start-tag)</li>
42
- <li>Better handling of errors per line with the state object - provides good infrastructure for extending it</li>
43
- </ul>
44
-
45
- <p>What's missing:</p>
46
- <ul>
47
- <li>Make sure only a single root element exists at the document level</li>
48
- <li>Multi-line attributes should NOT indent</li>
49
- <li>Start tags are not painted red when they have no matching end tags (is this really wrong?)</li>
50
- </ul>
51
-
52
- <p><strong>MIME types defined:</strong> <code>application/xml</code>, <code>text/xml</code>.</p>
53
-
54
- <p><b>@author</b>: Dror BG (<i>deebug dot dev at gmail dot com</i>)<br/>
55
- <p><b>@date</b>: August, 2011<br/>
56
- <p><b>@github</b>: <a href='https://github.com/deebugger/CodeMirror2' target='blank'>https://github.com/deebugger/CodeMirror2</a></p>
57
-
58
- <p><strong>MIME types defined:</strong> <code>application/xml</code>, <code>text/xml</code>.</p>
59
- </body>
60
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/mode/xmlpure/xmlpure.js DELETED
@@ -1,481 +0,0 @@
1
- /**
2
- * xmlpure.js
3
- *
4
- * Building upon and improving the CodeMirror 2 XML parser
5
- * @author: Dror BG (deebug.dev@gmail.com)
6
- * @date: August, 2011
7
- */
8
-
9
- CodeMirror.defineMode("xmlpure", function(config, parserConfig) {
10
- // constants
11
- var STYLE_ERROR = "error";
12
- var STYLE_INSTRUCTION = "comment";
13
- var STYLE_COMMENT = "comment";
14
- var STYLE_ELEMENT_NAME = "tag";
15
- var STYLE_ATTRIBUTE = "attribute";
16
- var STYLE_WORD = "string";
17
- var STYLE_TEXT = "atom";
18
-
19
- var TAG_INSTRUCTION = "!instruction";
20
- var TAG_CDATA = "!cdata";
21
- var TAG_COMMENT = "!comment";
22
- var TAG_TEXT = "!text";
23
-
24
- var doNotIndent = {
25
- "!cdata": true,
26
- "!comment": true,
27
- "!text": true,
28
- "!instruction": true
29
- };
30
-
31
- // options
32
- var indentUnit = config.indentUnit;
33
-
34
- ///////////////////////////////////////////////////////////////////////////
35
- // helper functions
36
-
37
- // chain a parser to another parser
38
- function chain(stream, state, parser) {
39
- state.tokenize = parser;
40
- return parser(stream, state);
41
- }
42
-
43
- // parse a block (comment, CDATA or text)
44
- function inBlock(style, terminator, nextTokenize) {
45
- return function(stream, state) {
46
- while (!stream.eol()) {
47
- if (stream.match(terminator)) {
48
- popContext(state);
49
- state.tokenize = nextTokenize;
50
- break;
51
- }
52
- stream.next();
53
- }
54
- return style;
55
- };
56
- }
57
-
58
- // go down a level in the document
59
- // (hint: look at who calls this function to know what the contexts are)
60
- function pushContext(state, tagName) {
61
- var noIndent = doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.doIndent);
62
- var newContext = {
63
- tagName: tagName,
64
- prev: state.context,
65
- indent: state.context ? state.context.indent + indentUnit : 0,
66
- lineNumber: state.lineNumber,
67
- indented: state.indented,
68
- noIndent: noIndent
69
- };
70
- state.context = newContext;
71
- }
72
-
73
- // go up a level in the document
74
- function popContext(state) {
75
- if (state.context) {
76
- var oldContext = state.context;
77
- state.context = oldContext.prev;
78
- return oldContext;
79
- }
80
-
81
- // we shouldn't be here - it means we didn't have a context to pop
82
- return null;
83
- }
84
-
85
- // return true if the current token is seperated from the tokens before it
86
- // which means either this is the start of the line, or there is at least
87
- // one space or tab character behind the token
88
- // otherwise returns false
89
- function isTokenSeparated(stream) {
90
- return stream.sol() ||
91
- stream.string.charAt(stream.start - 1) == " " ||
92
- stream.string.charAt(stream.start - 1) == "\t";
93
- }
94
-
95
- ///////////////////////////////////////////////////////////////////////////
96
- // context: document
97
- //
98
- // an XML document can contain:
99
- // - a single declaration (if defined, it must be the very first line)
100
- // - exactly one root element
101
- // @todo try to actually limit the number of root elements to 1
102
- // - zero or more comments
103
- function parseDocument(stream, state) {
104
- if(stream.eat("<")) {
105
- if(stream.eat("?")) {
106
- // processing instruction
107
- pushContext(state, TAG_INSTRUCTION);
108
- state.tokenize = parseProcessingInstructionStartTag;
109
- return STYLE_INSTRUCTION;
110
- } else if(stream.match("!--")) {
111
- // new context: comment
112
- pushContext(state, TAG_COMMENT);
113
- return chain(stream, state, inBlock(STYLE_COMMENT, "-->", parseDocument));
114
- } else if(stream.eatSpace() || stream.eol() ) {
115
- stream.skipToEnd();
116
- return STYLE_ERROR;
117
- } else {
118
- // element
119
- state.tokenize = parseElementTagName;
120
- return STYLE_ELEMENT_NAME;
121
- }
122
- }
123
-
124
- // error on line
125
- stream.skipToEnd();
126
- return STYLE_ERROR;
127
- }
128
-
129
- ///////////////////////////////////////////////////////////////////////////
130
- // context: XML element start-tag or end-tag
131
- //
132
- // - element start-tag can contain attributes
133
- // - element start-tag may self-close (or start an element block if it doesn't)
134
- // - element end-tag can contain only the tag name
135
- function parseElementTagName(stream, state) {
136
- // get the name of the tag
137
- var startPos = stream.pos;
138
- if(stream.match(/^[a-zA-Z_:][-a-zA-Z0-9_:.]*/)) {
139
- // element start-tag
140
- var tagName = stream.string.substring(startPos, stream.pos);
141
- pushContext(state, tagName);
142
- state.tokenize = parseElement;
143
- return STYLE_ELEMENT_NAME;
144
- } else if(stream.match(/^\/[a-zA-Z_:][-a-zA-Z0-9_:.]*( )*>/)) {
145
- // element end-tag
146
- var endTagName = stream.string.substring(startPos + 1, stream.pos - 1).trim();
147
- var oldContext = popContext(state);
148
- state.tokenize = state.context == null ? parseDocument : parseElementBlock;
149
- if(oldContext == null || endTagName != oldContext.tagName) {
150
- // the start and end tag names should match - error
151
- return STYLE_ERROR;
152
- }
153
- return STYLE_ELEMENT_NAME;
154
- } else {
155
- // no tag name - error
156
- state.tokenize = state.context == null ? parseDocument : parseElementBlock;
157
- stream.eatWhile(/[^>]/);
158
- stream.eat(">");
159
- return STYLE_ERROR;
160
- }
161
-
162
- stream.skipToEnd();
163
- return null;
164
- }
165
-
166
- function parseElement(stream, state) {
167
- if(stream.match(/^\/>/)) {
168
- // self-closing tag
169
- popContext(state);
170
- state.tokenize = state.context == null ? parseDocument : parseElementBlock;
171
- return STYLE_ELEMENT_NAME;
172
- } else if(stream.eat(/^>/)) {
173
- state.tokenize = parseElementBlock;
174
- return STYLE_ELEMENT_NAME;
175
- } else if(isTokenSeparated(stream) && stream.match(/^[a-zA-Z_:][-a-zA-Z0-9_:.]*( )*=/)) {
176
- // attribute
177
- state.tokenize = parseAttribute;
178
- return STYLE_ATTRIBUTE;
179
- }
180
-
181
- // no other options - this is an error
182
- state.tokenize = state.context == null ? parseDocument : parseDocument;
183
- stream.eatWhile(/[^>]/);
184
- stream.eat(">");
185
- return STYLE_ERROR;
186
- }
187
-
188
- ///////////////////////////////////////////////////////////////////////////
189
- // context: attribute
190
- //
191
- // attribute values may contain everything, except:
192
- // - the ending quote (with ' or ") - this marks the end of the value
193
- // - the character "<" - should never appear
194
- // - ampersand ("&") - unless it starts a reference: a string that ends with a semi-colon (";")
195
- // ---> note: this parser is lax in what may be put into a reference string,
196
- // ---> consult http://www.w3.org/TR/REC-xml/#NT-Reference if you want to make it tighter
197
- function parseAttribute(stream, state) {
198
- var quote = stream.next();
199
- if(quote != "\"" && quote != "'") {
200
- // attribute must be quoted
201
- stream.skipToEnd();
202
- state.tokenize = parseElement;
203
- return STYLE_ERROR;
204
- }
205
-
206
- state.tokParams.quote = quote;
207
- state.tokenize = parseAttributeValue;
208
- return STYLE_WORD;
209
- }
210
-
211
- // @todo: find out whether this attribute value spans multiple lines,
212
- // and if so, push a context for it in order not to indent it
213
- // (or something of the sort..)
214
- function parseAttributeValue(stream, state) {
215
- var ch = "";
216
- while(!stream.eol()) {
217
- ch = stream.next();
218
- if(ch == state.tokParams.quote) {
219
- // end quote found
220
- state.tokenize = parseElement;
221
- return STYLE_WORD;
222
- } else if(ch == "<") {
223
- // can't have less-than signs in an attribute value, ever
224
- stream.skipToEnd()
225
- state.tokenize = parseElement;
226
- return STYLE_ERROR;
227
- } else if(ch == "&") {
228
- // reference - look for a semi-colon, or return error if none found
229
- ch = stream.next();
230
-
231
- // make sure that semi-colon isn't right after the ampersand
232
- if(ch == ';') {
233
- stream.skipToEnd()
234
- state.tokenize = parseElement;
235
- return STYLE_ERROR;
236
- }
237
-
238
- // make sure no less-than characters slipped in
239
- while(!stream.eol() && ch != ";") {
240
- if(ch == "<") {
241
- // can't have less-than signs in an attribute value, ever
242
- stream.skipToEnd()
243
- state.tokenize = parseElement;
244
- return STYLE_ERROR;
245
- }
246
- ch = stream.next();
247
- }
248
- if(stream.eol() && ch != ";") {
249
- // no ampersand found - error
250
- stream.skipToEnd();
251
- state.tokenize = parseElement;
252
- return STYLE_ERROR;
253
- }
254
- }
255
- }
256
-
257
- // attribute value continues to next line
258
- return STYLE_WORD;
259
- }
260
-
261
- ///////////////////////////////////////////////////////////////////////////
262
- // context: element block
263
- //
264
- // a block can contain:
265
- // - elements
266
- // - text
267
- // - CDATA sections
268
- // - comments
269
- function parseElementBlock(stream, state) {
270
- if(stream.eat("<")) {
271
- if(stream.match("?")) {
272
- pushContext(state, TAG_INSTRUCTION);
273
- state.tokenize = parseProcessingInstructionStartTag;
274
- return STYLE_INSTRUCTION;
275
- } else if(stream.match("!--")) {
276
- // new context: comment
277
- pushContext(state, TAG_COMMENT);
278
- return chain(stream, state, inBlock(STYLE_COMMENT, "-->",
279
- state.context == null ? parseDocument : parseElementBlock));
280
- } else if(stream.match("![CDATA[")) {
281
- // new context: CDATA section
282
- pushContext(state, TAG_CDATA);
283
- return chain(stream, state, inBlock(STYLE_TEXT, "]]>",
284
- state.context == null ? parseDocument : parseElementBlock));
285
- } else if(stream.eatSpace() || stream.eol() ) {
286
- stream.skipToEnd();
287
- return STYLE_ERROR;
288
- } else {
289
- // element
290
- state.tokenize = parseElementTagName;
291
- return STYLE_ELEMENT_NAME;
292
- }
293
- } else {
294
- // new context: text
295
- pushContext(state, TAG_TEXT);
296
- state.tokenize = parseText;
297
- return null;
298
- }
299
-
300
- state.tokenize = state.context == null ? parseDocument : parseElementBlock;
301
- stream.skipToEnd();
302
- return null;
303
- }
304
-
305
- function parseText(stream, state) {
306
- stream.eatWhile(/[^<]/);
307
- if(!stream.eol()) {
308
- // we cannot possibly be in the document context,
309
- // just inside an element block
310
- popContext(state);
311
- state.tokenize = parseElementBlock;
312
- }
313
- return STYLE_TEXT;
314
- }
315
-
316
- ///////////////////////////////////////////////////////////////////////////
317
- // context: XML processing instructions
318
- //
319
- // XML processing instructions (PIs) allow documents to contain instructions for applications.
320
- // PI format: <?name data?>
321
- // - 'name' can be anything other than 'xml' (case-insensitive)
322
- // - 'data' can be anything which doesn't contain '?>'
323
- // XML declaration is a special PI (see XML declaration context below)
324
- function parseProcessingInstructionStartTag(stream, state) {
325
- if(stream.match("xml", true, true)) {
326
- // xml declaration
327
- if(state.lineNumber > 1 || stream.pos > 5) {
328
- state.tokenize = parseDocument;
329
- stream.skipToEnd();
330
- return STYLE_ERROR;
331
- } else {
332
- state.tokenize = parseDeclarationVersion;
333
- return STYLE_INSTRUCTION;
334
- }
335
- }
336
-
337
- // regular processing instruction
338
- if(isTokenSeparated(stream) || stream.match("?>")) {
339
- // we have a space after the start-tag, or nothing but the end-tag
340
- // either way - error!
341
- state.tokenize = parseDocument;
342
- stream.skipToEnd();
343
- return STYLE_ERROR;
344
- }
345
-
346
- state.tokenize = parseProcessingInstructionBody;
347
- return STYLE_INSTRUCTION;
348
- }
349
-
350
- function parseProcessingInstructionBody(stream, state) {
351
- stream.eatWhile(/[^?]/);
352
- if(stream.eat("?")) {
353
- if(stream.eat(">")) {
354
- popContext(state);
355
- state.tokenize = state.context == null ? parseDocument : parseElementBlock;
356
- }
357
- }
358
- return STYLE_INSTRUCTION;
359
- }
360
-
361
-
362
- ///////////////////////////////////////////////////////////////////////////
363
- // context: XML declaration
364
- //
365
- // XML declaration is of the following format:
366
- // <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
367
- // - must start at the first character of the first line
368
- // - may span multiple lines
369
- // - must include 'version'
370
- // - may include 'encoding' and 'standalone' (in that order after 'version')
371
- // - attribute names must be lowercase
372
- // - cannot contain anything else on the line
373
- function parseDeclarationVersion(stream, state) {
374
- state.tokenize = parseDeclarationEncoding;
375
-
376
- if(isTokenSeparated(stream) && stream.match(/^version( )*=( )*"([a-zA-Z0-9_.:]|\-)+"/)) {
377
- return STYLE_INSTRUCTION;
378
- }
379
- stream.skipToEnd();
380
- return STYLE_ERROR;
381
- }
382
-
383
- function parseDeclarationEncoding(stream, state) {
384
- state.tokenize = parseDeclarationStandalone;
385
-
386
- if(isTokenSeparated(stream) && stream.match(/^encoding( )*=( )*"[A-Za-z]([A-Za-z0-9._]|\-)*"/)) {
387
- return STYLE_INSTRUCTION;
388
- }
389
- return null;
390
- }
391
-
392
- function parseDeclarationStandalone(stream, state) {
393
- state.tokenize = parseDeclarationEndTag;
394
-
395
- if(isTokenSeparated(stream) && stream.match(/^standalone( )*=( )*"(yes|no)"/)) {
396
- return STYLE_INSTRUCTION;
397
- }
398
- return null;
399
- }
400
-
401
- function parseDeclarationEndTag(stream, state) {
402
- state.tokenize = parseDocument;
403
-
404
- if(stream.match("?>") && stream.eol()) {
405
- popContext(state);
406
- return STYLE_INSTRUCTION;
407
- }
408
- stream.skipToEnd();
409
- return STYLE_ERROR;
410
- }
411
-
412
- ///////////////////////////////////////////////////////////////////////////
413
- // returned object
414
- return {
415
- electricChars: "/",
416
-
417
- startState: function() {
418
- return {
419
- tokenize: parseDocument,
420
- tokParams: {},
421
- lineNumber: 0,
422
- lineError: false,
423
- context: null,
424
- indented: 0
425
- };
426
- },
427
-
428
- token: function(stream, state) {
429
- if(stream.sol()) {
430
- // initialize a new line
431
- state.lineNumber++;
432
- state.lineError = false;
433
- state.indented = stream.indentation();
434
- }
435
-
436
- // eat all (the spaces) you can
437
- if(stream.eatSpace()) return null;
438
-
439
- // run the current tokenize function, according to the state
440
- var style = state.tokenize(stream, state);
441
-
442
- // is there an error somewhere in the line?
443
- state.lineError = (state.lineError || style == "error");
444
-
445
- return style;
446
- },
447
-
448
- blankLine: function(state) {
449
- // blank lines are lines too!
450
- state.lineNumber++;
451
- state.lineError = false;
452
- },
453
-
454
- indent: function(state, textAfter) {
455
- if(state.context) {
456
- if(state.context.noIndent == true) {
457
- // do not indent - no return value at all
458
- return;
459
- }
460
- if(textAfter.match(/^<\/.*/)) {
461
- // eng-tag - indent back to last context
462
- return state.context.indent;
463
- }
464
- // indent to last context + regular indent unit
465
- return state.context.indent + indentUnit;
466
- }
467
- return 0;
468
- },
469
-
470
- compareStates: function(a, b) {
471
- if (a.indented != b.indented) return false;
472
- for (var ca = a.context, cb = b.context; ; ca = ca.prev, cb = cb.prev) {
473
- if (!ca || !cb) return ca == cb;
474
- if (ca.tagName != cb.tagName) return false;
475
- }
476
- }
477
- };
478
- });
479
-
480
- CodeMirror.defineMIME("application/xml", "purexml");
481
- CodeMirror.defineMIME("text/xml", "purexml");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/theme/default.css DELETED
@@ -1,19 +0,0 @@
1
- .cm-s-default span.cm-keyword {color: #708;}
2
- .cm-s-default span.cm-atom {color: #219;}
3
- .cm-s-default span.cm-number {color: #164;}
4
- .cm-s-default span.cm-def {color: #00f;}
5
- .cm-s-default span.cm-variable {color: black;}
6
- .cm-s-default span.cm-variable-2 {color: #05a;}
7
- .cm-s-default span.cm-variable-3 {color: #0a5;}
8
- .cm-s-default span.cm-property {color: black;}
9
- .cm-s-default span.cm-operator {color: black;}
10
- .cm-s-default span.cm-comment {color: #a50;}
11
- .cm-s-default span.cm-string {color: #a11;}
12
- .cm-s-default span.cm-string-2 {color: #f50;}
13
- .cm-s-default span.cm-meta {color: #555;}
14
- .cm-s-default span.cm-error {color: #f00;}
15
- .cm-s-default span.cm-qualifier {color: #555;}
16
- .cm-s-default span.cm-builtin {color: #30a;}
17
- .cm-s-default span.cm-bracket {color: #cc7;}
18
- .cm-s-default span.cm-tag {color: #170;}
19
- .cm-s-default span.cm-attribute {color: #00c;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/theme/elegant.css DELETED
@@ -1,9 +0,0 @@
1
- .cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;}
2
- .cm-s-elegant span.cm-comment {color: #262;font-style: italic;}
3
- .cm-s-elegant span.cm-meta {color: #555;font-style: italic;}
4
- .cm-s-elegant span.cm-variable {color: black;}
5
- .cm-s-elegant span.cm-variable-2 {color: #b11;}
6
- .cm-s-elegant span.cm-qualifier {color: #555;}
7
- .cm-s-elegant span.cm-keyword {color: #730;}
8
- .cm-s-elegant span.cm-builtin {color: #30a;}
9
- .cm-s-elegant span.cm-error {background-color: #fdd;}
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/theme/neat.css DELETED
@@ -1,8 +0,0 @@
1
- .cm-s-neat span.cm-comment { color: #a86; }
2
- .cm-s-neat span.cm-keyword { font-weight: bold; color: blue; }
3
- .cm-s-neat span.cm-string { color: #a22; }
4
- .cm-s-neat span.cm-builtin { font-weight: bold; color: #077; }
5
- .cm-s-neat span.cm-special { font-weight: bold; color: #0aa; }
6
- .cm-s-neat span.cm-variable { color: black; }
7
- .cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; }
8
- .cm-s-neat span.cm-meta {color: #555;}
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/js/theme/night.css DELETED
@@ -1,20 +0,0 @@
1
- /* Loosely based on the Midnight Textmate theme */
2
-
3
- .cm-s-night { background: #0a001f; color: #f8f8f8; }
4
- .cm-s-night span.CodeMirror-selected { background: #a8f !important; }
5
- .cm-s-night .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; }
6
- .cm-s-night .CodeMirror-gutter-text { color: #f8f8f8; }
7
- .cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; }
8
-
9
- .cm-s-night span.cm-comment { color: #6900a1; }
10
- .cm-s-night span.cm-atom { color: #845dc4; }
11
- .cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; }
12
- .cm-s-night span.cm-keyword { color: #599eff; }
13
- .cm-s-night span.cm-string { color: #37f14a; }
14
- .cm-s-night span.cm-meta { color: #7678e2; }
15
- .cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; }
16
- .cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; }
17
- .cm-s-night span.cm-error { color: #9d1e15; }
18
- .cm-s-night span.cm-bracket { color: #8da6ce; }
19
- .cm-s-night span.cm-comment { color: #6900a1; }
20
- .cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tinymce-plugins/cmseditor/langs/en.js DELETED
@@ -1,3 +0,0 @@
1
- tinyMCE.addI18n('en.example',{
2
- desc : 'This is just a template button'
3
- });
 
 
 
tinymce-plugins/cmseditor/langs/en_dlg.js DELETED
@@ -1,3 +0,0 @@
1
- tinyMCE.addI18n('en.example_dlg',{
2
- title : 'This is just a example title'
3
- });
 
 
 
views/help.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p><?php _e('Some dynamic tags can be included in your email template :', 'wp-better-emails'); ?></p>
2
+ <ul>
3
+ <li><?php _e('<strong>%content%</strong> : will be replaced with the message content.', 'wp-better-emails'); ?><br />
4
+ <span class="description"> <?php _e('NOTE: The content tag is <strong>required</strong>, WP Better Emails will be automatically desactivated if no content tag is found.', 'wp-better-emails'); ?></span></li>
5
+ <li><?php _e('<strong>%blog_url%</strong> : will be replaced with your blog URL.', 'wp-better-emails'); ?></li>
6
+ <li><?php _e('<strong>%home_url%</strong> : will be replaced with your home URL.', 'wp-better-emails'); ?></li>
7
+ <li><?php _e('<strong>%blog_name%</strong> : will be replaced with your blog name.', 'wp-better-emails'); ?></li>
8
+ <li><?php _e('<strong>%blog_description%</strong> : will be replaced with your blog description.', 'wp-better-emails'); ?></li>
9
+ <li><?php _e('<strong>%admin_email%</strong> : will be replaced with admin email.', 'wp-better-emails'); ?></li>
10
+ <li><?php _e('<strong>%date%</strong> : will be replaced with current date', 'as formatted in <a href="options-general.php">general options</a>.', 'wp-better-emails'); ?></li>
11
+ <li><?php _e('<strong>%time%</strong> : will be replaced with current time', 'as formatted in <a href="options-general.php">general options</a>.', 'wp-better-emails'); ?></li>
12
+ </ul>
webpack.mix.js ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const mix = require('laravel-mix');
2
+
3
+ const assets = 'assets';
4
+ const dist = 'dist';
5
+
6
+ mix.setPublicPath(dist);
7
+ mix.setResourceRoot('../');
8
+
9
+ // SASS
10
+ mix
11
+ .sass(`${assets}/css/wpbe.scss`, `${dist}/css`)
12
+ .sass(`${assets}/js/plugins/codemirror/code.scss`, `${dist}/js/plugins/codemirror`)
13
+
14
+ // Javascript
15
+ mix
16
+ .autoload({
17
+ 'jquery': ['window.$', 'window.jQuery']
18
+ })
19
+ .js(`${assets}/js/admin.js`, `${dist}/js`)
20
+ .js(`${assets}/js/plugins/codemirror/plugin.js`, `${dist}/js/plugins/codemirror`)
21
+ .js(`${assets}/js/plugins/codemirror/code.js`, `${dist}/js/plugins/codemirror`)
22
+ .copy(`${assets}/js/plugins/codemirror/source.html`, `${dist}/js/plugins/codemirror`)
23
+ .js(`${assets}/js/plugins/fullpage.js`, `${dist}/js/plugins`);
24
+
25
+ // Source maps when not in production.
26
+ if (!mix.inProduction()) {
27
+ mix.sourceMaps();
28
+ }
29
+
30
+ // Hash and version files in production.
31
+ if (mix.inProduction()) {
32
+ mix.version();
33
+ }
wpbe-options.php CHANGED
@@ -1,5 +1,6 @@
1
  <div class="wrap">
2
- <h2><?php _e('Email settings', 'wp-better-emails'); ?></h2>
 
3
 
4
  <form method="post" action="options.php" id="wpbe_options_form">
5
  <?php settings_fields('wpbe_full_options'); ?>
@@ -19,10 +20,9 @@
19
  </table>
20
 
21
  <!-- Template -->
22
- <h3 class="wpbe_title"><?php _e('HTML Template', 'wp-better-emails'); ?>
23
- <?php if( version_compare($wp_version, '3.1', '>') ): ?>
24
- <a class="button" title="<?php esc_attr_e('Live template preview', 'wp-better-emails'); ?>" id="wpbe_preview_template" href="<?php echo plugins_url('preview.html?keepThis=true&TB_iframe=true&height=400&width=700', __FILE__); ?>"><?php _e('Live preview', 'wp-better-emails'); ?></a>
25
- <?php endif; ?>
26
  </h3>
27
  <p><?php _e('Edit the HTML template if you want to customize it. You might have a look at the <a href="#" class="wpbe_help">help tab</a> for further information.', 'wp-better-emails'); ?></p>
28
  <div id="wpbe_template_container">
@@ -32,9 +32,7 @@
32
  <!-- Plain-text template -->
33
  <h3 class="wpbe_title"><?php _e('Plain-text Template', 'wp-better-emails'); ?></h3>
34
  <p><?php _e('Edit the plain-text template if you want to customize it. You might have a look at the <a href="#" class="wpbe_help">help tab</a> for further information.', 'wp-better-emails'); ?></p>
35
- <div id="wpbe_plaintext_template_container">
36
- <?php $this->plaintext_template_editor(); ?>
37
- </div>
38
 
39
  <!-- Preview -->
40
  <h3 class="wpbe_title"><?php _e('Preview', 'wp-better-emails'); ?></h3>
@@ -60,7 +58,7 @@
60
  <div id="wpbe_support">
61
  <h3><?php _e('Support & bug report', 'wp-better-emails'); ?></h3>
62
  <p><?php printf(__('If you have any idea to improve this plugin or any bug to report, please email me at : <a href="%1$s">%2$s</a>', 'wp-better-emails'), 'mailto:wpbetteremails@helloni.co?subject=[wp-better-emails]', 'wpbetteremails@helloni.co'); ?></p>
63
- <?php $donation_link = 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=7Q49VJQNRCQ8E&lc=FR&item_name=ArtyShow&item_number=wp%2dbetter%2demails&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted'; ?>
64
  <p><?php printf(__('You like this plugin ? You use it in a business context ? Please, consider a <a href="%s" target="_blank" rel="external">donation</a>.', 'wp-better-emails'), $donation_link ); ?></p>
65
  <p><?php printf(__('You can still provide some support by <a href="%1$s" target="_blank">voting for it</a> and/or says that <a href="%2$s" target="_blank">it works</a> for your WordPress installation on the official WordPress plugins repository.', 'wp-better-emails'), 'http://wordpress.org/plugins/wp-better-emails/', 'http://wordpress.org/plugins/wp-better-emails/'); ?></p>
66
  </div>
1
  <div class="wrap">
2
+
3
+ <h1><?php _e('Email settings', 'wp-better-emails'); ?></h1>
4
 
5
  <form method="post" action="options.php" id="wpbe_options_form">
6
  <?php settings_fields('wpbe_full_options'); ?>
20
  </table>
21
 
22
  <!-- Template -->
23
+ <h3 class="wpbe_title">
24
+ <?php _e('HTML Template', 'wp-better-emails'); ?>
25
+ <!-- <a class="button" title="<?php esc_attr_e('Live template preview', 'wp-better-emails'); ?>" id="wpbe_preview_template" href="<?php echo plugins_url('preview.html?keepThis=true&TB_iframe=true&height=400&width=700', __FILE__); ?>"><?php _e('Live preview', 'wp-better-emails'); ?></a> -->
 
26
  </h3>
27
  <p><?php _e('Edit the HTML template if you want to customize it. You might have a look at the <a href="#" class="wpbe_help">help tab</a> for further information.', 'wp-better-emails'); ?></p>
28
  <div id="wpbe_template_container">
32
  <!-- Plain-text template -->
33
  <h3 class="wpbe_title"><?php _e('Plain-text Template', 'wp-better-emails'); ?></h3>
34
  <p><?php _e('Edit the plain-text template if you want to customize it. You might have a look at the <a href="#" class="wpbe_help">help tab</a> for further information.', 'wp-better-emails'); ?></p>
35
+ <div id="wpbe_plaintext_template_container"><?php $this->plaintext_template_editor(); ?></div>
 
 
36
 
37
  <!-- Preview -->
38
  <h3 class="wpbe_title"><?php _e('Preview', 'wp-better-emails'); ?></h3>
58
  <div id="wpbe_support">
59
  <h3><?php _e('Support & bug report', 'wp-better-emails'); ?></h3>
60
  <p><?php printf(__('If you have any idea to improve this plugin or any bug to report, please email me at : <a href="%1$s">%2$s</a>', 'wp-better-emails'), 'mailto:wpbetteremails@helloni.co?subject=[wp-better-emails]', 'wpbetteremails@helloni.co'); ?></p>
61
+ <?php $donation_link = 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=7Q49VJQNRCQ8E&lc=FR&item_name=wp-better-emails&item_number=wp%2dbetter%2demails&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted'; ?>
62
  <p><?php printf(__('You like this plugin ? You use it in a business context ? Please, consider a <a href="%s" target="_blank" rel="external">donation</a>.', 'wp-better-emails'), $donation_link ); ?></p>
63
  <p><?php printf(__('You can still provide some support by <a href="%1$s" target="_blank">voting for it</a> and/or says that <a href="%2$s" target="_blank">it works</a> for your WordPress installation on the official WordPress plugins repository.', 'wp-better-emails'), 'http://wordpress.org/plugins/wp-better-emails/', 'http://wordpress.org/plugins/wp-better-emails/'); ?></p>
64
  </div>
wpbe.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Better Emails
4
  Plugin URI: http://wordpress.org/extend/plugins/wp-better-emails/
5
  Description: Beautify the default text/plain WP mails into fully customizable HTML emails.
6
- Version: 0.3
7
  Author: Nicolas Lemoine
8
  Author URI: http://wordpress.org/extend/plugins/wp-better-emails/
9
  License: GPLv2
@@ -29,15 +29,17 @@ License: GPLv2
29
 
30
  if ( ! class_exists( 'WP_Better_Emails' ) ) {
31
 
32
- if ( ! defined( 'WPBE_JS_URL' ) )
33
- define( 'WPBE_JS_URL', plugin_dir_url( __FILE__ ) . 'js' );
 
34
 
35
- if ( ! defined( 'WPBE_CSS_URL' ) )
36
- define( 'WPBE_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' );
 
37
 
38
  class WP_Better_Emails {
39
 
40
- var $options = array();
41
  var $page = '';
42
  var $send_as_html;
43
 
@@ -69,20 +71,8 @@ if ( ! class_exists( 'WP_Better_Emails' ) ) {
69
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
70
  add_action( 'wp_ajax_send_preview', array( $this, 'ajax_send_preview' ) );
71
 
72
- if ( version_compare( $wp_version, '3.2.1', '<=' ) ) {
73
- add_action( 'admin_head', array( $this, 'load_wp_tiny_mce' ) );
74
- }
75
-
76
- if ( version_compare( $wp_version, '3.2', '<' ) && version_compare( $wp_version, '3.0.6', '>' ) ) {
77
- add_action( 'admin_print_footer_scripts', 'wp_tiny_mce_preload_dialogs' );
78
- }
79
-
80
  // Filters
81
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'settings_link' ) );
82
- add_filter( 'contextual_help', array( $this, 'contextual_help' ), 10, 3 );
83
- add_filter( 'mce_external_plugins', array( $this, 'tinymce_plugins' ) );
84
- add_filter( 'mce_buttons', array( $this, 'tinymce_buttons' ) );
85
- add_filter( 'tiny_mce_before_init', array( $this, 'tinymce_config' ) );
86
 
87
  }
88
 
@@ -104,15 +94,19 @@ if ( ! class_exists( 'WP_Better_Emails' ) ) {
104
 
105
  // HTML default template
106
  $template = '';
107
- @require 'templates/template-1.php';
108
 
109
  // Plain-text default template
110
- $plaintext = '%content%
 
 
111
 
112
  ---
113
 
114
  Email sent %date% @ %time%
115
- For any requests, please contact %admin_email%';
 
 
116
 
117
  // Setup options array
118
  $this->options = array(
@@ -135,8 +129,8 @@ For any requests, please contact %admin_email%';
135
  */
136
  function init() {
137
  register_setting( 'wpbe_full_options', 'wpbe_options', array( $this, 'validate_options' ) );
138
- wp_register_script( 'wpbe-admin-script', WPBE_JS_URL . '/wpbe-admin-script.js', array( 'jquery', 'thickbox' ), null, true );
139
- wp_register_style( 'wpbe-admin-style', WPBE_CSS_URL . '/wpbe-admin-style.css' );
140
  }
141
 
142
  /**
@@ -160,15 +154,6 @@ For any requests, please contact %admin_email%';
160
  * @global $wp_version
161
  */
162
  function activate() {
163
- global $wp_version;
164
- // Prevent activation if requirements are not met
165
- // WP 2.8 required
166
- if ( version_compare( $wp_version, '2.8', '<=' ) ) {
167
- deactivate_plugins( __FILE__ );
168
-
169
- wp_die( __( 'WP Better Emails requires WordPress 2.8 or newer.', 'wp-better-emails' ), __( 'Upgrade your Wordpress installation.', 'wp-better-emails' ) );
170
- }
171
-
172
  if ( ! is_multisite() ) {
173
  $this->set_options();
174
  } else {
@@ -182,7 +167,6 @@ For any requests, please contact %admin_email%';
182
  }
183
  }
184
  }
185
-
186
  }
187
 
188
  /**
@@ -191,27 +175,34 @@ For any requests, please contact %admin_email%';
191
  * @since 0.1
192
  */
193
  function admin_menu() {
194
- $this->page = add_options_page( __( 'Email settings', 'wp-better-emails' ), __( 'WP Better Emails', 'wp-better-emails' ), 'administrator', 'wpbe_options', array( $this, 'admin_page' ) );
 
 
 
 
 
 
195
 
196
- add_action( 'admin_print_scripts-' . $this->page, array( $this, 'admin_print_script' ) );
197
- add_action( 'admin_print_styles-' . $this->page, array( $this, 'admin_print_style' ) );
198
  }
199
 
200
  /**
201
- * Check if we're on the plugin page
202
  *
203
- * @since 0.2
204
- * @global type $page_hook
205
- * @return type
206
  */
207
- function is_wpbe_page() {
208
- global $page_hook;
 
209
 
210
- if ( $page_hook === $this->page ) {
211
- return true;
212
- }
 
213
 
214
- return false;
 
 
215
  }
216
 
217
  /**
@@ -226,7 +217,6 @@ For any requests, please contact %admin_email%';
226
  $protocol = isset( $_SERVER["HTTPS"] ) ? 'https://' : 'http://';
227
 
228
  $ajax_vars = array(
229
- 'url' => admin_url( 'admin-ajax.php', $protocol ),
230
  'nonce' => wp_create_nonce( 'email_preview' ),
231
  'action' => 'send_preview'
232
  );
@@ -265,6 +255,8 @@ For any requests, please contact %admin_email%';
265
  */
266
  function validate_options( $input ) {
267
 
 
 
268
  $from_email = strtolower( $input['from_email'] );
269
 
270
  // Checking emails
@@ -574,28 +566,19 @@ For any requests, please contact %admin_email%';
574
  * Help on template variables in contextual help
575
  *
576
  * @since 0.2
577
- * @global string $page
578
- * @param string $contextual_help
579
- * @param string $screen_id
580
- * @param string $screen
581
  */
582
- function contextual_help( $contextual_help, $screen_id, $screen ) {
583
- if ( ! $this->is_wpbe_page() ) {
584
- return $contextual_help;
585
- }
 
 
586
 
587
- return '<p>' . __( 'Some dynamic tags can be included in your email template :', 'wp-better-emails' ) . '</p>
588
- <ul>
589
- <li>' . __( '<strong>%content%</strong> : will be replaced with the message content.', 'wp-better-emails' ) . '<br />
590
- <span class="description"> ' . __( 'NOTE: The content tag is <strong>required</strong>, WP Better Emails will be automatically desactivated if no content tag is found.', 'wp-better-emails' ) . '</span></li>
591
- <li>' . __( '<strong>%blog_url%</strong> : will be replaced with your blog URL.', 'wp-better-emails' ) . '</li>
592
- <li>' . __( '<strong>%home_url%</strong> : will be replaced with your home URL.', 'wp-better-emails' ) . '</li>
593
- <li>' . __( '<strong>%blog_name%</strong> : will be replaced with your blog name.', 'wp-better-emails' ) . '</li>
594
- <li>' . __( '<strong>%blog_description%</strong> : will be replaced with your blog description.', 'wp-better-emails' ) . '</li>
595
- <li>' . __( '<strong>%admin_email%</strong> : will be replaced with admin email.', 'wp-better-emails' ) . '</li>
596
- <li>' . __( '<strong>%date%</strong> : will be replaced with current date, as formatted in <a href="options-general.php">general options</a>.', 'wp-better-emails' ) . '</li>
597
- <li>' . __( '<strong>%time%</strong> : will be replaced with current time, as formatted in <a href="options-general.php">general options</a>.', 'wp-better-emails' ) . '</li>
598
- </ul>';
599
  }
600
 
601
  /**
@@ -610,30 +593,8 @@ For any requests, please contact %admin_email%';
610
  * @return array
611
  */
612
  function tinymce_plugins( $external_plugins ) {
613
- global $wp_version;
614
-
615
- if ( ! $this->is_wpbe_page() ) {
616
- return $external_plugins;
617
- }
618
-
619
- $fullpage = array();
620
-
621
- if ( version_compare( $wp_version, '3.2', '<' ) ) {
622
- $fullpage = array(
623
- 'fullpage' => plugins_url( 'tinymce-plugins/3.3.x/fullpage/editor_plugin.js', __FILE__ )
624
- );
625
- } else {
626
- $fullpage = array(
627
- 'fullpage' => plugins_url( 'tinymce-plugins/3.4.x/fullpage/editor_plugin.js', __FILE__ )
628
- );
629
- }
630
-
631
- $cmseditor = array(
632
- 'cmseditor' => plugins_url( 'tinymce-plugins/cmseditor/editor_plugin.js', __FILE__ )
633
- );
634
-
635
- $external_plugins = $external_plugins + $fullpage + $cmseditor;
636
-
637
  return $external_plugins;
638
  }
639
 
@@ -647,10 +608,7 @@ For any requests, please contact %admin_email%';
647
  * @return type
648
  */
649
  function tinymce_buttons( $buttons ) {
650
- if ( $this->is_wpbe_page() ) {
651
- array_push( $buttons, 'cmseditor' );
652
- }
653
-
654
  return $buttons;
655
  }
656
 
@@ -661,11 +619,7 @@ For any requests, please contact %admin_email%';
661
  * @return boolean
662
  */
663
  function tinymce_config( $init ) {
664
- if ( ! $this->is_wpbe_page() )
665
- return $init;
666
-
667
- $init['remove_linebreaks'] = false;
668
- $init['content_css'] = ''; // WP =< 3.0
669
 
670
  if ( isset( $init['extended_valid_elements'] ) ) {
671
  $init['extended_valid_elements'] = $init['extended_valid_elements'] . ',td[*]';
@@ -674,24 +628,6 @@ For any requests, please contact %admin_email%';
674
  return $init;
675
  }
676
 
677
- /**
678
- * Load WP tinyMCE editor
679
- *
680
- * @since 0.2
681
- */
682
- function load_wp_tiny_mce() {
683
- if ( ! $this->is_wpbe_page() ) {
684
- return;
685
- }
686
-
687
- $settings = array(
688
- 'editor_selector' => 'wpbe_template',
689
- 'height' => '400'
690
- );
691
-
692
- wp_tiny_mce( false, $settings );
693
- }
694
-
695
  /**
696
  * Print WP TinyMCE editor to edit template
697
  *
@@ -699,23 +635,12 @@ For any requests, please contact %admin_email%';
699
  * @global string $wp_version
700
  */
701
  function template_editor() {
702
- global $wp_version;
703
-
704
- if ( version_compare( $wp_version, '3.2.1', '<=' ) ) {
705
- ?>
706
- <textarea id="wpbe_template" class="wpbe_template" name="wpbe_options[template]" cols="80" rows="10"><?php echo $this->options['template']; ?></textarea>
707
- <?php
708
- } else {
709
- // WP >= 3.3
710
- $settings = array(
711
- 'wpautop' => false,
712
- 'editor_class' => 'wpbe_template',
713
- 'quicktags' => false,
714
- 'textarea_name' => 'wpbe_options[template]'
715
- );
716
-
717
- wp_editor( $this->options['template'], 'wpbe_template', $settings );
718
- }
719
  }
720
 
721
  /**
3
  Plugin Name: WP Better Emails
4
  Plugin URI: http://wordpress.org/extend/plugins/wp-better-emails/
5
  Description: Beautify the default text/plain WP mails into fully customizable HTML emails.
6
+ Version: 0.4
7
  Author: Nicolas Lemoine
8
  Author URI: http://wordpress.org/extend/plugins/wp-better-emails/
9
  License: GPLv2
29
 
30
  if ( ! class_exists( 'WP_Better_Emails' ) ) {
31
 
32
+ if ( ! defined( 'WPBE_JS_URL' ) ) {
33
+ define( 'WPBE_JS_URL', plugin_dir_url( __FILE__ ) . 'dist/js' );
34
+ }
35
 
36
+ if ( ! defined( 'WPBE_CSS_URL' ) ) {
37
+ define( 'WPBE_CSS_URL', plugin_dir_url( __FILE__ ) . 'dist/css' );
38
+ }
39
 
40
  class WP_Better_Emails {
41
 
42
+ var $options = [];
43
  var $page = '';
44
  var $send_as_html;
45
 
71
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
72
  add_action( 'wp_ajax_send_preview', array( $this, 'ajax_send_preview' ) );
73
 
 
 
 
 
 
 
 
 
74
  // Filters
75
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'settings_link' ) );
 
 
 
 
76
 
77
  }
78
 
94
 
95
  // HTML default template
96
  $template = '';
97
+ @require 'templates/template.php';
98
 
99
  // Plain-text default template
100
+ ob_start();
101
+ ?>
102
+ %content%
103
 
104
  ---
105
 
106
  Email sent %date% @ %time%
107
+ For any requests, please contact %admin_email%'
108
+ <?php
109
+ $plaintext = ob_get_clean();
110
 
111
  // Setup options array
112
  $this->options = array(
129
  */
130
  function init() {
131
  register_setting( 'wpbe_full_options', 'wpbe_options', array( $this, 'validate_options' ) );
132
+ wp_register_script( 'wpbe-admin-script', WPBE_JS_URL . '/admin.js',['jquery', 'thickbox'], null, true );
133
+ wp_register_style( 'wpbe-admin-style', WPBE_CSS_URL . '/wpbe.css' );
134
  }
135
 
136
  /**
154
  * @global $wp_version
155
  */
156
  function activate() {
 
 
 
 
 
 
 
 
 
157
  if ( ! is_multisite() ) {
158
  $this->set_options();
159
  } else {
167
  }
168
  }
169
  }
 
170
  }
171
 
172
  /**
175
  * @since 0.1
176
  */
177
  function admin_menu() {
178
+ $this->page = add_options_page(
179
+ __( 'Email settings', 'wp-better-emails' ),
180
+ __( 'WP Better Emails', 'wp-better-emails' ),
181
+ 'administrator',
182
+ 'wpbe_options',
183
+ array( $this, 'admin_page' )
184
+ );
185
 
186
+ add_action( 'load-' . $this->page, [$this, 'load_hooks']);
 
187
  }
188
 
189
  /**
190
+ * Fire WP Better Emails admin page hooks
191
  *
192
+ * @since 0.5
 
 
193
  */
194
+ function load_hooks() {
195
+ // Add help tab
196
+ $this->add_help_tab();
197
 
198
+ // Tiny MCE
199
+ add_filter( 'mce_external_plugins', array( $this, 'tinymce_plugins' ) );
200
+ add_filter( 'mce_buttons', array( $this, 'tinymce_buttons' ) );
201
+ add_filter( 'tiny_mce_before_init', array( $this, 'tinymce_config' ) );
202
 
203
+ // Scripts & styles
204
+ add_action( 'admin_print_scripts', array( $this, 'admin_print_script' ) );
205
+ add_action( 'admin_print_styles', array( $this, 'admin_print_style' ) );
206
  }
207
 
208
  /**
217
  $protocol = isset( $_SERVER["HTTPS"] ) ? 'https://' : 'http://';
218
 
219
  $ajax_vars = array(
 
220
  'nonce' => wp_create_nonce( 'email_preview' ),
221
  'action' => 'send_preview'
222
  );
255
  */
256
  function validate_options( $input ) {
257
 
258
+ return $input;
259
+
260
  $from_email = strtolower( $input['from_email'] );
261
 
262
  // Checking emails
566
  * Help on template variables in contextual help
567
  *
568
  * @since 0.2
 
 
 
 
569
  */
570
+ function add_help_tab() {
571
+ $screen = get_current_screen();
572
+
573
+ ob_start();
574
+ require 'views/help.php';
575
+ $content = ob_get_clean();
576
 
577
+ $screen->add_help_tab([
578
+ 'id' => 'wpbe_help',
579
+ 'title' => 'Template help',
580
+ 'content' => $content,
581
+ ]);
 
 
 
 
 
 
 
582
  }
583
 
584
  /**
593
  * @return array
594
  */
595
  function tinymce_plugins( $external_plugins ) {
596
+ $external_plugins['codemirror'] = plugins_url('dist/js/plugins/codemirror/plugin.js', __FILE__);
597
+ $external_plugins['fullpage'] = plugins_url('dist/js/plugins/fullpage.js', __FILE__);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
598
  return $external_plugins;
599
  }
600
 
608
  * @return type
609
  */
610
  function tinymce_buttons( $buttons ) {
611
+ array_push( $buttons, 'code' );
 
 
 
612
  return $buttons;
613
  }
614
 
619
  * @return boolean
620
  */
621
  function tinymce_config( $init ) {
622
+ // $init['remove_linebreaks'] = false;
 
 
 
 
623
 
624
  if ( isset( $init['extended_valid_elements'] ) ) {
625
  $init['extended_valid_elements'] = $init['extended_valid_elements'] . ',td[*]';
628
  return $init;
629
  }
630
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
631
  /**
632
  * Print WP TinyMCE editor to edit template
633
  *
635
  * @global string $wp_version
636
  */
637
  function template_editor() {
638
+ wp_editor( $this->options['template'], 'wpbe_template', [
639
+ 'wpautop' => false,
640
+ 'editor_class' => 'wpbe_template',
641
+ 'quicktags' => false,
642
+ 'textarea_name' => 'wpbe_options[template]'
643
+ ] );
 
 
 
 
 
 
 
 
 
 
 
644
  }
645
 
646
  /**