MailChimp for WordPress - Version 3.1.5

Version Description

Download this release

Release Info

Developer DvanKooten
Plugin Icon 128x128 MailChimp for WordPress
Version 3.1.5
Comparing to
See all releases

Code changes from version 3.1.4 to 3.1.5

CHANGELOG.md CHANGED
@@ -1,6 +1,24 @@
1
  Changelog
2
  =========
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  #### 3.1.4 - February 29, 2016
5
 
6
  **Fixes**
1
  Changelog
2
  =========
3
 
4
+ #### 3.1.5 - March 22, 2016
5
+
6
+ **Fixes**
7
+
8
+ - Response message was shown for unsubmitted forms when using `{response}` in the form mark-up with multiple forms on the same page.
9
+
10
+ **Improvements**
11
+
12
+ - Scroll to form after form submission now uses native browser method `scrollIntoView()`.
13
+ - Various improvements for right-to-left (RTL) sites.
14
+ - The MailChimp API key is now obfuscated on the settings page.
15
+ - Contact Form 7 integration now uses an early hook priority to ensure we run before any page redirects.
16
+
17
+ **Additions**
18
+
19
+ - Add position option for WooCommerce integration.
20
+ - Add `{post}` tag whch can be used in form mark-up to fetch properties of the current page or post.
21
+
22
  #### 3.1.4 - February 29, 2016
23
 
24
  **Fixes**
assets/css/admin-styles.css CHANGED
@@ -17,7 +17,7 @@
17
  /* The rest of this file contains styles related to the mechanics of
18
  the editor. You probably shouldn't touch them. */
19
  /* The fake, visible scrollbars. Used to force redraw during scrolling
20
- before actuall scrolling happens, thus preventing shaking and
21
  flickering artifacts. */
22
  /* Force content-box sizing for the elements where we expect it */
23
  /* IE7 hack to prevent it from returning funny offsetTops on the spans */
@@ -401,6 +401,7 @@
401
  white-space: normal;
402
  height: 100%;
403
  display: inline-block;
 
404
  margin-bottom: -30px;
405
  /* Hack to make IE7 behave */
406
  *zoom: 1;
@@ -709,3 +710,19 @@
709
  right: 0;
710
  bottom: 0;
711
  top: 0; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  /* The rest of this file contains styles related to the mechanics of
18
  the editor. You probably shouldn't touch them. */
19
  /* The fake, visible scrollbars. Used to force redraw during scrolling
20
+ before actual scrolling happens, thus preventing shaking and
21
  flickering artifacts. */
22
  /* Force content-box sizing for the elements where we expect it */
23
  /* IE7 hack to prevent it from returning funny offsetTops on the spans */
401
  white-space: normal;
402
  height: 100%;
403
  display: inline-block;
404
+ vertical-align: top;
405
  margin-bottom: -30px;
406
  /* Hack to make IE7 behave */
407
  *zoom: 1;
710
  right: 0;
711
  bottom: 0;
712
  top: 0; }
713
+
714
+ .rtl .overlay .close {
715
+ right: auto;
716
+ left: 0; }
717
+
718
+ .rtl #mc4wp-admin .page-title {
719
+ background-position: right center;
720
+ padding-left: 0;
721
+ padding-right: 42px; }
722
+
723
+ .rtl #mc4wp-admin .CodeMirror-scroll {
724
+ overflow-y: hidden !important; }
725
+
726
+ .rtl #mc4wp-admin .CodeMirror-vscrollbar {
727
+ left: 0 !important;
728
+ right: auto !important; }
assets/css/admin-styles.min.css CHANGED
@@ -1 +1 @@
1
- #mc4wp-admin .cm-em,#mc4wp-admin .help,.mc4wp-admin .cm-em,.mc4wp-admin .help{font-style:italic}#mc4wp-admin .row,.mc4wp-admin .row{margin:20px -20px}#mc4wp-admin .row:after,.mc4wp-admin .row:after{content:"";clear:both;display:table}#mc4wp-admin .row .col,.mc4wp-admin .row .col{padding:0 20px;float:left;-webkit-box-sizing:border-box;box-sizing:border-box}#mc4wp-admin .row .col-1,.mc4wp-admin .row .col-1{width:16.666%}#mc4wp-admin .row .col-2,.mc4wp-admin .row .col-2{width:33.333%}#mc4wp-admin .row .col-3,.mc4wp-admin .row .col-3{width:50%}#mc4wp-admin .row .col-4,.mc4wp-admin .row .col-4{width:66.666%}#mc4wp-admin .row .col-5,.mc4wp-admin .row .col-5{width:83.333%}#mc4wp-admin .field-wizard td.stretch,#mc4wp-admin .row .col-6,.mc4wp-admin .field-wizard td.stretch,.mc4wp-admin .row .col-6,.overlay{width:100%}@media (max-width:1200px){#mc4wp-admin .row .col,.mc4wp-admin .row .col{width:100%;float:none;margin:20px 0}}#mc4wp-admin .status,.mc4wp-admin .status{display:inline-block;margin-left:1em;padding:3px 6px;color:#fff;font-size:12px;font-weight:700}#mc4wp-admin .status.positive,.mc4wp-admin .status.positive{background-color:#32cd32}#mc4wp-admin .status.negative,.mc4wp-admin .status.negative{background-color:red}#mc4wp-admin .status.neutral,.mc4wp-admin .status.neutral{background:gray}#mc4wp-admin .valigntop,.mc4wp-admin .valigntop{vertical-align:top!important}#mc4wp-admin .field-wizard .dashicons,#mc4wp-admin .field-wizard td,#mc4wp-admin .field-wizard tr,.mc4wp-admin .field-wizard .dashicons,.mc4wp-admin .field-wizard td,.mc4wp-admin .field-wizard tr{vertical-align:middle}#mc4wp-admin .big-margin,.mc4wp-admin .big-margin{margin:60px 0}#mc4wp-admin .medium-margin,.mc4wp-admin .medium-margin{margin:40px 0}#mc4wp-admin .small-margin,.mc4wp-admin .small-margin{margin:20px 0}#mc4wp-admin .hover-activated,.mc4wp-admin .hover-activated{opacity:.5}#mc4wp-admin .hover-activated:hover,.mc4wp-admin .hover-activated:hover{cursor:pointer;opacity:1}#mc4wp-admin .help-text,.mc4wp-admin .help-text{font-size:14px}#mc4wp-admin .help-text p,.mc4wp-admin .help-text p{margin:10px 0;font-size:14px}#mc4wp-admin .help-text ul,.mc4wp-admin .help-text ul{list-style:square;margin-top:15px;padding-left:40px}#mc4wp-admin .muted,.mc4wp-admin .muted{color:#aaa}#mc4wp-admin .red,.mc4wp-admin .red{color:red}#mc4wp-admin .green,.mc4wp-admin .green{color:#32cd32}#mc4wp-admin .mc4wp-notice,.mc4wp-admin .mc4wp-notice{padding:6px 12px;color:#31708f;background:#d9edf7;border:1px solid #bce8f1;margin:1em 0!important}#mc4wp-admin .column-ID,.mc4wp-admin .column-ID{width:10%}#mc4wp-admin .block,.mc4wp-admin .block{display:block}#mc4wp-admin .code-sample,.mc4wp-admin .code-sample{font-family:Consolas,Monaco,Lucida Console,monospace;font-size:12px;background:#fff}#mc4wp-admin .breadcrumbs,.mc4wp-admin .breadcrumbs{border-bottom:1px solid #ccc;padding-bottom:1em}#mc4wp-admin .tab,.mc4wp-admin .tab{display:none}#mc4wp-admin .tab.tab-active,.mc4wp-admin .tab.tab-active{display:block}#mc4wp-admin .tab h2,.mc4wp-admin .tab h2{margin-top:20px}#mc4wp-admin .CodeMirror,.mc4wp-admin .CodeMirror{font-family:monospace;height:300px;color:#000}#mc4wp-admin .CodeMirror-lines,.mc4wp-admin .CodeMirror-lines{padding:4px 0}#mc4wp-admin .CodeMirror pre,.mc4wp-admin .CodeMirror pre{padding:0 4px}#mc4wp-admin .CodeMirror-gutter-filler,#mc4wp-admin .CodeMirror-scrollbar-filler,.mc4wp-admin .CodeMirror-gutter-filler,.mc4wp-admin .CodeMirror-scrollbar-filler{background-color:#fff}#mc4wp-admin .CodeMirror-gutters,.mc4wp-admin .CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}#mc4wp-admin .CodeMirror-linenumber,.mc4wp-admin .CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}#mc4wp-admin .CodeMirror-guttermarker,.mc4wp-admin .CodeMirror-guttermarker{color:#000}#mc4wp-admin .CodeMirror-guttermarker-subtle,.mc4wp-admin .CodeMirror-guttermarker-subtle{color:#999}#mc4wp-admin .CodeMirror-cursor,.mc4wp-admin .CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}#mc4wp-admin .CodeMirror div.CodeMirror-secondarycursor,.mc4wp-admin .CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}#mc4wp-admin .cm-fat-cursor .CodeMirror-cursor,.mc4wp-admin .cm-fat-cursor .CodeMirror-cursor{width:auto;border:0;background:#7e7}#mc4wp-admin .cm-fat-cursor div.CodeMirror-cursors,.mc4wp-admin .cm-fat-cursor div.CodeMirror-cursors{z-index:1}#mc4wp-admin .cm-animate-fat-cursor,.mc4wp-admin .cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite;background-color:#7e7}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}#mc4wp-admin .cm-tab,.mc4wp-admin .cm-tab{display:inline-block;text-decoration:inherit}#mc4wp-admin .CodeMirror-ruler,.mc4wp-admin .CodeMirror-ruler{border-left:1px solid #ccc;position:absolute}#mc4wp-admin .cm-s-default .cm-header,.mc4wp-admin .cm-s-default .cm-header{color:#00f}#mc4wp-admin .cm-s-default .cm-quote,.mc4wp-admin .cm-s-default .cm-quote{color:#090}#mc4wp-admin .cm-negative,.mc4wp-admin .cm-negative{color:#d44}#mc4wp-admin .cm-positive,.mc4wp-admin .cm-positive{color:#292}#mc4wp-admin .cm-header,#mc4wp-admin .cm-strong,.mc4wp-admin .cm-header,.mc4wp-admin .cm-strong{font-weight:700}#mc4wp-admin .cm-link,.mc4wp-admin .cm-link{text-decoration:underline}#mc4wp-admin .cm-strikethrough,.mc4wp-admin .cm-strikethrough{text-decoration:line-through}#mc4wp-admin .cm-s-default .cm-keyword,.mc4wp-admin .cm-s-default .cm-keyword{color:#708}#mc4wp-admin .cm-s-default .cm-atom,.mc4wp-admin .cm-s-default .cm-atom{color:#219}#mc4wp-admin .cm-s-default .cm-number,.mc4wp-admin .cm-s-default .cm-number{color:#164}#mc4wp-admin .cm-s-default .cm-def,.mc4wp-admin .cm-s-default .cm-def{color:#00f}#mc4wp-admin .cm-s-default .cm-variable-2,.mc4wp-admin .cm-s-default .cm-variable-2{color:#05a}#mc4wp-admin .cm-s-default .cm-variable-3,.mc4wp-admin .cm-s-default .cm-variable-3{color:#085}#mc4wp-admin .cm-s-default .cm-comment,.mc4wp-admin .cm-s-default .cm-comment{color:#a50}#mc4wp-admin .cm-s-default .cm-string,.mc4wp-admin .cm-s-default .cm-string{color:#a11}#mc4wp-admin .cm-s-default .cm-string-2,.mc4wp-admin .cm-s-default .cm-string-2{color:#f50}#mc4wp-admin .cm-s-default .cm-meta,#mc4wp-admin .cm-s-default .cm-qualifier,.mc4wp-admin .cm-s-default .cm-meta,.mc4wp-admin .cm-s-default .cm-qualifier{color:#555}#mc4wp-admin .cm-s-default .cm-builtin,.mc4wp-admin .cm-s-default .cm-builtin{color:#30a}#mc4wp-admin .cm-s-default .cm-bracket,.mc4wp-admin .cm-s-default .cm-bracket{color:#997}#mc4wp-admin .cm-s-default .cm-tag,.mc4wp-admin .cm-s-default .cm-tag{color:#170}#mc4wp-admin .cm-s-default .cm-attribute,.mc4wp-admin .cm-s-default .cm-attribute{color:#00c}#mc4wp-admin .cm-s-default .cm-hr,.mc4wp-admin .cm-s-default .cm-hr{color:#999}#mc4wp-admin .cm-s-default .cm-link,.mc4wp-admin .cm-s-default .cm-link{color:#00c}#mc4wp-admin .cm-invalidchar,#mc4wp-admin .cm-s-default .cm-error,.mc4wp-admin .cm-invalidchar,.mc4wp-admin .cm-s-default .cm-error{color:red}#mc4wp-admin .CodeMirror-composing,.mc4wp-admin .CodeMirror-composing{border-bottom:2px solid}#mc4wp-admin div.CodeMirror span.CodeMirror-matchingbracket,.mc4wp-admin div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}#mc4wp-admin div.CodeMirror span.CodeMirror-nonmatchingbracket,.mc4wp-admin div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}#mc4wp-admin .CodeMirror-matchingtag,.mc4wp-admin .CodeMirror-matchingtag{background:rgba(255,150,0,.3)}#mc4wp-admin .CodeMirror-activeline-background,.mc4wp-admin .CodeMirror-activeline-background{background:#e8f2ff}#mc4wp-admin .CodeMirror,.mc4wp-admin .CodeMirror{position:relative;overflow:hidden;background:#fff}#mc4wp-admin .CodeMirror-scroll,.mc4wp-admin .CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:0;position:relative}#mc4wp-admin .CodeMirror-sizer,.mc4wp-admin .CodeMirror-sizer{position:relative;border-right:30px solid transparent}#mc4wp-admin .CodeMirror-gutter-filler,#mc4wp-admin .CodeMirror-hscrollbar,#mc4wp-admin .CodeMirror-scrollbar-filler,#mc4wp-admin .CodeMirror-vscrollbar,.mc4wp-admin .CodeMirror-gutter-filler,.mc4wp-admin .CodeMirror-hscrollbar,.mc4wp-admin .CodeMirror-scrollbar-filler,.mc4wp-admin .CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}#mc4wp-admin .CodeMirror-vscrollbar,.mc4wp-admin .CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}#mc4wp-admin .CodeMirror-hscrollbar,.mc4wp-admin .CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}#mc4wp-admin .CodeMirror-scrollbar-filler,.mc4wp-admin .CodeMirror-scrollbar-filler{right:0;bottom:0}#mc4wp-admin .CodeMirror-gutter-filler,.mc4wp-admin .CodeMirror-gutter-filler{left:0;bottom:0}#mc4wp-admin .CodeMirror-gutters,.mc4wp-admin .CodeMirror-gutters{position:absolute;left:0;top:0;z-index:3}#mc4wp-admin .CodeMirror-gutter,.mc4wp-admin .CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;margin-bottom:-30px}#mc4wp-admin .CodeMirror-gutter-wrapper,.mc4wp-admin .CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important;-webkit-user-select:none;-moz-user-select:none;user-select:none}#mc4wp-admin .CodeMirror-gutter-background,.mc4wp-admin .CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}#mc4wp-admin .CodeMirror-gutter-elt,.mc4wp-admin .CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}#mc4wp-admin .CodeMirror-lines,.mc4wp-admin .CodeMirror-lines{cursor:text;min-height:1px}#mc4wp-admin .CodeMirror pre,.mc4wp-admin .CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent}#mc4wp-admin .CodeMirror-wrap pre,.mc4wp-admin .CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}#mc4wp-admin .CodeMirror-linebackground,.mc4wp-admin .CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}#mc4wp-admin .CodeMirror-linewidget,.mc4wp-admin .CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}#mc4wp-admin .CodeMirror-code,.mc4wp-admin .CodeMirror-code{outline:0}#mc4wp-admin .CodeMirror-gutter,#mc4wp-admin .CodeMirror-gutters,#mc4wp-admin .CodeMirror-linenumber,#mc4wp-admin .CodeMirror-scroll,#mc4wp-admin .CodeMirror-sizer,.mc4wp-admin .CodeMirror-gutter,.mc4wp-admin .CodeMirror-gutters,.mc4wp-admin .CodeMirror-linenumber,.mc4wp-admin .CodeMirror-scroll,.mc4wp-admin .CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}#mc4wp-admin .CodeMirror-measure,.mc4wp-admin .CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}#mc4wp-admin .CodeMirror-cursor,.mc4wp-admin .CodeMirror-cursor{position:absolute}#mc4wp-admin .CodeMirror-measure pre,.mc4wp-admin .CodeMirror-measure pre{position:static}#mc4wp-admin div.CodeMirror-cursors,.mc4wp-admin div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}#mc4wp-admin .CodeMirror-focused div.CodeMirror-cursors,#mc4wp-admin div.CodeMirror-dragcursors,.mc4wp-admin .CodeMirror-focused div.CodeMirror-cursors,.mc4wp-admin div.CodeMirror-dragcursors{visibility:visible}#mc4wp-admin .CodeMirror-selected,.mc4wp-admin .CodeMirror-selected{background:#d9d9d9}#mc4wp-admin .CodeMirror-focused .CodeMirror-selected,#mc4wp-admin .CodeMirror-line::selection,#mc4wp-admin .CodeMirror-line>span::selection,#mc4wp-admin .CodeMirror-line>span>span::selection,.mc4wp-admin .CodeMirror-focused .CodeMirror-selected,.mc4wp-admin .CodeMirror-line::selection,.mc4wp-admin .CodeMirror-line>span::selection,.mc4wp-admin .CodeMirror-line>span>span::selection{background:#d7d4f0}#mc4wp-admin .CodeMirror-crosshair,.mc4wp-admin .CodeMirror-crosshair{cursor:crosshair}#mc4wp-admin .CodeMirror-line::-moz-selection,#mc4wp-admin .CodeMirror-line>span::-moz-selection,#mc4wp-admin .CodeMirror-line>span>span::-moz-selection,.mc4wp-admin .CodeMirror-line::-moz-selection,.mc4wp-admin .CodeMirror-line>span::-moz-selection,.mc4wp-admin .CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}#mc4wp-admin .cm-searching,.mc4wp-admin .cm-searching{background:#ffa;background:rgba(255,255,0,.4)}#mc4wp-admin .cm-force-border,.mc4wp-admin .cm-force-border{padding-right:.1px}@media print{#mc4wp-admin .CodeMirror div.CodeMirror-cursors,.mc4wp-admin .CodeMirror div.CodeMirror-cursors{visibility:hidden}}#mc4wp-admin .cm-tab-wrap-hack:after,.mc4wp-admin .cm-tab-wrap-hack:after{content:''}#mc4wp-admin span.CodeMirror-selectedtext,.mc4wp-admin span.CodeMirror-selectedtext{background:0 0}#mc4wp-admin .CodeMirror,.mc4wp-admin .CodeMirror{border:1px solid #ccc;padding:10px;min-height:500px}#mc4wp-admin .CodeMirror-empty,.mc4wp-admin .CodeMirror-empty{color:#999}#mc4wp-admin .field-wizard h3,.mc4wp-admin .field-wizard h3{margin-top:0;padding-bottom:12px;border-bottom:1px solid #eee;margin-bottom:12px}#mc4wp-admin .field-wizard code,.mc4wp-admin .field-wizard code{margin-left:10px}#mc4wp-admin .field-wizard>div,.mc4wp-admin .field-wizard>div{margin:24px 0}#mc4wp-admin .field-wizard label,.mc4wp-admin .field-wizard label{font-weight:600;display:block;margin-bottom:3px}#mc4wp-admin .field-wizard table,.mc4wp-admin .field-wizard table{table-layout:fixed;border-collapse:collapse;border-spacing:0}#mc4wp-admin .field-wizard .cb-wrap,.mc4wp-admin .field-wizard .cb-wrap{font-weight:400}#mc4wp-admin .field-wizard .cb-wrap input,.mc4wp-admin .field-wizard .cb-wrap input{margin-right:6px}#mc4wp-admin .field-wizard .limit-height,.mc4wp-admin .field-wizard .limit-height{border:1px solid #eee;padding:6px;max-height:200px;overflow-y:scroll}#mc4wp-admin .field-wizard .help,.mc4wp-admin .field-wizard .help{margin-top:0}#mc4wp-admin .available-fields,.mc4wp-admin .available-fields{border:1px solid #ccc;padding:20px;background:#fff}#mc4wp-admin .available-fields strong,.mc4wp-admin .available-fields strong{display:block;margin-bottom:10px}#mc4wp-admin .available-fields button,.mc4wp-admin .available-fields button{margin:0 6px 6px 0}#mc4wp-admin .available-fields .is-required:after,.mc4wp-admin .available-fields .is-required:after{content:" *";color:red}#mc4wp-admin .available-fields .is-required.not-in-form,.mc4wp-admin .available-fields .is-required.not-in-form{-webkit-box-shadow:0 0 3px 1px red;-moz-box-shadow:0 0 3px 1px red;box-shadow:0 0 3px 1px red}#mc4wp-admin .available-fields .in-form,.mc4wp-admin .available-fields .in-form{opacity:.5}#mc4wp-admin .page-title,.mc4wp-admin .page-title{background:url(../img/icon-large.png) left center no-repeat;padding-left:42px;line-height:32px;margin-bottom:20px}#mc4wp-admin .page-title small,.mc4wp-admin .page-title small{font-size:12px;color:#777;display:inline-block;margin-left:10px}#mc4wp-admin .button .dashicons,#mc4wp-admin .button-secondary .dashicons,#mc4wp-admin .page-title-action .dashicons,.mc4wp-admin .button .dashicons,.mc4wp-admin .button-secondary .dashicons,.mc4wp-admin .page-title-action .dashicons{vertical-align:middle;line-height:16px;margin:0 4px 0 0}#mc4wp-admin .form-table td p,.mc4wp-admin .form-table td p{margin-top:1em}#mc4wp-admin .sidebar,.mc4wp-admin .sidebar{border-left:1px solid #ccc}#mc4wp-admin .sidebar h3,#mc4wp-admin .sidebar h4,.mc4wp-admin .sidebar h3,.mc4wp-admin .sidebar h4{font-size:16px;margin-bottom:0}#mc4wp-admin .sidebar>div,.mc4wp-admin .sidebar>div{border-bottom:1px solid #ccc;margin-bottom:20px;padding-bottom:20px}#mc4wp-admin .sidebar>div:last-of-type,.mc4wp-admin .sidebar>div:last-of-type{border-bottom:0}.overlay{position:fixed;left:0;top:0;z-index:99999;padding:20px;max-width:480px;max-height:100%;background:#fefefe;border:1px solid #ccc;overflow-y:scroll;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.overlay .close{position:absolute;padding:10px;right:0;top:0;font-size:24px;cursor:pointer;opacity:.5}.overlay .close:hover{opacity:1}.overlay-background{z-index:99998;background:rgba(0,0,0,.67);position:fixed;left:0;right:0;bottom:0;top:0}
1
+ #mc4wp-admin .cm-em,#mc4wp-admin .help,.mc4wp-admin .cm-em,.mc4wp-admin .help{font-style:italic}#mc4wp-admin .row,.mc4wp-admin .row{margin:20px -20px}#mc4wp-admin .row:after,.mc4wp-admin .row:after{content:"";clear:both;display:table}#mc4wp-admin .row .col,.mc4wp-admin .row .col{padding:0 20px;float:left;-webkit-box-sizing:border-box;box-sizing:border-box}#mc4wp-admin .row .col-1,.mc4wp-admin .row .col-1{width:16.666%}#mc4wp-admin .row .col-2,.mc4wp-admin .row .col-2{width:33.333%}#mc4wp-admin .row .col-3,.mc4wp-admin .row .col-3{width:50%}#mc4wp-admin .row .col-4,.mc4wp-admin .row .col-4{width:66.666%}#mc4wp-admin .row .col-5,.mc4wp-admin .row .col-5{width:83.333%}#mc4wp-admin .field-wizard td.stretch,#mc4wp-admin .row .col-6,.mc4wp-admin .field-wizard td.stretch,.mc4wp-admin .row .col-6,.overlay{width:100%}@media (max-width:1200px){#mc4wp-admin .row .col,.mc4wp-admin .row .col{width:100%;float:none;margin:20px 0}}#mc4wp-admin .status,.mc4wp-admin .status{display:inline-block;margin-left:1em;padding:3px 6px;color:#fff;font-size:12px;font-weight:700}#mc4wp-admin .status.positive,.mc4wp-admin .status.positive{background-color:#32cd32}#mc4wp-admin .status.negative,.mc4wp-admin .status.negative{background-color:red}#mc4wp-admin .status.neutral,.mc4wp-admin .status.neutral{background:gray}#mc4wp-admin .valigntop,.mc4wp-admin .valigntop{vertical-align:top!important}#mc4wp-admin .big-margin,.mc4wp-admin .big-margin{margin:60px 0}#mc4wp-admin .medium-margin,.mc4wp-admin .medium-margin{margin:40px 0}#mc4wp-admin .small-margin,.mc4wp-admin .small-margin{margin:20px 0}#mc4wp-admin .hover-activated,.mc4wp-admin .hover-activated{opacity:.5}#mc4wp-admin .hover-activated:hover,.mc4wp-admin .hover-activated:hover{cursor:pointer;opacity:1}#mc4wp-admin .help-text,.mc4wp-admin .help-text{font-size:14px}#mc4wp-admin .help-text p,.mc4wp-admin .help-text p{margin:10px 0;font-size:14px}#mc4wp-admin .help-text ul,.mc4wp-admin .help-text ul{list-style:square;margin-top:15px;padding-left:40px}#mc4wp-admin .muted,.mc4wp-admin .muted{color:#aaa}#mc4wp-admin .red,.mc4wp-admin .red{color:red}#mc4wp-admin .green,.mc4wp-admin .green{color:#32cd32}#mc4wp-admin .mc4wp-notice,.mc4wp-admin .mc4wp-notice{padding:6px 12px;color:#31708f;background:#d9edf7;border:1px solid #bce8f1;margin:1em 0!important}#mc4wp-admin .column-ID,.mc4wp-admin .column-ID{width:10%}#mc4wp-admin .block,.mc4wp-admin .block{display:block}#mc4wp-admin .code-sample,.mc4wp-admin .code-sample{font-family:Consolas,Monaco,Lucida Console,monospace;font-size:12px;background:#fff}#mc4wp-admin .breadcrumbs,.mc4wp-admin .breadcrumbs{border-bottom:1px solid #ccc;padding-bottom:1em}#mc4wp-admin .tab,.mc4wp-admin .tab{display:none}#mc4wp-admin .tab.tab-active,.mc4wp-admin .tab.tab-active{display:block}#mc4wp-admin .tab h2,.mc4wp-admin .tab h2{margin-top:20px}#mc4wp-admin .CodeMirror,.mc4wp-admin .CodeMirror{font-family:monospace;height:300px;color:#000}#mc4wp-admin .CodeMirror-lines,.mc4wp-admin .CodeMirror-lines{padding:4px 0}#mc4wp-admin .CodeMirror pre,.mc4wp-admin .CodeMirror pre{padding:0 4px}#mc4wp-admin .CodeMirror-gutter-filler,#mc4wp-admin .CodeMirror-scrollbar-filler,.mc4wp-admin .CodeMirror-gutter-filler,.mc4wp-admin .CodeMirror-scrollbar-filler{background-color:#fff}#mc4wp-admin .CodeMirror-gutters,.mc4wp-admin .CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}#mc4wp-admin .CodeMirror-linenumber,.mc4wp-admin .CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}#mc4wp-admin .CodeMirror-guttermarker,.mc4wp-admin .CodeMirror-guttermarker{color:#000}#mc4wp-admin .CodeMirror-guttermarker-subtle,.mc4wp-admin .CodeMirror-guttermarker-subtle{color:#999}#mc4wp-admin .CodeMirror-cursor,.mc4wp-admin .CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}#mc4wp-admin .CodeMirror div.CodeMirror-secondarycursor,.mc4wp-admin .CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}#mc4wp-admin .cm-fat-cursor .CodeMirror-cursor,.mc4wp-admin .cm-fat-cursor .CodeMirror-cursor{width:auto;border:0;background:#7e7}#mc4wp-admin .cm-fat-cursor div.CodeMirror-cursors,.mc4wp-admin .cm-fat-cursor div.CodeMirror-cursors{z-index:1}#mc4wp-admin .cm-animate-fat-cursor,.mc4wp-admin .cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite;background-color:#7e7}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}#mc4wp-admin .cm-tab,.mc4wp-admin .cm-tab{display:inline-block;text-decoration:inherit}#mc4wp-admin .CodeMirror-ruler,.mc4wp-admin .CodeMirror-ruler{border-left:1px solid #ccc;position:absolute}#mc4wp-admin .cm-s-default .cm-header,.mc4wp-admin .cm-s-default .cm-header{color:#00f}#mc4wp-admin .cm-s-default .cm-quote,.mc4wp-admin .cm-s-default .cm-quote{color:#090}#mc4wp-admin .cm-negative,.mc4wp-admin .cm-negative{color:#d44}#mc4wp-admin .cm-positive,.mc4wp-admin .cm-positive{color:#292}#mc4wp-admin .cm-header,#mc4wp-admin .cm-strong,.mc4wp-admin .cm-header,.mc4wp-admin .cm-strong{font-weight:700}#mc4wp-admin .cm-link,.mc4wp-admin .cm-link{text-decoration:underline}#mc4wp-admin .cm-strikethrough,.mc4wp-admin .cm-strikethrough{text-decoration:line-through}#mc4wp-admin .cm-s-default .cm-keyword,.mc4wp-admin .cm-s-default .cm-keyword{color:#708}#mc4wp-admin .cm-s-default .cm-atom,.mc4wp-admin .cm-s-default .cm-atom{color:#219}#mc4wp-admin .cm-s-default .cm-number,.mc4wp-admin .cm-s-default .cm-number{color:#164}#mc4wp-admin .cm-s-default .cm-def,.mc4wp-admin .cm-s-default .cm-def{color:#00f}#mc4wp-admin .cm-s-default .cm-variable-2,.mc4wp-admin .cm-s-default .cm-variable-2{color:#05a}#mc4wp-admin .cm-s-default .cm-variable-3,.mc4wp-admin .cm-s-default .cm-variable-3{color:#085}#mc4wp-admin .cm-s-default .cm-comment,.mc4wp-admin .cm-s-default .cm-comment{color:#a50}#mc4wp-admin .cm-s-default .cm-string,.mc4wp-admin .cm-s-default .cm-string{color:#a11}#mc4wp-admin .cm-s-default .cm-string-2,.mc4wp-admin .cm-s-default .cm-string-2{color:#f50}#mc4wp-admin .cm-s-default .cm-meta,#mc4wp-admin .cm-s-default .cm-qualifier,.mc4wp-admin .cm-s-default .cm-meta,.mc4wp-admin .cm-s-default .cm-qualifier{color:#555}#mc4wp-admin .cm-s-default .cm-builtin,.mc4wp-admin .cm-s-default .cm-builtin{color:#30a}#mc4wp-admin .cm-s-default .cm-bracket,.mc4wp-admin .cm-s-default .cm-bracket{color:#997}#mc4wp-admin .cm-s-default .cm-tag,.mc4wp-admin .cm-s-default .cm-tag{color:#170}#mc4wp-admin .cm-s-default .cm-attribute,.mc4wp-admin .cm-s-default .cm-attribute{color:#00c}#mc4wp-admin .cm-s-default .cm-hr,.mc4wp-admin .cm-s-default .cm-hr{color:#999}#mc4wp-admin .cm-s-default .cm-link,.mc4wp-admin .cm-s-default .cm-link{color:#00c}#mc4wp-admin .cm-invalidchar,#mc4wp-admin .cm-s-default .cm-error,.mc4wp-admin .cm-invalidchar,.mc4wp-admin .cm-s-default .cm-error{color:red}#mc4wp-admin .CodeMirror-composing,.mc4wp-admin .CodeMirror-composing{border-bottom:2px solid}#mc4wp-admin div.CodeMirror span.CodeMirror-matchingbracket,.mc4wp-admin div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}#mc4wp-admin div.CodeMirror span.CodeMirror-nonmatchingbracket,.mc4wp-admin div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}#mc4wp-admin .CodeMirror-matchingtag,.mc4wp-admin .CodeMirror-matchingtag{background:rgba(255,150,0,.3)}#mc4wp-admin .CodeMirror-activeline-background,.mc4wp-admin .CodeMirror-activeline-background{background:#e8f2ff}#mc4wp-admin .CodeMirror,.mc4wp-admin .CodeMirror{position:relative;overflow:hidden;background:#fff}#mc4wp-admin .CodeMirror-scroll,.mc4wp-admin .CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:0;position:relative}#mc4wp-admin .CodeMirror-sizer,.mc4wp-admin .CodeMirror-sizer{position:relative;border-right:30px solid transparent}#mc4wp-admin .CodeMirror-gutter-filler,#mc4wp-admin .CodeMirror-hscrollbar,#mc4wp-admin .CodeMirror-scrollbar-filler,#mc4wp-admin .CodeMirror-vscrollbar,.mc4wp-admin .CodeMirror-gutter-filler,.mc4wp-admin .CodeMirror-hscrollbar,.mc4wp-admin .CodeMirror-scrollbar-filler,.mc4wp-admin .CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}#mc4wp-admin .CodeMirror-vscrollbar,.mc4wp-admin .CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}#mc4wp-admin .CodeMirror-hscrollbar,.mc4wp-admin .CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}#mc4wp-admin .CodeMirror-scrollbar-filler,.mc4wp-admin .CodeMirror-scrollbar-filler{right:0;bottom:0}#mc4wp-admin .CodeMirror-gutter-filler,.mc4wp-admin .CodeMirror-gutter-filler{left:0;bottom:0}#mc4wp-admin .CodeMirror-gutters,.mc4wp-admin .CodeMirror-gutters{position:absolute;left:0;top:0;z-index:3}#mc4wp-admin .CodeMirror-gutter,.mc4wp-admin .CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-30px}#mc4wp-admin .field-wizard .dashicons,#mc4wp-admin .field-wizard td,#mc4wp-admin .field-wizard tr,.mc4wp-admin .field-wizard .dashicons,.mc4wp-admin .field-wizard td,.mc4wp-admin .field-wizard tr{vertical-align:middle}#mc4wp-admin .CodeMirror-gutter-wrapper,.mc4wp-admin .CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important;-webkit-user-select:none;-moz-user-select:none;user-select:none}#mc4wp-admin .CodeMirror-gutter-background,.mc4wp-admin .CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}#mc4wp-admin .CodeMirror-gutter-elt,.mc4wp-admin .CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}#mc4wp-admin .CodeMirror-lines,.mc4wp-admin .CodeMirror-lines{cursor:text;min-height:1px}#mc4wp-admin .CodeMirror pre,.mc4wp-admin .CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent}#mc4wp-admin .CodeMirror-wrap pre,.mc4wp-admin .CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}#mc4wp-admin .CodeMirror-linebackground,.mc4wp-admin .CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}#mc4wp-admin .CodeMirror-linewidget,.mc4wp-admin .CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}#mc4wp-admin .CodeMirror-code,.mc4wp-admin .CodeMirror-code{outline:0}#mc4wp-admin .CodeMirror-gutter,#mc4wp-admin .CodeMirror-gutters,#mc4wp-admin .CodeMirror-linenumber,#mc4wp-admin .CodeMirror-scroll,#mc4wp-admin .CodeMirror-sizer,.mc4wp-admin .CodeMirror-gutter,.mc4wp-admin .CodeMirror-gutters,.mc4wp-admin .CodeMirror-linenumber,.mc4wp-admin .CodeMirror-scroll,.mc4wp-admin .CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}#mc4wp-admin .CodeMirror-measure,.mc4wp-admin .CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}#mc4wp-admin .CodeMirror-cursor,.mc4wp-admin .CodeMirror-cursor{position:absolute}#mc4wp-admin .CodeMirror-measure pre,.mc4wp-admin .CodeMirror-measure pre{position:static}#mc4wp-admin div.CodeMirror-cursors,.mc4wp-admin div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}#mc4wp-admin .CodeMirror-focused div.CodeMirror-cursors,#mc4wp-admin div.CodeMirror-dragcursors,.mc4wp-admin .CodeMirror-focused div.CodeMirror-cursors,.mc4wp-admin div.CodeMirror-dragcursors{visibility:visible}#mc4wp-admin .CodeMirror-selected,.mc4wp-admin .CodeMirror-selected{background:#d9d9d9}#mc4wp-admin .CodeMirror-focused .CodeMirror-selected,#mc4wp-admin .CodeMirror-line::selection,#mc4wp-admin .CodeMirror-line>span::selection,#mc4wp-admin .CodeMirror-line>span>span::selection,.mc4wp-admin .CodeMirror-focused .CodeMirror-selected,.mc4wp-admin .CodeMirror-line::selection,.mc4wp-admin .CodeMirror-line>span::selection,.mc4wp-admin .CodeMirror-line>span>span::selection{background:#d7d4f0}#mc4wp-admin .CodeMirror-crosshair,.mc4wp-admin .CodeMirror-crosshair{cursor:crosshair}#mc4wp-admin .CodeMirror-line::-moz-selection,#mc4wp-admin .CodeMirror-line>span::-moz-selection,#mc4wp-admin .CodeMirror-line>span>span::-moz-selection,.mc4wp-admin .CodeMirror-line::-moz-selection,.mc4wp-admin .CodeMirror-line>span::-moz-selection,.mc4wp-admin .CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}#mc4wp-admin .cm-searching,.mc4wp-admin .cm-searching{background:#ffa;background:rgba(255,255,0,.4)}#mc4wp-admin .cm-force-border,.mc4wp-admin .cm-force-border{padding-right:.1px}@media print{#mc4wp-admin .CodeMirror div.CodeMirror-cursors,.mc4wp-admin .CodeMirror div.CodeMirror-cursors{visibility:hidden}}#mc4wp-admin .cm-tab-wrap-hack:after,.mc4wp-admin .cm-tab-wrap-hack:after{content:''}#mc4wp-admin span.CodeMirror-selectedtext,.mc4wp-admin span.CodeMirror-selectedtext{background:0 0}#mc4wp-admin .CodeMirror,.mc4wp-admin .CodeMirror{border:1px solid #ccc;padding:10px;min-height:500px}#mc4wp-admin .CodeMirror-empty,.mc4wp-admin .CodeMirror-empty{color:#999}#mc4wp-admin .field-wizard h3,.mc4wp-admin .field-wizard h3{margin-top:0;padding-bottom:12px;border-bottom:1px solid #eee;margin-bottom:12px}#mc4wp-admin .field-wizard code,.mc4wp-admin .field-wizard code{margin-left:10px}#mc4wp-admin .field-wizard>div,.mc4wp-admin .field-wizard>div{margin:24px 0}#mc4wp-admin .field-wizard label,.mc4wp-admin .field-wizard label{font-weight:600;display:block;margin-bottom:3px}#mc4wp-admin .field-wizard table,.mc4wp-admin .field-wizard table{table-layout:fixed;border-collapse:collapse;border-spacing:0}#mc4wp-admin .field-wizard .cb-wrap,.mc4wp-admin .field-wizard .cb-wrap{font-weight:400}#mc4wp-admin .field-wizard .cb-wrap input,.mc4wp-admin .field-wizard .cb-wrap input{margin-right:6px}#mc4wp-admin .field-wizard .limit-height,.mc4wp-admin .field-wizard .limit-height{border:1px solid #eee;padding:6px;max-height:200px;overflow-y:scroll}#mc4wp-admin .field-wizard .help,.mc4wp-admin .field-wizard .help{margin-top:0}#mc4wp-admin .available-fields,.mc4wp-admin .available-fields{border:1px solid #ccc;padding:20px;background:#fff}#mc4wp-admin .available-fields strong,.mc4wp-admin .available-fields strong{display:block;margin-bottom:10px}#mc4wp-admin .available-fields button,.mc4wp-admin .available-fields button{margin:0 6px 6px 0}#mc4wp-admin .available-fields .is-required:after,.mc4wp-admin .available-fields .is-required:after{content:" *";color:red}#mc4wp-admin .available-fields .is-required.not-in-form,.mc4wp-admin .available-fields .is-required.not-in-form{-webkit-box-shadow:0 0 3px 1px red;-moz-box-shadow:0 0 3px 1px red;box-shadow:0 0 3px 1px red}#mc4wp-admin .available-fields .in-form,.mc4wp-admin .available-fields .in-form{opacity:.5}#mc4wp-admin .page-title,.mc4wp-admin .page-title{background:url(../img/icon-large.png) left center no-repeat;padding-left:42px;line-height:32px;margin-bottom:20px}#mc4wp-admin .page-title small,.mc4wp-admin .page-title small{font-size:12px;color:#777;display:inline-block;margin-left:10px}#mc4wp-admin .button .dashicons,#mc4wp-admin .button-secondary .dashicons,#mc4wp-admin .page-title-action .dashicons,.mc4wp-admin .button .dashicons,.mc4wp-admin .button-secondary .dashicons,.mc4wp-admin .page-title-action .dashicons{vertical-align:middle;line-height:16px;margin:0 4px 0 0}#mc4wp-admin .form-table td p,.mc4wp-admin .form-table td p{margin-top:1em}#mc4wp-admin .sidebar,.mc4wp-admin .sidebar{border-left:1px solid #ccc}#mc4wp-admin .sidebar h3,#mc4wp-admin .sidebar h4,.mc4wp-admin .sidebar h3,.mc4wp-admin .sidebar h4{font-size:16px;margin-bottom:0}#mc4wp-admin .sidebar>div,.mc4wp-admin .sidebar>div{border-bottom:1px solid #ccc;margin-bottom:20px;padding-bottom:20px}#mc4wp-admin .sidebar>div:last-of-type,.mc4wp-admin .sidebar>div:last-of-type{border-bottom:0}.overlay{position:fixed;left:0;top:0;z-index:99999;padding:20px;max-width:480px;max-height:100%;background:#fefefe;border:1px solid #ccc;overflow-y:scroll;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.overlay .close{position:absolute;padding:10px;right:0;top:0;font-size:24px;cursor:pointer;opacity:.5}.overlay .close:hover{opacity:1}.overlay-background{z-index:99998;background:rgba(0,0,0,.67);position:fixed;left:0;right:0;bottom:0;top:0}.rtl .overlay .close{right:auto;left:0}.rtl #mc4wp-admin .page-title{background-position:right center;padding-left:0;padding-right:42px}.rtl #mc4wp-admin .CodeMirror-scroll{overflow-y:hidden!important}.rtl #mc4wp-admin .CodeMirror-vscrollbar{left:0!important;right:auto!important}
assets/css/form-editor.css CHANGED
@@ -215,7 +215,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {
215
  border-right: 30px solid transparent; }
216
 
217
  /* The fake, visible scrollbars. Used to force redraw during scrolling
218
- before actuall scrolling happens, thus preventing shaking and
219
  flickering artifacts. */
220
  .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
221
  position: absolute;
@@ -252,6 +252,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {
252
  white-space: normal;
253
  height: 100%;
254
  display: inline-block;
 
255
  margin-bottom: -30px;
256
  /* Hack to make IE7 behave */
257
  *zoom: 1;
215
  border-right: 30px solid transparent; }
216
 
217
  /* The fake, visible scrollbars. Used to force redraw during scrolling
218
+ before actual scrolling happens, thus preventing shaking and
219
  flickering artifacts. */
220
  .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
221
  position: absolute;
252
  white-space: normal;
253
  height: 100%;
254
  display: inline-block;
255
+ vertical-align: top;
256
  margin-bottom: -30px;
257
  /* Hack to make IE7 behave */
258
  *zoom: 1;
assets/css/form-editor.min.css CHANGED
@@ -1 +1 @@
1
- .field-wizard .dashicons,.field-wizard td,.field-wizard tr{vertical-align:middle}.CodeMirror{font-family:monospace;height:300px;color:#000}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite;background-color:#7e7}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-ruler{border-left:1px solid #ccc;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-invalidchar,.cm-s-default .cm-error{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative;border-right:30px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;margin-bottom:-30px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important;-webkit-user-select:none;-moz-user-select:none;user-select:none}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}.CodeMirror-focused div.CodeMirror-cursors,div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected,.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:0 0}.CodeMirror{border:1px solid #ccc;padding:10px;min-height:500px}.CodeMirror-empty{color:#999}.field-wizard h3{margin-top:0;padding-bottom:12px;border-bottom:1px solid #eee;margin-bottom:12px}.field-wizard code{margin-left:10px}.field-wizard>div{margin:24px 0}.field-wizard label{font-weight:600;display:block;margin-bottom:3px}.field-wizard table{table-layout:fixed;border-collapse:collapse;border-spacing:0}.field-wizard td.stretch{width:100%}.field-wizard .cb-wrap{font-weight:400}.field-wizard .cb-wrap input{margin-right:6px}.field-wizard .limit-height{border:1px solid #eee;padding:6px;max-height:200px;overflow-y:scroll}.field-wizard .help{margin-top:0}.available-fields{border:1px solid #ccc;padding:20px;background:#fff}.available-fields strong{display:block;margin-bottom:10px}.available-fields button{margin:0 6px 6px 0}.available-fields .is-required:after{content:" *";color:red}.available-fields .is-required.not-in-form{-webkit-box-shadow:0 0 3px 1px red;-moz-box-shadow:0 0 3px 1px red;box-shadow:0 0 3px 1px red}.available-fields .in-form{opacity:.5}
1
+ .CodeMirror{font-family:monospace;height:300px;color:#000}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite;background-color:#7e7}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-ruler{border-left:1px solid #ccc;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-invalidchar,.cm-s-default .cm-error{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative;border-right:30px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-30px}.field-wizard .dashicons,.field-wizard td,.field-wizard tr{vertical-align:middle}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important;-webkit-user-select:none;-moz-user-select:none;user-select:none}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}.CodeMirror-focused div.CodeMirror-cursors,div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected,.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:0 0}.CodeMirror{border:1px solid #ccc;padding:10px;min-height:500px}.CodeMirror-empty{color:#999}.field-wizard h3{margin-top:0;padding-bottom:12px;border-bottom:1px solid #eee;margin-bottom:12px}.field-wizard code{margin-left:10px}.field-wizard>div{margin:24px 0}.field-wizard label{font-weight:600;display:block;margin-bottom:3px}.field-wizard table{table-layout:fixed;border-collapse:collapse;border-spacing:0}.field-wizard td.stretch{width:100%}.field-wizard .cb-wrap{font-weight:400}.field-wizard .cb-wrap input{margin-right:6px}.field-wizard .limit-height{border:1px solid #eee;padding:6px;max-height:200px;overflow-y:scroll}.field-wizard .help{margin-top:0}.available-fields{border:1px solid #ccc;padding:20px;background:#fff}.available-fields strong{display:block;margin-bottom:10px}.available-fields button{margin:0 6px 6px 0}.available-fields .is-required:after{content:" *";color:red}.available-fields .is-required.not-in-form{-webkit-box-shadow:0 0 3px 1px red;-moz-box-shadow:0 0 3px 1px red;box-shadow:0 0 3px 1px red}.available-fields .in-form{opacity:.5}
assets/js/admin.js CHANGED
@@ -383,26 +383,83 @@ var URL = {
383
 
384
  module.exports = URL;
385
  },{}],6:[function(require,module,exports){
386
- var m = (function app(window, undefined) {
387
- var OBJECT = "[object Object]", ARRAY = "[object Array]", STRING = "[object String]", FUNCTION = "function";
388
- var type = {}.toString;
389
- var parser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g, attrParser = /\[(.+?)(?:=("|'|)(.*?)\2)?\]/;
390
- var voidElements = /^(AREA|BASE|BR|COL|COMMAND|EMBED|HR|IMG|INPUT|KEYGEN|LINK|META|PARAM|SOURCE|TRACK|WBR)$/;
391
- var noop = function() {}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
392
 
393
  // caching commonly used variables
394
- var $document, $location, $requestAnimationFrame, $cancelAnimationFrame;
395
 
396
  // self invoking function needed because of the way mocks work
397
- function initialize(window){
398
- $document = window.document;
399
- $location = window.location;
400
- $cancelAnimationFrame = window.cancelAnimationFrame || window.clearTimeout;
401
- $requestAnimationFrame = window.requestAnimationFrame || window.setTimeout;
402
  }
403
 
404
- initialize(window);
 
 
 
 
405
 
 
406
 
407
  /**
408
  * @typedef {String} Tag
@@ -410,957 +467,1825 @@ var m = (function app(window, undefined) {
410
  * Which describes a DOM node
411
  */
412
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
413
  /**
414
  *
415
  * @param {Tag} The DOM node tag
416
  * @param {Object=[]} optional key-value pairs to be mapped to DOM attrs
417
- * @param {...mNode=[]} Zero or more Mithril child nodes. Can be an array, or splat (optional)
418
- *
419
  */
420
- function m() {
421
- var args = [].slice.call(arguments);
422
- var hasAttrs = args[1] != null && type.call(args[1]) === OBJECT && !("tag" in args[1] || "view" in args[1]) && !("subtree" in args[1]);
423
- var attrs = hasAttrs ? args[1] : {};
424
- var classAttrName = "class" in attrs ? "class" : "className";
425
- var cell = {tag: "div", attrs: {}};
426
- var match, classes = [];
427
- if (type.call(args[0]) != STRING) throw new Error("selector in m(selector, attrs, children) should be a string")
428
- while (match = parser.exec(args[0])) {
429
- if (match[1] === "" && match[2]) cell.tag = match[2];
430
- else if (match[1] === "#") cell.attrs.id = match[2];
431
- else if (match[1] === ".") classes.push(match[2]);
432
- else if (match[3][0] === "[") {
433
- var pair = attrParser.exec(match[3]);
434
- cell.attrs[pair[1]] = pair[3] || (pair[2] ? "" :true)
435
- }
436
  }
437
 
438
- var children = hasAttrs ? args.slice(2) : args.slice(1);
439
- if (children.length === 1 && type.call(children[0]) === ARRAY) {
440
- cell.children = children[0]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
441
  }
442
- else {
443
- cell.children = children
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
444
  }
445
-
446
- for (var attrName in attrs) {
447
- if (attrs.hasOwnProperty(attrName)) {
448
- if (attrName === classAttrName && attrs[attrName] != null && attrs[attrName] !== "") {
449
- classes.push(attrs[attrName])
450
- cell.attrs[attrName] = "" //create key in correct iteration order
451
- }
452
- else cell.attrs[attrName] = attrs[attrName]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
  }
454
  }
455
- if (classes.length > 0) cell.attrs[classAttrName] = classes.join(" ");
456
-
457
- return cell
458
  }
459
- function build(parentElement, parentTag, parentCache, parentIndex, data, cached, shouldReattach, index, editable, namespace, configs) {
460
- //`build` is a recursive function that manages creation/diffing/removal of DOM elements based on comparison between `data` and `cached`
461
- //the diff algorithm can be summarized as this:
462
- //1 - compare `data` and `cached`
463
- //2 - if they are different, copy `data` to `cached` and update the DOM based on what the difference is
464
- //3 - recursively apply this algorithm for every array and for the children of every virtual element
465
-
466
- //the `cached` data structure is essentially the same as the previous redraw's `data` data structure, with a few additions:
467
- //- `cached` always has a property called `nodes`, which is a list of DOM elements that correspond to the data represented by the respective virtual element
468
- //- in order to support attaching `nodes` as a property of `cached`, `cached` is *always* a non-primitive object, i.e. if the data was a string, then cached is a String instance. If data was `null` or `undefined`, cached is `new String("")`
469
- //- `cached also has a `configContext` property, which is the state storage object exposed by config(element, isInitialized, context)
470
- //- when `cached` is an Object, it represents a virtual element; when it's an Array, it represents a list of elements; when it's a String, Number or Boolean, it represents a text node
471
-
472
- //`parentElement` is a DOM element used for W3C DOM API calls
473
- //`parentTag` is only used for handling a corner case for textarea values
474
- //`parentCache` is used to remove nodes in some multi-node cases
475
- //`parentIndex` and `index` are used to figure out the offset of nodes. They're artifacts from before arrays started being flattened and are likely refactorable
476
- //`data` and `cached` are, respectively, the new and old nodes being diffed
477
- //`shouldReattach` is a flag indicating whether a parent node was recreated (if so, and if this node is reused, then this node must reattach itself to the new parent)
478
- //`editable` is a flag that indicates whether an ancestor is contenteditable
479
- //`namespace` indicates the closest HTML namespace as it cascades down from an ancestor
480
- //`configs` is a list of config functions to run after the topmost `build` call finishes running
481
-
482
- //there's logic that relies on the assumption that null and undefined data are equivalent to empty strings
483
- //- this prevents lifecycle surprises from procedural helpers that mix implicit and explicit return statements (e.g. function foo() {if (cond) return m("div")}
484
- //- it simplifies diffing code
485
- //data.toString() might throw or return null if data is the return value of Console.log in Firefox (behavior depends on version)
486
- try {if (data == null || data.toString() == null) data = "";} catch (e) {data = ""}
487
- if (data.subtree === "retain") return cached;
488
- var cachedType = type.call(cached), dataType = type.call(data);
489
- if (cached == null || cachedType !== dataType) {
490
- if (cached != null) {
491
- if (parentCache && parentCache.nodes) {
492
- var offset = index - parentIndex;
493
- var end = offset + (dataType === ARRAY ? data : cached.nodes).length;
494
- clear(parentCache.nodes.slice(offset, end), parentCache.slice(offset, end))
495
- }
496
- else if (cached.nodes) clear(cached.nodes, cached)
497
  }
498
- cached = new data.constructor;
499
- if (cached.tag) cached = {}; //if constructor creates a virtual dom element, use a blank object as the base cached node instead of copying the virtual el (#277)
500
- cached.nodes = []
501
- }
502
-
503
- if (dataType === ARRAY) {
504
- //recursively flatten array
505
- for (var i = 0, len = data.length; i < len; i++) {
506
- if (type.call(data[i]) === ARRAY) {
507
- data = data.concat.apply([], data);
508
- i-- //check current index again and flatten until there are no more nested arrays at that index
509
- len = data.length
510
- }
511
  }
512
-
513
- var nodes = [], intact = cached.length === data.length, subArrayCount = 0;
514
-
515
- //keys algorithm: sort elements without recreating them if keys are present
516
- //1) create a map of all existing keys, and mark all for deletion
517
- //2) add new keys to map and mark them for addition
518
- //3) if key exists in new list, change action from deletion to a move
519
- //4) for each key, handle its corresponding action as marked in previous steps
520
- var DELETION = 1, INSERTION = 2 , MOVE = 3;
521
- var existing = {}, shouldMaintainIdentities = false;
522
- for (var i = 0; i < cached.length; i++) {
523
- if (cached[i] && cached[i].attrs && cached[i].attrs.key != null) {
524
- shouldMaintainIdentities = true;
525
- existing[cached[i].attrs.key] = {action: DELETION, index: i}
526
  }
 
 
527
  }
528
-
529
- var guid = 0
530
- for (var i = 0, len = data.length; i < len; i++) {
531
- if (data[i] && data[i].attrs && data[i].attrs.key != null) {
532
- for (var j = 0, len = data.length; j < len; j++) {
533
- if (data[j] && data[j].attrs && data[j].attrs.key == null) data[j].attrs.key = "__mithril__" + guid++
534
- }
535
- break
536
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
537
  }
538
-
539
- if (shouldMaintainIdentities) {
540
- var keysDiffer = false
541
- if (data.length != cached.length) keysDiffer = true
542
- else for (var i = 0, cachedCell, dataCell; cachedCell = cached[i], dataCell = data[i]; i++) {
543
- if (cachedCell.attrs && dataCell.attrs && cachedCell.attrs.key != dataCell.attrs.key) {
544
- keysDiffer = true
545
- break
546
- }
547
- }
548
-
549
- if (keysDiffer) {
550
- for (var i = 0, len = data.length; i < len; i++) {
551
- if (data[i] && data[i].attrs) {
552
- if (data[i].attrs.key != null) {
553
- var key = data[i].attrs.key;
554
- if (!existing[key]) existing[key] = {action: INSERTION, index: i};
555
- else existing[key] = {
556
- action: MOVE,
557
- index: i,
558
- from: existing[key].index,
559
- element: cached.nodes[existing[key].index] || $document.createElement("div")
560
- }
561
- }
562
- }
563
- }
564
- var actions = []
565
- for (var prop in existing) actions.push(existing[prop])
566
- var changes = actions.sort(sortChanges);
567
- var newCached = new Array(cached.length)
568
- newCached.nodes = cached.nodes.slice()
569
-
570
- for (var i = 0, change; change = changes[i]; i++) {
571
- if (change.action === DELETION) {
572
- clear(cached[change.index].nodes, cached[change.index]);
573
- newCached.splice(change.index, 1)
574
- }
575
- if (change.action === INSERTION) {
576
- var dummy = $document.createElement("div");
577
- dummy.key = data[change.index].attrs.key;
578
- parentElement.insertBefore(dummy, parentElement.childNodes[change.index] || null);
579
- newCached.splice(change.index, 0, {attrs: {key: data[change.index].attrs.key}, nodes: [dummy]})
580
- newCached.nodes[change.index] = dummy
581
- }
582
-
583
- if (change.action === MOVE) {
584
- if (parentElement.childNodes[change.index] !== change.element && change.element !== null) {
585
- parentElement.insertBefore(change.element, parentElement.childNodes[change.index] || null)
586
- }
587
- newCached[change.index] = cached[change.from]
588
- newCached.nodes[change.index] = change.element
589
- }
590
- }
591
- cached = newCached;
592
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
593
  }
594
- //end key algorithm
595
-
596
- for (var i = 0, cacheCount = 0, len = data.length; i < len; i++) {
597
- //diff each item in the array
598
- var item = build(parentElement, parentTag, cached, index, data[i], cached[cacheCount], shouldReattach, index + subArrayCount || subArrayCount, editable, namespace, configs);
599
- if (item === undefined) continue;
600
- if (!item.nodes.intact) intact = false;
601
- if (item.$trusted) {
602
- //fix offset of next element if item was a trusted string w/ more than one html element
603
- //the first clause in the regexp matches elements
604
- //the second clause (after the pipe) matches text nodes
605
- subArrayCount += (item.match(/<[^\/]|\>\s*[^<]/g) || [0]).length
606
- }
607
- else subArrayCount += type.call(item) === ARRAY ? item.length : 1;
608
- cached[cacheCount++] = item
609
  }
610
- if (!intact) {
611
- //diff the array itself
612
-
613
- //update the list of DOM nodes by collecting the nodes from each item
614
- for (var i = 0, len = data.length; i < len; i++) {
615
- if (cached[i] != null) nodes.push.apply(nodes, cached[i].nodes)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
616
  }
617
- //remove items from the end of the array if the new array is shorter than the old one
618
- //if errors ever happen here, the issue is most likely a bug in the construction of the `cached` data structure somewhere earlier in the program
619
- for (var i = 0, node; node = cached.nodes[i]; i++) {
620
- if (node.parentNode != null && nodes.indexOf(node) < 0) clear([node], [cached[i]])
 
621
  }
622
- if (data.length < cached.length) cached.length = data.length;
623
- cached.nodes = nodes
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
624
  }
625
  }
626
- else if (data != null && dataType === OBJECT) {
627
- var views = [], controllers = []
628
- while (data.view) {
629
- var view = data.view.$original || data.view
630
- var controllerIndex = m.redraw.strategy() == "diff" && cached.views ? cached.views.indexOf(view) : -1
631
- var controller = controllerIndex > -1 ? cached.controllers[controllerIndex] : new (data.controller || noop)
632
- var key = data && data.attrs && data.attrs.key
633
- data = pendingRequests == 0 || (cached && cached.controllers && cached.controllers.indexOf(controller) > -1) ? data.view(controller) : {tag: "placeholder"}
634
- if (data.subtree === "retain") return cached;
635
- if (key) {
636
- if (!data.attrs) data.attrs = {}
637
- data.attrs.key = key
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
638
  }
639
- if (controller.onunload) unloaders.push({controller: controller, handler: controller.onunload})
640
- views.push(view)
641
- controllers.push(controller)
642
  }
643
- if (!data.tag && controllers.length) throw new Error("Component template must return a virtual element, not an array, string, etc.")
644
- if (!data.attrs) data.attrs = {};
645
- if (!cached.attrs) cached.attrs = {};
646
-
647
- var dataAttrKeys = Object.keys(data.attrs)
648
- var hasKeys = dataAttrKeys.length > ("key" in data.attrs ? 1 : 0)
649
- //if an element is different enough from the one in cache, recreate it
650
- if (data.tag != cached.tag || dataAttrKeys.sort().join() != Object.keys(cached.attrs).sort().join() || data.attrs.id != cached.attrs.id || data.attrs.key != cached.attrs.key || (m.redraw.strategy() == "all" && (!cached.configContext || cached.configContext.retain !== true)) || (m.redraw.strategy() == "diff" && cached.configContext && cached.configContext.retain === false)) {
651
- if (cached.nodes.length) clear(cached.nodes);
652
- if (cached.configContext && typeof cached.configContext.onunload === FUNCTION) cached.configContext.onunload()
653
- if (cached.controllers) {
654
- for (var i = 0, controller; controller = cached.controllers[i]; i++) {
655
- if (typeof controller.onunload === FUNCTION) controller.onunload({preventDefault: noop})
656
- }
657
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
658
  }
659
- if (type.call(data.tag) != STRING) return;
660
-
661
- var node, isNew = cached.nodes.length === 0;
662
- if (data.attrs.xmlns) namespace = data.attrs.xmlns;
663
- else if (data.tag === "svg") namespace = "http://www.w3.org/2000/svg";
664
- else if (data.tag === "math") namespace = "http://www.w3.org/1998/Math/MathML";
665
-
666
- if (isNew) {
667
- if (data.attrs.is) node = namespace === undefined ? $document.createElement(data.tag, data.attrs.is) : $document.createElementNS(namespace, data.tag, data.attrs.is);
668
- else node = namespace === undefined ? $document.createElement(data.tag) : $document.createElementNS(namespace, data.tag);
669
- cached = {
670
- tag: data.tag,
671
- //set attributes first, then create children
672
- attrs: hasKeys ? setAttributes(node, data.tag, data.attrs, {}, namespace) : data.attrs,
673
- children: data.children != null && data.children.length > 0 ?
674
- build(node, data.tag, undefined, undefined, data.children, cached.children, true, 0, data.attrs.contenteditable ? node : editable, namespace, configs) :
675
- data.children,
676
- nodes: [node]
677
- };
678
- if (controllers.length) {
679
- cached.views = views
680
- cached.controllers = controllers
681
- for (var i = 0, controller; controller = controllers[i]; i++) {
682
- if (controller.onunload && controller.onunload.$old) controller.onunload = controller.onunload.$old
683
- if (pendingRequests && controller.onunload) {
684
- var onunload = controller.onunload
685
- controller.onunload = noop
686
- controller.onunload.$old = onunload
687
- }
688
- }
689
- }
690
-
691
- if (cached.children && !cached.children.nodes) cached.children.nodes = [];
692
- //edge case: setting value on <select> doesn't work before children exist, so set it again after children have been created
693
- if (data.tag === "select" && "value" in data.attrs) setAttributes(node, data.tag, {value: data.attrs.value}, {}, namespace);
694
- parentElement.insertBefore(node, parentElement.childNodes[index] || null)
695
  }
696
- else {
697
- node = cached.nodes[0];
698
- if (hasKeys) setAttributes(node, data.tag, data.attrs, cached.attrs, namespace);
699
- cached.children = build(node, data.tag, undefined, undefined, data.children, cached.children, false, 0, data.attrs.contenteditable ? node : editable, namespace, configs);
700
- cached.nodes.intact = true;
701
- if (controllers.length) {
702
- cached.views = views
703
- cached.controllers = controllers
704
- }
705
- if (shouldReattach === true && node != null) parentElement.insertBefore(node, parentElement.childNodes[index] || null)
 
 
 
 
 
 
 
706
  }
707
- //schedule configs to be called. They are called after `build` finishes running
708
- if (typeof data.attrs["config"] === FUNCTION) {
709
- var context = cached.configContext = cached.configContext || {};
710
-
711
- // bind
712
- var callback = function(data, args) {
713
- return function() {
714
- return data.attrs["config"].apply(data, args)
715
- }
716
- };
717
- configs.push(callback(data, [node, !isNew, context, cached]))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
718
  }
719
  }
720
- else if (typeof data != FUNCTION) {
721
- //handle text nodes
722
- var nodes;
723
- if (cached.nodes.length === 0) {
724
- if (data.$trusted) {
725
- nodes = injectHTML(parentElement, index, data)
726
- }
727
- else {
728
- nodes = [$document.createTextNode(data)];
729
- if (!parentElement.nodeName.match(voidElements)) parentElement.insertBefore(nodes[0], parentElement.childNodes[index] || null)
730
- }
731
- cached = "string number boolean".indexOf(typeof data) > -1 ? new data.constructor(data) : data;
732
- cached.nodes = nodes
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
733
  }
734
- else if (cached.valueOf() !== data.valueOf() || shouldReattach === true) {
735
- nodes = cached.nodes;
736
- if (!editable || editable !== $document.activeElement) {
737
- if (data.$trusted) {
738
- clear(nodes, cached);
739
- nodes = injectHTML(parentElement, index, data)
740
- }
741
- else {
742
- //corner case: replacing the nodeValue of a text node that is a child of a textarea/contenteditable doesn't work
743
- //we need to update the value property of the parent textarea or the innerHTML of the contenteditable element instead
744
- if (parentTag === "textarea") parentElement.value = data;
745
- else if (editable) editable.innerHTML = data;
746
- else {
747
- if (nodes[0].nodeType === 1 || nodes.length > 1) { //was a trusted string
748
- clear(cached.nodes, cached);
749
- nodes = [$document.createTextNode(data)]
750
- }
751
- parentElement.insertBefore(nodes[0], parentElement.childNodes[index] || null);
752
- nodes[0].nodeValue = data
753
- }
754
- }
755
  }
756
- cached = new data.constructor(data);
757
- cached.nodes = nodes
758
  }
759
- else cached.nodes.intact = true
760
  }
 
 
761
 
762
- return cached
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
763
  }
764
- function sortChanges(a, b) {return a.action - b.action || a.index - b.index}
765
  function setAttributes(node, tag, dataAttrs, cachedAttrs, namespace) {
766
- for (var attrName in dataAttrs) {
767
- var dataAttr = dataAttrs[attrName];
768
- var cachedAttr = cachedAttrs[attrName];
769
- if (!(attrName in cachedAttrs) || (cachedAttr !== dataAttr)) {
770
- cachedAttrs[attrName] = dataAttr;
771
- try {
772
- //`config` isn't a real attributes, so ignore it
773
- if (attrName === "config" || attrName == "key") continue;
774
- //hook event handlers to the auto-redrawing system
775
- else if (typeof dataAttr === FUNCTION && attrName.indexOf("on") === 0) {
776
- node[attrName] = autoredraw(dataAttr, node)
777
- }
778
- //handle `style: {...}`
779
- else if (attrName === "style" && dataAttr != null && type.call(dataAttr) === OBJECT) {
780
- for (var rule in dataAttr) {
781
- if (cachedAttr == null || cachedAttr[rule] !== dataAttr[rule]) node.style[rule] = dataAttr[rule]
782
- }
783
- for (var rule in cachedAttr) {
784
- if (!(rule in dataAttr)) node.style[rule] = ""
785
- }
786
- }
787
- //handle SVG
788
- else if (namespace != null) {
789
- if (attrName === "href") node.setAttributeNS("http://www.w3.org/1999/xlink", "href", dataAttr);
790
- else if (attrName === "className") node.setAttribute("class", dataAttr);
791
- else node.setAttribute(attrName, dataAttr)
792
- }
793
- //handle cases that are properties (but ignore cases where we should use setAttribute instead)
794
- //- list and form are typically used as strings, but are DOM element references in js
795
- //- when using CSS selectors (e.g. `m("[style='']")`), style is used as a string, but it's an object in js
796
- else if (attrName in node && !(attrName === "list" || attrName === "style" || attrName === "form" || attrName === "type" || attrName === "width" || attrName === "height")) {
797
- //#348 don't set the value if not needed otherwise cursor placement breaks in Chrome
798
- if (tag !== "input" || node[attrName] !== dataAttr) node[attrName] = dataAttr
799
- }
800
- else node.setAttribute(attrName, dataAttr)
801
- }
802
- catch (e) {
803
- //swallow IE's invalid argument errors to mimic HTML's fallback-to-doing-nothing-on-invalid-attributes behavior
804
- if (e.message.indexOf("Invalid argument") < 0) throw e
805
- }
806
- }
807
- //#348 dataAttr may not be a string, so use loose comparison (double equal) instead of strict (triple equal)
808
- else if (attrName === "value" && tag === "input" && node.value != dataAttr) {
809
- node.value = dataAttr
810
  }
811
  }
812
  return cachedAttrs
813
  }
 
814
  function clear(nodes, cached) {
815
  for (var i = nodes.length - 1; i > -1; i--) {
816
  if (nodes[i] && nodes[i].parentNode) {
817
- try {nodes[i].parentNode.removeChild(nodes[i])}
818
- catch (e) {} //ignore if this fails due to order of events (see http://stackoverflow.com/questions/21926083/failed-to-execute-removechild-on-node)
819
- cached = [].concat(cached);
 
 
 
 
 
 
820
  if (cached[i]) unload(cached[i])
821
  }
822
  }
823
- if (nodes.length != 0) nodes.length = 0
 
 
 
 
824
  }
 
825
  function unload(cached) {
826
- if (cached.configContext && typeof cached.configContext.onunload === FUNCTION) {
827
- cached.configContext.onunload();
828
  cached.configContext.onunload = null
829
  }
830
  if (cached.controllers) {
831
- for (var i = 0, controller; controller = cached.controllers[i]; i++) {
832
- if (typeof controller.onunload === FUNCTION) controller.onunload({preventDefault: noop});
833
- }
 
 
834
  }
835
  if (cached.children) {
836
- if (type.call(cached.children) === ARRAY) {
837
- for (var i = 0, child; child = cached.children[i]; i++) unload(child)
838
- }
839
  else if (cached.children.tag) unload(cached.children)
840
  }
841
  }
 
 
 
 
 
 
 
 
 
 
842
  function injectHTML(parentElement, index, data) {
843
- var nextSibling = parentElement.childNodes[index];
844
  if (nextSibling) {
845
- var isElement = nextSibling.nodeType != 1;
846
- var placeholder = $document.createElement("span");
847
  if (isElement) {
848
- parentElement.insertBefore(placeholder, nextSibling || null);
849
- placeholder.insertAdjacentHTML("beforebegin", data);
850
  parentElement.removeChild(placeholder)
 
 
851
  }
852
- else nextSibling.insertAdjacentHTML("beforebegin", data)
 
853
  }
854
- else parentElement.insertAdjacentHTML("beforeend", data);
855
- var nodes = [];
 
856
  while (parentElement.childNodes[index] !== nextSibling) {
857
- nodes.push(parentElement.childNodes[index]);
858
  index++
859
  }
 
860
  return nodes
861
  }
 
862
  function autoredraw(callback, object) {
863
- return function(e) {
864
- e = e || event;
865
- m.redraw.strategy("diff");
866
- m.startComputation();
867
- try {return callback.call(object, e)}
868
- finally {
 
869
  endFirstComputation()
870
  }
871
  }
872
  }
873
 
874
- var html;
875
  var documentNode = {
876
- appendChild: function(node) {
877
- if (html === undefined) html = $document.createElement("html");
878
- if ($document.documentElement && $document.documentElement !== node) {
 
879
  $document.replaceChild(node, $document.documentElement)
 
 
880
  }
881
- else $document.appendChild(node);
882
  this.childNodes = $document.childNodes
883
  },
884
- insertBefore: function(node) {
 
885
  this.appendChild(node)
886
  },
 
887
  childNodes: []
888
- };
889
- var nodeCache = [], cellCache = {};
890
- m.render = function(root, cell, forceRecreation) {
891
- var configs = [];
892
- if (!root) throw new Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");
893
- var id = getCellCacheKey(root);
894
- var isDocumentRoot = root === $document;
895
- var node = isDocumentRoot || root === $document.documentElement ? documentNode : root;
896
- if (isDocumentRoot && cell.tag != "html") cell = {tag: "html", attrs: {}, children: cell};
897
- if (cellCache[id] === undefined) clear(node.childNodes);
898
- if (forceRecreation === true) reset(root);
899
- cellCache[id] = build(node, null, undefined, undefined, cell, cellCache[id], false, 0, null, undefined, configs);
900
- for (var i = 0, len = configs.length; i < len; i++) configs[i]()
901
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
902
  function getCellCacheKey(element) {
903
- var index = nodeCache.indexOf(element);
904
  return index < 0 ? nodeCache.push(element) - 1 : index
905
  }
906
 
907
- m.trust = function(value) {
908
- value = new String(value);
909
- value.$trusted = true;
910
  return value
911
- };
912
 
913
  function gettersetter(store) {
914
- var prop = function() {
915
- if (arguments.length) store = arguments[0];
916
  return store
917
- };
918
 
919
- prop.toJSON = function() {
920
  return store
921
- };
922
 
923
  return prop
924
  }
925
 
926
  m.prop = function (store) {
927
- //note: using non-strict equality check here because we're checking if store is null OR undefined
928
- if (((store != null && type.call(store) === OBJECT) || typeof store === FUNCTION) && typeof store.then === FUNCTION) {
929
  return propify(store)
930
  }
931
 
932
  return gettersetter(store)
933
- };
 
 
 
 
 
 
 
 
 
 
934
 
935
- var roots = [], components = [], controllers = [], lastRedrawId = null, lastRedrawCallTime = 0, computePreRedrawHook = null, computePostRedrawHook = null, prevented = false, topComponent, unloaders = [];
936
- var FRAME_BUDGET = 16; //60 frames per second = 1 call per 16 ms
937
  function parameterize(component, args) {
938
- var controller = function() {
 
939
  return (component.controller || noop).apply(this, args) || this
 
 
 
 
 
940
  }
941
- var view = function(ctrl) {
942
- if (arguments.length > 1) args = args.concat([].slice.call(arguments, 1))
943
- return component.view.apply(component, args ? [ctrl].concat(args) : [ctrl])
 
 
 
 
 
944
  }
 
945
  view.$original = component.view
946
  var output = {controller: controller, view: view}
947
  if (args[0] && args[0].key != null) output.attrs = {key: args[0].key}
948
  return output
949
  }
950
- m.component = function(component) {
951
- return parameterize(component, [].slice.call(arguments, 1))
952
- }
953
- m.mount = m.module = function(root, component) {
954
- if (!root) throw new Error("Please ensure the DOM element exists before rendering a template into it.");
955
- var index = roots.indexOf(root);
956
- if (index < 0) index = roots.length;
957
-
958
- var isPrevented = false;
959
- var event = {preventDefault: function() {
960
- isPrevented = true;
961
- computePreRedrawHook = computePostRedrawHook = null;
962
- }};
963
- for (var i = 0, unloader; unloader = unloaders[i]; i++) {
964
- unloader.handler.call(unloader.controller, event)
965
- unloader.controller.onunload = null
966
- }
967
- if (isPrevented) {
968
- for (var i = 0, unloader; unloader = unloaders[i]; i++) unloader.controller.onunload = unloader.handler
969
- }
970
- else unloaders = []
971
-
972
- if (controllers[index] && typeof controllers[index].onunload === FUNCTION) {
973
- controllers[index].onunload(event)
974
- }
975
-
976
  if (!isPrevented) {
977
- m.redraw.strategy("all");
978
- m.startComputation();
979
- roots[index] = root;
980
- if (arguments.length > 2) component = subcomponent(component, [].slice.call(arguments, 2))
981
- var currentComponent = topComponent = component = component || {controller: function() {}};
982
- var constructor = component.controller || noop
983
- var controller = new constructor;
984
- //controllers may call m.mount recursively (via m.route redirects, for example)
985
- //this conditional ensures only the last recursive m.mount call is applied
 
 
 
 
 
 
 
 
986
  if (currentComponent === topComponent) {
987
- controllers[index] = controller;
988
  components[index] = component
989
  }
990
- endFirstComputation();
 
 
 
991
  return controllers[index]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
992
  }
993
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
994
  var redrawing = false
995
- m.redraw = function(force) {
996
  if (redrawing) return
997
  redrawing = true
998
- //lastRedrawId is a positive number if a second redraw is requested before the next animation frame
999
- //lastRedrawID is null if it's the first redraw and not an event handler
1000
- if (lastRedrawId && force !== true) {
1001
- //when setTimeout: only reschedule redraw if time between now and previous redraw is bigger than a frame, otherwise keep currently scheduled timeout
1002
- //when rAF: always reschedule redraw
1003
- if ($requestAnimationFrame === window.requestAnimationFrame || new Date - lastRedrawCallTime > FRAME_BUDGET) {
1004
- if (lastRedrawId > 0) $cancelAnimationFrame(lastRedrawId);
1005
- lastRedrawId = $requestAnimationFrame(redraw, FRAME_BUDGET)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1006
  }
 
 
1007
  }
1008
- else {
1009
- redraw();
1010
- lastRedrawId = $requestAnimationFrame(function() {lastRedrawId = null}, FRAME_BUDGET)
1011
- }
1012
- redrawing = false
1013
- };
1014
- m.redraw.strategy = m.prop();
1015
  function redraw() {
1016
  if (computePreRedrawHook) {
1017
  computePreRedrawHook()
1018
  computePreRedrawHook = null
1019
  }
1020
- for (var i = 0, root; root = roots[i]; i++) {
 
1021
  if (controllers[i]) {
1022
- var args = components[i].controller && components[i].controller.$$args ? [controllers[i]].concat(components[i].controller.$$args) : [controllers[i]]
1023
- m.render(root, components[i].view ? components[i].view(controllers[i], args) : "")
 
1024
  }
1025
- }
1026
- //after rendering within a routed context, we need to scroll back to the top, and fetch the document title for history.pushState
 
1027
  if (computePostRedrawHook) {
1028
- computePostRedrawHook();
1029
  computePostRedrawHook = null
1030
  }
1031
- lastRedrawId = null;
1032
- lastRedrawCallTime = new Date;
1033
  m.redraw.strategy("diff")
1034
  }
1035
 
1036
- var pendingRequests = 0;
1037
- m.startComputation = function() {pendingRequests++};
1038
- m.endComputation = function() {
1039
- pendingRequests = Math.max(pendingRequests - 1, 0);
1040
- if (pendingRequests === 0) m.redraw()
1041
- };
1042
- var endFirstComputation = function() {
1043
- if (m.redraw.strategy() == "none") {
1044
  pendingRequests--
1045
  m.redraw.strategy("diff")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1046
  }
1047
- else m.endComputation();
1048
- }
1049
-
1050
- m.withAttr = function(prop, withAttrCallback) {
1051
- return function(e) {
1052
- e = e || event;
1053
- var currentTarget = e.currentTarget || this;
1054
- withAttrCallback(prop in currentTarget ? currentTarget[prop] : currentTarget.getAttribute(prop))
1055
- }
1056
- };
1057
-
1058
- //routing
1059
- var modes = {pathname: "", hash: "#", search: "?"};
1060
- var redirect = noop, routeParams, currentRoute, isDefaultRoute = false;
1061
- m.route = function() {
1062
- //m.route()
1063
- if (arguments.length === 0) return currentRoute;
1064
- //m.route(el, defaultRoute, routes)
1065
- else if (arguments.length === 3 && type.call(arguments[1]) === STRING) {
1066
- var root = arguments[0], defaultRoute = arguments[1], router = arguments[2];
1067
- redirect = function(source) {
1068
- var path = currentRoute = normalizeRoute(source);
1069
- if (!routeByValue(root, router, path)) {
1070
- if (isDefaultRoute) throw new Error("Ensure the default route matches one of the routes defined in m.route")
1071
  isDefaultRoute = true
1072
- m.route(defaultRoute, true)
1073
  isDefaultRoute = false
1074
  }
1075
- };
1076
- var listener = m.route.mode === "hash" ? "onhashchange" : "onpopstate";
1077
- window[listener] = function() {
 
 
 
 
1078
  var path = $location[m.route.mode]
1079
  if (m.route.mode === "pathname") path += $location.search
1080
- if (currentRoute != normalizeRoute(path)) {
1081
- redirect(path)
1082
- }
1083
- };
1084
- computePreRedrawHook = setScroll;
1085
- window[listener]()
1086
- }
1087
- //config: m.route
1088
- else if (arguments[0].addEventListener || arguments[0].attachEvent) {
1089
- var element = arguments[0];
1090
- var isInitialized = arguments[1];
1091
- var context = arguments[2];
1092
- var vdom = arguments[3];
1093
- element.href = (m.route.mode !== 'pathname' ? $location.pathname : '') + modes[m.route.mode] + vdom.attrs.href;
1094
- if (element.addEventListener) {
1095
- element.removeEventListener("click", routeUnobtrusive);
1096
- element.addEventListener("click", routeUnobtrusive)
1097
  }
1098
- else {
1099
- element.detachEvent("onclick", routeUnobtrusive);
1100
- element.attachEvent("onclick", routeUnobtrusive)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1101
  }
 
 
1102
  }
1103
- //m.route(route, params, shouldReplaceHistoryEntry)
1104
- else if (type.call(arguments[0]) === STRING) {
1105
- var oldRoute = currentRoute;
1106
- currentRoute = arguments[0];
1107
- var args = arguments[1] || {}
 
1108
  var queryIndex = currentRoute.indexOf("?")
1109
- var params = queryIndex > -1 ? parseQueryString(currentRoute.slice(queryIndex + 1)) : {}
1110
- for (var i in args) params[i] = args[i]
 
 
 
 
 
 
 
 
 
 
1111
  var querystring = buildQueryString(params)
1112
- var currentPath = queryIndex > -1 ? currentRoute.slice(0, queryIndex) : currentRoute
1113
- if (querystring) currentRoute = currentPath + (currentPath.indexOf("?") === -1 ? "?" : "&") + querystring;
 
 
 
 
 
 
 
 
 
 
 
1114
 
1115
- var shouldReplaceHistoryEntry = (arguments.length === 3 ? arguments[2] : arguments[1]) === true || oldRoute === arguments[0];
 
 
1116
 
1117
- if (window.history.pushState) {
 
1118
  computePreRedrawHook = setScroll
1119
- computePostRedrawHook = function() {
1120
- window.history[shouldReplaceHistoryEntry ? "replaceState" : "pushState"](null, $document.title, modes[m.route.mode] + currentRoute);
1121
- };
 
1122
  redirect(modes[m.route.mode] + currentRoute)
1123
- }
1124
- else {
1125
  $location[m.route.mode] = currentRoute
1126
  redirect(modes[m.route.mode] + currentRoute)
1127
  }
1128
  }
1129
- };
1130
- m.route.param = function(key) {
1131
- if (!routeParams) throw new Error("You must call m.route(element, defaultRoute, routes) before calling m.route.param()")
 
 
 
 
 
 
 
 
 
1132
  return routeParams[key]
1133
- };
1134
- m.route.mode = "search";
 
 
1135
  function normalizeRoute(route) {
1136
  return route.slice(modes[m.route.mode].length)
1137
  }
 
1138
  function routeByValue(root, router, path) {
1139
- routeParams = {};
1140
 
1141
- var queryStart = path.indexOf("?");
1142
  if (queryStart !== -1) {
1143
- routeParams = parseQueryString(path.substr(queryStart + 1, path.length));
 
1144
  path = path.substr(0, queryStart)
1145
  }
1146
 
1147
  // Get all routes and check if there's
1148
  // an exact match for the current path
1149
- var keys = Object.keys(router);
1150
- var index = keys.indexOf(path);
1151
- if(index !== -1){
1152
- m.mount(root, router[keys [index]]);
1153
- return true;
 
1154
  }
1155
 
1156
- for (var route in router) {
1157
  if (route === path) {
1158
- m.mount(root, router[route]);
1159
  return true
1160
  }
1161
 
1162
- var matcher = new RegExp("^" + route.replace(/:[^\/]+?\.{3}/g, "(.*?)").replace(/:[^\/]+/g, "([^\\/]+)") + "\/?$");
 
 
1163
 
1164
  if (matcher.test(path)) {
1165
- path.replace(matcher, function() {
1166
- var keys = route.match(/:[^\/]+/g) || [];
1167
- var values = [].slice.call(arguments, 1, -2);
1168
- for (var i = 0, len = keys.length; i < len; i++) routeParams[keys[i].replace(/:|\./g, "")] = decodeURIComponent(values[i])
 
 
 
 
1169
  m.mount(root, router[route])
1170
- });
 
1171
  return true
1172
  }
1173
  }
1174
  }
 
1175
  function routeUnobtrusive(e) {
1176
- e = e || event;
1177
- if (e.ctrlKey || e.metaKey || e.which === 2) return;
1178
- if (e.preventDefault) e.preventDefault();
1179
- else e.returnValue = false;
1180
- var currentTarget = e.currentTarget || e.srcElement;
1181
- var args = m.route.mode === "pathname" && currentTarget.search ? parseQueryString(currentTarget.search.slice(1)) : {};
1182
- while (currentTarget && currentTarget.nodeName.toUpperCase() != "A") currentTarget = currentTarget.parentNode
1183
- m.route(currentTarget[m.route.mode].slice(modes[m.route.mode].length), args)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1184
  }
 
1185
  function setScroll() {
1186
- if (m.route.mode != "hash" && $location.hash) $location.hash = $location.hash;
1187
- else window.scrollTo(0, 0)
 
 
 
1188
  }
 
1189
  function buildQueryString(object, prefix) {
1190
  var duplicates = {}
1191
  var str = []
1192
- for (var prop in object) {
 
1193
  var key = prefix ? prefix + "[" + prop + "]" : prop
1194
  var value = object[prop]
1195
- var valueType = type.call(value)
1196
- var pair = (value === null) ? encodeURIComponent(key) :
1197
- valueType === OBJECT ? buildQueryString(value, key) :
1198
- valueType === ARRAY ? value.reduce(function(memo, item) {
1199
- if (!duplicates[key]) duplicates[key] = {}
 
 
 
 
 
 
1200
  if (!duplicates[key][item]) {
1201
  duplicates[key][item] = true
1202
- return memo.concat(encodeURIComponent(key) + "=" + encodeURIComponent(item))
 
1203
  }
1204
- return memo
1205
- }, []).join("&") :
1206
- encodeURIComponent(key) + "=" + encodeURIComponent(value)
1207
- if (value !== undefined) str.push(pair)
 
 
1208
  }
1209
  return str.join("&")
1210
  }
 
1211
  function parseQueryString(str) {
1212
- if (str.charAt(0) === "?") str = str.substring(1);
1213
-
1214
- var pairs = str.split("&"), params = {};
1215
- for (var i = 0, len = pairs.length; i < len; i++) {
1216
- var pair = pairs[i].split("=");
 
 
 
1217
  var key = decodeURIComponent(pair[0])
1218
- var value = pair.length == 2 ? decodeURIComponent(pair[1]) : null
1219
  if (params[key] != null) {
1220
- if (type.call(params[key]) !== ARRAY) params[key] = [params[key]]
1221
  params[key].push(value)
1222
  }
1223
  else params[key] = value
1224
- }
 
1225
  return params
1226
  }
 
1227
  m.route.buildQueryString = buildQueryString
1228
  m.route.parseQueryString = parseQueryString
1229
-
1230
  function reset(root) {
1231
- var cacheKey = getCellCacheKey(root);
1232
- clear(root.childNodes, cellCache[cacheKey]);
1233
  cellCache[cacheKey] = undefined
1234
  }
1235
 
1236
  m.deferred = function () {
1237
- var deferred = new Deferred();
1238
- deferred.promise = propify(deferred.promise);
1239
  return deferred
1240
- };
 
1241
  function propify(promise, initialValue) {
1242
- var prop = m.prop(initialValue);
1243
- promise.then(prop);
1244
- prop.then = function(resolve, reject) {
1245
  return propify(promise.then(resolve, reject), initialValue)
1246
- };
 
 
1247
  return prop
1248
  }
1249
- //Promiz.mithril.js | Zolmeister | MIT
1250
- //a modified version of Promiz.js, which does not conform to Promises/A+ for two reasons:
1251
- //1) `then` callbacks are called synchronously (because setTimeout is too slow, and the setImmediate polyfill is too big
1252
- //2) throwing subclasses of Error cause the error to be bubbled up instead of triggering rejection (because the spec does not account for the important use case of default browser error handling, i.e. message w/ line number)
1253
- function Deferred(successCallback, failureCallback) {
1254
- var RESOLVING = 1, REJECTING = 2, RESOLVED = 3, REJECTED = 4;
1255
- var self = this, state = 0, promiseValue = 0, next = [];
 
 
 
 
 
 
 
 
 
1256
 
1257
- self["promise"] = {};
 
 
 
 
1258
 
1259
- self["resolve"] = function(value) {
 
 
1260
  if (!state) {
1261
- promiseValue = value;
1262
- state = RESOLVING;
1263
 
1264
  fire()
1265
  }
1266
- return this
1267
- };
1268
 
1269
- self["reject"] = function(value) {
 
 
 
1270
  if (!state) {
1271
- promiseValue = value;
1272
- state = REJECTING;
1273
 
1274
  fire()
1275
  }
1276
- return this
1277
- };
1278
 
1279
- self.promise["then"] = function(successCallback, failureCallback) {
1280
- var deferred = new Deferred(successCallback, failureCallback);
 
 
 
 
1281
  if (state === RESOLVED) {
1282
  deferred.resolve(promiseValue)
1283
- }
1284
- else if (state === REJECTED) {
1285
  deferred.reject(promiseValue)
1286
- }
1287
- else {
1288
  next.push(deferred)
1289
  }
 
1290
  return deferred.promise
1291
- };
1292
 
1293
  function finish(type) {
1294
- state = type || REJECTED;
1295
- next.map(function(deferred) {
1296
- state === RESOLVED && deferred.resolve(promiseValue) || deferred.reject(promiseValue)
 
 
 
 
1297
  })
1298
  }
1299
 
1300
- function thennable(then, successCallback, failureCallback, notThennableCallback) {
1301
- if (((promiseValue != null && type.call(promiseValue) === OBJECT) || typeof promiseValue === FUNCTION) && typeof then === FUNCTION) {
 
1302
  try {
1303
  // count protects against abuse calls from spec checker
1304
- var count = 0;
1305
- then.call(promiseValue, function(value) {
1306
- if (count++) return;
1307
- promiseValue = value;
1308
- successCallback()
1309
  }, function (value) {
1310
- if (count++) return;
1311
- promiseValue = value;
1312
- failureCallback()
1313
  })
1314
- }
1315
- catch (e) {
1316
- m.deferred.onerror(e);
1317
- promiseValue = e;
1318
- failureCallback()
1319
  }
1320
  } else {
1321
- notThennableCallback()
1322
  }
1323
  }
1324
 
1325
  function fire() {
1326
  // check if it's a thenable
1327
- var then;
1328
  try {
1329
  then = promiseValue && promiseValue.then
1330
- }
1331
- catch (e) {
1332
- m.deferred.onerror(e);
1333
- promiseValue = e;
1334
- state = REJECTING;
1335
  return fire()
1336
  }
1337
- thennable(then, function() {
1338
- state = RESOLVING;
 
 
 
 
 
1339
  fire()
1340
- }, function() {
1341
- state = REJECTING;
1342
  fire()
1343
- }, function() {
1344
  try {
1345
- if (state === RESOLVING && typeof successCallback === FUNCTION) {
1346
- promiseValue = successCallback(promiseValue)
1347
- }
1348
- else if (state === REJECTING && typeof failureCallback === "function") {
1349
- promiseValue = failureCallback(promiseValue);
1350
  state = RESOLVING
1351
  }
1352
- }
1353
- catch (e) {
1354
- m.deferred.onerror(e);
1355
- promiseValue = e;
1356
  return finish()
1357
  }
1358
 
1359
  if (promiseValue === self) {
1360
- promiseValue = TypeError();
1361
  finish()
1362
- }
1363
- else {
1364
  thennable(then, function () {
1365
  finish(RESOLVED)
1366
  }, finish, function () {
@@ -1370,178 +2295,235 @@ var m = (function app(window, undefined) {
1370
  })
1371
  }
1372
  }
1373
- m.deferred.onerror = function(e) {
1374
- if (type.call(e) === "[object Error]" && !e.constructor.toString().match(/ Error/)) throw e
1375
- };
1376
 
1377
- m.sync = function(args) {
1378
- var method = "resolve";
 
 
 
 
 
 
 
 
 
 
 
 
1379
  function synchronizer(pos, resolved) {
1380
- return function(value) {
1381
- results[pos] = value;
1382
- if (!resolved) method = "reject";
1383
  if (--outstanding === 0) {
1384
- deferred.promise(results);
1385
  deferred[method](results)
1386
  }
1387
  return value
1388
  }
1389
  }
1390
 
1391
- var deferred = m.deferred();
1392
- var outstanding = args.length;
1393
- var results = new Array(outstanding);
1394
  if (args.length > 0) {
1395
- for (var i = 0; i < args.length; i++) {
1396
- args[i].then(synchronizer(i, true), synchronizer(i, false))
1397
- }
 
 
1398
  }
1399
- else deferred.resolve([]);
1400
 
1401
  return deferred.promise
1402
- };
1403
- function identity(value) {return value}
1404
 
1405
- function ajax(options) {
1406
- if (options.dataType && options.dataType.toLowerCase() === "jsonp") {
1407
- var callbackKey = "mithril_callback_" + new Date().getTime() + "_" + (Math.round(Math.random() * 1e16)).toString(36);
1408
- var script = $document.createElement("script");
1409
-
1410
- window[callbackKey] = function(resp) {
1411
- script.parentNode.removeChild(script);
1412
- options.onload({
1413
- type: "load",
1414
- target: {
1415
- responseText: resp
1416
- }
1417
- });
1418
- window[callbackKey] = undefined
1419
- };
1420
 
1421
- script.onerror = function(e) {
1422
- script.parentNode.removeChild(script);
 
 
1423
 
1424
- options.onerror({
1425
- type: "error",
1426
- target: {
1427
- status: 500,
1428
- responseText: JSON.stringify({error: "Error making jsonp request"})
1429
- }
1430
- });
1431
- window[callbackKey] = undefined;
1432
-
1433
- return false
1434
- };
1435
-
1436
- script.onload = function(e) {
1437
- return false
1438
- };
1439
-
1440
- script.src = options.url
1441
- + (options.url.indexOf("?") > 0 ? "&" : "?")
1442
- + (options.callbackKey ? options.callbackKey : "callback")
1443
- + "=" + callbackKey
1444
- + "&" + buildQueryString(options.data || {});
1445
- $document.body.appendChild(script)
1446
- }
1447
- else {
1448
- var xhr = new window.XMLHttpRequest;
1449
- xhr.open(options.method, options.url, true, options.user, options.password);
1450
- xhr.onreadystatechange = function() {
1451
- if (xhr.readyState === 4) {
1452
- if (xhr.status >= 200 && xhr.status < 300) options.onload({type: "load", target: xhr});
1453
- else options.onerror({type: "error", target: xhr})
1454
  }
1455
- };
1456
- if (options.serialize === JSON.stringify && options.data && options.method !== "GET") {
1457
- xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8")
1458
- }
1459
- if (options.deserialize === JSON.parse) {
1460
- xhr.setRequestHeader("Accept", "application/json, text/*");
1461
- }
1462
- if (typeof options.config === FUNCTION) {
1463
- var maybeXhr = options.config(xhr, options);
1464
- if (maybeXhr != null) xhr = maybeXhr
1465
- }
 
 
 
 
 
 
1466
 
1467
- var data = options.method === "GET" || !options.data ? "" : options.data
1468
- if (data && (type.call(data) != STRING && data.constructor != window.FormData)) {
1469
- throw "Request data should be either be a string or FormData. Check the `serialize` option in `m.request`";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1470
  }
1471
- xhr.send(data);
1472
- return xhr
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1473
  }
1474
  }
1475
- function bindData(xhrOptions, data, serialize) {
1476
- if (xhrOptions.method === "GET" && xhrOptions.dataType != "jsonp") {
1477
- var prefix = xhrOptions.url.indexOf("?") < 0 ? "?" : "&";
1478
- var querystring = buildQueryString(data);
1479
- xhrOptions.url = xhrOptions.url + (querystring ? prefix + querystring : "")
 
 
 
1480
  }
1481
- else xhrOptions.data = serialize(data);
1482
- return xhrOptions
1483
  }
 
1484
  function parameterizeUrl(url, data) {
1485
- var tokens = url.match(/:[a-z]\w+/gi);
1486
- if (tokens && data) {
1487
- for (var i = 0; i < tokens.length; i++) {
1488
- var key = tokens[i].slice(1);
1489
- url = url.replace(tokens[i], data[key]);
1490
  delete data[key]
1491
- }
 
1492
  }
1493
  return url
1494
  }
1495
 
1496
- m.request = function(xhrOptions) {
1497
- if (xhrOptions.background !== true) m.startComputation();
1498
- var deferred = new Deferred();
1499
- var isJSONP = xhrOptions.dataType && xhrOptions.dataType.toLowerCase() === "jsonp";
1500
- var serialize = xhrOptions.serialize = isJSONP ? identity : xhrOptions.serialize || JSON.stringify;
1501
- var deserialize = xhrOptions.deserialize = isJSONP ? identity : xhrOptions.deserialize || JSON.parse;
1502
- var extract = isJSONP ? function(jsonp) {return jsonp.responseText} : xhrOptions.extract || function(xhr) {
1503
- return xhr.responseText.length === 0 && deserialize === JSON.parse ? null : xhr.responseText
1504
- };
1505
- xhrOptions.method = (xhrOptions.method || 'GET').toUpperCase();
1506
- xhrOptions.url = parameterizeUrl(xhrOptions.url, xhrOptions.data);
1507
- xhrOptions = bindData(xhrOptions, xhrOptions.data, serialize);
1508
- xhrOptions.onload = xhrOptions.onerror = function(e) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1509
  try {
1510
- e = e || event;
1511
- var unwrap = (e.type === "load" ? xhrOptions.unwrapSuccess : xhrOptions.unwrapError) || identity;
1512
- var response = unwrap(deserialize(extract(e.target, xhrOptions)), e.target);
1513
- if (e.type === "load") {
1514
- if (type.call(response) === ARRAY && xhrOptions.type) {
1515
- for (var i = 0; i < response.length; i++) response[i] = new xhrOptions.type(response[i])
 
 
 
 
 
 
 
 
 
 
 
 
 
1516
  }
1517
- else if (xhrOptions.type) response = new xhrOptions.type(response)
 
1518
  }
1519
- deferred[e.type === "load" ? "resolve" : "reject"](response)
1520
- }
1521
- catch (e) {
1522
- m.deferred.onerror(e);
1523
  deferred.reject(e)
 
 
1524
  }
1525
- if (xhrOptions.background !== true) m.endComputation()
1526
- };
1527
- ajax(xhrOptions);
1528
- deferred.promise = propify(deferred.promise, xhrOptions.initialValue);
1529
- return deferred.promise
1530
- };
1531
 
1532
- //testing API
1533
- m.deps = function(mock) {
1534
- initialize(window = mock || window);
1535
- return window;
1536
- };
1537
- //for internal testing only, do not use `m.deps.factory`
1538
- m.deps.factory = app;
1539
 
1540
  return m
1541
- })(typeof window != "undefined" ? window : {});
1542
-
1543
- if (typeof module != "undefined" && module !== null && module.exports) module.exports = m;
1544
- else if (typeof define === "function" && define.amd) define(function() {return m});
1545
 
1546
  },{}],7:[function(require,module,exports){
1547
  /*!
383
 
384
  module.exports = URL;
385
  },{}],6:[function(require,module,exports){
386
+ ;(function (global, factory) { // eslint-disable-line
387
+ "use strict"
388
+ /* eslint-disable no-undef */
389
+ var m = factory(global)
390
+ if (typeof module === "object" && module != null && module.exports) {
391
+ module.exports = m
392
+ } else if (typeof define === "function" && define.amd) {
393
+ define(function () { return m })
394
+ } else {
395
+ global.m = m
396
+ }
397
+ /* eslint-enable no-undef */
398
+ })(typeof window !== "undefined" ? window : {}, function (global, undefined) { // eslint-disable-line
399
+ "use strict"
400
+
401
+ m.version = function () {
402
+ return "v0.2.3"
403
+ }
404
+
405
+ var hasOwn = {}.hasOwnProperty
406
+ var type = {}.toString
407
+
408
+ function isFunction(object) {
409
+ return typeof object === "function"
410
+ }
411
+
412
+ function isObject(object) {
413
+ return type.call(object) === "[object Object]"
414
+ }
415
+
416
+ function isString(object) {
417
+ return type.call(object) === "[object String]"
418
+ }
419
+
420
+ var isArray = Array.isArray || function (object) {
421
+ return type.call(object) === "[object Array]"
422
+ }
423
+
424
+ function noop() {}
425
+
426
+ var voidElements = {
427
+ AREA: 1,
428
+ BASE: 1,
429
+ BR: 1,
430
+ COL: 1,
431
+ COMMAND: 1,
432
+ EMBED: 1,
433
+ HR: 1,
434
+ IMG: 1,
435
+ INPUT: 1,
436
+ KEYGEN: 1,
437
+ LINK: 1,
438
+ META: 1,
439
+ PARAM: 1,
440
+ SOURCE: 1,
441
+ TRACK: 1,
442
+ WBR: 1
443
+ }
444
 
445
  // caching commonly used variables
446
+ var $document, $location, $requestAnimationFrame, $cancelAnimationFrame
447
 
448
  // self invoking function needed because of the way mocks work
449
+ function initialize(mock) {
450
+ $document = mock.document
451
+ $location = mock.location
452
+ $cancelAnimationFrame = mock.cancelAnimationFrame || mock.clearTimeout
453
+ $requestAnimationFrame = mock.requestAnimationFrame || mock.setTimeout
454
  }
455
 
456
+ // testing API
457
+ m.deps = function (mock) {
458
+ initialize(global = mock || window)
459
+ return global
460
+ }
461
 
462
+ m.deps(global)
463
 
464
  /**
465
  * @typedef {String} Tag
467
  * Which describes a DOM node
468
  */
469
 
470
+ function parseTagAttrs(cell, tag) {
471
+ var classes = []
472
+ var parser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g
473
+ var match
474
+
475
+ while ((match = parser.exec(tag))) {
476
+ if (match[1] === "" && match[2]) {
477
+ cell.tag = match[2]
478
+ } else if (match[1] === "#") {
479
+ cell.attrs.id = match[2]
480
+ } else if (match[1] === ".") {
481
+ classes.push(match[2])
482
+ } else if (match[3][0] === "[") {
483
+ var pair = /\[(.+?)(?:=("|'|)(.*?)\2)?\]/.exec(match[3])
484
+ cell.attrs[pair[1]] = pair[3] || (pair[2] ? "" : true)
485
+ }
486
+ }
487
+
488
+ return classes
489
+ }
490
+
491
+ function getVirtualChildren(args, hasAttrs) {
492
+ var children = hasAttrs ? args.slice(1) : args
493
+
494
+ if (children.length === 1 && isArray(children[0])) {
495
+ return children[0]
496
+ } else {
497
+ return children
498
+ }
499
+ }
500
+
501
+ function assignAttrs(target, attrs, classes) {
502
+ var classAttr = "class" in attrs ? "class" : "className"
503
+
504
+ for (var attrName in attrs) {
505
+ if (hasOwn.call(attrs, attrName)) {
506
+ if (attrName === classAttr &&
507
+ attrs[attrName] != null &&
508
+ attrs[attrName] !== "") {
509
+ classes.push(attrs[attrName])
510
+ // create key in correct iteration order
511
+ target[attrName] = ""
512
+ } else {
513
+ target[attrName] = attrs[attrName]
514
+ }
515
+ }
516
+ }
517
+
518
+ if (classes.length) target[classAttr] = classes.join(" ")
519
+ }
520
+
521
  /**
522
  *
523
  * @param {Tag} The DOM node tag
524
  * @param {Object=[]} optional key-value pairs to be mapped to DOM attrs
525
+ * @param {...mNode=[]} Zero or more Mithril child nodes. Can be an array,
526
+ * or splat (optional)
527
  */
528
+ function m(tag, pairs) {
529
+ var args = [].slice.call(arguments, 1)
530
+
531
+ if (isObject(tag)) return parameterize(tag, args)
532
+
533
+ if (!isString(tag)) {
534
+ throw new Error("selector in m(selector, attrs, children) should " +
535
+ "be a string")
 
 
 
 
 
 
 
 
536
  }
537
 
538
+ var hasAttrs = pairs != null && isObject(pairs) &&
539
+ !("tag" in pairs || "view" in pairs || "subtree" in pairs)
540
+
541
+ var attrs = hasAttrs ? pairs : {}
542
+ var cell = {
543
+ tag: "div",
544
+ attrs: {},
545
+ children: getVirtualChildren(args, hasAttrs)
546
+ }
547
+
548
+ assignAttrs(cell.attrs, attrs, parseTagAttrs(cell, tag))
549
+ return cell
550
+ }
551
+
552
+ function forEach(list, f) {
553
+ for (var i = 0; i < list.length && !f(list[i], i++);) {
554
+ // function called in condition
555
  }
556
+ }
557
+
558
+ function forKeys(list, f) {
559
+ forEach(list, function (attrs, i) {
560
+ return (attrs = attrs && attrs.attrs) &&
561
+ attrs.key != null &&
562
+ f(attrs, i)
563
+ })
564
+ }
565
+ // This function was causing deopts in Chrome.
566
+ function dataToString(data) {
567
+ // data.toString() might throw or return null if data is the return
568
+ // value of Console.log in some versions of Firefox (behavior depends on
569
+ // version)
570
+ try {
571
+ if (data != null && data.toString() != null) return data
572
+ } catch (e) {
573
+ // silently ignore errors
574
  }
575
+ return ""
576
+ }
577
+
578
+ // This function was causing deopts in Chrome.
579
+ function injectTextNode(parentElement, first, index, data) {
580
+ try {
581
+ insertNode(parentElement, first, index)
582
+ first.nodeValue = data
583
+ } catch (e) {
584
+ // IE erroneously throws error when appending an empty text node
585
+ // after a null
586
+ }
587
+ }
588
+
589
+ function flatten(list) {
590
+ // recursively flatten array
591
+ for (var i = 0; i < list.length; i++) {
592
+ if (isArray(list[i])) {
593
+ list = list.concat.apply([], list)
594
+ // check current index again and flatten until there are no more
595
+ // nested arrays at that index
596
+ i--
597
  }
598
  }
599
+ return list
 
 
600
  }
601
+
602
+ function insertNode(parentElement, node, index) {
603
+ parentElement.insertBefore(node,
604
+ parentElement.childNodes[index] || null)
605
+ }
606
+
607
+ var DELETION = 1
608
+ var INSERTION = 2
609
+ var MOVE = 3
610
+
611
+ function handleKeysDiffer(data, existing, cached, parentElement) {
612
+ forKeys(data, function (key, i) {
613
+ existing[key = key.key] = existing[key] ? {
614
+ action: MOVE,
615
+ index: i,
616
+ from: existing[key].index,
617
+ element: cached.nodes[existing[key].index] ||
618
+ $document.createElement("div")
619
+ } : {action: INSERTION, index: i}
620
+ })
621
+
622
+ var actions = []
623
+ for (var prop in existing) if (hasOwn.call(existing, prop)) {
624
+ actions.push(existing[prop])
625
+ }
626
+
627
+ var changes = actions.sort(sortChanges)
628
+ var newCached = new Array(cached.length)
629
+
630
+ newCached.nodes = cached.nodes.slice()
631
+
632
+ forEach(changes, function (change) {
633
+ var index = change.index
634
+ if (change.action === DELETION) {
635
+ clear(cached[index].nodes, cached[index])
636
+ newCached.splice(index, 1)
 
 
637
  }
638
+ if (change.action === INSERTION) {
639
+ var dummy = $document.createElement("div")
640
+ dummy.key = data[index].attrs.key
641
+ insertNode(parentElement, dummy, index)
642
+ newCached.splice(index, 0, {
643
+ attrs: {key: data[index].attrs.key},
644
+ nodes: [dummy]
645
+ })
646
+ newCached.nodes[index] = dummy
 
 
 
 
647
  }
648
+
649
+ if (change.action === MOVE) {
650
+ var changeElement = change.element
651
+ var maybeChanged = parentElement.childNodes[index]
652
+ if (maybeChanged !== changeElement && changeElement !== null) {
653
+ parentElement.insertBefore(changeElement,
654
+ maybeChanged || null)
 
 
 
 
 
 
 
655
  }
656
+ newCached[index] = cached[change.from]
657
+ newCached.nodes[index] = changeElement
658
  }
659
+ })
660
+
661
+ return newCached
662
+ }
663
+
664
+ function diffKeys(data, cached, existing, parentElement) {
665
+ var keysDiffer = data.length !== cached.length
666
+
667
+ if (!keysDiffer) {
668
+ forKeys(data, function (attrs, i) {
669
+ var cachedCell = cached[i]
670
+ return keysDiffer = cachedCell &&
671
+ cachedCell.attrs &&
672
+ cachedCell.attrs.key !== attrs.key
673
+ })
674
+ }
675
+
676
+ if (keysDiffer) {
677
+ return handleKeysDiffer(data, existing, cached, parentElement)
678
+ } else {
679
+ return cached
680
+ }
681
+ }
682
+
683
+ function diffArray(data, cached, nodes) {
684
+ // diff the array itself
685
+
686
+ // update the list of DOM nodes by collecting the nodes from each item
687
+ forEach(data, function (_, i) {
688
+ if (cached[i] != null) nodes.push.apply(nodes, cached[i].nodes)
689
+ })
690
+ // remove items from the end of the array if the new array is shorter
691
+ // than the old one. if errors ever happen here, the issue is most
692
+ // likely a bug in the construction of the `cached` data structure
693
+ // somewhere earlier in the program
694
+ forEach(cached.nodes, function (node, i) {
695
+ if (node.parentNode != null && nodes.indexOf(node) < 0) {
696
+ clear([node], [cached[i]])
697
  }
698
+ })
699
+
700
+ if (data.length < cached.length) cached.length = data.length
701
+ cached.nodes = nodes
702
+ }
703
+
704
+ function buildArrayKeys(data) {
705
+ var guid = 0
706
+ forKeys(data, function () {
707
+ forEach(data, function (attrs) {
708
+ if ((attrs = attrs && attrs.attrs) && attrs.key == null) {
709
+ attrs.key = "__mithril__" + guid++
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
710
  }
711
+ })
712
+ return 1
713
+ })
714
+ }
715
+
716
+ function isDifferentEnough(data, cached, dataAttrKeys) {
717
+ if (data.tag !== cached.tag) return true
718
+
719
+ if (dataAttrKeys.sort().join() !==
720
+ Object.keys(cached.attrs).sort().join()) {
721
+ return true
722
+ }
723
+
724
+ if (data.attrs.id !== cached.attrs.id) {
725
+ return true
726
+ }
727
+
728
+ if (data.attrs.key !== cached.attrs.key) {
729
+ return true
730
+ }
731
+
732
+ if (m.redraw.strategy() === "all") {
733
+ return !cached.configContext || cached.configContext.retain !== true
734
+ }
735
+
736
+ if (m.redraw.strategy() === "diff") {
737
+ return cached.configContext && cached.configContext.retain === false
738
+ }
739
+
740
+ return false
741
+ }
742
+
743
+ function maybeRecreateObject(data, cached, dataAttrKeys) {
744
+ // if an element is different enough from the one in cache, recreate it
745
+ if (isDifferentEnough(data, cached, dataAttrKeys)) {
746
+ if (cached.nodes.length) clear(cached.nodes)
747
+
748
+ if (cached.configContext &&
749
+ isFunction(cached.configContext.onunload)) {
750
+ cached.configContext.onunload()
751
  }
752
+
753
+ if (cached.controllers) {
754
+ forEach(cached.controllers, function (controller) {
755
+ if (controller.onunload) controller.onunload({preventDefault: noop});
756
+ });
 
 
 
 
 
 
 
 
 
 
757
  }
758
+ }
759
+ }
760
+
761
+ function getObjectNamespace(data, namespace) {
762
+ if (data.attrs.xmlns) return data.attrs.xmlns
763
+ if (data.tag === "svg") return "http://www.w3.org/2000/svg"
764
+ if (data.tag === "math") return "http://www.w3.org/1998/Math/MathML"
765
+ return namespace
766
+ }
767
+
768
+ var pendingRequests = 0
769
+ m.startComputation = function () { pendingRequests++ }
770
+ m.endComputation = function () {
771
+ if (pendingRequests > 1) {
772
+ pendingRequests--
773
+ } else {
774
+ pendingRequests = 0
775
+ m.redraw()
776
+ }
777
+ }
778
+
779
+ function unloadCachedControllers(cached, views, controllers) {
780
+ if (controllers.length) {
781
+ cached.views = views
782
+ cached.controllers = controllers
783
+ forEach(controllers, function (controller) {
784
+ if (controller.onunload && controller.onunload.$old) {
785
+ controller.onunload = controller.onunload.$old
786
  }
787
+
788
+ if (pendingRequests && controller.onunload) {
789
+ var onunload = controller.onunload
790
+ controller.onunload = noop
791
+ controller.onunload.$old = onunload
792
  }
793
+ })
794
+ }
795
+ }
796
+
797
+ function scheduleConfigsToBeCalled(configs, data, node, isNew, cached) {
798
+ // schedule configs to be called. They are called after `build` finishes
799
+ // running
800
+ if (isFunction(data.attrs.config)) {
801
+ var context = cached.configContext = cached.configContext || {}
802
+
803
+ // bind
804
+ configs.push(function () {
805
+ return data.attrs.config.call(data, node, !isNew, context,
806
+ cached)
807
+ })
808
+ }
809
+ }
810
+
811
+ function buildUpdatedNode(
812
+ cached,
813
+ data,
814
+ editable,
815
+ hasKeys,
816
+ namespace,
817
+ views,
818
+ configs,
819
+ controllers
820
+ ) {
821
+ var node = cached.nodes[0]
822
+
823
+ if (hasKeys) {
824
+ setAttributes(node, data.tag, data.attrs, cached.attrs, namespace)
825
+ }
826
+
827
+ cached.children = build(
828
+ node,
829
+ data.tag,
830
+ undefined,
831
+ undefined,
832
+ data.children,
833
+ cached.children,
834
+ false,
835
+ 0,
836
+ data.attrs.contenteditable ? node : editable,
837
+ namespace,
838
+ configs
839
+ )
840
+
841
+ cached.nodes.intact = true
842
+
843
+ if (controllers.length) {
844
+ cached.views = views
845
+ cached.controllers = controllers
846
+ }
847
+
848
+ return node
849
+ }
850
+
851
+ function handleNonexistentNodes(data, parentElement, index) {
852
+ var nodes
853
+ if (data.$trusted) {
854
+ nodes = injectHTML(parentElement, index, data)
855
+ } else {
856
+ nodes = [$document.createTextNode(data)]
857
+ if (!(parentElement.nodeName in voidElements)) {
858
+ insertNode(parentElement, nodes[0], index)
859
  }
860
  }
861
+
862
+ var cached
863
+
864
+ if (typeof data === "string" ||
865
+ typeof data === "number" ||
866
+ typeof data === "boolean") {
867
+ cached = new data.constructor(data)
868
+ } else {
869
+ cached = data
870
+ }
871
+
872
+ cached.nodes = nodes
873
+ return cached
874
+ }
875
+
876
+ function reattachNodes(
877
+ data,
878
+ cached,
879
+ parentElement,
880
+ editable,
881
+ index,
882
+ parentTag
883
+ ) {
884
+ var nodes = cached.nodes
885
+ if (!editable || editable !== $document.activeElement) {
886
+ if (data.$trusted) {
887
+ clear(nodes, cached)
888
+ nodes = injectHTML(parentElement, index, data)
889
+ } else if (parentTag === "textarea") {
890
+ // <textarea> uses `value` instead of `nodeValue`.
891
+ parentElement.value = data
892
+ } else if (editable) {
893
+ // contenteditable nodes use `innerHTML` instead of `nodeValue`.
894
+ editable.innerHTML = data
895
+ } else {
896
+ // was a trusted string
897
+ if (nodes[0].nodeType === 1 || nodes.length > 1 ||
898
+ (nodes[0].nodeValue.trim &&
899
+ !nodes[0].nodeValue.trim())) {
900
+ clear(cached.nodes, cached)
901
+ nodes = [$document.createTextNode(data)]
902
  }
903
+
904
+ injectTextNode(parentElement, nodes[0], index, data)
 
905
  }
906
+ }
907
+ cached = new data.constructor(data)
908
+ cached.nodes = nodes
909
+ return cached
910
+ }
911
+
912
+ function handleTextNode(
913
+ cached,
914
+ data,
915
+ index,
916
+ parentElement,
917
+ shouldReattach,
918
+ editable,
919
+ parentTag
920
+ ) {
921
+ if (!cached.nodes.length) {
922
+ return handleNonexistentNodes(data, parentElement, index)
923
+ } else if (cached.valueOf() !== data.valueOf() || shouldReattach) {
924
+ return reattachNodes(data, cached, parentElement, editable, index,
925
+ parentTag)
926
+ } else {
927
+ return (cached.nodes.intact = true, cached)
928
+ }
929
+ }
930
+
931
+ function getSubArrayCount(item) {
932
+ if (item.$trusted) {
933
+ // fix offset of next element if item was a trusted string w/ more
934
+ // than one html element
935
+ // the first clause in the regexp matches elements
936
+ // the second clause (after the pipe) matches text nodes
937
+ var match = item.match(/<[^\/]|\>\s*[^<]/g)
938
+ if (match != null) return match.length
939
+ } else if (isArray(item)) {
940
+ return item.length
941
+ }
942
+ return 1
943
+ }
944
+
945
+ function buildArray(
946
+ data,
947
+ cached,
948
+ parentElement,
949
+ index,
950
+ parentTag,
951
+ shouldReattach,
952
+ editable,
953
+ namespace,
954
+ configs
955
+ ) {
956
+ data = flatten(data)
957
+ var nodes = []
958
+ var intact = cached.length === data.length
959
+ var subArrayCount = 0
960
+
961
+ // keys algorithm: sort elements without recreating them if keys are
962
+ // present
963
+ //
964
+ // 1) create a map of all existing keys, and mark all for deletion
965
+ // 2) add new keys to map and mark them for addition
966
+ // 3) if key exists in new list, change action from deletion to a move
967
+ // 4) for each key, handle its corresponding action as marked in
968
+ // previous steps
969
+
970
+ var existing = {}
971
+ var shouldMaintainIdentities = false
972
+
973
+ forKeys(cached, function (attrs, i) {
974
+ shouldMaintainIdentities = true
975
+ existing[cached[i].attrs.key] = {action: DELETION, index: i}
976
+ })
977
+
978
+ buildArrayKeys(data)
979
+ if (shouldMaintainIdentities) {
980
+ cached = diffKeys(data, cached, existing, parentElement)
981
+ }
982
+ // end key algorithm
983
+
984
+ var cacheCount = 0
985
+ // faster explicitly written
986
+ for (var i = 0, len = data.length; i < len; i++) {
987
+ // diff each item in the array
988
+ var item = build(
989
+ parentElement,
990
+ parentTag,
991
+ cached,
992
+ index,
993
+ data[i],
994
+ cached[cacheCount],
995
+ shouldReattach,
996
+ index + subArrayCount || subArrayCount,
997
+ editable,
998
+ namespace,
999
+ configs)
1000
+
1001
+ if (item !== undefined) {
1002
+ intact = intact && item.nodes.intact
1003
+ subArrayCount += getSubArrayCount(item)
1004
+ cached[cacheCount++] = item
1005
  }
1006
+ }
1007
+
1008
+ if (!intact) diffArray(data, cached, nodes)
1009
+ return cached
1010
+ }
1011
+
1012
+ function makeCache(data, cached, index, parentIndex, parentCache) {
1013
+ if (cached != null) {
1014
+ if (type.call(cached) === type.call(data)) return cached
1015
+
1016
+ if (parentCache && parentCache.nodes) {
1017
+ var offset = index - parentIndex
1018
+ var end = offset + (isArray(data) ? data : cached.nodes).length
1019
+ clear(
1020
+ parentCache.nodes.slice(offset, end),
1021
+ parentCache.slice(offset, end))
1022
+ } else if (cached.nodes) {
1023
+ clear(cached.nodes, cached)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1024
  }
1025
+ }
1026
+
1027
+ cached = new data.constructor()
1028
+ // if constructor creates a virtual dom element, use a blank object as
1029
+ // the base cached node instead of copying the virtual el (#277)
1030
+ if (cached.tag) cached = {}
1031
+ cached.nodes = []
1032
+ return cached
1033
+ }
1034
+
1035
+ function constructNode(data, namespace) {
1036
+ if (data.attrs.is) {
1037
+ if (namespace == null) {
1038
+ return $document.createElement(data.tag, data.attrs.is)
1039
+ } else {
1040
+ return $document.createElementNS(namespace, data.tag,
1041
+ data.attrs.is)
1042
  }
1043
+ } else if (namespace == null) {
1044
+ return $document.createElement(data.tag)
1045
+ } else {
1046
+ return $document.createElementNS(namespace, data.tag)
1047
+ }
1048
+ }
1049
+
1050
+ function constructAttrs(data, node, namespace, hasKeys) {
1051
+ if (hasKeys) {
1052
+ return setAttributes(node, data.tag, data.attrs, {}, namespace)
1053
+ } else {
1054
+ return data.attrs
1055
+ }
1056
+ }
1057
+
1058
+ function constructChildren(
1059
+ data,
1060
+ node,
1061
+ cached,
1062
+ editable,
1063
+ namespace,
1064
+ configs
1065
+ ) {
1066
+ if (data.children != null && data.children.length > 0) {
1067
+ return build(
1068
+ node,
1069
+ data.tag,
1070
+ undefined,
1071
+ undefined,
1072
+ data.children,
1073
+ cached.children,
1074
+ true,
1075
+ 0,
1076
+ data.attrs.contenteditable ? node : editable,
1077
+ namespace,
1078
+ configs)
1079
+ } else {
1080
+ return data.children
1081
+ }
1082
+ }
1083
+
1084
+ function reconstructCached(
1085
+ data,
1086
+ attrs,
1087
+ children,
1088
+ node,
1089
+ namespace,
1090
+ views,
1091
+ controllers
1092
+ ) {
1093
+ var cached = {
1094
+ tag: data.tag,
1095
+ attrs: attrs,
1096
+ children: children,
1097
+ nodes: [node]
1098
+ }
1099
+
1100
+ unloadCachedControllers(cached, views, controllers)
1101
+
1102
+ if (cached.children && !cached.children.nodes) {
1103
+ cached.children.nodes = []
1104
+ }
1105
+
1106
+ // edge case: setting value on <select> doesn't work before children
1107
+ // exist, so set it again after children have been created
1108
+ if (data.tag === "select" && "value" in data.attrs) {
1109
+ setAttributes(node, data.tag, {value: data.attrs.value}, {},
1110
+ namespace)
1111
+ }
1112
+
1113
+ return cached
1114
+ }
1115
+
1116
+ function getController(views, view, cachedControllers, controller) {
1117
+ var controllerIndex
1118
+
1119
+ if (m.redraw.strategy() === "diff" && views) {
1120
+ controllerIndex = views.indexOf(view)
1121
+ } else {
1122
+ controllerIndex = -1
1123
+ }
1124
+
1125
+ if (controllerIndex > -1) {
1126
+ return cachedControllers[controllerIndex]
1127
+ } else if (isFunction(controller)) {
1128
+ return new controller()
1129
+ } else {
1130
+ return {}
1131
+ }
1132
+ }
1133
+
1134
+ var unloaders = []
1135
+
1136
+ function updateLists(views, controllers, view, controller) {
1137
+ if (controller.onunload != null && unloaders.map(function(u) {return u.handler}).indexOf(controller.onunload) < 0) {
1138
+ unloaders.push({
1139
+ controller: controller,
1140
+ handler: controller.onunload
1141
+ })
1142
+ }
1143
+
1144
+ views.push(view)
1145
+ controllers.push(controller)
1146
+ }
1147
+
1148
+ var forcing = false
1149
+ function checkView(data, view, cached, cachedControllers, controllers, views) {
1150
+ var controller = getController(cached.views, view, cachedControllers, data.controller)
1151
+ var key = data && data.attrs && data.attrs.key
1152
+ data = pendingRequests === 0 || forcing || cachedControllers && cachedControllers.indexOf(controller) > -1 ? data.view(controller) : {tag: "placeholder"}
1153
+ if (data.subtree === "retain") return data;
1154
+ data.attrs = data.attrs || {}
1155
+ data.attrs.key = key
1156
+ updateLists(views, controllers, view, controller)
1157
+ return data
1158
+ }
1159
+
1160
+ function markViews(data, cached, views, controllers) {
1161
+ var cachedControllers = cached && cached.controllers
1162
+
1163
+ while (data.view != null) {
1164
+ data = checkView(
1165
+ data,
1166
+ data.view.$original || data.view,
1167
+ cached,
1168
+ cachedControllers,
1169
+ controllers,
1170
+ views)
1171
+ }
1172
+
1173
+ return data
1174
+ }
1175
+
1176
+ function buildObject( // eslint-disable-line max-statements
1177
+ data,
1178
+ cached,
1179
+ editable,
1180
+ parentElement,
1181
+ index,
1182
+ shouldReattach,
1183
+ namespace,
1184
+ configs
1185
+ ) {
1186
+ var views = []
1187
+ var controllers = []
1188
+
1189
+ data = markViews(data, cached, views, controllers)
1190
+
1191
+ if (data.subtree === "retain") return cached
1192
+
1193
+ if (!data.tag && controllers.length) {
1194
+ throw new Error("Component template must return a virtual " +
1195
+ "element, not an array, string, etc.")
1196
+ }
1197
+
1198
+ data.attrs = data.attrs || {}
1199
+ cached.attrs = cached.attrs || {}
1200
+
1201
+ var dataAttrKeys = Object.keys(data.attrs)
1202
+ var hasKeys = dataAttrKeys.length > ("key" in data.attrs ? 1 : 0)
1203
+
1204
+ maybeRecreateObject(data, cached, dataAttrKeys)
1205
+
1206
+ if (!isString(data.tag)) return
1207
+
1208
+ var isNew = cached.nodes.length === 0
1209
+
1210
+ namespace = getObjectNamespace(data, namespace)
1211
+
1212
+ var node
1213
+ if (isNew) {
1214
+ node = constructNode(data, namespace)
1215
+ // set attributes first, then create children
1216
+ var attrs = constructAttrs(data, node, namespace, hasKeys)
1217
+
1218
+ var children = constructChildren(data, node, cached, editable,
1219
+ namespace, configs)
1220
+
1221
+ cached = reconstructCached(
1222
+ data,
1223
+ attrs,
1224
+ children,
1225
+ node,
1226
+ namespace,
1227
+ views,
1228
+ controllers)
1229
+ } else {
1230
+ node = buildUpdatedNode(
1231
+ cached,
1232
+ data,
1233
+ editable,
1234
+ hasKeys,
1235
+ namespace,
1236
+ views,
1237
+ configs,
1238
+ controllers)
1239
+ }
1240
+
1241
+ if (isNew || shouldReattach === true && node != null) {
1242
+ insertNode(parentElement, node, index)
1243
+ }
1244
+
1245
+ // The configs are called after `build` finishes running
1246
+ scheduleConfigsToBeCalled(configs, data, node, isNew, cached)
1247
+
1248
+ return cached
1249
+ }
1250
+
1251
+ function build(
1252
+ parentElement,
1253
+ parentTag,
1254
+ parentCache,
1255
+ parentIndex,
1256
+ data,
1257
+ cached,
1258
+ shouldReattach,
1259
+ index,
1260
+ editable,
1261
+ namespace,
1262
+ configs
1263
+ ) {
1264
+ /*
1265
+ * `build` is a recursive function that manages creation/diffing/removal
1266
+ * of DOM elements based on comparison between `data` and `cached` the
1267
+ * diff algorithm can be summarized as this:
1268
+ *
1269
+ * 1 - compare `data` and `cached`
1270
+ * 2 - if they are different, copy `data` to `cached` and update the DOM
1271
+ * based on what the difference is
1272
+ * 3 - recursively apply this algorithm for every array and for the
1273
+ * children of every virtual element
1274
+ *
1275
+ * The `cached` data structure is essentially the same as the previous
1276
+ * redraw's `data` data structure, with a few additions:
1277
+ * - `cached` always has a property called `nodes`, which is a list of
1278
+ * DOM elements that correspond to the data represented by the
1279
+ * respective virtual element
1280
+ * - in order to support attaching `nodes` as a property of `cached`,
1281
+ * `cached` is *always* a non-primitive object, i.e. if the data was
1282
+ * a string, then cached is a String instance. If data was `null` or
1283
+ * `undefined`, cached is `new String("")`
1284
+ * - `cached also has a `configContext` property, which is the state
1285
+ * storage object exposed by config(element, isInitialized, context)
1286
+ * - when `cached` is an Object, it represents a virtual element; when
1287
+ * it's an Array, it represents a list of elements; when it's a
1288
+ * String, Number or Boolean, it represents a text node
1289
+ *
1290
+ * `parentElement` is a DOM element used for W3C DOM API calls
1291
+ * `parentTag` is only used for handling a corner case for textarea
1292
+ * values
1293
+ * `parentCache` is used to remove nodes in some multi-node cases
1294
+ * `parentIndex` and `index` are used to figure out the offset of nodes.
1295
+ * They're artifacts from before arrays started being flattened and are
1296
+ * likely refactorable
1297
+ * `data` and `cached` are, respectively, the new and old nodes being
1298
+ * diffed
1299
+ * `shouldReattach` is a flag indicating whether a parent node was
1300
+ * recreated (if so, and if this node is reused, then this node must
1301
+ * reattach itself to the new parent)
1302
+ * `editable` is a flag that indicates whether an ancestor is
1303
+ * contenteditable
1304
+ * `namespace` indicates the closest HTML namespace as it cascades down
1305
+ * from an ancestor
1306
+ * `configs` is a list of config functions to run after the topmost
1307
+ * `build` call finishes running
1308
+ *
1309
+ * there's logic that relies on the assumption that null and undefined
1310
+ * data are equivalent to empty strings
1311
+ * - this prevents lifecycle surprises from procedural helpers that mix
1312
+ * implicit and explicit return statements (e.g.
1313
+ * function foo() {if (cond) return m("div")}
1314
+ * - it simplifies diffing code
1315
+ */
1316
+ data = dataToString(data)
1317
+ if (data.subtree === "retain") return cached
1318
+ cached = makeCache(data, cached, index, parentIndex, parentCache)
1319
+
1320
+ if (isArray(data)) {
1321
+ return buildArray(
1322
+ data,
1323
+ cached,
1324
+ parentElement,
1325
+ index,
1326
+ parentTag,
1327
+ shouldReattach,
1328
+ editable,
1329
+ namespace,
1330
+ configs)
1331
+ } else if (data != null && isObject(data)) {
1332
+ return buildObject(
1333
+ data,
1334
+ cached,
1335
+ editable,
1336
+ parentElement,
1337
+ index,
1338
+ shouldReattach,
1339
+ namespace,
1340
+ configs)
1341
+ } else if (!isFunction(data)) {
1342
+ return handleTextNode(
1343
+ cached,
1344
+ data,
1345
+ index,
1346
+ parentElement,
1347
+ shouldReattach,
1348
+ editable,
1349
+ parentTag)
1350
+ } else {
1351
+ return cached
1352
+ }
1353
+ }
1354
+
1355
+ function sortChanges(a, b) {
1356
+ return a.action - b.action || a.index - b.index
1357
+ }
1358
+
1359
+ function copyStyleAttrs(node, dataAttr, cachedAttr) {
1360
+ for (var rule in dataAttr) if (hasOwn.call(dataAttr, rule)) {
1361
+ if (cachedAttr == null || cachedAttr[rule] !== dataAttr[rule]) {
1362
+ node.style[rule] = dataAttr[rule]
1363
  }
1364
  }
1365
+
1366
+ for (rule in cachedAttr) if (hasOwn.call(cachedAttr, rule)) {
1367
+ if (!hasOwn.call(dataAttr, rule)) node.style[rule] = ""
1368
+ }
1369
+ }
1370
+
1371
+ var shouldUseSetAttribute = {
1372
+ list: 1,
1373
+ style: 1,
1374
+ form: 1,
1375
+ type: 1,
1376
+ width: 1,
1377
+ height: 1
1378
+ }
1379
+
1380
+ function setSingleAttr(
1381
+ node,
1382
+ attrName,
1383
+ dataAttr,
1384
+ cachedAttr,
1385
+ tag,
1386
+ namespace
1387
+ ) {
1388
+ if (attrName === "config" || attrName === "key") {
1389
+ // `config` isn't a real attribute, so ignore it
1390
+ return true
1391
+ } else if (isFunction(dataAttr) && attrName.slice(0, 2) === "on") {
1392
+ // hook event handlers to the auto-redrawing system
1393
+ node[attrName] = autoredraw(dataAttr, node)
1394
+ } else if (attrName === "style" && dataAttr != null &&
1395
+ isObject(dataAttr)) {
1396
+ // handle `style: {...}`
1397
+ copyStyleAttrs(node, dataAttr, cachedAttr)
1398
+ } else if (namespace != null) {
1399
+ // handle SVG
1400
+ if (attrName === "href") {
1401
+ node.setAttributeNS("http://www.w3.org/1999/xlink",
1402
+ "href", dataAttr)
1403
+ } else {
1404
+ node.setAttribute(
1405
+ attrName === "className" ? "class" : attrName,
1406
+ dataAttr)
1407
  }
1408
+ } else if (attrName in node && !shouldUseSetAttribute[attrName]) {
1409
+ // handle cases that are properties (but ignore cases where we
1410
+ // should use setAttribute instead)
1411
+ //
1412
+ // - list and form are typically used as strings, but are DOM
1413
+ // element references in js
1414
+ //
1415
+ // - when using CSS selectors (e.g. `m("[style='']")`), style is
1416
+ // used as a string, but it's an object in js
1417
+ //
1418
+ // #348 don't set the value if not needed - otherwise, cursor
1419
+ // placement breaks in Chrome
1420
+ try {
1421
+ if (tag !== "input" || node[attrName] !== dataAttr) {
1422
+ node[attrName] = dataAttr
 
 
 
 
 
 
1423
  }
1424
+ } catch (e) {
1425
+ node.setAttribute(attrName, dataAttr)
1426
  }
 
1427
  }
1428
+ else node.setAttribute(attrName, dataAttr)
1429
+ }
1430
 
1431
+ function trySetAttr(
1432
+ node,
1433
+ attrName,
1434
+ dataAttr,
1435
+ cachedAttr,
1436
+ cachedAttrs,
1437
+ tag,
1438
+ namespace
1439
+ ) {
1440
+ if (!(attrName in cachedAttrs) || (cachedAttr !== dataAttr)) {
1441
+ cachedAttrs[attrName] = dataAttr
1442
+ try {
1443
+ return setSingleAttr(
1444
+ node,
1445
+ attrName,
1446
+ dataAttr,
1447
+ cachedAttr,
1448
+ tag,
1449
+ namespace)
1450
+ } catch (e) {
1451
+ // swallow IE's invalid argument errors to mimic HTML's
1452
+ // fallback-to-doing-nothing-on-invalid-attributes behavior
1453
+ if (e.message.indexOf("Invalid argument") < 0) throw e
1454
+ }
1455
+ } else if (attrName === "value" && tag === "input" &&
1456
+ node.value !== dataAttr) {
1457
+ // #348 dataAttr may not be a string, so use loose comparison
1458
+ node.value = dataAttr
1459
+ }
1460
  }
1461
+
1462
  function setAttributes(node, tag, dataAttrs, cachedAttrs, namespace) {
1463
+ for (var attrName in dataAttrs) if (hasOwn.call(dataAttrs, attrName)) {
1464
+ if (trySetAttr(
1465
+ node,
1466
+ attrName,
1467
+ dataAttrs[attrName],
1468
+ cachedAttrs[attrName],
1469
+ cachedAttrs,
1470
+ tag,
1471
+ namespace)) {
1472
+ continue
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1473
  }
1474
  }
1475
  return cachedAttrs
1476
  }
1477
+
1478
  function clear(nodes, cached) {
1479
  for (var i = nodes.length - 1; i > -1; i--) {
1480
  if (nodes[i] && nodes[i].parentNode) {
1481
+ try {
1482
+ nodes[i].parentNode.removeChild(nodes[i])
1483
+ } catch (e) {
1484
+ /* eslint-disable max-len */
1485
+ // ignore if this fails due to order of events (see
1486
+ // http://stackoverflow.com/questions/21926083/failed-to-execute-removechild-on-node)
1487
+ /* eslint-enable max-len */
1488
+ }
1489
+ cached = [].concat(cached)
1490
  if (cached[i]) unload(cached[i])
1491
  }
1492
  }
1493
+ // release memory if nodes is an array. This check should fail if nodes
1494
+ // is a NodeList (see loop above)
1495
+ if (nodes.length) {
1496
+ nodes.length = 0
1497
+ }
1498
  }
1499
+
1500
  function unload(cached) {
1501
+ if (cached.configContext && isFunction(cached.configContext.onunload)) {
1502
+ cached.configContext.onunload()
1503
  cached.configContext.onunload = null
1504
  }
1505
  if (cached.controllers) {
1506
+ forEach(cached.controllers, function (controller) {
1507
+ if (isFunction(controller.onunload)) {
1508
+ controller.onunload({preventDefault: noop})
1509
+ }
1510
+ })
1511
  }
1512
  if (cached.children) {
1513
+ if (isArray(cached.children)) forEach(cached.children, unload)
 
 
1514
  else if (cached.children.tag) unload(cached.children)
1515
  }
1516
  }
1517
+
1518
+ function appendTextFragment(parentElement, data) {
1519
+ try {
1520
+ parentElement.appendChild(
1521
+ $document.createRange().createContextualFragment(data))
1522
+ } catch (e) {
1523
+ parentElement.insertAdjacentHTML("beforeend", data)
1524
+ }
1525
+ }
1526
+
1527
  function injectHTML(parentElement, index, data) {
1528
+ var nextSibling = parentElement.childNodes[index]
1529
  if (nextSibling) {
1530
+ var isElement = nextSibling.nodeType !== 1
1531
+ var placeholder = $document.createElement("span")
1532
  if (isElement) {
1533
+ parentElement.insertBefore(placeholder, nextSibling || null)
1534
+ placeholder.insertAdjacentHTML("beforebegin", data)
1535
  parentElement.removeChild(placeholder)
1536
+ } else {
1537
+ nextSibling.insertAdjacentHTML("beforebegin", data)
1538
  }
1539
+ } else {
1540
+ appendTextFragment(parentElement, data)
1541
  }
1542
+
1543
+ var nodes = []
1544
+
1545
  while (parentElement.childNodes[index] !== nextSibling) {
1546
+ nodes.push(parentElement.childNodes[index])
1547
  index++
1548
  }
1549
+
1550
  return nodes
1551
  }
1552
+
1553
  function autoredraw(callback, object) {
1554
+ return function (e) {
1555
+ e = e || event
1556
+ m.redraw.strategy("diff")
1557
+ m.startComputation()
1558
+ try {
1559
+ return callback.call(object, e)
1560
+ } finally {
1561
  endFirstComputation()
1562
  }
1563
  }
1564
  }
1565
 
1566
+ var html
1567
  var documentNode = {
1568
+ appendChild: function (node) {
1569
+ if (html === undefined) html = $document.createElement("html")
1570
+ if ($document.documentElement &&
1571
+ $document.documentElement !== node) {
1572
  $document.replaceChild(node, $document.documentElement)
1573
+ } else {
1574
+ $document.appendChild(node)
1575
  }
1576
+
1577
  this.childNodes = $document.childNodes
1578
  },
1579
+
1580
+ insertBefore: function (node) {
1581
  this.appendChild(node)
1582
  },
1583
+
1584
  childNodes: []
1585
+ }
1586
+
1587
+ var nodeCache = []
1588
+ var cellCache = {}
1589
+
1590
+ m.render = function (root, cell, forceRecreation) {
1591
+ if (!root) {
1592
+ throw new Error("Ensure the DOM element being passed to " +
1593
+ "m.route/m.mount/m.render is not undefined.")
1594
+ }
1595
+ var configs = []
1596
+ var id = getCellCacheKey(root)
1597
+ var isDocumentRoot = root === $document
1598
+ var node
1599
+
1600
+ if (isDocumentRoot || root === $document.documentElement) {
1601
+ node = documentNode
1602
+ } else {
1603
+ node = root
1604
+ }
1605
+
1606
+ if (isDocumentRoot && cell.tag !== "html") {
1607
+ cell = {tag: "html", attrs: {}, children: cell}
1608
+ }
1609
+
1610
+ if (cellCache[id] === undefined) clear(node.childNodes)
1611
+ if (forceRecreation === true) reset(root)
1612
+
1613
+ cellCache[id] = build(
1614
+ node,
1615
+ null,
1616
+ undefined,
1617
+ undefined,
1618
+ cell,
1619
+ cellCache[id],
1620
+ false,
1621
+ 0,
1622
+ null,
1623
+ undefined,
1624
+ configs)
1625
+
1626
+ forEach(configs, function (config) { config() })
1627
+ }
1628
+
1629
  function getCellCacheKey(element) {
1630
+ var index = nodeCache.indexOf(element)
1631
  return index < 0 ? nodeCache.push(element) - 1 : index
1632
  }
1633
 
1634
+ m.trust = function (value) {
1635
+ value = new String(value) // eslint-disable-line no-new-wrappers
1636
+ value.$trusted = true
1637
  return value
1638
+ }
1639
 
1640
  function gettersetter(store) {
1641
+ function prop() {
1642
+ if (arguments.length) store = arguments[0]
1643
  return store
1644
+ }
1645
 
1646
+ prop.toJSON = function () {
1647
  return store
1648
+ }
1649
 
1650
  return prop
1651
  }
1652
 
1653
  m.prop = function (store) {
1654
+ if ((store != null && isObject(store) || isFunction(store)) &&
1655
+ isFunction(store.then)) {
1656
  return propify(store)
1657
  }
1658
 
1659
  return gettersetter(store)
1660
+ }
1661
+
1662
+ var roots = []
1663
+ var components = []
1664
+ var controllers = []
1665
+ var lastRedrawId = null
1666
+ var lastRedrawCallTime = 0
1667
+ var computePreRedrawHook = null
1668
+ var computePostRedrawHook = null
1669
+ var topComponent
1670
+ var FRAME_BUDGET = 16 // 60 frames per second = 1 call per 16 ms
1671
 
 
 
1672
  function parameterize(component, args) {
1673
+ function controller() {
1674
+ /* eslint-disable no-invalid-this */
1675
  return (component.controller || noop).apply(this, args) || this
1676
+ /* eslint-enable no-invalid-this */
1677
+ }
1678
+
1679
+ if (component.controller) {
1680
+ controller.prototype = component.controller.prototype
1681
  }
1682
+
1683
+ function view(ctrl) {
1684
+ var currentArgs = [ctrl].concat(args)
1685
+ for (var i = 1; i < arguments.length; i++) {
1686
+ currentArgs.push(arguments[i])
1687
+ }
1688
+
1689
+ return component.view.apply(component, currentArgs)
1690
  }
1691
+
1692
  view.$original = component.view
1693
  var output = {controller: controller, view: view}
1694
  if (args[0] && args[0].key != null) output.attrs = {key: args[0].key}
1695
  return output
1696
  }
1697
+
1698
+ m.component = function (component) {
1699
+ var args = [].slice.call(arguments, 1)
1700
+
1701
+ return parameterize(component, args)
1702
+ }
1703
+
1704
+ function checkPrevented(component, root, index, isPrevented) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1705
  if (!isPrevented) {
1706
+ m.redraw.strategy("all")
1707
+ m.startComputation()
1708
+ roots[index] = root
1709
+ var currentComponent
1710
+
1711
+ if (component) {
1712
+ currentComponent = topComponent = component
1713
+ } else {
1714
+ currentComponent = topComponent = component = {controller: noop}
1715
+ }
1716
+
1717
+ var controller = new (component.controller || noop)()
1718
+
1719
+ // controllers may call m.mount recursively (via m.route redirects,
1720
+ // for example)
1721
+ // this conditional ensures only the last recursive m.mount call is
1722
+ // applied
1723
  if (currentComponent === topComponent) {
1724
+ controllers[index] = controller
1725
  components[index] = component
1726
  }
1727
+ endFirstComputation()
1728
+ if (component === null) {
1729
+ removeRootElement(root, index)
1730
+ }
1731
  return controllers[index]
1732
+ } else if (component == null) {
1733
+ removeRootElement(root, index)
1734
+ }
1735
+ }
1736
+
1737
+ m.mount = m.module = function (root, component) {
1738
+ if (!root) {
1739
+ throw new Error("Please ensure the DOM element exists before " +
1740
+ "rendering a template into it.")
1741
+ }
1742
+
1743
+ var index = roots.indexOf(root)
1744
+ if (index < 0) index = roots.length
1745
+
1746
+ var isPrevented = false
1747
+ var event = {
1748
+ preventDefault: function () {
1749
+ isPrevented = true
1750
+ computePreRedrawHook = computePostRedrawHook = null
1751
+ }
1752
+ }
1753
+
1754
+ forEach(unloaders, function (unloader) {
1755
+ unloader.handler.call(unloader.controller, event)
1756
+ unloader.controller.onunload = null
1757
+ })
1758
+
1759
+ if (isPrevented) {
1760
+ forEach(unloaders, function (unloader) {
1761
+ unloader.controller.onunload = unloader.handler
1762
+ })
1763
+ } else {
1764
+ unloaders = []
1765
  }
1766
+
1767
+ if (controllers[index] && isFunction(controllers[index].onunload)) {
1768
+ controllers[index].onunload(event)
1769
+ }
1770
+
1771
+ return checkPrevented(component, root, index, isPrevented)
1772
+ }
1773
+
1774
+ function removeRootElement(root, index) {
1775
+ roots.splice(index, 1)
1776
+ controllers.splice(index, 1)
1777
+ components.splice(index, 1)
1778
+ reset(root)
1779
+ nodeCache.splice(getCellCacheKey(root), 1)
1780
+ }
1781
+
1782
  var redrawing = false
1783
+ m.redraw = function (force) {
1784
  if (redrawing) return
1785
  redrawing = true
1786
+ if (force) forcing = true
1787
+
1788
+ try {
1789
+ // lastRedrawId is a positive number if a second redraw is requested
1790
+ // before the next animation frame
1791
+ // lastRedrawID is null if it's the first redraw and not an event
1792
+ // handler
1793
+ if (lastRedrawId && !force) {
1794
+ // when setTimeout: only reschedule redraw if time between now
1795
+ // and previous redraw is bigger than a frame, otherwise keep
1796
+ // currently scheduled timeout
1797
+ // when rAF: always reschedule redraw
1798
+ if ($requestAnimationFrame === global.requestAnimationFrame ||
1799
+ new Date() - lastRedrawCallTime > FRAME_BUDGET) {
1800
+ if (lastRedrawId > 0) $cancelAnimationFrame(lastRedrawId)
1801
+ lastRedrawId = $requestAnimationFrame(redraw, FRAME_BUDGET)
1802
+ }
1803
+ } else {
1804
+ redraw()
1805
+ lastRedrawId = $requestAnimationFrame(function () {
1806
+ lastRedrawId = null
1807
+ }, FRAME_BUDGET)
1808
  }
1809
+ } finally {
1810
+ redrawing = forcing = false
1811
  }
1812
+ }
1813
+
1814
+ m.redraw.strategy = m.prop()
 
 
 
 
1815
  function redraw() {
1816
  if (computePreRedrawHook) {
1817
  computePreRedrawHook()
1818
  computePreRedrawHook = null
1819
  }
1820
+ forEach(roots, function (root, i) {
1821
+ var component = components[i]
1822
  if (controllers[i]) {
1823
+ var args = [controllers[i]]
1824
+ m.render(root,
1825
+ component.view ? component.view(controllers[i], args) : "")
1826
  }
1827
+ })
1828
+ // after rendering within a routed context, we need to scroll back to
1829
+ // the top, and fetch the document title for history.pushState
1830
  if (computePostRedrawHook) {
1831
+ computePostRedrawHook()
1832
  computePostRedrawHook = null
1833
  }
1834
+ lastRedrawId = null
1835
+ lastRedrawCallTime = new Date()
1836
  m.redraw.strategy("diff")
1837
  }
1838
 
1839
+ function endFirstComputation() {
1840
+ if (m.redraw.strategy() === "none") {
 
 
 
 
 
 
1841
  pendingRequests--
1842
  m.redraw.strategy("diff")
1843
+ } else {
1844
+ m.endComputation()
1845
+ }
1846
+ }
1847
+
1848
+ m.withAttr = function (prop, withAttrCallback, callbackThis) {
1849
+ return function (e) {
1850
+ e = e || event
1851
+ /* eslint-disable no-invalid-this */
1852
+ var currentTarget = e.currentTarget || this
1853
+ var _this = callbackThis || this
1854
+ /* eslint-enable no-invalid-this */
1855
+ var target = prop in currentTarget ?
1856
+ currentTarget[prop] :
1857
+ currentTarget.getAttribute(prop)
1858
+ withAttrCallback.call(_this, target)
1859
  }
1860
+ }
1861
+
1862
+ // routing
1863
+ var modes = {pathname: "", hash: "#", search: "?"}
1864
+ var redirect = noop
1865
+ var isDefaultRoute = false
1866
+ var routeParams, currentRoute
1867
+
1868
+ m.route = function (root, arg1, arg2, vdom) { // eslint-disable-line
1869
+ // m.route()
1870
+ if (arguments.length === 0) return currentRoute
1871
+ // m.route(el, defaultRoute, routes)
1872
+ if (arguments.length === 3 && isString(arg1)) {
1873
+ redirect = function (source) {
1874
+ var path = currentRoute = normalizeRoute(source)
1875
+ if (!routeByValue(root, arg2, path)) {
1876
+ if (isDefaultRoute) {
1877
+ throw new Error("Ensure the default route matches " +
1878
+ "one of the routes defined in m.route")
1879
+ }
1880
+
 
 
 
1881
  isDefaultRoute = true
1882
+ m.route(arg1, true)
1883
  isDefaultRoute = false
1884
  }
1885
+ }
1886
+
1887
+ var listener = m.route.mode === "hash" ?
1888
+ "onhashchange" :
1889
+ "onpopstate"
1890
+
1891
+ global[listener] = function () {
1892
  var path = $location[m.route.mode]
1893
  if (m.route.mode === "pathname") path += $location.search
1894
+ if (currentRoute !== normalizeRoute(path)) redirect(path)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1895
  }
1896
+
1897
+ computePreRedrawHook = setScroll
1898
+ global[listener]()
1899
+
1900
+ return
1901
+ }
1902
+
1903
+ // config: m.route
1904
+ if (root.addEventListener || root.attachEvent) {
1905
+ var base = m.route.mode !== "pathname" ? $location.pathname : ""
1906
+ root.href = base + modes[m.route.mode] + vdom.attrs.href
1907
+ if (root.addEventListener) {
1908
+ root.removeEventListener("click", routeUnobtrusive)
1909
+ root.addEventListener("click", routeUnobtrusive)
1910
+ } else {
1911
+ root.detachEvent("onclick", routeUnobtrusive)
1912
+ root.attachEvent("onclick", routeUnobtrusive)
1913
  }
1914
+
1915
+ return
1916
  }
1917
+ // m.route(route, params, shouldReplaceHistoryEntry)
1918
+ if (isString(root)) {
1919
+ var oldRoute = currentRoute
1920
+ currentRoute = root
1921
+
1922
+ var args = arg1 || {}
1923
  var queryIndex = currentRoute.indexOf("?")
1924
+ var params
1925
+
1926
+ if (queryIndex > -1) {
1927
+ params = parseQueryString(currentRoute.slice(queryIndex + 1))
1928
+ } else {
1929
+ params = {}
1930
+ }
1931
+
1932
+ for (var i in args) if (hasOwn.call(args, i)) {
1933
+ params[i] = args[i]
1934
+ }
1935
+
1936
  var querystring = buildQueryString(params)
1937
+ var currentPath
1938
+
1939
+ if (queryIndex > -1) {
1940
+ currentPath = currentRoute.slice(0, queryIndex)
1941
+ } else {
1942
+ currentPath = currentRoute
1943
+ }
1944
+
1945
+ if (querystring) {
1946
+ currentRoute = currentPath +
1947
+ (currentPath.indexOf("?") === -1 ? "?" : "&") +
1948
+ querystring
1949
+ }
1950
 
1951
+ var replaceHistory =
1952
+ (arguments.length === 3 ? arg2 : arg1) === true ||
1953
+ oldRoute === root
1954
 
1955
+ if (global.history.pushState) {
1956
+ var method = replaceHistory ? "replaceState" : "pushState"
1957
  computePreRedrawHook = setScroll
1958
+ computePostRedrawHook = function () {
1959
+ global.history[method](null, $document.title,
1960
+ modes[m.route.mode] + currentRoute)
1961
+ }
1962
  redirect(modes[m.route.mode] + currentRoute)
1963
+ } else {
 
1964
  $location[m.route.mode] = currentRoute
1965
  redirect(modes[m.route.mode] + currentRoute)
1966
  }
1967
  }
1968
+ }
1969
+
1970
+ m.route.param = function (key) {
1971
+ if (!routeParams) {
1972
+ throw new Error("You must call m.route(element, defaultRoute, " +
1973
+ "routes) before calling m.route.param()")
1974
+ }
1975
+
1976
+ if (!key) {
1977
+ return routeParams
1978
+ }
1979
+
1980
  return routeParams[key]
1981
+ }
1982
+
1983
+ m.route.mode = "search"
1984
+
1985
  function normalizeRoute(route) {
1986
  return route.slice(modes[m.route.mode].length)
1987
  }
1988
+
1989
  function routeByValue(root, router, path) {
1990
+ routeParams = {}
1991
 
1992
+ var queryStart = path.indexOf("?")
1993
  if (queryStart !== -1) {
1994
+ routeParams = parseQueryString(
1995
+ path.substr(queryStart + 1, path.length))
1996
  path = path.substr(0, queryStart)
1997
  }
1998
 
1999
  // Get all routes and check if there's
2000
  // an exact match for the current path
2001
+ var keys = Object.keys(router)
2002
+ var index = keys.indexOf(path)
2003
+
2004
+ if (index !== -1){
2005
+ m.mount(root, router[keys [index]])
2006
+ return true
2007
  }
2008
 
2009
+ for (var route in router) if (hasOwn.call(router, route)) {
2010
  if (route === path) {
2011
+ m.mount(root, router[route])
2012
  return true
2013
  }
2014
 
2015
+ var matcher = new RegExp("^" + route
2016
+ .replace(/:[^\/]+?\.{3}/g, "(.*?)")
2017
+ .replace(/:[^\/]+/g, "([^\\/]+)") + "\/?$")
2018
 
2019
  if (matcher.test(path)) {
2020
+ /* eslint-disable no-loop-func */
2021
+ path.replace(matcher, function () {
2022
+ var keys = route.match(/:[^\/]+/g) || []
2023
+ var values = [].slice.call(arguments, 1, -2)
2024
+ forEach(keys, function (key, i) {
2025
+ routeParams[key.replace(/:|\./g, "")] =
2026
+ decodeURIComponent(values[i])
2027
+ })
2028
  m.mount(root, router[route])
2029
+ })
2030
+ /* eslint-enable no-loop-func */
2031
  return true
2032
  }
2033
  }
2034
  }
2035
+
2036
  function routeUnobtrusive(e) {
2037
+ e = e || event
2038
+ if (e.ctrlKey || e.metaKey || e.shiftKey || e.which === 2) return
2039
+
2040
+ if (e.preventDefault) {
2041
+ e.preventDefault()
2042
+ } else {
2043
+ e.returnValue = false
2044
+ }
2045
+
2046
+ var currentTarget = e.currentTarget || e.srcElement
2047
+ var args
2048
+
2049
+ if (m.route.mode === "pathname" && currentTarget.search) {
2050
+ args = parseQueryString(currentTarget.search.slice(1))
2051
+ } else {
2052
+ args = {}
2053
+ }
2054
+
2055
+ while (currentTarget && !/a/i.test(currentTarget.nodeName)) {
2056
+ currentTarget = currentTarget.parentNode
2057
+ }
2058
+
2059
+ // clear pendingRequests because we want an immediate route change
2060
+ pendingRequests = 0
2061
+ m.route(currentTarget[m.route.mode]
2062
+ .slice(modes[m.route.mode].length), args)
2063
  }
2064
+
2065
  function setScroll() {
2066
+ if (m.route.mode !== "hash" && $location.hash) {
2067
+ $location.hash = $location.hash
2068
+ } else {
2069
+ global.scrollTo(0, 0)
2070
+ }
2071
  }
2072
+
2073
  function buildQueryString(object, prefix) {
2074
  var duplicates = {}
2075
  var str = []
2076
+
2077
+ for (var prop in object) if (hasOwn.call(object, prop)) {
2078
  var key = prefix ? prefix + "[" + prop + "]" : prop
2079
  var value = object[prop]
2080
+
2081
+ if (value === null) {
2082
+ str.push(encodeURIComponent(key))
2083
+ } else if (isObject(value)) {
2084
+ str.push(buildQueryString(value, key))
2085
+ } else if (isArray(value)) {
2086
+ var keys = []
2087
+ duplicates[key] = duplicates[key] || {}
2088
+ /* eslint-disable no-loop-func */
2089
+ forEach(value, function (item) {
2090
+ /* eslint-enable no-loop-func */
2091
  if (!duplicates[key][item]) {
2092
  duplicates[key][item] = true
2093
+ keys.push(encodeURIComponent(key) + "=" +
2094
+ encodeURIComponent(item))
2095
  }
2096
+ })
2097
+ str.push(keys.join("&"))
2098
+ } else if (value !== undefined) {
2099
+ str.push(encodeURIComponent(key) + "=" +
2100
+ encodeURIComponent(value))
2101
+ }
2102
  }
2103
  return str.join("&")
2104
  }
2105
+
2106
  function parseQueryString(str) {
2107
+ if (str === "" || str == null) return {}
2108
+ if (str.charAt(0) === "?") str = str.slice(1)
2109
+
2110
+ var pairs = str.split("&")
2111
+ var params = {}
2112
+
2113
+ forEach(pairs, function (string) {
2114
+ var pair = string.split("=")
2115
  var key = decodeURIComponent(pair[0])
2116
+ var value = pair.length === 2 ? decodeURIComponent(pair[1]) : null
2117
  if (params[key] != null) {
2118
+ if (!isArray(params[key])) params[key] = [params[key]]
2119
  params[key].push(value)
2120
  }
2121
  else params[key] = value
2122
+ })
2123
+
2124
  return params
2125
  }
2126
+
2127
  m.route.buildQueryString = buildQueryString
2128
  m.route.parseQueryString = parseQueryString
2129
+
2130
  function reset(root) {
2131
+ var cacheKey = getCellCacheKey(root)
2132
+ clear(root.childNodes, cellCache[cacheKey])
2133
  cellCache[cacheKey] = undefined
2134
  }
2135
 
2136
  m.deferred = function () {
2137
+ var deferred = new Deferred()
2138
+ deferred.promise = propify(deferred.promise)
2139
  return deferred
2140
+ }
2141
+
2142
  function propify(promise, initialValue) {
2143
+ var prop = m.prop(initialValue)
2144
+ promise.then(prop)
2145
+ prop.then = function (resolve, reject) {
2146
  return propify(promise.then(resolve, reject), initialValue)
2147
+ }
2148
+
2149
+ prop.catch = prop.then.bind(null, null)
2150
  return prop
2151
  }
2152
+ // Promiz.mithril.js | Zolmeister | MIT
2153
+ // a modified version of Promiz.js, which does not conform to Promises/A+
2154
+ // for two reasons:
2155
+ //
2156
+ // 1) `then` callbacks are called synchronously (because setTimeout is too
2157
+ // slow, and the setImmediate polyfill is too big
2158
+ //
2159
+ // 2) throwing subclasses of Error cause the error to be bubbled up instead
2160
+ // of triggering rejection (because the spec does not account for the
2161
+ // important use case of default browser error handling, i.e. message w/
2162
+ // line number)
2163
+
2164
+ var RESOLVING = 1
2165
+ var REJECTING = 2
2166
+ var RESOLVED = 3
2167
+ var REJECTED = 4
2168
 
2169
+ function Deferred(onSuccess, onFailure) {
2170
+ var self = this
2171
+ var state = 0
2172
+ var promiseValue = 0
2173
+ var next = []
2174
 
2175
+ self.promise = {}
2176
+
2177
+ self.resolve = function (value) {
2178
  if (!state) {
2179
+ promiseValue = value
2180
+ state = RESOLVING
2181
 
2182
  fire()
2183
  }
 
 
2184
 
2185
+ return self
2186
+ }
2187
+
2188
+ self.reject = function (value) {
2189
  if (!state) {
2190
+ promiseValue = value
2191
+ state = REJECTING
2192
 
2193
  fire()
2194
  }
 
 
2195
 
2196
+ return self
2197
+ }
2198
+
2199
+ self.promise.then = function (onSuccess, onFailure) {
2200
+ var deferred = new Deferred(onSuccess, onFailure)
2201
+
2202
  if (state === RESOLVED) {
2203
  deferred.resolve(promiseValue)
2204
+ } else if (state === REJECTED) {
 
2205
  deferred.reject(promiseValue)
2206
+ } else {
 
2207
  next.push(deferred)
2208
  }
2209
+
2210
  return deferred.promise
2211
+ }
2212
 
2213
  function finish(type) {
2214
+ state = type || REJECTED
2215
+ next.map(function (deferred) {
2216
+ if (state === RESOLVED) {
2217
+ deferred.resolve(promiseValue)
2218
+ } else {
2219
+ deferred.reject(promiseValue)
2220
+ }
2221
  })
2222
  }
2223
 
2224
+ function thennable(then, success, failure, notThennable) {
2225
+ if (((promiseValue != null && isObject(promiseValue)) ||
2226
+ isFunction(promiseValue)) && isFunction(then)) {
2227
  try {
2228
  // count protects against abuse calls from spec checker
2229
+ var count = 0
2230
+ then.call(promiseValue, function (value) {
2231
+ if (count++) return
2232
+ promiseValue = value
2233
+ success()
2234
  }, function (value) {
2235
+ if (count++) return
2236
+ promiseValue = value
2237
+ failure()
2238
  })
2239
+ } catch (e) {
2240
+ m.deferred.onerror(e)
2241
+ promiseValue = e
2242
+ failure()
 
2243
  }
2244
  } else {
2245
+ notThennable()
2246
  }
2247
  }
2248
 
2249
  function fire() {
2250
  // check if it's a thenable
2251
+ var then
2252
  try {
2253
  then = promiseValue && promiseValue.then
2254
+ } catch (e) {
2255
+ m.deferred.onerror(e)
2256
+ promiseValue = e
2257
+ state = REJECTING
 
2258
  return fire()
2259
  }
2260
+
2261
+ if (state === REJECTING) {
2262
+ m.deferred.onerror(promiseValue)
2263
+ }
2264
+
2265
+ thennable(then, function () {
2266
+ state = RESOLVING
2267
  fire()
2268
+ }, function () {
2269
+ state = REJECTING
2270
  fire()
2271
+ }, function () {
2272
  try {
2273
+ if (state === RESOLVING && isFunction(onSuccess)) {
2274
+ promiseValue = onSuccess(promiseValue)
2275
+ } else if (state === REJECTING && isFunction(onFailure)) {
2276
+ promiseValue = onFailure(promiseValue)
 
2277
  state = RESOLVING
2278
  }
2279
+ } catch (e) {
2280
+ m.deferred.onerror(e)
2281
+ promiseValue = e
 
2282
  return finish()
2283
  }
2284
 
2285
  if (promiseValue === self) {
2286
+ promiseValue = TypeError()
2287
  finish()
2288
+ } else {
 
2289
  thennable(then, function () {
2290
  finish(RESOLVED)
2291
  }, finish, function () {
2295
  })
2296
  }
2297
  }
 
 
 
2298
 
2299
+ m.deferred.onerror = function (e) {
2300
+ if (type.call(e) === "[object Error]" &&
2301
+ !/ Error/.test(e.constructor.toString())) {
2302
+ pendingRequests = 0
2303
+ throw e
2304
+ }
2305
+ }
2306
+
2307
+ m.sync = function (args) {
2308
+ var deferred = m.deferred()
2309
+ var outstanding = args.length
2310
+ var results = new Array(outstanding)
2311
+ var method = "resolve"
2312
+
2313
  function synchronizer(pos, resolved) {
2314
+ return function (value) {
2315
+ results[pos] = value
2316
+ if (!resolved) method = "reject"
2317
  if (--outstanding === 0) {
2318
+ deferred.promise(results)
2319
  deferred[method](results)
2320
  }
2321
  return value
2322
  }
2323
  }
2324
 
 
 
 
2325
  if (args.length > 0) {
2326
+ forEach(args, function (arg, i) {
2327
+ arg.then(synchronizer(i, true), synchronizer(i, false))
2328
+ })
2329
+ } else {
2330
+ deferred.resolve([])
2331
  }
 
2332
 
2333
  return deferred.promise
2334
+ }
 
2335
 
2336
+ function identity(value) { return value }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2337
 
2338
+ function handleJsonp(options) {
2339
+ var callbackKey = "mithril_callback_" +
2340
+ new Date().getTime() + "_" +
2341
+ (Math.round(Math.random() * 1e16)).toString(36)
2342
 
2343
+ var script = $document.createElement("script")
2344
+
2345
+ global[callbackKey] = function (resp) {
2346
+ script.parentNode.removeChild(script)
2347
+ options.onload({
2348
+ type: "load",
2349
+ target: {
2350
+ responseText: resp
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2351
  }
2352
+ })
2353
+ global[callbackKey] = undefined
2354
+ }
2355
+
2356
+ script.onerror = function () {
2357
+ script.parentNode.removeChild(script)
2358
+
2359
+ options.onerror({
2360
+ type: "error",
2361
+ target: {
2362
+ status: 500,
2363
+ responseText: JSON.stringify({
2364
+ error: "Error making jsonp request"
2365
+ })
2366
+ }
2367
+ })
2368
+ global[callbackKey] = undefined
2369
 
2370
+ return false
2371
+ }
2372
+
2373
+ script.onload = function () {
2374
+ return false
2375
+ }
2376
+
2377
+ script.src = options.url +
2378
+ (options.url.indexOf("?") > 0 ? "&" : "?") +
2379
+ (options.callbackKey ? options.callbackKey : "callback") +
2380
+ "=" + callbackKey +
2381
+ "&" + buildQueryString(options.data || {})
2382
+
2383
+ $document.body.appendChild(script)
2384
+ }
2385
+
2386
+ function createXhr(options) {
2387
+ var xhr = new global.XMLHttpRequest()
2388
+ xhr.open(options.method, options.url, true, options.user,
2389
+ options.password)
2390
+
2391
+ xhr.onreadystatechange = function () {
2392
+ if (xhr.readyState === 4) {
2393
+ if (xhr.status >= 200 && xhr.status < 300) {
2394
+ options.onload({type: "load", target: xhr})
2395
+ } else {
2396
+ options.onerror({type: "error", target: xhr})
2397
+ }
2398
  }
2399
+ }
2400
+
2401
+ if (options.serialize === JSON.stringify &&
2402
+ options.data &&
2403
+ options.method !== "GET") {
2404
+ xhr.setRequestHeader("Content-Type",
2405
+ "application/json; charset=utf-8")
2406
+ }
2407
+
2408
+ if (options.deserialize === JSON.parse) {
2409
+ xhr.setRequestHeader("Accept", "application/json, text/*")
2410
+ }
2411
+
2412
+ if (isFunction(options.config)) {
2413
+ var maybeXhr = options.config(xhr, options)
2414
+ if (maybeXhr != null) xhr = maybeXhr
2415
+ }
2416
+
2417
+ var data = options.method === "GET" || !options.data ? "" : options.data
2418
+
2419
+ if (data && !isString(data) && data.constructor !== global.FormData) {
2420
+ throw new Error("Request data should be either be a string or " +
2421
+ "FormData. Check the `serialize` option in `m.request`")
2422
+ }
2423
+
2424
+ xhr.send(data)
2425
+ return xhr
2426
+ }
2427
+
2428
+ function ajax(options) {
2429
+ if (options.dataType && options.dataType.toLowerCase() === "jsonp") {
2430
+ return handleJsonp(options)
2431
+ } else {
2432
+ return createXhr(options)
2433
  }
2434
  }
2435
+
2436
+ function bindData(options, data, serialize) {
2437
+ if (options.method === "GET" && options.dataType !== "jsonp") {
2438
+ var prefix = options.url.indexOf("?") < 0 ? "?" : "&"
2439
+ var querystring = buildQueryString(data)
2440
+ options.url += (querystring ? prefix + querystring : "")
2441
+ } else {
2442
+ options.data = serialize(data)
2443
  }
 
 
2444
  }
2445
+
2446
  function parameterizeUrl(url, data) {
2447
+ if (data) {
2448
+ url = url.replace(/:[a-z]\w+/gi, function(token){
2449
+ var key = token.slice(1)
2450
+ var value = data[key]
 
2451
  delete data[key]
2452
+ return value
2453
+ })
2454
  }
2455
  return url
2456
  }
2457
 
2458
+ m.request = function (options) {
2459
+ if (options.background !== true) m.startComputation()
2460
+ var deferred = new Deferred()
2461
+ var isJSONP = options.dataType &&
2462
+ options.dataType.toLowerCase() === "jsonp"
2463
+
2464
+ var serialize, deserialize, extract
2465
+
2466
+ if (isJSONP) {
2467
+ serialize = options.serialize =
2468
+ deserialize = options.deserialize = identity
2469
+
2470
+ extract = function (jsonp) { return jsonp.responseText }
2471
+ } else {
2472
+ serialize = options.serialize = options.serialize || JSON.stringify
2473
+
2474
+ deserialize = options.deserialize =
2475
+ options.deserialize || JSON.parse
2476
+ extract = options.extract || function (xhr) {
2477
+ if (xhr.responseText.length || deserialize !== JSON.parse) {
2478
+ return xhr.responseText
2479
+ } else {
2480
+ return null
2481
+ }
2482
+ }
2483
+ }
2484
+
2485
+ options.method = (options.method || "GET").toUpperCase()
2486
+ options.url = parameterizeUrl(options.url, options.data)
2487
+ bindData(options, options.data, serialize)
2488
+ options.onload = options.onerror = function (ev) {
2489
  try {
2490
+ ev = ev || event
2491
+ var response = deserialize(extract(ev.target, options))
2492
+ if (ev.type === "load") {
2493
+ if (options.unwrapSuccess) {
2494
+ response = options.unwrapSuccess(response, ev.target)
2495
+ }
2496
+
2497
+ if (isArray(response) && options.type) {
2498
+ forEach(response, function (res, i) {
2499
+ response[i] = new options.type(res)
2500
+ })
2501
+ } else if (options.type) {
2502
+ response = new options.type(response)
2503
+ }
2504
+
2505
+ deferred.resolve(response)
2506
+ } else {
2507
+ if (options.unwrapError) {
2508
+ response = options.unwrapError(response, ev.target)
2509
  }
2510
+
2511
+ deferred.reject(response)
2512
  }
2513
+ } catch (e) {
 
 
 
2514
  deferred.reject(e)
2515
+ } finally {
2516
+ if (options.background !== true) m.endComputation()
2517
  }
2518
+ }
 
 
 
 
 
2519
 
2520
+ ajax(options)
2521
+ deferred.promise = propify(deferred.promise, options.initialValue)
2522
+ return deferred.promise
2523
+ }
 
 
 
2524
 
2525
  return m
2526
+ })
 
 
 
2527
 
2528
  },{}],7:[function(require,module,exports){
2529
  /*!
assets/js/admin.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(){var e=void 0,t=void 0;!function n(t,r,o){function i(l,s){if(!r[l]){if(!t[l]){var u="function"==typeof e&&e;if(!s&&u)return u(l,!0);if(a)return a(l,!0);var c=new Error("Cannot find module '"+l+"'");throw c.code="MODULE_NOT_FOUND",c}var d=r[l]={exports:{}};t[l][0].call(d.exports,function(e){var n=t[l][1][e];return i(n?n:e)},d,d.exports,n,t,r,o)}return r[l].exports}for(var a="function"==typeof e&&e,l=0;l<o.length;l++)i(o[l]);return i}({1:[function(e,t,n){"use strict";var r=e("mithril"),o=e("wolfy87-eventemitter"),i=document.getElementById("mc4wp-admin"),a=new o,l=e("./admin/tabs.js")(i),s=e("./admin/helpers.js"),u=e("./admin/settings.js")(i,s,a);window.mc4wp=window.mc4wp||{},window.mc4wp.deps=window.mc4wp.deps||{},window.mc4wp.deps.mithril=r,window.mc4wp.helpers=s,window.mc4wp.events=a,window.mc4wp.settings=u,window.mc4wp.tabs=l},{"./admin/helpers.js":2,"./admin/settings.js":3,"./admin/tabs.js":4,mithril:6,"wolfy87-eventemitter":7}],2:[function(e,t,n){"use strict";var r={};r.toggleElement=function(e){for(var t=document.querySelectorAll(e),n=0;n<t.length;n++){var r=t[n].clientHeight<=0;t[n].style.display=r?"":"none"}},r.bindEventToElement=function(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent&&e.attachEvent("on"+t,n)},r.bindEventToElements=function(e,t,n){Array.prototype.forEach.call(e,function(e){r.bindEventToElement(e,t,n)})},r.debounce=function(e,t,n){var r;return function(){var o=this,i=arguments,a=function(){r=null,n||e.apply(o,i)},l=n&&!r;clearTimeout(r),r=setTimeout(a,t),l&&e.apply(o,i)}},function(){var e=document.querySelectorAll("[data-showif]");Array.prototype.forEach.call(e,function(e){function t(){if("boolean"!=typeof this.checked||this.checked){var t=this.value==n.value;a?(e.style.display=t?"":"none",e.style.visibility=t?"":"hidden"):e.style.opacity=t?"":"0.4",Array.prototype.forEach.call(i,function(e){t?e.removeAttribute("readonly"):e.setAttribute("readonly","readonly")})}}var n=JSON.parse(e.getAttribute("data-showif")),o=document.querySelectorAll('[name="'+n.element+'"]'),i=e.querySelectorAll("input,select,textarea:not([readonly])"),a=void 0===n.hide||n.hide;Array.prototype.forEach.call(o,function(e){t.call(e)}),r.bindEventToElements(o,"change",t)})}(),t.exports=r},{}],3:[function(e,t,n){var r=function(e,t,n){"use strict";function r(e,t){return u.filter(function(n){return n[e]===t})}function o(){return u}function i(){return u=[],Array.prototype.forEach.call(l,function(e){("boolean"!=typeof e.checked||e.checked)&&"object"==typeof s[e.value]&&u.push(s[e.value])}),n.trigger("selectedLists.change",[u]),u}function a(){var e=document.querySelectorAll(".lists--only-selected > *");Array.prototype.forEach.call(e,function(e){var t=e.getAttribute("data-list-id"),n=r("id",t).length>0;n?e.setAttribute("class",e.getAttribute("class").replace("hidden","")):e.setAttribute("class",e.getAttribute("class")+" hidden")})}var l=(e.querySelector("form"),e.querySelectorAll(".mc4wp-list-input")),s=mc4wp_vars.mailchimp.lists,u=[];return n.on("selectedLists.change",a),t.bindEventToElements(l,"change",i),i(),{getSelectedLists:o}};t.exports=r},{}],4:[function(e,t,n){var r=function(t){"use strict";function n(e){for(var t=0;t<h.length;t++)if(h[t].id===e)return h[t]}function r(e,t){if("string"==typeof e&&(e=n(e)),!e)return!1;void 0==t&&(t=!0),c.removeClass("tab-active").css("display","none"),d.removeClass("nav-tab-active"),Array.prototype.forEach.call(e.nav,function(e){e.className+=" nav-tab-active",e.blur()}),e.element.style.display="block",e.element.className+=" tab-active";var r=s.setParameter(window.location.href,"tab",e.id);return history.pushState&&t&&history.pushState(e.id,"",r),o(e),f.value=r,"function"==typeof tb_remove&&tb_remove(),"fields"===e.id&&window.mc4wp&&window.mc4wp.forms&&window.mc4wp.forms.editor&&mc4wp.forms.editor.refresh(),!0}function o(e){var t=document.title.split("-");document.title=document.title.replace(t[0],e.title+" ")}function i(e){e=e||window.event;var t=this.getAttribute("data-tab");if(!t){var n=this.className.match(/nav-tab-(\w+)?/);n&&(t=n[1])}if(!t){var o=s.parse(this.href);if(!o.tab)return;t=o.tab}var i=r(t);return i?(e.preventDefault(),e.returnValue=!1,!1):!0}function a(){if(history.pushState){var e=c.filter(":visible").get(0);if(e){var t=n(e.id.substring(4));t&&(history.replaceState&&null===history.state&&history.replaceState(t.id,""),o(t))}}}var l=window.jQuery,s=e("./url.js"),u=l(t),c=u.find(".tab"),d=u.find(".nav-tab"),f=t.querySelector('input[name="_wp_http_referer"]'),h=[];return l.each(c,function(e,n){var o=n.id.substring(4),i=l(n).find("h2").first().text();h.push({id:o,title:i,element:n,nav:t.querySelectorAll(".nav-tab-"+o),open:function(){return r(o)}})}),d.click(i),l(document.body).on("click",".tab-link",i),a(),window.addEventListener&&history.pushState&&window.addEventListener("popstate",function(e){if(!e.state)return!0;var t=e.state;return r(t,!1)}),{open:r,get:n}};t.exports=r},{"./url.js":5}],5:[function(e,t,n){"use strict";var r={parse:function(e){var t={},n=e.split("&");for(var r in n)if(n.hasOwnProperty(r)){var o=n[r].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t},build:function(e){var t=[];for(var n in e)t.push(n+"="+encodeURIComponent(e[n]));return t.join("&")},setParameter:function(e,t,n){var o=r.parse(e);return o[t]=n,r.build(o)}};t.exports=r},{}],6:[function(e,n,r){var o=function i(e,t){function n(e){j=e.document,S=e.location,R=e.cancelAnimationFrame||e.clearTimeout,T=e.requestAnimationFrame||e.setTimeout}function r(){var e,t=[].slice.call(arguments),n=!(null==t[1]||U.call(t[1])!==_||"tag"in t[1]||"view"in t[1]||"subtree"in t[1]),r=n?t[1]:{},o="class"in r?"class":"className",i={tag:"div",attrs:{}},a=[];if(U.call(t[0])!=q)throw new Error("selector in m(selector, attrs, children) should be a string");for(;e=I.exec(t[0]);)if(""===e[1]&&e[2])i.tag=e[2];else if("#"===e[1])i.attrs.id=e[2];else if("."===e[1])a.push(e[2]);else if("["===e[3][0]){var l=$.exec(e[3]);i.attrs[l[1]]=l[3]||(l[2]?"":!0)}var s=n?t.slice(2):t.slice(1);1===s.length&&U.call(s[0])===M?i.children=s[0]:i.children=s;for(var u in r)r.hasOwnProperty(u)&&(u===o&&null!=r[u]&&""!==r[u]?(a.push(r[u]),i.attrs[u]=""):i.attrs[u]=r[u]);return a.length>0&&(i.attrs[o]=a.join(" ")),i}function o(e,n,i,u,d,f,h,p,v,m,g){try{(null==d||null==d.toString())&&(d="")}catch(y){d=""}if("retain"===d.subtree)return f;var w=U.call(f),b=U.call(d);if(null==f||w!==b){if(null!=f)if(i&&i.nodes){var E=p-u,x=E+(b===M?d:f.nodes).length;s(i.nodes.slice(E,x),i.slice(E,x))}else f.nodes&&s(f.nodes,f);f=new d.constructor,f.tag&&(f={}),f.nodes=[]}if(b===M){for(var A=0,C=d.length;C>A;A++)U.call(d[A])===M&&(d=d.concat.apply([],d),A--,C=d.length);for(var O=[],L=f.length===d.length,k=0,N=1,S=2,T=3,R={},I=!1,A=0;A<f.length;A++)f[A]&&f[A].attrs&&null!=f[A].attrs.key&&(I=!0,R[f[A].attrs.key]={action:N,index:A});for(var $=0,A=0,C=d.length;C>A;A++)if(d[A]&&d[A].attrs&&null!=d[A].attrs.key){for(var V=0,C=d.length;C>V;V++)d[V]&&d[V].attrs&&null==d[V].attrs.key&&(d[V].attrs.key="__mithril__"+$++);break}if(I){var H=!1;if(d.length!=f.length)H=!0;else for(var z,J,A=0;z=f[A],J=d[A];A++)if(z.attrs&&J.attrs&&z.attrs.key!=J.attrs.key){H=!0;break}if(H){for(var A=0,C=d.length;C>A;A++)if(d[A]&&d[A].attrs&&null!=d[A].attrs.key){var K=d[A].attrs.key;R[K]?R[K]={action:T,index:A,from:R[K].index,element:f.nodes[R[K].index]||j.createElement("div")}:R[K]={action:S,index:A}}var F=[];for(var G in R)F.push(R[G]);var Q=F.sort(a),Y=new Array(f.length);Y.nodes=f.nodes.slice();for(var W,A=0;W=Q[A];A++){if(W.action===N&&(s(f[W.index].nodes,f[W.index]),Y.splice(W.index,1)),W.action===S){var X=j.createElement("div");X.key=d[W.index].attrs.key,e.insertBefore(X,e.childNodes[W.index]||null),Y.splice(W.index,0,{attrs:{key:d[W.index].attrs.key},nodes:[X]}),Y.nodes[W.index]=X}W.action===T&&(e.childNodes[W.index]!==W.element&&null!==W.element&&e.insertBefore(W.element,e.childNodes[W.index]||null),Y[W.index]=f[W.from],Y.nodes[W.index]=W.element)}f=Y}}for(var A=0,Z=0,C=d.length;C>A;A++){var te=o(e,n,f,p,d[A],f[Z],h,p+k||k,v,m,g);te!==t&&(te.nodes.intact||(L=!1),k+=te.$trusted?(te.match(/<[^\/]|\>\s*[^<]/g)||[0]).length:U.call(te)===M?te.length:1,f[Z++]=te)}if(!L){for(var A=0,C=d.length;C>A;A++)null!=f[A]&&O.push.apply(O,f[A].nodes);for(var ne,A=0;ne=f.nodes[A];A++)null!=ne.parentNode&&O.indexOf(ne)<0&&s([ne],[f[A]]);d.length<f.length&&(f.length=d.length),f.nodes=O}}else if(null!=d&&b===_){for(var oe=[],ie=[];d.view;){var ae=d.view.$original||d.view,le="diff"==r.redraw.strategy()&&f.views?f.views.indexOf(ae):-1,se=le>-1?f.controllers[le]:new(d.controller||B),K=d&&d.attrs&&d.attrs.key;if(d=0==re||f&&f.controllers&&f.controllers.indexOf(se)>-1?d.view(se):{tag:"placeholder"},"retain"===d.subtree)return f;K&&(d.attrs||(d.attrs={}),d.attrs.key=K),se.onunload&&ee.push({controller:se,handler:se.onunload}),oe.push(ae),ie.push(se)}if(!d.tag&&ie.length)throw new Error("Component template must return a virtual element, not an array, string, etc.");d.attrs||(d.attrs={}),f.attrs||(f.attrs={});var ue=Object.keys(d.attrs),ce=ue.length>("key"in d.attrs?1:0);if((d.tag!=f.tag||ue.sort().join()!=Object.keys(f.attrs).sort().join()||d.attrs.id!=f.attrs.id||d.attrs.key!=f.attrs.key||"all"==r.redraw.strategy()&&(!f.configContext||f.configContext.retain!==!0)||"diff"==r.redraw.strategy()&&f.configContext&&f.configContext.retain===!1)&&(f.nodes.length&&s(f.nodes),f.configContext&&typeof f.configContext.onunload===D&&f.configContext.onunload(),f.controllers))for(var se,A=0;se=f.controllers[A];A++)typeof se.onunload===D&&se.onunload({preventDefault:B});if(U.call(d.tag)!=q)return;var ne,de=0===f.nodes.length;if(d.attrs.xmlns?m=d.attrs.xmlns:"svg"===d.tag?m="http://www.w3.org/2000/svg":"math"===d.tag&&(m="http://www.w3.org/1998/Math/MathML"),de){if(ne=d.attrs.is?m===t?j.createElement(d.tag,d.attrs.is):j.createElementNS(m,d.tag,d.attrs.is):m===t?j.createElement(d.tag):j.createElementNS(m,d.tag),f={tag:d.tag,attrs:ce?l(ne,d.tag,d.attrs,{},m):d.attrs,children:null!=d.children&&d.children.length>0?o(ne,d.tag,t,t,d.children,f.children,!0,0,d.attrs.contenteditable?ne:v,m,g):d.children,nodes:[ne]},ie.length){f.views=oe,f.controllers=ie;for(var se,A=0;se=ie[A];A++)if(se.onunload&&se.onunload.$old&&(se.onunload=se.onunload.$old),re&&se.onunload){var fe=se.onunload;se.onunload=B,se.onunload.$old=fe}}f.children&&!f.children.nodes&&(f.children.nodes=[]),"select"===d.tag&&"value"in d.attrs&&l(ne,d.tag,{value:d.attrs.value},{},m),e.insertBefore(ne,e.childNodes[p]||null)}else ne=f.nodes[0],ce&&l(ne,d.tag,d.attrs,f.attrs,m),f.children=o(ne,d.tag,t,t,d.children,f.children,!1,0,d.attrs.contenteditable?ne:v,m,g),f.nodes.intact=!0,ie.length&&(f.views=oe,f.controllers=ie),h===!0&&null!=ne&&e.insertBefore(ne,e.childNodes[p]||null);if(typeof d.attrs.config===D){var he=f.configContext=f.configContext||{},pe=function(e,t){return function(){return e.attrs.config.apply(e,t)}};g.push(pe(d,[ne,!de,he,f]))}}else if(typeof d!=D){var O;0===f.nodes.length?(d.$trusted?O=c(e,p,d):(O=[j.createTextNode(d)],e.nodeName.match(P)||e.insertBefore(O[0],e.childNodes[p]||null)),f="string number boolean".indexOf(typeof d)>-1?new d.constructor(d):d,f.nodes=O):f.valueOf()!==d.valueOf()||h===!0?(O=f.nodes,v&&v===j.activeElement||(d.$trusted?(s(O,f),O=c(e,p,d)):"textarea"===n?e.value=d:v?v.innerHTML=d:((1===O[0].nodeType||O.length>1)&&(s(f.nodes,f),O=[j.createTextNode(d)]),e.insertBefore(O[0],e.childNodes[p]||null),O[0].nodeValue=d)),f=new d.constructor(d),f.nodes=O):f.nodes.intact=!0}return f}function a(e,t){return e.action-t.action||e.index-t.index}function l(e,t,n,r,o){for(var i in n){var a=n[i],l=r[i];if(i in r&&l===a)"value"===i&&"input"===t&&e.value!=a&&(e.value=a);else{r[i]=a;try{if("config"===i||"key"==i)continue;if(typeof a===D&&0===i.indexOf("on"))e[i]=d(a,e);else if("style"===i&&null!=a&&U.call(a)===_){for(var s in a)(null==l||l[s]!==a[s])&&(e.style[s]=a[s]);for(var s in l)s in a||(e.style[s]="")}else null!=o?"href"===i?e.setAttributeNS("http://www.w3.org/1999/xlink","href",a):"className"===i?e.setAttribute("class",a):e.setAttribute(i,a):i in e&&"list"!==i&&"style"!==i&&"form"!==i&&"type"!==i&&"width"!==i&&"height"!==i?("input"!==t||e[i]!==a)&&(e[i]=a):e.setAttribute(i,a)}catch(u){if(u.message.indexOf("Invalid argument")<0)throw u}}}return r}function s(e,t){for(var n=e.length-1;n>-1;n--)if(e[n]&&e[n].parentNode){try{e[n].parentNode.removeChild(e[n])}catch(r){}t=[].concat(t),t[n]&&u(t[n])}0!=e.length&&(e.length=0)}function u(e){if(e.configContext&&typeof e.configContext.onunload===D&&(e.configContext.onunload(),e.configContext.onunload=null),e.controllers)for(var t,n=0;t=e.controllers[n];n++)typeof t.onunload===D&&t.onunload({preventDefault:B});if(e.children)if(U.call(e.children)===M)for(var r,n=0;r=e.children[n];n++)u(r);else e.children.tag&&u(e.children)}function c(e,t,n){var r=e.childNodes[t];if(r){var o=1!=r.nodeType,i=j.createElement("span");o?(e.insertBefore(i,r||null),i.insertAdjacentHTML("beforebegin",n),e.removeChild(i)):r.insertAdjacentHTML("beforebegin",n)}else e.insertAdjacentHTML("beforeend",n);for(var a=[];e.childNodes[t]!==r;)a.push(e.childNodes[t]),t++;return a}function d(e,t){return function(n){n=n||event,r.redraw.strategy("diff"),r.startComputation();try{return e.call(t,n)}finally{oe()}}}function f(e){var t=z.indexOf(e);return 0>t?z.push(e)-1:t}function h(e){var t=function(){return arguments.length&&(e=arguments[0]),e};return t.toJSON=function(){return e},t}function p(e,t){var n=function(){return(e.controller||B).apply(this,t)||this},r=function(n){return arguments.length>1&&(t=t.concat([].slice.call(arguments,1))),e.view.apply(e,t?[n].concat(t):[n])};r.$original=e.view;var o={controller:n,view:r};return t[0]&&null!=t[0].key&&(o.attrs={key:t[0].key}),o}function v(){X&&(X(),X=null);for(var e,t=0;e=F[t];t++)if(Q[t]){var n=G[t].controller&&G[t].controller.$$args?[Q[t]].concat(G[t].controller.$$args):[Q[t]];r.render(e,G[t].view?G[t].view(Q[t],n):"")}Z&&(Z(),Z=null),Y=null,W=new Date,r.redraw.strategy("diff")}function m(e){return e.slice(le[r.route.mode].length)}function g(e,t,n){ie={};var o=n.indexOf("?");-1!==o&&(ie=E(n.substr(o+1,n.length)),n=n.substr(0,o));var i=Object.keys(t),a=i.indexOf(n);if(-1!==a)return r.mount(e,t[i[a]]),!0;for(var l in t){if(l===n)return r.mount(e,t[l]),!0;var s=new RegExp("^"+l.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(s.test(n))return n.replace(s,function(){for(var n=l.match(/:[^\/]+/g)||[],o=[].slice.call(arguments,1,-2),i=0,a=n.length;a>i;i++)ie[n[i].replace(/:|\./g,"")]=decodeURIComponent(o[i]);r.mount(e,t[l])}),!0}}function y(e){if(e=e||event,!e.ctrlKey&&!e.metaKey&&2!==e.which){e.preventDefault?e.preventDefault():e.returnValue=!1;for(var t=e.currentTarget||e.srcElement,n="pathname"===r.route.mode&&t.search?E(t.search.slice(1)):{};t&&"A"!=t.nodeName.toUpperCase();)t=t.parentNode;r.route(t[r.route.mode].slice(le[r.route.mode].length),n)}}function w(){"hash"!=r.route.mode&&S.hash?S.hash=S.hash:e.scrollTo(0,0)}function b(e,n){var r={},o=[];for(var i in e){var a=n?n+"["+i+"]":i,l=e[i],s=U.call(l),u=null===l?encodeURIComponent(a):s===_?b(l,a):s===M?l.reduce(function(e,t){return r[a]||(r[a]={}),r[a][t]?e:(r[a][t]=!0,e.concat(encodeURIComponent(a)+"="+encodeURIComponent(t)))},[]).join("&"):encodeURIComponent(a)+"="+encodeURIComponent(l);l!==t&&o.push(u)}return o.join("&")}function E(e){"?"===e.charAt(0)&&(e=e.substring(1));for(var t=e.split("&"),n={},r=0,o=t.length;o>r;r++){var i=t[r].split("="),a=decodeURIComponent(i[0]),l=2==i.length?decodeURIComponent(i[1]):null;null!=n[a]?(U.call(n[a])!==M&&(n[a]=[n[a]]),n[a].push(l)):n[a]=l}return n}function x(e){var n=f(e);s(e.childNodes,J[n]),J[n]=t}function A(e,t){var n=r.prop(t);return e.then(n),n.then=function(n,r){return A(e.then(n,r),t)},n}function C(e,t){function n(e){d=e||u,h.map(function(e){d===s&&e.resolve(f)||e.reject(f)})}function o(e,t,n,o){if((null!=f&&U.call(f)===_||typeof f===D)&&typeof e===D)try{var i=0;e.call(f,function(e){i++||(f=e,t())},function(e){i++||(f=e,n())})}catch(a){r.deferred.onerror(a),f=a,n()}else o()}function i(){var u;try{u=f&&f.then}catch(h){return r.deferred.onerror(h),f=h,d=l,i()}o(u,function(){d=a,i()},function(){d=l,i()},function(){try{d===a&&typeof e===D?f=e(f):d===l&&"function"==typeof t&&(f=t(f),d=a)}catch(i){return r.deferred.onerror(i),f=i,n()}f===c?(f=TypeError(),n()):o(u,function(){n(s)},n,function(){n(d===a&&s)})})}var a=1,l=2,s=3,u=4,c=this,d=0,f=0,h=[];c.promise={},c.resolve=function(e){return d||(f=e,d=a,i()),this},c.reject=function(e){return d||(f=e,d=l,i()),this},c.promise.then=function(e,t){var n=new C(e,t);return d===s?n.resolve(f):d===u?n.reject(f):h.push(n),n.promise}}function O(e){return e}function L(n){if(!n.dataType||"jsonp"!==n.dataType.toLowerCase()){var r=new e.XMLHttpRequest;if(r.open(n.method,n.url,!0,n.user,n.password),r.onreadystatechange=function(){4===r.readyState&&(r.status>=200&&r.status<300?n.onload({type:"load",target:r}):n.onerror({type:"error",target:r}))},n.serialize===JSON.stringify&&n.data&&"GET"!==n.method&&r.setRequestHeader("Content-Type","application/json; charset=utf-8"),n.deserialize===JSON.parse&&r.setRequestHeader("Accept","application/json, text/*"),typeof n.config===D){var o=n.config(r,n);null!=o&&(r=o)}var i="GET"!==n.method&&n.data?n.data:"";if(i&&U.call(i)!=q&&i.constructor!=e.FormData)throw"Request data should be either be a string or FormData. Check the `serialize` option in `m.request`";return r.send(i),r}var a="mithril_callback_"+(new Date).getTime()+"_"+Math.round(1e16*Math.random()).toString(36),l=j.createElement("script");e[a]=function(r){l.parentNode.removeChild(l),n.onload({type:"load",target:{responseText:r}}),e[a]=t},l.onerror=function(r){return l.parentNode.removeChild(l),n.onerror({type:"error",target:{status:500,responseText:JSON.stringify({error:"Error making jsonp request"})}}),e[a]=t,!1},l.onload=function(e){return!1},l.src=n.url+(n.url.indexOf("?")>0?"&":"?")+(n.callbackKey?n.callbackKey:"callback")+"="+a+"&"+b(n.data||{}),j.body.appendChild(l)}function k(e,t,n){if("GET"===e.method&&"jsonp"!=e.dataType){var r=e.url.indexOf("?")<0?"?":"&",o=b(t);e.url=e.url+(o?r+o:"")}else e.data=n(t);return e}function N(e,t){var n=e.match(/:[a-z]\w+/gi);if(n&&t)for(var r=0;r<n.length;r++){var o=n[r].slice(1);e=e.replace(n[r],t[o]),delete t[o]}return e}var j,S,T,R,_="[object Object]",M="[object Array]",q="[object String]",D="function",U={}.toString,I=/(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g,$=/\[(.+?)(?:=("|'|)(.*?)\2)?\]/,P=/^(AREA|BASE|BR|COL|COMMAND|EMBED|HR|IMG|INPUT|KEYGEN|LINK|META|PARAM|SOURCE|TRACK|WBR)$/,B=function(){};n(e);var V,H={appendChild:function(e){V===t&&(V=j.createElement("html")),j.documentElement&&j.documentElement!==e?j.replaceChild(e,j.documentElement):j.appendChild(e),this.childNodes=j.childNodes},insertBefore:function(e){this.appendChild(e)},childNodes:[]},z=[],J={};r.render=function(e,n,r){var i=[];if(!e)throw new Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var a=f(e),l=e===j,u=l||e===j.documentElement?H:e;l&&"html"!=n.tag&&(n={tag:"html",attrs:{},children:n}),J[a]===t&&s(u.childNodes),r===!0&&x(e),J[a]=o(u,null,t,t,n,J[a],!1,0,null,t,i);for(var c=0,d=i.length;d>c;c++)i[c]()},r.trust=function(e){return e=new String(e),e.$trusted=!0,e},r.prop=function(e){return(null!=e&&U.call(e)===_||typeof e===D)&&typeof e.then===D?A(e):h(e)};var K,F=[],G=[],Q=[],Y=null,W=0,X=null,Z=null,ee=[],te=16;r.component=function(e){return p(e,[].slice.call(arguments,1))},r.mount=r.module=function(e,t){if(!e)throw new Error("Please ensure the DOM element exists before rendering a template into it.");var n=F.indexOf(e);0>n&&(n=F.length);for(var o,i=!1,a={preventDefault:function(){i=!0,X=Z=null}},l=0;o=ee[l];l++)o.handler.call(o.controller,a),o.controller.onunload=null;if(i)for(var o,l=0;o=ee[l];l++)o.controller.onunload=o.handler;else ee=[];if(Q[n]&&typeof Q[n].onunload===D&&Q[n].onunload(a),!i){r.redraw.strategy("all"),r.startComputation(),F[n]=e,arguments.length>2&&(t=subcomponent(t,[].slice.call(arguments,2)));var s=K=t=t||{controller:function(){}},u=t.controller||B,c=new u;return s===K&&(Q[n]=c,G[n]=t),oe(),Q[n]}};var ne=!1;r.redraw=function(t){ne||(ne=!0,Y&&t!==!0?(T===e.requestAnimationFrame||new Date-W>te)&&(Y>0&&R(Y),Y=T(v,te)):(v(),Y=T(function(){Y=null},te)),ne=!1)},r.redraw.strategy=r.prop();var re=0;r.startComputation=function(){re++},r.endComputation=function(){re=Math.max(re-1,0),0===re&&r.redraw()};var oe=function(){"none"==r.redraw.strategy()?(re--,r.redraw.strategy("diff")):r.endComputation()};r.withAttr=function(e,t){return function(n){n=n||event;var r=n.currentTarget||this;t(e in r?r[e]:r.getAttribute(e))}};var ie,ae,le={pathname:"",hash:"#",search:"?"},se=B,ue=!1;return r.route=function(){if(0===arguments.length)return ae;if(3===arguments.length&&U.call(arguments[1])===q){var t=arguments[0],n=arguments[1],o=arguments[2];se=function(e){var i=ae=m(e);if(!g(t,o,i)){if(ue)throw new Error("Ensure the default route matches one of the routes defined in m.route");ue=!0,r.route(n,!0),ue=!1}};var i="hash"===r.route.mode?"onhashchange":"onpopstate";e[i]=function(){var e=S[r.route.mode];"pathname"===r.route.mode&&(e+=S.search),ae!=m(e)&&se(e)},X=w,e[i]()}else if(arguments[0].addEventListener||arguments[0].attachEvent){var a=arguments[0],l=(arguments[1],arguments[2],arguments[3]);a.href=("pathname"!==r.route.mode?S.pathname:"")+le[r.route.mode]+l.attrs.href,a.addEventListener?(a.removeEventListener("click",y),a.addEventListener("click",y)):(a.detachEvent("onclick",y),a.attachEvent("onclick",y))}else if(U.call(arguments[0])===q){var s=ae;ae=arguments[0];var u=arguments[1]||{},c=ae.indexOf("?"),d=c>-1?E(ae.slice(c+1)):{};for(var f in u)d[f]=u[f];var h=b(d),p=c>-1?ae.slice(0,c):ae;h&&(ae=p+(-1===p.indexOf("?")?"?":"&")+h);var v=(3===arguments.length?arguments[2]:arguments[1])===!0||s===arguments[0];e.history.pushState?(X=w,Z=function(){e.history[v?"replaceState":"pushState"](null,j.title,le[r.route.mode]+ae)},se(le[r.route.mode]+ae)):(S[r.route.mode]=ae,se(le[r.route.mode]+ae))}},r.route.param=function(e){if(!ie)throw new Error("You must call m.route(element, defaultRoute, routes) before calling m.route.param()");return ie[e]},r.route.mode="search",r.route.buildQueryString=b,r.route.parseQueryString=E,r.deferred=function(){var e=new C;return e.promise=A(e.promise),e},r.deferred.onerror=function(e){if("[object Error]"===U.call(e)&&!e.constructor.toString().match(/ Error/))throw e},r.sync=function(e){function t(e,t){return function(r){return a[e]=r,t||(n="reject"),0===--i&&(o.promise(a),o[n](a)),r}}var n="resolve",o=r.deferred(),i=e.length,a=new Array(i);if(e.length>0)for(var l=0;l<e.length;l++)e[l].then(t(l,!0),t(l,!1));else o.resolve([]);return o.promise},r.request=function(e){e.background!==!0&&r.startComputation();var t=new C,n=e.dataType&&"jsonp"===e.dataType.toLowerCase(),o=e.serialize=n?O:e.serialize||JSON.stringify,i=e.deserialize=n?O:e.deserialize||JSON.parse,a=n?function(e){return e.responseText}:e.extract||function(e){return 0===e.responseText.length&&i===JSON.parse?null:e.responseText};return e.method=(e.method||"GET").toUpperCase(),e.url=N(e.url,e.data),e=k(e,e.data,o),e.onload=e.onerror=function(n){try{n=n||event;var o=("load"===n.type?e.unwrapSuccess:e.unwrapError)||O,l=o(i(a(n.target,e)),n.target);if("load"===n.type)if(U.call(l)===M&&e.type)for(var s=0;s<l.length;s++)l[s]=new e.type(l[s]);else e.type&&(l=new e.type(l));t["load"===n.type?"resolve":"reject"](l)}catch(n){r.deferred.onerror(n),t.reject(n)}e.background!==!0&&r.endComputation()},L(e),t.promise=A(t.promise,e.initialValue),t.promise},r.deps=function(t){return n(e=t||e),e},r.deps.factory=i,r}("undefined"!=typeof window?window:{});"undefined"!=typeof n&&null!==n&&n.exports?n.exports=o:"function"==typeof t&&t.amd&&t(function(){return o})},{}],7:[function(e,n,r){(function(){"use strict";function e(){}function r(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function o(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,a=this,l=a.EventEmitter;i.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp){t={};for(n in r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n])}else t=r[e]||(r[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,t){var n,o=this.getListenersAsObject(e),i="object"==typeof t;for(n in o)o.hasOwnProperty(n)&&-1===r(o[n],t)&&o[n].push(i?t:{listener:t,once:!1});return this},i.on=o("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=o("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,t){var n,o,i=this.getListenersAsObject(e);for(o in i)i.hasOwnProperty(o)&&(n=r(i[o],t),-1!==n&&i[o].splice(n,1));return this},i.off=o("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var r,o,i=e?this.removeListener:this.addListener,a=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(r=n.length;r--;)i.call(this,t,n[r]);else for(r in t)t.hasOwnProperty(r)&&(o=t[r])&&("function"==typeof o?i.call(this,r,o):a.call(this,r,o));return this},i.removeEvent=function(e){var t,n=typeof e,r=this._getEvents();if("string"===n)delete r[e];else if(e instanceof RegExp)for(t in r)r.hasOwnProperty(t)&&e.test(t)&&delete r[t];else delete this._events;return this},i.removeAllListeners=o("removeEvent"),i.emitEvent=function(e,t){var n,r,o,i,a,l=this.getListenersAsObject(e);for(i in l)if(l.hasOwnProperty(i))for(n=l[i].slice(0),o=n.length;o--;)r=n[o],r.once===!0&&this.removeListener(e,r.listener),a=r.listener.apply(this,t||[]),a===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},i.trigger=o("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return a.EventEmitter=l,e},"function"==typeof t&&t.amd?t(function(){return e}):"object"==typeof n&&n.exports?n.exports=e:a.EventEmitter=e}).call(this)},{}]},{},[1])}();
2
  //# sourceMappingURL=admin.min.js.map
1
+ !function(){var e=void 0,t=void 0;!function n(t,r,o){function i(u,l){if(!r[u]){if(!t[u]){var s="function"==typeof e&&e;if(!l&&s)return s(u,!0);if(a)return a(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var f=r[u]={exports:{}};t[u][0].call(f.exports,function(e){var n=t[u][1][e];return i(n?n:e)},f,f.exports,n,t,r,o)}return r[u].exports}for(var a="function"==typeof e&&e,u=0;u<o.length;u++)i(o[u]);return i}({1:[function(e,t,n){"use strict";var r=e("mithril"),o=e("wolfy87-eventemitter"),i=document.getElementById("mc4wp-admin"),a=new o,u=e("./admin/tabs.js")(i),l=e("./admin/helpers.js"),s=e("./admin/settings.js")(i,l,a);window.mc4wp=window.mc4wp||{},window.mc4wp.deps=window.mc4wp.deps||{},window.mc4wp.deps.mithril=r,window.mc4wp.helpers=l,window.mc4wp.events=a,window.mc4wp.settings=s,window.mc4wp.tabs=u},{"./admin/helpers.js":2,"./admin/settings.js":3,"./admin/tabs.js":4,mithril:6,"wolfy87-eventemitter":7}],2:[function(e,t,n){"use strict";var r={};r.toggleElement=function(e){for(var t=document.querySelectorAll(e),n=0;n<t.length;n++){var r=t[n].clientHeight<=0;t[n].style.display=r?"":"none"}},r.bindEventToElement=function(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent&&e.attachEvent("on"+t,n)},r.bindEventToElements=function(e,t,n){Array.prototype.forEach.call(e,function(e){r.bindEventToElement(e,t,n)})},r.debounce=function(e,t,n){var r;return function(){var o=this,i=arguments,a=function(){r=null,n||e.apply(o,i)},u=n&&!r;clearTimeout(r),r=setTimeout(a,t),u&&e.apply(o,i)}},function(){var e=document.querySelectorAll("[data-showif]");Array.prototype.forEach.call(e,function(e){function t(){if("boolean"!=typeof this.checked||this.checked){var t=this.value==n.value;a?(e.style.display=t?"":"none",e.style.visibility=t?"":"hidden"):e.style.opacity=t?"":"0.4",Array.prototype.forEach.call(i,function(e){t?e.removeAttribute("readonly"):e.setAttribute("readonly","readonly")})}}var n=JSON.parse(e.getAttribute("data-showif")),o=document.querySelectorAll('[name="'+n.element+'"]'),i=e.querySelectorAll("input,select,textarea:not([readonly])"),a=void 0===n.hide||n.hide;Array.prototype.forEach.call(o,function(e){t.call(e)}),r.bindEventToElements(o,"change",t)})}(),t.exports=r},{}],3:[function(e,t,n){var r=function(e,t,n){"use strict";function r(e,t){return s.filter(function(n){return n[e]===t})}function o(){return s}function i(){return s=[],Array.prototype.forEach.call(u,function(e){("boolean"!=typeof e.checked||e.checked)&&"object"==typeof l[e.value]&&s.push(l[e.value])}),n.trigger("selectedLists.change",[s]),s}function a(){var e=document.querySelectorAll(".lists--only-selected > *");Array.prototype.forEach.call(e,function(e){var t=e.getAttribute("data-list-id"),n=r("id",t).length>0;n?e.setAttribute("class",e.getAttribute("class").replace("hidden","")):e.setAttribute("class",e.getAttribute("class")+" hidden")})}var u=(e.querySelector("form"),e.querySelectorAll(".mc4wp-list-input")),l=mc4wp_vars.mailchimp.lists,s=[];return n.on("selectedLists.change",a),t.bindEventToElements(u,"change",i),i(),{getSelectedLists:o}};t.exports=r},{}],4:[function(e,t,n){var r=function(t){"use strict";function n(e){for(var t=0;t<h.length;t++)if(h[t].id===e)return h[t]}function r(e,t){if("string"==typeof e&&(e=n(e)),!e)return!1;void 0==t&&(t=!0),c.removeClass("tab-active").css("display","none"),f.removeClass("nav-tab-active"),Array.prototype.forEach.call(e.nav,function(e){e.className+=" nav-tab-active",e.blur()}),e.element.style.display="block",e.element.className+=" tab-active";var r=l.setParameter(window.location.href,"tab",e.id);return history.pushState&&t&&history.pushState(e.id,"",r),o(e),d.value=r,"function"==typeof tb_remove&&tb_remove(),"fields"===e.id&&window.mc4wp&&window.mc4wp.forms&&window.mc4wp.forms.editor&&mc4wp.forms.editor.refresh(),!0}function o(e){var t=document.title.split("-");document.title=document.title.replace(t[0],e.title+" ")}function i(e){e=e||window.event;var t=this.getAttribute("data-tab");if(!t){var n=this.className.match(/nav-tab-(\w+)?/);n&&(t=n[1])}if(!t){var o=l.parse(this.href);if(!o.tab)return;t=o.tab}var i=r(t);return i?(e.preventDefault(),e.returnValue=!1,!1):!0}function a(){if(history.pushState){var e=c.filter(":visible").get(0);if(e){var t=n(e.id.substring(4));t&&(history.replaceState&&null===history.state&&history.replaceState(t.id,""),o(t))}}}var u=window.jQuery,l=e("./url.js"),s=u(t),c=s.find(".tab"),f=s.find(".nav-tab"),d=t.querySelector('input[name="_wp_http_referer"]'),h=[];return u.each(c,function(e,n){var o=n.id.substring(4),i=u(n).find("h2").first().text();h.push({id:o,title:i,element:n,nav:t.querySelectorAll(".nav-tab-"+o),open:function(){return r(o)}})}),f.click(i),u(document.body).on("click",".tab-link",i),a(),window.addEventListener&&history.pushState&&window.addEventListener("popstate",function(e){if(!e.state)return!0;var t=e.state;return r(t,!1)}),{open:r,get:n}};t.exports=r},{"./url.js":5}],5:[function(e,t,n){"use strict";var r={parse:function(e){var t={},n=e.split("&");for(var r in n)if(n.hasOwnProperty(r)){var o=n[r].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t},build:function(e){var t=[];for(var n in e)t.push(n+"="+encodeURIComponent(e[n]));return t.join("&")},setParameter:function(e,t,n){var o=r.parse(e);return o[t]=n,r.build(o)}};t.exports=r},{}],6:[function(e,n,r){!function(e,r){"use strict";var o=r(e);"object"==typeof n&&null!=n&&n.exports?n.exports=o:"function"==typeof t&&t.amd?t(function(){return o}):e.m=o}("undefined"!=typeof window?window:{},function(e,t){"use strict";function n(e){return"function"==typeof e}function r(e){return"[object Object]"===Le.call(e)}function o(e){return"[object String]"===Le.call(e)}function i(){}function a(e){be=e.document,xe=e.location,Ce=e.cancelAnimationFrame||e.clearTimeout,Ae=e.requestAnimationFrame||e.setTimeout}function u(e,t){for(var n,r=[],o=/(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g;n=o.exec(t);)if(""===n[1]&&n[2])e.tag=n[2];else if("#"===n[1])e.attrs.id=n[2];else if("."===n[1])r.push(n[2]);else if("["===n[3][0]){var i=/\[(.+?)(?:=("|'|)(.*?)\2)?\]/.exec(n[3]);e.attrs[i[1]]=i[3]||(i[2]?"":!0)}return r}function l(e,t){var n=t?e.slice(1):e;return 1===n.length&&je(n[0])?n[0]:n}function s(e,t,n){var r="class"in t?"class":"className";for(var o in t)Oe.call(t,o)&&(o===r&&null!=t[o]&&""!==t[o]?(n.push(t[o]),e[o]=""):e[o]=t[o]);n.length&&(e[r]=n.join(" "))}function c(e,t){var n=[].slice.call(arguments,1);if(r(e))return te(e,n);if(!o(e))throw new Error("selector in m(selector, attrs, children) should be a string");var i=null!=t&&r(t)&&!("tag"in t||"view"in t||"subtree"in t),a=i?t:{},c={tag:"div",attrs:{},children:l(n,i)};return s(c.attrs,a,u(c,e)),c}function f(e,t){for(var n=0;n<e.length&&!t(e[n],n++););}function d(e,t){f(e,function(e,n){return(e=e&&e.attrs)&&null!=e.key&&t(e,n)})}function h(e){try{if(null!=e&&null!=e.toString())return e}catch(t){}return""}function p(e,t,n,r){try{m(e,t,n),t.nodeValue=r}catch(o){}}function v(e){for(var t=0;t<e.length;t++)je(e[t])&&(e=e.concat.apply([],e),t--);return e}function m(e,t,n){e.insertBefore(t,e.childNodes[n]||null)}function g(e,t,n,r){d(e,function(e,r){t[e=e.key]=t[e]?{action:Te,index:r,from:t[e].index,element:n.nodes[t[e].index]||be.createElement("div")}:{action:Ne,index:r}});var o=[];for(var i in t)Oe.call(t,i)&&o.push(t[i]);var a=o.sort(B),u=new Array(n.length);return u.nodes=n.nodes.slice(),f(a,function(t){var o=t.index;if(t.action===Se&&(G(n[o].nodes,n[o]),u.splice(o,1)),t.action===Ne){var i=be.createElement("div");i.key=e[o].attrs.key,m(r,i,o),u.splice(o,0,{attrs:{key:e[o].attrs.key},nodes:[i]}),u.nodes[o]=i}if(t.action===Te){var a=t.element,l=r.childNodes[o];l!==a&&null!==a&&r.insertBefore(a,l||null),u[o]=n[t.from],u.nodes[o]=a}}),u}function y(e,t,n,r){var o=e.length!==t.length;return o||d(e,function(e,n){var r=t[n];return o=r&&r.attrs&&r.attrs.key!==e.key}),o?g(e,n,t,r):t}function w(e,t,n){f(e,function(e,r){null!=t[r]&&n.push.apply(n,t[r].nodes)}),f(t.nodes,function(e,r){null!=e.parentNode&&n.indexOf(e)<0&&G([e],[t[r]])}),e.length<t.length&&(t.length=e.length),t.nodes=n}function E(e){var t=0;d(e,function(){return f(e,function(e){(e=e&&e.attrs)&&null==e.key&&(e.key="__mithril__"+t++)}),1})}function b(e,t,n){return e.tag!==t.tag?!0:n.sort().join()!==Object.keys(t.attrs).sort().join()?!0:e.attrs.id!==t.attrs.id?!0:e.attrs.key!==t.attrs.key?!0:"all"===c.redraw.strategy()?!t.configContext||t.configContext.retain!==!0:"diff"===c.redraw.strategy()?t.configContext&&t.configContext.retain===!1:!1}function x(e,t,r){b(e,t,r)&&(t.nodes.length&&G(t.nodes),t.configContext&&n(t.configContext.onunload)&&t.configContext.onunload(),t.controllers&&f(t.controllers,function(e){e.onunload&&e.onunload({preventDefault:i})}))}function A(e,t){return e.attrs.xmlns?e.attrs.xmlns:"svg"===e.tag?"http://www.w3.org/2000/svg":"math"===e.tag?"http://www.w3.org/1998/Math/MathML":t}function C(e,t,n){n.length&&(e.views=t,e.controllers=n,f(n,function(e){if(e.onunload&&e.onunload.$old&&(e.onunload=e.onunload.$old),Re&&e.onunload){var t=e.onunload;e.onunload=i,e.onunload.$old=t}}))}function O(e,t,r,o,i){if(n(t.attrs.config)){var a=i.configContext=i.configContext||{};e.push(function(){return t.attrs.config.call(t,r,!o,a,i)})}}function L(e,n,r,o,i,a,u,l){var s=e.nodes[0];return o&&F(s,n.tag,n.attrs,e.attrs,i),e.children=$(s,n.tag,t,t,n.children,e.children,!1,0,n.attrs.contenteditable?s:r,i,u),e.nodes.intact=!0,l.length&&(e.views=a,e.controllers=l),s}function j(e,t,n){var r;e.$trusted?r=W(t,n,e):(r=[be.createTextNode(e)],t.nodeName in ke||m(t,r[0],n));var o;return o="string"==typeof e||"number"==typeof e||"boolean"==typeof e?new e.constructor(e):e,o.nodes=r,o}function k(e,t,n,r,o,i){var a=t.nodes;return r&&r===be.activeElement||(e.$trusted?(G(a,t),a=W(n,o,e)):"textarea"===i?n.value=e:r?r.innerHTML=e:((1===a[0].nodeType||a.length>1||a[0].nodeValue.trim&&!a[0].nodeValue.trim())&&(G(t.nodes,t),a=[be.createTextNode(e)]),p(n,a[0],o,e))),t=new e.constructor(e),t.nodes=a,t}function S(e,t,n,r,o,i,a){return e.nodes.length?e.valueOf()!==t.valueOf()||o?k(t,e,r,i,n,a):(e.nodes.intact=!0,e):j(t,r,n)}function N(e){if(e.$trusted){var t=e.match(/<[^\/]|\>\s*[^<]/g);if(null!=t)return t.length}else if(je(e))return e.length;return 1}function T(e,n,r,o,i,a,u,l,s){e=v(e);var c=[],f=n.length===e.length,h=0,p={},m=!1;d(n,function(e,t){m=!0,p[n[t].attrs.key]={action:Se,index:t}}),E(e),m&&(n=y(e,n,p,r));for(var g=0,b=0,x=e.length;x>b;b++){var A=$(r,i,n,o,e[b],n[g],a,o+h||h,u,l,s);A!==t&&(f=f&&A.nodes.intact,h+=N(A),n[g++]=A)}return f||w(e,n,c),n}function R(e,t,n,r,o){if(null!=t){if(Le.call(t)===Le.call(e))return t;if(o&&o.nodes){var i=n-r,a=i+(je(e)?e:t.nodes).length;G(o.nodes.slice(i,a),o.slice(i,a))}else t.nodes&&G(t.nodes,t)}return t=new e.constructor,t.tag&&(t={}),t.nodes=[],t}function _(e,t){return e.attrs.is?null==t?be.createElement(e.tag,e.attrs.is):be.createElementNS(t,e.tag,e.attrs.is):null==t?be.createElement(e.tag):be.createElementNS(t,e.tag)}function M(e,t,n,r){return r?F(t,e.tag,e.attrs,{},n):e.attrs}function q(e,n,r,o,i,a){return null!=e.children&&e.children.length>0?$(n,e.tag,t,t,e.children,r.children,!0,0,e.attrs.contenteditable?n:o,i,a):e.children}function D(e,t,n,r,o,i,a){var u={tag:e.tag,attrs:t,children:n,nodes:[r]};return C(u,i,a),u.children&&!u.children.nodes&&(u.children.nodes=[]),"select"===e.tag&&"value"in e.attrs&&F(r,e.tag,{value:e.attrs.value},{},o),u}function I(e,t,r,o){var i;return i="diff"===c.redraw.strategy()&&e?e.indexOf(t):-1,i>-1?r[i]:n(o)?new o:{}}function U(e,t,n,r){null!=r.onunload&&Me.map(function(e){return e.handler}).indexOf(r.onunload)<0&&Me.push({controller:r,handler:r.onunload}),e.push(n),t.push(r)}function P(e,t,n,r,o,i){var a=I(n.views,t,r,e.controller),u=e&&e.attrs&&e.attrs.key;return e=0===Re||qe||r&&r.indexOf(a)>-1?e.view(a):{tag:"placeholder"},"retain"===e.subtree?e:(e.attrs=e.attrs||{},e.attrs.key=u,U(i,o,t,a),e)}function V(e,t,n,r){for(var o=t&&t.controllers;null!=e.view;)e=P(e,e.view.$original||e.view,t,o,r,n);return e}function z(e,t,n,r,i,a,u,l){var s=[],c=[];if(e=V(e,t,s,c),"retain"===e.subtree)return t;if(!e.tag&&c.length)throw new Error("Component template must return a virtual element, not an array, string, etc.");e.attrs=e.attrs||{},t.attrs=t.attrs||{};var f=Object.keys(e.attrs),d=f.length>("key"in e.attrs?1:0);if(x(e,t,f),o(e.tag)){var h=0===t.nodes.length;u=A(e,u);var p;if(h){p=_(e,u);var v=M(e,p,u,d),g=q(e,p,t,n,u,l);t=D(e,v,g,p,u,s,c)}else p=L(t,e,n,d,u,s,l,c);return(h||a===!0&&null!=p)&&m(r,p,i),O(l,e,p,h,t),t}}function $(e,t,o,i,a,u,l,s,c,f,d){return a=h(a),"retain"===a.subtree?u:(u=R(a,u,s,i,o),je(a)?T(a,u,e,s,t,l,c,f,d):null!=a&&r(a)?z(a,u,c,e,s,l,f,d):n(a)?u:S(u,a,s,e,l,c,t))}function B(e,t){return e.action-t.action||e.index-t.index}function H(e,t,n){for(var r in t)Oe.call(t,r)&&(null!=n&&n[r]===t[r]||(e.style[r]=t[r]));for(r in n)Oe.call(n,r)&&(Oe.call(t,r)||(e.style[r]=""))}function J(e,t,o,i,a,u){if("config"===t||"key"===t)return!0;if(n(o)&&"on"===t.slice(0,2))e[t]=X(o,e);else if("style"===t&&null!=o&&r(o))H(e,o,i);else if(null!=u)"href"===t?e.setAttributeNS("http://www.w3.org/1999/xlink","href",o):e.setAttribute("className"===t?"class":t,o);else if(t in e&&!De[t])try{"input"===a&&e[t]===o||(e[t]=o)}catch(l){e.setAttribute(t,o)}else e.setAttribute(t,o)}function K(e,t,n,r,o,i,a){if(t in o&&r===n)"value"===t&&"input"===i&&e.value!==n&&(e.value=n);else{o[t]=n;try{return J(e,t,n,r,i,a)}catch(u){if(u.message.indexOf("Invalid argument")<0)throw u}}}function F(e,t,n,r,o){for(var i in n)if(Oe.call(n,i)&&K(e,i,n[i],r[i],r,t,o))continue;return r}function G(e,t){for(var n=e.length-1;n>-1;n--)if(e[n]&&e[n].parentNode){try{e[n].parentNode.removeChild(e[n])}catch(r){}t=[].concat(t),t[n]&&Q(t[n])}e.length&&(e.length=0)}function Q(e){e.configContext&&n(e.configContext.onunload)&&(e.configContext.onunload(),e.configContext.onunload=null),e.controllers&&f(e.controllers,function(e){n(e.onunload)&&e.onunload({preventDefault:i})}),e.children&&(je(e.children)?f(e.children,Q):e.children.tag&&Q(e.children))}function Y(e,t){try{e.appendChild(be.createRange().createContextualFragment(t))}catch(n){e.insertAdjacentHTML("beforeend",t)}}function W(e,t,n){var r=e.childNodes[t];if(r){var o=1!==r.nodeType,i=be.createElement("span");o?(e.insertBefore(i,r||null),i.insertAdjacentHTML("beforebegin",n),e.removeChild(i)):r.insertAdjacentHTML("beforebegin",n)}else Y(e,n);for(var a=[];e.childNodes[t]!==r;)a.push(e.childNodes[t]),t++;return a}function X(e,t){return function(n){n=n||event,c.redraw.strategy("diff"),c.startComputation();try{return e.call(t,n)}finally{ie()}}}function Z(e){var t=Ue.indexOf(e);return 0>t?Ue.push(e)-1:t}function ee(e){function t(){return arguments.length&&(e=arguments[0]),e}return t.toJSON=function(){return e},t}function te(e,t){function n(){return(e.controller||i).apply(this,t)||this}function r(n){for(var r=[n].concat(t),o=1;o<arguments.length;o++)r.push(arguments[o]);return e.view.apply(e,r)}e.controller&&(n.prototype=e.controller.prototype),r.$original=e.view;var o={controller:n,view:r};return t[0]&&null!=t[0].key&&(o.attrs={key:t[0].key}),o}function ne(e,t,n,r){if(!r){c.redraw.strategy("all"),c.startComputation(),ze[n]=t;var o;o=Ve=e?e:e={controller:i};var a=new(e.controller||i);return o===Ve&&(Be[n]=a,$e[n]=e),ie(),null===e&&re(t,n),Be[n]}null==e&&re(t,n)}function re(e,t){ze.splice(t,1),Be.splice(t,1),$e.splice(t,1),de(e),Ue.splice(Z(e),1)}function oe(){Ke&&(Ke(),Ke=null),f(ze,function(e,t){var n=$e[t];if(Be[t]){var r=[Be[t]];c.render(e,n.view?n.view(Be[t],r):"")}}),Fe&&(Fe(),Fe=null),He=null,Je=new Date,c.redraw.strategy("diff")}function ie(){"none"===c.redraw.strategy()?(Re--,c.redraw.strategy("diff")):c.endComputation()}function ae(e){return e.slice(Xe[c.route.mode].length)}function ue(e,t,n){Ye={};var r=n.indexOf("?");-1!==r&&(Ye=fe(n.substr(r+1,n.length)),n=n.substr(0,r));var o=Object.keys(t),i=o.indexOf(n);if(-1!==i)return c.mount(e,t[o[i]]),!0;for(var a in t)if(Oe.call(t,a)){if(a===n)return c.mount(e,t[a]),!0;var u=new RegExp("^"+a.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(u.test(n))return n.replace(u,function(){var n=a.match(/:[^\/]+/g)||[],r=[].slice.call(arguments,1,-2);f(n,function(e,t){Ye[e.replace(/:|\./g,"")]=decodeURIComponent(r[t])}),c.mount(e,t[a])}),!0}}function le(e){if(e=e||event,!(e.ctrlKey||e.metaKey||e.shiftKey||2===e.which)){e.preventDefault?e.preventDefault():e.returnValue=!1;var t,n=e.currentTarget||e.srcElement;for(t="pathname"===c.route.mode&&n.search?fe(n.search.slice(1)):{};n&&!/a/i.test(n.nodeName);)n=n.parentNode;Re=0,c.route(n[c.route.mode].slice(Xe[c.route.mode].length),t)}}function se(){"hash"!==c.route.mode&&xe.hash?xe.hash=xe.hash:e.scrollTo(0,0)}function ce(e,n){var o={},i=[];for(var a in e)if(Oe.call(e,a)){var u=n?n+"["+a+"]":a,l=e[a];if(null===l)i.push(encodeURIComponent(u));else if(r(l))i.push(ce(l,u));else if(je(l)){var s=[];o[u]=o[u]||{},f(l,function(e){o[u][e]||(o[u][e]=!0,s.push(encodeURIComponent(u)+"="+encodeURIComponent(e)))}),i.push(s.join("&"))}else l!==t&&i.push(encodeURIComponent(u)+"="+encodeURIComponent(l))}return i.join("&")}function fe(e){if(""===e||null==e)return{};"?"===e.charAt(0)&&(e=e.slice(1));var t=e.split("&"),n={};return f(t,function(e){var t=e.split("="),r=decodeURIComponent(t[0]),o=2===t.length?decodeURIComponent(t[1]):null;null!=n[r]?(je(n[r])||(n[r]=[n[r]]),n[r].push(o)):n[r]=o}),n}function de(e){var n=Z(e);G(e.childNodes,Pe[n]),Pe[n]=t}function he(e,t){var n=c.prop(t);return e.then(n),n.then=function(n,r){return he(e.then(n,r),t)},n["catch"]=n.then.bind(null,null),n}function pe(e,t){function o(e){l=e||ot,f.map(function(e){l===rt?e.resolve(s):e.reject(s)})}function i(e,t,o,i){if((null!=s&&r(s)||n(s))&&n(e))try{var a=0;e.call(s,function(e){a++||(s=e,t())},function(e){a++||(s=e,o())})}catch(u){c.deferred.onerror(u),s=u,o()}else i()}function a(){var r;try{r=s&&s.then}catch(f){return c.deferred.onerror(f),s=f,l=nt,a()}l===nt&&c.deferred.onerror(s),i(r,function(){l=tt,a()},function(){l=nt,a()},function(){try{l===tt&&n(e)?s=e(s):l===nt&&n(t)&&(s=t(s),l=tt)}catch(a){return c.deferred.onerror(a),s=a,o()}s===u?(s=TypeError(),o()):i(r,function(){o(rt)},o,function(){o(l===tt&&rt)})})}var u=this,l=0,s=0,f=[];u.promise={},u.resolve=function(e){return l||(s=e,l=tt,a()),u},u.reject=function(e){return l||(s=e,l=nt,a()),u},u.promise.then=function(e,t){var n=new pe(e,t);return l===rt?n.resolve(s):l===ot?n.reject(s):f.push(n),n.promise}}function ve(e){return e}function me(n){var r="mithril_callback_"+(new Date).getTime()+"_"+Math.round(1e16*Math.random()).toString(36),o=be.createElement("script");e[r]=function(i){o.parentNode.removeChild(o),n.onload({type:"load",target:{responseText:i}}),e[r]=t},o.onerror=function(){return o.parentNode.removeChild(o),n.onerror({type:"error",target:{status:500,responseText:JSON.stringify({error:"Error making jsonp request"})}}),e[r]=t,!1},o.onload=function(){return!1},o.src=n.url+(n.url.indexOf("?")>0?"&":"?")+(n.callbackKey?n.callbackKey:"callback")+"="+r+"&"+ce(n.data||{}),be.body.appendChild(o)}function ge(t){var r=new e.XMLHttpRequest;if(r.open(t.method,t.url,!0,t.user,t.password),r.onreadystatechange=function(){4===r.readyState&&(r.status>=200&&r.status<300?t.onload({type:"load",target:r}):t.onerror({type:"error",target:r}))},t.serialize===JSON.stringify&&t.data&&"GET"!==t.method&&r.setRequestHeader("Content-Type","application/json; charset=utf-8"),t.deserialize===JSON.parse&&r.setRequestHeader("Accept","application/json, text/*"),n(t.config)){var i=t.config(r,t);null!=i&&(r=i)}var a="GET"!==t.method&&t.data?t.data:"";if(a&&!o(a)&&a.constructor!==e.FormData)throw new Error("Request data should be either be a string or FormData. Check the `serialize` option in `m.request`");return r.send(a),r}function ye(e){return e.dataType&&"jsonp"===e.dataType.toLowerCase()?me(e):ge(e)}function we(e,t,n){if("GET"===e.method&&"jsonp"!==e.dataType){var r=e.url.indexOf("?")<0?"?":"&",o=ce(t);e.url+=o?r+o:""}else e.data=n(t)}function Ee(e,t){return t&&(e=e.replace(/:[a-z]\w+/gi,function(e){var n=e.slice(1),r=t[n];return delete t[n],r})),e}c.version=function(){return"v0.2.3"};var be,xe,Ae,Ce,Oe={}.hasOwnProperty,Le={}.toString,je=Array.isArray||function(e){return"[object Array]"===Le.call(e)},ke={AREA:1,BASE:1,BR:1,COL:1,COMMAND:1,EMBED:1,HR:1,IMG:1,INPUT:1,KEYGEN:1,LINK:1,META:1,PARAM:1,SOURCE:1,TRACK:1,WBR:1};c.deps=function(t){return a(e=t||window),e},c.deps(e);var Se=1,Ne=2,Te=3,Re=0;c.startComputation=function(){Re++},c.endComputation=function(){Re>1?Re--:(Re=0,c.redraw())};var _e,Me=[],qe=!1,De={list:1,style:1,form:1,type:1,width:1,height:1},Ie={appendChild:function(e){_e===t&&(_e=be.createElement("html")),be.documentElement&&be.documentElement!==e?be.replaceChild(e,be.documentElement):be.appendChild(e),this.childNodes=be.childNodes},insertBefore:function(e){this.appendChild(e)},childNodes:[]},Ue=[],Pe={};c.render=function(e,n,r){if(!e)throw new Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var o,i=[],a=Z(e),u=e===be;o=u||e===be.documentElement?Ie:e,u&&"html"!==n.tag&&(n={tag:"html",attrs:{},children:n}),Pe[a]===t&&G(o.childNodes),r===!0&&de(e),Pe[a]=$(o,null,t,t,n,Pe[a],!1,0,null,t,i),f(i,function(e){e()})},c.trust=function(e){return e=new String(e),e.$trusted=!0,e},c.prop=function(e){return(null!=e&&r(e)||n(e))&&n(e.then)?he(e):ee(e)};var Ve,ze=[],$e=[],Be=[],He=null,Je=0,Ke=null,Fe=null,Ge=16;c.component=function(e){var t=[].slice.call(arguments,1);return te(e,t)},c.mount=c.module=function(e,t){if(!e)throw new Error("Please ensure the DOM element exists before rendering a template into it.");var r=ze.indexOf(e);0>r&&(r=ze.length);var o=!1,i={preventDefault:function(){o=!0,Ke=Fe=null}};return f(Me,function(e){e.handler.call(e.controller,i),e.controller.onunload=null}),o?f(Me,function(e){e.controller.onunload=e.handler}):Me=[],Be[r]&&n(Be[r].onunload)&&Be[r].onunload(i),ne(t,e,r,o)};var Qe=!1;c.redraw=function(t){if(!Qe){Qe=!0,t&&(qe=!0);try{He&&!t?(Ae===e.requestAnimationFrame||new Date-Je>Ge)&&(He>0&&Ce(He),He=Ae(oe,Ge)):(oe(),He=Ae(function(){He=null},Ge))}finally{Qe=qe=!1}}},c.redraw.strategy=c.prop(),c.withAttr=function(e,t,n){return function(r){r=r||event;var o=r.currentTarget||this,i=n||this,a=e in o?o[e]:o.getAttribute(e);t.call(i,a)}};var Ye,We,Xe={pathname:"",hash:"#",search:"?"},Ze=i,et=!1;c.route=function(t,n,r,i){if(0===arguments.length)return We;if(3===arguments.length&&o(n)){Ze=function(e){var o=We=ae(e);if(!ue(t,r,o)){if(et)throw new Error("Ensure the default route matches one of the routes defined in m.route");et=!0,c.route(n,!0),et=!1}};var a="hash"===c.route.mode?"onhashchange":"onpopstate";return e[a]=function(){var e=xe[c.route.mode];"pathname"===c.route.mode&&(e+=xe.search),We!==ae(e)&&Ze(e)},Ke=se,void e[a]()}if(t.addEventListener||t.attachEvent){var u="pathname"!==c.route.mode?xe.pathname:"";return t.href=u+Xe[c.route.mode]+i.attrs.href,void(t.addEventListener?(t.removeEventListener("click",le),t.addEventListener("click",le)):(t.detachEvent("onclick",le),t.attachEvent("onclick",le)))}if(o(t)){var l=We;We=t;var s,f=n||{},d=We.indexOf("?");s=d>-1?fe(We.slice(d+1)):{};for(var h in f)Oe.call(f,h)&&(s[h]=f[h]);var p,v=ce(s);p=d>-1?We.slice(0,d):We,v&&(We=p+(-1===p.indexOf("?")?"?":"&")+v);var m=(3===arguments.length?r:n)===!0||l===t;if(e.history.pushState){var g=m?"replaceState":"pushState";Ke=se,Fe=function(){e.history[g](null,be.title,Xe[c.route.mode]+We)},Ze(Xe[c.route.mode]+We)}else xe[c.route.mode]=We,Ze(Xe[c.route.mode]+We)}},c.route.param=function(e){if(!Ye)throw new Error("You must call m.route(element, defaultRoute, routes) before calling m.route.param()");return e?Ye[e]:Ye},c.route.mode="search",c.route.buildQueryString=ce,c.route.parseQueryString=fe,c.deferred=function(){var e=new pe;return e.promise=he(e.promise),e};var tt=1,nt=2,rt=3,ot=4;return c.deferred.onerror=function(e){if("[object Error]"===Le.call(e)&&!/ Error/.test(e.constructor.toString()))throw Re=0,e},c.sync=function(e){function t(e,t){return function(a){return o[e]=a,t||(i="reject"),0===--r&&(n.promise(o),n[i](o)),a}}var n=c.deferred(),r=e.length,o=new Array(r),i="resolve";return e.length>0?f(e,function(e,n){e.then(t(n,!0),t(n,!1))}):n.resolve([]),n.promise},c.request=function(e){e.background!==!0&&c.startComputation();var t,n,r,o=new pe,i=e.dataType&&"jsonp"===e.dataType.toLowerCase();return i?(t=e.serialize=n=e.deserialize=ve,r=function(e){return e.responseText}):(t=e.serialize=e.serialize||JSON.stringify,n=e.deserialize=e.deserialize||JSON.parse,r=e.extract||function(e){return e.responseText.length||n!==JSON.parse?e.responseText:null}),e.method=(e.method||"GET").toUpperCase(),e.url=Ee(e.url,e.data),we(e,e.data,t),e.onload=e.onerror=function(t){try{t=t||event;var i=n(r(t.target,e));"load"===t.type?(e.unwrapSuccess&&(i=e.unwrapSuccess(i,t.target)),je(i)&&e.type?f(i,function(t,n){i[n]=new e.type(t)}):e.type&&(i=new e.type(i)),o.resolve(i)):(e.unwrapError&&(i=e.unwrapError(i,t.target)),o.reject(i))}catch(a){o.reject(a)}finally{e.background!==!0&&c.endComputation()}},ye(e),o.promise=he(o.promise,e.initialValue),o.promise},c})},{}],7:[function(e,n,r){(function(){"use strict";function e(){}function r(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function o(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,a=this,u=a.EventEmitter;i.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp){t={};for(n in r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n])}else t=r[e]||(r[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,t){var n,o=this.getListenersAsObject(e),i="object"==typeof t;for(n in o)o.hasOwnProperty(n)&&-1===r(o[n],t)&&o[n].push(i?t:{listener:t,once:!1});return this},i.on=o("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=o("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,t){var n,o,i=this.getListenersAsObject(e);for(o in i)i.hasOwnProperty(o)&&(n=r(i[o],t),-1!==n&&i[o].splice(n,1));return this},i.off=o("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var r,o,i=e?this.removeListener:this.addListener,a=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(r=n.length;r--;)i.call(this,t,n[r]);else for(r in t)t.hasOwnProperty(r)&&(o=t[r])&&("function"==typeof o?i.call(this,r,o):a.call(this,r,o));return this},i.removeEvent=function(e){var t,n=typeof e,r=this._getEvents();if("string"===n)delete r[e];else if(e instanceof RegExp)for(t in r)r.hasOwnProperty(t)&&e.test(t)&&delete r[t];else delete this._events;return this},i.removeAllListeners=o("removeEvent"),i.emitEvent=function(e,t){var n,r,o,i,a,u=this.getListenersAsObject(e);for(i in u)if(u.hasOwnProperty(i))for(n=u[i].slice(0),o=n.length;o--;)r=n[o],r.once===!0&&this.removeListener(e,r.listener),a=r.listener.apply(this,t||[]),a===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},i.trigger=o("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return a.EventEmitter=u,e},"function"==typeof t&&t.amd?t(function(){return e}):"object"==typeof n&&n.exports?n.exports=e:a.EventEmitter=e}).call(this)},{}]},{},[1])}();
2
  //# sourceMappingURL=admin.min.js.map
assets/js/admin.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["admin.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length",1,"module","m","EventEmitter","context","document","getElementById","events","tabs","helpers","settings","window","mc4wp","deps","mithril","./admin/helpers.js","./admin/settings.js","./admin/tabs.js","wolfy87-eventemitter",2,"toggleElement","selector","elements","querySelectorAll","show","clientHeight","style","display","bindEventToElement","element","event","handler","addEventListener","attachEvent","bindEventToElements","Array","prototype","forEach","debounce","func","wait","immediate","timeout","this","args","arguments","later","apply","callNow","clearTimeout","setTimeout","showIfElements","checked","conditionMet","value","config","hide","visibility","opacity","inputs","inputElement","removeAttribute","setAttribute","JSON","parse","getAttribute","parentElements","parentElement",3,"Settings","getSelectedListsWhere","searchKey","searchValue","selectedLists","filter","el","getSelectedLists","updateSelectedLists","listInputs","input","lists","push","trigger","toggleVisibleLists","rows","listId","isSelected","replace","querySelector","mc4wp_vars","mailchimp","on",4,"Tabs","get","id","open","tab","updateState","$tabs","removeClass","css","$tabNavs","nav","className","blur","url","URL","setParameter","location","href","history","pushState","title","refererField","tb_remove","forms","editor","refresh","split","switchTab","tabId","match","urlParams","opened","preventDefault","returnValue","init","activeTab","substring","replaceState","state","$","jQuery","$context","find","each","first","text","click","body","./url.js",5,"query","hasOwnProperty","b","decodeURIComponent","build","data","ret","d","encodeURIComponent","join","key",6,"app","initialize","$document","$location","$cancelAnimationFrame","cancelAnimationFrame","$requestAnimationFrame","requestAnimationFrame","slice","hasAttrs","type","OBJECT","attrs","classAttrName","cell","tag","classes","STRING","parser","exec","pair","attrParser","children","ARRAY","attrName","parentTag","parentCache","parentIndex","cached","shouldReattach","index","editable","namespace","configs","toString","subtree","cachedType","dataType","nodes","offset","end","clear","constructor","len","concat","intact","subArrayCount","DELETION","INSERTION","MOVE","existing","shouldMaintainIdentities","action","guid","j","keysDiffer","cachedCell","dataCell","from","createElement","actions","prop","changes","sort","sortChanges","newCached","change","splice","dummy","insertBefore","childNodes","cacheCount","item","$trusted","node","parentNode","indexOf","views","controllers","view","$original","controllerIndex","redraw","strategy","controller","noop","pendingRequests","onunload","unloaders","dataAttrKeys","Object","keys","hasKeys","configContext","retain","FUNCTION","isNew","xmlns","is","createElementNS","setAttributes","contenteditable","$old","callback","injectHTML","createTextNode","nodeName","voidElements","valueOf","activeElement","innerHTML","nodeType","nodeValue","dataAttrs","cachedAttrs","dataAttr","cachedAttr","autoredraw","rule","setAttributeNS","message","removeChild","unload","child","nextSibling","isElement","placeholder","insertAdjacentHTML","object","startComputation","endFirstComputation","getCellCacheKey","nodeCache","gettersetter","store","toJSON","parameterize","component","ctrl","output","computePreRedrawHook","root","roots","components","$$args","render","computePostRedrawHook","lastRedrawId","lastRedrawCallTime","Date","normalizeRoute","route","modes","mode","routeByValue","router","path","routeParams","queryStart","parseQueryString","substr","mount","matcher","RegExp","test","values","routeUnobtrusive","ctrlKey","metaKey","which","currentTarget","srcElement","search","toUpperCase","setScroll","hash","scrollTo","buildQueryString","prefix","duplicates","str","valueType","reduce","memo","charAt","pairs","params","reset","cacheKey","cellCache","propify","promise","initialValue","then","resolve","reject","Deferred","successCallback","failureCallback","finish","REJECTED","next","map","deferred","RESOLVED","promiseValue","thennable","notThennableCallback","count","onerror","fire","REJECTING","RESOLVING","self","TypeError","identity","ajax","options","toLowerCase","xhr","XMLHttpRequest","method","user","password","onreadystatechange","readyState","status","onload","target","serialize","stringify","setRequestHeader","deserialize","maybeXhr","FormData","send","callbackKey","getTime","Math","round","random","script","resp","responseText","error","src","appendChild","bindData","xhrOptions","querystring","parameterizeUrl","tokens","html","documentNode","documentElement","replaceChild","forceRecreation","isDocumentRoot","trust","String","topComponent","FRAME_BUDGET","unloader","isPrevented","subcomponent","currentComponent","redrawing","force","endComputation","max","withAttr","withAttrCallback","currentRoute","pathname","redirect","isDefaultRoute","defaultRoute","source","listener","vdom","removeEventListener","detachEvent","oldRoute","queryIndex","currentPath","shouldReplaceHistoryEntry","param","sync","synchronizer","pos","resolved","results","outstanding","request","background","isJSONP","extract","jsonp","unwrap","unwrapSuccess","unwrapError","response","mock","factory","amd",7,"indexOfListener","listeners","alias","name","proto","originalGlobalValue","getListeners","evt","_getEvents","flattenListeners","flatListeners","getListenersAsObject","addListener","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","off","addListeners","manipulateListeners","removeListeners","remove","single","multiple","removeEvent","_events","removeAllListeners","emitEvent","listenersMap","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict"],"mappings":"CAAA,WAAe,GAAIA,GAAUC,OAAeC,EAASD,QAAW,QAAUE,GAAEC,EAAEC,EAAEC,GAAG,QAASC,GA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,EAAKnC,EAASA,SAMlD,OAAOtY,OAMXsa,EAAM/X,QAAU6X,EAAM,aAUtBE,EAAM6B,KAAO,SAAc1B,GACvB,GAAIxa,GAAOT,MAAMC,UAAU+H,MAAMrK,KAAK+C,UAAW,EACjD,OAAOF,MAAKgc,UAAUvB,EAAKxa,IAW/Bqa,EAAM8B,mBAAqB,SAA4Bzb,GAEnD,MADAX,MAAKqc,iBAAmB1b,EACjBX,MAWXsa,EAAM4B,oBAAsB,WACxB,MAAIlc,MAAKqG,eAAe,oBACbrG,KAAKqc,kBAGL,GAUf/B,EAAMI,WAAa,WACf,MAAO1a,MAAK8b,UAAY9b,KAAK8b,aAQjCte,EAAa8e,WAAa,WAEtB,MADApf,GAAQM,aAAe+c,EAChB/c,GAIW,kBAAXpB,IAAyBA,EAAO4d,IACvC5d,EAAO,WACH,MAAOoB,KAGY,gBAAXF,IAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAUM,EAGjBN,EAAQM,aAAeA,IAE7BL,KAAK6C,gBAEI","file":"admin.min.js","sourcesContent":["(function () { var require = undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n'use strict';\n\n// dependencies\nvar m = require('mithril');\nvar EventEmitter = require('wolfy87-eventemitter');\n\n// vars\nvar context = document.getElementById('mc4wp-admin');\nvar events = new EventEmitter();\nvar tabs = require ('./admin/tabs.js')(context);\nvar helpers = require('./admin/helpers.js');\nvar settings = require('./admin/settings.js')(context, helpers, events);\n\n// expose some things\nwindow.mc4wp = window.mc4wp || {};\nwindow.mc4wp.deps = window.mc4wp.deps || {};\nwindow.mc4wp.deps.mithril = m;\nwindow.mc4wp.helpers = helpers;\nwindow.mc4wp.events = events;\nwindow.mc4wp.settings = settings;\nwindow.mc4wp.tabs = tabs;\n},{\"./admin/helpers.js\":2,\"./admin/settings.js\":3,\"./admin/tabs.js\":4,\"mithril\":6,\"wolfy87-eventemitter\":7}],2:[function(require,module,exports){\n'use strict';\n\nvar helpers = {};\n\nhelpers.toggleElement = function(selector) {\n\tvar elements = document.querySelectorAll(selector);\n\tfor( var i=0; i<elements.length;i++){\n\t\tvar show = elements[i].clientHeight <= 0;\n\t\telements[i].style.display = show ? '' : 'none';\n\t}\n};\n\nhelpers.bindEventToElement = function(element,event,handler) {\n\tif ( element.addEventListener) {\n\t\telement.addEventListener(event, handler);\n\t} else if (element.attachEvent) {\n\t\telement.attachEvent('on' + event, handler);\n\t}\n};\n\nhelpers.bindEventToElements = function( elements, event, handler ) {\n\tArray.prototype.forEach.call( elements, function(element) {\n\t\thelpers.bindEventToElement(element,event,handler);\n\t});\n};\n\n\n// polling\nhelpers.debounce = function(func, wait, immediate) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tvar later = function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tvar callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n};\n\n/**\n * Showif.js\n */\n(function() {\n\tvar showIfElements = document.querySelectorAll('[data-showif]');\n\n\t// dependent elements\n\tArray.prototype.forEach.call( showIfElements, function(element) {\n\t\tvar config = JSON.parse( element.getAttribute('data-showif') );\n\t\tvar parentElements = document.querySelectorAll('[name=\"'+ config.element +'\"]');\n\n\t\tvar inputs = element.querySelectorAll('input,select,textarea:not([readonly])');\n\t\tvar hide = config.hide === undefined || config.hide;\n\n\t\tfunction toggleElement() {\n\n\t\t\t// do nothing with unchecked elements\n\t\t\tif( typeof( this.checked ) === \"boolean\" && ! this.checked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// check if element value matches expected value\n\t\t\tvar conditionMet = ( this.value == config.value );\n\n\t\t\tif( hide ) {\n\t\t\t\telement.style.display = conditionMet ? '' : 'none';\n\t\t\t\telement.style.visibility = conditionMet ? '' : 'hidden';\n\t\t\t} else {\n\t\t\t\telement.style.opacity = conditionMet ? '' : '0.4';\n\t\t\t}\n\n\t\t\t// disable input fields to stop sending their values to server\n\t\t\tArray.prototype.forEach.call( inputs, function(inputElement) {\n\t\t\t\tconditionMet ? inputElement.removeAttribute('readonly') : inputElement.setAttribute('readonly','readonly');\n\t\t\t});\n\t\t}\n\n\t\t// find checked element and call toggleElement function\n\t\tArray.prototype.forEach.call( parentElements, function( parentElement ) {\n\t\t\ttoggleElement.call(parentElement);\n\t\t});\n\n\t\t// bind on all changes\n\t\thelpers.bindEventToElements(parentElements, 'change', toggleElement);\n\t});\n})();\n\nmodule.exports = helpers;\n},{}],3:[function(require,module,exports){\nvar Settings = function(context, helpers, events ) {\n\t'use strict';\n\n\t// vars\n\tvar form = context.querySelector('form');\n\tvar listInputs = context.querySelectorAll('.mc4wp-list-input');\n\tvar lists = mc4wp_vars.mailchimp.lists;\n\tvar selectedLists = [];\n\n\t// functions\n\tfunction getSelectedListsWhere(searchKey,searchValue) {\n\t\treturn selectedLists.filter(function(el) {\n\t\t\treturn el[searchKey] === searchValue;\n\t\t});\n\t}\n\n\tfunction getSelectedLists() {\n\t\treturn selectedLists;\n\t}\n\n\tfunction updateSelectedLists() {\n\t\tselectedLists = [];\n\n\t\tArray.prototype.forEach.call(listInputs, function(input) {\n\t\t\t// skip unchecked checkboxes\n\t\t\tif( typeof( input.checked ) === \"boolean\" && ! input.checked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif( typeof( lists[ input.value ] ) === \"object\" ){\n\t\t\t\tselectedLists.push( lists[ input.value ] );\n\t\t\t}\n\t\t});\n\n\t\tevents.trigger('selectedLists.change', [ selectedLists ]);\n\t\treturn selectedLists;\n\t}\n\n\tfunction toggleVisibleLists() {\n\t\tvar rows = document.querySelectorAll('.lists--only-selected > *');\n\t\tArray.prototype.forEach.call(rows, function(el) {\n\n\t\t\tvar listId = el.getAttribute('data-list-id');\n\t\t\tvar isSelected = getSelectedListsWhere('id', listId).length > 0;\n\n\t\t\tif( isSelected ) {\n\t\t\t\tel.setAttribute('class', el.getAttribute('class').replace('hidden',''));\n\t\t\t} else {\n\t\t\t\tel.setAttribute('class', el.getAttribute('class') + \" hidden\" );\n\t\t\t}\n\t\t});\n\t}\n\n\tevents.on('selectedLists.change', toggleVisibleLists);\n\thelpers.bindEventToElements(listInputs,'change',updateSelectedLists);\n\n\tupdateSelectedLists();\n\n\treturn {\n\t\tgetSelectedLists: getSelectedLists\n\t}\n\n};\n\nmodule.exports = Settings;\n},{}],4:[function(require,module,exports){\n// Tabs\nvar Tabs = function(context) {\n\t'use strict';\n\n\t// @todo last piece of jQuery... can we get rid of it?\n\tvar $ = window.jQuery;\n\n\tvar URL = require('./url.js');\n\tvar $context = $(context);\n\tvar $tabs = $context.find('.tab');\n\tvar $tabNavs = $context.find('.nav-tab');\n\tvar refererField = context.querySelector('input[name=\"_wp_http_referer\"]');\n\tvar tabs = [];\n\n\t$.each($tabs, function(i,t) {\n\t\tvar id = t.id.substring(4);\n\t\tvar title = $(t).find('h2').first().text();\n\n\t\ttabs.push({\n\t\t\tid: id,\n\t\t\ttitle: title,\n\t\t\telement: t,\n\t\t\tnav: context.querySelectorAll('.nav-tab-' + id),\n\t\t\topen: function() { return open(id); }\n\t\t});\n\t});\n\n\tfunction get(id) {\n\n\t\tfor( var i=0; i<tabs.length; i++){\n\t\t\tif(tabs[i].id === id ) {\n\t\t\t\treturn tabs[i];\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tfunction open( tab, updateState ) {\n\n\t\t// make sure we have a tab object\n\t\tif(typeof(tab) === \"string\"){\n\t\t\ttab = get(tab);\n\t\t}\n\n\t\tif(!tab) { return false; }\n\n\t\t// should we update state?\n\t\tif( updateState == undefined ) {\n\t\t\tupdateState = true;\n\t\t}\n\n\t\t// hide all tabs & remove active class\n\t\t$tabs.removeClass('tab-active').css('display', 'none');\n\t\t$tabNavs.removeClass('nav-tab-active');\n\n\t\t// add `nav-tab-active` to this tab\n\t\tArray.prototype.forEach.call(tab.nav, function(nav) {\n\t\t\tnav.className += \" nav-tab-active\";\n\t\t\tnav.blur();\n\t\t});\n\n\t\t// show target tab\n\t\ttab.element.style.display = 'block';\n\t\ttab.element.className += \" tab-active\";\n\n\t\t// create new URL\n\t\tvar url = URL.setParameter(window.location.href, \"tab\", tab.id );\n\n\t\t// update hash\n\t\tif( history.pushState && updateState ) {\n\t\t\thistory.pushState( tab.id, '', url );\n\t\t}\n\n\t\t// update document title\n\t\ttitle(tab);\n\n\t\t// update referer field\n\t\trefererField.value = url;\n\n\t\t// if thickbox is open, close it.\n\t\tif( typeof(tb_remove) === \"function\" ) {\n\t\t\ttb_remove();\n\t\t}\n\n\t\t// refresh editor after switching tabs\n\t\t// TODO: decouple decouple decouple\n\t\tif( tab.id === 'fields' && window.mc4wp && window.mc4wp.forms && window.mc4wp.forms.editor ) {\n\t\t\tmc4wp.forms.editor.refresh();\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tfunction title(tab) {\n\t\tvar title = document.title.split('-');\n\t\tdocument.title = document.title.replace(title[0], tab.title + \" \");\n\t}\n\n\tfunction switchTab(e) {\n\t\te = e || window.event;\n\n\t\t// get from data attribute\n\t\tvar tabId = this.getAttribute('data-tab');\n\n\t\t// get from classname\n\t\tif( ! tabId ) {\n\t\t\tvar match = this.className.match(/nav-tab-(\\w+)?/);\n\t\t\tif( match ) {\n\t\t\t\ttabId = match[1];\n\t\t\t}\n\t\t}\n\n\t\t// get from href\n\t\tif( ! tabId ) {\n\t\t\tvar urlParams = URL.parse( this.href );\n\t\t\tif( ! urlParams.tab ) { return; }\n\t\t\ttabId = urlParams.tab;\n\t\t}\n\n\t\tvar opened = open( tabId );\n\n\t\tif( opened ) {\n\t\t\te.preventDefault();\n\t\t\te.returnValue = false;\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tfunction init() {\n\n\t\t// check for current tab\n\t\tif(! history.pushState) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar activeTab = $tabs.filter(':visible').get(0);\n\t\tif( ! activeTab ) { return; }\n\t\tvar tab = get(activeTab.id.substring(4));\n\t\tif(!tab) return;\n\n\t\t// check if tab is in html5 history\n\t\tif( history.replaceState && history.state === null) {\n\t\t\thistory.replaceState( tab.id, '' );\n\t\t}\n\n\t\t// update document title\n\t\ttitle(tab);\n\t}\n\n\t$tabNavs.click(switchTab);\n\t$(document.body).on('click', '.tab-link', switchTab);\n\tinit();\n\n\tif(window.addEventListener && history.pushState ) {\n\t\twindow.addEventListener('popstate', function(e) {\n\t\t\tif(!e.state) return true;\n\t\t\tvar tabId = e.state;\n\t\t\treturn open(tabId,false);\n\t\t});\n\t}\n\n\treturn {\n\t\topen: open,\n\t\tget: get\n\t}\n\n};\n\nmodule.exports = Tabs;\n},{\"./url.js\":5}],5:[function(require,module,exports){\n'use strict';\n\nvar URL = {\n\tparse: function(url) {\n\t\tvar query = {};\n\t\tvar a = url.split('&');\n\t\tfor (var i in a) {\n\t\t\tif(!a.hasOwnProperty(i)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvar b = a[i].split('=');\n\t\t\tquery[decodeURIComponent(b[0])] = decodeURIComponent(b[1]);\n\t\t}\n\n\t\treturn query;\n\t},\n\tbuild: function(data) {\n\t\tvar ret = [];\n\t\tfor (var d in data)\n\t\t\tret.push(d + \"=\" + encodeURIComponent(data[d]));\n\t\treturn ret.join(\"&\");\n\t},\n\tsetParameter: function( url, key, value ) {\n\t\tvar data = URL.parse( url );\n\t\tdata[ key ] = value;\n\t\treturn URL.build( data );\n\t}\n};\n\nmodule.exports = URL;\n},{}],6:[function(require,module,exports){\nvar m = (function app(window, undefined) {\r\n\tvar OBJECT = \"[object Object]\", ARRAY = \"[object Array]\", STRING = \"[object String]\", FUNCTION = \"function\";\r\n\tvar type = {}.toString;\r\n\tvar parser = /(?:(^|#|\\.)([^#\\.\\[\\]]+))|(\\[.+?\\])/g, attrParser = /\\[(.+?)(?:=(\"|'|)(.*?)\\2)?\\]/;\r\n\tvar voidElements = /^(AREA|BASE|BR|COL|COMMAND|EMBED|HR|IMG|INPUT|KEYGEN|LINK|META|PARAM|SOURCE|TRACK|WBR)$/;\r\n\tvar noop = function() {}\r\n\r\n\t// caching commonly used variables\r\n\tvar $document, $location, $requestAnimationFrame, $cancelAnimationFrame;\r\n\r\n\t// self invoking function needed because of the way mocks work\r\n\tfunction initialize(window){\r\n\t\t$document = window.document;\r\n\t\t$location = window.location;\r\n\t\t$cancelAnimationFrame = window.cancelAnimationFrame || window.clearTimeout;\r\n\t\t$requestAnimationFrame = window.requestAnimationFrame || window.setTimeout;\r\n\t}\r\n\r\n\tinitialize(window);\r\n\r\n\r\n\t/**\r\n\t * @typedef {String} Tag\r\n\t * A string that looks like -> div.classname#id[param=one][param2=two]\r\n\t * Which describes a DOM node\r\n\t */\r\n\r\n\t/**\r\n\t *\r\n\t * @param {Tag} The DOM node tag\r\n\t * @param {Object=[]} optional key-value pairs to be mapped to DOM attrs\r\n\t * @param {...mNode=[]} Zero or more Mithril child nodes. Can be an array, or splat (optional)\r\n\t *\r\n\t */\r\n\tfunction m() {\r\n\t\tvar args = [].slice.call(arguments);\r\n\t\tvar hasAttrs = args[1] != null && type.call(args[1]) === OBJECT && !(\"tag\" in args[1] || \"view\" in args[1]) && !(\"subtree\" in args[1]);\r\n\t\tvar attrs = hasAttrs ? args[1] : {};\r\n\t\tvar classAttrName = \"class\" in attrs ? \"class\" : \"className\";\r\n\t\tvar cell = {tag: \"div\", attrs: {}};\r\n\t\tvar match, classes = [];\r\n\t\tif (type.call(args[0]) != STRING) throw new Error(\"selector in m(selector, attrs, children) should be a string\")\r\n\t\twhile (match = parser.exec(args[0])) {\r\n\t\t\tif (match[1] === \"\" && match[2]) cell.tag = match[2];\r\n\t\t\telse if (match[1] === \"#\") cell.attrs.id = match[2];\r\n\t\t\telse if (match[1] === \".\") classes.push(match[2]);\r\n\t\t\telse if (match[3][0] === \"[\") {\r\n\t\t\t\tvar pair = attrParser.exec(match[3]);\r\n\t\t\t\tcell.attrs[pair[1]] = pair[3] || (pair[2] ? \"\" :true)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar children = hasAttrs ? args.slice(2) : args.slice(1);\r\n\t\tif (children.length === 1 && type.call(children[0]) === ARRAY) {\r\n\t\t\tcell.children = children[0]\r\n\t\t}\r\n\t\telse {\r\n\t\t\tcell.children = children\r\n\t\t}\r\n\t\t\r\n\t\tfor (var attrName in attrs) {\r\n\t\t\tif (attrs.hasOwnProperty(attrName)) {\r\n\t\t\t\tif (attrName === classAttrName && attrs[attrName] != null && attrs[attrName] !== \"\") {\r\n\t\t\t\t\tclasses.push(attrs[attrName])\r\n\t\t\t\t\tcell.attrs[attrName] = \"\" //create key in correct iteration order\r\n\t\t\t\t}\r\n\t\t\t\telse cell.attrs[attrName] = attrs[attrName]\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (classes.length > 0) cell.attrs[classAttrName] = classes.join(\" \");\r\n\t\t\r\n\t\treturn cell\r\n\t}\r\n\tfunction build(parentElement, parentTag, parentCache, parentIndex, data, cached, shouldReattach, index, editable, namespace, configs) {\r\n\t\t//`build` is a recursive function that manages creation/diffing/removal of DOM elements based on comparison between `data` and `cached`\r\n\t\t//the diff algorithm can be summarized as this:\r\n\t\t//1 - compare `data` and `cached`\r\n\t\t//2 - if they are different, copy `data` to `cached` and update the DOM based on what the difference is\r\n\t\t//3 - recursively apply this algorithm for every array and for the children of every virtual element\r\n\r\n\t\t//the `cached` data structure is essentially the same as the previous redraw's `data` data structure, with a few additions:\r\n\t\t//- `cached` always has a property called `nodes`, which is a list of DOM elements that correspond to the data represented by the respective virtual element\r\n\t\t//- in order to support attaching `nodes` as a property of `cached`, `cached` is *always* a non-primitive object, i.e. if the data was a string, then cached is a String instance. If data was `null` or `undefined`, cached is `new String(\"\")`\r\n\t\t//- `cached also has a `configContext` property, which is the state storage object exposed by config(element, isInitialized, context)\r\n\t\t//- when `cached` is an Object, it represents a virtual element; when it's an Array, it represents a list of elements; when it's a String, Number or Boolean, it represents a text node\r\n\r\n\t\t//`parentElement` is a DOM element used for W3C DOM API calls\r\n\t\t//`parentTag` is only used for handling a corner case for textarea values\r\n\t\t//`parentCache` is used to remove nodes in some multi-node cases\r\n\t\t//`parentIndex` and `index` are used to figure out the offset of nodes. They're artifacts from before arrays started being flattened and are likely refactorable\r\n\t\t//`data` and `cached` are, respectively, the new and old nodes being diffed\r\n\t\t//`shouldReattach` is a flag indicating whether a parent node was recreated (if so, and if this node is reused, then this node must reattach itself to the new parent)\r\n\t\t//`editable` is a flag that indicates whether an ancestor is contenteditable\r\n\t\t//`namespace` indicates the closest HTML namespace as it cascades down from an ancestor\r\n\t\t//`configs` is a list of config functions to run after the topmost `build` call finishes running\r\n\r\n\t\t//there's logic that relies on the assumption that null and undefined data are equivalent to empty strings\r\n\t\t//- this prevents lifecycle surprises from procedural helpers that mix implicit and explicit return statements (e.g. function foo() {if (cond) return m(\"div\")}\r\n\t\t//- it simplifies diffing code\r\n\t\t//data.toString() might throw or return null if data is the return value of Console.log in Firefox (behavior depends on version)\r\n\t\ttry {if (data == null || data.toString() == null) data = \"\";} catch (e) {data = \"\"}\r\n\t\tif (data.subtree === \"retain\") return cached;\r\n\t\tvar cachedType = type.call(cached), dataType = type.call(data);\r\n\t\tif (cached == null || cachedType !== dataType) {\r\n\t\t\tif (cached != null) {\r\n\t\t\t\tif (parentCache && parentCache.nodes) {\r\n\t\t\t\t\tvar offset = index - parentIndex;\r\n\t\t\t\t\tvar end = offset + (dataType === ARRAY ? data : cached.nodes).length;\r\n\t\t\t\t\tclear(parentCache.nodes.slice(offset, end), parentCache.slice(offset, end))\r\n\t\t\t\t}\r\n\t\t\t\telse if (cached.nodes) clear(cached.nodes, cached)\r\n\t\t\t}\r\n\t\t\tcached = new data.constructor;\r\n\t\t\tif (cached.tag) cached = {}; //if constructor creates a virtual dom element, use a blank object as the base cached node instead of copying the virtual el (#277)\r\n\t\t\tcached.nodes = []\r\n\t\t}\r\n\r\n\t\tif (dataType === ARRAY) {\r\n\t\t\t//recursively flatten array\r\n\t\t\tfor (var i = 0, len = data.length; i < len; i++) {\r\n\t\t\t\tif (type.call(data[i]) === ARRAY) {\r\n\t\t\t\t\tdata = data.concat.apply([], data);\r\n\t\t\t\t\ti-- //check current index again and flatten until there are no more nested arrays at that index\r\n\t\t\t\t\tlen = data.length\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar nodes = [], intact = cached.length === data.length, subArrayCount = 0;\r\n\r\n\t\t\t//keys algorithm: sort elements without recreating them if keys are present\r\n\t\t\t//1) create a map of all existing keys, and mark all for deletion\r\n\t\t\t//2) add new keys to map and mark them for addition\r\n\t\t\t//3) if key exists in new list, change action from deletion to a move\r\n\t\t\t//4) for each key, handle its corresponding action as marked in previous steps\r\n\t\t\tvar DELETION = 1, INSERTION = 2 , MOVE = 3;\r\n\t\t\tvar existing = {}, shouldMaintainIdentities = false;\r\n\t\t\tfor (var i = 0; i < cached.length; i++) {\r\n\t\t\t\tif (cached[i] && cached[i].attrs && cached[i].attrs.key != null) {\r\n\t\t\t\t\tshouldMaintainIdentities = true;\r\n\t\t\t\t\texisting[cached[i].attrs.key] = {action: DELETION, index: i}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar guid = 0\r\n\t\t\tfor (var i = 0, len = data.length; i < len; i++) {\r\n\t\t\t\tif (data[i] && data[i].attrs && data[i].attrs.key != null) {\r\n\t\t\t\t\tfor (var j = 0, len = data.length; j < len; j++) {\r\n\t\t\t\t\t\tif (data[j] && data[j].attrs && data[j].attrs.key == null) data[j].attrs.key = \"__mithril__\" + guid++\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (shouldMaintainIdentities) {\r\n\t\t\t\tvar keysDiffer = false\r\n\t\t\t\tif (data.length != cached.length) keysDiffer = true\r\n\t\t\t\telse for (var i = 0, cachedCell, dataCell; cachedCell = cached[i], dataCell = data[i]; i++) {\r\n\t\t\t\t\tif (cachedCell.attrs && dataCell.attrs && cachedCell.attrs.key != dataCell.attrs.key) {\r\n\t\t\t\t\t\tkeysDiffer = true\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (keysDiffer) {\r\n\t\t\t\t\tfor (var i = 0, len = data.length; i < len; i++) {\r\n\t\t\t\t\t\tif (data[i] && data[i].attrs) {\r\n\t\t\t\t\t\t\tif (data[i].attrs.key != null) {\r\n\t\t\t\t\t\t\t\tvar key = data[i].attrs.key;\r\n\t\t\t\t\t\t\t\tif (!existing[key]) existing[key] = {action: INSERTION, index: i};\r\n\t\t\t\t\t\t\t\telse existing[key] = {\r\n\t\t\t\t\t\t\t\t\taction: MOVE,\r\n\t\t\t\t\t\t\t\t\tindex: i,\r\n\t\t\t\t\t\t\t\t\tfrom: existing[key].index,\r\n\t\t\t\t\t\t\t\t\telement: cached.nodes[existing[key].index] || $document.createElement(\"div\")\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar actions = []\r\n\t\t\t\t\tfor (var prop in existing) actions.push(existing[prop])\r\n\t\t\t\t\tvar changes = actions.sort(sortChanges);\r\n\t\t\t\t\tvar newCached = new Array(cached.length)\r\n\t\t\t\t\tnewCached.nodes = cached.nodes.slice()\r\n\r\n\t\t\t\t\tfor (var i = 0, change; change = changes[i]; i++) {\r\n\t\t\t\t\t\tif (change.action === DELETION) {\r\n\t\t\t\t\t\t\tclear(cached[change.index].nodes, cached[change.index]);\r\n\t\t\t\t\t\t\tnewCached.splice(change.index, 1)\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (change.action === INSERTION) {\r\n\t\t\t\t\t\t\tvar dummy = $document.createElement(\"div\");\r\n\t\t\t\t\t\t\tdummy.key = data[change.index].attrs.key;\r\n\t\t\t\t\t\t\tparentElement.insertBefore(dummy, parentElement.childNodes[change.index] || null);\r\n\t\t\t\t\t\t\tnewCached.splice(change.index, 0, {attrs: {key: data[change.index].attrs.key}, nodes: [dummy]})\r\n\t\t\t\t\t\t\tnewCached.nodes[change.index] = dummy\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (change.action === MOVE) {\r\n\t\t\t\t\t\t\tif (parentElement.childNodes[change.index] !== change.element && change.element !== null) {\r\n\t\t\t\t\t\t\t\tparentElement.insertBefore(change.element, parentElement.childNodes[change.index] || null)\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tnewCached[change.index] = cached[change.from]\r\n\t\t\t\t\t\t\tnewCached.nodes[change.index] = change.element\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcached = newCached;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t//end key algorithm\r\n\r\n\t\t\tfor (var i = 0, cacheCount = 0, len = data.length; i < len; i++) {\r\n\t\t\t\t//diff each item in the array\r\n\t\t\t\tvar item = build(parentElement, parentTag, cached, index, data[i], cached[cacheCount], shouldReattach, index + subArrayCount || subArrayCount, editable, namespace, configs);\r\n\t\t\t\tif (item === undefined) continue;\r\n\t\t\t\tif (!item.nodes.intact) intact = false;\r\n\t\t\t\tif (item.$trusted) {\r\n\t\t\t\t\t//fix offset of next element if item was a trusted string w/ more than one html element\r\n\t\t\t\t\t//the first clause in the regexp matches elements\r\n\t\t\t\t\t//the second clause (after the pipe) matches text nodes\r\n\t\t\t\t\tsubArrayCount += (item.match(/<[^\\/]|\\>\\s*[^<]/g) || [0]).length\r\n\t\t\t\t}\r\n\t\t\t\telse subArrayCount += type.call(item) === ARRAY ? item.length : 1;\r\n\t\t\t\tcached[cacheCount++] = item\r\n\t\t\t}\r\n\t\t\tif (!intact) {\r\n\t\t\t\t//diff the array itself\r\n\t\t\t\t\r\n\t\t\t\t//update the list of DOM nodes by collecting the nodes from each item\r\n\t\t\t\tfor (var i = 0, len = data.length; i < len; i++) {\r\n\t\t\t\t\tif (cached[i] != null) nodes.push.apply(nodes, cached[i].nodes)\r\n\t\t\t\t}\r\n\t\t\t\t//remove items from the end of the array if the new array is shorter than the old one\r\n\t\t\t\t//if errors ever happen here, the issue is most likely a bug in the construction of the `cached` data structure somewhere earlier in the program\r\n\t\t\t\tfor (var i = 0, node; node = cached.nodes[i]; i++) {\r\n\t\t\t\t\tif (node.parentNode != null && nodes.indexOf(node) < 0) clear([node], [cached[i]])\r\n\t\t\t\t}\r\n\t\t\t\tif (data.length < cached.length) cached.length = data.length;\r\n\t\t\t\tcached.nodes = nodes\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if (data != null && dataType === OBJECT) {\r\n\t\t\tvar views = [], controllers = []\r\n\t\t\twhile (data.view) {\r\n\t\t\t\tvar view = data.view.$original || data.view\r\n\t\t\t\tvar controllerIndex = m.redraw.strategy() == \"diff\" && cached.views ? cached.views.indexOf(view) : -1\r\n\t\t\t\tvar controller = controllerIndex > -1 ? cached.controllers[controllerIndex] : new (data.controller || noop)\r\n\t\t\t\tvar key = data && data.attrs && data.attrs.key\r\n\t\t\t\tdata = pendingRequests == 0 || (cached && cached.controllers && cached.controllers.indexOf(controller) > -1) ? data.view(controller) : {tag: \"placeholder\"}\r\n\t\t\t\tif (data.subtree === \"retain\") return cached;\r\n\t\t\t\tif (key) {\r\n\t\t\t\t\tif (!data.attrs) data.attrs = {}\r\n\t\t\t\t\tdata.attrs.key = key\r\n\t\t\t\t}\r\n\t\t\t\tif (controller.onunload) unloaders.push({controller: controller, handler: controller.onunload})\r\n\t\t\t\tviews.push(view)\r\n\t\t\t\tcontrollers.push(controller)\r\n\t\t\t}\r\n\t\t\tif (!data.tag && controllers.length) throw new Error(\"Component template must return a virtual element, not an array, string, etc.\")\r\n\t\t\tif (!data.attrs) data.attrs = {};\r\n\t\t\tif (!cached.attrs) cached.attrs = {};\r\n\r\n\t\t\tvar dataAttrKeys = Object.keys(data.attrs)\r\n\t\t\tvar hasKeys = dataAttrKeys.length > (\"key\" in data.attrs ? 1 : 0)\r\n\t\t\t//if an element is different enough from the one in cache, recreate it\r\n\t\t\tif (data.tag != cached.tag || dataAttrKeys.sort().join() != Object.keys(cached.attrs).sort().join() || data.attrs.id != cached.attrs.id || data.attrs.key != cached.attrs.key || (m.redraw.strategy() == \"all\" && (!cached.configContext || cached.configContext.retain !== true)) || (m.redraw.strategy() == \"diff\" && cached.configContext && cached.configContext.retain === false)) {\r\n\t\t\t\tif (cached.nodes.length) clear(cached.nodes);\r\n\t\t\t\tif (cached.configContext && typeof cached.configContext.onunload === FUNCTION) cached.configContext.onunload()\r\n\t\t\t\tif (cached.controllers) {\r\n\t\t\t\t\tfor (var i = 0, controller; controller = cached.controllers[i]; i++) {\r\n\t\t\t\t\t\tif (typeof controller.onunload === FUNCTION) controller.onunload({preventDefault: noop})\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (type.call(data.tag) != STRING) return;\r\n\r\n\t\t\tvar node, isNew = cached.nodes.length === 0;\r\n\t\t\tif (data.attrs.xmlns) namespace = data.attrs.xmlns;\r\n\t\t\telse if (data.tag === \"svg\") namespace = \"http://www.w3.org/2000/svg\";\r\n\t\t\telse if (data.tag === \"math\") namespace = \"http://www.w3.org/1998/Math/MathML\";\r\n\t\t\t\r\n\t\t\tif (isNew) {\r\n\t\t\t\tif (data.attrs.is) node = namespace === undefined ? $document.createElement(data.tag, data.attrs.is) : $document.createElementNS(namespace, data.tag, data.attrs.is);\r\n\t\t\t\telse node = namespace === undefined ? $document.createElement(data.tag) : $document.createElementNS(namespace, data.tag);\r\n\t\t\t\tcached = {\r\n\t\t\t\t\ttag: data.tag,\r\n\t\t\t\t\t//set attributes first, then create children\r\n\t\t\t\t\tattrs: hasKeys ? setAttributes(node, data.tag, data.attrs, {}, namespace) : data.attrs,\r\n\t\t\t\t\tchildren: data.children != null && data.children.length > 0 ?\r\n\t\t\t\t\t\tbuild(node, data.tag, undefined, undefined, data.children, cached.children, true, 0, data.attrs.contenteditable ? node : editable, namespace, configs) :\r\n\t\t\t\t\t\tdata.children,\r\n\t\t\t\t\tnodes: [node]\r\n\t\t\t\t};\r\n\t\t\t\tif (controllers.length) {\r\n\t\t\t\t\tcached.views = views\r\n\t\t\t\t\tcached.controllers = controllers\r\n\t\t\t\t\tfor (var i = 0, controller; controller = controllers[i]; i++) {\r\n\t\t\t\t\t\tif (controller.onunload && controller.onunload.$old) controller.onunload = controller.onunload.$old\r\n\t\t\t\t\t\tif (pendingRequests && controller.onunload) {\r\n\t\t\t\t\t\t\tvar onunload = controller.onunload\r\n\t\t\t\t\t\t\tcontroller.onunload = noop\r\n\t\t\t\t\t\t\tcontroller.onunload.$old = onunload\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (cached.children && !cached.children.nodes) cached.children.nodes = [];\r\n\t\t\t\t//edge case: setting value on <select> doesn't work before children exist, so set it again after children have been created\r\n\t\t\t\tif (data.tag === \"select\" && \"value\" in data.attrs) setAttributes(node, data.tag, {value: data.attrs.value}, {}, namespace);\r\n\t\t\t\tparentElement.insertBefore(node, parentElement.childNodes[index] || null)\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tnode = cached.nodes[0];\r\n\t\t\t\tif (hasKeys) setAttributes(node, data.tag, data.attrs, cached.attrs, namespace);\r\n\t\t\t\tcached.children = build(node, data.tag, undefined, undefined, data.children, cached.children, false, 0, data.attrs.contenteditable ? node : editable, namespace, configs);\r\n\t\t\t\tcached.nodes.intact = true;\r\n\t\t\t\tif (controllers.length) {\r\n\t\t\t\t\tcached.views = views\r\n\t\t\t\t\tcached.controllers = controllers\r\n\t\t\t\t}\r\n\t\t\t\tif (shouldReattach === true && node != null) parentElement.insertBefore(node, parentElement.childNodes[index] || null)\r\n\t\t\t}\r\n\t\t\t//schedule configs to be called. They are called after `build` finishes running\r\n\t\t\tif (typeof data.attrs[\"config\"] === FUNCTION) {\r\n\t\t\t\tvar context = cached.configContext = cached.configContext || {};\r\n\r\n\t\t\t\t// bind\r\n\t\t\t\tvar callback = function(data, args) {\r\n\t\t\t\t\treturn function() {\r\n\t\t\t\t\t\treturn data.attrs[\"config\"].apply(data, args)\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\tconfigs.push(callback(data, [node, !isNew, context, cached]))\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if (typeof data != FUNCTION) {\r\n\t\t\t//handle text nodes\r\n\t\t\tvar nodes;\r\n\t\t\tif (cached.nodes.length === 0) {\r\n\t\t\t\tif (data.$trusted) {\r\n\t\t\t\t\tnodes = injectHTML(parentElement, index, data)\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tnodes = [$document.createTextNode(data)];\r\n\t\t\t\t\tif (!parentElement.nodeName.match(voidElements)) parentElement.insertBefore(nodes[0], parentElement.childNodes[index] || null)\r\n\t\t\t\t}\r\n\t\t\t\tcached = \"string number boolean\".indexOf(typeof data) > -1 ? new data.constructor(data) : data;\r\n\t\t\t\tcached.nodes = nodes\r\n\t\t\t}\r\n\t\t\telse if (cached.valueOf() !== data.valueOf() || shouldReattach === true) {\r\n\t\t\t\tnodes = cached.nodes;\r\n\t\t\t\tif (!editable || editable !== $document.activeElement) {\r\n\t\t\t\t\tif (data.$trusted) {\r\n\t\t\t\t\t\tclear(nodes, cached);\r\n\t\t\t\t\t\tnodes = injectHTML(parentElement, index, data)\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\t//corner case: replacing the nodeValue of a text node that is a child of a textarea/contenteditable doesn't work\r\n\t\t\t\t\t\t//we need to update the value property of the parent textarea or the innerHTML of the contenteditable element instead\r\n\t\t\t\t\t\tif (parentTag === \"textarea\") parentElement.value = data;\r\n\t\t\t\t\t\telse if (editable) editable.innerHTML = data;\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\tif (nodes[0].nodeType === 1 || nodes.length > 1) { //was a trusted string\r\n\t\t\t\t\t\t\t\tclear(cached.nodes, cached);\r\n\t\t\t\t\t\t\t\tnodes = [$document.createTextNode(data)]\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tparentElement.insertBefore(nodes[0], parentElement.childNodes[index] || null);\r\n\t\t\t\t\t\t\tnodes[0].nodeValue = data\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tcached = new data.constructor(data);\r\n\t\t\t\tcached.nodes = nodes\r\n\t\t\t}\r\n\t\t\telse cached.nodes.intact = true\r\n\t\t}\r\n\r\n\t\treturn cached\r\n\t}\r\n\tfunction sortChanges(a, b) {return a.action - b.action || a.index - b.index}\r\n\tfunction setAttributes(node, tag, dataAttrs, cachedAttrs, namespace) {\r\n\t\tfor (var attrName in dataAttrs) {\r\n\t\t\tvar dataAttr = dataAttrs[attrName];\r\n\t\t\tvar cachedAttr = cachedAttrs[attrName];\r\n\t\t\tif (!(attrName in cachedAttrs) || (cachedAttr !== dataAttr)) {\r\n\t\t\t\tcachedAttrs[attrName] = dataAttr;\r\n\t\t\t\ttry {\r\n\t\t\t\t\t//`config` isn't a real attributes, so ignore it\r\n\t\t\t\t\tif (attrName === \"config\" || attrName == \"key\") continue;\r\n\t\t\t\t\t//hook event handlers to the auto-redrawing system\r\n\t\t\t\t\telse if (typeof dataAttr === FUNCTION && attrName.indexOf(\"on\") === 0) {\r\n\t\t\t\t\t\tnode[attrName] = autoredraw(dataAttr, node)\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//handle `style: {...}`\r\n\t\t\t\t\telse if (attrName === \"style\" && dataAttr != null && type.call(dataAttr) === OBJECT) {\r\n\t\t\t\t\t\tfor (var rule in dataAttr) {\r\n\t\t\t\t\t\t\tif (cachedAttr == null || cachedAttr[rule] !== dataAttr[rule]) node.style[rule] = dataAttr[rule]\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tfor (var rule in cachedAttr) {\r\n\t\t\t\t\t\t\tif (!(rule in dataAttr)) node.style[rule] = \"\"\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//handle SVG\r\n\t\t\t\t\telse if (namespace != null) {\r\n\t\t\t\t\t\tif (attrName === \"href\") node.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"href\", dataAttr);\r\n\t\t\t\t\t\telse if (attrName === \"className\") node.setAttribute(\"class\", dataAttr);\r\n\t\t\t\t\t\telse node.setAttribute(attrName, dataAttr)\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//handle cases that are properties (but ignore cases where we should use setAttribute instead)\r\n\t\t\t\t\t//- list and form are typically used as strings, but are DOM element references in js\r\n\t\t\t\t\t//- when using CSS selectors (e.g. `m(\"[style='']\")`), style is used as a string, but it's an object in js\r\n\t\t\t\t\telse if (attrName in node && !(attrName === \"list\" || attrName === \"style\" || attrName === \"form\" || attrName === \"type\" || attrName === \"width\" || attrName === \"height\")) {\r\n\t\t\t\t\t\t//#348 don't set the value if not needed otherwise cursor placement breaks in Chrome\r\n\t\t\t\t\t\tif (tag !== \"input\" || node[attrName] !== dataAttr) node[attrName] = dataAttr\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse node.setAttribute(attrName, dataAttr)\r\n\t\t\t\t}\r\n\t\t\t\tcatch (e) {\r\n\t\t\t\t\t//swallow IE's invalid argument errors to mimic HTML's fallback-to-doing-nothing-on-invalid-attributes behavior\r\n\t\t\t\t\tif (e.message.indexOf(\"Invalid argument\") < 0) throw e\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t//#348 dataAttr may not be a string, so use loose comparison (double equal) instead of strict (triple equal)\r\n\t\t\telse if (attrName === \"value\" && tag === \"input\" && node.value != dataAttr) {\r\n\t\t\t\tnode.value = dataAttr\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn cachedAttrs\r\n\t}\r\n\tfunction clear(nodes, cached) {\r\n\t\tfor (var i = nodes.length - 1; i > -1; i--) {\r\n\t\t\tif (nodes[i] && nodes[i].parentNode) {\r\n\t\t\t\ttry {nodes[i].parentNode.removeChild(nodes[i])}\r\n\t\t\t\tcatch (e) {} //ignore if this fails due to order of events (see http://stackoverflow.com/questions/21926083/failed-to-execute-removechild-on-node)\r\n\t\t\t\tcached = [].concat(cached);\r\n\t\t\t\tif (cached[i]) unload(cached[i])\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (nodes.length != 0) nodes.length = 0\r\n\t}\r\n\tfunction unload(cached) {\r\n\t\tif (cached.configContext && typeof cached.configContext.onunload === FUNCTION) {\r\n\t\t\tcached.configContext.onunload();\r\n\t\t\tcached.configContext.onunload = null\r\n\t\t}\r\n\t\tif (cached.controllers) {\r\n\t\t\tfor (var i = 0, controller; controller = cached.controllers[i]; i++) {\r\n\t\t\t\tif (typeof controller.onunload === FUNCTION) controller.onunload({preventDefault: noop});\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (cached.children) {\r\n\t\t\tif (type.call(cached.children) === ARRAY) {\r\n\t\t\t\tfor (var i = 0, child; child = cached.children[i]; i++) unload(child)\r\n\t\t\t}\r\n\t\t\telse if (cached.children.tag) unload(cached.children)\r\n\t\t}\r\n\t}\r\n\tfunction injectHTML(parentElement, index, data) {\r\n\t\tvar nextSibling = parentElement.childNodes[index];\r\n\t\tif (nextSibling) {\r\n\t\t\tvar isElement = nextSibling.nodeType != 1;\r\n\t\t\tvar placeholder = $document.createElement(\"span\");\r\n\t\t\tif (isElement) {\r\n\t\t\t\tparentElement.insertBefore(placeholder, nextSibling || null);\r\n\t\t\t\tplaceholder.insertAdjacentHTML(\"beforebegin\", data);\r\n\t\t\t\tparentElement.removeChild(placeholder)\r\n\t\t\t}\r\n\t\t\telse nextSibling.insertAdjacentHTML(\"beforebegin\", data)\r\n\t\t}\r\n\t\telse parentElement.insertAdjacentHTML(\"beforeend\", data);\r\n\t\tvar nodes = [];\r\n\t\twhile (parentElement.childNodes[index] !== nextSibling) {\r\n\t\t\tnodes.push(parentElement.childNodes[index]);\r\n\t\t\tindex++\r\n\t\t}\r\n\t\treturn nodes\r\n\t}\r\n\tfunction autoredraw(callback, object) {\r\n\t\treturn function(e) {\r\n\t\t\te = e || event;\r\n\t\t\tm.redraw.strategy(\"diff\");\r\n\t\t\tm.startComputation();\r\n\t\t\ttry {return callback.call(object, e)}\r\n\t\t\tfinally {\r\n\t\t\t\tendFirstComputation()\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tvar html;\r\n\tvar documentNode = {\r\n\t\tappendChild: function(node) {\r\n\t\t\tif (html === undefined) html = $document.createElement(\"html\");\r\n\t\t\tif ($document.documentElement && $document.documentElement !== node) {\r\n\t\t\t\t$document.replaceChild(node, $document.documentElement)\r\n\t\t\t}\r\n\t\t\telse $document.appendChild(node);\r\n\t\t\tthis.childNodes = $document.childNodes\r\n\t\t},\r\n\t\tinsertBefore: function(node) {\r\n\t\t\tthis.appendChild(node)\r\n\t\t},\r\n\t\tchildNodes: []\r\n\t};\r\n\tvar nodeCache = [], cellCache = {};\r\n\tm.render = function(root, cell, forceRecreation) {\r\n\t\tvar configs = [];\r\n\t\tif (!root) throw new Error(\"Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.\");\r\n\t\tvar id = getCellCacheKey(root);\r\n\t\tvar isDocumentRoot = root === $document;\r\n\t\tvar node = isDocumentRoot || root === $document.documentElement ? documentNode : root;\r\n\t\tif (isDocumentRoot && cell.tag != \"html\") cell = {tag: \"html\", attrs: {}, children: cell};\r\n\t\tif (cellCache[id] === undefined) clear(node.childNodes);\r\n\t\tif (forceRecreation === true) reset(root);\r\n\t\tcellCache[id] = build(node, null, undefined, undefined, cell, cellCache[id], false, 0, null, undefined, configs);\r\n\t\tfor (var i = 0, len = configs.length; i < len; i++) configs[i]()\r\n\t};\r\n\tfunction getCellCacheKey(element) {\r\n\t\tvar index = nodeCache.indexOf(element);\r\n\t\treturn index < 0 ? nodeCache.push(element) - 1 : index\r\n\t}\r\n\r\n\tm.trust = function(value) {\r\n\t\tvalue = new String(value);\r\n\t\tvalue.$trusted = true;\r\n\t\treturn value\r\n\t};\r\n\r\n\tfunction gettersetter(store) {\r\n\t\tvar prop = function() {\r\n\t\t\tif (arguments.length) store = arguments[0];\r\n\t\t\treturn store\r\n\t\t};\r\n\r\n\t\tprop.toJSON = function() {\r\n\t\t\treturn store\r\n\t\t};\r\n\r\n\t\treturn prop\r\n\t}\r\n\r\n\tm.prop = function (store) {\r\n\t\t//note: using non-strict equality check here because we're checking if store is null OR undefined\r\n\t\tif (((store != null && type.call(store) === OBJECT) || typeof store === FUNCTION) && typeof store.then === FUNCTION) {\r\n\t\t\treturn propify(store)\r\n\t\t}\r\n\r\n\t\treturn gettersetter(store)\r\n\t};\r\n\r\n\tvar roots = [], components = [], controllers = [], lastRedrawId = null, lastRedrawCallTime = 0, computePreRedrawHook = null, computePostRedrawHook = null, prevented = false, topComponent, unloaders = [];\r\n\tvar FRAME_BUDGET = 16; //60 frames per second = 1 call per 16 ms\r\n\tfunction parameterize(component, args) {\r\n\t\tvar controller = function() {\r\n\t\t\treturn (component.controller || noop).apply(this, args) || this\r\n\t\t}\r\n\t\tvar view = function(ctrl) {\r\n\t\t\tif (arguments.length > 1) args = args.concat([].slice.call(arguments, 1))\r\n\t\t\treturn component.view.apply(component, args ? [ctrl].concat(args) : [ctrl])\r\n\t\t}\r\n\t\tview.$original = component.view\r\n\t\tvar output = {controller: controller, view: view}\r\n\t\tif (args[0] && args[0].key != null) output.attrs = {key: args[0].key}\r\n\t\treturn output\r\n\t}\r\n\tm.component = function(component) {\r\n\t\treturn parameterize(component, [].slice.call(arguments, 1))\r\n\t}\r\n\tm.mount = m.module = function(root, component) {\r\n\t\tif (!root) throw new Error(\"Please ensure the DOM element exists before rendering a template into it.\");\r\n\t\tvar index = roots.indexOf(root);\r\n\t\tif (index < 0) index = roots.length;\r\n\t\t\r\n\t\tvar isPrevented = false;\r\n\t\tvar event = {preventDefault: function() {\r\n\t\t\tisPrevented = true;\r\n\t\t\tcomputePreRedrawHook = computePostRedrawHook = null;\r\n\t\t}};\r\n\t\tfor (var i = 0, unloader; unloader = unloaders[i]; i++) {\r\n\t\t\tunloader.handler.call(unloader.controller, event)\r\n\t\t\tunloader.controller.onunload = null\r\n\t\t}\r\n\t\tif (isPrevented) {\r\n\t\t\tfor (var i = 0, unloader; unloader = unloaders[i]; i++) unloader.controller.onunload = unloader.handler\r\n\t\t}\r\n\t\telse unloaders = []\r\n\t\t\r\n\t\tif (controllers[index] && typeof controllers[index].onunload === FUNCTION) {\r\n\t\t\tcontrollers[index].onunload(event)\r\n\t\t}\r\n\t\t\r\n\t\tif (!isPrevented) {\r\n\t\t\tm.redraw.strategy(\"all\");\r\n\t\t\tm.startComputation();\r\n\t\t\troots[index] = root;\r\n\t\t\tif (arguments.length > 2) component = subcomponent(component, [].slice.call(arguments, 2))\r\n\t\t\tvar currentComponent = topComponent = component = component || {controller: function() {}};\r\n\t\t\tvar constructor = component.controller || noop\r\n\t\t\tvar controller = new constructor;\r\n\t\t\t//controllers may call m.mount recursively (via m.route redirects, for example)\r\n\t\t\t//this conditional ensures only the last recursive m.mount call is applied\r\n\t\t\tif (currentComponent === topComponent) {\r\n\t\t\t\tcontrollers[index] = controller;\r\n\t\t\t\tcomponents[index] = component\r\n\t\t\t}\r\n\t\t\tendFirstComputation();\r\n\t\t\treturn controllers[index]\r\n\t\t}\r\n\t};\r\n\tvar redrawing = false\r\n\tm.redraw = function(force) {\r\n\t\tif (redrawing) return\r\n\t\tredrawing = true\r\n\t\t//lastRedrawId is a positive number if a second redraw is requested before the next animation frame\r\n\t\t//lastRedrawID is null if it's the first redraw and not an event handler\r\n\t\tif (lastRedrawId && force !== true) {\r\n\t\t\t//when setTimeout: only reschedule redraw if time between now and previous redraw is bigger than a frame, otherwise keep currently scheduled timeout\r\n\t\t\t//when rAF: always reschedule redraw\r\n\t\t\tif ($requestAnimationFrame === window.requestAnimationFrame || new Date - lastRedrawCallTime > FRAME_BUDGET) {\r\n\t\t\t\tif (lastRedrawId > 0) $cancelAnimationFrame(lastRedrawId);\r\n\t\t\t\tlastRedrawId = $requestAnimationFrame(redraw, FRAME_BUDGET)\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tredraw();\r\n\t\t\tlastRedrawId = $requestAnimationFrame(function() {lastRedrawId = null}, FRAME_BUDGET)\r\n\t\t}\r\n\t\tredrawing = false\r\n\t};\r\n\tm.redraw.strategy = m.prop();\r\n\tfunction redraw() {\r\n\t\tif (computePreRedrawHook) {\r\n\t\t\tcomputePreRedrawHook()\r\n\t\t\tcomputePreRedrawHook = null\r\n\t\t}\r\n\t\tfor (var i = 0, root; root = roots[i]; i++) {\r\n\t\t\tif (controllers[i]) {\r\n\t\t\t\tvar args = components[i].controller && components[i].controller.$$args ? [controllers[i]].concat(components[i].controller.$$args) : [controllers[i]]\r\n\t\t\t\tm.render(root, components[i].view ? components[i].view(controllers[i], args) : \"\")\r\n\t\t\t}\r\n\t\t}\r\n\t\t//after rendering within a routed context, we need to scroll back to the top, and fetch the document title for history.pushState\r\n\t\tif (computePostRedrawHook) {\r\n\t\t\tcomputePostRedrawHook();\r\n\t\t\tcomputePostRedrawHook = null\r\n\t\t}\r\n\t\tlastRedrawId = null;\r\n\t\tlastRedrawCallTime = new Date;\r\n\t\tm.redraw.strategy(\"diff\")\r\n\t}\r\n\r\n\tvar pendingRequests = 0;\r\n\tm.startComputation = function() {pendingRequests++};\r\n\tm.endComputation = function() {\r\n\t\tpendingRequests = Math.max(pendingRequests - 1, 0);\r\n\t\tif (pendingRequests === 0) m.redraw()\r\n\t};\r\n\tvar endFirstComputation = function() {\r\n\t\tif (m.redraw.strategy() == \"none\") {\r\n\t\t\tpendingRequests--\r\n\t\t\tm.redraw.strategy(\"diff\")\r\n\t\t}\r\n\t\telse m.endComputation();\r\n\t}\r\n\r\n\tm.withAttr = function(prop, withAttrCallback) {\r\n\t\treturn function(e) {\r\n\t\t\te = e || event;\r\n\t\t\tvar currentTarget = e.currentTarget || this;\r\n\t\t\twithAttrCallback(prop in currentTarget ? currentTarget[prop] : currentTarget.getAttribute(prop))\r\n\t\t}\r\n\t};\r\n\r\n\t//routing\r\n\tvar modes = {pathname: \"\", hash: \"#\", search: \"?\"};\r\n\tvar redirect = noop, routeParams, currentRoute, isDefaultRoute = false;\r\n\tm.route = function() {\r\n\t\t//m.route()\r\n\t\tif (arguments.length === 0) return currentRoute;\r\n\t\t//m.route(el, defaultRoute, routes)\r\n\t\telse if (arguments.length === 3 && type.call(arguments[1]) === STRING) {\r\n\t\t\tvar root = arguments[0], defaultRoute = arguments[1], router = arguments[2];\r\n\t\t\tredirect = function(source) {\r\n\t\t\t\tvar path = currentRoute = normalizeRoute(source);\r\n\t\t\t\tif (!routeByValue(root, router, path)) {\r\n\t\t\t\t\tif (isDefaultRoute) throw new Error(\"Ensure the default route matches one of the routes defined in m.route\")\r\n\t\t\t\t\tisDefaultRoute = true\r\n\t\t\t\t\tm.route(defaultRoute, true)\r\n\t\t\t\t\tisDefaultRoute = false\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tvar listener = m.route.mode === \"hash\" ? \"onhashchange\" : \"onpopstate\";\r\n\t\t\twindow[listener] = function() {\r\n\t\t\t\tvar path = $location[m.route.mode]\r\n\t\t\t\tif (m.route.mode === \"pathname\") path += $location.search\r\n\t\t\t\tif (currentRoute != normalizeRoute(path)) {\r\n\t\t\t\t\tredirect(path)\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tcomputePreRedrawHook = setScroll;\r\n\t\t\twindow[listener]()\r\n\t\t}\r\n\t\t//config: m.route\r\n\t\telse if (arguments[0].addEventListener || arguments[0].attachEvent) {\r\n\t\t\tvar element = arguments[0];\r\n\t\t\tvar isInitialized = arguments[1];\r\n\t\t\tvar context = arguments[2];\r\n\t\t\tvar vdom = arguments[3];\r\n\t\t\telement.href = (m.route.mode !== 'pathname' ? $location.pathname : '') + modes[m.route.mode] + vdom.attrs.href;\r\n\t\t\tif (element.addEventListener) {\r\n\t\t\t\telement.removeEventListener(\"click\", routeUnobtrusive);\r\n\t\t\t\telement.addEventListener(\"click\", routeUnobtrusive)\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\telement.detachEvent(\"onclick\", routeUnobtrusive);\r\n\t\t\t\telement.attachEvent(\"onclick\", routeUnobtrusive)\r\n\t\t\t}\r\n\t\t}\r\n\t\t//m.route(route, params, shouldReplaceHistoryEntry)\r\n\t\telse if (type.call(arguments[0]) === STRING) {\r\n\t\t\tvar oldRoute = currentRoute;\r\n\t\t\tcurrentRoute = arguments[0];\r\n\t\t\tvar args = arguments[1] || {}\r\n\t\t\tvar queryIndex = currentRoute.indexOf(\"?\")\r\n\t\t\tvar params = queryIndex > -1 ? parseQueryString(currentRoute.slice(queryIndex + 1)) : {}\r\n\t\t\tfor (var i in args) params[i] = args[i]\r\n\t\t\tvar querystring = buildQueryString(params)\r\n\t\t\tvar currentPath = queryIndex > -1 ? currentRoute.slice(0, queryIndex) : currentRoute\r\n\t\t\tif (querystring) currentRoute = currentPath + (currentPath.indexOf(\"?\") === -1 ? \"?\" : \"&\") + querystring;\r\n\r\n\t\t\tvar shouldReplaceHistoryEntry = (arguments.length === 3 ? arguments[2] : arguments[1]) === true || oldRoute === arguments[0];\r\n\r\n\t\t\tif (window.history.pushState) {\r\n\t\t\t\tcomputePreRedrawHook = setScroll\r\n\t\t\t\tcomputePostRedrawHook = function() {\r\n\t\t\t\t\twindow.history[shouldReplaceHistoryEntry ? \"replaceState\" : \"pushState\"](null, $document.title, modes[m.route.mode] + currentRoute);\r\n\t\t\t\t};\r\n\t\t\t\tredirect(modes[m.route.mode] + currentRoute)\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$location[m.route.mode] = currentRoute\r\n\t\t\t\tredirect(modes[m.route.mode] + currentRoute)\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\tm.route.param = function(key) {\r\n\t\tif (!routeParams) throw new Error(\"You must call m.route(element, defaultRoute, routes) before calling m.route.param()\")\r\n\t\treturn routeParams[key]\r\n\t};\r\n\tm.route.mode = \"search\";\r\n\tfunction normalizeRoute(route) {\r\n\t\treturn route.slice(modes[m.route.mode].length)\r\n\t}\r\n\tfunction routeByValue(root, router, path) {\r\n\t\trouteParams = {};\r\n\r\n\t\tvar queryStart = path.indexOf(\"?\");\r\n\t\tif (queryStart !== -1) {\r\n\t\t\trouteParams = parseQueryString(path.substr(queryStart + 1, path.length));\r\n\t\t\tpath = path.substr(0, queryStart)\r\n\t\t}\r\n\r\n\t\t// Get all routes and check if there's\r\n\t\t// an exact match for the current path\r\n\t\tvar keys = Object.keys(router);\r\n\t\tvar index = keys.indexOf(path);\r\n\t\tif(index !== -1){\r\n\t\t\tm.mount(root, router[keys [index]]);\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tfor (var route in router) {\r\n\t\t\tif (route === path) {\r\n\t\t\t\tm.mount(root, router[route]);\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\r\n\t\t\tvar matcher = new RegExp(\"^\" + route.replace(/:[^\\/]+?\\.{3}/g, \"(.*?)\").replace(/:[^\\/]+/g, \"([^\\\\/]+)\") + \"\\/?$\");\r\n\r\n\t\t\tif (matcher.test(path)) {\r\n\t\t\t\tpath.replace(matcher, function() {\r\n\t\t\t\t\tvar keys = route.match(/:[^\\/]+/g) || [];\r\n\t\t\t\t\tvar values = [].slice.call(arguments, 1, -2);\r\n\t\t\t\t\tfor (var i = 0, len = keys.length; i < len; i++) routeParams[keys[i].replace(/:|\\./g, \"\")] = decodeURIComponent(values[i])\r\n\t\t\t\t\tm.mount(root, router[route])\r\n\t\t\t\t});\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tfunction routeUnobtrusive(e) {\r\n\t\te = e || event;\r\n\t\tif (e.ctrlKey || e.metaKey || e.which === 2) return;\r\n\t\tif (e.preventDefault) e.preventDefault();\r\n\t\telse e.returnValue = false;\r\n\t\tvar currentTarget = e.currentTarget || e.srcElement;\r\n\t\tvar args = m.route.mode === \"pathname\" && currentTarget.search ? parseQueryString(currentTarget.search.slice(1)) : {};\r\n\t\twhile (currentTarget && currentTarget.nodeName.toUpperCase() != \"A\") currentTarget = currentTarget.parentNode\r\n\t\tm.route(currentTarget[m.route.mode].slice(modes[m.route.mode].length), args)\r\n\t}\r\n\tfunction setScroll() {\r\n\t\tif (m.route.mode != \"hash\" && $location.hash) $location.hash = $location.hash;\r\n\t\telse window.scrollTo(0, 0)\r\n\t}\r\n\tfunction buildQueryString(object, prefix) {\r\n\t\tvar duplicates = {}\r\n\t\tvar str = []\r\n\t\tfor (var prop in object) {\r\n\t\t\tvar key = prefix ? prefix + \"[\" + prop + \"]\" : prop\r\n\t\t\tvar value = object[prop]\r\n\t\t\tvar valueType = type.call(value)\r\n\t\t\tvar pair = (value === null) ? encodeURIComponent(key) :\r\n\t\t\t\tvalueType === OBJECT ? buildQueryString(value, key) :\r\n\t\t\t\tvalueType === ARRAY ? value.reduce(function(memo, item) {\r\n\t\t\t\t\tif (!duplicates[key]) duplicates[key] = {}\r\n\t\t\t\t\tif (!duplicates[key][item]) {\r\n\t\t\t\t\t\tduplicates[key][item] = true\r\n\t\t\t\t\t\treturn memo.concat(encodeURIComponent(key) + \"=\" + encodeURIComponent(item))\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn memo\r\n\t\t\t\t}, []).join(\"&\") :\r\n\t\t\t\tencodeURIComponent(key) + \"=\" + encodeURIComponent(value)\r\n\t\t\tif (value !== undefined) str.push(pair)\r\n\t\t}\r\n\t\treturn str.join(\"&\")\r\n\t}\r\n\tfunction parseQueryString(str) {\r\n\t\tif (str.charAt(0) === \"?\") str = str.substring(1);\r\n\t\t\r\n\t\tvar pairs = str.split(\"&\"), params = {};\r\n\t\tfor (var i = 0, len = pairs.length; i < len; i++) {\r\n\t\t\tvar pair = pairs[i].split(\"=\");\r\n\t\t\tvar key = decodeURIComponent(pair[0])\r\n\t\t\tvar value = pair.length == 2 ? decodeURIComponent(pair[1]) : null\r\n\t\t\tif (params[key] != null) {\r\n\t\t\t\tif (type.call(params[key]) !== ARRAY) params[key] = [params[key]]\r\n\t\t\t\tparams[key].push(value)\r\n\t\t\t}\r\n\t\t\telse params[key] = value\r\n\t\t}\r\n\t\treturn params\r\n\t}\r\n\tm.route.buildQueryString = buildQueryString\r\n\tm.route.parseQueryString = parseQueryString\r\n\t\r\n\tfunction reset(root) {\r\n\t\tvar cacheKey = getCellCacheKey(root);\r\n\t\tclear(root.childNodes, cellCache[cacheKey]);\r\n\t\tcellCache[cacheKey] = undefined\r\n\t}\r\n\r\n\tm.deferred = function () {\r\n\t\tvar deferred = new Deferred();\r\n\t\tdeferred.promise = propify(deferred.promise);\r\n\t\treturn deferred\r\n\t};\r\n\tfunction propify(promise, initialValue) {\r\n\t\tvar prop = m.prop(initialValue);\r\n\t\tpromise.then(prop);\r\n\t\tprop.then = function(resolve, reject) {\r\n\t\t\treturn propify(promise.then(resolve, reject), initialValue)\r\n\t\t};\r\n\t\treturn prop\r\n\t}\r\n\t//Promiz.mithril.js | Zolmeister | MIT\r\n\t//a modified version of Promiz.js, which does not conform to Promises/A+ for two reasons:\r\n\t//1) `then` callbacks are called synchronously (because setTimeout is too slow, and the setImmediate polyfill is too big\r\n\t//2) throwing subclasses of Error cause the error to be bubbled up instead of triggering rejection (because the spec does not account for the important use case of default browser error handling, i.e. message w/ line number)\r\n\tfunction Deferred(successCallback, failureCallback) {\r\n\t\tvar RESOLVING = 1, REJECTING = 2, RESOLVED = 3, REJECTED = 4;\r\n\t\tvar self = this, state = 0, promiseValue = 0, next = [];\r\n\r\n\t\tself[\"promise\"] = {};\r\n\r\n\t\tself[\"resolve\"] = function(value) {\r\n\t\t\tif (!state) {\r\n\t\t\t\tpromiseValue = value;\r\n\t\t\t\tstate = RESOLVING;\r\n\r\n\t\t\t\tfire()\r\n\t\t\t}\r\n\t\t\treturn this\r\n\t\t};\r\n\r\n\t\tself[\"reject\"] = function(value) {\r\n\t\t\tif (!state) {\r\n\t\t\t\tpromiseValue = value;\r\n\t\t\t\tstate = REJECTING;\r\n\r\n\t\t\t\tfire()\r\n\t\t\t}\r\n\t\t\treturn this\r\n\t\t};\r\n\r\n\t\tself.promise[\"then\"] = function(successCallback, failureCallback) {\r\n\t\t\tvar deferred = new Deferred(successCallback, failureCallback);\r\n\t\t\tif (state === RESOLVED) {\r\n\t\t\t\tdeferred.resolve(promiseValue)\r\n\t\t\t}\r\n\t\t\telse if (state === REJECTED) {\r\n\t\t\t\tdeferred.reject(promiseValue)\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tnext.push(deferred)\r\n\t\t\t}\r\n\t\t\treturn deferred.promise\r\n\t\t};\r\n\r\n\t\tfunction finish(type) {\r\n\t\t\tstate = type || REJECTED;\r\n\t\t\tnext.map(function(deferred) {\r\n\t\t\t\tstate === RESOLVED && deferred.resolve(promiseValue) || deferred.reject(promiseValue)\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tfunction thennable(then, successCallback, failureCallback, notThennableCallback) {\r\n\t\t\tif (((promiseValue != null && type.call(promiseValue) === OBJECT) || typeof promiseValue === FUNCTION) && typeof then === FUNCTION) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\t// count protects against abuse calls from spec checker\r\n\t\t\t\t\tvar count = 0;\r\n\t\t\t\t\tthen.call(promiseValue, function(value) {\r\n\t\t\t\t\t\tif (count++) return;\r\n\t\t\t\t\t\tpromiseValue = value;\r\n\t\t\t\t\t\tsuccessCallback()\r\n\t\t\t\t\t}, function (value) {\r\n\t\t\t\t\t\tif (count++) return;\r\n\t\t\t\t\t\tpromiseValue = value;\r\n\t\t\t\t\t\tfailureCallback()\r\n\t\t\t\t\t})\r\n\t\t\t\t}\r\n\t\t\t\tcatch (e) {\r\n\t\t\t\t\tm.deferred.onerror(e);\r\n\t\t\t\t\tpromiseValue = e;\r\n\t\t\t\t\tfailureCallback()\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tnotThennableCallback()\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfunction fire() {\r\n\t\t\t// check if it's a thenable\r\n\t\t\tvar then;\r\n\t\t\ttry {\r\n\t\t\t\tthen = promiseValue && promiseValue.then\r\n\t\t\t}\r\n\t\t\tcatch (e) {\r\n\t\t\t\tm.deferred.onerror(e);\r\n\t\t\t\tpromiseValue = e;\r\n\t\t\t\tstate = REJECTING;\r\n\t\t\t\treturn fire()\r\n\t\t\t}\r\n\t\t\tthennable(then, function() {\r\n\t\t\t\tstate = RESOLVING;\r\n\t\t\t\tfire()\r\n\t\t\t}, function() {\r\n\t\t\t\tstate = REJECTING;\r\n\t\t\t\tfire()\r\n\t\t\t}, function() {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tif (state === RESOLVING && typeof successCallback === FUNCTION) {\r\n\t\t\t\t\t\tpromiseValue = successCallback(promiseValue)\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if (state === REJECTING && typeof failureCallback === \"function\") {\r\n\t\t\t\t\t\tpromiseValue = failureCallback(promiseValue);\r\n\t\t\t\t\t\tstate = RESOLVING\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tcatch (e) {\r\n\t\t\t\t\tm.deferred.onerror(e);\r\n\t\t\t\t\tpromiseValue = e;\r\n\t\t\t\t\treturn finish()\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (promiseValue === self) {\r\n\t\t\t\t\tpromiseValue = TypeError();\r\n\t\t\t\t\tfinish()\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tthennable(then, function () {\r\n\t\t\t\t\t\tfinish(RESOLVED)\r\n\t\t\t\t\t}, finish, function () {\r\n\t\t\t\t\t\tfinish(state === RESOLVING && RESOLVED)\r\n\t\t\t\t\t})\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}\r\n\t}\r\n\tm.deferred.onerror = function(e) {\r\n\t\tif (type.call(e) === \"[object Error]\" && !e.constructor.toString().match(/ Error/)) throw e\r\n\t};\r\n\r\n\tm.sync = function(args) {\r\n\t\tvar method = \"resolve\";\r\n\t\tfunction synchronizer(pos, resolved) {\r\n\t\t\treturn function(value) {\r\n\t\t\t\tresults[pos] = value;\r\n\t\t\t\tif (!resolved) method = \"reject\";\r\n\t\t\t\tif (--outstanding === 0) {\r\n\t\t\t\t\tdeferred.promise(results);\r\n\t\t\t\t\tdeferred[method](results)\r\n\t\t\t\t}\r\n\t\t\t\treturn value\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar deferred = m.deferred();\r\n\t\tvar outstanding = args.length;\r\n\t\tvar results = new Array(outstanding);\r\n\t\tif (args.length > 0) {\r\n\t\t\tfor (var i = 0; i < args.length; i++) {\r\n\t\t\t\targs[i].then(synchronizer(i, true), synchronizer(i, false))\r\n\t\t\t}\r\n\t\t}\r\n\t\telse deferred.resolve([]);\r\n\r\n\t\treturn deferred.promise\r\n\t};\r\n\tfunction identity(value) {return value}\r\n\r\n\tfunction ajax(options) {\r\n\t\tif (options.dataType && options.dataType.toLowerCase() === \"jsonp\") {\r\n\t\t\tvar callbackKey = \"mithril_callback_\" + new Date().getTime() + \"_\" + (Math.round(Math.random() * 1e16)).toString(36);\r\n\t\t\tvar script = $document.createElement(\"script\");\r\n\r\n\t\t\twindow[callbackKey] = function(resp) {\r\n\t\t\t\tscript.parentNode.removeChild(script);\r\n\t\t\t\toptions.onload({\r\n\t\t\t\t\ttype: \"load\",\r\n\t\t\t\t\ttarget: {\r\n\t\t\t\t\t\tresponseText: resp\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\twindow[callbackKey] = undefined\r\n\t\t\t};\r\n\r\n\t\t\tscript.onerror = function(e) {\r\n\t\t\t\tscript.parentNode.removeChild(script);\r\n\r\n\t\t\t\toptions.onerror({\r\n\t\t\t\t\ttype: \"error\",\r\n\t\t\t\t\ttarget: {\r\n\t\t\t\t\t\tstatus: 500,\r\n\t\t\t\t\t\tresponseText: JSON.stringify({error: \"Error making jsonp request\"})\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\twindow[callbackKey] = undefined;\r\n\r\n\t\t\t\treturn false\r\n\t\t\t};\r\n\r\n\t\t\tscript.onload = function(e) {\r\n\t\t\t\treturn false\r\n\t\t\t};\r\n\r\n\t\t\tscript.src = options.url\r\n\t\t\t\t+ (options.url.indexOf(\"?\") > 0 ? \"&\" : \"?\")\r\n\t\t\t\t+ (options.callbackKey ? options.callbackKey : \"callback\")\r\n\t\t\t\t+ \"=\" + callbackKey\r\n\t\t\t\t+ \"&\" + buildQueryString(options.data || {});\r\n\t\t\t$document.body.appendChild(script)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tvar xhr = new window.XMLHttpRequest;\r\n\t\t\txhr.open(options.method, options.url, true, options.user, options.password);\r\n\t\t\txhr.onreadystatechange = function() {\r\n\t\t\t\tif (xhr.readyState === 4) {\r\n\t\t\t\t\tif (xhr.status >= 200 && xhr.status < 300) options.onload({type: \"load\", target: xhr});\r\n\t\t\t\t\telse options.onerror({type: \"error\", target: xhr})\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tif (options.serialize === JSON.stringify && options.data && options.method !== \"GET\") {\r\n\t\t\t\txhr.setRequestHeader(\"Content-Type\", \"application/json; charset=utf-8\")\r\n\t\t\t}\r\n\t\t\tif (options.deserialize === JSON.parse) {\r\n\t\t\t\txhr.setRequestHeader(\"Accept\", \"application/json, text/*\");\r\n\t\t\t}\r\n\t\t\tif (typeof options.config === FUNCTION) {\r\n\t\t\t\tvar maybeXhr = options.config(xhr, options);\r\n\t\t\t\tif (maybeXhr != null) xhr = maybeXhr\r\n\t\t\t}\r\n\r\n\t\t\tvar data = options.method === \"GET\" || !options.data ? \"\" : options.data\r\n\t\t\tif (data && (type.call(data) != STRING && data.constructor != window.FormData)) {\r\n\t\t\t\tthrow \"Request data should be either be a string or FormData. Check the `serialize` option in `m.request`\";\r\n\t\t\t}\r\n\t\t\txhr.send(data);\r\n\t\t\treturn xhr\r\n\t\t}\r\n\t}\r\n\tfunction bindData(xhrOptions, data, serialize) {\r\n\t\tif (xhrOptions.method === \"GET\" && xhrOptions.dataType != \"jsonp\") {\r\n\t\t\tvar prefix = xhrOptions.url.indexOf(\"?\") < 0 ? \"?\" : \"&\";\r\n\t\t\tvar querystring = buildQueryString(data);\r\n\t\t\txhrOptions.url = xhrOptions.url + (querystring ? prefix + querystring : \"\")\r\n\t\t}\r\n\t\telse xhrOptions.data = serialize(data);\r\n\t\treturn xhrOptions\r\n\t}\r\n\tfunction parameterizeUrl(url, data) {\r\n\t\tvar tokens = url.match(/:[a-z]\\w+/gi);\r\n\t\tif (tokens && data) {\r\n\t\t\tfor (var i = 0; i < tokens.length; i++) {\r\n\t\t\t\tvar key = tokens[i].slice(1);\r\n\t\t\t\turl = url.replace(tokens[i], data[key]);\r\n\t\t\t\tdelete data[key]\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn url\r\n\t}\r\n\r\n\tm.request = function(xhrOptions) {\r\n\t\tif (xhrOptions.background !== true) m.startComputation();\r\n\t\tvar deferred = new Deferred();\r\n\t\tvar isJSONP = xhrOptions.dataType && xhrOptions.dataType.toLowerCase() === \"jsonp\";\r\n\t\tvar serialize = xhrOptions.serialize = isJSONP ? identity : xhrOptions.serialize || JSON.stringify;\r\n\t\tvar deserialize = xhrOptions.deserialize = isJSONP ? identity : xhrOptions.deserialize || JSON.parse;\r\n\t\tvar extract = isJSONP ? function(jsonp) {return jsonp.responseText} : xhrOptions.extract || function(xhr) {\r\n\t\t\treturn xhr.responseText.length === 0 && deserialize === JSON.parse ? null : xhr.responseText\r\n\t\t};\r\n\t\txhrOptions.method = (xhrOptions.method || 'GET').toUpperCase();\r\n\t\txhrOptions.url = parameterizeUrl(xhrOptions.url, xhrOptions.data);\r\n\t\txhrOptions = bindData(xhrOptions, xhrOptions.data, serialize);\r\n\t\txhrOptions.onload = xhrOptions.onerror = function(e) {\r\n\t\t\ttry {\r\n\t\t\t\te = e || event;\r\n\t\t\t\tvar unwrap = (e.type === \"load\" ? xhrOptions.unwrapSuccess : xhrOptions.unwrapError) || identity;\r\n\t\t\t\tvar response = unwrap(deserialize(extract(e.target, xhrOptions)), e.target);\r\n\t\t\t\tif (e.type === \"load\") {\r\n\t\t\t\t\tif (type.call(response) === ARRAY && xhrOptions.type) {\r\n\t\t\t\t\t\tfor (var i = 0; i < response.length; i++) response[i] = new xhrOptions.type(response[i])\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if (xhrOptions.type) response = new xhrOptions.type(response)\r\n\t\t\t\t}\r\n\t\t\t\tdeferred[e.type === \"load\" ? \"resolve\" : \"reject\"](response)\r\n\t\t\t}\r\n\t\t\tcatch (e) {\r\n\t\t\t\tm.deferred.onerror(e);\r\n\t\t\t\tdeferred.reject(e)\r\n\t\t\t}\r\n\t\t\tif (xhrOptions.background !== true) m.endComputation()\r\n\t\t};\r\n\t\tajax(xhrOptions);\r\n\t\tdeferred.promise = propify(deferred.promise, xhrOptions.initialValue);\r\n\t\treturn deferred.promise\r\n\t};\r\n\r\n\t//testing API\r\n\tm.deps = function(mock) {\r\n\t\tinitialize(window = mock || window);\r\n\t\treturn window;\r\n\t};\r\n\t//for internal testing only, do not use `m.deps.factory`\r\n\tm.deps.factory = app;\r\n\r\n\treturn m\r\n})(typeof window != \"undefined\" ? window : {});\r\n\r\nif (typeof module != \"undefined\" && module !== null && module.exports) module.exports = m;\r\nelse if (typeof define === \"function\" && define.amd) define(function() {return m});\r\n\n},{}],7:[function(require,module,exports){\n/*!\n * EventEmitter v4.2.11 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function () {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var exports = this;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n i = listeners.length;\n\n while (i--) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}.call(this));\n\n},{}]},{},[1]);\n })();"],"sourceRoot":"/source/"}
1
+ {"version":3,"sources":["admin.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length",1,"module","m","EventEmitter","context","document","getElementById","events","tabs","helpers","settings","window","mc4wp","deps","mithril","./admin/helpers.js","./admin/settings.js","./admin/tabs.js","wolfy87-eventemitter",2,"toggleElement","selector","elements","querySelectorAll","show","clientHeight","style","display","bindEventToElement","element","event","handler","addEventListener","attachEvent","bindEventToElements","Array","prototype","forEach","debounce","func","wait","immediate","timeout","this","args","arguments","later","apply","callNow","clearTimeout","setTimeout","showIfElements","checked","conditionMet","value","config","hide","visibility","opacity","inputs","inputElement","removeAttribute","setAttribute","JSON","parse","getAttribute","parentElements","parentElement",3,"Settings","getSelectedListsWhere","searchKey","searchValue","selectedLists","filter","el","getSelectedLists","updateSelectedLists","listInputs","input","lists","push","trigger","toggleVisibleLists","rows","listId","isSelected","replace","querySelector","mc4wp_vars","mailchimp","on",4,"Tabs","get","id","open","tab","updateState","$tabs","removeClass","css","$tabNavs","nav","className","blur","url","URL","setParameter","location","href","history","pushState","title","refererField","tb_remove","forms","editor","refresh","split","switchTab","tabId","match","urlParams","opened","preventDefault","returnValue","init","activeTab","substring","replaceState","state","$","jQuery","$context","find","each","first","text","click","body","./url.js",5,"query","hasOwnProperty","b","decodeURIComponent","build","data","ret","d","encodeURIComponent","join","key",6,"global","factory","amd","isFunction","object","isObject","type","isString","noop","initialize","mock","$document","$location","$cancelAnimationFrame","cancelAnimationFrame","$requestAnimationFrame","requestAnimationFrame","parseTagAttrs","cell","tag","classes","parser","exec","attrs","pair","getVirtualChildren","hasAttrs","children","slice","isArray","assignAttrs","target","classAttr","attrName","hasOwn","pairs","parameterize","list","forKeys","dataToString","toString","injectTextNode","index","insertNode","nodeValue","flatten","concat","node","insertBefore","childNodes","handleKeysDiffer","existing","cached","action","MOVE","from","nodes","createElement","INSERTION","actions","prop","changes","sort","sortChanges","newCached","change","DELETION","clear","splice","dummy","changeElement","maybeChanged","diffKeys","keysDiffer","cachedCell","diffArray","_","parentNode","indexOf","buildArrayKeys","guid","isDifferentEnough","dataAttrKeys","Object","keys","redraw","strategy","configContext","retain","maybeRecreateObject","onunload","controllers","controller","getObjectNamespace","namespace","xmlns","unloadCachedControllers","views","$old","pendingRequests","scheduleConfigsToBeCalled","configs","isNew","buildUpdatedNode","editable","hasKeys","setAttributes","contenteditable","intact","handleNonexistentNodes","$trusted","injectHTML","createTextNode","nodeName","voidElements","constructor","reattachNodes","parentTag","activeElement","innerHTML","nodeType","trim","handleTextNode","shouldReattach","valueOf","getSubArrayCount","item","buildArray","subArrayCount","shouldMaintainIdentities","cacheCount","len","makeCache","parentIndex","parentCache","offset","end","constructNode","is","createElementNS","constructAttrs","constructChildren","reconstructCached","getController","view","cachedControllers","controllerIndex","updateLists","unloaders","map","checkView","forcing","subtree","markViews","$original","buildObject","copyStyleAttrs","dataAttr","cachedAttr","rule","setSingleAttr","autoredraw","setAttributeNS","shouldUseSetAttribute","trySetAttr","cachedAttrs","message","dataAttrs","removeChild","unload","appendTextFragment","appendChild","createRange","createContextualFragment","insertAdjacentHTML","nextSibling","isElement","placeholder","callback","startComputation","endFirstComputation","getCellCacheKey","nodeCache","gettersetter","store","toJSON","component","ctrl","currentArgs","output","checkPrevented","root","isPrevented","roots","currentComponent","topComponent","components","removeRootElement","reset","computePreRedrawHook","render","computePostRedrawHook","lastRedrawId","lastRedrawCallTime","Date","endComputation","normalizeRoute","route","modes","mode","routeByValue","router","path","routeParams","queryStart","parseQueryString","substr","mount","matcher","RegExp","test","values","routeUnobtrusive","ctrlKey","metaKey","shiftKey","which","currentTarget","srcElement","search","setScroll","hash","scrollTo","buildQueryString","prefix","duplicates","str","charAt","params","string","cacheKey","cellCache","propify","promise","initialValue","then","resolve","reject","bind","Deferred","onSuccess","onFailure","finish","REJECTED","next","deferred","RESOLVED","promiseValue","thennable","success","failure","notThennable","count","onerror","fire","REJECTING","RESOLVING","self","TypeError","identity","handleJsonp","options","callbackKey","getTime","Math","round","random","script","resp","onload","responseText","status","stringify","error","src","createXhr","xhr","XMLHttpRequest","method","user","password","onreadystatechange","readyState","serialize","setRequestHeader","deserialize","maybeXhr","FormData","send","ajax","dataType","toLowerCase","bindData","querystring","parameterizeUrl","token","version","AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR","html","form","width","height","documentNode","documentElement","replaceChild","forceRecreation","isDocumentRoot","trust","String","FRAME_BUDGET","unloader","redrawing","force","withAttr","withAttrCallback","callbackThis","_this","currentRoute","pathname","redirect","isDefaultRoute","arg1","arg2","vdom","source","listener","base","removeEventListener","detachEvent","oldRoute","queryIndex","currentPath","replaceHistory","param","sync","synchronizer","pos","resolved","results","outstanding","arg","request","background","extract","isJSONP","jsonp","toUpperCase","ev","response","unwrapSuccess","res","unwrapError",7,"indexOfListener","listeners","alias","name","proto","originalGlobalValue","getListeners","evt","_getEvents","flattenListeners","flatListeners","getListenersAsObject","addListener","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","off","addListeners","manipulateListeners","removeListeners","remove","single","multiple","removeEvent","_events","removeAllListeners","emitEvent","listenersMap","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict"],"mappings":"CAAA,WAAe,GAAIA,GAAUC,OAAeC,EAASD,QAAW,QAAUE,GAAEC,EAAEC,EAAEC,GAAG,QAASC,GAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,GAAIE,GAAkB,kBAATV,IAAqBA,CAAQ,KAAIS,GAAGC,EAAE,MAAOA,GAAEF,GAAE,EAAI,IAAGG,EAAE,MAAOA,GAAEH,GAAE,EAAI,IAAII,GAAE,GAAIC,OAAM,uBAAuBL,EAAE,IAAK,MAAMI,GAAEE,KAAK,mBAAmBF,EAAE,GAAIG,GAAEV,EAAEG,IAAIQ,WAAYZ,GAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAG,GAAIE,GAAED,EAAEI,GAAG,GAAGL,EAAG,OAAOI,GAAEF,EAAEA,EAAEF,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,MAAOD,GAAEG,GAAGQ,QAAkD,IAAI,GAA1CL,GAAkB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EAAKhf,GACtC,GACI0e,GACA7B,EACAjgB,EACAiK,EACAuX,EALAoC,EAAezgB,KAAKqf,qBAAqBJ,EAO7C,KAAKnY,IAAO2Z,GACR,GAAIA,EAAapa,eAAeS,GAI5B,IAHA6X,EAAY8B,EAAa3Z,GAAK8B,MAAM,GACpC/L,EAAI8hB,EAAUvhB,OAEPP,KAGHigB,EAAW6B,EAAU9hB,GAEjBigB,EAAS0C,QAAS,GAClBxf,KAAK6f,eAAeZ,EAAKnC,EAASA,UAGtCuB,EAAWvB,EAASA,SAAS1c,MAAMJ,KAAMC,OAErCoe,IAAare,KAAK0gB,uBAClB1gB,KAAK6f,eAAeZ,EAAKnC,EAASA,SAMlD,OAAO9c,OAMX8e,EAAMvc,QAAUqc,EAAM,aAUtBE,EAAM6B,KAAO,SAAc1B,GACvB,GAAIhf,GAAOT,MAAMC,UAAUmJ,MAAMzL,KAAK+C,UAAW,EACjD,OAAOF,MAAKwgB,UAAUvB,EAAKhf,IAW/B6e,EAAM8B,mBAAqB,SAA4BjgB,GAEnD,MADAX,MAAK6gB,iBAAmBlgB,EACjBX,MAWX8e,EAAM4B,oBAAsB,WACxB,MAAI1gB,MAAKqG,eAAe,oBACbrG,KAAK6gB,kBAGL,GAUf/B,EAAMI,WAAa,WACf,MAAOlf,MAAKsgB,UAAYtgB,KAAKsgB,aAQjC9iB,EAAasjB,WAAa,WAEtB,MADA5jB,GAAQM,aAAeuhB,EAChBvhB,GAIW,kBAAXpB,IAAyBA,EAAO8K,IACvC9K,EAAO,WACH,MAAOoB,KAGY,gBAAXF,IAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAUM,EAGjBN,EAAQM,aAAeA,IAE7BL,KAAK6C,gBAEI","file":"admin.min.js","sourcesContent":["(function () { var require = undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n'use strict';\n\n// dependencies\nvar m = require('mithril');\nvar EventEmitter = require('wolfy87-eventemitter');\n\n// vars\nvar context = document.getElementById('mc4wp-admin');\nvar events = new EventEmitter();\nvar tabs = require ('./admin/tabs.js')(context);\nvar helpers = require('./admin/helpers.js');\nvar settings = require('./admin/settings.js')(context, helpers, events);\n\n// expose some things\nwindow.mc4wp = window.mc4wp || {};\nwindow.mc4wp.deps = window.mc4wp.deps || {};\nwindow.mc4wp.deps.mithril = m;\nwindow.mc4wp.helpers = helpers;\nwindow.mc4wp.events = events;\nwindow.mc4wp.settings = settings;\nwindow.mc4wp.tabs = tabs;\n},{\"./admin/helpers.js\":2,\"./admin/settings.js\":3,\"./admin/tabs.js\":4,\"mithril\":6,\"wolfy87-eventemitter\":7}],2:[function(require,module,exports){\n'use strict';\n\nvar helpers = {};\n\nhelpers.toggleElement = function(selector) {\n\tvar elements = document.querySelectorAll(selector);\n\tfor( var i=0; i<elements.length;i++){\n\t\tvar show = elements[i].clientHeight <= 0;\n\t\telements[i].style.display = show ? '' : 'none';\n\t}\n};\n\nhelpers.bindEventToElement = function(element,event,handler) {\n\tif ( element.addEventListener) {\n\t\telement.addEventListener(event, handler);\n\t} else if (element.attachEvent) {\n\t\telement.attachEvent('on' + event, handler);\n\t}\n};\n\nhelpers.bindEventToElements = function( elements, event, handler ) {\n\tArray.prototype.forEach.call( elements, function(element) {\n\t\thelpers.bindEventToElement(element,event,handler);\n\t});\n};\n\n\n// polling\nhelpers.debounce = function(func, wait, immediate) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tvar later = function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tvar callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n};\n\n/**\n * Showif.js\n */\n(function() {\n\tvar showIfElements = document.querySelectorAll('[data-showif]');\n\n\t// dependent elements\n\tArray.prototype.forEach.call( showIfElements, function(element) {\n\t\tvar config = JSON.parse( element.getAttribute('data-showif') );\n\t\tvar parentElements = document.querySelectorAll('[name=\"'+ config.element +'\"]');\n\n\t\tvar inputs = element.querySelectorAll('input,select,textarea:not([readonly])');\n\t\tvar hide = config.hide === undefined || config.hide;\n\n\t\tfunction toggleElement() {\n\n\t\t\t// do nothing with unchecked elements\n\t\t\tif( typeof( this.checked ) === \"boolean\" && ! this.checked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// check if element value matches expected value\n\t\t\tvar conditionMet = ( this.value == config.value );\n\n\t\t\tif( hide ) {\n\t\t\t\telement.style.display = conditionMet ? '' : 'none';\n\t\t\t\telement.style.visibility = conditionMet ? '' : 'hidden';\n\t\t\t} else {\n\t\t\t\telement.style.opacity = conditionMet ? '' : '0.4';\n\t\t\t}\n\n\t\t\t// disable input fields to stop sending their values to server\n\t\t\tArray.prototype.forEach.call( inputs, function(inputElement) {\n\t\t\t\tconditionMet ? inputElement.removeAttribute('readonly') : inputElement.setAttribute('readonly','readonly');\n\t\t\t});\n\t\t}\n\n\t\t// find checked element and call toggleElement function\n\t\tArray.prototype.forEach.call( parentElements, function( parentElement ) {\n\t\t\ttoggleElement.call(parentElement);\n\t\t});\n\n\t\t// bind on all changes\n\t\thelpers.bindEventToElements(parentElements, 'change', toggleElement);\n\t});\n})();\n\nmodule.exports = helpers;\n},{}],3:[function(require,module,exports){\nvar Settings = function(context, helpers, events ) {\n\t'use strict';\n\n\t// vars\n\tvar form = context.querySelector('form');\n\tvar listInputs = context.querySelectorAll('.mc4wp-list-input');\n\tvar lists = mc4wp_vars.mailchimp.lists;\n\tvar selectedLists = [];\n\n\t// functions\n\tfunction getSelectedListsWhere(searchKey,searchValue) {\n\t\treturn selectedLists.filter(function(el) {\n\t\t\treturn el[searchKey] === searchValue;\n\t\t});\n\t}\n\n\tfunction getSelectedLists() {\n\t\treturn selectedLists;\n\t}\n\n\tfunction updateSelectedLists() {\n\t\tselectedLists = [];\n\n\t\tArray.prototype.forEach.call(listInputs, function(input) {\n\t\t\t// skip unchecked checkboxes\n\t\t\tif( typeof( input.checked ) === \"boolean\" && ! input.checked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif( typeof( lists[ input.value ] ) === \"object\" ){\n\t\t\t\tselectedLists.push( lists[ input.value ] );\n\t\t\t}\n\t\t});\n\n\t\tevents.trigger('selectedLists.change', [ selectedLists ]);\n\t\treturn selectedLists;\n\t}\n\n\tfunction toggleVisibleLists() {\n\t\tvar rows = document.querySelectorAll('.lists--only-selected > *');\n\t\tArray.prototype.forEach.call(rows, function(el) {\n\n\t\t\tvar listId = el.getAttribute('data-list-id');\n\t\t\tvar isSelected = getSelectedListsWhere('id', listId).length > 0;\n\n\t\t\tif( isSelected ) {\n\t\t\t\tel.setAttribute('class', el.getAttribute('class').replace('hidden',''));\n\t\t\t} else {\n\t\t\t\tel.setAttribute('class', el.getAttribute('class') + \" hidden\" );\n\t\t\t}\n\t\t});\n\t}\n\n\tevents.on('selectedLists.change', toggleVisibleLists);\n\thelpers.bindEventToElements(listInputs,'change',updateSelectedLists);\n\n\tupdateSelectedLists();\n\n\treturn {\n\t\tgetSelectedLists: getSelectedLists\n\t}\n\n};\n\nmodule.exports = Settings;\n},{}],4:[function(require,module,exports){\n// Tabs\nvar Tabs = function(context) {\n\t'use strict';\n\n\t// @todo last piece of jQuery... can we get rid of it?\n\tvar $ = window.jQuery;\n\n\tvar URL = require('./url.js');\n\tvar $context = $(context);\n\tvar $tabs = $context.find('.tab');\n\tvar $tabNavs = $context.find('.nav-tab');\n\tvar refererField = context.querySelector('input[name=\"_wp_http_referer\"]');\n\tvar tabs = [];\n\n\t$.each($tabs, function(i,t) {\n\t\tvar id = t.id.substring(4);\n\t\tvar title = $(t).find('h2').first().text();\n\n\t\ttabs.push({\n\t\t\tid: id,\n\t\t\ttitle: title,\n\t\t\telement: t,\n\t\t\tnav: context.querySelectorAll('.nav-tab-' + id),\n\t\t\topen: function() { return open(id); }\n\t\t});\n\t});\n\n\tfunction get(id) {\n\n\t\tfor( var i=0; i<tabs.length; i++){\n\t\t\tif(tabs[i].id === id ) {\n\t\t\t\treturn tabs[i];\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tfunction open( tab, updateState ) {\n\n\t\t// make sure we have a tab object\n\t\tif(typeof(tab) === \"string\"){\n\t\t\ttab = get(tab);\n\t\t}\n\n\t\tif(!tab) { return false; }\n\n\t\t// should we update state?\n\t\tif( updateState == undefined ) {\n\t\t\tupdateState = true;\n\t\t}\n\n\t\t// hide all tabs & remove active class\n\t\t$tabs.removeClass('tab-active').css('display', 'none');\n\t\t$tabNavs.removeClass('nav-tab-active');\n\n\t\t// add `nav-tab-active` to this tab\n\t\tArray.prototype.forEach.call(tab.nav, function(nav) {\n\t\t\tnav.className += \" nav-tab-active\";\n\t\t\tnav.blur();\n\t\t});\n\n\t\t// show target tab\n\t\ttab.element.style.display = 'block';\n\t\ttab.element.className += \" tab-active\";\n\n\t\t// create new URL\n\t\tvar url = URL.setParameter(window.location.href, \"tab\", tab.id );\n\n\t\t// update hash\n\t\tif( history.pushState && updateState ) {\n\t\t\thistory.pushState( tab.id, '', url );\n\t\t}\n\n\t\t// update document title\n\t\ttitle(tab);\n\n\t\t// update referer field\n\t\trefererField.value = url;\n\n\t\t// if thickbox is open, close it.\n\t\tif( typeof(tb_remove) === \"function\" ) {\n\t\t\ttb_remove();\n\t\t}\n\n\t\t// refresh editor after switching tabs\n\t\t// TODO: decouple decouple decouple\n\t\tif( tab.id === 'fields' && window.mc4wp && window.mc4wp.forms && window.mc4wp.forms.editor ) {\n\t\t\tmc4wp.forms.editor.refresh();\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tfunction title(tab) {\n\t\tvar title = document.title.split('-');\n\t\tdocument.title = document.title.replace(title[0], tab.title + \" \");\n\t}\n\n\tfunction switchTab(e) {\n\t\te = e || window.event;\n\n\t\t// get from data attribute\n\t\tvar tabId = this.getAttribute('data-tab');\n\n\t\t// get from classname\n\t\tif( ! tabId ) {\n\t\t\tvar match = this.className.match(/nav-tab-(\\w+)?/);\n\t\t\tif( match ) {\n\t\t\t\ttabId = match[1];\n\t\t\t}\n\t\t}\n\n\t\t// get from href\n\t\tif( ! tabId ) {\n\t\t\tvar urlParams = URL.parse( this.href );\n\t\t\tif( ! urlParams.tab ) { return; }\n\t\t\ttabId = urlParams.tab;\n\t\t}\n\n\t\tvar opened = open( tabId );\n\n\t\tif( opened ) {\n\t\t\te.preventDefault();\n\t\t\te.returnValue = false;\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tfunction init() {\n\n\t\t// check for current tab\n\t\tif(! history.pushState) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar activeTab = $tabs.filter(':visible').get(0);\n\t\tif( ! activeTab ) { return; }\n\t\tvar tab = get(activeTab.id.substring(4));\n\t\tif(!tab) return;\n\n\t\t// check if tab is in html5 history\n\t\tif( history.replaceState && history.state === null) {\n\t\t\thistory.replaceState( tab.id, '' );\n\t\t}\n\n\t\t// update document title\n\t\ttitle(tab);\n\t}\n\n\t$tabNavs.click(switchTab);\n\t$(document.body).on('click', '.tab-link', switchTab);\n\tinit();\n\n\tif(window.addEventListener && history.pushState ) {\n\t\twindow.addEventListener('popstate', function(e) {\n\t\t\tif(!e.state) return true;\n\t\t\tvar tabId = e.state;\n\t\t\treturn open(tabId,false);\n\t\t});\n\t}\n\n\treturn {\n\t\topen: open,\n\t\tget: get\n\t}\n\n};\n\nmodule.exports = Tabs;\n},{\"./url.js\":5}],5:[function(require,module,exports){\n'use strict';\n\nvar URL = {\n\tparse: function(url) {\n\t\tvar query = {};\n\t\tvar a = url.split('&');\n\t\tfor (var i in a) {\n\t\t\tif(!a.hasOwnProperty(i)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvar b = a[i].split('=');\n\t\t\tquery[decodeURIComponent(b[0])] = decodeURIComponent(b[1]);\n\t\t}\n\n\t\treturn query;\n\t},\n\tbuild: function(data) {\n\t\tvar ret = [];\n\t\tfor (var d in data)\n\t\t\tret.push(d + \"=\" + encodeURIComponent(data[d]));\n\t\treturn ret.join(\"&\");\n\t},\n\tsetParameter: function( url, key, value ) {\n\t\tvar data = URL.parse( url );\n\t\tdata[ key ] = value;\n\t\treturn URL.build( data );\n\t}\n};\n\nmodule.exports = URL;\n},{}],6:[function(require,module,exports){\n;(function (global, factory) { // eslint-disable-line\r\n\t\"use strict\"\r\n\t/* eslint-disable no-undef */\r\n\tvar m = factory(global)\r\n\tif (typeof module === \"object\" && module != null && module.exports) {\r\n\t\tmodule.exports = m\r\n\t} else if (typeof define === \"function\" && define.amd) {\r\n\t\tdefine(function () { return m })\r\n\t} else {\r\n\t\tglobal.m = m\r\n\t}\r\n\t/* eslint-enable no-undef */\r\n})(typeof window !== \"undefined\" ? window : {}, function (global, undefined) { // eslint-disable-line\r\n\t\"use strict\"\r\n\r\n\tm.version = function () {\r\n\t\treturn \"v0.2.3\"\r\n\t}\r\n\r\n\tvar hasOwn = {}.hasOwnProperty\r\n\tvar type = {}.toString\r\n\r\n\tfunction isFunction(object) {\r\n\t\treturn typeof object === \"function\"\r\n\t}\r\n\r\n\tfunction isObject(object) {\r\n\t\treturn type.call(object) === \"[object Object]\"\r\n\t}\r\n\r\n\tfunction isString(object) {\r\n\t\treturn type.call(object) === \"[object String]\"\r\n\t}\r\n\r\n\tvar isArray = Array.isArray || function (object) {\r\n\t\treturn type.call(object) === \"[object Array]\"\r\n\t}\r\n\r\n\tfunction noop() {}\r\n\r\n\tvar voidElements = {\r\n\t\tAREA: 1,\r\n\t\tBASE: 1,\r\n\t\tBR: 1,\r\n\t\tCOL: 1,\r\n\t\tCOMMAND: 1,\r\n\t\tEMBED: 1,\r\n\t\tHR: 1,\r\n\t\tIMG: 1,\r\n\t\tINPUT: 1,\r\n\t\tKEYGEN: 1,\r\n\t\tLINK: 1,\r\n\t\tMETA: 1,\r\n\t\tPARAM: 1,\r\n\t\tSOURCE: 1,\r\n\t\tTRACK: 1,\r\n\t\tWBR: 1\r\n\t}\r\n\r\n\t// caching commonly used variables\r\n\tvar $document, $location, $requestAnimationFrame, $cancelAnimationFrame\r\n\r\n\t// self invoking function needed because of the way mocks work\r\n\tfunction initialize(mock) {\r\n\t\t$document = mock.document\r\n\t\t$location = mock.location\r\n\t\t$cancelAnimationFrame = mock.cancelAnimationFrame || mock.clearTimeout\r\n\t\t$requestAnimationFrame = mock.requestAnimationFrame || mock.setTimeout\r\n\t}\r\n\r\n\t// testing API\r\n\tm.deps = function (mock) {\r\n\t\tinitialize(global = mock || window)\r\n\t\treturn global\r\n\t}\r\n\r\n\tm.deps(global)\r\n\r\n\t/**\r\n\t * @typedef {String} Tag\r\n\t * A string that looks like -> div.classname#id[param=one][param2=two]\r\n\t * Which describes a DOM node\r\n\t */\r\n\r\n\tfunction parseTagAttrs(cell, tag) {\r\n\t\tvar classes = []\r\n\t\tvar parser = /(?:(^|#|\\.)([^#\\.\\[\\]]+))|(\\[.+?\\])/g\r\n\t\tvar match\r\n\r\n\t\twhile ((match = parser.exec(tag))) {\r\n\t\t\tif (match[1] === \"\" && match[2]) {\r\n\t\t\t\tcell.tag = match[2]\r\n\t\t\t} else if (match[1] === \"#\") {\r\n\t\t\t\tcell.attrs.id = match[2]\r\n\t\t\t} else if (match[1] === \".\") {\r\n\t\t\t\tclasses.push(match[2])\r\n\t\t\t} else if (match[3][0] === \"[\") {\r\n\t\t\t\tvar pair = /\\[(.+?)(?:=(\"|'|)(.*?)\\2)?\\]/.exec(match[3])\r\n\t\t\t\tcell.attrs[pair[1]] = pair[3] || (pair[2] ? \"\" : true)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn classes\r\n\t}\r\n\r\n\tfunction getVirtualChildren(args, hasAttrs) {\r\n\t\tvar children = hasAttrs ? args.slice(1) : args\r\n\r\n\t\tif (children.length === 1 && isArray(children[0])) {\r\n\t\t\treturn children[0]\r\n\t\t} else {\r\n\t\t\treturn children\r\n\t\t}\r\n\t}\r\n\r\n\tfunction assignAttrs(target, attrs, classes) {\r\n\t\tvar classAttr = \"class\" in attrs ? \"class\" : \"className\"\r\n\r\n\t\tfor (var attrName in attrs) {\r\n\t\t\tif (hasOwn.call(attrs, attrName)) {\r\n\t\t\t\tif (attrName === classAttr &&\r\n\t\t\t\t\t\tattrs[attrName] != null &&\r\n\t\t\t\t\t\tattrs[attrName] !== \"\") {\r\n\t\t\t\t\tclasses.push(attrs[attrName])\r\n\t\t\t\t\t// create key in correct iteration order\r\n\t\t\t\t\ttarget[attrName] = \"\"\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttarget[attrName] = attrs[attrName]\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (classes.length) target[classAttr] = classes.join(\" \")\r\n\t}\r\n\r\n\t/**\r\n\t *\r\n\t * @param {Tag} The DOM node tag\r\n\t * @param {Object=[]} optional key-value pairs to be mapped to DOM attrs\r\n\t * @param {...mNode=[]} Zero or more Mithril child nodes. Can be an array,\r\n\t * or splat (optional)\r\n\t */\r\n\tfunction m(tag, pairs) {\r\n\t\tvar args = [].slice.call(arguments, 1)\r\n\r\n\t\tif (isObject(tag)) return parameterize(tag, args)\r\n\r\n\t\tif (!isString(tag)) {\r\n\t\t\tthrow new Error(\"selector in m(selector, attrs, children) should \" +\r\n\t\t\t\t\"be a string\")\r\n\t\t}\r\n\r\n\t\tvar hasAttrs = pairs != null && isObject(pairs) &&\r\n\t\t\t!(\"tag\" in pairs || \"view\" in pairs || \"subtree\" in pairs)\r\n\r\n\t\tvar attrs = hasAttrs ? pairs : {}\r\n\t\tvar cell = {\r\n\t\t\ttag: \"div\",\r\n\t\t\tattrs: {},\r\n\t\t\tchildren: getVirtualChildren(args, hasAttrs)\r\n\t\t}\r\n\r\n\t\tassignAttrs(cell.attrs, attrs, parseTagAttrs(cell, tag))\r\n\t\treturn cell\r\n\t}\r\n\r\n\tfunction forEach(list, f) {\r\n\t\tfor (var i = 0; i < list.length && !f(list[i], i++);) {\r\n\t\t\t// function called in condition\r\n\t\t}\r\n\t}\r\n\r\n\tfunction forKeys(list, f) {\r\n\t\tforEach(list, function (attrs, i) {\r\n\t\t\treturn (attrs = attrs && attrs.attrs) &&\r\n\t\t\t\tattrs.key != null &&\r\n\t\t\t\tf(attrs, i)\r\n\t\t})\r\n\t}\r\n\t// This function was causing deopts in Chrome.\r\n\tfunction dataToString(data) {\r\n\t\t// data.toString() might throw or return null if data is the return\r\n\t\t// value of Console.log in some versions of Firefox (behavior depends on\r\n\t\t// version)\r\n\t\ttry {\r\n\t\t\tif (data != null && data.toString() != null) return data\r\n\t\t} catch (e) {\r\n\t\t\t// silently ignore errors\r\n\t\t}\r\n\t\treturn \"\"\r\n\t}\r\n\r\n\t// This function was causing deopts in Chrome.\r\n\tfunction injectTextNode(parentElement, first, index, data) {\r\n\t\ttry {\r\n\t\t\tinsertNode(parentElement, first, index)\r\n\t\t\tfirst.nodeValue = data\r\n\t\t} catch (e) {\r\n\t\t\t// IE erroneously throws error when appending an empty text node\r\n\t\t\t// after a null\r\n\t\t}\r\n\t}\r\n\r\n\tfunction flatten(list) {\r\n\t\t// recursively flatten array\r\n\t\tfor (var i = 0; i < list.length; i++) {\r\n\t\t\tif (isArray(list[i])) {\r\n\t\t\t\tlist = list.concat.apply([], list)\r\n\t\t\t\t// check current index again and flatten until there are no more\r\n\t\t\t\t// nested arrays at that index\r\n\t\t\t\ti--\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn list\r\n\t}\r\n\r\n\tfunction insertNode(parentElement, node, index) {\r\n\t\tparentElement.insertBefore(node,\r\n\t\t\tparentElement.childNodes[index] || null)\r\n\t}\r\n\r\n\tvar DELETION = 1\r\n\tvar INSERTION = 2\r\n\tvar MOVE = 3\r\n\r\n\tfunction handleKeysDiffer(data, existing, cached, parentElement) {\r\n\t\tforKeys(data, function (key, i) {\r\n\t\t\texisting[key = key.key] = existing[key] ? {\r\n\t\t\t\taction: MOVE,\r\n\t\t\t\tindex: i,\r\n\t\t\t\tfrom: existing[key].index,\r\n\t\t\t\telement: cached.nodes[existing[key].index] ||\r\n\t\t\t\t\t$document.createElement(\"div\")\r\n\t\t\t} : {action: INSERTION, index: i}\r\n\t\t})\r\n\r\n\t\tvar actions = []\r\n\t\tfor (var prop in existing) if (hasOwn.call(existing, prop)) {\r\n\t\t\tactions.push(existing[prop])\r\n\t\t}\r\n\r\n\t\tvar changes = actions.sort(sortChanges)\r\n\t\tvar newCached = new Array(cached.length)\r\n\r\n\t\tnewCached.nodes = cached.nodes.slice()\r\n\r\n\t\tforEach(changes, function (change) {\r\n\t\t\tvar index = change.index\r\n\t\t\tif (change.action === DELETION) {\r\n\t\t\t\tclear(cached[index].nodes, cached[index])\r\n\t\t\t\tnewCached.splice(index, 1)\r\n\t\t\t}\r\n\t\t\tif (change.action === INSERTION) {\r\n\t\t\t\tvar dummy = $document.createElement(\"div\")\r\n\t\t\t\tdummy.key = data[index].attrs.key\r\n\t\t\t\tinsertNode(parentElement, dummy, index)\r\n\t\t\t\tnewCached.splice(index, 0, {\r\n\t\t\t\t\tattrs: {key: data[index].attrs.key},\r\n\t\t\t\t\tnodes: [dummy]\r\n\t\t\t\t})\r\n\t\t\t\tnewCached.nodes[index] = dummy\r\n\t\t\t}\r\n\r\n\t\t\tif (change.action === MOVE) {\r\n\t\t\t\tvar changeElement = change.element\r\n\t\t\t\tvar maybeChanged = parentElement.childNodes[index]\r\n\t\t\t\tif (maybeChanged !== changeElement && changeElement !== null) {\r\n\t\t\t\t\tparentElement.insertBefore(changeElement,\r\n\t\t\t\t\t\tmaybeChanged || null)\r\n\t\t\t\t}\r\n\t\t\t\tnewCached[index] = cached[change.from]\r\n\t\t\t\tnewCached.nodes[index] = changeElement\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\treturn newCached\r\n\t}\r\n\r\n\tfunction diffKeys(data, cached, existing, parentElement) {\r\n\t\tvar keysDiffer = data.length !== cached.length\r\n\r\n\t\tif (!keysDiffer) {\r\n\t\t\tforKeys(data, function (attrs, i) {\r\n\t\t\t\tvar cachedCell = cached[i]\r\n\t\t\t\treturn keysDiffer = cachedCell &&\r\n\t\t\t\t\tcachedCell.attrs &&\r\n\t\t\t\t\tcachedCell.attrs.key !== attrs.key\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tif (keysDiffer) {\r\n\t\t\treturn handleKeysDiffer(data, existing, cached, parentElement)\r\n\t\t} else {\r\n\t\t\treturn cached\r\n\t\t}\r\n\t}\r\n\r\n\tfunction diffArray(data, cached, nodes) {\r\n\t\t// diff the array itself\r\n\r\n\t\t// update the list of DOM nodes by collecting the nodes from each item\r\n\t\tforEach(data, function (_, i) {\r\n\t\t\tif (cached[i] != null) nodes.push.apply(nodes, cached[i].nodes)\r\n\t\t})\r\n\t\t// remove items from the end of the array if the new array is shorter\r\n\t\t// than the old one. if errors ever happen here, the issue is most\r\n\t\t// likely a bug in the construction of the `cached` data structure\r\n\t\t// somewhere earlier in the program\r\n\t\tforEach(cached.nodes, function (node, i) {\r\n\t\t\tif (node.parentNode != null && nodes.indexOf(node) < 0) {\r\n\t\t\t\tclear([node], [cached[i]])\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\tif (data.length < cached.length) cached.length = data.length\r\n\t\tcached.nodes = nodes\r\n\t}\r\n\r\n\tfunction buildArrayKeys(data) {\r\n\t\tvar guid = 0\r\n\t\tforKeys(data, function () {\r\n\t\t\tforEach(data, function (attrs) {\r\n\t\t\t\tif ((attrs = attrs && attrs.attrs) && attrs.key == null) {\r\n\t\t\t\t\tattrs.key = \"__mithril__\" + guid++\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\treturn 1\r\n\t\t})\r\n\t}\r\n\r\n\tfunction isDifferentEnough(data, cached, dataAttrKeys) {\r\n\t\tif (data.tag !== cached.tag) return true\r\n\r\n\t\tif (dataAttrKeys.sort().join() !==\r\n\t\t\t\tObject.keys(cached.attrs).sort().join()) {\r\n\t\t\treturn true\r\n\t\t}\r\n\r\n\t\tif (data.attrs.id !== cached.attrs.id) {\r\n\t\t\treturn true\r\n\t\t}\r\n\r\n\t\tif (data.attrs.key !== cached.attrs.key) {\r\n\t\t\treturn true\r\n\t\t}\r\n\r\n\t\tif (m.redraw.strategy() === \"all\") {\r\n\t\t\treturn !cached.configContext || cached.configContext.retain !== true\r\n\t\t}\r\n\r\n\t\tif (m.redraw.strategy() === \"diff\") {\r\n\t\t\treturn cached.configContext && cached.configContext.retain === false\r\n\t\t}\r\n\r\n\t\treturn false\r\n\t}\r\n\r\n\tfunction maybeRecreateObject(data, cached, dataAttrKeys) {\r\n\t\t// if an element is different enough from the one in cache, recreate it\r\n\t\tif (isDifferentEnough(data, cached, dataAttrKeys)) {\r\n\t\t\tif (cached.nodes.length) clear(cached.nodes)\r\n\r\n\t\t\tif (cached.configContext &&\r\n\t\t\t\t\tisFunction(cached.configContext.onunload)) {\r\n\t\t\t\tcached.configContext.onunload()\r\n\t\t\t}\r\n\r\n\t\t\tif (cached.controllers) {\r\n\t\t\t\tforEach(cached.controllers, function (controller) {\r\n\t\t\t\t\tif (controller.onunload) controller.onunload({preventDefault: noop});\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tfunction getObjectNamespace(data, namespace) {\r\n\t\tif (data.attrs.xmlns) return data.attrs.xmlns\r\n\t\tif (data.tag === \"svg\") return \"http://www.w3.org/2000/svg\"\r\n\t\tif (data.tag === \"math\") return \"http://www.w3.org/1998/Math/MathML\"\r\n\t\treturn namespace\r\n\t}\r\n\r\n\tvar pendingRequests = 0\r\n\tm.startComputation = function () { pendingRequests++ }\r\n\tm.endComputation = function () {\r\n\t\tif (pendingRequests > 1) {\r\n\t\t\tpendingRequests--\r\n\t\t} else {\r\n\t\t\tpendingRequests = 0\r\n\t\t\tm.redraw()\r\n\t\t}\r\n\t}\r\n\r\n\tfunction unloadCachedControllers(cached, views, controllers) {\r\n\t\tif (controllers.length) {\r\n\t\t\tcached.views = views\r\n\t\t\tcached.controllers = controllers\r\n\t\t\tforEach(controllers, function (controller) {\r\n\t\t\t\tif (controller.onunload && controller.onunload.$old) {\r\n\t\t\t\t\tcontroller.onunload = controller.onunload.$old\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (pendingRequests && controller.onunload) {\r\n\t\t\t\t\tvar onunload = controller.onunload\r\n\t\t\t\t\tcontroller.onunload = noop\r\n\t\t\t\t\tcontroller.onunload.$old = onunload\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}\r\n\t}\r\n\r\n\tfunction scheduleConfigsToBeCalled(configs, data, node, isNew, cached) {\r\n\t\t// schedule configs to be called. They are called after `build` finishes\r\n\t\t// running\r\n\t\tif (isFunction(data.attrs.config)) {\r\n\t\t\tvar context = cached.configContext = cached.configContext || {}\r\n\r\n\t\t\t// bind\r\n\t\t\tconfigs.push(function () {\r\n\t\t\t\treturn data.attrs.config.call(data, node, !isNew, context,\r\n\t\t\t\t\tcached)\r\n\t\t\t})\r\n\t\t}\r\n\t}\r\n\r\n\tfunction buildUpdatedNode(\r\n\t\tcached,\r\n\t\tdata,\r\n\t\teditable,\r\n\t\thasKeys,\r\n\t\tnamespace,\r\n\t\tviews,\r\n\t\tconfigs,\r\n\t\tcontrollers\r\n\t) {\r\n\t\tvar node = cached.nodes[0]\r\n\r\n\t\tif (hasKeys) {\r\n\t\t\tsetAttributes(node, data.tag, data.attrs, cached.attrs, namespace)\r\n\t\t}\r\n\r\n\t\tcached.children = build(\r\n\t\t\tnode,\r\n\t\t\tdata.tag,\r\n\t\t\tundefined,\r\n\t\t\tundefined,\r\n\t\t\tdata.children,\r\n\t\t\tcached.children,\r\n\t\t\tfalse,\r\n\t\t\t0,\r\n\t\t\tdata.attrs.contenteditable ? node : editable,\r\n\t\t\tnamespace,\r\n\t\t\tconfigs\r\n\t\t)\r\n\r\n\t\tcached.nodes.intact = true\r\n\r\n\t\tif (controllers.length) {\r\n\t\t\tcached.views = views\r\n\t\t\tcached.controllers = controllers\r\n\t\t}\r\n\r\n\t\treturn node\r\n\t}\r\n\r\n\tfunction handleNonexistentNodes(data, parentElement, index) {\r\n\t\tvar nodes\r\n\t\tif (data.$trusted) {\r\n\t\t\tnodes = injectHTML(parentElement, index, data)\r\n\t\t} else {\r\n\t\t\tnodes = [$document.createTextNode(data)]\r\n\t\t\tif (!(parentElement.nodeName in voidElements)) {\r\n\t\t\t\tinsertNode(parentElement, nodes[0], index)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar cached\r\n\r\n\t\tif (typeof data === \"string\" ||\r\n\t\t\t\ttypeof data === \"number\" ||\r\n\t\t\t\ttypeof data === \"boolean\") {\r\n\t\t\tcached = new data.constructor(data)\r\n\t\t} else {\r\n\t\t\tcached = data\r\n\t\t}\r\n\r\n\t\tcached.nodes = nodes\r\n\t\treturn cached\r\n\t}\r\n\r\n\tfunction reattachNodes(\r\n\t\tdata,\r\n\t\tcached,\r\n\t\tparentElement,\r\n\t\teditable,\r\n\t\tindex,\r\n\t\tparentTag\r\n\t) {\r\n\t\tvar nodes = cached.nodes\r\n\t\tif (!editable || editable !== $document.activeElement) {\r\n\t\t\tif (data.$trusted) {\r\n\t\t\t\tclear(nodes, cached)\r\n\t\t\t\tnodes = injectHTML(parentElement, index, data)\r\n\t\t\t} else if (parentTag === \"textarea\") {\r\n\t\t\t\t// <textarea> uses `value` instead of `nodeValue`.\r\n\t\t\t\tparentElement.value = data\r\n\t\t\t} else if (editable) {\r\n\t\t\t\t// contenteditable nodes use `innerHTML` instead of `nodeValue`.\r\n\t\t\t\teditable.innerHTML = data\r\n\t\t\t} else {\r\n\t\t\t\t// was a trusted string\r\n\t\t\t\tif (nodes[0].nodeType === 1 || nodes.length > 1 ||\r\n\t\t\t\t\t\t(nodes[0].nodeValue.trim &&\r\n\t\t\t\t\t\t\t!nodes[0].nodeValue.trim())) {\r\n\t\t\t\t\tclear(cached.nodes, cached)\r\n\t\t\t\t\tnodes = [$document.createTextNode(data)]\r\n\t\t\t\t}\r\n\r\n\t\t\t\tinjectTextNode(parentElement, nodes[0], index, data)\r\n\t\t\t}\r\n\t\t}\r\n\t\tcached = new data.constructor(data)\r\n\t\tcached.nodes = nodes\r\n\t\treturn cached\r\n\t}\r\n\r\n\tfunction handleTextNode(\r\n\t\tcached,\r\n\t\tdata,\r\n\t\tindex,\r\n\t\tparentElement,\r\n\t\tshouldReattach,\r\n\t\teditable,\r\n\t\tparentTag\r\n\t) {\r\n\t\tif (!cached.nodes.length) {\r\n\t\t\treturn handleNonexistentNodes(data, parentElement, index)\r\n\t\t} else if (cached.valueOf() !== data.valueOf() || shouldReattach) {\r\n\t\t\treturn reattachNodes(data, cached, parentElement, editable, index,\r\n\t\t\t\tparentTag)\r\n\t\t} else {\r\n\t\t\treturn (cached.nodes.intact = true, cached)\r\n\t\t}\r\n\t}\r\n\r\n\tfunction getSubArrayCount(item) {\r\n\t\tif (item.$trusted) {\r\n\t\t\t// fix offset of next element if item was a trusted string w/ more\r\n\t\t\t// than one html element\r\n\t\t\t// the first clause in the regexp matches elements\r\n\t\t\t// the second clause (after the pipe) matches text nodes\r\n\t\t\tvar match = item.match(/<[^\\/]|\\>\\s*[^<]/g)\r\n\t\t\tif (match != null) return match.length\r\n\t\t} else if (isArray(item)) {\r\n\t\t\treturn item.length\r\n\t\t}\r\n\t\treturn 1\r\n\t}\r\n\r\n\tfunction buildArray(\r\n\t\tdata,\r\n\t\tcached,\r\n\t\tparentElement,\r\n\t\tindex,\r\n\t\tparentTag,\r\n\t\tshouldReattach,\r\n\t\teditable,\r\n\t\tnamespace,\r\n\t\tconfigs\r\n\t) {\r\n\t\tdata = flatten(data)\r\n\t\tvar nodes = []\r\n\t\tvar intact = cached.length === data.length\r\n\t\tvar subArrayCount = 0\r\n\r\n\t\t// keys algorithm: sort elements without recreating them if keys are\r\n\t\t// present\r\n\t\t//\r\n\t\t// 1) create a map of all existing keys, and mark all for deletion\r\n\t\t// 2) add new keys to map and mark them for addition\r\n\t\t// 3) if key exists in new list, change action from deletion to a move\r\n\t\t// 4) for each key, handle its corresponding action as marked in\r\n\t\t// previous steps\r\n\r\n\t\tvar existing = {}\r\n\t\tvar shouldMaintainIdentities = false\r\n\r\n\t\tforKeys(cached, function (attrs, i) {\r\n\t\t\tshouldMaintainIdentities = true\r\n\t\t\texisting[cached[i].attrs.key] = {action: DELETION, index: i}\r\n\t\t})\r\n\r\n\t\tbuildArrayKeys(data)\r\n\t\tif (shouldMaintainIdentities) {\r\n\t\t\tcached = diffKeys(data, cached, existing, parentElement)\r\n\t\t}\r\n\t\t// end key algorithm\r\n\r\n\t\tvar cacheCount = 0\r\n\t\t// faster explicitly written\r\n\t\tfor (var i = 0, len = data.length; i < len; i++) {\r\n\t\t\t// diff each item in the array\r\n\t\t\tvar item = build(\r\n\t\t\t\tparentElement,\r\n\t\t\t\tparentTag,\r\n\t\t\t\tcached,\r\n\t\t\t\tindex,\r\n\t\t\t\tdata[i],\r\n\t\t\t\tcached[cacheCount],\r\n\t\t\t\tshouldReattach,\r\n\t\t\t\tindex + subArrayCount || subArrayCount,\r\n\t\t\t\teditable,\r\n\t\t\t\tnamespace,\r\n\t\t\t\tconfigs)\r\n\r\n\t\t\tif (item !== undefined) {\r\n\t\t\t\tintact = intact && item.nodes.intact\r\n\t\t\t\tsubArrayCount += getSubArrayCount(item)\r\n\t\t\t\tcached[cacheCount++] = item\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!intact) diffArray(data, cached, nodes)\r\n\t\treturn cached\r\n\t}\r\n\r\n\tfunction makeCache(data, cached, index, parentIndex, parentCache) {\r\n\t\tif (cached != null) {\r\n\t\t\tif (type.call(cached) === type.call(data)) return cached\r\n\r\n\t\t\tif (parentCache && parentCache.nodes) {\r\n\t\t\t\tvar offset = index - parentIndex\r\n\t\t\t\tvar end = offset + (isArray(data) ? data : cached.nodes).length\r\n\t\t\t\tclear(\r\n\t\t\t\t\tparentCache.nodes.slice(offset, end),\r\n\t\t\t\t\tparentCache.slice(offset, end))\r\n\t\t\t} else if (cached.nodes) {\r\n\t\t\t\tclear(cached.nodes, cached)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tcached = new data.constructor()\r\n\t\t// if constructor creates a virtual dom element, use a blank object as\r\n\t\t// the base cached node instead of copying the virtual el (#277)\r\n\t\tif (cached.tag) cached = {}\r\n\t\tcached.nodes = []\r\n\t\treturn cached\r\n\t}\r\n\r\n\tfunction constructNode(data, namespace) {\r\n\t\tif (data.attrs.is) {\r\n\t\t\tif (namespace == null) {\r\n\t\t\t\treturn $document.createElement(data.tag, data.attrs.is)\r\n\t\t\t} else {\r\n\t\t\t\treturn $document.createElementNS(namespace, data.tag,\r\n\t\t\t\t\tdata.attrs.is)\r\n\t\t\t}\r\n\t\t} else if (namespace == null) {\r\n\t\t\treturn $document.createElement(data.tag)\r\n\t\t} else {\r\n\t\t\treturn $document.createElementNS(namespace, data.tag)\r\n\t\t}\r\n\t}\r\n\r\n\tfunction constructAttrs(data, node, namespace, hasKeys) {\r\n\t\tif (hasKeys) {\r\n\t\t\treturn setAttributes(node, data.tag, data.attrs, {}, namespace)\r\n\t\t} else {\r\n\t\t\treturn data.attrs\r\n\t\t}\r\n\t}\r\n\r\n\tfunction constructChildren(\r\n\t\tdata,\r\n\t\tnode,\r\n\t\tcached,\r\n\t\teditable,\r\n\t\tnamespace,\r\n\t\tconfigs\r\n\t) {\r\n\t\tif (data.children != null && data.children.length > 0) {\r\n\t\t\treturn build(\r\n\t\t\t\tnode,\r\n\t\t\t\tdata.tag,\r\n\t\t\t\tundefined,\r\n\t\t\t\tundefined,\r\n\t\t\t\tdata.children,\r\n\t\t\t\tcached.children,\r\n\t\t\t\ttrue,\r\n\t\t\t\t0,\r\n\t\t\t\tdata.attrs.contenteditable ? node : editable,\r\n\t\t\t\tnamespace,\r\n\t\t\t\tconfigs)\r\n\t\t} else {\r\n\t\t\treturn data.children\r\n\t\t}\r\n\t}\r\n\r\n\tfunction reconstructCached(\r\n\t\tdata,\r\n\t\tattrs,\r\n\t\tchildren,\r\n\t\tnode,\r\n\t\tnamespace,\r\n\t\tviews,\r\n\t\tcontrollers\r\n\t) {\r\n\t\tvar cached = {\r\n\t\t\ttag: data.tag,\r\n\t\t\tattrs: attrs,\r\n\t\t\tchildren: children,\r\n\t\t\tnodes: [node]\r\n\t\t}\r\n\r\n\t\tunloadCachedControllers(cached, views, controllers)\r\n\r\n\t\tif (cached.children && !cached.children.nodes) {\r\n\t\t\tcached.children.nodes = []\r\n\t\t}\r\n\r\n\t\t// edge case: setting value on <select> doesn't work before children\r\n\t\t// exist, so set it again after children have been created\r\n\t\tif (data.tag === \"select\" && \"value\" in data.attrs) {\r\n\t\t\tsetAttributes(node, data.tag, {value: data.attrs.value}, {},\r\n\t\t\t\tnamespace)\r\n\t\t}\r\n\r\n\t\treturn cached\r\n\t}\r\n\r\n\tfunction getController(views, view, cachedControllers, controller) {\r\n\t\tvar controllerIndex\r\n\r\n\t\tif (m.redraw.strategy() === \"diff\" && views) {\r\n\t\t\tcontrollerIndex = views.indexOf(view)\r\n\t\t} else {\r\n\t\t\tcontrollerIndex = -1\r\n\t\t}\r\n\r\n\t\tif (controllerIndex > -1) {\r\n\t\t\treturn cachedControllers[controllerIndex]\r\n\t\t} else if (isFunction(controller)) {\r\n\t\t\treturn new controller()\r\n\t\t} else {\r\n\t\t\treturn {}\r\n\t\t}\r\n\t}\r\n\r\n\tvar unloaders = []\r\n\r\n\tfunction updateLists(views, controllers, view, controller) {\r\n\t\tif (controller.onunload != null && unloaders.map(function(u) {return u.handler}).indexOf(controller.onunload) < 0) {\r\n\t\t\tunloaders.push({\r\n\t\t\t\tcontroller: controller,\r\n\t\t\t\thandler: controller.onunload\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tviews.push(view)\r\n\t\tcontrollers.push(controller)\r\n\t}\r\n\r\n\tvar forcing = false\r\n\tfunction checkView(data, view, cached, cachedControllers, controllers, views) {\r\n\t\tvar controller = getController(cached.views, view, cachedControllers, data.controller)\r\n\t\tvar key = data && data.attrs && data.attrs.key\r\n\t\tdata = pendingRequests === 0 || forcing || cachedControllers && cachedControllers.indexOf(controller) > -1 ? data.view(controller) : {tag: \"placeholder\"}\r\n\t\tif (data.subtree === \"retain\") return data;\r\n\t\tdata.attrs = data.attrs || {}\r\n\t\tdata.attrs.key = key\r\n\t\tupdateLists(views, controllers, view, controller)\r\n\t\treturn data\r\n\t}\r\n\r\n\tfunction markViews(data, cached, views, controllers) {\r\n\t\tvar cachedControllers = cached && cached.controllers\r\n\r\n\t\twhile (data.view != null) {\r\n\t\t\tdata = checkView(\r\n\t\t\t\tdata,\r\n\t\t\t\tdata.view.$original || data.view,\r\n\t\t\t\tcached,\r\n\t\t\t\tcachedControllers,\r\n\t\t\t\tcontrollers,\r\n\t\t\t\tviews)\r\n\t\t}\r\n\r\n\t\treturn data\r\n\t}\r\n\r\n\tfunction buildObject( // eslint-disable-line max-statements\r\n\t\tdata,\r\n\t\tcached,\r\n\t\teditable,\r\n\t\tparentElement,\r\n\t\tindex,\r\n\t\tshouldReattach,\r\n\t\tnamespace,\r\n\t\tconfigs\r\n\t) {\r\n\t\tvar views = []\r\n\t\tvar controllers = []\r\n\r\n\t\tdata = markViews(data, cached, views, controllers)\r\n\r\n\t\tif (data.subtree === \"retain\") return cached\r\n\r\n\t\tif (!data.tag && controllers.length) {\r\n\t\t\tthrow new Error(\"Component template must return a virtual \" +\r\n\t\t\t\t\"element, not an array, string, etc.\")\r\n\t\t}\r\n\r\n\t\tdata.attrs = data.attrs || {}\r\n\t\tcached.attrs = cached.attrs || {}\r\n\r\n\t\tvar dataAttrKeys = Object.keys(data.attrs)\r\n\t\tvar hasKeys = dataAttrKeys.length > (\"key\" in data.attrs ? 1 : 0)\r\n\r\n\t\tmaybeRecreateObject(data, cached, dataAttrKeys)\r\n\r\n\t\tif (!isString(data.tag)) return\r\n\r\n\t\tvar isNew = cached.nodes.length === 0\r\n\r\n\t\tnamespace = getObjectNamespace(data, namespace)\r\n\r\n\t\tvar node\r\n\t\tif (isNew) {\r\n\t\t\tnode = constructNode(data, namespace)\r\n\t\t\t// set attributes first, then create children\r\n\t\t\tvar attrs = constructAttrs(data, node, namespace, hasKeys)\r\n\r\n\t\t\tvar children = constructChildren(data, node, cached, editable,\r\n\t\t\t\tnamespace, configs)\r\n\r\n\t\t\tcached = reconstructCached(\r\n\t\t\t\tdata,\r\n\t\t\t\tattrs,\r\n\t\t\t\tchildren,\r\n\t\t\t\tnode,\r\n\t\t\t\tnamespace,\r\n\t\t\t\tviews,\r\n\t\t\t\tcontrollers)\r\n\t\t} else {\r\n\t\t\tnode = buildUpdatedNode(\r\n\t\t\t\tcached,\r\n\t\t\t\tdata,\r\n\t\t\t\teditable,\r\n\t\t\t\thasKeys,\r\n\t\t\t\tnamespace,\r\n\t\t\t\tviews,\r\n\t\t\t\tconfigs,\r\n\t\t\t\tcontrollers)\r\n\t\t}\r\n\r\n\t\tif (isNew || shouldReattach === true && node != null) {\r\n\t\t\tinsertNode(parentElement, node, index)\r\n\t\t}\r\n\r\n\t\t// The configs are called after `build` finishes running\r\n\t\tscheduleConfigsToBeCalled(configs, data, node, isNew, cached)\r\n\r\n\t\treturn cached\r\n\t}\r\n\r\n\tfunction build(\r\n\t\tparentElement,\r\n\t\tparentTag,\r\n\t\tparentCache,\r\n\t\tparentIndex,\r\n\t\tdata,\r\n\t\tcached,\r\n\t\tshouldReattach,\r\n\t\tindex,\r\n\t\teditable,\r\n\t\tnamespace,\r\n\t\tconfigs\r\n\t) {\r\n\t\t/*\r\n\t\t * `build` is a recursive function that manages creation/diffing/removal\r\n\t\t * of DOM elements based on comparison between `data` and `cached` the\r\n\t\t * diff algorithm can be summarized as this:\r\n\t\t *\r\n\t\t * 1 - compare `data` and `cached`\r\n\t\t * 2 - if they are different, copy `data` to `cached` and update the DOM\r\n\t\t * based on what the difference is\r\n\t\t * 3 - recursively apply this algorithm for every array and for the\r\n\t\t * children of every virtual element\r\n\t\t *\r\n\t\t * The `cached` data structure is essentially the same as the previous\r\n\t\t * redraw's `data` data structure, with a few additions:\r\n\t\t * - `cached` always has a property called `nodes`, which is a list of\r\n\t\t * DOM elements that correspond to the data represented by the\r\n\t\t * respective virtual element\r\n\t\t * - in order to support attaching `nodes` as a property of `cached`,\r\n\t\t * `cached` is *always* a non-primitive object, i.e. if the data was\r\n\t\t * a string, then cached is a String instance. If data was `null` or\r\n\t\t * `undefined`, cached is `new String(\"\")`\r\n\t\t * - `cached also has a `configContext` property, which is the state\r\n\t\t * storage object exposed by config(element, isInitialized, context)\r\n\t\t * - when `cached` is an Object, it represents a virtual element; when\r\n\t\t * it's an Array, it represents a list of elements; when it's a\r\n\t\t * String, Number or Boolean, it represents a text node\r\n\t\t *\r\n\t\t * `parentElement` is a DOM element used for W3C DOM API calls\r\n\t\t * `parentTag` is only used for handling a corner case for textarea\r\n\t\t * values\r\n\t\t * `parentCache` is used to remove nodes in some multi-node cases\r\n\t\t * `parentIndex` and `index` are used to figure out the offset of nodes.\r\n\t\t * They're artifacts from before arrays started being flattened and are\r\n\t\t * likely refactorable\r\n\t\t * `data` and `cached` are, respectively, the new and old nodes being\r\n\t\t * diffed\r\n\t\t * `shouldReattach` is a flag indicating whether a parent node was\r\n\t\t * recreated (if so, and if this node is reused, then this node must\r\n\t\t * reattach itself to the new parent)\r\n\t\t * `editable` is a flag that indicates whether an ancestor is\r\n\t\t * contenteditable\r\n\t\t * `namespace` indicates the closest HTML namespace as it cascades down\r\n\t\t * from an ancestor\r\n\t\t * `configs` is a list of config functions to run after the topmost\r\n\t\t * `build` call finishes running\r\n\t\t *\r\n\t\t * there's logic that relies on the assumption that null and undefined\r\n\t\t * data are equivalent to empty strings\r\n\t\t * - this prevents lifecycle surprises from procedural helpers that mix\r\n\t\t * implicit and explicit return statements (e.g.\r\n\t\t * function foo() {if (cond) return m(\"div\")}\r\n\t\t * - it simplifies diffing code\r\n\t\t */\r\n\t\tdata = dataToString(data)\r\n\t\tif (data.subtree === \"retain\") return cached\r\n\t\tcached = makeCache(data, cached, index, parentIndex, parentCache)\r\n\r\n\t\tif (isArray(data)) {\r\n\t\t\treturn buildArray(\r\n\t\t\t\tdata,\r\n\t\t\t\tcached,\r\n\t\t\t\tparentElement,\r\n\t\t\t\tindex,\r\n\t\t\t\tparentTag,\r\n\t\t\t\tshouldReattach,\r\n\t\t\t\teditable,\r\n\t\t\t\tnamespace,\r\n\t\t\t\tconfigs)\r\n\t\t} else if (data != null && isObject(data)) {\r\n\t\t\treturn buildObject(\r\n\t\t\t\tdata,\r\n\t\t\t\tcached,\r\n\t\t\t\teditable,\r\n\t\t\t\tparentElement,\r\n\t\t\t\tindex,\r\n\t\t\t\tshouldReattach,\r\n\t\t\t\tnamespace,\r\n\t\t\t\tconfigs)\r\n\t\t} else if (!isFunction(data)) {\r\n\t\t\treturn handleTextNode(\r\n\t\t\t\tcached,\r\n\t\t\t\tdata,\r\n\t\t\t\tindex,\r\n\t\t\t\tparentElement,\r\n\t\t\t\tshouldReattach,\r\n\t\t\t\teditable,\r\n\t\t\t\tparentTag)\r\n\t\t} else {\r\n\t\t\treturn cached\r\n\t\t}\r\n\t}\r\n\r\n\tfunction sortChanges(a, b) {\r\n\t\treturn a.action - b.action || a.index - b.index\r\n\t}\r\n\r\n\tfunction copyStyleAttrs(node, dataAttr, cachedAttr) {\r\n\t\tfor (var rule in dataAttr) if (hasOwn.call(dataAttr, rule)) {\r\n\t\t\tif (cachedAttr == null || cachedAttr[rule] !== dataAttr[rule]) {\r\n\t\t\t\tnode.style[rule] = dataAttr[rule]\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (rule in cachedAttr) if (hasOwn.call(cachedAttr, rule)) {\r\n\t\t\tif (!hasOwn.call(dataAttr, rule)) node.style[rule] = \"\"\r\n\t\t}\r\n\t}\r\n\r\n\tvar shouldUseSetAttribute = {\r\n\t\tlist: 1,\r\n\t\tstyle: 1,\r\n\t\tform: 1,\r\n\t\ttype: 1,\r\n\t\twidth: 1,\r\n\t\theight: 1\r\n\t}\r\n\r\n\tfunction setSingleAttr(\r\n\t\tnode,\r\n\t\tattrName,\r\n\t\tdataAttr,\r\n\t\tcachedAttr,\r\n\t\ttag,\r\n\t\tnamespace\r\n\t) {\r\n\t\tif (attrName === \"config\" || attrName === \"key\") {\r\n\t\t\t// `config` isn't a real attribute, so ignore it\r\n\t\t\treturn true\r\n\t\t} else if (isFunction(dataAttr) && attrName.slice(0, 2) === \"on\") {\r\n\t\t\t// hook event handlers to the auto-redrawing system\r\n\t\t\tnode[attrName] = autoredraw(dataAttr, node)\r\n\t\t} else if (attrName === \"style\" && dataAttr != null &&\r\n\t\t\t\tisObject(dataAttr)) {\r\n\t\t\t// handle `style: {...}`\r\n\t\t\tcopyStyleAttrs(node, dataAttr, cachedAttr)\r\n\t\t} else if (namespace != null) {\r\n\t\t\t// handle SVG\r\n\t\t\tif (attrName === \"href\") {\r\n\t\t\t\tnode.setAttributeNS(\"http://www.w3.org/1999/xlink\",\r\n\t\t\t\t\t\"href\", dataAttr)\r\n\t\t\t} else {\r\n\t\t\t\tnode.setAttribute(\r\n\t\t\t\t\tattrName === \"className\" ? \"class\" : attrName,\r\n\t\t\t\t\tdataAttr)\r\n\t\t\t}\r\n\t\t} else if (attrName in node && !shouldUseSetAttribute[attrName]) {\r\n\t\t\t// handle cases that are properties (but ignore cases where we\r\n\t\t\t// should use setAttribute instead)\r\n\t\t\t//\r\n\t\t\t// - list and form are typically used as strings, but are DOM\r\n\t\t\t// element references in js\r\n\t\t\t//\r\n\t\t\t// - when using CSS selectors (e.g. `m(\"[style='']\")`), style is\r\n\t\t\t// used as a string, but it's an object in js\r\n\t\t\t//\r\n\t\t\t// #348 don't set the value if not needed - otherwise, cursor\r\n\t\t\t// placement breaks in Chrome\r\n\t\t\ttry {\r\n\t\t\t\tif (tag !== \"input\" || node[attrName] !== dataAttr) {\r\n\t\t\t\t\tnode[attrName] = dataAttr\r\n\t\t\t\t}\r\n\t\t\t} catch (e) {\r\n\t\t\t\tnode.setAttribute(attrName, dataAttr)\r\n\t\t\t}\r\n\t\t}\r\n\t\telse node.setAttribute(attrName, dataAttr)\r\n\t}\r\n\r\n\tfunction trySetAttr(\r\n\t\tnode,\r\n\t\tattrName,\r\n\t\tdataAttr,\r\n\t\tcachedAttr,\r\n\t\tcachedAttrs,\r\n\t\ttag,\r\n\t\tnamespace\r\n\t) {\r\n\t\tif (!(attrName in cachedAttrs) || (cachedAttr !== dataAttr)) {\r\n\t\t\tcachedAttrs[attrName] = dataAttr\r\n\t\t\ttry {\r\n\t\t\t\treturn setSingleAttr(\r\n\t\t\t\t\tnode,\r\n\t\t\t\t\tattrName,\r\n\t\t\t\t\tdataAttr,\r\n\t\t\t\t\tcachedAttr,\r\n\t\t\t\t\ttag,\r\n\t\t\t\t\tnamespace)\r\n\t\t\t} catch (e) {\r\n\t\t\t\t// swallow IE's invalid argument errors to mimic HTML's\r\n\t\t\t\t// fallback-to-doing-nothing-on-invalid-attributes behavior\r\n\t\t\t\tif (e.message.indexOf(\"Invalid argument\") < 0) throw e\r\n\t\t\t}\r\n\t\t} else if (attrName === \"value\" && tag === \"input\" &&\r\n\t\t\t\tnode.value !== dataAttr) {\r\n\t\t\t// #348 dataAttr may not be a string, so use loose comparison\r\n\t\t\tnode.value = dataAttr\r\n\t\t}\r\n\t}\r\n\r\n\tfunction setAttributes(node, tag, dataAttrs, cachedAttrs, namespace) {\r\n\t\tfor (var attrName in dataAttrs) if (hasOwn.call(dataAttrs, attrName)) {\r\n\t\t\tif (trySetAttr(\r\n\t\t\t\t\tnode,\r\n\t\t\t\t\tattrName,\r\n\t\t\t\t\tdataAttrs[attrName],\r\n\t\t\t\t\tcachedAttrs[attrName],\r\n\t\t\t\t\tcachedAttrs,\r\n\t\t\t\t\ttag,\r\n\t\t\t\t\tnamespace)) {\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn cachedAttrs\r\n\t}\r\n\r\n\tfunction clear(nodes, cached) {\r\n\t\tfor (var i = nodes.length - 1; i > -1; i--) {\r\n\t\t\tif (nodes[i] && nodes[i].parentNode) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tnodes[i].parentNode.removeChild(nodes[i])\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\t/* eslint-disable max-len */\r\n\t\t\t\t\t// ignore if this fails due to order of events (see\r\n\t\t\t\t\t// http://stackoverflow.com/questions/21926083/failed-to-execute-removechild-on-node)\r\n\t\t\t\t\t/* eslint-enable max-len */\r\n\t\t\t\t}\r\n\t\t\t\tcached = [].concat(cached)\r\n\t\t\t\tif (cached[i]) unload(cached[i])\r\n\t\t\t}\r\n\t\t}\r\n\t\t// release memory if nodes is an array. This check should fail if nodes\r\n\t\t// is a NodeList (see loop above)\r\n\t\tif (nodes.length) {\r\n\t\t\tnodes.length = 0\r\n\t\t}\r\n\t}\r\n\r\n\tfunction unload(cached) {\r\n\t\tif (cached.configContext && isFunction(cached.configContext.onunload)) {\r\n\t\t\tcached.configContext.onunload()\r\n\t\t\tcached.configContext.onunload = null\r\n\t\t}\r\n\t\tif (cached.controllers) {\r\n\t\t\tforEach(cached.controllers, function (controller) {\r\n\t\t\t\tif (isFunction(controller.onunload)) {\r\n\t\t\t\t\tcontroller.onunload({preventDefault: noop})\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}\r\n\t\tif (cached.children) {\r\n\t\t\tif (isArray(cached.children)) forEach(cached.children, unload)\r\n\t\t\telse if (cached.children.tag) unload(cached.children)\r\n\t\t}\r\n\t}\r\n\r\n\tfunction appendTextFragment(parentElement, data) {\r\n\t\ttry {\r\n\t\t\tparentElement.appendChild(\r\n\t\t\t\t$document.createRange().createContextualFragment(data))\r\n\t\t} catch (e) {\r\n\t\t\tparentElement.insertAdjacentHTML(\"beforeend\", data)\r\n\t\t}\r\n\t}\r\n\r\n\tfunction injectHTML(parentElement, index, data) {\r\n\t\tvar nextSibling = parentElement.childNodes[index]\r\n\t\tif (nextSibling) {\r\n\t\t\tvar isElement = nextSibling.nodeType !== 1\r\n\t\t\tvar placeholder = $document.createElement(\"span\")\r\n\t\t\tif (isElement) {\r\n\t\t\t\tparentElement.insertBefore(placeholder, nextSibling || null)\r\n\t\t\t\tplaceholder.insertAdjacentHTML(\"beforebegin\", data)\r\n\t\t\t\tparentElement.removeChild(placeholder)\r\n\t\t\t} else {\r\n\t\t\t\tnextSibling.insertAdjacentHTML(\"beforebegin\", data)\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tappendTextFragment(parentElement, data)\r\n\t\t}\r\n\r\n\t\tvar nodes = []\r\n\r\n\t\twhile (parentElement.childNodes[index] !== nextSibling) {\r\n\t\t\tnodes.push(parentElement.childNodes[index])\r\n\t\t\tindex++\r\n\t\t}\r\n\r\n\t\treturn nodes\r\n\t}\r\n\r\n\tfunction autoredraw(callback, object) {\r\n\t\treturn function (e) {\r\n\t\t\te = e || event\r\n\t\t\tm.redraw.strategy(\"diff\")\r\n\t\t\tm.startComputation()\r\n\t\t\ttry {\r\n\t\t\t\treturn callback.call(object, e)\r\n\t\t\t} finally {\r\n\t\t\t\tendFirstComputation()\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tvar html\r\n\tvar documentNode = {\r\n\t\tappendChild: function (node) {\r\n\t\t\tif (html === undefined) html = $document.createElement(\"html\")\r\n\t\t\tif ($document.documentElement &&\r\n\t\t\t\t\t$document.documentElement !== node) {\r\n\t\t\t\t$document.replaceChild(node, $document.documentElement)\r\n\t\t\t} else {\r\n\t\t\t\t$document.appendChild(node)\r\n\t\t\t}\r\n\r\n\t\t\tthis.childNodes = $document.childNodes\r\n\t\t},\r\n\r\n\t\tinsertBefore: function (node) {\r\n\t\t\tthis.appendChild(node)\r\n\t\t},\r\n\r\n\t\tchildNodes: []\r\n\t}\r\n\r\n\tvar nodeCache = []\r\n\tvar cellCache = {}\r\n\r\n\tm.render = function (root, cell, forceRecreation) {\r\n\t\tif (!root) {\r\n\t\t\tthrow new Error(\"Ensure the DOM element being passed to \" +\r\n\t\t\t\t\"m.route/m.mount/m.render is not undefined.\")\r\n\t\t}\r\n\t\tvar configs = []\r\n\t\tvar id = getCellCacheKey(root)\r\n\t\tvar isDocumentRoot = root === $document\r\n\t\tvar node\r\n\r\n\t\tif (isDocumentRoot || root === $document.documentElement) {\r\n\t\t\tnode = documentNode\r\n\t\t} else {\r\n\t\t\tnode = root\r\n\t\t}\r\n\r\n\t\tif (isDocumentRoot && cell.tag !== \"html\") {\r\n\t\t\tcell = {tag: \"html\", attrs: {}, children: cell}\r\n\t\t}\r\n\r\n\t\tif (cellCache[id] === undefined) clear(node.childNodes)\r\n\t\tif (forceRecreation === true) reset(root)\r\n\r\n\t\tcellCache[id] = build(\r\n\t\t\tnode,\r\n\t\t\tnull,\r\n\t\t\tundefined,\r\n\t\t\tundefined,\r\n\t\t\tcell,\r\n\t\t\tcellCache[id],\r\n\t\t\tfalse,\r\n\t\t\t0,\r\n\t\t\tnull,\r\n\t\t\tundefined,\r\n\t\t\tconfigs)\r\n\r\n\t\tforEach(configs, function (config) { config() })\r\n\t}\r\n\r\n\tfunction getCellCacheKey(element) {\r\n\t\tvar index = nodeCache.indexOf(element)\r\n\t\treturn index < 0 ? nodeCache.push(element) - 1 : index\r\n\t}\r\n\r\n\tm.trust = function (value) {\r\n\t\tvalue = new String(value) // eslint-disable-line no-new-wrappers\r\n\t\tvalue.$trusted = true\r\n\t\treturn value\r\n\t}\r\n\r\n\tfunction gettersetter(store) {\r\n\t\tfunction prop() {\r\n\t\t\tif (arguments.length) store = arguments[0]\r\n\t\t\treturn store\r\n\t\t}\r\n\r\n\t\tprop.toJSON = function () {\r\n\t\t\treturn store\r\n\t\t}\r\n\r\n\t\treturn prop\r\n\t}\r\n\r\n\tm.prop = function (store) {\r\n\t\tif ((store != null && isObject(store) || isFunction(store)) &&\r\n\t\t\t\tisFunction(store.then)) {\r\n\t\t\treturn propify(store)\r\n\t\t}\r\n\r\n\t\treturn gettersetter(store)\r\n\t}\r\n\r\n\tvar roots = []\r\n\tvar components = []\r\n\tvar controllers = []\r\n\tvar lastRedrawId = null\r\n\tvar lastRedrawCallTime = 0\r\n\tvar computePreRedrawHook = null\r\n\tvar computePostRedrawHook = null\r\n\tvar topComponent\r\n\tvar FRAME_BUDGET = 16 // 60 frames per second = 1 call per 16 ms\r\n\r\n\tfunction parameterize(component, args) {\r\n\t\tfunction controller() {\r\n\t\t\t/* eslint-disable no-invalid-this */\r\n\t\t\treturn (component.controller || noop).apply(this, args) || this\r\n\t\t\t/* eslint-enable no-invalid-this */\r\n\t\t}\r\n\r\n\t\tif (component.controller) {\r\n\t\t\tcontroller.prototype = component.controller.prototype\r\n\t\t}\r\n\r\n\t\tfunction view(ctrl) {\r\n\t\t\tvar currentArgs = [ctrl].concat(args)\r\n\t\t\tfor (var i = 1; i < arguments.length; i++) {\r\n\t\t\t\tcurrentArgs.push(arguments[i])\r\n\t\t\t}\r\n\r\n\t\t\treturn component.view.apply(component, currentArgs)\r\n\t\t}\r\n\r\n\t\tview.$original = component.view\r\n\t\tvar output = {controller: controller, view: view}\r\n\t\tif (args[0] && args[0].key != null) output.attrs = {key: args[0].key}\r\n\t\treturn output\r\n\t}\r\n\r\n\tm.component = function (component) {\r\n\t\tvar args = [].slice.call(arguments, 1)\r\n\r\n\t\treturn parameterize(component, args)\r\n\t}\r\n\r\n\tfunction checkPrevented(component, root, index, isPrevented) {\r\n\t\tif (!isPrevented) {\r\n\t\t\tm.redraw.strategy(\"all\")\r\n\t\t\tm.startComputation()\r\n\t\t\troots[index] = root\r\n\t\t\tvar currentComponent\r\n\r\n\t\t\tif (component) {\r\n\t\t\t\tcurrentComponent = topComponent = component\r\n\t\t\t} else {\r\n\t\t\t\tcurrentComponent = topComponent = component = {controller: noop}\r\n\t\t\t}\r\n\r\n\t\t\tvar controller = new (component.controller || noop)()\r\n\r\n\t\t\t// controllers may call m.mount recursively (via m.route redirects,\r\n\t\t\t// for example)\r\n\t\t\t// this conditional ensures only the last recursive m.mount call is\r\n\t\t\t// applied\r\n\t\t\tif (currentComponent === topComponent) {\r\n\t\t\t\tcontrollers[index] = controller\r\n\t\t\t\tcomponents[index] = component\r\n\t\t\t}\r\n\t\t\tendFirstComputation()\r\n\t\t\tif (component === null) {\r\n\t\t\t\tremoveRootElement(root, index)\r\n\t\t\t}\r\n\t\t\treturn controllers[index]\r\n\t\t} else if (component == null) {\r\n\t\t\tremoveRootElement(root, index)\r\n\t\t}\r\n\t}\r\n\r\n\tm.mount = m.module = function (root, component) {\r\n\t\tif (!root) {\r\n\t\t\tthrow new Error(\"Please ensure the DOM element exists before \" +\r\n\t\t\t\t\"rendering a template into it.\")\r\n\t\t}\r\n\r\n\t\tvar index = roots.indexOf(root)\r\n\t\tif (index < 0) index = roots.length\r\n\r\n\t\tvar isPrevented = false\r\n\t\tvar event = {\r\n\t\t\tpreventDefault: function () {\r\n\t\t\t\tisPrevented = true\r\n\t\t\t\tcomputePreRedrawHook = computePostRedrawHook = null\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tforEach(unloaders, function (unloader) {\r\n\t\t\tunloader.handler.call(unloader.controller, event)\r\n\t\t\tunloader.controller.onunload = null\r\n\t\t})\r\n\r\n\t\tif (isPrevented) {\r\n\t\t\tforEach(unloaders, function (unloader) {\r\n\t\t\t\tunloader.controller.onunload = unloader.handler\r\n\t\t\t})\r\n\t\t} else {\r\n\t\t\tunloaders = []\r\n\t\t}\r\n\r\n\t\tif (controllers[index] && isFunction(controllers[index].onunload)) {\r\n\t\t\tcontrollers[index].onunload(event)\r\n\t\t}\r\n\r\n\t\treturn checkPrevented(component, root, index, isPrevented)\r\n\t}\r\n\r\n\tfunction removeRootElement(root, index) {\r\n\t\troots.splice(index, 1)\r\n\t\tcontrollers.splice(index, 1)\r\n\t\tcomponents.splice(index, 1)\r\n\t\treset(root)\r\n\t\tnodeCache.splice(getCellCacheKey(root), 1)\r\n\t}\r\n\r\n\tvar redrawing = false\r\n\tm.redraw = function (force) {\r\n\t\tif (redrawing) return\r\n\t\tredrawing = true\r\n\t\tif (force) forcing = true\r\n\r\n\t\ttry {\r\n\t\t\t// lastRedrawId is a positive number if a second redraw is requested\r\n\t\t\t// before the next animation frame\r\n\t\t\t// lastRedrawID is null if it's the first redraw and not an event\r\n\t\t\t// handler\r\n\t\t\tif (lastRedrawId && !force) {\r\n\t\t\t\t// when setTimeout: only reschedule redraw if time between now\r\n\t\t\t\t// and previous redraw is bigger than a frame, otherwise keep\r\n\t\t\t\t// currently scheduled timeout\r\n\t\t\t\t// when rAF: always reschedule redraw\r\n\t\t\t\tif ($requestAnimationFrame === global.requestAnimationFrame ||\r\n\t\t\t\t\t\tnew Date() - lastRedrawCallTime > FRAME_BUDGET) {\r\n\t\t\t\t\tif (lastRedrawId > 0) $cancelAnimationFrame(lastRedrawId)\r\n\t\t\t\t\tlastRedrawId = $requestAnimationFrame(redraw, FRAME_BUDGET)\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tredraw()\r\n\t\t\t\tlastRedrawId = $requestAnimationFrame(function () {\r\n\t\t\t\t\tlastRedrawId = null\r\n\t\t\t\t}, FRAME_BUDGET)\r\n\t\t\t}\r\n\t\t} finally {\r\n\t\t\tredrawing = forcing = false\r\n\t\t}\r\n\t}\r\n\r\n\tm.redraw.strategy = m.prop()\r\n\tfunction redraw() {\r\n\t\tif (computePreRedrawHook) {\r\n\t\t\tcomputePreRedrawHook()\r\n\t\t\tcomputePreRedrawHook = null\r\n\t\t}\r\n\t\tforEach(roots, function (root, i) {\r\n\t\t\tvar component = components[i]\r\n\t\t\tif (controllers[i]) {\r\n\t\t\t\tvar args = [controllers[i]]\r\n\t\t\t\tm.render(root,\r\n\t\t\t\t\tcomponent.view ? component.view(controllers[i], args) : \"\")\r\n\t\t\t}\r\n\t\t})\r\n\t\t// after rendering within a routed context, we need to scroll back to\r\n\t\t// the top, and fetch the document title for history.pushState\r\n\t\tif (computePostRedrawHook) {\r\n\t\t\tcomputePostRedrawHook()\r\n\t\t\tcomputePostRedrawHook = null\r\n\t\t}\r\n\t\tlastRedrawId = null\r\n\t\tlastRedrawCallTime = new Date()\r\n\t\tm.redraw.strategy(\"diff\")\r\n\t}\r\n\r\n\tfunction endFirstComputation() {\r\n\t\tif (m.redraw.strategy() === \"none\") {\r\n\t\t\tpendingRequests--\r\n\t\t\tm.redraw.strategy(\"diff\")\r\n\t\t} else {\r\n\t\t\tm.endComputation()\r\n\t\t}\r\n\t}\r\n\r\n\tm.withAttr = function (prop, withAttrCallback, callbackThis) {\r\n\t\treturn function (e) {\r\n\t\t\te = e || event\r\n\t\t\t/* eslint-disable no-invalid-this */\r\n\t\t\tvar currentTarget = e.currentTarget || this\r\n\t\t\tvar _this = callbackThis || this\r\n\t\t\t/* eslint-enable no-invalid-this */\r\n\t\t\tvar target = prop in currentTarget ?\r\n\t\t\t\tcurrentTarget[prop] :\r\n\t\t\t\tcurrentTarget.getAttribute(prop)\r\n\t\t\twithAttrCallback.call(_this, target)\r\n\t\t}\r\n\t}\r\n\r\n\t// routing\r\n\tvar modes = {pathname: \"\", hash: \"#\", search: \"?\"}\r\n\tvar redirect = noop\r\n\tvar isDefaultRoute = false\r\n\tvar routeParams, currentRoute\r\n\r\n\tm.route = function (root, arg1, arg2, vdom) { // eslint-disable-line\r\n\t\t// m.route()\r\n\t\tif (arguments.length === 0) return currentRoute\r\n\t\t// m.route(el, defaultRoute, routes)\r\n\t\tif (arguments.length === 3 && isString(arg1)) {\r\n\t\t\tredirect = function (source) {\r\n\t\t\t\tvar path = currentRoute = normalizeRoute(source)\r\n\t\t\t\tif (!routeByValue(root, arg2, path)) {\r\n\t\t\t\t\tif (isDefaultRoute) {\r\n\t\t\t\t\t\tthrow new Error(\"Ensure the default route matches \" +\r\n\t\t\t\t\t\t\t\"one of the routes defined in m.route\")\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tisDefaultRoute = true\r\n\t\t\t\t\tm.route(arg1, true)\r\n\t\t\t\t\tisDefaultRoute = false\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tvar listener = m.route.mode === \"hash\" ?\r\n\t\t\t\t\"onhashchange\" :\r\n\t\t\t\t\"onpopstate\"\r\n\r\n\t\t\tglobal[listener] = function () {\r\n\t\t\t\tvar path = $location[m.route.mode]\r\n\t\t\t\tif (m.route.mode === \"pathname\") path += $location.search\r\n\t\t\t\tif (currentRoute !== normalizeRoute(path)) redirect(path)\r\n\t\t\t}\r\n\r\n\t\t\tcomputePreRedrawHook = setScroll\r\n\t\t\tglobal[listener]()\r\n\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\t// config: m.route\r\n\t\tif (root.addEventListener || root.attachEvent) {\r\n\t\t\tvar base = m.route.mode !== \"pathname\" ? $location.pathname : \"\"\r\n\t\t\troot.href = base + modes[m.route.mode] + vdom.attrs.href\r\n\t\t\tif (root.addEventListener) {\r\n\t\t\t\troot.removeEventListener(\"click\", routeUnobtrusive)\r\n\t\t\t\troot.addEventListener(\"click\", routeUnobtrusive)\r\n\t\t\t} else {\r\n\t\t\t\troot.detachEvent(\"onclick\", routeUnobtrusive)\r\n\t\t\t\troot.attachEvent(\"onclick\", routeUnobtrusive)\r\n\t\t\t}\r\n\r\n\t\t\treturn\r\n\t\t}\r\n\t\t// m.route(route, params, shouldReplaceHistoryEntry)\r\n\t\tif (isString(root)) {\r\n\t\t\tvar oldRoute = currentRoute\r\n\t\t\tcurrentRoute = root\r\n\r\n\t\t\tvar args = arg1 || {}\r\n\t\t\tvar queryIndex = currentRoute.indexOf(\"?\")\r\n\t\t\tvar params\r\n\r\n\t\t\tif (queryIndex > -1) {\r\n\t\t\t\tparams = parseQueryString(currentRoute.slice(queryIndex + 1))\r\n\t\t\t} else {\r\n\t\t\t\tparams = {}\r\n\t\t\t}\r\n\r\n\t\t\tfor (var i in args) if (hasOwn.call(args, i)) {\r\n\t\t\t\tparams[i] = args[i]\r\n\t\t\t}\r\n\r\n\t\t\tvar querystring = buildQueryString(params)\r\n\t\t\tvar currentPath\r\n\r\n\t\t\tif (queryIndex > -1) {\r\n\t\t\t\tcurrentPath = currentRoute.slice(0, queryIndex)\r\n\t\t\t} else {\r\n\t\t\t\tcurrentPath = currentRoute\r\n\t\t\t}\r\n\r\n\t\t\tif (querystring) {\r\n\t\t\t\tcurrentRoute = currentPath +\r\n\t\t\t\t\t(currentPath.indexOf(\"?\") === -1 ? \"?\" : \"&\") +\r\n\t\t\t\t\tquerystring\r\n\t\t\t}\r\n\r\n\t\t\tvar replaceHistory =\r\n\t\t\t\t(arguments.length === 3 ? arg2 : arg1) === true ||\r\n\t\t\t\toldRoute === root\r\n\r\n\t\t\tif (global.history.pushState) {\r\n\t\t\t\tvar method = replaceHistory ? \"replaceState\" : \"pushState\"\r\n\t\t\t\tcomputePreRedrawHook = setScroll\r\n\t\t\t\tcomputePostRedrawHook = function () {\r\n\t\t\t\t\tglobal.history[method](null, $document.title,\r\n\t\t\t\t\t\tmodes[m.route.mode] + currentRoute)\r\n\t\t\t\t}\r\n\t\t\t\tredirect(modes[m.route.mode] + currentRoute)\r\n\t\t\t} else {\r\n\t\t\t\t$location[m.route.mode] = currentRoute\r\n\t\t\t\tredirect(modes[m.route.mode] + currentRoute)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tm.route.param = function (key) {\r\n\t\tif (!routeParams) {\r\n\t\t\tthrow new Error(\"You must call m.route(element, defaultRoute, \" +\r\n\t\t\t\t\"routes) before calling m.route.param()\")\r\n\t\t}\r\n\r\n\t\tif (!key) {\r\n\t\t\treturn routeParams\r\n\t\t}\r\n\r\n\t\treturn routeParams[key]\r\n\t}\r\n\r\n\tm.route.mode = \"search\"\r\n\r\n\tfunction normalizeRoute(route) {\r\n\t\treturn route.slice(modes[m.route.mode].length)\r\n\t}\r\n\r\n\tfunction routeByValue(root, router, path) {\r\n\t\trouteParams = {}\r\n\r\n\t\tvar queryStart = path.indexOf(\"?\")\r\n\t\tif (queryStart !== -1) {\r\n\t\t\trouteParams = parseQueryString(\r\n\t\t\t\tpath.substr(queryStart + 1, path.length))\r\n\t\t\tpath = path.substr(0, queryStart)\r\n\t\t}\r\n\r\n\t\t// Get all routes and check if there's\r\n\t\t// an exact match for the current path\r\n\t\tvar keys = Object.keys(router)\r\n\t\tvar index = keys.indexOf(path)\r\n\r\n\t\tif (index !== -1){\r\n\t\t\tm.mount(root, router[keys [index]])\r\n\t\t\treturn true\r\n\t\t}\r\n\r\n\t\tfor (var route in router) if (hasOwn.call(router, route)) {\r\n\t\t\tif (route === path) {\r\n\t\t\t\tm.mount(root, router[route])\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\r\n\t\t\tvar matcher = new RegExp(\"^\" + route\r\n\t\t\t\t.replace(/:[^\\/]+?\\.{3}/g, \"(.*?)\")\r\n\t\t\t\t.replace(/:[^\\/]+/g, \"([^\\\\/]+)\") + \"\\/?$\")\r\n\r\n\t\t\tif (matcher.test(path)) {\r\n\t\t\t\t/* eslint-disable no-loop-func */\r\n\t\t\t\tpath.replace(matcher, function () {\r\n\t\t\t\t\tvar keys = route.match(/:[^\\/]+/g) || []\r\n\t\t\t\t\tvar values = [].slice.call(arguments, 1, -2)\r\n\t\t\t\t\tforEach(keys, function (key, i) {\r\n\t\t\t\t\t\trouteParams[key.replace(/:|\\./g, \"\")] =\r\n\t\t\t\t\t\t\tdecodeURIComponent(values[i])\r\n\t\t\t\t\t})\r\n\t\t\t\t\tm.mount(root, router[route])\r\n\t\t\t\t})\r\n\t\t\t\t/* eslint-enable no-loop-func */\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tfunction routeUnobtrusive(e) {\r\n\t\te = e || event\r\n\t\tif (e.ctrlKey || e.metaKey || e.shiftKey || e.which === 2) return\r\n\r\n\t\tif (e.preventDefault) {\r\n\t\t\te.preventDefault()\r\n\t\t} else {\r\n\t\t\te.returnValue = false\r\n\t\t}\r\n\r\n\t\tvar currentTarget = e.currentTarget || e.srcElement\r\n\t\tvar args\r\n\r\n\t\tif (m.route.mode === \"pathname\" && currentTarget.search) {\r\n\t\t\targs = parseQueryString(currentTarget.search.slice(1))\r\n\t\t} else {\r\n\t\t\targs = {}\r\n\t\t}\r\n\r\n\t\twhile (currentTarget && !/a/i.test(currentTarget.nodeName)) {\r\n\t\t\tcurrentTarget = currentTarget.parentNode\r\n\t\t}\r\n\r\n\t\t// clear pendingRequests because we want an immediate route change\r\n\t\tpendingRequests = 0\r\n\t\tm.route(currentTarget[m.route.mode]\r\n\t\t\t.slice(modes[m.route.mode].length), args)\r\n\t}\r\n\r\n\tfunction setScroll() {\r\n\t\tif (m.route.mode !== \"hash\" && $location.hash) {\r\n\t\t\t$location.hash = $location.hash\r\n\t\t} else {\r\n\t\t\tglobal.scrollTo(0, 0)\r\n\t\t}\r\n\t}\r\n\r\n\tfunction buildQueryString(object, prefix) {\r\n\t\tvar duplicates = {}\r\n\t\tvar str = []\r\n\r\n\t\tfor (var prop in object) if (hasOwn.call(object, prop)) {\r\n\t\t\tvar key = prefix ? prefix + \"[\" + prop + \"]\" : prop\r\n\t\t\tvar value = object[prop]\r\n\r\n\t\t\tif (value === null) {\r\n\t\t\t\tstr.push(encodeURIComponent(key))\r\n\t\t\t} else if (isObject(value)) {\r\n\t\t\t\tstr.push(buildQueryString(value, key))\r\n\t\t\t} else if (isArray(value)) {\r\n\t\t\t\tvar keys = []\r\n\t\t\t\tduplicates[key] = duplicates[key] || {}\r\n\t\t\t\t/* eslint-disable no-loop-func */\r\n\t\t\t\tforEach(value, function (item) {\r\n\t\t\t\t\t/* eslint-enable no-loop-func */\r\n\t\t\t\t\tif (!duplicates[key][item]) {\r\n\t\t\t\t\t\tduplicates[key][item] = true\r\n\t\t\t\t\t\tkeys.push(encodeURIComponent(key) + \"=\" +\r\n\t\t\t\t\t\t\tencodeURIComponent(item))\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tstr.push(keys.join(\"&\"))\r\n\t\t\t} else if (value !== undefined) {\r\n\t\t\t\tstr.push(encodeURIComponent(key) + \"=\" +\r\n\t\t\t\t\tencodeURIComponent(value))\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn str.join(\"&\")\r\n\t}\r\n\r\n\tfunction parseQueryString(str) {\r\n\t\tif (str === \"\" || str == null) return {}\r\n\t\tif (str.charAt(0) === \"?\") str = str.slice(1)\r\n\r\n\t\tvar pairs = str.split(\"&\")\r\n\t\tvar params = {}\r\n\r\n\t\tforEach(pairs, function (string) {\r\n\t\t\tvar pair = string.split(\"=\")\r\n\t\t\tvar key = decodeURIComponent(pair[0])\r\n\t\t\tvar value = pair.length === 2 ? decodeURIComponent(pair[1]) : null\r\n\t\t\tif (params[key] != null) {\r\n\t\t\t\tif (!isArray(params[key])) params[key] = [params[key]]\r\n\t\t\t\tparams[key].push(value)\r\n\t\t\t}\r\n\t\t\telse params[key] = value\r\n\t\t})\r\n\r\n\t\treturn params\r\n\t}\r\n\r\n\tm.route.buildQueryString = buildQueryString\r\n\tm.route.parseQueryString = parseQueryString\r\n\r\n\tfunction reset(root) {\r\n\t\tvar cacheKey = getCellCacheKey(root)\r\n\t\tclear(root.childNodes, cellCache[cacheKey])\r\n\t\tcellCache[cacheKey] = undefined\r\n\t}\r\n\r\n\tm.deferred = function () {\r\n\t\tvar deferred = new Deferred()\r\n\t\tdeferred.promise = propify(deferred.promise)\r\n\t\treturn deferred\r\n\t}\r\n\r\n\tfunction propify(promise, initialValue) {\r\n\t\tvar prop = m.prop(initialValue)\r\n\t\tpromise.then(prop)\r\n\t\tprop.then = function (resolve, reject) {\r\n\t\t\treturn propify(promise.then(resolve, reject), initialValue)\r\n\t\t}\r\n\r\n\t\tprop.catch = prop.then.bind(null, null)\r\n\t\treturn prop\r\n\t}\r\n\t// Promiz.mithril.js | Zolmeister | MIT\r\n\t// a modified version of Promiz.js, which does not conform to Promises/A+\r\n\t// for two reasons:\r\n\t//\r\n\t// 1) `then` callbacks are called synchronously (because setTimeout is too\r\n\t// slow, and the setImmediate polyfill is too big\r\n\t//\r\n\t// 2) throwing subclasses of Error cause the error to be bubbled up instead\r\n\t// of triggering rejection (because the spec does not account for the\r\n\t// important use case of default browser error handling, i.e. message w/\r\n\t// line number)\r\n\r\n\tvar RESOLVING = 1\r\n\tvar REJECTING = 2\r\n\tvar RESOLVED = 3\r\n\tvar REJECTED = 4\r\n\r\n\tfunction Deferred(onSuccess, onFailure) {\r\n\t\tvar self = this\r\n\t\tvar state = 0\r\n\t\tvar promiseValue = 0\r\n\t\tvar next = []\r\n\r\n\t\tself.promise = {}\r\n\r\n\t\tself.resolve = function (value) {\r\n\t\t\tif (!state) {\r\n\t\t\t\tpromiseValue = value\r\n\t\t\t\tstate = RESOLVING\r\n\r\n\t\t\t\tfire()\r\n\t\t\t}\r\n\r\n\t\t\treturn self\r\n\t\t}\r\n\r\n\t\tself.reject = function (value) {\r\n\t\t\tif (!state) {\r\n\t\t\t\tpromiseValue = value\r\n\t\t\t\tstate = REJECTING\r\n\r\n\t\t\t\tfire()\r\n\t\t\t}\r\n\r\n\t\t\treturn self\r\n\t\t}\r\n\r\n\t\tself.promise.then = function (onSuccess, onFailure) {\r\n\t\t\tvar deferred = new Deferred(onSuccess, onFailure)\r\n\r\n\t\t\tif (state === RESOLVED) {\r\n\t\t\t\tdeferred.resolve(promiseValue)\r\n\t\t\t} else if (state === REJECTED) {\r\n\t\t\t\tdeferred.reject(promiseValue)\r\n\t\t\t} else {\r\n\t\t\t\tnext.push(deferred)\r\n\t\t\t}\r\n\r\n\t\t\treturn deferred.promise\r\n\t\t}\r\n\r\n\t\tfunction finish(type) {\r\n\t\t\tstate = type || REJECTED\r\n\t\t\tnext.map(function (deferred) {\r\n\t\t\t\tif (state === RESOLVED) {\r\n\t\t\t\t\tdeferred.resolve(promiseValue)\r\n\t\t\t\t} else {\r\n\t\t\t\t\tdeferred.reject(promiseValue)\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tfunction thennable(then, success, failure, notThennable) {\r\n\t\t\tif (((promiseValue != null && isObject(promiseValue)) ||\r\n\t\t\t\t\tisFunction(promiseValue)) && isFunction(then)) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\t// count protects against abuse calls from spec checker\r\n\t\t\t\t\tvar count = 0\r\n\t\t\t\t\tthen.call(promiseValue, function (value) {\r\n\t\t\t\t\t\tif (count++) return\r\n\t\t\t\t\t\tpromiseValue = value\r\n\t\t\t\t\t\tsuccess()\r\n\t\t\t\t\t}, function (value) {\r\n\t\t\t\t\t\tif (count++) return\r\n\t\t\t\t\t\tpromiseValue = value\r\n\t\t\t\t\t\tfailure()\r\n\t\t\t\t\t})\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tm.deferred.onerror(e)\r\n\t\t\t\t\tpromiseValue = e\r\n\t\t\t\t\tfailure()\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tnotThennable()\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfunction fire() {\r\n\t\t\t// check if it's a thenable\r\n\t\t\tvar then\r\n\t\t\ttry {\r\n\t\t\t\tthen = promiseValue && promiseValue.then\r\n\t\t\t} catch (e) {\r\n\t\t\t\tm.deferred.onerror(e)\r\n\t\t\t\tpromiseValue = e\r\n\t\t\t\tstate = REJECTING\r\n\t\t\t\treturn fire()\r\n\t\t\t}\r\n\r\n\t\t\tif (state === REJECTING) {\r\n\t\t\t\tm.deferred.onerror(promiseValue)\r\n\t\t\t}\r\n\r\n\t\t\tthennable(then, function () {\r\n\t\t\t\tstate = RESOLVING\r\n\t\t\t\tfire()\r\n\t\t\t}, function () {\r\n\t\t\t\tstate = REJECTING\r\n\t\t\t\tfire()\r\n\t\t\t}, function () {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tif (state === RESOLVING && isFunction(onSuccess)) {\r\n\t\t\t\t\t\tpromiseValue = onSuccess(promiseValue)\r\n\t\t\t\t\t} else if (state === REJECTING && isFunction(onFailure)) {\r\n\t\t\t\t\t\tpromiseValue = onFailure(promiseValue)\r\n\t\t\t\t\t\tstate = RESOLVING\r\n\t\t\t\t\t}\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tm.deferred.onerror(e)\r\n\t\t\t\t\tpromiseValue = e\r\n\t\t\t\t\treturn finish()\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (promiseValue === self) {\r\n\t\t\t\t\tpromiseValue = TypeError()\r\n\t\t\t\t\tfinish()\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthennable(then, function () {\r\n\t\t\t\t\t\tfinish(RESOLVED)\r\n\t\t\t\t\t}, finish, function () {\r\n\t\t\t\t\t\tfinish(state === RESOLVING && RESOLVED)\r\n\t\t\t\t\t})\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}\r\n\t}\r\n\r\n\tm.deferred.onerror = function (e) {\r\n\t\tif (type.call(e) === \"[object Error]\" &&\r\n\t\t\t\t!/ Error/.test(e.constructor.toString())) {\r\n\t\t\tpendingRequests = 0\r\n\t\t\tthrow e\r\n\t\t}\r\n\t}\r\n\r\n\tm.sync = function (args) {\r\n\t\tvar deferred = m.deferred()\r\n\t\tvar outstanding = args.length\r\n\t\tvar results = new Array(outstanding)\r\n\t\tvar method = \"resolve\"\r\n\r\n\t\tfunction synchronizer(pos, resolved) {\r\n\t\t\treturn function (value) {\r\n\t\t\t\tresults[pos] = value\r\n\t\t\t\tif (!resolved) method = \"reject\"\r\n\t\t\t\tif (--outstanding === 0) {\r\n\t\t\t\t\tdeferred.promise(results)\r\n\t\t\t\t\tdeferred[method](results)\r\n\t\t\t\t}\r\n\t\t\t\treturn value\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (args.length > 0) {\r\n\t\t\tforEach(args, function (arg, i) {\r\n\t\t\t\targ.then(synchronizer(i, true), synchronizer(i, false))\r\n\t\t\t})\r\n\t\t} else {\r\n\t\t\tdeferred.resolve([])\r\n\t\t}\r\n\r\n\t\treturn deferred.promise\r\n\t}\r\n\r\n\tfunction identity(value) { return value }\r\n\r\n\tfunction handleJsonp(options) {\r\n\t\tvar callbackKey = \"mithril_callback_\" +\r\n\t\t\tnew Date().getTime() + \"_\" +\r\n\t\t\t(Math.round(Math.random() * 1e16)).toString(36)\r\n\r\n\t\tvar script = $document.createElement(\"script\")\r\n\r\n\t\tglobal[callbackKey] = function (resp) {\r\n\t\t\tscript.parentNode.removeChild(script)\r\n\t\t\toptions.onload({\r\n\t\t\t\ttype: \"load\",\r\n\t\t\t\ttarget: {\r\n\t\t\t\t\tresponseText: resp\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\tglobal[callbackKey] = undefined\r\n\t\t}\r\n\r\n\t\tscript.onerror = function () {\r\n\t\t\tscript.parentNode.removeChild(script)\r\n\r\n\t\t\toptions.onerror({\r\n\t\t\t\ttype: \"error\",\r\n\t\t\t\ttarget: {\r\n\t\t\t\t\tstatus: 500,\r\n\t\t\t\t\tresponseText: JSON.stringify({\r\n\t\t\t\t\t\terror: \"Error making jsonp request\"\r\n\t\t\t\t\t})\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\tglobal[callbackKey] = undefined\r\n\r\n\t\t\treturn false\r\n\t\t}\r\n\r\n\t\tscript.onload = function () {\r\n\t\t\treturn false\r\n\t\t}\r\n\r\n\t\tscript.src = options.url +\r\n\t\t\t(options.url.indexOf(\"?\") > 0 ? \"&\" : \"?\") +\r\n\t\t\t(options.callbackKey ? options.callbackKey : \"callback\") +\r\n\t\t\t\"=\" + callbackKey +\r\n\t\t\t\"&\" + buildQueryString(options.data || {})\r\n\r\n\t\t$document.body.appendChild(script)\r\n\t}\r\n\r\n\tfunction createXhr(options) {\r\n\t\tvar xhr = new global.XMLHttpRequest()\r\n\t\txhr.open(options.method, options.url, true, options.user,\r\n\t\t\toptions.password)\r\n\r\n\t\txhr.onreadystatechange = function () {\r\n\t\t\tif (xhr.readyState === 4) {\r\n\t\t\t\tif (xhr.status >= 200 && xhr.status < 300) {\r\n\t\t\t\t\toptions.onload({type: \"load\", target: xhr})\r\n\t\t\t\t} else {\r\n\t\t\t\t\toptions.onerror({type: \"error\", target: xhr})\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (options.serialize === JSON.stringify &&\r\n\t\t\t\toptions.data &&\r\n\t\t\t\toptions.method !== \"GET\") {\r\n\t\t\txhr.setRequestHeader(\"Content-Type\",\r\n\t\t\t\t\"application/json; charset=utf-8\")\r\n\t\t}\r\n\r\n\t\tif (options.deserialize === JSON.parse) {\r\n\t\t\txhr.setRequestHeader(\"Accept\", \"application/json, text/*\")\r\n\t\t}\r\n\r\n\t\tif (isFunction(options.config)) {\r\n\t\t\tvar maybeXhr = options.config(xhr, options)\r\n\t\t\tif (maybeXhr != null) xhr = maybeXhr\r\n\t\t}\r\n\r\n\t\tvar data = options.method === \"GET\" || !options.data ? \"\" : options.data\r\n\r\n\t\tif (data && !isString(data) && data.constructor !== global.FormData) {\r\n\t\t\tthrow new Error(\"Request data should be either be a string or \" +\r\n\t\t\t\t\"FormData. Check the `serialize` option in `m.request`\")\r\n\t\t}\r\n\r\n\t\txhr.send(data)\r\n\t\treturn xhr\r\n\t}\r\n\r\n\tfunction ajax(options) {\r\n\t\tif (options.dataType && options.dataType.toLowerCase() === \"jsonp\") {\r\n\t\t\treturn handleJsonp(options)\r\n\t\t} else {\r\n\t\t\treturn createXhr(options)\r\n\t\t}\r\n\t}\r\n\r\n\tfunction bindData(options, data, serialize) {\r\n\t\tif (options.method === \"GET\" && options.dataType !== \"jsonp\") {\r\n\t\t\tvar prefix = options.url.indexOf(\"?\") < 0 ? \"?\" : \"&\"\r\n\t\t\tvar querystring = buildQueryString(data)\r\n\t\t\toptions.url += (querystring ? prefix + querystring : \"\")\r\n\t\t} else {\r\n\t\t\toptions.data = serialize(data)\r\n\t\t}\r\n\t}\r\n\r\n\tfunction parameterizeUrl(url, data) {\r\n\t\tif (data) {\r\n\t\t\turl = url.replace(/:[a-z]\\w+/gi, function(token){\r\n\t\t\t\tvar key = token.slice(1)\r\n\t\t\t\tvar value = data[key]\r\n\t\t\t\tdelete data[key]\r\n\t\t\t\treturn value\r\n\t\t\t})\r\n\t\t}\r\n\t\treturn url\r\n\t}\r\n\r\n\tm.request = function (options) {\r\n\t\tif (options.background !== true) m.startComputation()\r\n\t\tvar deferred = new Deferred()\r\n\t\tvar isJSONP = options.dataType &&\r\n\t\t\toptions.dataType.toLowerCase() === \"jsonp\"\r\n\r\n\t\tvar serialize, deserialize, extract\r\n\r\n\t\tif (isJSONP) {\r\n\t\t\tserialize = options.serialize =\r\n\t\t\tdeserialize = options.deserialize = identity\r\n\r\n\t\t\textract = function (jsonp) { return jsonp.responseText }\r\n\t\t} else {\r\n\t\t\tserialize = options.serialize = options.serialize || JSON.stringify\r\n\r\n\t\t\tdeserialize = options.deserialize =\r\n\t\t\t\toptions.deserialize || JSON.parse\r\n\t\t\textract = options.extract || function (xhr) {\r\n\t\t\t\tif (xhr.responseText.length || deserialize !== JSON.parse) {\r\n\t\t\t\t\treturn xhr.responseText\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn null\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\toptions.method = (options.method || \"GET\").toUpperCase()\r\n\t\toptions.url = parameterizeUrl(options.url, options.data)\r\n\t\tbindData(options, options.data, serialize)\r\n\t\toptions.onload = options.onerror = function (ev) {\r\n\t\t\ttry {\r\n\t\t\t\tev = ev || event\r\n\t\t\t\tvar response = deserialize(extract(ev.target, options))\r\n\t\t\t\tif (ev.type === \"load\") {\r\n\t\t\t\t\tif (options.unwrapSuccess) {\r\n\t\t\t\t\t\tresponse = options.unwrapSuccess(response, ev.target)\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (isArray(response) && options.type) {\r\n\t\t\t\t\t\tforEach(response, function (res, i) {\r\n\t\t\t\t\t\t\tresponse[i] = new options.type(res)\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t} else if (options.type) {\r\n\t\t\t\t\t\tresponse = new options.type(response)\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tdeferred.resolve(response)\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (options.unwrapError) {\r\n\t\t\t\t\t\tresponse = options.unwrapError(response, ev.target)\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tdeferred.reject(response)\r\n\t\t\t\t}\r\n\t\t\t} catch (e) {\r\n\t\t\t\tdeferred.reject(e)\r\n\t\t\t} finally {\r\n\t\t\t\tif (options.background !== true) m.endComputation()\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tajax(options)\r\n\t\tdeferred.promise = propify(deferred.promise, options.initialValue)\r\n\t\treturn deferred.promise\r\n\t}\r\n\r\n\treturn m\r\n})\r\n\n},{}],7:[function(require,module,exports){\n/*!\n * EventEmitter v4.2.11 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function () {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var exports = this;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n i = listeners.length;\n\n while (i--) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}.call(this));\n\n},{}]},{},[1]);\n })();"],"sourceRoot":"/source/"}
assets/js/forms-admin.js CHANGED
@@ -896,8 +896,8 @@ module.exports = function(m, events) {
896
  var FormEditor = function(element) {
897
 
898
  // create dom representation of form
899
- var _dom = document.createElement('form')
900
- , domDirty = false,
901
  r = {},
902
  editor;
903
  _dom.innerHTML = element.value.toLowerCase();
@@ -3062,6 +3062,7 @@ module.exports = render;
3062
 
3063
  d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
3064
  d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
 
3065
 
3066
  if (sizes.right && sizes.bottom) {
3067
  d.scrollbarFiller.style.display = "block";
@@ -3306,9 +3307,9 @@ module.exports = render;
3306
 
3307
  function setDocumentHeight(cm, measure) {
3308
  cm.display.sizer.style.minHeight = measure.docHeight + "px";
3309
- var total = measure.docHeight + cm.display.barHeight;
3310
- cm.display.heightForcer.style.top = total + "px";
3311
- cm.display.gutters.style.height = Math.max(total + scrollGap(cm), measure.clientHeight) + "px";
3312
  }
3313
 
3314
  // Read the actual heights of the rendered lines, and update their
@@ -4001,10 +4002,11 @@ module.exports = render;
4001
  if (reset && cm.doc.sel.contains(pos) == -1)
4002
  operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);
4003
 
4004
- var oldCSS = te.style.cssText;
4005
- input.wrapper.style.position = "absolute";
4006
- te.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) +
4007
- "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: " +
 
4008
  (ie ? "rgba(255, 255, 255, .05)" : "transparent") +
4009
  "; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
4010
  if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712)
@@ -4035,7 +4037,7 @@ module.exports = render;
4035
  }
4036
  function rehide() {
4037
  input.contextMenuPending = false;
4038
- input.wrapper.style.position = "relative";
4039
  te.style.cssText = oldCSS;
4040
  if (ie && ie_version < 9) display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos);
4041
 
@@ -5658,7 +5660,7 @@ module.exports = render;
5658
  display.scroller.scrollTop = doc.scrollTop;
5659
  }
5660
  if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {
5661
- doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - displayWidth(cm), op.scrollLeft));
5662
  display.scrollbars.setScrollLeft(doc.scrollLeft);
5663
  display.scroller.scrollLeft = doc.scrollLeft;
5664
  alignHorizontally(cm);
@@ -11403,7 +11405,7 @@ module.exports = render;
11403
 
11404
  // THE END
11405
 
11406
- CodeMirror.version = "5.11.0";
11407
 
11408
  return CodeMirror;
11409
  });
@@ -12282,13 +12284,9 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
12282
  return attrRegexpCache[attr] = new RegExp("\\s+" + attr + "\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*");
12283
  }
12284
 
12285
- function getAttrValue(stream, attr) {
12286
- var pos = stream.pos, match;
12287
- while (pos >= 0 && stream.string.charAt(pos) !== "<") pos--;
12288
- if (pos < 0) return pos;
12289
- if (match = stream.string.slice(pos, stream.pos).match(getAttrRegexp(attr)))
12290
- return match[2];
12291
- return "";
12292
  }
12293
 
12294
  function getTagRegexp(tagName, anchored) {
@@ -12304,10 +12302,10 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
12304
  }
12305
  }
12306
 
12307
- function findMatchingMode(tagInfo, stream) {
12308
  for (var i = 0; i < tagInfo.length; i++) {
12309
  var spec = tagInfo[i];
12310
- if (!spec[0] || spec[1].test(getAttrValue(stream, spec[0]))) return spec[2];
12311
  }
12312
  }
12313
 
@@ -12327,15 +12325,17 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
12327
  tags.script.unshift(["type", configScript[i].matches, configScript[i].mode])
12328
 
12329
  function html(stream, state) {
12330
- var tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase();
12331
- var tagInfo = tagName && tags.hasOwnProperty(tagName) && tags[tagName];
12332
-
12333
- var style = htmlMode.token(stream, state.htmlState), modeSpec;
12334
-
12335
- if (tagInfo && /\btag\b/.test(style) && stream.current() === ">" &&
12336
- (modeSpec = findMatchingMode(tagInfo, stream))) {
12337
- var mode = CodeMirror.getMode(config, modeSpec);
12338
- var endTagA = getTagRegexp(tagName, true), endTag = getTagRegexp(tagName, false);
 
 
12339
  state.token = function (stream, state) {
12340
  if (stream.match(endTagA, false)) {
12341
  state.token = html;
@@ -12346,6 +12346,9 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
12346
  };
12347
  state.localMode = mode;
12348
  state.localState = CodeMirror.startState(mode, htmlMode.indent(state.htmlState, ""));
 
 
 
12349
  }
12350
  return style;
12351
  };
@@ -12353,7 +12356,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
12353
  return {
12354
  startState: function () {
12355
  var state = htmlMode.startState();
12356
- return {token: html, localMode: null, localState: null, htmlState: state};
12357
  },
12358
 
12359
  copyState: function (state) {
@@ -12361,7 +12364,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
12361
  if (state.localState) {
12362
  local = CodeMirror.copyState(state.localMode, state.localState);
12363
  }
12364
- return {token: state.token, localMode: state.localMode, localState: local,
 
12365
  htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
12366
  },
12367
 
@@ -13371,7 +13375,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
13371
  if (state.context && state.context.tagName != tagName &&
13372
  config.implicitlyClosed.hasOwnProperty(state.context.tagName))
13373
  popContext(state);
13374
- if (state.context && state.context.tagName == tagName) {
13375
  setStyle = "tag";
13376
  return closeState;
13377
  } else {
896
  var FormEditor = function(element) {
897
 
898
  // create dom representation of form
899
+ var _dom = document.createElement('form'),
900
+ domDirty = false,
901
  r = {},
902
  editor;
903
  _dom.innerHTML = element.value.toLowerCase();
3062
 
3063
  d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
3064
  d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
3065
+ d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent"
3066
 
3067
  if (sizes.right && sizes.bottom) {
3068
  d.scrollbarFiller.style.display = "block";
3307
 
3308
  function setDocumentHeight(cm, measure) {
3309
  cm.display.sizer.style.minHeight = measure.docHeight + "px";
3310
+ cm.display.heightForcer.style.top = measure.docHeight + "px";
3311
+ cm.display.gutters.style.height = Math.max(measure.docHeight + cm.display.barHeight + scrollGap(cm),
3312
+ measure.clientHeight) + "px";
3313
  }
3314
 
3315
  // Read the actual heights of the rendered lines, and update their
4002
  if (reset && cm.doc.sel.contains(pos) == -1)
4003
  operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);
4004
 
4005
+ var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;
4006
+ input.wrapper.style.cssText = "position: absolute"
4007
+ var wrapperBox = input.wrapper.getBoundingClientRect()
4008
+ te.style.cssText = "position: absolute; width: 30px; height: 30px; top: " + (e.clientY - wrapperBox.top - 5) +
4009
+ "px; left: " + (e.clientX - wrapperBox.left - 5) + "px; z-index: 1000; background: " +
4010
  (ie ? "rgba(255, 255, 255, .05)" : "transparent") +
4011
  "; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
4012
  if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712)
4037
  }
4038
  function rehide() {
4039
  input.contextMenuPending = false;
4040
+ input.wrapper.style.cssText = oldWrapperCSS
4041
  te.style.cssText = oldCSS;
4042
  if (ie && ie_version < 9) display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos);
4043
 
5660
  display.scroller.scrollTop = doc.scrollTop;
5661
  }
5662
  if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {
5663
+ doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft));
5664
  display.scrollbars.setScrollLeft(doc.scrollLeft);
5665
  display.scroller.scrollLeft = doc.scrollLeft;
5666
  alignHorizontally(cm);
11405
 
11406
  // THE END
11407
 
11408
+ CodeMirror.version = "5.12.0";
11409
 
11410
  return CodeMirror;
11411
  });
12284
  return attrRegexpCache[attr] = new RegExp("\\s+" + attr + "\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*");
12285
  }
12286
 
12287
+ function getAttrValue(text, attr) {
12288
+ var match = text.match(getAttrRegexp(attr))
12289
+ return match ? match[2] : ""
 
 
 
 
12290
  }
12291
 
12292
  function getTagRegexp(tagName, anchored) {
12302
  }
12303
  }
12304
 
12305
+ function findMatchingMode(tagInfo, tagText) {
12306
  for (var i = 0; i < tagInfo.length; i++) {
12307
  var spec = tagInfo[i];
12308
+ if (!spec[0] || spec[1].test(getAttrValue(tagText, spec[0]))) return spec[2];
12309
  }
12310
  }
12311
 
12325
  tags.script.unshift(["type", configScript[i].matches, configScript[i].mode])
12326
 
12327
  function html(stream, state) {
12328
+ var style = htmlMode.token(stream, state.htmlState), tag = /\btag\b/.test(style), tagName
12329
+ if (tag && !/[<>\s\/]/.test(stream.current()) &&
12330
+ (tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase()) &&
12331
+ tags.hasOwnProperty(tagName)) {
12332
+ state.inTag = tagName + " "
12333
+ } else if (state.inTag && tag && />$/.test(stream.current())) {
12334
+ var inTag = /^([\S]+) (.*)/.exec(state.inTag)
12335
+ state.inTag = null
12336
+ var modeSpec = stream.current() == ">" && findMatchingMode(tags[inTag[1]], inTag[2])
12337
+ var mode = CodeMirror.getMode(config, modeSpec)
12338
+ var endTagA = getTagRegexp(inTag[1], true), endTag = getTagRegexp(inTag[1], false);
12339
  state.token = function (stream, state) {
12340
  if (stream.match(endTagA, false)) {
12341
  state.token = html;
12346
  };
12347
  state.localMode = mode;
12348
  state.localState = CodeMirror.startState(mode, htmlMode.indent(state.htmlState, ""));
12349
+ } else if (state.inTag) {
12350
+ state.inTag += stream.current()
12351
+ if (stream.eol()) state.inTag += " "
12352
  }
12353
  return style;
12354
  };
12356
  return {
12357
  startState: function () {
12358
  var state = htmlMode.startState();
12359
+ return {token: html, inTag: null, localMode: null, localState: null, htmlState: state};
12360
  },
12361
 
12362
  copyState: function (state) {
12364
  if (state.localState) {
12365
  local = CodeMirror.copyState(state.localMode, state.localState);
12366
  }
12367
+ return {token: state.token, inTag: state.inTag,
12368
+ localMode: state.localMode, localState: local,
12369
  htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
12370
  },
12371
 
13375
  if (state.context && state.context.tagName != tagName &&
13376
  config.implicitlyClosed.hasOwnProperty(state.context.tagName))
13377
  popContext(state);
13378
+ if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {
13379
  setStyle = "tag";
13380
  return closeState;
13381
  } else {
assets/js/forms-admin.min.js CHANGED
@@ -1,9 +1,9 @@
1
- !function(){var e=void 0,t=void 0;!function r(t,n,i){function o(l,s){if(!n[l]){if(!t[l]){var c="function"==typeof e&&e;if(!s&&c)return c(l,!0);if(a)return a(l,!0);var u=new Error("Cannot find module '"+l+"'");throw u.code="MODULE_NOT_FOUND",u}var d=n[l]={exports:{}};t[l][0].call(d.exports,function(e){var r=t[l][1][e];return o(r?r:e)},d,d.exports,r,t,n,i)}return n[l].exports}for(var a="function"==typeof e&&e,l=0;l<i.length;l++)o(i[l]);return o}({1:[function(e,t,r){"use strict";var n=function(e,t){var r={};return r.label=function(r){return e("div",[e("label",t.fieldLabel),e("input.widefat",{type:"text",value:r.label(),onchange:e.withAttr("value",r.label),placeholder:r.title()})])},r.value=function(r){return e("div",[e("label",t.value),e("input.widefat",{type:"text",value:r.value(),onchange:e.withAttr("value",r.value)}),e("p.help",t.valueHelp)])},r.numberMinMax=function(r){return e("div",[e("div.row",[e("div.col.col-3",[e("label",t.min),e("input",{type:"number",onchange:e.withAttr("value",r.min)})]),e("div.col.col-3",[e("label",t.max),e("input",{type:"number",onchange:e.withAttr("value",r.max)})])])])},r.isRequired=function(r){var n,i={type:"checkbox",checked:r.required(),onchange:e.withAttr("checked",r.required)};return r.forceRequired()&&(i.required=!0,i.disabled=!0,n=e("p.help",t.forceRequired)),e("div",[e("label.cb-wrap",[e("input",i),t.isFieldRequired]),n])},r.placeholder=function(r){return e("div",[e("label",t.placeholder),e("input.widefat",{type:"text",value:r.placeholder(),onchange:e.withAttr("value",r.placeholder),placeholder:""}),e("p.help",t.placeholderHelp)])},r.useParagraphs=function(r){return e("div",[e("label.cb-wrap",[e("input",{type:"checkbox",checked:r.wrap(),onchange:e.withAttr("checked",r.wrap)}),t.wrapInParagraphTags])])},r.choiceType=function(r){return e("div",[e("label",t.choiceType),e("select",{value:r.type(),onchange:e.withAttr("value",r.type)},[e("option",{value:"select",selected:"select"===r.type()?"selected":!1},t.dropdown),e("option",{value:"radio",selected:"radio"===r.type()?"selected":!1},t.radioButtons),e("option",{value:"checkbox",selected:"checkbox"===r.type()?"selected":!1},t.checkboxes)])])},r.choices=function(r){return e("div",[e("label",t.choices),e("div.limit-height",[e("table",[r.choices().map(function(t,n){return e("tr",{"data-id":n},[e("td.cb",e("input",{name:"selected",type:"checkbox"===r.type()?"checkbox":"radio",onchange:e.withAttr("value",r.selectChoice.bind(r)),checked:t.selected(),value:t.value()})),e("td.stretch",e("input.widefat",{type:"text",value:t.label(),placeholder:t.title(),onchange:e.withAttr("value",t.label)})),e("td",e("span",{"class":"dashicons dashicons-no-alt hover-activated",onclick:function(e){this.choices().splice(e,1)}.bind(r,n)},""))])})])])])},r};t.exports=n},{}],2:[function(e,t,r){var n=function(t,r){var n={},i=e("./field-forms-rows.js")(t,r);return n.render=function(e){var t=e.type();if("function"==typeof n[t])return n[t](e);switch(t){case"select":case"radio":case"checkbox":return n.choice(e)}return n.text(e)},n.text=function(e){return[i.label(e),i.placeholder(e),i.value(e),i.isRequired(e),i.useParagraphs(e)]},n.choice=function(e){return[i.label(e),i.choiceType(e),i.choices(e),i.useParagraphs(e)]},n.hidden=function(e){return e.placeholder(""),e.choices().length>0&&e.value(e.choices().map(function(e){return e.label()}).join(",")),[i.value(e)]},n.submit=function(e){return e.label(""),e.placeholder(""),[i.value(e),i.useParagraphs(e)]},n.number=function(e){return[n.text(e),i.numberMinMax(e)]},n};t.exports=n},{"./field-forms-rows.js":1}],3:[function(e,t,r){var n=function(t){"use strict";function r(e){var r,a,l,s;return r=e.label().length?t("label",e.label()):"",a="function"==typeof o[e.type()]?o[e.type()](e):o["default"](e),l=e.wrap()?t("p",[r,a]):[r,a],s=n(l),s=i(s),s+"\n"}var n=e("../third-party/render.js"),i=e("../third-party/beautify-html.js"),o={};return o.select=function(e){var r=t("select",{name:e.name()},[e.choices().map(function(e){return t("option",{value:e.value()!==e.label()?e.value():void 0,selected:e.selected()},e.label())})]);return r},o.checkbox=function(e){var r=e.choices().map(function(r){return t("label",[t("input",{name:e.name()+("checkbox"===e.type()?"[]":""),type:e.type(),value:r.value(),checked:r.selected()})," ",t("span",r.label())])});return r},o.radio=o.checkbox,o["default"]=function(e){var r,n={type:e.type()};return e.name()&&(n.name=e.name()),e.min()&&(n.min=e.min()),e.max()&&(n.max=e.max()),e.value().length>0&&(n.value=e.value()),e.placeholder().length>0&&(n.placeholder=e.placeholder()),n.required=e.required(),r=t("input",n)},r};t.exports=n},{"../third-party/beautify-html.js":11,"../third-party/render.js":12}],4:[function(e,t,r){var n=function(t,r,n,i,o){"use strict";function a(e){u=i.get(e),t.redraw()}function l(){}function s(){var e=d(u);n.insert(e),a(""),t.redraw()}function c(){var e=i.getAll(),r=t("div.available-fields.small-margin",[t("strong",o.chooseField),e.length?e.map(function(e,r){var n="button";e.forceRequired()&&(n+=" is-required");var i=e.inFormContent();return null!==i&&(n+=" "+(i?"in-form":"not-in-form")),t("button",{"class":n,type:"button",onclick:t.withAttr("value",a),value:r},e.title())}):t("p",o.noAvailableFields)]),n=null;return u&&(n=h(t("div.field-wizard",[t("h3",[u.title(),u.forceRequired()?t("span.red","*"):"",u.name().length?t("code",u.name()):""]),u.help().length?t("p",t.trust(u.help())):"",f.render(u),t("p",[t("button",{"class":"button-primary",type:"button",onkeydown:function(e){e=e||window.event,13==e.keyCode&&s()},onclick:s},o.addToForm)])]),a)),[r,n]}var u,d=e("./field-generator.js")(t),h=e("./overlay.js")(t,o),f=e("./field-forms.js")(t,o);return n.on("blur",t.redraw),{view:c,controller:l}};t.exports=n},{"./field-forms.js":2,"./field-generator.js":3,"./overlay.js":9}],5:[function(e,t,r){var n=function(e,t,r){"use strict";function n(){d.forEach(function(e){t.deregister(e)})}function i(e,r){var n=t.register(e);r||d.push(n)}function o(e){var t={phone:"tel",dropdown:"select",checkboxes:"checkbox",birthday:"text"};return"undefined"!=typeof t[e]?t[e]:e}function a(e){if(!e["public"])return!1;var t={name:e.tag,title:e.name,required:e.required,forceRequired:e.required,type:o(e.field_type),choices:e.choices};return"address"!==t.type?i(t):(i({name:t.name+"[addr1]",type:"text",title:r.streetAddress}),i({name:t.name+"[city]",type:"text",title:r.city}),i({name:t.name+"[state]",type:"text",title:r.state}),i({name:t.name+"[zip]",type:"text",title:r.zip}),i({name:t.name+"[country]",type:"select",title:r.country,choices:mc4wp_vars.countries})),!0}function l(e){var t={title:e.name,name:"GROUPINGS["+e.id+"]",type:o(e.field_type),choices:e.groups};i(t)}function s(e){e.merge_vars.forEach(a),e.groupings.forEach(l)}function c(e){n(),e.forEach(s)}function u(e){var t;i({name:"",value:r.subscribe,type:"submit",title:r.submitButton},!0),t={};for(var n in e)t[e[n].id]=e[n].name;i({name:"_mc4wp_lists",type:"checkbox",title:r.listChoice,choices:t,help:r.listChoiceDescription},!0),t={subscribe:"Subscribe",unsubscribe:"Unsubscribe"},i({name:"_mc4wp_action",type:"radio",title:r.formAction,choices:t,value:"subscribe",help:r.formActionDescription},!0)}var d=[];return{registerCustomFields:u,registerListFields:s,registerListsFields:c}};t.exports=n},{}],6:[function(e,t,r){t.exports=function(e,t){"use strict";function r(e){var t=[];return t="function"==typeof e.map?e.map(function(e){return new c({label:e})}):Object.keys(e).map(function(t){var r=e[t];return new c({label:r,value:t})})}function n(n){var i,o=l("name",n.name).shift();return o?void(!o.required()&&n.required&&o.required(!0)):(n.choices&&(n.choices=r(n.choices),n.value&&(n.choices=n.choices.map(function(e){return e.value()===n.value&&e.selected(!0),e}))),i=new s(n),u.unshift(i),e.redraw(),t.trigger("fields.change"),i)}function i(t){var r=u.indexOf(t);r>-1&&(delete u[r],e.redraw())}function o(e){return u[e]}function a(){return u}function l(e,t){return u.filter(function(r){return r[e]()===t})}var s=function(t){this.name=e.prop(t.name),this.title=e.prop(t.title||t.name),this.type=e.prop(t.type),this.label=e.prop(t.title||""),this.value=e.prop(t.value||""),this.placeholder=e.prop(t.placeholder||""),this.required=e.prop(t.required||!1),this.forceRequired=e.prop(t.forceRequired||!1),this.wrap=e.prop(t.wrap||!0),this.min=e.prop(t.min||null),this.max=e.prop(t.max||null),this.help=e.prop(t.help||""),this.choices=e.prop(t.choices||[]),this.inFormContent=e.prop(null),this.selectChoice=function(e){var t=this;this.choices(this.choices().map(function(r){return r.value()===e?r.selected(!0):"checkbox"!==t.type()&&r.selected(!1),r}))}},c=function(t){this.label=e.prop(t.label),this.title=e.prop(t.title||t.label),this.selected=e.prop(t.selected||!1),this.value=e.prop(t.value||t.label)},u=[];return{fields:u,get:o,getAll:a,deregister:i,register:n,getAllWhere:l}}},{}],7:[function(e,t,r){var n=function(t){function r(){return o&&(i.innerHTML=a.getValue().toLowerCase(),o=!1),i}var n,i=document.createElement("form"),o=!1,a={};i.innerHTML=t.value.toLowerCase();var l=e("codemirror");return e("codemirror/mode/xml/xml"),e("codemirror/mode/javascript/javascript"),e("codemirror/mode/css/css"),e("codemirror/mode/htmlmixed/htmlmixed"),e("codemirror/addon/fold/xml-fold"),e("codemirror/addon/edit/matchtags"),e("codemirror/addon/edit/closetag.js"),l&&(n=l.fromTextArea(t,{selectionPointer:!0,matchTags:{bothTags:!0},mode:"htmlmixed",htmlMode:!0,autoCloseTags:!0,autoRefresh:!0}),window.dispatchEvent&&n.on("change",function(){if("function"==typeof Event){var e=new Event("change",{bubbles:!0});t.dispatchEvent(e)}})),t.addEventListener&&t.addEventListener("change",function(){o=!0}),a.getValue=function(){return n?n.getValue():t.value},a.query=function(e){return r().querySelectorAll(e)},a.containsField=function(e){return null!==r().elements.namedItem(e.toLowerCase())},a.insert=function(e){n?(n.replaceSelection(e),n.focus()):t.value+=e},a.on=function(e,r){return n?("input"===e&&(e="changes"),n.on(e,r)):t.addEventListener(e,r)},a.refresh=function(){n&&n.refresh()},a};t.exports=n},{codemirror:16,"codemirror/addon/edit/closetag.js":13,"codemirror/addon/edit/matchtags":14,"codemirror/addon/fold/xml-fold":15,"codemirror/mode/css/css":17,"codemirror/mode/htmlmixed/htmlmixed":18,"codemirror/mode/javascript/javascript":19,"codemirror/mode/xml/xml":20}],8:[function(e,t,r){var n=function(e,t,r,n,i,o){"use strict";function a(){n.getAll().forEach(function(e){if(!(e.name().length<=0)){var r=t.containsField(e.name());e.inFormContent(r)}}),l(),e.redraw()}function l(){var e=n.getAllWhere("forceRequired",!0).map(function(e){return e.name().toUpperCase()}),r=t.query("[required]");Array.prototype.forEach.call(r,function(t){var r=t.name.toUpperCase();"_"!==r[0]&&-1===e.indexOf(r)&&e.push(r)}),s.value=e.join(",")}var s=document.getElementById("required-fields");t.on("change",o.debounce(a,500)),i.on("fields.change",o.debounce(a,500))};t.exports=n},{}],9:[function(e,t,r){var n=function(e,t){"use strict";function r(){document.removeEventListener("keydown",n),window.removeEventListener("resize",i),a()}function n(e){e=e||window.event,27==e.keyCode&&r(),13==e.keyCode&&e.preventDefault()}function i(){if(o){var e=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,t=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,r=(e-o.clientWidth-40)/2,n=(t-o.clientHeight-40)/2;o.style.left=(r>0?r:0)+"px",o.style.top=(n>0?n:0)+"px"}}var o,a;return function(l,s){return a=s,document.addEventListener("keydown",n),window.addEventListener("resize",i),[e("div.overlay-wrap",e("div.overlay",{config:function(e){o=e,i()}},[e("span",{"class":"close dashicons dashicons-no",title:t.close,onclick:r}),l])),e("div.overlay-background",{title:t.close,onclick:r})]}};t.exports=n},{}],10:[function(e,t,r){"use strict";var n=window.mc4wp_forms_i18n,i=window.mc4wp.deps.mithril,o=mc4wp.events,a=mc4wp.settings,l=mc4wp.helpers,s=mc4wp.tabs,c=e("./admin/form-watcher.js"),u=e("./admin/form-editor.js"),d=e("./admin/field-helper.js"),h=e("./admin/fields-factory.js"),f=e("./admin/fields.js")(i,o),p=document.getElementById("mc4wp-form-content"),g=window.formEditor=new u(p),m=(new c(i,formEditor,a,f,o,l),new d(i,s,formEditor,f,n));i.mount(document.getElementById("mc4wp-field-wizard"),m);var v=new h(a,f,n);v.registerCustomFields(mc4wp_vars.mailchimp.lists),o.on("selectedLists.change",v.registerListsFields),v.registerListsFields(a.getSelectedLists()),window.setTimeout(function(){i.redraw()},2e3),window.mc4wp=window.mc4wp||{},window.mc4wp.forms=window.mc4wp.forms||{},window.mc4wp.forms.editor=g,window.mc4wp.forms.fields=f},{"./admin/field-helper.js":4,"./admin/fields-factory.js":5,"./admin/fields.js":6,"./admin/form-editor.js":7,"./admin/form-watcher.js":8}],11:[function(e,t,r){!function(){function e(e){return e.replace(/^\s+|\s+$/g,"")}function r(e){return e.replace(/^\s+/g,"")}function n(t,n,i,o){function a(){return this.pos=0,this.token="",this.current_mode="CONTENT",this.tags={parent:"parent1",parentcount:1,parent1:""},this.tag_type="",this.token_text=this.last_token=this.last_text=this.token_type="",this.newlines=0,this.indent_content=s,this.Utils={whitespace:"\n\r ".split(""),single_token:"br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed,?php,?,?=".split(","),extra_liners:"head,body,/html".split(","),in_array:function(e,t){for(var r=0;r<t.length;r++)if(e===t[r])return!0;return!1}},this.traverse_whitespace=function(){var e="";if(e=this.input.charAt(this.pos),this.Utils.in_array(e,this.Utils.whitespace)){for(this.newlines=0;this.Utils.in_array(e,this.Utils.whitespace);)p&&"\n"===e&&this.newlines<=g&&(this.newlines+=1),this.pos++,e=this.input.charAt(this.pos);return!0}return!1},this.get_content=function(){for(var e="",t=[],r=!1;"<"!==this.input.charAt(this.pos);){if(this.pos>=this.input.length)return t.length?t.join(""):["","TK_EOF"];if(this.traverse_whitespace())t.length&&(r=!0);else{if(indent_handlebars){var n=this.input.substr(this.pos,3);if("{{#"===n||"{{/"===n)break;if("{{"===this.input.substr(this.pos,2)&&"{{else}}"===this.get_tag(!0))break}e=this.input.charAt(this.pos),this.pos++,r&&(this.line_char_count>=this.wrap_line_length?(this.print_newline(!1,t),this.print_indentation(t)):(this.line_char_count++,t.push(" ")),r=!1),this.line_char_count++,t.push(e)}}return t.length?t.join(""):""},this.get_contents_to=function(e){if(this.pos===this.input.length)return["","TK_EOF"];var t="",r=new RegExp("</"+e+"\\s*>","igm");r.lastIndex=this.pos;var n=r.exec(this.input),i=n?n.index:this.input.length;return this.pos<i&&(t=this.input.substring(this.pos,i),this.pos=i),t},this.record_tag=function(e){this.tags[e+"count"]?(this.tags[e+"count"]++,this.tags[e+this.tags[e+"count"]]=this.indent_level):(this.tags[e+"count"]=1,this.tags[e+this.tags[e+"count"]]=this.indent_level),this.tags[e+this.tags[e+"count"]+"parent"]=this.tags.parent,this.tags.parent=e+this.tags[e+"count"]},this.retrieve_tag=function(e){if(this.tags[e+"count"]){for(var t=this.tags.parent;t&&e+this.tags[e+"count"]!==t;)t=this.tags[t+"parent"];t&&(this.indent_level=this.tags[e+this.tags[e+"count"]],this.tags.parent=this.tags[t+"parent"]),delete this.tags[e+this.tags[e+"count"]+"parent"],delete this.tags[e+this.tags[e+"count"]],1===this.tags[e+"count"]?delete this.tags[e+"count"]:this.tags[e+"count"]--}},this.indent_to_tag=function(e){if(this.tags[e+"count"]){for(var t=this.tags.parent;t&&e+this.tags[e+"count"]!==t;)t=this.tags[t+"parent"];t&&(this.indent_level=this.tags[e+this.tags[e+"count"]])}},this.get_tag=function(e){var t,r,n,i="",o=[],a="",l=!1,s=this.pos,c=this.line_char_count;e=void 0!==e?e:!1;do{if(this.pos>=this.input.length)return e&&(this.pos=s,this.line_char_count=c),o.length?o.join(""):["","TK_EOF"];if(i=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(i,this.Utils.whitespace))l=!0;else{if(("'"===i||'"'===i)&&(i+=this.get_unformatted(i),l=!0),"="===i&&(l=!1),o.length&&"="!==o[o.length-1]&&">"!==i&&l&&(this.line_char_count>=this.wrap_line_length?(this.print_newline(!1,o),this.print_indentation(o)):(o.push(" "),this.line_char_count++),l=!1),indent_handlebars&&"<"===n&&i+this.input.charAt(this.pos)==="{{"&&(i+=this.get_unformatted("}}"),o.length&&" "!==o[o.length-1]&&"<"!==o[o.length-1]&&(i=" "+i),l=!0),"<"!==i||n||(t=this.pos-1,n="<"),indent_handlebars&&!n&&o.length>=2&&"{"===o[o.length-1]&&"{"==o[o.length-2]&&(t="#"===i||"/"===i?this.pos-3:this.pos-2,n="{"),this.line_char_count++,o.push(i),o[1]&&"!"===o[1]){o=[this.get_comment(t)];break}if(indent_handlebars&&"{"===n&&o.length>2&&"}"===o[o.length-2]&&"}"===o[o.length-1])break}}while(">"!==i);var u,d,h=o.join("");u=-1!==h.indexOf(" ")?h.indexOf(" "):"{"===h[0]?h.indexOf("}"):h.indexOf(">"),d="<"!==h[0]&&indent_handlebars?"#"===h[2]?3:2:1;var p=h.substring(d,u).toLowerCase();return"/"===h.charAt(h.length-2)||this.Utils.in_array(p,this.Utils.single_token)?e||(this.tag_type="SINGLE"):indent_handlebars&&"{"===h[0]&&"else"===p?e||(this.indent_to_tag("if"),this.tag_type="HANDLEBARS_ELSE",this.indent_content=!0,this.traverse_whitespace()):"script"===p?e||(this.record_tag(p),this.tag_type="SCRIPT"):"style"===p?e||(this.record_tag(p),this.tag_type="STYLE"):this.is_unformatted(p,f)?(a=this.get_unformatted("</"+p+">",h),o.push(a),t>0&&this.Utils.in_array(this.input.charAt(t-1),this.Utils.whitespace)&&o.splice(0,0,this.input.charAt(t-1)),r=this.pos-1,this.Utils.in_array(this.input.charAt(r+1),this.Utils.whitespace)&&o.push(this.input.charAt(r+1)),this.tag_type="SINGLE"):"!"===p.charAt(0)?e||(this.tag_type="SINGLE",this.traverse_whitespace()):e||("/"===p.charAt(0)?(this.retrieve_tag(p.substring(1)),this.tag_type="END",this.traverse_whitespace()):(this.record_tag(p),"html"!==p.toLowerCase()&&(this.indent_content=!0),this.tag_type="START",this.traverse_whitespace()),this.Utils.in_array(p,this.Utils.extra_liners)&&(this.print_newline(!1,this.output),this.output.length&&"\n"!==this.output[this.output.length-2]&&this.print_newline(!0,this.output))),e&&(this.pos=s,this.line_char_count=c),o.join("")},this.get_comment=function(e){var t="",r=">",n=!1;for(this.pos=e,input_char=this.input.charAt(this.pos),this.pos++;this.pos<=this.input.length&&(t+=input_char,t[t.length-1]!==r[r.length-1]||-1===t.indexOf(r));)!n&&t.length<10&&(0===t.indexOf("<![if")?(r="<![endif]>",n=!0):0===t.indexOf("<![cdata[")?(r="]]>",n=!0):0===t.indexOf("<![")?(r="]>",n=!0):0===t.indexOf("<!--")&&(r="-->",n=!0)),input_char=this.input.charAt(this.pos),this.pos++;return t},this.get_unformatted=function(e,t){if(t&&-1!==t.toLowerCase().indexOf(e))return"";var r="",n="",i=0,o=!0;do{if(this.pos>=this.input.length)return n;if(r=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(r,this.Utils.whitespace)){if(!o){this.line_char_count--;continue}if("\n"===r||"\r"===r){n+="\n",this.line_char_count=0;continue}}n+=r,this.line_char_count++,o=!0,indent_handlebars&&"{"===r&&n.length&&"{"===n[n.length-2]&&(n+=this.get_unformatted("}}"),i=n.length)}while(-1===n.toLowerCase().indexOf(e,i));return n},this.get_token=function(){var e;if("TK_TAG_SCRIPT"===this.last_token||"TK_TAG_STYLE"===this.last_token){var t=this.last_token.substr(7);return e=this.get_contents_to(t),"string"!=typeof e?e:[e,"TK_"+t]}if("CONTENT"===this.current_mode)return e=this.get_content(),"string"!=typeof e?e:[e,"TK_CONTENT"];if("TAG"===this.current_mode){if(e=this.get_tag(),"string"!=typeof e)return e;var r="TK_TAG_"+this.tag_type;return[e,r]}},this.get_full_indent=function(e){return e=this.indent_level+e||0,1>e?"":Array(e+1).join(this.indent_string)},this.is_unformatted=function(e,t){if(!this.Utils.in_array(e,t))return!1;if("a"!==e.toLowerCase()||!this.Utils.in_array("a",t))return!0;var r=this.get_tag(!0),n=(r||"").match(/^\s*<\s*\/?([a-z]*)\s*[^>]*>\s*$/);return!n||this.Utils.in_array(n,t)?!0:!1},this.printer=function(e,t,n,i,o){this.input=e||"",this.output=[],this.indent_character=t,this.indent_string="",this.indent_size=n,this.brace_style=o,this.indent_level=0,this.wrap_line_length=i,this.line_char_count=0;for(var a=0;a<this.indent_size;a++)this.indent_string+=this.indent_character;this.print_newline=function(e,t){this.line_char_count=0,t&&t.length&&(e||"\n"!==t[t.length-1])&&t.push("\n")},this.print_indentation=function(e){for(var t=0;t<this.indent_level;t++)e.push(this.indent_string),this.line_char_count+=this.indent_string.length},this.print_token=function(e){(e||""!==e)&&this.output.length&&"\n"===this.output[this.output.length-1]&&(this.print_indentation(this.output),e=r(e)),this.print_token_raw(e)},this.print_token_raw=function(e){e&&""!==e&&(e.length>1&&"\n"===e[e.length-1]?(this.output.push(e.slice(0,-1)),this.print_newline(!1,this.output)):this.output.push(e));for(var t=0;t<this.newlines;t++)this.print_newline(t>0,this.output);this.newlines=0},this.indent=function(){this.indent_level++},this.unindent=function(){this.indent_level>0&&this.indent_level--}},this}var l,s,c,u,d,h,f,p,g;for(n=n||{},void 0!==n.wrap_line_length&&0!==parseInt(n.wrap_line_length,10)||void 0!==n.max_char&&0!==parseInt(n.max_char,10)||(n.wrap_line_length=n.max_char),s=n.indent_inner_html||!1,c=parseInt(n.indent_size||4,10),u=n.indent_char||" ",h=n.brace_style||"collapse",d=0===parseInt(n.wrap_line_length,10)?32786:parseInt(n.wrap_line_length||250,10),f=n.unformatted||["a","span","bdo","em","strong","dfn","code","samp","kbd","var","cite","abbr","acronym","q","sub","sup","tt","i","b","big","small","u","s","strike","font","ins","del","pre","address","dt","h1","h2","h3","h4","h5","h6"],p=n.preserve_newlines||!0,g=p?parseInt(n.max_preserve_newlines||32786,10):0,indent_handlebars=n.indent_handlebars||!1,l=new a,l.printer(t,u,c,d,h);;){var m=l.get_token();if(l.token_text=m[0],l.token_type=m[1],"TK_EOF"===l.token_type)break;switch(l.token_type){case"TK_TAG_START":l.print_newline(!1,l.output),l.print_token(l.token_text),l.indent_content&&(l.indent(),l.indent_content=!1),l.current_mode="CONTENT";break;case"TK_TAG_STYLE":case"TK_TAG_SCRIPT":l.print_newline(!1,l.output),l.print_token(l.token_text),l.current_mode="CONTENT";break;case"TK_TAG_END":if("TK_CONTENT"===l.last_token&&""===l.last_text){var v=l.token_text.match(/\w+/)[0],y=null;l.output.length&&(y=l.output[l.output.length-1].match(/(?:<|{{#)\s*(\w+)/)),(null===y||y[1]!==v)&&l.print_newline(!1,l.output)}l.print_token(l.token_text),l.current_mode="CONTENT";break;case"TK_TAG_SINGLE":var b=l.token_text.match(/^\s*<([a-z]+)/i);b&&l.Utils.in_array(b[1],f)||l.print_newline(!1,l.output),l.print_token(l.token_text),l.current_mode="CONTENT";break;case"TK_TAG_HANDLEBARS_ELSE":l.print_token(l.token_text),l.indent_content&&(l.indent(),l.indent_content=!1),l.current_mode="CONTENT";break;case"TK_CONTENT":l.print_token(l.token_text),l.current_mode="TAG";break;case"TK_STYLE":case"TK_SCRIPT":if(""!==l.token_text){l.print_newline(!1,l.output);var w,x=l.token_text,k=1;"TK_SCRIPT"===l.token_type?w="function"==typeof i&&i:"TK_STYLE"===l.token_type&&(w="function"==typeof o&&o),"keep"===n.indent_scripts?k=0:"separate"===n.indent_scripts&&(k=-l.indent_level);var C=l.get_full_indent(k);if(w)x=w(x.replace(/^\s*/,C),n);else{var S=x.match(/^\s*/)[0],T=S.match(/[^\n\r]*$/)[0].split(l.indent_string).length-1,L=l.get_full_indent(k-T);x=x.replace(/^\s*/,C).replace(/\r\n|\r|\n/g,"\n"+L).replace(/\s+$/,"")}x&&(l.print_token_raw(C+e(x)),l.print_newline(!1,l.output))}l.current_mode="TAG"}l.last_token=l.token_type,l.last_text=l.token_text}return l.output.join("")}"undefined"!=typeof t&&"undefined"!=typeof t.exports?t.exports=n:"undefined"!=typeof window&&(window.html_beautify=n)}()},{}],12:[function(e,t,r){"use strict";function n(e){return"[object Array]"===Object.prototype.toString.call(e)}function i(e){return e.replace(/\W+/g,"-").replace(/([a-z\d])([A-Z])/g,"$1-$2")}function o(e){return""!=e}function a(e,t){return"undefined"===e&&(e=""),"string"!=typeof e&&(e+=""),e=e.replace(/\&/g,"&amp;").replace(/</g,"&lt;").replace(/\>/g,"&gt;"),t?e.replace(/\"/g,"&quot;"):e}function l(e){return e&&Object.keys(e).length?Object.keys(e).map(function(t){var r=e[t];if("undefined"!=typeof r&&null!==r&&"function"!=typeof r){if("boolean"==typeof r)return r?" "+t:"";if("style"===t){if(!r)return;var n=e.style;return"object"==typeof n&&(n=Object.keys(n).map(function(e){return""!=n[e]?[i(e).toLowerCase(),n[e]].join(":"):""}).filter(o).join(";")),""!=n?' style="'+a(n,!0)+'"':""}return" "+a("className"===t?"class":t)+'="'+a(r,!0)+'"'}}).join(""):""}function s(e){return n(e.children)&&!e.children.length?"":c(e.children)}function c(e){var t=typeof e;if("string"===t)return a(e);if("number"===t||"boolean"===t)return e;if(!e)return"";if(n(e))return e.map(c).join("");if(e.view){var r=e.controller?new e.controller:{},i=c(e.view(r));return r.onunload&&r.onunload(),i}if(e.$trusted)return""+e;var o=s(e);return!o&&u.indexOf(e.tag.toLowerCase())>=0?"<"+e.tag+l(e.attrs)+">":["<",e.tag,l(e.attrs),">",o,"</",e.tag,">"].join("")}var u=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr","!doctype"];t.exports=c},{}],13:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror"),e("../fold/xml-fold")):"function"==typeof t&&t.amd?t(["../../lib/codemirror","../fold/xml-fold"],i):i(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var r=t.listSelections(),n=[],s=0;s<r.length;s++){if(!r[s].empty())return e.Pass;var c=r[s].head,u=t.getTokenAt(c),d=e.innerMode(t.getMode(),u.state),h=d.state;if("xml"!=d.mode.name||!h.tagName)return e.Pass;var f=t.getOption("autoCloseTags"),p="html"==d.mode.configuration,g="object"==typeof f&&f.dontCloseTags||p&&a,m="object"==typeof f&&f.indentTags||p&&l,v=h.tagName;u.end>c.ch&&(v=v.slice(0,v.length-u.end+c.ch));var y=v.toLowerCase();if(!v||"string"==u.type&&(u.end!=c.ch||!/[\"\']/.test(u.string.charAt(u.string.length-1))||1==u.string.length)||"tag"==u.type&&"closeTag"==h.type||u.string.indexOf("/")==u.string.length-1||g&&i(g,y)>-1||o(t,v,c,h,!0))return e.Pass;var b=m&&i(m,y)>-1;n[s]={indent:b,text:">"+(b?"\n\n":"")+"</"+v+">",newPos:b?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var s=r.length-1;s>=0;s--){var w=n[s];t.replaceRange(w.text,r[s].head,r[s].anchor,"+insert");var x=t.listSelections().slice(0);x[s]={head:w.newPos,anchor:w.newPos},t.setSelections(x),w.indent&&(t.indentLine(w.newPos.line,null,!0),t.indentLine(w.newPos.line+1,null,!0))}}function r(t,r){for(var n=t.listSelections(),i=[],a=r?"/":"</",l=0;l<n.length;l++){if(!n[l].empty())return e.Pass;var s=n[l].head,c=t.getTokenAt(s),u=e.innerMode(t.getMode(),c.state),d=u.state;if(r&&("string"==c.type||"<"!=c.string.charAt(0)||c.start!=s.ch-1))return e.Pass;var h;if("xml"!=u.mode.name)if("htmlmixed"==t.getMode().name&&"javascript"==u.mode.name)h=a+"script";else{if("htmlmixed"!=t.getMode().name||"css"!=u.mode.name)return e.Pass;h=a+"style"}else{if(!d.context||!d.context.tagName||o(t,d.context.tagName,s,d))return e.Pass;h=a+d.context.tagName}">"!=t.getLine(s.line).charAt(c.end)&&(h+=">"),i[l]=h}t.replaceSelections(i),n=t.listSelections();for(var l=0;l<n.length;l++)(l==n.length-1||n[l].head.line<n[l+1].head.line)&&t.indentLine(n[l].head.line)}function n(t){return t.getOption("disableInput")?e.Pass:r(t,!0)}function i(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;n>r;++r)if(e[r]==t)return r;return-1}function o(t,r,n,i,o){if(!e.scanForClosingTag)return!1;var a=Math.min(t.lastLine()+1,n.line+500),l=e.scanForClosingTag(t,n,null,a);if(!l||l.tag!=r)return!1;for(var s=i.context,c=o?1:0;s&&s.tagName==r;s=s.prev)++c;n=l.to;for(var u=1;c>u;u++){var d=e.scanForClosingTag(t,n,null,a);if(!d||d.tag!=r)return!1;n=d.to}return!0}e.defineOption("autoCloseTags",!1,function(r,i,o){if(o!=e.Init&&o&&r.removeKeyMap("autoCloseTags"),i){var a={name:"autoCloseTags"};("object"!=typeof i||i.whenClosing)&&(a["'/'"]=function(e){return n(e)}),("object"!=typeof i||i.whenOpening)&&(a["'>'"]=function(e){return t(e)}),r.addKeyMap(a)}});var a=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],l=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];e.commands.closeTag=function(e){return r(e)}})},{"../../lib/codemirror":16,"../fold/xml-fold":15}],14:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror"),e("../fold/xml-fold")):"function"==typeof t&&t.amd?t(["../../lib/codemirror","../fold/xml-fold"],i):i(CodeMirror)}(function(e){"use strict";function t(e){e.state.tagHit&&e.state.tagHit.clear(),e.state.tagOther&&e.state.tagOther.clear(),e.state.tagHit=e.state.tagOther=null}function r(r){r.state.failedTagMatch=!1,r.operation(function(){if(t(r),!r.somethingSelected()){var n=r.getCursor(),i=r.getViewport();i.from=Math.min(i.from,n.line),i.to=Math.max(n.line+1,i.to);var o=e.findMatchingTag(r,n,i);if(o){if(r.state.matchBothTags){var a="open"==o.at?o.open:o.close;a&&(r.state.tagHit=r.markText(a.from,a.to,{className:"CodeMirror-matchingtag"}))}var l="close"==o.at?o.open:o.close;l?r.state.tagOther=r.markText(l.from,l.to,{className:"CodeMirror-matchingtag"}):r.state.failedTagMatch=!0}}})}function n(e){e.state.failedTagMatch&&r(e)}e.defineOption("matchTags",!1,function(i,o,a){a&&a!=e.Init&&(i.off("cursorActivity",r),i.off("viewportChange",n),t(i)),o&&(i.state.matchBothTags="object"==typeof o&&o.bothTags,i.on("cursorActivity",r),i.on("viewportChange",n),r(i))}),e.commands.toMatchingTag=function(t){var r=e.findMatchingTag(t,t.getCursor());if(r){var n="close"==r.at?r.open:r.close;n&&t.extendSelection(n.to,n.from)}}})},{"../../lib/codemirror":16,"../fold/xml-fold":15}],15:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";function t(e,t){return e.line-t.line||e.ch-t.ch}function r(e,t,r,n){this.line=t,this.ch=r,this.cm=e,this.text=e.getLine(t),this.min=n?n.from:e.firstLine(),this.max=n?n.to-1:e.lastLine()}function n(e,t){var r=e.cm.getTokenTypeAt(h(e.line,t));return r&&/\btag\b/.test(r)}function i(e){return e.line>=e.max?void 0:(e.ch=0,e.text=e.cm.getLine(++e.line),!0)}function o(e){return e.line<=e.min?void 0:(e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0)}function a(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(i(e))continue;return}{if(n(e,t+1)){var r=e.text.lastIndexOf("/",t),o=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,o?"selfClose":"regular"}e.ch=t+1}}}function l(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(o(e))continue;return}if(n(e,t+1)){g.lastIndex=t,e.ch=t;var r=g.exec(e.text);if(r&&r.index==t)return r}else e.ch=t}}function s(e){for(;;){g.lastIndex=e.ch;var t=g.exec(e.text);if(!t){if(i(e))continue;return}{if(n(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}}function c(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(o(e))continue;return}{if(n(e,t+1)){var r=e.text.lastIndexOf("/",t),i=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,i?"selfClose":"regular"}e.ch=t}}}function u(e,t){for(var r=[];;){var n,i=s(e),o=e.line,l=e.ch-(i?i[0].length:0);if(!i||!(n=a(e)))return;if("selfClose"!=n)if(i[1]){for(var c=r.length-1;c>=0;--c)if(r[c]==i[2]){r.length=c;break}if(0>c&&(!t||t==i[2]))return{tag:i[2],from:h(o,l),to:h(e.line,e.ch)}}else r.push(i[2])}}function d(e,t){for(var r=[];;){var n=c(e);if(!n)return;if("selfClose"!=n){var i=e.line,o=e.ch,a=l(e);if(!a)return;if(a[1])r.push(a[2]);else{for(var s=r.length-1;s>=0;--s)if(r[s]==a[2]){r.length=s;break}if(0>s&&(!t||t==a[2]))return{tag:a[2],from:h(e.line,e.ch),to:h(i,o)}}}else l(e)}}var h=e.Pos,f="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",p=f+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",g=new RegExp("<(/?)(["+f+"]["+p+"]*)","g");
2
- e.registerHelper("fold","xml",function(e,t){for(var n=new r(e,t.line,0);;){var i,o=s(n);if(!o||n.line!=t.line||!(i=a(n)))return;if(!o[1]&&"selfClose"!=i){var t=h(n.line,n.ch),l=u(n,o[2]);return l&&{from:t,to:l.from}}}}),e.findMatchingTag=function(e,n,i){var o=new r(e,n.line,n.ch,i);if(-1!=o.text.indexOf(">")||-1!=o.text.indexOf("<")){var s=a(o),c=s&&h(o.line,o.ch),f=s&&l(o);if(s&&f&&!(t(o,n)>0)){var p={from:h(o.line,o.ch),to:c,tag:f[2]};return"selfClose"==s?{open:p,close:null,at:"open"}:f[1]?{open:d(o,f[2]),close:p,at:"close"}:(o=new r(e,c.line,c.ch,i),{open:p,close:u(o,f[2]),at:"open"})}}},e.findEnclosingTag=function(e,t,n){for(var i=new r(e,t.line,t.ch,n);;){var o=d(i);if(!o)break;var a=new r(e,t.line,t.ch,n),l=u(a,o.tag);if(l)return{open:o,close:l}}},e.scanForClosingTag=function(e,t,n,i){var o=new r(e,t.line,t.ch,i?{from:0,to:i}:null);return u(o,n)}})},{"../../lib/codemirror":16}],16:[function(e,r,n){!function(e){if("object"==typeof n&&"object"==typeof r)r.exports=e();else{if("function"==typeof t&&t.amd)return t([],e);(this||window).CodeMirror=e()}}(function(){"use strict";function e(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n?Ii(n):{},Ii(Jo,n,!1),f(n);var i=n.value;"string"==typeof i&&(i=new Ca(i,n.mode,null,n.lineSeparator)),this.doc=i;var o=new e.inputStyles[n.inputStyle](this),a=this.display=new t(r,i,o);a.wrapper.CodeMirror=this,c(this),l(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),n.autofocus&&!Ao&&a.input.focus(),v(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Ni,keySeq:null,specialChars:null};var s=this;bo&&11>wo&&setTimeout(function(){s.display.input.reset(!0)},20),Bt(this),Yi(),wt(this),this.curOp.forceUpdate=!0,Xn(this,i),n.autofocus&&!Ao||s.hasFocus()?setTimeout(Hi(mr,this),20):vr(this);for(var u in ea)ea.hasOwnProperty(u)&&ea[u](this,n[u],ta);k(this),n.finishInit&&n.finishInit(this);for(var d=0;d<oa.length;++d)oa[d](this);kt(this),xo&&n.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function t(e,t,r){var n=this;this.input=r,n.scrollbarFiller=Bi("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=Bi("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=Bi("div",null,"CodeMirror-code"),n.selectionDiv=Bi("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=Bi("div",null,"CodeMirror-cursors"),n.measure=Bi("div",null,"CodeMirror-measure"),n.lineMeasure=Bi("div",null,"CodeMirror-measure"),n.lineSpace=Bi("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none"),n.mover=Bi("div",[Bi("div",[n.lineSpace],"CodeMirror-lines")],null,"position: relative"),n.sizer=Bi("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=Bi("div",null,null,"position: absolute; height: "+Ea+"px; width: 1px;"),n.gutters=Bi("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=Bi("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=Bi("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),bo&&8>wo&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),xo||mo&&Ao||(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,Fe(e,100),e.state.modeGen++,e.curOp&&Pt(e)}function i(e){e.options.lineWrapping?(Za(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Xa(e.display.wrapper,"CodeMirror-wrap"),h(e)),a(e),Pt(e),lt(e),setTimeout(function(){y(e)},100)}function o(e){var t=yt(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/bt(e.display)-3);return function(i){if(kn(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function a(e){var t=e.doc,r=o(e);t.iter(function(e){var t=r(e);t!=e.height&&ei(e,t)})}function l(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),lt(e)}function s(e){c(e),Pt(e),setTimeout(function(){x(e)},20)}function c(e){var t=e.display.gutters,r=e.options.gutters;Ki(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(Bi("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",u(e)}function u(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function d(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=gn(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=mn(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=Zn(r,r.first),t.maxLineLength=d(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=d(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function f(e){var t=zi(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+Ue(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+qe(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function g(e,t,r){this.cm=r;var n=this.vert=Bi("div",[Bi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=Bi("div",[Bi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),Aa(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Aa(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,bo&&8>wo&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function m(){}function v(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Xa(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),Aa(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,r){"horizontal"==r?ir(t,e):nr(t,e)},t),t.display.scrollbars.addClass&&Za(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-Ke(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=ri(t,n),a=ri(t,i);if(r&&r.ensure){var l=r.ensure.from.line,s=r.ensure.to.line;o>l?(o=l,a=ri(t,ni(Zn(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=ri(t,ni(Zn(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function x(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=S(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a<r.length;a++)if(!r[a].hidden){e.options.fixedGutter&&r[a].gutter&&(r[a].gutter.style.left=o);var l=r[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function k(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=C(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(Bi("div",[Bi("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-a)+1,n.lineNumWidth=n.lineNumInnerWidth+a,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",u(e),!0}return!1}function C(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function S(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function T(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=Ve(e),this.force=r,this.dims=z(e),this.events=[]}function L(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=qe(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=qe(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==Rt(e))return!1;k(e)&&(It(e),t.dims=z(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>a&&r.viewTo-a<20&&(a=Math.min(i,r.viewTo)),Do&&(o=wn(e.doc,o),a=xn(e.doc,a));var l=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;jt(e,o,a),r.viewOffset=ni(Zn(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var s=Rt(e);if(!l&&0==s&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=Gi();return s>4&&(r.lineDiv.style.display="none"),E(e,r.updateLineNumbers,t.dims),s>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,c&&Gi()!=c&&c.offsetHeight&&c.focus(),Ki(r.cursorDiv),Ki(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,l&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Fe(e,400)),r.updateLineNumbers=null,!0}function _(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Ve(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Ue(e.display)-$e(e),r.top)}),t.visible=w(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&M(e,t);n=!1){O(e);var i=p(e);Ee(e),N(e,i),y(e,i)}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 T(e,t);if(M(e,r)){O(e),_(e,r);var n=p(e);Ee(e),N(e,n),y(e,n),r.finish()}}function N(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+qe(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(bo&&8>wo){var a=o.node.offsetTop+o.node.offsetHeight;i=a-r,r=a}else{var l=o.node.getBoundingClientRect();i=l.bottom-l.top}var s=o.line.height-i;if(2>i&&(i=yt(t)),(s>.001||-.001>s)&&(ei(o.line,i),W(o.line),o.rest))for(var c=0;c<o.rest.length;c++)W(o.rest[c])}}}function W(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.parentNode.offsetHeight}function z(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a)r[e.options.gutters[a]]=o.offsetLeft+o.clientLeft+i,n[e.options.gutters[a]]=o.clientWidth;return{fixedPos:S(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function E(e,t,r){function n(t){var r=t.nextSibling;return xo&&No&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var i=e.display,o=e.options.lineNumbers,a=i.lineDiv,l=a.firstChild,s=i.view,c=i.viewFrom,u=0;u<s.length;u++){var d=s[u];if(d.hidden);else if(d.node&&d.node.parentNode==a){for(;l!=d.node;)l=n(l);var h=o&&null!=t&&c>=t&&d.lineNumber;d.changes&&(zi(d.changes,"gutter")>-1&&(h=!1),P(e,d,c,r)),h&&(Ki(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(C(e.options,c)))),l=d.node.nextSibling}else{var f=K(e,d,c,r);a.insertBefore(f,l)}c+=d.size}for(;l;)l=n(l)}function P(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?F(e,t):"gutter"==o?R(e,t,r,n):"class"==o?j(t):"widget"==o&&B(e,t,n)}t.changes=null}function D(e){return e.node==e.text&&(e.node=Bi("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),bo&&8>wo&&(e.node.style.zIndex=2)),e.node}function I(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=D(e);e.background=r.insertBefore(Bi("div",null,t),r.firstChild)}}function H(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Hn(e,t)}function F(e,t){var r=t.text.className,n=H(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,j(t)):r&&(t.text.className=r)}function j(e){I(e),e.line.wrapClass?D(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 R(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=D(t);t.gutterBackground=Bi("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var i=D(t),a=t.gutter=Bi("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),i.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(Bi("div",C(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var l=0;l<e.options.gutters.length;++l){var s=e.options.gutters[l],c=o.hasOwnProperty(s)&&o[s];c&&a.appendChild(Bi("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[s]+"px; width: "+n.gutterWidth[s]+"px"))}}}function B(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)}U(e,t,r)}function K(e,t,r,n){var i=H(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),j(t),R(e,t,r,n),U(e,t,n),t.node}function U(e,t,r){if(G(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)G(e,t.rest[n],t,r,!1)}function G(e,t,r,n,i){if(t.widgets)for(var o=D(r),a=0,l=t.widgets;a<l.length;++a){var s=l[a],c=Bi("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),q(s,c,r,n),e.display.input.setUneditable(c),i&&s.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),Si(s,"redraw")}}function q(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 V(e){return Io(e.line,e.ch)}function $(e,t){return Ho(e,t)<0?t:e}function Y(e,t){return Ho(e,t)<0?e:t}function X(e){e.state.focused||(e.display.input.focus(),mr(e))}function Z(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var a=e.state.pasteIncoming||"paste"==i,l=o.splitLines(t),s=null;if(a&&n.ranges.length>1)if(Fo&&Fo.join("\n")==t){if(n.ranges.length%Fo.length==0){s=[];for(var c=0;c<Fo.length;c++)s.push(o.splitLines(Fo[c]))}}else l.length==n.ranges.length&&(s=Ei(l,function(e){return[e]}));for(var c=n.ranges.length-1;c>=0;c--){var u=n.ranges[c],d=u.from(),h=u.to();u.empty()&&(r&&r>0?d=Io(d.line,d.ch-r):e.state.overwrite&&!a&&(h=Io(h.line,Math.min(Zn(o,h.line).text.length,h.ch+Wi(l).length))));var f=e.curOp.updateInput,p={from:d,to:h,text:s?s[c%s.length]:l,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};Tr(e.doc,p),Si(e,"inputRead",e,p)}t&&!a&&J(e,t),Ir(e),e.curOp.updateInput=f,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Q(e,t){var r=e.clipboardData&&e.clipboardData.getData("text/plain");return r?(e.preventDefault(),t.isReadOnly()||t.options.disableInput||At(t,function(){Z(t,r,0,null,"paste")}),!0):void 0}function J(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(t.indexOf(o.electricChars.charAt(l))>-1){a=Fr(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Zn(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Fr(e,i.head.line,"smart"));a&&Si(e,"electricInput",e,i.head.line)}}}function ee(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:Io(i,0),head:Io(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function te(e){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false")}function re(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Ni,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null}function ne(){var e=Bi("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none"),t=Bi("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return xo?e.style.width="1000px":e.setAttribute("wrap","off"),_o&&(e.style.border="1px solid black"),te(e),t}function ie(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Ni,this.gracePeriod=!1}function oe(e,t){var r=Je(e,t.line);if(!r||r.hidden)return null;var n=Zn(e.doc,t.line),i=Xe(r,n,t.line),o=ii(n),a="left";if(o){var l=co(o,t.ch);a=l%2?"right":"left"}var s=rt(i.map,t.ch,a);return s.offset="right"==s.collapse?s.end:s.start,s}function ae(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 ae(e.clipPos(Io(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<(u?u.length:0);i++)for(var o=0>i?c.map:u[i],a=0;a<o.length;a+=3){var l=o[a+2];if(l==t||l==r){var s=ti(0>i?e.line:e.rest[i]),d=o[a]+n;return(0>n||l!=t)&&(d=o[a+(n?1:0)]),Io(s,d)}}}var i=e.text.firstChild,o=!1;if(!t||!Va(i,t))return ae(Io(ti(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[r],r=0,!t)){var a=e.rest?Wi(e.rest):e.line;return ae(Io(ti(a),a.text.length),o)}var l=3==t.nodeType?t:null,s=t;for(l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,r&&(r=l.nodeValue.length));s.parentNode!=i;)s=s.parentNode;var c=e.measure,u=c.maps,d=n(l,s,r);if(d)return ae(d,o);for(var h=s.nextSibling,f=l?l.nodeValue.length-r:0;h;h=h.nextSibling){if(d=n(h,h.firstChild,0))return ae(Io(d.line,d.ch-f),o);f+=h.textContent.length}for(var p=s.previousSibling,f=r;p;p=p.previousSibling){if(d=n(p,p.firstChild,-1))return ae(Io(d.line,d.ch+f),o);f+=h.textContent.length}}function ce(e,t,r,n,i){function o(e){return function(t){return t.id==e}}function a(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return""==r&&(r=t.textContent.replace(/\u200b/g,"")),void(l+=r);var u,d=t.getAttribute("cm-marker");if(d){var h=e.findMarks(Io(n,0),Io(i+1,0),o(+d));return void(h.length&&(u=h[0].find())&&(l+=Qn(e.doc,u.from,u.to).join(c)))}if("false"==t.getAttribute("contenteditable"))return;for(var f=0;f<t.childNodes.length;f++)a(t.childNodes[f]);/^(pre|div|p)$/i.test(t.nodeName)&&(s=!0)}else if(3==t.nodeType){var p=t.nodeValue;if(!p)return;s&&(l+=c,s=!1),l+=p}}for(var l="",s=!1,c=e.doc.lineSeparator();a(t),t!=r;)t=t.nextSibling;return l}function ue(e,t){this.ranges=e,this.primIndex=t}function de(e,t){this.anchor=e,this.head=t}function he(e,t){var r=e[t];e.sort(function(e,t){return Ho(e.from(),t.from())}),t=zi(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(Ho(o.to(),i.from())>=0){var a=Y(o.from(),i.from()),l=$(o.to(),i.to()),s=o.empty()?i.from()==i.head:o.from()==o.head;t>=n&&--t,e.splice(--n,2,new de(s?l:a,s?a:l))}}return new ue(e,t)}function fe(e,t){return new ue([new de(e,t||e)],0)}function pe(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ge(e,t){if(t.line<e.first)return Io(e.first,0);var r=e.first+e.size-1;return t.line>r?Io(r,Zn(e,r).text.length):me(t,Zn(e,t.line).text.length)}function me(e,t){var r=e.ch;return null==r||r>t?Io(e.line,t):0>r?Io(e.line,0):e}function ve(e,t){return t>=e.first&&t<e.first+e.size}function ye(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=ge(e,t[n]);return r}function be(e,t,r,n){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(n){var o=Ho(r,i)<0;o!=Ho(n,i)<0?(i=r,r=n):o!=Ho(r,n)<0&&(r=n)}return new de(i,r)}return new de(n||r,r)}function we(e,t,r,n){Le(e,new ue([be(e,e.sel.primary(),t,r)],0),n)}function xe(e,t,r){for(var n=[],i=0;i<e.sel.ranges.length;i++)n[i]=be(e,e.sel.ranges[i],t[i],null);var o=he(n,e.sel.primIndex);Le(e,o,r)}function ke(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Le(e,he(i,e.sel.primIndex),n)}function Ce(e,t,r,n){Le(e,fe(t,r),n)}function Se(e,t,r){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new de(ge(e,t[r].anchor),ge(e,t[r].head))},origin:r&&r.origin};return Wa(e,"beforeSelectionChange",e,n),e.cm&&Wa(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?he(n.ranges,n.ranges.length-1):t}function Te(e,t,r){var n=e.history.done,i=Wi(n);i&&i.ranges?(n[n.length-1]=t,Me(e,t,r)):Le(e,t,r)}function Le(e,t,r){Me(e,t,r),di(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Me(e,t,r){(_i(e,"beforeSelectionChange")||e.cm&&_i(e.cm,"beforeSelectionChange"))&&(t=Se(e,t,r));var n=r&&r.bias||(Ho(t.primary().head,e.sel.primary().head)<0?-1:1);_e(e,Ne(e,t,n,!0)),r&&r.scroll===!1||!e.cm||Ir(e.cm)}function _e(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,Mi(e.cm)),Si(e,"cursorActivity",e))}function Ae(e){_e(e,Ne(e,e.sel,null,!1),Da)}function Ne(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=We(e,a.anchor,l&&l.anchor,r,n),c=We(e,a.head,l&&l.head,r,n);(i||s!=a.anchor||c!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new de(s,c))}return i?he(i,t.primIndex):t}function Oe(e,t,r,n,i){var o=Zn(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker;if((null==l.from||(s.inclusiveLeft?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(s.inclusiveRight?l.to>=t.ch:l.to>t.ch))){if(i&&(Wa(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(r){var c,u=s.find(0>n?1:-1);if((0>n?s.inclusiveRight:s.inclusiveLeft)&&(u=ze(e,u,-n,o)),u&&u.line==t.line&&(c=Ho(u,r))&&(0>n?0>c:c>0))return Oe(e,u,t,n,i)}var d=s.find(0>n?-1:1);return(0>n?s.inclusiveLeft:s.inclusiveRight)&&(d=ze(e,d,n,o)),d?Oe(e,d,t,n,i):null}}return t}function We(e,t,r,n,i){var o=n||1,a=Oe(e,t,r,o,i)||!i&&Oe(e,t,r,o,!0)||Oe(e,t,r,-o,i)||!i&&Oe(e,t,r,-o,!0);return a?a:(e.cantEdit=!0,Io(e.first,0))}function ze(e,t,r,n){return 0>r&&0==t.ch?t.line>e.first?ge(e,Io(t.line-1)):null:r>0&&t.ch==(n||Zn(e,t.line)).text.length?t.line<e.first+e.size-1?Io(t.line+1,0):null:new Io(t.line,t.ch+r)}function Ee(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Pe(e,t){for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),a=0;a<r.sel.ranges.length;a++)if(t!==!1||a!=r.sel.primIndex){var l=r.sel.ranges[a],s=l.empty();(s||e.options.showCursorWhenSelecting)&&De(e,l.head,i),s||Ie(e,l,o)}return n}function De(e,t,r){var n=ft(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(Bi("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(Bi("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),l.appendChild(Bi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?u-e:r)+"px; height: "+(n-t)+"px"))}function i(t,r,i){function o(r,n){return ht(e,Io(t,r),"div",d,n)}var l,s,d=Zn(a,t),h=d.text.length;return eo(ii(d),r||0,null==i?h:i,function(e,t,a){var d,f,p,g=o(e,"left");if(e==t)d=g,f=p=g.left;else{if(d=o(t-1,"right"),"rtl"==a){var m=g;g=d,d=m}f=g.left,p=d.right}null==r&&0==e&&(f=c),d.top-g.top>3&&(n(f,g.top,null,g.bottom),f=c,g.bottom<d.top&&n(f,g.bottom,null,d.top)),null==i&&t==h&&(p=u),(!l||g.top<l.top||g.top==l.top&&g.left<l.left)&&(l=g),(!s||d.bottom>s.bottom||d.bottom==s.bottom&&d.right>s.right)&&(s=d),c+1>f&&(f=c),n(f,d.top,p-f,d.bottom)}),{start:l,end:s}}var o=e.display,a=e.doc,l=document.createDocumentFragment(),s=Ge(e.display),c=s.left,u=Math.max(o.sizerWidth,Ve(e)-o.sizer.offsetLeft)-s.right,d=t.from(),h=t.to();if(d.line==h.line)i(d.line,d.ch,h.ch);else{var f=Zn(a,d.line),p=Zn(a,h.line),g=yn(f)==yn(p),m=i(d.line,d.ch,g?f.text.length+1:null).end,v=i(h.line,g?0:null,h.ch).start;g&&(m.top<v.top-2?(n(m.right,m.top,null,m.bottom),n(c,v.top,v.left,v.bottom)):n(m.right,m.top,v.left-m.right,m.bottom)),m.bottom<v.top&&n(c,m.bottom,null,v.top)}r.appendChild(l)}function He(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 Fe(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,Hi(je,e))}function je(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=la(t.mode,Be(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 a=o.styles,l=o.text.length>e.options.maxHighlightLength,s=En(e,o,l?la(t.mode,n):n,!0);o.styles=s.styles;var c=o.styleClasses,u=s.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),h=0;!d&&h<a.length;++h)d=a[h]!=o.styles[h];d&&i.push(t.frontier),o.stateAfter=l?n:la(t.mode,n)}else o.text.length<=e.options.maxHighlightLength&&Dn(e,o.text,n),o.stateAfter=t.frontier%5==0?la(t.mode,n):null;return++t.frontier,+new Date>r?(Fe(e,e.options.workDelay),!0):void 0}),i.length&&At(e,function(){for(var t=0;t<i.length;t++)Dt(e,i[t],"text")})}}function Re(e,t,r){for(var n,i,o=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=Zn(o,l-1);if(s.stateAfter&&(!r||l<=o.frontier))return l;var c=Fa(s.text,null,e.options.tabSize);(null==i||n>c)&&(i=l-1,n=c)}return i}function Be(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=Re(e,t,r),a=o>n.first&&Zn(n,o-1).stateAfter;return a=a?la(n.mode,a):sa(n.mode),n.iter(o,t,function(r){Dn(e,r.text,a);var l=o==t-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;r.stateAfter=l?la(n.mode,a):null,++o}),r&&(n.frontier=o),a}function Ke(e){return e.lineSpace.offsetTop}function Ue(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Ge(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Ui(e.measure,Bi("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 qe(e){return Ea-e.display.nativeBarWidth}function Ve(e){return e.display.scroller.clientWidth-qe(e)-e.display.barWidth}function $e(e){return e.display.scroller.clientHeight-qe(e)-e.display.barHeight}function Ye(e,t,r){var n=e.options.lineWrapping,i=n&&Ve(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],c=a[l+1];Math.abs(s.bottom-c.bottom)>2&&o.push((s.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}function Xe(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(ti(e.rest[n])>r)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Ze(e,t){t=yn(t);var r=ti(t),n=e.display.externalMeasured=new zt(e.doc,t,r);n.lineN=r;var i=n.built=Hn(e,n);return n.text=i.pre,Ui(e.display.lineMeasure,i.pre),n}function Qe(e,t,r,n){return tt(e,et(e,t),r,n)}function Je(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Ht(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function et(e,t){
3
- var r=ti(t),n=Je(e,r);n&&!n.text?n=null:n&&n.changes&&(P(e,n,r,z(e)),e.curOp.forceUpdate=!0),n||(n=Ze(e,t));var i=Xe(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function tt(e,t,r,n,i){t.before&&(r=-1);var o,a=r+(n||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ye(e,t.view,t.rect),t.hasHeights=!0),o=nt(e,t,r,n),o.bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function rt(e,t,r){for(var n,i,o,a,l=0;l<e.length;l+=3){var s=e[l],c=e[l+1];if(s>t?(i=0,o=1,a="left"):c>t?(i=t-s,o=i+1):(l==e.length-3||t==c&&e[l+3]>t)&&(o=c-s,i=o-1,t>=c&&(a="right")),null!=i){if(n=e[l+2],s==c&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)for(;l&&e[l-2]==e[l-3]&&e[l-1].insertLeft;)n=e[(l-=3)+2],a="left";if("right"==r&&i==c-s)for(;l<e.length-3&&e[l+3]==e[l+4]&&!e[l+5].insertLeft;)n=e[(l+=3)+2],a="right";break}}return{node:n,start:i,end:o,collapse:a,coverStart:s,coverEnd:c}}function nt(e,t,r,n){var i,o=rt(t.map,r,n),a=o.node,l=o.start,s=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;4>u;u++){for(;l&&Ri(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+s<o.coverEnd&&Ri(t.line.text.charAt(o.coverStart+s));)++s;if(bo&&9>wo&&0==l&&s==o.coverEnd-o.coverStart)i=a.parentNode.getBoundingClientRect();else if(bo&&e.options.lineWrapping){var d=Ka(a,l,s).getClientRects();i=d.length?d["right"==n?d.length-1:0]:Ko}else i=Ka(a,l,s).getBoundingClientRect()||Ko;if(i.left||i.right||0==l)break;s=l,l-=1,c="right"}bo&&11>wo&&(i=it(e.display.measure,i))}else{l>0&&(c=n="right");var d;i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(bo&&9>wo&&!l&&(!i||!i.left&&!i.right)){var h=a.parentNode.getClientRects()[0];i=h?{left:h.left,right:h.left+bt(e.display),top:h.top,bottom:h.bottom}:Ko}for(var f=i.top-t.rect.top,p=i.bottom-t.rect.top,g=(f+p)/2,m=t.view.measure.heights,u=0;u<m.length-1&&!(g<m[u]);u++);var v=u?m[u-1]:0,y=m[u],b={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:v,bottom:y};return i.left||i.right||(b.bogus=!0),e.options.singleCursorHeightPerLine||(b.rtop=f,b.rbottom=p),b}function it(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Ji(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 ot(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 at(e){e.display.externalMeasure=null,Ki(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)ot(e.display.view[t])}function lt(e){at(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function st(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ct(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function ut(e,t,r,n){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=Tn(t.widgets[i]);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var a=ni(t);if("local"==n?a+=Ke(e.display):a-=e.display.viewOffset,"page"==n||"window"==n){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==n?0:ct());var s=l.left+("window"==n?0:st());r.left+=s,r.right+=s}return r.top+=a,r.bottom+=a,r}function dt(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=st(),i-=ct();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:n-a.left,top:i-a.top}}function ht(e,t,r,n,i){return n||(n=Zn(e.doc,t.line)),ut(e,n,Qe(e,n,t.ch,i),r)}function ft(e,t,r,n,i,o){function a(t,a){var l=tt(e,i,t,a?"right":"left",o);return a?l.left=l.right:l.right=l.left,ut(e,n,l,r)}function l(e,t){var r=s[t],n=r.level%2;return e==to(r)&&t&&r.level<s[t-1].level?(r=s[--t],e=ro(r)-(r.level%2?0:1),n=!0):e==ro(r)&&t<s.length-1&&r.level<s[t+1].level&&(r=s[++t],e=to(r)-r.level%2,n=!1),n&&e==r.to&&e>r.from?a(e-1):a(e,n)}n=n||Zn(e.doc,t.line),i||(i=et(e,n));var s=ii(n),c=t.ch;if(!s)return a(c);var u=co(s,c),d=l(c,u);return null!=ol&&(d.other=l(c,ol)),d}function pt(e,t){var r=0,t=ge(e.doc,t);e.options.lineWrapping||(r=bt(e.display)*t.ch);var n=Zn(e.doc,t.line),i=ni(n)+Ke(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function gt(e,t,r,n){var i=Io(e,t);return i.xRel=n,r&&(i.outside=!0),i}function mt(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,0>r)return gt(n.first,0,!0,-1);var i=ri(n,r),o=n.first+n.size-1;if(i>o)return gt(n.first+n.size-1,Zn(n,o).text.length,!0,1);0>t&&(t=0);for(var a=Zn(n,i);;){var l=vt(e,a,i,t,r),s=mn(a),c=s&&s.find(0,!0);if(!s||!(l.ch>c.from.ch||l.ch==c.from.ch&&l.xRel>0))return l;i=ti(a=c.to.line)}}function vt(e,t,r,n,i){function o(n){var i=ft(e,Io(r,n),"line",t,c);return l=!0,a>i.bottom?i.left-s:a<i.top?i.left+s:(l=!1,i.left)}var a=i-ni(t),l=!1,s=2*e.display.wrapper.clientWidth,c=et(e,t),u=ii(t),d=t.text.length,h=no(t),f=io(t),p=o(h),g=l,m=o(f),v=l;if(n>m)return gt(r,f,v,1);for(;;){if(u?f==h||f==ho(t,h,1):1>=f-h){for(var y=p>n||m-n>=n-p?h:f,b=n-(y==h?p:m);Ri(t.text.charAt(y));)++y;var w=gt(r,y,y==h?g:v,-1>b?-1:b>1?1:0);return w}var x=Math.ceil(d/2),k=h+x;if(u){k=h;for(var C=0;x>C;++C)k=ho(t,k,1)}var S=o(k);S>n?(f=k,m=S,(v=l)&&(m+=1e3),d=x):(h=k,p=S,g=l,d-=x)}}function yt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==jo){jo=Bi("pre");for(var t=0;49>t;++t)jo.appendChild(document.createTextNode("x")),jo.appendChild(Bi("br"));jo.appendChild(document.createTextNode("x"))}Ui(e.measure,jo);var r=jo.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),Ki(e.measure),r||1}function bt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Bi("span","xxxxxxxxxx"),r=Bi("pre",[t]);Ui(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function wt(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,focus:!1,id:++Go},Uo?Uo.ops.push(e.curOp):e.curOp.ownsGroup=Uo={ops:[e.curOp],delayedCallbacks:[]}}function xt(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}function kt(e){var t=e.curOp,r=t.ownsGroup;if(r)try{xt(r)}finally{Uo=null;for(var n=0;n<r.ops.length;n++)r.ops[n].cm.curOp=null;Ct(r)}}function Ct(e){for(var t=e.ops,r=0;r<t.length;r++)St(t[r]);for(var r=0;r<t.length;r++)Tt(t[r]);for(var r=0;r<t.length;r++)Lt(t[r]);for(var r=0;r<t.length;r++)Mt(t[r]);for(var r=0;r<t.length;r++)_t(t[r])}function St(e){var t=e.cm,r=t.display;L(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 T(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Tt(e){e.updatedDisplay=e.mustUpdate&&M(e.cm,e.update)}function Lt(e){var t=e.cm,r=t.display;e.updatedDisplay&&O(t),e.barMeasure=p(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Qe(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+qe(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Ve(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Mt(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&ir(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1),e.preparedSelection&&t.display.input.showSelection(e.preparedSelection),e.updatedDisplay&&N(t,e.barMeasure),(e.updatedDisplay||e.startHeight!=t.doc.height)&&y(t,e.barMeasure),e.selectionChanged&&He(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),!e.focus||e.focus!=Gi()||document.hasFocus&&!document.hasFocus()||X(e.cm)}function _t(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&_(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-Ve(t),e.scrollLeft)),r.scrollbars.setScrollLeft(n.scrollLeft),r.scroller.scrollLeft=n.scrollLeft,x(t)),e.scrollToPos){var i=zr(t,ge(n,e.scrollToPos.from),ge(n,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&Wr(t,i)}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var l=0;l<o.length;++l)o[l].lines.length||Wa(o[l],"hide");if(a)for(var l=0;l<a.length;++l)a[l].lines.length&&Wa(a[l],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Wa(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function At(e,t){if(e.curOp)return t();wt(e);try{return t()}finally{kt(e)}}function Nt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);wt(e);try{return t.apply(e,arguments)}finally{kt(e)}}}function Ot(e){return function(){if(this.curOp)return e.apply(this,arguments);wt(this);try{return e.apply(this,arguments)}finally{kt(this)}}}function Wt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);wt(t);try{return e.apply(this,arguments)}finally{kt(t)}}}function zt(e,t,r){this.line=t,this.rest=bn(t),this.size=this.rest?ti(Wi(this.rest))-r+1:1,this.node=this.text=null,this.hidden=kn(e,t)}function Et(e,t,r){for(var n,i=[],o=t;r>o;o=n){var a=new zt(e.doc,Zn(e.doc,o),o);n=o+a.size,i.push(a)}return i}function Pt(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)Do&&wn(e.doc,t)<i.viewTo&&It(e);else if(r<=i.viewFrom)Do&&xn(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=Ft(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=Ft(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):It(e)}else{var a=Ft(e,t,t,-1),l=Ft(e,r,r+n,1);a&&l?(i.view=i.view.slice(0,a.index).concat(Et(e,a.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=n):It(e)}var s=i.externalMeasured;s&&(r<s.lineN?s.lineN+=n:t<s.lineN+s.size&&(i.externalMeasured=null))}function Dt(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[Ht(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==zi(a,r)&&a.push(r)}}}function It(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ht(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 Ft(e,t,r,n){var i,o=Ht(e,t),a=e.display.view;if(!Do||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var l=0,s=e.display.viewFrom;o>l;l++)s+=a[l].size;if(s!=t){if(n>0){if(o==a.length-1)return null;i=s+a[o].size-t,o++}else i=s-t;t+=i,r+=i}for(;wn(e.doc,r)!=r;){if(o==(0>n?0:a.length-1))return null;r+=n*a[o-(0>n?1:0)].size,o+=n}return{index:o,lineN:r}}function jt(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=Et(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Et(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Ht(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(Et(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,Ht(e,r)))),n.viewTo=r}function Rt(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 Bt(e){function t(){i.activeTouch&&(o=setTimeout(function(){i.activeTouch=null},1e3),a=i.activeTouch,a.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}var i=e.display;Aa(i.scroller,"mousedown",Nt(e,Vt)),bo&&11>wo?Aa(i.scroller,"dblclick",Nt(e,function(t){if(!Li(e,t)){var r=qt(e,t);if(r&&!Qt(e,t)&&!Gt(e.display,t)){La(t);var n=e.findWordAt(r);we(e.doc,n.anchor,n.head)}}})):Aa(i.scroller,"dblclick",function(t){Li(e,t)||La(t)}),Eo||Aa(i.scroller,"contextmenu",function(t){yr(e,t)});var o,a={end:0};Aa(i.scroller,"touchstart",function(t){if(!Li(e,t)&&!r(t)){clearTimeout(o);var n=+new Date;i.activeTouch={start:n,moved:!1,prev:n-a.end<=300?a:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),Aa(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Aa(i.scroller,"touchend",function(r){var o=i.activeTouch;if(o&&!Gt(i,r)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,l=e.coordsChar(i.activeTouch,"page");a=!o.prev||n(o,o.prev)?new de(l,l):!o.prev.prev||n(o,o.prev.prev)?e.findWordAt(l):new de(Io(l.line,0),ge(e.doc,Io(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),La(r)}t()}),Aa(i.scroller,"touchcancel",t),Aa(i.scroller,"scroll",function(){i.scroller.clientHeight&&(nr(e,i.scroller.scrollTop),ir(e,i.scroller.scrollLeft,!0),Wa(e,"scroll",e))}),Aa(i.scroller,"mousewheel",function(t){or(e,t)}),Aa(i.scroller,"DOMMouseScroll",function(t){or(e,t)}),Aa(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Li(e,t)||_a(t)},over:function(t){Li(e,t)||(tr(e,t),_a(t))},start:function(t){er(e,t)},drop:Nt(e,Jt),leave:function(){rr(e)}};var l=i.input.getField();Aa(l,"keyup",function(t){fr.call(e,t)}),Aa(l,"keydown",Nt(e,dr)),Aa(l,"keypress",Nt(e,pr)),Aa(l,"focus",Hi(mr,e)),Aa(l,"blur",Hi(vr,e))}function Kt(t,r,n){var i=n&&n!=e.Init;if(!r!=!i){var o=t.display.dragFunctions,a=r?Aa:Oa;a(t.display.scroller,"dragstart",o.start),a(t.display.scroller,"dragenter",o.enter),a(t.display.scroller,"dragover",o.over),a(t.display.scroller,"dragleave",o.leave),a(t.display.scroller,"drop",o.drop)}}function Ut(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=xi(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 qt(e,t,r,n){var i=e.display;if(!r&&"true"==xi(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,c=mt(e,o,a);if(n&&1==c.xRel&&(s=Zn(e.doc,c.line).text).length==c.ch){var u=Fa(s,s.length,e.options.tabSize)-s.length;c=Io(c.line,Math.max(0,Math.round((o-Ge(e.display).left)/bt(e.display))-u))}return c}function Vt(e){var t=this,r=t.display;if(!(Li(t,e)||r.activeTouch&&r.input.supportsTouch())){if(r.shift=e.shiftKey,Gt(r,e))return void(xo||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!Qt(t,e)){var n=qt(t,e);switch(window.focus(),ki(e)){case 1:t.state.selectingText?t.state.selectingText(e):n?$t(t,e,n):xi(e)==r.scroller&&La(e);break;case 2:xo&&(t.state.lastMiddleDown=+new Date),n&&we(t.doc,n),setTimeout(function(){r.input.focus()},20),La(e);break;case 3:Eo?yr(t,e):gr(t)}}}}function $t(e,t,r){bo?setTimeout(Hi(X,e),0):e.curOp.focus=Gi();var n,i=+new Date;Bo&&Bo.time>i-400&&0==Ho(Bo.pos,r)?n="triple":Ro&&Ro.time>i-400&&0==Ho(Ro.pos,r)?(n="double",Bo={time:i,pos:r}):(n="single",Ro={time:i,pos:r});var o,a=e.doc.sel,l=No?t.metaKey:t.ctrlKey;e.options.dragDrop&&Ja&&!e.isReadOnly()&&"single"==n&&(o=a.contains(r))>-1&&(Ho((o=a.ranges[o]).from(),r)<0||r.xRel>0)&&(Ho(o.to(),r)>0||r.xRel<0)?Yt(e,t,r,l):Xt(e,t,r,n,l)}function Yt(e,t,r,n){var i=e.display,o=+new Date,a=Nt(e,function(l){xo&&(i.scroller.draggable=!1),e.state.draggingText=!1,Oa(document,"mouseup",a),Oa(i.scroller,"drop",a),Math.abs(t.clientX-l.clientX)+Math.abs(t.clientY-l.clientY)<10&&(La(l),!n&&+new Date-200<o&&we(e.doc,r),xo||bo&&9==wo?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())});xo&&(i.scroller.draggable=!0),e.state.draggingText=a,i.scroller.dragDrop&&i.scroller.dragDrop(),Aa(document,"mouseup",a),Aa(i.scroller,"drop",a)}function Xt(e,t,r,n,i){function o(t){if(0!=Ho(m,t))if(m=t,"rect"==n){for(var i=[],o=e.options.tabSize,a=Fa(Zn(c,r.line).text,r.ch,o),l=Fa(Zn(c,t.line).text,t.ch,o),s=Math.min(a,l),f=Math.max(a,l),p=Math.min(r.line,t.line),g=Math.min(e.lastLine(),Math.max(r.line,t.line));g>=p;p++){var v=Zn(c,p).text,y=ja(v,s,o);s==f?i.push(new de(Io(p,y),Io(p,y))):v.length>y&&i.push(new de(Io(p,y),Io(p,ja(v,f,o))))}i.length||i.push(new de(r,r)),Le(c,he(h.ranges.slice(0,d).concat(i),d),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,w=b.anchor,x=t;if("single"!=n){if("double"==n)var k=e.findWordAt(t);else var k=new de(Io(t.line,0),ge(c,Io(t.line+1,0)));Ho(k.anchor,w)>0?(x=k.head,w=Y(b.from(),k.anchor)):(x=k.anchor,w=$(b.to(),k.head))}var i=h.ranges.slice(0);i[d]=new de(ge(c,w),x),Le(c,he(i,d),Ia)}}function a(t){var r=++y,i=qt(e,t,!0,"rect"==n);if(i)if(0!=Ho(i,m)){e.curOp.focus=Gi(),o(i);var l=w(s,c);(i.line>=l.to||i.line<l.from)&&setTimeout(Nt(e,function(){y==r&&a(t)}),150)}else{var u=t.clientY<v.top?-20:t.clientY>v.bottom?20:0;u&&setTimeout(Nt(e,function(){y==r&&(s.scroller.scrollTop+=u,a(t))}),50)}}function l(t){e.state.selectingText=!1,y=1/0,La(t),s.input.focus(),Oa(document,"mousemove",b),Oa(document,"mouseup",x),c.history.lastSelOrigin=null}var s=e.display,c=e.doc;La(t);var u,d,h=c.sel,f=h.ranges;if(i&&!t.shiftKey?(d=c.sel.contains(r),u=d>-1?f[d]:new de(r,r)):(u=c.sel.primary(),d=c.sel.primIndex),t.altKey)n="rect",i||(u=new de(r,r)),r=qt(e,t,!0,!0),d=-1;else if("double"==n){var p=e.findWordAt(r);u=e.display.shift||c.extend?be(c,u,p.anchor,p.head):p}else if("triple"==n){var g=new de(Io(r.line,0),ge(c,Io(r.line+1,0)));u=e.display.shift||c.extend?be(c,u,g.anchor,g.head):g}else u=be(c,u,r);i?-1==d?(d=f.length,Le(c,he(f.concat([u]),d),{scroll:!1,origin:"*mouse"})):f.length>1&&f[d].empty()&&"single"==n&&!t.shiftKey?(Le(c,he(f.slice(0,d).concat(f.slice(d+1)),0),{scroll:!1,origin:"*mouse"}),h=c.sel):ke(c,d,u,Ia):(d=0,Le(c,new ue([u],0),Ia),h=c.sel);var m=r,v=s.wrapper.getBoundingClientRect(),y=0,b=Nt(e,function(e){ki(e)?a(e):l(e)}),x=Nt(e,l);e.state.selectingText=x,Aa(document,"mousemove",b),Aa(document,"mouseup",x)}function Zt(e,t,r,n){try{var i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&La(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!_i(e,r))return wi(t);o-=l.top-a.viewOffset;for(var s=0;s<e.options.gutters.length;++s){var c=a.gutters.childNodes[s];if(c&&c.getBoundingClientRect().right>=i){var u=ri(e.doc,o),d=e.options.gutters[s];return Wa(e,r,e,u,d,t),wi(t)}}}function Qt(e,t){return Zt(e,t,"gutterClick",!0)}function Jt(e){var t=this;if(rr(t),!Li(t,e)&&!Gt(t.display,e)){La(e),bo&&(qo=+new Date);var r=qt(t,e,!0),n=e.dataTransfer.files;if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),a=0,l=function(e,n){if(!t.options.allowDropFileTypes||-1!=zi(t.options.allowDropFileTypes,e.type)){var l=new FileReader;l.onload=Nt(t,function(){var e=l.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[n]=e,++a==i){r=ge(t.doc,r);var s={from:r,to:r,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};Tr(t.doc,s),Te(t.doc,fe(r,Qo(s)))}}),l.readAsText(e)}},s=0;i>s;++s)l(n[s],s);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&&!(No?e.altKey:e.ctrlKey))var c=t.listSelections();if(Me(t.doc,fe(r,r)),c)for(var s=0;s<c.length;++s)Or(t.doc,"",c[s].anchor,c[s].head,"drag");t.replaceSelection(o,"around","paste"),t.display.input.focus()}}catch(e){}}}}function er(e,t){if(bo&&(!e.state.draggingText||+new Date-qo<100))return void _a(t);if(!Li(e,t)&&!Gt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.setDragImage&&!To)){var r=Bi("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",So&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),So&&r.parentNode.removeChild(r)}}function tr(e,t){var r=qt(e,t);if(r){var n=document.createDocumentFragment();De(e,r,n),e.display.dragCursor||(e.display.dragCursor=Bi("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),Ui(e.display.dragCursor,n)}}function rr(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function nr(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,mo||A(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbars.setScrollTop(t),mo&&A(e),Fe(e,100))}function ir(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 or(e,t){var r=Yo(t),n=r.x,i=r.y,o=e.display,a=o.scroller,l=a.scrollWidth>a.clientWidth,s=a.scrollHeight>a.clientHeight;if(n&&l||i&&s){if(i&&No&&xo)e:for(var c=t.target,u=o.view;c!=a;c=c.parentNode)for(var d=0;d<u.length;d++)if(u[d].node==c){e.display.currentWheelTarget=c;break e}if(n&&!mo&&!So&&null!=$o)return i&&s&&nr(e,Math.max(0,Math.min(a.scrollTop+i*$o,a.scrollHeight-a.clientHeight))),ir(e,Math.max(0,Math.min(a.scrollLeft+n*$o,a.scrollWidth-a.clientWidth))),(!i||i&&s)&&La(t),void(o.wheelStartX=null);if(i&&null!=$o){var h=i*$o,f=e.doc.scrollTop,p=f+o.wrapper.clientHeight;0>h?f=Math.max(0,f+h-50):p=Math.min(e.doc.height,p+h+50),A(e,{top:f,bottom:p})}20>Vo&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&($o=($o*Vo+r)/(Vo+1),++Vo)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}function ar(e,t,r){if("string"==typeof t&&(t=ca[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=Pa}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function lr(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=da(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&da(t,e.options.extraKeys,r,e)||da(t,e.options.keyMap,r,e)}function sr(e,t,r,n){var i=e.state.keySeq;if(i){if(ha(t))return"handled";Xo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),t=i+" "+t}var o=lr(e,t,n);return"multi"==o&&(e.state.keySeq=t),"handled"==o&&Si(e,"keyHandled",e,t,r),("handled"==o||"multi"==o)&&(La(r),He(e)),i&&!o&&/\'$/.test(t)?(La(r),!0):!!o}function cr(e,t){var r=fa(t,!0);return r?t.shiftKey&&!e.state.keySeq?sr(e,"Shift-"+r,t,function(t){return ar(e,t,!0)})||sr(e,r,t,function(t){return("string"==typeof t?/^go[A-Z]/.test(t):t.motion)?ar(e,t):void 0}):sr(e,r,t,function(t){return ar(e,t)}):!1}function ur(e,t,r){return sr(e,"'"+r+"'",t,function(t){return ar(e,t,!0)})}function dr(e){var t=this;if(t.curOp.focus=Gi(),!Li(t,e)){bo&&11>wo&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=cr(t,e);So&&(Zo=n?r:null,!n&&88==r&&!rl&&(No?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||hr(t)}}function hr(e){function t(e){18!=e.keyCode&&e.altKey||(Xa(r,"CodeMirror-crosshair"),Oa(document,"keyup",t),Oa(document,"mouseover",t))}var r=e.display.lineDiv;Za(r,"CodeMirror-crosshair"),Aa(document,"keyup",t),Aa(document,"mouseover",t)}function fr(e){16==e.keyCode&&(this.doc.sel.shift=!1),Li(this,e)}function pr(e){var t=this;if(!(Gt(t.display,e)||Li(t,e)||e.ctrlKey&&!e.altKey||No&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(So&&r==Zo)return Zo=null,void La(e);if(!So||e.which&&!(e.which<10)||!cr(t,e)){var i=String.fromCharCode(null==n?r:n);ur(t,e,i)||t.display.input.onKeyPress(e)}}}function gr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,vr(e))},100)}function mr(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Wa(e,"focus",e),e.state.focused=!0,Za(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),xo&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),He(e))}function vr(e){e.state.delayingBlurEvent||(e.state.focused&&(Wa(e,"blur",e),e.state.focused=!1,Xa(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function yr(e,t){Gt(e.display,t)||br(e,t)||Li(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function br(e,t){return _i(e,"gutterContextMenu")?Zt(e,t,"gutterContextMenu",!1):!1}function wr(e,t){if(Ho(e,t.from)<0)return e;if(Ho(e,t.to)<=0)return Qo(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+=Qo(t).ch-t.to.ch),Io(r,n)}function xr(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new de(wr(i.anchor,t),wr(i.head,t)))}return he(r,e.sel.primIndex)}function kr(e,t,r){return e.line==t.line?Io(r.line,e.ch-t.ch+r.ch):Io(r.line+(e.line-t.line),e.ch)}function Cr(e,t,r){for(var n=[],i=Io(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=kr(l.from,i,o),c=kr(Qo(l),i,o);if(i=l.to,o=c,"around"==r){var u=e.sel.ranges[a],d=Ho(u.head,u.anchor)<0;n[a]=new de(d?c:s,d?s:c)}else n[a]=new de(s,s)}return new ue(n,e.sel.primIndex)}function Sr(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=ge(e,t)),r&&(this.to=ge(e,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),Wa(e,"beforeChange",e,n),e.cm&&Wa(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Tr(e,t,r){if(e.cm){if(!e.cm.curOp)return Nt(e.cm,Tr)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(_i(e,"beforeChange")||e.cm&&_i(e.cm,"beforeChange"))||(t=Sr(e,t,!0))){var n=Po&&!r&&sn(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)Lr(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else Lr(e,t)}}function Lr(e,t){if(1!=t.text.length||""!=t.text[0]||0!=Ho(t.from,t.to)){var r=xr(e,t);ci(e,t,r,e.cm?e.cm.curOp.id:NaN),Ar(e,t,r,on(e,t));var n=[];Yn(e,function(e,r){r||-1!=zi(n,e.history)||(bi(e.history,t),n.push(e.history)),Ar(e,t,null,on(e,t))})}}function Mr(e,t,r){if(!e.cm||!e.cm.state.suppressEdits){for(var n,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,l="undo"==t?i.undone:i.done,s=0;s<a.length&&(n=a[s],r?!n.ranges||n.equals(e.sel):n.ranges);s++);if(s!=a.length){for(i.lastOrigin=i.lastSelOrigin=null;n=a.pop(),n.ranges;){if(hi(n,l),r&&!n.equals(e.sel))return void Le(e,n,{clearRedo:!1});o=n}var c=[];hi(o,l),l.push({changes:c,generation:i.generation}),i.generation=n.generation||++i.maxGeneration;for(var u=_i(e,"beforeChange")||e.cm&&_i(e.cm,"beforeChange"),s=n.changes.length-1;s>=0;--s){var d=n.changes[s];if(d.origin=t,u&&!Sr(e,d,!1))return void(a.length=0);c.push(ai(e,d));var h=s?xr(e,d):Wi(a);Ar(e,d,h,ln(e,d)),!s&&e.cm&&e.cm.scrollIntoView({from:d.from,to:Qo(d)});var f=[];Yn(e,function(e,t){t||-1!=zi(f,e.history)||(bi(e.history,d),f.push(e.history)),Ar(e,d,null,ln(e,d))})}}}}function _r(e,t){if(0!=t&&(e.first+=t,e.sel=new ue(Ei(e.sel.ranges,function(e){return new de(Io(e.anchor.line+t,e.anchor.ch),Io(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Pt(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Dt(e.cm,n,"gutter")}}function Ar(e,t,r,n){if(e.cm&&!e.cm.curOp)return Nt(e.cm,Ar)(e,t,r,n);if(t.to.line<e.first)return void _r(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);_r(e,i),t={from:Io(e.first,0),to:Io(t.to.line+i,t.to.ch),text:[Wi(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:Io(o,Zn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Qn(e,t.from,t.to),r||(r=xr(e,t)),e.cm?Nr(e.cm,t,n):qn(e,t,n),Me(e,r,Da)}}function Nr(e,t,r){var n=e.doc,i=e.display,a=t.from,l=t.to,s=!1,c=a.line;e.options.lineWrapping||(c=ti(yn(Zn(n,a.line))),n.iter(c,l.line+1,function(e){return e==i.maxLine?(s=!0,!0):void 0})),n.sel.contains(t.from,t.to)>-1&&Mi(e),qn(n,t,r,o(e)),e.options.lineWrapping||(n.iter(c,a.line+t.text.length,function(e){var t=d(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,a.line),Fe(e,400);var u=t.text.length-(l.line-a.line)-1;t.full?Pt(e):a.line!=l.line||1!=t.text.length||Gn(e.doc,t)?Pt(e,a.line,l.line+1,u):Dt(e,a.line,"text");var h=_i(e,"changes"),f=_i(e,"change");if(f||h){var p={from:a,to:l,text:t.text,removed:t.removed,origin:t.origin};f&&Si(e,"change",e,p),h&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function Or(e,t,r,n,i){if(n||(n=r),Ho(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=e.splitLines(t)),Tr(e,{from:r,to:n,text:t,origin:i})}function Wr(e,t){if(!Li(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&&!Mo){var o=Bi("div","​",null,"position: absolute; top: "+(t.top-r.viewOffset-Ke(e.display))+"px; height: "+(t.bottom-t.top+qe(e)+r.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function zr(e,t,r,n){null==n&&(n=0);for(var i=0;5>i;i++){var o=!1,a=ft(e,t),l=r&&r!=t?ft(e,r):a,s=Pr(e,Math.min(a.left,l.left),Math.min(a.top,l.top)-n,Math.max(a.left,l.left),Math.max(a.bottom,l.bottom)+n),c=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=s.scrollTop&&(nr(e,s.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(o=!0)),null!=s.scrollLeft&&(ir(e,s.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return a}function Er(e,t,r,n,i){var o=Pr(e,t,r,n,i);null!=o.scrollTop&&nr(e,o.scrollTop),null!=o.scrollLeft&&ir(e,o.scrollLeft)}function Pr(e,t,r,n,i){var o=e.display,a=yt(e.display);0>r&&(r=0);var l=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,s=$e(e),c={};i-r>s&&(i=r+s);var u=e.doc.height+Ue(o),d=a>r,h=i>u-a;if(l>r)c.scrollTop=d?0:r;else if(i>l+s){
4
- var f=Math.min(r,(h?u:i)-s);f!=l&&(c.scrollTop=f)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,g=Ve(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),m=n-t>g;return m&&(n=t+g),10>t?c.scrollLeft=0:p>t?c.scrollLeft=Math.max(0,t-(m?0:10)):n>g+p-3&&(c.scrollLeft=n+(m?0:10)-g),c}function Dr(e,t,r){(null!=t||null!=r)&&Hr(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 Ir(e){Hr(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?Io(t.line,t.ch-1):t,n=Io(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function Hr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=pt(e,t.from),n=pt(e,t.to),i=Pr(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 Fr(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=Be(e,t):r="prev");var a=e.options.tabSize,l=Zn(o,t),s=Fa(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var c,u=l.text.match(/^\s*/)[0];if(n||/\S/.test(l.text)){if("smart"==r&&(c=o.mode.indent(i,l.text.slice(u.length),l.text),c==Pa||c>150)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?Fa(Zn(o,t-1).text,null,a):0:"add"==r?c=s+e.options.indentUnit:"subtract"==r?c=s-e.options.indentUnit:"number"==typeof r&&(c=s+r),c=Math.max(0,c);var d="",h=0;if(e.options.indentWithTabs)for(var f=Math.floor(c/a);f;--f)h+=a,d+=" ";if(c>h&&(d+=Oi(c-h)),d!=u)return Or(o,d,Io(t,0),Io(t,u.length),"+input"),l.stateAfter=null,!0;for(var f=0;f<o.sel.ranges.length;f++){var p=o.sel.ranges[f];if(p.head.line==t&&p.head.ch<u.length){var h=Io(t,u.length);ke(o,f,new de(h,h));break}}}function jr(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=Zn(e,pe(e,t)):i=ti(t),null==i?null:(n(o,i)&&e.cm&&Dt(e.cm,i,r),o)}function Rr(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&Ho(o.from,Wi(n).to)<=0;){var a=n.pop();if(Ho(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}At(e,function(){for(var t=n.length-1;t>=0;t--)Or(e.doc,"",n[t].from,n[t].to,"+delete");Ir(e)})}function Br(e,t,r,n,i){function o(){var t=l+r;return t<e.first||t>=e.first+e.size?!1:(l=t,u=Zn(e,t))}function a(e){var t=(i?ho:fo)(u,s,r,!0);if(null==t){if(e||!o())return!1;s=i?(0>r?io:no)(u):0>r?u.text.length:0}else s=t;return!0}var l=t.line,s=t.ch,c=r,u=Zn(e,l);if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var d=null,h="group"==n,f=e.cm&&e.cm.getHelper(t,"wordChars"),p=!0;!(0>r)||a(!p);p=!1){var g=u.text.charAt(s)||"\n",m=Fi(g,f)?"w":h&&"\n"==g?"n":!h||/\s/.test(g)?null:"p";if(!h||p||m||(m="s"),d&&d!=m){0>r&&(r=1,a());break}if(m&&(d=m),r>0&&!a(!p))break}var v=We(e,Io(l,s),t,c,!0);return Ho(t,v)||(v.hitSide=!0),v}function Kr(e,t,r,n){var i,o=e.doc,a=t.left;if("page"==n){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+r*(l-(0>r?1.5:.5)*yt(e.display))}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;;){var s=mt(e,a,i);if(!s.outside)break;if(0>r?0>=i:i>=o.height){s.hitSide=!0;break}i+=5*r}return s}function Ur(t,r,n,i){e.defaults[t]=r,n&&(ea[t]=i?function(e,t,r){r!=ta&&n(e,t,r)}:n)}function Gr(e){for(var t,r,n,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a<o.length-1;a++){var l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else{if(!/^s(hift)$/i.test(l))throw new Error("Unrecognized modifier name: "+l);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function qr(e){return"string"==typeof e?ua[e]:e}function Vr(e,t,r,n,i){if(n&&n.shared)return $r(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return Nt(e.cm,Vr)(e,t,r,n,i);var o=new ma(e,i),a=Ho(t,r);if(n&&Ii(n,o,!1),a>0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Bi("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(vn(e,t.line,t,r,o)||t.line!=r.line&&vn(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Do=!0}o.addToHistory&&ci(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var l,s=t.line,c=e.cm;if(e.iter(s,r.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&yn(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&ei(e,0),tn(e,new Qr(o,s==t.line?t.ch:null,s==r.line?r.ch:null)),++s}),o.collapsed&&e.iter(t.line,r.line+1,function(t){kn(e,t)&&ei(t,0)}),o.clearOnEnter&&Aa(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Po=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ga,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)Pt(c,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=t.line;u<=r.line;u++)Dt(c,u,"text");o.atomic&&Ae(c.doc),Si(c,"markerAdded",c,o)}return o}function $r(e,t,r,n,i){n=Ii(n),n.shared=!1;var o=[Vr(e,t,r,n,i)],a=o[0],l=n.widgetNode;return Yn(e,function(e){l&&(n.widgetNode=l.cloneNode(!0)),o.push(Vr(e,ge(e,t),ge(e,r),n,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;a=Wi(o)}),new va(o,a)}function Yr(e){return e.findMarks(Io(e.first,0),e.clipPos(Io(e.lastLine())),function(e){return e.parent})}function Xr(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(Ho(o,a)){var l=Vr(e,o,a,n.primary,n.primary.type);n.markers.push(l),l.parent=n}}}function Zr(e){for(var t=0;t<e.length;t++){var r=e[t],n=[r.primary.doc];Yn(r.primary.doc,function(e){n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==zi(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}}}function Qr(e,t,r){this.marker=e,this.from=t,this.to=r}function Jr(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function en(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function tn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function rn(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new Qr(a,o.from,s?null:o.to))}}return n}function nn(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new Qr(a,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}function on(e,t){if(t.full)return null;var r=ve(e,t.from.line)&&Zn(e,t.from.line).markedSpans,n=ve(e,t.to.line)&&Zn(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,a=0==Ho(t.from,t.to),l=rn(r,i,a),s=nn(n,o,a),c=1==t.text.length,u=Wi(t.text).length+(c?i:0);if(l)for(var d=0;d<l.length;++d){var h=l[d];if(null==h.to){var f=Jr(s,h.marker);f?c&&(h.to=null==f.to?null:f.to+u):h.to=i}}if(s)for(var d=0;d<s.length;++d){var h=s[d];if(null!=h.to&&(h.to+=u),null==h.from){var f=Jr(l,h.marker);f||(h.from=u,c&&(l||(l=[])).push(h))}else h.from+=u,c&&(l||(l=[])).push(h)}l&&(l=an(l)),s&&s!=l&&(s=an(s));var p=[l];if(!c){var g,m=t.text.length-2;if(m>0&&l)for(var d=0;d<l.length;++d)null==l[d].to&&(g||(g=[])).push(new Qr(l[d].marker,null,null));for(var d=0;m>d;++d)p.push(g);p.push(s)}return p}function an(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 ln(e,t){var r=gi(e,t),n=on(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],a=n[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue e;o.push(s)}else a&&(r[i]=a)}return r}function sn(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!=zi(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var a=n[o],l=a.find(0),s=0;s<i.length;++s){var c=i[s];if(!(Ho(c.to,l.from)<0||Ho(c.from,l.to)>0)){var u=[s,1],d=Ho(c.from,l.from),h=Ho(c.to,l.to);(0>d||!a.inclusiveLeft&&!d)&&u.push({from:c.from,to:l.from}),(h>0||!a.inclusiveRight&&!h)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-1}}return i}function cn(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function un(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function dn(e){return e.inclusiveLeft?-1:0}function hn(e){return e.inclusiveRight?1:0}function fn(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=Ho(n.from,i.from)||dn(e)-dn(t);if(o)return-o;var a=Ho(n.to,i.to)||hn(e)-hn(t);return a?a:t.id-e.id}function pn(e,t){var r,n=Do&&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||fn(r,i.marker)<0)&&(r=i.marker);return r}function gn(e){return pn(e,!0)}function mn(e){return pn(e,!1)}function vn(e,t,r,n,i){var o=Zn(e,t),a=Do&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var c=s.marker.find(0),u=Ho(c.from,r)||dn(s.marker)-dn(i),d=Ho(c.to,n)||hn(s.marker)-hn(i);if(!(u>=0&&0>=d||0>=u&&d>=0)&&(0>=u&&(Ho(c.to,r)>0||s.marker.inclusiveRight&&i.inclusiveLeft)||u>=0&&(Ho(c.from,n)<0||s.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function yn(e){for(var t;t=gn(e);)e=t.find(-1,!0).line;return e}function bn(e){for(var t,r;t=mn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function wn(e,t){var r=Zn(e,t),n=yn(r);return r==n?t:ti(n)}function xn(e,t){if(t>e.lastLine())return t;var r,n=Zn(e,t);if(!kn(e,n))return t;for(;r=mn(n);)n=r.find(1,!0).line;return ti(n)+1}function kn(e,t){var r=Do&&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&&Cn(e,t,n))return!0}}function Cn(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Cn(e,n.line,Jr(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)&&Cn(e,t,i))return!0}function Sn(e,t,r){ni(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Dr(e,null,r)}function Tn(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Va(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),Ui(t.display.measure,Bi("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function Ln(e,t,r,n){var i=new ya(e,r,n),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),jr(e,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!kn(e,t)){var n=ni(t)<e.scrollTop;ei(t,t.height+Tn(i)),n&&Dr(o,null,i.height),o.curOp.forceUpdate=!0}return!0}),i}function Mn(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),cn(e),un(e,r);var i=n?n(e):1;i!=e.height&&ei(e,i)}function _n(e){e.parent=null,cn(e)}function An(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 Nn(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 On(t,r,n,i){for(var o=0;10>o;o++){i&&(i[0]=e.innerMode(t,n).mode);var a=t.token(r,n);if(r.pos>r.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}function Wn(e,t,r,n){function i(e){return{start:d.start,end:d.pos,string:d.current(),type:o||null,state:e?la(a.mode,u):u}}var o,a=e.doc,l=a.mode;t=ge(a,t);var s,c=Zn(a,t.line),u=Be(e,t.line,r),d=new pa(c.text,e.options.tabSize);for(n&&(s=[]);(n||d.pos<t.ch)&&!d.eol();)d.start=d.pos,o=On(l,d,u),n&&s.push(i(!0));return n?s:i()}function zn(e,t,r,n,i,o,a){var l=r.flattenSpans;null==l&&(l=e.options.flattenSpans);var s,c=0,u=null,d=new pa(t,e.options.tabSize),h=e.options.addModeClass&&[null];for(""==t&&An(Nn(r,n),o);!d.eol();){if(d.pos>e.options.maxHighlightLength?(l=!1,a&&Dn(e,t,n,d.pos),d.pos=t.length,s=null):s=An(On(r,d,n,h),o),h){var f=h[0].name;f&&(s="m-"+(s?f+" "+s:f))}if(!l||u!=s){for(;c<d.start;)c=Math.min(d.start,c+5e4),i(c,u);u=s}d.start=d.pos}for(;c<d.pos;){var p=Math.min(d.pos,c+5e4);i(p,u),c=p}}function En(e,t,r,n){var i=[e.state.modeGen],o={};zn(e,t.text,e.doc.mode,r,function(e,t){i.push(e,t)},o,n);for(var a=0;a<e.state.overlays.length;++a){var l=e.state.overlays[a],s=1,c=0;zn(e,t.text,l.mode,!0,function(e,t){for(var r=s;e>c;){var n=i[s];n>e&&i.splice(s,1,e,i[s+1],n),s+=2,c=Math.min(e,n)}if(t)if(l.opaque)i.splice(r,s-r,e,"cm-overlay "+t),s=r+2;else for(;s>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 Pn(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Be(e,ti(t)),i=En(e,t,t.text.length>e.options.maxHighlightLength?la(e.doc.mode,n):n);t.stateAfter=n,t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.frontier&&e.doc.frontier++}return t.styles}function Dn(e,t,r,n){var i=e.doc.mode,o=new pa(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&Nn(i,r);!o.eol();)On(i,o,r),o.start=o.pos}function In(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?xa:wa;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Hn(e,t){var r=Bi("span",null,null,xo?"padding-right: .1px":null),n={pre:Bi("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,splitSpaces:(bo||xo)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,a=i?t.rest[i-1]:t.line;n.pos=0,n.addToken=jn,Qi(e.display.measure)&&(o=ii(a))&&(n.addToken=Bn(n.addToken,o)),n.map=[];var l=t!=e.display.externalMeasured&&ti(a);Un(a,n,Pn(e,a,l)),a.styleClasses&&(a.styleClasses.bgClass&&(n.bgClass=Vi(a.styleClasses.bgClass,n.bgClass||"")),a.styleClasses.textClass&&(n.textClass=Vi(a.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Zi(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 xo&&/\bcm-tab\b/.test(n.content.lastChild.className)&&(n.content.className="cm-tab-wrap-hack"),Wa(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Vi(n.pre.className,n.textClass||"")),n}function Fn(e){var t=Bi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function jn(e,t,r,n,i,o,a){if(t){var l=e.splitSpaces?t.replace(/ {3,}/g,Rn):t,s=e.cm.state.specialChars,c=!1;if(s.test(t))for(var u=document.createDocumentFragment(),d=0;;){s.lastIndex=d;var h=s.exec(t),f=h?h.index-d:t.length-d;if(f){var p=document.createTextNode(l.slice(d,d+f));bo&&9>wo?u.appendChild(Bi("span",[p])):u.appendChild(p),e.map.push(e.pos,e.pos+f,p),e.col+=f,e.pos+=f}if(!h)break;if(d+=f+1," "==h[0]){var g=e.cm.options.tabSize,m=g-e.col%g,p=u.appendChild(Bi("span",Oi(m),"cm-tab"));p.setAttribute("role","presentation"),p.setAttribute("cm-text"," "),e.col+=m}else if("\r"==h[0]||"\n"==h[0]){var p=u.appendChild(Bi("span","\r"==h[0]?"␍":"␤","cm-invalidchar"));p.setAttribute("cm-text",h[0]),e.col+=1}else{var p=e.cm.options.specialCharPlaceholder(h[0]);p.setAttribute("cm-text",h[0]),bo&&9>wo?u.appendChild(Bi("span",[p])):u.appendChild(p),e.col+=1}e.map.push(e.pos,e.pos+1,p),e.pos++}else{e.col+=t.length;var u=document.createTextNode(l);e.map.push(e.pos,e.pos+t.length,u),bo&&9>wo&&(c=!0),e.pos+=t.length}if(r||n||i||c||a){var v=r||"";n&&(v+=n),i&&(v+=i);var y=Bi("span",[u],v,a);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function Rn(e){for(var t=" ",r=0;r<e.length-2;++r)t+=r%2?" ":" ";return t+=" "}function Bn(e,t){return function(r,n,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border";for(var c=r.pos,u=c+n.length;;){for(var d=0;d<t.length;d++){var h=t[d];if(h.to>c&&h.from<=c)break}if(h.to>=u)return e(r,n,i,o,a,l,s);e(r,n.slice(0,h.to-c),i,o,null,l,s),o=null,n=n.slice(h.to-c),c=h.to}}}function Kn(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 Un(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a,l,s,c,u,d,h,f=i.length,p=0,g=1,m="",v=0;;){if(v==p){s=c=u=d=l="",h=null,v=1/0;for(var y,b=[],w=0;w<n.length;++w){var x=n[w],k=x.marker;"bookmark"==k.type&&x.from==p&&k.widgetNode?b.push(k):x.from<=p&&(null==x.to||x.to>p||k.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),k.className&&(s+=" "+k.className),k.css&&(l=(l?l+";":"")+k.css),k.startStyle&&x.from==p&&(u+=" "+k.startStyle),k.endStyle&&x.to==v&&(y||(y=[])).push(k.endStyle,x.to),k.title&&!d&&(d=k.title),k.collapsed&&(!h||fn(h.marker,k)<0)&&(h=x)):x.from>p&&v>x.from&&(v=x.from)}if(y)for(var w=0;w<y.length;w+=2)y[w+1]==v&&(c+=" "+y[w]);if(!h||h.from==p)for(var w=0;w<b.length;++w)Kn(t,0,b[w]);if(h&&(h.from||0)==p){if(Kn(t,(null==h.to?f+1:h.to)-p,h.marker,null==h.from),null==h.to)return;h.to==p&&(h=!1)}}if(p>=f)break;for(var C=Math.min(f,v);;){if(m){var S=p+m.length;if(!h){var T=S>C?m.slice(0,C-p):m;t.addToken(t,T,a?a+s:s,u,p+T.length==v?c:"",d,l)}if(S>=C){m=m.slice(C-p),p=C;break}p=S,u=""}m=i.slice(o,o=r[g++]),a=In(r[g++],t.cm.options)}}else for(var g=1;g<r.length;g+=2)t.addToken(t,i.slice(o,o=r[g]),In(r[g+1],t.cm.options))}function Gn(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Wi(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function qn(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){Mn(e,r,i,n),Si(e,"change",e,t)}function a(e,t){for(var r=e,o=[];t>r;++r)o.push(new ba(c[r],i(r),n));return o}var l=t.from,s=t.to,c=t.text,u=Zn(e,l.line),d=Zn(e,s.line),h=Wi(c),f=i(c.length-1),p=s.line-l.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(Gn(e,t)){var g=a(0,c.length-1);o(d,d.text,f),p&&e.remove(l.line,p),g.length&&e.insert(l.line,g)}else if(u==d)if(1==c.length)o(u,u.text.slice(0,l.ch)+h+u.text.slice(s.ch),f);else{var g=a(1,c.length-1);g.push(new ba(h+u.text.slice(s.ch),f,n)),o(u,u.text.slice(0,l.ch)+c[0],i(0)),e.insert(l.line+1,g)}else if(1==c.length)o(u,u.text.slice(0,l.ch)+c[0]+d.text.slice(s.ch),i(0)),e.remove(l.line+1,p);else{o(u,u.text.slice(0,l.ch)+c[0],i(0)),o(d,h+d.text.slice(s.ch),f);var g=a(1,c.length-1);p>1&&e.remove(l.line+1,p-1),e.insert(l.line+1,g)}Si(e,"change",e,t)}function Vn(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 $n(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 Yn(e,t,r){function n(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var l=e.linked[a];if(l.doc!=i){var s=o&&l.sharedHist;(!r||s)&&(t(l.doc,s),n(l.doc,e,s))}}}n(e,null,!0)}function Xn(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,a(e),r(e),e.options.lineWrapping||h(e),e.options.mode=t.modeOption,Pt(e)}function Zn(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 Qn(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 Jn(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function ei(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function ti(e){if(null==e.parent)return null;for(var t=e.parent,r=zi(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 ri(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 a=e.lines[n],l=a.height;if(l>t)break;t-=l}return r+n}function ni(e){e=yn(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 a=o.children[n];if(a==r)break;t+=a.height}return t}function ii(e){var t=e.order;return null==t&&(t=e.order=al(e.text)),t}function oi(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 ai(e,t){var r={from:V(t.from),to:Qo(t),text:Qn(e,t.from,t.to)};return fi(e,r,t.from.line,t.to.line+1),Yn(e,function(e){fi(e,r,t.from.line,t.to.line+1)},!0),r}function li(e){for(;e.length;){var t=Wi(e);if(!t.ranges)break;e.pop()}}function si(e,t){return t?(li(e.done),Wi(e.done)):e.done.length&&!Wi(e.done).ranges?Wi(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Wi(e.done)):void 0}function ci(e,t,r,n){var i=e.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>a-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=si(i,i.lastOp==n))){var l=Wi(o.changes);0==Ho(t.from,t.to)&&0==Ho(t.from,l.to)?l.to=Qo(t):o.changes.push(ai(e,t))}else{var s=Wi(i.done);for(s&&s.ranges||hi(e.sel,i.done),o={changes:[ai(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=a,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,l||Wa(e,"historyAdded")}function ui(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 di(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||ui(e,o,Wi(i.done),t))?i.done[i.done.length-1]=t:hi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&n.clearRedo!==!1&&li(i.undone)}function hi(e,t){var r=Wi(t);r&&r.ranges&&r.equals(e)||t.push(e)}function fi(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 pi(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 gi(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=0,i=[];n<t.text.length;++n)i.push(pi(r[n]));return i}function mi(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 a=o.changes,l=[];i.push({changes:l});for(var s=0;s<a.length;++s){var c,u=a[s];if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var d in u)(c=d.match(/^spans_(\d+)$/))&&zi(t,Number(c[1]))>-1&&(Wi(l)[d]=u[d],delete u[d])}}}return i}function vi(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function yi(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var l=0;l<o.ranges.length;l++)vi(o.ranges[l].anchor,t,r,n),vi(o.ranges[l].head,t,r,n)}else{for(var l=0;l<o.changes.length;++l){var s=o.changes[l];if(r<s.from.line)s.from=Io(s.from.line+n,s.from.ch),s.to=Io(s.to.line+n,s.to.ch);else if(t<=s.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function bi(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;yi(e.done,r,n,i),yi(e.undone,r,n,i)}function wi(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function xi(e){return e.target||e.srcElement}function ki(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),No&&e.ctrlKey&&1==t&&(t=3),t}function Ci(e,t,r){var n=e._handlers&&e._handlers[t];return r?n&&n.length>0?n.slice():Na:n||Na}function Si(e,t){function r(e){return function(){e.apply(null,o)}}var n=Ci(e,t,!1);if(n.length){var i,o=Array.prototype.slice.call(arguments,2);Uo?i=Uo.delayedCallbacks:za?i=za:(i=za=[],setTimeout(Ti,0));for(var a=0;a<n.length;++a)i.push(r(n[a]))}}function Ti(){var e=za;za=null;for(var t=0;t<e.length;++t)e[t]()}function Li(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Wa(e,r||t.type,e,t),wi(t)||t.codemirrorIgnore}function Mi(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==zi(r,t[n])&&r.push(t[n])}function _i(e,t){return Ci(e,t).length>0}function Ai(e){e.prototype.on=function(e,t){Aa(this,e,t)},e.prototype.off=function(e,t){Oa(this,e,t)}}function Ni(){this.id=null}function Oi(e){for(;Ra.length<=e;)Ra.push(Wi(Ra)+" ");return Ra[e]}function Wi(e){return e[e.length-1]}function zi(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}function Ei(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Pi(){}function Di(e,t){var r;return Object.create?r=Object.create(e):(Pi.prototype=e,r=new Pi),t&&Ii(t,r),r}function Ii(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 Hi(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Fi(e,t){return t?t.source.indexOf("\\w")>-1&&Ga(e)?!0:t.test(e):Ga(e)}function ji(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Ri(e){return e.charCodeAt(0)>=768&&qa.test(e)}function Bi(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 Ki(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Ui(e,t){return Ki(e).appendChild(t)}function Gi(){for(var e=document.activeElement;e&&e.root&&e.root.activeElement;)e=e.root.activeElement;return e}function qi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Vi(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!qi(r[n]).test(t)&&(t+=" "+r[n]);return t}function $i(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 Yi(){Qa||(Xi(),Qa=!0)}function Xi(){var e;Aa(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,$i(Ut)},100))}),Aa(window,"blur",function(){$i(vr)})}function Zi(e){if(null==$a){var t=Bi("span","​");Ui(e,Bi("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&($a=t.offsetWidth<=1&&t.offsetHeight>2&&!(bo&&8>wo))}var r=$a?Bi("span","​"):Bi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Qi(e){if(null!=Ya)return Ya;var t=Ui(e,document.createTextNode("AخA")),r=Ka(t,0,1).getBoundingClientRect();if(!r||r.left==r.right)return!1;var n=Ka(t,1,2).getBoundingClientRect();return Ya=n.right-r.right<3}function Ji(e){if(null!=nl)return nl;var t=Ui(e,Bi("span","x")),r=t.getBoundingClientRect(),n=Ka(t,0,1).getBoundingClientRect();return nl=Math.abs(r.left-n.left)>1}function eo(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<r&&a.to>t||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function to(e){return e.level%2?e.to:e.from}function ro(e){return e.level%2?e.from:e.to}function no(e){var t=ii(e);return t?to(t[0]):0}function io(e){var t=ii(e);return t?ro(Wi(t)):e.text.length}function oo(e,t){var r=Zn(e.doc,t),n=yn(r);n!=r&&(t=ti(n));var i=ii(n),o=i?i[0].level%2?io(n):no(n):0;return Io(t,o)}function ao(e,t){for(var r,n=Zn(e.doc,t);r=mn(n);)n=r.find(1,!0).line,t=null;var i=ii(n),o=i?i[0].level%2?no(n):io(n):n.text.length;return Io(null==t?ti(n):t,o)}function lo(e,t){var r=oo(e,t.line),n=Zn(e.doc,r.line),i=ii(n);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),a=t.line==r.line&&t.ch<=o&&t.ch;return Io(r.line,a?0:o)}return r}function so(e,t,r){var n=e[0].level;return t==n?!0:r==n?!1:r>t}function co(e,t){ol=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 so(e,i.level,e[r].level)?(i.from!=i.to&&(ol=r),n):(i.from!=i.to&&(ol=n),r);r=n}}return r}function uo(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&Ri(e.text.charAt(t)));return t}function ho(e,t,r,n){var i=ii(e);if(!i)return fo(e,t,r,n);for(var o=co(i,t),a=i[o],l=uo(e,t,a.level%2?-r:r,n);;){if(l>a.from&&l<a.to)return l;if(l==a.from||l==a.to)return co(i,l)==o?l:(a=i[o+=r],r>0==a.level%2?a.to:a.from);if(a=i[o+=r],!a)return null;l=r>0==a.level%2?uo(e,a.to,-1,n):uo(e,a.from,1,n)}}function fo(e,t,r,n){var i=t+r;if(n)for(;i>0&&Ri(e.text.charAt(i));)i+=r;return 0>i||i>e.text.length?null:i}var po=navigator.userAgent,go=navigator.platform,mo=/gecko\/\d/i.test(po),vo=/MSIE \d/.test(po),yo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(po),bo=vo||yo,wo=bo&&(vo?document.documentMode||6:yo[1]),xo=/WebKit\//.test(po),ko=xo&&/Qt\/\d+\.\d+/.test(po),Co=/Chrome\//.test(po),So=/Opera\//.test(po),To=/Apple Computer/.test(navigator.vendor),Lo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(po),Mo=/PhantomJS/.test(po),_o=/AppleWebKit/.test(po)&&/Mobile\/\w+/.test(po),Ao=_o||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(po),No=_o||/Mac/.test(go),Oo=/win/i.test(go),Wo=So&&po.match(/Version\/(\d*\.\d*)/);Wo&&(Wo=Number(Wo[1])),Wo&&Wo>=15&&(So=!1,xo=!0);var zo=No&&(ko||So&&(null==Wo||12.11>Wo)),Eo=mo||bo&&wo>=9,Po=!1,Do=!1;g.prototype=Ii({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.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var e=No&&!Lo?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",
5
- this.disableHoriz=new Ni,this.disableVert=new Ni},enableZeroWidthBar:function(e,t){function r(){var n=e.getBoundingClientRect(),i=document.elementFromPoint(n.left+1,n.bottom-1);i!=e?e.style.pointerEvents="none":t.set(1e3,r)}e.style.pointerEvents="auto",t.set(1e3,r)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},g.prototype),m.prototype=Ii({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},m.prototype),e.scrollbarModel={"native":g,"null":m},T.prototype.signal=function(e,t){_i(e,t)&&this.events.push(arguments)},T.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Wa.apply(null,this.events[e])};var Io=e.Pos=function(e,t){return this instanceof Io?(this.line=e,void(this.ch=t)):new Io(e,t)},Ho=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},Fo=null;re.prototype=Ii({init:function(e){function t(e){if(!Li(n,e)){if(n.somethingSelected())Fo=n.getSelections(),r.inaccurateSelection&&(r.prevInput="",r.inaccurateSelection=!1,o.value=Fo.join("\n"),Ba(o));else{if(!n.options.lineWiseCopyCut)return;var t=ee(n);Fo=t.text,"cut"==e.type?n.setSelections(t.ranges,null,Da):(r.prevInput="",o.value=t.text.join("\n"),Ba(o))}"cut"==e.type&&(n.state.cutIncoming=!0)}}var r=this,n=this.cm,i=this.wrapper=ne(),o=this.textarea=i.firstChild;e.wrapper.insertBefore(i,e.wrapper.firstChild),_o&&(o.style.width="0px"),Aa(o,"input",function(){bo&&wo>=9&&r.hasSelection&&(r.hasSelection=null),r.poll()}),Aa(o,"paste",function(e){Li(n,e)||Q(e,n)||(n.state.pasteIncoming=!0,r.fastPoll())}),Aa(o,"cut",t),Aa(o,"copy",t),Aa(e.scroller,"paste",function(t){Gt(e,t)||Li(n,t)||(n.state.pasteIncoming=!0,r.focus())}),Aa(e.lineSpace,"selectstart",function(t){Gt(e,t)||La(t)}),Aa(o,"compositionstart",function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Aa(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,r=e.doc,n=Pe(e);if(e.options.moveInputWithCursor){var i=ft(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return n},showSelection:function(e){var t=this.cm,r=t.display;Ui(r.cursorDiv,e.cursors),Ui(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=rl&&(o.to().line-o.from().line>100||(r=n.getSelection()).length>1e3);var a=t?"-":r||n.getSelection();this.textarea.value=a,n.state.focused&&Ba(this.textarea),bo&&wo>=9&&(this.hasSelection=a)}else e||(this.prevInput=this.textarea.value="",bo&&wo>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Ao||Gi()!=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(this.contextMenuPending||!e.state.focused||tl(t)&&!r&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var n=t.value;if(n==r&&!e.somethingSelected())return!1;if(bo&&wo>=9&&this.hasSelection===n||No&&/[\uf700-\uf7ff]/.test(n))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var i=n.charCodeAt(0);if(8203!=i||r||(r="​"),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(r.length,n.length);a>o&&r.charCodeAt(o)==n.charCodeAt(o);)++o;var l=this;return At(e,function(){Z(e,n.slice(o),r.length-o,null,l.composing?"*compose":null),n.length>1e3||n.indexOf("\n")>-1?t.value=l.prevInput="":l.prevInput=n,l.composing&&(l.composing.range.clear(),l.composing.range=e.markText(l.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){bo&&wo>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t="​"+(e?a.value:"");a.value="⇚",a.value=t,n.prevInput=e?"":"​",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function r(){if(n.contextMenuPending=!1,n.wrapper.style.position="relative",a.style.cssText=u,bo&&9>wo&&o.scrollbars.setScrollTop(o.scroller.scrollTop=s),null!=a.selectionStart){(!bo||bo&&9>wo)&&t();var e=0,r=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&"​"==n.prevInput?Nt(i,ca.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,a=n.textarea,l=qt(i,e),s=o.scroller.scrollTop;if(l&&!So){var c=i.options.resetSelectionOnContextMenu;c&&-1==i.doc.sel.contains(l)&&Nt(i,Le)(i.doc,fe(l),Da);var u=a.style.cssText;if(n.wrapper.style.position="absolute",a.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(bo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",xo)var d=window.scrollY;if(o.input.focus(),xo&&window.scrollTo(null,d),o.input.reset(),i.somethingSelected()||(a.value=n.prevInput=" "),n.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),bo&&wo>=9&&t(),Eo){_a(e);var h=function(){Oa(window,"mouseup",h),setTimeout(r,20)};Aa(window,"mouseup",h)}else setTimeout(r,50)}},readOnlyChanged:function(e){e||this.reset()},setUneditable:Pi,needsContentAttribute:!1},re.prototype),ie.prototype=Ii({init:function(e){function t(e){if(!Li(n,e)){if(n.somethingSelected())Fo=n.getSelections(),"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=ee(n);Fo=t.text,"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,Da),n.replaceSelection("",null,"cut")})}if(e.clipboardData&&!_o)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Fo.join("\n"));else{var r=ne(),i=r.firstChild;n.display.lineSpace.insertBefore(r,n.display.lineSpace.firstChild),i.value=Fo.join("\n");var o=document.activeElement;Ba(i),setTimeout(function(){n.display.lineSpace.removeChild(r),o.focus()},50)}}}var r=this,n=r.cm,i=r.div=e.lineDiv;te(i),Aa(i,"paste",function(e){Li(n,e)||Q(e,n)}),Aa(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),a=o.indexOf(t,Math.max(0,i.head.ch-t.length));a>-1&&a<=i.head.ch&&(r.composing.sel=fe(Io(i.head.line,a),Io(i.head.line,a+t.length)))}}),Aa(i,"compositionupdate",function(e){r.composing.data=e.data}),Aa(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))}),Aa(i,"touchstart",function(){r.forceCompositionEnd()}),Aa(i,"input",function(){r.composing||(n.isReadOnly()||!r.pollContent())&&At(r.cm,function(){Pt(n)})}),Aa(i,"copy",t),Aa(i,"cut",t)},prepareSelection:function(){var e=Pe(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!=Ho(Y(r,n),t.from())||0!=Ho($(r,n),t.to())){var i=oe(this.cm,t.from()),o=oe(this.cm,t.to());if(i||o){var a=this.cm.display.view,l=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var s=a[a.length-1].measure,c=s.maps?s.maps[s.maps.length-1]:s.map;o={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}}}else i={node:a[0].measure.map[2],offset:0};try{var u=Ka(i.node,i.offset,o.offset,o.node)}catch(d){}u&&(!mo&&this.cm.state.focused?(e.collapse(i.node,i.offset),u.collapsed||e.addRange(u)):(e.removeAllRanges(),e.addRange(u)),l&&null==e.anchorNode?e.addRange(l):mo&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){Ui(this.cm.display.cursorDiv,e.cursors),Ui(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 Va(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():At(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var r=le(t,e.anchorNode,e.anchorOffset),n=le(t,e.focusNode,e.focusOffset);r&&n&&At(t,function(){Le(t.doc,fe(r,n),Da),(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=Ht(e,n.line)))var a=ti(t.view[0].line),l=t.view[0].node;else var a=ti(t.view[o].line),l=t.view[o-1].node.nextSibling;var s=Ht(e,i.line);if(s==t.view.length-1)var c=t.viewTo-1,u=t.lineDiv.lastChild;else var c=ti(t.view[s+1].line)-1,u=t.view[s+1].node.previousSibling;for(var d=e.doc.splitLines(ce(e,l,u,a,c)),h=Qn(e.doc,Io(a,0),Io(c,Zn(e.doc,c).text.length));d.length>1&&h.length>1;)if(Wi(d)==Wi(h))d.pop(),h.pop(),c--;else{if(d[0]!=h[0])break;d.shift(),h.shift(),a++}for(var f=0,p=0,g=d[0],m=h[0],v=Math.min(g.length,m.length);v>f&&g.charCodeAt(f)==m.charCodeAt(f);)++f;for(var y=Wi(d),b=Wi(h),w=Math.min(y.length-(1==d.length?f:0),b.length-(1==h.length?f:0));w>p&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;d[d.length-1]=y.slice(0,y.length-p),d[0]=d[0].slice(f);var x=Io(a,f),k=Io(c,h.length?Wi(h).length-p:0);return d.length>1||d[0]||Ho(x,k)?(Or(e.doc,d,x,k,"+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){this.cm.isReadOnly()?Nt(this.cm,Pt)(this.cm):e.data&&e.data!=e.startData&&Nt(this.cm,Z)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.contentEditable="false"},onKeyPress:function(e){e.preventDefault(),this.cm.isReadOnly()||Nt(this.cm,Z)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},readOnlyChanged:function(e){this.div.contentEditable=String("nocursor"!=e)},onContextMenu:Pi,resetPosition:Pi,needsContentAttribute:!0},ie.prototype),e.inputStyles={textarea:re,contenteditable:ie},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!=Ho(r.anchor,n.anchor)||0!=Ho(r.head,n.head))return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new de(V(this.ranges[t].anchor),V(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(Ho(t,n.from())>=0&&Ho(e,n.to())<=0)return r}return-1}},de.prototype={from:function(){return Y(this.anchor,this.head)},to:function(){return $(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var jo,Ro,Bo,Ko={left:0,right:0,top:0,bottom:0},Uo=null,Go=0,qo=0,Vo=0,$o=null;bo?$o=-.53:mo?$o=15:Co?$o=-.7:To&&($o=-1/3);var Yo=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=Yo(e);return t.x*=$o,t.y*=$o,t};var Xo=new Ni,Zo=null,Qo=e.changeEnd=function(e){return e.text?Io(e.from.line+e.text.length-1,Wi(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,ea.hasOwnProperty(e)&&Nt(this,ea[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"](qr(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:Ot(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++,Pt(this)}),removeOverlay:Ot(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 Pt(this)}}),indentLine:Ot(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)&&Fr(this,e,t,r)}),indentSelection:Ot(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&&(Fr(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&Ir(this));else{var o=i.from(),a=i.to(),l=Math.max(r,o.line);r=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=l;r>s;++s)Fr(this,s,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[n].from().ch>0&&ke(this.doc,n,new de(o,c[n].to()),Da)}}}),getTokenAt:function(e,t){return Wn(this,e,t)},getLineTokens:function(e,t){return Wn(this,Io(e),t,!0)},getTokenTypeAt:function(e){e=ge(this.doc,e);var t,r=Pn(this,Zn(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var a=n+i>>1;if((a?r[2*a-1]:0)>=o)i=a;else{if(!(r[2*a+1]<o)){t=r[2*a+2];break}n=a+1}}var l=t?t.indexOf("cm-overlay "):-1;return 0>l?t:0==l?null:t.slice(0,l-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!aa.hasOwnProperty(t))return r;var n=aa[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 a=n[i[t][o]];a&&r.push(a)}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 l=n._global[o];l.pred(i,this)&&-1==zi(r,l.val)&&r.push(l.val)}return r},getStateAfter:function(e,t){var r=this.doc;return e=pe(r,null==e?r.first+r.size-1:e),Be(this,e+1,t)},cursorCoords:function(e,t){var r,n=this.doc.sel.primary();return r=null==e?n.head:"object"==typeof e?ge(this.doc,e):e?n.from():n.to(),ft(this,r,t||"page")},charCoords:function(e,t){return ht(this,ge(this.doc,e),t||"page")},coordsChar:function(e,t){return e=dt(this,e,t||"page"),mt(this,e.left,e.top)},lineAtHeight:function(e,t){return e=dt(this,{top:e,left:0},t||"page").top,ri(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var r,n=!1;if("number"==typeof e){var i=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>i&&(e=i,n=!0),r=Zn(this.doc,e)}else r=e;return ut(this,r,{top:0,left:0},t||"page").top+(n?this.doc.height-ni(r):0)},defaultTextHeight:function(){return yt(this.display)},defaultCharWidth:function(){return bt(this.display)},setGutterMarker:Ot(function(e,t,r){return jr(this.doc,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&ji(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Ot(function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,Dt(t,n,"gutter"),ji(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),lineInfo:function(e){if("number"==typeof e){if(!ve(this.doc,e))return null;var t=e;if(e=Zn(this.doc,e),!e)return null}else{var t=ti(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=ft(this,ge(this.doc,e));var a=e.bottom,l=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)a=e.top;else if("above"==n||"near"==n){var s=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>c&&(l=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),r&&Er(this,l,a,l+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:Ot(dr),triggerOnKeyPress:Ot(pr),triggerOnKeyUp:fr,execCommand:function(e){return ca.hasOwnProperty(e)?ca[e].call(null,this):void 0},triggerElectric:Ot(function(e){J(this,e)}),findPosH:function(e,t,r,n){var i=1;0>t&&(i=-1,t=-t);for(var o=0,a=ge(this.doc,e);t>o&&(a=Br(this.doc,a,i,r,n),!a.hitSide);++o);return a},moveH:Ot(function(e,t){var r=this;r.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?Br(r.doc,n.head,e,t,r.options.rtlMoveVisually):0>e?n.from():n.to()},Ha)}),deleteH:Ot(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Rr(this,function(r){var i=Br(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 a=0,l=ge(this.doc,e);t>a;++a){var s=ft(this,l,"div");if(null==o?o=s.left:s.left=o,l=Kr(this,s,i,r),l.hitSide)break}return l},moveV:Ot(function(e,t){var r=this,n=this.doc,i=[],o=!r.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(a){if(o)return 0>e?a.from():a.to();var l=ft(r,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left);var s=Kr(r,l,e,t);return"page"==t&&a==n.sel.primary()&&Dr(r,null,ht(r,s,"div").top-l.top),s},Ha),i.length)for(var a=0;a<n.sel.ranges.length;a++)n.sel.ranges[a].goalColumn=i[a]}),findWordAt:function(e){var t=this.doc,r=Zn(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 a=r.charAt(n),l=Fi(a,o)?function(e){return Fi(e,o)}:/\s/.test(a)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Fi(e)};n>0&&l(r.charAt(n-1));)--n;for(;i<r.length&&l(r.charAt(i));)++i}return new de(Io(e.line,n),Io(e.line,i))},toggleOverwrite:function(e){(null==e||e!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?Za(this.display.cursorDiv,"CodeMirror-overwrite"):Xa(this.display.cursorDiv,"CodeMirror-overwrite"),Wa(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==Gi()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Ot(function(e,t){(null!=e||null!=t)&&Hr(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-qe(this)-this.display.barHeight,width:e.scrollWidth-qe(this)-this.display.barWidth,clientHeight:$e(this),clientWidth:Ve(this)}},scrollIntoView:Ot(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:Io(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)Hr(this),this.curOp.scrollToPos=e;else{var r=Pr(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:Ot(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&&at(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){Dt(n,i,"widget");break}++i}),n.curOp.forceUpdate=!0,Wa(n,"refresh",this)}),operation:function(e){return At(this,e)},refresh:Ot(function(){var e=this.display.cachedTextHeight;Pt(this),this.curOp.forceUpdate=!0,lt(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),u(this),(null==e||Math.abs(e-yt(this.display))>.5)&&a(this),Wa(this,"refresh",this)}),swapDoc:Ot(function(e){var t=this.doc;return t.cm=null,Xn(this,e),lt(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Si(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}},Ai(e);var Jo=e.defaults={},ea=e.optionHandlers={},ta=e.Init={toString:function(){return"CodeMirror.Init"}};Ur("value","",function(e,t){e.setValue(t)},!0),Ur("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),Ur("indentUnit",2,r,!0),Ur("indentWithTabs",!1),Ur("smartIndent",!0),Ur("tabSize",4,function(e){n(e),lt(e),Pt(e)},!0),Ur("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,r.push(Io(n,o))}n++});for(var i=r.length-1;i>=0;i--)Or(e.doc,t,r[i],Io(r[i].line,r[i].ch+t.length))}}),Ur("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,r,n){t.state.specialChars=new RegExp(r.source+(r.test(" ")?"":"| "),"g"),n!=e.Init&&t.refresh()}),Ur("specialCharPlaceholder",Fn,function(e){e.refresh()},!0),Ur("electricChars",!0),Ur("inputStyle",Ao?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Ur("rtlMoveVisually",!Oo),Ur("wholeLineUpdateBefore",!0),Ur("theme","default",function(e){l(e),s(e)},!0),Ur("keyMap","default",function(t,r,n){var i=qr(r),o=n!=e.Init&&qr(n);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),Ur("extraKeys",null),Ur("lineWrapping",!1,i,!0),Ur("gutters",[],function(e){f(e.options),s(e)},!0),Ur("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?S(e.display)+"px":"0",e.refresh()},!0),Ur("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),Ur("scrollbarStyle","native",function(e){v(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Ur("lineNumbers",!1,function(e){f(e.options),s(e)},!0),Ur("firstLineNumber",1,s,!0),Ur("lineNumberFormatter",function(e){return e},s,!0),Ur("showCursorWhenSelecting",!1,Ee,!0),Ur("resetSelectionOnContextMenu",!0),Ur("lineWiseCopyCut",!0),Ur("readOnly",!1,function(e,t){"nocursor"==t?(vr(e),e.display.input.blur(),e.display.disabled=!0):e.display.disabled=!1,e.display.input.readOnlyChanged(t)}),Ur("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Ur("dragDrop",!0,Kt),Ur("allowDropFileTypes",null),Ur("cursorBlinkRate",530),Ur("cursorScrollMargin",0),Ur("cursorHeight",1,Ee,!0),Ur("singleCursorHeightPerLine",!0,Ee,!0),Ur("workTime",100),Ur("workDelay",100),Ur("flattenSpans",!0,n,!0),Ur("addModeClass",!1,n,!0),Ur("pollInterval",100),Ur("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),Ur("historyEventDelay",1250),Ur("viewportMargin",10,function(e){e.refresh()},!0),Ur("maxHighlightLength",1e4,n,!0),Ur("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Ur("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),Ur("autofocus",null);var ra=e.modes={},na=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)),ra[t]=r},e.defineMIME=function(e,t){na[e]=t},e.resolveMode=function(t){if("string"==typeof t&&na.hasOwnProperty(t))t=na[t];else if(t&&"string"==typeof t.name&&na.hasOwnProperty(t.name)){var r=na[t.name];"string"==typeof r&&(r={name:r}),t=Di(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=ra[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if(ia.hasOwnProperty(r.name)){var o=ia[r.name];for(var a in o)o.hasOwnProperty(a)&&(i.hasOwnProperty(a)&&(i["_"+a]=i[a]),i[a]=o[a])}if(i.name=r.name,r.helperType&&(i.helperType=r.helperType),r.modeProps)for(var a in r.modeProps)i[a]=r.modeProps[a];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var ia=e.modeExtensions={};e.extendMode=function(e,t){var r=ia.hasOwnProperty(e)?ia[e]:ia[e]={};Ii(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){Ca.prototype[e]=t},e.defineOption=Ur;var oa=[];e.defineInitHook=function(e){oa.push(e)};var aa=e.helpers={};e.registerHelper=function(t,r,n){aa.hasOwnProperty(t)||(aa[t]=e[t]={_global:[]}),aa[t][r]=n},e.registerGlobalHelper=function(t,r,n,i){e.registerHelper(t,r,i),aa[t]._global.push({pred:n,val:i})};var la=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},sa=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 ca=e.commands={selectAll:function(e){e.setSelection(Io(e.firstLine(),0),Io(e.lastLine()),Da)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Da)},killLine:function(e){Rr(e,function(t){if(t.empty()){var r=Zn(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:Io(t.head.line+1,0)}:{from:t.head,to:Io(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){Rr(e,function(t){return{from:Io(t.from().line,0),to:ge(e.doc,Io(t.to().line+1,0))}})},delLineLeft:function(e){Rr(e,function(e){return{from:Io(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){Rr(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){Rr(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(Io(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(Io(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return oo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){return lo(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){e.extendSelectionsBy(function(t){return ao(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")},Ha)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},Ha)},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/)?lo(e,t.head):n},Ha)},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(),a=Fa(e.getLine(o.line),o.ch,n);t.push(new Array(n-a%n+1).join(" "))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){At(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){var i=t[n].head,o=Zn(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new Io(i.line,i.ch-1)),i.ch>0)i=new Io(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),Io(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Zn(e.doc,i.line-1).text;a&&e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),Io(i.line-1,a.length-1),Io(i.line,1),"+transpose")}r.push(new de(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){At(e,function(){for(var t=e.listSelections().length,r=0;t>r;r++){
6
- var n=e.listSelections()[r];e.replaceRange(e.doc.lineSeparator(),n.anchor,n.head,"+input"),e.indentLine(n.from().line+1,null,!0)}Ir(e)})},toggleOverwrite:function(e){e.toggleOverwrite()}},ua=e.keyMap={};ua.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"},ua.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"},ua.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"},ua.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"]},ua["default"]=No?ua.macDefault:ua.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=Ei(r.split(" "),Gr),o=0;o<i.length;o++){var a,l;o==i.length-1?(l=i.join(" "),a=n):(l=i.slice(0,o+1).join(" "),a="...");var s=t[l];if(s){if(s!=a)throw new Error("Inconsistent bindings for "+l)}else t[l]=a}delete e[r]}for(var c in t)e[c]=t[c];return e};var da=e.lookupKey=function(e,t,r,n){t=qr(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 da(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var a=da(e,t.fallthrough[o],r,n);if(a)return a}}},ha=e.isModifierKey=function(e){var t="string"==typeof e?e:il[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},fa=e.keyName=function(e,t){if(So&&34==e.keyCode&&e["char"])return!1;var r=il[e.keyCode],n=r;return null==n||e.altGraphKey?!1:(e.altKey&&"Alt"!=r&&(n="Alt-"+n),(zo?e.metaKey:e.ctrlKey)&&"Ctrl"!=r&&(n="Ctrl-"+n),(zo?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=c.getValue()}if(r=r?Ii(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=Gi();r.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(Aa(t.form,"submit",n),!r.leaveSubmitMethodAlone)){var o=t.form,a=o.submit;try{var l=o.submit=function(){n(),o.submit=a,o.submit(),o.submit=l}}catch(s){}}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&&(Oa(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=a))}},t.style.display="none";var c=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},r);return c};var pa=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};pa.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=Fa(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Fa(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Fa(this.string,null,this.tabSize)-(this.lineStart?Fa(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 ga=0,ma=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ga};Ai(ma),ma.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&wt(e),_i(this,"clear")){var r=this.find();r&&Si(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],l=Jr(a.markedSpans,this);e&&!this.collapsed?Dt(e,ti(a),"text"):e&&(null!=l.to&&(i=ti(a)),null!=l.from&&(n=ti(a))),a.markedSpans=en(a.markedSpans,l),null==l.from&&this.collapsed&&!kn(this.doc,a)&&e&&ei(a,yt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var s=yn(this.lines[o]),c=d(s);c>e.display.maxLineLength&&(e.display.maxLine=s,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&Pt(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ae(e.doc)),e&&Si(e,"markerCleared",e,this),t&&kt(e),this.parent&&this.parent.clear()}},ma.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],a=Jr(o.markedSpans,this);if(null!=a.from&&(r=Io(t?o:ti(o),a.from),-1==e))return r;if(null!=a.to&&(n=Io(t?o:ti(o),a.to),1==e))return n}return r&&{from:r,to:n}},ma.prototype.changed=function(){var e=this.find(-1,!0),t=this,r=this.doc.cm;e&&r&&At(r,function(){var n=e.line,i=ti(e.line),o=Je(r,i);if(o&&(ot(o),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!kn(t.doc,n)&&null!=t.height){var a=t.height;t.height=null;var l=Tn(t)-a;l&&ei(n,n.height+l)}})},ma.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=zi(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ma.prototype.detachLine=function(e){if(this.lines.splice(zi(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var ga=0,va=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};Ai(va),va.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Si(this,"clear")}},va.prototype.find=function(e,t){return this.primary.find(e,t)};var ya=e.LineWidget=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};Ai(ya),ya.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=ti(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=Tn(this);ei(r,Math.max(0,r.height-o)),e&&At(e,function(){Sn(e,r,-o),Dt(e,n,"widget")})}},ya.prototype.changed=function(){var e=this.height,t=this.doc.cm,r=this.line;this.height=null;var n=Tn(this)-e;n&&(ei(r,r.height+n),t&&At(t,function(){t.curOp.forceUpdate=!0,Sn(t,r,n)}))};var ba=e.Line=function(e,t,r){this.text=e,un(this,t),this.height=r?r(this):1};Ai(ba),ba.prototype.lineNo=function(){return ti(this)};var wa={},xa={};Vn.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,_n(i),Si(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}},$n.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),a=n.height;if(n.removeInner(e,o),this.height-=a-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Vn))){var l=[];this.collapse(l),this.children=[new Vn(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(o>=e){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(;i.lines.length>50;){var a=i.lines.splice(i.lines.length-25,25),l=new Vn(a);i.height-=l.height,this.children.splice(n+1,0,l),l.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 $n(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=zi(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new $n(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 a=Math.min(t,o-e);if(i.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var ka=0,Ca=e.Doc=function(e,t,r,n){if(!(this instanceof Ca))return new Ca(e,t,r,n);null==r&&(r=0),$n.call(this,[new Vn([new ba("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var i=Io(r,0);this.sel=fe(i),this.history=new oi(null),this.id=++ka,this.modeOption=t,this.lineSep=n,this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),qn(this,{from:i,to:i,text:e}),Le(this,fe(i),Da)};Ca.prototype=Di($n.prototype,{constructor:Ca,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=Jn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Wt(function(e){var t=Io(this.first,0),r=this.first+this.size-1;Tr(this,{from:t,to:Io(r,Zn(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),Le(this,fe(t))}),replaceRange:function(e,t,r,n){t=ge(this,t),r=r?ge(this,r):t,Or(this,e,t,r,n)},getRange:function(e,t,r){var n=Qn(this,ge(this,e),ge(this,t));return r===!1?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){return ve(this,e)?Zn(this,e):void 0},getLineNumber:function(e){return ti(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Zn(this,e)),yn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ge(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:Wt(function(e,t,r){Ce(this,ge(this,"number"==typeof e?Io(e,t||0):e),null,r)}),setSelection:Wt(function(e,t,r){Ce(this,ge(this,e),ge(this,t||e),r)}),extendSelection:Wt(function(e,t,r){we(this,ge(this,e),t&&ge(this,t),r)}),extendSelections:Wt(function(e,t){xe(this,ye(this,e),t)}),extendSelectionsBy:Wt(function(e,t){var r=Ei(this.sel.ranges,e);xe(this,ye(this,r),t)}),setSelections:Wt(function(e,t,r){if(e.length){for(var n=0,i=[];n<e.length;n++)i[n]=new de(ge(this,e[n].anchor),ge(this,e[n].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Le(this,he(i,t),r)}}),addSelection:Wt(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new de(ge(this,e),ge(this,t||e))),Le(this,he(n,n.length-1),r)}),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=Qn(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return e===!1?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=Qn(this,r[n].from(),r[n].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:Wt(function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];n[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:r}}for(var l=t&&"end"!=t&&Cr(this,n,t),o=n.length-1;o>=0;o--)Tr(this,n[o]);l?Te(this,l):this.cm&&Ir(this.cm)}),undo:Wt(function(){Mr(this,"undo")}),redo:Wt(function(){Mr(this,"redo")}),undoSelection:Wt(function(){Mr(this,"undo",!0)}),redoSelection:Wt(function(){Mr(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 oi(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:mi(this.history.done),undone:mi(this.history.undone)}},setHistory:function(e){var t=this.history=new oi(this.history.maxGeneration);t.done=mi(e.done.slice(0),null,!0),t.undone=mi(e.undone.slice(0),null,!0)},addLineClass:Wt(function(e,t,r){return jr(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(qi(r).test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0})}),removeLineClass:Wt(function(e,t,r){return jr(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(qi(r));if(!o)return!1;var a=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0})}),addLineWidget:Wt(function(e,t,r){return Ln(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return Vr(this,ge(this,e),ge(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ge(this,e),Vr(this,e,e,r,"bookmark")},findMarksAt:function(e){e=ge(this,e);var t=[],r=Zn(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=ge(this,e),t=ge(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;l<a.length;l++){var s=a[l];i==e.line&&e.ch>s.to||null==s.from&&i!=e.line||i==t.line&&s.from>t.ch||r&&!r(s.marker)||n.push(s.marker.parent||s.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first;return this.iter(function(n){var i=n.text.length+1;return i>e?(t=e,!0):(e-=i,void++r)}),ge(this,Io(r,t))},indexFromPos:function(e){e=ge(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 Ca(Jn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep);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 Ca(Jn(this,t,r),e.mode||this.modeOption,t,this.lineSep);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}],Xr(n,Yr(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),Zr(Yr(this));break}}if(t.history==this.history){var i=[t.id];Yn(t,function(e){i.push(e.id)},!0),t.history=new oi(null),t.history.done=mi(this.history.done,i),t.history.undone=mi(this.history.undone,i)}},iterLinkedDocs:function(e){Yn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):el(e)},lineSeparator:function(){return this.lineSep||"\n"}}),Ca.prototype.eachLine=Ca.prototype.iter;var Sa="iter insert remove copy getEditor constructor".split(" ");for(var Ta in Ca.prototype)Ca.prototype.hasOwnProperty(Ta)&&zi(Sa,Ta)<0&&(e.prototype[Ta]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ca.prototype[Ta]));Ai(Ca);var La=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},Ma=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},_a=e.e_stop=function(e){La(e),Ma(e)},Aa=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)}},Na=[],Oa=e.off=function(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else for(var n=Ci(e,t,!1),i=0;i<n.length;++i)if(n[i]==r){n.splice(i,1);break}},Wa=e.signal=function(e,t){var r=Ci(e,t,!0);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)},za=null,Ea=30,Pa=e.Pass={toString:function(){return"CodeMirror.Pass"}},Da={scroll:!1},Ia={origin:"*mouse"},Ha={origin:"+move"};Ni.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Fa=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,a=i||0;;){var l=e.indexOf(" ",o);if(0>l||l>=t)return a+(t-o);a+=l-o,a+=r-a%r,o=l+1}},ja=e.findColumn=function(e,t,r){for(var n=0,i=0;;){var o=e.indexOf(" ",n);-1==o&&(o=e.length);var a=o-n;if(o==e.length||i+a>=t)return n+Math.min(a,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}},Ra=[""],Ba=function(e){e.select()};_o?Ba=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:bo&&(Ba=function(e){try{e.select()}catch(t){}});var Ka,Ua=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ga=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Ua.test(e))},qa=/[\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]/;Ka=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 Va=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)};bo&&11>wo&&(Gi=function(){try{return document.activeElement}catch(e){return document.body}});var $a,Ya,Xa=e.rmClass=function(e,t){var r=e.className,n=qi(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:"")}},Za=e.addClass=function(e,t){var r=e.className;qi(t).test(r)||(e.className+=(r?" ":"")+t)},Qa=!1,Ja=function(){if(bo&&9>wo)return!1;var e=Bi("div");return"draggable"in e||"dragDrop"in e}(),el=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),a=o.indexOf("\r");-1!=a?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},tl=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},rl=function(){var e=Bi("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),nl=null,il=e.keyNames={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",106:"*",107:"=",109:"-",110:".",111:"/",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"};!function(){for(var e=0;10>e;e++)il[e+48]=il[e+96]=String(e);for(var e=65;90>=e;e++)il[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)il[e+111]=il[e+63235]="F"+e}();var ol,al=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]/,a=/[LRr]/,l=/[Lb1n]/,s=/[1n]/,c="L";return function(r){if(!i.test(r))return!1;for(var n,u=r.length,d=[],h=0;u>h;++h)d.push(n=e(r.charCodeAt(h)));for(var h=0,f=c;u>h;++h){var n=d[h];"m"==n?d[h]=f:f=n}for(var h=0,p=c;u>h;++h){var n=d[h];"1"==n&&"r"==p?d[h]="n":a.test(n)&&(p=n,"r"==n&&(d[h]="R"))}for(var h=1,f=d[0];u-1>h;++h){var n=d[h];"+"==n&&"1"==f&&"1"==d[h+1]?d[h]="1":","!=n||f!=d[h+1]||"1"!=f&&"n"!=f||(d[h]=f),f=n}for(var h=0;u>h;++h){var n=d[h];if(","==n)d[h]="N";else if("%"==n){for(var g=h+1;u>g&&"%"==d[g];++g);for(var m=h&&"!"==d[h-1]||u>g&&"1"==d[g]?"1":"N",v=h;g>v;++v)d[v]=m;h=g-1}}for(var h=0,p=c;u>h;++h){var n=d[h];"L"==p&&"1"==n?d[h]="L":a.test(n)&&(p=n)}for(var h=0;u>h;++h)if(o.test(d[h])){for(var g=h+1;u>g&&o.test(d[g]);++g);for(var y="L"==(h?d[h-1]:c),b="L"==(u>g?d[g]:c),m=y||b?"L":"R",v=h;g>v;++v)d[v]=m;h=g-1}for(var w,x=[],h=0;u>h;)if(l.test(d[h])){var k=h;for(++h;u>h&&l.test(d[h]);++h);x.push(new t(0,k,h))}else{var C=h,S=x.length;for(++h;u>h&&"L"!=d[h];++h);for(var v=C;h>v;)if(s.test(d[v])){v>C&&x.splice(S,0,new t(1,C,v));var T=v;for(++v;h>v&&s.test(d[v]);++v);x.splice(S,0,new t(2,T,v)),C=v}else++v;h>C&&x.splice(S,0,new t(1,C,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==Wi(x).level&&(w=r.match(/\s+$/))&&(Wi(x).to-=w[0].length,x.push(new t(0,u-w[0].length,u))),2==x[0].level&&x.unshift(new t(1,x[0].to,x[0].to)),x[0].level!=Wi(x).level&&x.push(new t(x[0].level,u,u)),x}}();return e.version="5.11.0",e})},{}],17:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=!0;return t}function r(e,t){for(var r,n=!1;null!=(r=e.next());){if(n&&"/"==r){t.tokenize=null;break}n="*"==r}return["comment","comment"]}e.defineMode("css",function(t,r){function n(e,t){return p=t,e}function i(e,t){var r=e.next();if(v[r]){var i=v[r](e,t);if(i!==!1)return i}return"@"==r?(e.eatWhile(/[\w\\\-]/),n("def",e.current())):"="==r||("~"==r||"|"==r)&&e.eat("=")?n(null,"compare"):'"'==r||"'"==r?(t.tokenize=o(r),t.tokenize(e,t)):"#"==r?(e.eatWhile(/[\w\\\-]/),n("atom","hash")):"!"==r?(e.match(/^\s*\w*/),n("keyword","important")):/\d/.test(r)||"."==r&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),n("number","unit")):"-"!==r?/[,+>*\/]/.test(r)?n(null,"select-op"):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?n("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?n(null,r):"u"==r&&e.match(/rl(-prefix)?\(/)||"d"==r&&e.match("omain(")||"r"==r&&e.match("egexp(")?(e.backUp(1),t.tokenize=a,n("property","word")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),n("property","word")):n(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),n("number","unit")):e.match(/^-[\w\\\-]+/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?n("variable-2","variable-definition"):n("variable-2","variable")):e.match(/^\w+-/)?n("meta","meta"):void 0}function o(e){return function(t,r){for(var i,o=!1;null!=(i=t.next());){if(i==e&&!o){")"==e&&t.backUp(1);break}o=!o&&"\\"==i}return(i==e||!o&&")"!=e)&&(r.tokenize=null),n("string","string")}}function a(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=o(")"),n(null,"(")}function l(e,t,r){this.type=e,this.indent=t,this.prev=r}function s(e,t,r,n){return e.context=new l(r,t.indentation()+(n===!1?0:m),e.context),r}function c(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function u(e,t,r){return N[r.context.type](e,t,r)}function d(e,t,r,n){for(var i=n||1;i>0;i--)r.context=r.context.prev;return u(e,t,r)}function h(e){var t=e.current().toLowerCase();g=M.hasOwnProperty(t)?"atom":L.hasOwnProperty(t)?"keyword":"variable"}var f=r.inline;r.propertyKeywords||(r=e.resolveMode("text/css"));var p,g,m=t.indentUnit,v=r.tokenHooks,y=r.documentTypes||{},b=r.mediaTypes||{},w=r.mediaFeatures||{},x=r.mediaValueKeywords||{},k=r.propertyKeywords||{},C=r.nonStandardPropertyKeywords||{},S=r.fontProperties||{},T=r.counterDescriptors||{},L=r.colorKeywords||{},M=r.valueKeywords||{},_=r.allowNested,A=r.supportsAtComponent===!0,N={};return N.top=function(e,t,r){if("{"==e)return s(r,t,"block");if("}"==e&&r.context.prev)return c(r);if(A&&/@component/.test(e))return s(r,t,"atComponentBlock");if(/^@(-moz-)?document$/.test(e))return s(r,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/.test(e))return s(r,t,"atBlock");if(/^@(font-face|counter-style)/.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return s(r,t,"at");if("hash"==e)g="builtin";else if("word"==e)g="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return s(r,t,"interpolation");if(":"==e)return"pseudo";if(_&&"("==e)return s(r,t,"parens")}return r.context.type},N.block=function(e,t,r){if("word"==e){var n=t.current().toLowerCase();return k.hasOwnProperty(n)?(g="property","maybeprop"):C.hasOwnProperty(n)?(g="string-2","maybeprop"):_?(g=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(g+=" error","maybeprop")}return"meta"==e?"block":_||"hash"!=e&&"qualifier"!=e?N.top(e,t,r):(g="error","block")},N.maybeprop=function(e,t,r){return":"==e?s(r,t,"prop"):u(e,t,r)},N.prop=function(e,t,r){if(";"==e)return c(r);if("{"==e&&_)return s(r,t,"propBlock");if("}"==e||"{"==e)return d(e,t,r);if("("==e)return s(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if("word"==e)h(t);else if("interpolation"==e)return s(r,t,"interpolation")}else g+=" error";return"prop"},N.propBlock=function(e,t,r){return"}"==e?c(r):"word"==e?(g="property","maybeprop"):r.context.type;
7
- },N.parens=function(e,t,r){return"{"==e||"}"==e?d(e,t,r):")"==e?c(r):"("==e?s(r,t,"parens"):"interpolation"==e?s(r,t,"interpolation"):("word"==e&&h(t),"parens")},N.pseudo=function(e,t,r){return"word"==e?(g="variable-3",r.context.type):u(e,t,r)},N.documentTypes=function(e,t,r){return"word"==e&&y.hasOwnProperty(t.current())?(g="tag",r.context.type):N.atBlock(e,t,r)},N.atBlock=function(e,t,r){if("("==e)return s(r,t,"atBlock_parens");if("}"==e||";"==e)return d(e,t,r);if("{"==e)return c(r)&&s(r,t,_?"block":"top");if("interpolation"==e)return s(r,t,"interpolation");if("word"==e){var n=t.current().toLowerCase();g="only"==n||"not"==n||"and"==n||"or"==n?"keyword":b.hasOwnProperty(n)?"attribute":w.hasOwnProperty(n)?"property":x.hasOwnProperty(n)?"keyword":k.hasOwnProperty(n)?"property":C.hasOwnProperty(n)?"string-2":M.hasOwnProperty(n)?"atom":L.hasOwnProperty(n)?"keyword":"error"}return r.context.type},N.atComponentBlock=function(e,t,r){return"}"==e?d(e,t,r):"{"==e?c(r)&&s(r,t,_?"block":"top",!1):("word"==e&&(g="error"),r.context.type)},N.atBlock_parens=function(e,t,r){return")"==e?c(r):"{"==e||"}"==e?d(e,t,r,2):N.atBlock(e,t,r)},N.restricted_atBlock_before=function(e,t,r){return"{"==e?s(r,t,"restricted_atBlock"):"word"==e&&"@counter-style"==r.stateArg?(g="variable","restricted_atBlock_before"):u(e,t,r)},N.restricted_atBlock=function(e,t,r){return"}"==e?(r.stateArg=null,c(r)):"word"==e?(g="@font-face"==r.stateArg&&!S.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==r.stateArg&&!T.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},N.keyframes=function(e,t,r){return"word"==e?(g="variable","keyframes"):"{"==e?s(r,t,"top"):u(e,t,r)},N.at=function(e,t,r){return";"==e?c(r):"{"==e||"}"==e?d(e,t,r):("word"==e?g="tag":"hash"==e&&(g="builtin"),"at")},N.interpolation=function(e,t,r){return"}"==e?c(r):"{"==e||";"==e?d(e,t,r):("word"==e?g="variable":"variable"!=e&&"("!=e&&")"!=e&&(g="error"),"interpolation")},{startState:function(e){return{tokenize:null,state:f?"block":"top",stateArg:null,context:new l(f?"block":"top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||i)(e,t);return r&&"object"==typeof r&&(p=r[1],r=r[0]),g=r,t.state=N[t.state](p,e,t),g},indent:function(e,t){var r=e.context,n=t&&t.charAt(0),i=r.indent;return"prop"!=r.type||"}"!=n&&")"!=n||(r=r.prev),r.prev&&("}"!=n||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"restricted_atBlock"!=r.type?(")"==n&&("parens"==r.type||"atBlock_parens"==r.type)||"{"==n&&("at"==r.type||"atBlock"==r.type))&&(i=Math.max(0,r.indent-m),r=r.prev):(r=r.prev,i=r.indent)),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var n=["domain","regexp","url","url-prefix"],i=t(n),o=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],a=t(o),l=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],s=t(l),c=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],u=t(c),d=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],h=t(d),f=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],p=t(f),g=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],m=t(g),v=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],y=t(v),b=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],w=t(b),x=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],k=t(x),C=n.concat(o).concat(l).concat(c).concat(d).concat(f).concat(b).concat(x);e.registerHelper("hintWords","css",C),e.defineMIME("text/css",{documentTypes:i,mediaTypes:a,mediaFeatures:s,mediaValueKeywords:u,propertyKeywords:h,nonStandardPropertyKeywords:p,fontProperties:m,counterDescriptors:y,colorKeywords:w,valueKeywords:k,tokenHooks:{"/":function(e,t){return e.eat("*")?(t.tokenize=r,r(e,t)):!1}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:a,mediaFeatures:s,mediaValueKeywords:u,propertyKeywords:h,nonStandardPropertyKeywords:p,colorKeywords:w,valueKeywords:k,fontProperties:m,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},":":function(e){return e.match(/\s*\{/)?[null,"{"]:!1},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return e.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:a,mediaFeatures:s,mediaValueKeywords:u,propertyKeywords:h,nonStandardPropertyKeywords:p,colorKeywords:w,valueKeywords:k,fontProperties:m,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)?!1:(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),e.defineMIME("text/x-gss",{documentTypes:i,mediaTypes:a,mediaFeatures:s,propertyKeywords:h,nonStandardPropertyKeywords:p,fontProperties:m,counterDescriptors:y,colorKeywords:w,valueKeywords:k,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return e.eat("*")?(t.tokenize=r,r(e,t)):!1}},name:"css",helperType:"gss"})})},{"../../lib/codemirror":16}],18:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror"),e("../xml/xml"),e("../javascript/javascript"),e("../css/css")):"function"==typeof t&&t.amd?t(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],i):i(CodeMirror)}(function(e){"use strict";function t(e,t,r){var n=e.current(),i=n.search(t);return i>-1?e.backUp(n.length-i):n.match(/<\/?$/)&&(e.backUp(n.length),e.match(t,!1)||e.match(n)),r}function r(e){var t=s[e];return t?t:s[e]=new RegExp("\\s+"+e+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")}function n(e,t){for(var n,i=e.pos;i>=0&&"<"!==e.string.charAt(i);)i--;return 0>i?i:(n=e.string.slice(i,e.pos).match(r(t)))?n[2]:""}function i(e,t){return new RegExp((t?"^":"")+"</s*"+e+"s*>","i")}function o(e,t){for(var r in e)for(var n=t[r]||(t[r]=[]),i=e[r],o=i.length-1;o>=0;o--)n.unshift(i[o])}function a(e,t){for(var r=0;r<e.length;r++){var i=e[r];if(!i[0]||i[1].test(n(t,i[0])))return i[2]}}var l={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]},s={};e.defineMode("htmlmixed",function(r,n){function s(n,o){var l,d=o.htmlState.tagName&&o.htmlState.tagName.toLowerCase(),h=d&&u.hasOwnProperty(d)&&u[d],f=c.token(n,o.htmlState);if(h&&/\btag\b/.test(f)&&">"===n.current()&&(l=a(h,n))){var p=e.getMode(r,l),g=i(d,!0),m=i(d,!1);o.token=function(e,r){return e.match(g,!1)?(r.token=s,r.localState=r.localMode=null,null):t(e,m,r.localMode.token(e,r.localState))},o.localMode=p,o.localState=e.startState(p,c.indent(o.htmlState,""))}return f}var c=e.getMode(r,{name:"xml",htmlMode:!0,multilineTagIndentFactor:n.multilineTagIndentFactor,multilineTagIndentPastTag:n.multilineTagIndentPastTag}),u={},d=n&&n.tags,h=n&&n.scriptTypes;if(o(l,u),d&&o(d,u),h)for(var f=h.length-1;f>=0;f--)u.script.unshift(["type",h[f].matches,h[f].mode]);return{startState:function(){var e=c.startState();return{token:s,localMode:null,localState:null,htmlState:e}},copyState:function(t){var r;return t.localState&&(r=e.copyState(t.localMode,t.localState)),{token:t.token,localMode:t.localMode,localState:r,htmlState:e.copyState(c,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,r){return!t.localMode||/^\s*<\//.test(r)?c.indent(t.htmlState,r):t.localMode.indent?t.localMode.indent(t.localState,r):e.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||c}}}},"xml","javascript","css"),e.defineMIME("text/html","htmlmixed")})},{"../../lib/codemirror":16,"../css/css":17,"../javascript/javascript":19,"../xml/xml":20}],19:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";function t(e,t,r){return/^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}e.defineMode("javascript",function(r,n){function i(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}function o(e,t,r){return we=e,xe=r,t}function a(e,r){var n=e.next();if('"'==n||"'"==n)return r.tokenize=l(n),r.tokenize(e,r);if("."==n&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return o("number","number");if("."==n&&e.match(".."))return o("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return o(n);if("="==n&&e.eat(">"))return o("=>","operator");if("0"==n&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),o("number","number");if("0"==n&&e.eat(/o/i))return e.eatWhile(/[0-7]/i),o("number","number");if("0"==n&&e.eat(/b/i))return e.eatWhile(/[01]/i),o("number","number");if(/\d/.test(n))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),o("number","number");if("/"==n)return e.eat("*")?(r.tokenize=s,s(e,r)):e.eat("/")?(e.skipToEnd(),o("comment","comment")):t(e,r,1)?(i(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),o("regexp","string-2")):(e.eatWhile(Ae),o("operator","operator",e.current()));if("`"==n)return r.tokenize=c,c(e,r);if("#"==n)return e.skipToEnd(),o("error","error");if(Ae.test(n))return e.eatWhile(Ae),o("operator","operator",e.current());if(Me.test(n)){e.eatWhile(Me);var a=e.current(),u=_e.propertyIsEnumerable(a)&&_e[a];return u&&"."!=r.lastType?o(u.type,u.style,a):o("variable","variable",a)}}function l(e){return function(t,r){var n,i=!1;if(Se&&"@"==t.peek()&&t.match(Ne))return r.tokenize=a,o("jsonld-keyword","meta");for(;null!=(n=t.next())&&(n!=e||i);)i=!i&&"\\"==n;return i||(r.tokenize=a),o("string","string")}}function s(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=a;break}n="*"==r}return o("comment","comment")}function c(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=a;break}n=!n&&"\\"==r}return o("quasi","string-2",e.current())}function u(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(0>r)){for(var n=0,i=!1,o=r-1;o>=0;--o){var a=e.string.charAt(o),l=Oe.indexOf(a);if(l>=0&&3>l){if(!n){++o;break}if(0==--n)break}else if(l>=3&&6>l)++n;else if(Me.test(a))i=!0;else{if(/["'\/]/.test(a))return;if(i&&!n){++o;break}}}i&&!n&&(t.fatArrowAt=o)}}function d(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function h(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function f(e,t,r,n,i){var o=e.cc;for(ze.state=e,ze.stream=i,ze.marked=null,ze.cc=o,ze.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var a=o.length?o.pop():Te?C:k;if(a(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return ze.marked?ze.marked:"variable"==r&&h(e,n)?"variable-2":t}}}function p(){for(var e=arguments.length-1;e>=0;e--)ze.cc.push(arguments[e])}function g(){return p.apply(null,arguments),!0}function m(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var r=ze.state;if(ze.marked="def",r.context){if(t(r.localVars))return;r.localVars={name:e,next:r.localVars}}else{if(t(r.globalVars))return;n.globalVars&&(r.globalVars={name:e,next:r.globalVars})}}function v(){ze.state.context={prev:ze.state.context,vars:ze.state.localVars},ze.state.localVars=Ee}function y(){ze.state.localVars=ze.state.context.vars,ze.state.context=ze.state.context.prev}function b(e,t){var r=function(){var r=ze.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented;r.lexical=new d(n,ze.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function w(){var e=ze.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function x(e){function t(r){return r==e?g():";"==e?p():g(t)}return t}function k(e,t){return"var"==e?g(b("vardef",t.length),$,x(";"),w):"keyword a"==e?g(b("form"),C,k,w):"keyword b"==e?g(b("form"),k,w):"{"==e?g(b("}"),U,w):";"==e?g():"if"==e?("else"==ze.state.lexical.info&&ze.state.cc[ze.state.cc.length-1]==w&&ze.state.cc.pop()(),g(b("form"),C,k,w,J)):"function"==e?g(oe):"for"==e?g(b("form"),ee,k,w):"variable"==e?g(b("stat"),I):"switch"==e?g(b("form"),C,b("}","switch"),x("{"),U,w,w):"case"==e?g(C,x(":")):"default"==e?g(x(":")):"catch"==e?g(b("form"),v,x("("),ae,x(")"),k,w,y):"class"==e?g(b("form"),le,w):"export"==e?g(b("stat"),de,w):"import"==e?g(b("stat"),he,w):"module"==e?g(b("form"),Y,b("}"),x("{"),U,w,w):p(b("stat"),C,x(";"),w)}function C(e){return T(e,!1)}function S(e){return T(e,!0)}function T(e,t){if(ze.state.fatArrowAt==ze.stream.start){var r=t?z:W;if("("==e)return g(v,b(")"),B(Y,")"),w,x("=>"),r,y);if("variable"==e)return p(v,Y,x("=>"),r,y)}var n=t?A:_;return We.hasOwnProperty(e)?g(n):"function"==e?g(oe,n):"keyword c"==e?g(t?M:L):"("==e?g(b(")"),L,ye,x(")"),w,n):"operator"==e||"spread"==e?g(t?S:C):"["==e?g(b("]"),me,w,n):"{"==e?K(F,"}",null,n):"quasi"==e?p(N,n):"new"==e?g(E(t)):g()}function L(e){return e.match(/[;\}\)\],]/)?p():p(C)}function M(e){return e.match(/[;\}\)\],]/)?p():p(S)}function _(e,t){return","==e?g(C):A(e,t,!1)}function A(e,t,r){var n=0==r?_:A,i=0==r?C:S;return"=>"==e?g(v,r?z:W,y):"operator"==e?/\+\+|--/.test(t)?g(n):"?"==t?g(C,x(":"),i):g(i):"quasi"==e?p(N,n):";"!=e?"("==e?K(S,")","call",n):"."==e?g(H,n):"["==e?g(b("]"),L,x("]"),w,n):void 0:void 0}function N(e,t){return"quasi"!=e?p():"${"!=t.slice(t.length-2)?g(N):g(C,O)}function O(e){return"}"==e?(ze.marked="string-2",ze.state.tokenize=c,g(N)):void 0}function W(e){return u(ze.stream,ze.state),p("{"==e?k:C)}function z(e){return u(ze.stream,ze.state),p("{"==e?k:S)}function E(e){return function(t){return"."==t?g(e?D:P):p(e?S:C)}}function P(e,t){return"target"==t?(ze.marked="keyword",g(_)):void 0}function D(e,t){return"target"==t?(ze.marked="keyword",g(A)):void 0}function I(e){return":"==e?g(w,k):p(_,x(";"),w)}function H(e){return"variable"==e?(ze.marked="property",g()):void 0}function F(e,t){return"variable"==e||"keyword"==ze.style?(ze.marked="property",g("get"==t||"set"==t?j:R)):"number"==e||"string"==e?(ze.marked=Se?"property":ze.style+" property",g(R)):"jsonld-keyword"==e?g(R):"modifier"==e?g(F):"["==e?g(C,x("]"),R):"spread"==e?g(C):void 0}function j(e){return"variable"!=e?p(R):(ze.marked="property",g(oe))}function R(e){return":"==e?g(S):"("==e?p(oe):void 0}function B(e,t){function r(n){if(","==n){var i=ze.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),g(e,r)}return n==t?g():g(x(t))}return function(n){return n==t?g():p(e,r)}}function K(e,t,r){for(var n=3;n<arguments.length;n++)ze.cc.push(arguments[n]);return g(b(t,r),B(e,t),w)}function U(e){return"}"==e?g():p(k,U)}function G(e){return Le&&":"==e?g(V):void 0}function q(e,t){return"="==t?g(S):void 0}function V(e){return"variable"==e?(ze.marked="variable-3",g()):void 0}function $(){return p(Y,G,Z,Q)}function Y(e,t){return"modifier"==e?g(Y):"variable"==e?(m(t),g()):"spread"==e?g(Y):"["==e?K(Y,"]"):"{"==e?K(X,"}"):void 0}function X(e,t){return"variable"!=e||ze.stream.match(/^\s*:/,!1)?("variable"==e&&(ze.marked="property"),"spread"==e?g(Y):"}"==e?p():g(x(":"),Y,Z)):(m(t),g(Z))}function Z(e,t){return"="==t?g(S):void 0}function Q(e){return","==e?g($):void 0}function J(e,t){return"keyword b"==e&&"else"==t?g(b("form","else"),k,w):void 0}function ee(e){return"("==e?g(b(")"),te,x(")"),w):void 0}function te(e){return"var"==e?g($,x(";"),ne):";"==e?g(ne):"variable"==e?g(re):p(C,x(";"),ne)}function re(e,t){return"in"==t||"of"==t?(ze.marked="keyword",g(C)):g(_,ne)}function ne(e,t){return";"==e?g(ie):"in"==t||"of"==t?(ze.marked="keyword",g(C)):p(C,x(";"),ie)}function ie(e){")"!=e&&g(C)}function oe(e,t){return"*"==t?(ze.marked="keyword",g(oe)):"variable"==e?(m(t),g(oe)):"("==e?g(v,b(")"),B(ae,")"),w,k,y):void 0}function ae(e){return"spread"==e?g(ae):p(Y,G,q)}function le(e,t){return"variable"==e?(m(t),g(se)):void 0}function se(e,t){return"extends"==t?g(C,se):"{"==e?g(b("}"),ce,w):void 0}function ce(e,t){return"variable"==e||"keyword"==ze.style?"static"==t?(ze.marked="keyword",g(ce)):(ze.marked="property","get"==t||"set"==t?g(ue,oe,ce):g(oe,ce)):"*"==t?(ze.marked="keyword",g(ce)):";"==e?g(ce):"}"==e?g():void 0}function ue(e){return"variable"!=e?p():(ze.marked="property",g())}function de(e,t){return"*"==t?(ze.marked="keyword",g(ge,x(";"))):"default"==t?(ze.marked="keyword",g(C,x(";"))):p(k)}function he(e){return"string"==e?g():p(fe,ge)}function fe(e,t){return"{"==e?K(fe,"}"):("variable"==e&&m(t),"*"==t&&(ze.marked="keyword"),g(pe))}function pe(e,t){return"as"==t?(ze.marked="keyword",g(fe)):void 0}function ge(e,t){return"from"==t?(ze.marked="keyword",g(C)):void 0}function me(e){return"]"==e?g():p(S,ve)}function ve(e){
8
- return"for"==e?p(ye,x("]")):","==e?g(B(M,"]")):p(B(S,"]"))}function ye(e){return"for"==e?g(ee,ye):"if"==e?g(C,ye):void 0}function be(e,t){return"operator"==e.lastType||","==e.lastType||Ae.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}var we,xe,ke=r.indentUnit,Ce=n.statementIndent,Se=n.jsonld,Te=n.json||Se,Le=n.typescript,Me=n.wordCharacters||/[\w$\xa1-\uffff]/,_e=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("operator"),o={type:"atom",style:"atom"},a={"if":e("if"),"while":t,"with":t,"else":r,"do":r,"try":r,"finally":r,"return":n,"break":n,"continue":n,"new":e("new"),"delete":n,"throw":n,"debugger":n,"var":e("var"),"const":e("var"),let:e("var"),"function":e("function"),"catch":e("catch"),"for":e("for"),"switch":e("switch"),"case":e("case"),"default":e("default"),"in":i,"typeof":i,"instanceof":i,"true":o,"false":o,"null":o,undefined:o,NaN:o,Infinity:o,"this":e("this"),"class":e("class"),"super":e("atom"),"yield":n,"export":e("export"),"import":e("import"),"extends":n};if(Le){var l={type:"variable",style:"variable-3"},s={"interface":e("class"),"implements":n,namespace:n,module:e("module"),"enum":e("module"),"public":e("modifier"),"private":e("modifier"),"protected":e("modifier"),"abstract":e("modifier"),as:i,string:l,number:l,"boolean":l,any:l};for(var c in s)a[c]=s[c]}return a}(),Ae=/[+\-*&%=<>!?|~^]/,Ne=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Oe="([{}])",We={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},ze={state:null,column:null,marked:null,cc:null},Ee={name:"this",next:{name:"arguments"}};return w.lex=!0,{startState:function(e){var t={tokenize:a,lastType:"sof",cc:[],lexical:new d((e||0)-ke,0,"block",!1),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:e||0};return n.globalVars&&"object"==typeof n.globalVars&&(t.globalVars=n.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),u(e,t)),t.tokenize!=s&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==we?r:(t.lastType="operator"!=we||"++"!=xe&&"--"!=xe?we:"incdec",f(t,r,we,xe,e))},indent:function(t,r){if(t.tokenize==s)return e.Pass;if(t.tokenize!=a)return 0;var i=r&&r.charAt(0),o=t.lexical;if(!/^\s*else\b/.test(r))for(var l=t.cc.length-1;l>=0;--l){var c=t.cc[l];if(c==w)o=o.prev;else if(c!=J)break}"stat"==o.type&&"}"==i&&(o=o.prev),Ce&&")"==o.type&&"stat"==o.prev.type&&(o=o.prev);var u=o.type,d=i==u;return"vardef"==u?o.indented+("operator"==t.lastType||","==t.lastType?o.info+1:0):"form"==u&&"{"==i?o.indented:"form"==u?o.indented+ke:"stat"==u?o.indented+(be(t,r)?Ce||ke:0):"switch"!=o.info||d||0==n.doubleIndentSwitch?o.align?o.column+(d?0:1):o.indented+(d?0:ke):o.indented+(/^(?:case|default)\b/.test(r)?ke:2*ke)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Te?null:"/*",blockCommentEnd:Te?null:"*/",lineComment:Te?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Te?"json":"javascript",jsonldMode:Se,jsonMode:Te,expressionAllowed:t,skipExpression:function(e){var t=e.cc[e.cc.length-1];(t==C||t==S)&&e.cc.pop()}}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})})},{"../../lib/codemirror":16}],20:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";var t={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},r={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1};e.defineMode("xml",function(n,i){function o(e,t){function r(r){return t.tokenize=r,r(e,t)}var n=e.next();if("<"==n)return e.eat("!")?e.eat("[")?e.match("CDATA[")?r(s("atom","]]>")):null:e.match("--")?r(s("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),r(c(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=s("meta","?>"),"meta"):(L=e.eat("/")?"closeTag":"openTag",t.tokenize=a,"tag bracket");if("&"==n){var i;return i=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),i?"atom":"error"}return e.eatWhile(/[^&<]/),null}function a(e,t){var r=e.next();if(">"==r||"/"==r&&e.eat(">"))return t.tokenize=o,L=">"==r?"endTag":"selfcloseTag","tag bracket";if("="==r)return L="equals",null;if("<"==r){t.tokenize=o,t.state=f,t.tagName=t.tagStart=null;var n=t.tokenize(e,t);return n?n+" tag error":"tag error"}return/[\'\"]/.test(r)?(t.tokenize=l(r),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function l(e){var t=function(t,r){for(;!t.eol();)if(t.next()==e){r.tokenize=a;break}return"string"};return t.isInAttribute=!0,t}function s(e,t){return function(r,n){for(;!r.eol();){if(r.match(t)){n.tokenize=o;break}r.next()}return e}}function c(e){return function(t,r){for(var n;null!=(n=t.next());){if("<"==n)return r.tokenize=c(e+1),r.tokenize(t,r);if(">"==n){if(1==e){r.tokenize=o;break}return r.tokenize=c(e-1),r.tokenize(t,r)}}return"meta"}}function u(e,t,r){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r,(C.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function d(e){e.context&&(e.context=e.context.prev)}function h(e,t){for(var r;;){if(!e.context)return;if(r=e.context.tagName,!C.contextGrabbers.hasOwnProperty(r)||!C.contextGrabbers[r].hasOwnProperty(t))return;d(e)}}function f(e,t,r){return"openTag"==e?(r.tagStart=t.column(),p):"closeTag"==e?g:f}function p(e,t,r){return"word"==e?(r.tagName=t.current(),M="tag",y):(M="error",p)}function g(e,t,r){if("word"==e){var n=t.current();return r.context&&r.context.tagName!=n&&C.implicitlyClosed.hasOwnProperty(r.context.tagName)&&d(r),r.context&&r.context.tagName==n?(M="tag",m):(M="tag error",v)}return M="error",v}function m(e,t,r){return"endTag"!=e?(M="error",m):(d(r),f)}function v(e,t,r){return M="error",m(e,t,r)}function y(e,t,r){if("word"==e)return M="attribute",b;if("endTag"==e||"selfcloseTag"==e){var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||C.autoSelfClosers.hasOwnProperty(n)?h(r,n):(h(r,n),r.context=new u(r,n,i==r.indented)),f}return M="error",y}function b(e,t,r){return"equals"==e?w:(C.allowMissing||(M="error"),y(e,t,r))}function w(e,t,r){return"string"==e?x:"word"==e&&C.allowUnquoted?(M="string",y):(M="error",y(e,t,r))}function x(e,t,r){return"string"==e?x:y(e,t,r)}var k=n.indentUnit,C={},S=i.htmlMode?t:r;for(var T in S)C[T]=S[T];for(var T in i)C[T]=i[T];var L,M;return o.isInText=!0,{startState:function(e){var t={tokenize:o,state:f,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;L=null;var r=t.tokenize(e,t);return(r||L)&&"comment"!=r&&(M=null,t.state=t.state(L||r,e,t),M&&(r="error"==M?r+" error":M)),r},indent:function(t,r,n){var i=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+k;if(i&&i.noIndent)return e.Pass;if(t.tokenize!=a&&t.tokenize!=o)return n?n.match(/^(\s*)/)[0].length:0;if(t.tagName)return C.multilineTagIndentPastTag!==!1?t.tagStart+t.tagName.length+2:t.tagStart+k*(C.multilineTagIndentFactor||1);if(C.alignCDATA&&/<!\[CDATA\[/.test(r))return 0;var l=r&&/^<(\/)?([\w_:\.-]*)/.exec(r);if(l&&l[1])for(;i;){if(i.tagName==l[2]){i=i.prev;break}if(!C.implicitlyClosed.hasOwnProperty(i.tagName))break;i=i.prev}else if(l)for(;i;){var s=C.contextGrabbers[i.tagName];if(!s||!s.hasOwnProperty(l[2]))break;i=i.prev}for(;i&&i.prev&&!i.startOfLine;)i=i.prev;return i?i.indent+k:t.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:C.htmlMode?"html":"xml",helperType:C.htmlMode?"html":"xml",skipAttribute:function(e){e.state==w&&(e.state=y)}}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})})},{"../../lib/codemirror":16}]},{},[10])}();
9
  //# sourceMappingURL=forms-admin.min.js.map
1
+ !function(){var e=void 0,t=void 0;!function r(t,n,i){function o(l,s){if(!n[l]){if(!t[l]){var c="function"==typeof e&&e;if(!s&&c)return c(l,!0);if(a)return a(l,!0);var u=new Error("Cannot find module '"+l+"'");throw u.code="MODULE_NOT_FOUND",u}var d=n[l]={exports:{}};t[l][0].call(d.exports,function(e){var r=t[l][1][e];return o(r?r:e)},d,d.exports,r,t,n,i)}return n[l].exports}for(var a="function"==typeof e&&e,l=0;l<i.length;l++)o(i[l]);return o}({1:[function(e,t,r){"use strict";var n=function(e,t){var r={};return r.label=function(r){return e("div",[e("label",t.fieldLabel),e("input.widefat",{type:"text",value:r.label(),onchange:e.withAttr("value",r.label),placeholder:r.title()})])},r.value=function(r){return e("div",[e("label",t.value),e("input.widefat",{type:"text",value:r.value(),onchange:e.withAttr("value",r.value)}),e("p.help",t.valueHelp)])},r.numberMinMax=function(r){return e("div",[e("div.row",[e("div.col.col-3",[e("label",t.min),e("input",{type:"number",onchange:e.withAttr("value",r.min)})]),e("div.col.col-3",[e("label",t.max),e("input",{type:"number",onchange:e.withAttr("value",r.max)})])])])},r.isRequired=function(r){var n,i={type:"checkbox",checked:r.required(),onchange:e.withAttr("checked",r.required)};return r.forceRequired()&&(i.required=!0,i.disabled=!0,n=e("p.help",t.forceRequired)),e("div",[e("label.cb-wrap",[e("input",i),t.isFieldRequired]),n])},r.placeholder=function(r){return e("div",[e("label",t.placeholder),e("input.widefat",{type:"text",value:r.placeholder(),onchange:e.withAttr("value",r.placeholder),placeholder:""}),e("p.help",t.placeholderHelp)])},r.useParagraphs=function(r){return e("div",[e("label.cb-wrap",[e("input",{type:"checkbox",checked:r.wrap(),onchange:e.withAttr("checked",r.wrap)}),t.wrapInParagraphTags])])},r.choiceType=function(r){return e("div",[e("label",t.choiceType),e("select",{value:r.type(),onchange:e.withAttr("value",r.type)},[e("option",{value:"select",selected:"select"===r.type()?"selected":!1},t.dropdown),e("option",{value:"radio",selected:"radio"===r.type()?"selected":!1},t.radioButtons),e("option",{value:"checkbox",selected:"checkbox"===r.type()?"selected":!1},t.checkboxes)])])},r.choices=function(r){return e("div",[e("label",t.choices),e("div.limit-height",[e("table",[r.choices().map(function(t,n){return e("tr",{"data-id":n},[e("td.cb",e("input",{name:"selected",type:"checkbox"===r.type()?"checkbox":"radio",onchange:e.withAttr("value",r.selectChoice.bind(r)),checked:t.selected(),value:t.value()})),e("td.stretch",e("input.widefat",{type:"text",value:t.label(),placeholder:t.title(),onchange:e.withAttr("value",t.label)})),e("td",e("span",{"class":"dashicons dashicons-no-alt hover-activated",onclick:function(e){this.choices().splice(e,1)}.bind(r,n)},""))])})])])])},r};t.exports=n},{}],2:[function(e,t,r){var n=function(t,r){var n={},i=e("./field-forms-rows.js")(t,r);return n.render=function(e){var t=e.type();if("function"==typeof n[t])return n[t](e);switch(t){case"select":case"radio":case"checkbox":return n.choice(e)}return n.text(e)},n.text=function(e){return[i.label(e),i.placeholder(e),i.value(e),i.isRequired(e),i.useParagraphs(e)]},n.choice=function(e){return[i.label(e),i.choiceType(e),i.choices(e),i.useParagraphs(e)]},n.hidden=function(e){return e.placeholder(""),e.choices().length>0&&e.value(e.choices().map(function(e){return e.label()}).join(",")),[i.value(e)]},n.submit=function(e){return e.label(""),e.placeholder(""),[i.value(e),i.useParagraphs(e)]},n.number=function(e){return[n.text(e),i.numberMinMax(e)]},n};t.exports=n},{"./field-forms-rows.js":1}],3:[function(e,t,r){var n=function(t){"use strict";function r(e){var r,a,l,s;return r=e.label().length?t("label",e.label()):"",a="function"==typeof o[e.type()]?o[e.type()](e):o["default"](e),l=e.wrap()?t("p",[r,a]):[r,a],s=n(l),s=i(s),s+"\n"}var n=e("../third-party/render.js"),i=e("../third-party/beautify-html.js"),o={};return o.select=function(e){var r=t("select",{name:e.name()},[e.choices().map(function(e){return t("option",{value:e.value()!==e.label()?e.value():void 0,selected:e.selected()},e.label())})]);return r},o.checkbox=function(e){var r=e.choices().map(function(r){return t("label",[t("input",{name:e.name()+("checkbox"===e.type()?"[]":""),type:e.type(),value:r.value(),checked:r.selected()})," ",t("span",r.label())])});return r},o.radio=o.checkbox,o["default"]=function(e){var r,n={type:e.type()};return e.name()&&(n.name=e.name()),e.min()&&(n.min=e.min()),e.max()&&(n.max=e.max()),e.value().length>0&&(n.value=e.value()),e.placeholder().length>0&&(n.placeholder=e.placeholder()),n.required=e.required(),r=t("input",n)},r};t.exports=n},{"../third-party/beautify-html.js":11,"../third-party/render.js":12}],4:[function(e,t,r){var n=function(t,r,n,i,o){"use strict";function a(e){u=i.get(e),t.redraw()}function l(){}function s(){var e=d(u);n.insert(e),a(""),t.redraw()}function c(){var e=i.getAll(),r=t("div.available-fields.small-margin",[t("strong",o.chooseField),e.length?e.map(function(e,r){var n="button";e.forceRequired()&&(n+=" is-required");var i=e.inFormContent();return null!==i&&(n+=" "+(i?"in-form":"not-in-form")),t("button",{"class":n,type:"button",onclick:t.withAttr("value",a),value:r},e.title())}):t("p",o.noAvailableFields)]),n=null;return u&&(n=h(t("div.field-wizard",[t("h3",[u.title(),u.forceRequired()?t("span.red","*"):"",u.name().length?t("code",u.name()):""]),u.help().length?t("p",t.trust(u.help())):"",f.render(u),t("p",[t("button",{"class":"button-primary",type:"button",onkeydown:function(e){e=e||window.event,13==e.keyCode&&s()},onclick:s},o.addToForm)])]),a)),[r,n]}var u,d=e("./field-generator.js")(t),h=e("./overlay.js")(t,o),f=e("./field-forms.js")(t,o);return n.on("blur",t.redraw),{view:c,controller:l}};t.exports=n},{"./field-forms.js":2,"./field-generator.js":3,"./overlay.js":9}],5:[function(e,t,r){var n=function(e,t,r){"use strict";function n(){d.forEach(function(e){t.deregister(e)})}function i(e,r){var n=t.register(e);r||d.push(n)}function o(e){var t={phone:"tel",dropdown:"select",checkboxes:"checkbox",birthday:"text"};return"undefined"!=typeof t[e]?t[e]:e}function a(e){if(!e["public"])return!1;var t={name:e.tag,title:e.name,required:e.required,forceRequired:e.required,type:o(e.field_type),choices:e.choices};return"address"!==t.type?i(t):(i({name:t.name+"[addr1]",type:"text",title:r.streetAddress}),i({name:t.name+"[city]",type:"text",title:r.city}),i({name:t.name+"[state]",type:"text",title:r.state}),i({name:t.name+"[zip]",type:"text",title:r.zip}),i({name:t.name+"[country]",type:"select",title:r.country,choices:mc4wp_vars.countries})),!0}function l(e){var t={title:e.name,name:"GROUPINGS["+e.id+"]",type:o(e.field_type),choices:e.groups};i(t)}function s(e){e.merge_vars.forEach(a),e.groupings.forEach(l)}function c(e){n(),e.forEach(s)}function u(e){var t;i({name:"",value:r.subscribe,type:"submit",title:r.submitButton},!0),t={};for(var n in e)t[e[n].id]=e[n].name;i({name:"_mc4wp_lists",type:"checkbox",title:r.listChoice,choices:t,help:r.listChoiceDescription},!0),t={subscribe:"Subscribe",unsubscribe:"Unsubscribe"},i({name:"_mc4wp_action",type:"radio",title:r.formAction,choices:t,value:"subscribe",help:r.formActionDescription},!0)}var d=[];return{registerCustomFields:u,registerListFields:s,registerListsFields:c}};t.exports=n},{}],6:[function(e,t,r){t.exports=function(e,t){"use strict";function r(e){var t=[];return t="function"==typeof e.map?e.map(function(e){return new c({label:e})}):Object.keys(e).map(function(t){var r=e[t];return new c({label:r,value:t})})}function n(n){var i,o=l("name",n.name).shift();return o?void(!o.required()&&n.required&&o.required(!0)):(n.choices&&(n.choices=r(n.choices),n.value&&(n.choices=n.choices.map(function(e){return e.value()===n.value&&e.selected(!0),e}))),i=new s(n),u.unshift(i),e.redraw(),t.trigger("fields.change"),i)}function i(t){var r=u.indexOf(t);r>-1&&(delete u[r],e.redraw())}function o(e){return u[e]}function a(){return u}function l(e,t){return u.filter(function(r){return r[e]()===t})}var s=function(t){this.name=e.prop(t.name),this.title=e.prop(t.title||t.name),this.type=e.prop(t.type),this.label=e.prop(t.title||""),this.value=e.prop(t.value||""),this.placeholder=e.prop(t.placeholder||""),this.required=e.prop(t.required||!1),this.forceRequired=e.prop(t.forceRequired||!1),this.wrap=e.prop(t.wrap||!0),this.min=e.prop(t.min||null),this.max=e.prop(t.max||null),this.help=e.prop(t.help||""),this.choices=e.prop(t.choices||[]),this.inFormContent=e.prop(null),this.selectChoice=function(e){var t=this;this.choices(this.choices().map(function(r){return r.value()===e?r.selected(!0):"checkbox"!==t.type()&&r.selected(!1),r}))}},c=function(t){this.label=e.prop(t.label),this.title=e.prop(t.title||t.label),this.selected=e.prop(t.selected||!1),this.value=e.prop(t.value||t.label)},u=[];return{fields:u,get:o,getAll:a,deregister:i,register:n,getAllWhere:l}}},{}],7:[function(e,t,r){var n=function(t){function r(){return o&&(i.innerHTML=a.getValue().toLowerCase(),o=!1),i}var n,i=document.createElement("form"),o=!1,a={};i.innerHTML=t.value.toLowerCase();var l=e("codemirror");return e("codemirror/mode/xml/xml"),e("codemirror/mode/javascript/javascript"),e("codemirror/mode/css/css"),e("codemirror/mode/htmlmixed/htmlmixed"),e("codemirror/addon/fold/xml-fold"),e("codemirror/addon/edit/matchtags"),e("codemirror/addon/edit/closetag.js"),l&&(n=l.fromTextArea(t,{selectionPointer:!0,matchTags:{bothTags:!0},mode:"htmlmixed",htmlMode:!0,autoCloseTags:!0,autoRefresh:!0}),window.dispatchEvent&&n.on("change",function(){if("function"==typeof Event){var e=new Event("change",{bubbles:!0});t.dispatchEvent(e)}})),t.addEventListener&&t.addEventListener("change",function(){o=!0}),a.getValue=function(){return n?n.getValue():t.value},a.query=function(e){return r().querySelectorAll(e)},a.containsField=function(e){return null!==r().elements.namedItem(e.toLowerCase())},a.insert=function(e){n?(n.replaceSelection(e),n.focus()):t.value+=e},a.on=function(e,r){return n?("input"===e&&(e="changes"),n.on(e,r)):t.addEventListener(e,r)},a.refresh=function(){n&&n.refresh()},a};t.exports=n},{codemirror:16,"codemirror/addon/edit/closetag.js":13,"codemirror/addon/edit/matchtags":14,"codemirror/addon/fold/xml-fold":15,"codemirror/mode/css/css":17,"codemirror/mode/htmlmixed/htmlmixed":18,"codemirror/mode/javascript/javascript":19,"codemirror/mode/xml/xml":20}],8:[function(e,t,r){var n=function(e,t,r,n,i,o){"use strict";function a(){n.getAll().forEach(function(e){if(!(e.name().length<=0)){var r=t.containsField(e.name());e.inFormContent(r)}}),l(),e.redraw()}function l(){var e=n.getAllWhere("forceRequired",!0).map(function(e){return e.name().toUpperCase()}),r=t.query("[required]");Array.prototype.forEach.call(r,function(t){var r=t.name.toUpperCase();"_"!==r[0]&&-1===e.indexOf(r)&&e.push(r)}),s.value=e.join(",")}var s=document.getElementById("required-fields");t.on("change",o.debounce(a,500)),i.on("fields.change",o.debounce(a,500))};t.exports=n},{}],9:[function(e,t,r){var n=function(e,t){"use strict";function r(){document.removeEventListener("keydown",n),window.removeEventListener("resize",i),a()}function n(e){e=e||window.event,27==e.keyCode&&r(),13==e.keyCode&&e.preventDefault()}function i(){if(o){var e=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,t=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,r=(e-o.clientWidth-40)/2,n=(t-o.clientHeight-40)/2;o.style.left=(r>0?r:0)+"px",o.style.top=(n>0?n:0)+"px"}}var o,a;return function(l,s){return a=s,document.addEventListener("keydown",n),window.addEventListener("resize",i),[e("div.overlay-wrap",e("div.overlay",{config:function(e){o=e,i()}},[e("span",{"class":"close dashicons dashicons-no",title:t.close,onclick:r}),l])),e("div.overlay-background",{title:t.close,onclick:r})]}};t.exports=n},{}],10:[function(e,t,r){"use strict";var n=window.mc4wp_forms_i18n,i=window.mc4wp.deps.mithril,o=mc4wp.events,a=mc4wp.settings,l=mc4wp.helpers,s=mc4wp.tabs,c=e("./admin/form-watcher.js"),u=e("./admin/form-editor.js"),d=e("./admin/field-helper.js"),h=e("./admin/fields-factory.js"),f=e("./admin/fields.js")(i,o),p=document.getElementById("mc4wp-form-content"),g=window.formEditor=new u(p),m=(new c(i,formEditor,a,f,o,l),new d(i,s,formEditor,f,n));i.mount(document.getElementById("mc4wp-field-wizard"),m);var v=new h(a,f,n);v.registerCustomFields(mc4wp_vars.mailchimp.lists),o.on("selectedLists.change",v.registerListsFields),v.registerListsFields(a.getSelectedLists()),window.setTimeout(function(){i.redraw()},2e3),window.mc4wp=window.mc4wp||{},window.mc4wp.forms=window.mc4wp.forms||{},window.mc4wp.forms.editor=g,window.mc4wp.forms.fields=f},{"./admin/field-helper.js":4,"./admin/fields-factory.js":5,"./admin/fields.js":6,"./admin/form-editor.js":7,"./admin/form-watcher.js":8}],11:[function(e,t,r){!function(){function e(e){return e.replace(/^\s+|\s+$/g,"")}function r(e){return e.replace(/^\s+/g,"")}function n(t,n,i,o){function a(){return this.pos=0,this.token="",this.current_mode="CONTENT",this.tags={parent:"parent1",parentcount:1,parent1:""},this.tag_type="",this.token_text=this.last_token=this.last_text=this.token_type="",this.newlines=0,this.indent_content=s,this.Utils={whitespace:"\n\r ".split(""),single_token:"br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed,?php,?,?=".split(","),extra_liners:"head,body,/html".split(","),in_array:function(e,t){for(var r=0;r<t.length;r++)if(e===t[r])return!0;return!1}},this.traverse_whitespace=function(){var e="";if(e=this.input.charAt(this.pos),this.Utils.in_array(e,this.Utils.whitespace)){for(this.newlines=0;this.Utils.in_array(e,this.Utils.whitespace);)p&&"\n"===e&&this.newlines<=g&&(this.newlines+=1),this.pos++,e=this.input.charAt(this.pos);return!0}return!1},this.get_content=function(){for(var e="",t=[],r=!1;"<"!==this.input.charAt(this.pos);){if(this.pos>=this.input.length)return t.length?t.join(""):["","TK_EOF"];if(this.traverse_whitespace())t.length&&(r=!0);else{if(indent_handlebars){var n=this.input.substr(this.pos,3);if("{{#"===n||"{{/"===n)break;if("{{"===this.input.substr(this.pos,2)&&"{{else}}"===this.get_tag(!0))break}e=this.input.charAt(this.pos),this.pos++,r&&(this.line_char_count>=this.wrap_line_length?(this.print_newline(!1,t),this.print_indentation(t)):(this.line_char_count++,t.push(" ")),r=!1),this.line_char_count++,t.push(e)}}return t.length?t.join(""):""},this.get_contents_to=function(e){if(this.pos===this.input.length)return["","TK_EOF"];var t="",r=new RegExp("</"+e+"\\s*>","igm");r.lastIndex=this.pos;var n=r.exec(this.input),i=n?n.index:this.input.length;return this.pos<i&&(t=this.input.substring(this.pos,i),this.pos=i),t},this.record_tag=function(e){this.tags[e+"count"]?(this.tags[e+"count"]++,this.tags[e+this.tags[e+"count"]]=this.indent_level):(this.tags[e+"count"]=1,this.tags[e+this.tags[e+"count"]]=this.indent_level),this.tags[e+this.tags[e+"count"]+"parent"]=this.tags.parent,this.tags.parent=e+this.tags[e+"count"]},this.retrieve_tag=function(e){if(this.tags[e+"count"]){for(var t=this.tags.parent;t&&e+this.tags[e+"count"]!==t;)t=this.tags[t+"parent"];t&&(this.indent_level=this.tags[e+this.tags[e+"count"]],this.tags.parent=this.tags[t+"parent"]),delete this.tags[e+this.tags[e+"count"]+"parent"],delete this.tags[e+this.tags[e+"count"]],1===this.tags[e+"count"]?delete this.tags[e+"count"]:this.tags[e+"count"]--}},this.indent_to_tag=function(e){if(this.tags[e+"count"]){for(var t=this.tags.parent;t&&e+this.tags[e+"count"]!==t;)t=this.tags[t+"parent"];t&&(this.indent_level=this.tags[e+this.tags[e+"count"]])}},this.get_tag=function(e){var t,r,n,i="",o=[],a="",l=!1,s=this.pos,c=this.line_char_count;e=void 0!==e?e:!1;do{if(this.pos>=this.input.length)return e&&(this.pos=s,this.line_char_count=c),o.length?o.join(""):["","TK_EOF"];if(i=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(i,this.Utils.whitespace))l=!0;else{if("'"!==i&&'"'!==i||(i+=this.get_unformatted(i),l=!0),"="===i&&(l=!1),o.length&&"="!==o[o.length-1]&&">"!==i&&l&&(this.line_char_count>=this.wrap_line_length?(this.print_newline(!1,o),this.print_indentation(o)):(o.push(" "),this.line_char_count++),l=!1),indent_handlebars&&"<"===n&&i+this.input.charAt(this.pos)==="{{"&&(i+=this.get_unformatted("}}"),o.length&&" "!==o[o.length-1]&&"<"!==o[o.length-1]&&(i=" "+i),l=!0),"<"!==i||n||(t=this.pos-1,n="<"),indent_handlebars&&!n&&o.length>=2&&"{"===o[o.length-1]&&"{"==o[o.length-2]&&(t="#"===i||"/"===i?this.pos-3:this.pos-2,n="{"),this.line_char_count++,o.push(i),o[1]&&"!"===o[1]){o=[this.get_comment(t)];break}if(indent_handlebars&&"{"===n&&o.length>2&&"}"===o[o.length-2]&&"}"===o[o.length-1])break}}while(">"!==i);var u,d,h=o.join("");u=-1!==h.indexOf(" ")?h.indexOf(" "):"{"===h[0]?h.indexOf("}"):h.indexOf(">"),d="<"!==h[0]&&indent_handlebars?"#"===h[2]?3:2:1;var p=h.substring(d,u).toLowerCase();return"/"===h.charAt(h.length-2)||this.Utils.in_array(p,this.Utils.single_token)?e||(this.tag_type="SINGLE"):indent_handlebars&&"{"===h[0]&&"else"===p?e||(this.indent_to_tag("if"),this.tag_type="HANDLEBARS_ELSE",this.indent_content=!0,this.traverse_whitespace()):"script"===p?e||(this.record_tag(p),this.tag_type="SCRIPT"):"style"===p?e||(this.record_tag(p),this.tag_type="STYLE"):this.is_unformatted(p,f)?(a=this.get_unformatted("</"+p+">",h),o.push(a),t>0&&this.Utils.in_array(this.input.charAt(t-1),this.Utils.whitespace)&&o.splice(0,0,this.input.charAt(t-1)),r=this.pos-1,this.Utils.in_array(this.input.charAt(r+1),this.Utils.whitespace)&&o.push(this.input.charAt(r+1)),this.tag_type="SINGLE"):"!"===p.charAt(0)?e||(this.tag_type="SINGLE",this.traverse_whitespace()):e||("/"===p.charAt(0)?(this.retrieve_tag(p.substring(1)),this.tag_type="END",this.traverse_whitespace()):(this.record_tag(p),"html"!==p.toLowerCase()&&(this.indent_content=!0),this.tag_type="START",this.traverse_whitespace()),this.Utils.in_array(p,this.Utils.extra_liners)&&(this.print_newline(!1,this.output),this.output.length&&"\n"!==this.output[this.output.length-2]&&this.print_newline(!0,this.output))),e&&(this.pos=s,this.line_char_count=c),o.join("")},this.get_comment=function(e){var t="",r=">",n=!1;for(this.pos=e,input_char=this.input.charAt(this.pos),this.pos++;this.pos<=this.input.length&&(t+=input_char,t[t.length-1]!==r[r.length-1]||-1===t.indexOf(r));)!n&&t.length<10&&(0===t.indexOf("<![if")?(r="<![endif]>",n=!0):0===t.indexOf("<![cdata[")?(r="]]>",n=!0):0===t.indexOf("<![")?(r="]>",n=!0):0===t.indexOf("<!--")&&(r="-->",n=!0)),input_char=this.input.charAt(this.pos),this.pos++;return t},this.get_unformatted=function(e,t){if(t&&-1!==t.toLowerCase().indexOf(e))return"";var r="",n="",i=0,o=!0;do{if(this.pos>=this.input.length)return n;if(r=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(r,this.Utils.whitespace)){if(!o){this.line_char_count--;continue}if("\n"===r||"\r"===r){n+="\n",this.line_char_count=0;continue}}n+=r,this.line_char_count++,o=!0,indent_handlebars&&"{"===r&&n.length&&"{"===n[n.length-2]&&(n+=this.get_unformatted("}}"),i=n.length)}while(-1===n.toLowerCase().indexOf(e,i));return n},this.get_token=function(){var e;if("TK_TAG_SCRIPT"===this.last_token||"TK_TAG_STYLE"===this.last_token){var t=this.last_token.substr(7);return e=this.get_contents_to(t),"string"!=typeof e?e:[e,"TK_"+t]}if("CONTENT"===this.current_mode)return e=this.get_content(),"string"!=typeof e?e:[e,"TK_CONTENT"];if("TAG"===this.current_mode){if(e=this.get_tag(),"string"!=typeof e)return e;var r="TK_TAG_"+this.tag_type;return[e,r]}},this.get_full_indent=function(e){return e=this.indent_level+e||0,1>e?"":Array(e+1).join(this.indent_string)},this.is_unformatted=function(e,t){if(!this.Utils.in_array(e,t))return!1;if("a"!==e.toLowerCase()||!this.Utils.in_array("a",t))return!0;var r=this.get_tag(!0),n=(r||"").match(/^\s*<\s*\/?([a-z]*)\s*[^>]*>\s*$/);return!(n&&!this.Utils.in_array(n,t))},this.printer=function(e,t,n,i,o){this.input=e||"",this.output=[],this.indent_character=t,this.indent_string="",this.indent_size=n,this.brace_style=o,this.indent_level=0,this.wrap_line_length=i,this.line_char_count=0;for(var a=0;a<this.indent_size;a++)this.indent_string+=this.indent_character;this.print_newline=function(e,t){this.line_char_count=0,t&&t.length&&(e||"\n"!==t[t.length-1])&&t.push("\n")},this.print_indentation=function(e){for(var t=0;t<this.indent_level;t++)e.push(this.indent_string),this.line_char_count+=this.indent_string.length},this.print_token=function(e){(e||""!==e)&&this.output.length&&"\n"===this.output[this.output.length-1]&&(this.print_indentation(this.output),e=r(e)),this.print_token_raw(e)},this.print_token_raw=function(e){e&&""!==e&&(e.length>1&&"\n"===e[e.length-1]?(this.output.push(e.slice(0,-1)),this.print_newline(!1,this.output)):this.output.push(e));for(var t=0;t<this.newlines;t++)this.print_newline(t>0,this.output);this.newlines=0},this.indent=function(){this.indent_level++},this.unindent=function(){this.indent_level>0&&this.indent_level--}},this}var l,s,c,u,d,h,f,p,g;for(n=n||{},void 0!==n.wrap_line_length&&0!==parseInt(n.wrap_line_length,10)||void 0!==n.max_char&&0!==parseInt(n.max_char,10)||(n.wrap_line_length=n.max_char),s=n.indent_inner_html||!1,c=parseInt(n.indent_size||4,10),u=n.indent_char||" ",h=n.brace_style||"collapse",d=0===parseInt(n.wrap_line_length,10)?32786:parseInt(n.wrap_line_length||250,10),f=n.unformatted||["a","span","bdo","em","strong","dfn","code","samp","kbd","var","cite","abbr","acronym","q","sub","sup","tt","i","b","big","small","u","s","strike","font","ins","del","pre","address","dt","h1","h2","h3","h4","h5","h6"],p=n.preserve_newlines||!0,g=p?parseInt(n.max_preserve_newlines||32786,10):0,indent_handlebars=n.indent_handlebars||!1,l=new a,l.printer(t,u,c,d,h);;){var m=l.get_token();if(l.token_text=m[0],l.token_type=m[1],"TK_EOF"===l.token_type)break;switch(l.token_type){case"TK_TAG_START":l.print_newline(!1,l.output),l.print_token(l.token_text),l.indent_content&&(l.indent(),l.indent_content=!1),l.current_mode="CONTENT";break;case"TK_TAG_STYLE":case"TK_TAG_SCRIPT":l.print_newline(!1,l.output),l.print_token(l.token_text),l.current_mode="CONTENT";break;case"TK_TAG_END":if("TK_CONTENT"===l.last_token&&""===l.last_text){var v=l.token_text.match(/\w+/)[0],y=null;l.output.length&&(y=l.output[l.output.length-1].match(/(?:<|{{#)\s*(\w+)/)),null!==y&&y[1]===v||l.print_newline(!1,l.output)}l.print_token(l.token_text),l.current_mode="CONTENT";break;case"TK_TAG_SINGLE":var b=l.token_text.match(/^\s*<([a-z]+)/i);b&&l.Utils.in_array(b[1],f)||l.print_newline(!1,l.output),l.print_token(l.token_text),l.current_mode="CONTENT";break;case"TK_TAG_HANDLEBARS_ELSE":l.print_token(l.token_text),l.indent_content&&(l.indent(),l.indent_content=!1),l.current_mode="CONTENT";break;case"TK_CONTENT":l.print_token(l.token_text),l.current_mode="TAG";break;case"TK_STYLE":case"TK_SCRIPT":if(""!==l.token_text){l.print_newline(!1,l.output);var w,x=l.token_text,k=1;"TK_SCRIPT"===l.token_type?w="function"==typeof i&&i:"TK_STYLE"===l.token_type&&(w="function"==typeof o&&o),"keep"===n.indent_scripts?k=0:"separate"===n.indent_scripts&&(k=-l.indent_level);var C=l.get_full_indent(k);if(w)x=w(x.replace(/^\s*/,C),n);else{var S=x.match(/^\s*/)[0],T=S.match(/[^\n\r]*$/)[0].split(l.indent_string).length-1,L=l.get_full_indent(k-T);x=x.replace(/^\s*/,C).replace(/\r\n|\r|\n/g,"\n"+L).replace(/\s+$/,"")}x&&(l.print_token_raw(C+e(x)),l.print_newline(!1,l.output))}l.current_mode="TAG"}l.last_token=l.token_type,l.last_text=l.token_text}return l.output.join("")}"undefined"!=typeof t&&"undefined"!=typeof t.exports?t.exports=n:"undefined"!=typeof window&&(window.html_beautify=n)}()},{}],12:[function(e,t,r){"use strict";function n(e){return"[object Array]"===Object.prototype.toString.call(e)}function i(e){return e.replace(/\W+/g,"-").replace(/([a-z\d])([A-Z])/g,"$1-$2")}function o(e){return""!=e}function a(e,t){return"undefined"===e&&(e=""),"string"!=typeof e&&(e+=""),e=e.replace(/\&/g,"&amp;").replace(/</g,"&lt;").replace(/\>/g,"&gt;"),t?e.replace(/\"/g,"&quot;"):e}function l(e){return e&&Object.keys(e).length?Object.keys(e).map(function(t){var r=e[t];if("undefined"!=typeof r&&null!==r&&"function"!=typeof r){if("boolean"==typeof r)return r?" "+t:"";if("style"===t){if(!r)return;var n=e.style;return"object"==typeof n&&(n=Object.keys(n).map(function(e){return""!=n[e]?[i(e).toLowerCase(),n[e]].join(":"):""}).filter(o).join(";")),""!=n?' style="'+a(n,!0)+'"':""}return" "+a("className"===t?"class":t)+'="'+a(r,!0)+'"'}}).join(""):""}function s(e){return n(e.children)&&!e.children.length?"":c(e.children)}function c(e){var t=typeof e;if("string"===t)return a(e);if("number"===t||"boolean"===t)return e;if(!e)return"";if(n(e))return e.map(c).join("");if(e.view){var r=e.controller?new e.controller:{},i=c(e.view(r));return r.onunload&&r.onunload(),i}if(e.$trusted)return""+e;var o=s(e);return!o&&u.indexOf(e.tag.toLowerCase())>=0?"<"+e.tag+l(e.attrs)+">":["<",e.tag,l(e.attrs),">",o,"</",e.tag,">"].join("")}var u=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr","!doctype"];t.exports=c},{}],13:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror"),e("../fold/xml-fold")):"function"==typeof t&&t.amd?t(["../../lib/codemirror","../fold/xml-fold"],i):i(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var r=t.listSelections(),n=[],s=0;s<r.length;s++){if(!r[s].empty())return e.Pass;var c=r[s].head,u=t.getTokenAt(c),d=e.innerMode(t.getMode(),u.state),h=d.state;if("xml"!=d.mode.name||!h.tagName)return e.Pass;var f=t.getOption("autoCloseTags"),p="html"==d.mode.configuration,g="object"==typeof f&&f.dontCloseTags||p&&a,m="object"==typeof f&&f.indentTags||p&&l,v=h.tagName;u.end>c.ch&&(v=v.slice(0,v.length-u.end+c.ch));var y=v.toLowerCase();if(!v||"string"==u.type&&(u.end!=c.ch||!/[\"\']/.test(u.string.charAt(u.string.length-1))||1==u.string.length)||"tag"==u.type&&"closeTag"==h.type||u.string.indexOf("/")==u.string.length-1||g&&i(g,y)>-1||o(t,v,c,h,!0))return e.Pass;var b=m&&i(m,y)>-1;n[s]={indent:b,text:">"+(b?"\n\n":"")+"</"+v+">",newPos:b?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var s=r.length-1;s>=0;s--){var w=n[s];t.replaceRange(w.text,r[s].head,r[s].anchor,"+insert");var x=t.listSelections().slice(0);x[s]={head:w.newPos,anchor:w.newPos},t.setSelections(x),w.indent&&(t.indentLine(w.newPos.line,null,!0),t.indentLine(w.newPos.line+1,null,!0))}}function r(t,r){for(var n=t.listSelections(),i=[],a=r?"/":"</",l=0;l<n.length;l++){if(!n[l].empty())return e.Pass;var s=n[l].head,c=t.getTokenAt(s),u=e.innerMode(t.getMode(),c.state),d=u.state;if(r&&("string"==c.type||"<"!=c.string.charAt(0)||c.start!=s.ch-1))return e.Pass;var h;if("xml"!=u.mode.name)if("htmlmixed"==t.getMode().name&&"javascript"==u.mode.name)h=a+"script";else{if("htmlmixed"!=t.getMode().name||"css"!=u.mode.name)return e.Pass;h=a+"style"}else{if(!d.context||!d.context.tagName||o(t,d.context.tagName,s,d))return e.Pass;h=a+d.context.tagName}">"!=t.getLine(s.line).charAt(c.end)&&(h+=">"),i[l]=h}t.replaceSelections(i),n=t.listSelections();for(var l=0;l<n.length;l++)(l==n.length-1||n[l].head.line<n[l+1].head.line)&&t.indentLine(n[l].head.line)}function n(t){return t.getOption("disableInput")?e.Pass:r(t,!0)}function i(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;n>r;++r)if(e[r]==t)return r;return-1}function o(t,r,n,i,o){if(!e.scanForClosingTag)return!1;var a=Math.min(t.lastLine()+1,n.line+500),l=e.scanForClosingTag(t,n,null,a);if(!l||l.tag!=r)return!1;for(var s=i.context,c=o?1:0;s&&s.tagName==r;s=s.prev)++c;n=l.to;for(var u=1;c>u;u++){var d=e.scanForClosingTag(t,n,null,a);if(!d||d.tag!=r)return!1;n=d.to}return!0}e.defineOption("autoCloseTags",!1,function(r,i,o){if(o!=e.Init&&o&&r.removeKeyMap("autoCloseTags"),i){var a={name:"autoCloseTags"};("object"!=typeof i||i.whenClosing)&&(a["'/'"]=function(e){return n(e)}),("object"!=typeof i||i.whenOpening)&&(a["'>'"]=function(e){return t(e)}),r.addKeyMap(a)}});var a=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],l=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];e.commands.closeTag=function(e){return r(e)}})},{"../../lib/codemirror":16,"../fold/xml-fold":15}],14:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror"),e("../fold/xml-fold")):"function"==typeof t&&t.amd?t(["../../lib/codemirror","../fold/xml-fold"],i):i(CodeMirror)}(function(e){"use strict";function t(e){e.state.tagHit&&e.state.tagHit.clear(),e.state.tagOther&&e.state.tagOther.clear(),e.state.tagHit=e.state.tagOther=null}function r(r){r.state.failedTagMatch=!1,r.operation(function(){if(t(r),!r.somethingSelected()){var n=r.getCursor(),i=r.getViewport();i.from=Math.min(i.from,n.line),i.to=Math.max(n.line+1,i.to);var o=e.findMatchingTag(r,n,i);if(o){if(r.state.matchBothTags){var a="open"==o.at?o.open:o.close;a&&(r.state.tagHit=r.markText(a.from,a.to,{className:"CodeMirror-matchingtag"}))}var l="close"==o.at?o.open:o.close;l?r.state.tagOther=r.markText(l.from,l.to,{className:"CodeMirror-matchingtag"}):r.state.failedTagMatch=!0}}})}function n(e){e.state.failedTagMatch&&r(e)}e.defineOption("matchTags",!1,function(i,o,a){a&&a!=e.Init&&(i.off("cursorActivity",r),i.off("viewportChange",n),t(i)),o&&(i.state.matchBothTags="object"==typeof o&&o.bothTags,i.on("cursorActivity",r),i.on("viewportChange",n),r(i))}),e.commands.toMatchingTag=function(t){var r=e.findMatchingTag(t,t.getCursor());if(r){var n="close"==r.at?r.open:r.close;n&&t.extendSelection(n.to,n.from)}}})},{"../../lib/codemirror":16,"../fold/xml-fold":15}],15:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";function t(e,t){return e.line-t.line||e.ch-t.ch}function r(e,t,r,n){this.line=t,this.ch=r,this.cm=e,this.text=e.getLine(t),this.min=n?n.from:e.firstLine(),this.max=n?n.to-1:e.lastLine()}function n(e,t){var r=e.cm.getTokenTypeAt(h(e.line,t));return r&&/\btag\b/.test(r)}function i(e){return e.line>=e.max?void 0:(e.ch=0,e.text=e.cm.getLine(++e.line),!0)}function o(e){return e.line<=e.min?void 0:(e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0)}function a(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(i(e))continue;return}{if(n(e,t+1)){var r=e.text.lastIndexOf("/",t),o=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,o?"selfClose":"regular"}e.ch=t+1}}}function l(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(o(e))continue;return}if(n(e,t+1)){g.lastIndex=t,e.ch=t;var r=g.exec(e.text);if(r&&r.index==t)return r}else e.ch=t}}function s(e){for(;;){g.lastIndex=e.ch;var t=g.exec(e.text);if(!t){if(i(e))continue;return}{if(n(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}}function c(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(o(e))continue;return}{if(n(e,t+1)){var r=e.text.lastIndexOf("/",t),i=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,i?"selfClose":"regular"}e.ch=t}}}function u(e,t){for(var r=[];;){var n,i=s(e),o=e.line,l=e.ch-(i?i[0].length:0);if(!i||!(n=a(e)))return;if("selfClose"!=n)if(i[1]){for(var c=r.length-1;c>=0;--c)if(r[c]==i[2]){r.length=c;break}if(0>c&&(!t||t==i[2]))return{tag:i[2],from:h(o,l),to:h(e.line,e.ch)}}else r.push(i[2])}}function d(e,t){for(var r=[];;){var n=c(e);if(!n)return;if("selfClose"!=n){var i=e.line,o=e.ch,a=l(e);if(!a)return;if(a[1])r.push(a[2]);else{for(var s=r.length-1;s>=0;--s)if(r[s]==a[2]){r.length=s;break}if(0>s&&(!t||t==a[2]))return{tag:a[2],from:h(e.line,e.ch),to:h(i,o)}}}else l(e)}}var h=e.Pos,f="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",p=f+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",g=new RegExp("<(/?)(["+f+"]["+p+"]*)","g");
2
+ e.registerHelper("fold","xml",function(e,t){for(var n=new r(e,t.line,0);;){var i,o=s(n);if(!o||n.line!=t.line||!(i=a(n)))return;if(!o[1]&&"selfClose"!=i){var t=h(n.line,n.ch),l=u(n,o[2]);return l&&{from:t,to:l.from}}}}),e.findMatchingTag=function(e,n,i){var o=new r(e,n.line,n.ch,i);if(-1!=o.text.indexOf(">")||-1!=o.text.indexOf("<")){var s=a(o),c=s&&h(o.line,o.ch),f=s&&l(o);if(s&&f&&!(t(o,n)>0)){var p={from:h(o.line,o.ch),to:c,tag:f[2]};return"selfClose"==s?{open:p,close:null,at:"open"}:f[1]?{open:d(o,f[2]),close:p,at:"close"}:(o=new r(e,c.line,c.ch,i),{open:p,close:u(o,f[2]),at:"open"})}}},e.findEnclosingTag=function(e,t,n){for(var i=new r(e,t.line,t.ch,n);;){var o=d(i);if(!o)break;var a=new r(e,t.line,t.ch,n),l=u(a,o.tag);if(l)return{open:o,close:l}}},e.scanForClosingTag=function(e,t,n,i){var o=new r(e,t.line,t.ch,i?{from:0,to:i}:null);return u(o,n)}})},{"../../lib/codemirror":16}],16:[function(e,r,n){!function(e){if("object"==typeof n&&"object"==typeof r)r.exports=e();else{if("function"==typeof t&&t.amd)return t([],e);(this||window).CodeMirror=e()}}(function(){"use strict";function e(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n?Hi(n):{},Hi(Jo,n,!1),f(n);var i=n.value;"string"==typeof i&&(i=new Ca(i,n.mode,null,n.lineSeparator)),this.doc=i;var o=new e.inputStyles[n.inputStyle](this),a=this.display=new t(r,i,o);a.wrapper.CodeMirror=this,c(this),l(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),n.autofocus&&!Ao&&a.input.focus(),v(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Ni,keySeq:null,specialChars:null};var s=this;bo&&11>wo&&setTimeout(function(){s.display.input.reset(!0)},20),Bt(this),Yi(),wt(this),this.curOp.forceUpdate=!0,Xn(this,i),n.autofocus&&!Ao||s.hasFocus()?setTimeout(Ii(mr,this),20):vr(this);for(var u in ea)ea.hasOwnProperty(u)&&ea[u](this,n[u],ta);k(this),n.finishInit&&n.finishInit(this);for(var d=0;d<oa.length;++d)oa[d](this);kt(this),xo&&n.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function t(e,t,r){var n=this;this.input=r,n.scrollbarFiller=Bi("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=Bi("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=Bi("div",null,"CodeMirror-code"),n.selectionDiv=Bi("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=Bi("div",null,"CodeMirror-cursors"),n.measure=Bi("div",null,"CodeMirror-measure"),n.lineMeasure=Bi("div",null,"CodeMirror-measure"),n.lineSpace=Bi("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none"),n.mover=Bi("div",[Bi("div",[n.lineSpace],"CodeMirror-lines")],null,"position: relative"),n.sizer=Bi("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=Bi("div",null,null,"position: absolute; height: "+Ea+"px; width: 1px;"),n.gutters=Bi("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=Bi("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=Bi("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),bo&&8>wo&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),xo||mo&&Ao||(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,Fe(e,100),e.state.modeGen++,e.curOp&&Pt(e)}function i(e){e.options.lineWrapping?(Za(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Xa(e.display.wrapper,"CodeMirror-wrap"),h(e)),a(e),Pt(e),lt(e),setTimeout(function(){y(e)},100)}function o(e){var t=yt(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/bt(e.display)-3);return function(i){if(kn(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function a(e){var t=e.doc,r=o(e);t.iter(function(e){var t=r(e);t!=e.height&&ei(e,t)})}function l(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),lt(e)}function s(e){c(e),Pt(e),setTimeout(function(){x(e)},20)}function c(e){var t=e.display.gutters,r=e.options.gutters;Ki(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(Bi("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",u(e)}function u(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function d(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=gn(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=mn(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=Zn(r,r.first),t.maxLineLength=d(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=d(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function f(e){var t=zi(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+Ue(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+qe(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function g(e,t,r){this.cm=r;var n=this.vert=Bi("div",[Bi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=Bi("div",[Bi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),Aa(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Aa(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,bo&&8>wo&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function m(){}function v(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Xa(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),Aa(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,r){"horizontal"==r?ir(t,e):nr(t,e)},t),t.display.scrollbars.addClass&&Za(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",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}function w(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Ke(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=ri(t,n),a=ri(t,i);if(r&&r.ensure){var l=r.ensure.from.line,s=r.ensure.to.line;o>l?(o=l,a=ri(t,ni(Zn(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=ri(t,ni(Zn(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function x(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=S(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a<r.length;a++)if(!r[a].hidden){e.options.fixedGutter&&r[a].gutter&&(r[a].gutter.style.left=o);var l=r[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function k(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=C(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(Bi("div",[Bi("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-a)+1,n.lineNumWidth=n.lineNumInnerWidth+a,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",u(e),!0}return!1}function C(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function S(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function T(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=Ve(e),this.force=r,this.dims=z(e),this.events=[]}function L(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=qe(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=qe(e)+"px",t.scrollbarsClipped=!0)}function M(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return Ht(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==Rt(e))return!1;k(e)&&(Ht(e),t.dims=z(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>a&&r.viewTo-a<20&&(a=Math.min(i,r.viewTo)),Do&&(o=wn(e.doc,o),a=xn(e.doc,a));var l=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;jt(e,o,a),r.viewOffset=ni(Zn(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var s=Rt(e);if(!l&&0==s&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=Gi();return s>4&&(r.lineDiv.style.display="none"),E(e,r.updateLineNumbers,t.dims),s>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,c&&Gi()!=c&&c.offsetHeight&&c.focus(),Ki(r.cursorDiv),Ki(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,l&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Fe(e,400)),r.updateLineNumbers=null,!0}function _(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Ve(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Ue(e.display)-$e(e),r.top)}),t.visible=w(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&M(e,t);n=!1){O(e);var i=p(e);Ee(e),N(e,i),y(e,i)}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 T(e,t);if(M(e,r)){O(e),_(e,r);var n=p(e);Ee(e),N(e,n),y(e,n),r.finish()}}function N(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=Math.max(t.docHeight+e.display.barHeight+qe(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(bo&&8>wo){var a=o.node.offsetTop+o.node.offsetHeight;i=a-r,r=a}else{var l=o.node.getBoundingClientRect();i=l.bottom-l.top}var s=o.line.height-i;if(2>i&&(i=yt(t)),(s>.001||-.001>s)&&(ei(o.line,i),W(o.line),o.rest))for(var c=0;c<o.rest.length;c++)W(o.rest[c])}}}function W(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.parentNode.offsetHeight}function z(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a)r[e.options.gutters[a]]=o.offsetLeft+o.clientLeft+i,n[e.options.gutters[a]]=o.clientWidth;return{fixedPos:S(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function E(e,t,r){function n(t){var r=t.nextSibling;return xo&&No&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var i=e.display,o=e.options.lineNumbers,a=i.lineDiv,l=a.firstChild,s=i.view,c=i.viewFrom,u=0;u<s.length;u++){var d=s[u];if(d.hidden);else if(d.node&&d.node.parentNode==a){for(;l!=d.node;)l=n(l);var h=o&&null!=t&&c>=t&&d.lineNumber;d.changes&&(zi(d.changes,"gutter")>-1&&(h=!1),P(e,d,c,r)),h&&(Ki(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(C(e.options,c)))),l=d.node.nextSibling}else{var f=K(e,d,c,r);a.insertBefore(f,l)}c+=d.size}for(;l;)l=n(l)}function P(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?F(e,t):"gutter"==o?R(e,t,r,n):"class"==o?j(t):"widget"==o&&B(e,t,n)}t.changes=null}function D(e){return e.node==e.text&&(e.node=Bi("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),bo&&8>wo&&(e.node.style.zIndex=2)),e.node}function H(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=D(e);e.background=r.insertBefore(Bi("div",null,t),r.firstChild)}}function I(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):In(e,t)}function F(e,t){var r=t.text.className,n=I(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,j(t)):r&&(t.text.className=r)}function j(e){H(e),e.line.wrapClass?D(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 R(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=D(t);t.gutterBackground=Bi("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var i=D(t),a=t.gutter=Bi("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),i.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(Bi("div",C(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var l=0;l<e.options.gutters.length;++l){var s=e.options.gutters[l],c=o.hasOwnProperty(s)&&o[s];c&&a.appendChild(Bi("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[s]+"px; width: "+n.gutterWidth[s]+"px"))}}}function B(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)}U(e,t,r)}function K(e,t,r,n){var i=I(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),j(t),R(e,t,r,n),U(e,t,n),t.node}function U(e,t,r){if(G(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)G(e,t.rest[n],t,r,!1)}function G(e,t,r,n,i){if(t.widgets)for(var o=D(r),a=0,l=t.widgets;a<l.length;++a){var s=l[a],c=Bi("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),q(s,c,r,n),e.display.input.setUneditable(c),i&&s.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),Si(s,"redraw")}}function q(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 V(e){return Ho(e.line,e.ch)}function $(e,t){return Io(e,t)<0?t:e}function Y(e,t){return Io(e,t)<0?e:t}function X(e){e.state.focused||(e.display.input.focus(),mr(e))}function Z(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var a=e.state.pasteIncoming||"paste"==i,l=o.splitLines(t),s=null;if(a&&n.ranges.length>1)if(Fo&&Fo.join("\n")==t){if(n.ranges.length%Fo.length==0){s=[];for(var c=0;c<Fo.length;c++)s.push(o.splitLines(Fo[c]))}}else l.length==n.ranges.length&&(s=Ei(l,function(e){return[e]}));for(var c=n.ranges.length-1;c>=0;c--){var u=n.ranges[c],d=u.from(),h=u.to();u.empty()&&(r&&r>0?d=Ho(d.line,d.ch-r):e.state.overwrite&&!a&&(h=Ho(h.line,Math.min(Zn(o,h.line).text.length,h.ch+Wi(l).length))));var f=e.curOp.updateInput,p={from:d,to:h,text:s?s[c%s.length]:l,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};Tr(e.doc,p),Si(e,"inputRead",e,p)}t&&!a&&J(e,t),Hr(e),e.curOp.updateInput=f,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Q(e,t){var r=e.clipboardData&&e.clipboardData.getData("text/plain");return r?(e.preventDefault(),t.isReadOnly()||t.options.disableInput||At(t,function(){Z(t,r,0,null,"paste")}),!0):void 0}function J(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(t.indexOf(o.electricChars.charAt(l))>-1){a=Fr(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Zn(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Fr(e,i.head.line,"smart"));a&&Si(e,"electricInput",e,i.head.line)}}}function ee(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:Ho(i,0),head:Ho(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function te(e){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false")}function re(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Ni,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null}function ne(){var e=Bi("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none"),t=Bi("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return xo?e.style.width="1000px":e.setAttribute("wrap","off"),_o&&(e.style.border="1px solid black"),te(e),t}function ie(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Ni,this.gracePeriod=!1}function oe(e,t){var r=Je(e,t.line);if(!r||r.hidden)return null;var n=Zn(e.doc,t.line),i=Xe(r,n,t.line),o=ii(n),a="left";if(o){var l=co(o,t.ch);a=l%2?"right":"left"}var s=rt(i.map,t.ch,a);return s.offset="right"==s.collapse?s.end:s.start,s}function ae(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 ae(e.clipPos(Ho(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<(u?u.length:0);i++)for(var o=0>i?c.map:u[i],a=0;a<o.length;a+=3){var l=o[a+2];if(l==t||l==r){var s=ti(0>i?e.line:e.rest[i]),d=o[a]+n;return(0>n||l!=t)&&(d=o[a+(n?1:0)]),Ho(s,d)}}}var i=e.text.firstChild,o=!1;if(!t||!Va(i,t))return ae(Ho(ti(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[r],r=0,!t)){var a=e.rest?Wi(e.rest):e.line;return ae(Ho(ti(a),a.text.length),o)}var l=3==t.nodeType?t:null,s=t;for(l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,r&&(r=l.nodeValue.length));s.parentNode!=i;)s=s.parentNode;var c=e.measure,u=c.maps,d=n(l,s,r);if(d)return ae(d,o);for(var h=s.nextSibling,f=l?l.nodeValue.length-r:0;h;h=h.nextSibling){if(d=n(h,h.firstChild,0))return ae(Ho(d.line,d.ch-f),o);f+=h.textContent.length}for(var p=s.previousSibling,f=r;p;p=p.previousSibling){if(d=n(p,p.firstChild,-1))return ae(Ho(d.line,d.ch+f),o);f+=h.textContent.length}}function ce(e,t,r,n,i){function o(e){return function(t){return t.id==e}}function a(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return""==r&&(r=t.textContent.replace(/\u200b/g,"")),void(l+=r);var u,d=t.getAttribute("cm-marker");if(d){var h=e.findMarks(Ho(n,0),Ho(i+1,0),o(+d));return void(h.length&&(u=h[0].find())&&(l+=Qn(e.doc,u.from,u.to).join(c)))}if("false"==t.getAttribute("contenteditable"))return;for(var f=0;f<t.childNodes.length;f++)a(t.childNodes[f]);/^(pre|div|p)$/i.test(t.nodeName)&&(s=!0)}else if(3==t.nodeType){var p=t.nodeValue;if(!p)return;s&&(l+=c,s=!1),l+=p}}for(var l="",s=!1,c=e.doc.lineSeparator();a(t),t!=r;)t=t.nextSibling;return l}function ue(e,t){this.ranges=e,this.primIndex=t}function de(e,t){this.anchor=e,this.head=t}function he(e,t){var r=e[t];e.sort(function(e,t){return Io(e.from(),t.from())}),t=zi(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(Io(o.to(),i.from())>=0){var a=Y(o.from(),i.from()),l=$(o.to(),i.to()),s=o.empty()?i.from()==i.head:o.from()==o.head;t>=n&&--t,e.splice(--n,2,new de(s?l:a,s?a:l))}}return new ue(e,t)}function fe(e,t){return new ue([new de(e,t||e)],0)}function pe(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ge(e,t){if(t.line<e.first)return Ho(e.first,0);var r=e.first+e.size-1;return t.line>r?Ho(r,Zn(e,r).text.length):me(t,Zn(e,t.line).text.length)}function me(e,t){var r=e.ch;return null==r||r>t?Ho(e.line,t):0>r?Ho(e.line,0):e}function ve(e,t){return t>=e.first&&t<e.first+e.size}function ye(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=ge(e,t[n]);return r}function be(e,t,r,n){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(n){var o=Io(r,i)<0;o!=Io(n,i)<0?(i=r,r=n):o!=Io(r,n)<0&&(r=n)}return new de(i,r)}return new de(n||r,r)}function we(e,t,r,n){Le(e,new ue([be(e,e.sel.primary(),t,r)],0),n)}function xe(e,t,r){for(var n=[],i=0;i<e.sel.ranges.length;i++)n[i]=be(e,e.sel.ranges[i],t[i],null);var o=he(n,e.sel.primIndex);Le(e,o,r)}function ke(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Le(e,he(i,e.sel.primIndex),n)}function Ce(e,t,r,n){Le(e,fe(t,r),n)}function Se(e,t,r){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new de(ge(e,t[r].anchor),ge(e,t[r].head))},origin:r&&r.origin};return Wa(e,"beforeSelectionChange",e,n),e.cm&&Wa(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?he(n.ranges,n.ranges.length-1):t}function Te(e,t,r){var n=e.history.done,i=Wi(n);i&&i.ranges?(n[n.length-1]=t,Me(e,t,r)):Le(e,t,r)}function Le(e,t,r){Me(e,t,r),di(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Me(e,t,r){(_i(e,"beforeSelectionChange")||e.cm&&_i(e.cm,"beforeSelectionChange"))&&(t=Se(e,t,r));var n=r&&r.bias||(Io(t.primary().head,e.sel.primary().head)<0?-1:1);_e(e,Ne(e,t,n,!0)),r&&r.scroll===!1||!e.cm||Hr(e.cm)}function _e(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,Mi(e.cm)),Si(e,"cursorActivity",e))}function Ae(e){_e(e,Ne(e,e.sel,null,!1),Da)}function Ne(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=We(e,a.anchor,l&&l.anchor,r,n),c=We(e,a.head,l&&l.head,r,n);(i||s!=a.anchor||c!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new de(s,c))}return i?he(i,t.primIndex):t}function Oe(e,t,r,n,i){var o=Zn(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker;if((null==l.from||(s.inclusiveLeft?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(s.inclusiveRight?l.to>=t.ch:l.to>t.ch))){if(i&&(Wa(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(r){var c,u=s.find(0>n?1:-1);if((0>n?s.inclusiveRight:s.inclusiveLeft)&&(u=ze(e,u,-n,o)),u&&u.line==t.line&&(c=Io(u,r))&&(0>n?0>c:c>0))return Oe(e,u,t,n,i)}var d=s.find(0>n?-1:1);return(0>n?s.inclusiveLeft:s.inclusiveRight)&&(d=ze(e,d,n,o)),d?Oe(e,d,t,n,i):null}}return t}function We(e,t,r,n,i){var o=n||1,a=Oe(e,t,r,o,i)||!i&&Oe(e,t,r,o,!0)||Oe(e,t,r,-o,i)||!i&&Oe(e,t,r,-o,!0);return a?a:(e.cantEdit=!0,Ho(e.first,0))}function ze(e,t,r,n){return 0>r&&0==t.ch?t.line>e.first?ge(e,Ho(t.line-1)):null:r>0&&t.ch==(n||Zn(e,t.line)).text.length?t.line<e.first+e.size-1?Ho(t.line+1,0):null:new Ho(t.line,t.ch+r)}function Ee(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Pe(e,t){for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),a=0;a<r.sel.ranges.length;a++)if(t!==!1||a!=r.sel.primIndex){var l=r.sel.ranges[a],s=l.empty();(s||e.options.showCursorWhenSelecting)&&De(e,l.head,i),s||He(e,l,o)}return n}function De(e,t,r){var n=ft(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(Bi("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(Bi("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 He(e,t,r){function n(e,t,r,n){0>t&&(t=0),t=Math.round(t),n=Math.round(n),l.appendChild(Bi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?u-e:r)+"px; height: "+(n-t)+"px"))}function i(t,r,i){function o(r,n){return ht(e,Ho(t,r),"div",d,n)}var l,s,d=Zn(a,t),h=d.text.length;return eo(ii(d),r||0,null==i?h:i,function(e,t,a){var d,f,p,g=o(e,"left");if(e==t)d=g,f=p=g.left;else{if(d=o(t-1,"right"),"rtl"==a){var m=g;g=d,d=m}f=g.left,p=d.right}null==r&&0==e&&(f=c),d.top-g.top>3&&(n(f,g.top,null,g.bottom),f=c,g.bottom<d.top&&n(f,g.bottom,null,d.top)),null==i&&t==h&&(p=u),(!l||g.top<l.top||g.top==l.top&&g.left<l.left)&&(l=g),(!s||d.bottom>s.bottom||d.bottom==s.bottom&&d.right>s.right)&&(s=d),c+1>f&&(f=c),n(f,d.top,p-f,d.bottom)}),{start:l,end:s}}var o=e.display,a=e.doc,l=document.createDocumentFragment(),s=Ge(e.display),c=s.left,u=Math.max(o.sizerWidth,Ve(e)-o.sizer.offsetLeft)-s.right,d=t.from(),h=t.to();if(d.line==h.line)i(d.line,d.ch,h.ch);else{var f=Zn(a,d.line),p=Zn(a,h.line),g=yn(f)==yn(p),m=i(d.line,d.ch,g?f.text.length+1:null).end,v=i(h.line,g?0:null,h.ch).start;g&&(m.top<v.top-2?(n(m.right,m.top,null,m.bottom),n(c,v.top,v.left,v.bottom)):n(m.right,m.top,v.left-m.right,m.bottom)),m.bottom<v.top&&n(c,m.bottom,null,v.top)}r.appendChild(l)}function Ie(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 Fe(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,Ii(je,e))}function je(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=la(t.mode,Be(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 a=o.styles,l=o.text.length>e.options.maxHighlightLength,s=En(e,o,l?la(t.mode,n):n,!0);o.styles=s.styles;var c=o.styleClasses,u=s.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),h=0;!d&&h<a.length;++h)d=a[h]!=o.styles[h];d&&i.push(t.frontier),o.stateAfter=l?n:la(t.mode,n)}else o.text.length<=e.options.maxHighlightLength&&Dn(e,o.text,n),o.stateAfter=t.frontier%5==0?la(t.mode,n):null;return++t.frontier,+new Date>r?(Fe(e,e.options.workDelay),!0):void 0}),i.length&&At(e,function(){for(var t=0;t<i.length;t++)Dt(e,i[t],"text")})}}function Re(e,t,r){for(var n,i,o=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=Zn(o,l-1);if(s.stateAfter&&(!r||l<=o.frontier))return l;var c=Fa(s.text,null,e.options.tabSize);(null==i||n>c)&&(i=l-1,n=c)}return i}function Be(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=Re(e,t,r),a=o>n.first&&Zn(n,o-1).stateAfter;return a=a?la(n.mode,a):sa(n.mode),n.iter(o,t,function(r){Dn(e,r.text,a);var l=o==t-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;r.stateAfter=l?la(n.mode,a):null,++o}),r&&(n.frontier=o),a}function Ke(e){return e.lineSpace.offsetTop}function Ue(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Ge(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Ui(e.measure,Bi("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 qe(e){return Ea-e.display.nativeBarWidth}function Ve(e){return e.display.scroller.clientWidth-qe(e)-e.display.barWidth}function $e(e){return e.display.scroller.clientHeight-qe(e)-e.display.barHeight}function Ye(e,t,r){var n=e.options.lineWrapping,i=n&&Ve(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],c=a[l+1];Math.abs(s.bottom-c.bottom)>2&&o.push((s.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}function Xe(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(ti(e.rest[n])>r)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Ze(e,t){t=yn(t);var r=ti(t),n=e.display.externalMeasured=new zt(e.doc,t,r);n.lineN=r;var i=n.built=In(e,n);return n.text=i.pre,Ui(e.display.lineMeasure,i.pre),n}function Qe(e,t,r,n){return tt(e,et(e,t),r,n)}function Je(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[It(e,t)];var r=e.display.externalMeasured;
3
+ return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function et(e,t){var r=ti(t),n=Je(e,r);n&&!n.text?n=null:n&&n.changes&&(P(e,n,r,z(e)),e.curOp.forceUpdate=!0),n||(n=Ze(e,t));var i=Xe(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function tt(e,t,r,n,i){t.before&&(r=-1);var o,a=r+(n||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ye(e,t.view,t.rect),t.hasHeights=!0),o=nt(e,t,r,n),o.bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function rt(e,t,r){for(var n,i,o,a,l=0;l<e.length;l+=3){var s=e[l],c=e[l+1];if(s>t?(i=0,o=1,a="left"):c>t?(i=t-s,o=i+1):(l==e.length-3||t==c&&e[l+3]>t)&&(o=c-s,i=o-1,t>=c&&(a="right")),null!=i){if(n=e[l+2],s==c&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)for(;l&&e[l-2]==e[l-3]&&e[l-1].insertLeft;)n=e[(l-=3)+2],a="left";if("right"==r&&i==c-s)for(;l<e.length-3&&e[l+3]==e[l+4]&&!e[l+5].insertLeft;)n=e[(l+=3)+2],a="right";break}}return{node:n,start:i,end:o,collapse:a,coverStart:s,coverEnd:c}}function nt(e,t,r,n){var i,o=rt(t.map,r,n),a=o.node,l=o.start,s=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;4>u;u++){for(;l&&Ri(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+s<o.coverEnd&&Ri(t.line.text.charAt(o.coverStart+s));)++s;if(bo&&9>wo&&0==l&&s==o.coverEnd-o.coverStart)i=a.parentNode.getBoundingClientRect();else if(bo&&e.options.lineWrapping){var d=Ka(a,l,s).getClientRects();i=d.length?d["right"==n?d.length-1:0]:Ko}else i=Ka(a,l,s).getBoundingClientRect()||Ko;if(i.left||i.right||0==l)break;s=l,l-=1,c="right"}bo&&11>wo&&(i=it(e.display.measure,i))}else{l>0&&(c=n="right");var d;i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(bo&&9>wo&&!l&&(!i||!i.left&&!i.right)){var h=a.parentNode.getClientRects()[0];i=h?{left:h.left,right:h.left+bt(e.display),top:h.top,bottom:h.bottom}:Ko}for(var f=i.top-t.rect.top,p=i.bottom-t.rect.top,g=(f+p)/2,m=t.view.measure.heights,u=0;u<m.length-1&&!(g<m[u]);u++);var v=u?m[u-1]:0,y=m[u],b={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:v,bottom:y};return i.left||i.right||(b.bogus=!0),e.options.singleCursorHeightPerLine||(b.rtop=f,b.rbottom=p),b}function it(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Ji(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 ot(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 at(e){e.display.externalMeasure=null,Ki(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)ot(e.display.view[t])}function lt(e){at(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function st(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ct(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function ut(e,t,r,n){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=Tn(t.widgets[i]);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var a=ni(t);if("local"==n?a+=Ke(e.display):a-=e.display.viewOffset,"page"==n||"window"==n){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==n?0:ct());var s=l.left+("window"==n?0:st());r.left+=s,r.right+=s}return r.top+=a,r.bottom+=a,r}function dt(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=st(),i-=ct();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:n-a.left,top:i-a.top}}function ht(e,t,r,n,i){return n||(n=Zn(e.doc,t.line)),ut(e,n,Qe(e,n,t.ch,i),r)}function ft(e,t,r,n,i,o){function a(t,a){var l=tt(e,i,t,a?"right":"left",o);return a?l.left=l.right:l.right=l.left,ut(e,n,l,r)}function l(e,t){var r=s[t],n=r.level%2;return e==to(r)&&t&&r.level<s[t-1].level?(r=s[--t],e=ro(r)-(r.level%2?0:1),n=!0):e==ro(r)&&t<s.length-1&&r.level<s[t+1].level&&(r=s[++t],e=to(r)-r.level%2,n=!1),n&&e==r.to&&e>r.from?a(e-1):a(e,n)}n=n||Zn(e.doc,t.line),i||(i=et(e,n));var s=ii(n),c=t.ch;if(!s)return a(c);var u=co(s,c),d=l(c,u);return null!=ol&&(d.other=l(c,ol)),d}function pt(e,t){var r=0,t=ge(e.doc,t);e.options.lineWrapping||(r=bt(e.display)*t.ch);var n=Zn(e.doc,t.line),i=ni(n)+Ke(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function gt(e,t,r,n){var i=Ho(e,t);return i.xRel=n,r&&(i.outside=!0),i}function mt(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,0>r)return gt(n.first,0,!0,-1);var i=ri(n,r),o=n.first+n.size-1;if(i>o)return gt(n.first+n.size-1,Zn(n,o).text.length,!0,1);0>t&&(t=0);for(var a=Zn(n,i);;){var l=vt(e,a,i,t,r),s=mn(a),c=s&&s.find(0,!0);if(!s||!(l.ch>c.from.ch||l.ch==c.from.ch&&l.xRel>0))return l;i=ti(a=c.to.line)}}function vt(e,t,r,n,i){function o(n){var i=ft(e,Ho(r,n),"line",t,c);return l=!0,a>i.bottom?i.left-s:a<i.top?i.left+s:(l=!1,i.left)}var a=i-ni(t),l=!1,s=2*e.display.wrapper.clientWidth,c=et(e,t),u=ii(t),d=t.text.length,h=no(t),f=io(t),p=o(h),g=l,m=o(f),v=l;if(n>m)return gt(r,f,v,1);for(;;){if(u?f==h||f==ho(t,h,1):1>=f-h){for(var y=p>n||m-n>=n-p?h:f,b=n-(y==h?p:m);Ri(t.text.charAt(y));)++y;var w=gt(r,y,y==h?g:v,-1>b?-1:b>1?1:0);return w}var x=Math.ceil(d/2),k=h+x;if(u){k=h;for(var C=0;x>C;++C)k=ho(t,k,1)}var S=o(k);S>n?(f=k,m=S,(v=l)&&(m+=1e3),d=x):(h=k,p=S,g=l,d-=x)}}function yt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==jo){jo=Bi("pre");for(var t=0;49>t;++t)jo.appendChild(document.createTextNode("x")),jo.appendChild(Bi("br"));jo.appendChild(document.createTextNode("x"))}Ui(e.measure,jo);var r=jo.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),Ki(e.measure),r||1}function bt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Bi("span","xxxxxxxxxx"),r=Bi("pre",[t]);Ui(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function wt(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,focus:!1,id:++Go},Uo?Uo.ops.push(e.curOp):e.curOp.ownsGroup=Uo={ops:[e.curOp],delayedCallbacks:[]}}function xt(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}function kt(e){var t=e.curOp,r=t.ownsGroup;if(r)try{xt(r)}finally{Uo=null;for(var n=0;n<r.ops.length;n++)r.ops[n].cm.curOp=null;Ct(r)}}function Ct(e){for(var t=e.ops,r=0;r<t.length;r++)St(t[r]);for(var r=0;r<t.length;r++)Tt(t[r]);for(var r=0;r<t.length;r++)Lt(t[r]);for(var r=0;r<t.length;r++)Mt(t[r]);for(var r=0;r<t.length;r++)_t(t[r])}function St(e){var t=e.cm,r=t.display;L(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 T(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Tt(e){e.updatedDisplay=e.mustUpdate&&M(e.cm,e.update)}function Lt(e){var t=e.cm,r=t.display;e.updatedDisplay&&O(t),e.barMeasure=p(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Qe(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+qe(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Ve(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Mt(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&ir(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1),e.preparedSelection&&t.display.input.showSelection(e.preparedSelection),e.updatedDisplay&&N(t,e.barMeasure),(e.updatedDisplay||e.startHeight!=t.doc.height)&&y(t,e.barMeasure),e.selectionChanged&&Ie(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),!e.focus||e.focus!=Gi()||document.hasFocus&&!document.hasFocus()||X(e.cm)}function _t(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&_(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-r.scroller.clientWidth,e.scrollLeft)),r.scrollbars.setScrollLeft(n.scrollLeft),r.scroller.scrollLeft=n.scrollLeft,x(t)),e.scrollToPos){var i=zr(t,ge(n,e.scrollToPos.from),ge(n,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&Wr(t,i)}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var l=0;l<o.length;++l)o[l].lines.length||Wa(o[l],"hide");if(a)for(var l=0;l<a.length;++l)a[l].lines.length&&Wa(a[l],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Wa(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function At(e,t){if(e.curOp)return t();wt(e);try{return t()}finally{kt(e)}}function Nt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);wt(e);try{return t.apply(e,arguments)}finally{kt(e)}}}function Ot(e){return function(){if(this.curOp)return e.apply(this,arguments);wt(this);try{return e.apply(this,arguments)}finally{kt(this)}}}function Wt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);wt(t);try{return e.apply(this,arguments)}finally{kt(t)}}}function zt(e,t,r){this.line=t,this.rest=bn(t),this.size=this.rest?ti(Wi(this.rest))-r+1:1,this.node=this.text=null,this.hidden=kn(e,t)}function Et(e,t,r){for(var n,i=[],o=t;r>o;o=n){var a=new zt(e.doc,Zn(e.doc,o),o);n=o+a.size,i.push(a)}return i}function Pt(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)Do&&wn(e.doc,t)<i.viewTo&&Ht(e);else if(r<=i.viewFrom)Do&&xn(e.doc,r+n)>i.viewFrom?Ht(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)Ht(e);else if(t<=i.viewFrom){var o=Ft(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):Ht(e)}else if(r>=i.viewTo){var o=Ft(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):Ht(e)}else{var a=Ft(e,t,t,-1),l=Ft(e,r,r+n,1);a&&l?(i.view=i.view.slice(0,a.index).concat(Et(e,a.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=n):Ht(e)}var s=i.externalMeasured;s&&(r<s.lineN?s.lineN+=n:t<s.lineN+s.size&&(i.externalMeasured=null))}function Dt(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[It(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==zi(a,r)&&a.push(r)}}}function Ht(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function It(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 Ft(e,t,r,n){var i,o=It(e,t),a=e.display.view;if(!Do||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var l=0,s=e.display.viewFrom;o>l;l++)s+=a[l].size;if(s!=t){if(n>0){if(o==a.length-1)return null;i=s+a[o].size-t,o++}else i=s-t;t+=i,r+=i}for(;wn(e.doc,r)!=r;){if(o==(0>n?0:a.length-1))return null;r+=n*a[o-(0>n?1:0)].size,o+=n}return{index:o,lineN:r}}function jt(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=Et(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Et(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(It(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(Et(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,It(e,r)))),n.viewTo=r}function Rt(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 Bt(e){function t(){i.activeTouch&&(o=setTimeout(function(){i.activeTouch=null},1e3),a=i.activeTouch,a.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}var i=e.display;Aa(i.scroller,"mousedown",Nt(e,Vt)),bo&&11>wo?Aa(i.scroller,"dblclick",Nt(e,function(t){if(!Li(e,t)){var r=qt(e,t);if(r&&!Qt(e,t)&&!Gt(e.display,t)){La(t);var n=e.findWordAt(r);we(e.doc,n.anchor,n.head)}}})):Aa(i.scroller,"dblclick",function(t){Li(e,t)||La(t)}),Eo||Aa(i.scroller,"contextmenu",function(t){yr(e,t)});var o,a={end:0};Aa(i.scroller,"touchstart",function(t){if(!Li(e,t)&&!r(t)){clearTimeout(o);var n=+new Date;i.activeTouch={start:n,moved:!1,prev:n-a.end<=300?a:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),Aa(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Aa(i.scroller,"touchend",function(r){var o=i.activeTouch;if(o&&!Gt(i,r)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,l=e.coordsChar(i.activeTouch,"page");a=!o.prev||n(o,o.prev)?new de(l,l):!o.prev.prev||n(o,o.prev.prev)?e.findWordAt(l):new de(Ho(l.line,0),ge(e.doc,Ho(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),La(r)}t()}),Aa(i.scroller,"touchcancel",t),Aa(i.scroller,"scroll",function(){i.scroller.clientHeight&&(nr(e,i.scroller.scrollTop),ir(e,i.scroller.scrollLeft,!0),Wa(e,"scroll",e))}),Aa(i.scroller,"mousewheel",function(t){or(e,t)}),Aa(i.scroller,"DOMMouseScroll",function(t){or(e,t)}),Aa(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Li(e,t)||_a(t)},over:function(t){Li(e,t)||(tr(e,t),_a(t))},start:function(t){er(e,t)},drop:Nt(e,Jt),leave:function(){rr(e)}};var l=i.input.getField();Aa(l,"keyup",function(t){fr.call(e,t)}),Aa(l,"keydown",Nt(e,dr)),Aa(l,"keypress",Nt(e,pr)),Aa(l,"focus",Ii(mr,e)),Aa(l,"blur",Ii(vr,e))}function Kt(t,r,n){var i=n&&n!=e.Init;if(!r!=!i){var o=t.display.dragFunctions,a=r?Aa:Oa;a(t.display.scroller,"dragstart",o.start),a(t.display.scroller,"dragenter",o.enter),a(t.display.scroller,"dragover",o.over),a(t.display.scroller,"dragleave",o.leave),a(t.display.scroller,"drop",o.drop)}}function Ut(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=xi(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 qt(e,t,r,n){var i=e.display;if(!r&&"true"==xi(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,c=mt(e,o,a);if(n&&1==c.xRel&&(s=Zn(e.doc,c.line).text).length==c.ch){var u=Fa(s,s.length,e.options.tabSize)-s.length;c=Ho(c.line,Math.max(0,Math.round((o-Ge(e.display).left)/bt(e.display))-u))}return c}function Vt(e){var t=this,r=t.display;if(!(Li(t,e)||r.activeTouch&&r.input.supportsTouch())){if(r.shift=e.shiftKey,Gt(r,e))return void(xo||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!Qt(t,e)){var n=qt(t,e);switch(window.focus(),ki(e)){case 1:t.state.selectingText?t.state.selectingText(e):n?$t(t,e,n):xi(e)==r.scroller&&La(e);break;case 2:xo&&(t.state.lastMiddleDown=+new Date),n&&we(t.doc,n),setTimeout(function(){r.input.focus()},20),La(e);break;case 3:Eo?yr(t,e):gr(t)}}}}function $t(e,t,r){bo?setTimeout(Ii(X,e),0):e.curOp.focus=Gi();var n,i=+new Date;Bo&&Bo.time>i-400&&0==Io(Bo.pos,r)?n="triple":Ro&&Ro.time>i-400&&0==Io(Ro.pos,r)?(n="double",Bo={time:i,pos:r}):(n="single",Ro={time:i,pos:r});var o,a=e.doc.sel,l=No?t.metaKey:t.ctrlKey;e.options.dragDrop&&Ja&&!e.isReadOnly()&&"single"==n&&(o=a.contains(r))>-1&&(Io((o=a.ranges[o]).from(),r)<0||r.xRel>0)&&(Io(o.to(),r)>0||r.xRel<0)?Yt(e,t,r,l):Xt(e,t,r,n,l)}function Yt(e,t,r,n){var i=e.display,o=+new Date,a=Nt(e,function(l){xo&&(i.scroller.draggable=!1),e.state.draggingText=!1,Oa(document,"mouseup",a),Oa(i.scroller,"drop",a),Math.abs(t.clientX-l.clientX)+Math.abs(t.clientY-l.clientY)<10&&(La(l),!n&&+new Date-200<o&&we(e.doc,r),xo||bo&&9==wo?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())});xo&&(i.scroller.draggable=!0),e.state.draggingText=a,i.scroller.dragDrop&&i.scroller.dragDrop(),Aa(document,"mouseup",a),Aa(i.scroller,"drop",a)}function Xt(e,t,r,n,i){function o(t){if(0!=Io(m,t))if(m=t,"rect"==n){for(var i=[],o=e.options.tabSize,a=Fa(Zn(c,r.line).text,r.ch,o),l=Fa(Zn(c,t.line).text,t.ch,o),s=Math.min(a,l),f=Math.max(a,l),p=Math.min(r.line,t.line),g=Math.min(e.lastLine(),Math.max(r.line,t.line));g>=p;p++){var v=Zn(c,p).text,y=ja(v,s,o);s==f?i.push(new de(Ho(p,y),Ho(p,y))):v.length>y&&i.push(new de(Ho(p,y),Ho(p,ja(v,f,o))))}i.length||i.push(new de(r,r)),Le(c,he(h.ranges.slice(0,d).concat(i),d),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,w=b.anchor,x=t;if("single"!=n){if("double"==n)var k=e.findWordAt(t);else var k=new de(Ho(t.line,0),ge(c,Ho(t.line+1,0)));Io(k.anchor,w)>0?(x=k.head,w=Y(b.from(),k.anchor)):(x=k.anchor,w=$(b.to(),k.head))}var i=h.ranges.slice(0);i[d]=new de(ge(c,w),x),Le(c,he(i,d),Ha)}}function a(t){var r=++y,i=qt(e,t,!0,"rect"==n);if(i)if(0!=Io(i,m)){e.curOp.focus=Gi(),o(i);var l=w(s,c);(i.line>=l.to||i.line<l.from)&&setTimeout(Nt(e,function(){y==r&&a(t)}),150)}else{var u=t.clientY<v.top?-20:t.clientY>v.bottom?20:0;u&&setTimeout(Nt(e,function(){y==r&&(s.scroller.scrollTop+=u,a(t))}),50)}}function l(t){e.state.selectingText=!1,y=1/0,La(t),s.input.focus(),Oa(document,"mousemove",b),Oa(document,"mouseup",x),c.history.lastSelOrigin=null}var s=e.display,c=e.doc;La(t);var u,d,h=c.sel,f=h.ranges;if(i&&!t.shiftKey?(d=c.sel.contains(r),u=d>-1?f[d]:new de(r,r)):(u=c.sel.primary(),d=c.sel.primIndex),t.altKey)n="rect",i||(u=new de(r,r)),r=qt(e,t,!0,!0),d=-1;else if("double"==n){var p=e.findWordAt(r);u=e.display.shift||c.extend?be(c,u,p.anchor,p.head):p}else if("triple"==n){var g=new de(Ho(r.line,0),ge(c,Ho(r.line+1,0)));u=e.display.shift||c.extend?be(c,u,g.anchor,g.head):g}else u=be(c,u,r);i?-1==d?(d=f.length,Le(c,he(f.concat([u]),d),{scroll:!1,origin:"*mouse"})):f.length>1&&f[d].empty()&&"single"==n&&!t.shiftKey?(Le(c,he(f.slice(0,d).concat(f.slice(d+1)),0),{scroll:!1,origin:"*mouse"}),h=c.sel):ke(c,d,u,Ha):(d=0,Le(c,new ue([u],0),Ha),h=c.sel);var m=r,v=s.wrapper.getBoundingClientRect(),y=0,b=Nt(e,function(e){ki(e)?a(e):l(e)}),x=Nt(e,l);e.state.selectingText=x,Aa(document,"mousemove",b),Aa(document,"mouseup",x)}function Zt(e,t,r,n){try{var i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&La(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!_i(e,r))return wi(t);o-=l.top-a.viewOffset;for(var s=0;s<e.options.gutters.length;++s){var c=a.gutters.childNodes[s];if(c&&c.getBoundingClientRect().right>=i){var u=ri(e.doc,o),d=e.options.gutters[s];return Wa(e,r,e,u,d,t),wi(t)}}}function Qt(e,t){return Zt(e,t,"gutterClick",!0)}function Jt(e){var t=this;if(rr(t),!Li(t,e)&&!Gt(t.display,e)){La(e),bo&&(qo=+new Date);var r=qt(t,e,!0),n=e.dataTransfer.files;if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),a=0,l=function(e,n){if(!t.options.allowDropFileTypes||-1!=zi(t.options.allowDropFileTypes,e.type)){var l=new FileReader;l.onload=Nt(t,function(){var e=l.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[n]=e,++a==i){r=ge(t.doc,r);var s={from:r,to:r,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};Tr(t.doc,s),Te(t.doc,fe(r,Qo(s)))}}),l.readAsText(e)}},s=0;i>s;++s)l(n[s],s);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&&!(No?e.altKey:e.ctrlKey))var c=t.listSelections();if(Me(t.doc,fe(r,r)),c)for(var s=0;s<c.length;++s)Or(t.doc,"",c[s].anchor,c[s].head,"drag");t.replaceSelection(o,"around","paste"),t.display.input.focus()}}catch(e){}}}}function er(e,t){if(bo&&(!e.state.draggingText||+new Date-qo<100))return void _a(t);if(!Li(e,t)&&!Gt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.setDragImage&&!To)){var r=Bi("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",So&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),So&&r.parentNode.removeChild(r)}}function tr(e,t){var r=qt(e,t);if(r){var n=document.createDocumentFragment();De(e,r,n),e.display.dragCursor||(e.display.dragCursor=Bi("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),Ui(e.display.dragCursor,n)}}function rr(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function nr(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,mo||A(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbars.setScrollTop(t),mo&&A(e),Fe(e,100))}function ir(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 or(e,t){var r=Yo(t),n=r.x,i=r.y,o=e.display,a=o.scroller,l=a.scrollWidth>a.clientWidth,s=a.scrollHeight>a.clientHeight;if(n&&l||i&&s){if(i&&No&&xo)e:for(var c=t.target,u=o.view;c!=a;c=c.parentNode)for(var d=0;d<u.length;d++)if(u[d].node==c){e.display.currentWheelTarget=c;break e}if(n&&!mo&&!So&&null!=$o)return i&&s&&nr(e,Math.max(0,Math.min(a.scrollTop+i*$o,a.scrollHeight-a.clientHeight))),ir(e,Math.max(0,Math.min(a.scrollLeft+n*$o,a.scrollWidth-a.clientWidth))),(!i||i&&s)&&La(t),void(o.wheelStartX=null);if(i&&null!=$o){var h=i*$o,f=e.doc.scrollTop,p=f+o.wrapper.clientHeight;0>h?f=Math.max(0,f+h-50):p=Math.min(e.doc.height,p+h+50),A(e,{top:f,bottom:p})}20>Vo&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&($o=($o*Vo+r)/(Vo+1),++Vo)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}function ar(e,t,r){if("string"==typeof t&&(t=ca[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=Pa}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function lr(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=da(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&da(t,e.options.extraKeys,r,e)||da(t,e.options.keyMap,r,e)}function sr(e,t,r,n){var i=e.state.keySeq;if(i){if(ha(t))return"handled";Xo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),t=i+" "+t}var o=lr(e,t,n);return"multi"==o&&(e.state.keySeq=t),"handled"==o&&Si(e,"keyHandled",e,t,r),"handled"!=o&&"multi"!=o||(La(r),Ie(e)),i&&!o&&/\'$/.test(t)?(La(r),!0):!!o}function cr(e,t){var r=fa(t,!0);return r?t.shiftKey&&!e.state.keySeq?sr(e,"Shift-"+r,t,function(t){return ar(e,t,!0)})||sr(e,r,t,function(t){return("string"==typeof t?/^go[A-Z]/.test(t):t.motion)?ar(e,t):void 0}):sr(e,r,t,function(t){return ar(e,t)}):!1}function ur(e,t,r){return sr(e,"'"+r+"'",t,function(t){return ar(e,t,!0)})}function dr(e){var t=this;if(t.curOp.focus=Gi(),!Li(t,e)){bo&&11>wo&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=cr(t,e);So&&(Zo=n?r:null,!n&&88==r&&!rl&&(No?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||hr(t)}}function hr(e){function t(e){18!=e.keyCode&&e.altKey||(Xa(r,"CodeMirror-crosshair"),Oa(document,"keyup",t),Oa(document,"mouseover",t))}var r=e.display.lineDiv;Za(r,"CodeMirror-crosshair"),Aa(document,"keyup",t),Aa(document,"mouseover",t)}function fr(e){16==e.keyCode&&(this.doc.sel.shift=!1),Li(this,e)}function pr(e){var t=this;if(!(Gt(t.display,e)||Li(t,e)||e.ctrlKey&&!e.altKey||No&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(So&&r==Zo)return Zo=null,void La(e);if(!So||e.which&&!(e.which<10)||!cr(t,e)){var i=String.fromCharCode(null==n?r:n);ur(t,e,i)||t.display.input.onKeyPress(e)}}}function gr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,vr(e))},100)}function mr(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Wa(e,"focus",e),e.state.focused=!0,Za(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),xo&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ie(e))}function vr(e){e.state.delayingBlurEvent||(e.state.focused&&(Wa(e,"blur",e),e.state.focused=!1,Xa(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function yr(e,t){Gt(e.display,t)||br(e,t)||Li(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function br(e,t){return _i(e,"gutterContextMenu")?Zt(e,t,"gutterContextMenu",!1):!1}function wr(e,t){if(Io(e,t.from)<0)return e;if(Io(e,t.to)<=0)return Qo(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+=Qo(t).ch-t.to.ch),Ho(r,n)}function xr(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new de(wr(i.anchor,t),wr(i.head,t)))}return he(r,e.sel.primIndex)}function kr(e,t,r){return e.line==t.line?Ho(r.line,e.ch-t.ch+r.ch):Ho(r.line+(e.line-t.line),e.ch)}function Cr(e,t,r){for(var n=[],i=Ho(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=kr(l.from,i,o),c=kr(Qo(l),i,o);if(i=l.to,o=c,"around"==r){var u=e.sel.ranges[a],d=Io(u.head,u.anchor)<0;n[a]=new de(d?c:s,d?s:c)}else n[a]=new de(s,s)}return new ue(n,e.sel.primIndex)}function Sr(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=ge(e,t)),r&&(this.to=ge(e,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),Wa(e,"beforeChange",e,n),e.cm&&Wa(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Tr(e,t,r){if(e.cm){if(!e.cm.curOp)return Nt(e.cm,Tr)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(_i(e,"beforeChange")||e.cm&&_i(e.cm,"beforeChange"))||(t=Sr(e,t,!0))){var n=Po&&!r&&sn(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)Lr(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else Lr(e,t)}}function Lr(e,t){if(1!=t.text.length||""!=t.text[0]||0!=Io(t.from,t.to)){var r=xr(e,t);ci(e,t,r,e.cm?e.cm.curOp.id:NaN),Ar(e,t,r,on(e,t));var n=[];Yn(e,function(e,r){r||-1!=zi(n,e.history)||(bi(e.history,t),n.push(e.history)),Ar(e,t,null,on(e,t))})}}function Mr(e,t,r){if(!e.cm||!e.cm.state.suppressEdits){for(var n,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,l="undo"==t?i.undone:i.done,s=0;s<a.length&&(n=a[s],r?!n.ranges||n.equals(e.sel):n.ranges);s++);if(s!=a.length){for(i.lastOrigin=i.lastSelOrigin=null;n=a.pop(),n.ranges;){if(hi(n,l),r&&!n.equals(e.sel))return void Le(e,n,{clearRedo:!1});o=n}var c=[];hi(o,l),l.push({changes:c,generation:i.generation}),i.generation=n.generation||++i.maxGeneration;for(var u=_i(e,"beforeChange")||e.cm&&_i(e.cm,"beforeChange"),s=n.changes.length-1;s>=0;--s){var d=n.changes[s];if(d.origin=t,u&&!Sr(e,d,!1))return void(a.length=0);c.push(ai(e,d));var h=s?xr(e,d):Wi(a);Ar(e,d,h,ln(e,d)),!s&&e.cm&&e.cm.scrollIntoView({from:d.from,to:Qo(d)});var f=[];Yn(e,function(e,t){t||-1!=zi(f,e.history)||(bi(e.history,d),f.push(e.history)),Ar(e,d,null,ln(e,d))})}}}}function _r(e,t){if(0!=t&&(e.first+=t,e.sel=new ue(Ei(e.sel.ranges,function(e){return new de(Ho(e.anchor.line+t,e.anchor.ch),Ho(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Pt(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Dt(e.cm,n,"gutter")}}function Ar(e,t,r,n){if(e.cm&&!e.cm.curOp)return Nt(e.cm,Ar)(e,t,r,n);if(t.to.line<e.first)return void _r(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);_r(e,i),t={from:Ho(e.first,0),to:Ho(t.to.line+i,t.to.ch),text:[Wi(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:Ho(o,Zn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Qn(e,t.from,t.to),r||(r=xr(e,t)),e.cm?Nr(e.cm,t,n):qn(e,t,n),Me(e,r,Da)}}function Nr(e,t,r){var n=e.doc,i=e.display,a=t.from,l=t.to,s=!1,c=a.line;e.options.lineWrapping||(c=ti(yn(Zn(n,a.line))),n.iter(c,l.line+1,function(e){return e==i.maxLine?(s=!0,!0):void 0})),n.sel.contains(t.from,t.to)>-1&&Mi(e),qn(n,t,r,o(e)),e.options.lineWrapping||(n.iter(c,a.line+t.text.length,function(e){var t=d(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,a.line),Fe(e,400);var u=t.text.length-(l.line-a.line)-1;t.full?Pt(e):a.line!=l.line||1!=t.text.length||Gn(e.doc,t)?Pt(e,a.line,l.line+1,u):Dt(e,a.line,"text");var h=_i(e,"changes"),f=_i(e,"change");if(f||h){var p={from:a,to:l,text:t.text,removed:t.removed,origin:t.origin};f&&Si(e,"change",e,p),h&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function Or(e,t,r,n,i){if(n||(n=r),Io(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=e.splitLines(t)),Tr(e,{from:r,to:n,text:t,origin:i})}function Wr(e,t){if(!Li(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&&!Mo){var o=Bi("div","​",null,"position: absolute; top: "+(t.top-r.viewOffset-Ke(e.display))+"px; height: "+(t.bottom-t.top+qe(e)+r.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function zr(e,t,r,n){null==n&&(n=0);for(var i=0;5>i;i++){var o=!1,a=ft(e,t),l=r&&r!=t?ft(e,r):a,s=Pr(e,Math.min(a.left,l.left),Math.min(a.top,l.top)-n,Math.max(a.left,l.left),Math.max(a.bottom,l.bottom)+n),c=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=s.scrollTop&&(nr(e,s.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(o=!0)),null!=s.scrollLeft&&(ir(e,s.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return a}function Er(e,t,r,n,i){var o=Pr(e,t,r,n,i);null!=o.scrollTop&&nr(e,o.scrollTop),null!=o.scrollLeft&&ir(e,o.scrollLeft)}function Pr(e,t,r,n,i){var o=e.display,a=yt(e.display);0>r&&(r=0);var l=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,s=$e(e),c={};
4
+ i-r>s&&(i=r+s);var u=e.doc.height+Ue(o),d=a>r,h=i>u-a;if(l>r)c.scrollTop=d?0:r;else if(i>l+s){var f=Math.min(r,(h?u:i)-s);f!=l&&(c.scrollTop=f)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,g=Ve(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),m=n-t>g;return m&&(n=t+g),10>t?c.scrollLeft=0:p>t?c.scrollLeft=Math.max(0,t-(m?0:10)):n>g+p-3&&(c.scrollLeft=n+(m?0:10)-g),c}function Dr(e,t,r){null==t&&null==r||Ir(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 Hr(e){Ir(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?Ho(t.line,t.ch-1):t,n=Ho(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function Ir(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=pt(e,t.from),n=pt(e,t.to),i=Pr(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 Fr(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=Be(e,t):r="prev");var a=e.options.tabSize,l=Zn(o,t),s=Fa(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var c,u=l.text.match(/^\s*/)[0];if(n||/\S/.test(l.text)){if("smart"==r&&(c=o.mode.indent(i,l.text.slice(u.length),l.text),c==Pa||c>150)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?Fa(Zn(o,t-1).text,null,a):0:"add"==r?c=s+e.options.indentUnit:"subtract"==r?c=s-e.options.indentUnit:"number"==typeof r&&(c=s+r),c=Math.max(0,c);var d="",h=0;if(e.options.indentWithTabs)for(var f=Math.floor(c/a);f;--f)h+=a,d+=" ";if(c>h&&(d+=Oi(c-h)),d!=u)return Or(o,d,Ho(t,0),Ho(t,u.length),"+input"),l.stateAfter=null,!0;for(var f=0;f<o.sel.ranges.length;f++){var p=o.sel.ranges[f];if(p.head.line==t&&p.head.ch<u.length){var h=Ho(t,u.length);ke(o,f,new de(h,h));break}}}function jr(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=Zn(e,pe(e,t)):i=ti(t),null==i?null:(n(o,i)&&e.cm&&Dt(e.cm,i,r),o)}function Rr(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&Io(o.from,Wi(n).to)<=0;){var a=n.pop();if(Io(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}At(e,function(){for(var t=n.length-1;t>=0;t--)Or(e.doc,"",n[t].from,n[t].to,"+delete");Hr(e)})}function Br(e,t,r,n,i){function o(){var t=l+r;return t<e.first||t>=e.first+e.size?!1:(l=t,u=Zn(e,t))}function a(e){var t=(i?ho:fo)(u,s,r,!0);if(null==t){if(e||!o())return!1;s=i?(0>r?io:no)(u):0>r?u.text.length:0}else s=t;return!0}var l=t.line,s=t.ch,c=r,u=Zn(e,l);if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var d=null,h="group"==n,f=e.cm&&e.cm.getHelper(t,"wordChars"),p=!0;!(0>r)||a(!p);p=!1){var g=u.text.charAt(s)||"\n",m=Fi(g,f)?"w":h&&"\n"==g?"n":!h||/\s/.test(g)?null:"p";if(!h||p||m||(m="s"),d&&d!=m){0>r&&(r=1,a());break}if(m&&(d=m),r>0&&!a(!p))break}var v=We(e,Ho(l,s),t,c,!0);return Io(t,v)||(v.hitSide=!0),v}function Kr(e,t,r,n){var i,o=e.doc,a=t.left;if("page"==n){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+r*(l-(0>r?1.5:.5)*yt(e.display))}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;;){var s=mt(e,a,i);if(!s.outside)break;if(0>r?0>=i:i>=o.height){s.hitSide=!0;break}i+=5*r}return s}function Ur(t,r,n,i){e.defaults[t]=r,n&&(ea[t]=i?function(e,t,r){r!=ta&&n(e,t,r)}:n)}function Gr(e){for(var t,r,n,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a<o.length-1;a++){var l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else{if(!/^s(hift)$/i.test(l))throw new Error("Unrecognized modifier name: "+l);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function qr(e){return"string"==typeof e?ua[e]:e}function Vr(e,t,r,n,i){if(n&&n.shared)return $r(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return Nt(e.cm,Vr)(e,t,r,n,i);var o=new ma(e,i),a=Io(t,r);if(n&&Hi(n,o,!1),a>0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Bi("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(vn(e,t.line,t,r,o)||t.line!=r.line&&vn(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Do=!0}o.addToHistory&&ci(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var l,s=t.line,c=e.cm;if(e.iter(s,r.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&yn(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&ei(e,0),tn(e,new Qr(o,s==t.line?t.ch:null,s==r.line?r.ch:null)),++s}),o.collapsed&&e.iter(t.line,r.line+1,function(t){kn(e,t)&&ei(t,0)}),o.clearOnEnter&&Aa(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Po=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ga,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)Pt(c,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=t.line;u<=r.line;u++)Dt(c,u,"text");o.atomic&&Ae(c.doc),Si(c,"markerAdded",c,o)}return o}function $r(e,t,r,n,i){n=Hi(n),n.shared=!1;var o=[Vr(e,t,r,n,i)],a=o[0],l=n.widgetNode;return Yn(e,function(e){l&&(n.widgetNode=l.cloneNode(!0)),o.push(Vr(e,ge(e,t),ge(e,r),n,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;a=Wi(o)}),new va(o,a)}function Yr(e){return e.findMarks(Ho(e.first,0),e.clipPos(Ho(e.lastLine())),function(e){return e.parent})}function Xr(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(Io(o,a)){var l=Vr(e,o,a,n.primary,n.primary.type);n.markers.push(l),l.parent=n}}}function Zr(e){for(var t=0;t<e.length;t++){var r=e[t],n=[r.primary.doc];Yn(r.primary.doc,function(e){n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==zi(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}}}function Qr(e,t,r){this.marker=e,this.from=t,this.to=r}function Jr(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function en(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function tn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function rn(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new Qr(a,o.from,s?null:o.to))}}return n}function nn(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new Qr(a,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}function on(e,t){if(t.full)return null;var r=ve(e,t.from.line)&&Zn(e,t.from.line).markedSpans,n=ve(e,t.to.line)&&Zn(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,a=0==Io(t.from,t.to),l=rn(r,i,a),s=nn(n,o,a),c=1==t.text.length,u=Wi(t.text).length+(c?i:0);if(l)for(var d=0;d<l.length;++d){var h=l[d];if(null==h.to){var f=Jr(s,h.marker);f?c&&(h.to=null==f.to?null:f.to+u):h.to=i}}if(s)for(var d=0;d<s.length;++d){var h=s[d];if(null!=h.to&&(h.to+=u),null==h.from){var f=Jr(l,h.marker);f||(h.from=u,c&&(l||(l=[])).push(h))}else h.from+=u,c&&(l||(l=[])).push(h)}l&&(l=an(l)),s&&s!=l&&(s=an(s));var p=[l];if(!c){var g,m=t.text.length-2;if(m>0&&l)for(var d=0;d<l.length;++d)null==l[d].to&&(g||(g=[])).push(new Qr(l[d].marker,null,null));for(var d=0;m>d;++d)p.push(g);p.push(s)}return p}function an(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 ln(e,t){var r=gi(e,t),n=on(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],a=n[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue e;o.push(s)}else a&&(r[i]=a)}return r}function sn(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!=zi(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var a=n[o],l=a.find(0),s=0;s<i.length;++s){var c=i[s];if(!(Io(c.to,l.from)<0||Io(c.from,l.to)>0)){var u=[s,1],d=Io(c.from,l.from),h=Io(c.to,l.to);(0>d||!a.inclusiveLeft&&!d)&&u.push({from:c.from,to:l.from}),(h>0||!a.inclusiveRight&&!h)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-1}}return i}function cn(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function un(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function dn(e){return e.inclusiveLeft?-1:0}function hn(e){return e.inclusiveRight?1:0}function fn(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=Io(n.from,i.from)||dn(e)-dn(t);if(o)return-o;var a=Io(n.to,i.to)||hn(e)-hn(t);return a?a:t.id-e.id}function pn(e,t){var r,n=Do&&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||fn(r,i.marker)<0)&&(r=i.marker);return r}function gn(e){return pn(e,!0)}function mn(e){return pn(e,!1)}function vn(e,t,r,n,i){var o=Zn(e,t),a=Do&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var c=s.marker.find(0),u=Io(c.from,r)||dn(s.marker)-dn(i),d=Io(c.to,n)||hn(s.marker)-hn(i);if(!(u>=0&&0>=d||0>=u&&d>=0)&&(0>=u&&(Io(c.to,r)>0||s.marker.inclusiveRight&&i.inclusiveLeft)||u>=0&&(Io(c.from,n)<0||s.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function yn(e){for(var t;t=gn(e);)e=t.find(-1,!0).line;return e}function bn(e){for(var t,r;t=mn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function wn(e,t){var r=Zn(e,t),n=yn(r);return r==n?t:ti(n)}function xn(e,t){if(t>e.lastLine())return t;var r,n=Zn(e,t);if(!kn(e,n))return t;for(;r=mn(n);)n=r.find(1,!0).line;return ti(n)+1}function kn(e,t){var r=Do&&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&&Cn(e,t,n))return!0}}function Cn(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Cn(e,n.line,Jr(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)&&Cn(e,t,i))return!0}function Sn(e,t,r){ni(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Dr(e,null,r)}function Tn(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Va(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),Ui(t.display.measure,Bi("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function Ln(e,t,r,n){var i=new ya(e,r,n),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),jr(e,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!kn(e,t)){var n=ni(t)<e.scrollTop;ei(t,t.height+Tn(i)),n&&Dr(o,null,i.height),o.curOp.forceUpdate=!0}return!0}),i}function Mn(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),cn(e),un(e,r);var i=n?n(e):1;i!=e.height&&ei(e,i)}function _n(e){e.parent=null,cn(e)}function An(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 Nn(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 On(t,r,n,i){for(var o=0;10>o;o++){i&&(i[0]=e.innerMode(t,n).mode);var a=t.token(r,n);if(r.pos>r.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}function Wn(e,t,r,n){function i(e){return{start:d.start,end:d.pos,string:d.current(),type:o||null,state:e?la(a.mode,u):u}}var o,a=e.doc,l=a.mode;t=ge(a,t);var s,c=Zn(a,t.line),u=Be(e,t.line,r),d=new pa(c.text,e.options.tabSize);for(n&&(s=[]);(n||d.pos<t.ch)&&!d.eol();)d.start=d.pos,o=On(l,d,u),n&&s.push(i(!0));return n?s:i()}function zn(e,t,r,n,i,o,a){var l=r.flattenSpans;null==l&&(l=e.options.flattenSpans);var s,c=0,u=null,d=new pa(t,e.options.tabSize),h=e.options.addModeClass&&[null];for(""==t&&An(Nn(r,n),o);!d.eol();){if(d.pos>e.options.maxHighlightLength?(l=!1,a&&Dn(e,t,n,d.pos),d.pos=t.length,s=null):s=An(On(r,d,n,h),o),h){var f=h[0].name;f&&(s="m-"+(s?f+" "+s:f))}if(!l||u!=s){for(;c<d.start;)c=Math.min(d.start,c+5e4),i(c,u);u=s}d.start=d.pos}for(;c<d.pos;){var p=Math.min(d.pos,c+5e4);i(p,u),c=p}}function En(e,t,r,n){var i=[e.state.modeGen],o={};zn(e,t.text,e.doc.mode,r,function(e,t){i.push(e,t)},o,n);for(var a=0;a<e.state.overlays.length;++a){var l=e.state.overlays[a],s=1,c=0;zn(e,t.text,l.mode,!0,function(e,t){for(var r=s;e>c;){var n=i[s];n>e&&i.splice(s,1,e,i[s+1],n),s+=2,c=Math.min(e,n)}if(t)if(l.opaque)i.splice(r,s-r,e,"cm-overlay "+t),s=r+2;else for(;s>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 Pn(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Be(e,ti(t)),i=En(e,t,t.text.length>e.options.maxHighlightLength?la(e.doc.mode,n):n);t.stateAfter=n,t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.frontier&&e.doc.frontier++}return t.styles}function Dn(e,t,r,n){var i=e.doc.mode,o=new pa(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&Nn(i,r);!o.eol();)On(i,o,r),o.start=o.pos}function Hn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?xa:wa;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function In(e,t){var r=Bi("span",null,null,xo?"padding-right: .1px":null),n={pre:Bi("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,splitSpaces:(bo||xo)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,a=i?t.rest[i-1]:t.line;n.pos=0,n.addToken=jn,Qi(e.display.measure)&&(o=ii(a))&&(n.addToken=Bn(n.addToken,o)),n.map=[];var l=t!=e.display.externalMeasured&&ti(a);Un(a,n,Pn(e,a,l)),a.styleClasses&&(a.styleClasses.bgClass&&(n.bgClass=Vi(a.styleClasses.bgClass,n.bgClass||"")),a.styleClasses.textClass&&(n.textClass=Vi(a.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Zi(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 xo&&/\bcm-tab\b/.test(n.content.lastChild.className)&&(n.content.className="cm-tab-wrap-hack"),Wa(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Vi(n.pre.className,n.textClass||"")),n}function Fn(e){var t=Bi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function jn(e,t,r,n,i,o,a){if(t){var l=e.splitSpaces?t.replace(/ {3,}/g,Rn):t,s=e.cm.state.specialChars,c=!1;if(s.test(t))for(var u=document.createDocumentFragment(),d=0;;){s.lastIndex=d;var h=s.exec(t),f=h?h.index-d:t.length-d;if(f){var p=document.createTextNode(l.slice(d,d+f));bo&&9>wo?u.appendChild(Bi("span",[p])):u.appendChild(p),e.map.push(e.pos,e.pos+f,p),e.col+=f,e.pos+=f}if(!h)break;if(d+=f+1," "==h[0]){var g=e.cm.options.tabSize,m=g-e.col%g,p=u.appendChild(Bi("span",Oi(m),"cm-tab"));p.setAttribute("role","presentation"),p.setAttribute("cm-text"," "),e.col+=m}else if("\r"==h[0]||"\n"==h[0]){var p=u.appendChild(Bi("span","\r"==h[0]?"␍":"␤","cm-invalidchar"));p.setAttribute("cm-text",h[0]),e.col+=1}else{var p=e.cm.options.specialCharPlaceholder(h[0]);p.setAttribute("cm-text",h[0]),bo&&9>wo?u.appendChild(Bi("span",[p])):u.appendChild(p),e.col+=1}e.map.push(e.pos,e.pos+1,p),e.pos++}else{e.col+=t.length;var u=document.createTextNode(l);e.map.push(e.pos,e.pos+t.length,u),bo&&9>wo&&(c=!0),e.pos+=t.length}if(r||n||i||c||a){var v=r||"";n&&(v+=n),i&&(v+=i);var y=Bi("span",[u],v,a);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function Rn(e){for(var t=" ",r=0;r<e.length-2;++r)t+=r%2?" ":" ";return t+=" "}function Bn(e,t){return function(r,n,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border";for(var c=r.pos,u=c+n.length;;){for(var d=0;d<t.length;d++){var h=t[d];if(h.to>c&&h.from<=c)break}if(h.to>=u)return e(r,n,i,o,a,l,s);e(r,n.slice(0,h.to-c),i,o,null,l,s),o=null,n=n.slice(h.to-c),c=h.to}}}function Kn(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 Un(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a,l,s,c,u,d,h,f=i.length,p=0,g=1,m="",v=0;;){if(v==p){s=c=u=d=l="",h=null,v=1/0;for(var y,b=[],w=0;w<n.length;++w){var x=n[w],k=x.marker;"bookmark"==k.type&&x.from==p&&k.widgetNode?b.push(k):x.from<=p&&(null==x.to||x.to>p||k.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),k.className&&(s+=" "+k.className),k.css&&(l=(l?l+";":"")+k.css),k.startStyle&&x.from==p&&(u+=" "+k.startStyle),k.endStyle&&x.to==v&&(y||(y=[])).push(k.endStyle,x.to),k.title&&!d&&(d=k.title),k.collapsed&&(!h||fn(h.marker,k)<0)&&(h=x)):x.from>p&&v>x.from&&(v=x.from)}if(y)for(var w=0;w<y.length;w+=2)y[w+1]==v&&(c+=" "+y[w]);if(!h||h.from==p)for(var w=0;w<b.length;++w)Kn(t,0,b[w]);if(h&&(h.from||0)==p){if(Kn(t,(null==h.to?f+1:h.to)-p,h.marker,null==h.from),null==h.to)return;h.to==p&&(h=!1)}}if(p>=f)break;for(var C=Math.min(f,v);;){if(m){var S=p+m.length;if(!h){var T=S>C?m.slice(0,C-p):m;t.addToken(t,T,a?a+s:s,u,p+T.length==v?c:"",d,l)}if(S>=C){m=m.slice(C-p),p=C;break}p=S,u=""}m=i.slice(o,o=r[g++]),a=Hn(r[g++],t.cm.options)}}else for(var g=1;g<r.length;g+=2)t.addToken(t,i.slice(o,o=r[g]),Hn(r[g+1],t.cm.options))}function Gn(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Wi(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function qn(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){Mn(e,r,i,n),Si(e,"change",e,t)}function a(e,t){for(var r=e,o=[];t>r;++r)o.push(new ba(c[r],i(r),n));return o}var l=t.from,s=t.to,c=t.text,u=Zn(e,l.line),d=Zn(e,s.line),h=Wi(c),f=i(c.length-1),p=s.line-l.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(Gn(e,t)){var g=a(0,c.length-1);o(d,d.text,f),p&&e.remove(l.line,p),g.length&&e.insert(l.line,g)}else if(u==d)if(1==c.length)o(u,u.text.slice(0,l.ch)+h+u.text.slice(s.ch),f);else{var g=a(1,c.length-1);g.push(new ba(h+u.text.slice(s.ch),f,n)),o(u,u.text.slice(0,l.ch)+c[0],i(0)),e.insert(l.line+1,g)}else if(1==c.length)o(u,u.text.slice(0,l.ch)+c[0]+d.text.slice(s.ch),i(0)),e.remove(l.line+1,p);else{o(u,u.text.slice(0,l.ch)+c[0],i(0)),o(d,h+d.text.slice(s.ch),f);var g=a(1,c.length-1);p>1&&e.remove(l.line+1,p-1),e.insert(l.line+1,g)}Si(e,"change",e,t)}function Vn(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 $n(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 Yn(e,t,r){function n(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var l=e.linked[a];if(l.doc!=i){var s=o&&l.sharedHist;r&&!s||(t(l.doc,s),n(l.doc,e,s))}}}n(e,null,!0)}function Xn(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,a(e),r(e),e.options.lineWrapping||h(e),e.options.mode=t.modeOption,Pt(e)}function Zn(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 Qn(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 Jn(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function ei(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function ti(e){if(null==e.parent)return null;for(var t=e.parent,r=zi(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 ri(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 a=e.lines[n],l=a.height;if(l>t)break;t-=l}return r+n}function ni(e){e=yn(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 a=o.children[n];if(a==r)break;t+=a.height}return t}function ii(e){var t=e.order;return null==t&&(t=e.order=al(e.text)),t}function oi(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 ai(e,t){var r={from:V(t.from),to:Qo(t),text:Qn(e,t.from,t.to)};return fi(e,r,t.from.line,t.to.line+1),Yn(e,function(e){fi(e,r,t.from.line,t.to.line+1)},!0),r}function li(e){for(;e.length;){var t=Wi(e);if(!t.ranges)break;e.pop()}}function si(e,t){return t?(li(e.done),Wi(e.done)):e.done.length&&!Wi(e.done).ranges?Wi(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Wi(e.done)):void 0}function ci(e,t,r,n){var i=e.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>a-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=si(i,i.lastOp==n))){var l=Wi(o.changes);0==Io(t.from,t.to)&&0==Io(t.from,l.to)?l.to=Qo(t):o.changes.push(ai(e,t))}else{var s=Wi(i.done);for(s&&s.ranges||hi(e.sel,i.done),o={changes:[ai(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=a,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,l||Wa(e,"historyAdded")}function ui(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 di(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||ui(e,o,Wi(i.done),t))?i.done[i.done.length-1]=t:hi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&n.clearRedo!==!1&&li(i.undone)}function hi(e,t){var r=Wi(t);r&&r.ranges&&r.equals(e)||t.push(e)}function fi(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 pi(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 gi(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=0,i=[];n<t.text.length;++n)i.push(pi(r[n]));return i}function mi(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 a=o.changes,l=[];i.push({changes:l});for(var s=0;s<a.length;++s){var c,u=a[s];if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var d in u)(c=d.match(/^spans_(\d+)$/))&&zi(t,Number(c[1]))>-1&&(Wi(l)[d]=u[d],delete u[d])}}}return i}function vi(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function yi(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var l=0;l<o.ranges.length;l++)vi(o.ranges[l].anchor,t,r,n),vi(o.ranges[l].head,t,r,n)}else{for(var l=0;l<o.changes.length;++l){var s=o.changes[l];if(r<s.from.line)s.from=Ho(s.from.line+n,s.from.ch),s.to=Ho(s.to.line+n,s.to.ch);else if(t<=s.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function bi(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;yi(e.done,r,n,i),yi(e.undone,r,n,i)}function wi(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function xi(e){return e.target||e.srcElement}function ki(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),No&&e.ctrlKey&&1==t&&(t=3),t}function Ci(e,t,r){var n=e._handlers&&e._handlers[t];return r?n&&n.length>0?n.slice():Na:n||Na}function Si(e,t){function r(e){return function(){e.apply(null,o)}}var n=Ci(e,t,!1);if(n.length){var i,o=Array.prototype.slice.call(arguments,2);Uo?i=Uo.delayedCallbacks:za?i=za:(i=za=[],setTimeout(Ti,0));for(var a=0;a<n.length;++a)i.push(r(n[a]))}}function Ti(){var e=za;za=null;for(var t=0;t<e.length;++t)e[t]()}function Li(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Wa(e,r||t.type,e,t),wi(t)||t.codemirrorIgnore}function Mi(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==zi(r,t[n])&&r.push(t[n])}function _i(e,t){return Ci(e,t).length>0}function Ai(e){e.prototype.on=function(e,t){Aa(this,e,t)},e.prototype.off=function(e,t){Oa(this,e,t)}}function Ni(){this.id=null}function Oi(e){for(;Ra.length<=e;)Ra.push(Wi(Ra)+" ");return Ra[e]}function Wi(e){return e[e.length-1]}function zi(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}function Ei(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Pi(){}function Di(e,t){var r;return Object.create?r=Object.create(e):(Pi.prototype=e,r=new Pi),t&&Hi(t,r),r}function Hi(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 Ii(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Fi(e,t){return t?t.source.indexOf("\\w")>-1&&Ga(e)?!0:t.test(e):Ga(e)}function ji(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Ri(e){return e.charCodeAt(0)>=768&&qa.test(e)}function Bi(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 Ki(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Ui(e,t){return Ki(e).appendChild(t)}function Gi(){for(var e=document.activeElement;e&&e.root&&e.root.activeElement;)e=e.root.activeElement;return e}function qi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Vi(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!qi(r[n]).test(t)&&(t+=" "+r[n]);return t}function $i(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 Yi(){Qa||(Xi(),Qa=!0)}function Xi(){var e;Aa(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,$i(Ut)},100))}),Aa(window,"blur",function(){$i(vr)})}function Zi(e){if(null==$a){var t=Bi("span","​");Ui(e,Bi("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&($a=t.offsetWidth<=1&&t.offsetHeight>2&&!(bo&&8>wo))}var r=$a?Bi("span","​"):Bi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Qi(e){if(null!=Ya)return Ya;var t=Ui(e,document.createTextNode("AخA")),r=Ka(t,0,1).getBoundingClientRect();if(!r||r.left==r.right)return!1;var n=Ka(t,1,2).getBoundingClientRect();return Ya=n.right-r.right<3}function Ji(e){if(null!=nl)return nl;var t=Ui(e,Bi("span","x")),r=t.getBoundingClientRect(),n=Ka(t,0,1).getBoundingClientRect();return nl=Math.abs(r.left-n.left)>1}function eo(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<r&&a.to>t||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function to(e){return e.level%2?e.to:e.from}function ro(e){return e.level%2?e.from:e.to}function no(e){var t=ii(e);return t?to(t[0]):0}function io(e){var t=ii(e);return t?ro(Wi(t)):e.text.length}function oo(e,t){var r=Zn(e.doc,t),n=yn(r);n!=r&&(t=ti(n));var i=ii(n),o=i?i[0].level%2?io(n):no(n):0;return Ho(t,o)}function ao(e,t){for(var r,n=Zn(e.doc,t);r=mn(n);)n=r.find(1,!0).line,t=null;var i=ii(n),o=i?i[0].level%2?no(n):io(n):n.text.length;return Ho(null==t?ti(n):t,o)}function lo(e,t){var r=oo(e,t.line),n=Zn(e.doc,r.line),i=ii(n);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),a=t.line==r.line&&t.ch<=o&&t.ch;return Ho(r.line,a?0:o)}return r}function so(e,t,r){var n=e[0].level;return t==n?!0:r==n?!1:r>t}function co(e,t){ol=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 so(e,i.level,e[r].level)?(i.from!=i.to&&(ol=r),n):(i.from!=i.to&&(ol=n),r);r=n}}return r}function uo(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&Ri(e.text.charAt(t)));return t}function ho(e,t,r,n){var i=ii(e);if(!i)return fo(e,t,r,n);for(var o=co(i,t),a=i[o],l=uo(e,t,a.level%2?-r:r,n);;){if(l>a.from&&l<a.to)return l;if(l==a.from||l==a.to)return co(i,l)==o?l:(a=i[o+=r],r>0==a.level%2?a.to:a.from);if(a=i[o+=r],!a)return null;l=r>0==a.level%2?uo(e,a.to,-1,n):uo(e,a.from,1,n)}}function fo(e,t,r,n){var i=t+r;if(n)for(;i>0&&Ri(e.text.charAt(i));)i+=r;return 0>i||i>e.text.length?null:i}var po=navigator.userAgent,go=navigator.platform,mo=/gecko\/\d/i.test(po),vo=/MSIE \d/.test(po),yo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(po),bo=vo||yo,wo=bo&&(vo?document.documentMode||6:yo[1]),xo=/WebKit\//.test(po),ko=xo&&/Qt\/\d+\.\d+/.test(po),Co=/Chrome\//.test(po),So=/Opera\//.test(po),To=/Apple Computer/.test(navigator.vendor),Lo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(po),Mo=/PhantomJS/.test(po),_o=/AppleWebKit/.test(po)&&/Mobile\/\w+/.test(po),Ao=_o||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(po),No=_o||/Mac/.test(go),Oo=/win/i.test(go),Wo=So&&po.match(/Version\/(\d*\.\d*)/);Wo&&(Wo=Number(Wo[1])),Wo&&Wo>=15&&(So=!1,xo=!0);var zo=No&&(ko||So&&(null==Wo||12.11>Wo)),Eo=mo||bo&&wo>=9,Po=!1,Do=!1;g.prototype=Hi({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.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var e=No&&!Lo?"12px":"18px";
5
+ this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Ni,this.disableVert=new Ni},enableZeroWidthBar:function(e,t){function r(){var n=e.getBoundingClientRect(),i=document.elementFromPoint(n.left+1,n.bottom-1);i!=e?e.style.pointerEvents="none":t.set(1e3,r)}e.style.pointerEvents="auto",t.set(1e3,r)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},g.prototype),m.prototype=Hi({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},m.prototype),e.scrollbarModel={"native":g,"null":m},T.prototype.signal=function(e,t){_i(e,t)&&this.events.push(arguments)},T.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Wa.apply(null,this.events[e])};var Ho=e.Pos=function(e,t){return this instanceof Ho?(this.line=e,void(this.ch=t)):new Ho(e,t)},Io=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},Fo=null;re.prototype=Hi({init:function(e){function t(e){if(!Li(n,e)){if(n.somethingSelected())Fo=n.getSelections(),r.inaccurateSelection&&(r.prevInput="",r.inaccurateSelection=!1,o.value=Fo.join("\n"),Ba(o));else{if(!n.options.lineWiseCopyCut)return;var t=ee(n);Fo=t.text,"cut"==e.type?n.setSelections(t.ranges,null,Da):(r.prevInput="",o.value=t.text.join("\n"),Ba(o))}"cut"==e.type&&(n.state.cutIncoming=!0)}}var r=this,n=this.cm,i=this.wrapper=ne(),o=this.textarea=i.firstChild;e.wrapper.insertBefore(i,e.wrapper.firstChild),_o&&(o.style.width="0px"),Aa(o,"input",function(){bo&&wo>=9&&r.hasSelection&&(r.hasSelection=null),r.poll()}),Aa(o,"paste",function(e){Li(n,e)||Q(e,n)||(n.state.pasteIncoming=!0,r.fastPoll())}),Aa(o,"cut",t),Aa(o,"copy",t),Aa(e.scroller,"paste",function(t){Gt(e,t)||Li(n,t)||(n.state.pasteIncoming=!0,r.focus())}),Aa(e.lineSpace,"selectstart",function(t){Gt(e,t)||La(t)}),Aa(o,"compositionstart",function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Aa(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,r=e.doc,n=Pe(e);if(e.options.moveInputWithCursor){var i=ft(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return n},showSelection:function(e){var t=this.cm,r=t.display;Ui(r.cursorDiv,e.cursors),Ui(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=rl&&(o.to().line-o.from().line>100||(r=n.getSelection()).length>1e3);var a=t?"-":r||n.getSelection();this.textarea.value=a,n.state.focused&&Ba(this.textarea),bo&&wo>=9&&(this.hasSelection=a)}else e||(this.prevInput=this.textarea.value="",bo&&wo>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Ao||Gi()!=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(this.contextMenuPending||!e.state.focused||tl(t)&&!r&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var n=t.value;if(n==r&&!e.somethingSelected())return!1;if(bo&&wo>=9&&this.hasSelection===n||No&&/[\uf700-\uf7ff]/.test(n))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var i=n.charCodeAt(0);if(8203!=i||r||(r="​"),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(r.length,n.length);a>o&&r.charCodeAt(o)==n.charCodeAt(o);)++o;var l=this;return At(e,function(){Z(e,n.slice(o),r.length-o,null,l.composing?"*compose":null),n.length>1e3||n.indexOf("\n")>-1?t.value=l.prevInput="":l.prevInput=n,l.composing&&(l.composing.range.clear(),l.composing.range=e.markText(l.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){bo&&wo>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t="​"+(e?a.value:"");a.value="⇚",a.value=t,n.prevInput=e?"":"​",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function r(){if(n.contextMenuPending=!1,n.wrapper.style.cssText=d,a.style.cssText=u,bo&&9>wo&&o.scrollbars.setScrollTop(o.scroller.scrollTop=s),null!=a.selectionStart){(!bo||bo&&9>wo)&&t();var e=0,r=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&"​"==n.prevInput?Nt(i,ca.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,a=n.textarea,l=qt(i,e),s=o.scroller.scrollTop;if(l&&!So){var c=i.options.resetSelectionOnContextMenu;c&&-1==i.doc.sel.contains(l)&&Nt(i,Le)(i.doc,fe(l),Da);var u=a.style.cssText,d=n.wrapper.style.cssText;n.wrapper.style.cssText="position: absolute";var h=n.wrapper.getBoundingClientRect();if(a.style.cssText="position: absolute; width: 30px; height: 30px; top: "+(e.clientY-h.top-5)+"px; left: "+(e.clientX-h.left-5)+"px; z-index: 1000; background: "+(bo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",xo)var f=window.scrollY;if(o.input.focus(),xo&&window.scrollTo(null,f),o.input.reset(),i.somethingSelected()||(a.value=n.prevInput=" "),n.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),bo&&wo>=9&&t(),Eo){_a(e);var p=function(){Oa(window,"mouseup",p),setTimeout(r,20)};Aa(window,"mouseup",p)}else setTimeout(r,50)}},readOnlyChanged:function(e){e||this.reset()},setUneditable:Pi,needsContentAttribute:!1},re.prototype),ie.prototype=Hi({init:function(e){function t(e){if(!Li(n,e)){if(n.somethingSelected())Fo=n.getSelections(),"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=ee(n);Fo=t.text,"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,Da),n.replaceSelection("",null,"cut")})}if(e.clipboardData&&!_o)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Fo.join("\n"));else{var r=ne(),i=r.firstChild;n.display.lineSpace.insertBefore(r,n.display.lineSpace.firstChild),i.value=Fo.join("\n");var o=document.activeElement;Ba(i),setTimeout(function(){n.display.lineSpace.removeChild(r),o.focus()},50)}}}var r=this,n=r.cm,i=r.div=e.lineDiv;te(i),Aa(i,"paste",function(e){Li(n,e)||Q(e,n)}),Aa(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),a=o.indexOf(t,Math.max(0,i.head.ch-t.length));a>-1&&a<=i.head.ch&&(r.composing.sel=fe(Ho(i.head.line,a),Ho(i.head.line,a+t.length)))}}),Aa(i,"compositionupdate",function(e){r.composing.data=e.data}),Aa(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))}),Aa(i,"touchstart",function(){r.forceCompositionEnd()}),Aa(i,"input",function(){r.composing||!n.isReadOnly()&&r.pollContent()||At(r.cm,function(){Pt(n)})}),Aa(i,"copy",t),Aa(i,"cut",t)},prepareSelection:function(){var e=Pe(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!=Io(Y(r,n),t.from())||0!=Io($(r,n),t.to())){var i=oe(this.cm,t.from()),o=oe(this.cm,t.to());if(i||o){var a=this.cm.display.view,l=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var s=a[a.length-1].measure,c=s.maps?s.maps[s.maps.length-1]:s.map;o={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}}}else i={node:a[0].measure.map[2],offset:0};try{var u=Ka(i.node,i.offset,o.offset,o.node)}catch(d){}u&&(!mo&&this.cm.state.focused?(e.collapse(i.node,i.offset),u.collapsed||e.addRange(u)):(e.removeAllRanges(),e.addRange(u)),l&&null==e.anchorNode?e.addRange(l):mo&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){Ui(this.cm.display.cursorDiv,e.cursors),Ui(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 Va(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():At(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var r=le(t,e.anchorNode,e.anchorOffset),n=le(t,e.focusNode,e.focusOffset);r&&n&&At(t,function(){Le(t.doc,fe(r,n),Da),(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=It(e,n.line)))var a=ti(t.view[0].line),l=t.view[0].node;else var a=ti(t.view[o].line),l=t.view[o-1].node.nextSibling;var s=It(e,i.line);if(s==t.view.length-1)var c=t.viewTo-1,u=t.lineDiv.lastChild;else var c=ti(t.view[s+1].line)-1,u=t.view[s+1].node.previousSibling;for(var d=e.doc.splitLines(ce(e,l,u,a,c)),h=Qn(e.doc,Ho(a,0),Ho(c,Zn(e.doc,c).text.length));d.length>1&&h.length>1;)if(Wi(d)==Wi(h))d.pop(),h.pop(),c--;else{if(d[0]!=h[0])break;d.shift(),h.shift(),a++}for(var f=0,p=0,g=d[0],m=h[0],v=Math.min(g.length,m.length);v>f&&g.charCodeAt(f)==m.charCodeAt(f);)++f;for(var y=Wi(d),b=Wi(h),w=Math.min(y.length-(1==d.length?f:0),b.length-(1==h.length?f:0));w>p&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;d[d.length-1]=y.slice(0,y.length-p),d[0]=d[0].slice(f);var x=Ho(a,f),k=Ho(c,h.length?Wi(h).length-p:0);return d.length>1||d[0]||Io(x,k)?(Or(e.doc,d,x,k,"+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){this.cm.isReadOnly()?Nt(this.cm,Pt)(this.cm):e.data&&e.data!=e.startData&&Nt(this.cm,Z)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.contentEditable="false"},onKeyPress:function(e){e.preventDefault(),this.cm.isReadOnly()||Nt(this.cm,Z)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},readOnlyChanged:function(e){this.div.contentEditable=String("nocursor"!=e)},onContextMenu:Pi,resetPosition:Pi,needsContentAttribute:!0},ie.prototype),e.inputStyles={textarea:re,contenteditable:ie},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!=Io(r.anchor,n.anchor)||0!=Io(r.head,n.head))return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new de(V(this.ranges[t].anchor),V(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(Io(t,n.from())>=0&&Io(e,n.to())<=0)return r}return-1}},de.prototype={from:function(){return Y(this.anchor,this.head)},to:function(){return $(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var jo,Ro,Bo,Ko={left:0,right:0,top:0,bottom:0},Uo=null,Go=0,qo=0,Vo=0,$o=null;bo?$o=-.53:mo?$o=15:Co?$o=-.7:To&&($o=-1/3);var Yo=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=Yo(e);return t.x*=$o,t.y*=$o,t};var Xo=new Ni,Zo=null,Qo=e.changeEnd=function(e){return e.text?Ho(e.from.line+e.text.length-1,Wi(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,ea.hasOwnProperty(e)&&Nt(this,ea[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"](qr(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:Ot(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++,Pt(this)}),removeOverlay:Ot(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 Pt(this)}}),indentLine:Ot(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)&&Fr(this,e,t,r)}),indentSelection:Ot(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&&(Fr(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&Hr(this));else{var o=i.from(),a=i.to(),l=Math.max(r,o.line);r=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=l;r>s;++s)Fr(this,s,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[n].from().ch>0&&ke(this.doc,n,new de(o,c[n].to()),Da)}}}),getTokenAt:function(e,t){return Wn(this,e,t)},getLineTokens:function(e,t){return Wn(this,Ho(e),t,!0)},getTokenTypeAt:function(e){e=ge(this.doc,e);var t,r=Pn(this,Zn(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var a=n+i>>1;if((a?r[2*a-1]:0)>=o)i=a;else{if(!(r[2*a+1]<o)){t=r[2*a+2];break}n=a+1}}var l=t?t.indexOf("cm-overlay "):-1;return 0>l?t:0==l?null:t.slice(0,l-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!aa.hasOwnProperty(t))return r;var n=aa[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 a=n[i[t][o]];a&&r.push(a)}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 l=n._global[o];l.pred(i,this)&&-1==zi(r,l.val)&&r.push(l.val)}return r},getStateAfter:function(e,t){var r=this.doc;return e=pe(r,null==e?r.first+r.size-1:e),Be(this,e+1,t)},cursorCoords:function(e,t){var r,n=this.doc.sel.primary();return r=null==e?n.head:"object"==typeof e?ge(this.doc,e):e?n.from():n.to(),ft(this,r,t||"page")},charCoords:function(e,t){return ht(this,ge(this.doc,e),t||"page")},coordsChar:function(e,t){return e=dt(this,e,t||"page"),mt(this,e.left,e.top)},lineAtHeight:function(e,t){return e=dt(this,{top:e,left:0},t||"page").top,ri(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var r,n=!1;if("number"==typeof e){var i=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>i&&(e=i,n=!0),r=Zn(this.doc,e)}else r=e;return ut(this,r,{top:0,left:0},t||"page").top+(n?this.doc.height-ni(r):0)},defaultTextHeight:function(){return yt(this.display)},defaultCharWidth:function(){return bt(this.display)},setGutterMarker:Ot(function(e,t,r){return jr(this.doc,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&ji(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Ot(function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,Dt(t,n,"gutter"),ji(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),lineInfo:function(e){if("number"==typeof e){if(!ve(this.doc,e))return null;var t=e;if(e=Zn(this.doc,e),!e)return null}else{var t=ti(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=ft(this,ge(this.doc,e));var a=e.bottom,l=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)a=e.top;else if("above"==n||"near"==n){var s=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>c&&(l=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),r&&Er(this,l,a,l+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:Ot(dr),triggerOnKeyPress:Ot(pr),triggerOnKeyUp:fr,execCommand:function(e){return ca.hasOwnProperty(e)?ca[e].call(null,this):void 0},triggerElectric:Ot(function(e){J(this,e)}),findPosH:function(e,t,r,n){var i=1;0>t&&(i=-1,t=-t);for(var o=0,a=ge(this.doc,e);t>o&&(a=Br(this.doc,a,i,r,n),!a.hitSide);++o);return a},moveH:Ot(function(e,t){var r=this;r.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?Br(r.doc,n.head,e,t,r.options.rtlMoveVisually):0>e?n.from():n.to()},Ia)}),deleteH:Ot(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Rr(this,function(r){var i=Br(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 a=0,l=ge(this.doc,e);t>a;++a){var s=ft(this,l,"div");if(null==o?o=s.left:s.left=o,l=Kr(this,s,i,r),l.hitSide)break}return l},moveV:Ot(function(e,t){var r=this,n=this.doc,i=[],o=!r.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(a){if(o)return 0>e?a.from():a.to();var l=ft(r,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left);var s=Kr(r,l,e,t);return"page"==t&&a==n.sel.primary()&&Dr(r,null,ht(r,s,"div").top-l.top),s},Ia),i.length)for(var a=0;a<n.sel.ranges.length;a++)n.sel.ranges[a].goalColumn=i[a]}),findWordAt:function(e){var t=this.doc,r=Zn(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 a=r.charAt(n),l=Fi(a,o)?function(e){return Fi(e,o)}:/\s/.test(a)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Fi(e)};n>0&&l(r.charAt(n-1));)--n;for(;i<r.length&&l(r.charAt(i));)++i}return new de(Ho(e.line,n),Ho(e.line,i))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?Za(this.display.cursorDiv,"CodeMirror-overwrite"):Xa(this.display.cursorDiv,"CodeMirror-overwrite"),Wa(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==Gi()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Ot(function(e,t){null==e&&null==t||Ir(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-qe(this)-this.display.barHeight,width:e.scrollWidth-qe(this)-this.display.barWidth,clientHeight:$e(this),clientWidth:Ve(this)}},scrollIntoView:Ot(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:Ho(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)Ir(this),this.curOp.scrollToPos=e;else{var r=Pr(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:Ot(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&&at(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){Dt(n,i,"widget");break}++i}),n.curOp.forceUpdate=!0,Wa(n,"refresh",this)}),operation:function(e){return At(this,e)},refresh:Ot(function(){var e=this.display.cachedTextHeight;Pt(this),this.curOp.forceUpdate=!0,lt(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),u(this),(null==e||Math.abs(e-yt(this.display))>.5)&&a(this),Wa(this,"refresh",this)}),swapDoc:Ot(function(e){var t=this.doc;return t.cm=null,Xn(this,e),lt(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Si(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}},Ai(e);var Jo=e.defaults={},ea=e.optionHandlers={},ta=e.Init={toString:function(){return"CodeMirror.Init"}};Ur("value","",function(e,t){e.setValue(t)},!0),Ur("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),Ur("indentUnit",2,r,!0),Ur("indentWithTabs",!1),Ur("smartIndent",!0),Ur("tabSize",4,function(e){n(e),lt(e),Pt(e)},!0),Ur("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,r.push(Ho(n,o))}n++});for(var i=r.length-1;i>=0;i--)Or(e.doc,t,r[i],Ho(r[i].line,r[i].ch+t.length))}}),Ur("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,r,n){t.state.specialChars=new RegExp(r.source+(r.test(" ")?"":"| "),"g"),n!=e.Init&&t.refresh()}),Ur("specialCharPlaceholder",Fn,function(e){e.refresh()},!0),Ur("electricChars",!0),Ur("inputStyle",Ao?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Ur("rtlMoveVisually",!Oo),Ur("wholeLineUpdateBefore",!0),Ur("theme","default",function(e){l(e),s(e)},!0),Ur("keyMap","default",function(t,r,n){var i=qr(r),o=n!=e.Init&&qr(n);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),Ur("extraKeys",null),Ur("lineWrapping",!1,i,!0),Ur("gutters",[],function(e){f(e.options),s(e)},!0),Ur("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?S(e.display)+"px":"0",e.refresh()},!0),Ur("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),Ur("scrollbarStyle","native",function(e){v(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Ur("lineNumbers",!1,function(e){f(e.options),s(e)},!0),Ur("firstLineNumber",1,s,!0),Ur("lineNumberFormatter",function(e){return e},s,!0),Ur("showCursorWhenSelecting",!1,Ee,!0),Ur("resetSelectionOnContextMenu",!0),Ur("lineWiseCopyCut",!0),Ur("readOnly",!1,function(e,t){"nocursor"==t?(vr(e),e.display.input.blur(),e.display.disabled=!0):e.display.disabled=!1,e.display.input.readOnlyChanged(t)}),Ur("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Ur("dragDrop",!0,Kt),Ur("allowDropFileTypes",null),Ur("cursorBlinkRate",530),Ur("cursorScrollMargin",0),Ur("cursorHeight",1,Ee,!0),Ur("singleCursorHeightPerLine",!0,Ee,!0),Ur("workTime",100),Ur("workDelay",100),Ur("flattenSpans",!0,n,!0),Ur("addModeClass",!1,n,!0),Ur("pollInterval",100),Ur("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),Ur("historyEventDelay",1250),Ur("viewportMargin",10,function(e){e.refresh()},!0),Ur("maxHighlightLength",1e4,n,!0),Ur("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Ur("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),Ur("autofocus",null);var ra=e.modes={},na=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)),ra[t]=r},e.defineMIME=function(e,t){na[e]=t},e.resolveMode=function(t){if("string"==typeof t&&na.hasOwnProperty(t))t=na[t];else if(t&&"string"==typeof t.name&&na.hasOwnProperty(t.name)){var r=na[t.name];"string"==typeof r&&(r={name:r}),t=Di(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=ra[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if(ia.hasOwnProperty(r.name)){var o=ia[r.name];for(var a in o)o.hasOwnProperty(a)&&(i.hasOwnProperty(a)&&(i["_"+a]=i[a]),i[a]=o[a])}if(i.name=r.name,r.helperType&&(i.helperType=r.helperType),r.modeProps)for(var a in r.modeProps)i[a]=r.modeProps[a];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var ia=e.modeExtensions={};e.extendMode=function(e,t){var r=ia.hasOwnProperty(e)?ia[e]:ia[e]={};Hi(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){Ca.prototype[e]=t},e.defineOption=Ur;var oa=[];e.defineInitHook=function(e){oa.push(e)};var aa=e.helpers={};e.registerHelper=function(t,r,n){aa.hasOwnProperty(t)||(aa[t]=e[t]={_global:[]}),aa[t][r]=n},e.registerGlobalHelper=function(t,r,n,i){e.registerHelper(t,r,i),aa[t]._global.push({pred:n,val:i})};var la=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},sa=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 ca=e.commands={selectAll:function(e){e.setSelection(Ho(e.firstLine(),0),Ho(e.lastLine()),Da)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Da)},killLine:function(e){Rr(e,function(t){if(t.empty()){var r=Zn(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:Ho(t.head.line+1,0)}:{from:t.head,to:Ho(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){Rr(e,function(t){return{from:Ho(t.from().line,0),to:ge(e.doc,Ho(t.to().line+1,0))}})},delLineLeft:function(e){Rr(e,function(e){return{from:Ho(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){Rr(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){Rr(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(Ho(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(Ho(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return oo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){return lo(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){e.extendSelectionsBy(function(t){return ao(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")},Ia)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},Ia)},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/)?lo(e,t.head):n},Ia)},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(),a=Fa(e.getLine(o.line),o.ch,n);t.push(new Array(n-a%n+1).join(" "))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){At(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){var i=t[n].head,o=Zn(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new Ho(i.line,i.ch-1)),i.ch>0)i=new Ho(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),Ho(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Zn(e.doc,i.line-1).text;a&&e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),Ho(i.line-1,a.length-1),Ho(i.line,1),"+transpose");
6
+ }r.push(new de(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){At(e,function(){for(var t=e.listSelections().length,r=0;t>r;r++){var n=e.listSelections()[r];e.replaceRange(e.doc.lineSeparator(),n.anchor,n.head,"+input"),e.indentLine(n.from().line+1,null,!0)}Hr(e)})},toggleOverwrite:function(e){e.toggleOverwrite()}},ua=e.keyMap={};ua.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"},ua.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"},ua.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"},ua.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"]},ua["default"]=No?ua.macDefault:ua.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=Ei(r.split(" "),Gr),o=0;o<i.length;o++){var a,l;o==i.length-1?(l=i.join(" "),a=n):(l=i.slice(0,o+1).join(" "),a="...");var s=t[l];if(s){if(s!=a)throw new Error("Inconsistent bindings for "+l)}else t[l]=a}delete e[r]}for(var c in t)e[c]=t[c];return e};var da=e.lookupKey=function(e,t,r,n){t=qr(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 da(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var a=da(e,t.fallthrough[o],r,n);if(a)return a}}},ha=e.isModifierKey=function(e){var t="string"==typeof e?e:il[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},fa=e.keyName=function(e,t){if(So&&34==e.keyCode&&e["char"])return!1;var r=il[e.keyCode],n=r;return null==n||e.altGraphKey?!1:(e.altKey&&"Alt"!=r&&(n="Alt-"+n),(zo?e.metaKey:e.ctrlKey)&&"Ctrl"!=r&&(n="Ctrl-"+n),(zo?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=c.getValue()}if(r=r?Hi(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=Gi();r.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(Aa(t.form,"submit",n),!r.leaveSubmitMethodAlone)){var o=t.form,a=o.submit;try{var l=o.submit=function(){n(),o.submit=a,o.submit(),o.submit=l}}catch(s){}}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&&(Oa(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=a))}},t.style.display="none";var c=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},r);return c};var pa=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};pa.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=Fa(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Fa(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Fa(this.string,null,this.tabSize)-(this.lineStart?Fa(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 ga=0,ma=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ga};Ai(ma),ma.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&wt(e),_i(this,"clear")){var r=this.find();r&&Si(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],l=Jr(a.markedSpans,this);e&&!this.collapsed?Dt(e,ti(a),"text"):e&&(null!=l.to&&(i=ti(a)),null!=l.from&&(n=ti(a))),a.markedSpans=en(a.markedSpans,l),null==l.from&&this.collapsed&&!kn(this.doc,a)&&e&&ei(a,yt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var s=yn(this.lines[o]),c=d(s);c>e.display.maxLineLength&&(e.display.maxLine=s,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&Pt(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ae(e.doc)),e&&Si(e,"markerCleared",e,this),t&&kt(e),this.parent&&this.parent.clear()}},ma.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],a=Jr(o.markedSpans,this);if(null!=a.from&&(r=Ho(t?o:ti(o),a.from),-1==e))return r;if(null!=a.to&&(n=Ho(t?o:ti(o),a.to),1==e))return n}return r&&{from:r,to:n}},ma.prototype.changed=function(){var e=this.find(-1,!0),t=this,r=this.doc.cm;e&&r&&At(r,function(){var n=e.line,i=ti(e.line),o=Je(r,i);if(o&&(ot(o),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!kn(t.doc,n)&&null!=t.height){var a=t.height;t.height=null;var l=Tn(t)-a;l&&ei(n,n.height+l)}})},ma.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=zi(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ma.prototype.detachLine=function(e){if(this.lines.splice(zi(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var ga=0,va=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};Ai(va),va.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Si(this,"clear")}},va.prototype.find=function(e,t){return this.primary.find(e,t)};var ya=e.LineWidget=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};Ai(ya),ya.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=ti(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=Tn(this);ei(r,Math.max(0,r.height-o)),e&&At(e,function(){Sn(e,r,-o),Dt(e,n,"widget")})}},ya.prototype.changed=function(){var e=this.height,t=this.doc.cm,r=this.line;this.height=null;var n=Tn(this)-e;n&&(ei(r,r.height+n),t&&At(t,function(){t.curOp.forceUpdate=!0,Sn(t,r,n)}))};var ba=e.Line=function(e,t,r){this.text=e,un(this,t),this.height=r?r(this):1};Ai(ba),ba.prototype.lineNo=function(){return ti(this)};var wa={},xa={};Vn.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,_n(i),Si(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}},$n.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),a=n.height;if(n.removeInner(e,o),this.height-=a-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Vn))){var l=[];this.collapse(l),this.children=[new Vn(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(o>=e){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(;i.lines.length>50;){var a=i.lines.splice(i.lines.length-25,25),l=new Vn(a);i.height-=l.height,this.children.splice(n+1,0,l),l.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 $n(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=zi(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new $n(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 a=Math.min(t,o-e);if(i.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var ka=0,Ca=e.Doc=function(e,t,r,n){if(!(this instanceof Ca))return new Ca(e,t,r,n);null==r&&(r=0),$n.call(this,[new Vn([new ba("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var i=Ho(r,0);this.sel=fe(i),this.history=new oi(null),this.id=++ka,this.modeOption=t,this.lineSep=n,this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),qn(this,{from:i,to:i,text:e}),Le(this,fe(i),Da)};Ca.prototype=Di($n.prototype,{constructor:Ca,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=Jn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Wt(function(e){var t=Ho(this.first,0),r=this.first+this.size-1;Tr(this,{from:t,to:Ho(r,Zn(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),Le(this,fe(t))}),replaceRange:function(e,t,r,n){t=ge(this,t),r=r?ge(this,r):t,Or(this,e,t,r,n)},getRange:function(e,t,r){var n=Qn(this,ge(this,e),ge(this,t));return r===!1?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){return ve(this,e)?Zn(this,e):void 0},getLineNumber:function(e){return ti(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Zn(this,e)),yn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ge(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:Wt(function(e,t,r){Ce(this,ge(this,"number"==typeof e?Ho(e,t||0):e),null,r)}),setSelection:Wt(function(e,t,r){Ce(this,ge(this,e),ge(this,t||e),r)}),extendSelection:Wt(function(e,t,r){we(this,ge(this,e),t&&ge(this,t),r)}),extendSelections:Wt(function(e,t){xe(this,ye(this,e),t)}),extendSelectionsBy:Wt(function(e,t){var r=Ei(this.sel.ranges,e);xe(this,ye(this,r),t)}),setSelections:Wt(function(e,t,r){if(e.length){for(var n=0,i=[];n<e.length;n++)i[n]=new de(ge(this,e[n].anchor),ge(this,e[n].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Le(this,he(i,t),r)}}),addSelection:Wt(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new de(ge(this,e),ge(this,t||e))),Le(this,he(n,n.length-1),r)}),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=Qn(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return e===!1?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=Qn(this,r[n].from(),r[n].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:Wt(function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];n[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:r}}for(var l=t&&"end"!=t&&Cr(this,n,t),o=n.length-1;o>=0;o--)Tr(this,n[o]);l?Te(this,l):this.cm&&Hr(this.cm)}),undo:Wt(function(){Mr(this,"undo")}),redo:Wt(function(){Mr(this,"redo")}),undoSelection:Wt(function(){Mr(this,"undo",!0)}),redoSelection:Wt(function(){Mr(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 oi(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:mi(this.history.done),undone:mi(this.history.undone)}},setHistory:function(e){var t=this.history=new oi(this.history.maxGeneration);t.done=mi(e.done.slice(0),null,!0),t.undone=mi(e.undone.slice(0),null,!0)},addLineClass:Wt(function(e,t,r){return jr(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(qi(r).test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0})}),removeLineClass:Wt(function(e,t,r){return jr(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(qi(r));if(!o)return!1;var a=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0})}),addLineWidget:Wt(function(e,t,r){return Ln(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return Vr(this,ge(this,e),ge(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ge(this,e),Vr(this,e,e,r,"bookmark")},findMarksAt:function(e){e=ge(this,e);var t=[],r=Zn(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=ge(this,e),t=ge(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;l<a.length;l++){var s=a[l];i==e.line&&e.ch>s.to||null==s.from&&i!=e.line||i==t.line&&s.from>t.ch||r&&!r(s.marker)||n.push(s.marker.parent||s.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first;return this.iter(function(n){var i=n.text.length+1;return i>e?(t=e,!0):(e-=i,void++r)}),ge(this,Ho(r,t))},indexFromPos:function(e){e=ge(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 Ca(Jn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep);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 Ca(Jn(this,t,r),e.mode||this.modeOption,t,this.lineSep);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}],Xr(n,Yr(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),Zr(Yr(this));break}}if(t.history==this.history){var i=[t.id];Yn(t,function(e){i.push(e.id)},!0),t.history=new oi(null),t.history.done=mi(this.history.done,i),t.history.undone=mi(this.history.undone,i)}},iterLinkedDocs:function(e){Yn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):el(e)},lineSeparator:function(){return this.lineSep||"\n"}}),Ca.prototype.eachLine=Ca.prototype.iter;var Sa="iter insert remove copy getEditor constructor".split(" ");for(var Ta in Ca.prototype)Ca.prototype.hasOwnProperty(Ta)&&zi(Sa,Ta)<0&&(e.prototype[Ta]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ca.prototype[Ta]));Ai(Ca);var La=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},Ma=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},_a=e.e_stop=function(e){La(e),Ma(e)},Aa=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)}},Na=[],Oa=e.off=function(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else for(var n=Ci(e,t,!1),i=0;i<n.length;++i)if(n[i]==r){n.splice(i,1);break}},Wa=e.signal=function(e,t){var r=Ci(e,t,!0);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)},za=null,Ea=30,Pa=e.Pass={toString:function(){return"CodeMirror.Pass"}},Da={scroll:!1},Ha={origin:"*mouse"},Ia={origin:"+move"};Ni.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Fa=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,a=i||0;;){var l=e.indexOf(" ",o);if(0>l||l>=t)return a+(t-o);a+=l-o,a+=r-a%r,o=l+1}},ja=e.findColumn=function(e,t,r){for(var n=0,i=0;;){var o=e.indexOf(" ",n);-1==o&&(o=e.length);var a=o-n;if(o==e.length||i+a>=t)return n+Math.min(a,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}},Ra=[""],Ba=function(e){e.select()};_o?Ba=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:bo&&(Ba=function(e){try{e.select()}catch(t){}});var Ka,Ua=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ga=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Ua.test(e))},qa=/[\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]/;Ka=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 Va=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)};bo&&11>wo&&(Gi=function(){try{return document.activeElement}catch(e){return document.body}});var $a,Ya,Xa=e.rmClass=function(e,t){var r=e.className,n=qi(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:"")}},Za=e.addClass=function(e,t){var r=e.className;qi(t).test(r)||(e.className+=(r?" ":"")+t)},Qa=!1,Ja=function(){if(bo&&9>wo)return!1;var e=Bi("div");return"draggable"in e||"dragDrop"in e}(),el=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),a=o.indexOf("\r");-1!=a?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},tl=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},rl=function(){var e=Bi("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),nl=null,il=e.keyNames={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",106:"*",107:"=",109:"-",110:".",111:"/",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"};!function(){for(var e=0;10>e;e++)il[e+48]=il[e+96]=String(e);for(var e=65;90>=e;e++)il[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)il[e+111]=il[e+63235]="F"+e}();var ol,al=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]/,a=/[LRr]/,l=/[Lb1n]/,s=/[1n]/,c="L";return function(r){if(!i.test(r))return!1;for(var n,u=r.length,d=[],h=0;u>h;++h)d.push(n=e(r.charCodeAt(h)));for(var h=0,f=c;u>h;++h){var n=d[h];"m"==n?d[h]=f:f=n}for(var h=0,p=c;u>h;++h){var n=d[h];"1"==n&&"r"==p?d[h]="n":a.test(n)&&(p=n,"r"==n&&(d[h]="R"))}for(var h=1,f=d[0];u-1>h;++h){var n=d[h];"+"==n&&"1"==f&&"1"==d[h+1]?d[h]="1":","!=n||f!=d[h+1]||"1"!=f&&"n"!=f||(d[h]=f),f=n}for(var h=0;u>h;++h){var n=d[h];if(","==n)d[h]="N";else if("%"==n){for(var g=h+1;u>g&&"%"==d[g];++g);for(var m=h&&"!"==d[h-1]||u>g&&"1"==d[g]?"1":"N",v=h;g>v;++v)d[v]=m;h=g-1}}for(var h=0,p=c;u>h;++h){var n=d[h];"L"==p&&"1"==n?d[h]="L":a.test(n)&&(p=n)}for(var h=0;u>h;++h)if(o.test(d[h])){for(var g=h+1;u>g&&o.test(d[g]);++g);for(var y="L"==(h?d[h-1]:c),b="L"==(u>g?d[g]:c),m=y||b?"L":"R",v=h;g>v;++v)d[v]=m;h=g-1}for(var w,x=[],h=0;u>h;)if(l.test(d[h])){var k=h;for(++h;u>h&&l.test(d[h]);++h);x.push(new t(0,k,h))}else{var C=h,S=x.length;for(++h;u>h&&"L"!=d[h];++h);for(var v=C;h>v;)if(s.test(d[v])){v>C&&x.splice(S,0,new t(1,C,v));var T=v;for(++v;h>v&&s.test(d[v]);++v);x.splice(S,0,new t(2,T,v)),C=v}else++v;h>C&&x.splice(S,0,new t(1,C,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==Wi(x).level&&(w=r.match(/\s+$/))&&(Wi(x).to-=w[0].length,x.push(new t(0,u-w[0].length,u))),2==x[0].level&&x.unshift(new t(1,x[0].to,x[0].to)),x[0].level!=Wi(x).level&&x.push(new t(x[0].level,u,u)),x}}();return e.version="5.12.0",e})},{}],17:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=!0;return t}function r(e,t){for(var r,n=!1;null!=(r=e.next());){if(n&&"/"==r){t.tokenize=null;break}n="*"==r}return["comment","comment"]}e.defineMode("css",function(t,r){function n(e,t){return p=t,e}function i(e,t){var r=e.next();if(v[r]){var i=v[r](e,t);if(i!==!1)return i}return"@"==r?(e.eatWhile(/[\w\\\-]/),n("def",e.current())):"="==r||("~"==r||"|"==r)&&e.eat("=")?n(null,"compare"):'"'==r||"'"==r?(t.tokenize=o(r),t.tokenize(e,t)):"#"==r?(e.eatWhile(/[\w\\\-]/),n("atom","hash")):"!"==r?(e.match(/^\s*\w*/),n("keyword","important")):/\d/.test(r)||"."==r&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),n("number","unit")):"-"!==r?/[,+>*\/]/.test(r)?n(null,"select-op"):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?n("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?n(null,r):"u"==r&&e.match(/rl(-prefix)?\(/)||"d"==r&&e.match("omain(")||"r"==r&&e.match("egexp(")?(e.backUp(1),t.tokenize=a,n("property","word")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),n("property","word")):n(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),n("number","unit")):e.match(/^-[\w\\\-]+/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?n("variable-2","variable-definition"):n("variable-2","variable")):e.match(/^\w+-/)?n("meta","meta"):void 0}function o(e){return function(t,r){for(var i,o=!1;null!=(i=t.next());){if(i==e&&!o){")"==e&&t.backUp(1);break}o=!o&&"\\"==i}return(i==e||!o&&")"!=e)&&(r.tokenize=null),n("string","string")}}function a(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=o(")"),n(null,"(")}function l(e,t,r){this.type=e,this.indent=t,this.prev=r}function s(e,t,r,n){return e.context=new l(r,t.indentation()+(n===!1?0:m),e.context),r}function c(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function u(e,t,r){return N[r.context.type](e,t,r)}function d(e,t,r,n){for(var i=n||1;i>0;i--)r.context=r.context.prev;return u(e,t,r)}function h(e){var t=e.current().toLowerCase();g=M.hasOwnProperty(t)?"atom":L.hasOwnProperty(t)?"keyword":"variable"}var f=r.inline;r.propertyKeywords||(r=e.resolveMode("text/css"));var p,g,m=t.indentUnit,v=r.tokenHooks,y=r.documentTypes||{},b=r.mediaTypes||{},w=r.mediaFeatures||{},x=r.mediaValueKeywords||{},k=r.propertyKeywords||{},C=r.nonStandardPropertyKeywords||{},S=r.fontProperties||{},T=r.counterDescriptors||{},L=r.colorKeywords||{},M=r.valueKeywords||{},_=r.allowNested,A=r.supportsAtComponent===!0,N={};return N.top=function(e,t,r){if("{"==e)return s(r,t,"block");if("}"==e&&r.context.prev)return c(r);if(A&&/@component/.test(e))return s(r,t,"atComponentBlock");if(/^@(-moz-)?document$/.test(e))return s(r,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/.test(e))return s(r,t,"atBlock");if(/^@(font-face|counter-style)/.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return s(r,t,"at");if("hash"==e)g="builtin";else if("word"==e)g="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return s(r,t,"interpolation");if(":"==e)return"pseudo";if(_&&"("==e)return s(r,t,"parens")}return r.context.type},N.block=function(e,t,r){if("word"==e){var n=t.current().toLowerCase();return k.hasOwnProperty(n)?(g="property","maybeprop"):C.hasOwnProperty(n)?(g="string-2","maybeprop"):_?(g=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(g+=" error","maybeprop")}return"meta"==e?"block":_||"hash"!=e&&"qualifier"!=e?N.top(e,t,r):(g="error","block")},N.maybeprop=function(e,t,r){return":"==e?s(r,t,"prop"):u(e,t,r)},N.prop=function(e,t,r){if(";"==e)return c(r);if("{"==e&&_)return s(r,t,"propBlock");if("}"==e||"{"==e)return d(e,t,r);if("("==e)return s(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if("word"==e)h(t);else if("interpolation"==e)return s(r,t,"interpolation");
7
+ }else g+=" error";return"prop"},N.propBlock=function(e,t,r){return"}"==e?c(r):"word"==e?(g="property","maybeprop"):r.context.type},N.parens=function(e,t,r){return"{"==e||"}"==e?d(e,t,r):")"==e?c(r):"("==e?s(r,t,"parens"):"interpolation"==e?s(r,t,"interpolation"):("word"==e&&h(t),"parens")},N.pseudo=function(e,t,r){return"word"==e?(g="variable-3",r.context.type):u(e,t,r)},N.documentTypes=function(e,t,r){return"word"==e&&y.hasOwnProperty(t.current())?(g="tag",r.context.type):N.atBlock(e,t,r)},N.atBlock=function(e,t,r){if("("==e)return s(r,t,"atBlock_parens");if("}"==e||";"==e)return d(e,t,r);if("{"==e)return c(r)&&s(r,t,_?"block":"top");if("interpolation"==e)return s(r,t,"interpolation");if("word"==e){var n=t.current().toLowerCase();g="only"==n||"not"==n||"and"==n||"or"==n?"keyword":b.hasOwnProperty(n)?"attribute":w.hasOwnProperty(n)?"property":x.hasOwnProperty(n)?"keyword":k.hasOwnProperty(n)?"property":C.hasOwnProperty(n)?"string-2":M.hasOwnProperty(n)?"atom":L.hasOwnProperty(n)?"keyword":"error"}return r.context.type},N.atComponentBlock=function(e,t,r){return"}"==e?d(e,t,r):"{"==e?c(r)&&s(r,t,_?"block":"top",!1):("word"==e&&(g="error"),r.context.type)},N.atBlock_parens=function(e,t,r){return")"==e?c(r):"{"==e||"}"==e?d(e,t,r,2):N.atBlock(e,t,r)},N.restricted_atBlock_before=function(e,t,r){return"{"==e?s(r,t,"restricted_atBlock"):"word"==e&&"@counter-style"==r.stateArg?(g="variable","restricted_atBlock_before"):u(e,t,r)},N.restricted_atBlock=function(e,t,r){return"}"==e?(r.stateArg=null,c(r)):"word"==e?(g="@font-face"==r.stateArg&&!S.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==r.stateArg&&!T.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},N.keyframes=function(e,t,r){return"word"==e?(g="variable","keyframes"):"{"==e?s(r,t,"top"):u(e,t,r)},N.at=function(e,t,r){return";"==e?c(r):"{"==e||"}"==e?d(e,t,r):("word"==e?g="tag":"hash"==e&&(g="builtin"),"at")},N.interpolation=function(e,t,r){return"}"==e?c(r):"{"==e||";"==e?d(e,t,r):("word"==e?g="variable":"variable"!=e&&"("!=e&&")"!=e&&(g="error"),"interpolation")},{startState:function(e){return{tokenize:null,state:f?"block":"top",stateArg:null,context:new l(f?"block":"top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||i)(e,t);return r&&"object"==typeof r&&(p=r[1],r=r[0]),g=r,t.state=N[t.state](p,e,t),g},indent:function(e,t){var r=e.context,n=t&&t.charAt(0),i=r.indent;return"prop"!=r.type||"}"!=n&&")"!=n||(r=r.prev),r.prev&&("}"!=n||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"restricted_atBlock"!=r.type?(")"!=n||"parens"!=r.type&&"atBlock_parens"!=r.type)&&("{"!=n||"at"!=r.type&&"atBlock"!=r.type)||(i=Math.max(0,r.indent-m),r=r.prev):(r=r.prev,i=r.indent)),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var n=["domain","regexp","url","url-prefix"],i=t(n),o=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],a=t(o),l=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],s=t(l),c=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],u=t(c),d=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],h=t(d),f=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],p=t(f),g=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],m=t(g),v=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],y=t(v),b=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],w=t(b),x=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],k=t(x),C=n.concat(o).concat(l).concat(c).concat(d).concat(f).concat(b).concat(x);e.registerHelper("hintWords","css",C),e.defineMIME("text/css",{documentTypes:i,mediaTypes:a,mediaFeatures:s,mediaValueKeywords:u,propertyKeywords:h,nonStandardPropertyKeywords:p,fontProperties:m,counterDescriptors:y,colorKeywords:w,valueKeywords:k,tokenHooks:{"/":function(e,t){return e.eat("*")?(t.tokenize=r,r(e,t)):!1}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:a,mediaFeatures:s,mediaValueKeywords:u,propertyKeywords:h,nonStandardPropertyKeywords:p,colorKeywords:w,valueKeywords:k,fontProperties:m,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},":":function(e){return e.match(/\s*\{/)?[null,"{"]:!1},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return e.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:a,mediaFeatures:s,mediaValueKeywords:u,propertyKeywords:h,nonStandardPropertyKeywords:p,colorKeywords:w,valueKeywords:k,fontProperties:m,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)?!1:(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),e.defineMIME("text/x-gss",{documentTypes:i,mediaTypes:a,mediaFeatures:s,propertyKeywords:h,nonStandardPropertyKeywords:p,fontProperties:m,counterDescriptors:y,colorKeywords:w,valueKeywords:k,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return e.eat("*")?(t.tokenize=r,r(e,t)):!1}},name:"css",helperType:"gss"})})},{"../../lib/codemirror":16}],18:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror"),e("../xml/xml"),e("../javascript/javascript"),e("../css/css")):"function"==typeof t&&t.amd?t(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],i):i(CodeMirror)}(function(e){"use strict";function t(e,t,r){var n=e.current(),i=n.search(t);return i>-1?e.backUp(n.length-i):n.match(/<\/?$/)&&(e.backUp(n.length),e.match(t,!1)||e.match(n)),r}function r(e){var t=s[e];return t?t:s[e]=new RegExp("\\s+"+e+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")}function n(e,t){var n=e.match(r(t));return n?n[2]:""}function i(e,t){return new RegExp((t?"^":"")+"</s*"+e+"s*>","i")}function o(e,t){for(var r in e)for(var n=t[r]||(t[r]=[]),i=e[r],o=i.length-1;o>=0;o--)n.unshift(i[o])}function a(e,t){for(var r=0;r<e.length;r++){var i=e[r];if(!i[0]||i[1].test(n(t,i[0])))return i[2]}}var l={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]},s={};e.defineMode("htmlmixed",function(r,n){function s(n,o){var l,d=c.token(n,o.htmlState),h=/\btag\b/.test(d);if(h&&!/[<>\s\/]/.test(n.current())&&(l=o.htmlState.tagName&&o.htmlState.tagName.toLowerCase())&&u.hasOwnProperty(l))o.inTag=l+" ";else if(o.inTag&&h&&/>$/.test(n.current())){var f=/^([\S]+) (.*)/.exec(o.inTag);o.inTag=null;var p=">"==n.current()&&a(u[f[1]],f[2]),g=e.getMode(r,p),m=i(f[1],!0),v=i(f[1],!1);o.token=function(e,r){return e.match(m,!1)?(r.token=s,r.localState=r.localMode=null,null):t(e,v,r.localMode.token(e,r.localState))},o.localMode=g,o.localState=e.startState(g,c.indent(o.htmlState,""))}else o.inTag&&(o.inTag+=n.current(),n.eol()&&(o.inTag+=" "));return d}var c=e.getMode(r,{name:"xml",htmlMode:!0,multilineTagIndentFactor:n.multilineTagIndentFactor,multilineTagIndentPastTag:n.multilineTagIndentPastTag}),u={},d=n&&n.tags,h=n&&n.scriptTypes;if(o(l,u),d&&o(d,u),h)for(var f=h.length-1;f>=0;f--)u.script.unshift(["type",h[f].matches,h[f].mode]);return{startState:function(){var e=c.startState();return{token:s,inTag:null,localMode:null,localState:null,htmlState:e}},copyState:function(t){var r;return t.localState&&(r=e.copyState(t.localMode,t.localState)),{token:t.token,inTag:t.inTag,localMode:t.localMode,localState:r,htmlState:e.copyState(c,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,r){return!t.localMode||/^\s*<\//.test(r)?c.indent(t.htmlState,r):t.localMode.indent?t.localMode.indent(t.localState,r):e.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||c}}}},"xml","javascript","css"),e.defineMIME("text/html","htmlmixed")})},{"../../lib/codemirror":16,"../css/css":17,"../javascript/javascript":19,"../xml/xml":20}],19:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";function t(e,t,r){return/^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}e.defineMode("javascript",function(r,n){function i(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}function o(e,t,r){return we=e,xe=r,t}function a(e,r){var n=e.next();if('"'==n||"'"==n)return r.tokenize=l(n),r.tokenize(e,r);if("."==n&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return o("number","number");if("."==n&&e.match(".."))return o("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return o(n);if("="==n&&e.eat(">"))return o("=>","operator");if("0"==n&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),o("number","number");if("0"==n&&e.eat(/o/i))return e.eatWhile(/[0-7]/i),o("number","number");if("0"==n&&e.eat(/b/i))return e.eatWhile(/[01]/i),o("number","number");if(/\d/.test(n))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),o("number","number");if("/"==n)return e.eat("*")?(r.tokenize=s,s(e,r)):e.eat("/")?(e.skipToEnd(),o("comment","comment")):t(e,r,1)?(i(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),o("regexp","string-2")):(e.eatWhile(Ae),o("operator","operator",e.current()));if("`"==n)return r.tokenize=c,c(e,r);if("#"==n)return e.skipToEnd(),o("error","error");if(Ae.test(n))return e.eatWhile(Ae),o("operator","operator",e.current());if(Me.test(n)){e.eatWhile(Me);var a=e.current(),u=_e.propertyIsEnumerable(a)&&_e[a];return u&&"."!=r.lastType?o(u.type,u.style,a):o("variable","variable",a)}}function l(e){return function(t,r){var n,i=!1;if(Se&&"@"==t.peek()&&t.match(Ne))return r.tokenize=a,o("jsonld-keyword","meta");for(;null!=(n=t.next())&&(n!=e||i);)i=!i&&"\\"==n;return i||(r.tokenize=a),o("string","string")}}function s(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=a;break}n="*"==r}return o("comment","comment")}function c(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=a;break}n=!n&&"\\"==r}return o("quasi","string-2",e.current())}function u(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(0>r)){for(var n=0,i=!1,o=r-1;o>=0;--o){var a=e.string.charAt(o),l=Oe.indexOf(a);if(l>=0&&3>l){if(!n){++o;break}if(0==--n)break}else if(l>=3&&6>l)++n;else if(Me.test(a))i=!0;else{if(/["'\/]/.test(a))return;if(i&&!n){++o;break}}}i&&!n&&(t.fatArrowAt=o)}}function d(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function h(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function f(e,t,r,n,i){var o=e.cc;for(ze.state=e,ze.stream=i,ze.marked=null,ze.cc=o,ze.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var a=o.length?o.pop():Te?C:k;if(a(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return ze.marked?ze.marked:"variable"==r&&h(e,n)?"variable-2":t}}}function p(){for(var e=arguments.length-1;e>=0;e--)ze.cc.push(arguments[e])}function g(){return p.apply(null,arguments),!0}function m(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var r=ze.state;if(ze.marked="def",r.context){if(t(r.localVars))return;r.localVars={name:e,next:r.localVars}}else{if(t(r.globalVars))return;n.globalVars&&(r.globalVars={name:e,next:r.globalVars})}}function v(){ze.state.context={prev:ze.state.context,vars:ze.state.localVars},ze.state.localVars=Ee}function y(){ze.state.localVars=ze.state.context.vars,ze.state.context=ze.state.context.prev}function b(e,t){var r=function(){var r=ze.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented;r.lexical=new d(n,ze.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function w(){var e=ze.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function x(e){function t(r){return r==e?g():";"==e?p():g(t)}return t}function k(e,t){return"var"==e?g(b("vardef",t.length),$,x(";"),w):"keyword a"==e?g(b("form"),C,k,w):"keyword b"==e?g(b("form"),k,w):"{"==e?g(b("}"),U,w):";"==e?g():"if"==e?("else"==ze.state.lexical.info&&ze.state.cc[ze.state.cc.length-1]==w&&ze.state.cc.pop()(),g(b("form"),C,k,w,J)):"function"==e?g(oe):"for"==e?g(b("form"),ee,k,w):"variable"==e?g(b("stat"),H):"switch"==e?g(b("form"),C,b("}","switch"),x("{"),U,w,w):"case"==e?g(C,x(":")):"default"==e?g(x(":")):"catch"==e?g(b("form"),v,x("("),ae,x(")"),k,w,y):"class"==e?g(b("form"),le,w):"export"==e?g(b("stat"),de,w):"import"==e?g(b("stat"),he,w):"module"==e?g(b("form"),Y,b("}"),x("{"),U,w,w):p(b("stat"),C,x(";"),w)}function C(e){return T(e,!1)}function S(e){return T(e,!0)}function T(e,t){if(ze.state.fatArrowAt==ze.stream.start){var r=t?z:W;if("("==e)return g(v,b(")"),B(Y,")"),w,x("=>"),r,y);if("variable"==e)return p(v,Y,x("=>"),r,y)}var n=t?A:_;return We.hasOwnProperty(e)?g(n):"function"==e?g(oe,n):"keyword c"==e?g(t?M:L):"("==e?g(b(")"),L,ye,x(")"),w,n):"operator"==e||"spread"==e?g(t?S:C):"["==e?g(b("]"),me,w,n):"{"==e?K(F,"}",null,n):"quasi"==e?p(N,n):"new"==e?g(E(t)):g()}function L(e){return e.match(/[;\}\)\],]/)?p():p(C)}function M(e){return e.match(/[;\}\)\],]/)?p():p(S)}function _(e,t){return","==e?g(C):A(e,t,!1)}function A(e,t,r){var n=0==r?_:A,i=0==r?C:S;return"=>"==e?g(v,r?z:W,y):"operator"==e?/\+\+|--/.test(t)?g(n):"?"==t?g(C,x(":"),i):g(i):"quasi"==e?p(N,n):";"!=e?"("==e?K(S,")","call",n):"."==e?g(I,n):"["==e?g(b("]"),L,x("]"),w,n):void 0:void 0}function N(e,t){return"quasi"!=e?p():"${"!=t.slice(t.length-2)?g(N):g(C,O)}function O(e){return"}"==e?(ze.marked="string-2",ze.state.tokenize=c,g(N)):void 0}function W(e){return u(ze.stream,ze.state),p("{"==e?k:C)}function z(e){return u(ze.stream,ze.state),p("{"==e?k:S)}function E(e){return function(t){return"."==t?g(e?D:P):p(e?S:C)}}function P(e,t){return"target"==t?(ze.marked="keyword",g(_)):void 0}function D(e,t){return"target"==t?(ze.marked="keyword",g(A)):void 0}function H(e){return":"==e?g(w,k):p(_,x(";"),w)}function I(e){return"variable"==e?(ze.marked="property",g()):void 0}function F(e,t){return"variable"==e||"keyword"==ze.style?(ze.marked="property",g("get"==t||"set"==t?j:R)):"number"==e||"string"==e?(ze.marked=Se?"property":ze.style+" property",g(R)):"jsonld-keyword"==e?g(R):"modifier"==e?g(F):"["==e?g(C,x("]"),R):"spread"==e?g(C):void 0}function j(e){return"variable"!=e?p(R):(ze.marked="property",g(oe))}function R(e){return":"==e?g(S):"("==e?p(oe):void 0}function B(e,t){function r(n){if(","==n){var i=ze.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),g(e,r)}return n==t?g():g(x(t))}return function(n){return n==t?g():p(e,r)}}function K(e,t,r){for(var n=3;n<arguments.length;n++)ze.cc.push(arguments[n]);return g(b(t,r),B(e,t),w)}function U(e){return"}"==e?g():p(k,U)}function G(e){return Le&&":"==e?g(V):void 0}function q(e,t){return"="==t?g(S):void 0}function V(e){return"variable"==e?(ze.marked="variable-3",g()):void 0}function $(){return p(Y,G,Z,Q)}function Y(e,t){return"modifier"==e?g(Y):"variable"==e?(m(t),g()):"spread"==e?g(Y):"["==e?K(Y,"]"):"{"==e?K(X,"}"):void 0}function X(e,t){return"variable"!=e||ze.stream.match(/^\s*:/,!1)?("variable"==e&&(ze.marked="property"),"spread"==e?g(Y):"}"==e?p():g(x(":"),Y,Z)):(m(t),g(Z))}function Z(e,t){return"="==t?g(S):void 0}function Q(e){return","==e?g($):void 0}function J(e,t){return"keyword b"==e&&"else"==t?g(b("form","else"),k,w):void 0}function ee(e){return"("==e?g(b(")"),te,x(")"),w):void 0}function te(e){return"var"==e?g($,x(";"),ne):";"==e?g(ne):"variable"==e?g(re):p(C,x(";"),ne)}function re(e,t){return"in"==t||"of"==t?(ze.marked="keyword",g(C)):g(_,ne)}function ne(e,t){return";"==e?g(ie):"in"==t||"of"==t?(ze.marked="keyword",g(C)):p(C,x(";"),ie)}function ie(e){")"!=e&&g(C)}function oe(e,t){return"*"==t?(ze.marked="keyword",g(oe)):"variable"==e?(m(t),g(oe)):"("==e?g(v,b(")"),B(ae,")"),w,k,y):void 0}function ae(e){return"spread"==e?g(ae):p(Y,G,q)}function le(e,t){return"variable"==e?(m(t),g(se)):void 0}function se(e,t){return"extends"==t?g(C,se):"{"==e?g(b("}"),ce,w):void 0}function ce(e,t){return"variable"==e||"keyword"==ze.style?"static"==t?(ze.marked="keyword",g(ce)):(ze.marked="property","get"==t||"set"==t?g(ue,oe,ce):g(oe,ce)):"*"==t?(ze.marked="keyword",g(ce)):";"==e?g(ce):"}"==e?g():void 0}function ue(e){return"variable"!=e?p():(ze.marked="property",g())}function de(e,t){return"*"==t?(ze.marked="keyword",g(ge,x(";"))):"default"==t?(ze.marked="keyword",g(C,x(";"))):p(k)}function he(e){return"string"==e?g():p(fe,ge)}function fe(e,t){
8
+ return"{"==e?K(fe,"}"):("variable"==e&&m(t),"*"==t&&(ze.marked="keyword"),g(pe))}function pe(e,t){return"as"==t?(ze.marked="keyword",g(fe)):void 0}function ge(e,t){return"from"==t?(ze.marked="keyword",g(C)):void 0}function me(e){return"]"==e?g():p(S,ve)}function ve(e){return"for"==e?p(ye,x("]")):","==e?g(B(M,"]")):p(B(S,"]"))}function ye(e){return"for"==e?g(ee,ye):"if"==e?g(C,ye):void 0}function be(e,t){return"operator"==e.lastType||","==e.lastType||Ae.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}var we,xe,ke=r.indentUnit,Ce=n.statementIndent,Se=n.jsonld,Te=n.json||Se,Le=n.typescript,Me=n.wordCharacters||/[\w$\xa1-\uffff]/,_e=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("operator"),o={type:"atom",style:"atom"},a={"if":e("if"),"while":t,"with":t,"else":r,"do":r,"try":r,"finally":r,"return":n,"break":n,"continue":n,"new":e("new"),"delete":n,"throw":n,"debugger":n,"var":e("var"),"const":e("var"),let:e("var"),"function":e("function"),"catch":e("catch"),"for":e("for"),"switch":e("switch"),"case":e("case"),"default":e("default"),"in":i,"typeof":i,"instanceof":i,"true":o,"false":o,"null":o,undefined:o,NaN:o,Infinity:o,"this":e("this"),"class":e("class"),"super":e("atom"),"yield":n,"export":e("export"),"import":e("import"),"extends":n};if(Le){var l={type:"variable",style:"variable-3"},s={"interface":e("class"),"implements":n,namespace:n,module:e("module"),"enum":e("module"),"public":e("modifier"),"private":e("modifier"),"protected":e("modifier"),"abstract":e("modifier"),as:i,string:l,number:l,"boolean":l,any:l};for(var c in s)a[c]=s[c]}return a}(),Ae=/[+\-*&%=<>!?|~^]/,Ne=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Oe="([{}])",We={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},ze={state:null,column:null,marked:null,cc:null},Ee={name:"this",next:{name:"arguments"}};return w.lex=!0,{startState:function(e){var t={tokenize:a,lastType:"sof",cc:[],lexical:new d((e||0)-ke,0,"block",!1),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:e||0};return n.globalVars&&"object"==typeof n.globalVars&&(t.globalVars=n.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),u(e,t)),t.tokenize!=s&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==we?r:(t.lastType="operator"!=we||"++"!=xe&&"--"!=xe?we:"incdec",f(t,r,we,xe,e))},indent:function(t,r){if(t.tokenize==s)return e.Pass;if(t.tokenize!=a)return 0;var i=r&&r.charAt(0),o=t.lexical;if(!/^\s*else\b/.test(r))for(var l=t.cc.length-1;l>=0;--l){var c=t.cc[l];if(c==w)o=o.prev;else if(c!=J)break}"stat"==o.type&&"}"==i&&(o=o.prev),Ce&&")"==o.type&&"stat"==o.prev.type&&(o=o.prev);var u=o.type,d=i==u;return"vardef"==u?o.indented+("operator"==t.lastType||","==t.lastType?o.info+1:0):"form"==u&&"{"==i?o.indented:"form"==u?o.indented+ke:"stat"==u?o.indented+(be(t,r)?Ce||ke:0):"switch"!=o.info||d||0==n.doubleIndentSwitch?o.align?o.column+(d?0:1):o.indented+(d?0:ke):o.indented+(/^(?:case|default)\b/.test(r)?ke:2*ke)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Te?null:"/*",blockCommentEnd:Te?null:"*/",lineComment:Te?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Te?"json":"javascript",jsonldMode:Se,jsonMode:Te,expressionAllowed:t,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=C&&t!=S||e.cc.pop()}}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})})},{"../../lib/codemirror":16}],20:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";var t={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},r={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1};e.defineMode("xml",function(n,i){function o(e,t){function r(r){return t.tokenize=r,r(e,t)}var n=e.next();if("<"==n)return e.eat("!")?e.eat("[")?e.match("CDATA[")?r(s("atom","]]>")):null:e.match("--")?r(s("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),r(c(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=s("meta","?>"),"meta"):(L=e.eat("/")?"closeTag":"openTag",t.tokenize=a,"tag bracket");if("&"==n){var i;return i=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),i?"atom":"error"}return e.eatWhile(/[^&<]/),null}function a(e,t){var r=e.next();if(">"==r||"/"==r&&e.eat(">"))return t.tokenize=o,L=">"==r?"endTag":"selfcloseTag","tag bracket";if("="==r)return L="equals",null;if("<"==r){t.tokenize=o,t.state=f,t.tagName=t.tagStart=null;var n=t.tokenize(e,t);return n?n+" tag error":"tag error"}return/[\'\"]/.test(r)?(t.tokenize=l(r),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function l(e){var t=function(t,r){for(;!t.eol();)if(t.next()==e){r.tokenize=a;break}return"string"};return t.isInAttribute=!0,t}function s(e,t){return function(r,n){for(;!r.eol();){if(r.match(t)){n.tokenize=o;break}r.next()}return e}}function c(e){return function(t,r){for(var n;null!=(n=t.next());){if("<"==n)return r.tokenize=c(e+1),r.tokenize(t,r);if(">"==n){if(1==e){r.tokenize=o;break}return r.tokenize=c(e-1),r.tokenize(t,r)}}return"meta"}}function u(e,t,r){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r,(C.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function d(e){e.context&&(e.context=e.context.prev)}function h(e,t){for(var r;;){if(!e.context)return;if(r=e.context.tagName,!C.contextGrabbers.hasOwnProperty(r)||!C.contextGrabbers[r].hasOwnProperty(t))return;d(e)}}function f(e,t,r){return"openTag"==e?(r.tagStart=t.column(),p):"closeTag"==e?g:f}function p(e,t,r){return"word"==e?(r.tagName=t.current(),M="tag",y):(M="error",p)}function g(e,t,r){if("word"==e){var n=t.current();return r.context&&r.context.tagName!=n&&C.implicitlyClosed.hasOwnProperty(r.context.tagName)&&d(r),r.context&&r.context.tagName==n||C.matchClosing===!1?(M="tag",m):(M="tag error",v)}return M="error",v}function m(e,t,r){return"endTag"!=e?(M="error",m):(d(r),f)}function v(e,t,r){return M="error",m(e,t,r)}function y(e,t,r){if("word"==e)return M="attribute",b;if("endTag"==e||"selfcloseTag"==e){var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||C.autoSelfClosers.hasOwnProperty(n)?h(r,n):(h(r,n),r.context=new u(r,n,i==r.indented)),f}return M="error",y}function b(e,t,r){return"equals"==e?w:(C.allowMissing||(M="error"),y(e,t,r))}function w(e,t,r){return"string"==e?x:"word"==e&&C.allowUnquoted?(M="string",y):(M="error",y(e,t,r))}function x(e,t,r){return"string"==e?x:y(e,t,r)}var k=n.indentUnit,C={},S=i.htmlMode?t:r;for(var T in S)C[T]=S[T];for(var T in i)C[T]=i[T];var L,M;return o.isInText=!0,{startState:function(e){var t={tokenize:o,state:f,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;L=null;var r=t.tokenize(e,t);return(r||L)&&"comment"!=r&&(M=null,t.state=t.state(L||r,e,t),M&&(r="error"==M?r+" error":M)),r},indent:function(t,r,n){var i=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+k;if(i&&i.noIndent)return e.Pass;if(t.tokenize!=a&&t.tokenize!=o)return n?n.match(/^(\s*)/)[0].length:0;if(t.tagName)return C.multilineTagIndentPastTag!==!1?t.tagStart+t.tagName.length+2:t.tagStart+k*(C.multilineTagIndentFactor||1);if(C.alignCDATA&&/<!\[CDATA\[/.test(r))return 0;var l=r&&/^<(\/)?([\w_:\.-]*)/.exec(r);if(l&&l[1])for(;i;){if(i.tagName==l[2]){i=i.prev;break}if(!C.implicitlyClosed.hasOwnProperty(i.tagName))break;i=i.prev}else if(l)for(;i;){var s=C.contextGrabbers[i.tagName];if(!s||!s.hasOwnProperty(l[2]))break;i=i.prev}for(;i&&i.prev&&!i.startOfLine;)i=i.prev;return i?i.indent+k:t.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:C.htmlMode?"html":"xml",helperType:C.htmlMode?"html":"xml",skipAttribute:function(e){e.state==w&&(e.state=y)}}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})})},{"../../lib/codemirror":16}]},{},[10])}();
9
  //# sourceMappingURL=forms-admin.min.js.map
assets/js/forms-admin.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["forms-admin.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length",1,"module","rows","m","i18n","label","config","fieldLabel","type","value","onchange","withAttr","placeholder","title","valueHelp","numberMinMax","min","max","isRequired","desc","inputAtts","checked","required","forceRequired","disabled","isFieldRequired","placeholderHelp","useParagraphs","wrap","wrapInParagraphTags","choiceType","selected","dropdown","radioButtons","checkboxes","choices","map","choice","index","data-id","name","selectChoice","bind","class","onclick","key","this","splice",2,"forms","render","text","hidden","c","join","submit","number","./field-forms-rows.js",3,"g","generate","field","htmlTemplate","html","generators","html_beautify","select","checkbox","radio","attributes","../third-party/beautify-html.js","../third-party/render.js",4,"FieldHelper","tabs","editor","fields","setActiveField","fieldConfig","get","redraw","controller","createFieldHTMLAndAddToForm","insert","view","availableFields","getAll","fieldsChoice","chooseField","className","inForm","inFormContent","noAvailableFields","form","overlay","help","trust","onkeydown","window","event","keyCode","addToForm","on","./field-forms.js","./field-generator.js","./overlay.js",5,"FieldFactory","settings","reset","registeredFields","forEach","deregister","register","data","sticky","push","getFieldType","phone","birthday","registerMergeVar","mergeVar","tag","field_type","streetAddress","city","state","zip","country","mc4wp_vars","countries","registerGrouping","grouping","id","groups","registerListFields","list","merge_vars","groupings","registerListsFields","lists","registerCustomFields","subscribe","submitButton","listChoice","listChoiceDescription","unsubscribe","formAction","formActionDescription",6,"events","createChoices","choiceLabel","FieldChoice","Object","keys","existingField","getAllWhere","shift","Field","unshift","trigger","indexOf","searchKey","searchValue","filter","prop",7,"FormEditor","element","dom","domDirty","_dom","innerHTML","getValue","toLowerCase","document","createElement","CodeMirror","fromTextArea","selectionPointer","matchTags","bothTags","mode","htmlMode","autoCloseTags","autoRefresh","dispatchEvent","Event","bubbles","addEventListener","query","querySelectorAll","containsField","fieldName","elements","namedItem","replaceSelection","focus","callback","refresh","codemirror","codemirror/addon/edit/closetag.js","codemirror/addon/edit/matchtags","codemirror/addon/fold/xml-fold","codemirror/mode/css/css","codemirror/mode/htmlmixed/htmlmixed","codemirror/mode/javascript/javascript","codemirror/mode/xml/xml",8,"FormWatcher","helpers","updateFields","findRequiredFields","requiredFields","toUpperCase","requiredFieldElements","Array","prototype","el","requiredFieldsInput","getElementById","debounce",9,"close","removeEventListener","onKeyDown","position","_onCloseCallback","preventDefault","_element","windowWidth","innerWidth","documentElement","clientWidth","body","windowHeight","innerHeight","clientHeight","marginLeft","marginTop","style","left","top","content","onCloseCallback",10,"mc4wp_forms_i18n","mc4wp","deps","mithril","FieldsFactory","textareaElement","formEditor","fieldHelper","mount","fieldsFactory","mailchimp","getSelectedLists","setTimeout","./admin/field-helper.js","./admin/fields-factory.js","./admin/fields.js","./admin/form-editor.js","./admin/form-watcher.js",11,"trim","replace","ltrim","style_html","html_source","options","js_beautify","css_beautify","Parser","pos","token","current_mode","tags","parent","parentcount","parent1","tag_type","token_text","last_token","last_text","token_type","newlines","indent_content","indent_inner_html","Utils","whitespace","split","single_token","extra_liners","in_array","what","arr","traverse_whitespace","input_char","input","charAt","preserve_newlines","max_preserve_newlines","get_content","space","indent_handlebars","peek3","substr","get_tag","line_char_count","wrap_line_length","print_newline","print_indentation","get_contents_to","reg_match","RegExp","lastIndex","reg_array","exec","end_script","substring","record_tag","indent_level","retrieve_tag","temp_parent","indent_to_tag","peek","tag_start","tag_end","tag_start_char","comment","orig_pos","orig_line_char_count","get_unformatted","get_comment","tag_index","tag_offset","tag_complete","tag_check","is_unformatted","unformatted","output","start_pos","delimiter","matched","orig_tag","min_index","get_token","tag_name_type","get_full_indent","level","indent_string","next_tag","match","printer","js_source","indent_character","indent_size","brace_style","force","print_token","print_token_raw","slice","indent","unindent","multi_parser","parseInt","max_char","indent_char","tag_name","tag_extracted_from_last_output","_beautifier","script_indent_level","indent_scripts","indentation","white","_level","reindent",12,"isArray","thing","toString","camelToDash","str","removeEmpties","escapeHtml","replaceDoubleQuote","createAttrString","attrs","styles","property","createChildrenContent","children","scope","result","onunload","$trusted","VOID_TAGS",13,"mod","amd","autoCloseGT","cm","getOption","Pass","ranges","listSelections","replacements","empty","head","tok","getTokenAt","inner","innerMode","getMode","tagName","opt","configuration","dontCloseTags","htmlDontClose","indentTags","htmlIndent","end","ch","lowerTagName","test","string","closingTagExists","newPos","Pos","line","info","replaceRange","anchor","sel","setSelections","indentLine","autoCloseCurrent","typingSlash","start","replacement","context","getLine","replaceSelections","autoCloseSlash","collection","elt","newTag","scanForClosingTag","Math","lastLine","nextClose","cx","onCx","prev","to","next","defineOption","val","old","Init","removeKeyMap","whenClosing","whenOpening","addKeyMap","commands","closeTag","../../lib/codemirror","../fold/xml-fold",14,"clear","tagHit","tagOther","doMatchTags","failedTagMatch","operation","somethingSelected","cur","getCursor","range","getViewport","from","findMatchingTag","matchBothTags","hit","at","open","markText","other","maybeUpdateMatch","off","toMatchingTag","found","extendSelection",15,"cmp","b","Iter","firstLine","tagAt","iter","getTokenTypeAt","nextLine","prevLine","toTagEnd","gt","lastSlash","lastIndexOf","selfClose","toTagStart","lt","xmlTagStart","toNextTag","toPrevTag","findMatchingClose","stack","startLine","startCh","findMatchingOpen","endLine","endCh","nameStartChar","nameChar","registerHelper","openTag","here","findEnclosingTag","forward",16,"place","copyObj","defaults","setGuttersForLineNumbers","doc","Doc","lineSeparator","inputStyles","inputStyle","display","Display","wrapper","updateGutters","themeChanged","lineWrapping","autofocus","mobile","initScrollbars","keyMaps","overlays","modeGen","overwrite","delayingBlurEvent","focused","suppressEdits","pasteIncoming","cutIncoming","selectingText","draggingText","highlight","Delayed","keySeq","specialChars","ie","ie_version","registerEventHandlers","ensureGlobalHandlers","startOperation","curOp","forceUpdate","attachDoc","hasFocus","onFocus","onBlur","optionHandlers","hasOwnProperty","maybeUpdateLineNumberWidth","finishInit","initHooks","endOperation","webkit","getComputedStyle","lineDiv","textRendering","d","scrollbarFiller","setAttribute","gutterFiller","selectionDiv","cursorDiv","measure","lineMeasure","lineSpace","mover","sizer","sizerWidth","heightForcer","scrollerGap","gutters","lineGutter","scroller","zIndex","paddingRight","gecko","draggable","appendChild","viewFrom","viewTo","first","reportedViewFrom","reportedViewTo","renderedView","externalMeasured","viewOffset","lastWrapHeight","lastWrapWidth","updateLineNumbers","nativeBarWidth","barHeight","barWidth","scrollbarsClipped","lineNumWidth","lineNumInnerWidth","lineNumChars","alignWidgets","cachedCharWidth","cachedTextHeight","cachedPaddingH","maxLine","maxLineLength","maxLineChanged","wheelDX","wheelDY","wheelStartX","wheelStartY","selForContextMenu","activeTouch","init","loadMode","modeOption","resetModeState","stateAfter","frontier","startWorker","regChange","wrappingChanged","addClass","minWidth","rmClass","findMaxLine","estimateLineHeights","clearCaches","updateScrollbars","estimateHeight","th","textHeight","wrapping","perLine","charWidth","lineIsHidden","widgetsHeight","widgets","height","ceil","est","estHeight","updateLineHeight","theme","guttersChanged","alignHorizontally","specs","removeChildren","gutterClass","gElt","width","updateGutterSpace","offsetWidth","lineLength","merged","len","collapsedSpanAtStart","find","collapsedSpanAtEnd","lineNumbers","concat","measureForScrollbars","gutterW","docH","round","paddingVert","viewHeight","scrollWidth","viewWidth","barLeft","fixedGutter","docHeight","scrollHeight","scrollGap","gutterWidth","NativeScrollbars","scroll","vert","horiz","scrollTop","scrollLeft","checkedZeroWidth","minHeight","NullScrollbars","scrollbars","scrollbarModel","scrollbarStyle","node","insertBefore","axis","setScrollLeft","setScrollTop","startWidth","startHeight","updateScrollbarsInner","updateHeightsInViewport","sizes","update","right","paddingBottom","bottom","coverGutterNextToScrollbar","visibleLines","viewport","floor","paddingTop","lineAtHeight","ensure","ensureFrom","ensureTo","heightAtLine","firstChild","comp","compensateForHScroll","gutter","align","alignable","j","last","lineNumberFor","size","innerW","padding","String","lineNumberFormatter","firstLineNumber","getBoundingClientRect","DisplayUpdate","visible","editorIsHidden","wrapperHeight","wrapperWidth","oldDisplayWidth","displayWidth","dims","getDimensions","maybeClipScrollbars","marginBottom","borderRightWidth","updateDisplayIfNeeded","resetView","countDirtyView","viewportMargin","sawCollapsedSpans","visualLineNo","visualLineEndNo","different","adjustView","toUpdate","activeElt","patchDisplay","offsetHeight","postUpdateDisplay","displayHeight","barMeasure","updateSelection","setDocumentHeight","signal","updateDisplaySimple","finish","total","prevBottom","offsetTop","bot","box","diff","updateWidgetHeight","rest","parentNode","gutterLeft","clientLeft","nextSibling","offsetLeft","fixedPos","gutterTotalWidth","updateNumbersFrom","rm","mac","currentWheelTarget","removeChild","container","lineN","lineView","updateNumber","lineNumber","changes","updateLineForChanges","createTextNode","buildLineElement","updateLineText","updateLineGutter","updateLineClasses","updateLineWidgets","ensureLineWrapped","replaceChild","updateLineBackground","cls","bgClass","background","getLineContent","ext","built","buildLineContent","pre","textClass","wrapClass","gutterBackground","markers","gutterMarkers","gutterWrap","setUneditable","k","insertLineWidgets","insertLineWidgetsFor","allowAbove","ws","widget","handleMouseEvents","positionLineWidget","above","signalLater","noHScroll","coverGutter","paddingLeft","copyPos","x","maxPos","minPos","ensureFocus","applyTextInput","inserted","deleted","origin","paste","textLines","splitLines","multiPaste","lastCopied","lst","updateInput","changeEvent","makeChange","triggerElectric","ensureCursorVisible","typing","handlePaste","pasted","clipboardData","getData","isReadOnly","disableInput","runInOp","electricChars","smartIndent","getModeAt","indented","electricInput","copyableRanges","lineRange","getRange","disableBrowserMagic","TextareaInput","prevInput","pollingFast","polling","inaccurateSelection","hasSelection","composing","hiddenTextarea","te","div","ios","border","ContentEditableInput","lastAnchorNode","lastAnchorOffset","lastFocusNode","lastFocusOffset","gracePeriod","posToDOM","findViewForLine","mapFromLineView","order","getOrder","side","partPos","getBidiPartAt","nodeAndOffsetInLineMap","offset","collapse","badPos","bad","domToPos","lineNode","childNodes","clipPos","locateNodeInLineView","textNode","topNode","maps","curNode","lineNo","contains","nodeType","nodeValue","after","dist","textContent","before","previousSibling","domTextBetween","fromLine","toLine","recognizeMarker","marker","walk","cmText","getAttribute","markerID","findMarks","getBetween","lineSep","nodeName","closing","Selection","primIndex","Range","normalizeSelection","prim","sort","inv","simpleSelection","clipLine","clipToLen","linelen","isLine","clipPosArray","array","out","extendRange","extend","posBefore","setSelection","primary","extendSelections","heads","newSel","replaceOneSelection","setSimpleSelection","filterSelectionChange","obj","setSelectionReplaceHistory","done","history","setSelectionNoUndo","addSelectionToHistory","NaN","hasHandler","bias","setSelectionInner","skipAtomicInSelection","equals","selectionChanged","signalCursorActivity","reCheckSelection","sel_dontScroll","mayClear","newAnchor","skipAtomic","newHead","skipAtomicInner","oldPos","dir","markedSpans","sp","inclusiveLeft","inclusiveRight","explicitlyCleared","atomic","near","movePos","far","cantEdit","showSelection","prepareSelection","curFragment","cursors","createDocumentFragment","selFragment","selection","collapsed","showCursorWhenSelecting","drawSelectionCursor","drawSelectionRange","cursorCoords","singleCursorHeightPerLine","cursor","cursorHeight","otherCursor","add","fragment","rightSide","drawForLine","fromArg","toArg","coords","charCoords","lineObj","lineLen","iterateBidiSections","rightPos","leftPos","tmp","leftSide","paddingH","sFrom","sTo","singleVLine","visualLine","leftEnd","rightStart","restartBlink","clearInterval","blinker","visibility","cursorBlinkRate","setInterval","time","startState","set","highlightWorker","Date","workTime","copyState","getStateBefore","changedLines","oldStyles","tooLong","maxHighlightLength","highlighted","highlightLine","oldCls","styleClasses","newCls","classes","ischange","processLine","workDelay","regLineChange","findStartLine","precise","minindent","minline","lim","search","countColumn","tabSize","save","removeChildrenAndAdd","currentStyle","isNaN","ensureLineHeights","rect","curWidth","heights","rects","getClientRects","abs","cache","caches","updateExternalMeasurement","LineView","measureChar","measureCharPrepared","prepareMeasureForLine","findViewIndex","hasHeights","prepared","varHeight","measureCharInner","bogus","rtop","rbottom","mStart","mEnd","insertLeft","coverStart","coverEnd","isExtendingChar","nullRect","maybeUpdateRectForZooming","rSpan","rbot","mid","screen","logicalXDPI","deviceXDPI","hasBadZoomedRects","scaleX","scaleY","logicalYDPI","deviceYDPI","clearLineMeasurementCacheFor","clearLineMeasurementCache","externalMeasure","pageScrollX","pageXOffset","pageScrollY","pageYOffset","intoCoordSystem","widgetHeight","yOff","lOff","xOff","fromCoordSystem","localBox","lineSpaceBox","preparedMeasure","getBidi","part","bidiLeft","bidiRight","bidiOther","estimateCoords","PosWithInfo","outside","xRel","coordsChar","y","coordsCharInner","mergedPos","getX","wrongLine","innerOff","adjust","bidi","lineLeft","lineRight","fromX","fromOutside","toX","toOutside","moveVisually","xDiff","step","middle","middleX","measureText","viewChanged","changeObjs","cursorActivityHandlers","cursorActivityCalled","updateMaxLine","scrollToPos","nextOpId","operationGroup","ops","ownsGroup","delayedCallbacks","fireCallbacksForOps","group","callbacks","op","endOperations","endOperation_R1","endOperation_W1","endOperation_R2","endOperation_W2","endOperation_finish","mustUpdate","updatedDisplay","adjustWidthTo","maxScrollLeft","preparedSelection","forceScroll","scrollPosIntoView","margin","isCursor","maybeScrollWindow","maybeHiddenMarkers","unhidden","maybeUnhiddenMarkers","lines","apply","arguments","methodOp","docMethodOp","visualLineContinued","buildViewArray","nextPos","lendiff","cut","viewCuttingPoint","cutTop","cutBot","oldN","newN","dirty","finishTouch","touchFinished","prevTouch","isMouseLikeTouchEvent","touches","touch","radiusX","radiusY","farAway","dx","dy","onMouseDown","signalDOMEvent","posFromMouse","clickInGutter","eventInWidget","e_preventDefault","word","findWordAt","captureRightClick","onContextMenu","clearTimeout","now","moved","pageX","pageY","onScrollWheel","dragFunctions","enter","e_stop","over","onDragOver","onDragStart","drop","onDrop","leave","clearDragCursor","inp","getField","onKeyUp","onKeyPress","dragDropChanged","wasOn","funcs","toggle","onResize","setSize","e_target","liberal","forRect","clientX","clientY","colDiff","supportsTouch","shiftKey","e_button","leftButtonDown","lastMiddleDown","delayBlurEvent","lastDoubleClick","lastClick","contained","modifier","metaKey","ctrlKey","dragDrop","dragAndDrop","leftButtonStartDrag","leftButtonSelect","startTime","dragEnd","e2","addNew","extendTo","lastPos","startCol","posCol","findColumn","startSel","ourIndex","scrollIntoView","oldRange","ourRange","sel_mouse","curCount","counter","editorSize","Infinity","move","up","lastSelOrigin","altKey","gutterEvent","prevent","mX","mY","lineBox","e_defaultPrevented","lastDrop","files","dataTransfer","FileReader","File","read","loadFile","file","allowDropFileTypes","reader","onload","change","changeEnd","readAsText","setData","getSelection","setDragImage","safari","img","src","presto","_top","frag","dragCursor","isScroller","delta","wheelEventDelta","canScrollX","canScrollY","outer","target","wheelPixelsPerUnit","pixels","wheelSamples","movedX","movedY","sample","doHandleBinding","bound","dropShift","ensurePolled","prevShift","lookupKeyForEditor","handle","lookupKey","extraKeys","keyMap","dispatchKey","seq","isModifierKey","stopSeq","handleKeyBinding","keyName","motion","handleCharBinding","returnValue","handled","lastStoppedKey","hasCopyEvent","showCrossHair","charCode","which","fromCharCode","readOnly","receivedFocus","contextMenuInGutter","adjustForChange","computeSelAfterChange","offsetPos","nw","computeReplacedSel","hint","oldPrev","newPrev","filterChange","canceled","cancel","ignoreReadOnly","sawReadOnlySpans","removeReadOnlyRanges","makeChangeInner","selAfter","addChangeToHistory","makeChangeSingleDoc","stretchSpansOverChange","rebased","linkedDocs","sharedHist","rebaseHist","makeChangeFromHistory","allowSelectionOnly","hist","source","undone","dest","lastOrigin","pop","pushSelectionToHistory","clearRedo","antiChanges","generation","maxGeneration","historyChangeFromChange","mergeOldSpans","shiftDoc","distance","spans","removed","makeChangeSingleDocInEditor","updateDoc","recomputeMaxLength","checkWidthStart","full","isWholeLineUpdate","changesHandler","changeHandler","doScroll","phantom","scrollNode","limit","changed","endCoords","scrollPos","calculateScrollPos","startTop","startLeft","x1","y1","x2","y2","snapMargin","screentop","docBottom","atTop","atBottom","newTop","screenleft","screenw","tooWide","addToScrollPos","resolveScrollToPos","cursorScrollMargin","sPos","scrollTo","how","aggressive","curSpace","curSpaceString","indentUnit","indentString","indentWithTabs","spaceStr","changeLine","changeType","no","deleteNearSelection","compute","kill","toKill","replaced","findPosH","unit","visually","findNextLine","moveOnce","boundToLine","moveLogically","origDir","sawType","helper","getHelper","isWordChar","hitSide","findPosV","pageSize","option","deflt","notOnInit","normalizeKeyName","alt","ctrl","cmd","parts","getKeyMap","shared","markTextShared","TextMarker","clearWhenEmpty","replacedWith","widgetNode","conflictingCollapsedRange","addToHistory","curLine","addMarkedSpan","MarkedSpan","clearOnEnter","clearHistory","nextMarkerId","startStyle","endStyle","css","cloneNode","linked","isParent","SharedTextMarker","findSharedMarkers","copySharedMarkers","mFrom","mTo","subMark","detachSharedMarkers","subMarker","getMarkedSpanFor","span","removeMarkedSpan","attachLine","markedSpansBefore","isInsert","startsBefore","endsAfter","markedSpansAfter","oldFirst","oldLast","sameLine","clearEmptySpans","newMarkers","gapMarkers","gap","getOldSpans","stretched","oldCur","stretchCur","mark","mk","p","newParts","dfrom","dto","detachMarkedSpans","detachLine","attachMarkedSpans","extraLeft","extraRight","compareCollapsedMarkers","lenDiff","aPos","bPos","fromCmp","toCmp","collapsedSpanAtSide","sps","vis","lineIsHiddenInner","adjustScrollWhenAboveVisible","parentStyle","addLineWidget","LineWidget","insertAt","aboveVisible","updateLine","cleanUpLine","extractLineClasses","lineClass","callBlankLine","blankLine","readToken","stream","takeToken","asArray","getObj","copy","current","tokens","StringStream","eol","runMode","lineClasses","forceToEnd","flattenSpans","curStart","curStyle","addModeClass","mName","st","i_end","opaque","getLineStyles","updateFrontier","startAt","interpretTokenStyle","styleToClassCacheWithMode","styleToClassCache","builder","col","splitSpaces","addToken","buildToken","hasBadBidiRects","buildTokenBadBidi","allowFrontierUpdate","insertLineContent","joinClasses","zeroWidthElement","lastChild","defaultSpecialCharPlaceholder","charCodeAt","displayText","special","mustWrap","skipped","txt","tabWidth","specialCharPlaceholder","fullStyle","buildCollapsedSpan","ignoreWidget","needsContentAttribute","allText","spanStyle","spanEndStyle","spanStartStyle","nextChange","endStyles","foundBookmarks","upto","tokenText","wholeLineUpdateBefore","spansFor","linesFor","Line","lastText","lastSpans","nlines","remove","added","LeafChunk","BranchChunk","chunkSize","sharedHistOnly","propagate","skip","rel","chunk","child","sz","getLines","h","lh","bidiOrdering","History","startGen","undoDepth","lastModTime","lastSelTime","lastOp","lastSelOp","histChange","attachLocalSpans","clearSelectionEvents","lastChangeEvent","opId","historyEventDelay","selectionEventCanBeMerged","existing","removeClearedSpans","copyHistoryArray","newGroup","instantiateSel","deepCopy","newChanges","Number","rebaseHistSelSingle","rebaseHistArray","sub","ok","copied","defaultPrevented","srcElement","button","getHandlers","emitter","_handlers","noHandlers","bnd","args","orphanDelayedCallbacks","fireOrphanDelayed","delayed","override","codemirrorIgnore","cursorActivity","eventMixin","ctor","spaceStrs","nothing","createObj","base","props","inst","create","isWordCharBasic","isEmpty","extendingChars","cssText","count","activeElement","root","classTest","as","forEachCodeMirror","getElementsByClassName","byClass","globalsRegistered","registerGlobalHandlers","resizeTimer","zwspSupported","badBidiRects","r0","r1","badZoomedRects","normal","fromRange","lineStart","visual","lineEnd","lineStartSmart","firstNonWS","inWS","compareBidiLevel","linedir","moveInLine","byUnit","userAgent","navigator","platform","ie_upto10","ie_11up","documentMode","qtwebkit","chrome","vendor","mac_geMountainLion","windows","presto_version","flipCtrlCmd","needsH","needsV","sWidth","totalHeight","totalWidth","zeroWidthHack","disableHoriz","enableZeroWidthBar","disableVert","w","pointerEvents","bar","delay","maybeDisable","elementFromPoint","native","null","cmpPos","prepareCopyCut","getSelections","selectInput","lineWiseCopyCut","textarea","poll","fastPoll","moveInputWithCursor","headPos","wrapOff","lineOff","teTop","teLeft","drawn","contextMenuPending","minimal","blur","resetPosition","slowPoll","pollInterval","missed","execCommand","same","self","prepareSelectAllHack","selectionStart","extval","selectionEnd","rehide","oldCSS","selectAll","detectingSelectAll","resetSelectionOnContextMenu","oldScrollY","scrollY","mouseup","readOnlyChanged","onCopyCut","clearData","kludge","hadFocus","startData","ours","applyComposition","forceCompositionEnd","pollContent","showPrimarySelection","showMultipleSelections","curAnchor","anchorNode","anchorOffset","curFocus","focusNode","focusOffset","rangeCount","getRangeAt","rng","addRange","removeAllRanges","startGracePeriod","rememberSelection","selectionInEditor","commonAncestorContainer","pollSelection","fromIndex","fromNode","toIndex","toNode","newText","oldText","cutFront","cutEnd","oldTop","maxCutFront","newBot","oldBot","maxCutEnd","chFrom","chTo","contentEditable","contenteditable","there","wheelDeltaX","wheelDeltaY","detail","HORIZONTAL_AXIS","VERTICAL_AXIS","wheelDelta","wheelEventPixels","constructor","setOption","getDoc","addOverlay","spec","modeSpec","removeOverlay","indentSelection","newRanges","getLineTokens","getHelpers","helperType","_global","pred","getStateAfter","defaultTextHeight","defaultCharWidth","setGutterMarker","gutterID","clearGutter","lineInfo","addWidget","vspace","hspace","triggerOnKeyDown","triggerOnKeyPress","triggerOnKeyUp","amount","moveH","extendSelectionsBy","rtlMoveVisually","sel_move","deleteH","goalColumn","moveV","goals","startChar","check","toggleOverwrite","getScrollInfo","interpret","oldHeight","swapDoc","getInputField","getWrapperElement","getScrollerElement","getGutterElement","setValue","newBreaks","detach","attach","integer","tabIndex","modes","mimeModes","defineMode","dependencies","defineMIME","mime","resolveMode","mfactory","modeObj","modeExtensions","exts","modeProps","skipToEnd","extendMode","properties","defineExtension","func","defineDocExtension","defineInitHook","registerGlobalHelper","predicate","nstate","a1","a2","singleSelection","killLine","deleteLine","delLineLeft","delWrappedLineLeft","delWrappedLineRight","undo","redo","undoSelection","redoSelection","goDocStart","goDocEnd","goLineStart","goLineStartSmart","goLineEnd","goLineRight","goLineLeft","goLineLeftSmart","goLineUp","goLineDown","goPageUp","goPageDown","goCharLeft","goCharRight","goColumnLeft","goColumnRight","goWordLeft","goGroupRight","goGroupLeft","goWordRight","delCharBefore","delCharAfter","delWordBefore","delWordAfter","delGroupBefore","delGroupAfter","indentAuto","indentMore","indentLess","insertTab","insertSoftTab","spaces","defaultTab","transposeChars","newlineAndIndent","basic","Left","Right","Up","Down","End","Home","PageUp","PageDown","Delete","Backspace","Shift-Backspace","Tab","Shift-Tab","Enter","Insert","Esc","pcDefault","Ctrl-A","Ctrl-D","Ctrl-Z","Shift-Ctrl-Z","Ctrl-Y","Ctrl-Home","Ctrl-End","Ctrl-Up","Ctrl-Down","Ctrl-Left","Ctrl-Right","Alt-Left","Alt-Right","Ctrl-Backspace","Ctrl-Delete","Ctrl-S","Ctrl-F","Ctrl-G","Shift-Ctrl-G","Shift-Ctrl-F","Shift-Ctrl-R","Ctrl-[","Ctrl-]","Ctrl-U","Shift-Ctrl-U","Alt-U","fallthrough","emacsy","Ctrl-B","Ctrl-P","Ctrl-N","Alt-F","Alt-B","Ctrl-E","Ctrl-V","Shift-Ctrl-V","Ctrl-H","Alt-D","Alt-Backspace","Ctrl-K","Ctrl-T","macDefault","Cmd-A","Cmd-D","Cmd-Z","Shift-Cmd-Z","Cmd-Y","Cmd-Home","Cmd-Up","Cmd-End","Cmd-Down","Cmd-Left","Cmd-Right","Ctrl-Alt-Backspace","Alt-Delete","Cmd-S","Cmd-F","Cmd-G","Shift-Cmd-G","Cmd-Alt-F","Shift-Cmd-Alt-F","Cmd-[","Cmd-]","Cmd-Backspace","Cmd-Delete","Cmd-U","Shift-Cmd-U","normalizeKeyMap","keymap","keyname","keyNames","noShift","altGraphKey","tabindex","leaveSubmitMethodAlone","realSubmit","wrappedSubmit","getTextArea","toTextArea","lastColumnPos","lastColumnValue","sol","eat","eatWhile","eatSpace","skipTo","backUp","column","pattern","consume","caseInsensitive","cased","hideFirstChars","withOp","dHeight","oldH","removeInner","insertInner","iterN","spilled","newleaf","maybeSpill","me","sibling","myIndex","used","nextDocId","cleanGeneration","getLineHandle","getLineNumber","getLineHandleVisualStart","lineCount","setCursor","addSelection","dup","setExtending","getExtending","historySize","markClean","changeGeneration","forceSplit","isClean","gen","getHistory","setHistory","histData","addLineClass","where","removeLineClass","removeLineWidget","setBookmark","realOpts","findMarksAt","getAllMarks","posFromIndex","indexFromPos","copyHistory","linkedDoc","unlinkDoc","link","splitIds","iterLinkedDocs","getEditor","splitLinesAuto","eachLine","dontDelegate","method","e_stopPropagation","stopPropagation","cancelBubble","attachEvent","detachEvent","handlers","ms","startIndex","startValue","nextTab","goal","_e","nonASCIISingleCaseWordChar","createRange","endNode","setEnd","setStart","createTextRange","moveToElementText","moveEnd","moveStart","host","nl","rt","ownerDocument","parentElement","compareEndPoints","oncopy",17,18,19,20,27,32,33,34,35,36,37,38,39,40,44,45,46,59,61,91,92,93,106,107,109,110,111,127,173,186,187,188,189,190,191,192,219,220,221,222,63232,63233,63234,63235,63272,63273,63275,63276,63277,63302,"charType","lowTypes","arabicTypes","BidiSpan","bidiRE","isNeutral","isStrong","countsAsLeft","countsAsNum","outerType","types","nstart","version","keySet","tokenCComment","maybeEnd","tokenize","parserConfig","ret","tp","tokenBase","tokenHooks","tokenString","tokenParenthesized","quote","escaped","Context","pushContext","popContext","pass","states","popAndPass","wordAsValue","valueKeywords","colorKeywords","inline","propertyKeywords","documentTypes","mediaTypes","mediaFeatures","mediaValueKeywords","nonStandardPropertyKeywords","fontProperties","counterDescriptors","allowNested","supportsAtComponent","stateArg","block","maybeprop","propBlock","_stream","parens","pseudo","atBlock","atComponentBlock","atBlock_parens","restricted_atBlock_before","restricted_atBlock","keyframes","interpolation","textAfter","blockCommentStart","blockCommentEnd","fold","documentTypes_","mediaTypes_","mediaFeatures_","mediaValueKeywords_","propertyKeywords_","nonStandardPropertyKeywords_","fontProperties_","counterDescriptors_","colorKeywords_","valueKeywords_","allWords","/",":","$","#","@","&","maybeBackup","pat","getAttrRegexp","attr","regexp","attrRegexpCache","getAttrValue","getTagRegexp","anchored","addTags","findMatchingMode","tagInfo","defaultTags","script","htmlState","endTagA","endTag","localState","localMode","multilineTagIndentFactor","multilineTagIndentPastTag","configTags","configScript","scriptTypes","matches","local","../css/css","../javascript/javascript","../xml/xml","expressionAllowed","lastType","readRegexp","inSet","cont","tokenComment","isOperatorChar","tokenQuasi","wordRE","known","keywords","propertyIsEnumerable","jsonldMode","isJsonldKeyword","findFatArrow","fatArrowAt","arrow","depth","sawSomething","bracket","brackets","JSLexical","inScope","varname","v","localVars","vars","parseJS","cc","marked","lexical","combinator","jsonMode","expression","statement","lex","inList","globalVars","pushcontext","defaultVars","popcontext","pushlex","poplex","expect","wanted","exp","vardef","maybeelse","functiondef","forspec","maybelabel","funarg","afterExport","afterImport","expressionInner","expressionNoComma","noComma","arrowBodyNoComma","arrowBody","commasep","maybeop","maybeoperatorNoComma","maybeoperatorComma","atomicTypes","maybeexpressionNoComma","maybeexpression","comprehension","arrayLiteral","contCommasep","objprop","quasi","maybeTarget","expr","continueQuasi","targetNoComma","_","getterSetter","afterprop","proceed","maybetype","isTS","typedef","maybedefault","maybeAssign","vardefCont","proppattern","_type","forspec1","forspec2","formaybeinof","forspec3","classNameAfter","classBody","classGetterSetter","maybeFrom","importSpec","maybeAs","maybeArrayComprehension","isContinuedStatement","statementIndent","jsonld","json","typescript","wordCharacters","kw","A","B","C","operator","atom","jsKeywords","if","while","with","else","do","try","finally","return","break","continue","new","delete","throw","debugger","var","const","let","function","catch","for","switch","case","default","in","typeof","instanceof","true","false","super","yield","export","import","extends","tsKeywords","interface","implements","namespace","enum","public","private","protected","abstract","boolean","any","variable","jsonld-keyword","basecolumn","firstChar","doubleIndentSwitch","lineComment","closeBrackets","skipExpression","htmlConfig","autoSelfClosers","area","br","command","embed","frame","hr","keygen","meta","param","track","wbr","menuitem","implicitlyClosed","dd","li","optgroup","rp","tbody","td","tfoot","tr","contextGrabbers","dt","address","article","aside","blockquote","dl","fieldset","footer","h1","h2","h3","h4","h5","h6","header","hgroup","menu","nav","ol","section","table","ul","thead","doNotIndent","allowUnquoted","allowMissing","caseFold","xmlConfig","editorConf","config_","inText","chain","parser","inBlock","doctype","inTag","baseState","tagStart","inAttribute","stringStartCol","closure","isInAttribute","terminator","startOfLine","noIndent","maybePopContext","nextTagName","parentTagName","tagNameState","closeTagNameState","setStyle","attrState","closeState","closeStateErr","attrEqState","attrValueState","attrContinuedState","isInText","baseIndent","fullLine","alignCDATA","tagAfter","grabbers","skipAttribute"],"mappings":"CAAA,WAAe,GAAIA,GAAUC,OAAeC,EAASD,QAAW,QAAUE,GAAEC,EAAEC,EAAEC,GAAG,QAASC,GAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,GAAIE,GAAkB,kBAATV,IAAqBA,CAAQ,KAAIS,GAAGC,EAAE,MAAOA,GAAEF,GAAE,EAAI,IAAGG,EAAE,MAAOA,GAAEH,GAAE,EAAI,IAAII,GAAE,GAAIC,OAAM,uBAAuBL,EAAE,IAAK,MAAMI,GAAEE,KAAK,mBAAmBF,EAAE,GAAIG,GAAEV,EAAEG,IAAIQ,WAAYZ,GAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAG,GAAIE,GAAED,EAAEI,GAAG,GAAGL,EAAG,OAAOI,GAAEF,EAAEA,EAAEF,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,MAAOD,GAAEG,GAAGQ,QAAkD,IAAI,GAA1CL,GAAkB,kBAATX,IAAqBA,EAAgBQ,EAAE,EAAEA,EAAEF,EAAEY,OAAOV,IAAID,EAAED,EAAEE,GAAI,OAAOD,KAAKY,GAAG,SAASnB,EAAQoB,EAAOJ,GACvhB,YAEA,IAAIK,GAAO,SAASC,EAAGC,GAEtB,GAAIjB,KA4JJ,OA1JAA,GAAEkB,MAAQ,SAAUC,GAEnB,MAAOH,GAAE,OACRA,EAAE,QAASC,EAAKG,YAChBJ,EAAE,iBACDK,K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