Contact Form 7 Style - Version 3.1.3

Version Description

Release Date: November 3rd, 2017

  • [New Feature] Placeholder elements styling and hover too + preview generate
  • [New Feature] Opacity settings for placeholders
  • [Improvement] Updated fonticons
  • [Improvement] Contact Form 7 "Go To CF7" button to edit form structure
  • [Improvement] Notifications handling modified
  • [Improvement] Removed transparent checkbox from font color
  • [Improvement] Updated plugin file structure for better code management
  • [Improvement] JSON files for plugin settings
  • [Major Fix] Works with PHP 7
  • [Major Fix] Compatible with WordPress Multisite
  • [Major Fix] Refactored style generator
  • General bugfixing
Download this release

Release Info

Developer mlehelsz
Plugin Icon 128x128 Contact Form 7 Style
Version 3.1.3
Comparing to
See all releases

Code changes from version 3.1.2 to 3.1.3

Files changed (50) hide show
  1. admin/css/admin.css +1 -1
  2. admin/css/fontello-ie7.css +30 -0
  3. admin/css/fontello.css +75 -0
  4. admin/font/LICENSE.txt +12 -0
  5. admin/font/config.json +118 -0
  6. admin/font/fontello.eot +0 -0
  7. admin/font/fontello.svg +46 -0
  8. admin/font/fontello.ttf +0 -0
  9. admin/font/fontello.woff +0 -0
  10. admin/font/fontello.woff2 +0 -0
  11. admin/js/admin-min.js +1 -52
  12. admin/js/admin.js +60 -26
  13. admin/js/codemirror.js +4 -4
  14. admin/js/overall.js +88 -88
  15. admin/predefined-templates.json +1 -0
  16. admin/settings-setup.json +1 -0
  17. cf7-style-match-old.php +5 -0
  18. cf7-style-meta-box.php +54 -3
  19. cf7-style.php +82 -768
  20. inc/add_required_admin_scripts.php +34 -0
  21. inc/add_required_frontend_scripts.php +19 -0
  22. inc/admin_notices_activation.php +116 -0
  23. inc/adminbar_add_link.php +21 -0
  24. inc/cf7_add_form_class.php +44 -0
  25. inc/check_cfstyle_version.php +22 -0
  26. inc/check_deleted_templates.php +32 -0
  27. inc/cssparser.php +0 -373
  28. inc/custom_css_generator.php +176 -0
  29. inc/dashboard_generate_preview.php +16 -0
  30. inc/dashboard_hide_delete_tpl_box.php +12 -0
  31. inc/dashboard_hide_welcome_box.php +12 -0
  32. inc/dashboard_load_custom_property.php +44 -0
  33. inc/dashboard_table_add_preview.php +27 -0
  34. inc/deactivate_style.php +14 -0
  35. inc/editor_page.php +8 -11
  36. inc/frontend_edit_style_link.php +26 -0
  37. inc/get_form_id.php +24 -0
  38. inc/index.php +1 -0
  39. inc/init_style.php +202 -0
  40. inc/remove_predefined_templates.php +50 -0
  41. inc/slider_meta_box.php +5 -0
  42. inc/system_status.php +4 -0
  43. inc/taxonomy_filters_add.php +32 -0
  44. misc/index.php +1 -1
  45. misc/tracking.php +6 -0
  46. misc/welcome.php +5 -0
  47. options.php +4 -0
  48. plugin-options.php +34 -354
  49. predefined-templates.php +0 -63
  50. readme.txt +264 -242
admin/css/admin.css CHANGED
@@ -1 +1 @@
1
- .clearfix:after{visibility:hidden;display:block;font-size:0;content:" ";clear:both;height:0}.hidden,.panel .hidden{display:none}.menu-icon-cf7_style .dashicons-twitter{position:relative}.post-type-cf7_style .wp-list-table td{position:relative;overflow:visible}.post-type-cf7_style #preview-style{width:200px}#cf7_style_meta_box_image img{max-width:100%}.post-type-cf7_style .preview-style{text-align:center}.post-type-cf7_style .thumb-preview{width:50px;display:inline-block}.post-type-cf7_style .thumb-preview:hover .previewed-img{opacity:1;visibility:visible}.post-type-cf7_style .thumb-preview img{width:100%;border:1px solid #e1e1e1;padding:5px}.type-cf7_style .taxonomy-style_category{text-transform:capitalize}.post-type-cf7_style .previewed-img{opacity:0;visibility:hidden;position:absolute;z-index:100;top:-70px;left:0;width:202px;height:auto;border:1px solid #e1e1e1;padding:5px;background-color:#fff;-webkit-transition:all .3s ease-in-out;-moz-transition:all .3s ease-in-out;-ms-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.cf7-style-slider-wrap .overlay,.cf7slider li{-webkit-transition:.1s ease-in .1s;-moz-transition:.1s ease-in .1s;-o-transition:.1s ease-in .1s}.post-type-cf7_style .previewed-img img{padding:0;border:none}.post-type-cf7_style select[name=cf7_style_font_selector]{float:left;margin-right:10px;width:25%;margin-bottom:15px}.cf7-style.preview-zone{border:1px solid #e5e5e5;padding:8px 4px;width:70%;float:left}.cf7-style.preview-zone h4{margin:5px 0 10px}.cf7-style.preview-zone p{font-size:14px}.menu-icon-cf7_style .dashicons-twitter:after{color:#000;content:".";font-size:10px;left:20px;position:absolute;top:0}.wp-admin .widefat .different-style input{margin:0 10px 0 0;height:21px}.general-settings{float:left;width:32%;margin-right:2%;margin-bottom:10px}.general-settings.full-width{margin-right:0;width:99%;border:1px solid #ddd;padding:5px;-moz-border-size:border-box;-webkit-border-size:border-box;border-size:border-box}.general-settings:nth-of-type(2n+3){margin-right:0}.general-settings h3{text-transform:uppercase}.general-settings:after{clear:both}.general-settings label{line-height:26px}.general-settings label strong{display:block;margin-right:10px}.general-settings label input{margin-right:5px}.general-settings small{display:block;color:#999;margin-top:5px;line-height:12px}.general-settings .element{width:100%;border:1px solid #ddd;padding:10px;box-sizing:border-box;margin-bottom:10px}.general-settings .element table{width:100%}.general-settings .element td{width:50%}.CodeMirror{background:#f8f8ff}.cf7-style-slider,.cf7-style-slider-wrap img{position:relative;margin:0 auto;display:block}.close-cf7-panel{float:right}.cf7style-welcome-panel img{max-width:160px;height:auto}.cf7-style-slider{width:202px;height:300px}.cf7-style-slider-wrap{width:202px;overflow:hidden}.cf7-style-slider-wrap img{width:198px;z-index:1}.cf7-style-slider-wrap .overlay{width:100%;height:100%;position:absolute;display:block;background:rgba(192,192,192,.4);z-index:2;text-align:center;transition:.1s ease-in .1s}.cf7-style-slider-wrap .overlay em{color:#fff;line-height:200px;font-size:20px;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-ms-transform:rotate(-45deg);-o-transform:rotate(-45deg);filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);position:relative;display:block;font-weight:700}.cf7slider li{display:block;float:left;width:202px;cursor:pointer;transition:.1s ease-in .1s}.cf7slider li:hover>span em,input.cf7style_template{display:none}.cf7-style-slider .current-saved span,.cf7-style-slider span{width:100%;height:100%;position:relative;padding-top:2px;padding-bottom:2px}.cf7slider li:hover>span .overlay{background:0 0}.cf7slider li:hover>span .overlay em{color:#000}.cf7-style-slider .current-saved span .overlay{background:rgba(255,0,0,.1)}.cf7-style-slider .current-saved span{display:block;background:rgba(255,0,0,.5)}.cf7-style-slider span{background:silver;display:block}.cf7arrows a{position:absolute;display:block;width:90px;height:90px;background-repeat:no-repeat;top:50px;color:transparent;opacity:.7;-webkit-transition:.1s ease-in .1s;-moz-transition:.1s ease-in .1s;-o-transition:.1s ease-in .1s;transition:.1s ease-in .1s;outline:0;background-size:100% auto}.generate-preview,.panel-options{display:block;position:relative}.cf7arrows a:hover{opacity:1}.cf7arrows a.left{left:-145px;background-image:url(../images/left.png)}.cf7arrows a.right{right:-145px;background-image:url(../images/right.png)}.panel-options{width:60%;min-height:685px;float:right}.panel-options .decision,.panel-options .loading{position:absolute;background-color:transparent;width:100%;height:100%;top:0;left:0;display:flex;justify-content:center;align-items:center}.panel-options .decision{background-color:#f2f2f2;top:53px;height:182px}.panel-options .decision.hidden,.panel-options .loading.hidden{display:none}.wp-admin .panel-options .cancel-btn,.wp-admin .panel-options .save-btn{background-color:#e74c3c;height:40px;padding:0 25px;font-weight:400;margin-right:10px;font-size:16px;border:none;text-shadow:none;box-shadow:none}.wp-admin .panel-options .cancel-btn{background-color:#fff;color:#222;line-height:40px}.wp-admin .panel-options .save-btn{border:1px solid #e74c3c}.wp-admin .panel-options .save-btn:hover{color:#e74c3c;background-color:#fff}.panel-header{padding-right:12px;position:relative;width:40%;float:left;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:5}.generate-preview:after,.panel-header:after{display:block;content:"";clear:both}.panel li,.panel-header select,.preview-form-tag{display:inline-block;vertical-align:top}.preview-form-tag{width:100%;box-sizing:border-box;height:630px}#form-tag,.preview-form-tag{background:#f2f2f2;overflow-x:auto;padding:10px}.element-selector{background:#f2f2f2;margin-bottom:7px;margin-top:3px;padding-left:11px;padding-top:7px}#form-tag h4,.element-selector h4{margin-top:0;margin-bottom:12px}.element-selector label{display:block;margin-bottom:10px;width:50%;float:left}#form-tag a{margin-right:5px;border-radius:0;box-shadow:none;background-color:#fff;margin-bottom:5px}#form-tag a:hover{background-color:#E74C3C;color:#FFF;border:1px solid #E74C3C}#advanced-sortables .generate-preview-button,#form-tag a.button-primary,.wp-core-ui .fixed-save-style input.button{background-color:#E74C3C;-webkit-box-shadow:none;box-shadow:none;border:1px solid #E74C3C;border-radius:0;text-shadow:none}#advanced-sortables .generate-preview-button:hover,#advanced-sortables .generate-preview-button[disabled],#form-tag a.button-primary:hover,.wp-core-ui .fixed-save-style input.button:hover{background-color:#fff!important;color:#E74C3C!important;border:1px solid #E74C3C!important}.wp-core-ui .fixed-save-style input.button,.wp-core-ui .fixed-save-style input.button:hover{border-left:none;border-right:none;border-radius:0}#cf7_style_meta_box_font_selector,#cf7_style_meta_box_form_selector{display:inline-block;width:49.5%}.post-type-cf7_style #normal-sortables{display:none}.preview-form-container>h4{text-align:center;margin-top:0}.element-styling{float:left;padding:0 10px;width:100%;border-bottom:1px solid #CCC;box-sizing:border-box}.element-styling.half-size{width:50%}.element-styling label{display:inline-block;position:relative;margin-right:5px}.element-styling label select{width:123px}.element-styling label select[name*=unit]{width:46px;margin-left:3px}.element-styling input[type=number]{height:28px;position:relative;top:2px;width:60px}.wp-picker-container{position:relative;top:10px}.element-styling.background li,.element-styling.font li{width:50%}.element-styling label strong{margin-right:3px;font-weight:400;display:inline-block;min-width:153px}.choose-preview{background-color:#f2f2f2;padding:10px;margin-bottom:3px}.choose-preview h4{margin:0 0 10px}.element-styling.background label,.element-styling.font label{margin-right:0}.element-styling h3{font-size:13px;margin-bottom:10px}.element-styling h3 span{color:#E74C3C;opacity:1}.panel li{width:100%;margin-bottom:10px}.cf7style-status-form,.parser-message{margin-bottom:20px}.fixed-save-style{position:fixed;width:100%;left:0;bottom:0;z-index:9999;text-align:center;display:none}.wp-core-ui .fixed-save-style input.button{width:100%;height:40px;line-height:40px;font-size:18px}.remove_template_notice{float:right}.element-styling .icon{display:inline-block;height:26px;border:1px solid #CCC;padding:0 7px;background-color:#f2f2f2;position:relative;top:2px;font-size:13px;line-height:26px;margin-right:-2px}.cf7style-status-table,.generate-preview-option,.multiple-form-generated-preview,.wp-core-ui .button-primary.generate-preview-button{display:none}.element-styling .icon.smaller{height:23px;line-height:23px;top:1px;font-size:13px}.description-title{padding-left:10px}.parser-message{color:red}.cf7style-welcome-panel{background-color:#fff;border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04);width:100%;padding:10px}.cf7style-input{width:250px}.wp-core-ui .button-primary.cf7style-status-submit,.wp-core-ui .button.cf7style-status-info,.wp-core-ui input:focus,.wp-core-ui input[disabled]{display:inline-block}.wp-core-ui .button.cf7style-status-info{margin-right:10px}span.wpcf7-not-valid-tip{color:red;font-size:1em;display:block}.wpcf7-validation-errors{background:0 0;padding:15px;margin:2em .5em 1em;color:red;border:2px solid red}.wpcf7-response-output.wpcf7-mail-sent-ok{background:0 0;color:green;border:2px solid green;padding:15px;margin:2em .5em 1em}@media all and (max-width:1600px){.post-type-cf7_style #wpwrap .element-styling.half-size,.post-type-cf7_style #wpwrap .panel-header,.post-type-cf7_style #wpwrap .panel-options,.post-type-cf7_style #post-body.columns-2 #postbox-container-1,.post-type-cf7_style #post-body.columns-2 #postbox-container-2{width:100%;margin:0}.post-type-cf7_style #poststuff #post-body.columns-2{margin-right:0}.post-type-cf7_style #poststuff #post-body.columns-2 #side-sortables{width:100%}.post-type-cf7_style #postbox-container-1 .postbox{width:32%;display:inline-block;vertical-align:top}}@media screen and (max-width:1332px){.post-type-cf7_style .general-settings{width:47%}.post-type-cf7_style .general-settings.full-width{width:99%;margin-right:0}}@media screen and (max-width:1100px){.post-type-cf7_style .general-settings{width:99%;margin-right:0}.post-type-cf7_style #postbox-container-1 .postbox,.post-type-cf7_style #postbox-container-2 .postbox{width:100%}.post-type-cf7_style .element-wrapper{display:block;width:100%;text-align:center}.post-type-cf7_style .element-styling input[type=number]{height:36px;top:3px;width:50%}.post-type-cf7_style .element-styling .icon{height:34px;top:2px;width:20px;line-height:34px;text-align:center}.post-type-cf7_style .element-styling label select[name*=unit]{margin-left:-2px}.post-type-cf7_style .element-styling label{width:100%}}
1
+ .clearfix:after{visibility: hidden;display: block;font-size: 0;content: " ";clear: both;height: 0}.hidden,.panel .hidden{display: none}.menu-icon-cf7_style .dashicons-twitter{position: relative}.post-type-cf7_style .wp-list-table td{position: relative;overflow: visible}.post-type-cf7_style #preview-style{width: 200px}#cf7_style_meta_box_image img{max-width: 100%}.post-type-cf7_style .preview-style{text-align: center}.post-type-cf7_style .thumb-preview{width: 50px;display: inline-block}.post-type-cf7_style .thumb-preview:hover .previewed-img{opacity: 1;visibility: visible}.post-type-cf7_style .thumb-preview img{width: 100%;border: 1px solid #e1e1e1;padding: 5px}.type-cf7_style .taxonomy-style_category{text-transform: capitalize}.post-type-cf7_style .previewed-img{opacity: 0;visibility: hidden;position: absolute;z-index: 100;top: -70px;left: 0;width: 202px;height: auto;border: 1px solid #e1e1e1;padding: 5px;background-color: #fff;-webkit-transition: all .3s ease-in-out;-moz-transition: all .3s ease-in-out;-ms-transition: all .3s ease-in-out;-o-transition: all .3s ease-in-out;transition: all .3s ease-in-out}.cf7-style-slider-wrap .overlay,.cf7slider li{-webkit-transition: .1s ease-in .1s;-moz-transition: .1s ease-in .1s;-o-transition: .1s ease-in .1s}.post-type-cf7_style .previewed-img img{padding: 0;border: none}.post-type-cf7_style select[name=cf7_style_font_selector]{float: left;margin-right: 10px;width: 25%;margin-bottom: 15px}.cf7-style.preview-zone{border: 1px solid #e5e5e5;padding: 8px 4px;width: 70%;float: left}.cf7-style.preview-zone h4{margin: 5px 0 10px}.cf7-style.preview-zone p{font-size: 14px}.menu-icon-cf7_style .dashicons-twitter:after{color: #000;content: ".";font-size: 10px;left: 20px;position: absolute;top: 0}.wp-admin .widefat .different-style input{margin: 0 10px 0 0;height: 21px}.general-settings{float: left;width: 32%;margin-right: 2%;margin-bottom: 10px}.general-settings.full-width{margin-right: 0;width: 99%;border: 1px solid #ddd;padding: 5px;-moz-border-size: border-box;-webkit-border-size: border-box;border-size: border-box}.general-settings:nth-of-type(2n+3){margin-right: 0}.general-settings h3{text-transform: uppercase}.general-settings:after{clear: both}.general-settings label{line-height: 26px}.general-settings label strong{display: block;margin-right: 10px}.general-settings label input{margin-right: 5px}.general-settings small{display: block;color: #999;margin-top: 5px;line-height: 12px}.general-settings .element{width: 100%;border: 1px solid #ddd;padding: 10px;box-sizing: border-box;margin-bottom: 10px}.general-settings .element table{width: 100%}.general-settings .element td{width: 50%}.CodeMirror{background: #f8f8ff}.cf7-style-slider,.cf7-style-slider-wrap img{position: relative;margin: 0 auto;display: block}.close-cf7-panel{float: right}.cf7style-welcome-panel img{max-width: 160px;height: auto}.cf7-style-slider{width: 202px;height: 300px}.cf7-style-slider-wrap{width: 202px;overflow: hidden}.cf7-style-slider-wrap img{width: 198px;z-index: 1}.cf7-style-slider-wrap .overlay{width: 100%;height: 100%;position: absolute;display: block;background: rgba(192, 192, 192, .4);z-index: 2;text-align: center;transition: .1s ease-in .1s}.cf7-style-slider-wrap .overlay em{color: #fff;line-height: 200px;font-size: 20px;-webkit-transform: rotate(-45deg);-moz-transform: rotate(-45deg);-ms-transform: rotate(-45deg);-o-transform: rotate(-45deg);filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);position: relative;display: block;font-weight: 700}.cf7slider li{display: block;float: left;width: 202px;cursor: pointer;transition: .1s ease-in .1s}.cf7slider li:hover>span em,input.cf7style_template{display: none}.cf7-style-slider .current-saved span,.cf7-style-slider span{width: 100%;height: 100%;position: relative;padding-top: 2px;padding-bottom: 2px}.cf7slider li:hover>span .overlay{background: 0 0}.cf7slider li:hover>span .overlay em{color: #000}.cf7-style-slider .current-saved span .overlay{background: rgba(255, 0, 0, .1)}.cf7-style-slider .current-saved span{display: block;background: rgba(255, 0, 0, .5)}.cf7-style-slider span{background: silver;display: block}.cf7arrows a{position: absolute;display: block;width: 90px;height: 90px;background-repeat: no-repeat;top: 50px;color: transparent;opacity: .7;-webkit-transition: .1s ease-in .1s;-moz-transition: .1s ease-in .1s;-o-transition: .1s ease-in .1s;transition: .1s ease-in .1s;outline: 0;background-size: 100% auto}.generate-preview,.panel-options{display: block;position: relative}.cf7arrows a:hover{opacity: 1}.cf7arrows a.left{left: -145px;background-image: url(../images/left.png)}.cf7arrows a.right{right: -145px;background-image: url(../images/right.png)}.panel-options{width: 60%;min-height: 685px;float: right}.panel-options .decision,.panel-options .loading{position: absolute;background-color: transparent;width: 100%;height: 100%;top: 0;left: 0;display: flex;justify-content: center;align-items: center}.panel-options .decision{background-color: #f2f2f2;top: 53px;height: 182px}.panel-options .decision.hidden,.panel-options .loading.hidden{display: none}.wp-admin .panel-options .cancel-btn,.wp-admin .panel-options .save-btn{background-color: #e74c3c;height: 40px;padding: 0 25px;font-weight: 400;margin-right: 10px;font-size: 16px;border: none;text-shadow: none;box-shadow: none}.wp-admin .panel-options .cancel-btn{background-color: #fff;color: #222;line-height: 40px}.wp-admin .panel-options .save-btn{border: 1px solid #e74c3c}.wp-admin .panel-options .save-btn:hover{color: #e74c3c;background-color: #fff}.panel-header{padding-right: 12px;position: relative;width: 40%;float: left;-webkit-box-sizing: border-box;box-sizing: border-box;z-index: 5}.generate-preview:after,.panel-header:after{display: block;content: "";clear: both}.panel li,.panel-header select,.preview-form-tag{display: inline-block;vertical-align: top}.preview-form-tag{width: 100%;box-sizing: border-box;height: 630px}#form-tag,.preview-form-tag{background: #f2f2f2;overflow-x: auto;padding: 10px}.element-selector{background: #f2f2f2;margin-bottom: 7px;margin-top: 3px;padding-left: 11px;padding-top: 7px}#form-tag h4,.element-selector h4{margin-top: 0;margin-bottom: 12px}.element-selector label{display: block;margin-bottom: 10px;width: 50%;float: left}#form-tag a{margin-right: 5px;border-radius: 0;box-shadow: none;background-color: #fff;margin-bottom: 5px}#form-tag a:hover{background-color: #E74C3C;color: #FFF;border: 1px solid #E74C3C}#advanced-sortables .generate-preview-button,#advanced-sortables .gotoform-option a,#form-tag a.button-primary,.wp-core-ui .fixed-save-style input.button{background-color: #E74C3C;-webkit-box-shadow: none;box-shadow: none;border: 1px solid #E74C3C;border-radius: 0;text-shadow: none}#advanced-sortables .gotoform-option{text-align: right;}#advanced-sortables .generate-preview-button:hover,#advanced-sortables .generate-preview-button[disabled],#advanced-sortables .gotoform-option a:hover,#form-tag a.button-primary:hover,.wp-core-ui .fixed-save-style input.button:hover{background-color: #fff!important;color: #E74C3C!important;border: 1px solid #E74C3C!important}.wp-core-ui .fixed-save-style input.button,.wp-core-ui .fixed-save-style input.button:hover{border-left: none;border-right: none;border-radius: 0}#cf7_style_meta_box_font_selector,#cf7_style_meta_box_form_selector{display: inline-block;width: 49.5%}.post-type-cf7_style #normal-sortables{display: none}.preview-form-container>h4{text-align: center;margin-top: 0}.element-styling{float: left;padding: 0 10px;width: 100%;border-bottom: 1px solid #CCC;box-sizing: border-box}.element-styling.half-size{width: 50%}.element-styling label{display: inline-block;position: relative;margin-right: 5px}.element-styling label select{width: 123px}.element-styling label select[name*=unit]{width: 46px;margin-left: 3px}.element-styling input[type=number]{height: 28px;position: relative;top: 2px;width: 60px}.wp-picker-container{position: relative;top: 10px}.element-styling.background li,.element-styling.font li{width: 50%}.element-styling label strong{margin-right: 3px;font-weight: 400;display: inline-block;min-width: 153px}.choose-preview{background-color: #f2f2f2;padding: 10px;margin-bottom: 3px}.choose-preview h4{margin: 0 0 10px}.element-styling.background label,.element-styling.font label{margin-right: 0}.element-styling h3{font-size: 13px;margin-bottom: 10px}.element-styling h3 span{color: #E74C3C;opacity: 1}.panel li{width: 100%;margin-bottom: 10px}.cf7style-status-form,.parser-message{margin-bottom: 20px}.fixed-save-style{position: fixed;width: 100%;left: 0;bottom: 0;z-index: 9999;text-align: center;display: none}.wp-core-ui .fixed-save-style input.button{width: 100%;height: 40px;line-height: 40px;font-size: 18px}.remove_template_notice{float: right}.element-styling .icon{display: inline-block;height: 26px;border: 1px solid #CCC;padding: 0 7px;background-color: #f2f2f2;position: relative;top: 2px;font-size: 13px;line-height: 26px;margin-right: -2px}.cf7style-status-table,.generate-preview-option,.multiple-form-generated-preview,.wp-core-ui .button-primary.generate-preview-button{display: none}.element-styling .icon.smaller{height: 23px;line-height: 23px;top: 1px;font-size: 13px}.description-title{padding-left: 10px}.parser-message{color: red}.cf7style-welcome-panel{background-color: #fff;border: 1px solid #e5e5e5;-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .04);box-shadow: 0 1px 1px rgba(0, 0, 0, .04);width: 100%;padding: 10px}.cf7style-input{width: 250px}.wp-core-ui .button-primary.cf7style-status-submit,.wp-core-ui .button.cf7style-status-info,.wp-core-ui input:focus,.wp-core-ui input[disabled]{display: inline-block}.wp-core-ui .button.cf7style-status-info{margin-right: 10px}span.wpcf7-not-valid-tip{color: red;font-size: 1em;display: block}.wpcf7-validation-errors{background: 0 0;padding: 15px;margin: 2em .5em 1em;color: red;border: 2px solid red}.wpcf7-response-output.wpcf7-mail-sent-ok{background: 0 0;color: green;border: 2px solid green;padding: 15px;margin: 2em .5em 1em}@media all and (max-width:1600px){.post-type-cf7_style #wpwrap .element-styling.half-size,.post-type-cf7_style #wpwrap .panel-header,.post-type-cf7_style #wpwrap .panel-options,.post-type-cf7_style #post-body.columns-2 #postbox-container-1,.post-type-cf7_style #post-body.columns-2 #postbox-container-2{width: 100%;margin: 0}.post-type-cf7_style #poststuff #post-body.columns-2{margin-right: 0}.post-type-cf7_style #poststuff #post-body.columns-2 #side-sortables{width: 100%}.post-type-cf7_style #postbox-container-1 .postbox{width: 32%;display: inline-block;vertical-align: top}}@media screen and (max-width:1332px){.post-type-cf7_style .general-settings{width: 47%}.post-type-cf7_style .general-settings.full-width{width: 99%;margin-right: 0}}@media screen and (max-width:1100px){.post-type-cf7_style .general-settings{width: 99%;margin-right: 0}.post-type-cf7_style #postbox-container-1 .postbox,.post-type-cf7_style #postbox-container-2 .postbox{width: 100%}.post-type-cf7_style .element-wrapper{display: block;width: 100%;text-align: center}.post-type-cf7_style .element-styling input[type=number]{height: 36px;top: 3px;width: 50%}.post-type-cf7_style .element-styling .icon{height: 34px;top: 2px;width: 20px;line-height: 34px;text-align: center}.post-type-cf7_style .element-styling label select[name*=unit]{margin-left: -2px}.post-type-cf7_style .element-styling label{width: 100%}}
admin/css/fontello-ie7.css ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [class^="icon-"], [class*=" icon-"] {
2
+ font-family: 'fontello';
3
+ font-style: normal;
4
+ font-weight: normal;
5
+
6
+ /* fix buttons height */
7
+ line-height: 1em;
8
+
9
+ /* you can be more comfortable with increased icons size */
10
+ /* font-size: 120%; */
11
+ }
12
+
13
+ .icon-resize-horizontal { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
14
+ .icon-resize-vertical { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
15
+ .icon-text-height { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
16
+ .icon-bold { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
17
+ .icon-italic { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
18
+ .icon-align-center { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
19
+ .icon-font { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
20
+ .icon-indent-right { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
21
+ .icon-adjust { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
22
+ .icon-underline { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
23
+ .icon-level-up { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
24
+ .icon-level-down { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
25
+ .icon-down { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
26
+ .icon-up { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
27
+ .icon-left { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
28
+ .icon-right { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
29
+ .icon-header { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
30
+ .icon-eyedropper { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
admin/css/fontello.css ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @font-face {
2
+ font-family: 'fontello';
3
+ src: url('../font/fontello.eot?12424626');
4
+ src: url('../font/fontello.eot?12424626#iefix') format('embedded-opentype'),
5
+ url('../font/fontello.woff2?12424626') format('woff2'),
6
+ url('../font/fontello.woff?12424626') format('woff'),
7
+ url('../font/fontello.ttf?12424626') format('truetype'),
8
+ url('../font/fontello.svg?12424626#fontello') format('svg');
9
+ font-weight: normal;
10
+ font-style: normal;
11
+ }
12
+ /* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
13
+ /* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
14
+ /*
15
+ @media screen and (-webkit-min-device-pixel-ratio:0) {
16
+ @font-face {
17
+ font-family: 'fontello';
18
+ src: url('../font/fontello.svg?12424626#fontello') format('svg');
19
+ }
20
+ }
21
+ */
22
+
23
+ [class^="icon-"]:before, [class*=" icon-"]:before {
24
+ font-family: "fontello";
25
+ font-style: normal;
26
+ font-weight: normal;
27
+ speak: none;
28
+
29
+ display: inline-block;
30
+ text-decoration: inherit;
31
+ width: 1em;
32
+ margin-right: .2em;
33
+ text-align: center;
34
+ /* opacity: .8; */
35
+
36
+ /* For safety - reset parent styles, that can break glyph codes*/
37
+ font-variant: normal;
38
+ text-transform: none;
39
+
40
+ /* fix buttons height, for twitter bootstrap */
41
+ line-height: 1em;
42
+
43
+ /* Animation center compensation - margins should be symmetric */
44
+ /* remove if not needed */
45
+ margin-left: .2em;
46
+
47
+ /* you can be more comfortable with increased icons size */
48
+ /* font-size: 120%; */
49
+
50
+ /* Font smoothing. That was taken from TWBS */
51
+ -webkit-font-smoothing: antialiased;
52
+ -moz-osx-font-smoothing: grayscale;
53
+
54
+ /* Uncomment for 3D effect */
55
+ /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
56
+ }
57
+
58
+ .icon-resize-horizontal:before { content: '\e800'; } /* '' */
59
+ .icon-resize-vertical:before { content: '\e801'; } /* '' */
60
+ .icon-text-height:before { content: '\e802'; } /* '' */
61
+ .icon-bold:before { content: '\e803'; } /* '' */
62
+ .icon-italic:before { content: '\e804'; } /* '' */
63
+ .icon-align-center:before { content: '\e805'; } /* '' */
64
+ .icon-font:before { content: '\e806'; } /* '' */
65
+ .icon-indent-right:before { content: '\e807'; } /* '' */
66
+ .icon-adjust:before { content: '\e808'; } /* '' */
67
+ .icon-underline:before { content: '\f0cd'; } /* '' */
68
+ .icon-level-up:before { content: '\f148'; } /* '' */
69
+ .icon-level-down:before { content: '\f149'; } /* '' */
70
+ .icon-down:before { content: '\f175'; } /* '' */
71
+ .icon-up:before { content: '\f176'; } /* '' */
72
+ .icon-left:before { content: '\f177'; } /* '' */
73
+ .icon-right:before { content: '\f178'; } /* '' */
74
+ .icon-header:before { content: '\f1dc'; } /* '' */
75
+ .icon-eyedropper:before { content: '\f1fb'; } /* '' */
admin/font/LICENSE.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Font license info
2
+
3
+
4
+ ## Font Awesome
5
+
6
+ Copyright (C) 2016 by Dave Gandy
7
+
8
+ Author: Dave Gandy
9
+ License: SIL ()
10
+ Homepage: http://fortawesome.github.com/Font-Awesome/
11
+
12
+
admin/font/config.json ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "",
3
+ "css_prefix_text": "icon-",
4
+ "css_use_suffix": false,
5
+ "hinting": true,
6
+ "units_per_em": 1000,
7
+ "ascent": 850,
8
+ "glyphs": [
9
+ {
10
+ "uid": "3c73d058e4589b65a8d959c0fc8f153d",
11
+ "css": "resize-horizontal",
12
+ "code": 59392,
13
+ "src": "fontawesome"
14
+ },
15
+ {
16
+ "uid": "d3b3f17bc3eb7cd809a07bbd4d178bee",
17
+ "css": "resize-vertical",
18
+ "code": 59393,
19
+ "src": "fontawesome"
20
+ },
21
+ {
22
+ "uid": "88e6faa0f633ee23667f815689e82af3",
23
+ "css": "eyedropper",
24
+ "code": 61947,
25
+ "src": "fontawesome"
26
+ },
27
+ {
28
+ "uid": "720f98e7580b7987c8dc542513d1d440",
29
+ "css": "up",
30
+ "code": 61814,
31
+ "src": "fontawesome"
32
+ },
33
+ {
34
+ "uid": "f06941dfcb90dc24b987d810898c4310",
35
+ "css": "down",
36
+ "code": 61813,
37
+ "src": "fontawesome"
38
+ },
39
+ {
40
+ "uid": "f6d72aa5ef8e8f0e553012af9a29a87e",
41
+ "css": "left",
42
+ "code": 61815,
43
+ "src": "fontawesome"
44
+ },
45
+ {
46
+ "uid": "fb94e23ae1e7660aa63cc5f351ec7560",
47
+ "css": "right",
48
+ "code": 61816,
49
+ "src": "fontawesome"
50
+ },
51
+ {
52
+ "uid": "c009d417f87d6a27bb5a1cefd30b6cbd",
53
+ "css": "text-height",
54
+ "code": 59394,
55
+ "src": "fontawesome"
56
+ },
57
+ {
58
+ "uid": "02cca871bb69da75e8ee286b7055832c",
59
+ "css": "bold",
60
+ "code": 59395,
61
+ "src": "fontawesome"
62
+ },
63
+ {
64
+ "uid": "a8cb1c217f02b073db3670c061cc54d2",
65
+ "css": "italic",
66
+ "code": 59396,
67
+ "src": "fontawesome"
68
+ },
69
+ {
70
+ "uid": "ae6336c46d73af999fe7460c089abb4d",
71
+ "css": "align-center",
72
+ "code": 59397,
73
+ "src": "fontawesome"
74
+ },
75
+ {
76
+ "uid": "0c708edd8fae2376b3370aa56d40cf9e",
77
+ "css": "header",
78
+ "code": 61916,
79
+ "src": "fontawesome"
80
+ },
81
+ {
82
+ "uid": "d4a4a38a40b728f46dad1de4ac950231",
83
+ "css": "underline",
84
+ "code": 61645,
85
+ "src": "fontawesome"
86
+ },
87
+ {
88
+ "uid": "f9cbf7508cd04145ade2800169959eef",
89
+ "css": "font",
90
+ "code": 59398,
91
+ "src": "fontawesome"
92
+ },
93
+ {
94
+ "uid": "4d2dfc45d8176b1f26aed973fa84a91e",
95
+ "css": "indent-right",
96
+ "code": 59399,
97
+ "src": "fontawesome"
98
+ },
99
+ {
100
+ "uid": "ca90da02d2c6a3183f2458e4dc416285",
101
+ "css": "adjust",
102
+ "code": 59400,
103
+ "src": "fontawesome"
104
+ },
105
+ {
106
+ "uid": "dea706a9bd3144316ce37406ec10f469",
107
+ "css": "level-up",
108
+ "code": 61768,
109
+ "src": "fontawesome"
110
+ },
111
+ {
112
+ "uid": "4684e690bad65fb618329dfe52017475",
113
+ "css": "level-down",
114
+ "code": 61769,
115
+ "src": "fontawesome"
116
+ }
117
+ ]
118
+ }
admin/font/fontello.eot ADDED
Binary file
admin/font/fontello.svg ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Copyright (C) 2017 by original authors @ fontello.com</metadata>
5
+ <defs>
6
+ <font id="fontello" horiz-adv-x="1000" >
7
+ <font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
+ <missing-glyph horiz-adv-x="1000" />
9
+ <glyph glyph-name="resize-horizontal" unicode="&#xe800;" d="M1000 350q0-14-11-25l-142-143q-11-11-26-11t-25 11-10 25v72h-572v-72q0-14-10-25t-25-11-25 11l-143 143q-11 11-11 25t11 25l143 143q10 11 25 11t25-11 10-25v-72h572v72q0 14 10 25t25 11 26-11l142-143q11-10 11-25z" horiz-adv-x="1000" />
10
+
11
+ <glyph glyph-name="resize-vertical" unicode="&#xe801;" d="M393 671q0-14-11-25t-25-10h-71v-572h71q15 0 25-10t11-25-11-25l-143-143q-10-11-25-11t-25 11l-143 143q-10 10-10 25t10 25 25 10h72v572h-72q-14 0-25 10t-10 25 10 26l143 142q11 11 25 11t25-11l143-142q11-11 11-26z" horiz-adv-x="428.6" />
12
+
13
+ <glyph glyph-name="text-height" unicode="&#xe802;" d="M973 64q19 0 24-10t-6-25l-71-90q-11-15-27-15t-27 15l-71 90q-11 15-6 25t24 10h44v572h-44q-19 0-24 10t6 25l71 90q11 15 27 15t27-15l71-90q11-15 6-25t-24-10h-44v-572h44z m-928 714l30-15q7-3 118-3 25 0 74 1t73 1q21 0 60 0t60 0h164q3 0 12 0t11 0 9 1 10 5 8 10l24 1q2 0 7-1t8 0q1-62 1-187 0-45-2-61-22-8-38-10-14 24-31 71-1 5-6 27t-8 41-4 20q-3 4-7 7t-8 3-8 1-10 1-9-1q-9 0-37 1t-41 0-36-1-40-3q-5-46-4-76 0-53 1-217t1-254q0-9-1-40t0-51 7-38q22-12 69-24t67-21q2-22 2-28 0-8-1-16l-19-1q-43-1-122 5t-115 5q-28 0-85-5t-84-5q-2 29-2 29v5q9 15 34 24t55 17 44 15q10 23 10 213 0 57-1 170t-2 169v65q0 1 0 9t1 14-1 14-2 13-2 8q-7 7-91 7-18 0-52-7t-44-15q-11-7-19-40t-18-62-24-30q-23 15-31 25v214z" horiz-adv-x="1000" />
14
+
15
+ <glyph glyph-name="bold" unicode="&#xe803;" d="M310 1q41-18 78-18 210 0 210 187 0 64-23 101-15 24-34 41t-38 26-45 14-47 6-53 1q-40 0-56-6 0-29 0-88t-1-88q0-5 0-38t0-54 2-47 7-37z m-8 417q23-4 61-4 46 0 80 7t61 25 42 50 14 79q0 39-16 68t-45 46-60 24-69 8q-28 0-73-7 0-28 3-84t2-85q0-15 0-45t-1-44q0-26 1-38z m-302-497l1 53q9 2 48 9t59 15q4 7 7 15t4 19 4 18 1 21 0 19v36q0 548-12 572-2 5-12 8t-25 6-28 4-27 3-17 2l-2 46q55 1 190 6t208 6q13 0 38-1t38 0q39 0 76-7t72-24 60-39 41-59 16-76q0-29-9-54t-22-40-36-32-41-25-47-22q86-20 144-75t57-138q0-56-20-101t-52-72-77-48-91-27-98-8q-25 0-74 2t-74 1q-59 0-171-6t-129-7z" horiz-adv-x="785.7" />
16
+
17
+ <glyph glyph-name="italic" unicode="&#xe804;" d="M0-78l10 48q12 4 34 9t40 11 33 13q16 19 23 56 1 4 35 162t63 303 29 165v14q-13 8-30 11t-39 4-32 3l10 58q19-1 67-4t84-4 67-1q27 0 55 1t68 4 54 4q-2-22-10-50-17-6-57-16t-60-19q-5-10-8-23t-5-23-4-25-4-24q-15-82-49-234t-43-198q-1-5-7-32t-11-51-9-46-4-32l1-10q9-3 103-18-2-24-9-55-6 0-18-1t-18-1q-16 0-49 6t-48 6q-77 1-115 1-28 0-79-5t-68-7z" horiz-adv-x="571.4" />
18
+
19
+ <glyph glyph-name="align-center" unicode="&#xe805;" d="M1000 100v-71q0-15-11-25t-25-11h-928q-15 0-25 11t-11 25v71q0 15 11 25t25 11h928q15 0 25-11t11-25z m-214 214v-71q0-15-11-25t-25-11h-500q-14 0-25 11t-11 25v71q0 15 11 25t25 11h500q15 0 25-11t11-25z m143 215v-72q0-14-11-25t-25-11h-786q-14 0-25 11t-11 25v72q0 14 11 25t25 10h786q14 0 25-10t11-25z m-215 214v-72q0-14-10-25t-25-10h-358q-14 0-25 10t-10 25v72q0 14 10 25t25 11h358q14 0 25-11t10-25z" horiz-adv-x="1000" />
20
+
21
+ <glyph glyph-name="font" unicode="&#xe806;" d="M405 538l-95-251q18 0 76-1t89-1q11 0 32 1-48 141-102 252z m-405-617l1 44q13 4 31 7t32 6 28 8 25 17 17 28l132 344 156 404h72q4-8 6-12l114-268q19-43 60-144t63-153q9-19 33-80t40-94q11-26 19-32 11-9 49-17t47-11q4-22 4-32 0-3-1-8t0-7q-35 0-106 5t-107 4q-42 0-120-4t-99-4q0 24 2 43l73 16q1 0 7 1t9 2 8 3 9 4 6 4 5 6 1 8q0 9-17 54t-40 99-24 56l-251 1q-14-32-43-109t-28-91q0-12 8-21t24-14 27-7 32-5 23-2q1-11 1-32 0-5-1-16-33 0-98 6t-97 6q-5 0-15-3t-12-2q-45-8-105-8z" horiz-adv-x="928.6" />
22
+
23
+ <glyph glyph-name="indent-right" unicode="&#xe807;" d="M196 386q0-8-5-13l-160-161q-5-5-13-5-7 0-13 5t-5 13v321q0 8 5 13t13 5q8 0 13-5l160-160q5-5 5-13z m804-268v-107q0-7-5-13t-13-5h-964q-7 0-13 5t-5 13v107q0 7 5 12t13 6h964q7 0 13-6t5-12z m0 214v-107q0-7-5-13t-13-5h-607q-7 0-13 5t-5 13v107q0 7 5 13t13 5h607q7 0 13-5t5-13z m0 214v-107q0-7-5-12t-13-6h-607q-7 0-13 6t-5 12v107q0 8 5 13t13 5h607q7 0 13-5t5-13z m0 215v-107q0-8-5-13t-13-5h-964q-7 0-13 5t-5 13v107q0 7 5 12t13 6h964q7 0 13-6t5-12z" horiz-adv-x="1000" />
24
+
25
+ <glyph glyph-name="adjust" unicode="&#xe808;" d="M429 46v608q-83 0-153-41t-110-111-41-152 41-152 110-111 153-41z m428 304q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
26
+
27
+ <glyph glyph-name="underline" unicode="&#xf0cd;" d="M27 726q-21 1-25 2l-2 49q7 1 22 1 34 0 63-3 74-4 93-4 47 0 93 2 65 2 82 3 31 0 48 1l-1-8 1-36v-5q-33-5-69-5-33 0-44-14-7-7-7-73 0-7 0-18t0-15l1-127 8-157q3-69 28-112 20-33 54-52 49-26 98-26 59 0 107 16 31 10 55 28 27 20 37 36 20 31 29 63 12 41 12 128 0 44-2 72t-6 68-8 89l-2 33q-3 37-13 49-19 20-43 19l-56-1-8 2 1 48h47l114-6q43-2 110 6l10-1q3-22 3-29 0-4-2-17-25-7-47-8-41-6-44-9-8-8-8-23 0-4 0-15t1-17q5-11 13-221 3-109-9-170-8-42-23-68-21-36-62-69-42-31-102-49-61-19-142-19-93 0-159 26-66 26-99 68-34 42-47 109-9 45-9 132v186q0 105-9 119-14 20-82 22z m830-787v36q0 8-5 13t-13 5h-821q-8 0-13-5t-5-13v-36q0-8 5-13t13-5h821q8 0 13 5t5 13z" horiz-adv-x="857.1" />
28
+
29
+ <glyph glyph-name="level-up" unicode="&#xf148;" d="M568 514q-10-21-32-21h-107v-482q0-8-5-13t-13-5h-393q-12 0-16 10-5 11 2 19l89 108q5 6 14 6h179v357h-107q-23 0-33 21-9 20 5 38l179 214q10 12 27 12t28-12l178-214q15-18 5-38z" horiz-adv-x="571.4" />
30
+
31
+ <glyph glyph-name="level-down" unicode="&#xf149;" d="M18 707h393q7 0 12-5t6-13v-482h107q22 0 32-20t-5-39l-178-214q-11-13-28-13t-27 13l-179 214q-14 17-5 39 10 20 33 20h107v357h-179q-8 0-14 6l-89 108q-7 7-2 19 5 10 16 10z" horiz-adv-x="571.4" />
32
+
33
+ <glyph glyph-name="down" unicode="&#xf175;" d="M427 125q4-10-3-19l-195-215q-6-5-13-5-8 0-13 5l-198 215q-8 9-3 19 5 11 16 11h125v696q0 8 5 13t13 5h107q8 0 13-5t5-13v-696h125q11 0 16-11z" horiz-adv-x="428.6" />
34
+
35
+ <glyph glyph-name="up" unicode="&#xf176;" d="M427 575q-5-11-16-11h-125v-696q0-8-5-13t-13-5h-107q-8 0-13 5t-5 13v696h-125q-12 0-16 11t3 19l195 215q5 5 13 5 7 0 13-5l198-215q7-8 3-19z" horiz-adv-x="428.6" />
36
+
37
+ <glyph glyph-name="left" unicode="&#xf177;" d="M1000 404v-108q0-7-5-12t-13-5h-696v-125q0-12-11-17t-19 3l-215 196q-5 5-5 12 0 8 5 14l215 197q9 8 19 4 11-5 11-17v-125h696q8 0 13-5t5-12z" horiz-adv-x="1000" />
38
+
39
+ <glyph glyph-name="right" unicode="&#xf178;" d="M964 352q0-8-5-14l-215-197q-8-8-19-4-11 5-11 17v125h-696q-8 0-13 5t-5 12v108q0 7 5 12t13 5h696v125q0 12 11 17t19-3l215-195q5-6 5-13z" horiz-adv-x="1000" />
40
+
41
+ <glyph glyph-name="header" unicode="&#xf1dc;" d="M939-79q-25 0-74 2t-75 2q-24 0-73-2t-74-2q-13 0-21 12t-7 25q0 18 9 26t22 9 29 4 25 9q18 11 18 78l0 218q0 12-1 17-7 3-28 3h-376q-22 0-29-3 0-5 0-17l-1-207q0-79 21-91 9-6 26-8t32-2 25-8 11-26q0-14-6-26t-21-13q-26 0-78 2t-77 2q-24 0-71-2t-71-2q-13 0-20 12t-7 25q0 17 9 25t20 10 26 4 24 9q18 13 18 80l-1 31v454q0 2 1 15t0 20-1 21-2 24-4 20-6 18-9 10q-8 5-25 7t-29 1-23 7-10 26q0 14 6 26t20 13q26 0 78-2t77-2q23 0 71 2t70 2q14 0 21-13t7-26q0-17-9-25t-22-8-27-2-24-7q-20-12-20-90l1-178q0-12 0-18 7-2 22-2h390q14 0 21 2 1 6 1 18l0 178q0 78-19 90-10 6-33 7t-37 7-14 28q0 14 7 26t21 13q24 0 74-2t73-2q24 0 72 2t72 2q14 0 21-13t7-26q0-17-10-25t-22-8-29-2-24-7q-20-13-20-90l1-526q0-66 19-78 9-6 25-8t30-2 23-9 10-25q0-14-6-26t-20-13z" horiz-adv-x="1000" />
42
+
43
+ <glyph glyph-name="eyedropper" unicode="&#xf1fb;" d="M948 798q52-53 52-127t-52-126l-126-124 58-58q6-6 6-13t-6-13l-117-117q-6-6-13-6t-13 6l-58 59-337-337q-21-21-50-21h-113l-143-71-36 36 71 143v113q0 29 21 50l337 337-59 58q-6 6-6 13t6 13l117 117q6 6 13 6t13-6l58-58 124 126q52 52 126 52t127-52z m-662-769l321 321-107 107-321-321v-107h107z" horiz-adv-x="1000" />
44
+ </font>
45
+ </defs>
46
+ </svg>
admin/font/fontello.ttf ADDED
Binary file
admin/font/fontello.woff ADDED
Binary file
admin/font/fontello.woff2 ADDED
Binary file
admin/js/admin-min.js CHANGED
@@ -1,52 +1 @@
1
- jQuery(document).ready(function($){function isValidEmailAddress(emailAddress){var pattern=/^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*(([ \t]*\r\n)?[ \t]+)?")@(([a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.)+([a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.?$/i;return pattern.test(emailAddress)}
2
- function validateInput(elem,result){if(result=='valid'){elem.css('border-color','#ddd')}else{elem.css('border-color','red')}}
3
- var cf7s_status_name=$('.cf7style-name'),cf7s_status_email=$('.cf7style-email'),cf7s_status_message=$('.cf7style-message'),cf7s_status_submit=$('.cf7style-status-submit');cf7s_status_submit.on('click',function(e){e.preventDefault();$('.cf7style-input').each(function(index,value){if($(this).val()==''){validateInput($(this),'error')}else{validateInput($(this),'valid')}});if(cf7s_status_name.val()!==''&&cf7s_status_email.val()!==''){if(!isValidEmailAddress(cf7s_status_email.val())){validateInput(cf7s_status_email,'error')}else{validateInput(cf7s_status_email,'valid');var status=$('<div />');$('.cf7style-status-table').each(function(index,value){var table=$("<table />");table.html($(this).html());status.append(table)});$.ajax({'url':ajaxurl,'method':'POST','data':{'action':'cf7_style_send_status_report','name':cf7s_status_name.val(),'email':cf7s_status_email.val(),'message':cf7s_status_message.val(),'report':status.html()},'beforeSend':function(){cf7s_status_submit.text('Sending...')},'success':function(data){if($.trim(data)=='success'){cf7s_status_submit.text('Report sent').removeClass('cf7style-status-submit').attr('disabled','disabled')}else{cf7s_status_submit.text('Something went wrong!').removeClass('cf7style-status-submit').attr('disabled','disabled')}}})}}else{console.log('error 1')}});$('.cf7style-status-info').on('click',function(e){e.preventDefault();$('.cf7style-status-table').toggle()});String.prototype.filename=function(extension){var s=this.replace(/\\/g,'/');s=s.substring(s.lastIndexOf('/')+1);return extension?s.replace(/[?#].+$/,''):s.split('.')[0]}
4
- function changeFont(value){$(".google-fontos").remove();if("none"!=value&&"undefined"!=typeof value){$("head").append('<link class="google-fontos" rel="stylesheet" href="https://fonts.googleapis.com/css?family='+value+':100,200,300,400,500,600,700,800,900&subset=latin,latin-ext,cyrillic,cyrillic-ext,greek-ext,greek,vietnamese" />');$(".cf7-style.preview-zone p").css("font-family","'"+value+"', sans-serif");$('.preview-form-container .wpcf7').css("font-family","'"+value+"', sans-serif")}}
5
- function scrolling(element){$(window).scroll(function(){if($(window).width()>1600){var offset=element.find('.panel-header').offset(),cf7styleOffset=$('#cf7_style_meta_box_style_customizer').offset(),diff=$(window).scrollTop()-cf7styleOffset.top;if(diff>0){element.find('.panel-header').css('top',diff)}
6
- if(diff<=0){element.find('.panel-header').css('top',0)}}
7
- if($(window).scrollTop()>700){$('.fixed-save-style').show()}else{$('.fixed-save-style').hide()}}).trigger('scroll')}
8
- function autoCompleteOtherValues(){$("input[type='number']").on("change",function(){var _t=$(this),value=_t.val(),indexor=_t.parent().index(),allInput=_t.parent().parent().find("input[type=number]");switch(indexor){case 1:allInput.each(function(){if(parseFloat($(this).attr('step'))==parseFloat(_t.attr('step'))){$(this).val(value)}});break;case 2:if(parseFloat(allInput.eq(3).attr('step'))==parseFloat(_t.attr('step'))){allInput.eq(3).val(value)}
9
- break}})}
10
- function initialPreview(previewType){var hiddenInputData=$('input[name="cf7styleallvalues"]');if(hiddenInputData.length>0){var loadedData=$('input[name="cf7styleallvalues"]').val(),loadedArray=$.parseJSON(loadedData.replace(/'/g,'"'));$.each(loadedArray,function(index,value){if(index.indexOf('unit')<0&&((previewType=="hover"&&index.indexOf('hover')>0)||(previewType!="hover"&&index.indexOf('hover')<0))){var splitArray=index.split("_"),newElem=splitArray[0],unit=loadedArray[index+"_unit"];if(splitArray[0]=="submit"){newElem="input[type='submit']"}
11
- if(splitArray[0]=="form"){newElem=".wpcf7"}
12
- if(splitArray[0]=='wpcf7-not-valid-tip'||splitArray[0]=='wpcf7-validation-errors'||splitArray[0]=='wpcf7-mail-sent-ok'){newElem="."+splitArray[0]}
13
- unit=(typeof unit=='undefined'||value=="")?"":unit;var newValue=value+unit;if(splitArray[1]=="background-image"){newValue='url('+value+')'}
14
- newElem=(newElem=='radio')?'input[type="radio"]':(newElem=='checkbox')?'input[type="checkbox"]':newElem;$('.preview-form-container '+newElem).css(splitArray[1],newValue)}})}}
15
- function selectAllForms(element){element.on("click",function(){$(".cf7style_body_select_all input").prop('checked',($(this).is(":checked"))?!0:!1)})}
16
- function cf7_slider(elem,slideWidth,animationSpeed,showArrows){var active=elem.find('.active'),index=active.index()+1,slide=elem.find('li'),sliderViewport=elem.find('ul'),arrow=elem.find('.narrow'),arrowLeft=elem.find('.narrow.left'),arrowRight=elem.find('.narrow.right'),totalSlides=elem.find('li').length;arrowRight.addClass('visible');sliderViewport.css('width',totalSlides*slideWidth);if(showArrows==!1){elem.mouseenter(function(){elem.find('.visible').stop().show()}).mouseleave(function(){elem.find('.visible').stop().hide()})}
17
- arrow.on('click',function(e){e.stopPropagation();e.preventDefault();var direction=$(this).attr('data-direction');if(direction=="left"&&index!==1){sliderViewport.stop(!0,!0).animate({marginLeft:"+="+(slideWidth)+"px"},animationSpeed);index--}
18
- if(direction=="right"&&index!==totalSlides){sliderViewport.stop(!0,!0).animate({marginLeft:-(slideWidth*index)+"px"},animationSpeed);index++}
19
- if(index==1){arrowLeft.hide().removeClass('visible');arrowRight.show().addClass('visible')}
20
- if(index==totalSlides){arrowRight.hide().removeClass('visible')}
21
- if(index<totalSlides){arrowRight.show().addClass('visible')}
22
- if(index>1){arrowLeft.show().addClass('visible')}
23
- slide.removeClass('active').eq(index-1).addClass('active')});sliderViewport.css({'margin-left':'-'+(index-1)*slideWidth+'px'})}
24
- function sliderInit(element){cf7_slider(element,202,500,!0);element.find('li').on('click',function(){if(!$(this).hasClass('current-saved')){element.find('li').removeClass('current-saved');$(this).addClass('current-saved');element.find('.overlay em').html('Not Active');$(this).find('.overlay em').html('Active');$('.cf7style_template').removeAttr('checked');$(this).find('.cf7style_template').attr("checked","checked")}})}
25
- $.fn.serializeObject=function(){var o={};var a=this.serializeArray();$.each(a,function(){if(o[this.name]!==undefined){if(!o[this.name].push){o[this.name]=[o[this.name]]}
26
- o[this.name].push(this.value||'')}else{o[this.name]=this.value||''}});return o}
27
- function updateHiddenInput(current){var loadedString="",loadedArray=$.parseJSON($('input[name="cf7styleallvalues"]').val().replace(/'/g,'"'));$.each(current.serializeObject(),function(index,value){if(loadedArray.length==0){loadedArray={}}
28
- loadedArray[index.replace(/cf7stylecustom\[/g,'').replace(/]/g,'')]=value});loadedString=JSON.stringify(loadedArray);loadedString=loadedString.replace(/cf7stylecustom\[/g,'').replace(/]/g,'').replace(/"/g,"'");$('input[name="cf7styleallvalues"]').val(loadedString);$('input[name="cf7styleallvalues"]').attr('value',loadedString)}
29
- function showTheOption(){initialPreview();$('#form-tag a.button').on('click',function(e){e.preventDefault();var _t=$(this),currentElement=$('.'+_t.attr('data-property')+'-panel'),onlyOnce=0;if($('.modified-style-here').length==0){if(!_t.hasClass('button-primary')){$('.panel').stop(!0,!0).animate({'opacity':0},300,function(){if(onlyOnce===0){onlyOnce++;$('.panel').addClass('hidden');$('.panel').html('');currentElement.css('opacity','0');currentElement.removeClass('hidden');$.ajax({'url':ajaxurl,'method':'POST','data':{'action':'cf7_style_load_property','property':_t.attr('data-property')},'beforeSend':function(){_t.parent().find('a').prop('disabled','true');$('.panel-options .loading').removeClass('hidden')},'success':function(data){_t.parent().find('a').prop('disabled','false');onlyOnce=0;currentElement.html(data);$('.panel-options .loading').addClass('hidden');var loadedData=$('input[name="cf7styleallvalues"]').val(),loadedArray=$.parseJSON(loadedData.replace(/'/g,'"'));currentElement.find('[name^="cf7stylecustom"]').each(function(){if(($(this).attr('id')in loadedArray)&&loadedArray[$(this).attr('id')]!=""){$(this).val(loadedArray[$(this).attr('id')])}});currentElement.find('.cf7-style-color-field').wpColorPicker(options);autoCompleteOtherValues();addBgImage();currentElement.stop(!0,!0).animate({'opacity':1},300);injectCheckbox();changeInputStep()}})}});$(".element-selector input:eq(0)").prop("checked",!0)}
30
- $('#form-tag a.button').removeClass('button-primary');_t.addClass('button-primary');$('input[name="cf7styleactivepane"]').val(_t.attr('data-property'))}else{$('.panel-options .decision').removeClass('hidden')}});$('.panel-options .cancel-btn').on('click',function(e){e.preventDefault();$('.panel-options .decision').addClass('hidden')});$('.element-selector input').on('change',function(){$('.element-selector input').prop('checked',!1);$(this).prop('checked',!0);if($(this).val()=="hover"){$('.panel:visible li').addClass('hidden');$('.panel:visible li.hover-element').removeClass('hidden');initialPreview("hover")}else{$('.panel:visible li.hover-element').addClass('hidden');$('.panel:visible li').not('.hover-element').removeClass('hidden');initialPreview()}});$('#form-preview').on('change',function(){$('.preview-form-container').addClass('hidden');$('.preview-form-container').eq($(this).val()).removeClass('hidden')});var once=0;$(document).on("change",'[name^="cf7stylecustom"]',function(){if(once==0){once++;$(this).parents('.panel').addClass('modified-style-here')}
31
- updateHiddenInput($(this).parents('.panel').find('[name^="cf7stylecustom"]'));if($('input[name="element-type"]:checked').val()=="hover"){initialPreview('hover')}else{initialPreview()}});$(document).on("keyup",'[name^="cf7stylecustom"]',function(){updateHiddenInput($(this).parents('.panel').find('[name^="cf7stylecustom"]'));if($('input[name="element-type"]:checked').val()=="hover"){initialPreview('hover')}else{initialPreview()}})}
32
- function removePreviewfields(element){element.remove()}
33
- function disableSubmit(element){element.on('click',function(e){e.preventDefault()})}
34
- function addDummyElements(){$('.wpcf7 input[aria-required="true"]').each(function(){$('<span role="alert" class="wpcf7-not-valid-tip">Required field message example.</span>').insertAfter($(this))});$('.wpcf7').each(function(){$('<div class="wpcf7-response-output wpcf7-display-none wpcf7-validation-errors" style="display: block;" role="alert">Error message example.</div>').appendTo($(this));$('<div class="wpcf7-response-output wpcf7-display-none wpcf7-mail-sent-ok" style="display: block;" role="alert">Thank you message example.</div>').appendTo($(this))})}
35
- function addBgImage(){var bgFormInput=$('.cf7-style-upload-field');bgFormInput.addClass('hidden');bgFormInput.each(function(){var _t=$(this);$('<span class="image-info-box"></span>').insertAfter(_t);if(_t.val()!=""){_t.parent().find('.image-info-box').text(_t.val().filename('yes'))}});if($('.upload-btn').length<=0){$("<a href='javascript: void(0);' class='remove-btn button'>Remove</a>").insertAfter(bgFormInput);$("<a href='javascript: void(0);' class='upload-btn button'>Upload</a>").insertAfter(bgFormInput)}
36
- $('.upload-btn').on('click',function(){var _t=$(this),currentimage=_t.parent().find('.cf7-style-upload-field');tb_show('New Banner','media-upload.php?type=image&TB_iframe=1');window.send_to_editor=function(html){currentimage.val($(html).attr('src'));currentimage.trigger('change');_t.parent().find('.image-info-box').text($(html).attr('src').filename('yes'));tb_remove()}});$('.remove-btn').on('click',function(){var _t=$(this),currentimage=_t.parent().find('.cf7-style-upload-field');currentimage.val(' ');currentimage.attr('value',' ');currentimage.trigger('change');_t.parent().find('.image-info-box').text('')})}
37
- function codeMirrorInit(){if($("#cf7_style_manual_style").length>0){var editor=CodeMirror.fromTextArea(document.getElementById("cf7_style_manual_style"),{lineNumbers:!0,theme:"default",mode:"text/css"})}}
38
- if($('.cf7style-no-forms-added').length>0){$('.generate-preview-button, .generate-preview-option').show()}else{$('.generate-button-hidden').show()}
39
- $('.generate-preview-button').on('click',function(e){e.preventDefault();$('.cf7style-no-forms-added').hide();var form_id=$(this).attr('data-attr-id'),form_title=$(this).attr('data-attr-title');$(this).prop('disabled',!0);$(this).parents('tr').find('input').prop('checked',!0);var paragraph=$("<p />");$('.preview-form-tag').prepend(paragraph);$.ajax({'url':ajaxurl,'method':'POST','data':{'action':'cf7_style_generate_preview_dashboard','form_id':form_id,'form_title':form_title},'beforeSend':function(){paragraph.text("Loading...");$('.multiple-form-generated-preview').hide()},'success':function(data){if(data){paragraph.remove();$('.preview-form-tag').append(data);$('.multiple-form-generated-preview').eq($('.multiple-form-generated-preview').length-1).show();initialPreview();addDummyElements()}}})});function injectCheckbox(){$('<label><input type="checkbox" class="transparent-box" name="transparent-box">Transparent</label>').insertAfter('.wp-picker-container');$('.transparent-box').each(function(){var curParent=$(this).parent().parent();if(curParent.find('.cf7-style-color-field').val()=="transparent"){$(this).prop("checked",!0)}});$('.transparent-box').on('click',function(){var curParent=$(this).parent().parent();if($(this).is(':checked')){curParent.find('.cf7-style-color-field').val('transparent');curParent.find('.cf7-style-color-field').attr('value','transparent');curParent.find('.wp-color-result').css('background-color','transparent')}else{curParent.find('.cf7-style-color-field').val('');curParent.find('.cf7-style-color-field').attr('value','')}
40
- updateHiddenInput($(this).parents('.panel').find('[name^="cf7stylecustom"]'))})}
41
- function returnStep(element){return(("%"==element.val()||"em"==element.val())?"0.01":"1")}
42
- function changeInputStep(){$('.panel input[type="number"]').each(function(){var _t=$(this);_t.attr('step',returnStep(_t.next()))});$('.panel select[name*="unit"]').off("change").on("change",function(){var _t=$(this);_t.prev().attr('step',returnStep(_t));if(_t.val()=="px"){var curVal=Math.floor(_t.prev().val());_t.prev().val(curVal);_t.prev().attr('value',curVal)}})}
43
- var previewEl=$(".generate-preview"),cf7StylePostType=$(".post-type-cf7_style "),selectAll=$('#select_all'),fontSelectVar=$('select[name="cf7_style_font_selector"]'),sliderWrapper=$('.cf7-style-slider-wrap'),previewForm=$('.preview-form-container'),options={change:function(event,ui){var _t=$(this);_t.parents('.wp-picker-container').parent().find('.transparent-box').prop("checked",!1);setTimeout(function(){updateHiddenInput(_t.parents('.panel').find('[name^="cf7stylecustom"]'))},0);if($('input[name="element-type"]:checked').val()=="hover"){initialPreview('hover')}else{initialPreview()}}};$('.cf7-style-color-field').wpColorPicker(options);if(previewEl.length>0){scrolling(previewEl)}
44
- if(cf7StylePostType.length>0){codeMirrorInit();addBgImage();autoCompleteOtherValues();addDummyElements();var previewForm=$('.preview-form-container').not('.hidden');if(previewForm.find('label').length<1){$('.button[data-property="label"]').hide()}
45
- if(previewForm.find('p').length<1){$('.button[data-property="p"]').hide()}
46
- if(previewForm.find('fieldset').length<1){$('.button[data-property="fieldset"]').hide()}
47
- if(previewForm.find('select').length<1){$('.button[data-property="select"]').hide()}
48
- if(previewForm.find('input[type="checkbox"]').length<1){$('.button[data-property="checkbox"]').hide()}
49
- if(previewForm.find('input[type="radio"]').length<1){$('.button[data-property="radio"]').hide()}
50
- selectAllForms(selectAll);changeFont(fontSelectVar.val());fontSelectVar.on("change",function(){changeFont($(this).val())});showTheOption();removePreviewfields(previewForm.find('input[type="hidden"]'));disableSubmit(previewForm.find('input[type="submit"]'))}
51
- if(sliderWrapper.length>0){sliderInit(sliderWrapper)}
52
- $('.close-cf7-panel').on('click',function(e){e.preventDefault();$.ajax({'url':ajaxurl,'method':'POST','data':{'action':'cf7_style_remove_welcome_box'},'success':function(data){$('.welcome-container').fadeOut('slow')}})});injectCheckbox();changeInputStep()})
1
+ jQuery(document).ready(function(e){function t(e){return/^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*(([ \t]*\r\n)?[ \t]+)?")@(([a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.)+([a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.?$/i.test(e)}function a(t){t.find("label").length<1&&e('.button[data-property="label"]').hide(),t.find("p").length<1&&e('.button[data-property="p"]').hide(),t.find("fieldset").length<1&&e('.button[data-property="fieldset"]').hide(),t.find("select").length<1&&e('.button[data-property="select"]').hide(),t.find('input[type="checkbox"]').length<1&&e('.button[data-property="checkbox"]').hide(),t.find('input[type="radio"]').length<1&&e('.button[data-property="radio"]').hide()}function n(e,t){"valid"==t?e.css("border-color","#ddd"):e.css("border-color","red")}function i(t){e(".google-fontos").remove(),"none"!=t&&void 0!==t&&(e("head").append('<link class="google-fontos" rel="stylesheet" href="https://fonts.googleapis.com/css?family='+t+':100,200,300,400,500,600,700,800,900&subset=latin,latin-ext,cyrillic,cyrillic-ext,greek-ext,greek,vietnamese" />'),e(".cf7-style.preview-zone p").css("font-family","'"+t+"', sans-serif"),e(".preview-form-container .wpcf7").css("font-family","'"+t+"', sans-serif"))}function r(){e("input[type='number']").on("change",function(){var t=e(this),a=t.val(),n=t.parent().index(),i=t.parent().parent().find("input[type=number]");switch(n){case 1:i.each(function(){parseFloat(e(this).attr("step"))==parseFloat(t.attr("step"))&&e(this).val(a)});break;case 2:parseFloat(i.eq(3).attr("step"))==parseFloat(t.attr("step"))&&i.eq(3).val(a)}})}function l(t){if(e('input[name="cf7styleallvalues"]').length>0){var a=e('input[name="cf7styleallvalues"]').val(),n=e.parseJSON(a.replace(/'/g,'"'));e(".place-style").remove(),e.each(n,function(a,i){if(a.indexOf("unit")<0&&("hover"==t&&a.indexOf("hover")>0||"hover"!=t&&a.indexOf("hover")<0)){var r=a.split("_"),l=r[0],s="hover"==t&&a.indexOf("hover")>0?n[a.replace("hover","")+"unit_hover"]:n[a+"_unit"];if("placeholder"==r[0]&&""!=i){var o=i+(s=void 0===s||""==i?"":s),c=e("<style>").attr("class","place-style");return c.text(".preview-form-container ::-webkit-input-placeholder { "+r[1]+": "+o+";}.preview-form-container ::-moz-placeholder { "+r[1]+": "+o+";}.preview-form-container :-ms-input-placeholder { "+r[1]+": "+o+";}.preview-form-container :-moz-placeholder { "+r[1]+": "+o+";}"),void c.appendTo("head")}"submit"==r[0]&&(l="input[type='submit']"),"form"==r[0]&&(l=".wpcf7"),"wpcf7-not-valid-tip"!=r[0]&&"wpcf7-validation-errors"!=r[0]&&"wpcf7-mail-sent-ok"!=r[0]||(l="."+r[0]);o=i+(s=void 0===s||""==i?"":s);"background-image"==r[1]&&(o="url("+i+")"),e(".preview-form-container "+(l="radio"==l?'input[type="radio"]':"checkbox"==l?'input[type="checkbox"]':l)).css(r[1],o)}})}}function s(t,a,n,i){var r=t.find(".active").index()+1,l=t.find("li"),s=t.find("ul"),o=t.find(".narrow"),c=t.find(".narrow.left"),p=t.find(".narrow.right"),d=t.find("li").length;p.addClass("visible"),s.css("width",d*a),0==i&&t.mouseenter(function(){t.find(".visible").stop().show()}).mouseleave(function(){t.find(".visible").stop().hide()}),o.on("click",function(t){t.stopPropagation(),t.preventDefault();var i=e(this).attr("data-direction");"left"==i&&1!==r&&(s.stop(!0,!0).animate({marginLeft:"+="+a+"px"},n),r--),"right"==i&&r!==d&&(s.stop(!0,!0).animate({marginLeft:-a*r+"px"},n),r++),1==r&&(c.hide().removeClass("visible"),p.show().addClass("visible")),r==d&&p.hide().removeClass("visible"),r<d&&p.show().addClass("visible"),r>1&&c.show().addClass("visible"),l.removeClass("active").eq(r-1).addClass("active")}),s.css({"margin-left":"-"+(r-1)*a+"px"})}function o(t){var a="",n=e.parseJSON(e('input[name="cf7styleallvalues"]').val().replace(/'/g,'"'));e.each(t.serializeObject(),function(e,t){0==n.length&&(n={}),n[e.replace(/cf7stylecustom\[/g,"").replace(/]/g,"")]=t}),a=(a=JSON.stringify(n)).replace(/cf7stylecustom\[/g,"").replace(/]/g,"").replace(/"/g,"'"),e('input[name="cf7styleallvalues"]').val(a),e('input[name="cf7styleallvalues"]').attr("value",a)}function c(){e('.wpcf7 input[aria-required="true"]').each(function(){e('<span role="alert" class="wpcf7-not-valid-tip">Required field message example.</span>').insertAfter(e(this))}),e(".wpcf7").each(function(){e('<div class="wpcf7-response-output wpcf7-display-none wpcf7-validation-errors" style="display: block;" role="alert">Error message example.</div>').appendTo(e(this)),e('<div class="wpcf7-response-output wpcf7-display-none wpcf7-mail-sent-ok" style="display: block;" role="alert">Thank you message example.</div>').appendTo(e(this))})}function p(){var t=e(".cf7-style-upload-field");t.addClass("hidden"),t.each(function(){var t=e(this);e('<span class="image-info-box"></span>').insertAfter(t),""!=t.val()&&t.parent().find(".image-info-box").text(t.val().filename("yes"))}),e(".upload-btn").length<=0&&(e("<a href='javascript: void(0);' class='remove-btn button'>Remove</a>").insertAfter(t),e("<a href='javascript: void(0);' class='upload-btn button'>Upload</a>").insertAfter(t)),e(".upload-btn").on("click",function(){var t=e(this),a=t.parent().find(".cf7-style-upload-field");tb_show("New Banner","media-upload.php?type=image&TB_iframe=1"),window.send_to_editor=function(n){a.val(e(n).attr("src")),a.trigger("change"),t.parent().find(".image-info-box").text(e(n).attr("src").filename("yes")),tb_remove()}}),e(".remove-btn").on("click",function(){var t=e(this),a=t.parent().find(".cf7-style-upload-field");a.val(" "),a.attr("value"," "),a.trigger("change"),t.parent().find(".image-info-box").text("")})}function d(){e(".wp-picker-container").each(function(){e(this).parent().find('label[for*="_color"]').length<1&&e('<label><input type="checkbox" class="transparent-box" name="transparent-box">Transparent</label>').insertAfter(e(this))}),e(".transparent-box").each(function(){"transparent"==e(this).parent().parent().find(".cf7-style-color-field").val()&&e(this).prop("checked",!0)}),e(".transparent-box").on("click",function(){var t=e(this).parent().parent();e(this).is(":checked")?(t.find(".cf7-style-color-field").val("transparent"),t.find(".cf7-style-color-field").attr("value","transparent"),t.find(".wp-color-result").css("background-color","transparent")):(t.find(".cf7-style-color-field").val(""),t.find(".cf7-style-color-field").attr("value","")),o(e(this).parents(".panel").find('[name^="cf7stylecustom"]'))})}function u(e){return"%"==e.val()||"em"==e.val()?"0.01":"1"}function f(){e('.panel input[type="number"]:not([id*="opacity"])').each(function(){var t=e(this);t.attr("step",u(t.next()))}),e('.panel select[name*="unit"]').off("change").on("change",function(){var t=e(this);if(t.prev().attr("step",u(t)),"px"==t.val()){var a=Math.floor(t.prev().val());t.prev().val(a),t.prev().attr("value",a)}})}var h=e(".cf7style-name"),v=e(".cf7style-email"),m=e(".cf7style-message"),F=e(".cf7style-status-submit");F.on("click",function(a){if(a.preventDefault(),e(".cf7style-input").each(function(t,a){""==e(this).val()?n(e(this),"error"):n(e(this),"valid")}),""!==h.val()&&""!==v.val())if(t(v.val())){n(v,"valid");var i=e("<div />");e(".cf7style-status-table").each(function(t,a){var n=e("<table />");n.html(e(this).html()),i.append(n)}),e.ajax({url:ajaxurl,method:"POST",data:{action:"cf7_style_send_status_report",name:h.val(),email:v.val(),message:m.val(),report:i.html()},beforeSend:function(){F.text("Sending...")},success:function(t){"success"==e.trim(t)?F.text("Report sent").removeClass("cf7style-status-submit").attr("disabled","disabled"):F.text("Something went wrong!").removeClass("cf7style-status-submit").attr("disabled","disabled")}})}else n(v,"error");else console.log("error 1")}),e(".cf7style-status-info").on("click",function(t){t.preventDefault(),e(".cf7style-status-table").toggle()}),String.prototype.filename=function(e){var t=this.replace(/\\/g,"/");return t=t.substring(t.lastIndexOf("/")+1),e?t.replace(/[?#].+$/,""):t.split(".")[0]},e.fn.serializeObject=function(){var t={},a=this.serializeArray();return e.each(a,function(){void 0!==t[this.name]?(t[this.name].push||(t[this.name]=[t[this.name]]),t[this.name].push(this.value||"")):t[this.name]=this.value||""}),t},e(".cf7style-no-forms-added").length>0?e(".generate-preview-button, .generate-preview-option").show():e(".generate-button-hidden").show(),e(".generate-preview-button").on("click",function(t){t.preventDefault(),e(".cf7style-no-forms-added").hide();var n=e(this).attr("data-attr-id"),i=e(this).attr("data-attr-title");e(this).prop("disabled",!0),e(this).parents("tr").find("input").prop("checked",!0);var r=e("<p />");e(".preview-form-tag").prepend(r),e.ajax({url:ajaxurl,method:"POST",data:{action:"cf7_style_generate_preview_dashboard",form_id:n,form_title:i},beforeSend:function(){r.text("Loading..."),e(".multiple-form-generated-preview").hide()},success:function(t){t&&(r.remove(),e(".preview-form-tag").append(t),e(".multiple-form-generated-preview").eq(e(".multiple-form-generated-preview").length-1).show(),l(),c(),a(e(".preview-form-container form:visible")))}})});var y=e(".generate-preview"),b=e(".post-type-cf7_style"),g=e("#select_all"),w=e('select[name="cf7_style_font_selector"]'),x=e(".cf7-style-slider-wrap"),_=e(".preview-form-container"),k={change:function(t,a){var n=e(this);n.parents(".wp-picker-container").parent().find(".transparent-box").prop("checked",!1),setTimeout(function(){o(n.parents(".panel").find('[name^="cf7stylecustom"]'))},0),"hover"==e('input[name="element-type"]:checked').val()?l("hover"):l()}};if(e(".cf7-style-color-field").wpColorPicker(k),y.length>0&&function(t){e(window).scroll(function(){if(e(window).width()>1600){t.find(".panel-header").offset();var a=e("#cf7_style_meta_box_style_customizer").offset(),n=e(window).scrollTop()-a.top;n>0&&t.find(".panel-header").css("top",n),n<=0&&t.find(".panel-header").css("top",0)}e(window).scrollTop()>700?e(".fixed-save-style").show():e(".fixed-save-style").hide()}).trigger("scroll")}(y),b.length>0){e("#cf7_style_manual_style").length>0&&CodeMirror.fromTextArea(document.getElementById("cf7_style_manual_style"),{lineNumbers:!0,theme:"default",mode:"text/css"}),p(),r(),c();_=e(".preview-form-container").not(".hidden");e(".post-new-php").length<1&&a(_),g.on("click",function(){e(".cf7style_body_select_all input").prop("checked",!!e(this).is(":checked"))}),i(w.val()),w.on("change",function(){i(e(this).val())}),function(){l(),e("#form-tag a.button").on("click",function(t){t.preventDefault();var a=e(this),n=e("."+a.attr("data-property")+"-panel"),i=0;0==e(".modified-style-here").length?(a.hasClass("button-primary")||(e(".panel").stop(!0,!0).animate({opacity:0},300,function(){0===i&&(i++,e(".panel").addClass("hidden"),e(".panel").html(""),n.css("opacity","0"),n.removeClass("hidden"),e.ajax({url:ajaxurl,method:"POST",data:{action:"cf7_style_load_property",property:a.attr("data-property")},beforeSend:function(){a.parent().find("a").prop("disabled","true"),e(".panel-options .loading").removeClass("hidden")},success:function(t){a.parent().find("a").prop("disabled","false"),i=0,n.html(t),e(".panel-options .loading").addClass("hidden");var l=e('input[name="cf7styleallvalues"]').val(),s=e.parseJSON(l.replace(/'/g,'"'));n.find('[name^="cf7stylecustom"]').each(function(){e(this).attr("id")in s&&""!=s[e(this).attr("id")]&&e(this).val(s[e(this).attr("id")])}),n.find(".cf7-style-color-field").wpColorPicker(k),r(),p(),n.stop(!0,!0).animate({opacity:1},300),d(),f()}}))}),e(".element-selector input:eq(0)").prop("checked",!0)),e("#form-tag a.button").removeClass("button-primary"),a.addClass("button-primary"),e('input[name="cf7styleactivepane"]').val(a.attr("data-property"))):e(".panel-options .decision").removeClass("hidden")}),e(".panel-options .cancel-btn").on("click",function(t){t.preventDefault(),e(".panel-options .decision").addClass("hidden")}),e(".element-selector input").on("change",function(){e(".element-selector input").prop("checked",!1),e(this).prop("checked",!0),"hover"==e(this).val()?(e(".panel:visible li").addClass("hidden"),e(".panel:visible li.hover-element").removeClass("hidden"),l("hover")):(e(".panel:visible li.hover-element").addClass("hidden"),e(".panel:visible li").not(".hover-element").removeClass("hidden"),l())}),e("#form-preview").on("change",function(){e(".preview-form-container").addClass("hidden"),e(".preview-form-container").eq(e(this).val()).removeClass("hidden")});var t=0;e(document).on("change",'[name^="cf7stylecustom"]',function(){0==t&&(t++,e(this).parents(".panel").addClass("modified-style-here")),o(e(this).parents(".panel").find('[name^="cf7stylecustom"]')),"hover"==e('input[name="element-type"]:checked').val()?l("hover"):l()}),e(document).on("keyup",'[name^="cf7stylecustom"]',function(){o(e(this).parents(".panel").find('[name^="cf7stylecustom"]')),"hover"==e('input[name="element-type"]:checked').val()?l("hover"):l()})}(),_.find('input[type="hidden"]').remove(),_.find('input[type="submit"]').on("click",function(e){e.preventDefault()})}x.length>0&&function(t){s(t,202,500,!0),t.find("li").on("click",function(){e(this).hasClass("current-saved")||(t.find("li").removeClass("current-saved"),e(this).addClass("current-saved"),t.find(".overlay em").html("Not Active"),e(this).find(".overlay em").html("Active"),e(".cf7style_template").removeAttr("checked"),e(this).find(".cf7style_template").attr("checked","checked"))})}(x),e(".close-cf7-panel").on("click",function(t){t.preventDefault(),e.ajax({url:ajaxurl,method:"POST",data:{action:"cf7_style_remove_welcome_box"},success:function(t){e(".welcome-container").fadeOut("slow")}})}),d(),f()});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/js/admin.js CHANGED
@@ -12,6 +12,27 @@ jQuery(document).ready(function($) {
12
  return pattern.test(emailAddress);
13
  }
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  /* Validation border color */
16
 
17
  function validateInput(elem, result) {
@@ -87,7 +108,6 @@ jQuery(document).ready(function($) {
87
 
88
  $('.cf7style-status-info').on('click', function(e) {
89
  e.preventDefault();
90
-
91
  $('.cf7style-status-table').toggle();
92
 
93
  });
@@ -157,11 +177,33 @@ jQuery(document).ready(function($) {
157
  if (hiddenInputData.length > 0) {
158
  var loadedData = $('input[name="cf7styleallvalues"]').val(),
159
  loadedArray = $.parseJSON(loadedData.replace(/'/g, '"'));
 
160
  $.each(loadedArray, function(index, value) {
161
  if (index.indexOf('unit') < 0 && ((previewType == "hover" && index.indexOf('hover') > 0) || (previewType != "hover" && index.indexOf('hover') < 0))) {
162
  var splitArray = index.split("_"),
163
  newElem = splitArray[0],
164
- unit = loadedArray[index + "_unit"];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  if (splitArray[0] == "submit") {
166
  newElem = "input[type='submit']";
167
  }
@@ -514,13 +556,19 @@ jQuery(document).ready(function($) {
514
  $('.multiple-form-generated-preview').eq($('.multiple-form-generated-preview').length - 1).show();
515
  initialPreview();
516
  addDummyElements();
 
517
  }
518
  }
519
  });
520
  });
521
 
522
  function injectCheckbox() {
523
- $('<label><input type="checkbox" class="transparent-box" name="transparent-box">Transparent</label>').insertAfter('.wp-picker-container');
 
 
 
 
 
524
  $('.transparent-box').each(function() {
525
  var curParent = $(this).parent().parent();
526
  if (curParent.find('.cf7-style-color-field').val() == "transparent") {
@@ -546,23 +594,23 @@ jQuery(document).ready(function($) {
546
  }
547
 
548
  function changeInputStep() {
549
- $('.panel input[type="number"]').each(function() {
550
  var _t = $(this);
551
  _t.attr('step', returnStep(_t.next()));
552
  });
553
  $('.panel select[name*="unit"]').off("change").on("change", function() {
554
  var _t = $(this);
555
  _t.prev().attr('step', returnStep(_t));
556
- if( _t.val() == "px"){
557
- var curVal = Math.floor(_t.prev().val());
558
- _t.prev().val(curVal);
559
- _t.prev().attr('value',curVal);
560
  }
561
  });
562
  }
563
 
564
  var previewEl = $(".generate-preview"),
565
- cf7StylePostType = $(".post-type-cf7_style "),
566
  selectAll = $('#select_all'),
567
  fontSelectVar = $('select[name="cf7_style_font_selector"]'),
568
  sliderWrapper = $('.cf7-style-slider-wrap'),
@@ -597,23 +645,9 @@ jQuery(document).ready(function($) {
597
  autoCompleteOtherValues();
598
  addDummyElements();
599
  var previewForm = $('.preview-form-container').not('.hidden');
600
- if (previewForm.find('label').length < 1) {
601
- $('.button[data-property="label"]').hide();
602
- }
603
- if (previewForm.find('p').length < 1) {
604
- $('.button[data-property="p"]').hide();
605
- }
606
- if (previewForm.find('fieldset').length < 1) {
607
- $('.button[data-property="fieldset"]').hide();
608
- }
609
- if (previewForm.find('select').length < 1) {
610
- $('.button[data-property="select"]').hide();
611
- }
612
- if (previewForm.find('input[type="checkbox"]').length < 1) {
613
- $('.button[data-property="checkbox"]').hide();
614
- }
615
- if (previewForm.find('input[type="radio"]').length < 1) {
616
- $('.button[data-property="radio"]').hide();
617
  }
618
  /*Checkbox for select all the forms*/
619
  selectAllForms(selectAll);
12
  return pattern.test(emailAddress);
13
  }
14
 
15
+ function hideShowBtns(previewForm) {
16
+ if (previewForm.find('label').length < 1) {
17
+ $('.button[data-property="label"]').hide();
18
+ }
19
+ if (previewForm.find('p').length < 1) {
20
+ $('.button[data-property="p"]').hide();
21
+ }
22
+ if (previewForm.find('fieldset').length < 1) {
23
+ $('.button[data-property="fieldset"]').hide();
24
+ }
25
+ if (previewForm.find('select').length < 1) {
26
+ $('.button[data-property="select"]').hide();
27
+ }
28
+ if (previewForm.find('input[type="checkbox"]').length < 1) {
29
+ $('.button[data-property="checkbox"]').hide();
30
+ }
31
+ if (previewForm.find('input[type="radio"]').length < 1) {
32
+ $('.button[data-property="radio"]').hide();
33
+ }
34
+ }
35
+
36
  /* Validation border color */
37
 
38
  function validateInput(elem, result) {
108
 
109
  $('.cf7style-status-info').on('click', function(e) {
110
  e.preventDefault();
 
111
  $('.cf7style-status-table').toggle();
112
 
113
  });
177
  if (hiddenInputData.length > 0) {
178
  var loadedData = $('input[name="cf7styleallvalues"]').val(),
179
  loadedArray = $.parseJSON(loadedData.replace(/'/g, '"'));
180
+ $('.place-style').remove();
181
  $.each(loadedArray, function(index, value) {
182
  if (index.indexOf('unit') < 0 && ((previewType == "hover" && index.indexOf('hover') > 0) || (previewType != "hover" && index.indexOf('hover') < 0))) {
183
  var splitArray = index.split("_"),
184
  newElem = splitArray[0],
185
+ unit = (previewType == "hover" && index.indexOf('hover') > 0) ? loadedArray[index.replace('hover', '') + "unit_hover"] : loadedArray[index + "_unit"];
186
+ if (splitArray[0] == "placeholder" && value != '') {
187
+ unit = (typeof unit == 'undefined' || value == "") ? "" : unit;
188
+ var newValue = value + unit;
189
+ var $style = $('<style>').attr('class', 'place-style');
190
+ $style.text(
191
+ '.preview-form-container ::-webkit-input-placeholder { ' +
192
+ splitArray[1] + ': ' + newValue + ';' +
193
+ '}' +
194
+ '.preview-form-container ::-moz-placeholder { ' +
195
+ splitArray[1] + ': ' + newValue + ';' +
196
+ '}' +
197
+ '.preview-form-container :-ms-input-placeholder { ' +
198
+ splitArray[1] + ': ' + newValue + ';' +
199
+ '}' +
200
+ '.preview-form-container :-moz-placeholder { ' +
201
+ splitArray[1] + ': ' + newValue + ';' +
202
+ '}');
203
+ $style.appendTo('head');
204
+ return;
205
+ }
206
+
207
  if (splitArray[0] == "submit") {
208
  newElem = "input[type='submit']";
209
  }
556
  $('.multiple-form-generated-preview').eq($('.multiple-form-generated-preview').length - 1).show();
557
  initialPreview();
558
  addDummyElements();
559
+ hideShowBtns($('.preview-form-container form:visible'));
560
  }
561
  }
562
  });
563
  });
564
 
565
  function injectCheckbox() {
566
+
567
+ $('.wp-picker-container').each(function() {
568
+ if ($(this).parent().find('label[for*="_color"]').length < 1) {
569
+ $('<label><input type="checkbox" class="transparent-box" name="transparent-box">Transparent</label>').insertAfter($(this));
570
+ }
571
+ });
572
  $('.transparent-box').each(function() {
573
  var curParent = $(this).parent().parent();
574
  if (curParent.find('.cf7-style-color-field').val() == "transparent") {
594
  }
595
 
596
  function changeInputStep() {
597
+ $('.panel input[type="number"]:not([id*="opacity"])').each(function() {
598
  var _t = $(this);
599
  _t.attr('step', returnStep(_t.next()));
600
  });
601
  $('.panel select[name*="unit"]').off("change").on("change", function() {
602
  var _t = $(this);
603
  _t.prev().attr('step', returnStep(_t));
604
+ if (_t.val() == "px") {
605
+ var curVal = Math.floor(_t.prev().val());
606
+ _t.prev().val(curVal);
607
+ _t.prev().attr('value', curVal);
608
  }
609
  });
610
  }
611
 
612
  var previewEl = $(".generate-preview"),
613
+ cf7StylePostType = $(".post-type-cf7_style"),
614
  selectAll = $('#select_all'),
615
  fontSelectVar = $('select[name="cf7_style_font_selector"]'),
616
  sliderWrapper = $('.cf7-style-slider-wrap'),
645
  autoCompleteOtherValues();
646
  addDummyElements();
647
  var previewForm = $('.preview-form-container').not('.hidden');
648
+ /*Hide settings which are not present in the current selected form*/
649
+ if( $('.post-new-php').length < 1 ){
650
+ hideShowBtns(previewForm);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
651
  }
652
  /*Checkbox for select all the forms*/
653
  selectAllForms(selectAll);
admin/js/codemirror.js CHANGED
@@ -1,5 +1,5 @@
1
- !function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define([],e);this.CodeMirror=e()}}(function(){"use strict";function e(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n?Wi(n):{},Wi(Ko,n,!1),d(n);var i=n.value;"string"==typeof i&&(i=new pl(i,n.mode)),this.doc=i;var o=new e.inputStyles[n.inputStyle](this),l=this.display=new t(r,i,o);l.wrapper.CodeMirror=this,u(this),s(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),n.autofocus&&!wo&&l.input.focus(),m(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Ci,keySeq:null};var a=this;uo&&11>co&&setTimeout(function(){a.display.input.reset(!0)},20),Rt(this),Ui(),mt(this),this.curOp.forceUpdate=!0,Vn(this,i),n.autofocus&&!wo||a.hasFocus()?setTimeout(Oi(ur,this),20):cr(this);for(var c in jo)jo.hasOwnProperty(c)&&jo[c](this,n[c],Xo);C(this),n.finishInit&&n.finishInit(this);for(var f=0;f<qo.length;++f)qo[f](this);bt(this),fo&&n.lineWrapping&&"optimizelegibility"==getComputedStyle(l.lineDiv).textRendering&&(l.lineDiv.style.textRendering="auto")}function t(e,t,r){var n=this;this.input=r,n.scrollbarFiller=Pi("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=Pi("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=Pi("div",null,"CodeMirror-code"),n.selectionDiv=Pi("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=Pi("div",null,"CodeMirror-cursors"),n.measure=Pi("div",null,"CodeMirror-measure"),n.lineMeasure=Pi("div",null,"CodeMirror-measure"),n.lineSpace=Pi("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none"),n.mover=Pi("div",[Pi("div",[n.lineSpace],"CodeMirror-lines")],null,"position: relative"),n.sizer=Pi("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=Pi("div",null,null,"position: absolute; height: "+Ll+"px; width: 1px;"),n.gutters=Pi("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=Pi("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=Pi("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),uo&&8>co&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),fo||lo&&wo||(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,r.init(n)}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),n(t)}function n(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,ze(e,100),e.state.modeGen++,e.curOp&&Dt(e)}function i(e){e.options.lineWrapping?(Bl(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Rl(e.display.wrapper,"CodeMirror-wrap"),h(e)),l(e),Dt(e),it(e),setTimeout(function(){y(e)},100)}function o(e){var t=gt(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/vt(e.display)-3);return function(i){if(gn(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l<i.widgets.length;l++)i.widgets[l].height&&(o+=i.widgets[l].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function l(e){var t=e.doc,r=o(e);t.iter(function(e){var t=r(e);t!=e.height&&_n(e,t)})}function s(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),it(e)}function a(e){u(e),Dt(e),setTimeout(function(){x(e)},20)}function u(e){var t=e.display.gutters,r=e.options.gutters;zi(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(Pi("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none",c(e)}function c(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function f(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=an(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=un(n);){var i=t.find(0,!0);r-=n.text.length-i.from.ch,n=i.to.line,r+=n.text.length-i.to.ch}return r}function h(e){var t=e.display,r=e.doc;t.maxLine=Kn(r,r.first),t.maxLineLength=f(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=f(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function d(e){var t=Ti(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function p(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Ge(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Ve(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function g(e,t,r){this.cm=r;var n=this.vert=Pi("div",[Pi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=Pi("div",[Pi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),wl(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),wl(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedOverlay=!1,uo&&8>co&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function v(){}function m(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Rl(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),wl(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,r){"horizontal"==r?Qt(t,e):Zt(t,e)},t),t.display.scrollbars.addClass&&Bl(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=p(e));var r=e.display.barWidth,n=e.display.barHeight;b(e,t);for(var i=0;4>i&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&O(e),b(e,p(e)),r=e.display.barWidth,n=e.display.barHeight}function b(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}function w(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Be(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=$n(t,n),l=$n(t,i);if(r&&r.ensure){var s=r.ensure.from.line,a=r.ensure.to.line;o>s?(o=s,l=$n(t,qn(Kn(t,s))+e.wrapper.clientHeight)):Math.min(a,t.lastLine())>=l&&(o=$n(t,qn(Kn(t,a))-e.wrapper.clientHeight),l=a)}return{from:o,to:Math.max(l,o+1)}}function x(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=L(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",l=0;l<r.length;l++)if(!r[l].hidden){e.options.fixedGutter&&r[l].gutter&&(r[l].gutter.style.left=o);var s=r[l].alignable;if(s)for(var a=0;a<s.length;a++)s[a].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function C(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=S(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(Pi("div",[Pi("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,l=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-l),n.lineNumWidth=n.lineNumInnerWidth+l,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",c(e),!0}return!1}function S(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function L(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function k(e,t,r){var n=e.display;this.viewport=t,this.visible=w(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Ke(e),this.force=r,this.dims=H(e),this.events=[]}function T(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Ve(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ve(e)+"px",t.scrollbarsClipped=!0)}function M(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return It(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Ft(e))return!1;C(e)&&(It(e),t.dims=H(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>l&&r.viewTo-l<20&&(l=Math.min(i,r.viewTo)),Mo&&(o=dn(e.doc,o),l=pn(e.doc,l));var s=o!=r.viewFrom||l!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Et(e,o,l),r.viewOffset=qn(Kn(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var a=Ft(e);if(!s&&0==a&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var u=Fi();return a>4&&(r.lineDiv.style.display="none"),I(e,r.updateLineNumbers,t.dims),a>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,u&&Fi()!=u&&u.offsetHeight&&u.focus(),zi(r.cursorDiv),zi(r.selectionDiv),r.gutters.style.height=0,s&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,ze(e,400)),r.updateLineNumbers=null,!0}function N(e,t){for(var r=t.force,n=t.viewport,i=!0;;i=!1){if(i&&e.options.lineWrapping&&t.oldDisplayWidth!=Ke(e))r=!0;else if(r=!1,n&&null!=n.top&&(n={top:Math.min(e.doc.height+Ge(e.display)-je(e),n.top)}),t.visible=w(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!M(e,t))break;O(e);var o=p(e);Oe(e),W(e,o),y(e,o)}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function A(e,t){var r=new k(e,t);if(M(e,r)){O(e),N(e,r);var n=p(e);Oe(e),W(e,n),y(e,n),r.finish()}}function W(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var r=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=r+"px",e.display.gutters.style.height=Math.max(r+Ve(e),t.clientHeight)+"px"}function O(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i,o=t.view[n];if(!o.hidden){if(uo&&8>co){var l=o.node.offsetTop+o.node.offsetHeight;i=l-r,r=l}else{var s=o.node.getBoundingClientRect();i=s.bottom-s.top}var a=o.line.height-i;if(2>i&&(i=gt(t)),(a>.001||-.001>a)&&(_n(o.line,i),D(o.line),o.rest))for(var u=0;u<o.rest.length;u++)D(o.rest[u])}}}function D(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.offsetHeight}function H(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l)r[e.options.gutters[l]]=o.offsetLeft+o.clientLeft+i,n[e.options.gutters[l]]=o.clientWidth;return{fixedPos:L(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function I(e,t,r){function n(t){var r=t.nextSibling;return fo&&xo&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var i=e.display,o=e.options.lineNumbers,l=i.lineDiv,s=l.firstChild,a=i.view,u=i.viewFrom,c=0;c<a.length;c++){var f=a[c];if(f.hidden);else if(f.node&&f.node.parentNode==l){for(;s!=f.node;)s=n(s);var h=o&&null!=t&&u>=t&&f.lineNumber;f.changes&&(Ti(f.changes,"gutter")>-1&&(h=!1),P(e,f,u,r)),h&&(zi(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(S(e.options,u)))),s=f.node.nextSibling}else{var d=V(e,f,u,r);l.insertBefore(d,s)}u+=f.size}for(;s;)s=n(s)}function P(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?R(e,t):"gutter"==o?G(e,t,r,n):"class"==o?B(t):"widget"==o&&U(e,t,n)}t.changes=null}function z(e){return e.node==e.text&&(e.node=Pi("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),uo&&8>co&&(e.node.style.zIndex=2)),e.node}function E(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var r=z(e);e.background=r.insertBefore(Pi("div",null,t),r.firstChild)}}function F(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):On(e,t)}function R(e,t){var r=t.text.className,n=F(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,B(t)):r&&(t.text.className=r)}function B(e){E(e),e.line.wrapClass?z(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function G(e,t,r,n){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null);var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var o=z(t),l=t.gutter=Pi("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px");if(e.display.input.setUneditable(l),o.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),!e.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(t.lineNumber=l.appendChild(Pi("div",S(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),i)for(var s=0;s<e.options.gutters.length;++s){var a=e.options.gutters[s],u=i.hasOwnProperty(a)&&i[a];u&&l.appendChild(Pi("div",[u],"CodeMirror-gutter-elt","left: "+n.gutterLeft[a]+"px; width: "+n.gutterWidth[a]+"px"))}}}function U(e,t,r){t.alignable&&(t.alignable=null);for(var n,i=t.node.firstChild;i;i=n){var n=i.nextSibling;"CodeMirror-linewidget"==i.className&&t.node.removeChild(i)}K(e,t,r)}function V(e,t,r,n){var i=F(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),B(t),G(e,t,r,n),K(e,t,n),t.node}function K(e,t,r){if(j(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)j(e,t.rest[n],t,r,!1)}function j(e,t,r,n,i){if(t.widgets)for(var o=z(r),l=0,s=t.widgets;l<s.length;++l){var a=s[l],u=Pi("div",[a.node],"CodeMirror-linewidget");a.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),X(a,u,r,n),e.display.input.setUneditable(u),i&&a.above?o.insertBefore(u,r.gutter||r.text):o.appendChild(u),vi(a,"redraw")}}function X(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function _(e){return No(e.line,e.ch)}function Y(e,t){return Ao(e,t)<0?t:e}function $(e,t){return Ao(e,t)<0?e:t}function q(e){e.state.focused||(e.display.input.focus(),ur(e))}function Z(e){return e.options.readOnly||e.doc.cantEdit}function Q(e,t,r,n){var i=e.doc;e.display.shift=!1,n||(n=i.sel);var o=Vl(t),l=null;e.state.pasteIncoming&&n.ranges.length>1&&(Wo&&Wo.join("\n")==t?l=n.ranges.length%Wo.length==0&&Mi(Wo,Vl):o.length==n.ranges.length&&(l=Mi(o,function(e){return[e]})));for(var s=n.ranges.length-1;s>=0;s--){var a=n.ranges[s],u=a.from(),c=a.to();a.empty()&&(r&&r>0?u=No(u.line,u.ch-r):e.state.overwrite&&!e.state.pasteIncoming&&(c=No(c.line,Math.min(Kn(i,c.line).text.length,c.ch+ki(o).length))));var f=e.curOp.updateInput,h={from:u,to:c,text:l?l[s%l.length]:o,origin:e.state.pasteIncoming?"paste":e.state.cutIncoming?"cut":"+input"};if(yr(e.doc,h),vi(e,"inputRead",e,h),t&&!e.state.pasteIncoming&&e.options.electricChars&&e.options.smartIndent&&a.head.ch<100&&(!s||n.ranges[s-1].head.line!=a.head.line)){var d=e.getModeAt(a.head),p=Vo(h);if(d.electricChars){for(var g=0;g<d.electricChars.length;g++)if(t.indexOf(d.electricChars.charAt(g))>-1){Dr(e,p.line,"smart");break}}else d.electricInput&&d.electricInput.test(Kn(i,p.line).text.slice(0,p.ch))&&Dr(e,p.line,"smart")}}Wr(e),e.curOp.updateInput=f,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function J(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:No(i,0),head:No(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function ee(e){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false")}function te(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Ci,this.inaccurateSelection=!1,this.hasSelection=!1}function re(){var e=Pi("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none"),t=Pi("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return fo?e.style.width="1000px":e.setAttribute("wrap","off"),bo&&(e.style.border="1px solid black"),ee(e),t}function ne(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Ci}function ie(e,t){var r=qe(e,t.line);if(!r||r.hidden)return null;var n=Kn(e.doc,t.line),i=_e(r,n,t.line),o=Zn(n),l="left";if(o){var s=ro(o,t.ch);l=s%2?"right":"left"}var a=Je(i.map,t.ch,"left");return a.offset="right"==a.collapse?a.end:a.start,a}function oe(e,t){return t&&(e.bad=!0),e}function le(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return oe(e.clipPos(No(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return se(o,t,r)}}function se(e,t,r){function n(t,r,n){for(var i=-1;i<(c?c.length:0);i++)for(var o=0>i?u.map:c[i],l=0;l<o.length;l+=3){var s=o[l+2];if(s==t||s==r){var a=Yn(0>i?e.line:e.rest[i]),f=o[l]+n;return(0>n||s!=t)&&(f=o[l+(n?1:0)]),No(a,f)}}}var i=e.text.firstChild,o=!1;if(!t||!zl(i,t))return oe(No(Yn(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[r],r=0,!t)){var l=e.rest?ki(e.rest):e.line;return oe(No(Yn(l),l.text.length),o)}var s=3==t.nodeType?t:null,a=t;for(s||1!=t.childNodes.length||3!=t.firstChild.nodeType||(s=t.firstChild,r&&(r=s.nodeValue.length));a.parentNode!=i;)a=a.parentNode;var u=e.measure,c=u.maps,f=n(s,a,r);if(f)return oe(f,o);for(var h=a.nextSibling,d=s?s.nodeValue.length-r:0;h;h=h.nextSibling){if(f=n(h,h.firstChild,0))return oe(No(f.line,f.ch-d),o);d+=h.textContent.length}for(var p=a.previousSibling,d=r;p;p=p.previousSibling){if(f=n(p,p.firstChild,-1))return oe(No(f.line,f.ch+d),o);d+=h.textContent.length}}function ae(e,t,r,n,i){function o(e){return function(t){return t.id==e}}function l(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return""==r&&(r=t.textContent.replace(/\u200b/g,"")),void(s+=r);var u,c=t.getAttribute("cm-marker");if(c){var f=e.findMarks(No(n,0),No(i+1,0),o(+c));return void(f.length&&(u=f[0].find())&&(s+=jn(e.doc,u.from,u.to).join("\n")))}if("false"==t.getAttribute("contenteditable"))return;for(var h=0;h<t.childNodes.length;h++)l(t.childNodes[h]);/^(pre|div|p)$/i.test(t.nodeName)&&(a=!0)}else if(3==t.nodeType){var d=t.nodeValue;if(!d)return;a&&(s+="\n",a=!1),s+=d}}for(var s="",a=!1;l(t),t!=r;)t=t.nextSibling;return s}function ue(e,t){this.ranges=e,this.primIndex=t}function ce(e,t){this.anchor=e,this.head=t}function fe(e,t){var r=e[t];e.sort(function(e,t){return Ao(e.from(),t.from())}),t=Ti(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(Ao(o.to(),i.from())>=0){var l=$(o.from(),i.from()),s=Y(o.to(),i.to()),a=o.empty()?i.from()==i.head:o.from()==o.head;t>=n&&--t,e.splice(--n,2,new ce(a?s:l,a?l:s))}}return new ue(e,t)}function he(e,t){return new ue([new ce(e,t||e)],0)}function de(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function pe(e,t){if(t.line<e.first)return No(e.first,0);var r=e.first+e.size-1;return t.line>r?No(r,Kn(e,r).text.length):ge(t,Kn(e,t.line).text.length)}function ge(e,t){var r=e.ch;return null==r||r>t?No(e.line,t):0>r?No(e.line,0):e}function ve(e,t){return t>=e.first&&t<e.first+e.size}function me(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=pe(e,t[n]);return r}function ye(e,t,r,n){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(n){var o=Ao(r,i)<0;o!=Ao(n,i)<0?(i=r,r=n):o!=Ao(r,n)<0&&(r=n)}return new ce(i,r)}return new ce(n||r,r)}function be(e,t,r,n){ke(e,new ue([ye(e,e.sel.primary(),t,r)],0),n)}function we(e,t,r){for(var n=[],i=0;i<e.sel.ranges.length;i++)n[i]=ye(e,e.sel.ranges[i],t[i],null);var o=fe(n,e.sel.primIndex);ke(e,o,r)}function xe(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,ke(e,fe(i,e.sel.primIndex),n)}function Ce(e,t,r,n){ke(e,he(t,r),n)}function Se(e,t){var r={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new ce(pe(e,t[r].anchor),pe(e,t[r].head))}};return Cl(e,"beforeSelectionChange",e,r),e.cm&&Cl(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?fe(r.ranges,r.ranges.length-1):t}function Le(e,t,r){var n=e.history.done,i=ki(n);i&&i.ranges?(n[n.length-1]=t,Te(e,t,r)):ke(e,t,r)}function ke(e,t,r){Te(e,t,r),ii(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Te(e,t,r){(wi(e,"beforeSelectionChange")||e.cm&&wi(e.cm,"beforeSelectionChange"))&&(t=Se(e,t));var n=r&&r.bias||(Ao(t.primary().head,e.sel.primary().head)<0?-1:1);Me(e,Ae(e,t,n,!0)),r&&r.scroll===!1||!e.cm||Wr(e.cm)}function Me(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,bi(e.cm)),vi(e,"cursorActivity",e))}function Ne(e){Me(e,Ae(e,e.sel,null,!1),Tl)}function Ae(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var l=t.ranges[o],s=We(e,l.anchor,r,n),a=We(e,l.head,r,n);(i||s!=l.anchor||a!=l.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new ce(s,a))}return i?fe(i,t.primIndex):t}function We(e,t,r,n){var i=!1,o=t,l=r||1;e.cantEdit=!1;e:for(;;){var s=Kn(e,o.line);if(s.markedSpans)for(var a=0;a<s.markedSpans.length;++a){var u=s.markedSpans[a],c=u.marker;if((null==u.from||(c.inclusiveLeft?u.from<=o.ch:u.from<o.ch))&&(null==u.to||(c.inclusiveRight?u.to>=o.ch:u.to>o.ch))){if(n&&(Cl(c,"beforeCursorEnter"),c.explicitlyCleared)){if(s.markedSpans){--a;continue}break}if(!c.atomic)continue;var f=c.find(0>l?-1:1);if(0==Ao(f,o)&&(f.ch+=l,f.ch<0?f=f.line>e.first?pe(e,No(f.line-1)):null:f.ch>s.text.length&&(f=f.line<e.first+e.size-1?No(f.line+1,0):null),!f)){if(i)return n?(e.cantEdit=!0,No(e.first,0)):We(e,t,r,!0);i=!0,f=t,l=-l}o=f;continue e}}return o}}function Oe(e){e.display.input.showSelection(e.display.input.prepareSelection())}function De(e,t){for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),l=0;l<r.sel.ranges.length;l++)if(t!==!1||l!=r.sel.primIndex){var s=r.sel.ranges[l],a=s.empty();(a||e.options.showCursorWhenSelecting)&&He(e,s,i),a||Ie(e,s,o)}return n}function He(e,t,r){var n=ct(e,t.head,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(Pi("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(Pi("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function Ie(e,t,r){function n(e,t,r,n){0>t&&(t=0),t=Math.round(t),n=Math.round(n),s.appendChild(Pi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?c-e:r)+"px; height: "+(n-t)+"px"))}function i(t,r,i){function o(r,n){return ut(e,No(t,r),"div",f,n)}var s,a,f=Kn(l,t),h=f.text.length;return _i(Zn(f),r||0,null==i?h:i,function(e,t,l){var f,d,p,g=o(e,"left");if(e==t)f=g,d=p=g.left;else{if(f=o(t-1,"right"),"rtl"==l){var v=g;g=f,f=v}d=g.left,p=f.right}null==r&&0==e&&(d=u),f.top-g.top>3&&(n(d,g.top,null,g.bottom),d=u,g.bottom<f.top&&n(d,g.bottom,null,f.top)),null==i&&t==h&&(p=c),(!s||g.top<s.top||g.top==s.top&&g.left<s.left)&&(s=g),(!a||f.bottom>a.bottom||f.bottom==a.bottom&&f.right>a.right)&&(a=f),u+1>d&&(d=u),n(d,f.top,p-d,f.bottom)}),{start:s,end:a}}var o=e.display,l=e.doc,s=document.createDocumentFragment(),a=Ue(e.display),u=a.left,c=Math.max(o.sizerWidth,Ke(e)-o.sizer.offsetLeft)-a.right,f=t.from(),h=t.to();if(f.line==h.line)i(f.line,f.ch,h.ch);else{var d=Kn(l,f.line),p=Kn(l,h.line),g=fn(d)==fn(p),v=i(f.line,f.ch,g?d.text.length+1:null).end,m=i(h.line,g?0:null,h.ch).start;g&&(v.top<m.top-2?(n(v.right,v.top,null,v.bottom),n(u,m.top,m.left,m.bottom)):n(v.right,v.top,m.left-v.right,v.bottom)),v.bottom<m.top&&n(u,v.bottom,null,m.top)}r.appendChild(s)}function Pe(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function ze(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,Oi(Ee,e))}function Ee(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=Qo(t.mode,Re(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var l=o.styles,s=Mn(e,o,n,!0);o.styles=s.styles;var a=o.styleClasses,u=s.classes;u?o.styleClasses=u:a&&(o.styleClasses=null);for(var c=!l||l.length!=o.styles.length||a!=u&&(!a||!u||a.bgClass!=u.bgClass||a.textClass!=u.textClass),f=0;!c&&f<l.length;++f)c=l[f]!=o.styles[f];c&&i.push(t.frontier),o.stateAfter=Qo(t.mode,n)}else An(e,o.text,n),o.stateAfter=t.frontier%5==0?Qo(t.mode,n):null;return++t.frontier,+new Date>r?(ze(e,e.options.workDelay),!0):void 0}),i.length&&Tt(e,function(){for(var t=0;t<i.length;t++)Ht(e,i[t],"text")})}}function Fe(e,t,r){for(var n,i,o=e.doc,l=r?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;s>l;--s){if(s<=o.first)return o.first;var a=Kn(o,s-1);if(a.stateAfter&&(!r||s<=o.frontier))return s;var u=Al(a.text,null,e.options.tabSize);(null==i||n>u)&&(i=s-1,n=u)}return i}function Re(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=Fe(e,t,r),l=o>n.first&&Kn(n,o-1).stateAfter;return l=l?Qo(n.mode,l):Jo(n.mode),n.iter(o,t,function(r){An(e,r.text,l);var s=o==t-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;r.stateAfter=s?Qo(n.mode,l):null,++o}),r&&(n.frontier=o),l}function Be(e){return e.lineSpace.offsetTop}function Ge(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Ue(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Ei(e.measure,Pi("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function Ve(e){return Ll-e.display.nativeBarWidth}function Ke(e){return e.display.scroller.clientWidth-Ve(e)-e.display.barWidth}function je(e){return e.display.scroller.clientHeight-Ve(e)-e.display.barHeight}function Xe(e,t,r){var n=e.options.lineWrapping,i=n&&Ke(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var l=t.text.firstChild.getClientRects(),s=0;s<l.length-1;s++){var a=l[s],u=l[s+1];Math.abs(a.bottom-u.bottom)>2&&o.push((a.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}function _e(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var n=0;n<e.rest.length;n++)if(Yn(e.rest[n])>r)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Ye(e,t){t=fn(t);var r=Yn(t),n=e.display.externalMeasured=new Wt(e.doc,t,r);n.lineN=r;var i=n.built=On(e,n);return n.text=i.pre,Ei(e.display.lineMeasure,i.pre),n}function $e(e,t,r,n){return Qe(e,Ze(e,t),r,n)}function qe(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Pt(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Ze(e,t){var r=Yn(t),n=qe(e,r);n&&!n.text?n=null:n&&n.changes&&P(e,n,r,H(e)),n||(n=Ye(e,t));var i=_e(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Qe(e,t,r,n,i){t.before&&(r=-1);var o,l=r+(n||"");return t.cache.hasOwnProperty(l)?o=t.cache[l]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Xe(e,t.view,t.rect),t.hasHeights=!0),o=et(e,t,r,n),o.bogus||(t.cache[l]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function Je(e,t,r){for(var n,i,o,l,s=0;s<e.length;s+=3){var a=e[s],u=e[s+1];if(a>t?(i=0,o=1,l="left"):u>t?(i=t-a,o=i+1):(s==e.length-3||t==u&&e[s+3]>t)&&(o=u-a,i=o-1,t>=u&&(l="right")),null!=i){if(n=e[s+2],a==u&&r==(n.insertLeft?"left":"right")&&(l=r),"left"==r&&0==i)for(;s&&e[s-2]==e[s-3]&&e[s-1].insertLeft;)n=e[(s-=3)+2],l="left";if("right"==r&&i==u-a)for(;s<e.length-3&&e[s+3]==e[s+4]&&!e[s+5].insertLeft;)n=e[(s+=3)+2],l="right";break}}return{node:n,start:i,end:o,collapse:l,coverStart:a,coverEnd:u}}function et(e,t,r,n){var i,o=Je(t.map,r,n),l=o.node,s=o.start,a=o.end,u=o.collapse;if(3==l.nodeType){for(var c=0;4>c;c++){for(;s&&Ii(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+a<o.coverEnd&&Ii(t.line.text.charAt(o.coverStart+a));)++a;if(uo&&9>co&&0==s&&a==o.coverEnd-o.coverStart)i=l.parentNode.getBoundingClientRect();else if(uo&&e.options.lineWrapping){var f=Dl(l,s,a).getClientRects();i=f.length?f["right"==n?f.length-1:0]:Io}else i=Dl(l,s,a).getBoundingClientRect()||Io;if(i.left||i.right||0==s)break;a=s,s-=1,u="right"}uo&&11>co&&(i=tt(e.display.measure,i))}else{s>0&&(u=n="right");var f;i=e.options.lineWrapping&&(f=l.getClientRects()).length>1?f["right"==n?f.length-1:0]:l.getBoundingClientRect()}if(uo&&9>co&&!s&&(!i||!i.left&&!i.right)){var h=l.parentNode.getClientRects()[0];i=h?{left:h.left,right:h.left+vt(e.display),top:h.top,bottom:h.bottom}:Io}for(var d=i.top-t.rect.top,p=i.bottom-t.rect.top,g=(d+p)/2,v=t.view.measure.heights,c=0;c<v.length-1&&!(g<v[c]);c++);var m=c?v[c-1]:0,y=v[c],b={left:("right"==u?i.right:i.left)-t.rect.left,right:("left"==u?i.left:i.right)-t.rect.left,top:m,bottom:y};return i.left||i.right||(b.bogus=!0),e.options.singleCursorHeightPerLine||(b.rtop=d,
2
- b.rbottom=p),b}function tt(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Xi(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function rt(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function nt(e){e.display.externalMeasure=null,zi(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)rt(e.display.view[t])}function it(e){nt(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ot(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function lt(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function st(e,t,r,n){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=yn(t.widgets[i]);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var l=qn(t);if("local"==n?l+=Be(e.display):l-=e.display.viewOffset,"page"==n||"window"==n){var s=e.display.lineSpace.getBoundingClientRect();l+=s.top+("window"==n?0:lt());var a=s.left+("window"==n?0:ot());r.left+=a,r.right+=a}return r.top+=l,r.bottom+=l,r}function at(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=ot(),i-=lt();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:n-l.left,top:i-l.top}}function ut(e,t,r,n,i){return n||(n=Kn(e.doc,t.line)),st(e,n,$e(e,n,t.ch,i),r)}function ct(e,t,r,n,i,o){function l(t,l){var s=Qe(e,i,t,l?"right":"left",o);return l?s.left=s.right:s.right=s.left,st(e,n,s,r)}function s(e,t){var r=a[t],n=r.level%2;return e==Yi(r)&&t&&r.level<a[t-1].level?(r=a[--t],e=$i(r)-(r.level%2?0:1),n=!0):e==$i(r)&&t<a.length-1&&r.level<a[t+1].level&&(r=a[++t],e=Yi(r)-r.level%2,n=!1),n&&e==r.to&&e>r.from?l(e-1):l(e,n)}n=n||Kn(e.doc,t.line),i||(i=Ze(e,n));var a=Zn(n),u=t.ch;if(!a)return l(u);var c=ro(a,u),f=s(u,c);return null!=Yl&&(f.other=s(u,Yl)),f}function ft(e,t){var r=0,t=pe(e.doc,t);e.options.lineWrapping||(r=vt(e.display)*t.ch);var n=Kn(e.doc,t.line),i=qn(n)+Be(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function ht(e,t,r,n){var i=No(e,t);return i.xRel=n,r&&(i.outside=!0),i}function dt(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,0>r)return ht(n.first,0,!0,-1);var i=$n(n,r),o=n.first+n.size-1;if(i>o)return ht(n.first+n.size-1,Kn(n,o).text.length,!0,1);0>t&&(t=0);for(var l=Kn(n,i);;){var s=pt(e,l,i,t,r),a=un(l),u=a&&a.find(0,!0);if(!a||!(s.ch>u.from.ch||s.ch==u.from.ch&&s.xRel>0))return s;i=Yn(l=u.to.line)}}function pt(e,t,r,n,i){function o(n){var i=ct(e,No(r,n),"line",t,u);return s=!0,l>i.bottom?i.left-a:l<i.top?i.left+a:(s=!1,i.left)}var l=i-qn(t),s=!1,a=2*e.display.wrapper.clientWidth,u=Ze(e,t),c=Zn(t),f=t.text.length,h=qi(t),d=Zi(t),p=o(h),g=s,v=o(d),m=s;if(n>v)return ht(r,d,m,1);for(;;){if(c?d==h||d==io(t,h,1):1>=d-h){for(var y=p>n||v-n>=n-p?h:d,b=n-(y==h?p:v);Ii(t.text.charAt(y));)++y;var w=ht(r,y,y==h?g:m,-1>b?-1:b>1?1:0);return w}var x=Math.ceil(f/2),C=h+x;if(c){C=h;for(var S=0;x>S;++S)C=io(t,C,1)}var L=o(C);L>n?(d=C,v=L,(m=s)&&(v+=1e3),f=x):(h=C,p=L,g=s,f-=x)}}function gt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Oo){Oo=Pi("pre");for(var t=0;49>t;++t)Oo.appendChild(document.createTextNode("x")),Oo.appendChild(Pi("br"));Oo.appendChild(document.createTextNode("x"))}Ei(e.measure,Oo);var r=Oo.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),zi(e.measure),r||1}function vt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Pi("span","xxxxxxxxxx"),r=Pi("pre",[t]);Ei(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function mt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++zo},Po?Po.ops.push(e.curOp):e.curOp.ownsGroup=Po={ops:[e.curOp],delayedCallbacks:[]}}function yt(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r]();for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++](i.cm)}}while(r<t.length)}function bt(e){var t=e.curOp,r=t.ownsGroup;if(r)try{yt(r)}finally{Po=null;for(var n=0;n<r.ops.length;n++)r.ops[n].cm.curOp=null;wt(r)}}function wt(e){for(var t=e.ops,r=0;r<t.length;r++)xt(t[r]);for(var r=0;r<t.length;r++)Ct(t[r]);for(var r=0;r<t.length;r++)St(t[r]);for(var r=0;r<t.length;r++)Lt(t[r]);for(var r=0;r<t.length;r++)kt(t[r])}function xt(e){var t=e.cm,r=t.display;T(t),e.updateMaxLine&&h(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new k(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ct(e){e.updatedDisplay=e.mustUpdate&&M(e.cm,e.update)}function St(e){var t=e.cm,r=t.display;e.updatedDisplay&&O(t),e.barMeasure=p(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=$e(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Ve(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Ke(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Lt(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Qt(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1),e.preparedSelection&&t.display.input.showSelection(e.preparedSelection),e.updatedDisplay&&W(t,e.barMeasure),(e.updatedDisplay||e.startHeight!=t.doc.height)&&y(t,e.barMeasure),e.selectionChanged&&Pe(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing)}function kt(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&N(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null==e.scrollTop||r.scroller.scrollTop==e.scrollTop&&!e.forceScroll||(n.scrollTop=Math.max(0,Math.min(r.scroller.scrollHeight-r.scroller.clientHeight,e.scrollTop)),r.scrollbars.setScrollTop(n.scrollTop),r.scroller.scrollTop=n.scrollTop),null==e.scrollLeft||r.scroller.scrollLeft==e.scrollLeft&&!e.forceScroll||(n.scrollLeft=Math.max(0,Math.min(r.scroller.scrollWidth-Ke(t),e.scrollLeft)),r.scrollbars.setScrollLeft(n.scrollLeft),r.scroller.scrollLeft=n.scrollLeft,x(t)),e.scrollToPos){var i=Tr(t,pe(n,e.scrollToPos.from),pe(n,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&kr(t,i)}var o=e.maybeHiddenMarkers,l=e.maybeUnhiddenMarkers;if(o)for(var s=0;s<o.length;++s)o[s].lines.length||Cl(o[s],"hide");if(l)for(var s=0;s<l.length;++s)l[s].lines.length&&Cl(l[s],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Cl(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Tt(e,t){if(e.curOp)return t();mt(e);try{return t()}finally{bt(e)}}function Mt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);mt(e);try{return t.apply(e,arguments)}finally{bt(e)}}}function Nt(e){return function(){if(this.curOp)return e.apply(this,arguments);mt(this);try{return e.apply(this,arguments)}finally{bt(this)}}}function At(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);mt(t);try{return e.apply(this,arguments)}finally{bt(t)}}}function Wt(e,t,r){this.line=t,this.rest=hn(t),this.size=this.rest?Yn(ki(this.rest))-r+1:1,this.node=this.text=null,this.hidden=gn(e,t)}function Ot(e,t,r){for(var n,i=[],o=t;r>o;o=n){var l=new Wt(e.doc,Kn(e.doc,o),o);n=o+l.size,i.push(l)}return i}function Dt(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Mo&&dn(e.doc,t)<i.viewTo&&It(e);else if(r<=i.viewFrom)Mo&&pn(e.doc,r+n)>i.viewFrom?It(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)It(e);else if(t<=i.viewFrom){var o=zt(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):It(e)}else if(r>=i.viewTo){var o=zt(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):It(e)}else{var l=zt(e,t,t,-1),s=zt(e,r,r+n,1);l&&s?(i.view=i.view.slice(0,l.index).concat(Ot(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=n):It(e)}var a=i.externalMeasured;a&&(r<a.lineN?a.lineN+=n:t<a.lineN+a.size&&(i.externalMeasured=null))}function Ht(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[Pt(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==Ti(l,r)&&l.push(r)}}}function It(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Pt(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var r=e.display.view,n=0;n<r.length;n++)if(t-=r[n].size,0>t)return n}function zt(e,t,r,n){var i,o=Pt(e,t),l=e.display.view;if(!Mo||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=0,a=e.display.viewFrom;o>s;s++)a+=l[s].size;if(a!=t){if(n>0){if(o==l.length-1)return null;i=a+l[o].size-t,o++}else i=a-t;t+=i,r+=i}for(;dn(e.doc,r)!=r;){if(o==(0>n?0:l.length-1))return null;r+=n*l[o-(0>n?1:0)].size,o+=n}return{index:o,lineN:r}}function Et(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=Ot(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Ot(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Pt(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(Ot(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,Pt(e,r)))),n.viewTo=r}function Ft(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function Rt(e){function t(){o.activeTouch&&(l=setTimeout(function(){o.activeTouch=null},1e3),s=o.activeTouch,s.end=+new Date)}function r(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function n(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}function i(t){yi(e,t)||bl(t)}var o=e.display;wl(o.scroller,"mousedown",Mt(e,Vt)),uo&&11>co?wl(o.scroller,"dblclick",Mt(e,function(t){if(!yi(e,t)){var r=Ut(e,t);if(r&&!Yt(e,t)&&!Gt(e.display,t)){ml(t);var n=e.findWordAt(r);be(e.doc,n.anchor,n.head)}}})):wl(o.scroller,"dblclick",function(t){yi(e,t)||ml(t)}),ko||wl(o.scroller,"contextmenu",function(t){fr(e,t)});var l,s={end:0};wl(o.scroller,"touchstart",function(e){if(!r(e)){clearTimeout(l);var t=+new Date;o.activeTouch={start:t,moved:!1,prev:t-s.end<=300?s:null},1==e.touches.length&&(o.activeTouch.left=e.touches[0].pageX,o.activeTouch.top=e.touches[0].pageY)}}),wl(o.scroller,"touchmove",function(){o.activeTouch&&(o.activeTouch.moved=!0)}),wl(o.scroller,"touchend",function(r){var i=o.activeTouch;if(i&&!Gt(o,r)&&null!=i.left&&!i.moved&&new Date-i.start<300){var l,s=e.coordsChar(o.activeTouch,"page");l=!i.prev||n(i,i.prev)?new ce(s,s):!i.prev.prev||n(i,i.prev.prev)?e.findWordAt(s):new ce(No(s.line,0),pe(e.doc,No(s.line+1,0))),e.setSelection(l.anchor,l.head),e.focus(),ml(r)}t()}),wl(o.scroller,"touchcancel",t),wl(o.scroller,"scroll",function(){o.scroller.clientHeight&&(Zt(e,o.scroller.scrollTop),Qt(e,o.scroller.scrollLeft,!0),Cl(e,"scroll",e))}),wl(o.scroller,"mousewheel",function(t){Jt(e,t)}),wl(o.scroller,"DOMMouseScroll",function(t){Jt(e,t)}),wl(o.wrapper,"scroll",function(){o.wrapper.scrollTop=o.wrapper.scrollLeft=0}),e.options.dragDrop&&(wl(o.scroller,"dragstart",function(t){qt(e,t)}),wl(o.scroller,"dragenter",i),wl(o.scroller,"dragover",i),wl(o.scroller,"drop",Mt(e,$t)));var a=o.input.getField();wl(a,"keyup",function(t){sr.call(e,t)}),wl(a,"keydown",Mt(e,or)),wl(a,"keypress",Mt(e,ar)),wl(a,"focus",Oi(ur,e)),wl(a,"blur",Oi(cr,e))}function Bt(e){var t=e.display;(t.lastWrapHeight!=t.wrapper.clientHeight||t.lastWrapWidth!=t.wrapper.clientWidth)&&(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Gt(e,t){for(var r=pi(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function Ut(e,t,r,n){var i=e.display;if(!r&&"true"==pi(t).getAttribute("cm-not-content"))return null;var o,l,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,l=t.clientY-s.top}catch(t){return null}var a,u=dt(e,o,l);if(n&&1==u.xRel&&(a=Kn(e.doc,u.line).text).length==u.ch){var c=Al(a,a.length,e.options.tabSize)-a.length;u=No(u.line,Math.max(0,Math.round((o-Ue(e.display).left)/vt(e.display))-c))}return u}function Vt(e){var t=this,r=t.display;if(!(r.activeTouch&&r.input.supportsTouch()||yi(t,e))){if(r.shift=e.shiftKey,Gt(r,e))return void(fo||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!Yt(t,e)){var n=Ut(t,e);switch(window.focus(),gi(e)){case 1:n?Kt(t,e,n):pi(e)==r.scroller&&ml(e);break;case 2:fo&&(t.state.lastMiddleDown=+new Date),n&&be(t.doc,n),setTimeout(function(){r.input.focus()},20),ml(e);break;case 3:ko&&fr(t,e)}}}}function Kt(e,t,r){uo?setTimeout(Oi(q,e),0):q(e);var n,i=+new Date;Ho&&Ho.time>i-400&&0==Ao(Ho.pos,r)?n="triple":Do&&Do.time>i-400&&0==Ao(Do.pos,r)?(n="double",Ho={time:i,pos:r}):(n="single",Do={time:i,pos:r});var o,l=e.doc.sel,s=xo?t.metaKey:t.ctrlKey;e.options.dragDrop&&Ul&&!Z(e)&&"single"==n&&(o=l.contains(r))>-1&&!l.ranges[o].empty()?jt(e,t,r,s):Xt(e,t,r,n,s)}function jt(e,t,r,n){var i=e.display,o=Mt(e,function(l){fo&&(i.scroller.draggable=!1),e.state.draggingText=!1,xl(document,"mouseup",o),xl(i.scroller,"drop",o),Math.abs(t.clientX-l.clientX)+Math.abs(t.clientY-l.clientY)<10&&(ml(l),n||be(e.doc,r),i.input.focus(),uo&&9==co&&setTimeout(function(){document.body.focus(),i.input.focus()},20))});fo&&(i.scroller.draggable=!0),e.state.draggingText=o,i.scroller.dragDrop&&i.scroller.dragDrop(),wl(document,"mouseup",o),wl(i.scroller,"drop",o)}function Xt(e,t,r,n,i){function o(t){if(0!=Ao(v,t))if(v=t,"rect"==n){for(var i=[],o=e.options.tabSize,l=Al(Kn(u,r.line).text,r.ch,o),s=Al(Kn(u,t.line).text,t.ch,o),a=Math.min(l,s),d=Math.max(l,s),p=Math.min(r.line,t.line),g=Math.min(e.lastLine(),Math.max(r.line,t.line));g>=p;p++){var m=Kn(u,p).text,y=Si(m,a,o);a==d?i.push(new ce(No(p,y),No(p,y))):m.length>y&&i.push(new ce(No(p,y),No(p,Si(m,d,o))))}i.length||i.push(new ce(r,r)),ke(u,fe(h.ranges.slice(0,f).concat(i),f),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=c,w=b.anchor,x=t;if("single"!=n){if("double"==n)var C=e.findWordAt(t);else var C=new ce(No(t.line,0),pe(u,No(t.line+1,0)));Ao(C.anchor,w)>0?(x=C.head,w=$(b.from(),C.anchor)):(x=C.anchor,w=Y(b.to(),C.head))}var i=h.ranges.slice(0);i[f]=new ce(pe(u,w),x),ke(u,fe(i,f),Ml)}}function l(t){var r=++y,i=Ut(e,t,!0,"rect"==n);if(i)if(0!=Ao(i,v)){q(e),o(i);var s=w(a,u);(i.line>=s.to||i.line<s.from)&&setTimeout(Mt(e,function(){y==r&&l(t)}),150)}else{var c=t.clientY<m.top?-20:t.clientY>m.bottom?20:0;c&&setTimeout(Mt(e,function(){y==r&&(a.scroller.scrollTop+=c,l(t))}),50)}}function s(e){y=1/0,ml(e),a.input.focus(),xl(document,"mousemove",b),xl(document,"mouseup",x),u.history.lastSelOrigin=null}var a=e.display,u=e.doc;ml(t);var c,f,h=u.sel,d=h.ranges;if(i&&!t.shiftKey?(f=u.sel.contains(r),c=f>-1?d[f]:new ce(r,r)):c=u.sel.primary(),t.altKey)n="rect",i||(c=new ce(r,r)),r=Ut(e,t,!0,!0),f=-1;else if("double"==n){var p=e.findWordAt(r);c=e.display.shift||u.extend?ye(u,c,p.anchor,p.head):p}else if("triple"==n){var g=new ce(No(r.line,0),pe(u,No(r.line+1,0)));c=e.display.shift||u.extend?ye(u,c,g.anchor,g.head):g}else c=ye(u,c,r);i?-1==f?(f=d.length,ke(u,fe(d.concat([c]),f),{scroll:!1,origin:"*mouse"})):d.length>1&&d[f].empty()&&"single"==n?(ke(u,fe(d.slice(0,f).concat(d.slice(f+1)),0)),h=u.sel):xe(u,f,c,Ml):(f=0,ke(u,new ue([c],0),Ml),h=u.sel);var v=r,m=a.wrapper.getBoundingClientRect(),y=0,b=Mt(e,function(e){gi(e)?l(e):s(e)}),x=Mt(e,s);wl(document,"mousemove",b),wl(document,"mouseup",x)}function _t(e,t,r,n,i){try{var o=t.clientX,l=t.clientY}catch(t){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&ml(t);var s=e.display,a=s.lineDiv.getBoundingClientRect();if(l>a.bottom||!wi(e,r))return di(t);l-=a.top-s.viewOffset;for(var u=0;u<e.options.gutters.length;++u){var c=s.gutters.childNodes[u];if(c&&c.getBoundingClientRect().right>=o){var f=$n(e.doc,l),h=e.options.gutters[u];return i(e,r,e,f,h,t),di(t)}}}function Yt(e,t){return _t(e,t,"gutterClick",!0,vi)}function $t(e){var t=this;if(!yi(t,e)&&!Gt(t.display,e)){ml(e),uo&&(Eo=+new Date);var r=Ut(t,e,!0),n=e.dataTransfer.files;if(r&&!Z(t))if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),l=0,s=function(e,n){var s=new FileReader;s.onload=Mt(t,function(){if(o[n]=s.result,++l==i){r=pe(t.doc,r);var e={from:r,to:r,text:Vl(o.join("\n")),origin:"paste"};yr(t.doc,e),Le(t.doc,he(r,Vo(e)))}}),s.readAsText(e)},a=0;i>a;++a)s(n[a],a);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!(xo?e.metaKey:e.ctrlKey))var u=t.listSelections();if(Te(t.doc,he(r,r)),u)for(var a=0;a<u.length;++a)Lr(t.doc,"",u[a].anchor,u[a].head,"drag");t.replaceSelection(o,"around","paste"),t.display.input.focus()}}catch(e){}}}}function qt(e,t){if(uo&&(!e.state.draggingText||+new Date-Eo<100))return void bl(t);if(!yi(e,t)&&!Gt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.setDragImage&&!vo)){var r=Pi("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",go&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),go&&r.parentNode.removeChild(r)}}function Zt(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,lo||A(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbars.setScrollTop(t),lo&&A(e),ze(e,100))}function Qt(e,t,r){(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,x(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Jt(e,t){var r=Bo(t),n=r.x,i=r.y,o=e.display,l=o.scroller;if(n&&l.scrollWidth>l.clientWidth||i&&l.scrollHeight>l.clientHeight){if(i&&xo&&fo)e:for(var s=t.target,a=o.view;s!=l;s=s.parentNode)for(var u=0;u<a.length;u++)if(a[u].node==s){e.display.currentWheelTarget=s;break e}if(n&&!lo&&!go&&null!=Ro)return i&&Zt(e,Math.max(0,Math.min(l.scrollTop+i*Ro,l.scrollHeight-l.clientHeight))),Qt(e,Math.max(0,Math.min(l.scrollLeft+n*Ro,l.scrollWidth-l.clientWidth))),ml(t),void(o.wheelStartX=null);if(i&&null!=Ro){var c=i*Ro,f=e.doc.scrollTop,h=f+o.wrapper.clientHeight;0>c?f=Math.max(0,f+c-50):h=Math.min(e.doc.height,h+c+50),A(e,{top:f,bottom:h})}20>Fo&&(null==o.wheelStartX?(o.wheelStartX=l.scrollLeft,o.wheelStartY=l.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=l.scrollLeft-o.wheelStartX,t=l.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(Ro=(Ro*Fo+r)/(Fo+1),++Fo)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}function er(e,t,r){if("string"==typeof t&&(t=el[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{Z(e)&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=kl}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function tr(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=rl(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&rl(t,e.options.extraKeys,r,e)||rl(t,e.options.keyMap,r,e)}function rr(e,t,r,n){var i=e.state.keySeq;if(i){if(nl(t))return"handled";Go.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),t=i+" "+t}var o=tr(e,t,n);return"multi"==o&&(e.state.keySeq=t),"handled"==o&&vi(e,"keyHandled",e,t,r),("handled"==o||"multi"==o)&&(ml(r),Pe(e)),i&&!o&&/\'$/.test(t)?(ml(r),!0):!!o}function nr(e,t){var r=il(t,!0);return r?t.shiftKey&&!e.state.keySeq?rr(e,"Shift-"+r,t,function(t){return er(e,t,!0)})||rr(e,r,t,function(t){return("string"==typeof t?/^go[A-Z]/.test(t):t.motion)?er(e,t):void 0}):rr(e,r,t,function(t){return er(e,t)}):!1}function ir(e,t,r){return rr(e,"'"+r+"'",t,function(t){return er(e,t,!0)})}function or(e){var t=this;if(q(t),!yi(t,e)){uo&&11>co&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=nr(t,e);go&&(Uo=n?r:null,!n&&88==r&&!jl&&(xo?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||lr(t)}}function lr(e){function t(e){18!=e.keyCode&&e.altKey||(Rl(r,"CodeMirror-crosshair"),xl(document,"keyup",t),xl(document,"mouseover",t))}var r=e.display.lineDiv;Bl(r,"CodeMirror-crosshair"),wl(document,"keyup",t),wl(document,"mouseover",t)}function sr(e){16==e.keyCode&&(this.doc.sel.shift=!1),yi(this,e)}function ar(e){var t=this;if(!(Gt(t.display,e)||yi(t,e)||e.ctrlKey&&!e.altKey||xo&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(go&&r==Uo)return Uo=null,void ml(e);if(!go||e.which&&!(e.which<10)||!nr(t,e)){var i=String.fromCharCode(null==n?r:n);ir(t,e,i)||t.display.input.onKeyPress(e)}}}function ur(e){"nocursor"!=e.options.readOnly&&(e.state.focused||(Cl(e,"focus",e),e.state.focused=!0,Bl(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),fo&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Pe(e))}function cr(e){e.state.focused&&(Cl(e,"blur",e),e.state.focused=!1,Rl(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function fr(e,t){Gt(e.display,t)||hr(e,t)||e.display.input.onContextMenu(t)}function hr(e,t){return wi(e,"gutterContextMenu")?_t(e,t,"gutterContextMenu",!1,Cl):!1}function dr(e,t){if(Ao(e,t.from)<0)return e;if(Ao(e,t.to)<=0)return Vo(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Vo(t).ch-t.to.ch),No(r,n)}function pr(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new ce(dr(i.anchor,t),dr(i.head,t)))}return fe(r,e.sel.primIndex)}function gr(e,t,r){return e.line==t.line?No(r.line,e.ch-t.ch+r.ch):No(r.line+(e.line-t.line),e.ch)}function vr(e,t,r){for(var n=[],i=No(e.first,0),o=i,l=0;l<t.length;l++){var s=t[l],a=gr(s.from,i,o),u=gr(Vo(s),i,o);if(i=s.to,o=u,"around"==r){var c=e.sel.ranges[l],f=Ao(c.head,c.anchor)<0;n[l]=new ce(f?u:a,f?a:u)}else n[l]=new ce(a,a)}return new ue(n,e.sel.primIndex)}function mr(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return r&&(n.update=function(t,r,n,i){t&&(this.from=pe(e,t)),r&&(this.to=pe(e,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),Cl(e,"beforeChange",e,n),e.cm&&Cl(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function yr(e,t,r){if(e.cm){if(!e.cm.curOp)return Mt(e.cm,yr)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(wi(e,"beforeChange")||e.cm&&wi(e.cm,"beforeChange"))||(t=mr(e,t,!0))){var n=To&&!r&&en(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)br(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else br(e,t)}}function br(e,t){if(1!=t.text.length||""!=t.text[0]||0!=Ao(t.from,t.to)){var r=pr(e,t);ri(e,t,r,e.cm?e.cm.curOp.id:NaN),Cr(e,t,r,Zr(e,t));var n=[];Un(e,function(e,r){r||-1!=Ti(n,e.history)||(hi(e.history,t),n.push(e.history)),Cr(e,t,null,Zr(e,t))})}}function wr(e,t,r){if(!e.cm||!e.cm.state.suppressEdits){for(var n,i=e.history,o=e.sel,l="undo"==t?i.done:i.undone,s="undo"==t?i.undone:i.done,a=0;a<l.length&&(n=l[a],r?!n.ranges||n.equals(e.sel):n.ranges);a++);if(a!=l.length){for(i.lastOrigin=i.lastSelOrigin=null;n=l.pop(),n.ranges;){if(oi(n,s),r&&!n.equals(e.sel))return void ke(e,n,{clearRedo:!1});o=n}var u=[];oi(o,s),s.push({changes:u,generation:i.generation}),i.generation=n.generation||++i.maxGeneration;for(var c=wi(e,"beforeChange")||e.cm&&wi(e.cm,"beforeChange"),a=n.changes.length-1;a>=0;--a){var f=n.changes[a];if(f.origin=t,c&&!mr(e,f,!1))return void(l.length=0);u.push(Jn(e,f));var h=a?pr(e,f):ki(l);Cr(e,f,h,Jr(e,f)),!a&&e.cm&&e.cm.scrollIntoView({from:f.from,to:Vo(f)});var d=[];Un(e,function(e,t){t||-1!=Ti(d,e.history)||(hi(e.history,f),d.push(e.history)),Cr(e,f,null,Jr(e,f))})}}}}function xr(e,t){if(0!=t&&(e.first+=t,e.sel=new ue(Mi(e.sel.ranges,function(e){return new ce(No(e.anchor.line+t,e.anchor.ch),No(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Dt(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Ht(e.cm,n,"gutter")}}function Cr(e,t,r,n){if(e.cm&&!e.cm.curOp)return Mt(e.cm,Cr)(e,t,r,n);if(t.to.line<e.first)return void xr(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);xr(e,i),t={from:No(e.first,0),to:No(t.to.line+i,t.to.ch),text:[ki(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:No(o,Kn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=jn(e,t.from,t.to),r||(r=pr(e,t)),e.cm?Sr(e.cm,t,n):Rn(e,t,n),Te(e,r,Tl)}}function Sr(e,t,r){var n=e.doc,i=e.display,l=t.from,s=t.to,a=!1,u=l.line;e.options.lineWrapping||(u=Yn(fn(Kn(n,l.line))),n.iter(u,s.line+1,function(e){return e==i.maxLine?(a=!0,!0):void 0})),n.sel.contains(t.from,t.to)>-1&&bi(e),Rn(n,t,r,o(e)),e.options.lineWrapping||(n.iter(u,l.line+t.text.length,function(e){var t=f(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,a=!1)}),a&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,l.line),ze(e,400);var c=t.text.length-(s.line-l.line)-1;t.full?Dt(e):l.line!=s.line||1!=t.text.length||Fn(e.doc,t)?Dt(e,l.line,s.line+1,c):Ht(e,l.line,"text");var h=wi(e,"changes"),d=wi(e,"change");if(d||h){var p={from:l,to:s,text:t.text,removed:t.removed,origin:t.origin};d&&vi(e,"change",e,p),h&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function Lr(e,t,r,n,i){if(n||(n=r),Ao(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=Vl(t)),yr(e,{from:r,to:n,text:t,origin:i})}function kr(e,t){if(!yi(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!yo){var o=Pi("div","​",null,"position: absolute; top: "+(t.top-r.viewOffset-Be(e.display))+"px; height: "+(t.bottom-t.top+Ve(e)+r.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function Tr(e,t,r,n){null==n&&(n=0);for(var i=0;5>i;i++){var o=!1,l=ct(e,t),s=r&&r!=t?ct(e,r):l,a=Nr(e,Math.min(l.left,s.left),Math.min(l.top,s.top)-n,Math.max(l.left,s.left),Math.max(l.bottom,s.bottom)+n),u=e.doc.scrollTop,c=e.doc.scrollLeft;if(null!=a.scrollTop&&(Zt(e,a.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(o=!0)),null!=a.scrollLeft&&(Qt(e,a.scrollLeft),Math.abs(e.doc.scrollLeft-c)>1&&(o=!0)),!o)break}return l}function Mr(e,t,r,n,i){var o=Nr(e,t,r,n,i);null!=o.scrollTop&&Zt(e,o.scrollTop),null!=o.scrollLeft&&Qt(e,o.scrollLeft)}function Nr(e,t,r,n,i){var o=e.display,l=gt(e.display);0>r&&(r=0);var s=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,a=je(e),u={};i-r>a&&(i=r+a);var c=e.doc.height+Ge(o),f=l>r,h=i>c-l;if(s>r)u.scrollTop=f?0:r;else if(i>s+a){var d=Math.min(r,(h?c:i)-a);d!=s&&(u.scrollTop=d)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,g=Ke(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),v=n-t>g;return v&&(n=t+g),10>t?u.scrollLeft=0:p>t?u.scrollLeft=Math.max(0,t-(v?0:10)):n>g+p-3&&(u.scrollLeft=n+(v?0:10)-g),u}function Ar(e,t,r){(null!=t||null!=r)&&Or(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=r&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+r)}function Wr(e){Or(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?No(t.line,t.ch-1):t,n=No(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function Or(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=ft(e,t.from),n=ft(e,t.to),i=Nr(e,Math.min(r.left,n.left),Math.min(r.top,n.top)-t.margin,Math.max(r.right,n.right),Math.max(r.bottom,n.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function Dr(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=Re(e,t):r="prev");var l=e.options.tabSize,s=Kn(o,t),a=Al(s.text,null,l);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&(u=o.mode.indent(i,s.text.slice(c.length),s.text),u==kl||u>150)){if(!n)return;r="prev"}}else u=0,r="not";"prev"==r?u=t>o.first?Al(Kn(o,t-1).text,null,l):0:"add"==r?u=a+e.options.indentUnit:"subtract"==r?u=a-e.options.indentUnit:"number"==typeof r&&(u=a+r),u=Math.max(0,u);var f="",h=0;if(e.options.indentWithTabs)for(var d=Math.floor(u/l);d;--d)h+=l,f+=" ";if(u>h&&(f+=Li(u-h)),f!=c)Lr(o,f,No(t,0),No(t,c.length),"+input");else for(var d=0;d<o.sel.ranges.length;d++){var p=o.sel.ranges[d];if(p.head.line==t&&p.head.ch<c.length){var h=No(t,c.length);xe(o,d,new ce(h,h));break}}s.stateAfter=null}function Hr(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=Kn(e,de(e,t)):i=Yn(t),null==i?null:(n(o,i)&&e.cm&&Ht(e.cm,i,r),o)}function Ir(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&Ao(o.from,ki(n).to)<=0;){var l=n.pop();if(Ao(l.from,o.from)<0){o.from=l.from;break}}n.push(o)}Tt(e,function(){for(var t=n.length-1;t>=0;t--)Lr(e.doc,"",n[t].from,n[t].to,"+delete");Wr(e)})}function Pr(e,t,r,n,i){function o(){var t=s+r;return t<e.first||t>=e.first+e.size?f=!1:(s=t,c=Kn(e,t))}function l(e){var t=(i?io:oo)(c,a,r,!0);if(null==t){if(e||!o())return f=!1;a=i?(0>r?Zi:qi)(c):0>r?c.text.length:0}else a=t;return!0}var s=t.line,a=t.ch,u=r,c=Kn(e,s),f=!0;if("char"==n)l();else if("column"==n)l(!0);else if("word"==n||"group"==n)for(var h=null,d="group"==n,p=e.cm&&e.cm.getHelper(t,"wordChars"),g=!0;!(0>r)||l(!g);g=!1){var v=c.text.charAt(a)||"\n",m=Di(v,p)?"w":d&&"\n"==v?"n":!d||/\s/.test(v)?null:"p";if(!d||g||m||(m="s"),h&&h!=m){0>r&&(r=1,l());break}if(m&&(h=m),r>0&&!l(!g))break}var y=We(e,No(s,a),u,!0);return f||(y.hitSide=!0),y}function zr(e,t,r,n){var i,o=e.doc,l=t.left;if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+r*(s-(0>r?1.5:.5)*gt(e.display))}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;;){var a=dt(e,l,i);if(!a.outside)break;if(0>r?0>=i:i>=o.height){a.hitSide=!0;break}i+=5*r}return a}function Er(t,r,n,i){e.defaults[t]=r,n&&(jo[t]=i?function(e,t,r){r!=Xo&&n(e,t,r)}:n)}function Fr(e){for(var t,r,n,i,o=e.split(/-(?!$)/),e=o[o.length-1],l=0;l<o.length-1;l++){var s=o[l];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else{if(!/^s(hift)$/i.test(s))throw new Error("Unrecognized modifier name: "+s);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Rr(e){return"string"==typeof e?tl[e]:e;
3
- }function Br(e,t,r,n,i){if(n&&n.shared)return Gr(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return Mt(e.cm,Br)(e,t,r,n,i);var o=new sl(e,i),l=Ao(t,r);if(n&&Wi(n,o,!1),l>0||0==l&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Pi("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(cn(e,t.line,t,r,o)||t.line!=r.line&&cn(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Mo=!0}o.addToHistory&&ri(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var s,a=t.line,u=e.cm;if(e.iter(a,r.line+1,function(e){u&&o.collapsed&&!u.options.lineWrapping&&fn(e)==u.display.maxLine&&(s=!0),o.collapsed&&a!=t.line&&_n(e,0),Yr(e,new jr(o,a==t.line?t.ch:null,a==r.line?r.ch:null)),++a}),o.collapsed&&e.iter(t.line,r.line+1,function(t){gn(e,t)&&_n(t,0)}),o.clearOnEnter&&wl(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(To=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ll,o.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),o.collapsed)Dt(u,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var c=t.line;c<=r.line;c++)Ht(u,c,"text");o.atomic&&Ne(u.doc),vi(u,"markerAdded",u,o)}return o}function Gr(e,t,r,n,i){n=Wi(n),n.shared=!1;var o=[Br(e,t,r,n,i)],l=o[0],s=n.widgetNode;return Un(e,function(e){s&&(n.widgetNode=s.cloneNode(!0)),o.push(Br(e,pe(e,t),pe(e,r),n,i));for(var a=0;a<e.linked.length;++a)if(e.linked[a].isParent)return;l=ki(o)}),new al(o,l)}function Ur(e){return e.findMarks(No(e.first,0),e.clipPos(No(e.lastLine())),function(e){return e.parent})}function Vr(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),l=e.clipPos(i.to);if(Ao(o,l)){var s=Br(e,o,l,n.primary,n.primary.type);n.markers.push(s),s.parent=n}}}function Kr(e){for(var t=0;t<e.length;t++){var r=e[t],n=[r.primary.doc];Un(r.primary.doc,function(e){n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==Ti(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}}}function jr(e,t,r){this.marker=e,this.from=t,this.to=r}function Xr(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function _r(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Yr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function $r(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],l=o.marker,s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);if(s||o.from==t&&"bookmark"==l.type&&(!r||!o.marker.insertLeft)){var a=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new jr(l,o.from,a?null:o.to))}}return n}function qr(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],l=o.marker,s=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);if(s||o.from==t&&"bookmark"==l.type&&(!r||o.marker.insertLeft)){var a=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new jr(l,a?null:o.from-t,null==o.to?null:o.to-t))}}return n}function Zr(e,t){if(t.full)return null;var r=ve(e,t.from.line)&&Kn(e,t.from.line).markedSpans,n=ve(e,t.to.line)&&Kn(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,l=0==Ao(t.from,t.to),s=$r(r,i,l),a=qr(n,o,l),u=1==t.text.length,c=ki(t.text).length+(u?i:0);if(s)for(var f=0;f<s.length;++f){var h=s[f];if(null==h.to){var d=Xr(a,h.marker);d?u&&(h.to=null==d.to?null:d.to+c):h.to=i}}if(a)for(var f=0;f<a.length;++f){var h=a[f];if(null!=h.to&&(h.to+=c),null==h.from){var d=Xr(s,h.marker);d||(h.from=c,u&&(s||(s=[])).push(h))}else h.from+=c,u&&(s||(s=[])).push(h)}s&&(s=Qr(s)),a&&a!=s&&(a=Qr(a));var p=[s];if(!u){var g,v=t.text.length-2;if(v>0&&s)for(var f=0;f<s.length;++f)null==s[f].to&&(g||(g=[])).push(new jr(s[f].marker,null,null));for(var f=0;v>f;++f)p.push(g);p.push(a)}return p}function Qr(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Jr(e,t){var r=ai(e,t),n=Zr(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],l=n[i];if(o&&l)e:for(var s=0;s<l.length;++s){for(var a=l[s],u=0;u<o.length;++u)if(o[u].marker==a.marker)continue e;o.push(a)}else l&&(r[i]=l)}return r}function en(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=Ti(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var l=n[o],s=l.find(0),a=0;a<i.length;++a){var u=i[a];if(!(Ao(u.to,s.from)<0||Ao(u.from,s.to)>0)){var c=[a,1],f=Ao(u.from,s.from),h=Ao(u.to,s.to);(0>f||!l.inclusiveLeft&&!f)&&c.push({from:u.from,to:s.from}),(h>0||!l.inclusiveRight&&!h)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),a+=c.length-1}}return i}function tn(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function rn(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function nn(e){return e.inclusiveLeft?-1:0}function on(e){return e.inclusiveRight?1:0}function ln(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=Ao(n.from,i.from)||nn(e)-nn(t);if(o)return-o;var l=Ao(n.to,i.to)||on(e)-on(t);return l?l:t.id-e.id}function sn(e,t){var r,n=Mo&&e.markedSpans;if(n)for(var i,o=0;o<n.length;++o)i=n[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!r||ln(r,i.marker)<0)&&(r=i.marker);return r}function an(e){return sn(e,!0)}function un(e){return sn(e,!1)}function cn(e,t,r,n,i){var o=Kn(e,t),l=Mo&&o.markedSpans;if(l)for(var s=0;s<l.length;++s){var a=l[s];if(a.marker.collapsed){var u=a.marker.find(0),c=Ao(u.from,r)||nn(a.marker)-nn(i),f=Ao(u.to,n)||on(a.marker)-on(i);if(!(c>=0&&0>=f||0>=c&&f>=0)&&(0>=c&&(Ao(u.to,r)>0||a.marker.inclusiveRight&&i.inclusiveLeft)||c>=0&&(Ao(u.from,n)<0||a.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function fn(e){for(var t;t=an(e);)e=t.find(-1,!0).line;return e}function hn(e){for(var t,r;t=un(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function dn(e,t){var r=Kn(e,t),n=fn(r);return r==n?t:Yn(n)}function pn(e,t){if(t>e.lastLine())return t;var r,n=Kn(e,t);if(!gn(e,n))return t;for(;r=un(n);)n=r.find(1,!0).line;return Yn(n)+1}function gn(e,t){var r=Mo&&t.markedSpans;if(r)for(var n,i=0;i<r.length;++i)if(n=r[i],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&vn(e,t,n))return!0}}function vn(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return vn(e,n.line,Xr(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&vn(e,t,i))return!0}function mn(e,t,r){qn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ar(e,null,r)}function yn(e){if(null!=e.height)return e.height;if(!zl(document.body,e.node)){var t="position: relative;";e.coverGutter&&(t+="margin-left: -"+e.cm.display.gutters.offsetWidth+"px;"),e.noHScroll&&(t+="width: "+e.cm.display.wrapper.clientWidth+"px;"),Ei(e.cm.display.measure,Pi("div",[e.node],null,t))}return e.height=e.node.offsetHeight}function bn(e,t,r,n){var i=new ul(e,r,n);return i.noHScroll&&(e.display.alignWidgets=!0),Hr(e.doc,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,!gn(e.doc,t)){var n=qn(t)<e.doc.scrollTop;_n(t,t.height+yn(i)),n&&Ar(e,null,i.height),e.curOp.forceUpdate=!0}return!0}),i}function wn(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),tn(e),rn(e,r);var i=n?n(e):1;i!=e.height&&_n(e,i)}function xn(e){e.parent=null,tn(e)}function Cn(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function Sn(t,r){if(t.blankLine)return t.blankLine(r);if(t.innerMode){var n=e.innerMode(t,r);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function Ln(t,r,n,i){for(var o=0;10>o;o++){i&&(i[0]=e.innerMode(t,n).mode);var l=t.token(r,n);if(r.pos>r.start)return l}throw new Error("Mode "+t.name+" failed to advance stream.")}function kn(e,t,r,n){function i(e){return{start:f.start,end:f.pos,string:f.current(),type:o||null,state:e?Qo(l.mode,c):c}}var o,l=e.doc,s=l.mode;t=pe(l,t);var a,u=Kn(l,t.line),c=Re(e,t.line,r),f=new ol(u.text,e.options.tabSize);for(n&&(a=[]);(n||f.pos<t.ch)&&!f.eol();)f.start=f.pos,o=Ln(s,f,c),n&&a.push(i(!0));return n?a:i()}function Tn(e,t,r,n,i,o,l){var s=r.flattenSpans;null==s&&(s=e.options.flattenSpans);var a,u=0,c=null,f=new ol(t,e.options.tabSize),h=e.options.addModeClass&&[null];for(""==t&&Cn(Sn(r,n),o);!f.eol();){if(f.pos>e.options.maxHighlightLength?(s=!1,l&&An(e,t,n,f.pos),f.pos=t.length,a=null):a=Cn(Ln(r,f,n,h),o),h){var d=h[0].name;d&&(a="m-"+(a?d+" "+a:d))}if(!s||c!=a){for(;u<f.start;)u=Math.min(f.start,u+5e4),i(u,c);c=a}f.start=f.pos}for(;u<f.pos;){var p=Math.min(f.pos,u+5e4);i(p,c),u=p}}function Mn(e,t,r,n){var i=[e.state.modeGen],o={};Tn(e,t.text,e.doc.mode,r,function(e,t){i.push(e,t)},o,n);for(var l=0;l<e.state.overlays.length;++l){var s=e.state.overlays[l],a=1,u=0;Tn(e,t.text,s.mode,!0,function(e,t){for(var r=a;e>u;){var n=i[a];n>e&&i.splice(a,1,e,i[a+1],n),a+=2,u=Math.min(e,n)}if(t)if(s.opaque)i.splice(r,a-r,e,"cm-overlay "+t),a=r+2;else for(;a>r;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Nn(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Mn(e,t,t.stateAfter=Re(e,Yn(t)));t.styles=n.styles,n.classes?t.styleClasses=n.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.frontier&&e.doc.frontier++}return t.styles}function An(e,t,r,n){var i=e.doc.mode,o=new ol(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&Sn(i,r);!o.eol()&&o.pos<=e.options.maxHighlightLength;)Ln(i,o,r),o.start=o.pos}function Wn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?hl:fl;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function On(e,t){var r=Pi("span",null,null,fo?"padding-right: .1px":null),n={pre:Pi("pre",[r]),content:r,col:0,pos:0,cm:e};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,l=i?t.rest[i-1]:t.line;n.pos=0,n.addToken=Hn,(uo||fo)&&e.getOption("lineWrapping")&&(n.addToken=In(n.addToken)),ji(e.display.measure)&&(o=Zn(l))&&(n.addToken=Pn(n.addToken,o)),n.map=[];var s=t!=e.display.externalMeasured&&Yn(l);En(l,n,Nn(e,l,s)),l.styleClasses&&(l.styleClasses.bgClass&&(n.bgClass=Bi(l.styleClasses.bgClass,n.bgClass||"")),l.styleClasses.textClass&&(n.textClass=Bi(l.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Ki(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return fo&&/\bcm-tab\b/.test(n.content.lastChild.className)&&(n.content.className="cm-tab-wrap-hack"),Cl(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Bi(n.pre.className,n.textClass||"")),n}function Dn(e){var t=Pi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Hn(e,t,r,n,i,o,l){if(t){var s=e.cm.options.specialChars,a=!1;if(s.test(t))for(var u=document.createDocumentFragment(),c=0;;){s.lastIndex=c;var f=s.exec(t),h=f?f.index-c:t.length-c;if(h){var d=document.createTextNode(t.slice(c,c+h));uo&&9>co?u.appendChild(Pi("span",[d])):u.appendChild(d),e.map.push(e.pos,e.pos+h,d),e.col+=h,e.pos+=h}if(!f)break;if(c+=h+1," "==f[0]){var p=e.cm.options.tabSize,g=p-e.col%p,d=u.appendChild(Pi("span",Li(g),"cm-tab"));d.setAttribute("role","presentation"),d.setAttribute("cm-text"," "),e.col+=g}else{var d=e.cm.options.specialCharPlaceholder(f[0]);d.setAttribute("cm-text",f[0]),uo&&9>co?u.appendChild(Pi("span",[d])):u.appendChild(d),e.col+=1}e.map.push(e.pos,e.pos+1,d),e.pos++}else{e.col+=t.length;var u=document.createTextNode(t);e.map.push(e.pos,e.pos+t.length,u),uo&&9>co&&(a=!0),e.pos+=t.length}if(r||n||i||a||l){var v=r||"";n&&(v+=n),i&&(v+=i);var m=Pi("span",[u],v,l);return o&&(m.title=o),e.content.appendChild(m)}e.content.appendChild(u)}}function In(e){function t(e){for(var t=" ",r=0;r<e.length-2;++r)t+=r%2?" ":" ";return t+=" "}return function(r,n,i,o,l,s){e(r,n.replace(/ {3,}/g,t),i,o,l,s)}}function Pn(e,t){return function(r,n,i,o,l,s){i=i?i+" cm-force-border":"cm-force-border";for(var a=r.pos,u=a+n.length;;){for(var c=0;c<t.length;c++){var f=t[c];if(f.to>a&&f.from<=a)break}if(f.to>=u)return e(r,n,i,o,l,s);e(r,n.slice(0,f.to-a),i,o,null,s),o=null,n=n.slice(f.to-a),a=f.to}}}function zn(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t}function En(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var l,s,a,u,c,f,h,d=i.length,p=0,g=1,v="",m=0;;){if(m==p){a=u=c=f=s="",h=null,m=1/0;for(var y=[],b=0;b<n.length;++b){var w=n[b],x=w.marker;w.from<=p&&(null==w.to||w.to>p)?(null!=w.to&&m>w.to&&(m=w.to,u=""),x.className&&(a+=" "+x.className),x.css&&(s=x.css),x.startStyle&&w.from==p&&(c+=" "+x.startStyle),x.endStyle&&w.to==m&&(u+=" "+x.endStyle),x.title&&!f&&(f=x.title),x.collapsed&&(!h||ln(h.marker,x)<0)&&(h=w)):w.from>p&&m>w.from&&(m=w.from),"bookmark"==x.type&&w.from==p&&x.widgetNode&&y.push(x)}if(h&&(h.from||0)==p&&(zn(t,(null==h.to?d+1:h.to)-p,h.marker,null==h.from),null==h.to))return;if(!h&&y.length)for(var b=0;b<y.length;++b)zn(t,0,y[b])}if(p>=d)break;for(var C=Math.min(d,m);;){if(v){var S=p+v.length;if(!h){var L=S>C?v.slice(0,C-p):v;t.addToken(t,L,l?l+a:a,c,p+L.length==m?u:"",f,s)}if(S>=C){v=v.slice(C-p),p=C;break}p=S,c=""}v=i.slice(o,o=r[g++]),l=Wn(r[g++],t.cm.options)}}else for(var g=1;g<r.length;g+=2)t.addToken(t,i.slice(o,o=r[g]),Wn(r[g+1],t.cm.options))}function Fn(e,t){return 0==t.from.ch&&0==t.to.ch&&""==ki(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Rn(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){wn(e,r,i,n),vi(e,"change",e,t)}function l(e,t){for(var r=e,o=[];t>r;++r)o.push(new cl(u[r],i(r),n));return o}var s=t.from,a=t.to,u=t.text,c=Kn(e,s.line),f=Kn(e,a.line),h=ki(u),d=i(u.length-1),p=a.line-s.line;if(t.full)e.insert(0,l(0,u.length)),e.remove(u.length,e.size-u.length);else if(Fn(e,t)){var g=l(0,u.length-1);o(f,f.text,d),p&&e.remove(s.line,p),g.length&&e.insert(s.line,g)}else if(c==f)if(1==u.length)o(c,c.text.slice(0,s.ch)+h+c.text.slice(a.ch),d);else{var g=l(1,u.length-1);g.push(new cl(h+c.text.slice(a.ch),d,n)),o(c,c.text.slice(0,s.ch)+u[0],i(0)),e.insert(s.line+1,g)}else if(1==u.length)o(c,c.text.slice(0,s.ch)+u[0]+f.text.slice(a.ch),i(0)),e.remove(s.line+1,p);else{o(c,c.text.slice(0,s.ch)+u[0],i(0)),o(f,h+f.text.slice(a.ch),d);var g=l(1,u.length-1);p>1&&e.remove(s.line+1,p-1),e.insert(s.line+1,g)}vi(e,"change",e,t)}function Bn(e){this.lines=e,this.parent=null;for(var t=0,r=0;t<e.length;++t)e[t].parent=this,r+=e[t].height;this.height=r}function Gn(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}function Un(e,t,r){function n(e,i,o){if(e.linked)for(var l=0;l<e.linked.length;++l){var s=e.linked[l];if(s.doc!=i){var a=o&&s.sharedHist;(!r||a)&&(t(s.doc,a),n(s.doc,e,a))}}}n(e,null,!0)}function Vn(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,l(e),r(e),e.options.lineWrapping||h(e),e.options.mode=t.modeOption,Dt(e)}function Kn(e,t){if(t-=e.first,0>t||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(o>t){r=i;break}t-=o}return r.lines[t]}function jn(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function Xn(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function _n(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function Yn(e){if(null==e.parent)return null;for(var t=e.parent,r=Ti(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function $n(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(o>t){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var n=0;n<e.lines.length;++n){var l=e.lines[n],s=l.height;if(s>t)break;t-=s}return r+n}function qn(e){e=fn(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;r=o,o=r.parent)for(var n=0;n<o.children.length;++n){var l=o.children[n];if(l==r)break;t+=l.height}return t}function Zn(e){var t=e.order;return null==t&&(t=e.order=$l(e.text)),t}function Qn(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Jn(e,t){var r={from:_(t.from),to:Vo(t),text:jn(e,t.from,t.to)};return li(e,r,t.from.line,t.to.line+1),Un(e,function(e){li(e,r,t.from.line,t.to.line+1)},!0),r}function ei(e){for(;e.length;){var t=ki(e);if(!t.ranges)break;e.pop()}}function ti(e,t){return t?(ei(e.done),ki(e.done)):e.done.length&&!ki(e.done).ranges?ki(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),ki(e.done)):void 0}function ri(e,t,r,n){var i=e.history;i.undone.length=0;var o,l=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>l-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=ti(i,i.lastOp==n))){var s=ki(o.changes);0==Ao(t.from,t.to)&&0==Ao(t.from,s.to)?s.to=Vo(t):o.changes.push(Jn(e,t))}else{var a=ki(i.done);for(a&&a.ranges||oi(e.sel,i.done),o={changes:[Jn(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,s||Cl(e,"historyAdded")}function ni(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function ii(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||ni(e,o,ki(i.done),t))?i.done[i.done.length-1]=t:oi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&n.clearRedo!==!1&&ei(i.undone)}function oi(e,t){var r=ki(t);r&&r.ranges&&r.equals(e)||t.push(e)}function li(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function si(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function ai(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=0,i=[];n<t.text.length;++n)i.push(si(r[n]));return i}function ui(e,t,r){for(var n=0,i=[];n<e.length;++n){var o=e[n];if(o.ranges)i.push(r?ue.prototype.deepCopy.call(o):o);else{var l=o.changes,s=[];i.push({changes:s});for(var a=0;a<l.length;++a){var u,c=l[a];if(s.push({from:c.from,to:c.to,text:c.text}),t)for(var f in c)(u=f.match(/^spans_(\d+)$/))&&Ti(t,Number(u[1]))>-1&&(ki(s)[f]=c[f],delete c[f])}}}return i}function ci(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function fi(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],l=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var s=0;s<o.ranges.length;s++)ci(o.ranges[s].anchor,t,r,n),ci(o.ranges[s].head,t,r,n)}else{for(var s=0;s<o.changes.length;++s){var a=o.changes[s];if(r<a.from.line)a.from=No(a.from.line+n,a.from.ch),a.to=No(a.to.line+n,a.to.ch);else if(t<=a.to.line){l=!1;break}}l||(e.splice(0,i+1),i=0)}}}function hi(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;fi(e.done,r,n,i),fi(e.undone,r,n,i)}function di(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function pi(e){return e.target||e.srcElement}function gi(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),xo&&e.ctrlKey&&1==t&&(t=3),t}function vi(e,t){function r(e){return function(){e.apply(null,o)}}var n=e._handlers&&e._handlers[t];if(n){var i,o=Array.prototype.slice.call(arguments,2);Po?i=Po.delayedCallbacks:Sl?i=Sl:(i=Sl=[],setTimeout(mi,0));for(var l=0;l<n.length;++l)i.push(r(n[l]))}}function mi(){var e=Sl;Sl=null;for(var t=0;t<e.length;++t)e[t]()}function yi(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Cl(e,r||t.type,e,t),di(t)||t.codemirrorIgnore}function bi(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==Ti(r,t[n])&&r.push(t[n])}function wi(e,t){var r=e._handlers&&e._handlers[t];return r&&r.length>0}function xi(e){e.prototype.on=function(e,t){wl(this,e,t)},e.prototype.off=function(e,t){xl(this,e,t)}}function Ci(){this.id=null}function Si(e,t,r){for(var n=0,i=0;;){var o=e.indexOf(" ",n);-1==o&&(o=e.length);var l=o-n;if(o==e.length||i+l>=t)return n+Math.min(l,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}}function Li(e){for(;Wl.length<=e;)Wl.push(ki(Wl)+" ");return Wl[e]}function ki(e){return e[e.length-1]}function Ti(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}function Mi(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Ni(){}function Ai(e,t){var r;return Object.create?r=Object.create(e):(Ni.prototype=e,r=new Ni),t&&Wi(t,r),r}function Wi(e,t,r){t||(t={});for(var n in e)!e.hasOwnProperty(n)||r===!1&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function Oi(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Di(e,t){return t?t.source.indexOf("\\w")>-1&&Il(e)?!0:t.test(e):Il(e)}function Hi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Ii(e){return e.charCodeAt(0)>=768&&Pl.test(e)}function Pi(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function zi(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Ei(e,t){return zi(e).appendChild(t)}function Fi(){return document.activeElement}function Ri(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Bi(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!Ri(r[n]).test(t)&&(t+=" "+r[n]);return t}function Gi(e){if(document.body.getElementsByClassName)for(var t=document.body.getElementsByClassName("CodeMirror"),r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&e(n)}}function Ui(){Gl||(Vi(),Gl=!0)}function Vi(){var e;wl(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Gi(Bt)},100))}),wl(window,"blur",function(){Gi(cr)})}function Ki(e){if(null==El){var t=Pi("span","​");Ei(e,Pi("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(El=t.offsetWidth<=1&&t.offsetHeight>2&&!(uo&&8>co))}var r=El?Pi("span","​"):Pi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function ji(e){if(null!=Fl)return Fl;var t=Ei(e,document.createTextNode("AخA")),r=Dl(t,0,1).getBoundingClientRect();if(!r||r.left==r.right)return!1;var n=Dl(t,1,2).getBoundingClientRect();return Fl=n.right-r.right<3}function Xi(e){if(null!=Xl)return Xl;var t=Ei(e,Pi("span","x")),r=t.getBoundingClientRect(),n=Dl(t,0,1).getBoundingClientRect();return Xl=Math.abs(r.left-n.left)>1}function _i(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<r&&l.to>t||t==r&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,r),1==l.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function Yi(e){return e.level%2?e.to:e.from}function $i(e){return e.level%2?e.from:e.to}function qi(e){var t=Zn(e);return t?Yi(t[0]):0}function Zi(e){var t=Zn(e);return t?$i(ki(t)):e.text.length}function Qi(e,t){var r=Kn(e.doc,t),n=fn(r);n!=r&&(t=Yn(n));var i=Zn(n),o=i?i[0].level%2?Zi(n):qi(n):0;return No(t,o)}function Ji(e,t){for(var r,n=Kn(e.doc,t);r=un(n);)n=r.find(1,!0).line,t=null;var i=Zn(n),o=i?i[0].level%2?qi(n):Zi(n):n.text.length;return No(null==t?Yn(n):t,o)}function eo(e,t){var r=Qi(e,t.line),n=Kn(e.doc,r.line),i=Zn(n);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),l=t.line==r.line&&t.ch<=o&&t.ch;return No(r.line,l?0:o)}return r}function to(e,t,r){var n=e[0].level;return t==n?!0:r==n?!1:r>t}function ro(e,t){Yl=null;for(var r,n=0;n<e.length;++n){var i=e[n];if(i.from<t&&i.to>t)return n;if(i.from==t||i.to==t){if(null!=r)return to(e,i.level,e[r].level)?(i.from!=i.to&&(Yl=r),n):(i.from!=i.to&&(Yl=n),r);r=n}}return r}function no(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&Ii(e.text.charAt(t)));return t}function io(e,t,r,n){var i=Zn(e);if(!i)return oo(e,t,r,n);for(var o=ro(i,t),l=i[o],s=no(e,t,l.level%2?-r:r,n);;){if(s>l.from&&s<l.to)return s;if(s==l.from||s==l.to)return ro(i,s)==o?s:(l=i[o+=r],r>0==l.level%2?l.to:l.from);if(l=i[o+=r],!l)return null;s=r>0==l.level%2?no(e,l.to,-1,n):no(e,l.from,1,n)}}function oo(e,t,r,n){var i=t+r;if(n)for(;i>0&&Ii(e.text.charAt(i));)i+=r;return 0>i||i>e.text.length?null:i}var lo=/gecko\/\d/i.test(navigator.userAgent),so=/MSIE \d/.test(navigator.userAgent),ao=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),uo=so||ao,co=uo&&(so?document.documentMode||6:ao[1]),fo=/WebKit\//.test(navigator.userAgent),ho=fo&&/Qt\/\d+\.\d+/.test(navigator.userAgent),po=/Chrome\//.test(navigator.userAgent),go=/Opera\//.test(navigator.userAgent),vo=/Apple Computer/.test(navigator.vendor),mo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),yo=/PhantomJS/.test(navigator.userAgent),bo=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),wo=bo||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),xo=bo||/Mac/.test(navigator.platform),Co=/win/i.test(navigator.platform),So=go&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);So&&(So=Number(So[1])),So&&So>=15&&(go=!1,fo=!0);var Lo=xo&&(ho||go&&(null==So||12.11>So)),ko=lo||uo&&co>=9,To=!1,Mo=!1;g.prototype=Wi({update:function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+o+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedOverlay&&e.clientHeight>0&&(0==n&&this.overlayHack(),this.checkedOverlay=!0),{right:r?n:0,bottom:t?n:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e)},overlayHack:function(){var e=xo&&!mo?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=e;var t=this,r=function(e){pi(e)!=t.vert&&pi(e)!=t.horiz&&Mt(t.cm,Vt)(e)};wl(this.vert,"mousedown",r),wl(this.horiz,"mousedown",r)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},g.prototype),v.prototype=Wi({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},v.prototype),e.scrollbarModel={"native":g,"null":v},k.prototype.signal=function(e,t){wi(e,t)&&this.events.push(arguments)},k.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Cl.apply(null,this.events[e])};var No=e.Pos=function(e,t){return this instanceof No?(this.line=e,void(this.ch=t)):new No(e,t)},Ao=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},Wo=null;te.prototype=Wi({init:function(e){function t(e){if(n.somethingSelected())Wo=n.getSelections(),r.inaccurateSelection&&(r.prevInput="",r.inaccurateSelection=!1,o.value=Wo.join("\n"),Ol(o));else{var t=J(n);Wo=t.text,"cut"==e.type?n.setSelections(t.ranges,null,Tl):(r.prevInput="",o.value=t.text.join("\n"),Ol(o))}"cut"==e.type&&(n.state.cutIncoming=!0)}var r=this,n=this.cm,i=this.wrapper=re(),o=this.textarea=i.firstChild;e.wrapper.insertBefore(i,e.wrapper.firstChild),bo&&(o.style.width="0px"),wl(o,"input",function(){uo&&co>=9&&r.hasSelection&&(r.hasSelection=null),r.poll()}),wl(o,"paste",function(){if(fo&&!n.state.fakedLastChar&&!(new Date-n.state.lastMiddleDown<200)){var e=o.selectionStart,t=o.selectionEnd;o.value+="$",o.selectionEnd=t,o.selectionStart=e,n.state.fakedLastChar=!0}n.state.pasteIncoming=!0,r.fastPoll()}),wl(o,"cut",t),wl(o,"copy",t),wl(e.scroller,"paste",function(t){Gt(e,t)||(n.state.pasteIncoming=!0,r.focus())}),wl(e.lineSpace,"selectstart",function(t){Gt(e,t)||ml(t)})},prepareSelection:function(){var e=this.cm,t=e.display,r=e.doc,n=De(e);if(e.options.moveInputWithCursor){var i=ct(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return n},showSelection:function(e){var t=this.cm,r=t.display;Ei(r.cursorDiv,e.cursors),Ei(r.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,r,n=this.cm,i=n.doc;if(n.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=jl&&(o.to().line-o.from().line>100||(r=n.getSelection()).length>1e3);var l=t?"-":r||n.getSelection();this.textarea.value=l,n.state.focused&&Ol(this.textarea),uo&&co>=9&&(this.hasSelection=l)}else e||(this.prevInput=this.textarea.value="",uo&&co>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!wo||Fi()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var n=r.poll();n||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))}var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,r=this.prevInput;if(!e.state.focused||Kl(t)&&!r||Z(e)||e.options.disableInput||e.state.keySeq)return!1;e.state.pasteIncoming&&e.state.fakedLastChar&&(t.value=t.value.substring(0,t.value.length-1),e.state.fakedLastChar=!1);var n=t.value;if(n==r&&!e.somethingSelected())return!1;if(uo&&co>=9&&this.hasSelection===n||xo&&/[\uf700-\uf7ff]/.test(n))return e.display.input.reset(),!1;8203!=n.charCodeAt(0)||e.doc.sel!=e.display.selForContextMenu||r||(r="​");for(var i=0,o=Math.min(r.length,n.length);o>i&&r.charCodeAt(i)==n.charCodeAt(i);)++i;var l=this;
4
- return Tt(e,function(){Q(e,n.slice(i),r.length-i),n.length>1e3||n.indexOf("\n")>-1?t.value=l.prevInput="":l.prevInput=n}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){uo&&co>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=l.selectionStart){var e=i.somethingSelected(),t=l.value="​"+(e?l.value:"");n.prevInput=e?"":"​",l.selectionStart=1,l.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function r(){if(n.contextMenuPending=!1,n.wrapper.style.position="relative",l.style.cssText=c,uo&&9>co&&o.scrollbars.setScrollTop(o.scroller.scrollTop=a),null!=l.selectionStart){(!uo||uo&&9>co)&&t();var e=0,r=function(){o.selForContextMenu==i.doc.sel&&0==l.selectionStart?Mt(i,el.selectAll)(i):e++<10?o.detectingSelectAll=setTimeout(r,500):o.input.reset()};o.detectingSelectAll=setTimeout(r,200)}}var n=this,i=n.cm,o=i.display,l=n.textarea,s=Ut(i,e),a=o.scroller.scrollTop;if(s&&!go){var u=i.options.resetSelectionOnContextMenu;u&&-1==i.doc.sel.contains(s)&&Mt(i,ke)(i.doc,he(s),Tl);var c=l.style.cssText;if(n.wrapper.style.position="absolute",l.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(uo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",fo)var f=window.scrollY;if(o.input.focus(),fo&&window.scrollTo(null,f),o.input.reset(),i.somethingSelected()||(l.value=n.prevInput=" "),n.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),uo&&co>=9&&t(),ko){bl(e);var h=function(){xl(window,"mouseup",h),setTimeout(r,20)};wl(window,"mouseup",h)}else setTimeout(r,50)}},setUneditable:Ni,needsContentAttribute:!1},te.prototype),ne.prototype=Wi({init:function(e){function t(e){if(n.somethingSelected())Wo=n.getSelections(),"cut"==e.type&&n.replaceSelection("",null,"cut");else{var t=J(n);Wo=t.text,"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,Tl),n.replaceSelection("",null,"cut")})}if(e.clipboardData&&!bo)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Wo.join("\n"));else{var r=re(),i=r.firstChild;n.display.lineSpace.insertBefore(r,n.display.lineSpace.firstChild),i.value=Wo.join("\n");var o=document.activeElement;Ol(i),setTimeout(function(){n.display.lineSpace.removeChild(r),o.focus()},50)}}var r=this,n=r.cm,i=r.div=e.lineDiv;i.contentEditable="true",ee(i),wl(i,"paste",function(e){var t=e.clipboardData&&e.clipboardData.getData("text/plain");t&&(e.preventDefault(),n.replaceSelection(t,null,"paste"))}),wl(i,"compositionstart",function(e){var t=e.data;if(r.composing={sel:n.doc.sel,data:t,startData:t},t){var i=n.doc.sel.primary(),o=n.getLine(i.head.line),l=o.indexOf(t,Math.max(0,i.head.ch-t.length));l>-1&&l<=i.head.ch&&(r.composing.sel=he(No(i.head.line,l),No(i.head.line,l+t.length)))}}),wl(i,"compositionupdate",function(e){r.composing.data=e.data}),wl(i,"compositionend",function(e){var t=r.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||r.applyComposition(t),r.composing==t&&(r.composing=null)},50))}),wl(i,"touchstart",function(){r.forceCompositionEnd()}),wl(i,"input",function(){r.composing||r.pollContent()||Tt(r.cm,function(){Dt(n)})}),wl(i,"copy",t),wl(i,"cut",t)},prepareSelection:function(){var e=De(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){e&&this.cm.display.view.length&&(e.focus&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),r=le(this.cm,e.anchorNode,e.anchorOffset),n=le(this.cm,e.focusNode,e.focusOffset);if(!r||r.bad||!n||n.bad||0!=Ao($(r,n),t.from())||0!=Ao(Y(r,n),t.to())){var i=ie(this.cm,t.from()),o=ie(this.cm,t.to());if(i||o){var l=this.cm.display.view,s=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var a=l[l.length-1].measure,u=a.maps?a.maps[a.maps.length-1]:a.map;o={node:u[u.length-1],offset:u[u.length-2]-u[u.length-3]}}}else i={node:l[0].measure.map[2],offset:0};try{var c=Dl(i.node,i.offset,o.offset,o.node)}catch(f){}c&&(e.removeAllRanges(),e.addRange(c),s&&null==e.anchorNode&&e.addRange(s)),this.rememberSelection()}}},showMultipleSelections:function(e){Ei(this.cm.display.cursorDiv,e.cursors),Ei(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return zl(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():Tt(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},pollSelection:function(){if(!this.composing){var e=window.getSelection(),t=this.cm;if(e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset){this.rememberSelection();var r=le(t,e.anchorNode,e.anchorOffset),n=le(t,e.focusNode,e.focusOffset);r&&n&&Tt(t,function(){ke(t.doc,he(r,n),Tl),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}}},pollContent:function(){var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),i=r.to();if(n.line<t.viewFrom||i.line>t.viewTo-1)return!1;var o;if(n.line==t.viewFrom||0==(o=Pt(e,n.line)))var l=Yn(t.view[0].line),s=t.view[0].node;else var l=Yn(t.view[o].line),s=t.view[o-1].node.nextSibling;var a=Pt(e,i.line);if(a==t.view.length-1)var u=t.viewTo-1,c=t.view[a].node;else var u=Yn(t.view[a+1].line)-1,c=t.view[a+1].node.previousSibling;for(var f=Vl(ae(e,s,c,l,u)),h=jn(e.doc,No(l,0),No(u,Kn(e.doc,u).text.length));f.length>1&&h.length>1;)if(ki(f)==ki(h))f.pop(),h.pop(),u--;else{if(f[0]!=h[0])break;f.shift(),h.shift(),l++}for(var d=0,p=0,g=f[0],v=h[0],m=Math.min(g.length,v.length);m>d&&g.charCodeAt(d)==v.charCodeAt(d);)++d;for(var y=ki(f),b=ki(h),w=Math.min(y.length-(1==f.length?d:0),b.length-(1==h.length?d:0));w>p&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;f[f.length-1]=y.slice(0,y.length-p),f[0]=f[0].slice(d);var x=No(l,d),C=No(u,h.length?ki(h).length-p:0);return f.length>1||f[0]||Ao(x,C)?(Lr(e.doc,f,x,C,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){e.data&&e.data!=e.startData&&Mt(this.cm,Q)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.setAttribute("contenteditable","false")},onKeyPress:function(e){e.preventDefault(),Mt(this.cm,Q)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},onContextMenu:Ni,resetPosition:Ni,needsContentAttribute:!0},ne.prototype),e.inputStyles={textarea:te,contenteditable:ne},ue.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(0!=Ao(r.anchor,n.anchor)||0!=Ao(r.head,n.head))return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new ce(_(this.ranges[t].anchor),_(this.ranges[t].head));return new ue(e,this.primIndex)},somethingSelected:function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},contains:function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(Ao(t,n.from())>=0&&Ao(e,n.to())<=0)return r}return-1}},ce.prototype={from:function(){return $(this.anchor,this.head)},to:function(){return Y(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Oo,Do,Ho,Io={left:0,right:0,top:0,bottom:0},Po=null,zo=0,Eo=0,Fo=0,Ro=null;uo?Ro=-.53:lo?Ro=15:po?Ro=-.7:vo&&(Ro=-1/3);var Bo=function(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}};e.wheelEventPixels=function(e){var t=Bo(e);return t.x*=Ro,t.y*=Ro,t};var Go=new Ci,Uo=null,Vo=e.changeEnd=function(e){return e.text?No(e.from.line+e.text.length-1,ki(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var r=this.options,n=r[e];(r[e]!=t||"mode"==e)&&(r[e]=t,jo.hasOwnProperty(e)&&Mt(this,jo[e])(this,t,n))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Rr(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:Nt(function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:t,opaque:r&&r.opaque}),this.state.modeGen++,Dt(this)}),removeOverlay:Nt(function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void Dt(this)}}),indentLine:Nt(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),ve(this.doc,e)&&Dr(this,e,t,r)}),indentSelection:Nt(function(e){for(var t=this.doc.sel.ranges,r=-1,n=0;n<t.length;n++){var i=t[n];if(i.empty())i.head.line>r&&(Dr(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&Wr(this));else{var o=i.from(),l=i.to(),s=Math.max(r,o.line);r=Math.min(this.lastLine(),l.line-(l.ch?0:1))+1;for(var a=s;r>a;++a)Dr(this,a,e);var u=this.doc.sel.ranges;0==o.ch&&t.length==u.length&&u[n].from().ch>0&&xe(this.doc,n,new ce(o,u[n].to()),Tl)}}}),getTokenAt:function(e,t){return kn(this,e,t)},getLineTokens:function(e,t){return kn(this,No(e),t,!0)},getTokenTypeAt:function(e){e=pe(this.doc,e);var t,r=Nn(this,Kn(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var l=n+i>>1;if((l?r[2*l-1]:0)>=o)i=l;else{if(!(r[2*l+1]<o)){t=r[2*l+2];break}n=l+1}}var s=t?t.indexOf("cm-overlay "):-1;return 0>s?t:0==s?null:t.slice(0,s-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!Zo.hasOwnProperty(t))return Zo;var n=Zo[t],i=this.getModeAt(e);if("string"==typeof i[t])n[i[t]]&&r.push(n[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var l=n[i[t][o]];l&&r.push(l)}else i.helperType&&n[i.helperType]?r.push(n[i.helperType]):n[i.name]&&r.push(n[i.name]);for(var o=0;o<n._global.length;o++){var s=n._global[o];s.pred(i,this)&&-1==Ti(r,s.val)&&r.push(s.val)}return r},getStateAfter:function(e,t){var r=this.doc;return e=de(r,null==e?r.first+r.size-1:e),Re(this,e+1,t)},cursorCoords:function(e,t){var r,n=this.doc.sel.primary();return r=null==e?n.head:"object"==typeof e?pe(this.doc,e):e?n.from():n.to(),ct(this,r,t||"page")},charCoords:function(e,t){return ut(this,pe(this.doc,e),t||"page")},coordsChar:function(e,t){return e=at(this,e,t||"page"),dt(this,e.left,e.top)},lineAtHeight:function(e,t){return e=at(this,{top:e,left:0},t||"page").top,$n(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var r=!1,n=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>n&&(e=n,r=!0);var i=Kn(this.doc,e);return st(this,i,{top:0,left:0},t||"page").top+(r?this.doc.height-qn(i):0)},defaultTextHeight:function(){return gt(this.display)},defaultCharWidth:function(){return vt(this.display)},setGutterMarker:Nt(function(e,t,r){return Hr(this.doc,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&Hi(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Nt(function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,Ht(t,n,"gutter"),Hi(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),addLineWidget:Nt(function(e,t,r){return bn(this,e,t,r)}),removeLineWidget:function(e){e.clear()},lineInfo:function(e){if("number"==typeof e){if(!ve(this.doc,e))return null;var t=e;if(e=Kn(this.doc,e),!e)return null}else{var t=Yn(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=ct(this,pe(this.doc,e));var l=e.bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)l=e.top;else if("above"==n||"near"==n){var a=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>a)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=a&&(l=e.bottom),s+t.offsetWidth>u&&(s=u-t.offsetWidth)}t.style.top=l+"px",t.style.left=t.style.right="","right"==i?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),r&&Mr(this,s,l,s+t.offsetWidth,l+t.offsetHeight)},triggerOnKeyDown:Nt(or),triggerOnKeyPress:Nt(ar),triggerOnKeyUp:sr,execCommand:function(e){return el.hasOwnProperty(e)?el[e](this):void 0},findPosH:function(e,t,r,n){var i=1;0>t&&(i=-1,t=-t);for(var o=0,l=pe(this.doc,e);t>o&&(l=Pr(this.doc,l,i,r,n),!l.hitSide);++o);return l},moveH:Nt(function(e,t){var r=this;r.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?Pr(r.doc,n.head,e,t,r.options.rtlMoveVisually):0>e?n.from():n.to()},Nl)}),deleteH:Nt(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Ir(this,function(r){var i=Pr(n,r.head,e,t,!1);return 0>e?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=1,o=n;0>t&&(i=-1,t=-t);for(var l=0,s=pe(this.doc,e);t>l;++l){var a=ct(this,s,"div");if(null==o?o=a.left:a.left=o,s=zr(this,a,i,r),s.hitSide)break}return s},moveV:Nt(function(e,t){var r=this,n=this.doc,i=[],o=!r.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(l){if(o)return 0>e?l.from():l.to();var s=ct(r,l.head,"div");null!=l.goalColumn&&(s.left=l.goalColumn),i.push(s.left);var a=zr(r,s,e,t);return"page"==t&&l==n.sel.primary()&&Ar(r,null,ut(r,a,"div").top-s.top),a},Nl),i.length)for(var l=0;l<n.sel.ranges.length;l++)n.sel.ranges[l].goalColumn=i[l]}),findWordAt:function(e){var t=this.doc,r=Kn(t,e.line).text,n=e.ch,i=e.ch;if(r){var o=this.getHelper(e,"wordChars");(e.xRel<0||i==r.length)&&n?--n:++i;for(var l=r.charAt(n),s=Di(l,o)?function(e){return Di(e,o)}:/\s/.test(l)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Di(e)};n>0&&s(r.charAt(n-1));)--n;for(;i<r.length&&s(r.charAt(i));)++i}return new ce(No(e.line,n),No(e.line,i))},toggleOverwrite:function(e){(null==e||e!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?Bl(this.display.cursorDiv,"CodeMirror-overwrite"):Rl(this.display.cursorDiv,"CodeMirror-overwrite"),Cl(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==Fi()},scrollTo:Nt(function(e,t){(null!=e||null!=t)&&Or(this),null!=e&&(this.curOp.scrollLeft=e),null!=t&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Ve(this)-this.display.barHeight,width:e.scrollWidth-Ve(this)-this.display.barWidth,clientHeight:je(this),clientWidth:Ke(this)}},scrollIntoView:Nt(function(e,t){if(null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:No(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line)Or(this),this.curOp.scrollToPos=e;else{var r=Nr(this,Math.min(e.from.left,e.to.left),Math.min(e.from.top,e.to.top)-e.margin,Math.max(e.from.right,e.to.right),Math.max(e.from.bottom,e.to.bottom)+e.margin);this.scrollTo(r.scrollLeft,r.scrollTop)}}),setSize:Nt(function(e,t){function r(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}var n=this;null!=e&&(n.display.wrapper.style.width=r(e)),null!=t&&(n.display.wrapper.style.height=r(t)),n.options.lineWrapping&&nt(this);var i=n.display.viewFrom;n.doc.iter(i,n.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){Ht(n,i,"widget");break}++i}),n.curOp.forceUpdate=!0,Cl(n,"refresh",this)}),operation:function(e){return Tt(this,e)},refresh:Nt(function(){var e=this.display.cachedTextHeight;Dt(this),this.curOp.forceUpdate=!0,it(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),c(this),(null==e||Math.abs(e-gt(this.display))>.5)&&l(this),Cl(this,"refresh",this)}),swapDoc:Nt(function(e){var t=this.doc;return t.cm=null,Vn(this,e),it(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,vi(this,"swapDoc",this,t),t}),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}},xi(e);var Ko=e.defaults={},jo=e.optionHandlers={},Xo=e.Init={toString:function(){return"CodeMirror.Init"}};Er("value","",function(e,t){e.setValue(t)},!0),Er("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),Er("indentUnit",2,r,!0),Er("indentWithTabs",!1),Er("smartIndent",!0),Er("tabSize",4,function(e){n(e),it(e),Dt(e)},!0),Er("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t){e.options.specialChars=new RegExp(t.source+(t.test(" ")?"":"| "),"g"),e.refresh()},!0),Er("specialCharPlaceholder",Dn,function(e){e.refresh()},!0),Er("electricChars",!0),Er("inputStyle",wo?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Er("rtlMoveVisually",!Co),Er("wholeLineUpdateBefore",!0),Er("theme","default",function(e){s(e),a(e)},!0),Er("keyMap","default",function(t,r,n){var i=Rr(r),o=n!=e.Init&&Rr(n);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),Er("extraKeys",null),Er("lineWrapping",!1,i,!0),Er("gutters",[],function(e){d(e.options),a(e)},!0),Er("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?L(e.display)+"px":"0",e.refresh()},!0),Er("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),Er("scrollbarStyle","native",function(e){m(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Er("lineNumbers",!1,function(e){d(e.options),a(e)},!0),Er("firstLineNumber",1,a,!0),Er("lineNumberFormatter",function(e){return e},a,!0),Er("showCursorWhenSelecting",!1,Oe,!0),Er("resetSelectionOnContextMenu",!0),Er("readOnly",!1,function(e,t){"nocursor"==t?(cr(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||e.display.input.reset())}),Er("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Er("dragDrop",!0),Er("cursorBlinkRate",530),Er("cursorScrollMargin",0),Er("cursorHeight",1,Oe,!0),Er("singleCursorHeightPerLine",!0,Oe,!0),Er("workTime",100),Er("workDelay",100),Er("flattenSpans",!0,n,!0),Er("addModeClass",!1,n,!0),Er("pollInterval",100),Er("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),Er("historyEventDelay",1250),Er("viewportMargin",10,function(e){e.refresh()},!0),Er("maxHighlightLength",1e4,n,!0),Er("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Er("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),Er("autofocus",null);var _o=e.modes={},Yo=e.mimeModes={};e.defineMode=function(t,r){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(r.dependencies=Array.prototype.slice.call(arguments,2)),_o[t]=r},e.defineMIME=function(e,t){Yo[e]=t},e.resolveMode=function(t){if("string"==typeof t&&Yo.hasOwnProperty(t))t=Yo[t];else if(t&&"string"==typeof t.name&&Yo.hasOwnProperty(t.name)){var r=Yo[t.name];"string"==typeof r&&(r={name:r}),t=Ai(r,t),t.name=r.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,r){var r=e.resolveMode(r),n=_o[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if($o.hasOwnProperty(r.name)){var o=$o[r.name];for(var l in o)o.hasOwnProperty(l)&&(i.hasOwnProperty(l)&&(i["_"+l]=i[l]),i[l]=o[l])}if(i.name=r.name,r.helperType&&(i.helperType=r.helperType),r.modeProps)for(var l in r.modeProps)i[l]=r.modeProps[l];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var $o=e.modeExtensions={};e.extendMode=function(e,t){var r=$o.hasOwnProperty(e)?$o[e]:$o[e]={};Wi(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){pl.prototype[e]=t},e.defineOption=Er;var qo=[];e.defineInitHook=function(e){qo.push(e)};var Zo=e.helpers={};e.registerHelper=function(t,r,n){Zo.hasOwnProperty(t)||(Zo[t]=e[t]={_global:[]}),Zo[t][r]=n},e.registerGlobalHelper=function(t,r,n,i){e.registerHelper(t,r,i),Zo[t]._global.push({pred:n,val:i})};var Qo=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r},Jo=e.startState=function(e,t,r){return e.startState?e.startState(t,r):!0};e.innerMode=function(e,t){for(;e.innerMode;){var r=e.innerMode(t);if(!r||r.mode==e)break;t=r.state,e=r.mode}return r||{mode:e,state:t}};var el=e.commands={selectAll:function(e){e.setSelection(No(e.firstLine(),0),No(e.lastLine()),Tl)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Tl)},killLine:function(e){Ir(e,function(t){if(t.empty()){var r=Kn(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:No(t.head.line+1,0)}:{from:t.head,to:No(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){Ir(e,function(t){return{from:No(t.from().line,0),to:pe(e.doc,No(t.to().line+1,0))}})},delLineLeft:function(e){Ir(e,function(e){return{from:No(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){Ir(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return{from:n,to:t.from()}})},delWrappedLineRight:function(e){Ir(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},undo:function(e){e.undo()},redo:function(e){e.redo()},undoSelection:function(e){e.undoSelection()},redoSelection:function(e){e.redoSelection()},goDocStart:function(e){e.extendSelection(No(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(No(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return Qi(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){return eo(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){e.extendSelectionsBy(function(t){return Ji(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},Nl)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},Nl)},goLineLeftSmart:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?eo(e,t.head):n},Nl)},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),l=Al(e.getLine(o.line),o.ch,n);t.push(new Array(n-l%n+1).join(" "))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){Tt(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){var i=t[n].head,o=Kn(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new No(i.line,i.ch-1)),i.ch>0)i=new No(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),No(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=Kn(e.doc,i.line-1).text;l&&e.replaceRange(o.charAt(0)+"\n"+l.charAt(l.length-1),No(i.line-1,l.length-1),No(i.line,1),"+transpose")}r.push(new ce(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){Tt(e,function(){for(var t=e.listSelections().length,r=0;t>r;r++){var n=e.listSelections()[r];e.replaceRange("\n",n.anchor,n.head,"+input"),e.indentLine(n.from().line+1,null,!0),Wr(e)}})},toggleOverwrite:function(e){e.toggleOverwrite()}},tl=e.keyMap={};tl.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"},tl.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"},tl.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"},tl.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"]},tl["default"]=xo?tl.macDefault:tl.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=Mi(r.split(" "),Fr),o=0;o<i.length;o++){var l,s;o==i.length-1?(s=r,l=n):(s=i.slice(0,o+1).join(" "),l="...");var a=t[s];if(a){if(a!=l)throw new Error("Inconsistent bindings for "+s)}else t[s]=l}delete e[r]}for(var u in t)e[u]=t[u];return e};var rl=e.lookupKey=function(e,t,r,n){t=Rr(t);var i=t.call?t.call(e,n):t[e];if(i===!1)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return rl(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var l=rl(e,t.fallthrough[o],r,n);if(l)return l}}},nl=e.isModifierKey=function(e){var t="string"==typeof e?e:_l[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},il=e.keyName=function(e,t){if(go&&34==e.keyCode&&e["char"])return!1;var r=_l[e.keyCode],n=r;return null==n||e.altGraphKey?!1:(e.altKey&&"Alt"!=r&&(n="Alt-"+n),(Lo?e.metaKey:e.ctrlKey)&&"Ctrl"!=r&&(n="Ctrl-"+n),(Lo?e.ctrlKey:e.metaKey)&&"Cmd"!=r&&(n="Cmd-"+n),!t&&e.shiftKey&&"Shift"!=r&&(n="Shift-"+n),n)};e.fromTextArea=function(t,r){function n(){t.value=u.getValue()}if(r=r?Wi(r):{},r.value=t.value,!r.tabindex&&t.tabIndex&&(r.tabindex=t.tabIndex),!r.placeholder&&t.placeholder&&(r.placeholder=t.placeholder),null==r.autofocus){var i=Fi();r.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(wl(t.form,"submit",n),!r.leaveSubmitMethodAlone)){var o=t.form,l=o.submit;try{var s=o.submit=function(){n(),o.submit=l,o.submit(),o.submit=s}}catch(a){}}r.finishInit=function(e){e.save=n,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,n(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(xl(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=l))}},t.style.display="none";var u=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},r);return u};var ol=e.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};ol.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(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(e){var t=this.string.charAt(this.pos);if("string"==typeof e)var r=t==e;else var r=t&&(e.test?e.test(t):e(t));return r?(++this.pos,t):void 0},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Al(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),
5
  this.lastColumnValue-(this.lineStart?Al(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Al(this.string,null,this.tabSize)-(this.lineStart?Al(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var ll=0,sl=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ll};xi(sl),sl.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&mt(e),wi(this,"clear")){var r=this.find();r&&vi(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var l=this.lines[o],s=Xr(l.markedSpans,this);e&&!this.collapsed?Ht(e,Yn(l),"text"):e&&(null!=s.to&&(i=Yn(l)),null!=s.from&&(n=Yn(l))),l.markedSpans=_r(l.markedSpans,s),null==s.from&&this.collapsed&&!gn(this.doc,l)&&e&&_n(l,gt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var a=fn(this.lines[o]),u=f(a);u>e.display.maxLineLength&&(e.display.maxLine=a,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&Dt(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ne(e.doc)),e&&vi(e,"markerCleared",e,this),t&&bt(e),this.parent&&this.parent.clear()}},sl.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var r,n,i=0;i<this.lines.length;++i){var o=this.lines[i],l=Xr(o.markedSpans,this);if(null!=l.from&&(r=No(t?o:Yn(o),l.from),-1==e))return r;if(null!=l.to&&(n=No(t?o:Yn(o),l.to),1==e))return n}return r&&{from:r,to:n}},sl.prototype.changed=function(){var e=this.find(-1,!0),t=this,r=this.doc.cm;e&&r&&Tt(r,function(){var n=e.line,i=Yn(e.line),o=qe(r,i);if(o&&(rt(o),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!gn(t.doc,n)&&null!=t.height){var l=t.height;t.height=null;var s=yn(t)-l;s&&_n(n,n.height+s)}})},sl.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=Ti(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},sl.prototype.detachLine=function(e){if(this.lines.splice(Ti(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var ll=0,al=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};xi(al),al.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();vi(this,"clear")}},al.prototype.find=function(e,t){return this.primary.find(e,t)};var ul=e.LineWidget=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.cm=e,this.node=t};xi(ul),ul.prototype.clear=function(){var e=this.cm,t=this.line.widgets,r=this.line,n=Yn(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=yn(this);Tt(e,function(){mn(e,r,-o),Ht(e,n,"widget"),_n(r,Math.max(0,r.height-o))})}},ul.prototype.changed=function(){var e=this.height,t=this.cm,r=this.line;this.height=null;var n=yn(this)-e;n&&Tt(t,function(){t.curOp.forceUpdate=!0,mn(t,r,n),_n(r,r.height+n)})};var cl=e.Line=function(e,t,r){this.text=e,rn(this,t),this.height=r?r(this):1};xi(cl),cl.prototype.lineNo=function(){return Yn(this)};var fl={},hl={};Bn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;n>r;++r){var i=this.lines[r];this.height-=i.height,xn(i),vi(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;n>e;++e)if(r(this.lines[e]))return!0}},Gn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(i>e){var o=Math.min(t,i-e),l=n.height;if(n.removeInner(e,o),this.height-=l-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Bn))){var s=[];this.collapse(s),this.children=[new Bn(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(o>=e){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(;i.lines.length>50;){var l=i.lines.splice(i.lines.length-25,25),s=new Bn(l);i.height-=s.height,this.children.splice(n+1,0,s),s.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Gn(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=Ti(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new Gn(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(o>e){var l=Math.min(t,o-e);if(i.iterN(e,l,r))return!0;if(0==(t-=l))break;e=0}else e-=o}}};var dl=0,pl=e.Doc=function(e,t,r){if(!(this instanceof pl))return new pl(e,t,r);null==r&&(r=0),Gn.call(this,[new Bn([new cl("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var n=No(r,0);this.sel=he(n),this.history=new Qn(null),this.id=++dl,this.modeOption=t,"string"==typeof e&&(e=Vl(e)),Rn(this,{from:n,to:n,text:e}),ke(this,he(n),Tl)};pl.prototype=Ai(Gn.prototype,{constructor:pl,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Xn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||"\n")},setValue:At(function(e){var t=No(this.first,0),r=this.first+this.size-1;yr(this,{from:t,to:No(r,Kn(this,r).text.length),text:Vl(e),origin:"setValue",full:!0},!0),ke(this,he(t))}),replaceRange:function(e,t,r,n){t=pe(this,t),r=r?pe(this,r):t,Lr(this,e,t,r,n)},getRange:function(e,t,r){var n=jn(this,pe(this,e),pe(this,t));return r===!1?n:n.join(r||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){return ve(this,e)?Kn(this,e):void 0},getLineNumber:function(e){return Yn(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Kn(this,e)),fn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return pe(this,e)},getCursor:function(e){var t,r=this.sel.primary();return t=null==e||"head"==e?r.head:"anchor"==e?r.anchor:"end"==e||"to"==e||e===!1?r.to():r.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:At(function(e,t,r){Ce(this,pe(this,"number"==typeof e?No(e,t||0):e),null,r)}),setSelection:At(function(e,t,r){Ce(this,pe(this,e),pe(this,t||e),r)}),extendSelection:At(function(e,t,r){be(this,pe(this,e),t&&pe(this,t),r)}),extendSelections:At(function(e,t){we(this,me(this,e,t))}),extendSelectionsBy:At(function(e,t){we(this,Mi(this.sel.ranges,e),t)}),setSelections:At(function(e,t,r){if(e.length){for(var n=0,i=[];n<e.length;n++)i[n]=new ce(pe(this,e[n].anchor),pe(this,e[n].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),ke(this,fe(i,t),r)}}),addSelection:At(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new ce(pe(this,e),pe(this,t||e))),ke(this,fe(n,n.length-1),r)}),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=jn(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return e===!1?t:t.join(e||"\n")},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=jn(this,r[n].from(),r[n].to());e!==!1&&(i=i.join(e||"\n")),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:At(function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var l=i.ranges[o];n[o]={from:l.from(),to:l.to(),text:Vl(e[o]),origin:r}}for(var s=t&&"end"!=t&&vr(this,n,t),o=n.length-1;o>=0;o--)yr(this,n[o]);s?Le(this,s):this.cm&&Wr(this.cm)}),undo:At(function(){wr(this,"undo")}),redo:At(function(){wr(this,"redo")}),undoSelection:At(function(){wr(this,"undo",!0)}),redoSelection:At(function(){wr(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new Qn(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:ui(this.history.done),undone:ui(this.history.undone)}},setHistory:function(e){var t=this.history=new Qn(this.history.maxGeneration);t.done=ui(e.done.slice(0),null,!0),t.undone=ui(e.undone.slice(0),null,!0)},addLineClass:At(function(e,t,r){return Hr(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(Ri(r).test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0})}),removeLineClass:At(function(e,t,r){return Hr(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var o=i.match(Ri(r));if(!o)return!1;var l=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&l!=i.length?" ":"")+i.slice(l)||null}return!0})}),markText:function(e,t,r){return Br(this,pe(this,e),pe(this,t),r,"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared};return e=pe(this,e),Br(this,e,e,r,"bookmark")},findMarksAt:function(e){e=pe(this,e);var t=[],r=Kn(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=pe(this,e),t=pe(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l)for(var s=0;s<l.length;s++){var a=l[s];i==e.line&&e.ch>a.to||null==a.from&&i!=e.line||i==t.line&&a.from>t.ch||r&&!r(a.marker)||n.push(a.marker.parent||a.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first;return this.iter(function(n){var i=n.text.length+1;return i>e?(t=e,!0):(e-=i,void++r)}),pe(this,No(r,t))},indexFromPos:function(e){e=pe(this,e);var t=e.ch;return e.line<this.first||e.ch<0?0:(this.iter(this.first,e.line,function(e){t+=e.text.length+1}),t)},copy:function(e){var t=new pl(Xn(this,this.first,this.first+this.size),this.modeOption,this.first);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new pl(Xn(this,t,r),e.mode||this.modeOption,t);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Vr(n,Ur(this)),n},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(var r=0;r<this.linked.length;++r){var n=this.linked[r];if(n.doc==t){this.linked.splice(r,1),t.unlinkDoc(this),Kr(Ur(this));break}}if(t.history==this.history){var i=[t.id];Un(t,function(e){i.push(e.id)},!0),t.history=new Qn(null),t.history.done=ui(this.history.done,i),t.history.undone=ui(this.history.undone,i)}},iterLinkedDocs:function(e){Un(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),pl.prototype.eachLine=pl.prototype.iter;var gl="iter insert remove copy getEditor".split(" ");for(var vl in pl.prototype)pl.prototype.hasOwnProperty(vl)&&Ti(gl,vl)<0&&(e.prototype[vl]=function(e){return function(){return e.apply(this.doc,arguments)}}(pl.prototype[vl]));xi(pl);var ml=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},yl=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},bl=e.e_stop=function(e){ml(e),yl(e)},wl=e.on=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={}),i=n[t]||(n[t]=[]);i.push(r)}},xl=e.off=function(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers&&e._handlers[t];if(!n)return;for(var i=0;i<n.length;++i)if(n[i]==r){n.splice(i,1);break}}},Cl=e.signal=function(e,t){var r=e._handlers&&e._handlers[t];if(r)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)},Sl=null,Ll=30,kl=e.Pass={toString:function(){return"CodeMirror.Pass"}},Tl={scroll:!1},Ml={origin:"*mouse"},Nl={origin:"+move"};Ci.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Al=e.countColumn=function(e,t,r,n,i){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=n||0,l=i||0;;){var s=e.indexOf(" ",o);if(0>s||s>=t)return l+(t-o);l+=s-o,l+=r-l%r,o=s+1}},Wl=[""],Ol=function(e){e.select()};bo?Ol=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:uo&&(Ol=function(e){try{e.select()}catch(t){}});var Dl,Hl=/[\u00df\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Il=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Hl.test(e))},Pl=/[\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]/;Dl=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(i){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var zl=e.contains=function(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do if(11==t.nodeType&&(t=t.host),t==e)return!0;while(t=t.parentNode)};uo&&11>co&&(Fi=function(){try{return document.activeElement}catch(e){return document.body}});var El,Fl,Rl=e.rmClass=function(e,t){var r=e.className,n=Ri(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}},Bl=e.addClass=function(e,t){var r=e.className;Ri(t).test(r)||(e.className+=(r?" ":"")+t)},Gl=!1,Ul=function(){if(uo&&9>co)return!1;var e=Pi("div");return"draggable"in e||"dragDrop"in e}(),Vl=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;n>=t;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),t+=l+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},Kl=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(r){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},jl=function(){var e=Pi("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Xl=null,_l={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"};e.keyNames=_l,function(){for(var e=0;10>e;e++)_l[e+48]=_l[e+96]=String(e);for(var e=65;90>=e;e++)_l[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)_l[e+111]=_l[e+63235]="F"+e}();var Yl,$l=function(){function e(e){return 247>=e?r.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?n.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,r){this.level=e,this.from=t,this.to=r}var r="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,l=/[LRr]/,s=/[Lb1n]/,a=/[1n]/,u="L";return function(r){if(!i.test(r))return!1;for(var n,c=r.length,f=[],h=0;c>h;++h)f.push(n=e(r.charCodeAt(h)));for(var h=0,d=u;c>h;++h){var n=f[h];"m"==n?f[h]=d:d=n}for(var h=0,p=u;c>h;++h){var n=f[h];"1"==n&&"r"==p?f[h]="n":l.test(n)&&(p=n,"r"==n&&(f[h]="R"))}for(var h=1,d=f[0];c-1>h;++h){var n=f[h];"+"==n&&"1"==d&&"1"==f[h+1]?f[h]="1":","!=n||d!=f[h+1]||"1"!=d&&"n"!=d||(f[h]=d),d=n}for(var h=0;c>h;++h){var n=f[h];if(","==n)f[h]="N";else if("%"==n){for(var g=h+1;c>g&&"%"==f[g];++g);for(var v=h&&"!"==f[h-1]||c>g&&"1"==f[g]?"1":"N",m=h;g>m;++m)f[m]=v;h=g-1}}for(var h=0,p=u;c>h;++h){var n=f[h];"L"==p&&"1"==n?f[h]="L":l.test(n)&&(p=n)}for(var h=0;c>h;++h)if(o.test(f[h])){for(var g=h+1;c>g&&o.test(f[g]);++g);for(var y="L"==(h?f[h-1]:u),b="L"==(c>g?f[g]:u),v=y||b?"L":"R",m=h;g>m;++m)f[m]=v;h=g-1}for(var w,x=[],h=0;c>h;)if(s.test(f[h])){var C=h;for(++h;c>h&&s.test(f[h]);++h);x.push(new t(0,C,h))}else{var S=h,L=x.length;for(++h;c>h&&"L"!=f[h];++h);for(var m=S;h>m;)if(a.test(f[m])){m>S&&x.splice(L,0,new t(1,S,m));var k=m;for(++m;h>m&&a.test(f[m]);++m);x.splice(L,0,new t(2,k,m)),S=m}else++m;h>S&&x.splice(L,0,new t(1,S,h))}return 1==x[0].level&&(w=r.match(/^\s+/))&&(x[0].from=w[0].length,x.unshift(new t(0,0,w[0].length))),1==ki(x).level&&(w=r.match(/\s+$/))&&(ki(x).to-=w[0].length,x.push(new t(0,c-w[0].length,c))),x[0].level!=ki(x).level&&x.push(new t(x[0].level,c,c)),x}}();return e.version="5.0.0",e});
1
+ !function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define([],e);this.CodeMirror=e()}}(function(){"use strict";function e(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n?Wi(n):{},Wi(Ko,n,!1),d(n);var i=n.value;"string"==typeof i&&(i=new pl(i,n.mode)),this.doc=i;var o=new e.inputStyles[n.inputStyle](this),l=this.display=new t(r,i,o);l.wrapper.CodeMirror=this,u(this),s(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),n.autofocus&&!wo&&l.input.focus(),m(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Ci,keySeq:null};var a=this;uo&&11>co&&setTimeout(function(){a.display.input.reset(!0)},20),Rt(this),Ui(),mt(this),this.curOp.forceUpdate=!0,Vn(this,i),n.autofocus&&!wo||a.hasFocus()?setTimeout(Oi(ur,this),20):cr(this);for(var c in jo)jo.hasOwnProperty(c)&&jo[c](this,n[c],Xo);C(this),n.finishInit&&n.finishInit(this);for(var f=0;f<qo.length;++f)qo[f](this);bt(this),fo&&n.lineWrapping&&"optimizelegibility"==getComputedStyle(l.lineDiv).textRendering&&(l.lineDiv.style.textRendering="auto")}function t(e,t,r){var n=this;this.input=r,n.scrollbarFiller=Pi("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=Pi("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=Pi("div",null,"CodeMirror-code"),n.selectionDiv=Pi("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=Pi("div",null,"CodeMirror-cursors"),n.measure=Pi("div",null,"CodeMirror-measure"),n.lineMeasure=Pi("div",null,"CodeMirror-measure"),n.lineSpace=Pi("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none"),n.mover=Pi("div",[Pi("div",[n.lineSpace],"CodeMirror-lines")],null,"position: relative"),n.sizer=Pi("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=Pi("div",null,null,"position: absolute; height: "+Ll+"px; width: 1px;"),n.gutters=Pi("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=Pi("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=Pi("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),uo&&8>co&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),fo||lo&&wo||(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,r.init(n)}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),n(t)}function n(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,ze(e,100),e.state.modeGen++,e.curOp&&Dt(e)}function i(e){e.options.lineWrapping?(Bl(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Rl(e.display.wrapper,"CodeMirror-wrap"),h(e)),l(e),Dt(e),it(e),setTimeout(function(){y(e)},100)}function o(e){var t=gt(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/vt(e.display)-3);return function(i){if(gn(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l<i.widgets.length;l++)i.widgets[l].height&&(o+=i.widgets[l].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function l(e){var t=e.doc,r=o(e);t.iter(function(e){var t=r(e);t!=e.height&&_n(e,t)})}function s(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),it(e)}function a(e){u(e),Dt(e),setTimeout(function(){x(e)},20)}function u(e){var t=e.display.gutters,r=e.options.gutters;zi(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(Pi("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none",c(e)}function c(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function f(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=an(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=un(n);){var i=t.find(0,!0);r-=n.text.length-i.from.ch,n=i.to.line,r+=n.text.length-i.to.ch}return r}function h(e){var t=e.display,r=e.doc;t.maxLine=Kn(r,r.first),t.maxLineLength=f(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=f(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function d(e){var t=Ti(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function p(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Ge(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Ve(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function g(e,t,r){this.cm=r;var n=this.vert=Pi("div",[Pi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=Pi("div",[Pi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),wl(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),wl(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedOverlay=!1,uo&&8>co&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function v(){}function m(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Rl(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),wl(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,r){"horizontal"==r?Qt(t,e):Zt(t,e)},t),t.display.scrollbars.addClass&&Bl(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=p(e));var r=e.display.barWidth,n=e.display.barHeight;b(e,t);for(var i=0;4>i&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&O(e),b(e,p(e)),r=e.display.barWidth,n=e.display.barHeight}function b(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}function w(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Be(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=$n(t,n),l=$n(t,i);if(r&&r.ensure){var s=r.ensure.from.line,a=r.ensure.to.line;o>s?(o=s,l=$n(t,qn(Kn(t,s))+e.wrapper.clientHeight)):Math.min(a,t.lastLine())>=l&&(o=$n(t,qn(Kn(t,a))-e.wrapper.clientHeight),l=a)}return{from:o,to:Math.max(l,o+1)}}function x(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=L(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",l=0;l<r.length;l++)if(!r[l].hidden){e.options.fixedGutter&&r[l].gutter&&(r[l].gutter.style.left=o);var s=r[l].alignable;if(s)for(var a=0;a<s.length;a++)s[a].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function C(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=S(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(Pi("div",[Pi("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,l=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-l),n.lineNumWidth=n.lineNumInnerWidth+l,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",c(e),!0}return!1}function S(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function L(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function k(e,t,r){var n=e.display;this.viewport=t,this.visible=w(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Ke(e),this.force=r,this.dims=H(e),this.events=[]}function T(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Ve(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ve(e)+"px",t.scrollbarsClipped=!0)}function M(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return It(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Ft(e))return!1;C(e)&&(It(e),t.dims=H(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>l&&r.viewTo-l<20&&(l=Math.min(i,r.viewTo)),Mo&&(o=dn(e.doc,o),l=pn(e.doc,l));var s=o!=r.viewFrom||l!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Et(e,o,l),r.viewOffset=qn(Kn(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var a=Ft(e);if(!s&&0==a&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var u=Fi();return a>4&&(r.lineDiv.style.display="none"),I(e,r.updateLineNumbers,t.dims),a>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,u&&Fi()!=u&&u.offsetHeight&&u.focus(),zi(r.cursorDiv),zi(r.selectionDiv),r.gutters.style.height=0,s&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,ze(e,400)),r.updateLineNumbers=null,!0}function N(e,t){for(var r=t.force,n=t.viewport,i=!0;;i=!1){if(i&&e.options.lineWrapping&&t.oldDisplayWidth!=Ke(e))r=!0;else if(r=!1,n&&null!=n.top&&(n={top:Math.min(e.doc.height+Ge(e.display)-je(e),n.top)}),t.visible=w(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!M(e,t))break;O(e);var o=p(e);Oe(e),W(e,o),y(e,o)}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function A(e,t){var r=new k(e,t);if(M(e,r)){O(e),N(e,r);var n=p(e);Oe(e),W(e,n),y(e,n),r.finish()}}function W(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var r=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=r+"px",e.display.gutters.style.height=Math.max(r+Ve(e),t.clientHeight)+"px"}function O(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i,o=t.view[n];if(!o.hidden){if(uo&&8>co){var l=o.node.offsetTop+o.node.offsetHeight;i=l-r,r=l}else{var s=o.node.getBoundingClientRect();i=s.bottom-s.top}var a=o.line.height-i;if(2>i&&(i=gt(t)),(a>.001||-.001>a)&&(_n(o.line,i),D(o.line),o.rest))for(var u=0;u<o.rest.length;u++)D(o.rest[u])}}}function D(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.offsetHeight}function H(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l)r[e.options.gutters[l]]=o.offsetLeft+o.clientLeft+i,n[e.options.gutters[l]]=o.clientWidth;return{fixedPos:L(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function I(e,t,r){function n(t){var r=t.nextSibling;return fo&&xo&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var i=e.display,o=e.options.lineNumbers,l=i.lineDiv,s=l.firstChild,a=i.view,u=i.viewFrom,c=0;c<a.length;c++){var f=a[c];if(f.hidden);else if(f.node&&f.node.parentNode==l){for(;s!=f.node;)s=n(s);var h=o&&null!=t&&u>=t&&f.lineNumber;f.changes&&(Ti(f.changes,"gutter")>-1&&(h=!1),P(e,f,u,r)),h&&(zi(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(S(e.options,u)))),s=f.node.nextSibling}else{var d=V(e,f,u,r);l.insertBefore(d,s)}u+=f.size}for(;s;)s=n(s)}function P(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?R(e,t):"gutter"==o?G(e,t,r,n):"class"==o?B(t):"widget"==o&&U(e,t,n)}t.changes=null}function z(e){return e.node==e.text&&(e.node=Pi("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),uo&&8>co&&(e.node.style.zIndex=2)),e.node}function E(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var r=z(e);e.background=r.insertBefore(Pi("div",null,t),r.firstChild)}}function F(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):On(e,t)}function R(e,t){var r=t.text.className,n=F(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,B(t)):r&&(t.text.className=r)}function B(e){E(e),e.line.wrapClass?z(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function G(e,t,r,n){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null);var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var o=z(t),l=t.gutter=Pi("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px");if(e.display.input.setUneditable(l),o.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),!e.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(t.lineNumber=l.appendChild(Pi("div",S(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),i)for(var s=0;s<e.options.gutters.length;++s){var a=e.options.gutters[s],u=i.hasOwnProperty(a)&&i[a];u&&l.appendChild(Pi("div",[u],"CodeMirror-gutter-elt","left: "+n.gutterLeft[a]+"px; width: "+n.gutterWidth[a]+"px"))}}}function U(e,t,r){t.alignable&&(t.alignable=null);for(var n,i=t.node.firstChild;i;i=n){var n=i.nextSibling;"CodeMirror-linewidget"==i.className&&t.node.removeChild(i)}K(e,t,r)}function V(e,t,r,n){var i=F(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),B(t),G(e,t,r,n),K(e,t,n),t.node}function K(e,t,r){if(j(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)j(e,t.rest[n],t,r,!1)}function j(e,t,r,n,i){if(t.widgets)for(var o=z(r),l=0,s=t.widgets;l<s.length;++l){var a=s[l],u=Pi("div",[a.node],"CodeMirror-linewidget");a.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),X(a,u,r,n),e.display.input.setUneditable(u),i&&a.above?o.insertBefore(u,r.gutter||r.text):o.appendChild(u),vi(a,"redraw")}}function X(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function _(e){return No(e.line,e.ch)}function Y(e,t){return Ao(e,t)<0?t:e}function $(e,t){return Ao(e,t)<0?e:t}function q(e){e.state.focused||(e.display.input.focus(),ur(e))}function Z(e){return e.options.readOnly||e.doc.cantEdit}function Q(e,t,r,n){var i=e.doc;e.display.shift=!1,n||(n=i.sel);var o=Vl(t),l=null;e.state.pasteIncoming&&n.ranges.length>1&&(Wo&&Wo.join("\n")==t?l=n.ranges.length%Wo.length==0&&Mi(Wo,Vl):o.length==n.ranges.length&&(l=Mi(o,function(e){return[e]})));for(var s=n.ranges.length-1;s>=0;s--){var a=n.ranges[s],u=a.from(),c=a.to();a.empty()&&(r&&r>0?u=No(u.line,u.ch-r):e.state.overwrite&&!e.state.pasteIncoming&&(c=No(c.line,Math.min(Kn(i,c.line).text.length,c.ch+ki(o).length))));var f=e.curOp.updateInput,h={from:u,to:c,text:l?l[s%l.length]:o,origin:e.state.pasteIncoming?"paste":e.state.cutIncoming?"cut":"+input"};if(yr(e.doc,h),vi(e,"inputRead",e,h),t&&!e.state.pasteIncoming&&e.options.electricChars&&e.options.smartIndent&&a.head.ch<100&&(!s||n.ranges[s-1].head.line!=a.head.line)){var d=e.getModeAt(a.head),p=Vo(h);if(d.electricChars){for(var g=0;g<d.electricChars.length;g++)if(t.indexOf(d.electricChars.charAt(g))>-1){Dr(e,p.line,"smart");break}}else d.electricInput&&d.electricInput.test(Kn(i,p.line).text.slice(0,p.ch))&&Dr(e,p.line,"smart")}}Wr(e),e.curOp.updateInput=f,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function J(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:No(i,0),head:No(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function ee(e){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false")}function te(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Ci,this.inaccurateSelection=!1,this.hasSelection=!1}function re(){var e=Pi("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none"),t=Pi("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return fo?e.style.width="1000px":e.setAttribute("wrap","off"),bo&&(e.style.border="1px solid black"),ee(e),t}function ne(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Ci}function ie(e,t){var r=qe(e,t.line);if(!r||r.hidden)return null;var n=Kn(e.doc,t.line),i=_e(r,n,t.line),o=Zn(n),l="left";if(o){var s=ro(o,t.ch);l=s%2?"right":"left"}var a=Je(i.map,t.ch,"left");return a.offset="right"==a.collapse?a.end:a.start,a}function oe(e,t){return t&&(e.bad=!0),e}function le(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return oe(e.clipPos(No(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return se(o,t,r)}}function se(e,t,r){function n(t,r,n){for(var i=-1;i<(c?c.length:0);i++)for(var o=0>i?u.map:c[i],l=0;l<o.length;l+=3){var s=o[l+2];if(s==t||s==r){var a=Yn(0>i?e.line:e.rest[i]),f=o[l]+n;return(0>n||s!=t)&&(f=o[l+(n?1:0)]),No(a,f)}}}var i=e.text.firstChild,o=!1;if(!t||!zl(i,t))return oe(No(Yn(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[r],r=0,!t)){var l=e.rest?ki(e.rest):e.line;return oe(No(Yn(l),l.text.length),o)}var s=3==t.nodeType?t:null,a=t;for(s||1!=t.childNodes.length||3!=t.firstChild.nodeType||(s=t.firstChild,r&&(r=s.nodeValue.length));a.parentNode!=i;)a=a.parentNode;var u=e.measure,c=u.maps,f=n(s,a,r);if(f)return oe(f,o);for(var h=a.nextSibling,d=s?s.nodeValue.length-r:0;h;h=h.nextSibling){if(f=n(h,h.firstChild,0))return oe(No(f.line,f.ch-d),o);d+=h.textContent.length}for(var p=a.previousSibling,d=r;p;p=p.previousSibling){if(f=n(p,p.firstChild,-1))return oe(No(f.line,f.ch+d),o);d+=h.textContent.length}}function ae(e,t,r,n,i){function o(e){return function(t){return t.id==e}}function l(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return""==r&&(r=t.textContent.replace(/\u200b/g,"")),void(s+=r);var u,c=t.getAttribute("cm-marker");if(c){var f=e.findMarks(No(n,0),No(i+1,0),o(+c));return void(f.length&&(u=f[0].find())&&(s+=jn(e.doc,u.from,u.to).join("\n")))}if("false"==t.getAttribute("contenteditable"))return;for(var h=0;h<t.childNodes.length;h++)l(t.childNodes[h]);/^(pre|div|p)$/i.test(t.nodeName)&&(a=!0)}else if(3==t.nodeType){var d=t.nodeValue;if(!d)return;a&&(s+="\n",a=!1),s+=d}}for(var s="",a=!1;l(t),t!=r;)t=t.nextSibling;return s}function ue(e,t){this.ranges=e,this.primIndex=t}function ce(e,t){this.anchor=e,this.head=t}function fe(e,t){var r=e[t];e.sort(function(e,t){return Ao(e.from(),t.from())}),t=Ti(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(Ao(o.to(),i.from())>=0){var l=$(o.from(),i.from()),s=Y(o.to(),i.to()),a=o.empty()?i.from()==i.head:o.from()==o.head;t>=n&&--t,e.splice(--n,2,new ce(a?s:l,a?l:s))}}return new ue(e,t)}function he(e,t){return new ue([new ce(e,t||e)],0)}function de(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function pe(e,t){if(t.line<e.first)return No(e.first,0);var r=e.first+e.size-1;return t.line>r?No(r,Kn(e,r).text.length):ge(t,Kn(e,t.line).text.length)}function ge(e,t){var r=e.ch;return null==r||r>t?No(e.line,t):0>r?No(e.line,0):e}function ve(e,t){return t>=e.first&&t<e.first+e.size}function me(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=pe(e,t[n]);return r}function ye(e,t,r,n){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(n){var o=Ao(r,i)<0;o!=Ao(n,i)<0?(i=r,r=n):o!=Ao(r,n)<0&&(r=n)}return new ce(i,r)}return new ce(n||r,r)}function be(e,t,r,n){ke(e,new ue([ye(e,e.sel.primary(),t,r)],0),n)}function we(e,t,r){for(var n=[],i=0;i<e.sel.ranges.length;i++)n[i]=ye(e,e.sel.ranges[i],t[i],null);var o=fe(n,e.sel.primIndex);ke(e,o,r)}function xe(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,ke(e,fe(i,e.sel.primIndex),n)}function Ce(e,t,r,n){ke(e,he(t,r),n)}function Se(e,t){var r={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new ce(pe(e,t[r].anchor),pe(e,t[r].head))}};return Cl(e,"beforeSelectionChange",e,r),e.cm&&Cl(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?fe(r.ranges,r.ranges.length-1):t}function Le(e,t,r){var n=e.history.done,i=ki(n);i&&i.ranges?(n[n.length-1]=t,Te(e,t,r)):ke(e,t,r)}function ke(e,t,r){Te(e,t,r),ii(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Te(e,t,r){(wi(e,"beforeSelectionChange")||e.cm&&wi(e.cm,"beforeSelectionChange"))&&(t=Se(e,t));var n=r&&r.bias||(Ao(t.primary().head,e.sel.primary().head)<0?-1:1);Me(e,Ae(e,t,n,!0)),r&&r.scroll===!1||!e.cm||Wr(e.cm)}function Me(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,bi(e.cm)),vi(e,"cursorActivity",e))}function Ne(e){Me(e,Ae(e,e.sel,null,!1),Tl)}function Ae(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var l=t.ranges[o],s=We(e,l.anchor,r,n),a=We(e,l.head,r,n);(i||s!=l.anchor||a!=l.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new ce(s,a))}return i?fe(i,t.primIndex):t}function We(e,t,r,n){var i=!1,o=t,l=r||1;e.cantEdit=!1;e:for(;;){var s=Kn(e,o.line);if(s.markedSpans)for(var a=0;a<s.markedSpans.length;++a){var u=s.markedSpans[a],c=u.marker;if((null==u.from||(c.inclusiveLeft?u.from<=o.ch:u.from<o.ch))&&(null==u.to||(c.inclusiveRight?u.to>=o.ch:u.to>o.ch))){if(n&&(Cl(c,"beforeCursorEnter"),c.explicitlyCleared)){if(s.markedSpans){--a;continue}break}if(!c.atomic)continue;var f=c.find(0>l?-1:1);if(0==Ao(f,o)&&(f.ch+=l,f.ch<0?f=f.line>e.first?pe(e,No(f.line-1)):null:f.ch>s.text.length&&(f=f.line<e.first+e.size-1?No(f.line+1,0):null),!f)){if(i)return n?(e.cantEdit=!0,No(e.first,0)):We(e,t,r,!0);i=!0,f=t,l=-l}o=f;continue e}}return o}}function Oe(e){e.display.input.showSelection(e.display.input.prepareSelection())}function De(e,t){for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),l=0;l<r.sel.ranges.length;l++)if(t!==!1||l!=r.sel.primIndex){var s=r.sel.ranges[l],a=s.empty();(a||e.options.showCursorWhenSelecting)&&He(e,s,i),a||Ie(e,s,o)}return n}function He(e,t,r){var n=ct(e,t.head,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(Pi("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(Pi("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function Ie(e,t,r){function n(e,t,r,n){0>t&&(t=0),t=Math.round(t),n=Math.round(n),s.appendChild(Pi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?c-e:r)+"px; height: "+(n-t)+"px"))}function i(t,r,i){function o(r,n){return ut(e,No(t,r),"div",f,n)}var s,a,f=Kn(l,t),h=f.text.length;return _i(Zn(f),r||0,null==i?h:i,function(e,t,l){var f,d,p,g=o(e,"left");if(e==t)f=g,d=p=g.left;else{if(f=o(t-1,"right"),"rtl"==l){var v=g;g=f,f=v}d=g.left,p=f.right}null==r&&0==e&&(d=u),f.top-g.top>3&&(n(d,g.top,null,g.bottom),d=u,g.bottom<f.top&&n(d,g.bottom,null,f.top)),null==i&&t==h&&(p=c),(!s||g.top<s.top||g.top==s.top&&g.left<s.left)&&(s=g),(!a||f.bottom>a.bottom||f.bottom==a.bottom&&f.right>a.right)&&(a=f),u+1>d&&(d=u),n(d,f.top,p-d,f.bottom)}),{start:s,end:a}}var o=e.display,l=e.doc,s=document.createDocumentFragment(),a=Ue(e.display),u=a.left,c=Math.max(o.sizerWidth,Ke(e)-o.sizer.offsetLeft)-a.right,f=t.from(),h=t.to();if(f.line==h.line)i(f.line,f.ch,h.ch);else{var d=Kn(l,f.line),p=Kn(l,h.line),g=fn(d)==fn(p),v=i(f.line,f.ch,g?d.text.length+1:null).end,m=i(h.line,g?0:null,h.ch).start;g&&(v.top<m.top-2?(n(v.right,v.top,null,v.bottom),n(u,m.top,m.left,m.bottom)):n(v.right,v.top,m.left-v.right,v.bottom)),v.bottom<m.top&&n(u,v.bottom,null,m.top)}r.appendChild(s)}function Pe(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function ze(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,Oi(Ee,e))}function Ee(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=Qo(t.mode,Re(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var l=o.styles,s=Mn(e,o,n,!0);o.styles=s.styles;var a=o.styleClasses,u=s.classes;u?o.styleClasses=u:a&&(o.styleClasses=null);for(var c=!l||l.length!=o.styles.length||a!=u&&(!a||!u||a.bgClass!=u.bgClass||a.textClass!=u.textClass),f=0;!c&&f<l.length;++f)c=l[f]!=o.styles[f];c&&i.push(t.frontier),o.stateAfter=Qo(t.mode,n)}else An(e,o.text,n),o.stateAfter=t.frontier%5==0?Qo(t.mode,n):null;return++t.frontier,+new Date>r?(ze(e,e.options.workDelay),!0):void 0}),i.length&&Tt(e,function(){for(var t=0;t<i.length;t++)Ht(e,i[t],"text")})}}function Fe(e,t,r){for(var n,i,o=e.doc,l=r?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;s>l;--s){if(s<=o.first)return o.first;var a=Kn(o,s-1);if(a.stateAfter&&(!r||s<=o.frontier))return s;var u=Al(a.text,null,e.options.tabSize);(null==i||n>u)&&(i=s-1,n=u)}return i}function Re(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=Fe(e,t,r),l=o>n.first&&Kn(n,o-1).stateAfter;return l=l?Qo(n.mode,l):Jo(n.mode),n.iter(o,t,function(r){An(e,r.text,l);var s=o==t-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;r.stateAfter=s?Qo(n.mode,l):null,++o}),r&&(n.frontier=o),l}function Be(e){return e.lineSpace.offsetTop}function Ge(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Ue(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Ei(e.measure,Pi("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function Ve(e){return Ll-e.display.nativeBarWidth}function Ke(e){return e.display.scroller.clientWidth-Ve(e)-e.display.barWidth}function je(e){return e.display.scroller.clientHeight-Ve(e)-e.display.barHeight}function Xe(e,t,r){var n=e.options.lineWrapping,i=n&&Ke(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var l=t.text.firstChild.getClientRects(),s=0;s<l.length-1;s++){var a=l[s],u=l[s+1];Math.abs(a.bottom-u.bottom)>2&&o.push((a.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}function _e(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var n=0;n<e.rest.length;n++)if(Yn(e.rest[n])>r)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Ye(e,t){t=fn(t);var r=Yn(t),n=e.display.externalMeasured=new Wt(e.doc,t,r);n.lineN=r;var i=n.built=On(e,n);return n.text=i.pre,Ei(e.display.lineMeasure,i.pre),n}function $e(e,t,r,n){return Qe(e,Ze(e,t),r,n)}function qe(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Pt(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Ze(e,t){var r=Yn(t),n=qe(e,r);n&&!n.text?n=null:n&&n.changes&&P(e,n,r,H(e)),n||(n=Ye(e,t));var i=_e(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Qe(e,t,r,n,i){t.before&&(r=-1);var o,l=r+(n||"");return t.cache.hasOwnProperty(l)?o=t.cache[l]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Xe(e,t.view,t.rect),t.hasHeights=!0),o=et(e,t,r,n),o.bogus||(t.cache[l]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function Je(e,t,r){for(var n,i,o,l,s=0;s<e.length;s+=3){var a=e[s],u=e[s+1];if(a>t?(i=0,o=1,l="left"):u>t?(i=t-a,o=i+1):(s==e.length-3||t==u&&e[s+3]>t)&&(o=u-a,i=o-1,t>=u&&(l="right")),null!=i){if(n=e[s+2],a==u&&r==(n.insertLeft?"left":"right")&&(l=r),"left"==r&&0==i)for(;s&&e[s-2]==e[s-3]&&e[s-1].insertLeft;)n=e[(s-=3)+2],l="left";if("right"==r&&i==u-a)for(;s<e.length-3&&e[s+3]==e[s+4]&&!e[s+5].insertLeft;)n=e[(s+=3)+2],l="right";break}}return{node:n,start:i,end:o,collapse:l,coverStart:a,coverEnd:u}}function et(e,t,r,n){var i,o=Je(t.map,r,n),l=o.node,s=o.start,a=o.end,u=o.collapse;if(3==l.nodeType){for(var c=0;4>c;c++){for(;s&&Ii(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+a<o.coverEnd&&Ii(t.line.text.charAt(o.coverStart+a));)++a;if(uo&&9>co&&0==s&&a==o.coverEnd-o.coverStart)i=l.parentNode.getBoundingClientRect();else if(uo&&e.options.lineWrapping){var f=Dl(l,s,a).getClientRects();i=f.length?f["right"==n?f.length-1:0]:Io}else i=Dl(l,s,a).getBoundingClientRect()||Io;if(i.left||i.right||0==s)break;a=s,s-=1,u="right"}uo&&11>co&&(i=tt(e.display.measure,i))}else{s>0&&(u=n="right");var f;i=e.options.lineWrapping&&(f=l.getClientRects()).length>1?f["right"==n?f.length-1:0]:l.getBoundingClientRect()}if(uo&&9>co&&!s&&(!i||!i.left&&!i.right)){var h=l.parentNode.getClientRects()[0];i=h?{left:h.left,right:h.left+vt(e.display),top:h.top,bottom:h.bottom}:Io}for(var d=i.top-t.rect.top,p=i.bottom-t.rect.top,g=(d+p)/2,v=t.view.measure.heights,c=0;c<v.length-1&&!(g<v[c]);c++);var m=c?v[c-1]:0,y=v[c],b={left:("right"==u?i.right:i.left)-t.rect.left,right:("left"==u?i.left:i.right)-t.rect.left,top:m,bottom:y};return i.left||i.right||(b.bogus=!0),e.options.singleCursorHeightPerLine||(b.rtop=d,
2
+ b.rbottom=p),b}function tt(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Xi(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function rt(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function nt(e){e.display.externalMeasure=null,zi(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)rt(e.display.view[t])}function it(e){nt(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ot(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function lt(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function st(e,t,r,n){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=yn(t.widgets[i]);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var l=qn(t);if("local"==n?l+=Be(e.display):l-=e.display.viewOffset,"page"==n||"window"==n){var s=e.display.lineSpace.getBoundingClientRect();l+=s.top+("window"==n?0:lt());var a=s.left+("window"==n?0:ot());r.left+=a,r.right+=a}return r.top+=l,r.bottom+=l,r}function at(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=ot(),i-=lt();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:n-l.left,top:i-l.top}}function ut(e,t,r,n,i){return n||(n=Kn(e.doc,t.line)),st(e,n,$e(e,n,t.ch,i),r)}function ct(e,t,r,n,i,o){function l(t,l){var s=Qe(e,i,t,l?"right":"left",o);return l?s.left=s.right:s.right=s.left,st(e,n,s,r)}function s(e,t){var r=a[t],n=r.level%2;return e==Yi(r)&&t&&r.level<a[t-1].level?(r=a[--t],e=$i(r)-(r.level%2?0:1),n=!0):e==$i(r)&&t<a.length-1&&r.level<a[t+1].level&&(r=a[++t],e=Yi(r)-r.level%2,n=!1),n&&e==r.to&&e>r.from?l(e-1):l(e,n)}n=n||Kn(e.doc,t.line),i||(i=Ze(e,n));var a=Zn(n),u=t.ch;if(!a)return l(u);var c=ro(a,u),f=s(u,c);return null!=Yl&&(f.other=s(u,Yl)),f}function ft(e,t){var r=0,t=pe(e.doc,t);e.options.lineWrapping||(r=vt(e.display)*t.ch);var n=Kn(e.doc,t.line),i=qn(n)+Be(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function ht(e,t,r,n){var i=No(e,t);return i.xRel=n,r&&(i.outside=!0),i}function dt(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,0>r)return ht(n.first,0,!0,-1);var i=$n(n,r),o=n.first+n.size-1;if(i>o)return ht(n.first+n.size-1,Kn(n,o).text.length,!0,1);0>t&&(t=0);for(var l=Kn(n,i);;){var s=pt(e,l,i,t,r),a=un(l),u=a&&a.find(0,!0);if(!a||!(s.ch>u.from.ch||s.ch==u.from.ch&&s.xRel>0))return s;i=Yn(l=u.to.line)}}function pt(e,t,r,n,i){function o(n){var i=ct(e,No(r,n),"line",t,u);return s=!0,l>i.bottom?i.left-a:l<i.top?i.left+a:(s=!1,i.left)}var l=i-qn(t),s=!1,a=2*e.display.wrapper.clientWidth,u=Ze(e,t),c=Zn(t),f=t.text.length,h=qi(t),d=Zi(t),p=o(h),g=s,v=o(d),m=s;if(n>v)return ht(r,d,m,1);for(;;){if(c?d==h||d==io(t,h,1):1>=d-h){for(var y=p>n||v-n>=n-p?h:d,b=n-(y==h?p:v);Ii(t.text.charAt(y));)++y;var w=ht(r,y,y==h?g:m,-1>b?-1:b>1?1:0);return w}var x=Math.ceil(f/2),C=h+x;if(c){C=h;for(var S=0;x>S;++S)C=io(t,C,1)}var L=o(C);L>n?(d=C,v=L,(m=s)&&(v+=1e3),f=x):(h=C,p=L,g=s,f-=x)}}function gt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Oo){Oo=Pi("pre");for(var t=0;49>t;++t)Oo.appendChild(document.createTextNode("x")),Oo.appendChild(Pi("br"));Oo.appendChild(document.createTextNode("x"))}Ei(e.measure,Oo);var r=Oo.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),zi(e.measure),r||1}function vt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Pi("span","xxxxxxxxxx"),r=Pi("pre",[t]);Ei(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function mt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++zo},Po?Po.ops.push(e.curOp):e.curOp.ownsGroup=Po={ops:[e.curOp],delayedCallbacks:[]}}function yt(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r]();for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++](i.cm)}}while(r<t.length)}function bt(e){var t=e.curOp,r=t.ownsGroup;if(r)try{yt(r)}finally{Po=null;for(var n=0;n<r.ops.length;n++)r.ops[n].cm.curOp=null;wt(r)}}function wt(e){for(var t=e.ops,r=0;r<t.length;r++)xt(t[r]);for(var r=0;r<t.length;r++)Ct(t[r]);for(var r=0;r<t.length;r++)St(t[r]);for(var r=0;r<t.length;r++)Lt(t[r]);for(var r=0;r<t.length;r++)kt(t[r])}function xt(e){var t=e.cm,r=t.display;T(t),e.updateMaxLine&&h(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new k(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ct(e){e.updatedDisplay=e.mustUpdate&&M(e.cm,e.update)}function St(e){var t=e.cm,r=t.display;e.updatedDisplay&&O(t),e.barMeasure=p(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=$e(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Ve(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Ke(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Lt(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Qt(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1),e.preparedSelection&&t.display.input.showSelection(e.preparedSelection),e.updatedDisplay&&W(t,e.barMeasure),(e.updatedDisplay||e.startHeight!=t.doc.height)&&y(t,e.barMeasure),e.selectionChanged&&Pe(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing)}function kt(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&N(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null==e.scrollTop||r.scroller.scrollTop==e.scrollTop&&!e.forceScroll||(n.scrollTop=Math.max(0,Math.min(r.scroller.scrollHeight-r.scroller.clientHeight,e.scrollTop)),r.scrollbars.setScrollTop(n.scrollTop),r.scroller.scrollTop=n.scrollTop),null==e.scrollLeft||r.scroller.scrollLeft==e.scrollLeft&&!e.forceScroll||(n.scrollLeft=Math.max(0,Math.min(r.scroller.scrollWidth-Ke(t),e.scrollLeft)),r.scrollbars.setScrollLeft(n.scrollLeft),r.scroller.scrollLeft=n.scrollLeft,x(t)),e.scrollToPos){var i=Tr(t,pe(n,e.scrollToPos.from),pe(n,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&kr(t,i)}var o=e.maybeHiddenMarkers,l=e.maybeUnhiddenMarkers;if(o)for(var s=0;s<o.length;++s)o[s].lines.length||Cl(o[s],"hide");if(l)for(var s=0;s<l.length;++s)l[s].lines.length&&Cl(l[s],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Cl(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Tt(e,t){if(e.curOp)return t();mt(e);try{return t()}finally{bt(e)}}function Mt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);mt(e);try{return t.apply(e,arguments)}finally{bt(e)}}}function Nt(e){return function(){if(this.curOp)return e.apply(this,arguments);mt(this);try{return e.apply(this,arguments)}finally{bt(this)}}}function At(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);mt(t);try{return e.apply(this,arguments)}finally{bt(t)}}}function Wt(e,t,r){this.line=t,this.rest=hn(t),this.size=this.rest?Yn(ki(this.rest))-r+1:1,this.node=this.text=null,this.hidden=gn(e,t)}function Ot(e,t,r){for(var n,i=[],o=t;r>o;o=n){var l=new Wt(e.doc,Kn(e.doc,o),o);n=o+l.size,i.push(l)}return i}function Dt(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Mo&&dn(e.doc,t)<i.viewTo&&It(e);else if(r<=i.viewFrom)Mo&&pn(e.doc,r+n)>i.viewFrom?It(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)It(e);else if(t<=i.viewFrom){var o=zt(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):It(e)}else if(r>=i.viewTo){var o=zt(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):It(e)}else{var l=zt(e,t,t,-1),s=zt(e,r,r+n,1);l&&s?(i.view=i.view.slice(0,l.index).concat(Ot(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=n):It(e)}var a=i.externalMeasured;a&&(r<a.lineN?a.lineN+=n:t<a.lineN+a.size&&(i.externalMeasured=null))}function Ht(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[Pt(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==Ti(l,r)&&l.push(r)}}}function It(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Pt(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var r=e.display.view,n=0;n<r.length;n++)if(t-=r[n].size,0>t)return n}function zt(e,t,r,n){var i,o=Pt(e,t),l=e.display.view;if(!Mo||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=0,a=e.display.viewFrom;o>s;s++)a+=l[s].size;if(a!=t){if(n>0){if(o==l.length-1)return null;i=a+l[o].size-t,o++}else i=a-t;t+=i,r+=i}for(;dn(e.doc,r)!=r;){if(o==(0>n?0:l.length-1))return null;r+=n*l[o-(0>n?1:0)].size,o+=n}return{index:o,lineN:r}}function Et(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=Ot(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Ot(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Pt(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(Ot(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,Pt(e,r)))),n.viewTo=r}function Ft(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function Rt(e){function t(){o.activeTouch&&(l=setTimeout(function(){o.activeTouch=null},1e3),s=o.activeTouch,s.end=+new Date)}function r(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function n(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}function i(t){yi(e,t)||bl(t)}var o=e.display;wl(o.scroller,"mousedown",Mt(e,Vt)),uo&&11>co?wl(o.scroller,"dblclick",Mt(e,function(t){if(!yi(e,t)){var r=Ut(e,t);if(r&&!Yt(e,t)&&!Gt(e.display,t)){ml(t);var n=e.findWordAt(r);be(e.doc,n.anchor,n.head)}}})):wl(o.scroller,"dblclick",function(t){yi(e,t)||ml(t)}),ko||wl(o.scroller,"contextmenu",function(t){fr(e,t)});var l,s={end:0};wl(o.scroller,"touchstart",function(e){if(!r(e)){clearTimeout(l);var t=+new Date;o.activeTouch={start:t,moved:!1,prev:t-s.end<=300?s:null},1==e.touches.length&&(o.activeTouch.left=e.touches[0].pageX,o.activeTouch.top=e.touches[0].pageY)}}),wl(o.scroller,"touchmove",function(){o.activeTouch&&(o.activeTouch.moved=!0)}),wl(o.scroller,"touchend",function(r){var i=o.activeTouch;if(i&&!Gt(o,r)&&null!=i.left&&!i.moved&&new Date-i.start<300){var l,s=e.coordsChar(o.activeTouch,"page");l=!i.prev||n(i,i.prev)?new ce(s,s):!i.prev.prev||n(i,i.prev.prev)?e.findWordAt(s):new ce(No(s.line,0),pe(e.doc,No(s.line+1,0))),e.setSelection(l.anchor,l.head),e.focus(),ml(r)}t()}),wl(o.scroller,"touchcancel",t),wl(o.scroller,"scroll",function(){o.scroller.clientHeight&&(Zt(e,o.scroller.scrollTop),Qt(e,o.scroller.scrollLeft,!0),Cl(e,"scroll",e))}),wl(o.scroller,"mousewheel",function(t){Jt(e,t)}),wl(o.scroller,"DOMMouseScroll",function(t){Jt(e,t)}),wl(o.wrapper,"scroll",function(){o.wrapper.scrollTop=o.wrapper.scrollLeft=0}),e.options.dragDrop&&(wl(o.scroller,"dragstart",function(t){qt(e,t)}),wl(o.scroller,"dragenter",i),wl(o.scroller,"dragover",i),wl(o.scroller,"drop",Mt(e,$t)));var a=o.input.getField();wl(a,"keyup",function(t){sr.call(e,t)}),wl(a,"keydown",Mt(e,or)),wl(a,"keypress",Mt(e,ar)),wl(a,"focus",Oi(ur,e)),wl(a,"blur",Oi(cr,e))}function Bt(e){var t=e.display;(t.lastWrapHeight!=t.wrapper.clientHeight||t.lastWrapWidth!=t.wrapper.clientWidth)&&(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Gt(e,t){for(var r=pi(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function Ut(e,t,r,n){var i=e.display;if(!r&&"true"==pi(t).getAttribute("cm-not-content"))return null;var o,l,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,l=t.clientY-s.top}catch(t){return null}var a,u=dt(e,o,l);if(n&&1==u.xRel&&(a=Kn(e.doc,u.line).text).length==u.ch){var c=Al(a,a.length,e.options.tabSize)-a.length;u=No(u.line,Math.max(0,Math.round((o-Ue(e.display).left)/vt(e.display))-c))}return u}function Vt(e){var t=this,r=t.display;if(!(r.activeTouch&&r.input.supportsTouch()||yi(t,e))){if(r.shift=e.shiftKey,Gt(r,e))return void(fo||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!Yt(t,e)){var n=Ut(t,e);switch(window.focus(),gi(e)){case 1:n?Kt(t,e,n):pi(e)==r.scroller&&ml(e);break;case 2:fo&&(t.state.lastMiddleDown=+new Date),n&&be(t.doc,n),setTimeout(function(){r.input.focus()},20),ml(e);break;case 3:ko&&fr(t,e)}}}}function Kt(e,t,r){uo?setTimeout(Oi(q,e),0):q(e);var n,i=+new Date;Ho&&Ho.time>i-400&&0==Ao(Ho.pos,r)?n="triple":Do&&Do.time>i-400&&0==Ao(Do.pos,r)?(n="double",Ho={time:i,pos:r}):(n="single",Do={time:i,pos:r});var o,l=e.doc.sel,s=xo?t.metaKey:t.ctrlKey;e.options.dragDrop&&Ul&&!Z(e)&&"single"==n&&(o=l.contains(r))>-1&&!l.ranges[o].empty()?jt(e,t,r,s):Xt(e,t,r,n,s)}function jt(e,t,r,n){var i=e.display,o=Mt(e,function(l){fo&&(i.scroller.draggable=!1),e.state.draggingText=!1,xl(document,"mouseup",o),xl(i.scroller,"drop",o),Math.abs(t.clientX-l.clientX)+Math.abs(t.clientY-l.clientY)<10&&(ml(l),n||be(e.doc,r),i.input.focus(),uo&&9==co&&setTimeout(function(){document.body.focus(),i.input.focus()},20))});fo&&(i.scroller.draggable=!0),e.state.draggingText=o,i.scroller.dragDrop&&i.scroller.dragDrop(),wl(document,"mouseup",o),wl(i.scroller,"drop",o)}function Xt(e,t,r,n,i){function o(t){if(0!=Ao(v,t))if(v=t,"rect"==n){for(var i=[],o=e.options.tabSize,l=Al(Kn(u,r.line).text,r.ch,o),s=Al(Kn(u,t.line).text,t.ch,o),a=Math.min(l,s),d=Math.max(l,s),p=Math.min(r.line,t.line),g=Math.min(e.lastLine(),Math.max(r.line,t.line));g>=p;p++){var m=Kn(u,p).text,y=Si(m,a,o);a==d?i.push(new ce(No(p,y),No(p,y))):m.length>y&&i.push(new ce(No(p,y),No(p,Si(m,d,o))))}i.length||i.push(new ce(r,r)),ke(u,fe(h.ranges.slice(0,f).concat(i),f),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=c,w=b.anchor,x=t;if("single"!=n){if("double"==n)var C=e.findWordAt(t);else var C=new ce(No(t.line,0),pe(u,No(t.line+1,0)));Ao(C.anchor,w)>0?(x=C.head,w=$(b.from(),C.anchor)):(x=C.anchor,w=Y(b.to(),C.head))}var i=h.ranges.slice(0);i[f]=new ce(pe(u,w),x),ke(u,fe(i,f),Ml)}}function l(t){var r=++y,i=Ut(e,t,!0,"rect"==n);if(i)if(0!=Ao(i,v)){q(e),o(i);var s=w(a,u);(i.line>=s.to||i.line<s.from)&&setTimeout(Mt(e,function(){y==r&&l(t)}),150)}else{var c=t.clientY<m.top?-20:t.clientY>m.bottom?20:0;c&&setTimeout(Mt(e,function(){y==r&&(a.scroller.scrollTop+=c,l(t))}),50)}}function s(e){y=1/0,ml(e),a.input.focus(),xl(document,"mousemove",b),xl(document,"mouseup",x),u.history.lastSelOrigin=null}var a=e.display,u=e.doc;ml(t);var c,f,h=u.sel,d=h.ranges;if(i&&!t.shiftKey?(f=u.sel.contains(r),c=f>-1?d[f]:new ce(r,r)):c=u.sel.primary(),t.altKey)n="rect",i||(c=new ce(r,r)),r=Ut(e,t,!0,!0),f=-1;else if("double"==n){var p=e.findWordAt(r);c=e.display.shift||u.extend?ye(u,c,p.anchor,p.head):p}else if("triple"==n){var g=new ce(No(r.line,0),pe(u,No(r.line+1,0)));c=e.display.shift||u.extend?ye(u,c,g.anchor,g.head):g}else c=ye(u,c,r);i?-1==f?(f=d.length,ke(u,fe(d.concat([c]),f),{scroll:!1,origin:"*mouse"})):d.length>1&&d[f].empty()&&"single"==n?(ke(u,fe(d.slice(0,f).concat(d.slice(f+1)),0)),h=u.sel):xe(u,f,c,Ml):(f=0,ke(u,new ue([c],0),Ml),h=u.sel);var v=r,m=a.wrapper.getBoundingClientRect(),y=0,b=Mt(e,function(e){gi(e)?l(e):s(e)}),x=Mt(e,s);wl(document,"mousemove",b),wl(document,"mouseup",x)}function _t(e,t,r,n,i){try{var o=t.clientX,l=t.clientY}catch(t){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&ml(t);var s=e.display,a=s.lineDiv.getBoundingClientRect();if(l>a.bottom||!wi(e,r))return di(t);l-=a.top-s.viewOffset;for(var u=0;u<e.options.gutters.length;++u){var c=s.gutters.childNodes[u];if(c&&c.getBoundingClientRect().right>=o){var f=$n(e.doc,l),h=e.options.gutters[u];return i(e,r,e,f,h,t),di(t)}}}function Yt(e,t){return _t(e,t,"gutterClick",!0,vi)}function $t(e){var t=this;if(!yi(t,e)&&!Gt(t.display,e)){ml(e),uo&&(Eo=+new Date);var r=Ut(t,e,!0),n=e.dataTransfer.files;if(r&&!Z(t))if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),l=0,s=function(e,n){var s=new FileReader;s.onload=Mt(t,function(){if(o[n]=s.result,++l==i){r=pe(t.doc,r);var e={from:r,to:r,text:Vl(o.join("\n")),origin:"paste"};yr(t.doc,e),Le(t.doc,he(r,Vo(e)))}}),s.readAsText(e)},a=0;i>a;++a)s(n[a],a);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!(xo?e.metaKey:e.ctrlKey))var u=t.listSelections();if(Te(t.doc,he(r,r)),u)for(var a=0;a<u.length;++a)Lr(t.doc,"",u[a].anchor,u[a].head,"drag");t.replaceSelection(o,"around","paste"),t.display.input.focus()}}catch(e){}}}}function qt(e,t){if(uo&&(!e.state.draggingText||+new Date-Eo<100))return void bl(t);if(!yi(e,t)&&!Gt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.setDragImage&&!vo)){var r=Pi("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",go&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),go&&r.parentNode.removeChild(r)}}function Zt(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,lo||A(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbars.setScrollTop(t),lo&&A(e),ze(e,100))}function Qt(e,t,r){(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,x(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Jt(e,t){var r=Bo(t),n=r.x,i=r.y,o=e.display,l=o.scroller;if(n&&l.scrollWidth>l.clientWidth||i&&l.scrollHeight>l.clientHeight){if(i&&xo&&fo)e:for(var s=t.target,a=o.view;s!=l;s=s.parentNode)for(var u=0;u<a.length;u++)if(a[u].node==s){e.display.currentWheelTarget=s;break e}if(n&&!lo&&!go&&null!=Ro)return i&&Zt(e,Math.max(0,Math.min(l.scrollTop+i*Ro,l.scrollHeight-l.clientHeight))),Qt(e,Math.max(0,Math.min(l.scrollLeft+n*Ro,l.scrollWidth-l.clientWidth))),ml(t),void(o.wheelStartX=null);if(i&&null!=Ro){var c=i*Ro,f=e.doc.scrollTop,h=f+o.wrapper.clientHeight;0>c?f=Math.max(0,f+c-50):h=Math.min(e.doc.height,h+c+50),A(e,{top:f,bottom:h})}20>Fo&&(null==o.wheelStartX?(o.wheelStartX=l.scrollLeft,o.wheelStartY=l.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=l.scrollLeft-o.wheelStartX,t=l.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(Ro=(Ro*Fo+r)/(Fo+1),++Fo)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}function er(e,t,r){if("string"==typeof t&&(t=el[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{Z(e)&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=kl}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function tr(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=rl(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&rl(t,e.options.extraKeys,r,e)||rl(t,e.options.keyMap,r,e)}function rr(e,t,r,n){var i=e.state.keySeq;if(i){if(nl(t))return"handled";Go.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),t=i+" "+t}var o=tr(e,t,n);return"multi"==o&&(e.state.keySeq=t),"handled"==o&&vi(e,"keyHandled",e,t,r),("handled"==o||"multi"==o)&&(ml(r),Pe(e)),i&&!o&&/\'$/.test(t)?(ml(r),!0):!!o}function nr(e,t){var r=il(t,!0);return r?t.shiftKey&&!e.state.keySeq?rr(e,"Shift-"+r,t,function(t){return er(e,t,!0)})||rr(e,r,t,function(t){return("string"==typeof t?/^go[A-Z]/.test(t):t.motion)?er(e,t):void 0}):rr(e,r,t,function(t){return er(e,t)}):!1}function ir(e,t,r){return rr(e,"'"+r+"'",t,function(t){return er(e,t,!0)})}function or(e){var t=this;if(q(t),!yi(t,e)){uo&&11>co&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=nr(t,e);go&&(Uo=n?r:null,!n&&88==r&&!jl&&(xo?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||lr(t)}}function lr(e){function t(e){18!=e.keyCode&&e.altKey||(Rl(r,"CodeMirror-crosshair"),xl(document,"keyup",t),xl(document,"mouseover",t))}var r=e.display.lineDiv;Bl(r,"CodeMirror-crosshair"),wl(document,"keyup",t),wl(document,"mouseover",t)}function sr(e){16==e.keyCode&&(this.doc.sel.shift=!1),yi(this,e)}function ar(e){var t=this;if(!(Gt(t.display,e)||yi(t,e)||e.ctrlKey&&!e.altKey||xo&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(go&&r==Uo)return Uo=null,void ml(e);if(!go||e.which&&!(e.which<10)||!nr(t,e)){var i=String.fromCharCode(null==n?r:n);ir(t,e,i)||t.display.input.onKeyPress(e)}}}function ur(e){"nocursor"!=e.options.readOnly&&(e.state.focused||(Cl(e,"focus",e),e.state.focused=!0,Bl(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),fo&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Pe(e))}function cr(e){e.state.focused&&(Cl(e,"blur",e),e.state.focused=!1,Rl(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function fr(e,t){Gt(e.display,t)||hr(e,t)||e.display.input.onContextMenu(t)}function hr(e,t){return wi(e,"gutterContextMenu")?_t(e,t,"gutterContextMenu",!1,Cl):!1}function dr(e,t){if(Ao(e,t.from)<0)return e;if(Ao(e,t.to)<=0)return Vo(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Vo(t).ch-t.to.ch),No(r,n)}function pr(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new ce(dr(i.anchor,t),dr(i.head,t)))}return fe(r,e.sel.primIndex)}function gr(e,t,r){return e.line==t.line?No(r.line,e.ch-t.ch+r.ch):No(r.line+(e.line-t.line),e.ch)}function vr(e,t,r){for(var n=[],i=No(e.first,0),o=i,l=0;l<t.length;l++){var s=t[l],a=gr(s.from,i,o),u=gr(Vo(s),i,o);if(i=s.to,o=u,"around"==r){var c=e.sel.ranges[l],f=Ao(c.head,c.anchor)<0;n[l]=new ce(f?u:a,f?a:u)}else n[l]=new ce(a,a)}return new ue(n,e.sel.primIndex)}function mr(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return r&&(n.update=function(t,r,n,i){t&&(this.from=pe(e,t)),r&&(this.to=pe(e,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),Cl(e,"beforeChange",e,n),e.cm&&Cl(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function yr(e,t,r){if(e.cm){if(!e.cm.curOp)return Mt(e.cm,yr)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(wi(e,"beforeChange")||e.cm&&wi(e.cm,"beforeChange"))||(t=mr(e,t,!0))){var n=To&&!r&&en(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)br(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else br(e,t)}}function br(e,t){if(1!=t.text.length||""!=t.text[0]||0!=Ao(t.from,t.to)){var r=pr(e,t);ri(e,t,r,e.cm?e.cm.curOp.id:NaN),Cr(e,t,r,Zr(e,t));var n=[];Un(e,function(e,r){r||-1!=Ti(n,e.history)||(hi(e.history,t),n.push(e.history)),Cr(e,t,null,Zr(e,t))})}}function wr(e,t,r){if(!e.cm||!e.cm.state.suppressEdits){for(var n,i=e.history,o=e.sel,l="undo"==t?i.done:i.undone,s="undo"==t?i.undone:i.done,a=0;a<l.length&&(n=l[a],r?!n.ranges||n.equals(e.sel):n.ranges);a++);if(a!=l.length){for(i.lastOrigin=i.lastSelOrigin=null;n=l.pop(),n.ranges;){if(oi(n,s),r&&!n.equals(e.sel))return void ke(e,n,{clearRedo:!1});o=n}var u=[];oi(o,s),s.push({changes:u,generation:i.generation}),i.generation=n.generation||++i.maxGeneration;for(var c=wi(e,"beforeChange")||e.cm&&wi(e.cm,"beforeChange"),a=n.changes.length-1;a>=0;--a){var f=n.changes[a];if(f.origin=t,c&&!mr(e,f,!1))return void(l.length=0);u.push(Jn(e,f));var h=a?pr(e,f):ki(l);Cr(e,f,h,Jr(e,f)),!a&&e.cm&&e.cm.scrollIntoView({from:f.from,to:Vo(f)});var d=[];Un(e,function(e,t){t||-1!=Ti(d,e.history)||(hi(e.history,f),d.push(e.history)),Cr(e,f,null,Jr(e,f))})}}}}function xr(e,t){if(0!=t&&(e.first+=t,e.sel=new ue(Mi(e.sel.ranges,function(e){return new ce(No(e.anchor.line+t,e.anchor.ch),No(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Dt(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Ht(e.cm,n,"gutter")}}function Cr(e,t,r,n){if(e.cm&&!e.cm.curOp)return Mt(e.cm,Cr)(e,t,r,n);if(t.to.line<e.first)return void xr(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);xr(e,i),t={from:No(e.first,0),to:No(t.to.line+i,t.to.ch),text:[ki(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:No(o,Kn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=jn(e,t.from,t.to),r||(r=pr(e,t)),e.cm?Sr(e.cm,t,n):Rn(e,t,n),Te(e,r,Tl)}}function Sr(e,t,r){var n=e.doc,i=e.display,l=t.from,s=t.to,a=!1,u=l.line;e.options.lineWrapping||(u=Yn(fn(Kn(n,l.line))),n.iter(u,s.line+1,function(e){return e==i.maxLine?(a=!0,!0):void 0})),n.sel.contains(t.from,t.to)>-1&&bi(e),Rn(n,t,r,o(e)),e.options.lineWrapping||(n.iter(u,l.line+t.text.length,function(e){var t=f(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,a=!1)}),a&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,l.line),ze(e,400);var c=t.text.length-(s.line-l.line)-1;t.full?Dt(e):l.line!=s.line||1!=t.text.length||Fn(e.doc,t)?Dt(e,l.line,s.line+1,c):Ht(e,l.line,"text");var h=wi(e,"changes"),d=wi(e,"change");if(d||h){var p={from:l,to:s,text:t.text,removed:t.removed,origin:t.origin};d&&vi(e,"change",e,p),h&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function Lr(e,t,r,n,i){if(n||(n=r),Ao(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=Vl(t)),yr(e,{from:r,to:n,text:t,origin:i})}function kr(e,t){if(!yi(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!yo){var o=Pi("div","​",null,"position: absolute; top: "+(t.top-r.viewOffset-Be(e.display))+"px; height: "+(t.bottom-t.top+Ve(e)+r.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function Tr(e,t,r,n){null==n&&(n=0);for(var i=0;5>i;i++){var o=!1,l=ct(e,t),s=r&&r!=t?ct(e,r):l,a=Nr(e,Math.min(l.left,s.left),Math.min(l.top,s.top)-n,Math.max(l.left,s.left),Math.max(l.bottom,s.bottom)+n),u=e.doc.scrollTop,c=e.doc.scrollLeft;if(null!=a.scrollTop&&(Zt(e,a.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(o=!0)),null!=a.scrollLeft&&(Qt(e,a.scrollLeft),Math.abs(e.doc.scrollLeft-c)>1&&(o=!0)),!o)break}return l}function Mr(e,t,r,n,i){var o=Nr(e,t,r,n,i);null!=o.scrollTop&&Zt(e,o.scrollTop),null!=o.scrollLeft&&Qt(e,o.scrollLeft)}function Nr(e,t,r,n,i){var o=e.display,l=gt(e.display);0>r&&(r=0);var s=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,a=je(e),u={};i-r>a&&(i=r+a);var c=e.doc.height+Ge(o),f=l>r,h=i>c-l;if(s>r)u.scrollTop=f?0:r;else if(i>s+a){var d=Math.min(r,(h?c:i)-a);d!=s&&(u.scrollTop=d)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,g=Ke(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),v=n-t>g;return v&&(n=t+g),10>t?u.scrollLeft=0:p>t?u.scrollLeft=Math.max(0,t-(v?0:10)):n>g+p-3&&(u.scrollLeft=n+(v?0:10)-g),u}function Ar(e,t,r){(null!=t||null!=r)&&Or(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=r&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+r)}function Wr(e){Or(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?No(t.line,t.ch-1):t,n=No(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function Or(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=ft(e,t.from),n=ft(e,t.to),i=Nr(e,Math.min(r.left,n.left),Math.min(r.top,n.top)-t.margin,Math.max(r.right,n.right),Math.max(r.bottom,n.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function Dr(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=Re(e,t):r="prev");var l=e.options.tabSize,s=Kn(o,t),a=Al(s.text,null,l);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&(u=o.mode.indent(i,s.text.slice(c.length),s.text),u==kl||u>150)){if(!n)return;r="prev"}}else u=0,r="not";"prev"==r?u=t>o.first?Al(Kn(o,t-1).text,null,l):0:"add"==r?u=a+e.options.indentUnit:"subtract"==r?u=a-e.options.indentUnit:"number"==typeof r&&(u=a+r),u=Math.max(0,u);var f="",h=0;if(e.options.indentWithTabs)for(var d=Math.floor(u/l);d;--d)h+=l,f+=" ";if(u>h&&(f+=Li(u-h)),f!=c)Lr(o,f,No(t,0),No(t,c.length),"+input");else for(var d=0;d<o.sel.ranges.length;d++){var p=o.sel.ranges[d];if(p.head.line==t&&p.head.ch<c.length){var h=No(t,c.length);xe(o,d,new ce(h,h));break}}s.stateAfter=null}function Hr(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=Kn(e,de(e,t)):i=Yn(t),null==i?null:(n(o,i)&&e.cm&&Ht(e.cm,i,r),o)}function Ir(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&Ao(o.from,ki(n).to)<=0;){var l=n.pop();if(Ao(l.from,o.from)<0){o.from=l.from;break}}n.push(o)}Tt(e,function(){for(var t=n.length-1;t>=0;t--)Lr(e.doc,"",n[t].from,n[t].to,"+delete");Wr(e)})}function Pr(e,t,r,n,i){function o(){var t=s+r;return t<e.first||t>=e.first+e.size?f=!1:(s=t,c=Kn(e,t))}function l(e){var t=(i?io:oo)(c,a,r,!0);if(null==t){if(e||!o())return f=!1;a=i?(0>r?Zi:qi)(c):0>r?c.text.length:0}else a=t;return!0}var s=t.line,a=t.ch,u=r,c=Kn(e,s),f=!0;if("char"==n)l();else if("column"==n)l(!0);else if("word"==n||"group"==n)for(var h=null,d="group"==n,p=e.cm&&e.cm.getHelper(t,"wordChars"),g=!0;!(0>r)||l(!g);g=!1){var v=c.text.charAt(a)||"\n",m=Di(v,p)?"w":d&&"\n"==v?"n":!d||/\s/.test(v)?null:"p";if(!d||g||m||(m="s"),h&&h!=m){0>r&&(r=1,l());break}if(m&&(h=m),r>0&&!l(!g))break}var y=We(e,No(s,a),u,!0);return f||(y.hitSide=!0),y}function zr(e,t,r,n){var i,o=e.doc,l=t.left;if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+r*(s-(0>r?1.5:.5)*gt(e.display))}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;;){var a=dt(e,l,i);if(!a.outside)break;if(0>r?0>=i:i>=o.height){a.hitSide=!0;break}i+=5*r}return a}function Er(t,r,n,i){e.defaults[t]=r,n&&(jo[t]=i?function(e,t,r){r!=Xo&&n(e,t,r)}:n)}function Fr(e){for(var t,r,n,i,o=e.split(/-(?!$)/),e=o[o.length-1],l=0;l<o.length-1;l++){var s=o[l];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else{if(!/^s(hift)$/i.test(s))throw new Error("Unrecognized modifier name: "+s);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Rr(e){return"string"==typeof e?tl[e]:e;
3
+ }function Br(e,t,r,n,i){if(n&&n.shared)return Gr(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return Mt(e.cm,Br)(e,t,r,n,i);var o=new sl(e,i),l=Ao(t,r);if(n&&Wi(n,o,!1),l>0||0==l&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Pi("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(cn(e,t.line,t,r,o)||t.line!=r.line&&cn(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Mo=!0}o.addToHistory&&ri(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var s,a=t.line,u=e.cm;if(e.iter(a,r.line+1,function(e){u&&o.collapsed&&!u.options.lineWrapping&&fn(e)==u.display.maxLine&&(s=!0),o.collapsed&&a!=t.line&&_n(e,0),Yr(e,new jr(o,a==t.line?t.ch:null,a==r.line?r.ch:null)),++a}),o.collapsed&&e.iter(t.line,r.line+1,function(t){gn(e,t)&&_n(t,0)}),o.clearOnEnter&&wl(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(To=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ll,o.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),o.collapsed)Dt(u,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var c=t.line;c<=r.line;c++)Ht(u,c,"text");o.atomic&&Ne(u.doc),vi(u,"markerAdded",u,o)}return o}function Gr(e,t,r,n,i){n=Wi(n),n.shared=!1;var o=[Br(e,t,r,n,i)],l=o[0],s=n.widgetNode;return Un(e,function(e){s&&(n.widgetNode=s.cloneNode(!0)),o.push(Br(e,pe(e,t),pe(e,r),n,i));for(var a=0;a<e.linked.length;++a)if(e.linked[a].isParent)return;l=ki(o)}),new al(o,l)}function Ur(e){return e.findMarks(No(e.first,0),e.clipPos(No(e.lastLine())),function(e){return e.parent})}function Vr(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),l=e.clipPos(i.to);if(Ao(o,l)){var s=Br(e,o,l,n.primary,n.primary.type);n.markers.push(s),s.parent=n}}}function Kr(e){for(var t=0;t<e.length;t++){var r=e[t],n=[r.primary.doc];Un(r.primary.doc,function(e){n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==Ti(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}}}function jr(e,t,r){this.marker=e,this.from=t,this.to=r}function Xr(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function _r(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Yr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function $r(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],l=o.marker,s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);if(s||o.from==t&&"bookmark"==l.type&&(!r||!o.marker.insertLeft)){var a=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new jr(l,o.from,a?null:o.to))}}return n}function qr(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],l=o.marker,s=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);if(s||o.from==t&&"bookmark"==l.type&&(!r||o.marker.insertLeft)){var a=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new jr(l,a?null:o.from-t,null==o.to?null:o.to-t))}}return n}function Zr(e,t){if(t.full)return null;var r=ve(e,t.from.line)&&Kn(e,t.from.line).markedSpans,n=ve(e,t.to.line)&&Kn(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,l=0==Ao(t.from,t.to),s=$r(r,i,l),a=qr(n,o,l),u=1==t.text.length,c=ki(t.text).length+(u?i:0);if(s)for(var f=0;f<s.length;++f){var h=s[f];if(null==h.to){var d=Xr(a,h.marker);d?u&&(h.to=null==d.to?null:d.to+c):h.to=i}}if(a)for(var f=0;f<a.length;++f){var h=a[f];if(null!=h.to&&(h.to+=c),null==h.from){var d=Xr(s,h.marker);d||(h.from=c,u&&(s||(s=[])).push(h))}else h.from+=c,u&&(s||(s=[])).push(h)}s&&(s=Qr(s)),a&&a!=s&&(a=Qr(a));var p=[s];if(!u){var g,v=t.text.length-2;if(v>0&&s)for(var f=0;f<s.length;++f)null==s[f].to&&(g||(g=[])).push(new jr(s[f].marker,null,null));for(var f=0;v>f;++f)p.push(g);p.push(a)}return p}function Qr(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Jr(e,t){var r=ai(e,t),n=Zr(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],l=n[i];if(o&&l)e:for(var s=0;s<l.length;++s){for(var a=l[s],u=0;u<o.length;++u)if(o[u].marker==a.marker)continue e;o.push(a)}else l&&(r[i]=l)}return r}function en(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=Ti(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var l=n[o],s=l.find(0),a=0;a<i.length;++a){var u=i[a];if(!(Ao(u.to,s.from)<0||Ao(u.from,s.to)>0)){var c=[a,1],f=Ao(u.from,s.from),h=Ao(u.to,s.to);(0>f||!l.inclusiveLeft&&!f)&&c.push({from:u.from,to:s.from}),(h>0||!l.inclusiveRight&&!h)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),a+=c.length-1}}return i}function tn(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function rn(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function nn(e){return e.inclusiveLeft?-1:0}function on(e){return e.inclusiveRight?1:0}function ln(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=Ao(n.from,i.from)||nn(e)-nn(t);if(o)return-o;var l=Ao(n.to,i.to)||on(e)-on(t);return l?l:t.id-e.id}function sn(e,t){var r,n=Mo&&e.markedSpans;if(n)for(var i,o=0;o<n.length;++o)i=n[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!r||ln(r,i.marker)<0)&&(r=i.marker);return r}function an(e){return sn(e,!0)}function un(e){return sn(e,!1)}function cn(e,t,r,n,i){var o=Kn(e,t),l=Mo&&o.markedSpans;if(l)for(var s=0;s<l.length;++s){var a=l[s];if(a.marker.collapsed){var u=a.marker.find(0),c=Ao(u.from,r)||nn(a.marker)-nn(i),f=Ao(u.to,n)||on(a.marker)-on(i);if(!(c>=0&&0>=f||0>=c&&f>=0)&&(0>=c&&(Ao(u.to,r)>0||a.marker.inclusiveRight&&i.inclusiveLeft)||c>=0&&(Ao(u.from,n)<0||a.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function fn(e){for(var t;t=an(e);)e=t.find(-1,!0).line;return e}function hn(e){for(var t,r;t=un(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function dn(e,t){var r=Kn(e,t),n=fn(r);return r==n?t:Yn(n)}function pn(e,t){if(t>e.lastLine())return t;var r,n=Kn(e,t);if(!gn(e,n))return t;for(;r=un(n);)n=r.find(1,!0).line;return Yn(n)+1}function gn(e,t){var r=Mo&&t.markedSpans;if(r)for(var n,i=0;i<r.length;++i)if(n=r[i],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&vn(e,t,n))return!0}}function vn(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return vn(e,n.line,Xr(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&vn(e,t,i))return!0}function mn(e,t,r){qn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ar(e,null,r)}function yn(e){if(null!=e.height)return e.height;if(!zl(document.body,e.node)){var t="position: relative;";e.coverGutter&&(t+="margin-left: -"+e.cm.display.gutters.offsetWidth+"px;"),e.noHScroll&&(t+="width: "+e.cm.display.wrapper.clientWidth+"px;"),Ei(e.cm.display.measure,Pi("div",[e.node],null,t))}return e.height=e.node.offsetHeight}function bn(e,t,r,n){var i=new ul(e,r,n);return i.noHScroll&&(e.display.alignWidgets=!0),Hr(e.doc,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,!gn(e.doc,t)){var n=qn(t)<e.doc.scrollTop;_n(t,t.height+yn(i)),n&&Ar(e,null,i.height),e.curOp.forceUpdate=!0}return!0}),i}function wn(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),tn(e),rn(e,r);var i=n?n(e):1;i!=e.height&&_n(e,i)}function xn(e){e.parent=null,tn(e)}function Cn(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function Sn(t,r){if(t.blankLine)return t.blankLine(r);if(t.innerMode){var n=e.innerMode(t,r);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function Ln(t,r,n,i){for(var o=0;10>o;o++){i&&(i[0]=e.innerMode(t,n).mode);var l=t.token(r,n);if(r.pos>r.start)return l}throw new Error("Mode "+t.name+" failed to advance stream.")}function kn(e,t,r,n){function i(e){return{start:f.start,end:f.pos,string:f.current(),type:o||null,state:e?Qo(l.mode,c):c}}var o,l=e.doc,s=l.mode;t=pe(l,t);var a,u=Kn(l,t.line),c=Re(e,t.line,r),f=new ol(u.text,e.options.tabSize);for(n&&(a=[]);(n||f.pos<t.ch)&&!f.eol();)f.start=f.pos,o=Ln(s,f,c),n&&a.push(i(!0));return n?a:i()}function Tn(e,t,r,n,i,o,l){var s=r.flattenSpans;null==s&&(s=e.options.flattenSpans);var a,u=0,c=null,f=new ol(t,e.options.tabSize),h=e.options.addModeClass&&[null];for(""==t&&Cn(Sn(r,n),o);!f.eol();){if(f.pos>e.options.maxHighlightLength?(s=!1,l&&An(e,t,n,f.pos),f.pos=t.length,a=null):a=Cn(Ln(r,f,n,h),o),h){var d=h[0].name;d&&(a="m-"+(a?d+" "+a:d))}if(!s||c!=a){for(;u<f.start;)u=Math.min(f.start,u+5e4),i(u,c);c=a}f.start=f.pos}for(;u<f.pos;){var p=Math.min(f.pos,u+5e4);i(p,c),u=p}}function Mn(e,t,r,n){var i=[e.state.modeGen],o={};Tn(e,t.text,e.doc.mode,r,function(e,t){i.push(e,t)},o,n);for(var l=0;l<e.state.overlays.length;++l){var s=e.state.overlays[l],a=1,u=0;Tn(e,t.text,s.mode,!0,function(e,t){for(var r=a;e>u;){var n=i[a];n>e&&i.splice(a,1,e,i[a+1],n),a+=2,u=Math.min(e,n)}if(t)if(s.opaque)i.splice(r,a-r,e,"cm-overlay "+t),a=r+2;else for(;a>r;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Nn(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Mn(e,t,t.stateAfter=Re(e,Yn(t)));t.styles=n.styles,n.classes?t.styleClasses=n.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.frontier&&e.doc.frontier++}return t.styles}function An(e,t,r,n){var i=e.doc.mode,o=new ol(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&Sn(i,r);!o.eol()&&o.pos<=e.options.maxHighlightLength;)Ln(i,o,r),o.start=o.pos}function Wn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?hl:fl;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function On(e,t){var r=Pi("span",null,null,fo?"padding-right: .1px":null),n={pre:Pi("pre",[r]),content:r,col:0,pos:0,cm:e};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,l=i?t.rest[i-1]:t.line;n.pos=0,n.addToken=Hn,(uo||fo)&&e.getOption("lineWrapping")&&(n.addToken=In(n.addToken)),ji(e.display.measure)&&(o=Zn(l))&&(n.addToken=Pn(n.addToken,o)),n.map=[];var s=t!=e.display.externalMeasured&&Yn(l);En(l,n,Nn(e,l,s)),l.styleClasses&&(l.styleClasses.bgClass&&(n.bgClass=Bi(l.styleClasses.bgClass,n.bgClass||"")),l.styleClasses.textClass&&(n.textClass=Bi(l.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Ki(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return fo&&/\bcm-tab\b/.test(n.content.lastChild.className)&&(n.content.className="cm-tab-wrap-hack"),Cl(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Bi(n.pre.className,n.textClass||"")),n}function Dn(e){var t=Pi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Hn(e,t,r,n,i,o,l){if(t){var s=e.cm.options.specialChars,a=!1;if(s.test(t))for(var u=document.createDocumentFragment(),c=0;;){s.lastIndex=c;var f=s.exec(t),h=f?f.index-c:t.length-c;if(h){var d=document.createTextNode(t.slice(c,c+h));uo&&9>co?u.appendChild(Pi("span",[d])):u.appendChild(d),e.map.push(e.pos,e.pos+h,d),e.col+=h,e.pos+=h}if(!f)break;if(c+=h+1," "==f[0]){var p=e.cm.options.tabSize,g=p-e.col%p,d=u.appendChild(Pi("span",Li(g),"cm-tab"));d.setAttribute("role","presentation"),d.setAttribute("cm-text"," "),e.col+=g}else{var d=e.cm.options.specialCharPlaceholder(f[0]);d.setAttribute("cm-text",f[0]),uo&&9>co?u.appendChild(Pi("span",[d])):u.appendChild(d),e.col+=1}e.map.push(e.pos,e.pos+1,d),e.pos++}else{e.col+=t.length;var u=document.createTextNode(t);e.map.push(e.pos,e.pos+t.length,u),uo&&9>co&&(a=!0),e.pos+=t.length}if(r||n||i||a||l){var v=r||"";n&&(v+=n),i&&(v+=i);var m=Pi("span",[u],v,l);return o&&(m.title=o),e.content.appendChild(m)}e.content.appendChild(u)}}function In(e){function t(e){for(var t=" ",r=0;r<e.length-2;++r)t+=r%2?" ":" ";return t+=" "}return function(r,n,i,o,l,s){e(r,n.replace(/ {3,}/g,t),i,o,l,s)}}function Pn(e,t){return function(r,n,i,o,l,s){i=i?i+" cm-force-border":"cm-force-border";for(var a=r.pos,u=a+n.length;;){for(var c=0;c<t.length;c++){var f=t[c];if(f.to>a&&f.from<=a)break}if(f.to>=u)return e(r,n,i,o,l,s);e(r,n.slice(0,f.to-a),i,o,null,s),o=null,n=n.slice(f.to-a),a=f.to}}}function zn(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t}function En(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var l,s,a,u,c,f,h,d=i.length,p=0,g=1,v="",m=0;;){if(m==p){a=u=c=f=s="",h=null,m=1/0;for(var y=[],b=0;b<n.length;++b){var w=n[b],x=w.marker;w.from<=p&&(null==w.to||w.to>p)?(null!=w.to&&m>w.to&&(m=w.to,u=""),x.className&&(a+=" "+x.className),x.css&&(s=x.css),x.startStyle&&w.from==p&&(c+=" "+x.startStyle),x.endStyle&&w.to==m&&(u+=" "+x.endStyle),x.title&&!f&&(f=x.title),x.collapsed&&(!h||ln(h.marker,x)<0)&&(h=w)):w.from>p&&m>w.from&&(m=w.from),"bookmark"==x.type&&w.from==p&&x.widgetNode&&y.push(x)}if(h&&(h.from||0)==p&&(zn(t,(null==h.to?d+1:h.to)-p,h.marker,null==h.from),null==h.to))return;if(!h&&y.length)for(var b=0;b<y.length;++b)zn(t,0,y[b])}if(p>=d)break;for(var C=Math.min(d,m);;){if(v){var S=p+v.length;if(!h){var L=S>C?v.slice(0,C-p):v;t.addToken(t,L,l?l+a:a,c,p+L.length==m?u:"",f,s)}if(S>=C){v=v.slice(C-p),p=C;break}p=S,c=""}v=i.slice(o,o=r[g++]),l=Wn(r[g++],t.cm.options)}}else for(var g=1;g<r.length;g+=2)t.addToken(t,i.slice(o,o=r[g]),Wn(r[g+1],t.cm.options))}function Fn(e,t){return 0==t.from.ch&&0==t.to.ch&&""==ki(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Rn(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){wn(e,r,i,n),vi(e,"change",e,t)}function l(e,t){for(var r=e,o=[];t>r;++r)o.push(new cl(u[r],i(r),n));return o}var s=t.from,a=t.to,u=t.text,c=Kn(e,s.line),f=Kn(e,a.line),h=ki(u),d=i(u.length-1),p=a.line-s.line;if(t.full)e.insert(0,l(0,u.length)),e.remove(u.length,e.size-u.length);else if(Fn(e,t)){var g=l(0,u.length-1);o(f,f.text,d),p&&e.remove(s.line,p),g.length&&e.insert(s.line,g)}else if(c==f)if(1==u.length)o(c,c.text.slice(0,s.ch)+h+c.text.slice(a.ch),d);else{var g=l(1,u.length-1);g.push(new cl(h+c.text.slice(a.ch),d,n)),o(c,c.text.slice(0,s.ch)+u[0],i(0)),e.insert(s.line+1,g)}else if(1==u.length)o(c,c.text.slice(0,s.ch)+u[0]+f.text.slice(a.ch),i(0)),e.remove(s.line+1,p);else{o(c,c.text.slice(0,s.ch)+u[0],i(0)),o(f,h+f.text.slice(a.ch),d);var g=l(1,u.length-1);p>1&&e.remove(s.line+1,p-1),e.insert(s.line+1,g)}vi(e,"change",e,t)}function Bn(e){this.lines=e,this.parent=null;for(var t=0,r=0;t<e.length;++t)e[t].parent=this,r+=e[t].height;this.height=r}function Gn(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}function Un(e,t,r){function n(e,i,o){if(e.linked)for(var l=0;l<e.linked.length;++l){var s=e.linked[l];if(s.doc!=i){var a=o&&s.sharedHist;(!r||a)&&(t(s.doc,a),n(s.doc,e,a))}}}n(e,null,!0)}function Vn(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,l(e),r(e),e.options.lineWrapping||h(e),e.options.mode=t.modeOption,Dt(e)}function Kn(e,t){if(t-=e.first,0>t||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(o>t){r=i;break}t-=o}return r.lines[t]}function jn(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function Xn(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function _n(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function Yn(e){if(null==e.parent)return null;for(var t=e.parent,r=Ti(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function $n(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(o>t){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var n=0;n<e.lines.length;++n){var l=e.lines[n],s=l.height;if(s>t)break;t-=s}return r+n}function qn(e){e=fn(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;r=o,o=r.parent)for(var n=0;n<o.children.length;++n){var l=o.children[n];if(l==r)break;t+=l.height}return t}function Zn(e){var t=e.order;return null==t&&(t=e.order=$l(e.text)),t}function Qn(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Jn(e,t){var r={from:_(t.from),to:Vo(t),text:jn(e,t.from,t.to)};return li(e,r,t.from.line,t.to.line+1),Un(e,function(e){li(e,r,t.from.line,t.to.line+1)},!0),r}function ei(e){for(;e.length;){var t=ki(e);if(!t.ranges)break;e.pop()}}function ti(e,t){return t?(ei(e.done),ki(e.done)):e.done.length&&!ki(e.done).ranges?ki(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),ki(e.done)):void 0}function ri(e,t,r,n){var i=e.history;i.undone.length=0;var o,l=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>l-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=ti(i,i.lastOp==n))){var s=ki(o.changes);0==Ao(t.from,t.to)&&0==Ao(t.from,s.to)?s.to=Vo(t):o.changes.push(Jn(e,t))}else{var a=ki(i.done);for(a&&a.ranges||oi(e.sel,i.done),o={changes:[Jn(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,s||Cl(e,"historyAdded")}function ni(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function ii(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||ni(e,o,ki(i.done),t))?i.done[i.done.length-1]=t:oi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&n.clearRedo!==!1&&ei(i.undone)}function oi(e,t){var r=ki(t);r&&r.ranges&&r.equals(e)||t.push(e)}function li(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function si(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function ai(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=0,i=[];n<t.text.length;++n)i.push(si(r[n]));return i}function ui(e,t,r){for(var n=0,i=[];n<e.length;++n){var o=e[n];if(o.ranges)i.push(r?ue.prototype.deepCopy.call(o):o);else{var l=o.changes,s=[];i.push({changes:s});for(var a=0;a<l.length;++a){var u,c=l[a];if(s.push({from:c.from,to:c.to,text:c.text}),t)for(var f in c)(u=f.match(/^spans_(\d+)$/))&&Ti(t,Number(u[1]))>-1&&(ki(s)[f]=c[f],delete c[f])}}}return i}function ci(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function fi(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],l=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var s=0;s<o.ranges.length;s++)ci(o.ranges[s].anchor,t,r,n),ci(o.ranges[s].head,t,r,n)}else{for(var s=0;s<o.changes.length;++s){var a=o.changes[s];if(r<a.from.line)a.from=No(a.from.line+n,a.from.ch),a.to=No(a.to.line+n,a.to.ch);else if(t<=a.to.line){l=!1;break}}l||(e.splice(0,i+1),i=0)}}}function hi(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;fi(e.done,r,n,i),fi(e.undone,r,n,i)}function di(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function pi(e){return e.target||e.srcElement}function gi(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),xo&&e.ctrlKey&&1==t&&(t=3),t}function vi(e,t){function r(e){return function(){e.apply(null,o)}}var n=e._handlers&&e._handlers[t];if(n){var i,o=Array.prototype.slice.call(arguments,2);Po?i=Po.delayedCallbacks:Sl?i=Sl:(i=Sl=[],setTimeout(mi,0));for(var l=0;l<n.length;++l)i.push(r(n[l]))}}function mi(){var e=Sl;Sl=null;for(var t=0;t<e.length;++t)e[t]()}function yi(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Cl(e,r||t.type,e,t),di(t)||t.codemirrorIgnore}function bi(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==Ti(r,t[n])&&r.push(t[n])}function wi(e,t){var r=e._handlers&&e._handlers[t];return r&&r.length>0}function xi(e){e.prototype.on=function(e,t){wl(this,e,t)},e.prototype.off=function(e,t){xl(this,e,t)}}function Ci(){this.id=null}function Si(e,t,r){for(var n=0,i=0;;){var o=e.indexOf(" ",n);-1==o&&(o=e.length);var l=o-n;if(o==e.length||i+l>=t)return n+Math.min(l,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}}function Li(e){for(;Wl.length<=e;)Wl.push(ki(Wl)+" ");return Wl[e]}function ki(e){return e[e.length-1]}function Ti(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}function Mi(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Ni(){}function Ai(e,t){var r;return Object.create?r=Object.create(e):(Ni.prototype=e,r=new Ni),t&&Wi(t,r),r}function Wi(e,t,r){t||(t={});for(var n in e)!e.hasOwnProperty(n)||r===!1&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function Oi(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Di(e,t){return t?t.source.indexOf("\\w")>-1&&Il(e)?!0:t.test(e):Il(e)}function Hi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Ii(e){return e.charCodeAt(0)>=768&&Pl.test(e)}function Pi(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function zi(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Ei(e,t){return zi(e).appendChild(t)}function Fi(){return document.activeElement}function Ri(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Bi(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!Ri(r[n]).test(t)&&(t+=" "+r[n]);return t}function Gi(e){if(document.body.getElementsByClassName)for(var t=document.body.getElementsByClassName("CodeMirror"),r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&e(n)}}function Ui(){Gl||(Vi(),Gl=!0)}function Vi(){var e;wl(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Gi(Bt)},100))}),wl(window,"blur",function(){Gi(cr)})}function Ki(e){if(null==El){var t=Pi("span","​");Ei(e,Pi("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(El=t.offsetWidth<=1&&t.offsetHeight>2&&!(uo&&8>co))}var r=El?Pi("span","​"):Pi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function ji(e){if(null!=Fl)return Fl;var t=Ei(e,document.createTextNode("AخA")),r=Dl(t,0,1).getBoundingClientRect();if(!r||r.left==r.right)return!1;var n=Dl(t,1,2).getBoundingClientRect();return Fl=n.right-r.right<3}function Xi(e){if(null!=Xl)return Xl;var t=Ei(e,Pi("span","x")),r=t.getBoundingClientRect(),n=Dl(t,0,1).getBoundingClientRect();return Xl=Math.abs(r.left-n.left)>1}function _i(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<r&&l.to>t||t==r&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,r),1==l.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function Yi(e){return e.level%2?e.to:e.from}function $i(e){return e.level%2?e.from:e.to}function qi(e){var t=Zn(e);return t?Yi(t[0]):0}function Zi(e){var t=Zn(e);return t?$i(ki(t)):e.text.length}function Qi(e,t){var r=Kn(e.doc,t),n=fn(r);n!=r&&(t=Yn(n));var i=Zn(n),o=i?i[0].level%2?Zi(n):qi(n):0;return No(t,o)}function Ji(e,t){for(var r,n=Kn(e.doc,t);r=un(n);)n=r.find(1,!0).line,t=null;var i=Zn(n),o=i?i[0].level%2?qi(n):Zi(n):n.text.length;return No(null==t?Yn(n):t,o)}function eo(e,t){var r=Qi(e,t.line),n=Kn(e.doc,r.line),i=Zn(n);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),l=t.line==r.line&&t.ch<=o&&t.ch;return No(r.line,l?0:o)}return r}function to(e,t,r){var n=e[0].level;return t==n?!0:r==n?!1:r>t}function ro(e,t){Yl=null;for(var r,n=0;n<e.length;++n){var i=e[n];if(i.from<t&&i.to>t)return n;if(i.from==t||i.to==t){if(null!=r)return to(e,i.level,e[r].level)?(i.from!=i.to&&(Yl=r),n):(i.from!=i.to&&(Yl=n),r);r=n}}return r}function no(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&Ii(e.text.charAt(t)));return t}function io(e,t,r,n){var i=Zn(e);if(!i)return oo(e,t,r,n);for(var o=ro(i,t),l=i[o],s=no(e,t,l.level%2?-r:r,n);;){if(s>l.from&&s<l.to)return s;if(s==l.from||s==l.to)return ro(i,s)==o?s:(l=i[o+=r],r>0==l.level%2?l.to:l.from);if(l=i[o+=r],!l)return null;s=r>0==l.level%2?no(e,l.to,-1,n):no(e,l.from,1,n)}}function oo(e,t,r,n){var i=t+r;if(n)for(;i>0&&Ii(e.text.charAt(i));)i+=r;return 0>i||i>e.text.length?null:i}var lo=/gecko\/\d/i.test(navigator.userAgent),so=/MSIE \d/.test(navigator.userAgent),ao=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),uo=so||ao,co=uo&&(so?document.documentMode||6:ao[1]),fo=/WebKit\//.test(navigator.userAgent),ho=fo&&/Qt\/\d+\.\d+/.test(navigator.userAgent),po=/Chrome\//.test(navigator.userAgent),go=/Opera\//.test(navigator.userAgent),vo=/Apple Computer/.test(navigator.vendor),mo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),yo=/PhantomJS/.test(navigator.userAgent),bo=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),wo=bo||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),xo=bo||/Mac/.test(navigator.platform),Co=/win/i.test(navigator.platform),So=go&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);So&&(So=Number(So[1])),So&&So>=15&&(go=!1,fo=!0);var Lo=xo&&(ho||go&&(null==So||12.11>So)),ko=lo||uo&&co>=9,To=!1,Mo=!1;g.prototype=Wi({update:function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+o+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedOverlay&&e.clientHeight>0&&(0==n&&this.overlayHack(),this.checkedOverlay=!0),{right:r?n:0,bottom:t?n:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e)},overlayHack:function(){var e=xo&&!mo?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=e;var t=this,r=function(e){pi(e)!=t.vert&&pi(e)!=t.horiz&&Mt(t.cm,Vt)(e)};wl(this.vert,"mousedown",r),wl(this.horiz,"mousedown",r)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},g.prototype),v.prototype=Wi({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},v.prototype),e.scrollbarModel={"native":g,"null":v},k.prototype.signal=function(e,t){wi(e,t)&&this.events.push(arguments)},k.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Cl.apply(null,this.events[e])};var No=e.Pos=function(e,t){return this instanceof No?(this.line=e,void(this.ch=t)):new No(e,t)},Ao=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},Wo=null;te.prototype=Wi({init:function(e){function t(e){if(n.somethingSelected())Wo=n.getSelections(),r.inaccurateSelection&&(r.prevInput="",r.inaccurateSelection=!1,o.value=Wo.join("\n"),Ol(o));else{var t=J(n);Wo=t.text,"cut"==e.type?n.setSelections(t.ranges,null,Tl):(r.prevInput="",o.value=t.text.join("\n"),Ol(o))}"cut"==e.type&&(n.state.cutIncoming=!0)}var r=this,n=this.cm,i=this.wrapper=re(),o=this.textarea=i.firstChild;e.wrapper.insertBefore(i,e.wrapper.firstChild),bo&&(o.style.width="0px"),wl(o,"input",function(){uo&&co>=9&&r.hasSelection&&(r.hasSelection=null),r.poll()}),wl(o,"paste",function(){if(fo&&!n.state.fakedLastChar&&!(new Date-n.state.lastMiddleDown<200)){var e=o.selectionStart,t=o.selectionEnd;o.value+="$",o.selectionEnd=t,o.selectionStart=e,n.state.fakedLastChar=!0}n.state.pasteIncoming=!0,r.fastPoll()}),wl(o,"cut",t),wl(o,"copy",t),wl(e.scroller,"paste",function(t){Gt(e,t)||(n.state.pasteIncoming=!0,r.focus())}),wl(e.lineSpace,"selectstart",function(t){Gt(e,t)||ml(t)})},prepareSelection:function(){var e=this.cm,t=e.display,r=e.doc,n=De(e);if(e.options.moveInputWithCursor){var i=ct(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return n},showSelection:function(e){var t=this.cm,r=t.display;Ei(r.cursorDiv,e.cursors),Ei(r.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,r,n=this.cm,i=n.doc;if(n.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=jl&&(o.to().line-o.from().line>100||(r=n.getSelection()).length>1e3);var l=t?"-":r||n.getSelection();this.textarea.value=l,n.state.focused&&Ol(this.textarea),uo&&co>=9&&(this.hasSelection=l)}else e||(this.prevInput=this.textarea.value="",uo&&co>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!wo||Fi()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var n=r.poll();n||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))}var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,r=this.prevInput;if(!e.state.focused||Kl(t)&&!r||Z(e)||e.options.disableInput||e.state.keySeq)return!1;e.state.pasteIncoming&&e.state.fakedLastChar&&(t.value=t.value.substring(0,t.value.length-1),e.state.fakedLastChar=!1);var n=t.value;if(n==r&&!e.somethingSelected())return!1;if(uo&&co>=9&&this.hasSelection===n||xo&&/[\uf700-\uf7ff]/.test(n))return e.display.input.reset(),!1;8203!=n.charCodeAt(0)||e.doc.sel!=e.display.selForContextMenu||r||(r="​");for(var i=0,o=Math.min(r.length,n.length);o>i&&r.charCodeAt(i)==n.charCodeAt(i);)++i;var l=this;
4
+ return Tt(e,function(){Q(e,n.slice(i),r.length-i),n.length>1e3||n.indexOf("\n")>-1?t.value=l.prevInput="":l.prevInput=n}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){uo&&co>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=l.selectionStart){var e=i.somethingSelected(),t=l.value="​"+(e?l.value:"");n.prevInput=e?"":"​",l.selectionStart=1,l.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function r(){if(n.contextMenuPending=!1,n.wrapper.style.position="relative",l.style.cssText=c,uo&&9>co&&o.scrollbars.setScrollTop(o.scroller.scrollTop=a),null!=l.selectionStart){(!uo||uo&&9>co)&&t();var e=0,r=function(){o.selForContextMenu==i.doc.sel&&0==l.selectionStart?Mt(i,el.selectAll)(i):e++<10?o.detectingSelectAll=setTimeout(r,500):o.input.reset()};o.detectingSelectAll=setTimeout(r,200)}}var n=this,i=n.cm,o=i.display,l=n.textarea,s=Ut(i,e),a=o.scroller.scrollTop;if(s&&!go){var u=i.options.resetSelectionOnContextMenu;u&&-1==i.doc.sel.contains(s)&&Mt(i,ke)(i.doc,he(s),Tl);var c=l.style.cssText;if(n.wrapper.style.position="absolute",l.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(uo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",fo)var f=window.scrollY;if(o.input.focus(),fo&&window.scrollTo(null,f),o.input.reset(),i.somethingSelected()||(l.value=n.prevInput=" "),n.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),uo&&co>=9&&t(),ko){bl(e);var h=function(){xl(window,"mouseup",h),setTimeout(r,20)};wl(window,"mouseup",h)}else setTimeout(r,50)}},setUneditable:Ni,needsContentAttribute:!1},te.prototype),ne.prototype=Wi({init:function(e){function t(e){if(n.somethingSelected())Wo=n.getSelections(),"cut"==e.type&&n.replaceSelection("",null,"cut");else{var t=J(n);Wo=t.text,"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,Tl),n.replaceSelection("",null,"cut")})}if(e.clipboardData&&!bo)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Wo.join("\n"));else{var r=re(),i=r.firstChild;n.display.lineSpace.insertBefore(r,n.display.lineSpace.firstChild),i.value=Wo.join("\n");var o=document.activeElement;Ol(i),setTimeout(function(){n.display.lineSpace.removeChild(r),o.focus()},50)}}var r=this,n=r.cm,i=r.div=e.lineDiv;i.contentEditable="true",ee(i),wl(i,"paste",function(e){var t=e.clipboardData&&e.clipboardData.getData("text/plain");t&&(e.preventDefault(),n.replaceSelection(t,null,"paste"))}),wl(i,"compositionstart",function(e){var t=e.data;if(r.composing={sel:n.doc.sel,data:t,startData:t},t){var i=n.doc.sel.primary(),o=n.getLine(i.head.line),l=o.indexOf(t,Math.max(0,i.head.ch-t.length));l>-1&&l<=i.head.ch&&(r.composing.sel=he(No(i.head.line,l),No(i.head.line,l+t.length)))}}),wl(i,"compositionupdate",function(e){r.composing.data=e.data}),wl(i,"compositionend",function(e){var t=r.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||r.applyComposition(t),r.composing==t&&(r.composing=null)},50))}),wl(i,"touchstart",function(){r.forceCompositionEnd()}),wl(i,"input",function(){r.composing||r.pollContent()||Tt(r.cm,function(){Dt(n)})}),wl(i,"copy",t),wl(i,"cut",t)},prepareSelection:function(){var e=De(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){e&&this.cm.display.view.length&&(e.focus&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),r=le(this.cm,e.anchorNode,e.anchorOffset),n=le(this.cm,e.focusNode,e.focusOffset);if(!r||r.bad||!n||n.bad||0!=Ao($(r,n),t.from())||0!=Ao(Y(r,n),t.to())){var i=ie(this.cm,t.from()),o=ie(this.cm,t.to());if(i||o){var l=this.cm.display.view,s=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var a=l[l.length-1].measure,u=a.maps?a.maps[a.maps.length-1]:a.map;o={node:u[u.length-1],offset:u[u.length-2]-u[u.length-3]}}}else i={node:l[0].measure.map[2],offset:0};try{var c=Dl(i.node,i.offset,o.offset,o.node)}catch(f){}c&&(e.removeAllRanges(),e.addRange(c),s&&null==e.anchorNode&&e.addRange(s)),this.rememberSelection()}}},showMultipleSelections:function(e){Ei(this.cm.display.cursorDiv,e.cursors),Ei(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return zl(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():Tt(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},pollSelection:function(){if(!this.composing){var e=window.getSelection(),t=this.cm;if(e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset){this.rememberSelection();var r=le(t,e.anchorNode,e.anchorOffset),n=le(t,e.focusNode,e.focusOffset);r&&n&&Tt(t,function(){ke(t.doc,he(r,n),Tl),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}}},pollContent:function(){var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),i=r.to();if(n.line<t.viewFrom||i.line>t.viewTo-1)return!1;var o;if(n.line==t.viewFrom||0==(o=Pt(e,n.line)))var l=Yn(t.view[0].line),s=t.view[0].node;else var l=Yn(t.view[o].line),s=t.view[o-1].node.nextSibling;var a=Pt(e,i.line);if(a==t.view.length-1)var u=t.viewTo-1,c=t.view[a].node;else var u=Yn(t.view[a+1].line)-1,c=t.view[a+1].node.previousSibling;for(var f=Vl(ae(e,s,c,l,u)),h=jn(e.doc,No(l,0),No(u,Kn(e.doc,u).text.length));f.length>1&&h.length>1;)if(ki(f)==ki(h))f.pop(),h.pop(),u--;else{if(f[0]!=h[0])break;f.shift(),h.shift(),l++}for(var d=0,p=0,g=f[0],v=h[0],m=Math.min(g.length,v.length);m>d&&g.charCodeAt(d)==v.charCodeAt(d);)++d;for(var y=ki(f),b=ki(h),w=Math.min(y.length-(1==f.length?d:0),b.length-(1==h.length?d:0));w>p&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;f[f.length-1]=y.slice(0,y.length-p),f[0]=f[0].slice(d);var x=No(l,d),C=No(u,h.length?ki(h).length-p:0);return f.length>1||f[0]||Ao(x,C)?(Lr(e.doc,f,x,C,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){e.data&&e.data!=e.startData&&Mt(this.cm,Q)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.setAttribute("contenteditable","false")},onKeyPress:function(e){e.preventDefault(),Mt(this.cm,Q)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},onContextMenu:Ni,resetPosition:Ni,needsContentAttribute:!0},ne.prototype),e.inputStyles={textarea:te,contenteditable:ne},ue.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(0!=Ao(r.anchor,n.anchor)||0!=Ao(r.head,n.head))return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new ce(_(this.ranges[t].anchor),_(this.ranges[t].head));return new ue(e,this.primIndex)},somethingSelected:function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},contains:function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(Ao(t,n.from())>=0&&Ao(e,n.to())<=0)return r}return-1}},ce.prototype={from:function(){return $(this.anchor,this.head)},to:function(){return Y(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Oo,Do,Ho,Io={left:0,right:0,top:0,bottom:0},Po=null,zo=0,Eo=0,Fo=0,Ro=null;uo?Ro=-.53:lo?Ro=15:po?Ro=-.7:vo&&(Ro=-1/3);var Bo=function(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}};e.wheelEventPixels=function(e){var t=Bo(e);return t.x*=Ro,t.y*=Ro,t};var Go=new Ci,Uo=null,Vo=e.changeEnd=function(e){return e.text?No(e.from.line+e.text.length-1,ki(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var r=this.options,n=r[e];(r[e]!=t||"mode"==e)&&(r[e]=t,jo.hasOwnProperty(e)&&Mt(this,jo[e])(this,t,n))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Rr(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:Nt(function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:t,opaque:r&&r.opaque}),this.state.modeGen++,Dt(this)}),removeOverlay:Nt(function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void Dt(this)}}),indentLine:Nt(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),ve(this.doc,e)&&Dr(this,e,t,r)}),indentSelection:Nt(function(e){for(var t=this.doc.sel.ranges,r=-1,n=0;n<t.length;n++){var i=t[n];if(i.empty())i.head.line>r&&(Dr(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&Wr(this));else{var o=i.from(),l=i.to(),s=Math.max(r,o.line);r=Math.min(this.lastLine(),l.line-(l.ch?0:1))+1;for(var a=s;r>a;++a)Dr(this,a,e);var u=this.doc.sel.ranges;0==o.ch&&t.length==u.length&&u[n].from().ch>0&&xe(this.doc,n,new ce(o,u[n].to()),Tl)}}}),getTokenAt:function(e,t){return kn(this,e,t)},getLineTokens:function(e,t){return kn(this,No(e),t,!0)},getTokenTypeAt:function(e){e=pe(this.doc,e);var t,r=Nn(this,Kn(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var l=n+i>>1;if((l?r[2*l-1]:0)>=o)i=l;else{if(!(r[2*l+1]<o)){t=r[2*l+2];break}n=l+1}}var s=t?t.indexOf("cm-overlay "):-1;return 0>s?t:0==s?null:t.slice(0,s-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!Zo.hasOwnProperty(t))return Zo;var n=Zo[t],i=this.getModeAt(e);if("string"==typeof i[t])n[i[t]]&&r.push(n[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var l=n[i[t][o]];l&&r.push(l)}else i.helperType&&n[i.helperType]?r.push(n[i.helperType]):n[i.name]&&r.push(n[i.name]);for(var o=0;o<n._global.length;o++){var s=n._global[o];s.pred(i,this)&&-1==Ti(r,s.val)&&r.push(s.val)}return r},getStateAfter:function(e,t){var r=this.doc;return e=de(r,null==e?r.first+r.size-1:e),Re(this,e+1,t)},cursorCoords:function(e,t){var r,n=this.doc.sel.primary();return r=null==e?n.head:"object"==typeof e?pe(this.doc,e):e?n.from():n.to(),ct(this,r,t||"page")},charCoords:function(e,t){return ut(this,pe(this.doc,e),t||"page")},coordsChar:function(e,t){return e=at(this,e,t||"page"),dt(this,e.left,e.top)},lineAtHeight:function(e,t){return e=at(this,{top:e,left:0},t||"page").top,$n(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var r=!1,n=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>n&&(e=n,r=!0);var i=Kn(this.doc,e);return st(this,i,{top:0,left:0},t||"page").top+(r?this.doc.height-qn(i):0)},defaultTextHeight:function(){return gt(this.display)},defaultCharWidth:function(){return vt(this.display)},setGutterMarker:Nt(function(e,t,r){return Hr(this.doc,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&Hi(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Nt(function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,Ht(t,n,"gutter"),Hi(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),addLineWidget:Nt(function(e,t,r){return bn(this,e,t,r)}),removeLineWidget:function(e){e.clear()},lineInfo:function(e){if("number"==typeof e){if(!ve(this.doc,e))return null;var t=e;if(e=Kn(this.doc,e),!e)return null}else{var t=Yn(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=ct(this,pe(this.doc,e));var l=e.bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)l=e.top;else if("above"==n||"near"==n){var a=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>a)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=a&&(l=e.bottom),s+t.offsetWidth>u&&(s=u-t.offsetWidth)}t.style.top=l+"px",t.style.left=t.style.right="","right"==i?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),r&&Mr(this,s,l,s+t.offsetWidth,l+t.offsetHeight)},triggerOnKeyDown:Nt(or),triggerOnKeyPress:Nt(ar),triggerOnKeyUp:sr,execCommand:function(e){return el.hasOwnProperty(e)?el[e](this):void 0},findPosH:function(e,t,r,n){var i=1;0>t&&(i=-1,t=-t);for(var o=0,l=pe(this.doc,e);t>o&&(l=Pr(this.doc,l,i,r,n),!l.hitSide);++o);return l},moveH:Nt(function(e,t){var r=this;r.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?Pr(r.doc,n.head,e,t,r.options.rtlMoveVisually):0>e?n.from():n.to()},Nl)}),deleteH:Nt(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Ir(this,function(r){var i=Pr(n,r.head,e,t,!1);return 0>e?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=1,o=n;0>t&&(i=-1,t=-t);for(var l=0,s=pe(this.doc,e);t>l;++l){var a=ct(this,s,"div");if(null==o?o=a.left:a.left=o,s=zr(this,a,i,r),s.hitSide)break}return s},moveV:Nt(function(e,t){var r=this,n=this.doc,i=[],o=!r.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(l){if(o)return 0>e?l.from():l.to();var s=ct(r,l.head,"div");null!=l.goalColumn&&(s.left=l.goalColumn),i.push(s.left);var a=zr(r,s,e,t);return"page"==t&&l==n.sel.primary()&&Ar(r,null,ut(r,a,"div").top-s.top),a},Nl),i.length)for(var l=0;l<n.sel.ranges.length;l++)n.sel.ranges[l].goalColumn=i[l]}),findWordAt:function(e){var t=this.doc,r=Kn(t,e.line).text,n=e.ch,i=e.ch;if(r){var o=this.getHelper(e,"wordChars");(e.xRel<0||i==r.length)&&n?--n:++i;for(var l=r.charAt(n),s=Di(l,o)?function(e){return Di(e,o)}:/\s/.test(l)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Di(e)};n>0&&s(r.charAt(n-1));)--n;for(;i<r.length&&s(r.charAt(i));)++i}return new ce(No(e.line,n),No(e.line,i))},toggleOverwrite:function(e){(null==e||e!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?Bl(this.display.cursorDiv,"CodeMirror-overwrite"):Rl(this.display.cursorDiv,"CodeMirror-overwrite"),Cl(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==Fi()},scrollTo:Nt(function(e,t){(null!=e||null!=t)&&Or(this),null!=e&&(this.curOp.scrollLeft=e),null!=t&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Ve(this)-this.display.barHeight,width:e.scrollWidth-Ve(this)-this.display.barWidth,clientHeight:je(this),clientWidth:Ke(this)}},scrollIntoView:Nt(function(e,t){if(null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:No(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line)Or(this),this.curOp.scrollToPos=e;else{var r=Nr(this,Math.min(e.from.left,e.to.left),Math.min(e.from.top,e.to.top)-e.margin,Math.max(e.from.right,e.to.right),Math.max(e.from.bottom,e.to.bottom)+e.margin);this.scrollTo(r.scrollLeft,r.scrollTop)}}),setSize:Nt(function(e,t){function r(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}var n=this;null!=e&&(n.display.wrapper.style.width=r(e)),null!=t&&(n.display.wrapper.style.height=r(t)),n.options.lineWrapping&&nt(this);var i=n.display.viewFrom;n.doc.iter(i,n.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){Ht(n,i,"widget");break}++i}),n.curOp.forceUpdate=!0,Cl(n,"refresh",this)}),operation:function(e){return Tt(this,e)},refresh:Nt(function(){var e=this.display.cachedTextHeight;Dt(this),this.curOp.forceUpdate=!0,it(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),c(this),(null==e||Math.abs(e-gt(this.display))>.5)&&l(this),Cl(this,"refresh",this)}),swapDoc:Nt(function(e){var t=this.doc;return t.cm=null,Vn(this,e),it(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,vi(this,"swapDoc",this,t),t}),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}},xi(e);var Ko=e.defaults={},jo=e.optionHandlers={},Xo=e.Init={toString:function(){return"CodeMirror.Init"}};Er("value","",function(e,t){e.setValue(t)},!0),Er("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),Er("indentUnit",2,r,!0),Er("indentWithTabs",!1),Er("smartIndent",!0),Er("tabSize",4,function(e){n(e),it(e),Dt(e)},!0),Er("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t){e.options.specialChars=new RegExp(t.source+(t.test(" ")?"":"| "),"g"),e.refresh()},!0),Er("specialCharPlaceholder",Dn,function(e){e.refresh()},!0),Er("electricChars",!0),Er("inputStyle",wo?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Er("rtlMoveVisually",!Co),Er("wholeLineUpdateBefore",!0),Er("theme","default",function(e){s(e),a(e)},!0),Er("keyMap","default",function(t,r,n){var i=Rr(r),o=n!=e.Init&&Rr(n);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),Er("extraKeys",null),Er("lineWrapping",!1,i,!0),Er("gutters",[],function(e){d(e.options),a(e)},!0),Er("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?L(e.display)+"px":"0",e.refresh()},!0),Er("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),Er("scrollbarStyle","native",function(e){m(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Er("lineNumbers",!1,function(e){d(e.options),a(e)},!0),Er("firstLineNumber",1,a,!0),Er("lineNumberFormatter",function(e){return e},a,!0),Er("showCursorWhenSelecting",!1,Oe,!0),Er("resetSelectionOnContextMenu",!0),Er("readOnly",!1,function(e,t){"nocursor"==t?(cr(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||e.display.input.reset())}),Er("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Er("dragDrop",!0),Er("cursorBlinkRate",530),Er("cursorScrollMargin",0),Er("cursorHeight",1,Oe,!0),Er("singleCursorHeightPerLine",!0,Oe,!0),Er("workTime",100),Er("workDelay",100),Er("flattenSpans",!0,n,!0),Er("addModeClass",!1,n,!0),Er("pollInterval",100),Er("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),Er("historyEventDelay",1250),Er("viewportMargin",10,function(e){e.refresh()},!0),Er("maxHighlightLength",1e4,n,!0),Er("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Er("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),Er("autofocus",null);var _o=e.modes={},Yo=e.mimeModes={};e.defineMode=function(t,r){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(r.dependencies=Array.prototype.slice.call(arguments,2)),_o[t]=r},e.defineMIME=function(e,t){Yo[e]=t},e.resolveMode=function(t){if("string"==typeof t&&Yo.hasOwnProperty(t))t=Yo[t];else if(t&&"string"==typeof t.name&&Yo.hasOwnProperty(t.name)){var r=Yo[t.name];"string"==typeof r&&(r={name:r}),t=Ai(r,t),t.name=r.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,r){var r=e.resolveMode(r),n=_o[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if($o.hasOwnProperty(r.name)){var o=$o[r.name];for(var l in o)o.hasOwnProperty(l)&&(i.hasOwnProperty(l)&&(i["_"+l]=i[l]),i[l]=o[l])}if(i.name=r.name,r.helperType&&(i.helperType=r.helperType),r.modeProps)for(var l in r.modeProps)i[l]=r.modeProps[l];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var $o=e.modeExtensions={};e.extendMode=function(e,t){var r=$o.hasOwnProperty(e)?$o[e]:$o[e]={};Wi(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){pl.prototype[e]=t},e.defineOption=Er;var qo=[];e.defineInitHook=function(e){qo.push(e)};var Zo=e.helpers={};e.registerHelper=function(t,r,n){Zo.hasOwnProperty(t)||(Zo[t]=e[t]={_global:[]}),Zo[t][r]=n},e.registerGlobalHelper=function(t,r,n,i){e.registerHelper(t,r,i),Zo[t]._global.push({pred:n,val:i})};var Qo=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r},Jo=e.startState=function(e,t,r){return e.startState?e.startState(t,r):!0};e.innerMode=function(e,t){for(;e.innerMode;){var r=e.innerMode(t);if(!r||r.mode==e)break;t=r.state,e=r.mode}return r||{mode:e,state:t}};var el=e.commands={selectAll:function(e){e.setSelection(No(e.firstLine(),0),No(e.lastLine()),Tl)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Tl)},killLine:function(e){Ir(e,function(t){if(t.empty()){var r=Kn(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:No(t.head.line+1,0)}:{from:t.head,to:No(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){Ir(e,function(t){return{from:No(t.from().line,0),to:pe(e.doc,No(t.to().line+1,0))}})},delLineLeft:function(e){Ir(e,function(e){return{from:No(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){Ir(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return{from:n,to:t.from()}})},delWrappedLineRight:function(e){Ir(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},undo:function(e){e.undo()},redo:function(e){e.redo()},undoSelection:function(e){e.undoSelection()},redoSelection:function(e){e.redoSelection()},goDocStart:function(e){e.extendSelection(No(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(No(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return Qi(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){return eo(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){e.extendSelectionsBy(function(t){return Ji(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},Nl)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},Nl)},goLineLeftSmart:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?eo(e,t.head):n},Nl)},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),l=Al(e.getLine(o.line),o.ch,n);t.push(new Array(n-l%n+1).join(" "))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){Tt(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){var i=t[n].head,o=Kn(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new No(i.line,i.ch-1)),i.ch>0)i=new No(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),No(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=Kn(e.doc,i.line-1).text;l&&e.replaceRange(o.charAt(0)+"\n"+l.charAt(l.length-1),No(i.line-1,l.length-1),No(i.line,1),"+transpose")}r.push(new ce(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){Tt(e,function(){for(var t=e.listSelections().length,r=0;t>r;r++){var n=e.listSelections()[r];e.replaceRange("\n",n.anchor,n.head,"+input"),e.indentLine(n.from().line+1,null,!0),Wr(e)}})},toggleOverwrite:function(e){e.toggleOverwrite()}},tl=e.keyMap={};tl.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"},tl.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"},tl.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"},tl.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"]},tl["default"]=xo?tl.macDefault:tl.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=Mi(r.split(" "),Fr),o=0;o<i.length;o++){var l,s;o==i.length-1?(s=r,l=n):(s=i.slice(0,o+1).join(" "),l="...");var a=t[s];if(a){if(a!=l)throw new Error("Inconsistent bindings for "+s)}else t[s]=l}delete e[r]}for(var u in t)e[u]=t[u];return e};var rl=e.lookupKey=function(e,t,r,n){t=Rr(t);var i=t.call?t.call(e,n):t[e];if(i===!1)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return rl(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var l=rl(e,t.fallthrough[o],r,n);if(l)return l}}},nl=e.isModifierKey=function(e){var t="string"==typeof e?e:_l[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},il=e.keyName=function(e,t){if(go&&34==e.keyCode&&e["char"])return!1;var r=_l[e.keyCode],n=r;return null==n||e.altGraphKey?!1:(e.altKey&&"Alt"!=r&&(n="Alt-"+n),(Lo?e.metaKey:e.ctrlKey)&&"Ctrl"!=r&&(n="Ctrl-"+n),(Lo?e.ctrlKey:e.metaKey)&&"Cmd"!=r&&(n="Cmd-"+n),!t&&e.shiftKey&&"Shift"!=r&&(n="Shift-"+n),n)};e.fromTextArea=function(t,r){function n(){t.value=u.getValue()}if(r=r?Wi(r):{},r.value=t.value,!r.tabindex&&t.tabIndex&&(r.tabindex=t.tabIndex),!r.placeholder&&t.placeholder&&(r.placeholder=t.placeholder),null==r.autofocus){var i=Fi();r.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(wl(t.form,"submit",n),!r.leaveSubmitMethodAlone)){var o=t.form,l=o.submit;try{var s=o.submit=function(){n(),o.submit=l,o.submit(),o.submit=s}}catch(a){}}r.finishInit=function(e){e.save=n,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,n(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(xl(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=l))}},t.style.display="none";var u=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},r);return u};var ol=e.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};ol.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(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(e){var t=this.string.charAt(this.pos);if("string"==typeof e)var r=t==e;else var r=t&&(e.test?e.test(t):e(t));return r?(++this.pos,t):void 0},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Al(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),
5
  this.lastColumnValue-(this.lineStart?Al(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Al(this.string,null,this.tabSize)-(this.lineStart?Al(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var ll=0,sl=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ll};xi(sl),sl.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&mt(e),wi(this,"clear")){var r=this.find();r&&vi(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var l=this.lines[o],s=Xr(l.markedSpans,this);e&&!this.collapsed?Ht(e,Yn(l),"text"):e&&(null!=s.to&&(i=Yn(l)),null!=s.from&&(n=Yn(l))),l.markedSpans=_r(l.markedSpans,s),null==s.from&&this.collapsed&&!gn(this.doc,l)&&e&&_n(l,gt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var a=fn(this.lines[o]),u=f(a);u>e.display.maxLineLength&&(e.display.maxLine=a,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&Dt(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ne(e.doc)),e&&vi(e,"markerCleared",e,this),t&&bt(e),this.parent&&this.parent.clear()}},sl.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var r,n,i=0;i<this.lines.length;++i){var o=this.lines[i],l=Xr(o.markedSpans,this);if(null!=l.from&&(r=No(t?o:Yn(o),l.from),-1==e))return r;if(null!=l.to&&(n=No(t?o:Yn(o),l.to),1==e))return n}return r&&{from:r,to:n}},sl.prototype.changed=function(){var e=this.find(-1,!0),t=this,r=this.doc.cm;e&&r&&Tt(r,function(){var n=e.line,i=Yn(e.line),o=qe(r,i);if(o&&(rt(o),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!gn(t.doc,n)&&null!=t.height){var l=t.height;t.height=null;var s=yn(t)-l;s&&_n(n,n.height+s)}})},sl.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=Ti(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},sl.prototype.detachLine=function(e){if(this.lines.splice(Ti(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var ll=0,al=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};xi(al),al.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();vi(this,"clear")}},al.prototype.find=function(e,t){return this.primary.find(e,t)};var ul=e.LineWidget=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.cm=e,this.node=t};xi(ul),ul.prototype.clear=function(){var e=this.cm,t=this.line.widgets,r=this.line,n=Yn(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=yn(this);Tt(e,function(){mn(e,r,-o),Ht(e,n,"widget"),_n(r,Math.max(0,r.height-o))})}},ul.prototype.changed=function(){var e=this.height,t=this.cm,r=this.line;this.height=null;var n=yn(this)-e;n&&Tt(t,function(){t.curOp.forceUpdate=!0,mn(t,r,n),_n(r,r.height+n)})};var cl=e.Line=function(e,t,r){this.text=e,rn(this,t),this.height=r?r(this):1};xi(cl),cl.prototype.lineNo=function(){return Yn(this)};var fl={},hl={};Bn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;n>r;++r){var i=this.lines[r];this.height-=i.height,xn(i),vi(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;n>e;++e)if(r(this.lines[e]))return!0}},Gn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(i>e){var o=Math.min(t,i-e),l=n.height;if(n.removeInner(e,o),this.height-=l-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Bn))){var s=[];this.collapse(s),this.children=[new Bn(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(o>=e){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(;i.lines.length>50;){var l=i.lines.splice(i.lines.length-25,25),s=new Bn(l);i.height-=s.height,this.children.splice(n+1,0,s),s.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Gn(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=Ti(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new Gn(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(o>e){var l=Math.min(t,o-e);if(i.iterN(e,l,r))return!0;if(0==(t-=l))break;e=0}else e-=o}}};var dl=0,pl=e.Doc=function(e,t,r){if(!(this instanceof pl))return new pl(e,t,r);null==r&&(r=0),Gn.call(this,[new Bn([new cl("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var n=No(r,0);this.sel=he(n),this.history=new Qn(null),this.id=++dl,this.modeOption=t,"string"==typeof e&&(e=Vl(e)),Rn(this,{from:n,to:n,text:e}),ke(this,he(n),Tl)};pl.prototype=Ai(Gn.prototype,{constructor:pl,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Xn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||"\n")},setValue:At(function(e){var t=No(this.first,0),r=this.first+this.size-1;yr(this,{from:t,to:No(r,Kn(this,r).text.length),text:Vl(e),origin:"setValue",full:!0},!0),ke(this,he(t))}),replaceRange:function(e,t,r,n){t=pe(this,t),r=r?pe(this,r):t,Lr(this,e,t,r,n)},getRange:function(e,t,r){var n=jn(this,pe(this,e),pe(this,t));return r===!1?n:n.join(r||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){return ve(this,e)?Kn(this,e):void 0},getLineNumber:function(e){return Yn(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Kn(this,e)),fn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return pe(this,e)},getCursor:function(e){var t,r=this.sel.primary();return t=null==e||"head"==e?r.head:"anchor"==e?r.anchor:"end"==e||"to"==e||e===!1?r.to():r.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:At(function(e,t,r){Ce(this,pe(this,"number"==typeof e?No(e,t||0):e),null,r)}),setSelection:At(function(e,t,r){Ce(this,pe(this,e),pe(this,t||e),r)}),extendSelection:At(function(e,t,r){be(this,pe(this,e),t&&pe(this,t),r)}),extendSelections:At(function(e,t){we(this,me(this,e,t))}),extendSelectionsBy:At(function(e,t){we(this,Mi(this.sel.ranges,e),t)}),setSelections:At(function(e,t,r){if(e.length){for(var n=0,i=[];n<e.length;n++)i[n]=new ce(pe(this,e[n].anchor),pe(this,e[n].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),ke(this,fe(i,t),r)}}),addSelection:At(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new ce(pe(this,e),pe(this,t||e))),ke(this,fe(n,n.length-1),r)}),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=jn(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return e===!1?t:t.join(e||"\n")},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=jn(this,r[n].from(),r[n].to());e!==!1&&(i=i.join(e||"\n")),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:At(function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var l=i.ranges[o];n[o]={from:l.from(),to:l.to(),text:Vl(e[o]),origin:r}}for(var s=t&&"end"!=t&&vr(this,n,t),o=n.length-1;o>=0;o--)yr(this,n[o]);s?Le(this,s):this.cm&&Wr(this.cm)}),undo:At(function(){wr(this,"undo")}),redo:At(function(){wr(this,"redo")}),undoSelection:At(function(){wr(this,"undo",!0)}),redoSelection:At(function(){wr(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new Qn(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:ui(this.history.done),undone:ui(this.history.undone)}},setHistory:function(e){var t=this.history=new Qn(this.history.maxGeneration);t.done=ui(e.done.slice(0),null,!0),t.undone=ui(e.undone.slice(0),null,!0)},addLineClass:At(function(e,t,r){return Hr(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(Ri(r).test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0})}),removeLineClass:At(function(e,t,r){return Hr(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var o=i.match(Ri(r));if(!o)return!1;var l=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&l!=i.length?" ":"")+i.slice(l)||null}return!0})}),markText:function(e,t,r){return Br(this,pe(this,e),pe(this,t),r,"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared};return e=pe(this,e),Br(this,e,e,r,"bookmark")},findMarksAt:function(e){e=pe(this,e);var t=[],r=Kn(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=pe(this,e),t=pe(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l)for(var s=0;s<l.length;s++){var a=l[s];i==e.line&&e.ch>a.to||null==a.from&&i!=e.line||i==t.line&&a.from>t.ch||r&&!r(a.marker)||n.push(a.marker.parent||a.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first;return this.iter(function(n){var i=n.text.length+1;return i>e?(t=e,!0):(e-=i,void++r)}),pe(this,No(r,t))},indexFromPos:function(e){e=pe(this,e);var t=e.ch;return e.line<this.first||e.ch<0?0:(this.iter(this.first,e.line,function(e){t+=e.text.length+1}),t)},copy:function(e){var t=new pl(Xn(this,this.first,this.first+this.size),this.modeOption,this.first);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new pl(Xn(this,t,r),e.mode||this.modeOption,t);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Vr(n,Ur(this)),n},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(var r=0;r<this.linked.length;++r){var n=this.linked[r];if(n.doc==t){this.linked.splice(r,1),t.unlinkDoc(this),Kr(Ur(this));break}}if(t.history==this.history){var i=[t.id];Un(t,function(e){i.push(e.id)},!0),t.history=new Qn(null),t.history.done=ui(this.history.done,i),t.history.undone=ui(this.history.undone,i)}},iterLinkedDocs:function(e){Un(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),pl.prototype.eachLine=pl.prototype.iter;var gl="iter insert remove copy getEditor".split(" ");for(var vl in pl.prototype)pl.prototype.hasOwnProperty(vl)&&Ti(gl,vl)<0&&(e.prototype[vl]=function(e){return function(){return e.apply(this.doc,arguments)}}(pl.prototype[vl]));xi(pl);var ml=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},yl=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},bl=e.e_stop=function(e){ml(e),yl(e)},wl=e.on=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={}),i=n[t]||(n[t]=[]);i.push(r)}},xl=e.off=function(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers&&e._handlers[t];if(!n)return;for(var i=0;i<n.length;++i)if(n[i]==r){n.splice(i,1);break}}},Cl=e.signal=function(e,t){var r=e._handlers&&e._handlers[t];if(r)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)},Sl=null,Ll=30,kl=e.Pass={toString:function(){return"CodeMirror.Pass"}},Tl={scroll:!1},Ml={origin:"*mouse"},Nl={origin:"+move"};Ci.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Al=e.countColumn=function(e,t,r,n,i){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=n||0,l=i||0;;){var s=e.indexOf(" ",o);if(0>s||s>=t)return l+(t-o);l+=s-o,l+=r-l%r,o=s+1}},Wl=[""],Ol=function(e){e.select()};bo?Ol=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:uo&&(Ol=function(e){try{e.select()}catch(t){}});var Dl,Hl=/[\u00df\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Il=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Hl.test(e))},Pl=/[\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]/;Dl=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(i){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var zl=e.contains=function(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do if(11==t.nodeType&&(t=t.host),t==e)return!0;while(t=t.parentNode)};uo&&11>co&&(Fi=function(){try{return document.activeElement}catch(e){return document.body}});var El,Fl,Rl=e.rmClass=function(e,t){var r=e.className,n=Ri(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}},Bl=e.addClass=function(e,t){var r=e.className;Ri(t).test(r)||(e.className+=(r?" ":"")+t)},Gl=!1,Ul=function(){if(uo&&9>co)return!1;var e=Pi("div");return"draggable"in e||"dragDrop"in e}(),Vl=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;n>=t;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),t+=l+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},Kl=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(r){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},jl=function(){var e=Pi("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Xl=null,_l={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"};e.keyNames=_l,function(){for(var e=0;10>e;e++)_l[e+48]=_l[e+96]=String(e);for(var e=65;90>=e;e++)_l[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)_l[e+111]=_l[e+63235]="F"+e}();var Yl,$l=function(){function e(e){return 247>=e?r.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?n.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,r){this.level=e,this.from=t,this.to=r}var r="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,l=/[LRr]/,s=/[Lb1n]/,a=/[1n]/,u="L";return function(r){if(!i.test(r))return!1;for(var n,c=r.length,f=[],h=0;c>h;++h)f.push(n=e(r.charCodeAt(h)));for(var h=0,d=u;c>h;++h){var n=f[h];"m"==n?f[h]=d:d=n}for(var h=0,p=u;c>h;++h){var n=f[h];"1"==n&&"r"==p?f[h]="n":l.test(n)&&(p=n,"r"==n&&(f[h]="R"))}for(var h=1,d=f[0];c-1>h;++h){var n=f[h];"+"==n&&"1"==d&&"1"==f[h+1]?f[h]="1":","!=n||d!=f[h+1]||"1"!=d&&"n"!=d||(f[h]=d),d=n}for(var h=0;c>h;++h){var n=f[h];if(","==n)f[h]="N";else if("%"==n){for(var g=h+1;c>g&&"%"==f[g];++g);for(var v=h&&"!"==f[h-1]||c>g&&"1"==f[g]?"1":"N",m=h;g>m;++m)f[m]=v;h=g-1}}for(var h=0,p=u;c>h;++h){var n=f[h];"L"==p&&"1"==n?f[h]="L":l.test(n)&&(p=n)}for(var h=0;c>h;++h)if(o.test(f[h])){for(var g=h+1;c>g&&o.test(f[g]);++g);for(var y="L"==(h?f[h-1]:u),b="L"==(c>g?f[g]:u),v=y||b?"L":"R",m=h;g>m;++m)f[m]=v;h=g-1}for(var w,x=[],h=0;c>h;)if(s.test(f[h])){var C=h;for(++h;c>h&&s.test(f[h]);++h);x.push(new t(0,C,h))}else{var S=h,L=x.length;for(++h;c>h&&"L"!=f[h];++h);for(var m=S;h>m;)if(a.test(f[m])){m>S&&x.splice(L,0,new t(1,S,m));var k=m;for(++m;h>m&&a.test(f[m]);++m);x.splice(L,0,new t(2,k,m)),S=m}else++m;h>S&&x.splice(L,0,new t(1,S,h))}return 1==x[0].level&&(w=r.match(/^\s+/))&&(x[0].from=w[0].length,x.unshift(new t(0,0,w[0].length))),1==ki(x).level&&(w=r.match(/\s+$/))&&(ki(x).to-=w[0].length,x.push(new t(0,c-w[0].length,c))),x[0].level!=ki(x).level&&x.push(new t(x[0].level,c,c)),x}}();return e.version="5.0.0",e});
admin/js/overall.js CHANGED
@@ -1,88 +1,88 @@
1
- jQuery(document).ready(function($) {
2
-
3
- function dismissRemoveMessage() {
4
- $.ajax({
5
- 'url': ajaxurl,
6
- 'method': 'POST',
7
- 'data': {
8
- 'action': 'cf7_style_remove_box'
9
- },
10
- 'success': function(data) {}
11
- });
12
- }
13
-
14
- if ($('.post-type-cf7_style.post-php').length > 0) {
15
- $('.meta-box-sortables').sortable({
16
- disabled: true
17
- });
18
- }
19
- $('.cf7_style_page_cf7style-settings .cf7style-tooltip').on('click', function(e) {
20
- e.preventDefault();
21
- e.stopPropagation();
22
- $('.cf7style-tooltip-content').removeClass('show');
23
- if ($(this).hasClass('on')) {
24
- $('.cf7style-tooltip-content').removeClass('show');
25
- $('.cf7_style_page_cf7style-settings .cf7style-tooltip').removeClass('on');
26
- } else {
27
- $(this).find('.cf7style-tooltip-content').addClass('show');
28
- $(this).addClass('on');
29
- }
30
- });
31
- $('.cf7_style_page_cf7style-settings').on('click', function(e) {
32
- $('.cf7style-tooltip-content').removeClass('show');
33
- $('.cf7_style_page_cf7style-settings .cf7style-tooltip').removeClass('on');
34
- });
35
- $('.cf7style-tooltip-content').on('click', function(e){
36
- e.stopPropagation();
37
- });
38
- $('.remove_template_notice').on('click', function(e) {
39
- e.preventDefault();
40
- $('.template-message-box').fadeOut('slow');
41
- dismissRemoveMessage();
42
- });
43
- $(document).on('click', '.cf7style-pointer a.close', function(e) {
44
- e.preventDefault();
45
- if ($('#cf7_style_allow_tracking').is(':checked')) {
46
- $.post(ajaxurl, "action=cf7_style_allow_tracking&cf7_style_allow_tracking=1", function(res) {});
47
- } else {
48
- $.post(ajaxurl, "action=cf7_style_show_tracking&cf7_style_allow_tracking=0", function(res) {});
49
- }
50
- });
51
- $('input[name="custom_template_check"]').on('change', function() {
52
- if ($(this).is(':checked')) {
53
- $('.double-check').show();
54
- } else {
55
- $('.double-check').hide();
56
- }
57
- });
58
- $('.confirm-remove-template').on('click', function(e) {
59
- e.preventDefault();
60
- var curParent = $(this).parent();
61
- if ($('input[name="double_check_template"]:checked').val() == "no") {
62
- curParent.hide();
63
- $('input[name="custom_template_check"]').attr('checked', 'checked');
64
- } else {
65
- dismissRemoveMessage();
66
- $.ajax({
67
- 'url': ajaxurl,
68
- 'method': 'POST',
69
- 'data': {
70
- 'action': 'cf7_style_remove_templates'
71
- },
72
- 'success': function(data) {
73
- if (data) {
74
- $('<p class="succeded">Predefined templates successfully removed.</p>').appendTo(curParent);
75
- setTimeout(function() {
76
- curParent.fadeOut('slow');
77
- curParent.parent().fadeOut('slow', function() {
78
- setTimeout(function() {
79
- window.location.reload(false);
80
- }, 300);
81
- });
82
- }, 2000);
83
- }
84
- }
85
- });
86
- }
87
- });
88
- });
1
+ jQuery(document).ready(function($) {
2
+
3
+ function dismissRemoveMessage() {
4
+ $.ajax({
5
+ 'url': ajaxurl,
6
+ 'method': 'POST',
7
+ 'data': {
8
+ 'action': 'cf7_style_remove_box'
9
+ },
10
+ 'success': function(data) {}
11
+ });
12
+ }
13
+
14
+ if ($('.post-type-cf7_style.post-php').length > 0) {
15
+ $('.meta-box-sortables').sortable({
16
+ disabled: true
17
+ });
18
+ }
19
+ $('.cf7_style_page_cf7style-settings .cf7style-tooltip').on('click', function(e) {
20
+ e.preventDefault();
21
+ e.stopPropagation();
22
+ $('.cf7style-tooltip-content').removeClass('show');
23
+ if ($(this).hasClass('on')) {
24
+ $('.cf7style-tooltip-content').removeClass('show');
25
+ $('.cf7_style_page_cf7style-settings .cf7style-tooltip').removeClass('on');
26
+ } else {
27
+ $(this).find('.cf7style-tooltip-content').addClass('show');
28
+ $(this).addClass('on');
29
+ }
30
+ });
31
+ $('.cf7_style_page_cf7style-settings').on('click', function(e) {
32
+ $('.cf7style-tooltip-content').removeClass('show');
33
+ $('.cf7_style_page_cf7style-settings .cf7style-tooltip').removeClass('on');
34
+ });
35
+ $('.cf7style-tooltip-content').on('click', function(e){
36
+ e.stopPropagation();
37
+ });
38
+ $('.remove_template_notice').on('click', function(e) {
39
+ e.preventDefault();
40
+ $('.template-message-box').fadeOut('slow');
41
+ dismissRemoveMessage();
42
+ });
43
+ $(document).on('click', '.cf7style-pointer a.close', function(e) {
44
+ e.preventDefault();
45
+ if ($('#cf7_style_allow_tracking').is(':checked')) {
46
+ $.post(ajaxurl, "action=cf7_style_allow_tracking&cf7_style_allow_tracking=1", function(res) {});
47
+ } else {
48
+ $.post(ajaxurl, "action=cf7_style_show_tracking&cf7_style_allow_tracking=0", function(res) {});
49
+ }
50
+ });
51
+ $('input[name="custom_template_check"]').on('change', function() {
52
+ if ($(this).is(':checked')) {
53
+ $('.double-check').show();
54
+ } else {
55
+ $('.double-check').hide();
56
+ }
57
+ });
58
+ $('.confirm-remove-template').on('click', function(e) {
59
+ e.preventDefault();
60
+ var curParent = $(this).parent();
61
+ if ($('input[name="double_check_template"]:checked').val() == "no") {
62
+ curParent.hide();
63
+ $('input[name="custom_template_check"]').attr('checked', 'checked');
64
+ } else {
65
+ dismissRemoveMessage();
66
+ $.ajax({
67
+ 'url': ajaxurl,
68
+ 'method': 'POST',
69
+ 'data': {
70
+ 'action': 'cf7_style_remove_templates'
71
+ },
72
+ 'success': function(data) {
73
+ if (data) {
74
+ $('<p class="succeded">Predefined templates successfully removed.</p>').appendTo(curParent);
75
+ setTimeout(function() {
76
+ curParent.fadeOut('slow');
77
+ curParent.parent().fadeOut('slow', function() {
78
+ setTimeout(function() {
79
+ window.location.reload(false);
80
+ }, 300);
81
+ });
82
+ }, 2000);
83
+ }
84
+ }
85
+ });
86
+ }
87
+ });
88
+ });
admin/predefined-templates.json ADDED
@@ -0,0 +1 @@
 
1
+ [{"title":"Monochrome Light","category":"simple pattern style","image":"/admin/images/monochrome-light.png"},{"title":"Transparent Two Columns","category":"simple pattern style","image":"/admin/images/transparent-two-columns.png"},{"title":"Minimal Brown","category":"simple pattern style","image":"/admin/images/minimal-brown.png"},{"title":"Monochrome","category":"simple pattern style","image":"/admin/images/monochrome.png"},{"title":"Twenty Fifteen Pattern","category":"simple pattern style","image":"/admin/images/cf7_simple_twentyfifteen_pattern.jpg"},{"title":"Christmas Classic","category":"christmas style","image":"/admin/images/cf7_xmas_classic.jpg"},{"title":"Christmas Red","category":"christmas style","image":"/admin/images/cf7_xmas_red.jpg"},{"title":"Christmas Simple","category":"christmas style","image":"/admin/images/cf7_xmas_simple.jpg"},{"title":"Valentine's Day Classic","category":"valentine's day style","image":"/admin/images/cf7_vday_classic.jpg"},{"title":"Valentine's Day Roses","category":"valentine's day style","image":"/admin/images/cf7_vday_roses.jpg"},{"title":"Valentine's Day Birds","category":"valentine's day style","image":"/admin/images/cf7_vday_birds.jpg"},{"title":"Valentine's Day Blue Birds","category":"valentine's day style","image":"/admin/images/cf7_vday_blue_birds.jpg"}]
admin/settings-setup.json ADDED
@@ -0,0 +1 @@
 
1
+ {"width":{"name":"Width","slug":"width","type":{"numeric":{"title":"Width","style":"width","property":"0","unit":["px","%","em"]}},"desc":"Change the default width of the current element."},"opacity":{"name":"Opacity","slug":"opacity","type":{"numeric":{"title":"Opacity","style":"opacity","property":"1"}},"desc":"Change the default width of the current element."},"height":{"name":"Height","slug":"height","type":{"numeric":{"title":"Height","style":"height","property":"0","unit":["px","%","em"]}},"desc":"Change the default height of the current element."},"background":{"name":"Background","slug":"background","type":{"color-picker":{"title":"Background Color","style":"background-color","property":"#fff"},"input":{"title":"Background Image","style":"background-image","property":"none"},"select1":{"title":"Background Position","style":"background-position","property":["left top","left center","left bottom","center top","center center","center bottom","right top","right center","right bottom"]},"select2":{"title":"Background Size","style":"background-size","property":["inherit","cover","contain"]},"select3":{"title":"Background Repeat","style":"background-repeat","property":["no-repeat","repeat-x","repeat-y","repeat","space","round"]},"select4":{"title":"Background Attachment","style":"background-attachment","property":["inherit","fixed","scroll","local"]}},"desc":"Change the default background properties of the current element."},"border":{"name":"Border","slug":"border","type":{"numeric1":{"title":"Border Width","style":"border-width","property":"0 0 0 0","unit":["px","%","em"]},"select":{"title":"Border Style","style":"border-style","property":["none","solid","dotted","double","groove","ridge","inset","outset"]},"color-picker":{"title":"Border color","style":"border-color","property":"#fff"},"numeric2":{"title":"Border radius","style":"border-radius","property":"0 0 0 0","unit":["px","%","em"]}},"desc":"Add custom border."},"font":{"name":"Font","slug":"font","type":{"numeric1":{"title":"Font size","style":"font-size","property":"0","unit":["px","%","em"]},"select2":{"title":"Font weight","style":"font-weight","property":["inherit","normal","bold","lighter","bolder","300","400","600","700"]},"select1":{"title":"Font style","style":"font-style","property":["normal","italic","oblique"]},"select4":{"title":"Text Align","style":"text-align","property":["left","right","center","justify","start","end"]},"select3":{"title":"Text transform","style":"text-transform","property":["inherit","capitalize","uppercase","lowercase","none"]},"select5":{"title":"Text decoration","style":"text-decoration","property":["none","underline","inherit","initial","unset"]},"numeric2":{"title":"Line Height","style":"line-height","property":"0","unit":["px","%","em"]},"numeric3":{"title":"Text indent","style":"text-indent","property":"0","unit":["px","%","em"]},"color-picker":{"title":"Color","style":"color","property":"#fff"}},"desc":"Add custom font."},"placefont":{"name":"Font","slug":"font","type":{"numeric1":{"title":"Font size","style":"font-size","property":"0","unit":["px","%","em"]},"select2":{"title":"Font weight","style":"font-weight","property":["inherit","normal","bold","lighter","bolder","300","400","600","700"]},"select1":{"title":"Font style","style":"font-style","property":["normal","italic","oblique"]},"numeric2":{"title":"Line Height","style":"line-height","property":"0","unit":["px","%","em"]},"numeric3":{"title":"Text indent","style":"text-indent","property":"0","unit":["px","%","em"]},"color-picker":{"title":"Color","style":"color","property":"#fff"}},"desc":"Add custom font."},"margin":{"name":"Margin","slug":"margin","type":{"numeric":{"title":"Margin","style":"margin","property":"0 0 0 0","unit":["px","%","em"]}},"desc":"Add custom margin."},"padding":{"name":"Padding","slug":"padding","type":{"numeric":{"title":"Padding","style":"padding","property":"0 0 0 0","unit":["px","%","em"]}},"desc":"Add custom padding."},"float":{"name":"Position","slug":"float","type":{"select":{"title":"Position","style":"float","property":["inherit","none","left","right"]}},"desc":"Add custom float."},"display":{"name":"Display","slug":"display","type":{"select":{"title":"Display","style":"display","property":["inherit","none","inline","inline-block","block"]}},"desc":"Add custom display."},"box-sizing":{"name":"Box sizing","slug":"box-sizing","type":{"select":{"title":"Box sizing","style":"box-sizing","property":["inherit","initial","unset","content-box","border-box"]}},"desc":"Add custom box sizing."},"comming-soon":{"name":"Comming Soon","slug":"box-sizing","type":{"comming-soon":{}}}}
cf7-style-match-old.php CHANGED
@@ -1,4 +1,9 @@
1
  <?php
 
 
 
 
 
2
  function get_new_styler_data($a){
3
  $t = array();
4
  $u = "px";
1
  <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
  function get_new_styler_data($a){
8
  $t = array();
9
  $u = "px";
cf7-style-meta-box.php CHANGED
@@ -1,4 +1,34 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /**
3
  * Calls the class the meta box. Used for selecting forms for each style.
4
  */
@@ -11,6 +41,10 @@ if ( is_admin() ) {
11
  add_action( 'load-post-new.php', 'cf7_style_meta_form_init' );
12
  }
13
 
 
 
 
 
14
  /**
15
  * The Class for creating all of the meta boxes
16
  */
@@ -104,12 +138,24 @@ class cf7_style_meta_boxes {
104
  $posted_data = $_POST['cf7styleallvalues'];
105
  $posted_data = str_replace("\'", '"', $posted_data);
106
  $posted_data = json_decode($posted_data, true);
 
 
 
 
 
 
 
 
 
 
 
 
107
  $active_pane = sanitize_text_field($_POST['cf7styleactivepane']);
108
  if( isset( $active_pane )){
109
  update_post_meta( $post_id, 'cf7_style_active_panel', $active_pane, "");
110
  }
111
  if ( is_array( $posted_data ) && isset( $posted_data ) ) {
112
- update_post_meta( $post_id, 'cf7_style_custom_styler', $posted_data , "");
113
  }
114
 
115
  }
@@ -190,12 +236,14 @@ class cf7_style_meta_boxes {
190
  echo '<th class="manage-column">' . __('Contact form 7 forms', 'contact-form-7-style' ) . '</th>';
191
  echo '<th class="manage-column different-style"><input type="checkbox" id="select_all"/><label for="select_all">' . __('Select all','contact-form-7-style' ) . '</label></th>';
192
  echo '<th class="generate-preview-option">' . __( "Generate preview", 'contact-form-7-style' ) . '</th>';
 
193
  echo '</tr>';
194
  echo '</thead>';
195
  echo '<tbody class="cf7style_body_select_all">';
196
  if ( $query->have_posts() ) {
197
  while ( $query->have_posts() ) : $query->the_post();
198
- $cf7stylehas = get_post_meta( get_the_ID(), 'cf7_style_id', true );
 
199
  ?>
200
  <tr>
201
  <td>
@@ -207,6 +255,9 @@ class cf7_style_meta_boxes {
207
  <td class="generate-preview-option">
208
  <button class="button-primary generate-preview-button" data-attr-title="<?php the_title(); ?>" data-attr-id="<?php the_ID(); ?>"><?php _e( "Generate preview", 'contact-form-7-style' ); ?></button>
209
  </td>
 
 
 
210
  </tr>
211
  <tr>
212
  <td colspan="2">
@@ -282,7 +333,7 @@ class cf7_style_meta_boxes {
282
  public function render_font_selector( $post ) {
283
  wp_nonce_field( 'cf_7_style_font_inner_custom_box', 'cf_7_style_font_custom_box_nonce' );
284
  //getting all google fonts
285
- $google_list = wp_remote_get( 'https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyBAympIKDNKmfxhI3udY-U_9vDWSdfHrEo' );
286
  $response = wp_remote_retrieve_body( $google_list );
287
 
288
  $font_obj = json_decode( $response );
1
  <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ function active_styles() {
8
+
9
+ $args = array(
10
+ 'post_type'=>'wpcf7_contact_form',
11
+ 'post_status'=>'publish',
12
+ 'posts_per_page'=> -1
13
+ );
14
+ $active_styles = array();
15
+ $forms = new WP_Query( $args );
16
+
17
+ if( $forms->have_posts() ) :
18
+ while( $forms->have_posts() ) : $forms->the_post();
19
+ $form_title = get_the_title();
20
+ $id = get_the_ID();
21
+ $style_id = get_post_meta( $id, 'cf7_style_id', true );
22
+ if ( ! empty( $style_id ) || $style_id != 0 ) {
23
+ $active_styles[] = $style_id;
24
+ }
25
+ endwhile;
26
+ wp_reset_postdata();
27
+ endif;
28
+ return $active_styles;
29
+ }
30
+
31
+
32
  /**
33
  * Calls the class the meta box. Used for selecting forms for each style.
34
  */
41
  add_action( 'load-post-new.php', 'cf7_style_meta_form_init' );
42
  }
43
 
44
+ function filter_w_zeros($var){
45
+ return ($var !== NULL && $var !== FALSE && $var !== '');
46
+ }
47
+
48
  /**
49
  * The Class for creating all of the meta boxes
50
  */
138
  $posted_data = $_POST['cf7styleallvalues'];
139
  $posted_data = str_replace("\'", '"', $posted_data);
140
  $posted_data = json_decode($posted_data, true);
141
+
142
+ foreach ( $posted_data as $p_key => $p_value) {
143
+ if( strpos($p_key, '_unit' ) !== false){
144
+ $no_unit = str_replace("_unit","", $p_key );
145
+ if( !array_key_exists($no_unit, $posted_data) || empty( $posted_data[$no_unit]) ){
146
+ unset($posted_data[$p_key]);
147
+ }
148
+ }
149
+ }
150
+
151
+ ksort($posted_data);
152
+
153
  $active_pane = sanitize_text_field($_POST['cf7styleactivepane']);
154
  if( isset( $active_pane )){
155
  update_post_meta( $post_id, 'cf7_style_active_panel', $active_pane, "");
156
  }
157
  if ( is_array( $posted_data ) && isset( $posted_data ) ) {
158
+ update_post_meta( $post_id, 'cf7_style_custom_styler', array_filter($posted_data,'filter_w_zeros') , "");
159
  }
160
 
161
  }
236
  echo '<th class="manage-column">' . __('Contact form 7 forms', 'contact-form-7-style' ) . '</th>';
237
  echo '<th class="manage-column different-style"><input type="checkbox" id="select_all"/><label for="select_all">' . __('Select all','contact-form-7-style' ) . '</label></th>';
238
  echo '<th class="generate-preview-option">' . __( "Generate preview", 'contact-form-7-style' ) . '</th>';
239
+ echo '<th class="gotoform-option">' . __( "Navigate to CF7 form", 'contact-form-7-style' ) . '</th>';
240
  echo '</tr>';
241
  echo '</thead>';
242
  echo '<tbody class="cf7style_body_select_all">';
243
  if ( $query->have_posts() ) {
244
  while ( $query->have_posts() ) : $query->the_post();
245
+ $cf7ID = get_the_ID();
246
+ $cf7stylehas = get_post_meta( $cf7ID, 'cf7_style_id', true );
247
  ?>
248
  <tr>
249
  <td>
255
  <td class="generate-preview-option">
256
  <button class="button-primary generate-preview-button" data-attr-title="<?php the_title(); ?>" data-attr-id="<?php the_ID(); ?>"><?php _e( "Generate preview", 'contact-form-7-style' ); ?></button>
257
  </td>
258
+ <td class="gotoform-option">
259
+ <a class="button-primary" href="<?php echo esc_url(admin_url('?page=wpcf7&post='.$cf7ID.'&action=edit' )) ?>" target="_blank" title="<?php the_title(); ?>"><?php _e( "Go To CF7", 'contact-form-7-style' ); ?></a>
260
+ </td>
261
  </tr>
262
  <tr>
263
  <td colspan="2">
333
  public function render_font_selector( $post ) {
334
  wp_nonce_field( 'cf_7_style_font_inner_custom_box', 'cf_7_style_font_custom_box_nonce' );
335
  //getting all google fonts
336
+ $google_list = wp_safe_remote_get( 'https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyBAympIKDNKmfxhI3udY-U_9vDWSdfHrEo' );
337
  $response = wp_remote_retrieve_body( $google_list );
338
 
339
  $font_obj = json_decode( $response );
cf7-style.php CHANGED
@@ -3,835 +3,149 @@
3
  Plugin Name: Contact Form 7 Style
4
  Plugin URI: http://wordpress.reea.net/contact-form-7-style/
5
  Description: Simple style customization and templating for Contact Form 7 forms. Requires Contact Form 7 plugin installed.
6
- Version: 3.1.2
7
  Author: Johnny, dorumarginean, mlehelsz, MirceaR
8
  Author URI: http://cf7style.com
9
  License: GPL2
10
  @Author: Johnny, dorumarginean, mlehelsz, MirceaR
11
  */
12
 
13
- /**
 
 
 
 
14
  * Include the plugin options
15
  */
16
  define( 'WPCF7S_PLUGIN', __FILE__ );
17
  define( 'WPCF7S_PLUGIN_DIR', untrailingslashit( dirname( WPCF7S_PLUGIN ) ) );
18
  define( 'WPCF7S_LOCATION',plugin_dir_url( WPCF7S_PLUGIN ) );
19
- define( 'WPCF7S_PLUGIN_VER', '3.1.2' );
20
-
21
-
22
- function get_predefined_cf7_style_template_data() {
23
- require 'predefined-templates.php';
24
- $templates = json_decode( $templates_string, true );
25
- return $templates;
26
- }// end of get_predefined_cf7_style_template_data
27
- /**
28
- * Get contact form 7 id
29
- *
30
- * Back compat for CF7 3.9
31
- * @see http://contactform7.com/2014/07/02/contact-form-7-39-beta/
32
- *
33
- * @param $cf7 Contact Form 7 object
34
- * @since 0.1.0
35
- */
36
- function get_form_id( $cf7 ) {
37
- if ( version_compare( WPCF7_VERSION, '3.9-alpha', '>' ) ) {
38
- if (!is_object($cf7)) {
39
- return false;
40
- }
41
- return $cf7->id();
42
- }
43
- }
44
-
45
- /**
46
- * Add cf7skins classes to the CF7 HTML form class
47
- *
48
- * Based on selected template & style
49
- * eg. class="wpcf7-form cf7t-fieldset cf7s-wild-west"
50
- *
51
- * @uses 'wpcf7_form_class_attr' filter in WPCF7_ContactForm->form_html()
52
- * @uses wpcf7_get_current_contact_form()
53
- * @file wp-content\plugins\contact-form-7\includes\contact-form.php
54
- *
55
- * @param $class is the CF7 HTML form class
56
- * @since 0.0.1
57
- */
58
- function form_class_attr( $class, $id ) {
59
-
60
- // Get the current CF7 form ID
61
- $cf7 = wpcf7_get_current_contact_form(); // Current contact form 7 object
62
- $form_id = get_form_id( $cf7 );
63
- $template_class ='';
64
- $cf7_style_id = get_post_meta( $form_id, 'cf7_style_id' );
65
- if ( isset( $cf7_style_id[0] ) ) {
66
- $cf7_style_data = get_post( $cf7_style_id[0], OBJECT );
67
- $template_class = ( has_term( 'custom-style', 'style_category', $cf7_style_data ) ) ?
68
- "cf7-style-" . $cf7_style_id[0] : $cf7_style_data->post_name;
69
- }
70
-
71
- // Return the modified class
72
- return $template_class;
73
- }
74
- function active_styles() {
75
-
76
- $args = array(
77
- 'post_type'=>'wpcf7_contact_form',
78
- 'post_status'=>'publish',
79
- 'posts_per_page'=> -1
80
- );
81
- $active_styles = array();
82
- $forms = new WP_Query( $args );
83
 
84
- if( $forms->have_posts() ) :
85
- while( $forms->have_posts() ) : $forms->the_post();
86
- $form_title = get_the_title();
87
- $id = get_the_ID();
88
- $style_id = get_post_meta( $id, 'cf7_style_id', true );
89
- if ( ! empty( $style_id ) || $style_id != 0 ) {
90
- $active_styles[] = $style_id;
91
- }
92
- endwhile;
93
- wp_reset_postdata();
94
- endif;
95
- return $active_styles;
96
- }
97
-
98
- function cf7_style_custom_css_generator(){
99
- global $post;
100
- if( empty( $post ) ) {
101
- return false;
102
- }
103
- $args = array(
104
- 'post_type' => 'wpcf7_contact_form',
105
- 'post_status' => 'publish',
106
- 'posts_per_page' => -1
107
- );
108
- $forms = new WP_Query( $args );
109
- $total_num_posts = $forms->found_posts;
110
- $style = "";
111
- $cf7s_manual_style = html_entity_decode( stripslashes(get_option( 'cf7_style_manual_style', true )),ENT_QUOTES );
112
- $cf7s_manual_style = ( $cf7s_manual_style == '1' ) ? "" : $cf7s_manual_style;
113
- $cf7s_force_css = get_option( 'cf7_style_forcecss', true );
114
- $cf7s_force_css = (1 == $cf7s_force_css ) ? " !important" : "";
115
- $active_styles = array();
116
- $style_number = 0;
117
- if( $forms->have_posts() ) :
118
- while( $forms->have_posts() ) : $forms->the_post();
119
- $id = get_the_ID();
120
- $cf7s_id = get_post_meta( $id, 'cf7_style_id', true );
121
- $form_title = get_the_title($cf7s_id);
122
- if ( ( ! empty( $cf7s_id ) || $cf7s_id !== 0 ) && ! in_array( $cf7s_id, $active_styles ) ) {
123
- array_push( $active_styles, $cf7s_id );
124
- $cf7_style_data = get_post( $cf7s_id, OBJECT );
125
- $check_custom_style = has_term( 'custom-style', 'style_category', $cf7_style_data );
126
- /*Check if custom style or template*/
127
- $cf7s_slug = ( $check_custom_style ) ? $cf7s_id : sanitize_title( $form_title);
128
- /*check if custom again*/
129
- if( $check_custom_style ){
130
- $cf7s_custom_settings = maybe_unserialize( get_post_meta( $cf7s_id, 'cf7_style_custom_styler', true ));
131
- $cf7s_custom_settings = ( empty($cf7s_custom_settings) ) ? array() : $cf7s_custom_settings;
132
- $groundzero = "";
133
- $groundzero_hover = "";
134
- $groundone = "";
135
- $groundone_hover = "";
136
- $tempSave = "";
137
- $bleah = array();
138
- $bleah_hover = array();
139
- $i = 0;
140
- $i_hover = 0;
141
- $curr_tag_gen = "";
142
- $cur_property_gen = "";
143
- $the_hover = "no";
144
- foreach( $cf7s_custom_settings as $setting_key => $setting ){
145
- $setting_key_part = explode( "_", $setting_key );
146
- $classelem = "body .cf7-style." . ( ( is_numeric( $cf7s_slug ) ) ? "cf7-style-".$cf7s_slug : $cf7s_slug );
147
- $html_element = ( $setting_key_part[0] == "submit" || $setting_key_part[0] == "radio" || $setting_key_part[0] == "checkbox" ) ?
148
- " input[type='". $setting_key_part[0]."']" : ( ( $setting_key_part[0] == "form" ) ? "" : (( $setting_key_part[0] == "wpcf7-not-valid-tip" || $setting_key_part[0] == "wpcf7-validation-errors" || $setting_key_part[0] == "wpcf7-mail-sent-ok" ) ?
149
- " .". $setting_key_part[0] : ' '.$setting_key_part[0]) );
150
- $endtag = ( $i == 0 ) ? "" : "}\n";
151
- $endtag_hover = ( $i_hover == 0 ) ? "" : "}\n";
152
- $curr_tag_gen = $classelem.$html_element;
153
- if( $setting != "" ){
154
- $setting = ($setting_key_part[1] == "background-image") ? 'url("'.$setting.'")' : $setting;
155
- $cur_property_gen = "\t\t".$setting_key_part[1].": ".$setting.$cf7s_force_css. ";\n";
156
- }
157
- $the_hover = ( array_key_exists (3,$setting_key_part) && $setting_key_part[3] == "hover" ) ? "yes" :
158
- ( array_key_exists (2,$setting_key_part) && $setting_key_part[2] == "hover" ) ? "yes" : "no";
159
- if($the_hover == "yes"){
160
- if( $groundzero_hover != $setting_key_part[0]){
161
- if(array_key_exists($i_hover,$bleah_hover)){
162
- $i_hover++;
163
- }
164
- $bleah_hover[$i_hover] = $endtag_hover.$curr_tag_gen.":hover {\n";
165
- $groundzero_hover = $setting_key_part[0];
166
- }
167
- $i_hover++;
168
- if( $setting != "" ){
169
- if ( $groundone_hover != $setting_key_part[1]) {
170
- $groundone_hover = $setting_key_part[1];
171
- $tempSave = $setting;
172
- if( $setting != "px" && $setting != "%" && $setting != "em" ){
173
- $bleah_hover[$i_hover] = $cur_property_gen;
174
- }
175
- } else {
176
- $bleah_hover[--$i_hover] = ( $tempSave != "done" ) ? ( "\t\t".$setting_key_part[1].": ".$tempSave.$setting.$cf7s_force_css. ";\n") : "";
177
- $tempSave = "done";
178
- }
179
- }
180
- } else {
181
-
182
- if( $groundzero != $setting_key_part[0]){
183
- if(array_key_exists($i,$bleah)){
184
- $i++;
185
- }
186
- $bleah[$i] = $endtag.$curr_tag_gen." {\n";
187
- $groundzero = $setting_key_part[0];
188
- }
189
- $i++;
190
- if( $setting != "" ){
191
- if ( $groundone != $setting_key_part[1]) {
192
- $groundone = $setting_key_part[1];
193
- $tempSave = $setting;
194
- if( $setting != "px" && $setting != "%" && $setting != "em" ){
195
- $bleah[$i] = $cur_property_gen;
196
- }
197
- } else {
198
- $bleah[--$i] = ( $tempSave != "done" ) ? ( "\t\t".$setting_key_part[1].": ".$tempSave.$setting.$cf7s_force_css. ";\n") : "";
199
- $tempSave = "done";
200
- }
201
- }
202
- }
203
- }
204
- foreach ($bleah as $style_line) {
205
- $style .= $style_line;
206
- }
207
- $style .= "}\n";
208
- foreach ($bleah_hover as $style_line) {
209
- $style .= $style_line;
210
- }
211
- $style .= "}";
212
- }/*custom end*/
213
- $font_family = return_font_name( $cf7s_id );
214
-
215
- if( ! empty( $font_family ) && "none" !== $font_family ) {
216
- if (is_numeric($cf7s_slug)) {
217
- $cf7s_slug = "cf7-style-".$cf7s_slug;
218
- }
219
- $style .= "\n".'body .cf7-style.' . $cf7s_slug . ",\nbody .cf7-style." . $cf7s_slug . " input[type='submit'] {\n\t font-family: '" . $font_family . "',sans-serif;\n} ";
220
- }
221
- $style_number++;
222
- }/*Main if ends here*/
223
- endwhile;
224
- $style_manual = "";
225
- $style_start = "\n<style class='cf7-style' media='screen' type='text/css'>\n";
226
- if( !empty( $cf7s_manual_style ) ){
227
- $style_manual = "\n".$cf7s_manual_style."\n";
228
- }
229
- $cur_css = $style_start;
230
- if ( version_compare( phpversion() , '5.3', '>' ) ) {
231
- require_once 'inc/cssparser.php';
232
- $css = new CSSParser();
233
- $cssIndex = $css->ParseCSS($style);
234
- $cur_css .= $css->GetCSS($cssIndex);
235
- } else {
236
- $cur_css .= $style;
237
- }
238
- $cur_css .= $style_manual;
239
- if( ( $style_number !== 0 ) && $style_number == count( $active_styles ) ) {
240
- $cur_css .= "\n</style>\n";
241
- }
242
- $cur_css = str_replace(' 0px;', ' 0;', $cur_css);
243
- echo $cur_css;
244
- wp_reset_postdata();
245
- endif;
246
- }// end of cf7_style_custom_css_generator
247
- function cf7_style_admin_scripts($hook){
248
- global $post_type;
249
- if (!wp_script_is( 'jquery', 'enqueued' )) {
250
- wp_enqueue_script('jquery');
251
- }
252
- wp_enqueue_style( "cf7-style-bar-style", WPCF7S_LOCATION . "css/admin-bar.css", array(), WPCF7S_PLUGIN_VER, "all");
253
- wp_enqueue_script( "cf7_style_overall", WPCF7S_LOCATION . "admin/js/overall-min.js", array('jquery'), WPCF7S_PLUGIN_VER, true );
254
- if( 'cf7_style_page_cf7style-css-editor' == $hook ){
255
- wp_enqueue_script( "cf7_style_codemirror_js", WPCF7S_LOCATION . "admin/js/codemirror.js", array( 'jquery' ), WPCF7S_PLUGIN_VER, true );
256
- wp_enqueue_style( "cf7-style-codemirror-style", WPCF7S_LOCATION . "admin/css/codemirror.css", array(), WPCF7S_PLUGIN_VER, "all" );
257
- wp_enqueue_script( "cf7-style-codemirror-mode", WPCF7S_LOCATION . "admin/js/mode/css/css.js", array( 'jquery' ), WPCF7S_PLUGIN_VER, true );
258
- }
259
- if( 'cf7_style' == $post_type){
260
- wp_enqueue_style( 'wp-color-picker' );
261
- wp_enqueue_script( 'thickbox' );
262
- wp_enqueue_style( 'thickbox' );
263
- wp_enqueue_script( 'media-upload' );
264
- }
265
- if( 'plugins.php'== $hook || 'cf7_style' == $post_type || 'toplevel_page_wpcf7' == $hook || 'cf7_style_page_cf7style-css-editor' == $hook || 'cf7_style_page_system-status' == $hook || 'cf7_style_page_cf7style-settings' == $hook ){
266
- wp_enqueue_style('cf7-style-font-awesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css');
267
- wp_enqueue_style( "cf7-style-admin-style", WPCF7S_LOCATION . "admin/css/admin.css", false, WPCF7S_PLUGIN_VER, "all");
268
- wp_enqueue_script( "cf7_style_admin_js", WPCF7S_LOCATION . "admin/js/admin-min.js", array( 'wp-color-picker', 'jquery' ), WPCF7S_PLUGIN_VER, true );
269
- }
270
- }
271
- function cf7_style_add_class( $class ){
272
- global $post;
273
- $class.= " cf7-style ".form_class_attr( $post, "no" );
274
- return $class;
275
- }// end of cf7_style_add_class
276
- /**
277
- * Check if Contact Form 7 is activated
278
  */
279
- function contact_form_7_check() {
280
-
281
- // WordPress active plugins
282
- $required_plugin = 'contact-form-7/wp-contact-form-7.php';
283
- $all_plugins = get_plugins();
284
- $active_plugins = get_option( 'active_plugins' );
285
 
286
- if(! array_key_exists( $required_plugin, $all_plugins)){
287
- $html = '<div class="error">';
288
- $html .= '<p>';
289
- $html .= __( "Contact form 7 - Style is an addon. Please install", "contact-form-7-style" ).' <a href="'.esc_url(admin_url('plugin-install.php?s=contact+form+7&tab=search&type=term' )).'">Contact form 7</a>.';
290
- $html .= '</p>';
291
- $html .= '</div><!-- /.updated -->';
292
- echo $html;
293
- } else if ( $active_plugins ) {
294
- if ( ! in_array( $required_plugin, $active_plugins ) ) {
295
- $html = '<div class="error">';
296
- $html .= '<p>';
297
- $html .= __( "Contact form 7 - Style is an addon. Please activate", "contact-form-7-style" ).' <a href="'.esc_url(wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $required_plugin ), 'activate-plugin_' . $required_plugin)).'">Contact form 7</a>.';
298
- $html .= '</p>';
299
- $html .= '</div><!-- /.updated -->';
300
- echo $html;
301
- } else {
302
- // Get the cf7_style_cookie
303
- $cf7_style_cookie = get_option( 'cf7_style_cookie' );
304
- if( $cf7_style_cookie != true ) {
305
-
306
- $html = '<div class="updated">';
307
- $html .= '<p>';
308
- $html .= __( "Contact Form 7 - Style addon is now activated. Navigate to", "contact-form-7-style" ).' <a href="' . get_bloginfo( "url" ) . '/wp-admin/edit.php?post_type=cf7_style">'.__( "Contact Style", "contact-form-7-style" ).'</a> '.__( "to get started.", "contact-form-7-style" );
309
- $html .= '</p>';
310
- $html .= '</div><!-- /.updated -->';
311
- echo $html;
312
- update_option( 'cf7_style_cookie', true );
313
- } // end if !$cf7_style_cookie
314
- $cf7_style_templates = get_option( 'cf7_style_no_temps' );
315
- if($cf7_style_templates != "hide_box"){
316
- $box = '<div class="updated template-message-box">';
317
- $box .= '<p><label><input type="checkbox" name="custom_template_check" />'.__( "Click here, if you want to delete ALL predefined Contact Form 7 Style templates.", "contact-form-7-style" ).'</label></p>';
318
- $box .= '<p><small>'.__( "This works only if the predefined templates are not in the", "contact-form-7-style" ).' <a href="'.admin_url('edit.php?post_status=trash&post_type=cf7_style').'">'.__( "Trash", "contact-form-7-style" ).'</a>.</small></p>';
319
- $box .= '<div class="double-check hidden">';
320
- $box .= '<label>'.__( "Are you sure you want to remove? ", "contact-form-7-style" );
321
- $box .= '<br/><span>( '.__( "All Contact Form 7 Style predefined templates attached to your Contact Form 7 form will be removed", "contact-form-7-style" ).' ) &nbsp;&nbsp;</span>';
322
- $box .= '<span> '.__( "Yes", "contact-form-7-style" ).'</span><input type="radio" name="double_check_template" value="yes" />';
323
- $box .= '</label><label>';
324
- $box .= '<span> '.__( "No", "contact-form-7-style" ).'</span><input type="radio" name="double_check_template" value="no" checked="checked" /></label>';
325
- $box .= '<a href="#" class="confirm-remove-template button"> '.__( "Confirm", "contact-form-7-style" ).'</a>';
326
- $box .= '</div><a href="#" class="remove_template_notice">'.__( "Dismiss", "contact-form-7-style" ).'</a>';
327
- $box .= '<div style="clear:both;"></div>';
328
- $box .= '</div>';
329
- $screen = get_current_screen();
330
- if( !empty($screen) && ($screen->id == 'edit-cf7_style' || $screen->id == 'cf7_style') ){
331
- echo $box;
332
- }
333
- }
334
- }
335
- } // end if $active_plugins
336
- }
337
- add_action( 'admin_notices', 'contact_form_7_check' );
338
-
339
- function cf7_style_create_post( $slug, $title, $image) {
340
- // Initialize the page ID to -1. This indicates no action has been taken.
341
- $post_id = -1;
342
- $was_deleted = get_option('cf7_style_deleted');
343
- if( null == get_page_by_title( $title, "OBJECT", "cf7_style" ) && $was_deleted != "yes" ) {
344
- // Set the post ID so that we know the post was created successfully
345
- $post_id = wp_insert_post(
346
- array(
347
- 'comment_status' => 'closed',
348
- 'ping_status' => 'closed',
349
- 'post_name' => $slug,
350
- 'post_title' => $title,
351
- 'post_status' => 'publish',
352
- 'post_type' => 'cf7_style'
353
- )
354
- );
355
- //if is_wp_error doesn't trigger, then we add the image
356
- if ( is_wp_error( $post_id ) ) {
357
- $errors = $post_id->get_error_messages();
358
- foreach ($errors as $error) {
359
- echo $error . '<br>';
360
- }
361
- } else {
362
- //wp_set_object_terms( $post_id, $category, 'style_category', false );
363
- update_post_meta( $post_id, 'cf7_style_image_preview', $image );
364
- }
365
- // Otherwise, we'll stop
366
- } else {
367
- // Arbitrarily use -2 to indicate that the page with the title already exists
368
- $post_id = -2;
369
- } // end if
370
- } // end cf7_style_create_post
371
- function cf7_style_add_taxonomy_filters() {
372
- global $typenow;
373
- // an array of all the taxonomyies you want to display. Use the taxonomy name or slug
374
- $taxonomies = array( 'style_category' );
375
- // must set this to the post type you want the filter(s) displayed on
376
- if( $typenow == 'cf7_style' ){
377
- foreach ( $taxonomies as $tax_slug ) {
378
- $tax_obj = get_taxonomy( $tax_slug );
379
-
380
- $tax_name = $tax_obj->labels->name;
381
- $terms = get_terms( $tax_slug );
382
- if( count( $terms ) > 0 ) {
383
- echo "<select name='$tax_slug' id='$tax_slug' class='postform'>";
384
- echo "<option value=''>Show All $tax_name</option>";
385
- foreach ( $terms as $term ) {
386
- $resultA = "<option value='".$term->slug."' selected='selected'>".$term->name .' (' . $term->count .')'."</option>";
387
- $resultB = "<option value='".$term->slug."'>".$term->name .' (' . $term->count .')'."</option>";
388
- echo ( isset( $_GET[$tax_slug] ) ) ? ( ( $_GET[$tax_slug] == $term->slug ) ? $resultA : $resultB ) : $resultB;
389
- }
390
- echo "</select>";
391
- }
392
- }
393
- }
394
- }// end cf7_style_add_taxonomy_filters
395
- function cf7_style_set_style_category_on_publish( $ID, $post ) {
396
- $temporizator = 0;
397
- foreach ( get_predefined_cf7_style_template_data() as $predefined_post_titles ) {
398
- if( $post->post_title == $predefined_post_titles[ "title" ] ){
399
- $temporizator++;
400
- }
401
- }
402
- if( 0 == $temporizator ) {
403
- wp_set_object_terms( $ID, 'custom style', 'style_category' );
404
- }
405
- } // end cf7_style_set_style_category_on_publish
406
- function cf7_style_create_posts(){
407
- update_option( 'cf7_style_no_temps', 'show_box' );
408
- update_option( 'cf7_style_welcome', 'show_box' );
409
- update_option( 'cf7_style_update_saved', 'yes' );
410
- update_option( 'cf7_style_allow_tracking', '5' );
411
- update_option( 'cf7_style_add_categories', '0' );
412
-
413
- }
414
- // Hook into the 'cf7_style_create_posts' action
415
- // register_activation_hook( __FILE__, 'cf7_style_create_posts' );
416
 
417
- function cf7style_load_elements(){
418
 
419
- $labels = array(
420
- 'name' => _x( 'Contact Styles', 'Post Type General Name', 'contact-form-7-style' ),
421
- 'singular_name' => _x( 'Contact Style', 'Post Type Singular Name', 'contact-form-7-style' ),
422
- 'menu_name' => __( 'Contact Style', 'contact-form-7-style' ),
423
- 'parent_item_colon' => __( 'Parent Style:', 'contact-form-7-style' ),
424
- 'all_items' => __( 'All Styles', 'contact-form-7-style' ),
425
- 'view_item' => __( 'View Style', 'contact-form-7-style' ),
426
- 'add_new_item' => __( 'Add New', 'contact-form-7-style' ),
427
- 'add_new' => __( 'Add New', 'contact-form-7-style' ),
428
- 'edit_item' => __( 'Edit Style', 'contact-form-7-style' ),
429
- 'update_item' => __( 'Update Style', 'contact-form-7-style' ),
430
- 'search_items' => __( 'Search Style', 'contact-form-7-style' ),
431
- 'not_found' => __( 'Not found', 'contact-form-7-style' ),
432
- 'not_found_in_trash' => __( 'Not found in Trash', 'contact-form-7-style' )
433
- );
434
- $args = array(
435
- 'label' => __( 'cf7_style', 'contact-form-7-style' ),
436
- 'description' => __( 'Add/remove contact style', 'contact-form-7-style' ),
437
- 'labels' => $labels,
438
- 'supports' => array( 'title' ),
439
- 'hierarchical' => false,
440
- 'taxonomies' => array('style_category'),
441
- 'public' => true,
442
- 'show_ui' => true,
443
- 'show_in_menu' => true,
444
- 'show_in_nav_menus' => false,
445
- 'show_in_admin_bar' => false,
446
- 'menu_icon' => "dashicons-twitter",
447
- 'menu_position' => 28.555555,
448
- 'can_export' => true,
449
- 'has_archive' => false,
450
- 'exclude_from_search' => true,
451
- 'publicly_queryable' => false,
452
- 'capability_type' => 'page'
453
- );
454
- /*register custom post type CF7_STYLE*/
455
- register_post_type( 'cf7_style', $args );
456
 
457
- $labels = array(
458
- 'name' => _x( 'Categories', 'Taxonomy General Name', 'contact-form-7-style' ),
459
- 'singular_name' => _x( 'Categories', 'Taxonomy Singular Name', 'contact-form-7-style' ),
460
- 'menu_name' => __( 'Categories', 'contact-form-7-style' ),
461
- 'all_items' => __( 'All Categories', 'contact-form-7-style' ),
462
- 'parent_item' => __( 'Parent Categories', 'contact-form-7-style' ),
463
- 'parent_item_colon' => __( 'Parent Categories:', 'contact-form-7-style' ),
464
- 'new_item_name' => __( 'New Categories Name', 'contact-form-7-style' ),
465
- 'add_new_item' => __( 'Add New Categories', 'contact-form-7-style' ),
466
- 'edit_item' => __( 'Edit Categories', 'contact-form-7-style' ),
467
- 'update_item' => __( 'Update Categories', 'contact-form-7-style' ),
468
- 'separate_items_with_commas' => __( 'Separate Categories with commas', 'contact-form-7-style' ),
469
- 'search_items' => __( 'Search Categories', 'contact-form-7-style' ),
470
- 'add_or_remove_items' => __( 'Add or remove Categories', 'contact-form-7-style' ),
471
- 'choose_from_most_used' => __( 'Choose from the most used Categories', 'contact-form-7-style' ),
472
- 'not_found' => __( 'Not Found', 'contact-form-7-style' ),
473
- );
474
- $args = array(
475
- 'labels' => $labels,
476
- 'hierarchical' => true,
477
- 'public' => true,
478
- 'show_ui' => false,
479
- 'show_admin_column' => true,
480
- 'show_in_nav_menus' => false,
481
- 'show_tagcloud' => true,
482
- );
483
- //register tax
484
- register_taxonomy( 'style_category', array( 'cf7_style' ), $args );
485
 
486
- foreach ( get_predefined_cf7_style_template_data() as $style ) {
487
- cf7_style_create_post( strtolower( str_replace( " ", "-", $style['title'] ) ), $style['title'], $style['image'] );
488
- }
489
- if( get_option( 'cf7_style_add_categories', 0 ) == 0 ){
490
- $cf7_style_args = array(
491
- 'post_type' => 'cf7_style',
492
- 'posts_per_page' => '-1'
493
- );
494
-
495
- $cf7_style_query = new WP_Query( $cf7_style_args );
496
- if ( $cf7_style_query->have_posts() ) {
497
- while ( $cf7_style_query->have_posts() ) {
498
- $cf7_style_query->the_post();
499
- $temp_title = get_the_title();
500
- $temp_ID = get_the_ID();
501
 
502
- foreach ( get_predefined_cf7_style_template_data() as $style ) {
503
- if( $temp_title == wptexturize( $style[ 'title' ] ) ) {
504
- wp_set_object_terms( $temp_ID, $style[ 'category' ], 'style_category' );
505
- }
506
- }
507
- }
508
- wp_reset_postdata();
509
- update_option( 'cf7_style_add_categories', 1 );
510
- }
511
- }
512
- $cf7_style_update_saved = get_option( 'cf7_style_update_saved' );
513
- if( $cf7_style_update_saved == "yes" ) {
514
- $cf7_style_args = array(
515
- 'post_type' => 'cf7_style',
516
- 'style_category' => 'custom-style',
517
- 'posts_per_page' => '-1'
518
- );
519
- $cf7s_manual_old_style = "";
520
- $new_settings = array();
521
- $cf7_style_query = new WP_Query( $cf7_style_args );
522
- if ( $cf7_style_query->have_posts() ) {
523
- while ( $cf7_style_query->have_posts() ) {
524
- $cf7_style_query->the_post();
525
- $cur_style_id = get_the_ID();
526
- $cur_manual_style = get_post_meta( $cur_style_id, 'cf7_style_manual_style', true );
527
- $cur_custom_styles = maybe_unserialize( get_post_meta( $cur_style_id, 'cf7_style_custom_styles', true ));
528
- if($cur_manual_style){
529
- $cf7s_manual_old_style .= $cur_manual_style;
530
- update_post_meta( $cur_style_id, 'cf7_style_manual_style', '' );
531
- }
532
- if($cur_custom_styles){
533
- $cf7s_custom_old_settings = $cur_custom_styles;
534
- require_once( 'cf7-style-match-old.php' );
535
- $new_settings = get_new_styler_data( $cf7s_custom_old_settings );
536
- update_post_meta( $cur_style_id, 'cf7_style_manual_styles', '');
537
- update_post_meta( $cur_style_id, 'cf7_style_custom_styles', '');
538
- update_post_meta( $cur_style_id, 'cf7_style_custom_styler', $new_settings, "");
539
- }
540
- }
541
- wp_reset_postdata();
542
- if($cf7s_manual_old_style){
543
- update_option( 'cf7_style_manual_style', $cf7s_manual_old_style );
544
- }
545
- }
546
- update_option( 'cf7_style_update_saved', 'no' );
547
- }
548
- require_once( 'cf7-style-meta-box.php' );
549
- if ( ! is_admin() ) {
550
- add_action('wp_head', 'cf7_style_custom_css_generator');
551
- }
552
- }
553
 
554
- function cf7_style_frontend_scripts(){
555
- if (!wp_script_is( 'jquery', 'enqueued' )) {
556
- wp_enqueue_script('jquery');
557
- }
558
- if(is_user_logged_in()){
559
- wp_enqueue_style( "cf7-style-bar-style", WPCF7S_LOCATION . "css/admin-bar.css", array(), WPCF7S_PLUGIN_VER, "all");
560
- }
561
- wp_enqueue_style( "cf7-style-frontend-style", WPCF7S_LOCATION . "css/frontend.css", array(), WPCF7S_PLUGIN_VER, "all");
562
- wp_enqueue_style( "cf7-style-responsive-style", WPCF7S_LOCATION . "css/responsive.css", array(), WPCF7S_PLUGIN_VER, "all");
563
- wp_enqueue_script( "cf7-style-frontend-script", WPCF7S_LOCATION . "js/frontend-min.js", array( 'jquery' ), WPCF7S_PLUGIN_VER, true);
564
- }
565
- function cf7style_toolbar_link($wp_admin_bar) {
566
- $args = array(
567
- 'id' => 'cf7-style',
568
- 'title' => 'Contact Form 7 Style',
569
- 'href' => admin_url("edit.php?post_type=cf7_style"),
570
- 'meta' => array(
571
- 'class' => 'contact-style',
572
- 'title' => 'Contact Form 7 Style',
573
- 'html' => '<span class="admin-style-icon"><i class="dashicons-before dashicons-twitter" aria-hidden="true"></i></span>'
574
- )
575
- );
576
- $wp_admin_bar->add_node($args);
577
- }
578
- function cf7style_update_db_check() {
579
- if (get_option( 'cf7_style_plugin_version' ) != WPCF7S_PLUGIN_VER) {
580
- cf7_style_create_posts();
581
- update_option( 'cf7_style_plugin_version', WPCF7S_PLUGIN_VER );
582
- }
583
- }
584
 
585
- function cf7style_check_deleted( $postid ){
586
- global $post_type;
587
- if ( $post_type != 'cf7_style' ) return;
588
- $check_deleted = get_option('cf7_style_deleted');
589
- $clr_form_args = array(
590
- 'post_type' => 'wpcf7_contact_form',
591
- 'posts_per_page' => -1,
592
- 'meta_key' => 'cf7_style_id',
593
- 'meta_value' => $postid
594
- );
595
- $form_query = new WP_Query( $clr_form_args );
596
- if ( $form_query->have_posts() ) {
597
- while ( $form_query->have_posts() ) {
598
- $form_query->the_post();
599
- /*form id*/
600
- update_post_meta( get_the_ID(), 'cf7_style_id', '');
601
- }
602
- wp_reset_postdata();
603
- }
604
- if("yes" != $check_deleted){
605
- update_option( 'cf7_style_no_temps', 'hide_box' );
606
- update_option('cf7_style_deleted','yes');
607
- }
608
- }
609
 
610
- add_action('admin_bar_menu', 'cf7style_toolbar_link', 999);
611
 
612
- add_action( 'admin_enqueue_scripts', 'cf7_style_admin_scripts' );
613
- add_action( 'wp_enqueue_scripts', 'cf7_style_frontend_scripts' );
614
- add_action( 'init', 'cf7style_load_elements' );
615
- add_action( 'restrict_manage_posts', 'cf7_style_add_taxonomy_filters' );
616
- add_action( 'publish_cf7_style', 'cf7_style_set_style_category_on_publish', 10, 2 );
617
- add_filter( 'wpcf7_form_class_attr', 'cf7_style_add_class' );
618
- add_filter( 'manage_cf7_style_posts_columns', 'cf7_style_event_table_head');
619
- add_action( 'manage_cf7_style_posts_custom_column', 'cf7_style_event_table_content', 10, 2 );
620
- add_action( 'plugins_loaded', 'cf7style_update_db_check' );
621
- add_action( 'before_delete_post', 'cf7style_check_deleted' );
622
 
623
- function cf7_style_event_table_head( $defaults ) {
624
- $new = array();
625
- foreach( $defaults as $key=>$value) {
626
- if( $key=='title') { // when we find the date column
627
- $new['preview-style'] = 'Preview Style';
628
- }
629
- $new[$key]=$value;
630
- }
631
- return $new;
632
- }
633
- function cf7_style_event_table_content( $column_name, $post_id ) {
634
- // cf7_style_image_preview
635
- if ( $column_name == 'preview-style' ) {
636
- $img_src = get_post_meta( $post_id, 'cf7_style_image_preview', true );
637
- echo "<a href='".admin_url() ."post.php?post=".$post_id."&action=edit"."'><span class='thumb-preview'><img src='" . plugins_url() ."/"."contact-form-7-style". ( empty( $img_src ) ? "/images/default_form.jpg" : $img_src ) . "' alt='".get_the_title( $post_id )."' title='".get_the_title( $post_id )."'/><div class='previewed-img'><img src='" . plugins_url() ."/"."contact-form-7-style". ( empty( $img_src ) ? "/images/default_form.jpg" : $img_src ) . "' alt='".get_the_title( $post_id )."' title='Edit ".get_the_title( $post_id )." Style'/></div></span></a>" ;
638
- }
639
- }
640
-
641
- /**
642
- * Reset the cf7_style_cookie option
643
  */
644
- function cf7_style_deactivate() {
645
- update_option( 'cf7_style_cookie', false );
646
- update_option( 'cf7_style_add_categories', 0 );
647
- }
648
- register_deactivation_hook( __FILE__, 'cf7_style_deactivate' );
649
 
650
  /*
651
- * Function created for deactivated Contact Form 7 Designer plugin.
652
- * This is because styles of that plugin is in conflict with ours.
653
- * No one should add an id in the html tag.
654
  */
655
- function deactivate_contact_form_7_designer_plugin() {
656
- if ( is_plugin_active('contact-form-7-designer/cf7-styles.php') ) {
657
- deactivate_plugins('contact-form-7-designer/cf7-styles.php');
658
- add_action( 'admin_notices', 'cf7_designer_deactivation_notice' );
659
- }
660
- }
661
- add_action('admin_init', 'deactivate_contact_form_7_designer_plugin');
662
 
663
  /*
664
- * notice for the user
665
  */
666
- function cf7_designer_deactivation_notice() { ?>
667
- <div class="error">
668
- <p><?php _e( "You cannot activate CF7 Designer while CF7 Style is activated!", "contact-form-7-style" ) ?></p>
669
- </div>
670
- <?php }
 
 
671
 
672
  /*
673
  * Tracking feature
674
  */
675
  require_once( 'misc/tracking.php' );
 
676
  /*
677
  * Welcome panel
678
  */
679
  require_once( 'misc/welcome.php' );
 
680
  /*
681
  * Slider meta box in CF7
682
  */
683
  require_once( 'inc/slider_meta_box.php' );
 
684
  /*
685
  * global css page
686
  */
687
  require_once( 'inc/editor_page.php' );
688
 
689
- /**
690
  * System status
691
  */
692
  require_once( 'inc/system_status.php' );
693
 
694
-
695
  /*
696
  * Remove Predefined templates
697
  */
698
- function cf7_style_remove_templates() {
699
- global $wpdb;
700
- update_option( 'cf7_style_deleted', 'yes' );
701
- update_option( 'cf7_style_add_categories', 0 );
702
- $del_args = array(
703
- 'posts_per_page' => -1,
704
- 'post_type' => 'cf7_style',
705
- 'tax_query' => array(
706
- array(
707
- 'taxonomy' => 'style_category',
708
- 'field' => 'slug',
709
- 'terms' => 'custom-style',
710
- 'operator' => 'NOT IN',
711
- ),
712
- ),
713
- );
714
- $del_query = new WP_Query( $del_args );
715
- if ( $del_query->have_posts() ) {
716
- while ( $del_query->have_posts() ) {
717
- $del_query->the_post();
718
- $style_id = get_the_ID();
719
- $clr_form_args = array(
720
- 'post_type' => 'wpcf7_contact_form',
721
- 'posts_per_page' => -1,
722
- 'meta_key' => 'cf7_style_id',
723
- 'meta_value' => $style_id
724
- );
725
- $form_query = new WP_Query( $clr_form_args );
726
- if ( $form_query->have_posts() ) {
727
- while ( $form_query->have_posts() ) {
728
- $form_query->the_post();
729
- /*form id*/
730
- update_post_meta( get_the_ID(), 'cf7_style_id', '');
731
- }
732
- wp_reset_postdata();
733
- }
734
- wp_delete_post( $style_id,false);
735
- }
736
- wp_reset_postdata();
737
- print_r('success');
738
- }
739
- wp_die();
740
- }
741
- add_action( 'wp_ajax_cf7_style_remove_templates', 'cf7_style_remove_templates' );
742
- function cf7_style_remove_box() {
743
- global $wpdb;
744
- update_option( 'cf7_style_no_temps', 'hide_box' );
745
- wp_die();
746
- }
747
- add_action( 'wp_ajax_cf7_style_remove_box', 'cf7_style_remove_box' );
748
- function cf7_style_remove_welcome_box() {
749
- global $wpdb;
750
- update_option( 'cf7_style_welcome', 'hide_box' );
751
- wp_die();
752
- }
753
- add_action( 'wp_ajax_cf7_style_remove_welcome_box', 'cf7_style_remove_welcome_box' );
754
 
755
- /**
756
- * Frontend edit link
757
  */
 
758
 
759
- function cf7_style_frontend_edit_link( $form ) {
760
-
761
- if( is_user_logged_in() && current_user_can( 'manage_options' ) && !is_admin() && get_option( 'cf7_style_form_tooltip' ) == 1 ) {
762
-
763
- $cf7 = wpcf7_get_current_contact_form(); // Current contact form 7 object
764
- $form_id = get_form_id( $cf7 );
765
- $cf7_style_id = get_post_meta( $form_id, 'cf7_style_id', true );
766
-
767
- if( empty( $cf7_style_id ) ) {
768
- $form .= "<a href='" . admin_url( 'edit.php?post_type=cf7_style' ) . "' class='frontend-edit-style-link'>" . __( 'Add Style', 'contact-form-7-style' ) . "</a>";
769
- } else {
770
- $cf7_style_data = get_post( $cf7_style_id, OBJECT );
771
- $template_type = ( has_term( 'custom-style', 'style_category', $cf7_style_data ) ) ? __( 'Edit custom style', 'contact-form-7-style' ) : __( 'Edit predifined template', 'contact-form-7-style' );
772
- $form .= "<a href='" . admin_url( 'post.php?post=' . $cf7_style_id . '&action=edit' ) . "' class='frontend-edit-style-link'>" . $template_type . "</a>";
773
- }
774
- }
775
-
776
- return $form;
777
- }
778
- add_filter( 'wpcf7_form_elements', 'cf7_style_frontend_edit_link' );
779
 
 
 
 
 
780
 
781
- /**
782
  * Dashboard generate preview on user interaction
783
  */
 
784
 
785
- function cf7_style_generate_preview_dashboard() {
786
-
787
- $form_id = sanitize_text_field( $_POST['form_id'] );
788
- $form_title = sanitize_text_field( $_POST['form_title'] );
789
- $form = "<div class='multiple-form-generated-preview preview-form-container'><h4>" . $form_title . "</h4>" . do_shortcode( '[contact-form-7 id="'. $form_id .'" title="'. $form_title .'"]' ) . "</div>";
790
- echo $form;
791
-
792
- wp_die();
793
- }
794
- add_action( 'wp_ajax_cf7_style_generate_preview_dashboard', 'cf7_style_generate_preview_dashboard' );
795
-
796
- /**
797
- * Dashboard generate custom style desired properties
798
- */
799
-
800
- function cf7_style_load_property() {
801
-
802
- $form_property = sanitize_text_field( $_POST['property'] );
803
- $form_panel = "";
804
- $saved_values = maybe_unserialize(get_post_meta( $post->ID, 'cf7_style_custom_styler', true ));
805
- $saved_values = (empty($saved_values)) ? array() : $saved_values;
806
- require 'plugin-options.php';
807
- foreach( $elements as $property => $property_value ) {
808
- if( $property == $form_property ) {
809
- if( $property_value['description'] != ""){
810
- $form_panel .= '<h4 class="description-title">'.$property_value['description'].'</h4>';
811
- }
812
- foreach( $property_value['settings'] as $sub_property_key => $sub_property_value ) {
813
- $property = strtolower( $property );
814
- $sub_property_slug = strtolower( $options[$sub_property_value]['slug'] );
815
- $style_element_name = strtolower($options[$sub_property_value]['name']);
816
- $half_width_class = ( $style_element_name == "box sizing" || $style_element_name == "display" || $style_element_name == "position" || $style_element_name == "width" || $style_element_name == "height") ? "half-size" : "";
817
- $form_panel .= '<div class="element-styling '.$half_width_class.' '.$style_element_name.'"><h3><span>&lt;'.$property.'&gt;</span> '.$style_element_name . '</h3>';
818
- if( $options[$sub_property_value]['type'] ) {
819
- $form_panel .= "<ul>";
820
- foreach( $options[$sub_property_value]['type'] as $key => $value ) {
821
- if( $key != "comming-soon" ){
822
- $form_panel .= generate_property_fields( $key, $value, $property, $sub_property_slug, $saved_values, '');
823
- $form_panel .= generate_property_fields( $key, $value, $property, $sub_property_slug, $saved_values, '_hover');
824
- } else {
825
- $form_panel .= "<li></li>";
826
- }
827
- }
828
- $form_panel .= "</ul>";
829
- $form_panel .= "</div>";
830
- }
831
- }
832
- }
833
- }
834
- print_r($form_panel);
835
- wp_die();
836
- }
837
- add_action( 'wp_ajax_cf7_style_load_property', 'cf7_style_load_property' );
3
  Plugin Name: Contact Form 7 Style
4
  Plugin URI: http://wordpress.reea.net/contact-form-7-style/
5
  Description: Simple style customization and templating for Contact Form 7 forms. Requires Contact Form 7 plugin installed.
6
+ Version: 3.1.3
7
  Author: Johnny, dorumarginean, mlehelsz, MirceaR
8
  Author URI: http://cf7style.com
9
  License: GPL2
10
  @Author: Johnny, dorumarginean, mlehelsz, MirceaR
11
  */
12
 
13
+ if ( !defined( 'ABSPATH' ) ) {
14
+ exit;
15
+ }
16
+
17
+ /*
18
  * Include the plugin options
19
  */
20
  define( 'WPCF7S_PLUGIN', __FILE__ );
21
  define( 'WPCF7S_PLUGIN_DIR', untrailingslashit( dirname( WPCF7S_PLUGIN ) ) );
22
  define( 'WPCF7S_LOCATION',plugin_dir_url( WPCF7S_PLUGIN ) );
23
+ define( 'WPCF7S_PLUGIN_VER', '3.1.3' );
24
+ define( 'WPCF7S_REQ_PLUGIN', 'contact-form-7/wp-contact-form-7.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
+ /*
27
+ * Get contact form 7 ID
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  */
29
+ require_once( 'inc/get_form_id.php' );
 
 
 
 
 
30
 
31
+ /*
32
+ * Load Custom CSS generator function here
33
+ */
34
+ require_once( 'inc/custom_css_generator.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
 
36
 
37
+ /*
38
+ * Check for Contact Form 7 plugin
39
+ * Add proper messages to admin pages : missing CF7, not active CF7, success CF7k, remove predefined templates
40
+ */
41
+ require_once( 'inc/admin_notices_activation.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
+ /*
44
+ * Check for current version
45
+ */
46
+ require_once( 'inc/check_cfstyle_version.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
+ /*
49
+ * Create custom post type and taxonomy and populate with predefined templates
50
+ * Create custom style layout with metaboxes
51
+ * Front-End part: run style generator
52
+ */
53
+ require_once( 'inc/init_style.php' );
 
 
 
 
 
 
 
 
 
54
 
55
+ /*
56
+ * Add CF7Style edit URL to wpadminbar with bird icon
57
+ * Last positioned element
58
+ */
59
+ require_once( 'inc/adminbar_add_link.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
+ /*
62
+ * Add required admin styles and scripts
63
+ */
64
+ require_once( 'inc/add_required_admin_scripts.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
+ /*
67
+ * Add required frontend styles and scripts
68
+ */
69
+ require_once( 'inc/add_required_frontend_scripts.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
 
71
 
72
+ /*
73
+ * Add filters to dashboard for CF7Style plugin
74
+ */
75
+ require_once( 'inc/taxonomy_filters_add.php' );
 
 
 
 
 
 
76
 
77
+ /*
78
+ * Add cf7style proper class to CF7 form where needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  */
80
+ require_once( 'inc/cf7_add_form_class.php' );
 
 
 
 
81
 
82
  /*
83
+ * Add Preview style column to the Contact Styles listing table
 
 
84
  */
85
+ require_once( 'inc/dashboard_table_add_preview.php' );
 
 
 
 
 
 
86
 
87
  /*
88
+ * Check for Predefined templates and update options : "cf7_style_no_temps" and "cf7_style_deleted"
89
  */
90
+ require_once( 'inc/check_deleted_templates.php' );
91
+
92
+ /*
93
+ * Deactivation hook
94
+ */
95
+ require_once( 'inc/deactivate_style.php' );
96
+
97
 
98
  /*
99
  * Tracking feature
100
  */
101
  require_once( 'misc/tracking.php' );
102
+
103
  /*
104
  * Welcome panel
105
  */
106
  require_once( 'misc/welcome.php' );
107
+
108
  /*
109
  * Slider meta box in CF7
110
  */
111
  require_once( 'inc/slider_meta_box.php' );
112
+
113
  /*
114
  * global css page
115
  */
116
  require_once( 'inc/editor_page.php' );
117
 
118
+ /*
119
  * System status
120
  */
121
  require_once( 'inc/system_status.php' );
122
 
 
123
  /*
124
  * Remove Predefined templates
125
  */
126
+ require_once( 'inc/remove_predefined_templates.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
 
128
+ /*
129
+ * CTA: Close delete predefined box will hide the notice for removing the predefined templates
130
  */
131
+ require_once( 'inc/dashboard_hide_delete_tpl_box.php' );
132
 
133
+ /*
134
+ * CTA: Close welcome box will hide the welcome elements
135
+ */
136
+ require_once( 'inc/dashboard_hide_welcome_box.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
 
138
+ /*
139
+ * Frontend edit link
140
+ */
141
+ require_once( 'inc/frontend_edit_style_link.php' );
142
 
143
+ /*
144
  * Dashboard generate preview on user interaction
145
  */
146
+ require_once( 'inc/dashboard_generate_preview.php' );
147
 
148
+ /*
149
+ * Dashboard generate custom style desired properties
150
+ */
151
+ require_once( 'inc/dashboard_load_custom_property.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/add_required_admin_scripts.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ function cf7_style_admin_scripts($hook){
8
+ global $post_type;
9
+ if (!wp_script_is( 'jquery', 'enqueued' )) {
10
+ wp_enqueue_script('jquery');
11
+ }
12
+ wp_enqueue_style( "cf7-style-bar-style", WPCF7S_LOCATION . "css/admin-bar.css", array(), WPCF7S_PLUGIN_VER, "all");
13
+ wp_enqueue_script( "cf7_style_overall", WPCF7S_LOCATION . "admin/js/overall-min.js", array('jquery'), WPCF7S_PLUGIN_VER, true );
14
+ if( 'cf7_style_page_cf7style-css-editor' == $hook ){
15
+ wp_enqueue_script( "cf7_style_codemirror_js", WPCF7S_LOCATION . "admin/js/codemirror.js", array( 'jquery' ), WPCF7S_PLUGIN_VER, true );
16
+ wp_enqueue_style( "cf7-style-codemirror-style", WPCF7S_LOCATION . "admin/css/codemirror.css", array(), WPCF7S_PLUGIN_VER, "all" );
17
+ wp_enqueue_script( "cf7-style-codemirror-mode", WPCF7S_LOCATION . "admin/js/mode/css/css.js", array( 'jquery' ), WPCF7S_PLUGIN_VER, true );
18
+ }
19
+ if( 'cf7_style' == $post_type){
20
+ wp_enqueue_style( 'wp-color-picker' );
21
+ wp_enqueue_script( 'thickbox' );
22
+ wp_enqueue_style( 'thickbox' );
23
+ wp_enqueue_script( 'media-upload' );
24
+ }
25
+ if( 'plugins.php'== $hook || 'cf7_style' == $post_type || 'toplevel_page_wpcf7' == $hook || 'cf7_style_page_cf7style-css-editor' == $hook || 'cf7_style_page_system-status' == $hook || 'cf7_style_page_cf7style-settings' == $hook ){
26
+ /*wp_enqueue_style('cf7-style-font-awesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');*/
27
+ wp_enqueue_style( "cf7-style-fontello-ie7", WPCF7S_LOCATION . "admin/css/fontello-ie7.css", false, WPCF7S_PLUGIN_VER, "all");
28
+ wp_enqueue_style( "cf7-style-fontello", WPCF7S_LOCATION . "admin/css/fontello.css", false, WPCF7S_PLUGIN_VER, "all");
29
+ wp_enqueue_style( "cf7-style-admin-style", WPCF7S_LOCATION . "admin/css/admin.css", false, WPCF7S_PLUGIN_VER, "all");
30
+ wp_enqueue_script( "cf7_style_admin_js", WPCF7S_LOCATION . "admin/js/admin-min.js", array( 'wp-color-picker', 'jquery' ), WPCF7S_PLUGIN_VER, true );
31
+ }
32
+ }
33
+
34
+ add_action( 'admin_enqueue_scripts', 'cf7_style_admin_scripts' );
inc/add_required_frontend_scripts.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ function cf7_style_frontend_scripts(){
8
+ if (!wp_script_is( 'jquery', 'enqueued' )) {
9
+ wp_enqueue_script('jquery');
10
+ }
11
+ if(is_user_logged_in()){
12
+ wp_enqueue_style( "cf7-style-bar-style", WPCF7S_LOCATION . "css/admin-bar.css", array(), WPCF7S_PLUGIN_VER, "all");
13
+ }
14
+ wp_enqueue_style( "cf7-style-frontend-style", WPCF7S_LOCATION . "css/frontend.css", array(), WPCF7S_PLUGIN_VER, "all");
15
+ wp_enqueue_style( "cf7-style-responsive-style", WPCF7S_LOCATION . "css/responsive.css", array(), WPCF7S_PLUGIN_VER, "all");
16
+ wp_enqueue_script( "cf7-style-frontend-script", WPCF7S_LOCATION . "js/frontend-min.js", array( 'jquery' ), WPCF7S_PLUGIN_VER, true);
17
+ }
18
+
19
+ add_action( 'wp_enqueue_scripts', 'cf7_style_frontend_scripts' );
inc/admin_notices_activation.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ /*
8
+ * notice for the user
9
+ */
10
+ function cf7_designer_deactivation_notice() { ?>
11
+ <div class="error">
12
+ <p><?php _e( "You cannot activate CF7 Designer while CF7 Style is activated!", "contact-form-7-style" ) ?></p>
13
+ </div>
14
+ <?php }
15
+
16
+ /*
17
+ * Function created for deactivated Contact Form 7 Designer plugin.
18
+ * This is because styles of that plugin is in conflict with ours.
19
+ * No one should add an id in the html tag.
20
+ */
21
+
22
+ function deactivate_contact_form_7_designer_plugin() {
23
+ if ( is_plugin_active('contact-form-7-designer/cf7-styles.php') ) {
24
+ deactivate_plugins('contact-form-7-designer/cf7-styles.php');
25
+ add_action( 'admin_notices', 'cf7_designer_deactivation_notice' );
26
+ }
27
+ }
28
+
29
+ function cf7_style_rq_plugin($req=false) {
30
+
31
+ $all_plugins = get_plugins();
32
+
33
+ if( $req == true && array_key_exists( WPCF7S_REQ_PLUGIN, $all_plugins)) return true;
34
+ if(!$req) {
35
+ $active_plugins = get_option( 'active_plugins' );
36
+ if( is_multisite() ) {
37
+ $active_plugins = array_merge($active_plugins, array_keys(get_site_option( 'active_sitewide_plugins')));
38
+ }
39
+ if(in_array( WPCF7S_REQ_PLUGIN, $active_plugins )) return true;
40
+ }
41
+ return false;
42
+ }
43
+
44
+ /**
45
+ * Check if Contact Form 7 is activated
46
+ */
47
+ function contact_form_7_check() {
48
+
49
+ if(!cf7_style_rq_plugin(true)){
50
+ $html = '<div class="error">';
51
+ $html .= '<p>';
52
+ $html .= __( "Contact form 7 - Style is an addon. Please install", "contact-form-7-style" ).' <a href="'.esc_url(admin_url('plugin-install.php?s=contact+form+7&tab=search&type=term' )).'">Contact form 7</a>.';
53
+ $html .= '</p>';
54
+ $html .= '</div><!-- /.updated -->';
55
+ echo $html;
56
+ } else {
57
+ if ( !cf7_style_rq_plugin()) {
58
+ $html = '<div class="error">';
59
+ $html .= '<p>';
60
+ $html .= __( "Contact form 7 - Style is an addon. Please activate", "contact-form-7-style" ).' <a href="'.esc_url(wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . WPCF7S_REQ_PLUGIN ), 'activate-plugin_' . WPCF7S_REQ_PLUGIN )).'">Contact form 7</a>.';
61
+ $html .= '</p>';
62
+ $html .= '</div><!-- /.updated -->';
63
+ echo $html;
64
+ } else {
65
+ // Get the cf7_style_cookie
66
+ $cf7_style_cookie = get_option( 'cf7_style_cookie' );
67
+ if( $cf7_style_cookie != true ) {
68
+
69
+ $html = '<div class="updated">';
70
+ $html .= '<p>';
71
+ $html .= __( "Contact Form 7 - Style addon is now activated. Navigate to", "contact-form-7-style" ).' <a href="' . get_bloginfo( "url" ) . '/wp-admin/edit.php?post_type=cf7_style">'.__( "Contact Style", "contact-form-7-style" ).'</a> '.__( "to get started.", "contact-form-7-style" );
72
+ $html .= '</p>';
73
+ $html .= '</div><!-- /.updated -->';
74
+ echo $html;
75
+ update_option( 'cf7_style_cookie', true );
76
+ } // end if !$cf7_style_cookie
77
+ $cf7_style_templates = get_option( 'cf7_style_no_temps' );
78
+ if($cf7_style_templates != "hide_box"){
79
+ $box = '<div class="updated template-message-box">';
80
+ $box .= '<p><label><input type="checkbox" name="custom_template_check" />'.__( "Click here, if you want to delete ALL predefined Contact Form 7 Style templates.", "contact-form-7-style" ).'</label></p>';
81
+ $box .= '<p><small>'.__( "This works only if the predefined templates are not in the", "contact-form-7-style" ).' <a href="'.admin_url('edit.php?post_status=trash&post_type=cf7_style').'">'.__( "Trash", "contact-form-7-style" ).'</a>.</small></p>';
82
+ $box .= '<div class="double-check hidden">';
83
+ $box .= '<label>'.__( "Are you sure you want to remove? ", "contact-form-7-style" );
84
+ $box .= '<br/><span>( '.__( "All Contact Form 7 Style predefined templates attached to your Contact Form 7 form will be removed", "contact-form-7-style" ).' ) &nbsp;&nbsp;</span>';
85
+ $box .= '<span> '.__( "Yes", "contact-form-7-style" ).'</span><input type="radio" name="double_check_template" value="yes" />';
86
+ $box .= '</label><label>';
87
+ $box .= '<span> '.__( "No", "contact-form-7-style" ).'</span><input type="radio" name="double_check_template" value="no" checked="checked" /></label>';
88
+ $box .= '<a href="#" class="confirm-remove-template button"> '.__( "Confirm", "contact-form-7-style" ).'</a>';
89
+ $box .= '</div><a href="#" class="remove_template_notice">'.__( "Dismiss", "contact-form-7-style" ).'</a>';
90
+ $box .= '<div style="clear:both;"></div>';
91
+ $box .= '</div>';
92
+ $screen = get_current_screen();
93
+ if( !empty($screen) && ($screen->id == 'edit-cf7_style' || $screen->id == 'cf7_style') ){
94
+ echo $box;
95
+ }
96
+ }
97
+ }
98
+ } // end if $active_plugins
99
+ }
100
+ function cf7_style_activator(){
101
+
102
+ deactivate_contact_form_7_designer_plugin();
103
+
104
+ add_action( 'admin_notices', 'contact_form_7_check' );
105
+
106
+ if(!cf7_style_rq_plugin()) {
107
+
108
+ deactivate_plugins( plugin_basename( WPCF7S_PLUGIN ) );
109
+
110
+ if ( isset( $_GET['activate'] ) ) {
111
+ unset( $_GET['activate'] );
112
+ }
113
+ }
114
+
115
+ }
116
+ add_action( 'admin_init', 'cf7_style_activator' );
inc/adminbar_add_link.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ function cf7style_toolbar_link($wp_admin_bar) {
8
+ $args = array(
9
+ 'id' => 'cf7-style',
10
+ 'title' => 'Contact Form 7 Style',
11
+ 'href' => admin_url("edit.php?post_type=cf7_style"),
12
+ 'meta' => array(
13
+ 'class' => 'contact-style',
14
+ 'title' => 'Contact Form 7 Style',
15
+ 'html' => '<span class="admin-style-icon"><i class="dashicons-before dashicons-twitter" aria-hidden="true"></i></span>'
16
+ )
17
+ );
18
+ $wp_admin_bar->add_node($args);
19
+ }
20
+
21
+ add_action('admin_bar_menu', 'cf7style_toolbar_link', 999);
inc/cf7_add_form_class.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Add cf7skins classes to the CF7 HTML form class
5
+ *
6
+ * Based on selected template & style
7
+ * eg. class="wpcf7-form cf7t-fieldset cf7s-wild-west"
8
+ *
9
+ * @uses 'wpcf7_form_class_attr' filter in WPCF7_ContactForm->form_html()
10
+ * @uses wpcf7_get_current_contact_form()
11
+ * @file wp-content\plugins\contact-form-7\includes\contact-form.php
12
+ *
13
+ * @param $class is the CF7 HTML form class
14
+ * @since 0.0.1
15
+ */
16
+
17
+ if ( !defined( 'ABSPATH' ) ) {
18
+ exit;
19
+ }
20
+
21
+ function form_class_attr( $class, $id ) {
22
+
23
+ // Get the current CF7 form ID
24
+ $cf7 = wpcf7_get_current_contact_form(); // Current contact form 7 object
25
+ $form_id = get_form_id( $cf7 );
26
+ $template_class ='';
27
+ $cf7_style_id = get_post_meta( $form_id, 'cf7_style_id' );
28
+ if ( isset( $cf7_style_id[0] ) ) {
29
+ $cf7_style_data = get_post( $cf7_style_id[0], OBJECT );
30
+ $template_class = ( has_term( 'custom-style', 'style_category', $cf7_style_data ) ) ?
31
+ "cf7-style-" . $cf7_style_id[0] : $cf7_style_data->post_name;
32
+ }
33
+
34
+ // Return the modified class
35
+ return $template_class;
36
+ }
37
+
38
+ function cf7_style_add_class( $class ){
39
+ global $post;
40
+ $class.= " cf7-style ".form_class_attr( $post, "no" );
41
+ return $class;
42
+ }// end of cf7_style_add_class
43
+
44
+ add_filter( 'wpcf7_form_class_attr', 'cf7_style_add_class' );
inc/check_cfstyle_version.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ function cf7_style_create_posts(){
8
+ update_option( 'cf7_style_no_temps', 'show_box' );
9
+ update_option( 'cf7_style_welcome', 'show_box' );
10
+ update_option( 'cf7_style_update_saved', 'yes' );
11
+ update_option( 'cf7_style_allow_tracking', '5' );
12
+ update_option( 'cf7_style_add_categories', '0' );
13
+ }
14
+
15
+ function cf7style_update_db_check() {
16
+ if (get_option( 'cf7_style_plugin_version' ) != WPCF7S_PLUGIN_VER) {
17
+ cf7_style_create_posts();
18
+ update_option( 'cf7_style_plugin_version', WPCF7S_PLUGIN_VER );
19
+ }
20
+ }
21
+
22
+ add_action( 'plugins_loaded', 'cf7style_update_db_check' );
inc/check_deleted_templates.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ function cf7style_check_deleted( $postid ){
8
+ global $post_type;
9
+ if ( $post_type != 'cf7_style' ) return;
10
+ $check_deleted = get_option('cf7_style_deleted');
11
+ $clr_form_args = array(
12
+ 'post_type' => 'wpcf7_contact_form',
13
+ 'posts_per_page' => -1,
14
+ 'meta_key' => 'cf7_style_id',
15
+ 'meta_value' => $postid
16
+ );
17
+ $form_query = new WP_Query( $clr_form_args );
18
+ if ( $form_query->have_posts() ) {
19
+ while ( $form_query->have_posts() ) {
20
+ $form_query->the_post();
21
+ /*form id*/
22
+ update_post_meta( get_the_ID(), 'cf7_style_id', '');
23
+ }
24
+ wp_reset_postdata();
25
+ }
26
+ if("yes" != $check_deleted){
27
+ update_option( 'cf7_style_no_temps', 'hide_box' );
28
+ update_option('cf7_style_deleted','yes');
29
+ }
30
+ }
31
+
32
+ add_action( 'before_delete_post', 'cf7style_check_deleted' );
inc/cssparser.php DELETED
@@ -1,373 +0,0 @@
1
- <?php
2
-
3
- class CSSParser {
4
- protected static $cssCounter = 0;
5
- protected static $propCounter = 0;
6
- protected $cssData;
7
-
8
- function __construct() {
9
- $this->cssData = array();
10
- }
11
-
12
- public function ParseCSS($css) {
13
- $index = ++self::$cssCounter;
14
- $this->cssData[$index] = array('all'=>array(),'screen'=>array(),'print'=>array());
15
- return $this->ParseCode($index, $css);
16
- }
17
-
18
- public function ParseCSSAppend($index, $css) {
19
- if(isset($this->cssData[$index])) {
20
- return $this->ParseCode($index, $css);
21
- } else {
22
- return $this->ParseCSS($css);
23
- }
24
- }
25
-
26
- public function ParseCSSMediaAppend($index, $css, $media) {
27
- $css = '@'.$media.' {'.PHP_EOL.$css.PHP_EOL.'}'.PHP_EOL;
28
- if(isset($this->cssData[$index])) {
29
- return $this->ParseCode($index, $css);
30
- }
31
- $index = ++self::$cssCounter;
32
- $this->cssData[$index] = array('all'=>array(),'screen'=>array(),'print'=>array());
33
- return $this->ParseCode($index, $css);
34
- }
35
-
36
- protected function ParseCode($index, $css) {
37
- $currentMedia = 'all';
38
- $mediaList = array();
39
- $section = false;
40
- $css = trim($css);
41
- if(strlen($css) == 0) {
42
- return $index;
43
- }
44
- $css = preg_replace('/\/\*.*\*\//Us', '', $css);
45
- while(preg_match('/^\s*(\@(media|import|local)([^\{\}]+)(\{)|([^\{\}]+)(\{)|([^\{\}]*)(\}))/Usi', $css, $match)) {
46
- if(isset($match[8]) && ($match[8] == '}')) {
47
- if($section !== false) {
48
- $code = trim($match[7]);
49
- $idx = 0;
50
- $inQuote = false;
51
- $property = false;
52
- $codeLen = strlen($code);
53
- $parenthesis = array();
54
- while($idx < $codeLen) {
55
- $c = $code{$idx};
56
- $idx++;
57
- if($inQuote !== false) {
58
- if($inQuote === $c) {
59
- $inQuote = false;
60
- }
61
- } elseif(($inQuote === false) && ($c == '(')) {
62
- array_push($parenthesis, '(');
63
- } elseif(($inQuote === false) && ($c == ')')) {
64
- array_pop($parenthesis);
65
- } elseif(($c == '\'') || ($c == '"')) {
66
- $inQuote = $c;
67
- } elseif(($property === false) && ($c == ':')) {
68
- $property = trim(substr($code, 0, $idx - 1));
69
- if(preg_match('/^(.*)\[([0-9]*)\]$/Us', $property, $propMatch)) {
70
- $property = $propMatch[1].'['.static::$propCounter.']';
71
- static::$propCounter += 1;
72
- }
73
- $code = substr($code, $idx);
74
- $idx = 0;
75
- } elseif((count($parenthesis) == 0) && ($c == ';')) {
76
- $value = trim(substr($code, 0, $idx - 1));
77
- $code = substr($code, $idx);
78
- $idx = 0;
79
- $this->AddProperty($index, $currentMedia, $section, $property, $value);
80
- $property = false;
81
- }
82
- }
83
- if(($idx > 0) && ($property !== false)) {
84
- $value = trim($code);
85
- $this->AddProperty($index, $currentMedia, $section, $property, $value);
86
- }
87
- $section = false;
88
- } elseif(count($mediaList) > 0) {
89
- array_pop($mediaList);
90
- if(count($mediaList) > 0) {
91
- $currentMedia = end($mediaList);
92
- } else {
93
- $currentMedia = 'all';
94
- }
95
- } else {
96
- // Superfluous }
97
- }
98
- } elseif(isset($match[6]) && ($match[6] == '{')) {
99
- // Section
100
- $section = trim($match[5]);
101
- if(!isset($this->cssData[$index][$currentMedia][$section])) {
102
- $this->cssData[$index][$currentMedia][$section] = array();
103
- }
104
- } elseif(isset($match[4]) && ($match[4] == '{')) {
105
- if($match[2] == 'media') {
106
- // New media
107
- $media = trim($match[3]);
108
- $mediaList[] = $media;
109
- $currentMedia = $media;
110
- if(!isset($this->cssData[$index][$currentMedia])) {
111
- $this->cssData[$index][$currentMedia] = array();
112
- }
113
- } elseif($match[2] == 'import') {
114
- // Can't support import (yet!)
115
- } elseif($match[2] == 'local') {
116
- // Can't support local import (yet!)
117
- }
118
- } else {
119
- // Shouldn't get here
120
- }
121
- $stripCount = strlen($match[0]);
122
- $css = trim(substr($css, $stripCount));
123
- }
124
- $css = trim($css);
125
- if(strlen($css) > 0) {
126
- echo "Potential error in stylesheet: &nbsp;&nbsp;&nbsp;&nbsp;".$css;
127
- }
128
- return $index;
129
- }
130
-
131
- public function AddProperty($index, $media, $section, $property, $value) {
132
- if(!isset($this->cssData[$index])) {
133
- $this->cssData[$index] = array('all'=>array(),'screen'=>array(),'print'=>array());
134
- }
135
- $media = trim($media);
136
- if($media == '') {
137
- $media = 'all';
138
- }
139
- $section = trim($section);
140
- $property = trim($property);
141
- if(strlen($property) > 0) {
142
- $value = trim($value);
143
- if($media == 'all') {
144
- $this->cssData[$index][$media][$section][$property] = $value;
145
- $keys = array_keys($this->cssData[$index]);
146
- foreach($keys as $key) {
147
- if(!isset($this->cssData[$index][$key][$section])) {
148
- $this->cssData[$index][$key][$section] = array();
149
- }
150
- $this->cssData[$index][$key][$section][$property] = $value;
151
- }
152
- } else {
153
- if(!isset($this->cssData[$index][$media])) {
154
- $this->cssData[$index][$media] = $this->cssData[$index]['all'];
155
- }
156
- if(!isset($this->cssData[$index][$media][$section])) {
157
- $this->cssData[$index][$media][$section] = array();
158
- }
159
- $this->cssData[$index][$media][$section][$property] = $value;
160
- }
161
- }
162
- }
163
-
164
- public function GetMediaList($index) {
165
- if(isset($this->cssData[$index])) {
166
- return array_keys($this->cssData[$index]);
167
- }
168
- return array();
169
- }
170
-
171
- public function ExportKeyValues($index, $media, $keys) {
172
- $result = array();
173
- if(is_string($keys)) {
174
- $keys = array($keys);
175
- }
176
- if(!is_array($keys)) {
177
- return $result;
178
- }
179
- if(isset($this->cssData[$index]) && isset($this->cssData[$index][$media])) {
180
- foreach($this->cssData[$index][$media] as $section => $sectionValues) {
181
- foreach($sectionValues as $property => $value) {
182
- if(in_array($property, $keys)) {
183
- $result[] = $value;
184
- }
185
- }
186
- }
187
- }
188
- return $result;
189
- }
190
-
191
- public function ExportMedia($index, $media, $block = false) {
192
- $result = '';
193
- if(isset($this->cssData[$index]) && isset($this->cssData[$index][$media])) {
194
- foreach($this->cssData[$index][$media] as $section => $sectionValues) {
195
- $result .= "$section {\n";
196
- foreach($sectionValues as $property => $value) {
197
- $property = preg_replace('/(\[[0-9]*\])$/Usi', '', $property);
198
- if(is_array($block) && isset($block[$property])) {
199
- if(preg_match('/^'.static::ConvertWildcards($block[$property]).'$/Usi', $value) == 0) {
200
- $result .= $indent." $property: $value;\n";
201
- }
202
- } else {
203
- $result .= " $property: $value;\n";
204
- }
205
- }
206
- $result .= "}\n\n";
207
- }
208
- }
209
- return $result;
210
- }
211
-
212
- public function ExportStyle($index, $block = false) {
213
- $result = '';
214
- if(isset($this->cssData[$index])) {
215
- foreach($this->cssData[$index] as $media => $mediaValues) {
216
- if($media != 'all') {
217
- $result .= "@media $media {\n";
218
- $indent = ' ';
219
- } else {
220
- $indent = '';
221
- }
222
- foreach($mediaValues as $section => $sectionValues) {
223
- $result .= $indent."$section {\n";
224
- foreach($sectionValues as $property => $value) {
225
- $property = preg_replace('/(\[[0-9]*\])$/Usi', '', $property);
226
- if(is_array($block) && isset($block[$property])) {
227
- if(preg_match('/^'.static::ConvertWildcards($block[$property]).'$/Usi', $value) == 0) {
228
- $result .= $indent." $property: $value;\n";
229
- }
230
- } else {
231
- $result .= $indent." $property: $value;\n";
232
- }
233
- }
234
- $result .= $indent."}\n\n";
235
- }
236
- if($media != 'all') {
237
- $result .= "}\n\n";
238
- }
239
- }
240
- }
241
- return $result;
242
- }
243
-
244
-
245
- public function GetSections($index, $media = 'screen') {
246
- if(isset($this->cssData[$index])) {
247
- if(isset($this->cssData[$index][$media])) {
248
- return array_keys($this->cssData[$index][$media]);
249
- }
250
- if(isset($this->cssData[$index]['all'])) {
251
- return array_keys($this->cssData[$index]['all']);
252
- }
253
- }
254
- return false;
255
- }
256
-
257
- public function GetSectionsFiltered($index, $matchKey, $matchValue, $media = 'screen') {
258
- if(isset($this->cssData[$index])) {
259
- if(!isset($this->cssData[$index][$media])) {
260
- $media = 'all';
261
- if(!isset($this->cssData[$index][$media])) {
262
- return false;
263
- }
264
- }
265
- if(is_array($this->cssData[$index][$media])) {
266
- $result = array();
267
- foreach($this->cssData[$index][$media] as $section => $values) {
268
- if(isset($values[$matchKey])) {
269
- if($values[$matchKey] == $matchValue) {
270
- $result[] = $section;
271
- }
272
- }
273
- }
274
- return $result;
275
- }
276
- }
277
- return false;
278
- }
279
-
280
- public function GetEditorCSS($index) {
281
- $forbiddenKeys = array();
282
- $forbiddenKeys[] = '^filter$';
283
- return $this->GetCSS($index, 'screen', $forbiddenKeys);
284
- }
285
-
286
- public function GetCSS($index, $media = 'screen', $forbiddenKeys = array()) {
287
- if(isset($this->cssData[$index])) {
288
- if(!isset($this->cssData[$index][$media])) {
289
- $media = 'all';
290
- if(!isset($this->cssData[$index][$media])) {
291
- return false;
292
- }
293
- }
294
- if(is_array($this->cssData[$index][$media])) {
295
- $result = '';
296
- foreach($this->cssData[$index][$media] as $section => $values) {
297
- $result .= $section.' {';
298
- $result .= "\n";
299
- if(is_array($values)) {
300
- foreach($values as $key => $value) {
301
- $skipThis = false;
302
- foreach($forbiddenKeys as $fKey) {
303
- if(preg_match('/'.$fKey.'/Usi', $key)) {
304
- $skipThis = true;
305
- break;
306
- }
307
- }
308
- if($skipThis) {
309
- continue;
310
- }
311
- $result .= ' ';
312
- $key = preg_replace('/(\[[0-9]*\])$/Usi', '', $key);
313
- $result .= $key.': '.$value.';';
314
- $result .= "\n";
315
- }
316
- }
317
- $result .= '}';
318
- $result .= "\n";
319
- }
320
- return $result;
321
- }
322
- }
323
- return false;
324
- }
325
-
326
- public function GetCSSFiltered($index, $matchKey, $matchValue, $media = 'screen') {
327
- if(!isset($this->cssData[$index])) {
328
- if(!isset($this->cssData[$index][$media])) {
329
- $media = 'all';
330
- if(!isset($this->cssData[$index][$media])) {
331
- return false;
332
- }
333
- }
334
- }
335
- $sections = $this->GetSectionsFiltered($index, $matchKey, $matchValue, $media);
336
- if($sections !== false) {
337
- if(is_array($sections)) {
338
- $result = '';
339
- foreach($sections as $section) {
340
- $result .= $section.' {';
341
- $temp = $this->cssData[$index][$media];
342
- if(is_array($temp)) {
343
- foreach($temp as $key => $value) {
344
- $key = preg_replace('/(\[[0-9]*\])$/Usi', '', $key);
345
- $result .= $key.': '.$value.';';
346
- }
347
- }
348
- $result .= $section.' }';
349
- }
350
- return $result;
351
- }
352
- }
353
- return false;
354
- }
355
-
356
- public function GetCSSArray($index, $media = 'screen') {
357
- if(isset($this->cssData[$index])) {
358
- if(isset($this->cssData[$index][$media])) {
359
- return $this->cssData[$index][$media];
360
- } elseif(isset($this->cssData[$index]['all'])) {
361
- return $this->cssData[$index][$media];
362
- }
363
- }
364
- return false;
365
- }
366
-
367
- public static function ConvertWildcards($text) {
368
- $text = str_replace('.', '\.', $text);
369
- $text = str_replace('*', '.*', $text);
370
- $text = str_replace('?', '.', $text);
371
- return $text;
372
- }
373
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/custom_css_generator.php ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ function generate_row($f_keypart, $s_keypart, $temp_element, $setting_key, $setting, $cf7s_custom_settings, $css_base, $type, $cf7s_force_css){
8
+ $unit = '';
9
+ $innerstyle = '';
10
+ $kkey = ( $type == ":hover") ? '_hover' : '';
11
+ if( $temp_element != $f_keypart ){
12
+ $temp_element = $f_keypart;
13
+ $type_s = ( strpos($setting_key,'placeholder') === false ) ? $type : '';
14
+ $innerstyle .= $css_base.$type_s.' {';
15
+ }
16
+ if( strpos($setting_key,'_unit') === false){
17
+ $unitkey = ( $type == ":hover") ? $f_keypart.'_'.$s_keypart.'_unit'.$kkey : $setting_key.'_unit';
18
+
19
+ $unit = ( array_key_exists( $unitkey ,$cf7s_custom_settings)) ? $cf7s_custom_settings[$unitkey] : '';
20
+
21
+ $innerstyle .= $s_keypart.": ".$setting.$unit.$cf7s_force_css. ";";
22
+ }
23
+
24
+ return array(
25
+ 'temp' => $temp_element,
26
+ 'style' => $innerstyle);
27
+ }
28
+
29
+ function generate_css_code($style, $cf7s_custom_settings, $classelem, $cf7s_force_css, $type, $placenot ) {
30
+
31
+ $result = array();
32
+ $temp_element = '';
33
+
34
+ reset($cf7s_custom_settings);
35
+ $first_setting_key = key($cf7s_custom_settings);
36
+
37
+ /* get last key of custom style settings array */
38
+ end($cf7s_custom_settings);
39
+ $last_setting_key = key($cf7s_custom_settings);
40
+
41
+ foreach( $cf7s_custom_settings as $setting_key => $setting ){
42
+
43
+ $endtag = ( $first_setting_key == $setting_key ) ? "" : "}";
44
+
45
+ $setting_key_part = explode( "_", $setting_key );
46
+
47
+ $html_element = ( $setting_key_part[0] == "submit" || $setting_key_part[0] == "radio" || $setting_key_part[0] == "checkbox" ) ?
48
+ " input[type='". $setting_key_part[0]."']" : ( ( $setting_key_part[0] == "form" ) ? "" : (( $setting_key_part[0] == "wpcf7-not-valid-tip" || $setting_key_part[0] == "wpcf7-validation-errors" || $setting_key_part[0] == "wpcf7-mail-sent-ok" ) ?
49
+ " .". $setting_key_part[0] : ' '.$setting_key_part[0]) );
50
+
51
+ $html_element = ( $placenot == '' ) ? $html_element : ' '.$placenot;
52
+
53
+ $css_base = $endtag.$classelem.$html_element;
54
+
55
+ $result = generate_row($setting_key_part[0], $setting_key_part[1], $temp_element, $setting_key, $setting, $cf7s_custom_settings, $css_base, $type, $cf7s_force_css);
56
+ $temp_element = $result['temp'];
57
+ $style .= $result['style'];
58
+
59
+ if( $last_setting_key == $setting_key ){
60
+ $style .= '}';
61
+ }
62
+ }/*foreach end*/
63
+ return $style;
64
+ }
65
+
66
+ function cf7_style_custom_css_generator(){
67
+ global $post;
68
+ if( empty( $post ) ) {
69
+ return false;
70
+ }
71
+ $args = array(
72
+ 'post_type' => 'wpcf7_contact_form',
73
+ 'post_status' => 'publish',
74
+ 'posts_per_page' => -1
75
+ );
76
+
77
+ $placeholder_fallback = array('::-webkit-input-placeholder','::-moz-placeholder',':-ms-input-placeholder',':-moz-placeholder');
78
+ $placeholder_hover_fallback = array('[placeholder]:hover::-webkit-input-placeholder','[placeholder]:hover::-moz-placeholder','[placeholder]:hover:-ms-input-placeholder','[placeholder]:hover:-moz-placeholder');
79
+
80
+ $forms = new WP_Query( $args );
81
+ //$total_num_posts = $forms->found_posts;
82
+ $style = "";
83
+ $cf7s_manual_style = html_entity_decode( stripslashes(get_option( 'cf7_style_manual_style', true )),ENT_QUOTES );
84
+ $cf7s_manual_style = ( $cf7s_manual_style == '1' ) ? "" : $cf7s_manual_style;
85
+ $cf7s_force_css = get_option( 'cf7_style_forcecss', true );
86
+
87
+ $cf7s_force_css = ('1' === $cf7s_force_css ) ? " !important" : "";
88
+ $active_styles = array();
89
+ $style_number = 0;
90
+ if( $forms->have_posts() ) :
91
+ while( $forms->have_posts() ) : $forms->the_post();
92
+ $id = get_the_ID();
93
+ $cf7s_id = get_post_meta( $id, 'cf7_style_id', true );
94
+ $form_title = get_the_title($cf7s_id);
95
+ if ( ( ! empty( $cf7s_id ) || $cf7s_id !== 0 ) && ! in_array( $cf7s_id, $active_styles ) ) {
96
+ array_push( $active_styles, $cf7s_id );
97
+ $cf7_style_data = get_post( $cf7s_id, OBJECT );
98
+ $check_custom_style = has_term( 'custom-style', 'style_category', $cf7_style_data );
99
+ /*Check if custom style or template*/
100
+ $cf7s_slug = ( $check_custom_style ) ? $cf7s_id : sanitize_title( $form_title);
101
+ /*check if custom again*/
102
+ if( $check_custom_style ){
103
+
104
+ $cf7s_custom_settings = maybe_unserialize( get_post_meta( $cf7s_id, 'cf7_style_custom_styler', true ));
105
+ $cf7s_custom_settings = ( empty($cf7s_custom_settings) ) ? array() : $cf7s_custom_settings;
106
+
107
+ $classelem = "body .cf7-style." . ( ( is_numeric( $cf7s_slug ) ) ? "cf7-style-".$cf7s_slug : $cf7s_slug );
108
+
109
+ $normal_arr = array();
110
+ $hover_arr = array();
111
+
112
+ $placeholder_arr = array();
113
+ $placeholder_hover_arr = array();
114
+
115
+ foreach( $cf7s_custom_settings as $setting_key => $setting ){
116
+ if( strpos($setting_key,'_hover') === false ){
117
+ if( strpos($setting_key,'placeholder') !== false ){
118
+ $placeholder_arr[$setting_key] = $setting;
119
+ } else {
120
+ $normal_arr[$setting_key] = $setting;
121
+ }
122
+ } else {
123
+
124
+ if( strpos($setting_key,'placeholder') !== false ){
125
+ $placeholder_hover_arr[$setting_key] = $setting;
126
+ } else {
127
+ $hover_arr[$setting_key] = $setting;
128
+ }
129
+ }
130
+ }
131
+
132
+ $style .= generate_css_code( (( $style_number == 0) ? $style : ''), $normal_arr, $classelem, $cf7s_force_css, '', '' );
133
+ $style .= generate_css_code( '', $hover_arr, $classelem, $cf7s_force_css, ':hover', '' );
134
+
135
+ if( !empty($placeholder_arr) ){
136
+ foreach ($placeholder_fallback as $placeh) {
137
+ $style .= generate_css_code( '', $placeholder_arr, $classelem, $cf7s_force_css, '', $placeh);
138
+ }
139
+ }
140
+
141
+ if( !empty($placeholder_hover_arr) ){
142
+ foreach ($placeholder_hover_fallback as $placeh) {
143
+ $style .= generate_css_code( '', $placeholder_hover_arr, $classelem, $cf7s_force_css, ':hover', $placeh);
144
+ }
145
+ }
146
+
147
+ }/*custom end*/
148
+
149
+ $font_family = return_font_name( $cf7s_id );
150
+
151
+ if( ! empty( $font_family ) && "none" !== $font_family ) {
152
+ if (is_numeric($cf7s_slug)) {
153
+ $cf7s_slug = "cf7-style-".$cf7s_slug;
154
+ }
155
+ $style .= 'body .cf7-style.' . $cf7s_slug . ",body .cf7-style." . $cf7s_slug . " input[type='submit'] {font-family: '" . $font_family . "',sans-serif;} ";
156
+ }
157
+ $style_number++;
158
+ }/*Main if ends here*/
159
+ endwhile;
160
+ $style_manual = "";
161
+ $style_start = "\n<style class='cf7-style' media='screen' type='text/css'>\n";
162
+ if( !empty( $cf7s_manual_style ) ){
163
+ $style_manual = "\n".$cf7s_manual_style."\n";
164
+ }
165
+ $cur_css = $style_start;
166
+ $cur_css .= $style;
167
+ $cur_css .= $style_manual;
168
+ if( ( $style_number !== 0 ) && $style_number == count( $active_styles ) ) {
169
+ $cur_css .= "\n</style>\n";
170
+ }
171
+ $cur_css = str_replace(' 0px;', ' 0;', $cur_css);
172
+
173
+ echo $cur_css;
174
+ wp_reset_postdata();
175
+ endif;
176
+ }// end of cf7_style_custom_css_generator
inc/dashboard_generate_preview.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ function cf7_style_generate_preview_dashboard() {
8
+
9
+ $form_id = sanitize_text_field( $_POST['form_id'] );
10
+ $form_title = sanitize_text_field( $_POST['form_title'] );
11
+ $form = "<div class='multiple-form-generated-preview preview-form-container'><h4>" . $form_title . "</h4>" . do_shortcode( '[contact-form-7 id="'. $form_id .'" title="'. $form_title .'"]' ) . "</div>";
12
+ echo $form;
13
+
14
+ wp_die();
15
+ }
16
+ add_action( 'wp_ajax_cf7_style_generate_preview_dashboard', 'cf7_style_generate_preview_dashboard' );
inc/dashboard_hide_delete_tpl_box.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ function cf7_style_remove_box() {
8
+ global $wpdb;
9
+ update_option( 'cf7_style_no_temps', 'hide_box' );
10
+ wp_die();
11
+ }
12
+ add_action( 'wp_ajax_cf7_style_remove_box', 'cf7_style_remove_box' );
inc/dashboard_hide_welcome_box.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ function cf7_style_remove_welcome_box() {
8
+ global $wpdb;
9
+ update_option( 'cf7_style_welcome', 'hide_box' );
10
+ wp_die();
11
+ }
12
+ add_action( 'wp_ajax_cf7_style_remove_welcome_box', 'cf7_style_remove_welcome_box' );
inc/dashboard_load_custom_property.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ function cf7_style_load_property() {
8
+
9
+ $form_property = sanitize_text_field( $_POST['property'] );
10
+ $form_panel = "";
11
+ $saved_values = maybe_unserialize(get_post_meta( $post->ID, 'cf7_style_custom_styler', true ));
12
+ $saved_values = (empty($saved_values)) ? array() : $saved_values;
13
+ require_once( WPCF7S_PLUGIN_DIR.'/plugin-options.php' );
14
+ foreach( $elements as $property => $property_value ) {
15
+ if( $property == $form_property ) {
16
+ if( $property_value['description'] != ""){
17
+ $form_panel .= '<h4 class="description-title">'.$property_value['description'].'</h4>';
18
+ }
19
+ foreach( $property_value['settings'] as $sub_property_key => $sub_property_value ) {
20
+ $property = strtolower( $property );
21
+ $sub_property_slug = strtolower( $options[$sub_property_value]['slug'] );
22
+ $style_element_name = strtolower($options[$sub_property_value]['name']);
23
+ $half_width_class = ( $style_element_name == "box sizing" || $style_element_name == "display" || $style_element_name == "position" || $style_element_name == "width" || $style_element_name == "height") ? "half-size" : "";
24
+ $form_panel .= '<div class="element-styling '.$half_width_class.' '.$style_element_name.'"><h3><span>&lt;'.$property.'&gt;</span> '.$style_element_name . '</h3>';
25
+ if( $options[$sub_property_value]['type'] ) {
26
+ $form_panel .= "<ul>";
27
+ foreach( $options[$sub_property_value]['type'] as $key => $value ) {
28
+ if( $key != "comming-soon" ){
29
+ $form_panel .= generate_property_fields( $key, $value, $property, $sub_property_slug, $saved_values, '');
30
+ $form_panel .= generate_property_fields( $key, $value, $property, $sub_property_slug, $saved_values, '_hover');
31
+ } else {
32
+ $form_panel .= "<li></li>";
33
+ }
34
+ }
35
+ $form_panel .= "</ul>";
36
+ $form_panel .= "</div>";
37
+ }
38
+ }
39
+ }
40
+ }
41
+ print_r($form_panel);
42
+ wp_die();
43
+ }
44
+ add_action( 'wp_ajax_cf7_style_load_property', 'cf7_style_load_property' );
inc/dashboard_table_add_preview.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ function cf7_style_event_table_head( $defaults ) {
8
+ $new = array();
9
+ foreach( $defaults as $key=>$value) {
10
+ if( $key=='title') { // when we find the date column
11
+ $new['preview-style'] = 'Preview Style';
12
+ }
13
+ $new[$key]=$value;
14
+ }
15
+ return $new;
16
+ }
17
+
18
+ function cf7_style_event_table_content( $column_name, $post_id ) {
19
+ // cf7_style_image_preview
20
+ if ( $column_name == 'preview-style' ) {
21
+ $img_src = get_post_meta( $post_id, 'cf7_style_image_preview', true );
22
+ echo "<a href='".admin_url() ."post.php?post=".$post_id."&action=edit"."'><span class='thumb-preview'><img src='" . plugins_url() ."/"."contact-form-7-style". ( empty( $img_src ) ? "/images/default_form.jpg" : $img_src ) . "' alt='".get_the_title( $post_id )."' title='".get_the_title( $post_id )."'/><div class='previewed-img'><img src='" . plugins_url() ."/"."contact-form-7-style". ( empty( $img_src ) ? "/images/default_form.jpg" : $img_src ) . "' alt='".get_the_title( $post_id )."' title='Edit ".get_the_title( $post_id )." Style'/></div></span></a>" ;
23
+ }
24
+ }
25
+
26
+ add_filter( 'manage_cf7_style_posts_columns', 'cf7_style_event_table_head');
27
+ add_action( 'manage_cf7_style_posts_custom_column', 'cf7_style_event_table_content', 10, 2 );
inc/deactivate_style.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Reset the cf7_style_cookie option
4
+ */
5
+
6
+ if ( !defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ function cf7_style_deactivate() {
11
+ update_option( 'cf7_style_cookie', false );
12
+ update_option( 'cf7_style_add_categories', 0 );
13
+ }
14
+ register_deactivation_hook( __FILE__, 'cf7_style_deactivate' );
inc/editor_page.php CHANGED
@@ -2,6 +2,11 @@
2
  /*
3
  * page to save global css
4
  */
 
 
 
 
 
5
  if ( !function_exists( 'cf7style_editor_page_init' ) ) {
6
  add_action('admin_menu', 'cf7style_editor_page_init');
7
  function cf7style_editor_page_init() {
@@ -40,8 +45,9 @@ if ( !function_exists( 'cf7style_editor_page_view' ) ) {
40
  }
41
  }
42
  $initiatenewoptions = new init_sections_register_fields();
 
43
  class init_sections_register_fields {
44
- function init_sections_register_fields( ) {
45
  add_filter( 'admin_init' , array( $this , 'register_new_fields' ) );
46
  }
47
  function cf7style_render_checkbox( $option, $args, $description, $tulip ){
@@ -51,7 +57,6 @@ class init_sections_register_fields {
51
  function cf7style_collection_structure( $args ) {
52
  $html = "";
53
  $html .= '</tr>';
54
- /*$html .= '<tr><td colspan="2"><p>'.__( "Want to help make Contact Form 7 Style even more better? Allow Us to collect non-sensitive diagnostic data.", "contact-form-7-style" ).'</p><p>'.__( "We will only collect your website URL, WordPress version, Contact Form 7 Style plugin version and active status.", "contact-form-7-style" ).'</p></td></tr>';*/
55
  $html .= '<tr><td colspan="2">';
56
  $option = get_option( $args[0] );
57
  $html .= $this->cf7style_render_checkbox( $option, $args, 'Allow collecting data', '<p>'.__( "Want to help make Contact Form 7 Style even more better? Allow Us to collect non-sensitive diagnostic data.", "contact-form-7-style" ).'</p><p>'.__( "We will only collect your website URL, WordPress version, Contact Form 7 Style plugin version and active status.", "contact-form-7-style" ).'</p>' );
@@ -62,8 +67,6 @@ class init_sections_register_fields {
62
  function cf7style_templates_structure ( $args) {
63
  $html = "";
64
  $html .= '</tr>';
65
- /*$html .= '<tr><td colspan="2"><p>'.__( "From here you will be able to import the Contact Form 7 Style predefined templates.", "contact-form-7-style" ).'</p></td></tr>';
66
- $html .= '<tr><td colspan="2"><p><small>'.__( "This works only if the predefined templates are Deleted Permanently (they don't appear in", "contact-form-7-style" ).' <a href="'.admin_url('edit.php?post_status=trash&post_type=cf7_style').'">'.__( "Trash", "contact-form-7-style" ).'</a> ).</small></p></td></tr>';*/
67
  $html .= '<tr><td colspan="2">';
68
  $option = get_option( $args[0] );
69
  if( $option == '1'){
@@ -183,13 +186,7 @@ class init_sections_register_fields {
183
  update_option( $args[0], $_POST[$args[0]] );
184
  }
185
  $option = stripslashes(get_option( $args[0] ));
186
- if ( version_compare( phpversion() , '5.3', '>' ) ) {
187
- require_once 'cssparser.php';
188
- $css = new CSSParser();
189
- echo "<div class='parser-message'>";
190
- $cssIndex = $css->ParseCSS($option);
191
- echo "</div>";
192
- }
193
  echo '<form method="POST" action="">';
194
  echo '<textarea id="'.$args[0].'" name="'.$args[0].'" />' . $option. '</textarea>';
195
  submit_button( 'Save CSS', 'primary' );
2
  /*
3
  * page to save global css
4
  */
5
+
6
+ if ( !defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
  if ( !function_exists( 'cf7style_editor_page_init' ) ) {
11
  add_action('admin_menu', 'cf7style_editor_page_init');
12
  function cf7style_editor_page_init() {
45
  }
46
  }
47
  $initiatenewoptions = new init_sections_register_fields();
48
+
49
  class init_sections_register_fields {
50
+ public function __construct( ) {
51
  add_filter( 'admin_init' , array( $this , 'register_new_fields' ) );
52
  }
53
  function cf7style_render_checkbox( $option, $args, $description, $tulip ){
57
  function cf7style_collection_structure( $args ) {
58
  $html = "";
59
  $html .= '</tr>';
 
60
  $html .= '<tr><td colspan="2">';
61
  $option = get_option( $args[0] );
62
  $html .= $this->cf7style_render_checkbox( $option, $args, 'Allow collecting data', '<p>'.__( "Want to help make Contact Form 7 Style even more better? Allow Us to collect non-sensitive diagnostic data.", "contact-form-7-style" ).'</p><p>'.__( "We will only collect your website URL, WordPress version, Contact Form 7 Style plugin version and active status.", "contact-form-7-style" ).'</p>' );
67
  function cf7style_templates_structure ( $args) {
68
  $html = "";
69
  $html .= '</tr>';
 
 
70
  $html .= '<tr><td colspan="2">';
71
  $option = get_option( $args[0] );
72
  if( $option == '1'){
186
  update_option( $args[0], $_POST[$args[0]] );
187
  }
188
  $option = stripslashes(get_option( $args[0] ));
189
+
 
 
 
 
 
 
190
  echo '<form method="POST" action="">';
191
  echo '<textarea id="'.$args[0].'" name="'.$args[0].'" />' . $option. '</textarea>';
192
  submit_button( 'Save CSS', 'primary' );
inc/frontend_edit_style_link.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ function cf7_style_frontend_edit_link( $form ) {
8
+
9
+ if( is_user_logged_in() && current_user_can( 'manage_options' ) && !is_admin() && get_option( 'cf7_style_form_tooltip' ) == 1 ) {
10
+
11
+ $cf7 = wpcf7_get_current_contact_form(); // Current contact form 7 object
12
+ $form_id = get_form_id( $cf7 );
13
+ $cf7_style_id = get_post_meta( $form_id, 'cf7_style_id', true );
14
+
15
+ if( empty( $cf7_style_id ) ) {
16
+ $form .= "<a href='" . admin_url( 'edit.php?post_type=cf7_style' ) . "' class='frontend-edit-style-link'>" . __( 'Add Style', 'contact-form-7-style' ) . "</a>";
17
+ } else {
18
+ $cf7_style_data = get_post( $cf7_style_id, OBJECT );
19
+ $template_type = ( has_term( 'custom-style', 'style_category', $cf7_style_data ) ) ? __( 'Edit custom style', 'contact-form-7-style' ) : __( 'Edit predifined template', 'contact-form-7-style' );
20
+ $form .= "<a href='" . admin_url( 'post.php?post=' . $cf7_style_id . '&action=edit' ) . "' class='frontend-edit-style-link'>" . $template_type . "</a>";
21
+ }
22
+ }
23
+
24
+ return $form;
25
+ }
26
+ add_filter( 'wpcf7_form_elements', 'cf7_style_frontend_edit_link' );
inc/get_form_id.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Get contact form 7 id
5
+ *
6
+ * Back compat for CF7 3.9
7
+ * @see http://contactform7.com/2014/07/02/contact-form-7-39-beta/
8
+ *
9
+ * @param $cf7 Contact Form 7 object
10
+ * @since 0.1.0
11
+ */
12
+
13
+ if ( !defined( 'ABSPATH' ) ) {
14
+ exit;
15
+ }
16
+
17
+ function get_form_id( $cf7 ) {
18
+ if ( version_compare( WPCF7_VERSION, '3.9-alpha', '>' ) ) {
19
+ if (!is_object($cf7)) {
20
+ return false;
21
+ }
22
+ return $cf7->id();
23
+ }
24
+ }
inc/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php /*Silence is golden.*/
inc/init_style.php ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ Create the Contact style post type and custom taxonomy
5
+ CPT: cf7_style
6
+ Taxonomy: style_category
7
+ */
8
+
9
+ if ( !defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ function get_predefined_cf7_style_template_data() {
14
+ $request_json = wp_safe_remote_get( WPCF7S_LOCATION.'/admin/predefined-templates.json' );
15
+ $templates = json_decode( wp_remote_retrieve_body( $request_json ) , true);
16
+ return $templates;
17
+ }// end of get_predefined_cf7_style_template_data
18
+
19
+ function cf7_style_set_style_category_on_publish( $ID, $post ) {
20
+ $temporizator = 0;
21
+ foreach ( get_predefined_cf7_style_template_data() as $predefined_post_titles ) {
22
+ if( $post->post_title == $predefined_post_titles[ "title" ] ){
23
+ $temporizator++;
24
+ }
25
+ }
26
+ if( 0 == $temporizator ) {
27
+ wp_set_object_terms( $ID, 'custom style', 'style_category' );
28
+ }
29
+ } // end cf7_style_set_style_category_on_publish
30
+
31
+ function cf7_style_create_post( $slug, $title, $image) {
32
+ // Initialize the page ID to -1. This indicates no action has been taken.
33
+ $post_id = -1;
34
+ $was_deleted = get_option('cf7_style_deleted');
35
+ if( null == get_page_by_title( $title, "OBJECT", "cf7_style" ) && $was_deleted != "yes" ) {
36
+ // Set the post ID so that we know the post was created successfully
37
+ $post_id = wp_insert_post(
38
+ array(
39
+ 'comment_status' => 'closed',
40
+ 'ping_status' => 'closed',
41
+ 'post_name' => $slug,
42
+ 'post_title' => $title,
43
+ 'post_status' => 'publish',
44
+ 'post_type' => 'cf7_style'
45
+ )
46
+ );
47
+ //if is_wp_error doesn't trigger, then we add the image
48
+ if ( is_wp_error( $post_id ) ) {
49
+ $errors = $post_id->get_error_messages();
50
+ foreach ($errors as $error) {
51
+ echo $error . '<br>';
52
+ }
53
+ } else {
54
+ //wp_set_object_terms( $post_id, $category, 'style_category', false );
55
+ update_post_meta( $post_id, 'cf7_style_image_preview', $image );
56
+ }
57
+ // Otherwise, we'll stop
58
+ } else {
59
+ // Arbitrarily use -2 to indicate that the page with the title already exists
60
+ $post_id = -2;
61
+ } // end if
62
+ } // end cf7_style_create_post
63
+
64
+ function cf7style_load_elements(){
65
+
66
+ $labels = array(
67
+ 'name' => _x( 'Contact Styles', 'Post Type General Name', 'contact-form-7-style' ),
68
+ 'singular_name' => _x( 'Contact Style', 'Post Type Singular Name', 'contact-form-7-style' ),
69
+ 'menu_name' => __( 'Contact Style', 'contact-form-7-style' ),
70
+ 'parent_item_colon' => __( 'Parent Style:', 'contact-form-7-style' ),
71
+ 'all_items' => __( 'All Styles', 'contact-form-7-style' ),
72
+ 'view_item' => __( 'View Style', 'contact-form-7-style' ),
73
+ 'add_new_item' => __( 'Add New', 'contact-form-7-style' ),
74
+ 'add_new' => __( 'Add New', 'contact-form-7-style' ),
75
+ 'edit_item' => __( 'Edit Style', 'contact-form-7-style' ),
76
+ 'update_item' => __( 'Update Style', 'contact-form-7-style' ),
77
+ 'search_items' => __( 'Search Style', 'contact-form-7-style' ),
78
+ 'not_found' => __( 'Not found', 'contact-form-7-style' ),
79
+ 'not_found_in_trash' => __( 'Not found in Trash', 'contact-form-7-style' )
80
+ );
81
+ $args = array(
82
+ 'label' => __( 'cf7_style', 'contact-form-7-style' ),
83
+ 'description' => __( 'Add/remove contact style', 'contact-form-7-style' ),
84
+ 'labels' => $labels,
85
+ 'supports' => array( 'title' ),
86
+ 'hierarchical' => false,
87
+ 'taxonomies' => array('style_category'),
88
+ 'public' => true,
89
+ 'show_ui' => true,
90
+ 'show_in_menu' => true,
91
+ 'show_in_nav_menus' => false,
92
+ 'show_in_admin_bar' => false,
93
+ 'menu_icon' => "dashicons-twitter",
94
+ 'menu_position' => 28.555555,
95
+ 'can_export' => true,
96
+ 'has_archive' => false,
97
+ 'exclude_from_search' => true,
98
+ 'publicly_queryable' => false,
99
+ 'capability_type' => 'page'
100
+ );
101
+ /*register custom post type CF7_STYLE*/
102
+ register_post_type( 'cf7_style', $args );
103
+
104
+ $labels = array(
105
+ 'name' => _x( 'Categories', 'Taxonomy General Name', 'contact-form-7-style' ),
106
+ 'singular_name' => _x( 'Categories', 'Taxonomy Singular Name', 'contact-form-7-style' ),
107
+ 'menu_name' => __( 'Categories', 'contact-form-7-style' ),
108
+ 'all_items' => __( 'All Categories', 'contact-form-7-style' ),
109
+ 'parent_item' => __( 'Parent Categories', 'contact-form-7-style' ),
110
+ 'parent_item_colon' => __( 'Parent Categories:', 'contact-form-7-style' ),
111
+ 'new_item_name' => __( 'New Categories Name', 'contact-form-7-style' ),
112
+ 'add_new_item' => __( 'Add New Categories', 'contact-form-7-style' ),
113
+ 'edit_item' => __( 'Edit Categories', 'contact-form-7-style' ),
114
+ 'update_item' => __( 'Update Categories', 'contact-form-7-style' ),
115
+ 'separate_items_with_commas' => __( 'Separate Categories with commas', 'contact-form-7-style' ),
116
+ 'search_items' => __( 'Search Categories', 'contact-form-7-style' ),
117
+ 'add_or_remove_items' => __( 'Add or remove Categories', 'contact-form-7-style' ),
118
+ 'choose_from_most_used' => __( 'Choose from the most used Categories', 'contact-form-7-style' ),
119
+ 'not_found' => __( 'Not Found', 'contact-form-7-style' ),
120
+ );
121
+ $args = array(
122
+ 'labels' => $labels,
123
+ 'hierarchical' => true,
124
+ 'public' => true,
125
+ 'show_ui' => false,
126
+ 'show_admin_column' => true,
127
+ 'show_in_nav_menus' => false,
128
+ 'show_tagcloud' => true,
129
+ );
130
+ //register tax
131
+ register_taxonomy( 'style_category', array( 'cf7_style' ), $args );
132
+
133
+ foreach ( get_predefined_cf7_style_template_data() as $style ) {
134
+ cf7_style_create_post( strtolower( str_replace( " ", "-", $style['title'] ) ), $style['title'], $style['image'] );
135
+ }
136
+ if( get_option( 'cf7_style_add_categories', 0 ) == 0 ){
137
+ $cf7_style_args = array(
138
+ 'post_type' => 'cf7_style',
139
+ 'posts_per_page' => '-1'
140
+ );
141
+
142
+ $cf7_style_query = new WP_Query( $cf7_style_args );
143
+ if ( $cf7_style_query->have_posts() ) {
144
+ while ( $cf7_style_query->have_posts() ) {
145
+ $cf7_style_query->the_post();
146
+ $temp_title = get_the_title();
147
+ $temp_ID = get_the_ID();
148
+
149
+ foreach ( get_predefined_cf7_style_template_data() as $style ) {
150
+ if( $temp_title == wptexturize( $style[ 'title' ] ) ) {
151
+ wp_set_object_terms( $temp_ID, $style[ 'category' ], 'style_category' );
152
+ }
153
+ }
154
+ }
155
+ wp_reset_postdata();
156
+ update_option( 'cf7_style_add_categories', 1 );
157
+ }
158
+ }
159
+ $cf7_style_update_saved = get_option( 'cf7_style_update_saved' );
160
+ if( $cf7_style_update_saved == "yes" ) {
161
+ $cf7_style_args = array(
162
+ 'post_type' => 'cf7_style',
163
+ 'style_category' => 'custom-style',
164
+ 'posts_per_page' => '-1'
165
+ );
166
+ $cf7s_manual_old_style = "";
167
+ $new_settings = array();
168
+ $cf7_style_query = new WP_Query( $cf7_style_args );
169
+ if ( $cf7_style_query->have_posts() ) {
170
+ while ( $cf7_style_query->have_posts() ) {
171
+ $cf7_style_query->the_post();
172
+ $cur_style_id = get_the_ID();
173
+ $cur_manual_style = get_post_meta( $cur_style_id, 'cf7_style_manual_style', true );
174
+ $cur_custom_styles = maybe_unserialize( get_post_meta( $cur_style_id, 'cf7_style_custom_styles', true ));
175
+ if($cur_manual_style){
176
+ $cf7s_manual_old_style .= $cur_manual_style;
177
+ update_post_meta( $cur_style_id, 'cf7_style_manual_style', '' );
178
+ }
179
+ if($cur_custom_styles){
180
+ $cf7s_custom_old_settings = $cur_custom_styles;
181
+ require_once( WPCF7S_PLUGIN_DIR.'/cf7-style-match-old.php' );
182
+ $new_settings = get_new_styler_data( $cf7s_custom_old_settings );
183
+ update_post_meta( $cur_style_id, 'cf7_style_manual_styles', '');
184
+ update_post_meta( $cur_style_id, 'cf7_style_custom_styles', '');
185
+ update_post_meta( $cur_style_id, 'cf7_style_custom_styler', $new_settings, "");
186
+ }
187
+ }
188
+ wp_reset_postdata();
189
+ if($cf7s_manual_old_style){
190
+ update_option( 'cf7_style_manual_style', $cf7s_manual_old_style );
191
+ }
192
+ }
193
+ update_option( 'cf7_style_update_saved', 'no' );
194
+ }
195
+ require_once( WPCF7S_PLUGIN_DIR.'/cf7-style-meta-box.php' );
196
+ if ( ! is_admin() ) {
197
+ add_action('wp_head', 'cf7_style_custom_css_generator');
198
+ }
199
+ }
200
+
201
+ add_action( 'init', 'cf7style_load_elements' );
202
+ add_action( 'publish_cf7_style', 'cf7_style_set_style_category_on_publish', 10, 2 );
inc/remove_predefined_templates.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ function cf7_style_remove_templates() {
8
+ global $wpdb;
9
+ update_option( 'cf7_style_deleted', 'yes' );
10
+ update_option( 'cf7_style_add_categories', 0 );
11
+ $del_args = array(
12
+ 'posts_per_page' => -1,
13
+ 'post_type' => 'cf7_style',
14
+ 'tax_query' => array(
15
+ array(
16
+ 'taxonomy' => 'style_category',
17
+ 'field' => 'slug',
18
+ 'terms' => 'custom-style',
19
+ 'operator' => 'NOT IN',
20
+ ),
21
+ ),
22
+ );
23
+ $del_query = new WP_Query( $del_args );
24
+ if ( $del_query->have_posts() ) {
25
+ while ( $del_query->have_posts() ) {
26
+ $del_query->the_post();
27
+ $style_id = get_the_ID();
28
+ $clr_form_args = array(
29
+ 'post_type' => 'wpcf7_contact_form',
30
+ 'posts_per_page' => -1,
31
+ 'meta_key' => 'cf7_style_id',
32
+ 'meta_value' => $style_id
33
+ );
34
+ $form_query = new WP_Query( $clr_form_args );
35
+ if ( $form_query->have_posts() ) {
36
+ while ( $form_query->have_posts() ) {
37
+ $form_query->the_post();
38
+ /*form id*/
39
+ update_post_meta( get_the_ID(), 'cf7_style_id', '');
40
+ }
41
+ wp_reset_postdata();
42
+ }
43
+ wp_delete_post( $style_id,false);
44
+ }
45
+ wp_reset_postdata();
46
+ print_r('success');
47
+ }
48
+ wp_die();
49
+ }
50
+ add_action( 'wp_ajax_cf7_style_remove_templates', 'cf7_style_remove_templates' );
inc/slider_meta_box.php CHANGED
@@ -2,6 +2,11 @@
2
  /*
3
  * function for displaying the meta box
4
  */
 
 
 
 
 
5
  function cf7_style_display_slider( $post ) {
6
  $stylearray = array(
7
  'post_type' => 'cf7_style',
2
  /*
3
  * function for displaying the meta box
4
  */
5
+
6
+ if ( !defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
  function cf7_style_display_slider( $post ) {
11
  $stylearray = array(
12
  'post_type' => 'cf7_style',
inc/system_status.php CHANGED
@@ -3,6 +3,10 @@
3
  * CF7 Style System status
4
  */
5
 
 
 
 
 
6
  function cf7style_system_status() {
7
 
8
  /**
3
  * CF7 Style System status
4
  */
5
 
6
+ if ( !defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
  function cf7style_system_status() {
11
 
12
  /**
inc/taxonomy_filters_add.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ function cf7_style_add_taxonomy_filters() {
8
+ global $typenow;
9
+ // an array of all the taxonomyies you want to display. Use the taxonomy name or slug
10
+ $taxonomies = array( 'style_category' );
11
+ // must set this to the post type you want the filter(s) displayed on
12
+ if( $typenow == 'cf7_style' ){
13
+ foreach ( $taxonomies as $tax_slug ) {
14
+ $tax_obj = get_taxonomy( $tax_slug );
15
+
16
+ $tax_name = $tax_obj->labels->name;
17
+ $terms = get_terms( $tax_slug );
18
+ if( count( $terms ) > 0 ) {
19
+ echo "<select name='$tax_slug' id='$tax_slug' class='postform'>";
20
+ echo "<option value=''>Show All $tax_name</option>";
21
+ foreach ( $terms as $term ) {
22
+ $resultA = "<option value='".$term->slug."' selected='selected'>".$term->name .' (' . $term->count .')'."</option>";
23
+ $resultB = "<option value='".$term->slug."'>".$term->name .' (' . $term->count .')'."</option>";
24
+ echo ( isset( $_GET[$tax_slug] ) ) ? ( ( $_GET[$tax_slug] == $term->slug ) ? $resultA : $resultB ) : $resultB;
25
+ }
26
+ echo "</select>";
27
+ }
28
+ }
29
+ }
30
+ }// end cf7_style_add_taxonomy_filters
31
+
32
+ add_action( 'restrict_manage_posts', 'cf7_style_add_taxonomy_filters' );
misc/index.php CHANGED
@@ -1 +1 @@
1
- <?php //silence
1
+ <?php /*Silence is golden.*/
misc/tracking.php CHANGED
@@ -2,6 +2,12 @@
2
  /**
3
  * on deactivation, if tracking is on, it will send info to plugin authors that the plugin is no longer active
4
  */
 
 
 
 
 
 
5
  define( 'CF7_STYLE_PLUGIN_PATH', WP_PLUGIN_DIR . '/contact-form-7-style/' );
6
  if ( !function_exists( 'cf7_style_announce_authors_about_deactivation' ) ) {
7
  function cf7_style_announce_authors_about_deactivation () {
2
  /**
3
  * on deactivation, if tracking is on, it will send info to plugin authors that the plugin is no longer active
4
  */
5
+
6
+ if ( !defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+
11
  define( 'CF7_STYLE_PLUGIN_PATH', WP_PLUGIN_DIR . '/contact-form-7-style/' );
12
  if ( !function_exists( 'cf7_style_announce_authors_about_deactivation' ) ) {
13
  function cf7_style_announce_authors_about_deactivation () {
misc/welcome.php CHANGED
@@ -2,6 +2,11 @@
2
  /*
3
  * Welcome panel html
4
  */
 
 
 
 
 
5
  if ( !function_exists( 'cf7_style_show_welcome_panel' ) ) {
6
  function cf7_style_show_welcome_panel() {
7
  $welm = get_option( 'cf7_style_welcome' );
2
  /*
3
  * Welcome panel html
4
  */
5
+
6
+ if ( !defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
  if ( !function_exists( 'cf7_style_show_welcome_panel' ) ) {
11
  function cf7_style_show_welcome_panel() {
12
  $welm = get_option( 'cf7_style_welcome' );
options.php CHANGED
@@ -3,6 +3,10 @@
3
  * Contact Form 7 Style Options
4
  */
5
 
 
 
 
 
6
  require 'plugin-options.php';
7
 
8
  /**
3
  * Contact Form 7 Style Options
4
  */
5
 
6
+ if ( !defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
  require 'plugin-options.php';
11
 
12
  /**
plugin-options.php CHANGED
@@ -1,346 +1,14 @@
1
  <?php
2
- $options_string = '{
3
- "width": {
4
- "name": "Width",
5
- "slug": "width",
6
- "type": {
7
- "numeric": {
8
- "title": "Width",
9
- "style": "width",
10
- "property": "0",
11
- "unit": [
12
- "px",
13
- "%",
14
- "em"
15
- ]
16
- }
17
- },
18
- "desc": "Change the default width of the current element."
19
- },
20
- "height": {
21
- "name": "Height",
22
- "slug": "height",
23
- "type": {
24
- "numeric": {
25
- "title": "Height",
26
- "style": "height",
27
- "property": "0",
28
- "unit": [
29
- "px",
30
- "%",
31
- "em"
32
- ]
33
- }
34
- },
35
- "desc": "Change the default height of the current element."
36
- },
37
- "background": {
38
- "name": "Background",
39
- "slug": "background",
40
- "type": {
41
- "color-picker": {
42
- "title": "Background Color",
43
- "style": "background-color",
44
- "property": "#fff"
45
- },
46
- "input": {
47
- "title": "Background Image",
48
- "style": "background-image",
49
- "property": "none"
50
- },
51
- "select1": {
52
- "title": "Background Position",
53
- "style": "background-position",
54
- "property": [
55
- "left top",
56
- "left center",
57
- "left bottom",
58
- "center top",
59
- "center center",
60
- "center bottom",
61
- "right top",
62
- "right center",
63
- "right bottom"
64
- ]
65
- },
66
- "select2": {
67
- "title": "Background Size",
68
- "style": "background-size",
69
- "property": [
70
- "inherit",
71
- "cover",
72
- "contain"
73
- ]
74
- },
75
- "select3": {
76
- "title": "Background Repeat",
77
- "style": "background-repeat",
78
- "property": [
79
- "no-repeat",
80
- "repeat-x",
81
- "repeat-y",
82
- "repeat",
83
- "space",
84
- "round"
85
- ]
86
- },
87
- "select4": {
88
- "title": "Background Attachment",
89
- "style": "background-attachment",
90
- "property": [
91
- "inherit",
92
- "fixed",
93
- "scroll",
94
- "local"
95
- ]
96
- }
97
- },
98
- "desc": "Change the default background properties of the current element."
99
- },
100
- "border": {
101
- "name": "Border",
102
- "slug": "border",
103
- "type": {
104
- "numeric1": {
105
- "title": "Border Width",
106
- "style": "border-width",
107
- "property": "0 0 0 0",
108
- "unit": [
109
- "px",
110
- "%",
111
- "em"
112
- ]
113
- },
114
- "select": {
115
- "title": "Border Style",
116
- "style": "border-style",
117
- "property": [
118
- "none",
119
- "solid",
120
- "dotted",
121
- "double",
122
- "groove",
123
- "ridge",
124
- "inset",
125
- "outset"
126
- ]
127
- },
128
- "color-picker": {
129
- "title": "Border color",
130
- "style": "border-color",
131
- "property": "#fff"
132
- },
133
- "numeric2": {
134
- "title": "Border radius",
135
- "style": "border-radius",
136
- "property": "0 0 0 0",
137
- "unit": [
138
- "px",
139
- "%",
140
- "em"
141
- ]
142
- }
143
- },
144
- "desc": "Add custom border."
145
- },
146
- "font": {
147
- "name": "Font",
148
- "slug": "font",
149
- "type": {
150
- "numeric1": {
151
- "title": "Font size",
152
- "style": "font-size",
153
- "property": "0",
154
- "unit": [
155
- "px",
156
- "%",
157
- "em"
158
- ]
159
- },
160
- "select2": {
161
- "title": "Font weight",
162
- "style": "font-weight",
163
- "property": [
164
- "inherit",
165
- "normal",
166
- "bold",
167
- "lighter",
168
- "bolder",
169
- "300",
170
- "400",
171
- "600",
172
- "700"
173
- ]
174
- },
175
- "select1": {
176
- "title": "Font style",
177
- "style": "font-style",
178
- "property": [
179
- "normal",
180
- "italic",
181
- "oblique"
182
- ]
183
- },
184
- "select4": {
185
- "title": "Text Align",
186
- "style": "text-align",
187
- "property": [
188
- "left",
189
- "right",
190
- "center",
191
- "justify",
192
- "start",
193
- "end"
194
- ]
195
- },
196
- "select3": {
197
- "title": "Text transform",
198
- "style": "text-transform",
199
- "property": [
200
- "inherit",
201
- "capitalize",
202
- "uppercase",
203
- "lowercase",
204
- "none"
205
- ]
206
- },
207
- "select5": {
208
- "title": "Text decoration",
209
- "style": "text-decoration",
210
- "property": [
211
- "none",
212
- "underline",
213
- "inherit",
214
- "initial",
215
- "unset"
216
- ]
217
- },
218
- "numeric2": {
219
- "title": "Line Height",
220
- "style": "line-height",
221
- "property": "0",
222
- "unit": [
223
- "px",
224
- "%",
225
- "em"
226
- ]
227
- },
228
 
229
- "numeric3": {
230
- "title": "Text indent",
231
- "style": "text-indent",
232
- "property": "0",
233
- "unit": [
234
- "px",
235
- "%",
236
- "em"
237
- ]
238
- },
239
 
240
- "color-picker": {
241
- "title": "Color",
242
- "style": "color",
243
- "property": "#fff"
244
- }
245
- },
246
- "desc": "Add custom font."
247
- },
248
- "margin": {
249
- "name": "Margin",
250
- "slug": "margin",
251
- "type": {
252
- "numeric": {
253
- "title": "Margin",
254
- "style": "margin",
255
- "property": "0 0 0 0",
256
- "unit": [
257
- "px",
258
- "%",
259
- "em"
260
- ]
261
- }
262
- },
263
- "desc": "Add custom margin."
264
- },
265
- "padding": {
266
- "name": "Padding",
267
- "slug": "padding",
268
- "type": {
269
- "numeric": {
270
- "title": "Padding",
271
- "style": "padding",
272
- "property": "0 0 0 0",
273
- "unit": [
274
- "px",
275
- "%",
276
- "em"
277
- ]
278
- }
279
- },
280
- "desc": "Add custom padding."
281
- },
282
- "float": {
283
- "name": "Position",
284
- "slug": "float",
285
- "type": {
286
- "select": {
287
- "title": "Position",
288
- "style": "float",
289
- "property": [
290
- "inherit",
291
- "none",
292
- "left",
293
- "right"
294
- ]
295
- }
296
- },
297
- "desc": "Add custom float."
298
- },
299
- "display": {
300
- "name": "Display",
301
- "slug": "display",
302
- "type": {
303
- "select": {
304
- "title": "Display",
305
- "style": "display",
306
- "property": [
307
- "inherit",
308
- "none",
309
- "inline",
310
- "inline-block",
311
- "block"
312
- ]
313
- }
314
- },
315
- "desc": "Add custom display."
316
- },
317
- "box-sizing": {
318
- "name": "Box sizing",
319
- "slug": "box-sizing",
320
- "type": {
321
- "select": {
322
- "title": "Box sizing",
323
- "style": "box-sizing",
324
- "property": [
325
- "inherit",
326
- "initial",
327
- "unset",
328
- "content-box",
329
- "border-box"
330
- ]
331
- }
332
- },
333
- "desc": "Add custom box sizing."
334
- },
335
- "comming-soon": {
336
- "name": "Comming Soon",
337
- "slug": "box-sizing",
338
- "type": {
339
- "comming-soon": {}
340
- }
341
- }
342
- }';
343
- $options = json_decode($options_string, true);
344
 
345
  /**
346
  * Generate property fields
@@ -357,7 +25,7 @@ function generate_property_fields( $key, $std, $name, $type, $saved_values, $sel
357
  case 'input':
358
  $field_class = ($current_key == "input") ? "cf7-style-upload-field" : "cf7-style-color-field";
359
  $saved_one = (array_key_exists( $name . "_". $std["style"].$selector_type, $saved_values)) ? $saved_values[ $name . "_". $std["style"].$selector_type] : "";
360
- return "<li ".$hidden_element."><label for='". $name . "_". $std["style"] .$selector_type."'><strong>".$std["title"].$title_addon.":</strong></label>".(($current_key == "color-picker") ? "<span class='icon smaller'><i class='fa fa-eyedropper' aria-hidden='true'></i></span>" : "")."<input type='text' id='". $name . "_". $std["style"] .$selector_type."' name='cf7stylecustom[". $name . "_". $std["style"] .$selector_type."]' value='". $saved_one ."' class='".$field_class."' /></li>";
361
  break;
362
  case 'comming-soon':
363
  return "<li></li>";
@@ -385,7 +53,7 @@ function generate_property_fields( $key, $std, $name, $type, $saved_values, $sel
385
  $incrementor = 0;
386
  $indexer = 0;
387
  $arrows = array('up', 'right', 'down' , 'left');
388
- $fonts = array( 'font-size' => 'text-height', 'line-height' => 'font', 'text-indent' => 'indent');
389
  foreach( $val as $elem_key => $elem_value ) {
390
  if( $std["property"] == "0 0 0 0"){
391
  /*Add new style properties if 4 value property inserted*/
@@ -400,29 +68,35 @@ function generate_property_fields( $key, $std, $name, $type, $saved_values, $sel
400
  $test = ( $std["style"] == "border-top" || $std["style"] == "border-right" || $std["style"] == "border-bottom" || $std["style"] == "border-left") ? '-width' : '' ;
401
  $saved_one = ( array_key_exists( $name . "_". $std["style"].$test.$selector_type, $saved_values)) ? $saved_values [ $name . "_". $std["style"].$test.$selector_type ] : "";
402
  switch ($type){
403
- case "width" : $temp .= '<span class="element-wrapper"><span class="icon"><i class="fa fa-arrows-h" aria-hidden="true"></i></span>'; break;
404
- case "height" : $temp .= '<span class="element-wrapper"><span class="icon"><i class="fa fa-arrows-v" aria-hidden="true"></i></span>'; break;
 
405
  case "border" :
406
  case "margin" :
407
- case "padding": $temp .= '<span class="element-wrapper"><span class="icon"><i class="fa fa-long-arrow-'.$arrows[$indexer++].'" aria-hidden="true"></i></span>'; break;
408
- case "font" : $temp .= '<span class="element-wrapper"><span class="icon"><i class="fa fa-'.$fonts[$std["style"]].'" aria-hidden="true"></i></span>';break;
409
  }
410
  $min_val = ("margin" == $type) ? '-1000' : '0';
411
- $temp .= "<input type='number' min='".$min_val."' max='1000' id='". $name . "_". $std["style"].$test.$selector_type."' name='cf7stylecustom[". $name . "_". $std["style"].$test.$selector_type."]' value='". $saved_one ."' />";
 
 
 
 
412
 
413
- $temp .= "<select id='". $name . "_". $std["style"] .$test . "_unit".$selector_type."' name='cf7stylecustom[". $name . "_". $std["style"] .$test ."_unit".$selector_type."]'>";
 
 
 
414
 
415
- foreach( $std["unit"] as $unit_val ) {
416
- $saved_one_unit = ( array_key_exists( $name . "_". $std["style"]. "_unit".$selector_type, $saved_values) ) ? $saved_values[ $name . "_". $std["style"]. "_unit".$selector_type ] : "";
417
- $temp .= "<option ". selected( $saved_one_unit , $unit_val, false ) . ">". $unit_val ."</option>";
418
  }
419
- $temp .= "</select>";
420
  switch ($type){
421
  case "width" :
422
  case "height" :
423
  case "border" :
424
  case "margin" :
425
- case "padding":
 
426
  case "font" : $temp .= '</span>';break;
427
  }
428
  }
@@ -434,7 +108,7 @@ function generate_property_fields( $key, $std, $name, $type, $saved_values, $sel
434
  $fonts = array( 'font-style' => 'italic', 'font-weight' => 'bold', 'text-align' => 'align-center', 'text-decoration' => 'underline', 'text-transform' => 'header' );
435
  $temp .= "<li ".$hidden_element."><label for='".$name . "_" . $std["style"].$selector_type."'><strong>".$std["title"].$title_addon.":</strong>";
436
  switch ($type){
437
- case "font" : $temp .= '<span class="icon"><i class="fa fa-'.$fonts[$std["style"]].'" aria-hidden="true"></i></span>';break;
438
  }
439
  $temp .= "<select id='". $name . "_" . $std["style"].$selector_type. "' name='cf7stylecustom[". $name . "_" . $std["style"] .$selector_type."]'>";
440
  $temp .= '<option value="">'.__( "Choose value", 'contact-form-7-style' ).'</option>';
@@ -460,6 +134,7 @@ function generate_property_fields( $key, $std, $name, $type, $saved_values, $sel
460
 
461
  $sameElements = array( "width", "height", "background", "margin", "padding", "font", "border", "float", "display", "box-sizing" );
462
  $containerElements = array( "width", "height", "margin", "padding", "font", "border", "float", "box-sizing" );
 
463
  $elements = array(
464
  'form' => array(
465
  'name' => 'form',
@@ -481,6 +156,11 @@ $elements = array(
481
  'description' => '',
482
  'settings' => $containerElements
483
  ),
 
 
 
 
 
484
  'label' => array(
485
  'name' => 'input label',
486
  'description' => 'This section allows styling the input label.',
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
 
 
 
 
 
 
 
6
 
7
+
8
+ $request_json = wp_safe_remote_get( WPCF7S_LOCATION.'/admin/settings-setup.json' );
9
+
10
+
11
+ $options = json_decode( wp_remote_retrieve_body( $request_json ) , true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  /**
14
  * Generate property fields
25
  case 'input':
26
  $field_class = ($current_key == "input") ? "cf7-style-upload-field" : "cf7-style-color-field";
27
  $saved_one = (array_key_exists( $name . "_". $std["style"].$selector_type, $saved_values)) ? $saved_values[ $name . "_". $std["style"].$selector_type] : "";
28
+ return "<li ".$hidden_element."><label for='". $name . "_". $std["style"] .$selector_type."'><strong>".$std["title"].$title_addon.":</strong></label>".(($current_key == "color-picker") ? "<span class='icon smaller'><i class='icon-eyedropper' aria-hidden='true'></i></span>" : "")."<input type='text' id='". $name . "_". $std["style"] .$selector_type."' name='cf7stylecustom[". $name . "_". $std["style"] .$selector_type."]' value='". $saved_one ."' class='".$field_class."' /></li>";
29
  break;
30
  case 'comming-soon':
31
  return "<li></li>";
53
  $incrementor = 0;
54
  $indexer = 0;
55
  $arrows = array('up', 'right', 'down' , 'left');
56
+ $fonts = array( 'font-size' => 'text-height', 'line-height' => 'font', 'text-indent' => 'indent-right');
57
  foreach( $val as $elem_key => $elem_value ) {
58
  if( $std["property"] == "0 0 0 0"){
59
  /*Add new style properties if 4 value property inserted*/
68
  $test = ( $std["style"] == "border-top" || $std["style"] == "border-right" || $std["style"] == "border-bottom" || $std["style"] == "border-left") ? '-width' : '' ;
69
  $saved_one = ( array_key_exists( $name . "_". $std["style"].$test.$selector_type, $saved_values)) ? $saved_values [ $name . "_". $std["style"].$test.$selector_type ] : "";
70
  switch ($type){
71
+ case "width" : $temp .= '<span class="element-wrapper"><span class="icon"><i class="icon-resize-horizontal" aria-hidden="true"></i></span>'; break;
72
+ case "height" : $temp .= '<span class="element-wrapper"><span class="icon"><i class="icon-resize-vertical" aria-hidden="true"></i></span>'; break;
73
+ case "opacity" : $temp .= '<span class="element-wrapper"><span class="icon"><i class="icon-adjust" aria-hidden="true"></i></span>'; break;
74
  case "border" :
75
  case "margin" :
76
+ case "padding": $temp .= '<span class="element-wrapper"><span class="icon"><i class="icon-'.$arrows[$indexer++].'" aria-hidden="true"></i></span>'; break;
77
+ case "font" : $temp .= '<span class="element-wrapper"><span class="icon"><i class="icon-'.$fonts[$std["style"]].'" aria-hidden="true"></i></span>';break;
78
  }
79
  $min_val = ("margin" == $type) ? '-1000' : '0';
80
+ $max_val = ("opacity" == $type) ? '1' : '1000';
81
+ $step_value = ("opacity" == $type) ? '0.01' : '1';
82
+ $temp .= "<input type='number' step='".$step_value."' min='".$min_val."' max='".$max_val."' id='". $name . "_". $std["style"].$test.$selector_type."' name='cf7stylecustom[". $name . "_". $std["style"].$test.$selector_type."]' value='". $saved_one ."' />";
83
+ if( array_key_exists('unit', $std) ) {
84
+ $temp .= "<select id='". $name . "_". $std["style"] .$test . "_unit".$selector_type."' name='cf7stylecustom[". $name . "_". $std["style"] .$test ."_unit".$selector_type."]'>";
85
 
86
+ foreach( $std["unit"] as $unit_val ) {
87
+ $saved_one_unit = ( array_key_exists( $name . "_". $std["style"]. "_unit".$selector_type, $saved_values) ) ? $saved_values[ $name . "_". $std["style"]. "_unit".$selector_type ] : "";
88
+ $temp .= "<option ". selected( $saved_one_unit , $unit_val, false ) . ">". $unit_val ."</option>";
89
+ }
90
 
91
+ $temp .= "</select>";
 
 
92
  }
 
93
  switch ($type){
94
  case "width" :
95
  case "height" :
96
  case "border" :
97
  case "margin" :
98
+ case "padding":
99
+ case "opacity":
100
  case "font" : $temp .= '</span>';break;
101
  }
102
  }
108
  $fonts = array( 'font-style' => 'italic', 'font-weight' => 'bold', 'text-align' => 'align-center', 'text-decoration' => 'underline', 'text-transform' => 'header' );
109
  $temp .= "<li ".$hidden_element."><label for='".$name . "_" . $std["style"].$selector_type."'><strong>".$std["title"].$title_addon.":</strong>";
110
  switch ($type){
111
+ case "font" : $temp .= '<span class="icon"><i class="icon-'.$fonts[$std["style"]].'" aria-hidden="true"></i></span>';break;
112
  }
113
  $temp .= "<select id='". $name . "_" . $std["style"].$selector_type. "' name='cf7stylecustom[". $name . "_" . $std["style"] .$selector_type."]'>";
114
  $temp .= '<option value="">'.__( "Choose value", 'contact-form-7-style' ).'</option>';
134
 
135
  $sameElements = array( "width", "height", "background", "margin", "padding", "font", "border", "float", "display", "box-sizing" );
136
  $containerElements = array( "width", "height", "margin", "padding", "font", "border", "float", "box-sizing" );
137
+ $placeholderElements = array( "placefont", "opacity" );
138
  $elements = array(
139
  'form' => array(
140
  'name' => 'form',
156
  'description' => '',
157
  'settings' => $containerElements
158
  ),
159
+ "placeholder" => array(
160
+ 'name' => 'placeholder',
161
+ 'description' => 'This section allows styling the placholder element of the input fields if present',
162
+ 'settings' => $placeholderElements
163
+ ),
164
  'label' => array(
165
  'name' => 'input label',
166
  'description' => 'This section allows styling the input label.',
predefined-templates.php DELETED
@@ -1,63 +0,0 @@
1
- <?php
2
- $templates_string = '[
3
- {
4
- "title":"Monochrome Light",
5
- "category":"simple pattern style",
6
- "image":"\/admin\/images\/monochrome-light.png"
7
- },
8
- {
9
- "title":"Transparent Two Columns",
10
- "category":"simple pattern style",
11
- "image":"\/admin\/images\/transparent-two-columns.png"
12
- },
13
- {
14
- "title":"Minimal Brown",
15
- "category":"simple pattern style",
16
- "image":"\/admin\/images\/minimal-brown.png"
17
- },
18
- {
19
- "title":"Monochrome",
20
- "category":"simple pattern style",
21
- "image":"\/admin\/images\/monochrome.png"
22
- },
23
- {
24
- "title":"Twenty Fifteen Pattern",
25
- "category":"simple pattern style",
26
- "image":"\/admin\/images\/cf7_simple_twentyfifteen_pattern.jpg"
27
- },
28
- {
29
- "title":"Christmas Classic",
30
- "category":"christmas style",
31
- "image":"\/admin\/images\/cf7_xmas_classic.jpg"
32
- },
33
- {
34
- "title":"Christmas Red",
35
- "category":"christmas style",
36
- "image":"\/admin\/images\/cf7_xmas_red.jpg"
37
- },
38
- {
39
- "title":"Christmas Simple",
40
- "category":"christmas style",
41
- "image":"\/admin\/images\/cf7_xmas_simple.jpg"
42
- },
43
- {
44
- "title":"Valentine\'s Day Classic",
45
- "category":"valentine\'s day style",
46
- "image":"\/admin\/images\/cf7_vday_classic.jpg"
47
- },
48
- {
49
- "title":"Valentine\'s Day Roses",
50
- "category":"valentine\'s day style",
51
- "image":"\/admin\/images\/cf7_vday_roses.jpg"
52
- },
53
- {
54
- "title":"Valentine\'s Day Birds",
55
- "category":"valentine\'s day style",
56
- "image":"\/admin\/images\/cf7_vday_birds.jpg"
57
- },
58
- {
59
- "title":"Valentine\'s Day Blue Birds",
60
- "category":"valentine\'s day style",
61
- "image":"\/admin\/images\/cf7_vday_blue_birds.jpg"
62
- }
63
- ]';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,242 +1,264 @@
1
- === Contact Form 7 Style ===
2
- Contributors: ionut.iclanzan, dorumarginean, mlehelsz, mircear
3
- Donate link: http://cf7style.com/back-this-project/
4
- Tags: contact form 7, contact form 7 style, contact form 7 css, contact form 7 styling, CF7, CF7 style, styling contact form, styling contact form 7, multiple form styling, custom form styling, CF7 addon, customize, templates, valentine's day templates, Christmas templates, manual styling, live preview, hover state styling, CF7 form messages styling
5
- Requires at least: 3.0.1
6
- Tested up to: 4.8
7
- Stable tag: 3.1.2
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- Simple style customization and templating for Contact Form 7 forms. Requires Contact Form 7 plugin installed.
12
-
13
- == Description ==
14
-
15
- [Contact Form 7 Style](http://cf7style.com/) plugin is an addon for [Contact Form 7](http://wordpress.org/plugins/contact-form-7/) which needs to be installed on your WordPress website.
16
- > This plugin requires the <a href="http://wordpress.org/extend/plugins/contact-form-7/" rel="nofollow">Contact Form 7 plugin</a><BR>
17
- <BR>
18
- > <a href="http://cf7style.com/downloads-history/" target="_blank">Downloads history</a> can be checked out on the cf7style.com website.<BR>
19
-
20
- [youtube https://www.youtube.com/watch?v=dByaDeVlmAc]
21
-
22
- Supports custom styling, which can be easily managed via admin dashboard. Also has predefined templates like Simple Pattern, Valentine's Day, Christmas that can be activated on your Contact Form 7. <BR>
23
-
24
-
25
- **Custom style options: <BR>**
26
- - color styling, <BR>
27
- - custom fonts ( google fonts included ), <BR>
28
- - styling for input fields, text, textarea, labels, submit button, messages <BR>
29
- - border-color, <BR>
30
- - form background-color, <BR>
31
- - form transparent background-color, <BR>
32
- - form background-image, <BR>
33
- - form container styling, <BR>
34
- - form container background-image styling, <BR>
35
- - customized style can be imported / exported <BR>
36
- - quick edit option <BR>
37
- - support multiple forms with different design<BR>
38
- - Style Template Slider on the Contact Form 7 form Settings page<BR>
39
- - px,em, % unit selector for all the specified style settings<BR>
40
- - possibility to change the syling for the HOVER state of each element<BR>
41
- - live preview on changing/adding the new style properties of each element<BR>
42
- - possibility to customize error messages, success messages and warning messages<BR>
43
- - setting page, where can re-import deleted default templates, deactivate collecting data and / or manipulate the appearance of the "edit style" button on the page where you have your contact form 7 form<BR>
44
-
45
- <strong>Support can be found [here](https://wordpress.org/support/plugin/contact-form-7-style).</strong>
46
-
47
- or you can check the [FAQ](http://cf7style.com/faq/) section.
48
-
49
-
50
- == Installation ==
51
-
52
- 1. Upload the entire `contact-form-7-style` folder to the `/wp-content/plugins/` directory
53
- 2. Make sure that Contact Form 7 is installed and activated ( an admin notice will check for this )
54
- 3. Activate the plugin through the 'Plugins' menu in WordPress
55
-
56
- You will find 'Contact Style' menu in your WordPress admin panel.
57
-
58
- == Screenshots ==
59
-
60
- 1. The Contact Style main settings page with predefined, responsive Style Templates
61
- 2. Custom new style Settings page with Google Font Selector, live preview and multiple element styling with the possibility to change the settings unit.
62
- 3. Template slider for quick setup of the form styling on the Contact Form 7 Settings Page.
63
- 4. Possibility to remove predefined templates only with 2 clicks.
64
- 5. Quick Edit on the Contact Style Settings Page, which allows Style Apply on various forms in a few seconds away.
65
- 6. Manual CSS Editor on the pages/posts which contains one or more Contact Form 7 forms.
66
- 7. Form Selector on the new Custom Style Setup Page.
67
- 8. Google Font Selector with all the Google Fonts included in one Dropdown with preview on the right side of the Dropdown.
68
- 9. Enable / disable forcing the CSS on the actual setup (it adds !important to every style property changed on the form)
69
- 10. Transparent background
70
-
71
- == Changelog ==
72
-
73
- = 3.1.2 =
74
- * [Small Fix](https://wordpress.org/support/topic/block-disappeared/) de-activated the possibility to drag boxes around
75
- * [Small Fix](https://wordpress.org/support/topic/transparentclear-input-background/) added possibility to add transparent background
76
- * [Small Fix](https://wordpress.org/support/topic/custom-submit-button-settings-not-working/) added new Force CSS settings possibility to plugin
77
- * [Small Fix](https://wordpress.org/support/topic/successfully-sent-message-styles-not-working-properly/) customized styling to remove this issue
78
- * [Small Fix](https://wordpress.org/support/topic/changing-default-padding-and-margins/) added possibility to add 0 padding / 0 margin
79
- * [Small Improvement] Possible to add negative margins on custom templates
80
- * [Small Improvement] Possible to add decimal values for "%" and "em" units
81
- * [Small Improvement] Added tooltip on settings page for better understanding
82
- * general bugfixing
83
- * user interface improvements
84
-
85
- = 3.1.1 =
86
- * [Major Fix](https://wordpress.org/support/topic/custom-styles-not-working/) for custom styles
87
- * [Small Fix] Styling issue on buttons
88
- * [Small Fix] CSS generator core upgraded
89
-
90
- = 3.1.0 =
91
- * [New Feature](https://wordpress.org/support/topic/error-confirmation-message-box-styling?replies=2) Error, confirmation, success message customization added
92
- * [New Feature](https://wordpress.org/support/topic/disabling-the-edit-custom-style-button?replies=2) Added settings field, where you can activate or deactivate the "edit custom style" button
93
- * [Major Improvement] modified settings page field generation, now it will remove every hidden field to improve page load
94
- * [New](https://wordpress.org/support/topic/could-we-have-few-more-ready-skins-pretty-please/) predefined templates available
95
- * [Improvements] for reliability and speed
96
- * User interface improvements
97
- * general bugfixing
98
-
99
- = 3.0.5 =
100
- * [Major Fix](https://wordpress.org/support/topic/headers-already-sent-35?replies=2) Headers already sent
101
- * [Major Fix](https://wordpress.org/support/topic/please-fix-a-googleapi-call-in-your-php?replies=2) SSL security fix for Google Fonts
102
- * [Major Fix] Parse error: syntax error, unexpected T_STATIC
103
- * general bugfixing
104
-
105
-
106
-
107
- = 3.0.4 =
108
- * [Major Fix](https://wordpress.org/support/topic/problem-with-css-editor?replies=2) Fixed CSS editor "\" multiplier removed
109
- * [Major Fix] Collection data functionality to prevent fatal error for various server setups
110
- * [Major Fix] Prevent existing style data loss based on a new versioning system functionality
111
- * [Improvement] Publish or Update Style button
112
- * New feature - System Status page with the possibility to ask for help from the Contact Form 7 Style team by email
113
- * New feature - Settings page - Install predefined templates or Allow collection data
114
- * General bugfixing
115
-
116
-
117
- = 3.0.3 =
118
- * [Major Fix](https://wordpress.org/support/topic/existing-styling-deleted?replies=3) JQuery conflict with Siteorigin Page Builder and Visual Composer
119
-
120
-
121
- = 3.0.2 =
122
- * [Major Fix](https://wordpress.org/support/topic/does-not-work-639?replies=7)
123
- * [Collection data settings page](https://wordpress.org/support/topic/how-to-disable-data-collection?replies=2)
124
- * New feature - generate cf7 form preview buttons added when creating new custom style
125
- * Improvements - preview generations on various user interactions
126
- * Improvements - general bugfixing
127
-
128
- = 3.0.1 =
129
- * New feature - width and height styling properties for radio elements
130
- * New feature - width and height styling properties for checkbox elements
131
- * Improvements - general bugfixing
132
-
133
- = 3.0.0 =
134
- * UI rework, update, redesign
135
- * New feature - Live Preview on all element changes with the actual Contact Form 7 form where the styling is applied
136
- * New feature - Hover state design for all elements
137
- * New feature - Style Selector Slider on Contact Form 7 Settings page, for quick style selection
138
- * New feature - Introduced new unit selector
139
- * New feature - Introduced new background-image add-on
140
- * New feature - Introduced new styling properties
141
- * New feature - Introduced fieldset, dropdowns, radio, checkbox
142
- * Improvements - Bugfixing, running process, code updates
143
- * Improvements - Modified Custom Styling logic and add it to new settings page
144
- * Improvements - Message boxes behaviour
145
- * Improvements - autocomplete styling where possible
146
-
147
- = 2.2.8 =
148
- * Optimize responsive view for predefined templates on mobile devices
149
- * Added Invitora WordPress Theme compatibility
150
- * Added support for special characters and fixed bugs
151
-
152
- = 2.2.7 =
153
- * Improvements for reliability and speed
154
- * Enhanced plugin stability and fixed bugs
155
- * Added Bretheon Premium WordPress Theme compatibility
156
-
157
- = 2.2.6 =
158
- * Added Avada Theme compatibility
159
- * Added Bridge - Creative Multi-Purpose WordPress Theme compatibility
160
- * Added Flatco - Multipurpose & Responsive WordPress Theme compatibility
161
- * Improve CSS Editor UI
162
-
163
- = 2.2.5 =
164
- * [Fixed](https://wordpress.org/support/topic/avada-theme-5) Avada Theme Fusion Page Builder incompatibility issue
165
- * [Fixed](https://wordpress.org/support/topic/good-morning-1) Contact form 7 shortcode detection for Flatco - Multipurpose & Responsive WordPress Theme
166
- * Improve plugin installer process
167
-
168
-
169
- = 2.2.4 =
170
- * New feature - ability to add your own custom css rules
171
- * [Fixed](https://wordpress.org/support/topic/textarea-height-and-submit-width) textarea and submit button on focus issue
172
-
173
- = 2.2.3 =
174
- * [Fixed](https://wordpress.org/support/topic/style-doesnt-apply-to-an-existing-form) simple template style issue
175
-
176
- = 2.2.2 =
177
- * Minor JQuery fixes for newer wordpress version
178
- * Fixed custom style for textarea selector
179
- * Admin panel minor adjustments
180
-
181
- = 2.2.1 =
182
- * New feature - textarea field additional options
183
- * [Fixed](https://wordpress.org/support/topic/field-style-issue?replies=6) textarea field style issue
184
-
185
- = 2.2 =
186
- * Fixed Chrome preview problem
187
- * Removed unnecessary elements from nav menus
188
- * Fixed custom style no title problem
189
- * [Fixed](https://wordpress.org/support/topic/custom-style-is-not-working?replies=6) css class generator
190
- * New feature - Added quick edit
191
- * New feature - Added new simple pattern style category with Twenty Fifteen Pattern
192
-
193
- = 2.1.1 =
194
- * Minor JQuery fixes for older wordpress version
195
-
196
- = 2.1 =
197
- * New feature - Google fonts preview when edit the style
198
- * New feature - List all styles thumbnail preview for predefined templates
199
-
200
- = 2.0.1 =
201
- * Admin panel minor adjustments
202
-
203
- = 2.0 =
204
- * New UI Admin settings options
205
- * Use custom post type for individual style set up
206
- * Multiple cf7 forms can have their own style
207
- * Style can be activated only for certain cf7 forms
208
- * All google fonts available for use
209
- * Styling improvement for theme twentyfifteen, twentyfourteen
210
- * New settings available
211
- * Possibility to change certain settings for the "custom style" styles
212
- * Style filtering by categories for easier use
213
- * Possibility to save your settings and import / export the generated "custom style"
214
- * Donate option for support the plugin's continued development and better user support
215
-
216
- = 1.1.1 =
217
- * Added plugin update notification in plugin template selection panel
218
-
219
- = 1.1.0 =
220
- * Added Valentine's Day templates for 2014.
221
- * Fixed Xmas Red header and footer position
222
- * Added Custom Style submenu for styling the templates
223
-
224
- = 1.0.1 =
225
- * Fixed x-mas classic display on 2014 wordpress theme.
226
-
227
- = 1.0 =
228
- * First plugin version.
229
-
230
- == Upgrade Notice ==
231
- = Contact Form 7 Style Version 3.1.2 =
232
-
233
- * [Small Fix](https://wordpress.org/support/topic/block-disappeared/) de-activated the possibility to drag boxes around
234
- * [Small Fix](https://wordpress.org/support/topic/transparentclear-input-background/) added possibility to add transparent background
235
- * [Small Fix](https://wordpress.org/support/topic/custom-submit-button-settings-not-working/) added new Force CSS settings possibility to plugin
236
- * [Small Fix](https://wordpress.org/support/topic/successfully-sent-message-styles-not-working-properly/) customized styling to remove this issue
237
- * [Small Fix](https://wordpress.org/support/topic/changing-default-padding-and-margins/) added possibility to add 0 padding / 0 margin
238
- * [Small Improvement] Possible to add negative margins on custom templates
239
- * [Small Improvement] Possible to add decimal values for "%" and "em" units
240
- * [Small Improvement] Added tooltip settings for better explanations
241
- * general bugfixing
242
- * user interface improvements
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Contact Form 7 Style ===
2
+ Contributors: ionut.iclanzan, dorumarginean, mlehelsz, mircear
3
+ Donate link: http://cf7style.com/back-this-project/
4
+ Tags: contact form 7, contact form 7 style, contact form 7 templates, contact form 7 styling, CF7, CF7 style, styling contact form, styling contact form 7, multiple form styling, custom form styling, CF7 addon, customize, templates, valentine's day templates, Christmas templates, manual styling, live preview, hover state styling, CF7 form messages styling
5
+ Requires at least: 3.0.1
6
+ Tested up to: 4.8
7
+ Stable tag: 3.1.3
8
+ Requires PHP: 5.6.0
9
+ License: GPLv2 or later
10
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
+
12
+ Simple style customization and templating for Contact Form 7 forms. Requires Contact Form 7 plugin installed.
13
+
14
+ == Description ==
15
+
16
+ [Contact Form 7 Style](http://cf7style.com/) plugin is an addon for [Contact Form 7](http://wordpress.org/plugins/contact-form-7/) which needs to be installed on your WordPress website.
17
+ > This plugin requires the <a href="http://wordpress.org/extend/plugins/contact-form-7/" rel="nofollow">Contact Form 7 plugin</a><BR>
18
+ <BR>
19
+ > <a href="http://cf7style.com/downloads-history/" target="_blank">Downloads history</a> can be checked out on the cf7style.com website.<BR>
20
+
21
+ [youtube https://www.youtube.com/watch?v=dByaDeVlmAc]
22
+
23
+ Supports custom styling, which can be easily managed via admin dashboard. Also has predefined templates like Simple Pattern, Valentine's Day, Christmas that can be activated on your Contact Form 7. <BR>
24
+
25
+
26
+ **Custom style options: <BR>**
27
+ - color styling, <BR>
28
+ - custom fonts ( google fonts included ), <BR>
29
+ - styling for input fields, text, textarea, labels, submit button, messages, placeholders, <BR>
30
+ - border-color, <BR>
31
+ - form background-color, <BR>
32
+ - form transparent background-color, <BR>
33
+ - form background-image, <BR>
34
+ - form container styling, <BR>
35
+ - form container background-image styling, <BR>
36
+ - form placeholder opacity styling, <BR>
37
+ - customized style can be imported / exported <BR>
38
+ - quick edit option <BR>
39
+ - support multiple forms with different design<BR>
40
+ - Style Template Slider on the Contact Form 7 form Settings page<BR>
41
+ - px,em, % unit selector for all the specified style settings<BR>
42
+ - possibility to change the syling for the HOVER state of each element<BR>
43
+ - live preview on changing/adding the new style properties of each element<BR>
44
+ - possibility to customize error messages, success messages and warning messages<BR>
45
+ - setting page, where can re-import deleted default templates, deactivate collecting data and / or manipulate the appearance of the "edit style" button on the page where you have your contact form 7 form<BR>
46
+
47
+ <strong>Support can be found [here](https://wordpress.org/support/plugin/contact-form-7-style).</strong>
48
+
49
+ or you can check the [FAQ](http://cf7style.com/faq/) section.
50
+
51
+
52
+ == Installation ==
53
+
54
+ 1. Upload the entire `contact-form-7-style` folder to the `/wp-content/plugins/` directory
55
+ 2. Make sure that Contact Form 7 is installed and activated ( an admin notice will check for this )
56
+ 3. Activate the plugin through the 'Plugins' menu in WordPress
57
+
58
+ You will find 'Contact Style' menu in your WordPress admin panel.
59
+
60
+ == Screenshots ==
61
+
62
+ 1. The Contact Style main settings page with predefined, responsive Style Templates
63
+ 2. Custom new style Settings page with Google Font Selector, live preview and multiple element styling with the possibility to change the settings unit.
64
+ 3. Template slider for quick setup of the form styling on the Contact Form 7 Settings Page.
65
+ 4. Possibility to remove predefined templates only with 2 clicks.
66
+ 5. Quick Edit on the Contact Style Settings Page, which allows Style Apply on various forms in a few seconds away.
67
+ 6. Manual CSS Editor on the pages/posts which contains one or more Contact Form 7 forms.
68
+ 7. Form Selector on the new Custom Style Setup Page.
69
+ 8. Google Font Selector with all the Google Fonts included in one Dropdown with preview on the right side of the Dropdown.
70
+ 9. Enable / disable forcing the CSS on the actual setup (it adds !important to every style property changed on the form)
71
+ 10. Transparent background
72
+
73
+ == Frequently Asked Questions ==
74
+
75
+ Please check our FAQ page where you'll find answers to some of your questions on [cf7style.com/faq/](http://cf7style.com/faq/).
76
+
77
+ == Changelog ==
78
+
79
+ = 3.1.3 =
80
+
81
+ Release Date: November 3rd, 2017
82
+
83
+ * [New Feature] Placeholder elements styling and hover too + preview generate
84
+ * [New Feature] Opacity settings for placeholders
85
+ * [Improvement] Updated fonticons
86
+ * [Improvement] Contact Form 7 "Go To CF7" button to edit form structure
87
+ * [Improvement] Notifications handling modified
88
+ * [Improvement] Removed transparent checkbox from font color
89
+ * [Improvement] Updated plugin file structure for better code management
90
+ * [Improvement] JSON files for plugin settings
91
+ * [Major Fix] Works with PHP 7
92
+ * [Major Fix] Compatible with WordPress Multisite
93
+ * [Major Fix] Refactored style generator
94
+ * General bugfixing
95
+
96
+
97
+
98
+ = 3.1.2 =
99
+ * [Small Fix](https://wordpress.org/support/topic/block-disappeared/) de-activated the possibility to drag boxes around
100
+ * [Small Fix](https://wordpress.org/support/topic/transparentclear-input-background/) added possibility to add transparent background
101
+ * [Small Fix](https://wordpress.org/support/topic/custom-submit-button-settings-not-working/) added new Force CSS settings possibility to plugin
102
+ * [Small Fix](https://wordpress.org/support/topic/successfully-sent-message-styles-not-working-properly/) customized styling to remove this issue
103
+ * [Small Fix](https://wordpress.org/support/topic/changing-default-padding-and-margins/) added possibility to add 0 padding / 0 margin
104
+ * [Small Improvement] Possible to add negative margins on custom templates
105
+ * [Small Improvement] Possible to add decimal values for "%" and "em" units
106
+ * [Small Improvement] Added tooltip on settings page for better understanding
107
+ * general bugfixing
108
+ * user interface improvements
109
+
110
+ = 3.1.1 =
111
+ * [Major Fix](https://wordpress.org/support/topic/custom-styles-not-working/) for custom styles
112
+ * [Small Fix] Styling issue on buttons
113
+ * [Small Fix] CSS generator core upgraded
114
+
115
+ = 3.1.0 =
116
+ * [New Feature](https://wordpress.org/support/topic/error-confirmation-message-box-styling?replies=2) Error, confirmation, success message customization added
117
+ * [New Feature](https://wordpress.org/support/topic/disabling-the-edit-custom-style-button?replies=2) Added settings field, where you can activate or deactivate the "edit custom style" button
118
+ * [Major Improvement] modified settings page field generation, now it will remove every hidden field to improve page load
119
+ * [New](https://wordpress.org/support/topic/could-we-have-few-more-ready-skins-pretty-please/) predefined templates available
120
+ * [Improvements] for reliability and speed
121
+ * User interface improvements
122
+ * general bugfixing
123
+
124
+ = 3.0.5 =
125
+ * [Major Fix](https://wordpress.org/support/topic/headers-already-sent-35?replies=2) Headers already sent
126
+ * [Major Fix](https://wordpress.org/support/topic/please-fix-a-googleapi-call-in-your-php?replies=2) SSL security fix for Google Fonts
127
+ * [Major Fix] Parse error: syntax error, unexpected T_STATIC
128
+ * general bugfixing
129
+
130
+ = 3.0.4 =
131
+ * [Major Fix](https://wordpress.org/support/topic/problem-with-css-editor?replies=2) Fixed CSS editor "\" multiplier removed
132
+ * [Major Fix] Collection data functionality to prevent fatal error for various server setups
133
+ * [Major Fix] Prevent existing style data loss based on a new versioning system functionality
134
+ * [Improvement] Publish or Update Style button
135
+ * New feature - System Status page with the possibility to ask for help from the Contact Form 7 Style team by email
136
+ * New feature - Settings page - Install predefined templates or Allow collection data
137
+ * General bugfixing
138
+
139
+ = 3.0.3 =
140
+ * [Major Fix](https://wordpress.org/support/topic/existing-styling-deleted?replies=3) JQuery conflict with Siteorigin Page Builder and Visual Composer
141
+
142
+ = 3.0.2 =
143
+ * [Major Fix](https://wordpress.org/support/topic/does-not-work-639?replies=7)
144
+ * [Collection data settings page](https://wordpress.org/support/topic/how-to-disable-data-collection?replies=2)
145
+ * New feature - generate cf7 form preview buttons added when creating new custom style
146
+ * Improvements - preview generations on various user interactions
147
+ * Improvements - general bugfixing
148
+
149
+ = 3.0.1 =
150
+ * New feature - width and height styling properties for radio elements
151
+ * New feature - width and height styling properties for checkbox elements
152
+ * Improvements - general bugfixing
153
+
154
+ = 3.0.0 =
155
+ * UI rework, update, redesign
156
+ * New feature - Live Preview on all element changes with the actual Contact Form 7 form where the styling is applied
157
+ * New feature - Hover state design for all elements
158
+ * New feature - Style Selector Slider on Contact Form 7 Settings page, for quick style selection
159
+ * New feature - Introduced new unit selector
160
+ * New feature - Introduced new background-image add-on
161
+ * New feature - Introduced new styling properties
162
+ * New feature - Introduced fieldset, dropdowns, radio, checkbox
163
+ * Improvements - Bugfixing, running process, code updates
164
+ * Improvements - Modified Custom Styling logic and add it to new settings page
165
+ * Improvements - Message boxes behaviour
166
+ * Improvements - autocomplete styling where possible
167
+
168
+ = 2.2.8 =
169
+ * Optimize responsive view for predefined templates on mobile devices
170
+ * Added Invitora WordPress Theme compatibility
171
+ * Added support for special characters and fixed bugs
172
+
173
+ = 2.2.7 =
174
+ * Improvements for reliability and speed
175
+ * Enhanced plugin stability and fixed bugs
176
+ * Added Bretheon Premium WordPress Theme compatibility
177
+
178
+ = 2.2.6 =
179
+ * Added Avada Theme compatibility
180
+ * Added Bridge - Creative Multi-Purpose WordPress Theme compatibility
181
+ * Added Flatco - Multipurpose & Responsive WordPress Theme compatibility
182
+ * Improve CSS Editor UI
183
+
184
+ = 2.2.5 =
185
+ * [Fixed](https://wordpress.org/support/topic/avada-theme-5) Avada Theme Fusion Page Builder incompatibility issue
186
+ * [Fixed](https://wordpress.org/support/topic/good-morning-1) Contact form 7 shortcode detection for Flatco - Multipurpose & Responsive WordPress Theme
187
+ * Improve plugin installer process
188
+
189
+ = 2.2.4 =
190
+ * New feature - ability to add your own custom css rules
191
+ * [Fixed](https://wordpress.org/support/topic/textarea-height-and-submit-width) textarea and submit button on focus issue
192
+
193
+ = 2.2.3 =
194
+ * [Fixed](https://wordpress.org/support/topic/style-doesnt-apply-to-an-existing-form) simple template style issue
195
+
196
+ = 2.2.2 =
197
+ * Minor JQuery fixes for newer wordpress version
198
+ * Fixed custom style for textarea selector
199
+ * Admin panel minor adjustments
200
+
201
+ = 2.2.1 =
202
+ * New feature - textarea field additional options
203
+ * [Fixed](https://wordpress.org/support/topic/field-style-issue?replies=6) textarea field style issue
204
+
205
+ = 2.2 =
206
+ * Fixed Chrome preview problem
207
+ * Removed unnecessary elements from nav menus
208
+ * Fixed custom style no title problem
209
+ * [Fixed](https://wordpress.org/support/topic/custom-style-is-not-working?replies=6) css class generator
210
+ * New feature - Added quick edit
211
+ * New feature - Added new simple pattern style category with Twenty Fifteen Pattern
212
+
213
+ = 2.1.1 =
214
+ * Minor JQuery fixes for older wordpress version
215
+
216
+ = 2.1 =
217
+ * New feature - Google fonts preview when edit the style
218
+ * New feature - List all styles thumbnail preview for predefined templates
219
+
220
+ = 2.0.1 =
221
+ * Admin panel minor adjustments
222
+
223
+ = 2.0 =
224
+ * New UI Admin settings options
225
+ * Use custom post type for individual style set up
226
+ * Multiple cf7 forms can have their own style
227
+ * Style can be activated only for certain cf7 forms
228
+ * All google fonts available for use
229
+ * Styling improvement for theme twentyfifteen, twentyfourteen
230
+ * New settings available
231
+ * Possibility to change certain settings for the "custom style" styles
232
+ * Style filtering by categories for easier use
233
+ * Possibility to save your settings and import / export the generated "custom style"
234
+ * Donate option for support the plugin's continued development and better user support
235
+
236
+ = 1.1.1 =
237
+ * Added plugin update notification in plugin template selection panel
238
+
239
+ = 1.1.0 =
240
+ * Added Valentine's Day templates for 2014.
241
+ * Fixed Xmas Red header and footer position
242
+ * Added Custom Style submenu for styling the templates
243
+
244
+ = 1.0.1 =
245
+ * Fixed x-mas classic display on 2014 wordpress theme.
246
+
247
+ = 1.0 =
248
+ * First plugin version.
249
+
250
+ == Upgrade Notice ==
251
+ = Contact Form 7 Style Version 3.1.3 =
252
+
253
+ * [New Feature] Placeholder elements styling and hover too + preview generate
254
+ * [New Feature] Opacity settings for placeholders
255
+ * [Improvement] Updated fonticons
256
+ * [Improvement] Contact Form 7 "Go To CF7" button to edit form structure
257
+ * [Improvement] Notifications handling modified
258
+ * [Improvement] Removed transparent checkbox from font color
259
+ * [Improvement] Updated plugin file structure for better code management
260
+ * [Improvement] JSON files for plugin settings
261
+ * [Major Fix] Works with PHP 7
262
+ * [Major Fix] Compatible with WordPress Multisite
263
+ * [Major Fix] Refactored style generator
264
+ * General bugfixing