diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2015-07-11 15:26:48 -0700 |
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2015-07-11 15:26:48 -0700 |
| commit | c94eff6021ef963f08f67da501e756d53a61c50d (patch) | |
| tree | 002b414cfdbc6bf8dae08ff85afacb75ccdc723c /httemplate/elements/ckeditor/samples/toolbarconfigurator | |
| parent | 0736a91a87c46f7097ddef9782ddbb59a0ce3304 (diff) | |
update CKeditor
Diffstat (limited to 'httemplate/elements/ckeditor/samples/toolbarconfigurator')
19 files changed, 1369 insertions, 0 deletions
diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/css/fontello.css b/httemplate/elements/ckeditor/samples/toolbarconfigurator/css/fontello.css new file mode 100644 index 000000000..d98370795 --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/css/fontello.css @@ -0,0 +1,55 @@ +@font-face {
+ font-family: 'fontello';
+ src: url('../font/fontello.eot?89024372');
+ src: url('../font/fontello.eot?89024372#iefix') format('embedded-opentype'),
+ url('../font/fontello.woff?89024372') format('woff'),
+ url('../font/fontello.ttf?89024372') format('truetype'),
+ url('../font/fontello.svg?89024372#fontello') format('svg');
+ font-weight: normal;
+ font-style: normal;
+}
+/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
+/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
+/*
+@media screen and (-webkit-min-device-pixel-ratio:0) {
+ @font-face {
+ font-family: 'fontello';
+ src: url('../font/fontello.svg?89024372#fontello') format('svg');
+ }
+}
+*/
+
+ [class^="icon-"]:before, [class*=" icon-"]:before {
+ font-family: "fontello";
+ font-style: normal;
+ font-weight: normal;
+ speak: none;
+
+ display: inline-block;
+ text-decoration: inherit;
+ width: 1em;
+ margin-right: .2em;
+ text-align: center;
+ /* opacity: .8; */
+
+ /* For safety - reset parent styles, that can break glyph codes*/
+ font-variant: normal;
+ text-transform: none;
+
+ /* fix buttons height, for twitter bootstrap */
+ line-height: 1em;
+
+ /* Animation center compensation - margins should be symmetric */
+ /* remove if not needed */
+ margin-left: .2em;
+
+ /* you can be more comfortable with increased icons size */
+ /* font-size: 120%; */
+
+ /* Uncomment for 3D effect */
+ /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
+}
+
+.icon-trash:before { content: '\e802'; } /* '' */
+.icon-down-big:before { content: '\e800'; } /* '' */
+.icon-up-big:before { content: '\e801'; } /* '' */
diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/LICENSE.txt b/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/LICENSE.txt new file mode 100644 index 000000000..4a73f6c97 --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/LICENSE.txt @@ -0,0 +1,10 @@ +Font license info
+
+
+## Font Awesome
+
+ Copyright (C) 2012 by Dave Gandy
+
+ Author: Dave Gandy
+ License: SIL ()
+ Homepage: http://fortawesome.github.com/Font-Awesome/
diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/config.json b/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/config.json new file mode 100644 index 000000000..94809d70d --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/config.json @@ -0,0 +1,28 @@ +{ + "name": "", + "css_prefix_text": "icon-", + "css_use_suffix": false, + "hinting": true, + "units_per_em": 1000, + "ascent": 850, + "glyphs": [ + { + "uid": "f48ae54adfb27d8ada53d0fd9e34ee10", + "css": "trash-empty", + "code": 59392, + "src": "fontawesome" + }, + { + "uid": "1c4068ed75209e21af36017df8871802", + "css": "down-big", + "code": 59393, + "src": "fontawesome" + }, + { + "uid": "95376bf082bfec6ce06ea1cda7bd7ead", + "css": "up-big", + "code": 59394, + "src": "fontawesome" + } + ] +}
\ No newline at end of file diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/fontello.eot b/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/fontello.eot Binary files differnew file mode 100644 index 000000000..2732fad4b --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/fontello.eot diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/fontello.svg b/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/fontello.svg new file mode 100644 index 000000000..33d14ac83 --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/fontello.svg @@ -0,0 +1,14 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg xmlns="http://www.w3.org/2000/svg"> +<metadata>Copyright (C) 2014 by original authors @ fontello.com</metadata> +<defs> +<font id="fontello" horiz-adv-x="1000" > +<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" /> +<missing-glyph horiz-adv-x="1000" /> +<glyph glyph-name="trash" unicode="" d="m286 439v-321q0-8-5-13t-13-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q8 0 13-5t5-13z m143 0v-321q0-8-5-13t-13-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q8 0 13-5t5-13z m142 0v-321q0-8-5-13t-12-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q7 0 12-5t5-13z m72-404v529h-500v-529q0-12 4-22t8-15t6-5h464q2 0 6 5t8 15t4 22z m-375 601h250l-27 65q-4 5-9 6h-177q-6-1-10-6z m518-18v-36q0-8-5-13t-13-5h-54v-529q0-46-26-80t-63-34h-464q-37 0-63 33t-27 79v531h-53q-8 0-13 5t-5 13v36q0 8 5 13t13 5h172l39 93q9 21 31 35t44 15h178q22 0 44-15t30-35l39-93h173q8 0 13-5t5-13z" horiz-adv-x="785.7" /> +<glyph glyph-name="down-big" unicode="" d="m899 386q0-30-21-50l-363-364q-22-21-51-21q-29 0-50 21l-363 364q-21 20-21 50q0 29 21 51l41 41q22 21 51 21q29 0 50-21l164-164v393q0 29 21 50t51 22h71q29 0 50-22t21-50v-393l164 164q21 21 51 21q29 0 50-21l42-42q21-21 21-50z" horiz-adv-x="928.6" /> +<glyph glyph-name="up-big" unicode="" d="m899 308q0-28-21-50l-42-42q-21-21-50-21q-30 0-51 21l-164 164v-393q0-29-20-47t-51-19h-71q-30 0-51 19t-21 47v393l-164-164q-20-21-50-21t-50 21l-42 42q-21 21-21 50q0 30 21 51l363 363q20 21 50 21q30 0 51-21l363-363q21-22 21-51z" horiz-adv-x="928.6" /> +</font> +</defs> +</svg>
\ No newline at end of file diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/fontello.ttf b/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/fontello.ttf Binary files differnew file mode 100644 index 000000000..fbcbf06af --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/fontello.ttf diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/fontello.woff b/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/fontello.woff Binary files differnew file mode 100644 index 000000000..e1d56472f --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/font/fontello.woff diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/index.html b/httemplate/elements/ckeditor/samples/toolbarconfigurator/index.html new file mode 100644 index 000000000..44af76b92 --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/index.html @@ -0,0 +1,446 @@ +<!DOCTYPE html>
+<!--
+Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
+For licensing, see LICENSE.md or http://ckeditor.com/license
+-->
+<!--[if IE 8]><html class="ie8"><![endif]-->
+<!--[if gt IE 8]><html><![endif]-->
+<!--[if !IE]><!--><html><!--<![endif]-->
+<head>
+ <meta charset="utf-8">
+ <title>Toolbar Configurator</title>
+ <script src="../../ckeditor.js"></script>
+ <script>
+ if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
+ CKEDITOR.tools.enableHtml5Elements( document );
+ </script>
+ <link rel="stylesheet" href="lib/codemirror/codemirror.css">
+ <link rel="stylesheet" href="lib/codemirror/show-hint.css">
+ <link rel="stylesheet" href="lib/codemirror/neo.css">
+ <link rel="stylesheet" href="css/fontello.css">
+ <link rel="stylesheet" href="../css/samples.css">
+</head>
+<body id="toolbar">
+
+<nav class="navigation-a">
+ <div class="grid-container">
+ <ul class="navigation-a-left grid-width-70">
+ <li><a href="http://ckeditor.com">Project Homepage</a></li>
+ <li><a href="http://dev.ckeditor.com/">I found a bug</a></li>
+ <li><a href="http://github.com/ckeditor/ckeditor-dev" class="icon-pos-right icon-navigation-a-github">Fork CKEditor on GitHub</a></li>
+ </ul>
+ <ul class="navigation-a-right grid-width-30">
+ <li><a href="http://ckeditor.com/blog-list">CKEditor Blog</a></li>
+ </ul>
+ </div>
+</nav>
+
+<header class="header-a">
+ <div class="grid-container">
+ <h1 class="header-a-logo grid-width-30">
+ <a href="../index.html"><img src="../img/logo.png" alt="CKEditor Logo"></a>
+ </h1>
+ <nav class="navigation-b grid-width-70">
+ <ul>
+ <li><a href="../index.html" class="button-a">Start</a></li>
+ <li><a href="index.html" class="button-a button-a-background">Toolbar configurator</a></li>
+ </ul>
+ </nav>
+ </div>
+</header>
+
+<main>
+ <div class="adjoined-top">
+ <div class="grid-container">
+ <div class="content grid-width-100">
+ <div class="grid-container-nested">
+ <h1 class="grid-width-60">
+ Toolbar Configurator
+ <a href="#help-content" type="button" title="Configurator help" id="help" class="button-a button-a-background button-a-no-text icon-pos-left icon-question-mark">Help</a>
+ </h1>
+
+ <div class="grid-width-40 grid-switch-magic">
+ <div class="switch">
+ <span class="balloon-a balloon-a-se">Select configurator type</span>
+ <input type="radio" name="radio" data-num="1" id="radio-basic" />
+ <input type="radio" name="radio" data-num="2" id="radio-advanced" />
+ <label data-for="1" for="radio-basic">Basic</label>
+ <span class="switch-inner">
+ <span class="handler"></span>
+ </span>
+ <label data-for="2" for="radio-advanced">Advanced</label>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="adjoined-bottom">
+ <div class="grid-container">
+ <div class="grid-width-100">
+ <div class="editors-container">
+ <div id="editor-basic"></div>
+ <div id="editor-advanced"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="grid-container configurator">
+ <div class="content grid-width-100">
+ <div class="configurator">
+ <div>
+ <div id="toolbarModifierWrapper"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div id="help-content">
+ <div class="grid-container">
+ <div class="grid-width-100">
+ <h2>What Am I Doing Here?</h2>
+
+ <div class="grid-container grid-container-nested">
+ <div class="basic">
+ <div class="grid-width-50">
+ <p>Arrange <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-toolbarGroups">toolbar groups</a>, toggle <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-removeButtons">button visibility</a> according to your needs and get your toolbar configuration.</p>
+ <p>You can replace the content of the <a href="../../config.js"><code>config.js</code></a> file with the generated configuration. If you already set some configuration options you will need to merge both configurations.</p>
+ </div>
+ <div class="grid-width-50">
+ <p>Read more about different ways of <a href="http://docs.ckeditor.com/#!/guide/dev_configuration">setting configuration</a> and do not forget about <strong>clearing browser cache</strong>.</p>
+ <p>Arranging toolbar groups is the recommended way of configuring the toolbar, but if you need more freedom you can use the <a href="#advanced">advanced configurator</a>.</p>
+ </div>
+ </div>
+ <div class="advanced" style="display: none;">
+ <div class="grid-width-50">
+ <p>With this code editor you can edit your <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-toolbar">toolbar configuration</a> live.</p>
+ <p>You can replace the content of the <a href="../../config.js"><code>config.js</code></a> file with the generated configuration. If you already set some configuration options you will need to merge both configurations.</p>
+ </div>
+ <div class="grid-width-50">
+ <p>Read more about different ways of <a href="http://docs.ckeditor.com/#!/guide/dev_configuration">setting configuration</a> and do not forget about <strong>clearing browser cache</strong>.</p>
+ </div>
+ </div>
+ </div>
+
+ <p class="grid-container grid-container-nested">
+ <button type="button" class="help-content-close grid-width-100 button-a button-a-background">Got it. Let's play!</button>
+ </p>
+ </div>
+ </div>
+ </div>
+</main>
+
+<footer class="footer-a grid-container">
+ <p class="grid-width-100">
+ CKEditor – The text editor for the Internet – <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
+ </p>
+ <p class="grid-width-100" id="copy">
+ Copyright © 2003-2015, <a class="samples" href="http://cksource.com/">CKSource</a> – Frederico Knabben. All rights reserved.
+ </p>
+</footer>
+
+<script src="lib/codemirror/codemirror.js"></script>
+<script src="lib/codemirror/javascript.js"></script>
+<script src="lib/codemirror/show-hint.js"></script>
+
+<script src="js/fulltoolbareditor.js"></script>
+<script src="js/abstracttoolbarmodifier.js"></script>
+<script src="js/toolbarmodifier.js"></script>
+<script src="js/toolbartextmodifier.js"></script>
+<script src="../js/sf.js"></script>
+
+<script>
+ ( function() {
+ 'use strict';
+
+ var mode = ( window.location.hash.substr( 1 ) === 'advanced' ) ? 'advanced' : 'basic',
+ configuratorSection = CKEDITOR.document.findOne( 'main > .grid-container.configurator' ),
+ basicInstruction = CKEDITOR.document.findOne( '#help-content .basic' ),
+ advancedInstruction = CKEDITOR.document.findOne( '#help-content .advanced' ),
+
+ // Configurator mode switcher.
+ modeSwitchBasic = CKEDITOR.document.getById( 'radio-basic' ),
+ modeSwitchAdvanced = CKEDITOR.document.getById( 'radio-advanced' );
+
+ // Initial setup
+ function updateSwitcher() {
+ if ( mode === 'advanced' ) {
+ modeSwitchAdvanced.$.checked = true;
+ } else {
+ modeSwitchBasic.$.checked = true;
+ }
+ }
+
+ updateSwitcher();
+
+ CKEDITOR.document.getWindow().on( 'hashchange', function( e ) {
+ var hash = window.location.hash.substr( 1 );
+ if ( !( hash === 'advanced' || hash === 'basic' ) ) {
+ return;
+ }
+ mode = hash;
+ onToolbarsDone( mode );
+ } );
+
+ CKEDITOR.document.getWindow().on( 'resize', function() {
+ updateToolbar( ( mode === 'basic' ? toolbarModifier : toolbarTextModifier )[ 'editorInstance' ] );
+ } );
+
+ function onRefresh( modifier ) {
+ modifier = modifier || this;
+
+ if ( mode === 'basic' && modifier instanceof ToolbarConfigurator.ToolbarTextModifier ) {
+ return;
+ }
+
+ // CodeMirror container becomes visible, so we need to refresh and to avoid rendering problems.
+ if ( mode === 'advanced' && modifier instanceof ToolbarConfigurator.ToolbarTextModifier ) {
+ modifier.codeContainer.refresh();
+ }
+
+ updateToolbar( modifier.editorInstance );
+ }
+
+ function updateToolbar( editor ) {
+ var editorContainer = editor.container;
+
+ // Not always editor is loaded.
+ if ( !editorContainer ) {
+ return;
+ }
+
+ var displayStyle = editorContainer.getStyle( 'display' );
+
+ editorContainer.setStyle( 'display', 'block' );
+
+ var newHeight = editorContainer.getSize( 'height' );
+
+ var newMarginTop = parseInt( editorContainer.getComputedStyle( 'margin-top' ), 10 );
+ newMarginTop = ( isNaN( newMarginTop ) ? 0 : Number( newMarginTop ) );
+
+ var newMarginBottom = parseInt( editorContainer.getComputedStyle( 'margin-bottom' ), 10 );
+ newMarginBottom = ( isNaN( newMarginBottom ) ? 0 : Number( newMarginBottom ) );
+
+ var result = newHeight + newMarginTop + newMarginBottom;
+
+ editorContainer.setStyle( 'display', displayStyle );
+
+ editor.container.getAscendant( 'div' ).setStyle( 'height', result + 'px' );
+ }
+
+ var toolbarModifier = new ToolbarConfigurator.ToolbarModifier( 'editor-basic' );
+
+ var done = 0;
+ toolbarModifier.init( onToolbarInit );
+ toolbarModifier.onRefresh = onRefresh;
+
+ CKEDITOR.document.getById( 'toolbarModifierWrapper' ).append( toolbarModifier.mainContainer );
+
+ var toolbarTextModifier = new ToolbarConfigurator.ToolbarTextModifier( 'editor-advanced' );
+ toolbarTextModifier.init( onToolbarInit );
+ toolbarTextModifier.onRefresh = onRefresh;
+
+ function onToolbarInit() {
+ if ( ++done === 2 ) {
+ onToolbarsDone();
+
+ positionSticky.watch( CKEDITOR.document.findOne( '.toolbar' ), function() {
+ return mode === 'advanced';
+ } );
+ }
+ }
+
+ function onToolbarsDone() {
+ if ( mode === 'basic' ) {
+ toggleModeBasic( false );
+ } else {
+ toggleModeAdvanced( false );
+ }
+
+ updateSwitcher();
+
+ setTimeout( function() {
+ CKEDITOR.document.findOne( '.editors-container' ).addClass( 'active' );
+ CKEDITOR.document.findOne( '#toolbarModifierWrapper' ).addClass( 'active' );
+ }, 200 );
+ }
+
+ CKEDITOR.document.getById( 'toolbarModifierWrapper' ).append( toolbarTextModifier.mainContainer );
+
+ function toogleModeSwitch( onElement, offElement, onModifier, offModifier ) {
+ onElement.addClass( 'fancy-button-active' );
+ offElement.removeClass( 'fancy-button-active' );
+
+ onModifier.showUI();
+ offModifier.hideUI();
+ }
+
+ function toggleModeBasic( callOnRefresh ) {
+ callOnRefresh = ( callOnRefresh !== false );
+ mode = 'basic';
+ window.location.hash = '#basic';
+ toogleModeSwitch( modeSwitchBasic, modeSwitchAdvanced, toolbarModifier, toolbarTextModifier );
+
+ configuratorSection.removeClass( 'freed-width' );
+ basicInstruction.show();
+ advancedInstruction.hide();
+
+ callOnRefresh && onRefresh( toolbarModifier );
+ }
+
+ function toggleModeAdvanced( callOnRefresh ) {
+ callOnRefresh = ( callOnRefresh !== false );
+ mode = 'advanced';
+ window.location.hash = '#advanced';
+ toogleModeSwitch( modeSwitchAdvanced, modeSwitchBasic, toolbarTextModifier, toolbarModifier );
+
+ configuratorSection.addClass( 'freed-width' );
+ advancedInstruction.show();
+ basicInstruction.hide();
+
+ callOnRefresh && onRefresh( toolbarTextModifier );
+ }
+
+ modeSwitchBasic.on( 'click', toggleModeBasic );
+ modeSwitchAdvanced.on( 'click', toggleModeAdvanced );
+
+ //
+ // Position:sticky for the toolbar.
+ //
+
+ // Will make elements behave like they were styled with position:sticky.
+ var positionSticky = {
+ // Store object: {
+ // element: CKEDITOR.dom.element, // Element which will float.
+ // placeholder: CKEDITOR.dom.element, // Placeholder which is place to prevent page bounce.
+ // isFixed: boolean // Whether element float now.
+ // }
+ watched: [],
+
+ active: [],
+
+ staticContainer: null,
+
+ init: function() {
+ var element = CKEDITOR.dom.element.createFromHtml(
+ '<div class="staticContainer">' +
+ '<div class="grid-container" >' +
+ '<div class="grid-width-100">' +
+ '<div class="inner"></div>' +
+ '</div>' +
+ '</div>' +
+ '</div>' );
+
+ this.staticContainer = element.findOne( '.inner' );
+
+ CKEDITOR.document.getBody().append( element );
+ },
+
+ watch: function( element, preventFunc ) {
+ this.watched.push( {
+ element: element,
+ placeholder: new CKEDITOR.dom.element( 'div' ),
+ isFixed: false,
+ preventFunc: preventFunc
+ } );
+ },
+
+ checkAll: function() {
+ for ( var i = 0; i < this.watched.length; i++ ) {
+ this.check( this.watched[ i ] );
+ }
+ },
+
+ check: function( element ) {
+ var isFixed = element.isFixed;
+ var shouldBeFixed = this.shouldBeFixed( element );
+
+ // Nothing to be done.
+ if ( isFixed === shouldBeFixed ) {
+ return;
+ }
+
+ var placeholder = element.placeholder;
+
+ if ( isFixed ) {
+ // Unfixing.
+
+ element.element.insertBefore( placeholder );
+ placeholder.remove();
+
+ element.element.removeStyle( 'margin' );
+
+ this.active.splice( CKEDITOR.tools.indexOf( this.active, element ), 1 );
+
+ } else {
+ // Fixing.
+ placeholder.setStyle( 'width', element.element.getSize( 'width' ) + 'px' );
+ placeholder.setStyle( 'height', element.element.getSize( 'height' ) + 'px' );
+ placeholder.setStyle( 'margin-bottom', element.element.getComputedStyle( 'margin-bottom' ) );
+ placeholder.setStyle( 'display', element.element.getComputedStyle( 'display' ) );
+ placeholder.insertAfter( element.element );
+
+ this.staticContainer.append( element.element );
+
+ this.active.push( element );
+ }
+
+ element.isFixed = !element.isFixed;
+ },
+
+ shouldBeFixed: function( element ) {
+ if ( element.preventFunc && element.preventFunc() ) {
+ return false;
+ }
+
+ // If element is already fixed we are checking it's placeholder.
+ var related = ( element.isFixed ? element.placeholder : element.element ),
+ clientRect = related.$.getBoundingClientRect(),
+ staticHeight = this.staticContainer.getSize('height' ),
+ elemHeight = element.element.getSize( 'height' );
+
+ if ( element.isFixed ) {
+ return ( clientRect.top + elemHeight < staticHeight );
+ } else {
+ return ( clientRect.top < staticHeight );
+ }
+ }
+ };
+
+ positionSticky.init();
+
+ CKEDITOR.document.getWindow().on( 'scroll',
+ new CKEDITOR.tools.eventsBuffer( 100, positionSticky.checkAll, positionSticky ).input
+ );
+
+ // Make the toolbar sticky.
+ positionSticky.watch( CKEDITOR.document.findOne( '.editors-container' ) );
+
+ // Help button and help-content.
+ ( function() {
+ var helpButton = CKEDITOR.document.getById( 'help' ),
+ helpContent = CKEDITOR.document.getById( 'help-content' );
+
+ // Don't show help button on IE8 because it's unsupported by Pico Modal.
+ if ( CKEDITOR.env.ie && CKEDITOR.env.version == 8 ) {
+ helpButton.hide();
+ } else {
+ // Display help modal when the button is clicked.
+ helpButton.on( 'click', function( evt ) {
+ SF.modal( {
+ // Clone modal content from DOM.
+ content: helpContent.getHtml(),
+
+ afterCreate: function( modal ) {
+ // Enable modal content button to close the modal.
+ new CKEDITOR.dom.element( modal.modalElem() ).findOne( '.help-content-close' ).once( 'click', modal.close );
+ }
+ } ).show();
+ } );
+ }
+ } )();
+ } )();
+</script>
+</body>
+</html>
diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/js/abstracttoolbarmodifier.js b/httemplate/elements/ckeditor/samples/toolbarconfigurator/js/abstracttoolbarmodifier.js new file mode 100644 index 000000000..42bed3711 --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/js/abstracttoolbarmodifier.js @@ -0,0 +1,14 @@ +"function"!=typeof Object.create&&function(){var b=function(){};Object.create=function(a){if(1<arguments.length)throw Error("Second argument not supported");if(null===a)throw Error("Cannot set a null [[Prototype]]");if("object"!=typeof a)throw TypeError("Argument must be an object");b.prototype=a;return new b}}(); +CKEDITOR.plugins.add("toolbarconfiguratorarea",{afterInit:function(b){b.addMode("wysiwyg",function(a){var c=CKEDITOR.dom.element.createFromHtml('<div class="cke_wysiwyg_div cke_reset" hidefocus="true"></div>');b.ui.space("contents").append(c);c=b.editable(c);c.detach=CKEDITOR.tools.override(c.detach,function(a){return function(){a.apply(this,arguments);this.remove()}});b.setData(b.getData(1),a);b.fire("contentDom")});b.dataProcessor.toHtml=function(a){return a};b.dataProcessor.toDataFormat=function(a){return a}}}); +Object.keys||(Object.keys=function(){var b=Object.prototype.hasOwnProperty,a=!{toString:null}.propertyIsEnumerable("toString"),c="toString toLocaleString valueOf hasOwnProperty isPrototypeOf propertyIsEnumerable constructor".split(" "),e=c.length;return function(d){if("object"!==typeof d&&("function"!==typeof d||null===d))throw new TypeError("Object.keys called on non-object");var g=[],f;for(f in d)b.call(d,f)&&g.push(f);if(a)for(f=0;f<e;f++)b.call(d,c[f])&&g.push(c[f]);return g}}()); +(function(){function b(a,c){this.cfg=c||{};this.hidden=false;this.editorId=a;this.fullToolbarEditor=new ToolbarConfigurator.FullToolbarEditor;this.actualConfig=this.originalConfig=this.mainContainer=null;this.isEditableVisible=this.waitForReady=false;this.toolbarContainer=null;this.toolbarButtons=[]}ToolbarConfigurator.AbstractToolbarModifier=b;b.prototype.setConfig=function(a){this._onInit(void 0,a,true)};b.prototype.init=function(a){var c=this;this.mainContainer=new CKEDITOR.dom.element("div"); +if(this.fullToolbarEditor.editorInstance!==null)throw"Only one instance of ToolbarModifier is allowed";this.editorInstance||this._createEditor(false);this.editorInstance.once("loaded",function(){c.fullToolbarEditor.init(function(){c._onInit(a);if(typeof c.onRefresh=="function")c.onRefresh()},c.editorInstance.config)});return this.mainContainer};b.prototype._onInit=function(a,c){this.originalConfig=this.editorInstance.config;this.actualConfig=c?JSON.parse(c):JSON.parse(JSON.stringify(this.originalConfig)); +if(!this.actualConfig.toolbarGroups&&!this.actualConfig.toolbar){for(var b=this.actualConfig,d=this.editorInstance.toolbar,g=[],f=d.length,i=0;i<f;i++){var h=d[i];typeof h=="string"?g.push(h):g.push({name:h.name,groups:h.groups?h.groups.slice():[]})}b.toolbarGroups=g}typeof a==="function"&&a(this.mainContainer)};b.prototype._createModifier=function(){this.mainContainer.addClass("unselectable");this.modifyContainer&&this.modifyContainer.remove();this.modifyContainer=new CKEDITOR.dom.element("div"); +this.modifyContainer.addClass("toolbarModifier");this.mainContainer.append(this.modifyContainer);return this.mainContainer};b.prototype.getEditableArea=function(){return this.editorInstance.container.findOne("#"+this.editorInstance.id+"_contents")};b.prototype._hideEditable=function(){var a=this.getEditableArea();this.isEditableVisible=false;this.lastEditableAreaHeight=a.getStyle("height");a.setStyle("height","0")};b.prototype._showEditable=function(){this.isEditableVisible=true;this.getEditableArea().setStyle("height", +this.lastEditableAreaHeight||"auto")};b.prototype._toggleEditable=function(){this.isEditableVisible?this._hideEditable():this._showEditable()};b.prototype._refreshEditor=function(){function a(){c.editorInstance.destroy();c._createEditor(true,c.getActualConfig());c.waitForReady=false}var c=this,b=this.editorInstance.status;if(!this.waitForReady)if(b=="unloaded"||b=="loaded"){this.waitForReady=true;this.editorInstance.once("instanceReady",function(){a()},this)}else a()};b.prototype._createEditor=function(a, +c){function e(){}var d=this;this.editorInstance=CKEDITOR.replace(this.editorId);this.editorInstance.on("configLoaded",function(){var a=d.editorInstance.config;c&&CKEDITOR.tools.extend(a,c,true);b.extendPluginsConfig(a)});this.editorInstance.on("uiSpace",function(a){a.data.space!="top"&&a.stop()},null,null,-999);this.editorInstance.once("loaded",function(){var c=d.editorInstance.ui.instances,b;for(b in c)if(c[b]){c[b].click=e;c[b].onClick=e}d.isEditableVisible||d._hideEditable();d.currentActive&&d.currentActive.name&& +d._highlightGroup(d.currentActive.name);d.hidden?d.hideUI():d.showUI();if(a&&typeof d.onRefresh==="function")d.onRefresh()})};b.prototype.getActualConfig=function(){return JSON.parse(JSON.stringify(this.actualConfig))};b.prototype._createToolbar=function(){if(this.toolbarButtons.length){this.toolbarContainer=new CKEDITOR.dom.element("div");this.toolbarContainer.addClass("toolbar");for(var a=this.toolbarButtons.length,c=0;c<a;c=c+1)this._createToolbarBtn(this.toolbarButtons[c])}};b.prototype._createToolbarBtn= +function(a){var c=ToolbarConfigurator.FullToolbarEditor.createButton(typeof a.text==="string"?a.text:a.text.inactive,a.cssClass);this.toolbarContainer.append(c);c.data("group",a.group);c.addClass(a.position);c.on("click",function(){a.clickCallback.call(this,c,a)},this);return c};b.prototype._fixGroups=function(a){for(var a=a.toolbarGroups||[],c=a.length,b=0;b<c;b=b+1){var d=a[b];if(d=="/"){d=a[b]={};d.type="separator";d.name="separator"+CKEDITOR.tools.getNextNumber()}else{d.groups=d.groups||[];if(CKEDITOR.tools.indexOf(d.groups, +d.name)==-1){this.editorInstance.ui.addToolbarGroup(d.name,d.groups[d.groups.length-1],d.name);d.groups.push(d.name)}this._fixSubgroups(d)}}};b.prototype._fixSubgroups=function(a){for(var a=a.groups,c=a.length,b=0;b<c;b=b+1){var d=a[b];a[b]={name:d,totalBtns:ToolbarConfigurator.ToolbarModifier.getTotalSubGroupButtonsNumber(d,this.fullToolbarEditor)}}};b.stringifyJSONintoOneLine=function(a,b){var b=b||{},e=JSON.stringify(a,null,""),e=e.replace(/\n/g,"");if(b.addSpaces){e=e.replace(/(\{|:|,|\[|\])/g, +function(a){return a+" "});e=e.replace(/(\])/g,function(a){return" "+a})}b.noQuotesOnKey&&(e=e.replace(/"(\w*)":/g,function(a,b){return b+":"}));b.singleQuotes&&(e=e.replace(/\"/g,"'"));return e};b.prototype.hideUI=function(){this.hidden=true;this.mainContainer.hide();this.editorInstance.container&&this.editorInstance.container.hide()};b.prototype.showUI=function(){this.hidden=false;this.mainContainer.show();this.editorInstance.container&&this.editorInstance.container.show()};b.extendPluginsConfig= +function(a){var b=a.extraPlugins,e=a.removePlugins;a.extraPlugins=(b?b+",":"")+"toolbarconfiguratorarea";a.removePlugins=(e?e+",":"")+"autogrow,dialogadvtab,elementspath,enterkey,floatingspace,htmlwriter,magicline,resize,sharedspace,tab,wysiwygarea"}})();
\ No newline at end of file diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/js/fulltoolbareditor.js b/httemplate/elements/ckeditor/samples/toolbarconfigurator/js/fulltoolbareditor.js new file mode 100644 index 000000000..2a84f71ad --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/js/fulltoolbareditor.js @@ -0,0 +1,9 @@ +window.ToolbarConfigurator={}; +(function(){function e(){this.instanceid="fte"+CKEDITOR.tools.getNextId();this.textarea=new CKEDITOR.dom.element("textarea");this.textarea.setAttributes({id:this.instanceid,name:this.instanceid,contentEditable:!0});this.editorInstance=this.buttons=null}ToolbarConfigurator.FullToolbarEditor=e;e.prototype.init=function(b){var a=this;document.body.appendChild(this.textarea.$);CKEDITOR.replace(this.instanceid);this.editorInstance=CKEDITOR.instances[this.instanceid];this.editorInstance.once("configLoaded",function(d){var c= +d.editor.config;delete c.removeButtons;delete c.toolbarGroups;delete c.toolbar;ToolbarConfigurator.AbstractToolbarModifier.extendPluginsConfig(c);d.editor.once("loaded",function(){a.buttons=e.toolbarToButtons(a.editorInstance.toolbar);a.buttonsByGroup=e.groupButtons(a.buttons);a.buttonNamesByGroup=a.groupButtonNamesByGroup(a.buttons);d.editor.container.hide();"function"===typeof b&&b(a.buttons)})})};e.prototype.groupButtonNamesByGroup=function(b){var a=this,b=e.groupButtons(b),d;for(d in b)b[d]=e.map(b[d], +function(b){return a.getCamelCasedButtonName(b.name)});return b};e.prototype.getGroupByName=function(b){for(var a=this.editorInstance.config.toolbarGroups||this.getFullToolbarGroupsConfig(),d=a.length,c=0;c<d;c+=1)if(a[c].name===b)return a[c];return null};e.prototype.getCamelCasedButtonName=function(b){var a=this.editorInstance.ui.items,d;for(d in a)if(a[d].name==b)return d;return null};e.prototype.getFullToolbarGroupsConfig=function(b){for(var b=!0===b?!0:!1,a=[],d=this.editorInstance.toolbar,c= +d.length,f=0;f<c;f+=1){var e=d[f],g={};"string"!=typeof e.name?b&&a.push("/"):(g.name=e.name,e.groups&&(g.groups=Array.prototype.slice.call(e.groups)),a.push(g))}return a};e.filter=function(b,a){for(var d=b&&b.length?b.length:0,c=[],f=0;f<d;f+=1)a(b[f])&&c.push(b[f]);return c};e.map=function(b,a){var d;if(CKEDITOR.tools.isArray(b)){d=[];for(var c=b.length,f=0;f<c;f+=1)d.push(a(b[f]))}else for(c in d={},b)d[c]=a(b[c]);return d};e.groupButtons=function(b){for(var a={},d=b.length,c=0;c<d;c+=1){var f= +b[c],e=f.toolbar.split(",")[0];a[e]=a[e]||[];a[e].push(f)}return a};e.toolbarToButtons=function(b){for(var a=[],d=b.length,c=0;c<d;c+=1)"object"==typeof b[c]&&(a=a.concat(e.groupToButtons(b[c])));return a};e.createToolbarButton=function(b){var a=new CKEDITOR.dom.element("a"),d=e.createIcon(b.name,b.icon,b.command);a.setStyle("float","none");a.addClass("cke_"+("rtl"==CKEDITOR.lang.dir?"rtl":"ltr"));if(b instanceof CKEDITOR.ui.button)a.addClass("cke_button"),a.addClass("cke_toolgroup"),a.append(d); +else if(CKEDITOR.ui.richCombo&&b instanceof CKEDITOR.ui.richCombo){var d=new CKEDITOR.dom.element("span"),c=new CKEDITOR.dom.element("span"),f=new CKEDITOR.dom.element("span");a.addClass("cke_combo_button");d.addClass("cke_combo_text");d.addClass("cke_combo_inlinelabel");d.setText(b.label);c.addClass("cke_combo_open");f.addClass("cke_combo_arrow");c.append(f);a.append(d);a.append(c)}return a};e.createIcon=function(b,a,d){var c=CKEDITOR.skin.getIconStyle(b,"rtl"==CKEDITOR.lang.dir),c=(c=c||CKEDITOR.skin.getIconStyle(a, +"rtl"==CKEDITOR.lang.dir))||CKEDITOR.skin.getIconStyle(d,"rtl"==CKEDITOR.lang.dir),a=new CKEDITOR.dom.element("span");a.addClass("cke_button_icon");a.addClass("cke_button__"+b+"_icon");a.setAttribute("style",c);a.setStyle("float","none");return a};e.createButton=function(b,a){var d=new CKEDITOR.dom.element("button");d.addClass("button-a");if("string"==typeof a)for(var a=a.split(" "),c=a.length;c--;)d.addClass(a[c]);d.setHtml(b);return d};e.groupToButtons=function(b){for(var a=[],d=(b=b.items)?b.length: +0,c=0;c<d;c+=1){var f=b[c];if(f instanceof CKEDITOR.ui.button||CKEDITOR.ui.richCombo&&f instanceof CKEDITOR.ui.richCombo)f.$=e.createToolbarButton(f),a.push(f)}return a}})();
\ No newline at end of file diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/js/toolbarmodifier.js b/httemplate/elements/ckeditor/samples/toolbarconfigurator/js/toolbarmodifier.js new file mode 100644 index 000000000..4e126220b --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/js/toolbarmodifier.js @@ -0,0 +1,31 @@ +(function(){function d(a,b){j.call(this,a,b);this.actualConfig=this.originalConfig=this.removedButtons=null;this.emptyVisible=!1;this.state="edit";this.toolbarButtons=[{text:{active:"Hide empty toolbar groups",inactive:"Show empty toolbar groups"},group:"edit",position:"left",cssClass:"button-a-soft",clickCallback:function(a,b){a[a.hasClass("button-a-background")?"removeClass":"addClass"]("button-a-background");this._toggleVisibilityEmptyElements();this.emptyVisible?a.setText(b.text.active):a.setText(b.text.inactive)}}, +{text:"Add row separator",group:"edit",position:"left",cssClass:"button-a-soft",clickCallback:function(){this._addSeparator()}},{text:"Select config",group:"config",position:"left",cssClass:"button-a-soft",clickCallback:function(){this.configContainer.findOne("textarea").$.select()}},{text:"Back to configurator",group:"config",position:"right",cssClass:"button-a-background",clickCallback:function(){if("paste"===this.state){var a=this.configContainer.findOne("textarea").getValue();(a=d.evaluateToolbarGroupsConfig(a))? +this.setConfig(a):alert("Your pasted config is wrong.")}this.state="edit";this._showConfigurationTool();this.showToolbarBtnsByGroupName(this.state)}},{text:'Get toolbar <span class="highlight">config</span>',group:"edit",position:"right",cssClass:"button-a-background icon-pos-left icon-download",clickCallback:function(){this.state="config";this._showConfig();this.showToolbarBtnsByGroupName(this.state)}}];this.cachedActiveElement=null}var j=ToolbarConfigurator.AbstractToolbarModifier;ToolbarConfigurator.ToolbarModifier= +d;d.prototype=Object.create(ToolbarConfigurator.AbstractToolbarModifier.prototype);d.prototype.getActualConfig=function(){var a=j.prototype.getActualConfig.call(this);if(a.toolbarGroups)for(var b=a.toolbarGroups.length,c=0;c<b;c+=1)a.toolbarGroups[c]=d.parseGroupToConfigValue(a.toolbarGroups[c]);return a};d.prototype._onInit=function(a,b,c){c=!0===c;j.prototype._onInit.call(this,void 0,b);this.removedButtons=[];c?this.removedButtons=this.actualConfig.removeButtons?this.actualConfig.removeButtons.split(","): +[]:"removeButtons"in this.originalConfig?this.removedButtons=this.originalConfig.removeButtons?this.originalConfig.removeButtons.split(","):[]:(this.originalConfig.removeButtons="",this.removedButtons=[]);this.actualConfig.toolbarGroups||(this.actualConfig.toolbarGroups=this.fullToolbarEditor.getFullToolbarGroupsConfig());this._fixGroups(this.actualConfig);this._calculateTotalBtns();this._createModifier();this._refreshMoveBtnsAvalibility();this._refreshBtnTabIndexes();"function"===typeof a&&a(this.mainContainer)}; +d.prototype._showConfigurationTool=function(){this.configContainer.addClass("hidden");this.modifyContainer.removeClass("hidden")};d.prototype._showConfig=function(){var a=this.getActualConfig(),b,c;if(a.toolbarGroups){b=a.toolbarGroups;for(var e=this.cfg.trimEmptyGroups,f=[],g=b.length,k=0;k<g;k++){var h=b[k];if("/"===h)f.push("'/'");else{if(e)for(var i=h.groups.length;i--;)0===d.getTotalSubGroupButtonsNumber(h.groups[i],this.fullToolbarEditor)&&h.groups.splice(i,1);e&&0===h.groups.length||f.push(j.stringifyJSONintoOneLine(h, +{addSpaces:!0,noQuotesOnKey:!0,singleQuotes:!0}))}}b="\n\t\t"+f.join(",\n\t\t")}a.removeButtons&&(c=a.removeButtons);a=["<textarea readonly>CKEDITOR.editorConfig = function( config ) {\n",b?"\tconfig.toolbarGroups = ["+b+"\n\t];":"",c?"\n\n":"",c?"\tconfig.removeButtons = '"+c+"';":"","\n};</textarea>"].join("");this.modifyContainer.addClass("hidden");this.configContainer.removeClass("hidden");this.configContainer.setHtml(a)};d.prototype._toggleVisibilityEmptyElements=function(){this.modifyContainer.hasClass("empty-visible")? +(this.modifyContainer.removeClass("empty-visible"),this.emptyVisible=!1):(this.modifyContainer.addClass("empty-visible"),this.emptyVisible=!0);this._refreshMoveBtnsAvalibility()};d.prototype._createModifier=function(){function a(){b._highlightGroup(this.data("name"))}var b=this;j.prototype._createModifier.call(this);this.modifyContainer.setHtml(this._toolbarConfigToListString());var c=this.modifyContainer.find('li[data-type="group"]');this.modifyContainer.on("mouseleave",function(){this._dehighlightActiveToolGroup()}, +this);for(var e=c.count(),f=0;f<e;f+=1)c.getItem(f).on("mouseenter",a);CKEDITOR.document.on("keypress",function(a){var a=a.data.$.keyCode,a=32===a||13===a,c=new CKEDITOR.dom.element(CKEDITOR.document.$.activeElement);c.getAscendant(function(a){return a.$===b.mainContainer.$})&&a&&"button"===c.data("type")&&c.findOne("input").$.click()});this.modifyContainer.on("click",function(a){var c=a.data.$,e=new CKEDITOR.dom.element(c.target||c.srcElement);if(a=d.getGroupOrSeparatorLiAncestor(e)){b.cachedActiveElement= +document.activeElement;if(e.$ instanceof HTMLInputElement)b._handleCheckboxClicked(e);else if(e.$ instanceof HTMLButtonElement&&(c.preventDefault?c.preventDefault():c.returnValue=!1,(c=b._handleAnchorClicked(e.$))&&"remove"==c.action))return;c=a.data("type");a=a.data("name");b._setActiveElement(c,a);b.cachedActiveElement&&b.cachedActiveElement.focus()}});this.toolbarContainer||(this._createToolbar(),this.toolbarContainer.insertBefore(this.mainContainer.getChildren().getItem(0)));this.showToolbarBtnsByGroupName("edit"); +this.configContainer||(this.configContainer=new CKEDITOR.dom.element("div"),this.configContainer.addClass("configContainer"),this.configContainer.addClass("hidden"),this.mainContainer.append(this.configContainer));return this.mainContainer};d.prototype.showToolbarBtnsByGroupName=function(a){if(this.toolbarContainer)for(var b=this.toolbarContainer.find("button"),c=b.count(),e=0;e<c;e+=1){var d=b.getItem(e);d.data("group")==a?d.removeClass("hidden"):d.addClass("hidden")}};d.parseGroupToConfigValue= +function(a){if("separator"==a.type)return"/";var b=a.groups,c=b.length;delete a.totalBtns;for(var e=0;e<c;e+=1)b[e]=b[e].name;return a};d.getGroupOrSeparatorLiAncestor=function(a){return a.$ instanceof HTMLLIElement&&"group"==a.data("type")?a:d.getFirstAncestor(a,function(a){a=a.data("type");return"group"==a||"separator"==a})};d.prototype._setActiveElement=function(a,b){this.currentActive&&this.currentActive.elem.removeClass("active");if(null===a)this._dehighlightActiveToolGroup(),this.currentActive= +null;else{var c=this.mainContainer.findOne('ul[data-type=table-body] li[data-type="'+a+'"][data-name="'+b+'"]');c.addClass("active");this.currentActive={type:a,name:b,elem:c};"group"==a&&this._highlightGroup(b);"separator"==a&&this._dehighlightActiveToolGroup()}};d.prototype.getActiveToolGroup=function(){return this.editorInstance.container?this.editorInstance.container.findOne(".cke_toolgroup.active, .cke_toolbar.active"):null};d.prototype._dehighlightActiveToolGroup=function(){var a=this.getActiveToolGroup(); +a&&a.removeClass("active");this.editorInstance.container&&this.editorInstance.container.removeClass("some-toolbar-active")};d.prototype._highlightGroup=function(a){this.editorInstance.container&&(a=this.getFirstEnabledButtonInGroup(a),a=this.editorInstance.container.findOne(".cke_button__"+a+", .cke_combo__"+a),this._dehighlightActiveToolGroup(),this.editorInstance.container&&this.editorInstance.container.addClass("some-toolbar-active"),a&&(a=d.getFirstAncestor(a,function(a){return a.hasClass("cke_toolbar")}))&& +a.addClass("active"))};d.prototype.getFirstEnabledButtonInGroup=function(a){var b=this.actualConfig.toolbarGroups,a=this.getGroupIndex(a),b=b[a];if(-1===a)return null;for(var a=b.groups?b.groups.length:0,c=0;c<a;c+=1){var e=this.getFirstEnabledButtonInSubgroup(b.groups[c].name);if(e)return e}return null};d.prototype.getFirstEnabledButtonInSubgroup=function(a){for(var b=(a=this.fullToolbarEditor.buttonsByGroup[a])?a.length:0,c=0;c<b;c+=1){var e=a[c].name;if(!this.isButtonRemoved(e))return e}return null}; +d.prototype._handleCheckboxClicked=function(a){var b=a.getAscendant("li").data("name");a.$.checked?this._removeButtonFromRemoved(b):this._addButtonToRemoved(b)};d.prototype._handleAnchorClicked=function(a){var a=new CKEDITOR.dom.element(a),b=a.getAscendant("li"),c=b.getAscendant("ul"),e=b.data("type"),d=b.data("name"),g=a.data("direction"),k="up"===g?b.getPrevious():b.getNext(),h;if(a.hasClass("disabled"))return null;if(a.hasClass("remove"))return b.remove(),this._removeSeparator(b.data("name")), +this._setActiveElement(null),{action:"remove"};if(!a.hasClass("move")||!k)return{action:null};if("group"===e||"separator"===e)h=this._moveGroup(g,d);"subgroup"===e&&(h=b.getAscendant("li").data("name"),h=this._moveSubgroup(g,h,d));"up"===g&&b.insertBefore(c.getChild(h));"down"===g&&b.insertAfter(c.getChild(h));for(var i;b="up"===g?b.getPrevious():b.getNext();)if(this.emptyVisible||!b.hasClass("empty")){i=b;break}i||(this.cachedActiveElement=a.getParent().findOne('[data-direction="'+("up"===g?"down": +"up")+'"]'));this._refreshMoveBtnsAvalibility();this._refreshBtnTabIndexes();return{action:"move"}};d.prototype._refreshMoveBtnsAvalibility=function(){function a(a){var c=a.count();for(d=0;d<c;d+=1)b._disableElementsInList(a.getItem(d))}for(var b=this,c=this.mainContainer.find("ul[data-type=table-body] li > p > span > button.move.disabled"),e=c.count(),d=0;d<e;d+=1)c.getItem(d).removeClass("disabled");a(this.mainContainer.find("ul[data-type=table-body]"));a(this.mainContainer.find("ul[data-type=table-body] > li > ul"))}; +d.prototype._refreshBtnTabIndexes=function(){for(var a=this.mainContainer.find('[data-tab="true"]'),b=a.count(),c=0;c<b;c++){var e=a.getItem(c),d=e.hasClass("disabled");e.setAttribute("tabindex",d?-1:c)}};d.prototype._disableElementsInList=function(a){function b(a){return!a.hasClass("empty")}if(a.getChildren().count()){var c;this.emptyVisible?(c=a.getFirst(),a=a.getLast()):(c=a.getFirst(b),a=a.getLast(b));if(c)var e=c.findOne('p button[data-direction="up"]');if(a)var d=a.findOne('p button[data-direction="down"]'); +e&&(e.addClass("disabled"),e.setAttribute("tabindex","-1"));d&&(d.addClass("disabled"),d.setAttribute("tabindex","-1"))}};d.prototype.getGroupIndex=function(a){for(var b=this.actualConfig.toolbarGroups,c=b.length,d=0;d<c;d+=1)if(b[d].name===a)return d;return-1};d.prototype._addSeparator=function(){var a=this._determineSeparatorToAddIndex(),b=d.createSeparatorLiteral(),c=CKEDITOR.dom.element.createFromHtml(d.getToolbarSeparatorString(b));this.actualConfig.toolbarGroups.splice(a,0,b);c.insertBefore(this.modifyContainer.findOne("ul[data-type=table-body]").getChild(a)); +this._setActiveElement("separator",b.name);this._refreshMoveBtnsAvalibility();this._refreshBtnTabIndexes();this._refreshEditor()};d.prototype._removeSeparator=function(a){this.actualConfig.toolbarGroups.splice(CKEDITOR.tools.indexOf(this.actualConfig.toolbarGroups,function(b){return"separator"==b.type&&b.name==a}),1);this._refreshMoveBtnsAvalibility();this._refreshBtnTabIndexes();this._refreshEditor()};d.prototype._determineSeparatorToAddIndex=function(){return!this.currentActive?0:("group"==this.currentActive.elem.data("type")|| +"separator"==this.currentActive.elem.data("type")?this.currentActive.elem:this.currentActive.elem.getAscendant("li")).getIndex()};d.prototype._moveElement=function(a,b,c){function e(a){return a.totalBtns||"separator"==a.type}c=this.emptyVisible?"down"==c?b+1:b-1:d.getFirstElementIndexWith(a,b,c,e);return d.moveTo(c-b,a,b)};d.prototype._moveGroup=function(a,b){var c=this._moveElement(this.actualConfig.toolbarGroups,this.getGroupIndex(b),a);this._refreshMoveBtnsAvalibility();this._refreshBtnTabIndexes(); +this._refreshEditor();return c};d.prototype._moveSubgroup=function(a,b,c){var b=this.actualConfig.toolbarGroups[this.getGroupIndex(b)],d=CKEDITOR.tools.indexOf(b.groups,function(a){return a.name==c}),a=this._moveElement(b.groups,d,a);this._refreshEditor();return a};d.prototype._calculateTotalBtns=function(){for(var a=this.actualConfig.toolbarGroups,b=a.length;b--;){var c=a[b],e=d.getTotalGroupButtonsNumber(c,this.fullToolbarEditor);"separator"!=c.type&&(c.totalBtns=e)}};d.prototype._addButtonToRemoved= +function(a){if(-1!=CKEDITOR.tools.indexOf(this.removedButtons,a))throw"Button already added to removed";this.removedButtons.push(a);this.actualConfig.removeButtons=this.removedButtons.join(",");this._refreshEditor()};d.prototype._removeButtonFromRemoved=function(a){a=CKEDITOR.tools.indexOf(this.removedButtons,a);if(-1===a)throw"Trying to remove button from removed, but not found";this.removedButtons.splice(a,1);this.actualConfig.removeButtons=this.removedButtons.join(",");this._refreshEditor()};d.parseGroupToConfigValue= +function(a){if("separator"==a.type)return"/";var b=a.groups,c=b.length;delete a.totalBtns;for(var d=0;d<c;d+=1)b[d]=b[d].name;return a};d.getGroupOrSeparatorLiAncestor=function(a){return a.$ instanceof HTMLLIElement&&"group"==a.data("type")?a:d.getFirstAncestor(a,function(a){a=a.data("type");return"group"==a||"separator"==a})};d.createSeparatorLiteral=function(){return{type:"separator",name:"separator"+CKEDITOR.tools.getNextNumber()}};d.prototype._toolbarConfigToListString=function(){for(var a=this.actualConfig.toolbarGroups|| +[],b='<ul data-type="table-body">',c=a.length,e=0;e<c;e+=1)var f=a[e],b="separator"===f.type?b+d.getToolbarSeparatorString(f):b+this._getToolbarGroupString(f);return d.getToolbarHeaderString()+(b+"</ul>")};d.prototype._getToolbarGroupString=function(a){var b=a.groups,c;c=""+['<li data-type="group" data-name="',a.name,'" ',a.totalBtns?"":'class="empty"',">"].join("");c+=d.getToolbarElementPreString(a)+"<ul>";for(var a=b.length,e=0;e<a;e+=1){var f=b[e];c+=this._getToolbarSubgroupString(f,this.fullToolbarEditor.buttonsByGroup[f.name])}return c+ +"</ul></li>"};d.getToolbarSeparatorString=function(a){return['<li data-type="',a.type,'" data-name="',a.name,'">',d.getToolbarElementPreString("row separator"),"</li>"].join("")};d.getToolbarHeaderString=function(){return'<ul data-type="table-header"><li data-type="header"><p>Toolbars</p><ul><li><p>Toolbar groups</p><p>Toolbar group items</p></li></ul></li></ul>'};d.getFirstAncestor=function(a,b){for(var c=a.getParents(),d=c.length;d--;)if(b(c[d]))return c[d];return null};d.getFirstElementIndexWith= +function(a,b,c,d){for(;"up"===c?b--:++b<a.length;)if(d(a[b]))return b;return-1};d.moveTo=function(a,b,c){var d;-1!==c&&(d=b.splice(c,1)[0]);a=c+a;b.splice(a,0,d);return a};d.getTotalSubGroupButtonsNumber=function(a,b){var c=b.buttonsByGroup["string"==typeof a?a:a.name];return c?c.length:0};d.getTotalGroupButtonsNumber=function(a,b){for(var c=0,e=a.groups,f=e?e.length:0,g=0;g<f;g+=1)c+=d.getTotalSubGroupButtonsNumber(e[g],b);return c};d.prototype._getToolbarSubgroupString=function(a,b){var c;c=""+ +['<li data-type="subgroup" data-name="',a.name,'" ',a.totalBtns?"":'class="empty" ',">"].join("");c+=d.getToolbarElementPreString(a.name);c+="<ul>";for(var e=b?b.length:0,f=0;f<e;f+=1)c+=this.getButtonString(b[f]);return c+"</ul></li>"};d.prototype._getConfigButtonName=function(a){var b=this.fullToolbarEditor.editorInstance.ui.items,c;for(c in b)if(b[c].name==a)return c;return null};d.prototype.isButtonRemoved=function(a){return-1!=CKEDITOR.tools.indexOf(this.removedButtons,this._getConfigButtonName(a))}; +d.prototype.getButtonString=function(a){var b=this.isButtonRemoved(a.name)?"":'checked="checked"';return['<li data-tab="true" data-type="button" data-name="',this._getConfigButtonName(a.name),'"><label title="',a.label,'" ><input tabindex="-1"type="checkbox"',b,"/>",a.$.getOuterHtml(),"</label></li>"].join("")};d.getToolbarElementPreString=function(a){a=a.name?a.name:a;return['<p><span><button title="Move element upward" data-tab="true" data-direction="up" class="move icon-up-big"></button><button title="Move element downward" data-tab="true" data-direction="down" class="move icon-down-big"></button>', +"row separator"==a?'<button title="Remove element" data-tab="true" class="remove icon-trash"></button>':"",a,"</span></p>"].join("")};d.evaluateToolbarGroupsConfig=function(a){return a=function(a){var c={},d;try{d=eval("("+a+")")}catch(f){try{d=eval(a)}catch(g){return null}}return c.toolbarGroups&&"number"===typeof c.toolbarGroups.length?JSON.stringify(c):d&&"number"===typeof d.length?JSON.stringify({toolbarGroups:d}):d&&d.toolbarGroups?JSON.stringify(d):null}(a)};return d})();
\ No newline at end of file diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/js/toolbartextmodifier.js b/httemplate/elements/ckeditor/samples/toolbarconfigurator/js/toolbartextmodifier.js new file mode 100644 index 000000000..90f577190 --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/js/toolbartextmodifier.js @@ -0,0 +1,14 @@ +(function(){function e(a){j.call(this,a);this.hintContainer=this.codeContainer=null}var j=ToolbarConfigurator.AbstractToolbarModifier,g=ToolbarConfigurator.FullToolbarEditor;ToolbarConfigurator.ToolbarTextModifier=e;e.prototype=Object.create(j.prototype);e.prototype._onInit=function(a,d){j.prototype._onInit.call(this,void 0,d);this._createModifier(d?this.actualConfig:void 0);"function"===typeof a&&a(this.mainContainer)};e.prototype._createModifier=function(a){function d(a){var b=c(a);if(null!==b.charsBetween){var d= +i.getUnusedButtonsArray(i.actualConfig.toolbar,!0,b.charsBetween),e=a.getCursor(),b=CodeMirror.Pos(e.line,e.ch-b.charsBetween.length),h=a.getTokenAt(e);"{"===a.getTokenAt({line:e.line,ch:h.start}).string&&(d=["name"]);if(0!==d.length)return new f(b,e,d)}}function f(a,c,b){this.from=a;this.to=c;this.list=b;this._handlers=[]}function c(a,c){var b={};b.cur=a.getCursor();b.tok=a.getTokenAt(b.cur);b["char"]=c||b.tok.string.charAt(b.tok.string.length-1);var d=a.getRange(CodeMirror.Pos(b.cur.line,0),b.cur).split("").reverse().join(""), +d=d.replace(/(['|"]\w*['|"])/g,"");b.charsBetween=d.match(/(^\w*)(['|"])/);b.charsBetween&&(b.endChar=b.charsBetween[2],b.charsBetween=b.charsBetween[1].split("").reverse().join(""));return b}function b(a){setTimeout(function(){a.state.completionActive||CodeMirror.showHint(a,d,{hintsClass:"toolbar-modifier",completeSingle:!1})},100);return CodeMirror.Pass}var i=this;this._createToolbar();this.toolbarContainer&&this.mainContainer.append(this.toolbarContainer);j.prototype._createModifier.call(this); +this._setupActualConfig(a);var a=this.actualConfig.toolbar,a=CKEDITOR.tools.isArray(a)?"\tconfig.toolbar = "+("[\n\t\t"+g.map(a,function(a){return j.stringifyJSONintoOneLine(a,{addSpaces:!0,noQuotesOnKey:!0,singleQuotes:!0})}).join(",\n\t\t")+"\n\t]")+";":"config.toolbar = [];",a=["CKEDITOR.editorConfig = function( config ) {\n",a,"\n};"].join(""),e=new CKEDITOR.dom.element("div");e.addClass("codemirror-wrapper");this.modifyContainer.append(e);this.codeContainer=CodeMirror(e.$,{mode:{name:"javascript", +json:!0},lineNumbers:!1,lineWrapping:!0,viewportMargin:Infinity,value:a,smartIndent:!1,indentWithTabs:!0,indentUnit:4,tabSize:4,theme:"neo",extraKeys:{Left:b,Right:b,"'''":b,"'\"'":b,Backspace:b,Delete:b,"Shift-Tab":"indentLess"}});this.codeContainer.on("endCompletion",function(a,b){var d=c(a);void 0!==b&&a.replaceSelection(d.endChar)});this.codeContainer.on("change",function(){var a=i.codeContainer.getValue(),a=i._evaluateValue(a);null!==a?(i.actualConfig.toolbar=a.toolbar?a.toolbar:i.actualConfig.toolbar, +i._fillHintByUnusedElements(),i._refreshEditor(),i.mainContainer.removeClass("invalid")):i.mainContainer.addClass("invalid")});this.hintContainer=new CKEDITOR.dom.element("div");this.hintContainer.addClass("toolbarModifier-hints");this._fillHintByUnusedElements();this.hintContainer.insertBefore(e)};e.prototype._fillHintByUnusedElements=function(){var a=this.getUnusedButtonsArray(this.actualConfig.toolbar,!0),a=this.groupButtonNamesByGroup(a),d=g.map(a,function(a){var b=g.map(a.buttons,function(a){return"<code>"+ +a+"</code> "}).join("");return["<dt><code>",a.name,"</code></dt><dd>",b,"</dd>"].join("")}).join(" "),f='<dt class="list-header">Toolbar group</dt><dd class="list-header">Unused items</dd>';a.length||(f="<p>All items are in use.</p>");this.codeContainer.refresh();this.hintContainer.setHtml("<h3>Unused toolbar items</h3><dl>"+f+d+"</dl>")};e.prototype.getToolbarGroupByButtonName=function(a){var d=this.fullToolbarEditor.buttonNamesByGroup,f;for(f in d)for(var c=d[f],b=c.length;b--;)if(a===c[b])return f; +return null};e.prototype.getUnusedButtonsArray=function(a,d,f){var d=!0===d?!0:!1,c=e.mapToolbarCfgToElementsList(a),a=Object.keys(this.fullToolbarEditor.editorInstance.ui.items),a=g.filter(a,function(a){var d="-"===a,a=void 0===f||0===a.toLowerCase().indexOf(f.toLowerCase());return!d&&a}),a=g.filter(a,function(a){return-1==CKEDITOR.tools.indexOf(c,a)});d&&a.sort();return a};e.prototype.groupButtonNamesByGroup=function(a){var d=[],f=JSON.parse(JSON.stringify(this.fullToolbarEditor.buttonNamesByGroup)), +c;for(c in f){var b=f[c],b=g.filter(b,function(b){return-1!==CKEDITOR.tools.indexOf(a,b)});b.length&&d.push({name:c,buttons:b})}return d};e.mapToolbarCfgToElementsList=function(a){function d(a){return"-"!==a}for(var f=[],c=a.length,b=0;b<c;b+=1)a[b]&&"string"!==typeof a[b]&&(f=f.concat(g.filter(a[b].items,d)));return f};e.prototype._setupActualConfig=function(a){a=a||this.editorInstance.config;CKEDITOR.tools.isArray(a.toolbar)||(a.toolbarGroups||(a.toolbarGroups=this.fullToolbarEditor.getFullToolbarGroupsConfig(!0)), +this._fixGroups(a),a.toolbar=this._mapToolbarGroupsToToolbar(a.toolbarGroups,this.actualConfig.removeButtons),this.actualConfig.toolbar=a.toolbar,this.actualConfig.removeButtons="")};e.prototype._mapToolbarGroupsToToolbar=function(a,d){for(var d=d||this.editorInstance.config.removedBtns,d="string"==typeof d?d.split(","):[],f=a.length;f--;){var c=this._mapToolbarSubgroup(a[f],d);"separator"===a[f].type?a[f]="/":CKEDITOR.tools.isArray(c)&&0===c.length?a.splice(f,1):a[f]="string"==typeof c?c:{name:a[f].name, +items:c}}return a};e.prototype._mapToolbarSubgroup=function(a,d){if("string"==typeof a)return a;for(var f=a.groups?a.groups.length:0,c=[],b=0;b<f;b+=1){var e=a.groups[b],e=this.fullToolbarEditor.buttonsByGroup["string"===typeof e?e:e.name]||[],e=this._mapButtonsToButtonsNames(e,d),g=e.length,c=c.concat(e);g&&c.push("-")}"-"==c[c.length-1]&&c.pop();return c};e.prototype._mapButtonsToButtonsNames=function(a,d){for(var f=a.length;f--;){var c=a[f],c="string"===typeof c?c:this.fullToolbarEditor.getCamelCasedButtonName(c.name); +-1!==CKEDITOR.tools.indexOf(d,c)?a.splice(f,1):a[f]=c}return a};e.prototype._evaluateValue=function(a){var d;try{var f={};Function("var CKEDITOR = {}; "+a+"; return CKEDITOR;")().editorConfig(f);d=f;for(var c=d.toolbar.length;c--;)d.toolbar[c]||d.toolbar.splice(c,1)}catch(b){d=null}return d};e.prototype.mapToolbarToToolbarGroups=function(a){function d(a,b){for(var a=a.slice(),d=b.length;d--;){var c=a.indexOf(b[d]);-1!==c&&a.splice(c,1)}return a}for(var f={},c=[],b=[],c=a.length,e=0;e<c;e++)if("/"=== +a[e])b.push("/");else{var g=a[e].items,k={};k.name=a[e].name;k.groups=[];for(var j=g.length,m=0;m<j;m++){var l=g[m];if("-"!==l){var h=this.getToolbarGroupByButtonName(l);-1===k.groups.indexOf(h)&&k.groups.push(h);f[h]=f[h]||{};h=f[h].buttons=f[h].buttons||{};h[l]=h[l]||{used:0,origin:k.name};h[l].used++}}b.push(k)}c=function(a,b){var c=[],e;for(e in a)var f=a[e],g=b[e].slice(),c=c.concat(d(g,Object.keys(f.buttons)));return c}(f,this.fullToolbarEditor.buttonNamesByGroup);return{toolbarGroups:b,removeButtons:c.join(",")}}; +return e})();
\ No newline at end of file diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/LICENSE b/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/LICENSE new file mode 100644 index 000000000..d21bbea5a --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2014 by Marijn Haverbeke <marijnh@gmail.com> and others + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.css b/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.css new file mode 100644 index 000000000..2fe9d0f54 --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.css @@ -0,0 +1,325 @@ +/* BASICS */
+
+.CodeMirror {
+ /* Set height, width, borders, and global font properties here */
+ font-family: monospace;
+ height: 300px;
+ color: black;
+}
+
+/* PADDING */
+
+.CodeMirror-lines {
+ padding: 4px 0; /* Vertical padding around content */
+}
+.CodeMirror pre {
+ padding: 0 4px; /* Horizontal padding of content */
+}
+
+.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
+ background-color: white; /* The little square between H and V scrollbars */
+}
+
+/* GUTTER */
+
+.CodeMirror-gutters {
+ border-right: 1px solid #ddd;
+ background-color: #f7f7f7;
+ white-space: nowrap;
+}
+.CodeMirror-linenumbers {}
+.CodeMirror-linenumber {
+ padding: 0 3px 0 5px;
+ min-width: 20px;
+ text-align: right;
+ color: #999;
+ white-space: nowrap;
+}
+
+.CodeMirror-guttermarker { color: black; }
+.CodeMirror-guttermarker-subtle { color: #999; }
+
+/* CURSOR */
+
+.CodeMirror div.CodeMirror-cursor {
+ border-left: 1px solid black;
+}
+/* Shown when moving in bi-directional text */
+.CodeMirror div.CodeMirror-secondarycursor {
+ border-left: 1px solid silver;
+}
+.CodeMirror.cm-fat-cursor div.CodeMirror-cursor {
+ width: auto;
+ border: 0;
+ background: #7e7;
+}
+.CodeMirror.cm-fat-cursor div.CodeMirror-cursors {
+ z-index: 1;
+}
+
+.cm-animate-fat-cursor {
+ width: auto;
+ border: 0;
+ -webkit-animation: blink 1.06s steps(1) infinite;
+ -moz-animation: blink 1.06s steps(1) infinite;
+ animation: blink 1.06s steps(1) infinite;
+}
+@-moz-keyframes blink {
+ 0% { background: #7e7; }
+ 50% { background: none; }
+ 100% { background: #7e7; }
+}
+@-webkit-keyframes blink {
+ 0% { background: #7e7; }
+ 50% { background: none; }
+ 100% { background: #7e7; }
+}
+@keyframes blink {
+ 0% { background: #7e7; }
+ 50% { background: none; }
+ 100% { background: #7e7; }
+}
+
+/* Can style cursor different in overwrite (non-insert) mode */
+div.CodeMirror-overwrite div.CodeMirror-cursor {}
+
+.cm-tab { display: inline-block; text-decoration: inherit; }
+
+.CodeMirror-ruler {
+ border-left: 1px solid #ccc;
+ position: absolute;
+}
+
+/* DEFAULT THEME */
+
+.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,
+.cm-s-default .cm-punctuation,
+.cm-s-default .cm-property,
+.cm-s-default .cm-operator {}
+.cm-s-default .cm-variable-2 {color: #05a;}
+.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 {color: #555;}
+.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-header {color: blue;}
+.cm-s-default .cm-quote {color: #090;}
+.cm-s-default .cm-hr {color: #999;}
+.cm-s-default .cm-link {color: #00c;}
+
+.cm-negative {color: #d44;}
+.cm-positive {color: #292;}
+.cm-header, .cm-strong {font-weight: bold;}
+.cm-em {font-style: italic;}
+.cm-link {text-decoration: underline;}
+.cm-strikethrough {text-decoration: line-through;}
+
+.cm-s-default .cm-error {color: #f00;}
+.cm-invalidchar {color: #f00;}
+
+.CodeMirror-composing { border-bottom: 2px solid; }
+
+/* Default styles for common addons */
+
+div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
+div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
+.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
+.CodeMirror-activeline-background {background: #e8f2ff;}
+
+/* STOP */
+
+/* The rest of this file contains styles related to the mechanics of
+ the editor. You probably shouldn't touch them. */
+
+.CodeMirror {
+ position: relative;
+ overflow: hidden;
+ background: white;
+}
+
+.CodeMirror-scroll {
+ overflow: scroll !important; /* Things will break if this is overridden */
+ /* 30px is the magic margin used to hide the element's real scrollbars */
+ /* See overflow: hidden in .CodeMirror */
+ margin-bottom: -30px; margin-right: -30px;
+ padding-bottom: 30px;
+ height: 100%;
+ outline: none; /* Prevent dragging from highlighting the element */
+ position: relative;
+}
+.CodeMirror-sizer {
+ position: relative;
+ border-right: 30px solid transparent;
+}
+
+/* The fake, visible scrollbars. Used to force redraw during scrolling
+ before actuall scrolling happens, thus preventing shaking and
+ flickering artifacts. */
+.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
+ position: absolute;
+ z-index: 6;
+ display: 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;
+ z-index: 3;
+}
+.CodeMirror-gutter {
+ white-space: normal;
+ height: 100%;
+ display: inline-block;
+ margin-bottom: -30px;
+ /* Hack to make IE7 behave */
+ *zoom:1;
+ *display:inline;
+}
+.CodeMirror-gutter-wrapper {
+ position: absolute;
+ z-index: 4;
+ height: 100%;
+}
+.CodeMirror-gutter-elt {
+ position: absolute;
+ cursor: default;
+ z-index: 4;
+}
+.CodeMirror-gutter-wrapper {
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ user-select: none;
+}
+
+.CodeMirror-lines {
+ cursor: text;
+ min-height: 1px; /* prevents collapsing before first draw */
+}
+.CodeMirror pre {
+ /* Reset some styles that the rest of the page might have set */
+ -moz-border-radius: 0; -webkit-border-radius: 0; 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;
+}
+.CodeMirror-wrap pre {
+ 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;
+ overflow: auto;
+}
+
+.CodeMirror-widget {}
+
+.CodeMirror-code {
+ outline: none;
+}
+
+/* Force content-box sizing for the elements where we expect it */
+.CodeMirror-scroll,
+.CodeMirror-sizer,
+.CodeMirror-gutter,
+.CodeMirror-gutters,
+.CodeMirror-linenumber {
+ -moz-box-sizing: content-box;
+ box-sizing: content-box;
+}
+
+.CodeMirror-measure {
+ position: absolute;
+ width: 100%;
+ height: 0;
+ overflow: hidden;
+ visibility: hidden;
+}
+.CodeMirror-measure pre { position: static; }
+
+.CodeMirror div.CodeMirror-cursor {
+ position: absolute;
+ border-right: none;
+ width: 0;
+}
+
+div.CodeMirror-cursors {
+ visibility: hidden;
+ position: relative;
+ z-index: 3;
+}
+.CodeMirror-focused div.CodeMirror-cursors {
+ visibility: visible;
+}
+
+.CodeMirror-selected { background: #d9d9d9; }
+.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
+.CodeMirror-crosshair { cursor: crosshair; }
+.CodeMirror ::selection { background: #d7d4f0; }
+.CodeMirror ::-moz-selection { background: #d7d4f0; }
+
+.cm-searching {
+ background: #ffa;
+ background: rgba(255, 255, 0, .4);
+}
+
+/* IE7 hack to prevent it from returning funny offsetTops on the spans */
+.CodeMirror span { *vertical-align: text-bottom; }
+
+/* Used to force a border model for a node */
+.cm-force-border { padding-right: .1px; }
+
+@media print {
+ /* Hide the cursor when printing */
+ .CodeMirror div.CodeMirror-cursors {
+ visibility: hidden;
+ }
+}
+
+/* See issue #2901 */
+.cm-tab-wrap-hack:after { content: ''; }
+
+/* Help users use markselection to safely style text background */
+span.CodeMirror-selectedtext { background: none; }
diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.js b/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.js new file mode 100644 index 000000000..2550fefab --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.js @@ -0,0 +1,290 @@ +(function(m){if("object"==typeof exports&&"object"==typeof module)module.exports=m();else{if("function"==typeof define&&define.amd)return define([],m);this.CodeMirror=m()}})(function(){function m(a,b){if(!(this instanceof m))return new m(a,b);this.options=b=b?S(b):{};S(jf,b,!1);rc(b);var c=b.value;"string"==typeof c&&(c=new M(c,b.mode));this.doc=c;var d=new m.inputStyles[b.inputStyle](this),d=this.display=new kf(a,c,d);d.wrapper.CodeMirror=this;sd(this);td(this);b.lineWrapping&&(this.display.wrapper.className+= +" CodeMirror-wrap");b.autofocus&&!Xa&&d.input.focus();ud(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Ya,keySeq:null,specialChars:null};var e=this;y&&11>z&&setTimeout(function(){e.display.input.reset(true)},20);lf(this);vd||(mf(),vd=!0);Fa(this);this.curOp.forceUpdate=!0;wd(this,c);b.autofocus&&!Xa||e.hasFocus()?setTimeout(Za(sc,this),20):$a(this);for(var f in Ga)if(Ga.hasOwnProperty(f))Ga[f](this, +b[f],xd);yd(this);b.finishInit&&b.finishInit(this);for(c=0;c<tc.length;++c)tc[c](this);Ha(this);E&&(b.lineWrapping&&"optimizelegibility"==getComputedStyle(d.lineDiv).textRendering)&&(d.lineDiv.style.textRendering="auto")}function kf(a,b,c){this.input=c;this.scrollbarFiller=q("div",null,"CodeMirror-scrollbar-filler");this.scrollbarFiller.setAttribute("cm-not-content","true");this.gutterFiller=q("div",null,"CodeMirror-gutter-filler");this.gutterFiller.setAttribute("cm-not-content","true");this.lineDiv= +q("div",null,"CodeMirror-code");this.selectionDiv=q("div",null,null,"position: relative; z-index: 1");this.cursorDiv=q("div",null,"CodeMirror-cursors");this.measure=q("div",null,"CodeMirror-measure");this.lineMeasure=q("div",null,"CodeMirror-measure");this.lineSpace=q("div",[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");this.mover=q("div",[q("div",[this.lineSpace],"CodeMirror-lines")],null,"position: relative");this.sizer=q("div", +[this.mover],"CodeMirror-sizer");this.sizerWidth=null;this.heightForcer=q("div",null,null,"position: absolute; height: "+zd+"px; width: 1px;");this.gutters=q("div",null,"CodeMirror-gutters");this.lineGutter=null;this.scroller=q("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex","-1");this.wrapper=q("div",[this.scrollbarFiller,this.gutterFiller,this.scroller],"CodeMirror");y&&8>z&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight= +0);if(!E&&(!sa||!Xa))this.scroller.draggable=!0;a&&(a.appendChild?a.appendChild(this.wrapper):a(this.wrapper));this.reportedViewFrom=this.reportedViewTo=this.viewFrom=this.viewTo=b.first;this.view=[];this.externalMeasured=this.renderedView=null;this.lastWrapHeight=this.lastWrapWidth=this.viewOffset=0;this.updateLineNumbers=null;this.nativeBarWidth=this.barHeight=this.barWidth=0;this.scrollbarsClipped=!1;this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=null;this.alignWidgets=!1;this.maxLine= +this.cachedCharWidth=this.cachedTextHeight=this.cachedPaddingH=null;this.maxLineLength=0;this.maxLineChanged=!1;this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null;this.shift=!1;this.activeTouch=this.selForContextMenu=null;c.init(this)}function uc(a){a.doc.mode=m.getMode(a.options,a.doc.modeOption);ab(a)}function ab(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null)});a.doc.frontier=a.doc.first;bb(a,100);a.state.modeGen++;a.curOp&&N(a)}function Ad(a){var b= +ta(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/cb(a.display)-3);return function(e){if(ua(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return c?f+(Math.ceil(e.text.length/d)||1)*b:f+b}}function vc(a){var b=a.doc,c=Ad(a);b.iter(function(a){var b=c(a);b!=a.height&&Z(a,b)})}function td(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g, +" cm-s-");db(a)}function eb(a){sd(a);N(a);setTimeout(function(){wc(a)},20)}function sd(a){var b=a.display.gutters,c=a.options.gutters;va(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(q("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none";xc(a)}function xc(a){a.display.sizer.style.marginLeft=a.display.gutters.offsetWidth+"px"}function Gb(a){if(0==a.height)return 0;for(var b=a.text.length, +c,d=a;c=wa(d,!0);)c=c.find(0,!0),d=c.from.line,b+=c.from.ch-c.to.ch;for(d=a;c=wa(d,!1);)c=c.find(0,!0),b-=d.text.length-c.from.ch,d=c.to.line,b+=d.text.length-c.to.ch;return b}function yc(a){var b=a.display,a=a.doc;b.maxLine=r(a,a.first);b.maxLineLength=Gb(b.maxLine);b.maxLineChanged=!0;a.iter(function(a){var d=Gb(a);d>b.maxLineLength&&(b.maxLineLength=d,b.maxLine=a)})}function rc(a){var b=G(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]): +-1<b&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function fb(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+(a.display.mover.offsetHeight-a.display.lineSpace.offsetHeight));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+$(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth, +gutterWidth:c}}function zc(a,b,c){this.cm=c;var d=this.vert=q("div",[q("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=q("div",[q("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a(d);a(e);p(d,"scroll",function(){d.clientHeight&&b(d.scrollTop,"vertical")});p(e,"scroll",function(){e.clientWidth&&b(e.scrollLeft,"horizontal")});this.checkedOverlay=!1;y&&8>z&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function Ac(){}function ud(a){a.display.scrollbars&& +(a.display.scrollbars.clear(),a.display.scrollbars.addClass&&gb(a.display.wrapper,a.display.scrollbars.addClass));a.display.scrollbars=new m.scrollbarModel[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller);p(b,"mousedown",function(){a.state.focused&&setTimeout(function(){a.display.input.focus()},0)});b.setAttribute("cm-not-content","true")},function(b,c){c=="horizontal"?Ia(a,b):hb(a,b)},a);a.display.scrollbars.addClass&&ib(a.display.wrapper,a.display.scrollbars.addClass)} +function Ja(a,b){b||(b=fb(a));var c=a.display.barWidth,d=a.display.barHeight;Bd(a,b);for(var e=0;4>e&&c!=a.display.barWidth||d!=a.display.barHeight;e++)c!=a.display.barWidth&&a.options.lineWrapping&&Hb(a),Bd(a,fb(a)),c=a.display.barWidth,d=a.display.barHeight}function Bd(a,b){var c=a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+"px";c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px";d.right&&d.bottom?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height= +d.bottom+"px",c.scrollbarFiller.style.width=d.right+"px"):c.scrollbarFiller.style.display="";d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=d.bottom+"px",c.gutterFiller.style.width=b.gutterWidth+"px"):c.gutterFiller.style.display=""}function Bc(a,b,c){var d=c&&null!=c.top?Math.max(0,c.top):a.scroller.scrollTop,d=Math.floor(d-a.lineSpace.offsetTop),e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight,d=xa(b,d), +e=xa(b,e);if(c&&c.ensure){var f=c.ensure.from.line,c=c.ensure.to.line;f<d?(d=f,e=xa(b,ga(r(b,f))+a.wrapper.clientHeight)):Math.min(c,b.lastLine())>=e&&(d=xa(b,ga(r(b,c))-a.wrapper.clientHeight),e=c)}return{from:d,to:Math.max(e,d+1)}}function wc(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=Cc(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g<c.length;g++)if(!c[g].hidden){a.options.fixedGutter&&c[g].gutter&&(c[g].gutter.style.left= +f);var h=c[g].alignable;if(h)for(var i=0;i<h.length;i++)h[i].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=d+e+"px")}}function yd(a){if(!a.options.lineNumbers)return!1;var b=a.doc,b=""+a.options.lineNumberFormatter(b.first+b.size-1+a.options.firstLineNumber),c=a.display;if(b.length!=c.lineNumChars){var d=c.measure.appendChild(q("div",[q("div",b)],"CodeMirror-linenumber CodeMirror-gutter-elt")),e=d.firstChild.offsetWidth,d=d.offsetWidth-e;c.lineGutter.style.width="";c.lineNumInnerWidth= +Math.max(e,c.lineGutter.offsetWidth-d)+1;c.lineNumWidth=c.lineNumInnerWidth+d;c.lineNumChars=c.lineNumInnerWidth?b.length:-1;c.lineGutter.style.width=c.lineNumWidth+"px";xc(a);return!0}return!1}function Cc(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function Ib(a,b,c){var d=a.display;this.viewport=b;this.visible=Bc(d,a.doc,b);this.editorIsHidden=!d.wrapper.offsetWidth;this.wrapperHeight=d.wrapper.clientHeight;this.wrapperWidth=d.wrapper.clientWidth;this.oldDisplayWidth= +la(a);this.force=c;this.dims=Dc(a);this.events=[]}function Ec(a,b){var c=a.display,d=a.doc;if(b.editorIsHidden)return ma(a),!1;if(!b.force&&b.visible.from>=c.viewFrom&&b.visible.to<=c.viewTo&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo)&&c.renderedView==c.view&&0==Cd(a))return!1;yd(a)&&(ma(a),b.dims=Dc(a));var e=d.first+d.size,f=Math.max(b.visible.from-a.options.viewportMargin,d.first),g=Math.min(e,b.visible.to+a.options.viewportMargin);c.viewFrom<f&&20>f-c.viewFrom&&(f=Math.max(d.first, +c.viewFrom));c.viewTo>g&&20>c.viewTo-g&&(g=Math.min(e,c.viewTo));na&&(f=Fc(a.doc,f),g=Dd(a.doc,g));d=f!=c.viewFrom||g!=c.viewTo||c.lastWrapHeight!=b.wrapperHeight||c.lastWrapWidth!=b.wrapperWidth;e=a.display;0==e.view.length||f>=e.viewTo||g<=e.viewFrom?(e.view=Jb(a,f,g),e.viewFrom=f):(e.viewFrom>f?e.view=Jb(a,f,e.viewFrom).concat(e.view):e.viewFrom<f&&(e.view=e.view.slice(ya(a,f))),e.viewFrom=f,e.viewTo<g)?e.view=e.view.concat(Jb(a,e.viewTo,g)):e.viewTo>g&&(e.view=e.view.slice(0,ya(a,g)));e.viewTo= +g;c.viewOffset=ga(r(a.doc,c.viewFrom));a.display.mover.style.top=c.viewOffset+"px";g=Cd(a);if(!d&&0==g&&!b.force&&c.renderedView==c.view&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo))return!1;f=aa();4<g&&(c.lineDiv.style.display="none");nf(a,c.updateLineNumbers,b.dims);4<g&&(c.lineDiv.style.display="");c.renderedView=c.view;f&&(aa()!=f&&f.offsetHeight)&&f.focus();va(c.cursorDiv);va(c.selectionDiv);c.gutters.style.height=0;d&&(c.lastWrapHeight=b.wrapperHeight,c.lastWrapWidth=b.wrapperWidth, +bb(a,400));c.updateLineNumbers=null;return!0}function Ed(a,b){for(var c=b.viewport,d=!0;;d=!1){if(!d||!(a.options.lineWrapping&&b.oldDisplayWidth!=la(a)))if(c&&null!=c.top&&(c={top:Math.min(a.doc.height+(a.display.mover.offsetHeight-a.display.lineSpace.offsetHeight)-Gc(a),c.top)}),b.visible=Bc(a.display,a.doc,c),b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break;if(!Ec(a,b))break;Hb(a);d=fb(a);jb(a);Hc(a,d);Ja(a,d)}b.signal(a,"update",a);if(a.display.viewFrom!=a.display.reportedViewFrom|| +a.display.viewTo!=a.display.reportedViewTo)b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo}function Ic(a,b){var c=new Ib(a,b);if(Ec(a,c)){Hb(a);Ed(a,c);var d=fb(a);jb(a);Hc(a,d);Ja(a,d);c.finish()}}function Hc(a,b){a.display.sizer.style.minHeight=b.docHeight+"px";var c=b.docHeight+a.display.barHeight;a.display.heightForcer.style.top=c+"px";a.display.gutters.style.height=Math.max(c+$(a),b.clientHeight)+ +"px"}function Hb(a){for(var a=a.display,b=a.lineDiv.offsetTop,c=0;c<a.view.length;c++){var d=a.view[c],e;if(!d.hidden){if(y&&8>z){var f=d.node.offsetTop+d.node.offsetHeight;e=f-b;b=f}else e=d.node.getBoundingClientRect(),e=e.bottom-e.top;f=d.line.height-e;2>e&&(e=ta(a));if(0.001<f||-0.001>f)if(Z(d.line,e),Fd(d.line),d.rest)for(e=0;e<d.rest.length;e++)Fd(d.rest[e])}}}function Fd(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.offsetHeight}function Dc(a){for(var b= +a.display,c={},d={},e=b.gutters.clientLeft,f=b.gutters.firstChild,g=0;f;f=f.nextSibling,++g)c[a.options.gutters[g]]=f.offsetLeft+f.clientLeft+e,d[a.options.gutters[g]]=f.clientWidth;return{fixedPos:Cc(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function nf(a,b,c){function d(b){var c=b.nextSibling;E&&T&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b);return c}for(var e=a.display,f=a.options.lineNumbers, +g=e.lineDiv,h=g.firstChild,i=e.view,e=e.viewFrom,j=0;j<i.length;j++){var k=i[j];if(!k.hidden)if(!k.node||k.node.parentNode!=g){var n=of(a,k,e,c);g.insertBefore(n,h)}else{for(;h!=k.node;)h=d(h);h=f&&null!=b&&b<=e&&k.lineNumber;k.changes&&(-1<G(k.changes,"gutter")&&(h=!1),Gd(a,k,e,c));h&&(va(k.lineNumber),k.lineNumber.appendChild(document.createTextNode(""+a.options.lineNumberFormatter(e+a.options.firstLineNumber))));h=k.node.nextSibling}e+=k.size}for(;h;)h=d(h)}function Gd(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f= +b.changes[e];if("text"==f){var f=b,g=f.text.className,h=Hd(a,f);f.text==f.node&&(f.node=h.pre);f.text.parentNode.replaceChild(h.pre,f.text);f.text=h.pre;h.bgClass!=f.bgClass||h.textClass!=f.textClass?(f.bgClass=h.bgClass,f.textClass=h.textClass,Jc(f)):g&&(f.text.className=g)}else if("gutter"==f)Id(a,b,c,d);else if("class"==f)Jc(b);else if("widget"==f){f=a;g=b;h=d;g.alignable&&(g.alignable=null);for(var i=g.node.firstChild,j=void 0;i;i=j)j=i.nextSibling,"CodeMirror-linewidget"==i.className&&g.node.removeChild(i); +Jd(f,g,h)}}b.changes=null}function Kb(a){a.node==a.text&&(a.node=q("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),y&&8>z&&(a.node.style.zIndex=2));return a.node}function Hd(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):Kd(a,b)}function Jc(a){var b=a.bgClass?a.bgClass+" "+(a.line.bgClass||""):a.line.bgClass;b&&(b+=" CodeMirror-linebackground"); +if(a.background)b?a.background.className=b:(a.background.parentNode.removeChild(a.background),a.background=null);else if(b){var c=Kb(a);a.background=c.insertBefore(q("div",null,b),c.firstChild)}a.line.wrapClass?Kb(a).className=a.line.wrapClass:a.node!=a.text&&(a.node.className="");a.text.className=(a.textClass?a.textClass+" "+(a.line.textClass||""):a.line.textClass)||""}function Id(a,b,c,d){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);var e=b.line.gutterMarkers;if(a.options.lineNumbers|| +e){var f=Kb(b),g=b.gutter=q("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px; width: "+d.gutterTotalWidth+"px");a.display.input.setUneditable(g);f.insertBefore(g,b.text);b.line.gutterClass&&(g.className+=" "+b.line.gutterClass);if(a.options.lineNumbers&&(!e||!e["CodeMirror-linenumbers"]))b.lineNumber=g.appendChild(q("div",""+a.options.lineNumberFormatter(c+a.options.firstLineNumber),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+ +"px; width: "+a.display.lineNumInnerWidth+"px"));if(e)for(b=0;b<a.options.gutters.length;++b)c=a.options.gutters[b],(f=e.hasOwnProperty(c)&&e[c])&&g.appendChild(q("div",[f],"CodeMirror-gutter-elt","left: "+d.gutterLeft[c]+"px; width: "+d.gutterWidth[c]+"px"))}}function of(a,b,c,d){var e=Hd(a,b);b.text=b.node=e.pre;e.bgClass&&(b.bgClass=e.bgClass);e.textClass&&(b.textClass=e.textClass);Jc(b);Id(a,b,c,d);Jd(a,b,d);return b.node}function Jd(a,b,c){Ld(a,b.line,b,c,!0);if(b.rest)for(var d=0;d<b.rest.length;d++)Ld(a, +b.rest[d],b,c,!1)}function Ld(a,b,c,d,e){if(b.widgets)for(var f=Kb(c),g=0,b=b.widgets;g<b.length;++g){var h=b[g],i=q("div",[h.node],"CodeMirror-linewidget");h.handleMouseEvents||i.setAttribute("cm-ignore-events","true");var j=h,k=i,n=d;if(j.noHScroll){(c.alignable||(c.alignable=[])).push(k);var l=n.wrapperWidth;k.style.left=n.fixedPos+"px";j.coverGutter||(l-=n.gutterTotalWidth,k.style.paddingLeft=n.gutterTotalWidth+"px");k.style.width=l+"px"}j.coverGutter&&(k.style.zIndex=5,k.style.position="relative", +j.noHScroll||(k.style.marginLeft=-n.gutterTotalWidth+"px"));a.display.input.setUneditable(i);e&&h.above?f.insertBefore(i,c.gutter||c.text):f.appendChild(i);H(h,"redraw")}}function Lb(a,b){return 0>v(a,b)?b:a}function Mb(a,b){return 0>v(a,b)?a:b}function Md(a){a.state.focused||(a.display.input.focus(),sc(a))}function Nb(a){return a.options.readOnly||a.doc.cantEdit}function Kc(a,b,c,d,e){var f=a.doc;a.display.shift=!1;d||(d=f.sel);var g=oa(b),h=null;a.state.pasteIncoming&&1<d.ranges.length&&(U&&U.join("\n")== +b?h=0==d.ranges.length%U.length&&kb(U,oa):g.length==d.ranges.length&&(h=kb(g,function(a){return[a]})));for(var i=d.ranges.length-1;0<=i;i--){var j=d.ranges[i],k=j.from(),n=j.to();j.empty()&&(c&&0<c?k=o(k.line,k.ch-c):a.state.overwrite&&!a.state.pasteIncoming&&(n=o(n.line,Math.min(r(f,n.line).text.length,n.ch+x(g).length))));var l=a.curOp.updateInput,k={from:k,to:n,text:h?h[i%h.length]:g,origin:e||(a.state.pasteIncoming?"paste":a.state.cutIncoming?"cut":"+input")};Ka(a.doc,k);H(a,"inputRead",a,k); +if(b&&!a.state.pasteIncoming&&a.options.electricChars&&a.options.smartIndent&&100>j.head.ch&&(!i||d.ranges[i-1].head.line!=j.head.line)){j=a.getModeAt(j.head);k=pa(k);n=!1;if(j.electricChars)for(var s=0;s<j.electricChars.length;s++){if(-1<b.indexOf(j.electricChars.charAt(s))){n=lb(a,k.line,"smart");break}}else j.electricInput&&j.electricInput.test(r(f,k.line).text.slice(0,k.ch))&&(n=lb(a,k.line,"smart"));n&&H(a,"electricInput",a,k.line)}}La(a);a.curOp.updateInput=l;a.curOp.typing=!0;a.state.pasteIncoming= +a.state.cutIncoming=!1}function Nd(a){for(var b=[],c=[],d=0;d<a.doc.sel.ranges.length;d++){var e=a.doc.sel.ranges[d].head.line,e={anchor:o(e,0),head:o(e+1,0)};c.push(e);b.push(a.getRange(e.anchor,e.head))}return{text:b,ranges:c}}function Od(a){a.setAttribute("autocorrect","off");a.setAttribute("autocapitalize","off");a.setAttribute("spellcheck","false")}function Lc(a){this.cm=a;this.prevInput="";this.pollingFast=!1;this.polling=new Ya;this.hasSelection=this.inaccurateSelection=!1;this.composing=null} +function Pd(){var a=q("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none"),b=q("div",[a],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");E?a.style.width="1000px":a.setAttribute("wrap","off");Ma&&(a.style.border="1px solid black");Od(a);return b}function Mc(a){this.cm=a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new Ya;this.gracePeriod=!1}function Qd(a,b){var c=Nc(a,b.line);if(!c|| +c.hidden)return null;var d=r(a.doc,b.line),c=Rd(c,d,b.line);(d=V(d))&&Ob(d,b.ch);d=Sd(c.map,b.ch,"left");d.offset="right"==d.collapse?d.end:d.start;return d}function Na(a,b){b&&(a.bad=!0);return a}function Pb(a,b,c){var d;if(b==a.display.lineDiv){d=a.display.lineDiv.childNodes[c];if(!d)return Na(a.clipPos(o(a.display.viewTo-1)),!0);b=null;c=0}else for(d=b;;d=d.parentNode){if(!d||d==a.display.lineDiv)return null;if(d.parentNode&&d.parentNode==a.display.lineDiv)break}for(var e=0;e<a.display.view.length;e++){var f= +a.display.view[e];if(f.node==d)return pf(f,b,c)}}function pf(a,b,c){function d(b,c,d){for(var e=-1;e<(j?j.length:0);e++)for(var f=0>e?i.map:j[e],g=0;g<f.length;g+=3){var h=f[g+2];if(h==b||h==c){c=C(0>e?a.line:a.rest[e]);e=f[g]+d;if(0>d||h!=b)e=f[g+(d?1:0)];return o(c,e)}}}var e=a.text.firstChild,f=!1;if(!b||!Oc(e,b))return Na(o(C(a.line),0),!0);if(b==e&&(f=!0,b=e.childNodes[c],c=0,!b))return c=a.rest?x(a.rest):a.line,Na(o(C(c),c.text.length),f);var g=3==b.nodeType?b:null,h=b;!g&&(1==b.childNodes.length&& +3==b.firstChild.nodeType)&&(g=b.firstChild,c&&(c=g.nodeValue.length));for(;h.parentNode!=e;)h=h.parentNode;var i=a.measure,j=i.maps;if(b=d(g,h,c))return Na(b,f);e=h.nextSibling;for(g=g?g.nodeValue.length-c:0;e;e=e.nextSibling){if(b=d(e,e.firstChild,0))return Na(o(b.line,b.ch-g),f);g+=e.textContent.length}h=h.previousSibling;for(g=c;h;h=h.previousSibling){if(b=d(h,h.firstChild,-1))return Na(o(b.line,b.ch+g),f);g+=e.textContent.length}}function qf(a,b,c,d,e){function f(a){return function(b){return b.id== +a}}function g(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)""==c&&(c=b.textContent.replace(/\u200b/g,"")),h+=c;else{var c=b.getAttribute("cm-marker"),n;if(c){if(b=a.findMarks(o(d,0),o(e+1,0),f(+c)),b.length&&(n=b[0].find()))h+=za(a.doc,n.from,n.to).join("\n")}else if("false"!=b.getAttribute("contenteditable")){for(n=0;n<b.childNodes.length;n++)g(b.childNodes[n]);/^(pre|div|p)$/i.test(b.nodeName)&&(i=!0)}}}else if(3==b.nodeType&&(b=b.nodeValue))i&&(h+="\n",i=!1),h+=b}for(var h="", +i=!1;;){g(b);if(b==c)break;b=b.nextSibling}return h}function ha(a,b){this.ranges=a;this.primIndex=b}function w(a,b){this.anchor=a;this.head=b}function W(a,b){var c=a[b];a.sort(function(a,b){return v(a.from(),b.from())});b=G(a,c);for(c=1;c<a.length;c++){var d=a[c],e=a[c-1];if(0<=v(e.to(),d.from())){var f=Mb(e.from(),d.from()),g=Lb(e.to(),d.to()),d=e.empty()?d.from()==d.head:e.from()==e.head;c<=b&&--b;a.splice(--c,2,new w(d?g:f,d?f:g))}}return new ha(a,b)}function ba(a,b){return new ha([new w(a,b|| +a)],0)}function t(a,b){if(b.line<a.first)return o(a.first,0);var c=a.first+a.size-1;if(b.line>c)return o(c,r(a,c).text.length);var c=r(a,b.line).text.length,d=b.ch,c=null==d||d>c?o(b.line,c):0>d?o(b.line,0):b;return c}function mb(a,b){return b>=a.first&&b<a.first+a.size}function nb(a,b,c,d){return a.cm&&a.cm.display.shift||a.extend?(a=b.anchor,d&&(b=0>v(c,a),b!=0>v(d,a)?(a=c,c=d):b!=0>v(c,d)&&(c=d)),new w(a,c)):new w(d||c,c)}function Qb(a,b,c,d){A(a,new ha([nb(a,a.sel.primary(),b,c)],0),d)}function Td(a, +b,c){for(var d=[],e=0;e<a.sel.ranges.length;e++)d[e]=nb(a,a.sel.ranges[e],b[e],null);b=W(d,a.sel.primIndex);A(a,b,c)}function Pc(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c;A(a,W(e,a.sel.primIndex),d)}function rf(a,b){var c={ranges:b.ranges,update:function(b){this.ranges=[];for(var c=0;c<b.length;c++)this.ranges[c]=new w(t(a,b[c].anchor),t(a,b[c].head))}};F(a,"beforeSelectionChange",a,c);a.cm&&F(a.cm,"beforeSelectionChange",a.cm,c);return c.ranges!=b.ranges?W(c.ranges,c.ranges.length-1):b}function Ud(a, +b,c){var d=a.history.done,e=x(d);e&&e.ranges?(d[d.length-1]=b,Rb(a,b,c)):A(a,b,c)}function A(a,b,c){Rb(a,b,c);var b=a.sel,d=a.cm?a.cm.curOp.id:NaN,e=a.history,f=c&&c.origin,g;if(!(g=d==e.lastSelOp))if(g=f)if(g=e.lastSelOrigin==f)if(!(g=e.lastModTime==e.lastSelTime&&e.lastOrigin==f)){g=x(e.done);var h=f.charAt(0);g="*"==h||"+"==h&&g.ranges.length==b.ranges.length&&g.somethingSelected()==b.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}g?e.done[e.done.length- +1]=b:Sb(b,e.done);e.lastSelTime=+new Date;e.lastSelOrigin=f;e.lastSelOp=d;c&&!1!==c.clearRedo&&Vd(e.undone)}function Rb(a,b,c){if(P(a,"beforeSelectionChange")||a.cm&&P(a.cm,"beforeSelectionChange"))b=rf(a,b);var d=c&&c.bias||(0>v(b.primary().head,a.sel.primary().head)?-1:1);Wd(a,Xd(a,b,d,!0));!(c&&!1===c.scroll)&&a.cm&&La(a.cm)}function Wd(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,Yd(a.cm)),H(a,"cursorActivity",a))}function Zd(a){Wd(a,Xd(a,a.sel,null, +!1),ca)}function Xd(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=Tb(a,g.anchor,c,d),i=Tb(a,g.head,c,d);if(e||h!=g.anchor||i!=g.head)e||(e=b.ranges.slice(0,f)),e[f]=new w(h,i)}return e?W(e,b.primIndex):b}function Tb(a,b,c,d){var e=!1,f=b,g=c||1;a.cantEdit=!1;a:for(;;){var h=r(a,f.line);if(h.markedSpans)for(var i=0;i<h.markedSpans.length;++i){var j=h.markedSpans[i],k=j.marker;if((null==j.from||(k.inclusiveLeft?j.from<=f.ch:j.from<f.ch))&&(null==j.to||(k.inclusiveRight?j.to>=f.ch: +j.to>f.ch))){if(d&&(F(k,"beforeCursorEnter"),k.explicitlyCleared))if(h.markedSpans){--i;continue}else break;if(k.atomic){i=k.find(0>g?-1:1);if(0==v(i,f)&&(i.ch+=g,0>i.ch?i=i.line>a.first?t(a,o(i.line-1)):null:i.ch>h.text.length&&(i=i.line<a.first+a.size-1?o(i.line+1,0):null),!i)){if(e){if(!d)return Tb(a,b,c,!0);a.cantEdit=!0;return o(a.first,0)}e=!0;i=b;g=-g}f=i;continue a}}}return f}}function jb(a){a.display.input.showSelection(a.display.input.prepareSelection())}function $d(a,b){for(var c=a.doc, +d={},e=d.cursors=document.createDocumentFragment(),f=d.selection=document.createDocumentFragment(),g=0;g<c.sel.ranges.length;g++)if(!(!1===b&&g==c.sel.primIndex)){var h=c.sel.ranges[g],i=h.empty();if(i||a.options.showCursorWhenSelecting){var j=a,k=e,n=ia(j,h.head,"div",null,null,!j.options.singleCursorHeightPerLine),l=k.appendChild(q("div"," ","CodeMirror-cursor"));l.style.left=n.left+"px";l.style.top=n.top+"px";l.style.height=Math.max(0,n.bottom-n.top)*j.options.cursorHeight+"px";n.other&&(j=k.appendChild(q("div", +" ","CodeMirror-cursor CodeMirror-secondarycursor")),j.style.display="",j.style.left=n.other.left+"px",j.style.top=n.other.top+"px",j.style.height=0.85*(n.other.bottom-n.other.top)+"px")}i||sf(a,h,f)}return d}function sf(a,b,c){function d(a,b,c,d){0>b&&(b=0);b=Math.round(b);d=Math.round(d);h.appendChild(q("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?k-a:c)+"px; height: "+(d-b)+"px"))}function e(b,c,e){var f=r(g,b),h=f.text.length,i,n;tf(V(f), +c||0,null==e?h:e,function(g,m,q){var r=Ub(a,o(b,g),"div",f,"left"),p,t;g==m?(p=r,q=t=r.left):(p=Ub(a,o(b,m-1),"div",f,"right"),"rtl"==q&&(q=r,r=p,p=q),q=r.left,t=p.right);null==c&&0==g&&(q=j);3<p.top-r.top&&(d(q,r.top,null,r.bottom),q=j,r.bottom<p.top&&d(q,r.bottom,null,p.top));null==e&&m==h&&(t=k);if(!i||r.top<i.top||r.top==i.top&&r.left<i.left)i=r;if(!n||p.bottom>n.bottom||p.bottom==n.bottom&&p.right>n.right)n=p;q<j+1&&(q=j);d(q,p.top,t-q,p.bottom)});return{start:i,end:n}}var f=a.display,g=a.doc, +h=document.createDocumentFragment(),i=ae(a.display),j=i.left,k=Math.max(f.sizerWidth,la(a)-f.sizer.offsetLeft)-i.right,f=b.from(),b=b.to();if(f.line==b.line)e(f.line,f.ch,b.ch);else{var n=r(g,f.line),i=r(g,b.line),i=da(n)==da(i),f=e(f.line,f.ch,i?n.text.length+1:null).end,b=e(b.line,i?0:null,b.ch).start;i&&(f.top<b.top-2?(d(f.right,f.top,null,f.bottom),d(j,b.top,b.left,b.bottom)):d(f.right,f.top,b.left-f.right,f.bottom));f.bottom<b.top&&d(j,f.bottom,null,b.top)}c.appendChild(h)}function Qc(a){if(a.state.focused){var b= +a.display;clearInterval(b.blinker);var c=!0;b.cursorDiv.style.visibility="";0<a.options.cursorBlinkRate?b.blinker=setInterval(function(){b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate):0>a.options.cursorBlinkRate&&(b.cursorDiv.style.visibility="hidden")}}function bb(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.viewTo&&a.state.highlight.set(b,Za(uf,a))}function uf(a){var b=a.doc;b.frontier<b.first&&(b.frontier=b.first);if(!(b.frontier>=a.display.viewTo)){var c=+new Date+ +a.options.workTime,d=Oa(b.mode,ob(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(b.frontier>=a.display.viewFrom){var g=f.styles,h=be(a,f,d,true);f.styles=h.styles;var i=f.styleClasses;if(h=h.classes)f.styleClasses=h;else if(i)f.styleClasses=null;i=!g||g.length!=f.styles.length||i!=h&&(!i||!h||i.bgClass!=h.bgClass||i.textClass!=h.textClass);for(h=0;!i&&h<g.length;++h)i=g[h]!=f.styles[h];i&&e.push(b.frontier);f.stateAfter=Oa(b.mode,d)}else{Rc(a,f.text, +d);f.stateAfter=b.frontier%5==0?Oa(b.mode,d):null}++b.frontier;if(+new Date>c){bb(a,a.options.workDelay);return true}});e.length&&Q(a,function(){for(var b=0;b<e.length;b++)ja(a,e[b],"text")})}}function vf(a,b,c){for(var d,e,f=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1E3:100);b>g;--b){if(b<=f.first)return f.first;var h=r(f,b-1);if(h.stateAfter&&(!c||b<=f.frontier))return b;h=X(h.text,null,a.options.tabSize);if(null==e||d>h)e=b-1,d=h}return e}function ob(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0; +var f=vf(a,b,c),g=f>d.first&&r(d,f-1).stateAfter,g=g?Oa(d.mode,g):wf(d.mode);d.iter(f,b,function(c){Rc(a,c.text,g);c.stateAfter=f==b-1||0==f%5||f>=e.viewFrom&&f<e.viewTo?Oa(d.mode,g):null;++f});c&&(d.frontier=f);return g}function ae(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=R(a.measure,q("pre","x")),b=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle,b={left:parseInt(b.paddingLeft),right:parseInt(b.paddingRight)};!isNaN(b.left)&&!isNaN(b.right)&&(a.cachedPaddingH=b);return b} +function $(a){return zd-a.display.nativeBarWidth}function la(a){return a.display.scroller.clientWidth-$(a)-a.display.barWidth}function Gc(a){return a.display.scroller.clientHeight-$(a)-a.display.barHeight}function Rd(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;d<a.rest.length;d++)if(a.rest[d]==b)return{map:a.measure.maps[d],cache:a.measure.caches[d]};for(d=0;d<a.rest.length;d++)if(C(a.rest[d])>c)return{map:a.measure.maps[d],cache:a.measure.caches[d],before:!0}} +function Nc(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[ya(a,b)];var c=a.display.externalMeasured;if(c&&b>=c.lineN&&b<c.lineN+c.size)return c}function Vb(a,b){var c=C(b),d=Nc(a,c);d&&!d.text?d=null:d&&d.changes&&Gd(a,d,c,Dc(a));if(!d){var e;e=da(b);d=C(e);e=a.display.externalMeasured=new ce(a.doc,e,d);e.lineN=d;d=e.built=Kd(a,e);e.text=d.pre;R(a.display.lineMeasure,d.pre);d=e}c=Rd(d,b,c);return{line:b,view:d,rect:null,map:c.map,cache:c.cache,before:c.before,hasHeights:!1}} +function Sc(a,b,c,d,e){b.before&&(c=-1);var f=c+(d||"");if(b.cache.hasOwnProperty(f))a=b.cache[f];else{b.rect||(b.rect=b.view.text.getBoundingClientRect());if(!b.hasHeights){var g=b.view,h=b.rect,i=a.options.lineWrapping,j=i&&la(a);if(!g.measure.heights||i&&g.measure.width!=j){var k=g.measure.heights=[];if(i){g.measure.width=j;g=g.text.firstChild.getClientRects();for(i=0;i<g.length-1;i++){var j=g[i],n=g[i+1];2<Math.abs(j.bottom-n.bottom)&&k.push((j.bottom+n.top)/2-h.top)}}k.push(h.bottom-h.top)}b.hasHeights= +!0}var g=d,i=Sd(b.map,c,g),d=i.node,h=i.start,j=i.end,c=i.collapse,l;if(3==d.nodeType){for(k=0;4>k;k++){for(;h&&pb(b.line.text.charAt(i.coverStart+h));)--h;for(;i.coverStart+j<i.coverEnd&&pb(b.line.text.charAt(i.coverStart+j));)++j;if(y&&9>z&&0==h&&j==i.coverEnd-i.coverStart)l=d.parentNode.getBoundingClientRect();else if(y&&a.options.lineWrapping){var s=Aa(d,h,j).getClientRects();l=s.length?s["right"==g?s.length-1:0]:Tc}else l=Aa(d,h,j).getBoundingClientRect()||Tc;if(l.left||l.right||0==h)break;j= +h;h-=1;c="right"}if(y&&11>z){if(!(s=!window.screen))if(!(s=null==screen.logicalXDPI))if(!(s=screen.logicalXDPI==screen.deviceXDPI))null!=Uc?s=Uc:(k=R(a.display.measure,q("span","x")),s=k.getBoundingClientRect(),k=Aa(k,0,1).getBoundingClientRect(),s=Uc=1<Math.abs(s.left-k.left)),s=!s;s||(s=screen.logicalXDPI/screen.deviceXDPI,k=screen.logicalYDPI/screen.deviceYDPI,l={left:l.left*s,right:l.right*s,top:l.top*k,bottom:l.bottom*k})}}else 0<h&&(c=g="right"),l=a.options.lineWrapping&&1<(s=d.getClientRects()).length? +s["right"==g?s.length-1:0]:d.getBoundingClientRect();if(y&&9>z&&!h&&(!l||!l.left&&!l.right))l=(l=d.parentNode.getClientRects()[0])?{left:l.left,right:l.left+cb(a.display),top:l.top,bottom:l.bottom}:Tc;s=l.top-b.rect.top;d=l.bottom-b.rect.top;h=(s+d)/2;g=b.view.measure.heights;for(k=0;k<g.length-1&&!(h<g[k]);k++);c={left:("right"==c?l.right:l.left)-b.rect.left,right:("left"==c?l.left:l.right)-b.rect.left,top:k?g[k-1]:0,bottom:g[k]};!l.left&&!l.right&&(c.bogus=!0);a.options.singleCursorHeightPerLine|| +(c.rtop=s,c.rbottom=d);a=c;a.bogus||(b.cache[f]=a)}return{left:a.left,right:a.right,top:e?a.rtop:a.top,bottom:e?a.rbottom:a.bottom}}function Sd(a,b,c){for(var d,e,f,g,h=0;h<a.length;h+=3){var i=a[h],j=a[h+1];if(b<i)e=0,f=1,g="left";else if(b<j)e=b-i,f=e+1;else if(h==a.length-3||b==j&&a[h+3]>b)f=j-i,e=f-1,b>=j&&(g="right");if(null!=e){d=a[h+2];if(i==j&&c==(d.insertLeft?"left":"right"))g=c;if("left"==c&&0==e)for(;h&&a[h-2]==a[h-3]&&a[h-1].insertLeft;)d=a[(h-=3)+2],g="left";if("right"==c&&e==j-i)for(;h< +a.length-3&&a[h+3]==a[h+4]&&!a[h+5].insertLeft;)d=a[(h+=3)+2],g="right";break}}return{node:d,start:e,end:f,collapse:g,coverStart:i,coverEnd:j}}function de(a){if(a.measure&&(a.measure.cache={},a.measure.heights=null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function ee(a){a.display.externalMeasure=null;va(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)de(a.display.view[b])}function db(a){ee(a);a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH= +null;a.options.lineWrapping||(a.display.maxLineChanged=!0);a.display.lineNumChars=null}function Vc(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=qb(b.widgets[e]);c.top+=f;c.bottom+=f}if("line"==d)return c;d||(d="local");b=ga(b);b="local"==d?b+a.display.lineSpace.offsetTop:b-a.display.viewOffset;if("page"==d||"window"==d)a=a.display.lineSpace.getBoundingClientRect(),b+=a.top+("window"==d?0:window.pageYOffset||(document.documentElement||document.body).scrollTop), +d=a.left+("window"==d?0:window.pageXOffset||(document.documentElement||document.body).scrollLeft),c.left+=d,c.right+=d;c.top+=b;c.bottom+=b;return c}function fe(a,b,c){if("div"==c)return b;var d=b.left,b=b.top;if("page"==c)d-=window.pageXOffset||(document.documentElement||document.body).scrollLeft,b-=window.pageYOffset||(document.documentElement||document.body).scrollTop;else if("local"==c||!c)c=a.display.sizer.getBoundingClientRect(),d+=c.left,b+=c.top;a=a.display.lineSpace.getBoundingClientRect(); +return{left:d-a.left,top:b-a.top}}function Ub(a,b,c,d,e){d||(d=r(a.doc,b.line));return Vc(a,d,Sc(a,Vb(a,d),b.ch,e),c)}function ia(a,b,c,d,e,f){function g(b,g){var h=Sc(a,e,b,g?"right":"left",f);g?h.left=h.right:h.right=h.left;return Vc(a,d,h,c)}function h(a,b){var c=i[b],d=c.level%2;a==(c.level%2?c.to:c.from)&&b&&c.level<i[b-1].level?(c=i[--b],a=Wc(c)-(c.level%2?0:1),d=!0):a==Wc(c)&&(b<i.length-1&&c.level<i[b+1].level)&&(c=i[++b],a=(c.level%2?c.to:c.from)-c.level%2,d=!1);return d&&a==c.to&&a>c.from? +g(a-1):g(a,d)}d=d||r(a.doc,b.line);e||(e=Vb(a,d));var i=V(d),b=b.ch;if(!i)return g(b);var j=Ob(i,b),j=h(b,j);null!=rb&&(j.other=h(b,rb));return j}function ge(a,b){var c=0,b=t(a.doc,b);a.options.lineWrapping||(c=cb(a.display)*b.ch);var d=r(a.doc,b.line),e=ga(d)+a.display.lineSpace.offsetTop;return{left:c,right:c,top:e,bottom:e+d.height}}function Wb(a,b,c,d){a=o(a,b);a.xRel=d;c&&(a.outside=!0);return a}function Xc(a,b,c){var d=a.doc,c=c+a.display.viewOffset;if(0>c)return Wb(d.first,0,!0,-1);var e=xa(d, +c),f=d.first+d.size-1;if(e>f)return Wb(d.first+d.size-1,r(d,f).text.length,!0,1);0>b&&(b=0);for(d=r(d,e);;)if(e=xf(a,d,e,b,c),f=(d=wa(d,!1))&&d.find(0,!0),d&&(e.ch>f.from.ch||e.ch==f.from.ch&&0<e.xRel))e=C(d=f.to.line);else return e}function xf(a,b,c,d,e){function f(d){d=ia(a,o(c,d),"line",b,j);h=!0;if(g>d.bottom)return d.left-i;if(g<d.top)return d.left+i;h=!1;return d.left}var g=e-ga(b),h=!1,i=2*a.display.wrapper.clientWidth,j=Vb(a,b),k=V(b),n=b.text.length,e=Xb(b),l=Yb(b),s=f(e),I=h,m=f(l),q=h; +if(d>m)return Wb(c,l,q,1);for(;;){if(k?l==e||l==Yc(b,e,1):1>=l-e){k=d<s||d-s<=m-d?e:l;for(d-=k==e?s:m;pb(b.text.charAt(k));)++k;return Wb(c,k,k==e?I:q,-1>d?-1:1<d?1:0)}var r=Math.ceil(n/2),p=e+r;if(k)for(var p=e,t=0;t<r;++t)p=Yc(b,p,1);t=f(p);if(t>d){l=p;m=t;if(q=h)m+=1E3;n=r}else e=p,s=t,I=h,n-=r}}function ta(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==Ba){Ba=q("pre");for(var b=0;49>b;++b)Ba.appendChild(document.createTextNode("x")),Ba.appendChild(q("br"));Ba.appendChild(document.createTextNode("x"))}R(a.measure, +Ba);b=Ba.offsetHeight/50;3<b&&(a.cachedTextHeight=b);va(a.measure);return b||1}function cb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=q("span","xxxxxxxxxx"),c=q("pre",[b]);R(a.measure,c);b=b.getBoundingClientRect();b=(b.right-b.left)/10;2<b&&(a.cachedCharWidth=b);return b||10}function Fa(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1, +scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++yf};Pa?Pa.ops.push(a.curOp):a.curOp.ownsGroup=Pa={ops:[a.curOp],delayedCallbacks:[]}}function Ha(a){if(a=a.curOp.ownsGroup)try{var b=a.delayedCallbacks,c=0;do{for(;c<b.length;c++)b[c]();for(var d=0;d<a.ops.length;d++){var e=a.ops[d];if(e.cursorActivityHandlers)for(;e.cursorActivityCalled<e.cursorActivityHandlers.length;)e.cursorActivityHandlers[e.cursorActivityCalled++](e.cm)}}while(c<b.length)}finally{Pa=null;for(b=0;b<a.ops.length;b++)a.ops[b].cm.curOp= +null;a=a.ops;for(b=0;b<a.length;b++){var e=a[b],c=e.cm,f=d=c.display;!f.scrollbarsClipped&&f.scroller.offsetWidth&&(f.nativeBarWidth=f.scroller.offsetWidth-f.scroller.clientWidth,f.heightForcer.style.height=$(c)+"px",f.sizer.style.marginBottom=-f.nativeBarWidth+"px",f.sizer.style.borderRightWidth=$(c)+"px",f.scrollbarsClipped=!0);e.updateMaxLine&&yc(c);e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<d.viewFrom||e.scrollToPos.to.line>=d.viewTo)|| +d.maxLineChanged&&c.options.lineWrapping;e.update=e.mustUpdate&&new Ib(c,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}for(b=0;b<a.length;b++)e=a[b],e.updatedDisplay=e.mustUpdate&&Ec(e.cm,e.update);for(b=0;b<a.length;b++)if(e=a[b],c=e.cm,d=c.display,e.updatedDisplay&&Hb(c),e.barMeasure=fb(c),d.maxLineChanged&&!c.options.lineWrapping&&(e.adjustWidthTo=Sc(c,Vb(c,d.maxLine),d.maxLine.text.length,void 0).left+3,c.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(d.scroller.clientWidth, +d.sizer.offsetLeft+e.adjustWidthTo+$(c)+c.display.barWidth),e.maxScrollLeft=Math.max(0,d.sizer.offsetLeft+e.adjustWidthTo-la(c))),e.updatedDisplay||e.selectionChanged)e.preparedSelection=d.input.prepareSelection();for(b=0;b<a.length;b++)e=a[b],c=e.cm,null!=e.adjustWidthTo&&(c.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<c.doc.scrollLeft&&Ia(c,Math.min(c.display.scroller.scrollLeft,e.maxScrollLeft),!0),c.display.maxLineChanged=!1),e.preparedSelection&&c.display.input.showSelection(e.preparedSelection), +e.updatedDisplay&&Hc(c,e.barMeasure),(e.updatedDisplay||e.startHeight!=c.doc.height)&&Ja(c,e.barMeasure),e.selectionChanged&&Qc(c),c.state.focused&&e.updateInput&&c.display.input.reset(e.typing),e.focus&&e.focus==aa()&&Md(e.cm);for(b=0;b<a.length;b++){e=a[b];c=e.cm;d=c.display;f=c.doc;e.updatedDisplay&&Ed(c,e.update);if(null!=d.wheelStartX&&(null!=e.scrollTop||null!=e.scrollLeft||e.scrollToPos))d.wheelStartX=d.wheelStartY=null;if(null!=e.scrollTop&&(d.scroller.scrollTop!=e.scrollTop||e.forceScroll))f.scrollTop= +Math.max(0,Math.min(d.scroller.scrollHeight-d.scroller.clientHeight,e.scrollTop)),d.scrollbars.setScrollTop(f.scrollTop),d.scroller.scrollTop=f.scrollTop;if(null!=e.scrollLeft&&(d.scroller.scrollLeft!=e.scrollLeft||e.forceScroll))f.scrollLeft=Math.max(0,Math.min(d.scroller.scrollWidth-la(c),e.scrollLeft)),d.scrollbars.setScrollLeft(f.scrollLeft),d.scroller.scrollLeft=f.scrollLeft,wc(c);if(e.scrollToPos){var g=void 0,h=t(f,e.scrollToPos.from),g=t(f,e.scrollToPos.to),i=e.scrollToPos.margin;null==i&& +(i=0);for(var j=0;5>j;j++){var k=!1,n=ia(c,h),l=!g||g==h?n:ia(c,g),l=Zb(c,Math.min(n.left,l.left),Math.min(n.top,l.top)-i,Math.max(n.left,l.left),Math.max(n.bottom,l.bottom)+i),s=c.doc.scrollTop,I=c.doc.scrollLeft;null!=l.scrollTop&&(hb(c,l.scrollTop),1<Math.abs(c.doc.scrollTop-s)&&(k=!0));null!=l.scrollLeft&&(Ia(c,l.scrollLeft),1<Math.abs(c.doc.scrollLeft-I)&&(k=!0));if(!k)break}g=n;if(e.scrollToPos.isCursor&&c.state.focused&&!ea(c,"scrollCursorIntoView")){i=c.display;j=i.sizer.getBoundingClientRect(); +h=null;if(0>g.top+j.top)h=!0;else if(g.bottom+j.top>(window.innerHeight||document.documentElement.clientHeight))h=!1;null!=h&&!zf&&(g=q("div","",null,"position: absolute; top: "+(g.top-i.viewOffset-c.display.lineSpace.offsetTop)+"px; height: "+(g.bottom-g.top+$(c)+i.barHeight)+"px; left: "+g.left+"px; width: 2px;"),c.display.lineSpace.appendChild(g),g.scrollIntoView(h),c.display.lineSpace.removeChild(g))}}h=e.maybeHiddenMarkers;g=e.maybeUnhiddenMarkers;if(h)for(i=0;i<h.length;++i)h[i].lines.length|| +F(h[i],"hide");if(g)for(i=0;i<g.length;++i)g[i].lines.length&&F(g[i],"unhide");d.wrapper.offsetHeight&&(f.scrollTop=c.display.scroller.scrollTop);e.changeObjs&&F(c,"changes",c,e.changeObjs);e.update&&e.update.finish()}}}function Q(a,b){if(a.curOp)return b();Fa(a);try{return b()}finally{Ha(a)}}function B(a,b){return function(){if(a.curOp)return b.apply(a,arguments);Fa(a);try{return b.apply(a,arguments)}finally{Ha(a)}}}function J(a){return function(){if(this.curOp)return a.apply(this,arguments);Fa(this); +try{return a.apply(this,arguments)}finally{Ha(this)}}}function K(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);Fa(b);try{return a.apply(this,arguments)}finally{Ha(b)}}}function ce(a,b,c){for(var d=this.line=b,e;d=wa(d,!1);)d=d.find(1,!0).line,(e||(e=[])).push(d);this.size=(this.rest=e)?C(x(this.rest))-c+1:1;this.node=this.text=null;this.hidden=ua(a,b)}function Jb(a,b,c){var d=[],e;for(e=b;e<c;)b=new ce(a.doc,r(a.doc,e),e),e+=b.size,d.push(b);return d}function N(a, +b,c,d){null==b&&(b=a.doc.first);null==c&&(c=a.doc.first+a.doc.size);d||(d=0);var e=a.display;if(d&&c<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b))e.updateLineNumbers=b;a.curOp.viewChanged=!0;if(b>=e.viewTo)na&&Fc(a.doc,b)<e.viewTo&&ma(a);else if(c<=e.viewFrom)na&&Dd(a.doc,c+d)>e.viewFrom?ma(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)ma(a);else if(b<=e.viewFrom){var f=$b(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):ma(a)}else if(c>= +e.viewTo)(f=$b(a,b,b,-1))?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):ma(a);else{var f=$b(a,b,b,-1),g=$b(a,c,c+d,1);f&&g?(e.view=e.view.slice(0,f.index).concat(Jb(a,f.lineN,g.lineN)).concat(e.view.slice(g.index)),e.viewTo+=d):ma(a)}if(a=e.externalMeasured)c<a.lineN?a.lineN+=d:b<a.lineN+a.size&&(e.externalMeasured=null)}function ja(a,b,c){a.curOp.viewChanged=!0;var d=a.display,e=a.display.externalMeasured;e&&(b>=e.lineN&&b<e.lineN+e.size)&&(d.externalMeasured=null);b<d.viewFrom||b>=d.viewTo|| +(a=d.view[ya(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==G(a,c)&&a.push(c)))}function ma(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function ya(a,b){if(b>=a.display.viewTo)return null;b-=a.display.viewFrom;if(0>b)return null;for(var c=a.display.view,d=0;d<c.length;d++)if(b-=c[d].size,0>b)return d}function $b(a,b,c,d){var e=ya(a,b),f=a.display.view;if(!na||c==a.doc.first+a.doc.size)return{index:e,lineN:c};for(var g=0,h=a.display.viewFrom;g< +e;g++)h+=f[g].size;if(h!=b){if(0<d){if(e==f.length-1)return null;b=h+f[e].size-b;e++}else b=h-b;c+=b}for(;Fc(a.doc,c)!=c;){if(e==(0>d?0:f.length-1))return null;c+=d*f[e-(0>d?1:0)].size;e+=d}return{index:e,lineN:c}}function Cd(a){for(var a=a.display.view,b=0,c=0;c<a.length;c++){var d=a[c];!d.hidden&&(!d.node||d.changes)&&++b}return b}function lf(a){function b(){d.activeTouch&&(e=setTimeout(function(){d.activeTouch=null},1E3),f=d.activeTouch,f.end=+new Date)}function c(a,b){if(null==b.left)return!0; +var c=b.left-a.left,d=b.top-a.top;return 400<c*c+d*d}var d=a.display;p(d.scroller,"mousedown",B(a,he));y&&11>z?p(d.scroller,"dblclick",B(a,function(b){if(!ea(a,b)){var c=Qa(a,b);c&&(!Zc(a,b,"gutterClick",!0,H)&&!ka(a.display,b))&&(L(b),b=a.findWordAt(c),Qb(a.doc,b.anchor,b.head))}})):p(d.scroller,"dblclick",function(b){ea(a,b)||L(b)});$c||p(d.scroller,"contextmenu",function(b){ie(a,b)});var e,f={end:0};p(d.scroller,"touchstart",function(a){var b;1!=a.touches.length?b=!1:(b=a.touches[0],b=1>=b.radiusX&& +1>=b.radiusY);b||(clearTimeout(e),b=+new Date,d.activeTouch={start:b,moved:!1,prev:300>=b-f.end?f:null},1==a.touches.length&&(d.activeTouch.left=a.touches[0].pageX,d.activeTouch.top=a.touches[0].pageY))});p(d.scroller,"touchmove",function(){d.activeTouch&&(d.activeTouch.moved=!0)});p(d.scroller,"touchend",function(e){var f=d.activeTouch;if(f&&!ka(d,e)&&null!=f.left&&!f.moved&&300>new Date-f.start){var g=a.coordsChar(d.activeTouch,"page"),f=!f.prev||c(f,f.prev)?new w(g,g):!f.prev.prev||c(f,f.prev.prev)? +a.findWordAt(g):new w(o(g.line,0),t(a.doc,o(g.line+1,0)));a.setSelection(f.anchor,f.head);a.focus();L(e)}b()});p(d.scroller,"touchcancel",b);p(d.scroller,"scroll",function(){d.scroller.clientHeight&&(hb(a,d.scroller.scrollTop),Ia(a,d.scroller.scrollLeft,!0),F(a,"scroll",a))});p(d.scroller,"mousewheel",function(b){je(a,b)});p(d.scroller,"DOMMouseScroll",function(b){je(a,b)});p(d.wrapper,"scroll",function(){d.wrapper.scrollTop=d.wrapper.scrollLeft=0});d.dragFunctions={simple:function(b){ea(a,b)||ad(b)}, +start:function(b){if(y&&(!a.state.draggingText||100>+new Date-ke))ad(b);else if(!ea(a,b)&&!ka(a.display,b)&&(b.dataTransfer.setData("Text",a.getSelection()),b.dataTransfer.setDragImage&&!le)){var c=q("img",null,null,"position: fixed; left: 0; top: 0;");c.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";Y&&(c.width=c.height=1,a.display.wrapper.appendChild(c),c._top=c.offsetTop);b.dataTransfer.setDragImage(c,0,0);Y&&c.parentNode.removeChild(c)}},drop:B(a,Af)};var g=d.input.getField(); +p(g,"keyup",function(b){me.call(a,b)});p(g,"keydown",B(a,ne));p(g,"keypress",B(a,oe));p(g,"focus",Za(sc,a));p(g,"blur",Za($a,a))}function Bf(a){var b=a.display;b.lastWrapHeight==b.wrapper.clientHeight&&b.lastWrapWidth==b.wrapper.clientWidth||(b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,b.scrollbarsClipped=!1,a.setSize())}function ka(a,b){for(var c=b.target||b.srcElement;c!=a.wrapper;c=c.parentNode)if(!c||1==c.nodeType&&"true"==c.getAttribute("cm-ignore-events")||c.parentNode==a.sizer&& +c!=a.mover)return!0}function Qa(a,b,c,d){var e=a.display;if(!c&&"true"==(b.target||b.srcElement).getAttribute("cm-not-content"))return null;var f,g,c=e.lineSpace.getBoundingClientRect();try{f=b.clientX-c.left,g=b.clientY-c.top}catch(h){return null}var b=Xc(a,f,g),i;if(d&&1==b.xRel&&(i=r(a.doc,b.line).text).length==b.ch)d=X(i,i.length,a.options.tabSize)-i.length,b=o(b.line,Math.max(0,Math.round((f-ae(a.display).left)/cb(a.display))-d));return b}function he(a){var b=this.display;if(!(b.activeTouch&& +b.input.supportsTouch()||ea(this,a)))if(b.shift=a.shiftKey,ka(b,a))E||(b.scroller.draggable=!1,setTimeout(function(){b.scroller.draggable=!0},100));else if(!Zc(this,a,"gutterClick",!0,H)){var c=Qa(this,a);window.focus();switch(pe(a)){case 1:c?Cf(this,a,c):(a.target||a.srcElement)==b.scroller&&L(a);break;case 2:E&&(this.state.lastMiddleDown=+new Date);c&&Qb(this.doc,c);setTimeout(function(){b.input.focus()},20);L(a);break;case 3:$c?ie(this,a):Df(this)}}}function Cf(a,b,c){y?setTimeout(Za(Md,a),0): +a.curOp.focus=aa();var d=+new Date,e;ac&&ac.time>d-400&&0==v(ac.pos,c)?e="triple":bc&&bc.time>d-400&&0==v(bc.pos,c)?(e="double",ac={time:d,pos:c}):(e="single",bc={time:d,pos:c});var d=a.doc.sel,f=T?b.metaKey:b.ctrlKey,g;a.options.dragDrop&&Ef&&!Nb(a)&&"single"==e&&-1<(g=d.contains(c))&&!d.ranges[g].empty()?Ff(a,b,c,f):Gf(a,b,c,e,f)}function Ff(a,b,c,d){var e=a.display,f=+new Date,g=B(a,function(h){E&&(e.scroller.draggable=!1);a.state.draggingText=!1;fa(document,"mouseup",g);fa(e.scroller,"drop",g); +10>Math.abs(b.clientX-h.clientX)+Math.abs(b.clientY-h.clientY)&&(L(h),!d&&+new Date-200<f&&Qb(a.doc,c),E||y&&9==z?setTimeout(function(){document.body.focus();e.input.focus()},20):e.input.focus())});E&&(e.scroller.draggable=!0);a.state.draggingText=g;e.scroller.dragDrop&&e.scroller.dragDrop();p(document,"mouseup",g);p(e.scroller,"drop",g)}function Gf(a,b,c,d,e){function f(b){if(0!=v(m,b))if(m=b,"rect"==d){for(var e=[],f=a.options.tabSize,g=X(r(j,c.line).text,c.ch,f),h=X(r(j,b.line).text,b.ch,f),i= +Math.min(g,h),g=Math.max(g,h),h=Math.min(c.line,b.line),s=Math.min(a.lastLine(),Math.max(c.line,b.line));h<=s;h++){var I=r(j,h).text,q=qe(I,i,f);i==g?e.push(new w(o(h,q),o(h,q))):I.length>q&&e.push(new w(o(h,q),o(h,qe(I,g,f))))}e.length||e.push(new w(c,c));A(j,W(l.ranges.slice(0,n).concat(e),n),{origin:"*mouse",scroll:!1});a.scrollIntoView(b)}else e=k,f=e.anchor,i=b,"single"!=d&&(b="double"==d?a.findWordAt(b):new w(o(b.line,0),t(j,o(b.line+1,0))),0<v(b.anchor,f)?(i=b.head,f=Mb(e.from(),b.anchor)): +(i=b.anchor,f=Lb(e.to(),b.head))),e=l.ranges.slice(0),e[n]=new w(t(j,f),i),A(j,W(e,n),bd)}function g(b){var c=++u,e=Qa(a,b,!0,"rect"==d);if(e)if(0!=v(e,m)){a.curOp.focus=aa();f(e);var h=Bc(i,j);(e.line>=h.to||e.line<h.from)&&setTimeout(B(a,function(){u==c&&g(b)}),150)}else{var k=b.clientY<q.top?-20:b.clientY>q.bottom?20:0;k&&setTimeout(B(a,function(){u==c&&(i.scroller.scrollTop+=k,g(b))}),50)}}function h(a){u=Infinity;L(a);i.input.focus();fa(document,"mousemove",y);fa(document,"mouseup",x);j.history.lastSelOrigin= +null}var i=a.display,j=a.doc;L(b);var k,n,l=j.sel,s=l.ranges;e&&!b.shiftKey?(n=j.sel.contains(c),k=-1<n?s[n]:new w(c,c)):(k=j.sel.primary(),n=j.sel.primIndex);if(b.altKey)d="rect",e||(k=new w(c,c)),c=Qa(a,b,!0,!0),n=-1;else if("double"==d){var I=a.findWordAt(c);k=a.display.shift||j.extend?nb(j,k,I.anchor,I.head):I}else"triple"==d?(I=new w(o(c.line,0),t(j,o(c.line+1,0))),k=a.display.shift||j.extend?nb(j,k,I.anchor,I.head):I):k=nb(j,k,c);e?-1==n?(n=s.length,A(j,W(s.concat([k]),n),{scroll:!1,origin:"*mouse"})): +1<s.length&&s[n].empty()&&"single"==d&&!b.shiftKey?(A(j,W(s.slice(0,n).concat(s.slice(n+1)),0)),l=j.sel):Pc(j,n,k,bd):(n=0,A(j,new ha([k],0),bd),l=j.sel);var m=c,q=i.wrapper.getBoundingClientRect(),u=0,y=B(a,function(a){pe(a)?g(a):h(a)}),x=B(a,h);p(document,"mousemove",y);p(document,"mouseup",x)}function Zc(a,b,c,d,e){try{var f=b.clientX,g=b.clientY}catch(h){return!1}if(f>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&L(b);var d=a.display,i=d.lineDiv.getBoundingClientRect(); +if(g>i.bottom||!P(a,c))return cd(b);g-=i.top-d.viewOffset;for(i=0;i<a.options.gutters.length;++i){var j=d.gutters.childNodes[i];if(j&&j.getBoundingClientRect().right>=f)return f=xa(a.doc,g),e(a,c,a,f,a.options.gutters[i],b),cd(b)}}function Af(a){var b=this;if(!ea(b,a)&&!ka(b.display,a)){L(a);y&&(ke=+new Date);var c=Qa(b,a,!0),d=a.dataTransfer.files;if(c&&!Nb(b))if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,a=function(a,d){var h=new FileReader;h.onload=B(b,function(){f[d]= +h.result;if(++g==e){c=t(b.doc,c);var a={from:c,to:c,text:oa(f.join("\n")),origin:"paste"};Ka(b.doc,a);Ud(b.doc,ba(c,pa(a)))}});h.readAsText(a)},h=0;h<e;++h)a(d[h],h);else if(b.state.draggingText&&-1<b.doc.sel.contains(c))b.state.draggingText(a),setTimeout(function(){b.display.input.focus()},20);else try{if(f=a.dataTransfer.getData("Text")){if(b.state.draggingText&&!(T?a.altKey:a.ctrlKey))var i=b.listSelections();Rb(b.doc,ba(c,c));if(i)for(h=0;h<i.length;++h)sb(b.doc,"",i[h].anchor,i[h].head,"drag"); +b.replaceSelection(f,"around","paste");b.display.input.focus()}}catch(j){}}}function hb(a,b){2>Math.abs(a.doc.scrollTop-b)||(a.doc.scrollTop=b,sa||Ic(a,{top:b}),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b),a.display.scrollbars.setScrollTop(b),sa&&Ic(a),bb(a,100))}function Ia(a,b,c){if(!(c?b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b)))b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,wc(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft= +b),a.display.scrollbars.setScrollLeft(b)}function je(a,b){var c=re(b),d=c.x,c=c.y,e=a.display,f=e.scroller;if(d&&f.scrollWidth>f.clientWidth||c&&f.scrollHeight>f.clientHeight){if(c&&T&&E){var g=b.target,h=e.view;a:for(;g!=f;g=g.parentNode)for(var i=0;i<h.length;i++)if(h[i].node==g){a.display.currentWheelTarget=g;break a}}if(d&&!sa&&!Y&&null!=O)c&&hb(a,Math.max(0,Math.min(f.scrollTop+c*O,f.scrollHeight-f.clientHeight))),Ia(a,Math.max(0,Math.min(f.scrollLeft+d*O,f.scrollWidth-f.clientWidth))),L(b), +e.wheelStartX=null;else if(c&&null!=O&&(g=c*O,h=a.doc.scrollTop,i=h+e.wrapper.clientHeight,0>g?h=Math.max(0,h+g-50):i=Math.min(a.doc.height,i+g+50),Ic(a,{top:h,bottom:i})),20>cc)null==e.wheelStartX?(e.wheelStartX=f.scrollLeft,e.wheelStartY=f.scrollTop,e.wheelDX=d,e.wheelDY=c,setTimeout(function(){if(e.wheelStartX!=null){var a=f.scrollLeft-e.wheelStartX,b=f.scrollTop-e.wheelStartY,a=b&&e.wheelDY&&b/e.wheelDY||a&&e.wheelDX&&a/e.wheelDX;e.wheelStartX=e.wheelStartY=null;if(a){O=(O*cc+a)/(cc+1);++cc}}}, +200)):(e.wheelDX+=d,e.wheelDY+=c)}}function dc(a,b,c){if("string"==typeof b&&(b=ec[b],!b))return!1;a.display.input.ensurePolled();var d=a.display.shift,e=!1;try{Nb(a)&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=se}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function Hf(a,b,c){for(var d=0;d<a.state.keyMaps.length;d++){var e=tb(b,a.state.keyMaps[d],c,a);if(e)return e}return a.options.extraKeys&&tb(b,a.options.extraKeys,c,a)||tb(b,a.options.keyMap,c,a)}function fc(a,b, +c,d){var e=a.state.keySeq;if(e){if(If(b))return"handled";Jf.set(50,function(){a.state.keySeq==e&&(a.state.keySeq=null,a.display.input.reset())});b=e+" "+b}d=Hf(a,b,d);"multi"==d&&(a.state.keySeq=b);"handled"==d&&H(a,"keyHandled",a,b,c);if("handled"==d||"multi"==d)L(c),Qc(a);return e&&!d&&/\'$/.test(b)?(L(c),!0):!!d}function te(a,b){var c=Kf(b,!0);return!c?!1:b.shiftKey&&!a.state.keySeq?fc(a,"Shift-"+c,b,function(b){return dc(a,b,true)})||fc(a,c,b,function(b){if(typeof b=="string"?/^go[A-Z]/.test(b): +b.motion)return dc(a,b)}):fc(a,c,b,function(b){return dc(a,b)})}function Lf(a,b,c){return fc(a,"'"+c+"'",b,function(b){return dc(a,b,!0)})}function ne(a){this.curOp.focus=aa();if(!ea(this,a)){y&&(11>z&&27==a.keyCode)&&(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var c=te(this,a);Y&&(dd=c?b:null,!c&&(88==b&&!ue&&(T?a.metaKey:a.ctrlKey))&&this.replaceSelection("",null,"cut"));18==b&&!/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)&&Mf(this)}}function Mf(a){function b(a){if(18== +a.keyCode||!a.altKey)gb(c,"CodeMirror-crosshair"),fa(document,"keyup",b),fa(document,"mouseover",b)}var c=a.display.lineDiv;ib(c,"CodeMirror-crosshair");p(document,"keyup",b);p(document,"mouseover",b)}function me(a){16==a.keyCode&&(this.doc.sel.shift=!1);ea(this,a)}function oe(a){if(!ka(this.display,a)&&!ea(this,a)&&!(a.ctrlKey&&!a.altKey||T&&a.metaKey)){var b=a.keyCode,c=a.charCode;if(Y&&b==dd)dd=null,L(a);else if(!Y||a.which&&!(10>a.which)||!te(this,a))if(b=String.fromCharCode(null==c?b:c),!Lf(this, +a,b))this.display.input.onKeyPress(a)}}function Df(a){a.state.delayingBlurEvent=!0;setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,$a(a))},100)}function sc(a){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1);"nocursor"!=a.options.readOnly&&(a.state.focused||(F(a,"focus",a),a.state.focused=!0,ib(a.display.wrapper,"CodeMirror-focused"),!a.curOp&&a.display.selForContextMenu!=a.doc.sel&&(a.display.input.reset(),E&&setTimeout(function(){a.display.input.reset(true)}, +20)),a.display.input.receivedFocus()),Qc(a))}function $a(a){a.state.delayingBlurEvent||(a.state.focused&&(F(a,"blur",a),a.state.focused=!1,gb(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){if(!a.state.focused)a.display.shift=false},150))}function ie(a,b){var c;if(!(c=ka(a.display,b)))c=P(a,"gutterContextMenu")?Zc(a,b,"gutterContextMenu",!1,F):!1;if(!c)a.display.input.onContextMenu(b)}function ve(a,b){if(0>v(a,b.from))return a;if(0>=v(a,b.to))return pa(b); +var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;a.line==b.to.line&&(d+=pa(b).ch-b.to.ch);return o(c,d)}function ed(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new w(ve(e.anchor,b),ve(e.head,b)))}return W(c,a.sel.primIndex)}function we(a,b,c){return a.line==b.line?o(c.line,a.ch-b.ch+c.ch):o(c.line+(a.line-b.line),a.ch)}function xe(a,b,c){b={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){this.canceled=!0}};c&&(b.update=function(b, +c,f,g){b&&(this.from=t(a,b));c&&(this.to=t(a,c));f&&(this.text=f);void 0!==g&&(this.origin=g)});F(a,"beforeChange",a,b);a.cm&&F(a.cm,"beforeChange",a.cm,b);return b.canceled?null:{from:b.from,to:b.to,text:b.text,origin:b.origin}}function Ka(a,b,c){if(a.cm){if(!a.cm.curOp)return B(a.cm,Ka)(a,b,c);if(a.cm.state.suppressEdits)return}if(P(a,"beforeChange")||a.cm&&P(a.cm,"beforeChange"))if(b=xe(a,b,!0),!b)return;if(c=ye&&!c&&Nf(a,b.from,b.to))for(var d=c.length-1;0<=d;--d)ze(a,{from:c[d].from,to:c[d].to, +text:d?[""]:b.text});else ze(a,b)}function ze(a,b){if(!(1==b.text.length&&""==b.text[0]&&0==v(b.from,b.to))){var c=ed(a,b);Ae(a,b,c,a.cm?a.cm.curOp.id:NaN);ub(a,b,c,fd(a,b));var d=[];Ca(a,function(a,c){!c&&-1==G(d,a.history)&&(Be(a.history,b),d.push(a.history));ub(a,b,null,fd(a,b))})}}function gc(a,b,c){if(!a.cm||!a.cm.state.suppressEdits){for(var d=a.history,e,f=a.sel,g="undo"==b?d.done:d.undone,h="undo"==b?d.undone:d.done,i=0;i<g.length&&!(e=g[i],c?e.ranges&&!e.equals(a.sel):!e.ranges);i++);if(i!= +g.length){for(d.lastOrigin=d.lastSelOrigin=null;;)if(e=g.pop(),e.ranges){Sb(e,h);if(c&&!e.equals(a.sel)){A(a,e,{clearRedo:!1});return}f=e}else break;c=[];Sb(f,h);h.push({changes:c,generation:d.generation});d.generation=e.generation||++d.maxGeneration;d=P(a,"beforeChange")||a.cm&&P(a.cm,"beforeChange");for(i=e.changes.length-1;0<=i;--i){var j=e.changes[i];j.origin=b;if(d&&!xe(a,j,!1)){g.length=0;break}c.push(gd(a,j));f=i?ed(a,j):x(g);ub(a,j,f,Ce(a,j));!i&&a.cm&&a.cm.scrollIntoView({from:j.from,to:pa(j)}); +var k=[];Ca(a,function(a,b){!b&&-1==G(k,a.history)&&(Be(a.history,j),k.push(a.history));ub(a,j,null,Ce(a,j))})}}}}function De(a,b){if(0!=b&&(a.first+=b,a.sel=new ha(kb(a.sel.ranges,function(a){return new w(o(a.anchor.line+b,a.anchor.ch),o(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){N(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;d<c.viewTo;d++)ja(a.cm,d,"gutter")}}function ub(a,b,c,d){if(a.cm&&!a.cm.curOp)return B(a.cm,ub)(a,b,c,d);if(b.to.line<a.first)De(a,b.text.length-1- +(b.to.line-b.from.line));else if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);De(a,e);b={from:o(a.first,0),to:o(b.to.line+e,b.to.ch),text:[x(b.text)],origin:b.origin}}e=a.lastLine();b.to.line>e&&(b={from:b.from,to:o(e,r(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=za(a,b.from,b.to);c||(c=ed(a,b));a.cm?Of(a.cm,b,d):hd(a,b,d);Rb(a,c,ca)}}function Of(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,i=f.line;a.options.lineWrapping|| +(i=C(da(r(d,f.line))),d.iter(i,g.line+1,function(a){if(a==e.maxLine)return h=!0}));-1<d.sel.contains(b.from,b.to)&&Yd(a);hd(d,b,c,Ad(a));a.options.lineWrapping||(d.iter(i,f.line+b.text.length,function(a){var b=Gb(a);if(b>e.maxLineLength){e.maxLine=a;e.maxLineLength=b;e.maxLineChanged=true;h=false}}),h&&(a.curOp.updateMaxLine=!0));d.frontier=Math.min(d.frontier,f.line);bb(a,400);c=b.text.length-(g.line-f.line)-1;b.full?N(a):f.line==g.line&&1==b.text.length&&!Ee(a.doc,b)?ja(a,f.line,"text"):N(a,f.line, +g.line+1,c);c=P(a,"changes");if((d=P(a,"change"))||c)b={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin},d&&H(a,"change",a,b),c&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b);a.display.selForContextMenu=null}function sb(a,b,c,d,e){d||(d=c);if(0>v(d,c))var f=d,d=c,c=f;"string"==typeof b&&(b=oa(b));Ka(a,{from:c,to:d,text:b,origin:e})}function Zb(a,b,c,d,e){var f=a.display,g=ta(a.display);0>c&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,i=Gc(a), +j={};e-c>i&&(e=c+i);var k=a.doc.height+(f.mover.offsetHeight-f.lineSpace.offsetHeight),n=c<g,g=e>k-g;c<h?j.scrollTop=n?0:c:e>h+i&&(c=Math.min(c,(g?k:e)-i),c!=h&&(j.scrollTop=c));h=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:f.scroller.scrollLeft;a=la(a)-(a.options.fixedGutter?f.gutters.offsetWidth:0);(f=d-b>a)&&(d=b+a);10>b?j.scrollLeft=0:b<h?j.scrollLeft=Math.max(0,b-(f?0:10)):d>a+h-3&&(j.scrollLeft=d+(f?0:10)-a);return j}function id(a,b,c){(null!=b||null!=c)&&hc(a);null!=b&&(a.curOp.scrollLeft= +(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b);null!=c&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+c)}function La(a){hc(a);var b=a.getCursor(),c=b,d=b;a.options.lineWrapping||(c=b.ch?o(b.line,b.ch-1):b,d=o(b.line,b.ch+1));a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function hc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=ge(a,b.from),d=ge(a,b.to),b=Zb(a,Math.min(c.left,d.left),Math.min(c.top, +d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(b.scrollLeft,b.scrollTop)}}function lb(a,b,c,d){var e=a.doc,f;null==c&&(c="add");"smart"==c&&(e.mode.indent?f=ob(a,b):c="prev");var g=a.options.tabSize,h=r(e,b),i=X(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var j=h.text.match(/^\s*/)[0],k;if(!d&&!/\S/.test(h.text))k=0,c="not";else if("smart"==c&&(k=e.mode.indent(f,h.text.slice(j.length),h.text),k==se||150<k)){if(!d)return;c="prev"}"prev"==c?k=b>e.first? +X(r(e,b-1).text,null,g):0:"add"==c?k=i+a.options.indentUnit:"subtract"==c?k=i-a.options.indentUnit:"number"==typeof c&&(k=i+c);k=Math.max(0,k);c="";d=0;if(a.options.indentWithTabs)for(a=Math.floor(k/g);a;--a)d+=g,c+="\t";d<k&&(c+=Fe(k-d));if(c!=j)return sb(e,c,o(b,0),o(b,j.length),"+input"),h.stateAfter=null,!0;for(a=0;a<e.sel.ranges.length;a++)if(g=e.sel.ranges[a],g.head.line==b&&g.head.ch<j.length){d=o(b,j.length);Pc(e,a,new w(d,d));break}}function ic(a,b,c,d){var e=b,f=b;"number"==typeof b?f=r(a, +Math.max(a.first,Math.min(b,a.first+a.size-1))):e=C(b);if(null==e)return null;d(f,e)&&a.cm&&ja(a.cm,e,c);return f}function Ra(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&0>=v(f.from,x(d).to);){var g=d.pop();if(0>v(g.from,f.from)){f.from=g.from;break}}d.push(f)}Q(a,function(){for(var b=d.length-1;0<=b;b--)sb(a.doc,"",d[b].from,d[b].to,"+delete");La(a)})}function jd(a,b,c,d,e){function f(b){var d=(e?Yc:Ge)(j,h,c,!0);if(null==d){if(b=!b)b=g+c,b<a.first||b>=a.first+ +a.size?b=k=!1:(g=b,b=j=r(a,b));if(b)h=e?(0>c?Yb:Xb)(j):0>c?j.text.length:0;else return k=!1}else h=d;return!0}var g=b.line,h=b.ch,i=c,j=r(a,g),k=!0;if("char"==d)f();else if("column"==d)f(!0);else if("word"==d||"group"==d)for(var n=null,d="group"==d,b=a.cm&&a.cm.getHelper(b,"wordChars"),l=!0;!(0>c)||f(!l);l=!1){var s=j.text.charAt(h)||"\n",s=jc(s,b)?"w":d&&"\n"==s?"n":!d||/\s/.test(s)?null:"p";d&&(!l&&!s)&&(s="s");if(n&&n!=s){0>c&&(c=1,f());break}s&&(n=s);if(0<c&&!f(!l))break}i=Tb(a,o(g,h),i,!0);k|| +(i.hitSide=!0);return i}function He(a,b,c,d){var e=a.doc,f=b.left,g;"page"==d?(d=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),g=b.top+c*(d-(0>c?1.5:0.5)*ta(a.display))):"line"==d&&(g=0<c?b.bottom+3:b.top-3);for(;;){var h=Xc(a,f,g);if(!h.outside)break;if(0>c?0>=g:g>=e.height){h.hitSide=!0;break}g+=5*c}return h}function u(a,b,c,d){m.defaults[a]=b;c&&(Ga[a]=d?function(a,b,d){d!=xd&&c(a,b,d)}:c)}function Pf(a){for(var b=a.split(/-(?!$)/),a=b[b.length- +1],c,d,e,f,g=0;g<b.length-1;g++){var h=b[g];if(/^(cmd|meta|m)$/i.test(h))f=!0;else if(/^a(lt)?$/i.test(h))c=!0;else if(/^(c|ctrl|control)$/i.test(h))d=!0;else if(/^s(hift)$/i.test(h))e=!0;else throw Error("Unrecognized modifier name: "+h);}c&&(a="Alt-"+a);d&&(a="Ctrl-"+a);f&&(a="Cmd-"+a);e&&(a="Shift-"+a);return a}function kc(a){return"string"==typeof a?qa[a]:a}function Sa(a,b,c,d,e){if(d&&d.shared)return Qf(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return B(a.cm,Sa)(a,b,c,d,e);var f=new Da(a,e),e=v(b,c);d&& +S(d,f,!1);if(0<e||0==e&&!1!==f.clearWhenEmpty)return f;f.replacedWith&&(f.collapsed=!0,f.widgetNode=q("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(f.widgetNode.insertLeft=!0));if(f.collapsed){if(Ie(a,b.line,b,c,f)||b.line!=c.line&&Ie(a,c.line,b,c,f))throw Error("Inserting collapsed marker partially overlapping an existing one");na=!0}f.addToHistory&&Ae(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var g=b.line, +h=a.cm,i;a.iter(g,c.line+1,function(a){h&&(f.collapsed&&!h.options.lineWrapping&&da(a)==h.display.maxLine)&&(i=true);f.collapsed&&g!=b.line&&Z(a,0);var d=new lc(f,g==b.line?b.ch:null,g==c.line?c.ch:null);a.markedSpans=a.markedSpans?a.markedSpans.concat([d]):[d];d.marker.attachLine(a);++g});f.collapsed&&a.iter(b.line,c.line+1,function(b){ua(a,b)&&Z(b,0)});f.clearOnEnter&&p(f,"beforeCursorEnter",function(){f.clear()});f.readOnly&&(ye=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory()); +f.collapsed&&(f.id=++kd,f.atomic=!0);if(h){i&&(h.curOp.updateMaxLine=!0);if(f.collapsed)N(h,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle||f.css)for(d=b.line;d<=c.line;d++)ja(h,d,"text");f.atomic&&Zd(h.doc);H(h,"markerAdded",h,f)}return f}function Qf(a,b,c,d,e){d=S(d);d.shared=!1;var f=[Sa(a,b,c,d,e)],g=f[0],h=d.widgetNode;Ca(a,function(a){h&&(d.widgetNode=h.cloneNode(!0));f.push(Sa(a,t(a,b),t(a,c),d,e));for(var j=0;j<a.linked.length;++j)if(a.linked[j].isParent)return;g= +x(f)});return new mc(f,g)}function Je(a){return a.findMarks(o(a.first,0),a.clipPos(o(a.lastLine())),function(a){return a.parent})}function Rf(a){for(var b=0;b<a.length;b++){var c=a[b],d=[c.primary.doc];Ca(c.primary.doc,function(a){d.push(a)});for(var e=0;e<c.markers.length;e++){var f=c.markers[e];-1==G(d,f.doc)&&(f.parent=null,c.markers.splice(e--,1))}}}function lc(a,b,c){this.marker=a;this.from=b;this.to=c}function vb(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function fd(a, +b){if(b.full)return null;var c=mb(a,b.from.line)&&r(a,b.from.line).markedSpans,d=mb(a,b.to.line)&&r(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=0==v(b.from,b.to);if(c)for(var h=0,i;h<c.length;++h){var j=c[h],k=j.marker;if(null==j.from||(k.inclusiveLeft?j.from<=e:j.from<e)||j.from==e&&"bookmark"==k.type&&(!g||!j.marker.insertLeft)){var n=null==j.to||(k.inclusiveRight?j.to>=e:j.to>e);(i||(i=[])).push(new lc(k,j.from,n?null:j.to))}}c=i;if(d)for(var h=0,l;h<d.length;++h)if(i= +d[h],j=i.marker,null==i.to||(j.inclusiveRight?i.to>=f:i.to>f)||i.from==f&&"bookmark"==j.type&&(!g||i.marker.insertLeft))k=null==i.from||(j.inclusiveLeft?i.from<=f:i.from<f),(l||(l=[])).push(new lc(j,k?null:i.from-f,null==i.to?null:i.to-f));d=l;g=1==b.text.length;l=x(b.text).length+(g?e:0);if(c)for(f=0;f<c.length;++f)h=c[f],null==h.to&&((i=vb(d,h.marker))?g&&(h.to=null==i.to?null:i.to+l):h.to=e);if(d)for(f=0;f<d.length;++f)(h=d[f],null!=h.to&&(h.to+=l),null==h.from)?(i=vb(c,h.marker),i||(h.from=l, +g&&(c||(c=[])).push(h))):(h.from+=l,g&&(c||(c=[])).push(h));c&&(c=Ke(c));d&&d!=c&&(d=Ke(d));e=[c];if(!g){var g=b.text.length-2,s;if(0<g&&c)for(f=0;f<c.length;++f)null==c[f].to&&(s||(s=[])).push(new lc(c[f].marker,null,null));for(f=0;f<g;++f)e.push(s);e.push(d)}return e}function Ke(a){for(var b=0;b<a.length;++b){var c=a[b];null!=c.from&&(c.from==c.to&&!1!==c.marker.clearWhenEmpty)&&a.splice(b--,1)}return!a.length?null:a}function Ce(a,b){var c;if(c=b["spans_"+a.id]){for(var d=0,e=[];d<b.text.length;++d)e.push(Sf(c[d])); +c=e}else c=null;d=fd(a,b);if(!c)return d;if(!d)return c;for(e=0;e<c.length;++e){var f=c[e],g=d[e];if(f&&g){var h=0;a:for(;h<g.length;++h){for(var i=g[h],j=0;j<f.length;++j)if(f[j].marker==i.marker)continue a;f.push(i)}}else g&&(c[e]=g)}return c}function Nf(a,b,c){var d=null;a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;if(c.readOnly&&(!d||-1==G(d,c)))(d||(d=[])).push(c)}});if(!d)return null;a=[{from:b,to:c}];for(b=0;b<d.length;++b)for(var c= +d[b],e=c.find(0),f=0;f<a.length;++f){var g=a[f];if(!(0>v(g.to,e.from)||0<v(g.from,e.to))){var h=[f,1],i=v(g.from,e.from),j=v(g.to,e.to);(0>i||!c.inclusiveLeft&&!i)&&h.push({from:g.from,to:e.from});(0<j||!c.inclusiveRight&&!j)&&h.push({from:e.to,to:g.to});a.splice.apply(a,h);f+=h.length-1}}return a}function Le(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Me(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans= +b}}function Ne(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;var c=a.find(),d=b.find(),e=v(c.from,d.from)||(a.inclusiveLeft?-1:0)-(b.inclusiveLeft?-1:0);return e?-e:(c=v(c.to,d.to)||(a.inclusiveRight?1:0)-(b.inclusiveRight?1:0))?c:b.id-a.id}function wa(a,b){var c=na&&a.markedSpans,d;if(c)for(var e,f=0;f<c.length;++f)if(e=c[f],e.marker.collapsed&&null==(b?e.from:e.to)&&(!d||0>Ne(d,e.marker)))d=e.marker;return d}function Ie(a,b,c,d,e){a=r(a,b);if(a=na&&a.markedSpans)for(b=0;b<a.length;++b){var f= +a[b];if(f.marker.collapsed){var g=f.marker.find(0),h=v(g.from,c)||(f.marker.inclusiveLeft?-1:0)-(e.inclusiveLeft?-1:0),i=v(g.to,d)||(f.marker.inclusiveRight?1:0)-(e.inclusiveRight?1:0);if(!(0<=h&&0>=i||0>=h&&0<=i))if(0>=h&&(0<v(g.to,c)||f.marker.inclusiveRight&&e.inclusiveLeft)||0<=h&&(0>v(g.from,d)||f.marker.inclusiveLeft&&e.inclusiveRight))return!0}}}function da(a){for(var b;b=wa(a,!0);)a=b.find(-1,!0).line;return a}function Fc(a,b){var c=r(a,b),d=da(c);return c==d?b:C(d)}function Dd(a,b){if(b> +a.lastLine())return b;var c=r(a,b),d;if(!ua(a,c))return b;for(;d=wa(c,!1);)c=d.find(1,!0).line;return C(c)+1}function ua(a,b){var c=na&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed&&(null==d.from||!d.marker.widgetNode&&0==d.from&&d.marker.inclusiveLeft&&ld(a,b,d)))return!0}function ld(a,b,c){if(null==c.to)return b=c.marker.find(1,!0),ld(a,b.line,vb(b.line.markedSpans,c.marker));if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var d,e=0;e<b.markedSpans.length;++e)if(d= +b.markedSpans[e],d.marker.collapsed&&!d.marker.widgetNode&&d.from==c.to&&(null==d.to||d.to!=c.from)&&(d.marker.inclusiveLeft||c.marker.inclusiveRight)&&ld(a,b,d))return!0}function Oe(a,b,c){ga(b)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&id(a,null,c)}function qb(a){if(null!=a.height)return a.height;var b=a.doc.cm;if(!b)return 0;if(!Oc(document.body,a.node)){var c="position: relative;";a.coverGutter&&(c+="margin-left: -"+b.display.gutters.offsetWidth+"px;");a.noHScroll&&(c+="width: "+b.display.wrapper.clientWidth+ +"px;");R(b.display.measure,q("div",[a.node],null,c))}return a.height=a.node.offsetHeight}function Tf(a,b,c,d){var e=new nc(a,c,d),f=a.cm;f&&e.noHScroll&&(f.display.alignWidgets=!0);ic(a,b,"widget",function(b){var c=b.widgets||(b.widgets=[]);e.insertAt==null?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e);e.line=b;if(f&&!ua(a,b)){c=ga(b)<a.scrollTop;Z(b,b.height+qb(e));c&&id(f,null,e.height);f.curOp.forceUpdate=true}return true});return e}function Pe(a,b){if(a)for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/); +if(!c)break;var a=a.slice(0,c.index)+a.slice(c.index+c[0].length),d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:RegExp("(?:^|s)"+c[2]+"(?:$|s)").test(b[d])||(b[d]+=" "+c[2])}return a}function Qe(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode){var c=m.innerMode(a,b);if(c.mode.blankLine)return c.mode.blankLine(c.state)}}function md(a,b,c,d){for(var e=0;10>e;e++){d&&(d[0]=m.innerMode(a,c).mode);var f=a.token(b,c);if(b.pos>b.start)return f}throw Error("Mode "+a.name+" failed to advance stream."); +}function Re(a,b,c,d){function e(a){return{start:k.start,end:k.pos,string:k.current(),type:h||null,state:a?Oa(f.mode,j):j}}var f=a.doc,g=f.mode,h,b=t(f,b),i=r(f,b.line),j=ob(a,b.line,c),k=new oc(i.text,a.options.tabSize),n;for(d&&(n=[]);(d||k.pos<b.ch)&&!k.eol();)k.start=k.pos,h=md(g,k,j),d&&n.push(e(!0));return d?n:e()}function Se(a,b,c,d,e,f,g){var h=c.flattenSpans;null==h&&(h=a.options.flattenSpans);var i=0,j=null,k=new oc(b,a.options.tabSize),n,l=a.options.addModeClass&&[null];for(""==b&&Pe(Qe(c, +d),f);!k.eol();){k.pos>a.options.maxHighlightLength?(h=!1,g&&Rc(a,b,d,k.pos),k.pos=b.length,n=null):n=Pe(md(c,k,d,l),f);if(l){var s=l[0].name;s&&(n="m-"+(n?s+" "+n:s))}if(!h||j!=n){for(;i<k.start;)i=Math.min(k.start,i+5E4),e(i,j);j=n}k.start=k.pos}for(;i<k.pos;)a=Math.min(k.pos,i+5E4),e(a,j),i=a}function be(a,b,c,d){var e=[a.state.modeGen],f={};Se(a,b.text,a.doc.mode,c,function(a,b){e.push(a,b)},f,d);for(c=0;c<a.state.overlays.length;++c){var g=a.state.overlays[c],h=1,i=0;Se(a,b.text,g.mode,!0,function(a, +b){for(var c=h;i<a;){var d=e[h];d>a&&e.splice(h,1,a,e[h+1],d);h=h+2;i=Math.min(a,d)}if(b)if(g.opaque){e.splice(c,h-c,a,"cm-overlay "+b);h=c+2}else for(;c<h;c=c+2){d=e[c+1];e[c+1]=(d?d+" ":"")+"cm-overlay "+b}},f)}return{styles:e,classes:f.bgClass||f.textClass?f:null}}function Te(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=be(a,b,b.stateAfter=ob(a,C(b)));b.styles=d.styles;d.classes?b.styleClasses=d.classes:b.styleClasses&&(b.styleClasses=null);c===a.doc.frontier&&a.doc.frontier++}return b.styles} +function Rc(a,b,c,d){var e=a.doc.mode,f=new oc(b,a.options.tabSize);f.start=f.pos=d||0;for(""==b&&Qe(e,c);!f.eol()&&f.pos<=a.options.maxHighlightLength;)md(e,f,c),f.start=f.pos}function Ue(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?Uf:Vf;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function Kd(a,b){var c=q("span",null,null,E?"padding-right: .1px":null),c={pre:q("pre",[c]),content:c,col:0,pos:0,cm:a,splitSpaces:(y||E)&&a.getOption("lineWrapping")};b.measure={};for(var d=0;d<=(b.rest? +b.rest.length:0);d++){var e=d?b.rest[d-1]:b.line,f;c.pos=0;c.addToken=Wf;var g;if(null!=nd)g=nd;else{g=R(a.display.measure,document.createTextNode("AخA"));var h=Aa(g,0,1).getBoundingClientRect();g=!h||h.left==h.right?!1:nd=3>Aa(g,1,2).getBoundingClientRect().right-h.right}if(g&&(f=V(e)))c.addToken=Xf(c.addToken,f);c.map=[];h=b!=a.display.externalMeasured&&C(e);a:{g=c;var h=Te(a,e,h),i=e.markedSpans,j=e.text,k=0;if(i)for(var n=j.length,l=0,s=1,m="",o=void 0,r=void 0,p=0,t=void 0,u=void 0,v=void 0, +x=void 0,w=void 0;;){if(p==l){for(var t=u=v=x=r="",w=null,p=Infinity,z=[],B=0;B<i.length;++B){var D=i[B],A=D.marker;if("bookmark"==A.type&&D.from==l&&A.widgetNode)z.push(A);else if(D.from<=l&&(null==D.to||D.to>l||A.collapsed&&D.to==l&&D.from==l)){if(null!=D.to&&(D.to!=l&&p>D.to)&&(p=D.to,u=""),A.className&&(t+=" "+A.className),A.css&&(r=A.css),A.startStyle&&D.from==l&&(v+=" "+A.startStyle),A.endStyle&&D.to==p&&(u+=" "+A.endStyle),A.title&&!x&&(x=A.title),A.collapsed&&(!w||0>Ne(w.marker,A)))w=D}else D.from> +l&&p>D.from&&(p=D.from)}if(w&&(w.from||0)==l){Ve(g,(null==w.to?n+1:w.to)-l,w.marker,null==w.from);if(null==w.to)break a;w.to==l&&(w=!1)}if(!w&&z.length)for(B=0;B<z.length;++B)Ve(g,0,z[B])}if(l>=n)break;for(z=Math.min(n,p);;){if(m){B=l+m.length;w||(D=B>z?m.slice(0,z-l):m,g.addToken(g,D,o?o+t:t,v,l+D.length==p?u:"",x,r));if(B>=z){m=m.slice(z-l);l=z;break}l=B;v=""}m=j.slice(k,k=h[s++]);o=Ue(h[s++],g.cm.options)}}else for(var s=1;s<h.length;s+=2)g.addToken(g,j.slice(k,k=h[s]),Ue(h[s+1],g.cm.options))}if(e.styleClasses&& +(e.styleClasses.bgClass&&(c.bgClass=od(e.styleClasses.bgClass,c.bgClass||"")),e.styleClasses.textClass))c.textClass=od(e.styleClasses.textClass,c.textClass||"");0==c.map.length&&c.map.push(0,0,c.content.appendChild(Yf(a.display.measure)));0==d?(b.measure.map=c.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(c.map),(b.measure.caches||(b.measure.caches=[])).push({}))}E&&/\bcm-tab\b/.test(c.content.lastChild.className)&&(c.content.className="cm-tab-wrap-hack");F(a,"renderLine",a, +b.line,c.pre);c.pre.className&&(c.textClass=od(c.pre.className,c.textClass||""));return c}function Wf(a,b,c,d,e,f,g){if(b){var h=a.splitSpaces?b.replace(/ {3,}/g,Zf):b,i=a.cm.state.specialChars,j=!1;if(i.test(b))for(var k=document.createDocumentFragment(),n=0;;){i.lastIndex=n;var l=i.exec(b),s=l?l.index-n:b.length-n;if(s){var m=document.createTextNode(h.slice(n,n+s));y&&9>z?k.appendChild(q("span",[m])):k.appendChild(m);a.map.push(a.pos,a.pos+s,m);a.col+=s;a.pos+=s}if(!l)break;n+=s+1;"\t"==l[0]?(m= +a.cm.options.tabSize,l=m-a.col%m,m=k.appendChild(q("span",Fe(l),"cm-tab")),m.setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),a.col+=l):(m=a.cm.options.specialCharPlaceholder(l[0]),m.setAttribute("cm-text",l[0]),y&&9>z?k.appendChild(q("span",[m])):k.appendChild(m),a.col+=1);a.map.push(a.pos,a.pos+1,m);a.pos++}else{a.col+=b.length;var k=document.createTextNode(h);a.map.push(a.pos,a.pos+b.length,k);y&&9>z&&(j=!0);a.pos+=b.length}if(c||d||e||j||g)return b=c||"",d&&(b+=d),e&&(b+=e), +d=q("span",[k],b,g),f&&(d.title=f),a.content.appendChild(d);a.content.appendChild(k)}}function Zf(a){for(var b=" ",c=0;c<a.length-2;++c)b+=c%2?" ":" ";return b+" "}function Xf(a,b){return function(c,d,e,f,g,h,i){for(var e=e?e+" cm-force-border":"cm-force-border",j=c.pos,k=j+d.length;;){for(var n=0;n<b.length;n++){var l=b[n];if(l.to>j&&l.from<=j)break}if(l.to>=k)return a(c,d,e,f,g,h,i);a(c,d.slice(0,l.to-j),e,f,null,h,i);f=null;d=d.slice(l.to-j);j=l.to}}}function Ve(a,b,c,d){var e=!d&&c.widgetNode; +e&&a.map.push(a.pos,a.pos+b,e);!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",c.id));e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e));a.pos+=b}function Ee(a,b){return 0==b.from.ch&&0==b.to.ch&&""==x(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function hd(a,b,c,d){function e(a){return c?c[a]:null}function f(a,c,e){var f=d;a.text=c;a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null); +null!=a.order&&(a.order=null);Le(a);Me(a,e);c=f?f(a):1;c!=a.height&&Z(a,c);H(a,"change",a,b)}function g(a,b){for(var c=a,f=[];c<b;++c)f.push(new wb(j[c],e(c),d));return f}var h=b.from,i=b.to,j=b.text,k=r(a,h.line),n=r(a,i.line),l=x(j),s=e(j.length-1),m=i.line-h.line;if(b.full)a.insert(0,g(0,j.length)),a.remove(j.length,a.size-j.length);else if(Ee(a,b)){var o=g(0,j.length-1);f(n,n.text,s);m&&a.remove(h.line,m);o.length&&a.insert(h.line,o)}else k==n?1==j.length?f(k,k.text.slice(0,h.ch)+l+k.text.slice(i.ch), +s):(o=g(1,j.length-1),o.push(new wb(l+k.text.slice(i.ch),s,d)),f(k,k.text.slice(0,h.ch)+j[0],e(0)),a.insert(h.line+1,o)):1==j.length?(f(k,k.text.slice(0,h.ch)+j[0]+n.text.slice(i.ch),e(0)),a.remove(h.line+1,m)):(f(k,k.text.slice(0,h.ch)+j[0],e(0)),f(n,l+n.text.slice(i.ch),s),o=g(1,j.length-1),1<m&&a.remove(h.line+1,m-1),a.insert(h.line+1,o));H(a,"change",a,b)}function xb(a){this.lines=a;this.parent=null;for(var b=0,c=0;b<a.length;++b)a[b].parent=this,c+=a[b].height;this.height=c}function yb(a){this.children= +a;for(var b=0,c=0,d=0;d<a.length;++d){var e=a[d],b=b+e.chunkSize(),c=c+e.height;e.parent=this}this.size=b;this.height=c;this.parent=null}function Ca(a,b,c){function d(a,f,g){if(a.linked)for(var h=0;h<a.linked.length;++h){var i=a.linked[h];if(i.doc!=f){var j=g&&i.sharedHist;if(!c||j)b(i.doc,j),d(i.doc,a,j)}}}d(a,null,!0)}function wd(a,b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;vc(a);uc(a);a.options.lineWrapping||yc(a);a.options.mode=b.modeOption;N(a)}function r(a,b){b-= +a.first;if(0>b||b>=a.size)throw Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(b<f){c=e;break}b-=f}return c.lines[b]}function za(a,b,c){var d=[],e=b.line;a.iter(b.line,c.line+1,function(a){a=a.text;e==c.line&&(a=a.slice(0,c.ch));e==b.line&&(a=a.slice(b.ch));d.push(a);++e});return d}function pd(a,b,c){var d=[];a.iter(b,c,function(a){d.push(a.text)});return d}function Z(a,b){var c=b-a.height;if(c)for(var d=a;d;d= +d.parent)d.height+=c}function C(a){if(null==a.parent)return null;for(var b=a.parent,a=G(b.lines,a),c=b.parent;c;b=c,c=c.parent)for(var d=0;c.children[d]!=b;++d)a+=c.children[d].chunkSize();return a+b.first}function xa(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],f=e.height;if(b<f){a=e;continue a}b-=f;c+=e.chunkSize()}return c}while(!a.lines);for(d=0;d<a.lines.length;++d){e=a.lines[d].height;if(b<e)break;b-=e}return c+d}function ga(a){for(var a=da(a),b=0,c=a.parent, +d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;else b+=e.height}for(a=c.parent;a;c=a,a=c.parent)for(d=0;d<a.children.length&&!(e=a.children[d],e==c);++d)b+=e.height;return b}function V(a){var b=a.order;null==b&&(b=a.order=$f(a.text));return b}function pc(a){this.done=[];this.undone=[];this.undoDepth=Infinity;this.lastModTime=this.lastSelTime=0;this.lastOrigin=this.lastSelOrigin=this.lastOp=this.lastSelOp=null;this.generation=this.maxGeneration=a||1}function gd(a,b){var c={from:o(b.from.line, +b.from.ch),to:pa(b),text:za(a,b.from,b.to)};We(a,c,b.from.line,b.to.line+1);Ca(a,function(a){We(a,c,b.from.line,b.to.line+1)},!0);return c}function Vd(a){for(;a.length;)if(x(a).ranges)a.pop();else break}function Ae(a,b,c,d){var e=a.history;e.undone.length=0;var f=+new Date,g,h;if(h=e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0))){var i;e.lastOp==d?(Vd(e.done),i=x(e.done)):e.done.length&&!x(e.done).ranges? +i=x(e.done):1<e.done.length&&!e.done[e.done.length-2].ranges&&(e.done.pop(),i=x(e.done));h=g=i}if(h){var j=x(g.changes);0==v(b.from,b.to)&&0==v(b.from,j.to)?j.to=pa(b):g.changes.push(gd(a,b))}else{g=x(e.done);(!g||!g.ranges)&&Sb(a.sel,e.done);g={changes:[gd(a,b)],generation:e.generation};for(e.done.push(g);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift()}e.done.push(c);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime=f;e.lastOp=e.lastSelOp=d;e.lastOrigin=e.lastSelOrigin= +b.origin;j||F(a,"historyAdded")}function Sb(a,b){var c=x(b);(!c||!c.ranges||!c.equals(a))&&b.push(a)}function We(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans);++f})}function Sf(a){if(!a)return null;for(var b=0,c;b<a.length;++b)a[b].marker.explicitlyCleared?c||(c=a.slice(0,b)):c&&c.push(a[b]);return!c?a:c.length?c:null}function Ta(a,b,c){for(var d=0,e=[];d<a.length;++d){var f=a[d]; +if(f.ranges)e.push(c?ha.prototype.deepCopy.call(f):f);else{var f=f.changes,g=[];e.push({changes:g});for(var h=0;h<f.length;++h){var i=f[h],j;g.push({from:i.from,to:i.to,text:i.text});if(b)for(var k in i)if((j=k.match(/^spans_(\d+)$/))&&-1<G(b,Number(j[1])))x(g)[k]=i[k],delete i[k]}}}return e}function Xe(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function Ye(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges){f.copied||(f=a[e]=f.deepCopy(),f.copied=!0);for(var h=0;h<f.ranges.length;h++)Xe(f.ranges[h].anchor, +b,c,d),Xe(f.ranges[h].head,b,c,d)}else{for(h=0;h<f.changes.length;++h){var i=f.changes[h];if(c<i.from.line)i.from=o(i.from.line+d,i.from.ch),i.to=o(i.to.line+d,i.to.ch);else if(b<=i.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function Be(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;Ye(a.done,c,d,e);Ye(a.undone,c,d,e)}function cd(a){return null!=a.defaultPrevented?a.defaultPrevented:!1==a.returnValue}function pe(a){var b=a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&& +(b=2));T&&(a.ctrlKey&&1==b)&&(b=3);return b}function H(a,b){function c(a){return function(){a.apply(null,e)}}var d=a._handlers&&a._handlers[b];if(d){var e=Array.prototype.slice.call(arguments,2),f;Pa?f=Pa.delayedCallbacks:zb?f=zb:(f=zb=[],setTimeout(ag,0));for(var g=0;g<d.length;++g)f.push(c(d[g]))}}function ag(){var a=zb;zb=null;for(var b=0;b<a.length;++b)a[b]()}function ea(a,b,c){"string"==typeof b&&(b={type:b,preventDefault:function(){this.defaultPrevented=!0}});F(a,c||b.type,a,b);return cd(b)|| +b.codemirrorIgnore}function Yd(a){var b=a._handlers&&a._handlers.cursorActivity;if(b)for(var a=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]),c=0;c<b.length;++c)-1==G(a,b[c])&&a.push(b[c])}function P(a,b){var c=a._handlers&&a._handlers[b];return c&&0<c.length}function Ua(a){a.prototype.on=function(a,c){p(this,a,c)};a.prototype.off=function(a,c){fa(this,a,c)}}function Ya(){this.id=null}function qe(a,b,c){for(var d=0,e=0;;){var f=a.indexOf("\t",d);-1==f&&(f=a.length);var g=f-d; +if(f==a.length||e+g>=b)return d+Math.min(g,b-e);e+=f-d;e+=c-e%c;d=f+1;if(e>=b)return d}}function Fe(a){for(;qc.length<=a;)qc.push(x(qc)+" ");return qc[a]}function x(a){return a[a.length-1]}function G(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}function kb(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function Ab(){}function Ze(a,b){var c;Object.create?c=Object.create(a):(Ab.prototype=a,c=new Ab);b&&S(b,c);return c}function S(a,b,c){b||(b={});for(var d in a)if(a.hasOwnProperty(d)&& +(!1!==c||!b.hasOwnProperty(d)))b[d]=a[d];return b}function Za(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function jc(a,b){return!b?$e(a):-1<b.source.indexOf("\\w")&&$e(a)?!0:b.test(a)}function af(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function pb(a){return 768<=a.charCodeAt(0)&&bg.test(a)}function q(a,b,c,d){a=document.createElement(a);c&&(a.className=c);d&&(a.style.cssText=d);if("string"==typeof b)a.appendChild(document.createTextNode(b)); +else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);return a}function va(a){for(var b=a.childNodes.length;0<b;--b)a.removeChild(a.firstChild);return a}function R(a,b){return va(a).appendChild(b)}function aa(){return document.activeElement}function Bb(a){return RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function od(a,b){for(var c=a.split(" "),d=0;d<c.length;d++)c[d]&&!Bb(c[d]).test(b)&&(b+=" "+c[d]);return b}function bf(a){if(document.body.getElementsByClassName)for(var b=document.body.getElementsByClassName("CodeMirror"), +c=0;c<b.length;c++){var d=b[c].CodeMirror;d&&a(d)}}function mf(){var a;p(window,"resize",function(){null==a&&(a=setTimeout(function(){a=null;bf(Bf)},100))});p(window,"blur",function(){bf($a)})}function Yf(a){if(null==qd){var b=q("span","");R(a,q("span",[b,document.createTextNode("x")]));0!=a.firstChild.offsetHeight&&(qd=1>=b.offsetWidth&&2<b.offsetHeight&&!(y&&8>z))}a=qd?q("span",""):q("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");a.setAttribute("cm-text","");return a} +function tf(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;f<a.length;++f){var g=a[f];if(g.from<c&&g.to>b||b==c&&g.to==b)d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0}e||d(b,c,"ltr")}function Wc(a){return a.level%2?a.from:a.to}function Xb(a){return(a=V(a))?a[0].level%2?a[0].to:a[0].from:0}function Yb(a){var b=V(a);return!b?a.text.length:Wc(x(b))}function cf(a,b){var c=r(a.doc,b),d=da(c);d!=c&&(b=C(d));c=V(d);d=!c?0:c[0].level%2?Yb(d):Xb(d);return o(b,d)}function df(a,b){var c= +cf(a,b.line),d=r(a.doc,c.line),e=V(d);return!e||0==e[0].level?(d=Math.max(0,d.text.search(/\S/)),o(c.line,b.line==c.line&&b.ch<=d&&b.ch?0:d)):c}function Ob(a,b){rb=null;for(var c=0,d;c<a.length;++c){var e=a[c];if(e.from<b&&e.to>b)return c;if(e.from==b||e.to==b)if(null==d)d=c;else{var f;f=e.level;var g=a[d].level,h=a[0].level;f=f==h?!0:g==h?!1:f<g;if(f)return e.from!=e.to&&(rb=d),c;e.from!=e.to&&(rb=c);break}}return d}function rd(a,b,c,d){if(!d)return b+c;do b+=c;while(0<b&&pb(a.text.charAt(b)));return b} +function Yc(a,b,c,d){var e=V(a);if(!e)return Ge(a,b,c,d);for(var f=Ob(e,b),g=e[f],b=rd(a,b,g.level%2?-c:c,d);;){if(b>g.from&&b<g.to)return b;if(b==g.from||b==g.to){if(Ob(e,b)==f)return b;g=e[f+c];return 0<c==g.level%2?g.to:g.from}g=e[f+=c];if(!g)return null;b=0<c==g.level%2?rd(a,g.to,-1,d):rd(a,g.from,1,d)}}function Ge(a,b,c,d){b+=c;if(d)for(;0<b&&pb(a.text.charAt(b));)b+=c;return 0>b||b>a.text.length?null:b}var sa=/gecko\/\d/i.test(navigator.userAgent),ef=/MSIE \d/.test(navigator.userAgent),ff=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent), +y=ef||ff,z=y&&(ef?document.documentMode||6:ff[1]),E=/WebKit\//.test(navigator.userAgent),cg=E&&/Qt\/\d+\.\d+/.test(navigator.userAgent),dg=/Chrome\//.test(navigator.userAgent),Y=/Opera\//.test(navigator.userAgent),le=/Apple Computer/.test(navigator.vendor),eg=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),zf=/PhantomJS/.test(navigator.userAgent),Ma=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),Xa=Ma||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent), +T=Ma||/Mac/.test(navigator.platform),fg=/win/i.test(navigator.platform),Ea=Y&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Ea&&(Ea=Number(Ea[1]));Ea&&15<=Ea&&(Y=!1,E=!0);var gf=T&&(cg||Y&&(null==Ea||12.11>Ea)),$c=sa||y&&9<=z,ye=!1,na=!1;zc.prototype=S({update:function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;if(c){this.vert.style.display="block";this.vert.style.bottom=b?d+"px":"0";this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+ +(a.viewHeight-(b?d:0)))+"px"}else{this.vert.style.display="";this.vert.firstChild.style.height="0"}if(b){this.horiz.style.display="block";this.horiz.style.right=c?d+"px":"0";this.horiz.style.left=a.barLeft+"px";this.horiz.firstChild.style.width=a.scrollWidth-a.clientWidth+(a.viewWidth-a.barLeft-(c?d:0))+"px"}else{this.horiz.style.display="";this.horiz.firstChild.style.width="0"}if(!this.checkedOverlay&&a.clientHeight>0){d==0&&this.overlayHack();this.checkedOverlay=true}return{right:c?d:0,bottom:b? +d:0}},setScrollLeft:function(a){if(this.horiz.scrollLeft!=a)this.horiz.scrollLeft=a},setScrollTop:function(a){if(this.vert.scrollTop!=a)this.vert.scrollTop=a},overlayHack:function(){this.horiz.style.minHeight=this.vert.style.minWidth=T&&!eg?"12px":"18px";var a=this,b=function(b){(b.target||b.srcElement)!=a.vert&&(b.target||b.srcElement)!=a.horiz&&B(a.cm,he)(b)};p(this.vert,"mousedown",b);p(this.horiz,"mousedown",b)},clear:function(){var a=this.horiz.parentNode;a.removeChild(this.horiz);a.removeChild(this.vert)}}, +zc.prototype);Ac.prototype=S({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},Ac.prototype);m.scrollbarModel={"native":zc,"null":Ac};Ib.prototype.signal=function(a,b){P(a,b)&&this.events.push(arguments)};Ib.prototype.finish=function(){for(var a=0;a<this.events.length;a++)F.apply(null,this.events[a])};var o=m.Pos=function(a,b){if(!(this instanceof o))return new o(a,b);this.line=a;this.ch=b},v=m.cmpPos=function(a,b){return a.line- +b.line||a.ch-b.ch},U=null;Lc.prototype=S({init:function(a){function b(a){if(d.somethingSelected()){U=d.getSelections();if(c.inaccurateSelection){c.prevInput="";c.inaccurateSelection=false;f.value=U.join("\n");Va(f)}}else if(d.options.lineWiseCopyCut){var b=Nd(d);U=b.text;if(a.type=="cut")d.setSelections(b.ranges,null,ca);else{c.prevInput="";f.value=b.text.join("\n");Va(f)}}else return;if(a.type=="cut")d.state.cutIncoming=true}var c=this,d=this.cm,e=this.wrapper=Pd(),f=this.textarea=e.firstChild;a.wrapper.insertBefore(e, +a.wrapper.firstChild);if(Ma)f.style.width="0px";p(f,"input",function(){if(y&&z>=9&&c.hasSelection)c.hasSelection=null;c.poll()});p(f,"paste",function(){if(E&&!d.state.fakedLastChar&&!(new Date-d.state.lastMiddleDown<200)){var a=f.selectionStart,b=f.selectionEnd;f.value=f.value+"$";f.selectionEnd=b;f.selectionStart=a;d.state.fakedLastChar=true}d.state.pasteIncoming=true;c.fastPoll()});p(f,"cut",b);p(f,"copy",b);p(a.scroller,"paste",function(b){if(!ka(a,b)){d.state.pasteIncoming=true;c.focus()}});p(a.lineSpace, +"selectstart",function(b){ka(a,b)||L(b)});p(f,"compositionstart",function(){var a=d.getCursor("from");c.composing={start:a,range:d.markText(a,d.getCursor("to"),{className:"CodeMirror-composing"})}});p(f,"compositionend",function(){if(c.composing){c.poll();c.composing.range.clear();c.composing=null}})},prepareSelection:function(){var a=this.cm,b=a.display,c=a.doc,d=$d(a);if(a.options.moveInputWithCursor){var a=ia(a,c.sel.primary().head,"div"),c=b.wrapper.getBoundingClientRect(),e=b.lineDiv.getBoundingClientRect(); +d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+e.top-c.top));d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,a.left+e.left-c.left))}return d},showSelection:function(a){var b=this.cm.display;R(b.cursorDiv,a.cursors);R(b.selectionDiv,a.selection);if(a.teTop!=null){this.wrapper.style.top=a.teTop+"px";this.wrapper.style.left=a.teLeft+"px"}},reset:function(a){if(!this.contextMenuPending){var b,c,d=this.cm,e=d.doc;if(d.somethingSelected()){this.prevInput="";b=e.sel.primary();c=(b=ue&& +(b.to().line-b.from().line>100||(c=d.getSelection()).length>1E3))?"-":c||d.getSelection();this.textarea.value=c;d.state.focused&&Va(this.textarea);if(y&&z>=9)this.hasSelection=c}else if(!a){this.prevInput=this.textarea.value="";if(y&&z>=9)this.hasSelection=null}this.inaccurateSelection=b}},getField:function(){return this.textarea},supportsTouch:function(){return false},focus:function(){if(this.cm.options.readOnly!="nocursor"&&(!Xa||aa()!=this.textarea))try{this.textarea.focus()}catch(a){}},blur:function(){this.textarea.blur()}, +resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var a=this;a.pollingFast||a.polling.set(this.cm.options.pollInterval,function(){a.poll();a.cm.state.focused&&a.slowPoll()})},fastPoll:function(){function a(){if(!c.poll()&&!b){b=true;c.polling.set(60,a)}else{c.pollingFast=false;c.slowPoll()}}var b=false,c=this;c.pollingFast=true;c.polling.set(20,a)},poll:function(){var a=this.cm,b=this.textarea,c=this.prevInput; +if(!a.state.focused||gg(b)&&!c||Nb(a)||a.options.disableInput||a.state.keySeq)return false;if(a.state.pasteIncoming&&a.state.fakedLastChar){b.value=b.value.substring(0,b.value.length-1);a.state.fakedLastChar=false}var d=b.value;if(d==c&&!a.somethingSelected())return false;if(y&&z>=9&&this.hasSelection===d||T&&/[\uf700-\uf7ff]/.test(d)){a.display.input.reset();return false}if(a.doc.sel==a.display.selForContextMenu){var e=d.charCodeAt(0);e==8203&&!c&&(c="");if(e==8666){this.reset();return this.cm.execCommand("undo")}}for(var f= +0,e=Math.min(c.length,d.length);f<e&&c.charCodeAt(f)==d.charCodeAt(f);)++f;var g=this;Q(a,function(){Kc(a,d.slice(f),c.length-f,null,g.composing?"*compose":null);d.length>1E3||d.indexOf("\n")>-1?b.value=g.prevInput="":g.prevInput=d;if(g.composing){g.composing.range.clear();g.composing.range=a.markText(g.composing.start,a.getCursor("to"),{className:"CodeMirror-composing"})}});return true},ensurePolled:function(){if(this.pollingFast&&this.poll())this.pollingFast=false},onKeyPress:function(){if(y&&z>= +9)this.hasSelection=null;this.fastPoll()},onContextMenu:function(a){function b(){if(g.selectionStart!=null){var a=e.somethingSelected(),b=""+(a?g.value:"");g.value="⇚";g.value=b;d.prevInput=a?"":"";g.selectionStart=1;g.selectionEnd=b.length;f.selForContextMenu=e.doc.sel}}function c(){d.contextMenuPending=false;d.wrapper.style.position="relative";g.style.cssText=j;if(y&&z<9)f.scrollbars.setScrollTop(f.scroller.scrollTop=i);if(g.selectionStart!=null){(!y||y&&z<9)&&b();var a=0,c=function(){f.selForContextMenu== +e.doc.sel&&g.selectionStart==0&&g.selectionEnd>0&&d.prevInput==""?B(e,ec.selectAll)(e):a++<10?f.detectingSelectAll=setTimeout(c,500):f.input.reset()};f.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,f=e.display,g=d.textarea,h=Qa(e,a),i=f.scroller.scrollTop;if(h&&!Y){e.options.resetSelectionOnContextMenu&&e.doc.sel.contains(h)==-1&&B(e,A)(e.doc,ba(h),ca);var j=g.style.cssText;d.wrapper.style.position="absolute";g.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(a.clientY- +5)+"px; left: "+(a.clientX-5)+"px; z-index: 1000; background: "+(y?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(E)var k=window.scrollY;f.input.focus();E&&window.scrollTo(null,k);f.input.reset();if(!e.somethingSelected())g.value=d.prevInput=" ";d.contextMenuPending=true;f.selForContextMenu=e.doc.sel;clearTimeout(f.detectingSelectAll);y&&z>=9&&b();if($c){ad(a);var n=function(){fa(window,"mouseup", +n);setTimeout(c,20)};p(window,"mouseup",n)}else setTimeout(c,50)}},setUneditable:Ab,needsContentAttribute:!1},Lc.prototype);Mc.prototype=S({init:function(a){function b(a){if(d.somethingSelected()){U=d.getSelections();a.type=="cut"&&d.replaceSelection("",null,"cut")}else if(d.options.lineWiseCopyCut){var b=Nd(d);U=b.text;a.type=="cut"&&d.operation(function(){d.setSelections(b.ranges,0,ca);d.replaceSelection("",null,"cut")})}else return;if(a.clipboardData&&!Ma){a.preventDefault();a.clipboardData.clearData(); +a.clipboardData.setData("text/plain",U.join("\n"))}else{var c=Pd(),a=c.firstChild;d.display.lineSpace.insertBefore(c,d.display.lineSpace.firstChild);a.value=U.join("\n");var h=document.activeElement;Va(a);setTimeout(function(){d.display.lineSpace.removeChild(c);h.focus()},50)}}var c=this,d=c.cm,a=c.div=a.lineDiv;a.contentEditable="true";Od(a);p(a,"paste",function(a){var b=a.clipboardData&&a.clipboardData.getData("text/plain");if(b){a.preventDefault();d.replaceSelection(b,null,"paste")}});p(a,"compositionstart", +function(a){a=a.data;c.composing={sel:d.doc.sel,data:a,startData:a};if(a){var b=d.doc.sel.primary(),g=d.getLine(b.head.line).indexOf(a,Math.max(0,b.head.ch-a.length));if(g>-1&&g<=b.head.ch)c.composing.sel=ba(o(b.head.line,g),o(b.head.line,g+a.length))}});p(a,"compositionupdate",function(a){c.composing.data=a.data});p(a,"compositionend",function(a){var b=c.composing;if(b){if(a.data!=b.startData&&!/\u200b/.test(a.data))b.data=a.data;setTimeout(function(){b.handled||c.applyComposition(b);if(c.composing== +b)c.composing=null},50)}});p(a,"touchstart",function(){c.forceCompositionEnd()});p(a,"input",function(){c.composing||c.pollContent()||Q(c.cm,function(){N(d)})});p(a,"copy",b);p(a,"cut",b)},prepareSelection:function(){var a=$d(this.cm,false);a.focus=this.cm.state.focused;return a},showSelection:function(a){if(a&&this.cm.display.view.length){a.focus&&this.showPrimarySelection();this.showMultipleSelections(a)}},showPrimarySelection:function(){var a=window.getSelection(),b=this.cm.doc.sel.primary(),c= +Pb(this.cm,a.anchorNode,a.anchorOffset),d=Pb(this.cm,a.focusNode,a.focusOffset);if(!c||c.bad||!d||d.bad||!(v(Mb(c,d),b.from())==0&&v(Lb(c,d),b.to())==0)){c=Qd(this.cm,b.from());d=Qd(this.cm,b.to());if(c||d){var e=this.cm.display.view,b=a.rangeCount&&a.getRangeAt(0);if(c){if(!d){d=e[e.length-1].measure;d=d.maps?d.maps[d.maps.length-1]:d.map;d={node:d[d.length-1],offset:d[d.length-2]-d[d.length-3]}}}else c={node:e[0].measure.map[2],offset:0};try{var f=Aa(c.node,c.offset,d.offset,d.node)}catch(g){}if(f){a.removeAllRanges(); +a.addRange(f);b&&a.anchorNode==null?a.addRange(b):sa&&this.startGracePeriod()}this.rememberSelection()}}},startGracePeriod:function(){var a=this;clearTimeout(this.gracePeriod);this.gracePeriod=setTimeout(function(){a.gracePeriod=false;a.selectionChanged()&&a.cm.operation(function(){a.cm.curOp.selectionChanged=true})},20)},showMultipleSelections:function(a){R(this.cm.display.cursorDiv,a.cursors);R(this.cm.display.selectionDiv,a.selection)},rememberSelection:function(){var a=window.getSelection();this.lastAnchorNode= +a.anchorNode;this.lastAnchorOffset=a.anchorOffset;this.lastFocusNode=a.focusNode;this.lastFocusOffset=a.focusOffset},selectionInEditor:function(){var a=window.getSelection();if(!a.rangeCount)return false;a=a.getRangeAt(0).commonAncestorContainer;return Oc(this.div,a)},focus:function(){this.cm.options.readOnly!="nocursor"&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return true},receivedFocus:function(){function a(){if(b.cm.state.focused){b.pollSelection(); +b.polling.set(b.cm.options.pollInterval,a)}}var b=this;this.selectionInEditor()?this.pollSelection():Q(this.cm,function(){b.cm.curOp.selectionChanged=true});this.polling.set(this.cm.options.pollInterval,a)},selectionChanged:function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var a= +window.getSelection(),b=this.cm;this.rememberSelection();var c=Pb(b,a.anchorNode,a.anchorOffset),d=Pb(b,a.focusNode,a.focusOffset);c&&d&&Q(b,function(){A(b.doc,ba(c,d),ca);if(c.bad||d.bad)b.curOp.selectionChanged=true})}},pollContent:function(){var a=this.cm,b=a.display,c=a.doc.sel.primary(),d=c.from(),c=c.to();if(d.line<b.viewFrom||c.line>b.viewTo-1)return false;var e;if(d.line==b.viewFrom||(e=ya(a,d.line))==0){d=C(b.view[0].line);e=b.view[0].node}else{d=C(b.view[e].line);e=b.view[e-1].node.nextSibling}var f= +ya(a,c.line);if(f==b.view.length-1){c=b.viewTo-1;b=b.view[f].node}else{c=C(b.view[f+1].line)-1;b=b.view[f+1].node.previousSibling}b=oa(qf(a,e,b,d,c));for(e=za(a.doc,o(d,0),o(c,r(a.doc,c).text.length));b.length>1&&e.length>1;)if(x(b)==x(e)){b.pop();e.pop();c--}else if(b[0]==e[0]){b.shift();e.shift();d++}else break;for(var g=0,f=0,h=b[0],i=e[0],j=Math.min(h.length,i.length);g<j&&h.charCodeAt(g)==i.charCodeAt(g);)++g;h=x(b);i=x(e);for(j=Math.min(h.length-(b.length==1?g:0),i.length-(e.length==1?g:0));f< +j&&h.charCodeAt(h.length-f-1)==i.charCodeAt(i.length-f-1);)++f;b[b.length-1]=h.slice(0,h.length-f);b[0]=b[0].slice(g);d=o(d,g);c=o(c,e.length?x(e).length-f:0);if(b.length>1||b[0]||v(d,c)){sb(a.doc,b,d,c,"+input");return true}},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){if(this.composing&&!this.composing.handled){this.applyComposition(this.composing);this.composing.handled=true;this.div.blur();this.div.focus()}},applyComposition:function(a){a.data&& +a.data!=a.startData&&B(this.cm,Kc)(this.cm,a.data,0,a.sel)},setUneditable:function(a){a.setAttribute("contenteditable","false")},onKeyPress:function(a){a.preventDefault();B(this.cm,Kc)(this.cm,String.fromCharCode(a.charCode==null?a.keyCode:a.charCode),0)},onContextMenu:Ab,resetPosition:Ab,needsContentAttribute:!0},Mc.prototype);m.inputStyles={textarea:Lc,contenteditable:Mc};ha.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(a){if(a==this)return true;if(a.primIndex!= +this.primIndex||a.ranges.length!=this.ranges.length)return false;for(var b=0;b<this.ranges.length;b++){var c=this.ranges[b],d=a.ranges[b];if(v(c.anchor,d.anchor)!=0||v(c.head,d.head)!=0)return false}return true},deepCopy:function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new w(o(this.ranges[b].anchor.line,this.ranges[b].anchor.ch),o(this.ranges[b].head.line,this.ranges[b].head.ch));return new ha(a,this.primIndex)},somethingSelected:function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return true; +return false},contains:function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(v(b,d.from())>=0&&v(a,d.to())<=0)return c}return-1}};w.prototype={from:function(){return Mb(this.anchor,this.head)},to:function(){return Lb(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Tc={left:0,right:0,top:0,bottom:0},Ba,Pa=null,yf=0,bc,ac,ke=0,cc=0,O=null;y?O=-0.53:sa?O=15:dg?O=-0.7:le&&(O=-1/3);var re=function(a){var b= +a.wheelDeltaX,c=a.wheelDeltaY;if(b==null&&a.detail&&a.axis==a.HORIZONTAL_AXIS)b=a.detail;if(c==null&&a.detail&&a.axis==a.VERTICAL_AXIS)c=a.detail;else if(c==null)c=a.wheelDelta;return{x:b,y:c}};m.wheelEventPixels=function(a){a=re(a);a.x=a.x*O;a.y=a.y*O;return a};var Jf=new Ya,dd=null,pa=m.changeEnd=function(a){return!a.text?a.to:o(a.from.line+a.text.length-1,x(a.text).length+(a.text.length==1?a.from.ch:0))};m.prototype={constructor:m,focus:function(){window.focus();this.display.input.focus()},setOption:function(a, +b){var c=this.options,d=c[a];if(!(c[a]==b&&a!="mode")){c[a]=b;Ga.hasOwnProperty(a)&&B(this,Ga[a])(this,b,d)}},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](kc(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||b[c].name==a){b.splice(c,1);return true}},addOverlay:J(function(a,b){var c=a.token?a:m.getMode(this.options,a);if(c.startState)throw Error("Overlays may not be stateful."); +this.state.overlays.push({mode:c,modeSpec:a,opaque:b&&b.opaque});this.state.modeGen++;N(this)}),removeOverlay:J(function(a){for(var b=this.state.overlays,c=0;c<b.length;++c){var d=b[c].modeSpec;if(d==a||typeof a=="string"&&d.name==a){b.splice(c,1);this.state.modeGen++;N(this);break}}}),indentLine:J(function(a,b,c){typeof b!="string"&&typeof b!="number"&&(b=b==null?this.options.smartIndent?"smart":"prev":b?"add":"subtract");mb(this.doc,a)&&lb(this,a,b,c)}),indentSelection:J(function(a){for(var b=this.doc.sel.ranges, +c=-1,d=0;d<b.length;d++){var e=b[d];if(e.empty()){if(e.head.line>c){lb(this,e.head.line,a,true);c=e.head.line;d==this.doc.sel.primIndex&&La(this)}}else{for(var f=e.from(),e=e.to(),g=Math.max(c,f.line),c=Math.min(this.lastLine(),e.line-(e.ch?0:1))+1,e=g;e<c;++e)lb(this,e,a);e=this.doc.sel.ranges;f.ch==0&&(b.length==e.length&&e[d].from().ch>0)&&Pc(this.doc,d,new w(f,e[d].to()),ca)}}}),getTokenAt:function(a,b){return Re(this,a,b)},getLineTokens:function(a,b){return Re(this,o(a),b,true)},getTokenTypeAt:function(a){var a= +t(this.doc,a),b=Te(this,r(this.doc,a.line)),c=0,d=(b.length-1)/2,a=a.ch,e;if(a==0)e=b[2];else for(;;){var f=c+d>>1;if((f?b[f*2-1]:0)>=a)d=f;else if(b[f*2+1]<a)c=f+1;else{e=b[f*2+2];break}}b=e?e.indexOf("cm-overlay "):-1;return b<0?e:b==0?null:e.slice(0,b-1)},getModeAt:function(a){var b=this.doc.mode;return!b.innerMode?b:m.innerMode(b,this.getTokenAt(a).state).mode},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var c=[];if(!Wa.hasOwnProperty(b))return c;var d=Wa[b], +e=this.getModeAt(a);if(typeof e[b]=="string")d[e[b]]&&c.push(d[e[b]]);else if(e[b])for(var f=0;f<e[b].length;f++){var g=d[e[b][f]];g&&c.push(g)}else e.helperType&&d[e.helperType]?c.push(d[e.helperType]):d[e.name]&&c.push(d[e.name]);for(f=0;f<d._global.length;f++){g=d._global[f];g.pred(e,this)&&G(c,g.val)==-1&&c.push(g.val)}return c},getStateAfter:function(a,b){var c=this.doc,a=Math.max(c.first,Math.min(a==null?c.first+c.size-1:a,c.first+c.size-1));return ob(this,a+1,b)},cursorCoords:function(a,b){var c; +c=this.doc.sel.primary();c=a==null?c.head:typeof a=="object"?t(this.doc,a):a?c.from():c.to();return ia(this,c,b||"page")},charCoords:function(a,b){return Ub(this,t(this.doc,a),b||"page")},coordsChar:function(a,b){a=fe(this,a,b||"page");return Xc(this,a.left,a.top)},lineAtHeight:function(a,b){a=fe(this,{top:a,left:0},b||"page").top;return xa(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b){var c=false,d;if(typeof a=="number"){d=this.doc.first+this.doc.size-1;if(a<this.doc.first)a=this.doc.first; +else if(a>d){a=d;c=true}d=r(this.doc,a)}else d=a;return Vc(this,d,{top:0,left:0},b||"page").top+(c?this.doc.height-ga(d):0)},defaultTextHeight:function(){return ta(this.display)},defaultCharWidth:function(){return cb(this.display)},setGutterMarker:J(function(a,b,c){return ic(this.doc,a,"gutter",function(a){var e=a.gutterMarkers||(a.gutterMarkers={});e[b]=c;if(!c&&af(e))a.gutterMarkers=null;return true})}),clearGutter:J(function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){if(c.gutterMarkers&& +c.gutterMarkers[a]){c.gutterMarkers[a]=null;ja(b,d,"gutter");if(af(c.gutterMarkers))c.gutterMarkers=null}++d})}),lineInfo:function(a){if(typeof a=="number"){if(!mb(this.doc,a))return null;var b=a,a=r(this.doc,a);if(!a)return null}else{b=C(a);if(b==null)return null}return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a, +b,c,d,e){var f=this.display,a=ia(this,t(this.doc,a)),g=a.bottom,h=a.left;b.style.position="absolute";b.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(b);f.sizer.appendChild(b);if(d=="over")g=a.top;else if(d=="above"||d=="near"){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);if((d=="above"||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight)g=a.top-b.offsetHeight;else if(a.bottom+b.offsetHeight<=i)g=a.bottom;h+ +b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px";b.style.left=b.style.right="";if(e=="right"){h=f.sizer.clientWidth-b.offsetWidth;b.style.right="0px"}else{e=="left"?h=0:e=="middle"&&(h=(f.sizer.clientWidth-b.offsetWidth)/2);b.style.left=h+"px"}if(c){a=Zb(this,h,g,h+b.offsetWidth,g+b.offsetHeight);a.scrollTop!=null&&hb(this,a.scrollTop);a.scrollLeft!=null&&Ia(this,a.scrollLeft)}},triggerOnKeyDown:J(ne),triggerOnKeyPress:J(oe),triggerOnKeyUp:me,execCommand:function(a){if(ec.hasOwnProperty(a))return ec[a](this)}, +findPosH:function(a,b,c,d){var e=1;if(b<0){e=-1;b=-b}for(var f=0,a=t(this.doc,a);f<b;++f){a=jd(this.doc,a,e,c,d);if(a.hitSide)break}return a},moveH:J(function(a,b){var c=this;c.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?jd(c.doc,d.head,a,b,c.options.rtlMoveVisually):a<0?d.from():d.to()},Cb)}),deleteH:J(function(a,b){var c=this.doc;this.doc.sel.somethingSelected()?c.replaceSelection("",null,"+delete"):Ra(this,function(d){var e=jd(c,d.head,a,b,false);return a<0?{from:e, +to:d.head}:{from:d.head,to:e}})}),findPosV:function(a,b,c,d){var e=1;if(b<0){e=-1;b=-b}for(var f=0,a=t(this.doc,a);f<b;++f){a=ia(this,a,"div");d==null?d=a.left:a.left=d;a=He(this,a,e,c);if(a.hitSide)break}return a},moveV:J(function(a,b){var c=this,d=this.doc,e=[],f=!c.display.shift&&!d.extend&&d.sel.somethingSelected();d.extendSelectionsBy(function(g){if(f)return a<0?g.from():g.to();var i=ia(c,g.head,"div");if(g.goalColumn!=null)i.left=g.goalColumn;e.push(i.left);var j=He(c,i,a,b);b=="page"&&g==d.sel.primary()&& +id(c,null,Ub(c,j,"div").top-i.top);return j},Cb);if(e.length)for(var g=0;g<d.sel.ranges.length;g++)d.sel.ranges[g].goalColumn=e[g]}),findWordAt:function(a){var b=r(this.doc,a.line).text,c=a.ch,d=a.ch;if(b){var e=this.getHelper(a,"wordChars");(a.xRel<0||d==b.length)&&c?--c:++d;for(var f=b.charAt(c),f=jc(f,e)?function(a){return jc(a,e)}:/\s/.test(f)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!jc(a)};c>0&&f(b.charAt(c-1));)--c;for(;d<b.length&&f(b.charAt(d));)++d}return new w(o(a.line, +c),o(a.line,d))},toggleOverwrite:function(a){if(!(a!=null&&a==this.state.overwrite)){(this.state.overwrite=!this.state.overwrite)?ib(this.display.cursorDiv,"CodeMirror-overwrite"):gb(this.display.cursorDiv,"CodeMirror-overwrite");F(this,"overwriteToggle",this,this.state.overwrite)}},hasFocus:function(){return this.display.input.getField()==aa()},scrollTo:J(function(a,b){(a!=null||b!=null)&&hc(this);if(a!=null)this.curOp.scrollLeft=a;if(b!=null)this.curOp.scrollTop=b}),getScrollInfo:function(){var a= +this.display.scroller;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-$(this)-this.display.barHeight,width:a.scrollWidth-$(this)-this.display.barWidth,clientHeight:Gc(this),clientWidth:la(this)}},scrollIntoView:J(function(a,b){if(a==null){a={from:this.doc.sel.primary().head,to:null};if(b==null)b=this.options.cursorScrollMargin}else typeof a=="number"?a={from:o(a,0),to:null}:a.from==null&&(a={from:a,to:null});if(!a.to)a.to=a.from;a.margin=b||0;if(a.from.line!=null){hc(this);this.curOp.scrollToPos= +a}else{var c=Zb(this,Math.min(a.from.left,a.to.left),Math.min(a.from.top,a.to.top)-a.margin,Math.max(a.from.right,a.to.right),Math.max(a.from.bottom,a.to.bottom)+a.margin);this.scrollTo(c.scrollLeft,c.scrollTop)}}),setSize:J(function(a,b){function c(a){return typeof a=="number"||/^\d+$/.test(""+a)?a+"px":a}var d=this;if(a!=null)d.display.wrapper.style.width=c(a);if(b!=null)d.display.wrapper.style.height=c(b);d.options.lineWrapping&&ee(this);var e=d.display.viewFrom;d.doc.iter(e,d.display.viewTo,function(a){if(a.widgets)for(var b= +0;b<a.widgets.length;b++)if(a.widgets[b].noHScroll){ja(d,e,"widget");break}++e});d.curOp.forceUpdate=true;F(d,"refresh",this)}),operation:function(a){return Q(this,a)},refresh:J(function(){var a=this.display.cachedTextHeight;N(this);this.curOp.forceUpdate=true;db(this);this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop);xc(this);(a==null||Math.abs(a-ta(this.display))>0.5)&&vc(this);F(this,"refresh",this)}),swapDoc:J(function(a){var b=this.doc;b.cm=null;wd(this,a);db(this);this.display.input.reset(); +this.scrollTo(a.scrollLeft,a.scrollTop);this.curOp.forceScroll=true;H(this,"swapDoc",this,b);return b}),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}};Ua(m);var jf=m.defaults={},Ga=m.optionHandlers={},xd=m.Init={toString:function(){return"CodeMirror.Init"}};u("value","",function(a,b){a.setValue(b)},!0);u("mode", +null,function(a,b){a.doc.modeOption=b;uc(a)},!0);u("indentUnit",2,uc,!0);u("indentWithTabs",!1);u("smartIndent",!0);u("tabSize",4,function(a){ab(a);db(a);N(a)},!0);u("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,c){a.state.specialChars=RegExp(b.source+(b.test("\t")?"":"|\t"),"g");c!=m.Init&&a.refresh()});u("specialCharPlaceholder",function(a){var b=q("span","•","cm-invalidchar");b.title="\\u"+a.charCodeAt(0).toString(16);b.setAttribute("aria-label",b.title); +return b},function(a){a.refresh()},!0);u("electricChars",!0);u("inputStyle",Xa?"contenteditable":"textarea",function(){throw Error("inputStyle can not (yet) be changed in a running editor");},!0);u("rtlMoveVisually",!fg);u("wholeLineUpdateBefore",!0);u("theme","default",function(a){td(a);eb(a)},!0);u("keyMap","default",function(a,b,c){b=kc(b);(c=c!=m.Init&&kc(c))&&c.detach&&c.detach(a,b);b.attach&&b.attach(a,c||null)});u("extraKeys",null);u("lineWrapping",!1,function(a){if(a.options.lineWrapping){ib(a.display.wrapper, +"CodeMirror-wrap");a.display.sizer.style.minWidth="";a.display.sizerWidth=null}else{gb(a.display.wrapper,"CodeMirror-wrap");yc(a)}vc(a);N(a);db(a);setTimeout(function(){Ja(a)},100)},!0);u("gutters",[],function(a){rc(a.options);eb(a)},!0);u("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?Cc(a.display)+"px":"0";a.refresh()},!0);u("coverGutterNextToScrollbar",!1,function(a){Ja(a)},!0);u("scrollbarStyle","native",function(a){ud(a);Ja(a);a.display.scrollbars.setScrollTop(a.doc.scrollTop); +a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0);u("lineNumbers",!1,function(a){rc(a.options);eb(a)},!0);u("firstLineNumber",1,eb,!0);u("lineNumberFormatter",function(a){return a},eb,!0);u("showCursorWhenSelecting",!1,jb,!0);u("resetSelectionOnContextMenu",!0);u("lineWiseCopyCut",!0);u("readOnly",!1,function(a,b){if(b=="nocursor"){$a(a);a.display.input.blur();a.display.disabled=true}else{a.display.disabled=false;b||a.display.input.reset()}});u("disableInput",!1,function(a,b){b||a.display.input.reset()}, +!0);u("dragDrop",!0,function(a,b,c){if(!b!=!(c&&c!=m.Init)){c=a.display.dragFunctions;b=b?p:fa;b(a.display.scroller,"dragstart",c.start);b(a.display.scroller,"dragenter",c.simple);b(a.display.scroller,"dragover",c.simple);b(a.display.scroller,"drop",c.drop)}});u("cursorBlinkRate",530);u("cursorScrollMargin",0);u("cursorHeight",1,jb,!0);u("singleCursorHeightPerLine",!0,jb,!0);u("workTime",100);u("workDelay",100);u("flattenSpans",!0,ab,!0);u("addModeClass",!1,ab,!0);u("pollInterval",100);u("undoDepth", +200,function(a,b){a.doc.history.undoDepth=b});u("historyEventDelay",1250);u("viewportMargin",10,function(a){a.refresh()},!0);u("maxHighlightLength",1E4,ab,!0);u("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()});u("tabindex",null,function(a,b){a.display.input.getField().tabIndex=b||""});u("autofocus",null);var hf=m.modes={},Db=m.mimeModes={};m.defineMode=function(a,b){if(!m.defaults.mode&&a!="null")m.defaults.mode=a;if(arguments.length>2)b.dependencies=Array.prototype.slice.call(arguments, +2);hf[a]=b};m.defineMIME=function(a,b){Db[a]=b};m.resolveMode=function(a){if(typeof a=="string"&&Db.hasOwnProperty(a))a=Db[a];else if(a&&typeof a.name=="string"&&Db.hasOwnProperty(a.name)){var b=Db[a.name];typeof b=="string"&&(b={name:b});a=Ze(b,a);a.name=b.name}else if(typeof a=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return m.resolveMode("application/xml");return typeof a=="string"?{name:a}:a||{name:"null"}};m.getMode=function(a,b){var b=m.resolveMode(b),c=hf[b.name];if(!c)return m.getMode(a, +"text/plain");c=c(a,b);if(Eb.hasOwnProperty(b.name)){var d=Eb[b.name],e;for(e in d)if(d.hasOwnProperty(e)){c.hasOwnProperty(e)&&(c["_"+e]=c[e]);c[e]=d[e]}}c.name=b.name;if(b.helperType)c.helperType=b.helperType;if(b.modeProps)for(e in b.modeProps)c[e]=b.modeProps[e];return c};m.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}});m.defineMIME("text/plain","null");var Eb=m.modeExtensions={};m.extendMode=function(a,b){var c=Eb.hasOwnProperty(a)?Eb[a]:Eb[a]={};S(b,c)};m.defineExtension= +function(a,b){m.prototype[a]=b};m.defineDocExtension=function(a,b){M.prototype[a]=b};m.defineOption=u;var tc=[];m.defineInitHook=function(a){tc.push(a)};var Wa=m.helpers={};m.registerHelper=function(a,b,c){Wa.hasOwnProperty(a)||(Wa[a]=m[a]={_global:[]});Wa[a][b]=c};m.registerGlobalHelper=function(a,b,c,d){m.registerHelper(a,b,d);Wa[a]._global.push({pred:c,val:d})};var Oa=m.copyState=function(a,b){if(b===true)return b;if(a.copyState)return a.copyState(b);var c={},d;for(d in b){var e=b[d];e instanceof +Array&&(e=e.concat([]));c[d]=e}return c},wf=m.startState=function(a,b,c){return a.startState?a.startState(b,c):true};m.innerMode=function(a,b){for(;a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state;a=c.mode}return c||{mode:a,state:b}};var ec=m.commands={selectAll:function(a){a.setSelection(o(a.firstLine(),0),o(a.lastLine()),ca)},singleSelection:function(a){a.setSelection(a.getCursor("anchor"),a.getCursor("head"),ca)},killLine:function(a){Ra(a,function(b){if(b.empty()){var c=r(a.doc, +b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:o(b.head.line+1,0)}:{from:b.head,to:o(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){Ra(a,function(b){return{from:o(b.from().line,0),to:t(a.doc,o(b.to().line+1,0))}})},delLineLeft:function(a){Ra(a,function(a){return{from:o(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){Ra(a,function(b){var c=a.charCoords(b.head,"div").top+5;return{from:a.coordsChar({left:0,top:c},"div"), +to:b.from()}})},delWrappedLineRight:function(a){Ra(a,function(b){var c=a.charCoords(b.head,"div").top+5,c=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div");return{from:b.from(),to:c}})},undo:function(a){a.undo()},redo:function(a){a.redo()},undoSelection:function(a){a.undoSelection()},redoSelection:function(a){a.redoSelection()},goDocStart:function(a){a.extendSelection(o(a.firstLine(),0))},goDocEnd:function(a){a.extendSelection(o(a.lastLine()))},goLineStart:function(a){a.extendSelectionsBy(function(b){return cf(a, +b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){a.extendSelectionsBy(function(b){return df(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){a.extendSelectionsBy(function(b){for(var b=b.head.line,c,d=r(a.doc,b);c=wa(d,false);){d=c.find(1,true).line;b=null}c=V(d);c=!c?d.text.length:c[0].level%2?Xb(d):Yb(d);return o(b==null?C(d):b,c)},{origin:"+move",bias:-1})},goLineRight:function(a){a.extendSelectionsBy(function(b){b=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+ +100,top:b},"div")},Cb)},goLineLeft:function(a){a.extendSelectionsBy(function(b){b=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:b},"div")},Cb)},goLineLeftSmart:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5,c=a.coordsChar({left:0,top:c},"div");return c.ch<a.getLine(c.line).search(/\S/)?df(a,b.head):c},Cb)},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1, +"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goGroupRight:function(a){a.moveH(1,"group")},goGroupLeft:function(a){a.moveH(-1,"group")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")}, +delWordAfter:function(a){a.deleteH(1,"word")},delGroupBefore:function(a){a.deleteH(-1,"group")},delGroupAfter:function(a){a.deleteH(1,"group")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection("\t")},insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,e=0;e<c.length;e++){var f=c[e].from(),f=X(a.getLine(f.line),f.ch,d);b.push(Array(d- +f%d+1).join(" "))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){Q(a,function(){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++){var e=b[d].head,f=r(a.doc,e.line).text;if(f){e.ch==f.length&&(e=new o(e.line,e.ch-1));if(e.ch>0){e=new o(e.line,e.ch+1);a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),o(e.line,e.ch-2),e,"+transpose")}else if(e.line>a.doc.first){var g=r(a.doc,e.line-1).text;g&&a.replaceRange(f.charAt(0)+ +"\n"+g.charAt(g.length-1),o(e.line-1,g.length-1),o(e.line,1),"+transpose")}}c.push(new w(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){Q(a,function(){for(var b=a.listSelections().length,c=0;c<b;c++){var d=a.listSelections()[c];a.replaceRange("\n",d.anchor,d.head,"+input");a.indentLine(d.from().line+1,null,true);La(a)}})},toggleOverwrite:function(a){a.toggleOverwrite()}},qa=m.keyMap={};qa.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"};qa.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"};qa.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"};qa.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"]};qa["default"]= +T?qa.macDefault:qa.pcDefault;m.normalizeKeyMap=function(a){var b={},c;for(c in a)if(a.hasOwnProperty(c)){var d=a[c];if(!/^(name|fallthrough|(de|at)tach)$/.test(c)){if(d!="...")for(var e=kb(c.split(" "),Pf),f=0;f<e.length;f++){var g,h;if(f==e.length-1){h=c;g=d}else{h=e.slice(0,f+1).join(" ");g="..."}var i=b[h];if(i){if(i!=g)throw Error("Inconsistent bindings for "+h);}else b[h]=g}delete a[c]}}for(var j in b)a[j]=b[j];return a};var tb=m.lookupKey=function(a,b,c,d){var b=kc(b),e=b.call?b.call(a,d):b[a]; +if(e===false)return"nothing";if(e==="...")return"multi";if(e!=null&&c(e))return"handled";if(b.fallthrough){if(Object.prototype.toString.call(b.fallthrough)!="[object Array]")return tb(a,b.fallthrough,c,d);for(e=0;e<b.fallthrough.length;e++){var f=tb(a,b.fallthrough[e],c,d);if(f)return f}}},If=m.isModifierKey=function(a){a=typeof a=="string"?a:ra[a.keyCode];return a=="Ctrl"||a=="Alt"||a=="Shift"||a=="Mod"},Kf=m.keyName=function(a,b){if(Y&&a.keyCode==34&&a["char"])return false;var c=ra[a.keyCode],d= +c;if(d==null||a.altGraphKey)return false;a.altKey&&c!="Alt"&&(d="Alt-"+d);if((gf?a.metaKey:a.ctrlKey)&&c!="Ctrl")d="Ctrl-"+d;if((gf?a.ctrlKey:a.metaKey)&&c!="Cmd")d="Cmd-"+d;!b&&(a.shiftKey&&c!="Shift")&&(d="Shift-"+d);return d};m.fromTextArea=function(a,b){function c(){a.value=i.getValue()}b=b?S(b):{};b.value=a.value;if(!b.tabindex&&a.tabIndex)b.tabindex=a.tabIndex;if(!b.placeholder&&a.placeholder)b.placeholder=a.placeholder;if(b.autofocus==null){var d=aa();b.autofocus=d==a||a.getAttribute("autofocus")!= +null&&d==document.body}if(a.form){p(a.form,"submit",c);if(!b.leaveSubmitMethodAlone){var e=a.form,f=e.submit;try{var g=e.submit=function(){c();e.submit=f;e.submit();e.submit=g}}catch(h){}}}b.finishInit=function(b){b.save=c;b.getTextArea=function(){return a};b.toTextArea=function(){b.toTextArea=isNaN;c();a.parentNode.removeChild(b.getWrapperElement());a.style.display="";if(a.form){fa(a.form,"submit",c);if(typeof a.form.submit=="function")a.form.submit=f}}};a.style.display="none";var i=m(function(b){a.parentNode.insertBefore(b, +a.nextSibling)},b);return i};var oc=m.StringStream=function(a,b){this.pos=this.start=0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0};oc.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},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"?b==a:b&&(a.test?a.test(b):a(b))){++this.pos;return b}},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){a=this.string.indexOf(a,this.pos);if(a>-1){this.pos=a;return true}},backUp:function(a){this.pos=this.pos-a},column:function(){if(this.lastColumnPos<this.start){this.lastColumnValue= +X(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue);this.lastColumnPos=this.start}return this.lastColumnValue-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return X(this.string,null,this.tabSize)-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},match:function(a,b,c){if(typeof a=="string"){var d=this.string.substr(this.pos,a.length);if((c?d.toLowerCase():d)==(c?a.toLowerCase():a)){if(b!==false)this.pos=this.pos+a.length; +return true}}else{if((a=this.string.slice(this.pos).match(a))&&a.index>0)return null;if(a&&b!==false)this.pos=this.pos+a[0].length;return a}},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart=this.lineStart+a;try{return b()}finally{this.lineStart=this.lineStart-a}}};var kd=0,Da=m.TextMarker=function(a,b){this.lines=[];this.type=b;this.doc=a;this.id=++kd};Ua(Da);Da.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b= +a&&!a.curOp;b&&Fa(a);if(P(this,"clear")){var c=this.find();c&&H(this,"clear",c.from,c.to)}for(var d=c=null,e=0;e<this.lines.length;++e){var f=this.lines[e],g=vb(f.markedSpans,this);if(a&&!this.collapsed)ja(a,C(f),"text");else if(a){g.to!=null&&(d=C(f));g.from!=null&&(c=C(f))}for(var h=f,i=f.markedSpans,j=g,k=void 0,n=0;n<i.length;++n)i[n]!=j&&(k||(k=[])).push(i[n]);h.markedSpans=k;g.from==null&&(this.collapsed&&!ua(this.doc,f)&&a)&&Z(f,ta(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(e= +0;e<this.lines.length;++e){f=da(this.lines[e]);g=Gb(f);if(g>a.display.maxLineLength){a.display.maxLine=f;a.display.maxLineLength=g;a.display.maxLineChanged=true}}c!=null&&(a&&this.collapsed)&&N(a,c,d+1);this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;a&&Zd(a.doc)}a&&H(a,"markerCleared",a,this);b&&Ha(a);this.parent&&this.parent.clear()}};Da.prototype.find=function(a,b){a==null&&this.type=="bookmark"&&(a=1);for(var c,d,e=0;e<this.lines.length;++e){var f= +this.lines[e],g=vb(f.markedSpans,this);if(g.from!=null){c=o(b?f:C(f),g.from);if(a==-1)return c}if(g.to!=null){d=o(b?f:C(f),g.to);if(a==1)return d}}return c&&{from:c,to:d}};Da.prototype.changed=function(){var a=this.find(-1,true),b=this,c=this.doc.cm;a&&c&&Q(c,function(){var d=a.line,e=C(a.line);if(e=Nc(c,e)){de(e);c.curOp.selectionChanged=c.curOp.forceUpdate=true}c.curOp.updateMaxLine=true;if(!ua(b.doc,d)&&b.height!=null){e=b.height;b.height=null;(e=qb(b)-e)&&Z(d,d.height+e)}})};Da.prototype.attachLine= +function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;if(!b.maybeHiddenMarkers||G(b.maybeHiddenMarkers,this)==-1)(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};Da.prototype.detachLine=function(a){this.lines.splice(G(this.lines,a),1);if(!this.lines.length&&this.doc.cm){a=this.doc.cm.curOp;(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this)}};var kd=0,mc=m.SharedTextMarker=function(a,b){this.markers=a;this.primary=b;for(var c=0;c<a.length;++c)a[c].parent= +this};Ua(mc);mc.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=true;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();H(this,"clear")}};mc.prototype.find=function(a,b){return this.primary.find(a,b)};var nc=m.LineWidget=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.doc=a;this.node=b};Ua(nc);nc.prototype.clear=function(){var a=this.doc.cm,b=this.line.widgets,c=this.line,d=C(c);if(d!=null&&b){for(var e=0;e<b.length;++e)b[e]==this&& +b.splice(e--,1);if(!b.length)c.widgets=null;var f=qb(this);Z(c,Math.max(0,c.height-f));a&&Q(a,function(){Oe(a,c,-f);ja(a,d,"widget")})}};nc.prototype.changed=function(){var a=this.height,b=this.doc.cm,c=this.line;this.height=null;var d=qb(this)-a;if(d){Z(c,c.height+d);b&&Q(b,function(){b.curOp.forceUpdate=true;Oe(b,c,d)})}};var wb=m.Line=function(a,b,c){this.text=a;Me(this,b);this.height=c?c(this):1};Ua(wb);wb.prototype.lineNo=function(){return C(this)};var Vf={},Uf={};xb.prototype={chunkSize:function(){return this.lines.length}, +removeInner:function(a,b){for(var c=a,d=a+b;c<d;++c){var e=this.lines[c];this.height=this.height-e.height;var f=e;f.parent=null;Le(f);H(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height=this.height+c;this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(a=0;a<b.length;++a)b[a].parent=this},iterN:function(a,b,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return true}};yb.prototype={chunkSize:function(){return this.size}, +removeInner:function(a,b){this.size=this.size-b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(a<e){var f=Math.min(b,e-a),g=d.height;d.removeInner(a,f);this.height=this.height-(g-d.height);if(e==f){this.children.splice(c--,1);d.parent=null}if((b=b-f)==0)break;a=0}else a=a-e}if(this.size-b<25&&(this.children.length>1||!(this.children[0]instanceof xb))){c=[];this.collapse(c);this.children=[new xb(c)];this.children[0].parent=this}},collapse:function(a){for(var b=0;b< +this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size=this.size+b.length;this.height=this.height+c;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<=f){e.insertInner(a,b,c);if(e.lines&&e.lines.length>50){for(;e.lines.length>50;){a=e.lines.splice(e.lines.length-25,25);a=new xb(a);e.height=e.height-a.height;this.children.splice(d+1,0,a);a.parent=this}this.maybeSpill()}break}a=a-f}},maybeSpill:function(){if(!(this.children.length<= +10)){var a=this;do{var b=a.children.splice(a.children.length-5,5),b=new yb(b);if(a.parent){a.size=a.size-b.size;a.height=a.height-b.height;var c=G(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else{c=new yb(a.children);c.parent=a;a.children=[c,b];a=c}b.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<f){f=Math.min(b,f-a);if(e.iterN(a,f,c))return true;if((b=b-f)==0)break; +a=0}else a=a-f}}};var hg=0,M=m.Doc=function(a,b,c){if(!(this instanceof M))return new M(a,b,c);c==null&&(c=0);yb.call(this,[new xb([new wb("",null)])]);this.first=c;this.scrollTop=this.scrollLeft=0;this.cantEdit=false;this.cleanGeneration=1;this.frontier=c;c=o(c,0);this.sel=ba(c);this.history=new pc(null);this.id=++hg;this.modeOption=b;typeof a=="string"&&(a=oa(a));hd(this,{from:c,to:c,text:a});A(this,ba(c),ca)};M.prototype=Ze(yb.prototype,{constructor:M,iter:function(a,b,c){c?this.iterN(a-this.first, +b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0;d<b.length;++d)c=c+b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=pd(this,this.first,this.first+this.size);return a===false?b:b.join(a||"\n")},setValue:K(function(a){var b=o(this.first,0),c=this.first+this.size-1;Ka(this,{from:b,to:o(c,r(this,c).text.length),text:oa(a),origin:"setValue",full:true},true);A(this,ba(b))}),replaceRange:function(a, +b,c,d){b=t(this,b);c=c?t(this,c):b;sb(this,a,b,c,d)},getRange:function(a,b,c){a=za(this,t(this,a),t(this,b));return c===false?a:a.join(c||"\n")},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},getLineHandle:function(a){if(mb(this,a))return r(this,a)},getLineNumber:function(a){return C(a)},getLineHandleVisualStart:function(a){typeof a=="number"&&(a=r(this,a));return da(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+ +this.size-1},clipPos:function(a){return t(this,a)},getCursor:function(a){var b=this.sel.primary();return a==null||a=="head"?b.head:a=="anchor"?b.anchor:a=="end"||a=="to"||a===false?b.to():b.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:K(function(a,b,c){a=t(this,typeof a=="number"?o(a,b||0):a);A(this,ba(a,null),c)}),setSelection:K(function(a,b,c){var d=t(this,a),a=t(this,b||a);A(this,ba(d,a),c)}),extendSelection:K(function(a, +b,c){Qb(this,t(this,a),b&&t(this,b),c)}),extendSelections:K(function(a){for(var b=[],c=0;c<a.length;c++)b[c]=t(this,a[c]);Td(this,b)}),extendSelectionsBy:K(function(a,b){Td(this,kb(this.sel.ranges,a),b)}),setSelections:K(function(a,b,c){if(a.length){for(var d=0,e=[];d<a.length;d++)e[d]=new w(t(this,a[d].anchor),t(this,a[d].head));b==null&&(b=Math.min(a.length-1,this.sel.primIndex));A(this,W(e,b),c)}}),addSelection:K(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new w(t(this,a),t(this,b||a))); +A(this,W(d,d.length-1),c)}),getSelection:function(a){for(var b=this.sel.ranges,c,d=0;d<b.length;d++){var e=za(this,b[d].from(),b[d].to());c=c?c.concat(e):e}return a===false?c:c.join(a||"\n")},getSelections:function(a){for(var b=[],c=this.sel.ranges,d=0;d<c.length;d++){var e=za(this,c[d].from(),c[d].to());a!==false&&(e=e.join(a||"\n"));b[d]=e}return b},replaceSelection:function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c||"+input")},replaceSelections:K(function(a, +b,c){for(var d=[],e=this.sel,f=0;f<e.ranges.length;f++){var g=e.ranges[f];d[f]={from:g.from(),to:g.to(),text:oa(a[f]),origin:c}}if(f=b)if(f=b!="end"){f=[];c=a=o(this.first,0);for(e=0;e<d.length;e++){var h=d[e],g=we(h.from,a,c),i=we(pa(h),a,c),a=h.to,c=i;if(b=="around"){h=this.sel.ranges[e];h=v(h.head,h.anchor)<0;f[e]=new w(h?i:g,h?g:i)}else f[e]=new w(g,g)}f=new ha(f,this.sel.primIndex)}b=f;for(f=d.length-1;f>=0;f--)Ka(this,d[f]);b?Ud(this,b):this.cm&&La(this.cm)}),undo:K(function(){gc(this,"undo")}), +redo:K(function(){gc(this,"redo")}),undoSelection:K(function(){gc(this,"undo",true)}),redoSelection:K(function(){gc(this,"redo",true)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(d=0;d<a.undone.length;d++)a.undone[d].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new pc(this.history.maxGeneration)},markClean:function(){this.cleanGeneration= +this.changeGeneration(true)},changeGeneration:function(a){if(a)this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null;return this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:Ta(this.history.done),undone:Ta(this.history.undone)}},setHistory:function(a){var b=this.history=new pc(this.history.maxGeneration);b.done=Ta(a.done.slice(0),null,true);b.undone=Ta(a.undone.slice(0),null,true)},addLineClass:K(function(a, +b,c){return ic(this,a,b=="gutter"?"gutter":"class",function(a){var e=b=="text"?"textClass":b=="background"?"bgClass":b=="gutter"?"gutterClass":"wrapClass";if(a[e]){if(Bb(c).test(a[e]))return false;a[e]=a[e]+(" "+c)}else a[e]=c;return true})}),removeLineClass:K(function(a,b,c){return ic(this,a,b=="gutter"?"gutter":"class",function(a){var e=b=="text"?"textClass":b=="background"?"bgClass":b=="gutter"?"gutterClass":"wrapClass",f=a[e];if(f)if(c==null)a[e]=null;else{var g=f.match(Bb(c));if(!g)return false; +var h=g.index+g[0].length;a[e]=f.slice(0,g.index)+(!g.index||h==f.length?"":" ")+f.slice(h)||null}else return false;return true})}),addLineWidget:K(function(a,b,c){return Tf(this,a,b,c)}),removeLineWidget:function(a){a.clear()},markText:function(a,b,c){return Sa(this,t(this,a),t(this,b),c,"range")},setBookmark:function(a,b){var c={replacedWith:b&&(b.nodeType==null?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:false,shared:b&&b.shared,handleMouseEvents:b&&b.handleMouseEvents},a=t(this,a);return Sa(this, +a,a,c,"bookmark")},findMarksAt:function(a){var a=t(this,a),b=[],c=r(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var e=c[d];if((e.from==null||e.from<=a.ch)&&(e.to==null||e.to>=a.ch))b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){var a=t(this,a),b=t(this,b),d=[],e=a.line;this.iter(a.line,b.line+1,function(f){if(f=f.markedSpans)for(var g=0;g<f.length;g++){var h=f[g];if(!(e==a.line&&a.ch>h.to||h.from==null&&e!=a.line||e==b.line&&h.from>b.ch)&&(!c||c(h.marker)))d.push(h.marker.parent|| +h.marker)}++e});return d},getAllMarks:function(){var a=[];this.iter(function(b){if(b=b.markedSpans)for(var c=0;c<b.length;++c)b[c].from!=null&&a.push(b[c].marker)});return a},posFromIndex:function(a){var b,c=this.first;this.iter(function(d){d=d.text.length+1;if(d>a){b=a;return true}a=a-d;++c});return t(this,o(c,b))},indexFromPos:function(a){var a=t(this,a),b=a.ch;if(a.line<this.first||a.ch<0)return 0;this.iter(this.first,a.line,function(a){b=b+(a.text.length+1)});return b},copy:function(a){var b= +new M(pd(this,this.first,this.first+this.size),this.modeOption,this.first);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=false;if(a){b.history.undoDepth=this.history.undoDepth;b.setHistory(this.getHistory())}return b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;if(a.from!=null&&a.from>b)b=a.from;if(a.to!=null&&a.to<c)c=a.to;b=new M(pd(this,b,c),a.mode||this.modeOption,b);if(a.sharedHist)b.history=this.history;(this.linked||(this.linked= +[])).push({doc:b,sharedHist:a.sharedHist});b.linked=[{doc:this,isParent:true,sharedHist:a.sharedHist}];a=Je(this);for(c=0;c<a.length;c++){var d=a[c],e=d.find(),f=b.clipPos(e.from),e=b.clipPos(e.to);if(v(f,e)){f=Sa(b,f,e,d.primary,d.primary.type);d.markers.push(f);f.parent=d}}return b},unlinkDoc:function(a){if(a instanceof m)a=a.doc;if(this.linked)for(var b=0;b<this.linked.length;++b)if(this.linked[b].doc==a){this.linked.splice(b,1);a.unlinkDoc(this);Rf(Je(this));break}if(a.history==this.history){var c= +[a.id];Ca(a,function(a){c.push(a.id)},true);a.history=new pc(null);a.history.done=Ta(this.history.done,c);a.history.undone=Ta(this.history.undone,c)}},iterLinkedDocs:function(a){Ca(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm}});M.prototype.eachLine=M.prototype.iter;var ig=["iter","insert","remove","copy","getEditor"],Fb;for(Fb in M.prototype)M.prototype.hasOwnProperty(Fb)&&0>G(ig,Fb)&&(m.prototype[Fb]=function(a){return function(){return a.apply(this.doc,arguments)}}(M.prototype[Fb])); +Ua(M);var L=m.e_preventDefault=function(a){a.preventDefault?a.preventDefault():a.returnValue=false},jg=m.e_stopPropagation=function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=true},ad=m.e_stop=function(a){L(a);jg(a)},p=m.on=function(a,b,c){if(a.addEventListener)a.addEventListener(b,c,false);else if(a.attachEvent)a.attachEvent("on"+b,c);else{a=a._handlers||(a._handlers={});(a[b]||(a[b]=[])).push(c)}},fa=m.off=function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,false);else if(a.detachEvent)a.detachEvent("on"+ +b,c);else if(a=a._handlers&&a._handlers[b])for(b=0;b<a.length;++b)if(a[b]==c){a.splice(b,1);break}},F=m.signal=function(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)},zb=null,zd=30,se=m.Pass={toString:function(){return"CodeMirror.Pass"}},ca={scroll:!1},bd={origin:"*mouse"},Cb={origin:"+move"};Ya.prototype.set=function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var X=m.countColumn=function(a,b,c,d,e){if(b== +null){b=a.search(/[^\s\u00a0]/);if(b==-1)b=a.length}d=d||0;for(e=e||0;;){var f=a.indexOf("\t",d);if(f<0||f>=b)return e+(b-d);e=e+(f-d);e=e+(c-e%c);d=f+1}},qc=[""],Va=function(a){a.select()};Ma?Va=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:y&&(Va=function(a){try{a.select()}catch(b){}});var kg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,$e=m.isWordChar=function(a){return/\w/.test(a)||a>""&&(a.toUpperCase()!=a.toLowerCase()|| +kg.test(a))},bg=/[\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]/, +Aa;Aa=document.createRange?function(a,b,c,d){var e=document.createRange();e.setEnd(d||a,c);e.setStart(a,b);return e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(e){return d}d.collapse(true);d.moveEnd("character",c);d.moveStart("character",b);return d};var Oc=m.contains=function(a,b){if(b.nodeType==3)b=b.parentNode;if(a.contains)return a.contains(b);do{if(b.nodeType==11)b=b.host;if(b==a)return true}while(b=b.parentNode)};y&&11>z&&(aa=function(){try{return document.activeElement}catch(a){return document.body}}); +var gb=m.rmClass=function(a,b){var c=a.className,d=Bb(b).exec(c);if(d){var e=c.slice(d.index+d[0].length);a.className=c.slice(0,d.index)+(e?d[1]+e:"")}},ib=m.addClass=function(a,b){var c=a.className;if(!Bb(b).test(c))a.className=a.className+((c?" ":"")+b)},vd=!1,Ef=function(){if(y&&z<9)return false;var a=q("div");return"draggable"in a||"dragDrop"in a}(),qd,nd,oa=m.splitLines=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);if(e==-1)e=a.length;var f= +a.slice(b,a.charAt(e-1)=="\r"?e-1:e),g=f.indexOf("\r");if(g!=-1){c.push(f.slice(0,g));b=b+(g+1)}else{c.push(f);b=e+1}}return c}:function(a){return a.split(/\r\n?|\n/)},gg=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return false}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return!b||b.parentElement()!=a?false:b.compareEndPoints("StartToEnd",b)!=0},ue=function(){var a=q("div");if("oncopy"in a)return true;a.setAttribute("oncopy","return;"); +return typeof a.oncopy=="function"}(),Uc=null,ra={3:"Enter",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",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right", +63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};m.keyNames=ra;(function(){for(var a=0;a<10;a++)ra[a+48]=ra[a+96]=""+a;for(a=65;a<=90;a++)ra[a]=String.fromCharCode(a);for(a=1;a<=12;a++)ra[a+111]=ra[a+63235]="F"+a})();var rb,$f=function(){function a(a){return a<=247?c.charAt(a):1424<=a&&a<=1524?"R":1536<=a&&a<=1773?d.charAt(a-1536):1774<=a&&a<=2220?"r":8192<=a&&a<=8203?"w":a==8204?"b":"L"}function b(a,b,c){this.level=a;this.from=b;this.to=c}var c="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN", +d="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,g=/[LRr]/,h=/[Lb1n]/,i=/[1n]/;return function(c){if(!e.test(c))return false;for(var d=c.length,n=[],l=0,m;l<d;++l)n.push(a(c.charCodeAt(l)));for(var l=0,o="L";l<d;++l){m=n[l];m=="m"?n[l]=o:o=m}l=0;for(o= +"L";l<d;++l){m=n[l];if(m=="1"&&o=="r")n[l]="n";else if(g.test(m)){o=m;m=="r"&&(n[l]="R")}}l=1;for(o=n[0];l<d-1;++l){m=n[l];if(m=="+"&&o=="1"&&n[l+1]=="1")n[l]="1";else if(m==","&&o==n[l+1]&&(o=="1"||o=="n"))n[l]=o;o=m}for(l=0;l<d;++l){m=n[l];if(m==",")n[l]="N";else if(m=="%"){for(o=l+1;o<d&&n[o]=="%";++o);var p=l&&n[l-1]=="!"||o<d&&n[o]=="1"?"1":"N";for(m=l;m<o;++m)n[m]=p;l=o-1}}l=0;for(o="L";l<d;++l){m=n[l];o=="L"&&m=="1"?n[l]="L":g.test(m)&&(o=m)}for(l=0;l<d;++l)if(f.test(n[l])){for(o=l+1;o<d&& +f.test(n[o]);++o);m=(o<d?n[o]:"L")=="L";p=(l?n[l-1]:"L")=="L"||m?"L":"R";for(m=l;m<o;++m)n[m]=p;l=o-1}for(var o=[],q,l=0;l<d;)if(h.test(n[l])){m=l;for(++l;l<d&&h.test(n[l]);++l);o.push(new b(0,m,l))}else{var r=l,p=o.length;for(++l;l<d&&n[l]!="L";++l);for(m=r;m<l;)if(i.test(n[m])){r<m&&o.splice(p,0,new b(1,r,m));r=m;for(++m;m<l&&i.test(n[m]);++m);o.splice(p,0,new b(2,r,m));r=m}else++m;r<l&&o.splice(p,0,new b(1,r,l))}if(o[0].level==1&&(q=c.match(/^\s+/))){o[0].from=q[0].length;o.unshift(new b(0,0,q[0].length))}if(x(o).level== +1&&(q=c.match(/\s+$/))){x(o).to-=q[0].length;o.push(new b(0,d-q[0].length,d))}o[0].level==2&&o.unshift(new b(1,o[0].to,o[0].to));o[0].level!=x(o).level&&o.push(new b(o[0].level,d,d));return o}}();m.version="5.2.0";return m});
\ No newline at end of file diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/javascript.js b/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/javascript.js new file mode 100644 index 000000000..97627fe78 --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/javascript.js @@ -0,0 +1,24 @@ +(function(m){"object"==typeof exports&&"object"==typeof module?m(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],m):m(CodeMirror)})(function(m){m.defineMode("javascript",function(oa,p){var H,l,i,t,C;function n(a,d,e){D=a;I=e;return d}function u(a,d){var e=a.next();if('"'==e||"'"==e)return d.tokenize=pa(e),d.tokenize(a,d);if("."==e&&a.match(/^\d+(?:[eE][+\-]?\d+)?/))return n("number","number");if("."==e&&a.match(".."))return n("spread","meta"); +if(/[\[\]{}\(\),;\:\.]/.test(e))return n(e);if("="==e&&a.eat(">"))return n("=>","operator");if("0"==e&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),n("number","number");if(/\d/.test(e))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),n("number","number");if("/"==e){if(a.eat("*"))return d.tokenize=J,J(a,d);if(a.eat("/"))return a.skipToEnd(),n("comment","comment");if("operator"==d.lastType||"keyword c"==d.lastType||"sof"==d.lastType||/^[\[{}\(,;:]$/.test(d.lastType)){a:for(var e=!1,c,b=!1;null!=(c=a.next());){if(!e){if("/"== +c&&!b)break a;"["==c?b=!0:b&&"]"==c&&(b=!1)}e=!e&&"\\"==c}a.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);return n("regexp","string-2")}a.eatWhile(K);return n("operator","operator",a.current())}if("`"==e)return d.tokenize=Q,Q(a,d);if("#"==e)return a.skipToEnd(),n("error","error");if(K.test(e))return a.eatWhile(K),n("operator","operator",a.current());if(R.test(e))return a.eatWhile(R),e=a.current(),(c=ba.propertyIsEnumerable(e)&&ba[e])&&"."!=d.lastType?n(c.type,c.style,e):n("variable","variable",e)}function pa(a){return function(d, +e){var c=!1,b;if(L&&"@"==d.peek()&&d.match(qa))return e.tokenize=u,n("jsonld-keyword","meta");for(;null!=(b=d.next())&&(b!=a||c);)c=!c&&"\\"==b;c||(e.tokenize=u);return n("string","string")}}function J(a,d){for(var b=!1,c;c=a.next();){if("/"==c&&b){d.tokenize=u;break}b="*"==c}return n("comment","comment")}function Q(a,d){for(var b=!1,c;null!=(c=a.next());){if(!b&&("`"==c||"$"==c&&a.eat("{"))){d.tokenize=u;break}b=!b&&"\\"==c}return n("quasi","string-2",a.current())}function S(a,d){d.fatArrowAt&&(d.fatArrowAt= +null);var b=a.string.indexOf("=>",a.start);if(!(0>b)){for(var c=0,r=!1,b=b-1;0<=b;--b){var T=a.string.charAt(b),f=ra.indexOf(T);if(0<=f&&3>f){if(!c){++b;break}if(0==--c)break}else if(3<=f&&6>f)++c;else if(R.test(T))r=!0;else{if(/["'\/]/.test(T))return;if(r&&!c){++b;break}}}r&&!c&&(d.fatArrowAt=b)}}function ca(a,d,b,c,r,f){this.indented=a;this.column=d;this.type=b;this.prev=r;this.info=f;null!=c&&(this.align=c)}function f(){for(var a=arguments.length-1;0<=a;a--)H.push(arguments[a])}function b(){f.apply(null, +arguments);return!0}function v(a){function d(b){for(;b;b=b.next)if(b.name==a)return!0;return!1}var b=l;b.context?(i="def",d(b.localVars)||(b.localVars={name:a,next:b.localVars})):!d(b.globalVars)&&p.globalVars&&(b.globalVars={name:a,next:b.globalVars})}function w(){l.context={prev:l.context,vars:l.localVars};l.localVars=sa}function x(){l.localVars=l.context.vars;l.context=l.context.prev}function g(a,b){var e=function(){var c=l,e=c.indented;if("stat"==c.lexical.type)e=c.lexical.indented;else for(var f= +c.lexical;f&&")"==f.type&&f.align;f=f.prev)e=f.indented;c.lexical=new ca(e,t.column(),a,null,c.lexical,b)};e.lex=!0;return e}function h(){var a=l;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function j(a){function d(e){return e==a?b():";"==a?f():b(d)}return d}function o(a,d){return"var"==a?b(g("vardef",d.length),U,j(";"),h):"keyword a"==a?b(g("form"),k,o,h):"keyword b"==a?b(g("form"),o,h):"{"==a?b(g("}"),V,h):";"==a?b():"if"==a?("else"==l.lexical.info&& +l.cc[l.cc.length-1]==h&&l.cc.pop()(),b(g("form"),k,o,h,da)):"function"==a?b(s):"for"==a?b(g("form"),ea,o,h):"variable"==a?b(g("stat"),ta):"switch"==a?b(g("form"),k,g("}","switch"),j("{"),V,h,h):"case"==a?b(k,j(":")):"default"==a?b(j(":")):"catch"==a?b(g("form"),w,j("("),W,j(")"),o,h,x):"module"==a?b(g("form"),w,ua,x,h):"class"==a?b(g("form"),va,h):"export"==a?b(g("form"),wa,h):"import"==a?b(g("form"),xa,h):f(g("stat"),k,j(";"),h)}function k(a){return fa(a,!1)}function q(a){return fa(a,!0)}function fa(a, +d){if(l.fatArrowAt==t.start){var e=d?ga:ha;if("("==a)return b(w,g(")"),E(y,")"),h,j("=>"),e,x);if("variable"==a)return f(w,y,j("=>"),e,x)}e=d?X:M;return ya.hasOwnProperty(a)?b(e):"function"==a?b(s,e):"keyword c"==a?b(d?ia:Y):"("==a?b(g(")"),Y,N,j(")"),h,e):"operator"==a||"spread"==a?b(d?q:k):"["==a?b(g("]"),za,h,e):"{"==a?F(Aa,"}",null,e):"quasi"==a?f(O,e):b()}function Y(a){return a.match(/[;\}\)\],]/)?f():f(k)}function ia(a){return a.match(/[;\}\)\],]/)?f():f(q)}function M(a,d){return","==a?b(k): +X(a,d,!1)}function X(a,d,e){var c=!1==e?M:X,r=!1==e?k:q;if("=>"==a)return b(w,e?ga:ha,x);if("operator"==a)return/\+\+|--/.test(d)?b(c):"?"==d?b(k,j(":"),r):b(r);if("quasi"==a)return f(O,c);if(";"!=a){if("("==a)return F(q,")","call",c);if("."==a)return b(Ba,c);if("["==a)return b(g("]"),Y,j("]"),h,c)}}function O(a,d){return"quasi"!=a?f():"${"!=d.slice(d.length-2)?b(O):b(k,Ca)}function Ca(a){if("}"==a)return i="string-2",l.tokenize=Q,b(O)}function ha(a){S(t,l);return f("{"==a?o:k)}function ga(a){S(t, +l);return f("{"==a?o:q)}function ta(a){return":"==a?b(h,o):f(M,j(";"),h)}function Ba(a){if("variable"==a)return i="property",b()}function Aa(a,d){if("variable"==a||"keyword"==C)return i="property","get"==d||"set"==d?b(Da):b(G);if("number"==a||"string"==a)return i=L?"property":C+" property",b(G);if("jsonld-keyword"==a)return b(G);if("["==a)return b(k,j("]"),G)}function Da(a){if("variable"!=a)return f(G);i="property";return b(s)}function G(a){if(":"==a)return b(q);if("("==a)return f(s)}function E(a, +d){function e(c){return","==c?(c=l.lexical,"call"==c.info&&(c.pos=(c.pos||0)+1),b(a,e)):c==d?b():b(j(d))}return function(c){return c==d?b():f(a,e)}}function F(a,d,e){for(var c=3;c<arguments.length;c++)H.push(arguments[c]);return b(g(d,e),E(a,d),h)}function V(a){return"}"==a?b():f(o,V)}function ja(a){if(ka&&":"==a)return b(Ea)}function Ea(a){if("variable"==a)return i="variable-3",b()}function U(){return f(y,ja,Z,Fa)}function y(a,d){if("variable"==a)return v(d),b();if("["==a)return F(y,"]");if("{"== +a)return F(Ga,"}")}function Ga(a,d){if("variable"==a&&!t.match(/^\s*:/,!1))return v(d),b(Z);"variable"==a&&(i="property");return b(j(":"),y,Z)}function Z(a,d){if("="==d)return b(q)}function Fa(a){if(","==a)return b(U)}function da(a,d){if("keyword b"==a&&"else"==d)return b(g("form","else"),o,h)}function ea(a){if("("==a)return b(g(")"),Ha,j(")"),h)}function Ha(a){return"var"==a?b(U,j(";"),P):";"==a?b(P):"variable"==a?b(Ia):f(k,j(";"),P)}function Ia(a,d){return"in"==d||"of"==d?(i="keyword",b(k)):b(M, +P)}function P(a,d){return";"==a?b(la):"in"==d||"of"==d?(i="keyword",b(k)):f(k,j(";"),la)}function la(a){")"!=a&&b(k)}function s(a,d){if("*"==d)return i="keyword",b(s);if("variable"==a)return v(d),b(s);if("("==a)return b(w,g(")"),E(W,")"),h,o,x)}function W(a){return"spread"==a?b(W):f(y,ja)}function va(a,d){if("variable"==a)return v(d),b(ma)}function ma(a,d){if("extends"==d)return b(k,ma);if("{"==a)return b(g("}"),z,h)}function z(a,d){if("variable"==a||"keyword"==C){if("static"==d)return i="keyword", +b(z);i="property";return"get"==d||"set"==d?b(Ja,s,z):b(s,z)}if("*"==d)return i="keyword",b(z);if(";"==a)return b(z);if("}"==a)return b()}function Ja(a){if("variable"!=a)return f();i="property";return b()}function ua(a,d){if("string"==a)return b(o);if("variable"==a)return v(d),b($)}function wa(a,d){return"*"==d?(i="keyword",b($,j(";"))):"default"==d?(i="keyword",b(k,j(";"))):f(o)}function xa(a){return"string"==a?b():f(aa,$)}function aa(a,d){if("{"==a)return F(aa,"}");"variable"==a&&v(d);"*"==d&&(i= +"keyword");return b(Ka)}function Ka(a,d){if("as"==d)return i="keyword",b(aa)}function $(a,d){if("from"==d)return i="keyword",b(k)}function za(a){return"]"==a?b():f(q,La)}function La(a){return"for"==a?f(N,j("]")):","==a?b(E(ia,"]")):f(E(q,"]"))}function N(a){if("for"==a)return b(ea,N);if("if"==a)return b(k,N)}var A=oa.indentUnit,na=p.statementIndent,L=p.jsonld,B=p.json||L,ka=p.typescript,R=p.wordCharacters||/[\w$\xa1-\uffff]/,ba=function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"), +e=a("keyword b"),c=a("keyword c"),f=a("operator"),h={type:"atom",style:"atom"},b={"if":a("if"),"while":b,"with":b,"else":e,"do":e,"try":e,"finally":e,"return":c,"break":c,"continue":c,"new":c,"delete":c,"throw":c,"debugger":c,"var":a("var"),"const":a("var"),let:a("var"),"function":a("function"),"catch":a("catch"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),"in":f,"typeof":f,"instanceof":f,"true":h,"false":h,"null":h,undefined:h,NaN:h,Infinity:h,"this":a("this"),module:a("module"), +"class":a("class"),"super":a("atom"),yield:c,"export":a("export"),"import":a("import"),"extends":c};if(ka){var e={type:"variable",style:"variable-3"},e={"interface":a("interface"),"extends":a("extends"),constructor:a("constructor"),"public":a("public"),"private":a("private"),"protected":a("protected"),"static":a("static"),string:e,number:e,bool:e,any:e},i;for(i in e)b[i]=e[i]}return b}(),K=/[+\-*&%=<>!?|~^]/,qa=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/, +D,I,ra="([{}])",ya={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0};H=i=l=null;C=t=void 0;var sa={name:"this",next:{name:"arguments"}};h.lex=!0;return{startState:function(a){a={tokenize:u,lastType:"sof",cc:[],lexical:new ca((a||0)-A,0,"block",!1),localVars:p.localVars,context:p.localVars&&{vars:p.localVars},indented:0};p.globalVars&&"object"==typeof p.globalVars&&(a.globalVars=p.globalVars);return a},token:function(a,b){a.sol()&&(b.lexical.hasOwnProperty("align")|| +(b.lexical.align=!1),b.indented=a.indentation(),S(a,b));if(b.tokenize!=J&&a.eatSpace())return null;var e=b.tokenize(a,b);if("comment"==D)return e;b.lastType="operator"==D&&("++"==I||"--"==I)?"incdec":D;var c;a:{var f=D,h=I,g=b.cc;l=b;t=a;i=null;H=g;C=e;b.lexical.hasOwnProperty("align")||(b.lexical.align=!0);for(;;)if((g.length?g.pop():B?k:o)(f,h)){for(;g.length&&g[g.length-1].lex;)g.pop()();if(i){c=i;break a}if(c="variable"==f)b:{for(c=b.localVars;c;c=c.next)if(c.name==h){c=!0;break b}for(f=b.context;f;f= +f.prev)for(c=f.vars;c;c=c.next)if(c.name==h){c=!0;break b}c=void 0}if(c){c="variable-2";break a}c=e;break a}}return c},indent:function(a,b){if(a.tokenize==J)return m.Pass;if(a.tokenize!=u)return 0;var e=b&&b.charAt(0),c=a.lexical;if(!/^\s*else\b/.test(b))for(var f=a.cc.length-1;0<=f;--f){var g=a.cc[f];if(g==h)c=c.prev;else if(g!=da)break}"stat"==c.type&&"}"==e&&(c=c.prev);na&&(")"==c.type&&"stat"==c.prev.type)&&(c=c.prev);f=c.type;g=e==f;return"vardef"==f?c.indented+("operator"==a.lastType||","== +a.lastType?c.info+1:0):"form"==f&&"{"==e?c.indented:"form"==f?c.indented+A:"stat"==f?c.indented+("operator"==a.lastType||","==a.lastType||K.test(b.charAt(0))||/[,.]/.test(b.charAt(0))?na||A:0):"switch"==c.info&&!g&&!1!=p.doubleIndentSwitch?c.indented+(/^(?:case|default)\b/.test(b)?A:2*A):c.align?c.column+(g?0:1):c.indented+(g?0:A)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:B?null:"/*",blockCommentEnd:B?null:"*/",lineComment:B?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``", +helperType:B?"json":"javascript",jsonldMode:L,jsonMode:B}});m.registerHelper("wordChars","javascript",/[\w$]/);m.defineMIME("text/javascript","javascript");m.defineMIME("text/ecmascript","javascript");m.defineMIME("application/javascript","javascript");m.defineMIME("application/x-javascript","javascript");m.defineMIME("application/ecmascript","javascript");m.defineMIME("application/json",{name:"javascript",json:!0});m.defineMIME("application/x-json",{name:"javascript",json:!0});m.defineMIME("application/ld+json", +{name:"javascript",jsonld:!0});m.defineMIME("text/typescript",{name:"javascript",typescript:!0});m.defineMIME("application/typescript",{name:"javascript",typescript:!0})});
\ No newline at end of file diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/neo.css b/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/neo.css new file mode 100644 index 000000000..f932db075 --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/neo.css @@ -0,0 +1,36 @@ +/* neo theme for codemirror */
+
+/* Color scheme */
+
+.cm-s-neo.CodeMirror {
+ background-color:#ffffff;
+ color:#2e383c;
+ line-height:1.4375;
+}
+.cm-s-neo .cm-comment {color:#75787b}
+.cm-s-neo .cm-keyword, .cm-s-neo .cm-property {color:#1d75b3}
+.cm-s-neo .cm-atom,.cm-s-neo .cm-number {color:#75438a}
+.cm-s-neo .cm-node,.cm-s-neo .cm-tag {color:#9c3328}
+.cm-s-neo .cm-string {color:#b35e14}
+.cm-s-neo .cm-variable,.cm-s-neo .cm-qualifier {color:#047d65}
+
+
+/* Editor styling */
+
+.cm-s-neo pre {
+ padding:0;
+}
+
+.cm-s-neo .CodeMirror-gutters {
+ border:none;
+ border-right:10px solid transparent;
+ background-color:transparent;
+}
+
+.cm-s-neo .CodeMirror-linenumber {
+ padding:0;
+ color:#e0e2e5;
+}
+
+.cm-s-neo .CodeMirror-guttermarker { color: #1d75b3; }
+.cm-s-neo .CodeMirror-guttermarker-subtle { color: #e0e2e5; }
diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.css b/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.css new file mode 100644 index 000000000..e38bfb6ba --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.css @@ -0,0 +1,38 @@ +.CodeMirror-hints {
+ position: absolute;
+ z-index: 10;
+ overflow: hidden;
+ list-style: none;
+
+ margin: 0;
+ padding: 2px;
+
+ -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
+ -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
+ box-shadow: 2px 3px 5px rgba(0,0,0,.2);
+ border-radius: 3px;
+ border: 1px solid silver;
+
+ background: white;
+ font-size: 90%;
+ font-family: monospace;
+
+ max-height: 20em;
+ overflow-y: auto;
+}
+
+.CodeMirror-hint {
+ margin: 0;
+ padding: 0 4px;
+ border-radius: 2px;
+ max-width: 19em;
+ overflow: hidden;
+ white-space: pre;
+ color: black;
+ cursor: pointer;
+}
+
+li.CodeMirror-hint-active {
+ background: #08f;
+ color: white;
+}
diff --git a/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.js b/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.js new file mode 100644 index 000000000..ec4a56811 --- /dev/null +++ b/httemplate/elements/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.js @@ -0,0 +1,16 @@ +(function(f){"object"==typeof exports&&"object"==typeof module?f(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],f):f(CodeMirror)})(function(f){function m(a,b){this.cm=a;this.options=this.buildOptions(b);this.widget=null;this.tick=this.debounce=0;this.startPos=this.cm.getCursor();this.startLen=this.cm.getLine(this.startPos.line).length;var c=this;a.on("cursorActivity",this.activityFunc=function(){c.cursorActivity()})}function t(a,b){function c(a, +c){var d;d="string"!=typeof c?function(a){return c(a,b)}:e.hasOwnProperty(c)?e[c]:c;f[a]=d}var e={Up:function(){b.moveFocus(-1)},Down:function(){b.moveFocus(1)},PageUp:function(){b.moveFocus(-b.menuSize()+1,!0)},PageDown:function(){b.moveFocus(b.menuSize()-1,!0)},Home:function(){b.setFocus(0)},End:function(){b.setFocus(b.length-1)},Enter:b.pick,Tab:b.pick,Esc:b.close},d=a.options.customKeys,f=d?{}:e;if(d)for(var g in d)d.hasOwnProperty(g)&&c(g,d[g]);if(d=a.options.extraKeys)for(g in d)d.hasOwnProperty(g)&& +c(g,d[g]);return f}function s(a,b){for(;b&&b!=a;){if("LI"===b.nodeName.toUpperCase()&&b.parentNode==a)return b;b=b.parentNode}}function l(a,b){this.completion=a;this.data=b;this.picked=!1;var c=this,e=a.cm,d=this.hints=document.createElement("ul");d.className="CodeMirror-hints";this.selectedHint=b.selectedHint||0;for(var k=b.list,g=0;g<k.length;++g){var j=d.appendChild(document.createElement("li")),h=k[g],i=u+(g!=this.selectedHint?"":" "+q);null!=h.className&&(i=h.className+" "+i);j.className=i;h.render? +h.render(j,b,h):j.appendChild(document.createTextNode(h.displayText||("string"==typeof h?h:h.text)));j.hintId=g}var g=e.cursorCoords(a.options.alignWithWord?b.from:null),o=g.left,p=g.bottom,l=!0;d.style.left=o+"px";d.style.top=p+"px";j=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth);i=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(a.options.container||document.body).appendChild(d);h=d.getBoundingClientRect(); +if(0<h.bottom-i){var r=h.bottom-h.top;0<g.top-(g.bottom-h.top)-r?(d.style.top=(p=g.top-r)+"px",l=!1):r>i&&(d.style.height=i-5+"px",d.style.top=(p=g.bottom-h.top)+"px",i=e.getCursor(),b.from.ch!=i.ch&&(g=e.cursorCoords(i),d.style.left=(o=g.left)+"px",h=d.getBoundingClientRect()))}i=h.right-j;0<i&&(h.right-h.left>j&&(d.style.width=j-5+"px",i-=h.right-h.left-j),d.style.left=(o=g.left-i)+"px");e.addKeyMap(this.keyMap=t(a,{moveFocus:function(a,b){c.changeActive(c.selectedHint+a,b)},setFocus:function(a){c.changeActive(a)}, +menuSize:function(){return c.screenAmount()},length:k.length,close:function(){a.close()},pick:function(){c.pick()},data:b}));if(a.options.closeOnUnfocus){var m;e.on("blur",this.onBlur=function(){m=setTimeout(function(){a.close()},100)});e.on("focus",this.onFocus=function(){clearTimeout(m)})}var n=e.getScrollInfo();e.on("scroll",this.onScroll=function(){var c=e.getScrollInfo(),b=e.getWrapperElement().getBoundingClientRect(),f=p+n.top-c.top,g=f-(window.pageYOffset||(document.documentElement||document.body).scrollTop); +l||(g=g+d.offsetHeight);if(g<=b.top||g>=b.bottom)return a.close();d.style.top=f+"px";d.style.left=o+n.left-c.left+"px"});f.on(d,"dblclick",function(a){if((a=s(d,a.target||a.srcElement))&&a.hintId!=null){c.changeActive(a.hintId);c.pick()}});f.on(d,"click",function(b){if((b=s(d,b.target||b.srcElement))&&b.hintId!=null){c.changeActive(b.hintId);a.options.completeOnSingleClick&&c.pick()}});f.on(d,"mousedown",function(){setTimeout(function(){e.focus()},20)});f.signal(b,"select",k[0],d.firstChild);return!0} +var u="CodeMirror-hint",q="CodeMirror-hint-active";f.showHint=function(a,b,c){if(!b)return a.showHint(c);c&&c.async&&(b.async=!0);b={hint:b};if(c)for(var e in c)b[e]=c[e];return a.showHint(b)};f.defineExtension("showHint",function(a){1<this.listSelections().length||this.somethingSelected()||(this.state.completionActive&&this.state.completionActive.close(),a=this.state.completionActive=new m(this,a),a.options.hint&&(f.signal(this,"startCompletion",this),a.update()))});var v=window.requestAnimationFrame|| +function(a){return setTimeout(a,1E3/60)},w=window.cancelAnimationFrame||clearTimeout;m.prototype={close:function(){this.active()&&(this.tick=this.cm.state.completionActive=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.widget.close(),f.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(a,b){var c=a.list[b];c.hint?c.hint(this.cm,a,c):this.cm.replaceRange("string"==typeof c?c:c.text,c.from||a.from,c.to||a.to, +"complete");f.signal(a,"pick",c);this.close()},showHints:function(a){if(!a||!a.list.length||!this.active())return this.close();this.options.completeSingle&&1==a.list.length?this.pick(a,0):this.showWidget(a)},cursorActivity:function(){this.debounce&&(w(this.debounce),this.debounce=0);var a=this.cm.getCursor(),b=this.cm.getLine(a.line);if(a.line!=this.startPos.line||b.length-a.ch!=this.startLen-this.startPos.ch||a.ch<this.startPos.ch||this.cm.somethingSelected()||a.ch&&this.options.closeCharacters.test(b.charAt(a.ch- +1)))this.close();else{var c=this;this.debounce=v(function(){c.update()});this.widget&&this.widget.disable()}},update:function(){if(null!=this.tick)if(this.data&&f.signal(this.data,"update"),this.options.hint.async){var a=++this.tick,b=this;this.options.hint(this.cm,function(c){b.tick==a&&b.finishUpdate(c)},this.options)}else this.finishUpdate(this.options.hint(this.cm,this.options),a)},finishUpdate:function(a){this.data=a;var b=this.widget&&this.widget.picked;this.widget&&this.widget.close();a&&a.list.length&& +(b&&1==a.list.length?this.pick(a,0):this.widget=new l(this,a))},showWidget:function(a){this.data=a;this.widget=new l(this,a);f.signal(a,"shown")},buildOptions:function(a){var b=this.cm.options.hintOptions,c={},e;for(e in n)c[e]=n[e];if(b)for(e in b)void 0!==b[e]&&(c[e]=b[e]);if(a)for(e in a)void 0!==a[e]&&(c[e]=a[e]);return c}};l.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null;this.hints.parentNode.removeChild(this.hints);this.completion.cm.removeKeyMap(this.keyMap); +var a=this.completion.cm;this.completion.options.closeOnUnfocus&&(a.off("blur",this.onBlur),a.off("focus",this.onFocus));a.off("scroll",this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var a=this;this.keyMap={Enter:function(){a.picked=!0}};this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(a,b){a>=this.data.list.length?a=b?this.data.list.length-1:0:0>a&&(a=b?0:this.data.list.length-1); +if(this.selectedHint!=a){var c=this.hints.childNodes[this.selectedHint];c.className=c.className.replace(" "+q,"");c=this.hints.childNodes[this.selectedHint=a];c.className+=" "+q;c.offsetTop<this.hints.scrollTop?this.hints.scrollTop=c.offsetTop-3:c.offsetTop+c.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=c.offsetTop+c.offsetHeight-this.hints.clientHeight+3);f.signal(this.data,"select",this.data.list[this.selectedHint],c)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/ +this.hints.firstChild.offsetHeight)||1}};f.registerHelper("hint","auto",function(a,b){var c=a.getHelpers(a.getCursor(),"hint");if(c.length)for(var e=0;e<c.length;e++){var d=c[e](a,b);if(d&&d.list.length)return d}else if(c=a.getHelper(a.getCursor(),"hintWords")){if(c)return f.hint.fromList(a,{words:c})}else if(f.hint.anyword)return f.hint.anyword(a,b)});f.registerHelper("hint","fromList",function(a,b){for(var c=a.getCursor(),e=a.getTokenAt(c),d=[],k=0;k<b.words.length;k++){var g=b.words[k];g.slice(0, +e.string.length)==e.string&&d.push(g)}if(d.length)return{list:d,from:f.Pos(c.line,e.start),to:f.Pos(c.line,e.end)}});f.commands.autocomplete=f.showHint;var n={hint:f.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:!0,completeOnSingleClick:!1,container:null,customKeys:null,extraKeys:null};f.defineOption("hintOptions",null)});
\ No newline at end of file |
