MailChimp for WordPress - Version 4.0.5

Version Description

Download this release

Release Info

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

Code changes from version 4.0.4 to 4.0.5

CHANGELOG.md CHANGED
@@ -1,6 +1,26 @@
1
  Changelog
2
  =========
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  #### 4.0.4 - September 7, 2016
5
 
6
  **Improvements**
1
  Changelog
2
  =========
3
 
4
+ #### 4.0.5 - September 29, 2016
5
+
6
+ **Fixes**
7
+
8
+ - Allow checkbox option for the List Choice field (again).
9
+
10
+ **Improvements**
11
+
12
+ - Fetch MailChimp lists over AJAX, to speed up perceived performance (especially when your account has many lists).
13
+ - Periodically fetch MailChimp lists, so cache is always fresh.
14
+ - Improved `<label>` element accessibility for checkbox integrations.
15
+ - Stop using double underscore prefix in function names, as these are reserved in PHP 7.
16
+ - `{post}` and `{user}` shortcodes now accept a `default` parameter.
17
+
18
+ **Additions**
19
+
20
+ - Add [MemberPress](https://www.memberpress.com/) integration.
21
+ - Add missing e-commerce related API methods for next week's [WooCommerce MailChimp e-commerce integration](https://mc4wp.com/kb/what-is-ecommerce360/) release.
22
+
23
+
24
  #### 4.0.4 - September 7, 2016
25
 
26
  **Improvements**
assets/css/admin-styles.css CHANGED
@@ -97,6 +97,12 @@
97
  #mc4wp-admin .status.neutral,
98
  .mc4wp-admin .status.neutral {
99
  background: gray; }
 
 
 
 
 
 
100
  #mc4wp-admin .valigntop,
101
  .mc4wp-admin .valigntop {
102
  vertical-align: top !important; }
@@ -169,6 +175,42 @@
169
  .mc4wp-admin .breadcrumbs {
170
  border-bottom: 1px solid #ccc;
171
  padding-bottom: 1em; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  #mc4wp-admin .tab,
173
  .mc4wp-admin .tab {
174
  display: none;
97
  #mc4wp-admin .status.neutral,
98
  .mc4wp-admin .status.neutral {
99
  background: gray; }
100
+ #mc4wp-admin .green,
101
+ .mc4wp-admin .green {
102
+ color: green; }
103
+ #mc4wp-admin .red,
104
+ .mc4wp-admin .red {
105
+ color: red; }
106
  #mc4wp-admin .valigntop,
107
  .mc4wp-admin .valigntop {
108
  vertical-align: top !important; }
175
  .mc4wp-admin .breadcrumbs {
176
  border-bottom: 1px solid #ccc;
177
  padding-bottom: 1em; }
178
+ #mc4wp-admin .mc4wp-loader,
179
+ .mc4wp-admin .mc4wp-loader {
180
+ position: relative;
181
+ display: inline-block;
182
+ text-indent: -9999999px;
183
+ border: 3px solid rgba(0, 0, 0, 0.2);
184
+ border-left-color: #000000;
185
+ -webkit-transform: translateZ(0);
186
+ -ms-transform: translateZ(0);
187
+ transform: translateZ(0);
188
+ -webkit-animation: load8 1.1s infinite linear;
189
+ animation: load8 1.1s infinite linear;
190
+ overflow: hidden;
191
+ border-radius: 50%;
192
+ vertical-align: middle;
193
+ width: 12px;
194
+ height: 12px;
195
+ margin-bottom: 3px;
196
+ margin-left: 3px;
197
+ margin-right: 3px; }
198
+
199
+ @-webkit-keyframes load8 {
200
+ 0% {
201
+ -webkit-transform: rotate(0deg);
202
+ transform: rotate(0deg); }
203
+ 100% {
204
+ -webkit-transform: rotate(360deg);
205
+ transform: rotate(360deg); } }
206
+
207
+ @keyframes load8 {
208
+ 0% {
209
+ -webkit-transform: rotate(0deg);
210
+ transform: rotate(0deg); }
211
+ 100% {
212
+ -webkit-transform: rotate(360deg);
213
+ transform: rotate(360deg); } }
214
  #mc4wp-admin .tab,
215
  .mc4wp-admin .tab {
216
  display: none;
assets/css/admin-styles.min.css CHANGED
@@ -1 +1 @@
1
- #mc4wp-admin .available-fields .in-form,#mc4wp-admin .hover-activated,.mc4wp-admin .available-fields .in-form,.mc4wp-admin .hover-activated{opacity:.5}#mc4wp-admin .cm-em,#mc4wp-admin .help,.mc4wp-admin .cm-em,.mc4wp-admin .help{font-style:italic}#mc4wp-admin .row,.mc4wp-admin .row{margin-left:-20px;margin-right:-20px;float:none}#mc4wp-admin .row .col,.mc4wp-admin .row .col{padding:0 20px;float:left;-webkit-box-sizing:border-box;-moz-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 .row .col-6,.mc4wp-admin .row .col-6{width:100%}#mc4wp-admin .clearfix:after,#mc4wp-admin .clearfix:before,#mc4wp-admin .row:after,#mc4wp-admin .row:before,.mc4wp-admin .clearfix:after,.mc4wp-admin .clearfix:before,.mc4wp-admin .row:after,.mc4wp-admin .row:before{content:" ";display:table}#mc4wp-admin .clearfix:after,#mc4wp-admin .row:after,.mc4wp-admin .clearfix:after,.mc4wp-admin .row:after{clear:both}@media (max-width:1200px){#mc4wp-admin .row .col,.mc4wp-admin .row .col{width:100%;float:none;margin:10px 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-top:60px;margin-bottom:60px}#mc4wp-admin .medium-margin,.mc4wp-admin .medium-margin{margin-top:40px;margin-bottom:40px}#mc4wp-admin .small-margin,.mc4wp-admin .small-margin{margin-top:20px;margin-bottom:20px}#mc4wp-admin .tiny-margin,.mc4wp-admin .tiny-margin{margin-top:10px;margin-bottom:10px}#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;background:inherit;border:none;font-weight:initial}#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}#mc4wp-admin .field-wizard td.stretch,.mc4wp-admin .field-wizard td.stretch,.overlay{width:100%}@-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;font-weight:400}#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 h4,.mc4wp-admin .available-fields h4{font-size:14px;margin-top:0}#mc4wp-admin .available-fields strong,.mc4wp-admin .available-fields strong{display:block;margin-bottom:6px}#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 .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}
1
+ #mc4wp-admin .available-fields .in-form,#mc4wp-admin .hover-activated,.mc4wp-admin .available-fields .in-form,.mc4wp-admin .hover-activated{opacity:.5}#mc4wp-admin .cm-em,#mc4wp-admin .help,.mc4wp-admin .cm-em,.mc4wp-admin .help{font-style:italic}#mc4wp-admin .row,.mc4wp-admin .row{margin-left:-20px;margin-right:-20px;float:none}#mc4wp-admin .row .col,.mc4wp-admin .row .col{padding:0 20px;float:left;-webkit-box-sizing:border-box;-moz-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 .row .col-6,.mc4wp-admin .row .col-6{width:100%}#mc4wp-admin .clearfix:after,#mc4wp-admin .clearfix:before,#mc4wp-admin .row:after,#mc4wp-admin .row:before,.mc4wp-admin .clearfix:after,.mc4wp-admin .clearfix:before,.mc4wp-admin .row:after,.mc4wp-admin .row:before{content:" ";display:table}#mc4wp-admin .clearfix:after,#mc4wp-admin .row:after,.mc4wp-admin .clearfix:after,.mc4wp-admin .row:after{clear:both}@media (max-width:1200px){#mc4wp-admin .row .col,.mc4wp-admin .row .col{width:100%;float:none;margin:10px 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-top:60px;margin-bottom:60px}#mc4wp-admin .medium-margin,.mc4wp-admin .medium-margin{margin-top:40px;margin-bottom:40px}#mc4wp-admin .small-margin,.mc4wp-admin .small-margin{margin-top:20px;margin-bottom:20px}#mc4wp-admin .tiny-margin,.mc4wp-admin .tiny-margin{margin-top:10px;margin-bottom:10px}#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 .mc4wp-loader,.mc4wp-admin .mc4wp-loader{position:relative;display:inline-block;text-indent:-9999999px;border:3px solid rgba(0,0,0,.2);border-left-color:#000;-webkit-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);-webkit-animation:load8 1.1s infinite linear;animation:load8 1.1s infinite linear;overflow:hidden;border-radius:50%;vertical-align:middle;width:12px;height:12px;margin-bottom:3px;margin-left:3px;margin-right:3px}@-webkit-keyframes load8{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes load8{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}#mc4wp-admin .tab,.mc4wp-admin .tab{display:none;background:inherit;border:none;font-weight:initial}#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}#mc4wp-admin .field-wizard td.stretch,.mc4wp-admin .field-wizard td.stretch,.overlay{width:100%}@-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;font-weight:400}#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 h4,.mc4wp-admin .available-fields h4{font-size:14px;margin-top:0}#mc4wp-admin .available-fields strong,.mc4wp-admin .available-fields strong{display:block;margin-bottom:6px}#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 .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/js/admin.js CHANGED
@@ -2,7 +2,7 @@
2
  'use strict';
3
 
4
  // dependencies
5
- var m = require('mithril');
6
  var EventEmitter = require('wolfy87-eventemitter');
7
 
8
  // vars
@@ -12,6 +12,13 @@ var tabs = require ('./admin/tabs.js')(context);
12
  var helpers = require('./admin/helpers.js');
13
  var settings = require('./admin/settings.js')(context, helpers, events);
14
 
 
 
 
 
 
 
 
15
  // expose some things
16
  window.mc4wp = window.mc4wp || {};
17
  window.mc4wp.deps = window.mc4wp.deps || {};
@@ -20,7 +27,7 @@ window.mc4wp.helpers = helpers;
20
  window.mc4wp.events = events;
21
  window.mc4wp.settings = settings;
22
  window.mc4wp.tabs = tabs;
23
- },{"./admin/helpers.js":2,"./admin/settings.js":3,"./admin/tabs.js":4,"mithril":6,"wolfy87-eventemitter":7}],2:[function(require,module,exports){
24
  'use strict';
25
 
26
  var helpers = {};
@@ -64,6 +71,7 @@ helpers.debounce = function(func, wait, immediate) {
64
  };
65
  };
66
 
 
67
  /**
68
  * Showif.js
69
  */
@@ -112,6 +120,71 @@ helpers.debounce = function(func, wait, immediate) {
112
 
113
  module.exports = helpers;
114
  },{}],3:[function(require,module,exports){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  var Settings = function(context, helpers, events ) {
116
  'use strict';
117
 
@@ -177,7 +250,7 @@ var Settings = function(context, helpers, events ) {
177
  };
178
 
179
  module.exports = Settings;
180
- },{}],4:[function(require,module,exports){
181
  'use strict';
182
 
183
  var URL = require('./url.js');
@@ -352,7 +425,7 @@ var Tabs = function(context) {
352
  };
353
 
354
  module.exports = Tabs;
355
- },{"./url.js":5}],5:[function(require,module,exports){
356
  'use strict';
357
 
358
  var URL = {
@@ -383,7 +456,7 @@ var URL = {
383
  };
384
 
385
  module.exports = URL;
386
- },{}],6:[function(require,module,exports){
387
  ;(function (global, factory) { // eslint-disable-line
388
  "use strict"
389
  /* eslint-disable no-undef */
@@ -2618,7 +2691,7 @@ module.exports = URL;
2618
  return m
2619
  }); // eslint-disable-line
2620
 
2621
- },{}],7:[function(require,module,exports){
2622
  /*!
2623
  * EventEmitter v4.2.11 - git.io/ee
2624
  * Unlicense - http://unlicense.org/
2
  'use strict';
3
 
4
  // dependencies
5
+ var m = window.m = require('mithril');
6
  var EventEmitter = require('wolfy87-eventemitter');
7
 
8
  // vars
12
  var helpers = require('./admin/helpers.js');
13
  var settings = require('./admin/settings.js')(context, helpers, events);
14
 
15
+ // list fetcher
16
+ var ListFetcher = require('./admin/list-fetcher.js');
17
+ var mount = document.getElementById('mc4wp-list-fetcher');
18
+ if( mount ) {
19
+ m.mount(mount, new ListFetcher);
20
+ }
21
+
22
  // expose some things
23
  window.mc4wp = window.mc4wp || {};
24
  window.mc4wp.deps = window.mc4wp.deps || {};
27
  window.mc4wp.events = events;
28
  window.mc4wp.settings = settings;
29
  window.mc4wp.tabs = tabs;
30
+ },{"./admin/helpers.js":2,"./admin/list-fetcher.js":3,"./admin/settings.js":4,"./admin/tabs.js":5,"mithril":7,"wolfy87-eventemitter":8}],2:[function(require,module,exports){
31
  'use strict';
32
 
33
  var helpers = {};
71
  };
72
  };
73
 
74
+
75
  /**
76
  * Showif.js
77
  */
120
 
121
  module.exports = helpers;
122
  },{}],3:[function(require,module,exports){
123
+ 'use strict';
124
+
125
+ var $ = window.jQuery;
126
+ var config = mc4wp_vars;
127
+ var i18n = config.i18n;
128
+
129
+ function ListFetcher() {
130
+ this.working = false;
131
+ this.done = false;
132
+
133
+ // start fetching right away when no lists but api key given
134
+ if( config.mailchimp.api_connected && config.mailchimp.lists.length == 0 ) {
135
+ this.fetch();
136
+ }
137
+ }
138
+
139
+ ListFetcher.prototype.fetch = function (e) {
140
+ e && e.preventDefault();
141
+
142
+ this.working = true;
143
+ this.done = false;
144
+
145
+ $.post(ajaxurl, {
146
+ action: "mc4wp_renew_mailchimp_lists"
147
+ }).done(function(data) {
148
+ if(data) {
149
+ window.setTimeout(function() { window.location.reload(); }, 3000 );
150
+ }
151
+ }).always(function (data) {
152
+ this.working = false;
153
+ this.done = true;
154
+
155
+ m.redraw();
156
+ }.bind(this));
157
+ };
158
+
159
+ ListFetcher.prototype.view = function () {
160
+ return m('form', {
161
+ method: "POST",
162
+ onsubmit: this.fetch.bind(this)
163
+ }, [
164
+ m('p', [
165
+ m('input', {
166
+ type: "submit",
167
+ value: this.working ? i18n.fetching_mailchimp_lists : i18n.renew_mailchimp_lists,
168
+ className: "button",
169
+ disabled: !!this.working
170
+ }),
171
+ m.trust(' &nbsp; '),
172
+
173
+ this.working ? [
174
+ m('span.mc4wp-loader', "Loading..."),
175
+ m.trust(' &nbsp; '),
176
+ m('em.help', i18n.fetching_mailchimp_lists_can_take_a_while)
177
+ ]: '',
178
+
179
+ this.done ? [
180
+ m( 'em.help.green', i18n.fetching_mailchimp_lists_done )
181
+ ] : ''
182
+ ])
183
+ ]);
184
+ };
185
+
186
+ module.exports = ListFetcher;
187
+ },{}],4:[function(require,module,exports){
188
  var Settings = function(context, helpers, events ) {
189
  'use strict';
190
 
250
  };
251
 
252
  module.exports = Settings;
253
+ },{}],5:[function(require,module,exports){
254
  'use strict';
255
 
256
  var URL = require('./url.js');
425
  };
426
 
427
  module.exports = Tabs;
428
+ },{"./url.js":6}],6:[function(require,module,exports){
429
  'use strict';
430
 
431
  var URL = {
456
  };
457
 
458
  module.exports = URL;
459
+ },{}],7:[function(require,module,exports){
460
  ;(function (global, factory) { // eslint-disable-line
461
  "use strict"
462
  /* eslint-disable no-undef */
2691
  return m
2692
  }); // eslint-disable-line
2693
 
2694
+ },{}],8:[function(require,module,exports){
2695
  /*!
2696
  * EventEmitter v4.2.11 - git.io/ee
2697
  * Unlicense - http://unlicense.org/
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(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("radio"!==this.getAttribute("type")||this.checked){var t="checkbox"===this.getAttribute("type")?this.checked:this.value,r=t==n.value;a?(e.style.display=r?"":"none",e.style.visibility=r?"":"hidden"):e.style.opacity=r?"":"0.4",Array.prototype.forEach.call(i,function(e){r?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){"use strict";var r=e("./url.js"),o=function(e){function t(e){for(var t=0;t<d.length;t++)if(d[t].id===e)return d[t]}function n(e,n){if("string"==typeof e&&(e=t(e)),!e)return!1;void 0==n&&(n=!0),s.removeClass("tab-active").css("display","none"),c.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 i=r.setParameter(window.location.href,"tab",e.id);return history.pushState&&n&&history.pushState(e.id,"",i),o(e),f.value=i,"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 o=this.className.match(/nav-tab-(\w+)?/);o&&(t=o[1])}if(!t){var i=r.parse(this.href);if(!i.tab)return;t=i.tab}var a=n(t);return!a||(e.preventDefault(),e.returnValue=!1,!1)}function a(){if(history.pushState){var e=s.filter(":visible").get(0);if(e){var n=t(e.id.substring(4));n&&(history.replaceState&&null===history.state&&history.replaceState(n.id,""),o(n))}}}var u=window.jQuery,l=u(e),s=l.find(".tab"),c=l.find(".nav-tab"),f=e.querySelector('input[name="_wp_http_referer"]'),d=[];return u.each(s,function(t,r){var o=r.id.substring(4),i=u(r).find("h2").first().text();d.push({id:o,title:i,element:r,nav:e.querySelectorAll(".nav-tab-"+o),open:function(){return n(o)}})}),c.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 n(t,!1)}),{open:n,get:t}};t.exports=o},{"./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:this,function(e,t){"use strict";function n(e){return"function"==typeof e}function r(e){return"[object Object]"===ke.call(e)}function o(e){return"[object String]"===ke.call(e)}function i(){}function a(e){Ae=e.document,Ce=e.location,Le=e.cancelAnimationFrame||e.clearTimeout,Oe=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]||""}return r}function l(e,t){var n=t?e.slice(1):e;return 1===n.length&&Ne(n[0])?n[0]:n}function s(e,t,n){var r="class"in t?"class":"className";for(var o in t)je.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){for(var n=[],i=1,a=arguments.length;i<a;i++)n[i-1]=arguments[i];if(r(e))return re(e,n);if(!o(e))throw new Error("selector in m(selector, attrs, children) should be a string");var c=null!=t&&r(t)&&!("tag"in t||"view"in t||"subtree"in t),f=c?t:{},d={tag:"div",attrs:{},children:l(n,c)};return s(d.attrs,f,u(d,e)),d}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++)Ne(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:_e,index:r,from:t[e].index,element:n.nodes[t[e].index]||Ae.createElement("div")}:{action:Re,index:r}});var o=[];for(var i in t)je.call(t,i)&&o.push(t[i]);var a=o.sort($),u=new Array(n.length);return u.nodes=n.nodes.slice(),f(a,function(t){var o=t.index;if(t.action===Te&&(G(n[o].nodes,n[o]),u.splice(o,1)),t.action===Re){var i=Ae.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===_e){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 b(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 E(e,t,n){return e.tag!==t.tag||(n.sort().join()!==Object.keys(t.attrs).sort().join()||(e.attrs.id!==t.attrs.id||(e.attrs.key!==t.attrs.key||("all"===c.redraw.strategy()?!t.configContext||t.configContext.retain!==!0:"diff"===c.redraw.strategy()&&(t.configContext&&t.configContext.retain===!1)))))}function x(e,t,r){E(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),Me&&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=H(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=Z(t,n,e):(r=[Ae.createTextNode(e)],t.nodeName in Se||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===Ae.activeElement||(e.$trusted?(G(a,t),a=Z(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=[Ae.createTextNode(e)]),p(n,a[0],o,e))),t=new e.constructor(e),t.nodes=a,t}function N(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 S(e){if(e.$trusted){var t=e.match(/<[^\/]|\>\s*[^<]/g);if(null!=t)return t.length}else if(Ne(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:Te,index:t}}),b(e),m&&(n=y(e,n,p,r));for(var g=0,E=0,x=e.length;E<x;E++){var A=H(r,i,n,o,e[E],n[g],a,o+h||h,u,l,s);A!==t&&(f=f&&A.nodes.intact,h+=S(A),n[g++]=A)}return f||w(e,n,c),n}function R(e,t,n,r,o){if(null!=t){if(ke.call(t)===ke.call(e))return t;if(o&&o.nodes){var i=n-r,a=i+(Ne(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?Ae.createElement(e.tag,e.attrs.is):Ae.createElementNS(t,e.tag,e.attrs.is):null==t?Ae.createElement(e.tag):Ae.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?H(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 P(e,t,n,r){null!=r.onunload&&De.map(function(e){return e.handler}).indexOf(r.onunload)<0&&De.push({controller:r,handler:r.onunload}),e.push(n),t.push(r)}function U(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===Me||Ie||r&&r.indexOf(a)>-1?e.view(a):{tag:"placeholder"},"retain"===e.subtree?e:(e.attrs=e.attrs||{},e.attrs.key=u,P(i,o,t,a),e)}function V(e,t,n,r){for(var o=t&&t.controllers;null!=e.view;)e=U(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);m(r,p,i);var 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 H(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),Ne(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:N(u,a,s,e,l,c,t))}function $(e,t){return e.action-t.action||e.index-t.index}function B(e,t,n){for(var r in t)je.call(t,r)&&(null!=n&&n[r]===t[r]||(e.style[r]=t[r]));for(r in n)je.call(n,r)&&(je.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]=ee(o,e);else if("style"===t&&null!=o&&r(o))B(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&&!Pe[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&&Ae.activeElement!==e)"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)!je.call(n,i)||!K(e,i,n[i],r[i],r,t,o);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&&(Ne(e.children)?f(e.children,Q):e.children.tag&&Q(e.children))}function Y(e,t){try{e.appendChild(Ae.createRange().createContextualFragment(t))}catch(n){e.insertAdjacentHTML("beforeend",t),W(e)}}function W(e){if("SCRIPT"===e.tagName)e.parentNode.replaceChild(X(e),e);else{var t=e.childNodes;if(t&&t.length)for(var n=0;n<t.length;n++)W(t[n])}return e}function X(e){for(var t=document.createElement("script"),n=e.attributes,r=0;r<n.length;r++)t.setAttribute(n[r].name,n[r].value);return t.text=e.innerHTML,t}function Z(e,t,n){var r=e.childNodes[t];if(r){var o=1!==r.nodeType,i=Ae.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 ee(e,t){return function(n){n=n||event,c.redraw.strategy("diff"),c.startComputation();try{return e.call(t,n)}finally{ue()}}}function te(e){var t=Ve.indexOf(e);return t<0?Ve.push(e)-1:t}function ne(e){function t(){return arguments.length&&(e=arguments[0]),e}return t.toJSON=function(){return e},t}function re(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 oe(e,t,n,r){if(!r){c.redraw.strategy("all"),c.startComputation(),$e[n]=t;var o;o=He=e?e:e={controller:i};var a=new(e.controller||i);return o===He&&(Je[n]=a,Be[n]=e),ue(),null===e&&ie(t,n),Je[n]}null==e&&ie(t,n)}function ie(e,t){$e.splice(t,1),Je.splice(t,1),Be.splice(t,1),pe(e),Ve.splice(te(e),1)}function ae(){Ge&&(Ge(),Ge=null),f($e,function(e,t){var n=Be[t];if(Je[t]){var r=[Je[t]];c.render(e,n.view?n.view(Je[t],r):"")}}),Qe&&(Qe(),Qe=null),Ke=null,Fe=new Date,c.redraw.strategy("diff")}function ue(){"none"===c.redraw.strategy()?(Me--,c.redraw.strategy("diff")):c.endComputation()}function le(e){return e.slice(et[c.route.mode].length)}function se(e,t,n){Xe={};var r=n.indexOf("?");r!==-1&&(Xe=he(n.substr(r+1,n.length)),n=n.substr(0,r));var o=Object.keys(t),i=o.indexOf(n);if(i!==-1)return c.mount(e,t[o[i]]),!0;for(var a in t)if(je.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){Xe[e.replace(/:|\./g,"")]=decodeURIComponent(r[t])}),c.mount(e,t[a])}),!0}}function ce(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?he(n.search.slice(1)):{};n&&!/a/i.test(n.nodeName);)n=n.parentNode;Me=0,c.route(n[c.route.mode].slice(et[c.route.mode].length),t)}}function fe(){"hash"!==c.route.mode&&Ce.hash?Ce.hash=Ce.hash:e.scrollTo(0,0)}function de(e,n){var o={},i=[];for(var a in e)if(je.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(de(l,u));else if(Ne(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 he(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]?(Ne(n[r])||(n[r]=[n[r]]),n[r].push(o)):n[r]=o}),n}function pe(e){var n=te(e);G(e.childNodes,ze[n]),ze[n]=t}function ve(e,t){var n=c.prop(t);return e.then(n),n.then=function(n,r){return ve(e.then(n,r),t)},n["catch"]=n.then.bind(null,null),n}function me(e,t){function o(e){l=e||at,f.map(function(e){l===it?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=ot,a()}l===ot&&c.deferred.onerror(s),i(r,function(){l=rt,a()},function(){l=ot,a()},function(){try{l===rt&&n(e)?s=e(s):l===ot&&n(t)&&(s=t(s),l=rt)}catch(a){return c.deferred.onerror(a),s=a,o()}s===u?(s=TypeError(),o()):i(r,function(){o(it)},o,function(){o(l===rt&&it)})})}var u=this,l=0,s=0,f=[];u.promise={},u.resolve=function(e){return l||(s=e,l=rt,a()),u},u.reject=function(e){return l||(s=e,l=ot,a()),u},u.promise.then=function(e,t){var n=new me(e,t);return l===it?n.resolve(s):l===at?n.reject(s):f.push(n),n.promise}}function ge(e){return e}function ye(n){var r=n.callbackName||"mithril_callback_"+(new Date).getTime()+"_"+Math.round(1e16*Math.random()).toString(36),o=Ae.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+"&"+de(n.data||{}),Ae.body.appendChild(o)}function we(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 be(e){return e.dataType&&"jsonp"===e.dataType.toLowerCase()?ye(e):we(e)}function Ee(e,t,n){if("GET"===e.method&&"jsonp"!==e.dataType){var r=e.url.indexOf("?")<0?"?":"&",o=de(t);e.url+=o?r+o:""}else e.data=n(t)}function xe(e,t){return t&&(e=e.replace(/:[a-z]\w+/gi,function(e){var n=e.slice(1),r=t[n]||e;return delete t[n],r})),e}c.version=function(){return"v0.2.5"};var Ae,Ce,Oe,Le,je={}.hasOwnProperty,ke={}.toString,Ne=Array.isArray||function(e){return"[object Array]"===ke.call(e)},Se={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 Te=1,Re=2,_e=3,Me=0;c.startComputation=function(){Me++},c.endComputation=function(){Me>1?Me--:(Me=0,c.redraw())};var qe,De=[],Ie=!1,Pe={list:1,style:1,form:1,type:1,width:1,height:1},Ue={appendChild:function(e){qe===t&&(qe=Ae.createElement("html")),Ae.documentElement&&Ae.documentElement!==e?Ae.replaceChild(e,Ae.documentElement):Ae.appendChild(e),this.childNodes=Ae.childNodes},insertBefore:function(e){this.appendChild(e)},childNodes:[]},Ve=[],ze={};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=te(e),u=e===Ae;o=u||e===Ae.documentElement?Ue:e,u&&"html"!==n.tag&&(n={tag:"html",attrs:{},children:n}),ze[a]===t&&G(o.childNodes),r===!0&&pe(e),ze[a]=H(o,null,t,t,n,ze[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))||"undefined"!=typeof Promise&&e instanceof Promise)&&n(e.then)?ve(e):ne(e)};var He,$e=[],Be=[],Je=[],Ke=null,Fe=0,Ge=null,Qe=null,Ye=16;c.component=function(e){for(var t=new Array(arguments.length-1),n=1;n<arguments.length;n++)t[n-1]=arguments[n];return re(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=$e.indexOf(e);r<0&&(r=$e.length);var o=!1,i={preventDefault:function(){o=!0,Ge=Qe=null}};return f(De,function(e){e.handler.call(e.controller,i),e.controller.onunload=null}),o?f(De,function(e){e.controller.onunload=e.handler}):De=[],Je[r]&&n(Je[r].onunload)&&Je[r].onunload(i),oe(t,e,r,o)};var We=!1;c.redraw=function(t){if(!We){We=!0,t&&(Ie=!0);try{Ke&&!t?(Oe===e.requestAnimationFrame||new Date-Fe>Ye)&&(Ke>0&&Le(Ke),Ke=Oe(ae,Ye)):(ae(),Ke=Oe(function(){Ke=null},Ye))}finally{We=Ie=!1}}},c.redraw.strategy=c.prop(),c.withAttr=function(e,t,n){return function(r){r=r||window.event;var o=r.currentTarget||this,i=n||this,a=e in o?o[e]:o.getAttribute(e);t.call(i,a)}};var Xe,Ze,et={pathname:"",hash:"#",search:"?"},tt=i,nt=!1;c.route=function(t,n,r,i){if(0===arguments.length)return Ze;if(3===arguments.length&&o(n)){tt=function(e){var o=Ze=le(e);if(!se(t,r,o)){if(nt)throw new Error("Ensure the default route matches one of the routes defined in m.route");nt=!0,c.route(n,!0),nt=!1}};var a="hash"===c.route.mode?"onhashchange":"onpopstate";return e[a]=function(){var e=Ce[c.route.mode];"pathname"===c.route.mode&&(e+=Ce.search),Ze!==le(e)&&tt(e)},Ge=fe,void e[a]()}if(t.addEventListener||t.attachEvent){var u="pathname"!==c.route.mode?Ce.pathname:"";return t.href=u+et[c.route.mode]+i.attrs.href,void(t.addEventListener?(t.removeEventListener("click",ce),t.addEventListener("click",ce)):(t.detachEvent("onclick",ce),t.attachEvent("onclick",ce)))}if(o(t)){var l=Ze;Ze=t;var s,f=n||{},d=Ze.indexOf("?");s=d>-1?he(Ze.slice(d+1)):{};for(var h in f)je.call(f,h)&&(s[h]=f[h]);var p,v=de(s);p=d>-1?Ze.slice(0,d):Ze,v&&(Ze=p+(p.indexOf("?")===-1?"?":"&")+v);var m=(3===arguments.length?r:n)===!0||l===t;if(e.history.pushState){var g=m?"replaceState":"pushState";Ge=fe,Qe=function(){try{e.history[g](null,Ae.title,et[c.route.mode]+Ze)}catch(t){Ce[c.route.mode]=Ze}},tt(et[c.route.mode]+Ze)}else Ce[c.route.mode]=Ze,tt(et[c.route.mode]+Ze)}},c.route.param=function(e){if(!Xe)throw new Error("You must call m.route(element, defaultRoute, routes) before calling m.route.param()");return e?Xe[e]:Xe},c.route.mode="search",c.route.buildQueryString=de,c.route.parseQueryString=he,c.deferred=function(){var e=new me;return e.promise=ve(e.promise),e};var rt=1,ot=2,it=3,at=4;return c.deferred.onerror=function(e){if("[object Error]"===ke.call(e)&&!/ Error/.test(e.constructor.toString()))throw Me=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=[],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 me,i=e.dataType&&"jsonp"===e.dataType.toLowerCase();return i?(t=e.serialize=n=e.deserialize=ge,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=xe(e.url,e.data),Ee(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)),Ne(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),c.deferred.onerror(a)}finally{e.background!==!0&&c.endComputation()}},be(e),o.promise=ve(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)&&r(o[n],t)===-1&&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),n!==-1&&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},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
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=window.m=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),c=e("./admin/list-fetcher.js"),f=document.getElementById("mc4wp-list-fetcher");f&&r.mount(f,new c),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/list-fetcher.js":3,"./admin/settings.js":4,"./admin/tabs.js":5,mithril:7,"wolfy87-eventemitter":8}],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("radio"!==this.getAttribute("type")||this.checked){var t="checkbox"===this.getAttribute("type")?this.checked:this.value,r=t==n.value;a?(e.style.display=r?"":"none",e.style.visibility=r?"":"hidden"):e.style.opacity=r?"":"0.4",Array.prototype.forEach.call(i,function(e){r?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){"use strict";function r(){this.working=!1,this.done=!1,i.mailchimp.api_connected&&0==i.mailchimp.lists.length&&this.fetch()}var o=window.jQuery,i=mc4wp_vars,a=i.i18n;r.prototype.fetch=function(e){e&&e.preventDefault(),this.working=!0,this.done=!1,o.post(ajaxurl,{action:"mc4wp_renew_mailchimp_lists"}).done(function(e){e&&window.setTimeout(function(){window.location.reload()},3e3)}).always(function(e){this.working=!1,this.done=!0,m.redraw()}.bind(this))},r.prototype.view=function(){return m("form",{method:"POST",onsubmit:this.fetch.bind(this)},[m("p",[m("input",{type:"submit",value:this.working?a.fetching_mailchimp_lists:a.renew_mailchimp_lists,className:"button",disabled:!!this.working}),m.trust(" &nbsp; "),this.working?[m("span.mc4wp-loader","Loading..."),m.trust(" &nbsp; "),m("em.help",a.fetching_mailchimp_lists_can_take_a_while)]:"",this.done?[m("em.help.green",a.fetching_mailchimp_lists_done)]:""])])},t.exports=r},{}],4:[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},{}],5:[function(e,t,n){"use strict";var r=e("./url.js"),o=function(e){function t(e){for(var t=0;t<d.length;t++)if(d[t].id===e)return d[t]}function n(e,n){if("string"==typeof e&&(e=t(e)),!e)return!1;void 0==n&&(n=!0),s.removeClass("tab-active").css("display","none"),c.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 i=r.setParameter(window.location.href,"tab",e.id);return history.pushState&&n&&history.pushState(e.id,"",i),o(e),f.value=i,"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 o=this.className.match(/nav-tab-(\w+)?/);o&&(t=o[1])}if(!t){var i=r.parse(this.href);if(!i.tab)return;t=i.tab}var a=n(t);return!a||(e.preventDefault(),e.returnValue=!1,!1)}function a(){if(history.pushState){var e=s.filter(":visible").get(0);if(e){var n=t(e.id.substring(4));n&&(history.replaceState&&null===history.state&&history.replaceState(n.id,""),o(n))}}}var u=window.jQuery,l=u(e),s=l.find(".tab"),c=l.find(".nav-tab"),f=e.querySelector('input[name="_wp_http_referer"]'),d=[];return u.each(s,function(t,r){var o=r.id.substring(4),i=u(r).find("h2").first().text();d.push({id:o,title:i,element:r,nav:e.querySelectorAll(".nav-tab-"+o),open:function(){return n(o)}})}),c.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 n(t,!1)}),{open:n,get:t}};t.exports=o},{"./url.js":6}],6:[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},{}],7:[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:this,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){Ae=e.document,Ce=e.location,ke=e.cancelAnimationFrame||e.clearTimeout,Oe=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]||""}return r}function l(e,t){var n=t?e.slice(1):e;return 1===n.length&&Ne(n[0])?n[0]:n}function s(e,t,n){var r="class"in t?"class":"className";for(var o in t)je.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){for(var n=[],i=1,a=arguments.length;i<a;i++)n[i-1]=arguments[i];if(r(e))return re(e,n);if(!o(e))throw new Error("selector in m(selector, attrs, children) should be a string");var c=null!=t&&r(t)&&!("tag"in t||"view"in t||"subtree"in t),f=c?t:{},d={tag:"div",attrs:{},children:l(n,c)};return s(d.attrs,f,u(d,e)),d}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++)Ne(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:Re,index:r,from:t[e].index,element:n.nodes[t[e].index]||Ae.createElement("div")}:{action:_e,index:r}});var o=[];for(var i in t)je.call(t,i)&&o.push(t[i]);var a=o.sort(H),u=new Array(n.length);return u.nodes=n.nodes.slice(),f(a,function(t){var o=t.index;if(t.action===Te&&(G(n[o].nodes,n[o]),u.splice(o,1)),t.action===_e){var i=Ae.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===Re){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 b(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 E(e,t,n){return e.tag!==t.tag||(n.sort().join()!==Object.keys(t.attrs).sort().join()||(e.attrs.id!==t.attrs.id||(e.attrs.key!==t.attrs.key||("all"===c.redraw.strategy()?!t.configContext||t.configContext.retain!==!0:"diff"===c.redraw.strategy()&&(t.configContext&&t.configContext.retain===!1)))))}function x(e,t,r){E(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),Me&&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 k(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=B(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=Z(t,n,e):(r=[Ae.createTextNode(e)],t.nodeName in Se||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 L(e,t,n,r,o,i){var a=t.nodes;return r&&r===Ae.activeElement||(e.$trusted?(G(a,t),a=Z(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=[Ae.createTextNode(e)]),p(n,a[0],o,e))),t=new e.constructor(e),t.nodes=a,t}function N(e,t,n,r,o,i,a){return e.nodes.length?e.valueOf()!==t.valueOf()||o?L(t,e,r,i,n,a):(e.nodes.intact=!0,e):j(t,r,n)}function S(e){if(e.$trusted){var t=e.match(/<[^\/]|\>\s*[^<]/g);if(null!=t)return t.length}else if(Ne(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:Te,index:t}}),b(e),m&&(n=y(e,n,p,r));for(var g=0,E=0,x=e.length;E<x;E++){var A=B(r,i,n,o,e[E],n[g],a,o+h||h,u,l,s);A!==t&&(f=f&&A.nodes.intact,h+=S(A),n[g++]=A)}return f||w(e,n,c),n}function _(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+(Ne(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 R(e,t){return e.attrs.is?null==t?Ae.createElement(e.tag,e.attrs.is):Ae.createElementNS(t,e.tag,e.attrs.is):null==t?Ae.createElement(e.tag):Ae.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?B(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 P(e,t,n,r){null!=r.onunload&&De.map(function(e){return e.handler}).indexOf(r.onunload)<0&&De.push({controller:r,handler:r.onunload}),e.push(n),t.push(r)}function U(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===Me||Ie||r&&r.indexOf(a)>-1?e.view(a):{tag:"placeholder"},"retain"===e.subtree?e:(e.attrs=e.attrs||{},e.attrs.key=u,P(i,o,t,a),e)}function V(e,t,n,r){for(var o=t&&t.controllers;null!=e.view;)e=U(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=R(e,u);var v=M(e,p,u,d);m(r,p,i);var g=q(e,p,t,n,u,l);t=D(e,v,g,p,u,s,c)}else p=k(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 B(e,t,o,i,a,u,l,s,c,f,d){return a=h(a),"retain"===a.subtree?u:(u=_(a,u,s,i,o),Ne(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:N(u,a,s,e,l,c,t))}function H(e,t){return e.action-t.action||e.index-t.index}function $(e,t,n){for(var r in t)je.call(t,r)&&(null!=n&&n[r]===t[r]||(e.style[r]=t[r]));for(r in n)je.call(n,r)&&(je.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]=ee(o,e);else if("style"===t&&null!=o&&r(o))$(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&&!Pe[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&&Ae.activeElement!==e)"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)!je.call(n,i)||!K(e,i,n[i],r[i],r,t,o);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&&(Ne(e.children)?f(e.children,Q):e.children.tag&&Q(e.children))}function Y(e,t){try{e.appendChild(Ae.createRange().createContextualFragment(t))}catch(n){e.insertAdjacentHTML("beforeend",t),W(e)}}function W(e){if("SCRIPT"===e.tagName)e.parentNode.replaceChild(X(e),e);else{var t=e.childNodes;if(t&&t.length)for(var n=0;n<t.length;n++)W(t[n])}return e}function X(e){for(var t=document.createElement("script"),n=e.attributes,r=0;r<n.length;r++)t.setAttribute(n[r].name,n[r].value);return t.text=e.innerHTML,t}function Z(e,t,n){var r=e.childNodes[t];if(r){var o=1!==r.nodeType,i=Ae.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 ee(e,t){return function(n){n=n||event,c.redraw.strategy("diff"),c.startComputation();try{return e.call(t,n)}finally{ue()}}}function te(e){var t=Ve.indexOf(e);return t<0?Ve.push(e)-1:t}function ne(e){function t(){return arguments.length&&(e=arguments[0]),e}return t.toJSON=function(){return e},t}function re(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 oe(e,t,n,r){if(!r){c.redraw.strategy("all"),c.startComputation(),He[n]=t;var o;o=Be=e?e:e={controller:i};var a=new(e.controller||i);return o===Be&&(Je[n]=a,$e[n]=e),ue(),null===e&&ie(t,n),Je[n]}null==e&&ie(t,n)}function ie(e,t){He.splice(t,1),Je.splice(t,1),$e.splice(t,1),pe(e),Ve.splice(te(e),1)}function ae(){Ge&&(Ge(),Ge=null),f(He,function(e,t){var n=$e[t];if(Je[t]){var r=[Je[t]];c.render(e,n.view?n.view(Je[t],r):"")}}),Qe&&(Qe(),Qe=null),Ke=null,Fe=new Date,c.redraw.strategy("diff")}function ue(){"none"===c.redraw.strategy()?(Me--,c.redraw.strategy("diff")):c.endComputation()}function le(e){return e.slice(et[c.route.mode].length)}function se(e,t,n){Xe={};var r=n.indexOf("?");r!==-1&&(Xe=he(n.substr(r+1,n.length)),n=n.substr(0,r));var o=Object.keys(t),i=o.indexOf(n);if(i!==-1)return c.mount(e,t[o[i]]),!0;for(var a in t)if(je.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){Xe[e.replace(/:|\./g,"")]=decodeURIComponent(r[t])}),c.mount(e,t[a])}),!0}}function ce(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?he(n.search.slice(1)):{};n&&!/a/i.test(n.nodeName);)n=n.parentNode;Me=0,c.route(n[c.route.mode].slice(et[c.route.mode].length),t)}}function fe(){"hash"!==c.route.mode&&Ce.hash?Ce.hash=Ce.hash:e.scrollTo(0,0)}function de(e,n){var o={},i=[];for(var a in e)if(je.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(de(l,u));else if(Ne(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 he(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]?(Ne(n[r])||(n[r]=[n[r]]),n[r].push(o)):n[r]=o}),n}function pe(e){var n=te(e);G(e.childNodes,ze[n]),ze[n]=t}function ve(e,t){var n=c.prop(t);return e.then(n),n.then=function(n,r){return ve(e.then(n,r),t)},n["catch"]=n.then.bind(null,null),n}function me(e,t){function o(e){l=e||at,f.map(function(e){l===it?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=ot,a()}l===ot&&c.deferred.onerror(s),i(r,function(){l=rt,a()},function(){l=ot,a()},function(){try{l===rt&&n(e)?s=e(s):l===ot&&n(t)&&(s=t(s),l=rt)}catch(a){return c.deferred.onerror(a),s=a,o()}s===u?(s=TypeError(),o()):i(r,function(){o(it)},o,function(){o(l===rt&&it)})})}var u=this,l=0,s=0,f=[];u.promise={},u.resolve=function(e){return l||(s=e,l=rt,a()),u},u.reject=function(e){return l||(s=e,l=ot,a()),u},u.promise.then=function(e,t){var n=new me(e,t);return l===it?n.resolve(s):l===at?n.reject(s):f.push(n),n.promise}}function ge(e){return e}function ye(n){var r=n.callbackName||"mithril_callback_"+(new Date).getTime()+"_"+Math.round(1e16*Math.random()).toString(36),o=Ae.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+"&"+de(n.data||{}),Ae.body.appendChild(o)}function we(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 be(e){return e.dataType&&"jsonp"===e.dataType.toLowerCase()?ye(e):we(e)}function Ee(e,t,n){if("GET"===e.method&&"jsonp"!==e.dataType){var r=e.url.indexOf("?")<0?"?":"&",o=de(t);e.url+=o?r+o:""}else e.data=n(t)}function xe(e,t){return t&&(e=e.replace(/:[a-z]\w+/gi,function(e){var n=e.slice(1),r=t[n]||e;return delete t[n],r})),e}c.version=function(){return"v0.2.5"};var Ae,Ce,Oe,ke,je={}.hasOwnProperty,Le={}.toString,Ne=Array.isArray||function(e){return"[object Array]"===Le.call(e)},Se={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 Te=1,_e=2,Re=3,Me=0;c.startComputation=function(){Me++},c.endComputation=function(){Me>1?Me--:(Me=0,c.redraw())};var qe,De=[],Ie=!1,Pe={list:1,style:1,form:1,type:1,width:1,height:1},Ue={appendChild:function(e){qe===t&&(qe=Ae.createElement("html")),Ae.documentElement&&Ae.documentElement!==e?Ae.replaceChild(e,Ae.documentElement):Ae.appendChild(e),this.childNodes=Ae.childNodes},insertBefore:function(e){this.appendChild(e)},childNodes:[]},Ve=[],ze={};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=te(e),u=e===Ae;o=u||e===Ae.documentElement?Ue:e,u&&"html"!==n.tag&&(n={tag:"html",attrs:{},children:n}),ze[a]===t&&G(o.childNodes),r===!0&&pe(e),ze[a]=B(o,null,t,t,n,ze[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))||"undefined"!=typeof Promise&&e instanceof Promise)&&n(e.then)?ve(e):ne(e)};var Be,He=[],$e=[],Je=[],Ke=null,Fe=0,Ge=null,Qe=null,Ye=16;c.component=function(e){for(var t=new Array(arguments.length-1),n=1;n<arguments.length;n++)t[n-1]=arguments[n];return re(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=He.indexOf(e);r<0&&(r=He.length);var o=!1,i={preventDefault:function(){o=!0,Ge=Qe=null}};return f(De,function(e){e.handler.call(e.controller,i),e.controller.onunload=null}),o?f(De,function(e){e.controller.onunload=e.handler}):De=[],Je[r]&&n(Je[r].onunload)&&Je[r].onunload(i),oe(t,e,r,o)};var We=!1;c.redraw=function(t){if(!We){We=!0,t&&(Ie=!0);try{Ke&&!t?(Oe===e.requestAnimationFrame||new Date-Fe>Ye)&&(Ke>0&&ke(Ke),Ke=Oe(ae,Ye)):(ae(),Ke=Oe(function(){Ke=null},Ye))}finally{We=Ie=!1}}},c.redraw.strategy=c.prop(),c.withAttr=function(e,t,n){return function(r){r=r||window.event;var o=r.currentTarget||this,i=n||this,a=e in o?o[e]:o.getAttribute(e);t.call(i,a)}};var Xe,Ze,et={pathname:"",hash:"#",search:"?"},tt=i,nt=!1;c.route=function(t,n,r,i){if(0===arguments.length)return Ze;if(3===arguments.length&&o(n)){tt=function(e){var o=Ze=le(e);if(!se(t,r,o)){if(nt)throw new Error("Ensure the default route matches one of the routes defined in m.route");nt=!0,c.route(n,!0),nt=!1}};var a="hash"===c.route.mode?"onhashchange":"onpopstate";return e[a]=function(){var e=Ce[c.route.mode];"pathname"===c.route.mode&&(e+=Ce.search),Ze!==le(e)&&tt(e)},Ge=fe,void e[a]()}if(t.addEventListener||t.attachEvent){var u="pathname"!==c.route.mode?Ce.pathname:"";return t.href=u+et[c.route.mode]+i.attrs.href,void(t.addEventListener?(t.removeEventListener("click",ce),t.addEventListener("click",ce)):(t.detachEvent("onclick",ce),t.attachEvent("onclick",ce)))}if(o(t)){var l=Ze;Ze=t;var s,f=n||{},d=Ze.indexOf("?");s=d>-1?he(Ze.slice(d+1)):{};for(var h in f)je.call(f,h)&&(s[h]=f[h]);var p,v=de(s);p=d>-1?Ze.slice(0,d):Ze,v&&(Ze=p+(p.indexOf("?")===-1?"?":"&")+v);var m=(3===arguments.length?r:n)===!0||l===t;if(e.history.pushState){var g=m?"replaceState":"pushState";Ge=fe,Qe=function(){try{e.history[g](null,Ae.title,et[c.route.mode]+Ze)}catch(t){Ce[c.route.mode]=Ze}},tt(et[c.route.mode]+Ze)}else Ce[c.route.mode]=Ze,tt(et[c.route.mode]+Ze)}},c.route.param=function(e){if(!Xe)throw new Error("You must call m.route(element, defaultRoute, routes) before calling m.route.param()");return e?Xe[e]:Xe},c.route.mode="search",c.route.buildQueryString=de,c.route.parseQueryString=he,c.deferred=function(){var e=new me;return e.promise=ve(e.promise),e};var rt=1,ot=2,it=3,at=4;return c.deferred.onerror=function(e){if("[object Error]"===Le.call(e)&&!/ Error/.test(e.constructor.toString()))throw Me=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=[],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 me,i=e.dataType&&"jsonp"===e.dataType.toLowerCase();return i?(t=e.serialize=n=e.deserialize=ge,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=xe(e.url,e.data),Ee(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)),Ne(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),c.deferred.onerror(a)}finally{e.background!==!0&&c.endComputation()}},be(e),o.promise=ve(o.promise,e.initialValue),o.promise},c})},{}],8:[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)&&r(o[n],t)===-1&&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),n!==-1&&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},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","getAttribute","checked","value","conditionMet","config","hide","visibility","opacity","inputs","inputElement","removeAttribute","setAttribute","JSON","parse","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","URL","Tabs","get","id","open","tab","updateState","$tabs","removeClass","css","$tabNavs","nav","className","blur","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","replaceScriptNodes","tagName","replaceChild","buildExecutableNode","scriptEl","attributes","name","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","callbackName","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","forceRecreation","isDocumentRoot","trust","String","Promise","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","err","param","sync","synchronizer","pos","resolved","results","outstanding","arg","request","background","extract","isJSONP","jsonp","toUpperCase","ev","response","unwrapSuccess","res","unwrapError","7","indexOfListener","listeners","alias","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","setOnceReturn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BAAXF,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\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 radio inputs\n\t\t\tif( this.getAttribute('type') === \"radio\" && ! this.checked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar value = ( this.getAttribute(\"type\") === \"checkbox\" ) ? this.checked : this.value;\n\t\t\tvar conditionMet = ( 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'use strict';\n\nvar URL = require('./url.js');\n\n// Tabs\nvar Tabs = function(context) {\n\n\t// @todo last piece of jQuery... can we get rid of it?\n\tvar $ = window.jQuery;\n\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 : this, function (global, undefined) { // eslint-disable-line\r\n\t\"use strict\"\r\n\r\n\tm.version = function () {\r\n\t\treturn \"v0.2.5\"\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] || \"\"\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 = []\r\n\r\n\t\tfor (var i = 1, length = arguments.length; i < length; i++) {\r\n\t\t\targs[i - 1] = arguments[i]\r\n\t\t}\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) {\r\n\t\t\tif (hasOwn.call(existing, prop)) {\r\n\t\t\t\tactions.push(existing[prop])\r\n\t\t\t}\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) {\r\n\t\t\t\t\t\tcontroller.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}\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 &&\r\n\t\t\t\tunloaders.map(function (u) { return u.handler })\r\n\t\t\t\t\t.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(\r\n\t\tdata,\r\n\t\tview,\r\n\t\tcached,\r\n\t\tcachedControllers,\r\n\t\tcontrollers,\r\n\t\tviews\r\n\t) {\r\n\t\tvar controller = getController(\r\n\t\t\tcached.views,\r\n\t\t\tview,\r\n\t\t\tcachedControllers,\r\n\t\t\tdata.controller)\r\n\r\n\t\tvar key = data && data.attrs && data.attrs.key\r\n\r\n\t\tif (pendingRequests === 0 ||\r\n\t\t\t\tforcing ||\r\n\t\t\t\tcachedControllers &&\r\n\t\t\t\t\tcachedControllers.indexOf(controller) > -1) {\r\n\t\t\tdata = data.view(controller)\r\n\t\t} else {\r\n\t\t\tdata = {tag: \"placeholder\"}\r\n\t\t}\r\n\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\t// add the node to its parent before attaching children to it\r\n\t\t\tinsertNode(parentElement, node, index)\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) {\r\n\t\t\tif (hasOwn.call(dataAttr, rule)) {\r\n\t\t\t\tif (cachedAttr == null || cachedAttr[rule] !== dataAttr[rule]) {\r\n\t\t\t\t\tnode.style[rule] = dataAttr[rule]\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (rule in cachedAttr) {\r\n\t\t\tif (hasOwn.call(cachedAttr, rule)) {\r\n\t\t\t\tif (!hasOwn.call(dataAttr, rule)) node.style[rule] = \"\"\r\n\t\t\t}\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) || ($document.activeElement === node)) {\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) {\r\n\t\t\tif (hasOwn.call(dataAttrs, attrName)) {\r\n\t\t\t\tif (trySetAttr(\r\n\t\t\t\t\t\tnode,\r\n\t\t\t\t\t\tattrName,\r\n\t\t\t\t\t\tdataAttrs[attrName],\r\n\t\t\t\t\t\tcachedAttrs[attrName],\r\n\t\t\t\t\t\tcachedAttrs,\r\n\t\t\t\t\t\ttag,\r\n\t\t\t\t\t\tnamespace)) {\r\n\t\t\t\t\tcontinue\r\n\t\t\t\t}\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\treplaceScriptNodes(parentElement)\r\n\t\t}\r\n\t}\r\n\r\n\t// Replace script tags inside given DOM element with executable ones.\r\n\t// Will also check children recursively and replace any found script\r\n\t// tags in same manner.\r\n\tfunction replaceScriptNodes(node) {\r\n\t\tif (node.tagName === \"SCRIPT\") {\r\n\t\t\tnode.parentNode.replaceChild(buildExecutableNode(node), node)\r\n\t\t} else {\r\n\t\t\tvar children = node.childNodes\r\n\t\t\tif (children && children.length) {\r\n\t\t\t\tfor (var i = 0; i < children.length; i++) {\r\n\t\t\t\t\treplaceScriptNodes(children[i])\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn node\r\n\t}\r\n\r\n\t// Replace script element with one whose contents are executable.\r\n\tfunction buildExecutableNode(node){\r\n\t\tvar scriptEl = document.createElement(\"script\")\r\n\t\tvar attrs = node.attributes\r\n\r\n\t\tfor (var i = 0; i < attrs.length; i++) {\r\n\t\t\tscriptEl.setAttribute(attrs[i].name, attrs[i].value)\r\n\t\t}\r\n\r\n\t\tscriptEl.text = node.innerHTML\r\n\t\treturn scriptEl\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)) || ((typeof Promise !== \"undefined\") && (store instanceof Promise))) &&\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 = new Array(arguments.length - 1)\r\n\r\n\t\tfor (var i = 1; i < arguments.length; i++) {\r\n\t\t\targs[i - 1] = arguments[i]\r\n\t\t}\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 || window.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) {\r\n\t\t\t\tif (hasOwn.call(args, i)) {\r\n\t\t\t\t\tparams[i] = args[i]\r\n\t\t\t\t}\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\ttry {\r\n\t\t\t\t\t\tglobal.history[method](null, $document.title,\r\n\t\t\t\t\t\t\tmodes[m.route.mode] + currentRoute)\r\n\t\t\t\t\t} catch (err) {\r\n\t\t\t\t\t\t// In the event of a pushState or replaceState failure,\r\n\t\t\t\t\t\t// fallback to a standard redirect. This is specifically\r\n\t\t\t\t\t\t// to address a Safari security error when attempting to\r\n\t\t\t\t\t\t// call pushState more than 100 times.\r\n\t\t\t\t\t\t$location[m.route.mode] = currentRoute\r\n\t\t\t\t\t}\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) {\r\n\t\t\tif (hasOwn.call(router, route)) {\r\n\t\t\t\tif (route === path) {\r\n\t\t\t\t\tm.mount(root, router[route])\r\n\t\t\t\t\treturn true\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar matcher = new RegExp(\"^\" + route\r\n\t\t\t\t\t.replace(/:[^\\/]+?\\.{3}/g, \"(.*?)\")\r\n\t\t\t\t\t.replace(/:[^\\/]+/g, \"([^\\\\/]+)\") + \"\\/?$\")\r\n\r\n\t\t\t\tif (matcher.test(path)) {\r\n\t\t\t\t\t/* eslint-disable no-loop-func */\r\n\t\t\t\t\tpath.replace(matcher, function () {\r\n\t\t\t\t\t\tvar keys = route.match(/:[^\\/]+/g) || []\r\n\t\t\t\t\t\tvar values = [].slice.call(arguments, 1, -2)\r\n\t\t\t\t\t\tforEach(keys, function (key, i) {\r\n\t\t\t\t\t\t\trouteParams[key.replace(/:|\\./g, \"\")] =\r\n\t\t\t\t\t\t\t\tdecodeURIComponent(values[i])\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t\tm.mount(root, router[route])\r\n\t\t\t\t\t})\r\n\t\t\t\t\t/* eslint-enable no-loop-func */\r\n\t\t\t\t\treturn true\r\n\t\t\t\t}\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) {\r\n\t\t\tif (hasOwn.call(object, prop)) {\r\n\t\t\t\tvar key = prefix ? prefix + \"[\" + prop + \"]\" : prop\r\n\t\t\t\tvar value = object[prop]\r\n\r\n\t\t\t\tif (value === null) {\r\n\t\t\t\t\tstr.push(encodeURIComponent(key))\r\n\t\t\t\t} else if (isObject(value)) {\r\n\t\t\t\t\tstr.push(buildQueryString(value, key))\r\n\t\t\t\t} else if (isArray(value)) {\r\n\t\t\t\t\tvar keys = []\r\n\t\t\t\t\tduplicates[key] = duplicates[key] || {}\r\n\t\t\t\t\t/* eslint-disable no-loop-func */\r\n\t\t\t\t\tforEach(value, function (item) {\r\n\t\t\t\t\t\t/* eslint-enable no-loop-func */\r\n\t\t\t\t\t\tif (!duplicates[key][item]) {\r\n\t\t\t\t\t\t\tduplicates[key][item] = true\r\n\t\t\t\t\t\t\tkeys.push(encodeURIComponent(key) + \"=\" +\r\n\t\t\t\t\t\t\t\tencodeURIComponent(item))\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t})\r\n\t\t\t\t\tstr.push(keys.join(\"&\"))\r\n\t\t\t\t} else if (value !== undefined) {\r\n\t\t\t\t\tstr.push(encodeURIComponent(key) + \"=\" +\r\n\t\t\t\t\t\tencodeURIComponent(value))\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\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 = []\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 = options.callbackName || \"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] || token\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\tm.deferred.onerror(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}); // eslint-disable-line\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","window","EventEmitter","context","document","getElementById","events","tabs","helpers","settings","ListFetcher","mount","mc4wp","deps","mithril","./admin/helpers.js","./admin/list-fetcher.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","getAttribute","checked","value","conditionMet","config","hide","visibility","opacity","inputs","inputElement","removeAttribute","setAttribute","JSON","parse","parentElements","parentElement","3","working","done","mailchimp","api_connected","lists","fetch","$","jQuery","mc4wp_vars","i18n","preventDefault","post","ajaxurl","action","data","location","reload","always","redraw","bind","view","method","onsubmit","type","fetching_mailchimp_lists","renew_mailchimp_lists","className","disabled","trust","fetching_mailchimp_lists_can_take_a_while","fetching_mailchimp_lists_done","4","Settings","getSelectedListsWhere","searchKey","searchValue","selectedLists","filter","el","getSelectedLists","updateSelectedLists","listInputs","input","push","trigger","toggleVisibleLists","rows","listId","isSelected","replace","querySelector","on","5","URL","Tabs","get","id","open","tab","updateState","$tabs","removeClass","css","$tabNavs","nav","blur","url","setParameter","href","history","pushState","title","refererField","tb_remove","forms","editor","refresh","split","switchTab","tabId","match","urlParams","opened","returnValue","init","activeTab","substring","replaceState","state","$context","find","each","first","text","click","body","./url.js","6","query","hasOwnProperty","b","decodeURIComponent","build","ret","d","encodeURIComponent","join","key","7","global","factory","amd","isFunction","object","isObject","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","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","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","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","replaceScriptNodes","tagName","replaceChild","buildExecutableNode","scriptEl","attributes","name","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","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","Deferred","onSuccess","onFailure","finish","REJECTED","next","deferred","RESOLVED","promiseValue","thennable","success","failure","notThennable","count","onerror","fire","REJECTING","RESOLVING","self","TypeError","identity","handleJsonp","options","callbackKey","callbackName","getTime","Math","round","random","script","resp","onload","responseText","status","stringify","error","src","createXhr","xhr","XMLHttpRequest","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","forceRecreation","isDocumentRoot","String","Promise","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","err","param","sync","synchronizer","pos","resolved","results","outstanding","arg","request","background","extract","isJSONP","jsonp","toUpperCase","ev","response","unwrapSuccess","res","unwrapError","8","indexOfListener","listeners","alias","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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O2K,cAMfrI,MAAK6hB,OAGhB,OAAO7hB,OAQXqgB,EAAMyB,mBAAqB1B,EAAM,eAcjCC,EAAM0B,UAAY,SAAmBvB,EAAKvgB,GACtC,GACIkgB,GACA9B,EACA3hB,EACA2L,EACAwX,EALAmC,EAAehiB,KAAK4gB,qBAAqBJ,EAO7C,KAAKnY,IAAO2Z,GACR,GAAIA,EAAana,eAAeQ,GAI5B,IAHA8X,EAAY6B,EAAa3Z,GAAK6B,MAAM,GACpCxN,EAAIyjB,EAAUljB,OAEPP,KAGH2hB,EAAW8B,EAAUzjB,GAEjB2hB,EAAS0C,QAAS,GAClB/gB,KAAKohB,eAAeZ,EAAKnC,EAASA,UAGtCwB,EAAWxB,EAASA,SAASje,MAAMJ,KAAMC,OAErC4f,IAAa7f,KAAKiiB,uBAClBjiB,KAAKohB,eAAeZ,EAAKnC,EAASA,SAMlD,OAAOre,OAMXqgB,EAAM/b,QAAU8b,EAAM,aAUtBC,EAAM6B,KAAO,SAAc1B,GACvB,GAAIvgB,GAAOT,MAAMC,UAAUyK,MAAMlN,KAAKkD,UAAW,EACjD,OAAOF,MAAK+hB,UAAUvB,EAAKvgB,IAW/BogB,EAAM8B,mBAAqB,SAA4BxhB,GAEnD,MADAX,MAAKoiB,iBAAmBzhB,EACjBX,MAWXqgB,EAAM4B,oBAAsB,WACxB,OAAIjiB,KAAK6H,eAAe,qBACb7H,KAAKoiB,kBAapB/B,EAAMI,WAAa,WACf,MAAOzgB,MAAK6hB,UAAY7hB,KAAK6hB,aAQjCvkB,EAAa+kB,WAAa,WAEtB,MADAtlB,GAAQO,aAAegjB,EAChBhjB,GAIW,kBAAXrB,IAAyBA,EAAOwM,IACvCxM,EAAO,WACH,MAAOqB,KAGY,gBAAXH,IAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAUO,EAGjBP,EAAQO,aAAeA,IAE7BN,KAAKgD,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 = window.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// list fetcher\nvar ListFetcher = require('./admin/list-fetcher.js');\nvar mount = document.getElementById('mc4wp-list-fetcher');\nif( mount ) {\n m.mount(mount, new ListFetcher);\n}\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/list-fetcher.js\":3,\"./admin/settings.js\":4,\"./admin/tabs.js\":5,\"mithril\":7,\"wolfy87-eventemitter\":8}],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/**\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\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 radio inputs\n\t\t\tif( this.getAttribute('type') === \"radio\" && ! this.checked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar value = ( this.getAttribute(\"type\") === \"checkbox\" ) ? this.checked : this.value;\n\t\t\tvar conditionMet = ( 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){\n'use strict';\n\nvar $ = window.jQuery;\nvar config = mc4wp_vars;\nvar i18n = config.i18n;\n\nfunction ListFetcher() {\n this.working = false;\n this.done = false;\n\n // start fetching right away when no lists but api key given\n if( config.mailchimp.api_connected && config.mailchimp.lists.length == 0 ) {\n this.fetch();\n }\n}\n\nListFetcher.prototype.fetch = function (e) {\n e && e.preventDefault();\n\n this.working = true;\n this.done = false;\n\n $.post(ajaxurl, {\n action: \"mc4wp_renew_mailchimp_lists\"\n }).done(function(data) {\n if(data) {\n window.setTimeout(function() { window.location.reload(); }, 3000 );\n }\n }).always(function (data) {\n this.working = false;\n this.done = true;\n\n m.redraw();\n }.bind(this));\n};\n\nListFetcher.prototype.view = function () {\n return m('form', {\n method: \"POST\",\n onsubmit: this.fetch.bind(this)\n }, [\n m('p', [\n m('input', {\n type: \"submit\",\n value: this.working ? i18n.fetching_mailchimp_lists : i18n.renew_mailchimp_lists,\n className: \"button\",\n disabled: !!this.working\n }),\n m.trust(' &nbsp; '),\n\n this.working ? [\n m('span.mc4wp-loader', \"Loading...\"),\n m.trust(' &nbsp; '),\n m('em.help', i18n.fetching_mailchimp_lists_can_take_a_while)\n ]: '',\n\n this.done ? [\n m( 'em.help.green', i18n.fetching_mailchimp_lists_done )\n ] : ''\n ])\n ]);\n};\n\nmodule.exports = ListFetcher;\n},{}],4:[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},{}],5:[function(require,module,exports){\n'use strict';\n\nvar URL = require('./url.js');\n\n// Tabs\nvar Tabs = function(context) {\n\n\t// @todo last piece of jQuery... can we get rid of it?\n\tvar $ = window.jQuery;\n\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\":6}],6:[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},{}],7:[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 : this, function (global, undefined) { // eslint-disable-line\r\n\t\"use strict\"\r\n\r\n\tm.version = function () {\r\n\t\treturn \"v0.2.5\"\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] || \"\"\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 = []\r\n\r\n\t\tfor (var i = 1, length = arguments.length; i < length; i++) {\r\n\t\t\targs[i - 1] = arguments[i]\r\n\t\t}\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) {\r\n\t\t\tif (hasOwn.call(existing, prop)) {\r\n\t\t\t\tactions.push(existing[prop])\r\n\t\t\t}\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) {\r\n\t\t\t\t\t\tcontroller.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}\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 &&\r\n\t\t\t\tunloaders.map(function (u) { return u.handler })\r\n\t\t\t\t\t.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(\r\n\t\tdata,\r\n\t\tview,\r\n\t\tcached,\r\n\t\tcachedControllers,\r\n\t\tcontrollers,\r\n\t\tviews\r\n\t) {\r\n\t\tvar controller = getController(\r\n\t\t\tcached.views,\r\n\t\t\tview,\r\n\t\t\tcachedControllers,\r\n\t\t\tdata.controller)\r\n\r\n\t\tvar key = data && data.attrs && data.attrs.key\r\n\r\n\t\tif (pendingRequests === 0 ||\r\n\t\t\t\tforcing ||\r\n\t\t\t\tcachedControllers &&\r\n\t\t\t\t\tcachedControllers.indexOf(controller) > -1) {\r\n\t\t\tdata = data.view(controller)\r\n\t\t} else {\r\n\t\t\tdata = {tag: \"placeholder\"}\r\n\t\t}\r\n\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\t// add the node to its parent before attaching children to it\r\n\t\t\tinsertNode(parentElement, node, index)\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) {\r\n\t\t\tif (hasOwn.call(dataAttr, rule)) {\r\n\t\t\t\tif (cachedAttr == null || cachedAttr[rule] !== dataAttr[rule]) {\r\n\t\t\t\t\tnode.style[rule] = dataAttr[rule]\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (rule in cachedAttr) {\r\n\t\t\tif (hasOwn.call(cachedAttr, rule)) {\r\n\t\t\t\tif (!hasOwn.call(dataAttr, rule)) node.style[rule] = \"\"\r\n\t\t\t}\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) || ($document.activeElement === node)) {\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) {\r\n\t\t\tif (hasOwn.call(dataAttrs, attrName)) {\r\n\t\t\t\tif (trySetAttr(\r\n\t\t\t\t\t\tnode,\r\n\t\t\t\t\t\tattrName,\r\n\t\t\t\t\t\tdataAttrs[attrName],\r\n\t\t\t\t\t\tcachedAttrs[attrName],\r\n\t\t\t\t\t\tcachedAttrs,\r\n\t\t\t\t\t\ttag,\r\n\t\t\t\t\t\tnamespace)) {\r\n\t\t\t\t\tcontinue\r\n\t\t\t\t}\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\treplaceScriptNodes(parentElement)\r\n\t\t}\r\n\t}\r\n\r\n\t// Replace script tags inside given DOM element with executable ones.\r\n\t// Will also check children recursively and replace any found script\r\n\t// tags in same manner.\r\n\tfunction replaceScriptNodes(node) {\r\n\t\tif (node.tagName === \"SCRIPT\") {\r\n\t\t\tnode.parentNode.replaceChild(buildExecutableNode(node), node)\r\n\t\t} else {\r\n\t\t\tvar children = node.childNodes\r\n\t\t\tif (children && children.length) {\r\n\t\t\t\tfor (var i = 0; i < children.length; i++) {\r\n\t\t\t\t\treplaceScriptNodes(children[i])\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn node\r\n\t}\r\n\r\n\t// Replace script element with one whose contents are executable.\r\n\tfunction buildExecutableNode(node){\r\n\t\tvar scriptEl = document.createElement(\"script\")\r\n\t\tvar attrs = node.attributes\r\n\r\n\t\tfor (var i = 0; i < attrs.length; i++) {\r\n\t\t\tscriptEl.setAttribute(attrs[i].name, attrs[i].value)\r\n\t\t}\r\n\r\n\t\tscriptEl.text = node.innerHTML\r\n\t\treturn scriptEl\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)) || ((typeof Promise !== \"undefined\") && (store instanceof Promise))) &&\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 = new Array(arguments.length - 1)\r\n\r\n\t\tfor (var i = 1; i < arguments.length; i++) {\r\n\t\t\targs[i - 1] = arguments[i]\r\n\t\t}\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 || window.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) {\r\n\t\t\t\tif (hasOwn.call(args, i)) {\r\n\t\t\t\t\tparams[i] = args[i]\r\n\t\t\t\t}\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\ttry {\r\n\t\t\t\t\t\tglobal.history[method](null, $document.title,\r\n\t\t\t\t\t\t\tmodes[m.route.mode] + currentRoute)\r\n\t\t\t\t\t} catch (err) {\r\n\t\t\t\t\t\t// In the event of a pushState or replaceState failure,\r\n\t\t\t\t\t\t// fallback to a standard redirect. This is specifically\r\n\t\t\t\t\t\t// to address a Safari security error when attempting to\r\n\t\t\t\t\t\t// call pushState more than 100 times.\r\n\t\t\t\t\t\t$location[m.route.mode] = currentRoute\r\n\t\t\t\t\t}\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) {\r\n\t\t\tif (hasOwn.call(router, route)) {\r\n\t\t\t\tif (route === path) {\r\n\t\t\t\t\tm.mount(root, router[route])\r\n\t\t\t\t\treturn true\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar matcher = new RegExp(\"^\" + route\r\n\t\t\t\t\t.replace(/:[^\\/]+?\\.{3}/g, \"(.*?)\")\r\n\t\t\t\t\t.replace(/:[^\\/]+/g, \"([^\\\\/]+)\") + \"\\/?$\")\r\n\r\n\t\t\t\tif (matcher.test(path)) {\r\n\t\t\t\t\t/* eslint-disable no-loop-func */\r\n\t\t\t\t\tpath.replace(matcher, function () {\r\n\t\t\t\t\t\tvar keys = route.match(/:[^\\/]+/g) || []\r\n\t\t\t\t\t\tvar values = [].slice.call(arguments, 1, -2)\r\n\t\t\t\t\t\tforEach(keys, function (key, i) {\r\n\t\t\t\t\t\t\trouteParams[key.replace(/:|\\./g, \"\")] =\r\n\t\t\t\t\t\t\t\tdecodeURIComponent(values[i])\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t\tm.mount(root, router[route])\r\n\t\t\t\t\t})\r\n\t\t\t\t\t/* eslint-enable no-loop-func */\r\n\t\t\t\t\treturn true\r\n\t\t\t\t}\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) {\r\n\t\t\tif (hasOwn.call(object, prop)) {\r\n\t\t\t\tvar key = prefix ? prefix + \"[\" + prop + \"]\" : prop\r\n\t\t\t\tvar value = object[prop]\r\n\r\n\t\t\t\tif (value === null) {\r\n\t\t\t\t\tstr.push(encodeURIComponent(key))\r\n\t\t\t\t} else if (isObject(value)) {\r\n\t\t\t\t\tstr.push(buildQueryString(value, key))\r\n\t\t\t\t} else if (isArray(value)) {\r\n\t\t\t\t\tvar keys = []\r\n\t\t\t\t\tduplicates[key] = duplicates[key] || {}\r\n\t\t\t\t\t/* eslint-disable no-loop-func */\r\n\t\t\t\t\tforEach(value, function (item) {\r\n\t\t\t\t\t\t/* eslint-enable no-loop-func */\r\n\t\t\t\t\t\tif (!duplicates[key][item]) {\r\n\t\t\t\t\t\t\tduplicates[key][item] = true\r\n\t\t\t\t\t\t\tkeys.push(encodeURIComponent(key) + \"=\" +\r\n\t\t\t\t\t\t\t\tencodeURIComponent(item))\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t})\r\n\t\t\t\t\tstr.push(keys.join(\"&\"))\r\n\t\t\t\t} else if (value !== undefined) {\r\n\t\t\t\t\tstr.push(encodeURIComponent(key) + \"=\" +\r\n\t\t\t\t\t\tencodeURIComponent(value))\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\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 = []\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 = options.callbackName || \"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] || token\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\tm.deferred.onerror(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}); // eslint-disable-line\r\n\n},{}],8:[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
@@ -743,7 +743,8 @@ var FieldFactory = function(fields, i18n) {
743
  type: 'checkbox',
744
  title: i18n.listChoice,
745
  choices: choices,
746
- help: i18n.listChoiceDescription
 
747
  }, true);
748
 
749
  choices = {
@@ -3269,8 +3270,12 @@ module.exports = render;
3269
  var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
3270
  var gutterW = display.gutters.offsetWidth, left = comp + "px";
3271
  for (var i = 0; i < view.length; i++) if (!view[i].hidden) {
3272
- if (cm.options.fixedGutter && view[i].gutter)
3273
- view[i].gutter.style.left = left;
 
 
 
 
3274
  var align = view[i].alignable;
3275
  if (align) for (var j = 0; j < align.length; j++)
3276
  align[j].style.left = left;
@@ -3826,7 +3831,7 @@ module.exports = render;
3826
  }
3827
 
3828
  function handlePaste(e, cm) {
3829
- var pasted = e.clipboardData && e.clipboardData.getData("text/plain");
3830
  if (pasted) {
3831
  e.preventDefault();
3832
  if (!cm.isReadOnly() && !cm.options.disableInput)
@@ -3870,10 +3875,10 @@ module.exports = render;
3870
  return {text: text, ranges: ranges};
3871
  }
3872
 
3873
- function disableBrowserMagic(field) {
3874
  field.setAttribute("autocorrect", "off");
3875
  field.setAttribute("autocapitalize", "off");
3876
- field.setAttribute("spellcheck", "false");
3877
  }
3878
 
3879
  // TEXTAREA INPUT STYLE
@@ -4251,10 +4256,14 @@ module.exports = render;
4251
  init: function(display) {
4252
  var input = this, cm = input.cm;
4253
  var div = input.div = display.lineDiv;
4254
- disableBrowserMagic(div);
4255
 
4256
  on(div, "paste", function(e) {
4257
- if (!signalDOMEvent(cm, e)) handlePaste(e, cm);
 
 
 
 
4258
  })
4259
 
4260
  on(div, "compositionstart", function(e) {
@@ -4314,23 +4323,27 @@ module.exports = render;
4314
  });
4315
  }
4316
  }
4317
- // iOS exposes the clipboard API, but seems to discard content inserted into it
4318
- if (e.clipboardData && !ios) {
4319
- e.preventDefault();
4320
  e.clipboardData.clearData();
4321
- e.clipboardData.setData("text/plain", lastCopied.text.join("\n"));
4322
- } else {
4323
- // Old-fashioned briefly-focus-a-textarea hack
4324
- var kludge = hiddenTextarea(), te = kludge.firstChild;
4325
- cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
4326
- te.value = lastCopied.text.join("\n");
4327
- var hadFocus = document.activeElement;
4328
- selectInput(te);
4329
- setTimeout(function() {
4330
- cm.display.lineSpace.removeChild(kludge);
4331
- hadFocus.focus();
4332
- }, 50);
4333
  }
 
 
 
 
 
 
 
 
 
 
 
4334
  }
4335
  on(div, "copy", onCopyCut);
4336
  on(div, "cut", onCopyCut);
@@ -4638,7 +4651,7 @@ module.exports = render;
4638
  if (found)
4639
  return badPos(Pos(found.line, found.ch + dist), bad);
4640
  else
4641
- dist += after.textContent.length;
4642
  }
4643
  }
4644
 
@@ -7625,7 +7638,10 @@ module.exports = render;
7625
  addOverlay: methodOp(function(spec, options) {
7626
  var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
7627
  if (mode.startState) throw new Error("Overlays may not be stateful.");
7628
- this.state.overlays.push({mode: mode, modeSpec: spec, opaque: options && options.opaque});
 
 
 
7629
  this.state.modeGen++;
7630
  regChange(this);
7631
  }),
@@ -8097,6 +8113,9 @@ module.exports = render;
8097
  option("inputStyle", mobile ? "contenteditable" : "textarea", function() {
8098
  throw new Error("inputStyle can not (yet) be changed in a running editor"); // FIXME
8099
  }, true);
 
 
 
8100
  option("rtlMoveVisually", !windows);
8101
  option("wholeLineUpdateBefore", true);
8102
 
@@ -8206,6 +8225,8 @@ module.exports = render;
8206
  spec.name = found.name;
8207
  } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
8208
  return CodeMirror.resolveMode("application/xml");
 
 
8209
  }
8210
  if (typeof spec == "string") return {name: spec};
8211
  else return spec || {name: "null"};
@@ -10635,7 +10656,7 @@ module.exports = render;
10635
  }
10636
 
10637
  // Register a change in the history. Merges changes that are within
10638
- // a single operation, ore are close together with an origin that
10639
  // allows merging (starting with "+") into a single event.
10640
  function addChangeToHistory(doc, change, selAfter, opId) {
10641
  var hist = doc.history;
@@ -11038,6 +11059,12 @@ module.exports = render;
11038
  return out;
11039
  }
11040
 
 
 
 
 
 
 
11041
  function nothing() {}
11042
 
11043
  function createObj(base, props) {
@@ -11606,7 +11633,7 @@ module.exports = render;
11606
 
11607
  // THE END
11608
 
11609
- CodeMirror.version = "5.17.0";
11610
 
11611
  return CodeMirror;
11612
  });
@@ -12487,7 +12514,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
12487
 
12488
  function getAttrValue(text, attr) {
12489
  var match = text.match(getAttrRegexp(attr))
12490
- return match ? match[2] : ""
12491
  }
12492
 
12493
  function getTagRegexp(tagName, anchored) {
@@ -12596,8 +12623,6 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
12596
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
12597
  // Distributed under an MIT license: http://codemirror.net/LICENSE
12598
 
12599
- // TODO actually recognize syntax of TypeScript constructs
12600
-
12601
  (function(mod) {
12602
  if (typeof exports == "object" && typeof module == "object") // CommonJS
12603
  mod(require("../../lib/codemirror"));
@@ -12811,7 +12836,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
12811
  var bracket = brackets.indexOf(ch);
12812
  if (bracket >= 0 && bracket < 3) {
12813
  if (!depth) { ++pos; break; }
12814
- if (--depth == 0) break;
12815
  } else if (bracket >= 3 && bracket < 6) {
12816
  ++depth;
12817
  } else if (wordRE.test(ch)) {
@@ -13058,8 +13083,10 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
13058
  if (type == "variable") {cx.marked = "property"; return cont();}
13059
  }
13060
  function objprop(type, value) {
13061
- if (type == "async") return cont(objprop);
13062
- if (type == "variable" || cx.style == "keyword") {
 
 
13063
  cx.marked = "property";
13064
  if (value == "get" || value == "set") return cont(getterSetter);
13065
  return cont(afterprop);
@@ -13074,6 +13101,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
13074
  return cont(expression, expect("]"), afterprop);
13075
  } else if (type == "spread") {
13076
  return cont(expression);
 
 
13077
  }
13078
  }
13079
  function getterSetter(type) {
@@ -13120,6 +13149,23 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
13120
  }
13121
  function typeexpr(type) {
13122
  if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13123
  }
13124
  function afterType(type, value) {
13125
  if (value == "<") return cont(commasep(typeexpr, ">"), afterType)
@@ -13188,7 +13234,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
13188
  if (type == "variable") {register(value); return cont(classNameAfter);}
13189
  }
13190
  function classNameAfter(type, value) {
13191
- if (value == "extends") return cont(expression, classNameAfter);
13192
  if (type == "{") return cont(pushlex("}"), classBody, poplex);
13193
  }
13194
  function classBody(type, value) {
@@ -13236,7 +13282,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
13236
  }
13237
  function arrayLiteral(type) {
13238
  if (type == "]") return cont();
13239
- return pass(expressionNoComma, commasep(expressionNoComma, "]"));
13240
  }
13241
 
13242
  function isContinuedStatement(state, textAfter) {
743
  type: 'checkbox',
744
  title: i18n.listChoice,
745
  choices: choices,
746
+ help: i18n.listChoiceDescription,
747
+ acceptsMultipleValues: true
748
  }, true);
749
 
750
  choices = {
3270
  var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
3271
  var gutterW = display.gutters.offsetWidth, left = comp + "px";
3272
  for (var i = 0; i < view.length; i++) if (!view[i].hidden) {
3273
+ if (cm.options.fixedGutter) {
3274
+ if (view[i].gutter)
3275
+ view[i].gutter.style.left = left;
3276
+ if (view[i].gutterBackground)
3277
+ view[i].gutterBackground.style.left = left;
3278
+ }
3279
  var align = view[i].alignable;
3280
  if (align) for (var j = 0; j < align.length; j++)
3281
  align[j].style.left = left;
3831
  }
3832
 
3833
  function handlePaste(e, cm) {
3834
+ var pasted = e.clipboardData && e.clipboardData.getData("Text");
3835
  if (pasted) {
3836
  e.preventDefault();
3837
  if (!cm.isReadOnly() && !cm.options.disableInput)
3875
  return {text: text, ranges: ranges};
3876
  }
3877
 
3878
+ function disableBrowserMagic(field, spellcheck) {
3879
  field.setAttribute("autocorrect", "off");
3880
  field.setAttribute("autocapitalize", "off");
3881
+ field.setAttribute("spellcheck", !!spellcheck);
3882
  }
3883
 
3884
  // TEXTAREA INPUT STYLE
4256
  init: function(display) {
4257
  var input = this, cm = input.cm;
4258
  var div = input.div = display.lineDiv;
4259
+ disableBrowserMagic(div, cm.options.spellcheck);
4260
 
4261
  on(div, "paste", function(e) {
4262
+ if (signalDOMEvent(cm, e) || handlePaste(e, cm)) return
4263
+ // IE doesn't fire input events, so we schedule a read for the pasted content in this way
4264
+ if (ie_version <= 11) setTimeout(operation(cm, function() {
4265
+ if (!input.pollContent()) regChange(cm);
4266
+ }), 20)
4267
  })
4268
 
4269
  on(div, "compositionstart", function(e) {
4323
  });
4324
  }
4325
  }
4326
+ if (e.clipboardData) {
 
 
4327
  e.clipboardData.clearData();
4328
+ var content = lastCopied.text.join("\n")
4329
+ // iOS exposes the clipboard API, but seems to discard content inserted into it
4330
+ e.clipboardData.setData("Text", content);
4331
+ if (e.clipboardData.getData("Text") == content) {
4332
+ e.preventDefault();
4333
+ return
4334
+ }
 
 
 
 
 
4335
  }
4336
+ // Old-fashioned briefly-focus-a-textarea hack
4337
+ var kludge = hiddenTextarea(), te = kludge.firstChild;
4338
+ cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
4339
+ te.value = lastCopied.text.join("\n");
4340
+ var hadFocus = document.activeElement;
4341
+ selectInput(te);
4342
+ setTimeout(function() {
4343
+ cm.display.lineSpace.removeChild(kludge);
4344
+ hadFocus.focus();
4345
+ if (hadFocus == div) input.showPrimarySelection()
4346
+ }, 50);
4347
  }
4348
  on(div, "copy", onCopyCut);
4349
  on(div, "cut", onCopyCut);
4651
  if (found)
4652
  return badPos(Pos(found.line, found.ch + dist), bad);
4653
  else
4654
+ dist += before.textContent.length;
4655
  }
4656
  }
4657
 
7638
  addOverlay: methodOp(function(spec, options) {
7639
  var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
7640
  if (mode.startState) throw new Error("Overlays may not be stateful.");
7641
+ insertSorted(this.state.overlays,
7642
+ {mode: mode, modeSpec: spec, opaque: options && options.opaque,
7643
+ priority: (options && options.priority) || 0},
7644
+ function(overlay) { return overlay.priority })
7645
  this.state.modeGen++;
7646
  regChange(this);
7647
  }),
8113
  option("inputStyle", mobile ? "contenteditable" : "textarea", function() {
8114
  throw new Error("inputStyle can not (yet) be changed in a running editor"); // FIXME
8115
  }, true);
8116
+ option("spellcheck", false, function(cm, val) {
8117
+ cm.getInputField().spellcheck = val
8118
+ }, true);
8119
  option("rtlMoveVisually", !windows);
8120
  option("wholeLineUpdateBefore", true);
8121
 
8225
  spec.name = found.name;
8226
  } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
8227
  return CodeMirror.resolveMode("application/xml");
8228
+ } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
8229
+ return CodeMirror.resolveMode("application/json");
8230
  }
8231
  if (typeof spec == "string") return {name: spec};
8232
  else return spec || {name: "null"};
10656
  }
10657
 
10658
  // Register a change in the history. Merges changes that are within
10659
+ // a single operation, or are close together with an origin that
10660
  // allows merging (starting with "+") into a single event.
10661
  function addChangeToHistory(doc, change, selAfter, opId) {
10662
  var hist = doc.history;
11059
  return out;
11060
  }
11061
 
11062
+ function insertSorted(array, value, score) {
11063
+ var pos = 0, priority = score(value)
11064
+ while (pos < array.length && score(array[pos]) <= priority) pos++
11065
+ array.splice(pos, 0, value)
11066
+ }
11067
+
11068
  function nothing() {}
11069
 
11070
  function createObj(base, props) {
11633
 
11634
  // THE END
11635
 
11636
+ CodeMirror.version = "5.18.2";
11637
 
11638
  return CodeMirror;
11639
  });
12514
 
12515
  function getAttrValue(text, attr) {
12516
  var match = text.match(getAttrRegexp(attr))
12517
+ return match ? /^\s*(.*?)\s*$/.exec(match[2])[1] : ""
12518
  }
12519
 
12520
  function getTagRegexp(tagName, anchored) {
12623
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
12624
  // Distributed under an MIT license: http://codemirror.net/LICENSE
12625
 
 
 
12626
  (function(mod) {
12627
  if (typeof exports == "object" && typeof module == "object") // CommonJS
12628
  mod(require("../../lib/codemirror"));
12836
  var bracket = brackets.indexOf(ch);
12837
  if (bracket >= 0 && bracket < 3) {
12838
  if (!depth) { ++pos; break; }
12839
+ if (--depth == 0) { if (ch == "(") sawSomething = true; break; }
12840
  } else if (bracket >= 3 && bracket < 6) {
12841
  ++depth;
12842
  } else if (wordRE.test(ch)) {
13083
  if (type == "variable") {cx.marked = "property"; return cont();}
13084
  }
13085
  function objprop(type, value) {
13086
+ if (type == "async") {
13087
+ cx.marked = "property";
13088
+ return cont(objprop);
13089
+ } else if (type == "variable" || cx.style == "keyword") {
13090
  cx.marked = "property";
13091
  if (value == "get" || value == "set") return cont(getterSetter);
13092
  return cont(afterprop);
13101
  return cont(expression, expect("]"), afterprop);
13102
  } else if (type == "spread") {
13103
  return cont(expression);
13104
+ } else if (type == ":") {
13105
+ return pass(afterprop)
13106
  }
13107
  }
13108
  function getterSetter(type) {
13149
  }
13150
  function typeexpr(type) {
13151
  if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);}
13152
+ if (type == "{") return cont(commasep(typeprop, "}"))
13153
+ if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType)
13154
+ }
13155
+ function maybeReturnType(type) {
13156
+ if (type == "=>") return cont(typeexpr)
13157
+ }
13158
+ function typeprop(type) {
13159
+ if (type == "variable" || cx.style == "keyword") {
13160
+ cx.marked = "property"
13161
+ return cont(typeprop)
13162
+ } else if (type == ":") {
13163
+ return cont(typeexpr)
13164
+ }
13165
+ }
13166
+ function typearg(type) {
13167
+ if (type == "variable") return cont(typearg)
13168
+ else if (type == ":") return cont(typeexpr)
13169
  }
13170
  function afterType(type, value) {
13171
  if (value == "<") return cont(commasep(typeexpr, ">"), afterType)
13234
  if (type == "variable") {register(value); return cont(classNameAfter);}
13235
  }
13236
  function classNameAfter(type, value) {
13237
+ if (value == "extends") return cont(isTS ? typeexpr : expression, classNameAfter);
13238
  if (type == "{") return cont(pushlex("}"), classBody, poplex);
13239
  }
13240
  function classBody(type, value) {
13282
  }
13283
  function arrayLiteral(type) {
13284
  if (type == "]") return cont();
13285
+ return pass(commasep(expressionNoComma, "]"));
13286
  }
13287
 
13288
  function isContinuedStatement(state, textAfter) {
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," ","hidden"===r.type()?"":e("small",{style:"float: right; font-weight: normal;"},t.optional)]),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("small",{style:"float: right; font-weight: normal;"},t.optional)]),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){var n=[e("option",{value:"select",selected:"select"===r.type()&&"selected"},t.dropdown),e("option",{value:"radio",selected:"radio"===r.type()&&"selected"},t.radioButtons)];return r.acceptsMultipleValues&&n.push(e("option",{value:"checkbox",selected:"checkbox"===r.type()&&"selected"},t.checkboxes)),e("div",[e("label",t.choiceType),e("select",{value:r.type(),onchange:e.withAttr("value",r.type)},n)])},r.choices=function(r){var n=[];return n.push(e("div",[e("label",t.choices),e("div.limit-height",[e("table",[r.choices().map(function(n,i){return e("tr",{"data-id":i},[e("td.cb",e("input",{name:"selected",type:"checkbox"===r.type()?"checkbox":"radio",onchange:e.withAttr("value",r.selectChoice.bind(r)),checked:n.selected(),value:n.value(),title:t.preselect})),e("td.stretch",e("input.widefat",{type:"text",value:n.label(),placeholder:n.title(),onchange:e.withAttr("value",n.label)})),e("td",e("span",{title:t.remove,"class":"dashicons dashicons-no-alt hover-activated",onclick:function(e){this.choices().splice(e,1)}.bind(r,i)},""))])})])])])),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){var t=[i.label(e),i.choiceType(e),i.choices(e)];return"select"===e.type()&&t.push(i.placeholder(e)),t.push(i.useParagraphs(e)),"select"!==e.type()&&"radio"!==e.type()||t.push(i.isRequired(e)),t},n.hidden=function(e){return e.placeholder(""),e.label(""),e.wrap(!1),[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){"use strict";var n=e("../third-party/render.js"),i=e("../third-party/beautify-html.js"),o=function(e){function t(t){var o,a,l,s;return o=t.label().length?e("label",t.label()):"",a="function"==typeof r[t.type()]?r[t.type()](t):r["default"](t),l=t.wrap()?e("p",[o,a]):[o,a],s=n(l),s=i(s),s+"\n"}var r={};return r.select=function(t){var r={name:t.name(),required:t.required()},n=!1,i=t.choices().map(function(t){return t.selected()&&(n=!0),e("option",{value:t.value()!==t.label()?t.value():void 0,selected:t.selected()},t.label())}),o=t.placeholder();return o.length>0&&i.unshift(e("option",{disabled:!0,value:"",selected:!n},o)),e("select",r,i)},r.checkbox=function(t){var r=t.choices().map(function(r){var n=t.name()+("checkbox"===t.type()?"[]":""),i=t.required()&&"radio"===t.type();return e("label",[e("input",{name:n,type:t.type(),value:r.value(),checked:r.selected(),required:i})," ",e("span",r.label())])});return r},r.radio=r.checkbox,r["default"]=function(t){var r,n={type:t.type()};return t.name()&&(n.name=t.name()),t.min()&&(n.min=t.min()),t.max()&&(n.max=t.max()),t.value().length>0&&(n.value=t.value()),t.placeholder().length>0&&(n.placeholder=t.placeholder()),n.required=t.required(),r=e("input",n)},t};t.exports=o},{"../third-party/beautify-html.js":12,"../third-party/render.js":13}],4:[function(e,t,r){var n=function(t,r,n,i,o){"use strict";function a(e){u=i.get(e),u&&u.choices().length>0&&u.value(u.choices().map(function(e){return e.label()}).join("|")),t.redraw()}function l(){}function s(){var e=d(u);n.insert(e),a(""),t.redraw()}function c(){var e=i.getCategories(),r=i.getAll(),n=t("div.available-fields.small-margin",[t("h4",o.chooseField),e.map(function(e){var n=r.filter(function(t){return t.category===e});if(n.length)return t("div.tiny-margin",[t("strong",e),n.map(function(e){var r="button";e.forceRequired()&&(r+=" is-required");var n=e.inFormContent();return null!==n&&(r+=" "+(n?"in-form":"not-in-form")),t("button",{className:r,type:"button",onclick:t.withAttr("value",a),value:e.index},e.title())})])})]),l=null;return u&&(l=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)),[n,l]}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":10}],5:[function(e,t,r){var n=function(e,t){"use strict";function r(){u.forEach(e.deregister)}function n(t,r,n){var i=e.register(t,r);n||u.push(i)}function i(e){var t={phone:"tel",dropdown:"select",checkboxes:"checkbox",birthday:"text"};return"undefined"!=typeof t[e]?t[e]:e}function o(e){var r=t.listFields,o=i(e.field_type),a={name:e.tag,title:e.name,required:e.required,forceRequired:e.required,type:o,choices:e.choices,acceptsMultipleValues:!1};return"address"!==a.type?n(r,a,!1):(n(r,{name:a.name+"[addr1]",type:"text",title:t.streetAddress}),n(r,{name:a.name+"[city]",type:"text",title:t.city}),n(r,{name:a.name+"[state]",type:"text",title:t.state}),n(r,{name:a.name+"[zip]",type:"text",title:t.zip}),n(r,{name:a.name+"[country]",type:"select",title:t.country,choices:mc4wp_vars.countries})),!0}function a(e){var r=t.interestCategories,o=i(e.field_type),a={title:e.name,name:"INTERESTS["+e.id+"]",type:o,choices:e.interests,acceptsMultipleValues:"checkbox"===o};n(r,a,!1)}function l(e){e.merge_fields=e.merge_fields.sort(function(e,t){return"EMAIL"===e.tag||e["public"]&&!t["public"]?-1:!e["public"]&&t["public"]?1:0}),e.merge_fields.forEach(o),e.interest_categories.forEach(a)}function s(e){r(),e.forEach(l)}function c(e){var r,i=t.formFields;n(i,{name:"",value:t.subscribe,type:"submit",title:t.submitButton},!0),r={};for(var o in e)r[e[o].id]=e[o].name;n(i,{name:"_mc4wp_lists",type:"checkbox",title:t.listChoice,choices:r,help:t.listChoiceDescription},!0),r={subscribe:"Subscribe",unsubscribe:"Unsubscribe"},n(i,{name:"_mc4wp_action",type:"radio",title:t.formAction,choices:r,value:"subscribe",help:t.formActionDescription},!0)}var u=[];return{registerCustomFields:c,registerListFields:l,registerListsFields:s}};t.exports=n},{}],6:[function(e,t,r){"use strict";t.exports=function(e,t){function r(e){var t=[];return t="function"==typeof e.map?e.map(function(e){return new f({label:e})}):Object.keys(e).map(function(t){var r=e[t];return new f({label:r,value:t})})}function n(n,i){var o,a=s("name",i.name).shift();return a?void(!a.required()&&i.required&&a.required(!0)):(i.choices&&(i.choices=r(i.choices),i.value&&(i.choices=i.choices.map(function(e){return e.value()===i.value&&e.selected(!0),e}))),d.indexOf(n)<0&&d.push(n),o=new h(i),o.category=n,u.push(o),c&&window.clearTimeout(c),c=window.setTimeout(e.redraw,100),t.trigger("fields.change"),o)}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=u.map(function(e,t){return e.index=t,e})}function l(){return d}function s(e,t){return u.filter(function(r){return r[e]()===t})}var c,u=[],d=[],h=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.acceptsMultipleValues=t.acceptsMultipleValues,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}))}},f=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)};return{get:o,getAll:a,getCategories:l,deregister:i,register:n,getAllWhere:s}}},{}],7:[function(e,t,r){"use strict";var n=e("codemirror");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");var i=function(e){function t(){return o&&(i.innerHTML=a.getValue().toLowerCase(),o=!1),i}var r,i=document.createElement("form"),o=!1,a={};return i.innerHTML=e.value.toLowerCase(),n&&(r=n.fromTextArea(e,{selectionPointer:!0,matchTags:{bothTags:!0},mode:"htmlmixed",htmlMode:!0,autoCloseTags:!0,autoRefresh:!0}),window.dispatchEvent&&r.on("change",function(){if("function"==typeof Event){var t=new Event("change",{bubbles:!0});e.dispatchEvent(t)}})),window.addEventListener("load",function(){n.signal(r,"change")}),e.addEventListener("change",function(){o=!0}),a.getValue=function(){return r?r.getValue():e.value},a.query=function(e){return t().querySelectorAll(e)},a.containsField=function(e){return null!==t().elements.namedItem(e.toLowerCase())},a.insert=function(t){r?(r.replaceSelection(t),r.focus()):e.value+=t},a.on=function(t,n){return r?(t="input"===t?"changes":t,r.on(t,n)):e.addEventListener(t,n)},a.refresh=function(){r&&r.refresh()},a};t.exports=i},{codemirror:17,"codemirror/addon/edit/closetag.js":14,"codemirror/addon/edit/matchtags":15,"codemirror/addon/fold/xml-fold":16,"codemirror/mode/css/css":18,"codemirror/mode/htmlmixed/htmlmixed":19,"codemirror/mode/javascript/javascript":20,"codemirror/mode/xml/xml":21}],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=e.name();"checkbox"===e.type()&&(r+="[]");var n=t.containsField(r);e.inFormContent(n)}}),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]&&(r=r.replace(/\[(\w+)\]/g,".$1"),e.indexOf(r)===-1&&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){"use strict";function n(e){var t=l.indexOf(e);t<0&&(l.push(e),o())}function i(e){var t=l.indexOf(e);t>-1&&(l.splice(t,1),o())}function o(){for(var e="",t=0;t<l.length;t++)e+='<div class="notice notice-warning"><p>'+l[t]+"</p></div>";var r=document.querySelector(".mc4wp-notices");if(!r){r=document.createElement("div"),r.className="mc4wp-notices";var n=document.querySelector("h1");n.parentNode.insertBefore(r,n.nextSibling)}r.innerHTML=e}function a(e){e.on("change",function(){var t="Your form contains old style <code>GROUPINGS</code> fields. <br /><br />Please remove these fields from your form and then re-add them through the available field buttons to make sure your data is getting through to MailChimp correctly.",r=e.getValue().toLowerCase();r.indexOf('name="groupings')>-1?n(t):i(t)})}var l=[];t.exports={init:a}},{}],10:[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},{}],11:[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)),v=e("./admin/notices");i.mount(document.getElementById("mc4wp-field-wizard"),m);var y=new h(f,n);o.on("selectedLists.change",y.registerListsFields),y.registerListsFields(a.getSelectedLists()),y.registerCustomFields(mc4wp_vars.mailchimp.lists),window.setTimeout(function(){i.redraw()},2e3),v.init(g),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,"./admin/notices":9}],12:[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\t ".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;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=h.indexOf(" ")!==-1?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]||t.indexOf(r)===-1);)!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&&t.toLowerCase().indexOf(e)!==-1)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(n.toLowerCase().indexOf(e,i)===-1);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,e<1?"":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)}()},{}],13:[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},{}],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){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;r<n;++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;u<c;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":17,"../fold/xml-fold":16}],15:[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":17,"../fold/xml-fold":16}],16:[function(e,r,n){!function(i){
2
- "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){if(!(e.line>=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function o(e){if(!(e.line<=e.min))return 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(t==-1){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(t==-1){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(t==-1){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(c<0&&(!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(s<0&&(!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");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 l=h(n.line,n.ch),c=u(n,o[2]);return c&&{from:l,to:c.from}}}}),e.findMatchingTag=function(e,n,i){var o=new r(e,n.line,n.ch,i);if(o.text.indexOf(">")!=-1||o.text.indexOf("<")!=-1){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":17}],17:[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(ta,n,!1),f(n);var i=n.value;"string"==typeof i&&(i=new Ta(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&&!Oo&&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;wo&&xo<11&&setTimeout(function(){s.display.input.reset(!0)},20),qt(this),Xi(),xt(this),this.curOp.forceUpdate=!0,Zn(this,i),n.autofocus&&!Oo||s.hasFocus()?setTimeout(Fi(vr,this),20):yr(this);for(var u in ra)ra.hasOwnProperty(u)&&ra[u](this,n[u],na);k(this),n.finishInit&&n.finishInit(this);for(var d=0;d<la.length;++d)la[d](this);Ct(this),ko&&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=qi("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=qi("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=qi("div",null,"CodeMirror-code"),n.selectionDiv=qi("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=qi("div",null,"CodeMirror-cursors"),n.measure=qi("div",null,"CodeMirror-measure"),n.lineMeasure=qi("div",null,"CodeMirror-measure"),n.lineSpace=qi("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none"),n.mover=qi("div",[qi("div",[n.lineSpace],"CodeMirror-lines")],null,"position: relative"),n.sizer=qi("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=qi("div",null,null,"position: absolute; height: "+Da+"px; width: 1px;"),n.gutters=qi("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=qi("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=qi("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),wo&&xo<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),ko||vo&&Oo||(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&&Dt(e)}function i(e){e.options.lineWrapping?(Ja(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Qa(e.display.wrapper,"CodeMirror-wrap"),h(e)),a(e),Dt(e),st(e),setTimeout(function(){y(e)},100)}function o(e){var t=bt(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/wt(e.display)-3);return function(i){if(Cn(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&&ti(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-"),st(e)}function s(e){c(e),Dt(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(qi("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=mn(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=vn(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=Qn(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");t==-1&&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+Ke(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+Ge(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function g(e,t,r){this.cm=r;var n=this.vert=qi("div",[qi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=qi("div",[qi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),Na(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Na(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,wo&&xo<8&&(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&&Qa(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),Na(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,r){"horizontal"==r?or(t,e):ir(t,e)},t),t.display.scrollbars.addClass&&Ja(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;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&N(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-qe(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=ni(t,n),a=ni(t,i);if(r&&r.ensure){var l=r.ensure.from.line,s=r.ensure.to.line;l<o?(o=l,a=ni(t,ii(Qn(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=ni(t,ii(Qn(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(qi("div",[qi("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=E(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=Ge(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ge(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==Bt(e))return!1;k(e)&&(Ht(e),t.dims=E(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)),Ho&&(o=xn(e.doc,o),a=kn(e.doc,a));var l=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Rt(e,o,a),r.viewOffset=ii(Qn(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var s=Bt(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"),z(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+Ke(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){N(e);var i=p(e);ze(e),y(e,i),O(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)){N(e),_(e,r);var n=p(e);ze(e),y(e,n),O(e,n),r.finish()}}function O(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ge(e)+"px"}function N(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(wo&&xo<8){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(i<2&&(i=bt(t)),(s>.001||s<-.001)&&(ti(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 E(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 z(e,t,r){function n(t){var r=t.nextSibling;return ko&&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&&t<=c&&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=q(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=qi("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),wo&&xo<8&&(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(qi("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):Fn(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=qi("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=qi("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(qi("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(qi("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)}K(e,t,r)}function q(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),K(e,t,n),t.node}function K(e,t,r){if(U(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)U(e,t.rest[n],t,r,!1)}function U(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=qi("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),G(s,c,r,n),e.display.input.setUneditable(c),i&&s.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),Ti(s,"redraw")}}function G(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 Fo(e.line,e.ch)}function $(e,t){return jo(e,t)<0?t:e}function Y(e,t){return jo(e,t)<0?e:t}function X(e){e.state.focused||(e.display.input.focus(),vr(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(Ro&&Ro.text.join("\n")==t){if(n.ranges.length%Ro.text.length==0){s=[];for(var c=0;c<Ro.text.length;c++)s.push(o.splitLines(Ro.text[c]))}}else l.length==n.ranges.length&&(s=Pi(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=Fo(d.line,d.ch-r):e.state.overwrite&&!a?h=Fo(h.line,Math.min(Qn(o,h.line).text.length,h.ch+Ei(l).length)):Ro&&Ro.lineWise&&Ro.text.join("\n")==t&&(d=h=Fo(d.line,0)));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")};Lr(e.doc,p),Ti(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");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Ot(t,function(){Z(t,r,0,null,"paste")}),!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=jr(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Qn(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=jr(e,i.head.line,"smart"));a&&Ti(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:Fo(i,0),head:Fo(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=qi("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=qi("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return ko?e.style.width="1000px":e.setAttribute("wrap","off"),Ao&&(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=Qn(e.doc,t.line),i=Xe(r,n,t.line),o=oi(n),a="left";if(o){var l=uo(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(Fo(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=i<0?c.map:u[i],a=0;a<o.length;a+=3){var l=o[a+2];if(l==t||l==r){var s=ri(i<0?e.line:e.rest[i]),d=o[a]+n;return(n<0||l!=t)&&(d=o[a+(n?1:0)]),Fo(s,d)}}}var i=e.text.firstChild,o=!1;if(!t||!Ya(i,t))return ae(Fo(ri(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[r],r=0,!t)){var a=e.rest?Ei(e.rest):e.line;return ae(Fo(ri(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(Fo(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(Fo(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(Fo(n,0),Fo(i+1,0),o(+d));return void(h.length&&(u=h[0].find())&&(l+=Jn(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 jo(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(jo(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;n<=t&&--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 Fo(e.first,0);var r=e.first+e.size-1;return t.line>r?Fo(r,Qn(e,r).text.length):me(t,Qn(e,t.line).text.length)}function me(e,t){var r=e.ch;return null==r||r>t?Fo(e.line,t):r<0?Fo(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=jo(r,i)<0;o!=jo(n,i)<0?(i=r,r=n):o!=jo(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 za(e,"beforeSelectionChange",e,n),e.cm&&za(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=Ei(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),hi(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Me(e,t,r){(Ai(e,"beforeSelectionChange")||e.cm&&Ai(e.cm,"beforeSelectionChange"))&&(t=Se(e,t,r));var n=r&&r.bias||(jo(t.primary().head,e.sel.primary().head)<0?-1:1);_e(e,Oe(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,_i(e.cm)),Ti(e,"cursorActivity",e))}function Ae(e){_e(e,Oe(e,e.sel,null,!1),Ha)}function Oe(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 Ne(e,t,r,n,i){var o=Qn(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&&(za(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(r){var c,u=s.find(n<0?1:-1);if((n<0?s.inclusiveRight:s.inclusiveLeft)&&(u=Ee(e,u,-n,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=jo(u,r))&&(n<0?c<0:c>0))return Ne(e,u,t,n,i)}var d=s.find(n<0?-1:1);return(n<0?s.inclusiveLeft:s.inclusiveRight)&&(d=Ee(e,d,n,d.line==t.line?o:null)),d?Ne(e,d,t,n,i):null}}return t}function We(e,t,r,n,i){var o=n||1,a=Ne(e,t,r,o,i)||!i&&Ne(e,t,r,o,!0)||Ne(e,t,r,-o,i)||!i&&Ne(e,t,r,-o,!0);return a?a:(e.cantEdit=!0,Fo(e.first,0))}function Ee(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?ge(e,Fo(t.line-1)):null:r>0&&t.ch==(n||Qn(e,t.line)).text.length?t.line<e.first+e.size-1?Fo(t.line+1,0):null:new Fo(t.line,t.ch+r)}function ze(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];if(!(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)){var 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=pt(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(qi("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(qi("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){t<0&&(t=0),t=Math.round(t),n=Math.round(n),l.appendChild(qi("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 ft(e,Fo(t,r),"div",d,n)}var l,s,d=Qn(a,t),h=d.text.length;return to(oi(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),f<c+1&&(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=Ue(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=Qn(a,d.line),p=Qn(a,h.line),g=bn(f)==bn(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,Fi(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=ca(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=Pn(e,o,l?ca(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];
3
- d&&i.push(t.frontier),o.stateAfter=l?n:ca(t.mode,n)}else o.text.length<=e.options.maxHighlightLength&&In(e,o.text,n),o.stateAfter=t.frontier%5==0?ca(t.mode,n):null;if(++t.frontier,+new Date>r)return Fe(e,e.options.workDelay),!0}),i.length&&Ot(e,function(){for(var t=0;t<i.length;t++)It(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=Qn(o,l-1);if(s.stateAfter&&(!r||l<=o.frontier))return l;var c=Ra(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&&Qn(n,o-1).stateAfter;return a=a?ca(n.mode,a):ua(n.mode),n.iter(o,t,function(r){In(e,r.text,a);var l=o==t-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;r.stateAfter=l?ca(n.mode,a):null,++o}),r&&(n.frontier=o),a}function qe(e){return e.lineSpace.offsetTop}function Ke(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Ue(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Ui(e.measure,qi("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 Ge(e){return Da-e.display.nativeBarWidth}function Ve(e){return e.display.scroller.clientWidth-Ge(e)-e.display.barWidth}function $e(e){return e.display.scroller.clientHeight-Ge(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(ri(e.rest[n])>r)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Ze(e,t){t=bn(t);var r=ri(t),n=e.display.externalMeasured=new zt(e.doc,t,r);n.lineN=r;var i=n.built=Fn(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[Ft(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function et(e,t){var r=ri(t),n=Je(e,r);n&&!n.text?n=null:n&&n.changes&&(P(e,n,r,E(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=it(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(t<s?(i=0,o=1,a="left"):t<c?(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){var r=Uo;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var n=e.length-1;n>=0&&(r=e[n]).left==r.right;n--);return r}function it(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;u<4;u++){for(;l&&Bi(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+s<o.coverEnd&&Bi(t.line.text.charAt(o.coverStart+s));)++s;if(i=wo&&xo<9&&0==l&&s==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():nt(Ua(a,l,s).getClientRects(),n),i.left||i.right||0==l)break;s=l,l-=1,c="right"}wo&&xo<11&&(i=ot(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(wo&&xo<9&&!l&&(!i||!i.left&&!i.right)){var h=a.parentNode.getClientRects()[0];i=h?{left:h.left,right:h.left+wt(e.display),top:h.top,bottom:h.bottom}:Uo}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 ot(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!eo(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 at(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 lt(e){e.display.externalMeasure=null,Ki(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)at(e.display.view[t])}function st(e){lt(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ct(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ut(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function dt(e,t,r,n){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=Ln(t.widgets[i]);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var a=ii(t);if("local"==n?a+=qe(e.display):a-=e.display.viewOffset,"page"==n||"window"==n){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==n?0:ut());var s=l.left+("window"==n?0:ct());r.left+=s,r.right+=s}return r.top+=a,r.bottom+=a,r}function ht(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=ct(),i-=ut();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 ft(e,t,r,n,i){return n||(n=Qn(e.doc,t.line)),dt(e,n,Qe(e,n,t.ch,i),r)}function pt(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,dt(e,n,l,r)}function l(e,t){var r=s[t],n=r.level%2;return e==ro(r)&&t&&r.level<s[t-1].level?(r=s[--t],e=no(r)-(r.level%2?0:1),n=!0):e==no(r)&&t<s.length-1&&r.level<s[t+1].level&&(r=s[++t],e=ro(r)-r.level%2,n=!1),n&&e==r.to&&e>r.from?a(e-1):a(e,n)}n=n||Qn(e.doc,t.line),i||(i=et(e,n));var s=oi(n),c=t.ch;if(!s)return a(c);var u=uo(s,c),d=l(c,u);return null!=ll&&(d.other=l(c,ll)),d}function gt(e,t){var r=0,t=ge(e.doc,t);e.options.lineWrapping||(r=wt(e.display)*t.ch);var n=Qn(e.doc,t.line),i=ii(n)+qe(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function mt(e,t,r,n){var i=Fo(e,t);return i.xRel=n,r&&(i.outside=!0),i}function vt(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return mt(n.first,0,!0,-1);var i=ni(n,r),o=n.first+n.size-1;if(i>o)return mt(n.first+n.size-1,Qn(n,o).text.length,!0,1);t<0&&(t=0);for(var a=Qn(n,i);;){var l=yt(e,a,i,t,r),s=vn(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=ri(a=c.to.line)}}function yt(e,t,r,n,i){function o(n){var i=pt(e,Fo(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-ii(t),l=!1,s=2*e.display.wrapper.clientWidth,c=et(e,t),u=oi(t),d=t.text.length,h=io(t),f=oo(t),p=o(h),g=l,m=o(f),v=l;if(n>m)return mt(r,f,v,1);for(;;){if(u?f==h||f==fo(t,h,1):f-h<=1){var y=n<p||n-p<=m-n?h:f,b=y==h?g:v,w=n-(y==h?p:m);if(v&&!u&&!/\s/.test(t.text.charAt(y))&&w>0&&y<t.text.length&&c.view.measure.heights.length>1){var x=tt(e,c,y,"right");a<=x.bottom&&a>=x.top&&Math.abs(n-x.right)<w&&(b=!1,y++,w=n-x.right)}for(;Bi(t.text.charAt(y));)++y;var k=mt(r,y,b,w<-1?-1:w>1?1:0);return k}var C=Math.ceil(d/2),S=h+C;if(u){S=h;for(var T=0;T<C;++T)S=fo(t,S,1)}var L=o(S);L>n?(f=S,m=L,(v=l)&&(m+=1e3),d=C):(h=S,p=L,g=l,d-=C)}}function bt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Bo){Bo=qi("pre");for(var t=0;t<49;++t)Bo.appendChild(document.createTextNode("x")),Bo.appendChild(qi("br"));Bo.appendChild(document.createTextNode("x"))}Ui(e.measure,Bo);var r=Bo.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),Ki(e.measure),r||1}function wt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=qi("span","xxxxxxxxxx"),r=qi("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 xt(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:++Vo},Go?Go.ops.push(e.curOp):e.curOp.ownsGroup=Go={ops:[e.curOp],delayedCallbacks:[]}}function kt(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 Ct(e){var t=e.curOp,r=t.ownsGroup;if(r)try{kt(r)}finally{Go=null;for(var n=0;n<r.ops.length;n++)r.ops[n].cm.curOp=null;St(r)}}function St(e){for(var t=e.ops,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]);for(var r=0;r<t.length;r++)At(t[r])}function Tt(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 Lt(e){e.updatedDisplay=e.mustUpdate&&M(e.cm,e.update)}function Mt(e){var t=e.cm,r=t.display;e.updatedDisplay&&N(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+Ge(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(e.focus))}function _t(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&or(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==Gi()&&(!document.hasFocus||document.hasFocus());e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&y(t,e.barMeasure),e.updatedDisplay&&O(t,e.barMeasure),e.selectionChanged&&He(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&X(e.cm)}function At(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&&Er(t,i)}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var l=0;l<o.length;++l)o[l].lines.length||za(o[l],"hide");if(a)for(var l=0;l<a.length;++l)a[l].lines.length&&za(a[l],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&za(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Ot(e,t){if(e.curOp)return t();xt(e);try{return t()}finally{Ct(e)}}function Nt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);xt(e);try{return t.apply(e,arguments)}finally{Ct(e)}}}function Wt(e){return function(){if(this.curOp)return e.apply(this,arguments);xt(this);try{return e.apply(this,arguments)}finally{Ct(this)}}}function Et(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);xt(t);try{return e.apply(this,arguments)}finally{Ct(t)}}}function zt(e,t,r){this.line=t,this.rest=wn(t),this.size=this.rest?ri(Ei(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Cn(e,t)}function Pt(e,t,r){for(var n,i=[],o=t;o<r;o=n){var a=new zt(e.doc,Qn(e.doc,o),o);n=o+a.size,i.push(a)}return i}function Dt(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ho&&xn(e.doc,t)<i.viewTo&&Ht(e);else if(r<=i.viewFrom)Ho&&kn(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=jt(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=jt(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):Ht(e)}else{var a=jt(e,t,t,-1),l=jt(e,r,r+n,1);a&&l?(i.view=i.view.slice(0,a.index).concat(Pt(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 It(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[Ft(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);zi(a,r)==-1&&a.push(r)}}}function Ht(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ft(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if(t-=r[n].size,t<0)return n}function jt(e,t,r,n){var i,o=Ft(e,t),a=e.display.view;if(!Ho||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var l=0,s=e.display.viewFrom;l<o;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(;xn(e.doc,r)!=r;){if(o==(n<0?0:a.length-1))return null;r+=n*a[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function Rt(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=Pt(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Pt(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Ft(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(Pt(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,Ft(e,r)))),n.viewTo=r}function Bt(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 qt(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;Na(i.scroller,"mousedown",Nt(e,$t)),wo&&xo<11?Na(i.scroller,"dblclick",Nt(e,function(t){if(!Mi(e,t)){var r=Vt(e,t);if(r&&!Jt(e,t)&&!Gt(e.display,t)){_a(t);var n=e.findWordAt(r);we(e.doc,n.anchor,n.head)}}})):Na(i.scroller,"dblclick",function(t){Mi(e,t)||_a(t)}),Do||Na(i.scroller,"contextmenu",function(t){br(e,t)});var o,a={end:0};Na(i.scroller,"touchstart",function(t){if(!Mi(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)}}),Na(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Na(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(Fo(l.line,0),ge(e.doc,Fo(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),_a(r)}t()}),Na(i.scroller,"touchcancel",t),Na(i.scroller,"scroll",function(){i.scroller.clientHeight&&(ir(e,i.scroller.scrollTop),or(e,i.scroller.scrollLeft,!0),za(e,"scroll",e))}),Na(i.scroller,"mousewheel",function(t){ar(e,t)}),Na(i.scroller,"DOMMouseScroll",function(t){ar(e,t)}),Na(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Mi(e,t)||Oa(t)},over:function(t){Mi(e,t)||(rr(e,t),Oa(t))},start:function(t){tr(e,t)},drop:Nt(e,er),leave:function(t){Mi(e,t)||nr(e)}};var l=i.input.getField();Na(l,"keyup",function(t){pr.call(e,t)}),Na(l,"keydown",Nt(e,hr)),Na(l,"keypress",Nt(e,gr)),Na(l,"focus",Fi(vr,e)),Na(l,"blur",Fi(yr,e))}function Kt(t,r,n){var i=n&&n!=e.Init;if(!r!=!i){var o=t.display.dragFunctions,a=r?Na:Ea;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=ki(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 Vt(e,t,r,n){var i=e.display;if(!r&&"true"==ki(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=vt(e,o,a);if(n&&1==c.xRel&&(s=Qn(e.doc,c.line).text).length==c.ch){var u=Ra(s,s.length,e.options.tabSize)-s.length;c=Fo(c.line,Math.max(0,Math.round((o-Ue(e.display).left)/wt(e.display))-u))}return c}function $t(e){var t=this,r=t.display;if(!(Mi(t,e)||r.activeTouch&&r.input.supportsTouch())){if(r.shift=e.shiftKey,Gt(r,e))return void(ko||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!Jt(t,e)){var n=Vt(t,e);switch(window.focus(),Ci(e)){case 1:t.state.selectingText?t.state.selectingText(e):n?Yt(t,e,n):ki(e)==r.scroller&&_a(e);break;case 2:ko&&(t.state.lastMiddleDown=+new Date),n&&we(t.doc,n),setTimeout(function(){r.input.focus()},20),_a(e);break;case 3:Do?br(t,e):mr(t)}}}}function Yt(e,t,r){wo?setTimeout(Fi(X,e),0):e.curOp.focus=Gi();var n,i=+new Date;Ko&&Ko.time>i-400&&0==jo(Ko.pos,r)?n="triple":qo&&qo.time>i-400&&0==jo(qo.pos,r)?(n="double",Ko={time:i,pos:r}):(n="single",qo={time:i,pos:r});var o,a=e.doc.sel,l=No?t.metaKey:t.ctrlKey;e.options.dragDrop&&tl&&!e.isReadOnly()&&"single"==n&&(o=a.contains(r))>-1&&(jo((o=a.ranges[o]).from(),r)<0||r.xRel>0)&&(jo(o.to(),r)>0||r.xRel<0)?Xt(e,t,r,l):Zt(e,t,r,n,l)}function Xt(e,t,r,n){var i=e.display,o=+new Date,a=Nt(e,function(l){ko&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ea(document,"mouseup",a),Ea(i.scroller,"drop",a),Math.abs(t.clientX-l.clientX)+Math.abs(t.clientY-l.clientY)<10&&(_a(l),!n&&+new Date-200<o&&we(e.doc,r),ko||wo&&9==xo?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())});ko&&(i.scroller.draggable=!0),e.state.draggingText=a,a.copy=No?t.altKey:t.ctrlKey,i.scroller.dragDrop&&i.scroller.dragDrop(),Na(document,"mouseup",a),Na(i.scroller,"drop",a)}function Zt(e,t,r,n,i){function o(t){if(0!=jo(m,t))if(m=t,"rect"==n){for(var i=[],o=e.options.tabSize,a=Ra(Qn(c,r.line).text,r.ch,o),l=Ra(Qn(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));p<=g;p++){var v=Qn(c,p).text,y=Ba(v,s,o);s==f?i.push(new de(Fo(p,y),Fo(p,y))):v.length>y&&i.push(new de(Fo(p,y),Fo(p,Ba(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(Fo(t.line,0),ge(c,Fo(t.line+1,0)));jo(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),Fa)}}function a(t){var r=++y,i=Vt(e,t,!0,"rect"==n);if(i)if(0!=jo(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,_a(t),s.input.focus(),Ea(document,"mousemove",b),Ea(document,"mouseup",x),c.history.lastSelOrigin=null}var s=e.display,c=e.doc;_a(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),Wo?t.shiftKey&&t.metaKey:t.altKey)n="rect",i||(u=new de(r,r)),r=Vt(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(Fo(r.line,0),ge(c,Fo(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?d==-1?(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,Fa):(d=0,Le(c,new ue([u],0),Fa),h=c.sel);var m=r,v=s.wrapper.getBoundingClientRect(),y=0,b=Nt(e,function(e){Ci(e)?a(e):l(e)}),x=Nt(e,l);e.state.selectingText=x,Na(document,"mousemove",b),Na(document,"mouseup",x)}function Qt(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&&_a(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!Ai(e,r))return xi(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=ni(e.doc,o),d=e.options.gutters[s];return za(e,r,e,u,d,t),xi(t)}}}function Jt(e,t){return Qt(e,t,"gutterClick",!0)}function er(e){var t=this;if(nr(t),!Mi(t,e)&&!Gt(t.display,e)){_a(e),wo&&($o=+new Date);var r=Vt(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||zi(t.options.allowDropFileTypes,e.type)!=-1){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"};Lr(t.doc,s),Te(t.doc,fe(r,ea(s)))}}),l.readAsText(e)}},s=0;s<i;++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&&!t.state.draggingText.copy)var c=t.listSelections();if(Me(t.doc,fe(r,r)),c)for(var s=0;s<c.length;++s)Wr(t.doc,"",c[s].anchor,c[s].head,"drag");t.replaceSelection(o,"around","paste"),t.display.input.focus()}}catch(e){}}}}function tr(e,t){if(wo&&(!e.state.draggingText||+new Date-$o<100))return void Oa(t);if(!Mi(e,t)&&!Gt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!Lo)){var r=qi("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",To&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),To&&r.parentNode.removeChild(r)}}function rr(e,t){var r=Vt(e,t);if(r){var n=document.createDocumentFragment();De(e,r,n),e.display.dragCursor||(e.display.dragCursor=qi("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),Ui(e.display.dragCursor,n)}}function nr(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ir(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,vo||A(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbars.setScrollTop(t),vo&&A(e),Fe(e,100))}function or(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 ar(e,t){var r=Zo(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&&ko)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&&!vo&&!To&&null!=Xo)return i&&s&&ir(e,Math.max(0,Math.min(a.scrollTop+i*Xo,a.scrollHeight-a.clientHeight))),or(e,Math.max(0,Math.min(a.scrollLeft+n*Xo,a.scrollWidth-a.clientWidth))),(!i||i&&s)&&_a(t),void(o.wheelStartX=null);if(i&&null!=Xo){var h=i*Xo,f=e.doc.scrollTop,p=f+o.wrapper.clientHeight;h<0?f=Math.max(0,f+h-50):p=Math.min(e.doc.height,p+h+50),A(e,{top:f,bottom:p})}Yo<20&&(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&&(Xo=(Xo*Yo+r)/(Yo+1),++Yo)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}function lr(e,t,r){if("string"==typeof t&&(t=da[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)!=Ia}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function sr(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=fa(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&fa(t,e.options.extraKeys,r,e)||fa(t,e.options.keyMap,r,e)}function cr(e,t,r,n){var i=e.state.keySeq;if(i){if(pa(t))return"handled";Qo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),t=i+" "+t}var o=sr(e,t,n);return"multi"==o&&(e.state.keySeq=t),"handled"==o&&Ti(e,"keyHandled",e,t,r),"handled"!=o&&"multi"!=o||(_a(r),He(e)),i&&!o&&/\'$/.test(t)?(_a(r),!0):!!o}function ur(e,t){var r=ga(t,!0);return!!r&&(t.shiftKey&&!e.state.keySeq?cr(e,"Shift-"+r,t,function(t){return lr(e,t,!0)})||cr(e,r,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return lr(e,t)}):cr(e,r,t,function(t){return lr(e,t)}))}function dr(e,t,r){return cr(e,"'"+r+"'",t,function(t){return lr(e,t,!0)})}function hr(e){var t=this;if(t.curOp.focus=Gi(),!Mi(t,e)){wo&&xo<11&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=ur(t,e);To&&(Jo=n?r:null,!n&&88==r&&!il&&(No?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||fr(t)}}function fr(e){function t(e){18!=e.keyCode&&e.altKey||(Qa(r,"CodeMirror-crosshair"),Ea(document,"keyup",t),Ea(document,"mouseover",t))}var r=e.display.lineDiv;Ja(r,"CodeMirror-crosshair"),Na(document,"keyup",t),Na(document,"mouseover",t)}function pr(e){16==e.keyCode&&(this.doc.sel.shift=!1),Mi(this,e)}function gr(e){var t=this;if(!(Gt(t.display,e)||Mi(t,e)||e.ctrlKey&&!e.altKey||No&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(To&&r==Jo)return Jo=null,void _a(e);if(!To||e.which&&!(e.which<10)||!ur(t,e)){var i=String.fromCharCode(null==n?r:n);dr(t,e,i)||t.display.input.onKeyPress(e)}}}function mr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,yr(e))},100)}function vr(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(za(e,"focus",e),e.state.focused=!0,Ja(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),ko&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),He(e))}function yr(e){e.state.delayingBlurEvent||(e.state.focused&&(za(e,"blur",e),e.state.focused=!1,Qa(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function br(e,t){Gt(e.display,t)||wr(e,t)||Mi(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function wr(e,t){return!!Ai(e,"gutterContextMenu")&&Qt(e,t,"gutterContextMenu",!1)}function xr(e,t){if(jo(e,t.from)<0)return e;if(jo(e,t.to)<=0)return ea(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+=ea(t).ch-t.to.ch),Fo(r,n)}function kr(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new de(xr(i.anchor,t),xr(i.head,t)))}return he(r,e.sel.primIndex)}function Cr(e,t,r){return e.line==t.line?Fo(r.line,e.ch-t.ch+r.ch):Fo(r.line+(e.line-t.line),e.ch)}function Sr(e,t,r){for(var n=[],i=Fo(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=Cr(l.from,i,o),c=Cr(ea(l),i,o);if(i=l.to,o=c,"around"==r){var u=e.sel.ranges[a],d=jo(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 Tr(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)}),za(e,"beforeChange",e,n),e.cm&&za(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Lr(e,t,r){if(e.cm){if(!e.cm.curOp)return Nt(e.cm,Lr)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(Ai(e,"beforeChange")||e.cm&&Ai(e.cm,"beforeChange"))||(t=Tr(e,t,!0))){var n=Io&&!r&&cn(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)Mr(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else Mr(e,t)}}function Mr(e,t){if(1!=t.text.length||""!=t.text[0]||0!=jo(t.from,t.to)){var r=kr(e,t);ui(e,t,r,e.cm?e.cm.curOp.id:NaN),Or(e,t,r,an(e,t));var n=[];Xn(e,function(e,r){r||zi(n,e.history)!=-1||(wi(e.history,t),n.push(e.history)),Or(e,t,null,an(e,t))})}}function _r(e,t,r){if(!e.cm||!e.cm.state.suppressEdits||r){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(fi(n,l),r&&!n.equals(e.sel))return void Le(e,n,{clearRedo:!1});o=n}var c=[];fi(o,l),l.push({changes:c,generation:i.generation}),i.generation=n.generation||++i.maxGeneration;for(var u=Ai(e,"beforeChange")||e.cm&&Ai(e.cm,"beforeChange"),s=n.changes.length-1;s>=0;--s){var d=n.changes[s];if(d.origin=t,u&&!Tr(e,d,!1))return void(a.length=0);c.push(li(e,d));var h=s?kr(e,d):Ei(a);Or(e,d,h,sn(e,d)),!s&&e.cm&&e.cm.scrollIntoView({from:d.from,to:ea(d)});var f=[];Xn(e,function(e,t){t||zi(f,e.history)!=-1||(wi(e.history,d),f.push(e.history)),Or(e,d,null,sn(e,d))})}}}}function Ar(e,t){if(0!=t&&(e.first+=t,e.sel=new ue(Pi(e.sel.ranges,function(e){return new de(Fo(e.anchor.line+t,e.anchor.ch),Fo(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){
4
- Dt(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)It(e.cm,n,"gutter")}}function Or(e,t,r,n){if(e.cm&&!e.cm.curOp)return Nt(e.cm,Or)(e,t,r,n);if(t.to.line<e.first)return void Ar(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);Ar(e,i),t={from:Fo(e.first,0),to:Fo(t.to.line+i,t.to.ch),text:[Ei(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:Fo(o,Qn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Jn(e,t.from,t.to),r||(r=kr(e,t)),e.cm?Nr(e.cm,t,n):Vn(e,t,n),Me(e,r,Ha)}}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=ri(bn(Qn(n,a.line))),n.iter(c,l.line+1,function(e){if(e==i.maxLine)return s=!0,!0})),n.sel.contains(t.from,t.to)>-1&&_i(e),Vn(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?Dt(e):a.line!=l.line||1!=t.text.length||Gn(e.doc,t)?Dt(e,a.line,l.line+1,u):It(e,a.line,"text");var h=Ai(e,"changes"),f=Ai(e,"change");if(f||h){var p={from:a,to:l,text:t.text,removed:t.removed,origin:t.origin};f&&Ti(e,"change",e,p),h&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function Wr(e,t,r,n,i){if(n||(n=r),jo(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=e.splitLines(t)),Lr(e,{from:r,to:n,text:t,origin:i})}function Er(e,t){if(!Mi(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&&!_o){var o=qi("div","​",null,"position: absolute; top: "+(t.top-r.viewOffset-qe(e.display))+"px; height: "+(t.bottom-t.top+Ge(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;i<5;i++){var o=!1,a=pt(e,t),l=r&&r!=t?pt(e,r):a,s=Dr(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&&(ir(e,s.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(o=!0)),null!=s.scrollLeft&&(or(e,s.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return a}function Pr(e,t,r,n,i){var o=Dr(e,t,r,n,i);null!=o.scrollTop&&ir(e,o.scrollTop),null!=o.scrollLeft&&or(e,o.scrollLeft)}function Dr(e,t,r,n,i){var o=e.display,a=bt(e.display);r<0&&(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+Ke(o),d=r<a,h=i>u-a;if(r<l)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),t<10?c.scrollLeft=0:t<p?c.scrollLeft=Math.max(0,t-(m?0:10)):n>g+p-3&&(c.scrollLeft=n+(m?0:10)-g),c}function Ir(e,t,r){null==t&&null==r||Fr(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){Fr(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?Fo(t.line,t.ch-1):t,n=Fo(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function Fr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=gt(e,t.from),n=gt(e,t.to),i=Dr(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 jr(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=Qn(o,t),s=Ra(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==Ia||c>150)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?Ra(Qn(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+="\t";if(h<c&&(d+=Wi(c-h)),d!=u)return Wr(o,d,Fo(t,0),Fo(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=Fo(t,u.length);ke(o,f,new de(h,h));break}}}function Rr(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=Qn(e,pe(e,t)):i=ri(t),null==i?null:(n(o,i)&&e.cm&&It(e.cm,i,r),o)}function Br(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&jo(o.from,Ei(n).to)<=0;){var a=n.pop();if(jo(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}Ot(e,function(){for(var t=n.length-1;t>=0;t--)Wr(e.doc,"",n[t].from,n[t].to,"+delete");Hr(e)})}function qr(e,t,r,n,i){function o(){var t=l+r;return!(t<e.first||t>=e.first+e.size)&&(l=t,u=Qn(e,t))}function a(e){var t=(i?fo:po)(u,s,r,!0);if(null==t){if(e||!o())return!1;s=i?(r<0?oo:io)(u):r<0?u.text.length:0}else s=t;return!0}var l=t.line,s=t.ch,c=r,u=Qn(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;!(r<0)||a(!p);p=!1){var g=u.text.charAt(s)||"\n",m=ji(g,f)?"w":h&&"\n"==g?"n":!h||/\s/.test(g)?null:"p";if(!h||p||m||(m="s"),d&&d!=m){r<0&&(r=1,a());break}if(m&&(d=m),r>0&&!a(!p))break}var v=We(e,Fo(l,s),t,c,!0);return jo(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-(r<0?1.5:.5)*bt(e.display))}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;;){var s=vt(e,a,i);if(!s.outside)break;if(r<0?i<=0:i>=o.height){s.hitSide=!0;break}i+=5*r}return s}function Ur(t,r,n,i){e.defaults[t]=r,n&&(ra[t]=i?function(e,t,r){r!=na&&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 Vr(e){return"string"==typeof e?ha[e]:e}function $r(e,t,r,n,i){if(n&&n.shared)return Yr(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return Nt(e.cm,$r)(e,t,r,n,i);var o=new ya(e,i),a=jo(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=qi("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(yn(e,t.line,t,r,o)||t.line!=r.line&&yn(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ho=!0}o.addToHistory&&ui(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&&bn(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&ti(e,0),rn(e,new Jr(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){Cn(e,t)&&ti(t,0)}),o.clearOnEnter&&Na(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Io=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++va,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)Dt(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++)It(c,u,"text");o.atomic&&Ae(c.doc),Ti(c,"markerAdded",c,o)}return o}function Yr(e,t,r,n,i){n=Hi(n),n.shared=!1;var o=[$r(e,t,r,n,i)],a=o[0],l=n.widgetNode;return Xn(e,function(e){l&&(n.widgetNode=l.cloneNode(!0)),o.push($r(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=Ei(o)}),new ba(o,a)}function Xr(e){return e.findMarks(Fo(e.first,0),e.clipPos(Fo(e.lastLine())),function(e){return e.parent})}function Zr(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(jo(o,a)){var l=$r(e,o,a,n.primary,n.primary.type);n.markers.push(l),l.parent=n}}}function Qr(e){for(var t=0;t<e.length;t++){var r=e[t],n=[r.primary.doc];Xn(r.primary.doc,function(e){n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];zi(n,o.doc)==-1&&(o.parent=null,r.markers.splice(i--,1))}}}function Jr(e,t,r){this.marker=e,this.from=t,this.to=r}function en(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function tn(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function rn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}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.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 Jr(a,o.from,s?null:o.to))}}return n}function on(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 Jr(a,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}function an(e,t){if(t.full)return null;var r=ve(e,t.from.line)&&Qn(e,t.from.line).markedSpans,n=ve(e,t.to.line)&&Qn(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,a=0==jo(t.from,t.to),l=nn(r,i,a),s=on(n,o,a),c=1==t.text.length,u=Ei(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=en(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=en(l,h.marker);f||(h.from=u,c&&(l||(l=[])).push(h))}else h.from+=u,c&&(l||(l=[])).push(h)}l&&(l=ln(l)),s&&s!=l&&(s=ln(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 Jr(l[d].marker,null,null));for(var d=0;d<m;++d)p.push(g);p.push(s)}return p}function ln(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 sn(e,t){var r=mi(e,t),n=an(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 cn(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&&zi(n,r)!=-1||(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(!(jo(c.to,l.from)<0||jo(c.from,l.to)>0)){var u=[s,1],d=jo(c.from,l.from),h=jo(c.to,l.to);(d<0||!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 un(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function dn(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function hn(e){return e.inclusiveLeft?-1:0}function fn(e){return e.inclusiveRight?1:0}function pn(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=jo(n.from,i.from)||hn(e)-hn(t);if(o)return-o;var a=jo(n.to,i.to)||fn(e)-fn(t);return a?a:t.id-e.id}function gn(e,t){var r,n=Ho&&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||pn(r,i.marker)<0)&&(r=i.marker);return r}function mn(e){return gn(e,!0)}function vn(e){return gn(e,!1)}function yn(e,t,r,n,i){var o=Qn(e,t),a=Ho&&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=jo(c.from,r)||hn(s.marker)-hn(i),d=jo(c.to,n)||fn(s.marker)-fn(i);if(!(u>=0&&d<=0||u<=0&&d>=0)&&(u<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?jo(c.to,r)>=0:jo(c.to,r)>0)||u>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?jo(c.from,n)<=0:jo(c.from,n)<0)))return!0}}}function bn(e){for(var t;t=mn(e);)e=t.find(-1,!0).line;return e}function wn(e){for(var t,r;t=vn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function xn(e,t){var r=Qn(e,t),n=bn(r);return r==n?t:ri(n)}function kn(e,t){if(t>e.lastLine())return t;var r,n=Qn(e,t);if(!Cn(e,n))return t;for(;r=vn(n);)n=r.find(1,!0).line;return ri(n)+1}function Cn(e,t){var r=Ho&&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&&Sn(e,t,n))return!0}}function Sn(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Sn(e,n.line,en(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)&&Sn(e,t,i))return!0}function Tn(e,t,r){ii(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ir(e,null,r)}function Ln(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Ya(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,qi("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function Mn(e,t,r,n){var i=new wa(e,r,n),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),Rr(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&&!Cn(e,t)){var n=ii(t)<e.scrollTop;ti(t,t.height+Ln(i)),n&&Ir(o,null,i.height),o.curOp.forceUpdate=!0}return!0}),i}function _n(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),un(e),dn(e,r);var i=n?n(e):1;i!=e.height&&ti(e,i)}function An(e){e.parent=null,un(e)}function On(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 Wn(t,r,n,i){for(var o=0;o<10;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 En(e,t,r,n){function i(e){return{start:d.start,end:d.pos,string:d.current(),type:o||null,state:e?ca(a.mode,u):u}}var o,a=e.doc,l=a.mode;t=ge(a,t);var s,c=Qn(a,t.line),u=Be(e,t.line,r),d=new ma(c.text,e.options.tabSize);for(n&&(s=[]);(n||d.pos<t.ch)&&!d.eol();)d.start=d.pos,o=Wn(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 ma(t,e.options.tabSize),h=e.options.addModeClass&&[null];for(""==t&&On(Nn(r,n),o);!d.eol();){if(d.pos>e.options.maxHighlightLength?(l=!1,a&&In(e,t,n,d.pos),d.pos=t.length,s=null):s=On(Wn(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 Pn(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;c<e;){var n=i[s];n>e&&i.splice(s,1,e,i[s+1],n),s+=2,c=Math.min(e,n)}if(t)if(l.opaque)i.splice(r,s-r,e,"cm-overlay "+t),s=r+2;else for(;r<s;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 Dn(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Be(e,ri(t)),i=Pn(e,t,t.text.length>e.options.maxHighlightLength?ca(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 In(e,t,r,n){var i=e.doc.mode,o=new ma(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&Nn(i,r);!o.eol();)Wn(i,o,r),o.start=o.pos}function Hn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Ca:ka;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Fn(e,t){var r=qi("span",null,null,ko?"padding-right: .1px":null),n={pre:qi("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:(wo||ko)&&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=Rn,Ji(e.display.measure)&&(o=oi(a))&&(n.addToken=qn(n.addToken,o)),n.map=[];var l=t!=e.display.externalMeasured&&ri(a);Un(a,n,Dn(e,a,l)),a.styleClasses&&(a.styleClasses.bgClass&&(n.bgClass=$i(a.styleClasses.bgClass,n.bgClass||"")),a.styleClasses.textClass&&(n.textClass=$i(a.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Qi(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(ko){var s=n.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return za(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=$i(n.pre.className,n.textClass||"")),n}function jn(e){var t=qi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Rn(e,t,r,n,i,o,a){if(t){var l=e.splitSpaces?Bn(t,e.trailingSpace):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));wo&&xo<9?u.appendChild(qi("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,"\t"==h[0]){var g=e.cm.options.tabSize,m=g-e.col%g,p=u.appendChild(qi("span",Wi(m),"cm-tab"));p.setAttribute("role","presentation"),p.setAttribute("cm-text","\t"),e.col+=m}else if("\r"==h[0]||"\n"==h[0]){var p=u.appendChild(qi("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]),wo&&xo<9?u.appendChild(qi("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),wo&&xo<9&&(c=!0),e.pos+=t.length}if(e.trailingSpace=32==l.charCodeAt(t.length-1),r||n||i||c||a){var v=r||"";n&&(v+=n),i&&(v+=i);var y=qi("span",[u],v,a);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function Bn(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}function qn(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,e.trailingSpace=!1}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||pn(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&&""==Ei(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Vn(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){_n(e,r,i,n),Ti(e,"change",e,t)}function a(e,t){for(var r=e,o=[];r<t;++r)o.push(new xa(c[r],i(r),n));return o}var l=t.from,s=t.to,c=t.text,u=Qn(e,l.line),d=Qn(e,s.line),h=Ei(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 xa(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)}Ti(e,"change",e,t)}function $n(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 Yn(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 Xn(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 Zn(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,Dt(e)}function Qn(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function Jn(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function ei(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function ti(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function ri(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 ni(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var n=0;n<e.lines.length;++n){var a=e.lines[n],l=a.height;if(t<l)break;t-=l}return r+n}function ii(e){e=bn(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 oi(e){var t=e.order;return null==t&&(t=e.order=sl(e.text)),t}function ai(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 li(e,t){var r={from:V(t.from),to:ea(t),text:Jn(e,t.from,t.to)};return pi(e,r,t.from.line,t.to.line+1),Xn(e,function(e){pi(e,r,t.from.line,t.to.line+1)},!0),r}function si(e){for(;e.length;){var t=Ei(e);if(!t.ranges)break;e.pop()}}function ci(e,t){return t?(si(e.done),Ei(e.done)):e.done.length&&!Ei(e.done).ranges?Ei(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Ei(e.done)):void 0}function ui(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=ci(i,i.lastOp==n))){var l=Ei(o.changes);0==jo(t.from,t.to)&&0==jo(t.from,l.to)?l.to=ea(t):o.changes.push(li(e,t))}else{var s=Ei(i.done);for(s&&s.ranges||fi(e.sel,i.done),o={changes:[li(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||za(e,"historyAdded")}function di(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 hi(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||di(e,o,Ei(i.done),t))?i.done[i.done.length-1]=t:fi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&n.clearRedo!==!1&&si(i.undone)}function fi(e,t){var r=Ei(t);r&&r.ranges&&r.equals(e)||t.push(e)}function pi(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function gi(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function mi(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=0,i=[];n<t.text.length;++n)i.push(gi(r[n]));return i}function vi(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&&(Ei(l)[d]=u[d],delete u[d])}}}return i}function yi(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function bi(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++)yi(o.ranges[l].anchor,t,r,n),yi(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=Fo(s.from.line+n,s.from.ch),s.to=Fo(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 wi(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;bi(e.done,r,n,i),bi(e.undone,r,n,i)}function xi(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function ki(e){return e.target||e.srcElement}function Ci(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 Si(e,t,r){var n=e._handlers&&e._handlers[t];return r?n&&n.length>0?n.slice():Wa:n||Wa}function Ti(e,t){function r(e){return function(){e.apply(null,o)}}var n=Si(e,t,!1);if(n.length){var i,o=Array.prototype.slice.call(arguments,2);Go?i=Go.delayedCallbacks:Pa?i=Pa:(i=Pa=[],setTimeout(Li,0));for(var a=0;a<n.length;++a)i.push(r(n[a]))}}function Li(){var e=Pa;Pa=null;for(var t=0;t<e.length;++t)e[t]()}function Mi(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),za(e,r||t.type,e,t),xi(t)||t.codemirrorIgnore}function _i(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)zi(r,t[n])==-1&&r.push(t[n])}function Ai(e,t){return Si(e,t).length>0}function Oi(e){e.prototype.on=function(e,t){Na(this,e,t)},e.prototype.off=function(e,t){Ea(this,e,t)}}function Ni(){this.id=null}function Wi(e){for(;qa.length<=e;)qa.push(Ei(qa)+" ");return qa[e]}function Ei(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 Pi(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Di(){}function Ii(e,t){var r;return Object.create?r=Object.create(e):(Di.prototype=e,r=new Di),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 Fi(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function ji(e,t){return t?!!(t.source.indexOf("\\w")>-1&&Va(e))||t.test(e):Va(e)}function Ri(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Bi(e){return e.charCodeAt(0)>=768&&$a.test(e)}function qi(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 Vi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function $i(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!Vi(r[n]).test(t)&&(t+=" "+r[n]);return t}function Yi(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 Xi(){el||(Zi(),el=!0)}function Zi(){var e;Na(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Yi(Ut)},100))}),Na(window,"blur",function(){Yi(yr)})}function Qi(e){if(null==Xa){var t=qi("span","​");Ui(e,qi("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Xa=t.offsetWidth<=1&&t.offsetHeight>2&&!(wo&&xo<8))}var r=Xa?qi("span","​"):qi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Ji(e){if(null!=Za)return Za;var t=Ui(e,document.createTextNode("AخA")),r=Ua(t,0,1).getBoundingClientRect(),n=Ua(t,1,2).getBoundingClientRect();return Ki(e),!(!r||r.left==r.right)&&(Za=n.right-r.right<3)}function eo(e){if(null!=ol)return ol;var t=Ui(e,qi("span","x")),r=t.getBoundingClientRect(),n=Ua(t,0,1).getBoundingClientRect();return ol=Math.abs(r.left-n.left)>1}function to(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 ro(e){return e.level%2?e.to:e.from}function no(e){return e.level%2?e.from:e.to}function io(e){var t=oi(e);return t?ro(t[0]):0}function oo(e){var t=oi(e);return t?no(Ei(t)):e.text.length}function ao(e,t){var r=Qn(e.doc,t),n=bn(r);
5
- n!=r&&(t=ri(n));var i=oi(n),o=i?i[0].level%2?oo(n):io(n):0;return Fo(t,o)}function lo(e,t){for(var r,n=Qn(e.doc,t);r=vn(n);)n=r.find(1,!0).line,t=null;var i=oi(n),o=i?i[0].level%2?io(n):oo(n):n.text.length;return Fo(null==t?ri(n):t,o)}function so(e,t){var r=ao(e,t.line),n=Qn(e.doc,r.line),i=oi(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 Fo(r.line,a?0:o)}return r}function co(e,t,r){var n=e[0].level;return t==n||r!=n&&t<r}function uo(e,t){ll=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 co(e,i.level,e[r].level)?(i.from!=i.to&&(ll=r),n):(i.from!=i.to&&(ll=n),r);r=n}}return r}function ho(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&Bi(e.text.charAt(t)));return t}function fo(e,t,r,n){var i=oi(e);if(!i)return po(e,t,r,n);for(var o=uo(i,t),a=i[o],l=ho(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 uo(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?ho(e,a.to,-1,n):ho(e,a.from,1,n)}}function po(e,t,r,n){var i=t+r;if(n)for(;i>0&&Bi(e.text.charAt(i));)i+=r;return i<0||i>e.text.length?null:i}var go=navigator.userAgent,mo=navigator.platform,vo=/gecko\/\d/i.test(go),yo=/MSIE \d/.test(go),bo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(go),wo=yo||bo,xo=wo&&(yo?document.documentMode||6:bo[1]),ko=/WebKit\//.test(go),Co=ko&&/Qt\/\d+\.\d+/.test(go),So=/Chrome\//.test(go),To=/Opera\//.test(go),Lo=/Apple Computer/.test(navigator.vendor),Mo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(go),_o=/PhantomJS/.test(go),Ao=/AppleWebKit/.test(go)&&/Mobile\/\w+/.test(go),Oo=Ao||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(go),No=Ao||/Mac/.test(mo),Wo=/\bCrOS\b/.test(go),Eo=/win/i.test(mo),zo=To&&go.match(/Version\/(\d*\.\d*)/);zo&&(zo=Number(zo[1])),zo&&zo>=15&&(To=!1,ko=!0);var Po=No&&(Co||To&&(null==zo||zo<12.11)),Do=vo||wo&&xo>=9,Io=!1,Ho=!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&&!Mo?"12px":"18px";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){Ai(e,t)&&this.events.push(arguments)},T.prototype.finish=function(){for(var e=0;e<this.events.length;e++)za.apply(null,this.events[e])};var Fo=e.Pos=function(e,t){return this instanceof Fo?(this.line=e,void(this.ch=t)):new Fo(e,t)},jo=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},Ro=null;re.prototype=Hi({init:function(e){function t(e){if(!Mi(n,e)){if(n.somethingSelected())Ro={lineWise:!1,text:n.getSelections()},r.inaccurateSelection&&(r.prevInput="",r.inaccurateSelection=!1,o.value=Ro.text.join("\n"),Ka(o));else{if(!n.options.lineWiseCopyCut)return;var t=ee(n);Ro={lineWise:!0,text:t.text},"cut"==e.type?n.setSelections(t.ranges,null,Ha):(r.prevInput="",o.value=t.text.join("\n"),Ka(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),Ao&&(o.style.width="0px"),Na(o,"input",function(){wo&&xo>=9&&r.hasSelection&&(r.hasSelection=null),r.poll()}),Na(o,"paste",function(e){Mi(n,e)||Q(e,n)||(n.state.pasteIncoming=!0,r.fastPoll())}),Na(o,"cut",t),Na(o,"copy",t),Na(e.scroller,"paste",function(t){Gt(e,t)||Mi(n,t)||(n.state.pasteIncoming=!0,r.focus())}),Na(e.lineSpace,"selectstart",function(t){Gt(e,t)||_a(t)}),Na(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"})}}),Na(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=pt(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=il&&(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&&Ka(this.textarea),wo&&xo>=9&&(this.hasSelection=a)}else e||(this.prevInput=this.textarea.value="",wo&&xo>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Oo||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||nl(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(wo&&xo>=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);o<a&&r.charCodeAt(o)==n.charCodeAt(o);)++o;var l=this;return Ot(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(){wo&&xo>=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,wo&&xo<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=s),null!=a.selectionStart){(!wo||wo&&xo<9)&&t();var e=0,r=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&"​"==n.prevInput?Nt(i,da.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=Vt(i,e),s=o.scroller.scrollTop;if(l&&!To){var c=i.options.resetSelectionOnContextMenu;c&&i.doc.sel.contains(l)==-1&&Nt(i,Le)(i.doc,fe(l),Ha);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: "+(wo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",ko)var f=window.scrollY;if(o.input.focus(),ko&&window.scrollTo(null,f),o.input.reset(),i.somethingSelected()||(a.value=n.prevInput=" "),n.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),wo&&xo>=9&&t(),Do){Oa(e);var p=function(){Ea(window,"mouseup",p),setTimeout(r,20)};Na(window,"mouseup",p)}else setTimeout(r,50)}},readOnlyChanged:function(e){e||this.reset()},setUneditable:Di,needsContentAttribute:!1},re.prototype),ie.prototype=Hi({init:function(e){function t(e){if(!Mi(n,e)){if(n.somethingSelected())Ro={lineWise:!1,text:n.getSelections()},"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=ee(n);Ro={lineWise:!0,text:t.text},"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,Ha),n.replaceSelection("",null,"cut")})}if(e.clipboardData&&!Ao)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Ro.text.join("\n"));else{var r=ne(),i=r.firstChild;n.display.lineSpace.insertBefore(r,n.display.lineSpace.firstChild),i.value=Ro.text.join("\n");var o=document.activeElement;Ka(i),setTimeout(function(){n.display.lineSpace.removeChild(r),o.focus()},50)}}}var r=this,n=r.cm,i=r.div=e.lineDiv;te(i),Na(i,"paste",function(e){Mi(n,e)||Q(e,n)}),Na(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(Fo(i.head.line,a),Fo(i.head.line,a+t.length)))}}),Na(i,"compositionupdate",function(e){r.composing.data=e.data}),Na(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))}),Na(i,"touchstart",function(){r.forceCompositionEnd()}),Na(i,"input",function(){r.composing||!n.isReadOnly()&&r.pollContent()||Ot(r.cm,function(){Dt(n)})}),Na(i,"copy",t),Na(i,"cut",t)},prepareSelection:function(){var e=Pe(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&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!=jo(Y(r,n),t.from())||0!=jo($(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=Ua(i.node,i.offset,o.offset,o.node)}catch(d){}u&&(!vo&&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):vo&&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 Ya(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():Ot(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&&Ot(t,function(){Le(t.doc,fe(r,n),Ha),(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=Ft(e,n.line)))var a=ri(t.view[0].line),l=t.view[0].node;else var a=ri(t.view[o].line),l=t.view[o-1].node.nextSibling;var s=Ft(e,i.line);if(s==t.view.length-1)var c=t.viewTo-1,u=t.lineDiv.lastChild;else var c=ri(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=Jn(e.doc,Fo(a,0),Fo(c,Qn(e.doc,c).text.length));d.length>1&&h.length>1;)if(Ei(d)==Ei(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);f<v&&g.charCodeAt(f)==m.charCodeAt(f);)++f;for(var y=Ei(d),b=Ei(h),w=Math.min(y.length-(1==d.length?f:0),b.length-(1==h.length?f:0));p<w&&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=Fo(a,f),k=Fo(c,h.length?Ei(h).length-p:0);return d.length>1||d[0]||jo(x,k)?(Wr(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,Dt)(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:Di,resetPosition:Di,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!=jo(r.anchor,n.anchor)||0!=jo(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(jo(t,n.from())>=0&&jo(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 Bo,qo,Ko,Uo={left:0,right:0,top:0,bottom:0},Go=null,Vo=0,$o=0,Yo=0,Xo=null;wo?Xo=-.53:vo?Xo=15:So?Xo=-.7:Lo&&(Xo=-1/3);var Zo=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=Zo(e);return t.x*=Xo,t.y*=Xo,t};var Qo=new Ni,Jo=null,ea=e.changeEnd=function(e){return e.text?Fo(e.from.line+e.text.length-1,Ei(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,ra.hasOwnProperty(e)&&Nt(this,ra[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"](Vr(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:Wt(function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:t,opaque:r&&r.opaque}),this.state.modeGen++,Dt(this)}),removeOverlay:Wt(function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void Dt(this)}}),indentLine:Wt(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)&&jr(this,e,t,r)}),indentSelection:Wt(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&&(jr(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;s<r;++s)jr(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()),Ha)}}}),getTokenAt:function(e,t){return En(this,e,t)},getLineTokens:function(e,t){return En(this,Fo(e),t,!0)},getTokenTypeAt:function(e){e=ge(this.doc,e);var t,r=Dn(this,Qn(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 l<0?t:0==l?null:t.slice(0,l-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!sa.hasOwnProperty(t))return r;var n=sa[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)&&zi(r,l.val)==-1&&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(),pt(this,r,t||"page")},charCoords:function(e,t){return ft(this,ge(this.doc,e),t||"page")},coordsChar:function(e,t){return e=ht(this,e,t||"page"),vt(this,e.left,e.top)},lineAtHeight:function(e,t){return e=ht(this,{top:e,left:0},t||"page").top,ni(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=Qn(this.doc,e)}else r=e;return dt(this,r,{top:0,left:0},t||"page").top+(n?this.doc.height-ii(r):0)},defaultTextHeight:function(){return bt(this.display)},defaultCharWidth:function(){return wt(this.display)},setGutterMarker:Wt(function(e,t,r){return Rr(this.doc,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&Ri(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Wt(function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,It(t,n,"gutter"),Ri(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=Qn(this.doc,e),!e)return null}else{var t=ri(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=pt(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&&Pr(this,l,a,l+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:Wt(hr),triggerOnKeyPress:Wt(gr),triggerOnKeyUp:pr,execCommand:function(e){if(da.hasOwnProperty(e))return da[e].call(null,this)},triggerElectric:Wt(function(e){J(this,e)}),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=0,a=ge(this.doc,e);o<t&&(a=qr(this.doc,a,i,r,n),!a.hitSide);++o);return a},moveH:Wt(function(e,t){var r=this;r.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?qr(r.doc,n.head,e,t,r.options.rtlMoveVisually):e<0?n.from():n.to()},ja)}),deleteH:Wt(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Br(this,function(r){var i=qr(n,r.head,e,t,!1);return e<0?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=1,o=n;t<0&&(i=-1,t=-t);for(var a=0,l=ge(this.doc,e);a<t;++a){var s=pt(this,l,"div");if(null==o?o=s.left:s.left=o,l=Kr(this,s,i,r),l.hitSide)break}return l},moveV:Wt(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 e<0?a.from():a.to();var l=pt(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()&&Ir(r,null,ft(r,s,"div").top-l.top),s},ja),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=Qn(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=ji(a,o)?function(e){return ji(e,o)}:/\s/.test(a)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!ji(e)};n>0&&l(r.charAt(n-1));)--n;for(;i<r.length&&l(r.charAt(i));)++i}return new de(Fo(e.line,n),Fo(e.line,i))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?Ja(this.display.cursorDiv,"CodeMirror-overwrite"):Qa(this.display.cursorDiv,"CodeMirror-overwrite"),za(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==Gi()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Wt(function(e,t){null==e&&null==t||Fr(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-Ge(this)-this.display.barHeight,width:e.scrollWidth-Ge(this)-this.display.barWidth,clientHeight:$e(this),clientWidth:Ve(this)}},scrollIntoView:Wt(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:Fo(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)Fr(this),this.curOp.scrollToPos=e;else{var r=Dr(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:Wt(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&&lt(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){It(n,i,"widget");break}++i}),n.curOp.forceUpdate=!0,za(n,"refresh",this)}),operation:function(e){return Ot(this,e)},refresh:Wt(function(){var e=this.display.cachedTextHeight;Dt(this),this.curOp.forceUpdate=!0,st(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),u(this),(null==e||Math.abs(e-bt(this.display))>.5)&&a(this),za(this,"refresh",this)}),swapDoc:Wt(function(e){var t=this.doc;return t.cm=null,Zn(this,e),st(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Ti(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}},Oi(e);var ta=e.defaults={},ra=e.optionHandlers={},na=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),st(e),Dt(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(o==-1)break;i=o+t.length,r.push(Fo(n,o))}n++});for(var i=r.length-1;i>=0;i--)Wr(e.doc,t,r[i],Fo(r[i].line,r[i].ch+t.length))}}),Ur("specialChars",/[\u0000-\u001f\u007f\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,r,n){t.state.specialChars=new RegExp(r.source+(r.test("\t")?"":"|\t"),"g"),n!=e.Init&&t.refresh()}),Ur("specialCharPlaceholder",jn,function(e){e.refresh()},!0),Ur("electricChars",!0),Ur("inputStyle",Oo?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Ur("rtlMoveVisually",!Eo),Ur("wholeLineUpdateBefore",!0),Ur("theme","default",function(e){l(e),s(e)},!0),Ur("keyMap","default",function(t,r,n){var i=Vr(r),o=n!=e.Init&&Vr(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,ze,!0),Ur("resetSelectionOnContextMenu",!0),Ur("lineWiseCopyCut",!0),Ur("readOnly",!1,function(e,t){"nocursor"==t?(yr(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,ze,!0),Ur("singleCursorHeightPerLine",!0,ze,!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 ia=e.modes={},oa=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)),ia[t]=r},e.defineMIME=function(e,t){oa[e]=t},e.resolveMode=function(t){if("string"==typeof t&&oa.hasOwnProperty(t))t=oa[t];else if(t&&"string"==typeof t.name&&oa.hasOwnProperty(t.name)){var r=oa[t.name];"string"==typeof r&&(r={name:r}),t=Ii(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=ia[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if(aa.hasOwnProperty(r.name)){var o=aa[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 aa=e.modeExtensions={};e.extendMode=function(e,t){var r=aa.hasOwnProperty(e)?aa[e]:aa[e]={};Hi(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){Ta.prototype[e]=t},e.defineOption=Ur;var la=[];e.defineInitHook=function(e){la.push(e)};var sa=e.helpers={};e.registerHelper=function(t,r,n){sa.hasOwnProperty(t)||(sa[t]=e[t]={_global:[]}),sa[t][r]=n},e.registerGlobalHelper=function(t,r,n,i){e.registerHelper(t,r,i),sa[t]._global.push({pred:n,val:i})};var ca=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},ua=e.startState=function(e,t,r){return!e.startState||e.startState(t,r)};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 da=e.commands={selectAll:function(e){e.setSelection(Fo(e.firstLine(),0),Fo(e.lastLine()),Ha)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ha)},killLine:function(e){Br(e,function(t){if(t.empty()){var r=Qn(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:Fo(t.head.line+1,0)}:{from:t.head,to:Fo(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){Br(e,function(t){return{from:Fo(t.from().line,0),to:ge(e.doc,Fo(t.to().line+1,0))}})},delLineLeft:function(e){Br(e,function(e){return{
6
- from:Fo(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){Br(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){Br(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(Fo(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(Fo(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return ao(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){return so(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){e.extendSelectionsBy(function(t){return lo(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")},ja)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},ja)},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/)?so(e,t.head):n},ja)},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("\t")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),a=Ra(e.getLine(o.line),o.ch,n);t.push(Wi(n-a%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){Ot(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){var i=t[n].head,o=Qn(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new Fo(i.line,i.ch-1)),i.ch>0)i=new Fo(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),Fo(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Qn(e.doc,i.line-1).text;a&&e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),Fo(i.line-1,a.length-1),Fo(i.line,1),"+transpose")}r.push(new de(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){Ot(e,function(){for(var t=e.listSelections().length,r=0;r<t;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)})},openLine:function(e){e.replaceSelection("\n","start")},toggleOverwrite:function(e){e.toggleOverwrite()}},ha=e.keyMap={};ha.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"},ha.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"},ha.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},ha.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"]},ha["default"]=No?ha.macDefault:ha.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=Pi(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 fa=e.lookupKey=function(e,t,r,n){t=Vr(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 fa(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var a=fa(e,t.fallthrough[o],r,n);if(a)return a}}},pa=e.isModifierKey=function(e){var t="string"==typeof e?e:al[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},ga=e.keyName=function(e,t){if(To&&34==e.keyCode&&e["char"])return!1;var r=al[e.keyCode],n=r;return null!=n&&!e.altGraphKey&&(e.altKey&&"Alt"!=r&&(n="Alt-"+n),(Po?e.metaKey:e.ctrlKey)&&"Ctrl"!=r&&(n="Ctrl-"+n),(Po?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&&(Na(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&&(Ea(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 ma=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};ma.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(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));if(r)return++this.pos,t},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);if(t>-1)return this.pos=t,!0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Ra(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Ra(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Ra(this.string,null,this.tabSize)-(this.lineStart?Ra(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);if(i(o)==i(e))return t!==!1&&(this.pos+=e.length),!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 va=0,ya=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++va};Oi(ya),ya.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&xt(e),Ai(this,"clear")){var r=this.find();r&&Ti(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=en(a.markedSpans,this);e&&!this.collapsed?It(e,ri(a),"text"):e&&(null!=l.to&&(i=ri(a)),null!=l.from&&(n=ri(a))),a.markedSpans=tn(a.markedSpans,l),null==l.from&&this.collapsed&&!Cn(this.doc,a)&&e&&ti(a,bt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var s=bn(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&&Dt(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&&Ti(e,"markerCleared",e,this),t&&Ct(e),this.parent&&this.parent.clear()}},ya.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=en(o.markedSpans,this);if(null!=a.from&&(r=Fo(t?o:ri(o),a.from),e==-1))return r;if(null!=a.to&&(n=Fo(t?o:ri(o),a.to),1==e))return n}return r&&{from:r,to:n}},ya.prototype.changed=function(){var e=this.find(-1,!0),t=this,r=this.doc.cm;e&&r&&Ot(r,function(){var n=e.line,i=ri(e.line),o=Je(r,i);if(o&&(at(o),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Cn(t.doc,n)&&null!=t.height){var a=t.height;t.height=null;var l=Ln(t)-a;l&&ti(n,n.height+l)}})},ya.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&zi(t.maybeHiddenMarkers,this)!=-1||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ya.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 va=0,ba=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};Oi(ba),ba.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Ti(this,"clear")}},ba.prototype.find=function(e,t){return this.primary.find(e,t)};var wa=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};Oi(wa),wa.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=ri(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=Ln(this);ti(r,Math.max(0,r.height-o)),e&&Ot(e,function(){Tn(e,r,-o),It(e,n,"widget")})}},wa.prototype.changed=function(){var e=this.height,t=this.doc.cm,r=this.line;this.height=null;var n=Ln(this)-e;n&&(ti(r,r.height+n),t&&Ot(t,function(){t.curOp.forceUpdate=!0,Tn(t,r,n)}))};var xa=e.Line=function(e,t,r){this.text=e,dn(this,t),this.height=r?r(this):1};Oi(xa),xa.prototype.lineNo=function(){return ri(this)};var ka={},Ca={};$n.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var i=this.lines[r];this.height-=i.height,An(i),Ti(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}},Yn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(e<i){var o=Math.min(t,i-e),a=n.height;if(n.removeInner(e,o),this.height-=a-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof $n))){var l=[];this.collapse(l),this.children=[new $n(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(var a=i.lines.length%25+25,l=a;l<i.lines.length;){var s=new $n(i.lines.slice(l,l+=25));i.height-=s.height,this.children.splice(++n,0,s),s.parent=this}i.lines=i.lines.slice(0,a),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Yn(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 Yn(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(e<o){var a=Math.min(t,o-e);if(i.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var Sa=0,Ta=e.Doc=function(e,t,r,n){if(!(this instanceof Ta))return new Ta(e,t,r,n);null==r&&(r=0),Yn.call(this,[new $n([new xa("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var i=Fo(r,0);this.sel=fe(i),this.history=new ai(null),this.id=++Sa,this.modeOption=t,this.lineSep=n,this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Vn(this,{from:i,to:i,text:e}),Le(this,fe(i),Ha)};Ta.prototype=Ii(Yn.prototype,{constructor:Ta,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=ei(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Et(function(e){var t=Fo(this.first,0),r=this.first+this.size-1;Lr(this,{from:t,to:Fo(r,Qn(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,Wr(this,e,t,r,n)},getRange:function(e,t,r){var n=Jn(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){if(ve(this,e))return Qn(this,e)},getLineNumber:function(e){return ri(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Qn(this,e)),bn(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:Et(function(e,t,r){Ce(this,ge(this,"number"==typeof e?Fo(e,t||0):e),null,r)}),setSelection:Et(function(e,t,r){Ce(this,ge(this,e),ge(this,t||e),r)}),extendSelection:Et(function(e,t,r){we(this,ge(this,e),t&&ge(this,t),r)}),extendSelections:Et(function(e,t){xe(this,ye(this,e),t)}),extendSelectionsBy:Et(function(e,t){var r=Pi(this.sel.ranges,e);xe(this,ye(this,r),t)}),setSelections:Et(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:Et(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=Jn(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=Jn(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:Et(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&&Sr(this,n,t),o=n.length-1;o>=0;o--)Lr(this,n[o]);l?Te(this,l):this.cm&&Hr(this.cm)}),undo:Et(function(){_r(this,"undo")}),redo:Et(function(){_r(this,"redo")}),undoSelection:Et(function(){_r(this,"undo",!0)}),redoSelection:Et(function(){_r(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 ai(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:vi(this.history.done),undone:vi(this.history.undone)}},setHistory:function(e){var t=this.history=new ai(this.history.maxGeneration);t.done=vi(e.done.slice(0),null,!0),t.undone=vi(e.undone.slice(0),null,!0)},addLineClass:Et(function(e,t,r){return Rr(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(Vi(r).test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0})}),removeLineClass:Et(function(e,t,r){return Rr(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(Vi(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:Et(function(e,t,r){return Mn(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return $r(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),$r(this,e,e,r,"bookmark")},findMarksAt:function(e){e=ge(this,e);var t=[],r=Qn(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];null!=s.to&&i==e.line&&e.ch>=s.to||null==s.from&&i!=e.line||null!=s.from&&i==t.line&&s.from>=t.ch||r&&!r(s.marker)||n.push(s.marker.parent||s.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter(function(i){var o=i.text.length+n;return o>e?(t=e,!0):(e-=o,void++r)}),ge(this,Fo(r,t))},indexFromPos:function(e){e=ge(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+r}),t},copy:function(e){var t=new Ta(ei(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 Ta(ei(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}],Zr(n,Xr(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),Qr(Xr(this));break}}if(t.history==this.history){var i=[t.id];Xn(t,function(e){i.push(e.id)},!0),t.history=new ai(null),t.history.done=vi(this.history.done,i),t.history.undone=vi(this.history.undone,i)}},iterLinkedDocs:function(e){Xn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):rl(e)},lineSeparator:function(){return this.lineSep||"\n"}}),Ta.prototype.eachLine=Ta.prototype.iter;var La="iter insert remove copy getEditor constructor".split(" ");for(var Ma in Ta.prototype)Ta.prototype.hasOwnProperty(Ma)&&zi(La,Ma)<0&&(e.prototype[Ma]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ta.prototype[Ma]));Oi(Ta);var _a=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},Aa=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},Oa=e.e_stop=function(e){_a(e),Aa(e)},Na=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)}},Wa=[],Ea=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=Si(e,t,!1),i=0;i<n.length;++i)if(n[i]==r){n.splice(i,1);break}},za=e.signal=function(e,t){var r=Si(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)},Pa=null,Da=30,Ia=e.Pass={toString:function(){return"CodeMirror.Pass"}},Ha={scroll:!1},Fa={origin:"*mouse"},ja={origin:"+move"};Ni.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Ra=e.countColumn=function(e,t,r,n,i){null==t&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var o=n||0,a=i||0;;){var l=e.indexOf("\t",o);if(l<0||l>=t)return a+(t-o);a+=l-o,a+=r-a%r,o=l+1}},Ba=e.findColumn=function(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);o==-1&&(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}},qa=[""],Ka=function(e){e.select()};Ao?Ka=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:wo&&(Ka=function(e){try{e.select()}catch(t){}});var Ua,Ga=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Va=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Ga.test(e))},$a=/[\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]/;Ua=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 Ya=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)};wo&&xo<11&&(Gi=function(){try{return document.activeElement}catch(e){return document.body}});var Xa,Za,Qa=e.rmClass=function(e,t){var r=e.className,n=Vi(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:"")}},Ja=e.addClass=function(e,t){var r=e.className;Vi(t).test(r)||(e.className+=(r?" ":"")+t)},el=!1,tl=function(){if(wo&&xo<9)return!1;var e=qi("div");return"draggable"in e||"dragDrop"in e}(),rl=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);i==-1&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");a!=-1?(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/)},nl=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)},il=function(){var e=qi("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),ol=null,al=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;e<10;e++)al[e+48]=al[e+96]=String(e);for(var e=65;e<=90;e++)al[e]=String.fromCharCode(e);for(var e=1;e<=12;e++)al[e+111]=al[e+63235]="F"+e}();var ll,sl=function(){function e(e){return e<=247?r.charAt(e):1424<=e&&e<=1524?"R":1536<=e&&e<=1773?n.charAt(e-1536):1774<=e&&e<=2220?"r":8192<=e&&e<=8203?"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;h<u;++h)d.push(n=e(r.charCodeAt(h)));for(var h=0,f=c;h<u;++h){var n=d[h];"m"==n?d[h]=f:f=n}for(var h=0,p=c;h<u;++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];h<u-1;++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;h<u;++h){var n=d[h];if(","==n)d[h]="N";else if("%"==n){for(var g=h+1;g<u&&"%"==d[g];++g);for(var m=h&&"!"==d[h-1]||g<u&&"1"==d[g]?"1":"N",v=h;v<g;++v)d[v]=m;h=g-1}}for(var h=0,p=c;h<u;++h){var n=d[h];"L"==p&&"1"==n?d[h]="L":a.test(n)&&(p=n)}for(var h=0;h<u;++h)if(o.test(d[h])){for(var g=h+1;g<u&&o.test(d[g]);++g);for(var y="L"==(h?d[h-1]:c),b="L"==(g<u?d[g]:c),m=y||b?"L":"R",v=h;v<g;++v)d[v]=m;h=g-1}for(var w,x=[],h=0;h<u;)if(l.test(d[h])){var k=h;for(++h;h<u&&l.test(d[h]);++h);x.push(new t(0,k,h))}else{var C=h,S=x.length;for(++h;h<u&&"L"!=d[h];++h);for(var v=C;v<h;)if(s.test(d[v])){C<v&&x.splice(S,0,new t(1,C,v));var T=v;for(++v;v<h&&s.test(d[v]);++v);x.splice(S,0,new t(2,T,v)),C=v}else++v;C<h&&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==Ei(x).level&&(w=r.match(/\s+$/))&&(Ei(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!=Ei(x).level&&x.push(new t(x[0].level,u,u)),x}}();return e.version="5.17.0",e})},{}],18:[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),
7
- 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 O[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,O={};return O.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},O.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?O.top(e,t,r):(g="error","block")},O.maybeprop=function(e,t,r){return":"==e?s(r,t,"prop"):u(e,t,r)},O.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"},O.propBlock=function(e,t,r){return"}"==e?c(r):"word"==e?(g="property","maybeprop"):r.context.type},O.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")},O.pseudo=function(e,t,r){return"word"==e?(g="variable-3",r.context.type):u(e,t,r)},O.documentTypes=function(e,t,r){return"word"==e&&y.hasOwnProperty(t.current())?(g="tag",r.context.type):O.atBlock(e,t,r)},O.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},O.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)},O.atBlock_parens=function(e,t,r){return")"==e?c(r):"{"==e||"}"==e?d(e,t,r,2):O.atBlock(e,t,r)},O.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)},O.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"},O.keyframes=function(e,t,r){return"word"==e?(g="variable","keyframes"):"{"==e?s(r,t,"top"):u(e,t,r)},O.at=function(e,t,r){return";"==e?c(r):"{"==e||"}"==e?d(e,t,r):("word"==e?g="tag":"hash"==e&&(g="builtin"),"at")},O.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=O[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-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","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","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","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))}},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,"{"]},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return!!e.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes: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)&&(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))}},name:"css",helperType:"gss"})})},{"../../lib/codemirror":17}],19:[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 t=e.startState(c);return{token:s,inTag:null,localMode:null,localState:null,htmlState:t}},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":17,"../css/css":18,"../javascript/javascript":20,"../xml/xml":21}],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";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 be=e,we=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(_e),o("operator","operator",e.current()));if("`"==n)return r.tokenize=c,c(e,r);if("#"==n)return e.skipToEnd(),o("error","error");if(_e.test(n))return e.eatWhile(_e),o("operator","operator",e.current());if(Le.test(n)){e.eatWhile(Le);var a=e.current(),u=Me.propertyIsEnumerable(a)&&Me[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(Ce&&"@"==t.peek()&&t.match(Ae))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(!(r<0)){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&&l<3){if(!n){++o;break}if(0==--n)break}else if(l>=3&&l<6)++n;else if(Le.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(We.state=e,We.stream=i,We.marked=null,We.cc=o,We.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var a=o.length?o.pop():Se?C:k;if(a(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return We.marked?We.marked:"variable"==r&&h(e,n)?"variable-2":t}}}function p(){for(var e=arguments.length-1;e>=0;e--)We.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=We.state;if(We.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(){We.state.context={prev:We.state.context,vars:We.state.localVars},We.state.localVars=Ee}function y(){We.state.localVars=We.state.context.vars,We.state.context=We.state.context.prev}function b(e,t){var r=function(){var r=We.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,We.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function w(){var e=We.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),Y,x(";"),w):"keyword a"==e?g(b("form"),C,k,w):"keyword b"==e?g(b("form"),k,w):"{"==e?g(b("}"),K,w):";"==e?g():"if"==e?("else"==We.state.lexical.info&&We.state.cc[We.state.cc.length-1]==w&&We.state.cc.pop()(),g(b("form"),C,k,w,ee)):"function"==e?g(ae):"for"==e?g(b("form"),te,k,w):"variable"==e?g(b("stat"),I):"switch"==e?g(b("form"),C,b("}","switch"),x("{"),K,w,w):"case"==e?g(C,x(":")):"default"==e?g(x(":")):"catch"==e?g(b("form"),v,x("("),le,x(")"),k,w,y):"class"==e?g(b("form"),se,w):"export"==e?g(b("stat"),he,w):"import"==e?g(b("stat"),fe,w):"module"==e?g(b("form"),X,b("}"),x("{"),K,w,w):"async"==e?g(k):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(We.state.fatArrowAt==We.stream.start){var r=t?E:W;if("("==e)return g(v,b(")"),B(X,")"),w,x("=>"),r,y);if("variable"==e)return p(v,X,x("=>"),r,y)}var n=t?A:_;return Ne.hasOwnProperty(e)?g(n):"function"==e?g(ae,n):"keyword c"==e||"async"==e?g(t?M:L):"("==e?g(b(")"),L,x(")"),w,n):"operator"==e||"spread"==e?g(t?S:C):"["==e?g(b("]"),ve,w,n):"{"==e?q(F,"}",null,n):"quasi"==e?p(O,n):"new"==e?g(z(t)):g();
8
- }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?E:W,y):"operator"==e?/\+\+|--/.test(t)?g(n):"?"==t?g(C,x(":"),i):g(i):"quasi"==e?p(O,n):";"!=e?"("==e?q(S,")","call",n):"."==e?g(H,n):"["==e?g(b("]"),L,x("]"),w,n):void 0:void 0}function O(e,t){return"quasi"!=e?p():"${"!=t.slice(t.length-2)?g(O):g(C,N)}function N(e){if("}"==e)return We.marked="string-2",We.state.tokenize=c,g(O)}function W(e){return u(We.stream,We.state),p("{"==e?k:C)}function E(e){return u(We.stream,We.state),p("{"==e?k:S)}function z(e){return function(t){return"."==t?g(e?D:P):p(e?S:C)}}function P(e,t){if("target"==t)return We.marked="keyword",g(_)}function D(e,t){if("target"==t)return We.marked="keyword",g(A)}function I(e){return":"==e?g(w,k):p(_,x(";"),w)}function H(e){if("variable"==e)return We.marked="property",g()}function F(e,t){return"async"==e?g(F):"variable"==e||"keyword"==We.style?(We.marked="property",g("get"==t||"set"==t?j:R)):"number"==e||"string"==e?(We.marked=Ce?"property":We.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):(We.marked="property",g(ae))}function R(e){return":"==e?g(S):"("==e?p(ae):void 0}function B(e,t){function r(n,i){if(","==n){var o=We.state.lexical;return"call"==o.info&&(o.pos=(o.pos||0)+1),g(function(r,n){return r==t||n==t?p():p(e)},r)}return n==t||i==t?g():g(x(t))}return function(n,i){return n==t||i==t?g():p(e,r)}}function q(e,t,r){for(var n=3;n<arguments.length;n++)We.cc.push(arguments[n]);return g(b(t,r),B(e,t),w)}function K(e){return"}"==e?g():p(k,K)}function U(e){if(Te&&":"==e)return g(V)}function G(e,t){if("="==t)return g(S)}function V(e){if("variable"==e)return We.marked="variable-3",g($)}function $(e,t){return"<"==t?g(B(V,">"),$):"["==e?g(x("]"),$):void 0}function Y(){return p(X,U,Q,J)}function X(e,t){return"modifier"==e?g(X):"variable"==e?(m(t),g()):"spread"==e?g(X):"["==e?q(X,"]"):"{"==e?q(Z,"}"):void 0}function Z(e,t){return"variable"!=e||We.stream.match(/^\s*:/,!1)?("variable"==e&&(We.marked="property"),"spread"==e?g(X):"}"==e?p():g(x(":"),X,Q)):(m(t),g(Q))}function Q(e,t){if("="==t)return g(S)}function J(e){if(","==e)return g(Y)}function ee(e,t){if("keyword b"==e&&"else"==t)return g(b("form","else"),k,w)}function te(e){if("("==e)return g(b(")"),re,x(")"),w)}function re(e){return"var"==e?g(Y,x(";"),ie):";"==e?g(ie):"variable"==e?g(ne):p(C,x(";"),ie)}function ne(e,t){return"in"==t||"of"==t?(We.marked="keyword",g(C)):g(_,ie)}function ie(e,t){return";"==e?g(oe):"in"==t||"of"==t?(We.marked="keyword",g(C)):p(C,x(";"),oe)}function oe(e){")"!=e&&g(C)}function ae(e,t){return"*"==t?(We.marked="keyword",g(ae)):"variable"==e?(m(t),g(ae)):"("==e?g(v,b(")"),B(le,")"),w,U,k,y):void 0}function le(e){return"spread"==e?g(le):p(X,U,G)}function se(e,t){if("variable"==e)return m(t),g(ce)}function ce(e,t){return"extends"==t?g(C,ce):"{"==e?g(b("}"),ue,w):void 0}function ue(e,t){return"variable"==e||"keyword"==We.style?"static"==t?(We.marked="keyword",g(ue)):(We.marked="property","get"==t||"set"==t?g(de,ae,ue):g(ae,ue)):"*"==t?(We.marked="keyword",g(ue)):";"==e?g(ue):"}"==e?g():void 0}function de(e){return"variable"!=e?p():(We.marked="property",g())}function he(e,t){return"*"==t?(We.marked="keyword",g(me,x(";"))):"default"==t?(We.marked="keyword",g(C,x(";"))):p(k)}function fe(e){return"string"==e?g():p(pe,me)}function pe(e,t){return"{"==e?q(pe,"}"):("variable"==e&&m(t),"*"==t&&(We.marked="keyword"),g(ge))}function ge(e,t){if("as"==t)return We.marked="keyword",g(pe)}function me(e,t){if("from"==t)return We.marked="keyword",g(C)}function ve(e){return"]"==e?g():p(S,B(S,"]"))}function ye(e,t){return"operator"==e.lastType||","==e.lastType||_e.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}var be,we,xe=r.indentUnit,ke=n.statementIndent,Ce=n.jsonld,Se=n.json||Ce,Te=n.typescript,Le=n.wordCharacters||/[\w$\xa1-\uffff]/,Me=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,await:n,async:e("async")};if(Te){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}(),_e=/[+\-*&%=<>!?|~^]/,Ae=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Oe="([{}])",Ne={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},We={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)-xe,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"==be?r:(t.lastType="operator"!=be||"++"!=we&&"--"!=we?be:"incdec",f(t,r,be,we,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!=ee)break}"stat"==o.type&&"}"==i&&(o=o.prev),ke&&")"==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+xe:"stat"==u?o.indented+(ye(t,r)?ke||xe:0):"switch"!=o.info||d||0==n.doubleIndentSwitch?o.align?o.column+(d?0:1):o.indented+(d?0:xe):o.indented+(/^(?:case|default)\b/.test(r)?xe:2*xe)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Se?null:"/*",blockCommentEnd:Se?null:"*/",lineComment:Se?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Se?"json":"javascript",jsonldMode:Ce,jsonMode:Se,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":17}],21:[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":17}]},{},[11])}();
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," ","hidden"===r.type()?"":e("small",{style:"float: right; font-weight: normal;"},t.optional)]),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("small",{style:"float: right; font-weight: normal;"},t.optional)]),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){var n=[e("option",{value:"select",selected:"select"===r.type()&&"selected"},t.dropdown),e("option",{value:"radio",selected:"radio"===r.type()&&"selected"},t.radioButtons)];return r.acceptsMultipleValues&&n.push(e("option",{value:"checkbox",selected:"checkbox"===r.type()&&"selected"},t.checkboxes)),e("div",[e("label",t.choiceType),e("select",{value:r.type(),onchange:e.withAttr("value",r.type)},n)])},r.choices=function(r){var n=[];return n.push(e("div",[e("label",t.choices),e("div.limit-height",[e("table",[r.choices().map(function(n,i){return e("tr",{"data-id":i},[e("td.cb",e("input",{name:"selected",type:"checkbox"===r.type()?"checkbox":"radio",onchange:e.withAttr("value",r.selectChoice.bind(r)),checked:n.selected(),value:n.value(),title:t.preselect})),e("td.stretch",e("input.widefat",{type:"text",value:n.label(),placeholder:n.title(),onchange:e.withAttr("value",n.label)})),e("td",e("span",{title:t.remove,"class":"dashicons dashicons-no-alt hover-activated",onclick:function(e){this.choices().splice(e,1)}.bind(r,i)},""))])})])])])),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){var t=[i.label(e),i.choiceType(e),i.choices(e)];return"select"===e.type()&&t.push(i.placeholder(e)),t.push(i.useParagraphs(e)),"select"!==e.type()&&"radio"!==e.type()||t.push(i.isRequired(e)),t},n.hidden=function(e){return e.placeholder(""),e.label(""),e.wrap(!1),[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){"use strict";var n=e("../third-party/render.js"),i=e("../third-party/beautify-html.js"),o=function(e){function t(t){var o,a,l,s;return o=t.label().length?e("label",t.label()):"",a="function"==typeof r[t.type()]?r[t.type()](t):r["default"](t),l=t.wrap()?e("p",[o,a]):[o,a],s=n(l),s=i(s),s+"\n"}var r={};return r.select=function(t){var r={name:t.name(),required:t.required()},n=!1,i=t.choices().map(function(t){return t.selected()&&(n=!0),e("option",{value:t.value()!==t.label()?t.value():void 0,selected:t.selected()},t.label())}),o=t.placeholder();return o.length>0&&i.unshift(e("option",{disabled:!0,value:"",selected:!n},o)),e("select",r,i)},r.checkbox=function(t){var r=t.choices().map(function(r){var n=t.name()+("checkbox"===t.type()?"[]":""),i=t.required()&&"radio"===t.type();return e("label",[e("input",{name:n,type:t.type(),value:r.value(),checked:r.selected(),required:i})," ",e("span",r.label())])});return r},r.radio=r.checkbox,r["default"]=function(t){var r,n={type:t.type()};return t.name()&&(n.name=t.name()),t.min()&&(n.min=t.min()),t.max()&&(n.max=t.max()),t.value().length>0&&(n.value=t.value()),t.placeholder().length>0&&(n.placeholder=t.placeholder()),n.required=t.required(),r=e("input",n)},t};t.exports=o},{"../third-party/beautify-html.js":12,"../third-party/render.js":13}],4:[function(e,t,r){var n=function(t,r,n,i,o){"use strict";function a(e){u=i.get(e),u&&u.choices().length>0&&u.value(u.choices().map(function(e){return e.label()}).join("|")),t.redraw()}function l(){}function s(){var e=d(u);n.insert(e),a(""),t.redraw()}function c(){var e=i.getCategories(),r=i.getAll(),n=t("div.available-fields.small-margin",[t("h4",o.chooseField),e.map(function(e){var n=r.filter(function(t){return t.category===e});if(n.length)return t("div.tiny-margin",[t("strong",e),n.map(function(e){var r="button";e.forceRequired()&&(r+=" is-required");var n=e.inFormContent();return null!==n&&(r+=" "+(n?"in-form":"not-in-form")),t("button",{className:r,type:"button",onclick:t.withAttr("value",a),value:e.index},e.title())})])})]),l=null;return u&&(l=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)),[n,l]}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":10}],5:[function(e,t,r){var n=function(e,t){"use strict";function r(){u.forEach(e.deregister)}function n(t,r,n){var i=e.register(t,r);n||u.push(i)}function i(e){var t={phone:"tel",dropdown:"select",checkboxes:"checkbox",birthday:"text"};return"undefined"!=typeof t[e]?t[e]:e}function o(e){var r=t.listFields,o=i(e.field_type),a={name:e.tag,title:e.name,required:e.required,forceRequired:e.required,type:o,choices:e.choices,acceptsMultipleValues:!1};return"address"!==a.type?n(r,a,!1):(n(r,{name:a.name+"[addr1]",type:"text",title:t.streetAddress}),n(r,{name:a.name+"[city]",type:"text",title:t.city}),n(r,{name:a.name+"[state]",type:"text",title:t.state}),n(r,{name:a.name+"[zip]",type:"text",title:t.zip}),n(r,{name:a.name+"[country]",type:"select",title:t.country,choices:mc4wp_vars.countries})),!0}function a(e){var r=t.interestCategories,o=i(e.field_type),a={title:e.name,name:"INTERESTS["+e.id+"]",type:o,choices:e.interests,acceptsMultipleValues:"checkbox"===o};n(r,a,!1)}function l(e){e.merge_fields=e.merge_fields.sort(function(e,t){return"EMAIL"===e.tag||e["public"]&&!t["public"]?-1:!e["public"]&&t["public"]?1:0}),e.merge_fields.forEach(o),e.interest_categories.forEach(a)}function s(e){r(),e.forEach(l)}function c(e){var r,i=t.formFields;n(i,{name:"",value:t.subscribe,type:"submit",title:t.submitButton},!0),r={};for(var o in e)r[e[o].id]=e[o].name;n(i,{name:"_mc4wp_lists",type:"checkbox",title:t.listChoice,choices:r,help:t.listChoiceDescription,acceptsMultipleValues:!0},!0),r={subscribe:"Subscribe",unsubscribe:"Unsubscribe"},n(i,{name:"_mc4wp_action",type:"radio",title:t.formAction,choices:r,value:"subscribe",help:t.formActionDescription},!0)}var u=[];return{registerCustomFields:c,registerListFields:l,registerListsFields:s}};t.exports=n},{}],6:[function(e,t,r){"use strict";t.exports=function(e,t){function r(e){var t=[];return t="function"==typeof e.map?e.map(function(e){return new f({label:e})}):Object.keys(e).map(function(t){var r=e[t];return new f({label:r,value:t})})}function n(n,i){var o,a=s("name",i.name).shift();return a?void(!a.required()&&i.required&&a.required(!0)):(i.choices&&(i.choices=r(i.choices),i.value&&(i.choices=i.choices.map(function(e){return e.value()===i.value&&e.selected(!0),e}))),d.indexOf(n)<0&&d.push(n),o=new h(i),o.category=n,u.push(o),c&&window.clearTimeout(c),c=window.setTimeout(e.redraw,100),t.trigger("fields.change"),o)}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=u.map(function(e,t){return e.index=t,e})}function l(){return d}function s(e,t){return u.filter(function(r){return r[e]()===t})}var c,u=[],d=[],h=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.acceptsMultipleValues=t.acceptsMultipleValues,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}))}},f=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)};return{get:o,getAll:a,getCategories:l,deregister:i,register:n,getAllWhere:s}}},{}],7:[function(e,t,r){"use strict";var n=e("codemirror");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");var i=function(e){function t(){return o&&(i.innerHTML=a.getValue().toLowerCase(),o=!1),i}var r,i=document.createElement("form"),o=!1,a={};return i.innerHTML=e.value.toLowerCase(),n&&(r=n.fromTextArea(e,{selectionPointer:!0,matchTags:{bothTags:!0},mode:"htmlmixed",htmlMode:!0,autoCloseTags:!0,autoRefresh:!0}),window.dispatchEvent&&r.on("change",function(){if("function"==typeof Event){var t=new Event("change",{bubbles:!0});e.dispatchEvent(t)}})),window.addEventListener("load",function(){n.signal(r,"change")}),e.addEventListener("change",function(){o=!0}),a.getValue=function(){return r?r.getValue():e.value},a.query=function(e){return t().querySelectorAll(e)},a.containsField=function(e){return null!==t().elements.namedItem(e.toLowerCase())},a.insert=function(t){r?(r.replaceSelection(t),r.focus()):e.value+=t},a.on=function(t,n){return r?(t="input"===t?"changes":t,r.on(t,n)):e.addEventListener(t,n)},a.refresh=function(){r&&r.refresh()},a};t.exports=i},{codemirror:17,"codemirror/addon/edit/closetag.js":14,"codemirror/addon/edit/matchtags":15,"codemirror/addon/fold/xml-fold":16,"codemirror/mode/css/css":18,"codemirror/mode/htmlmixed/htmlmixed":19,"codemirror/mode/javascript/javascript":20,"codemirror/mode/xml/xml":21}],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=e.name();"checkbox"===e.type()&&(r+="[]");var n=t.containsField(r);e.inFormContent(n)}}),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]&&(r=r.replace(/\[(\w+)\]/g,".$1"),e.indexOf(r)===-1&&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){"use strict";function n(e){var t=l.indexOf(e);t<0&&(l.push(e),o())}function i(e){var t=l.indexOf(e);t>-1&&(l.splice(t,1),o())}function o(){for(var e="",t=0;t<l.length;t++)e+='<div class="notice notice-warning"><p>'+l[t]+"</p></div>";var r=document.querySelector(".mc4wp-notices");if(!r){r=document.createElement("div"),r.className="mc4wp-notices";var n=document.querySelector("h1");n.parentNode.insertBefore(r,n.nextSibling)}r.innerHTML=e}function a(e){e.on("change",function(){var t="Your form contains old style <code>GROUPINGS</code> fields. <br /><br />Please remove these fields from your form and then re-add them through the available field buttons to make sure your data is getting through to MailChimp correctly.",r=e.getValue().toLowerCase();r.indexOf('name="groupings')>-1?n(t):i(t)})}var l=[];t.exports={init:a}},{}],10:[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},{}],11:[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)),v=e("./admin/notices");i.mount(document.getElementById("mc4wp-field-wizard"),m);var y=new h(f,n);o.on("selectedLists.change",y.registerListsFields),y.registerListsFields(a.getSelectedLists()),y.registerCustomFields(mc4wp_vars.mailchimp.lists),window.setTimeout(function(){i.redraw()},2e3),v.init(g),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,"./admin/notices":9}],12:[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\t ".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;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=h.indexOf(" ")!==-1?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]||t.indexOf(r)===-1);)!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&&t.toLowerCase().indexOf(e)!==-1)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(n.toLowerCase().indexOf(e,i)===-1);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,e<1?"":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)}()},{}],13:[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.rep