Version Description
Download this release
Release Info
Developer | DvanKooten |
Plugin | MailChimp for WordPress |
Version | 4.6.0 |
Comparing to | |
See all releases |
Code changes from version 4.5.5 to 4.6.0
- CHANGELOG.md +13 -0
- assets/css/admin-styles.min.css +1 -1
- assets/css/checkbox-reset.min.css +1 -1
- assets/css/form-basic.min.css +1 -1
- assets/css/form-editor.min.css +1 -1
- assets/css/form-themes.min.css +1 -1
- assets/js/admin.js +2013 -1630
- assets/js/admin.min.js +1 -1
- assets/js/admin.min.js.map +1 -1
- assets/js/forms-admin.js +3522 -1192
- assets/js/forms-admin.min.js +0 -1
CHANGELOG.md
CHANGED
@@ -1,6 +1,19 @@
|
|
1 |
Changelog
|
2 |
=========
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
#### 4.5.5 - Sep 12, 2019
|
5 |
|
6 |
**Fixes**
|
1 |
Changelog
|
2 |
=========
|
3 |
|
4 |
+
#### 4.6.0 - Oct 7, 2019
|
5 |
+
|
6 |
+
**Improvements**
|
7 |
+
|
8 |
+
- Improved fetch and cache mechanism for retrieving Mailchimp account details, fetching data only when it is required.
|
9 |
+
- Updated [Mithril](https://mithril.js.org/) and [CodeMirror](https://codemirror.net/) dependencies.
|
10 |
+
- Decreased size of `forms-api.js` from 22KB to 9KB.
|
11 |
+
- No longer requiring jQuery anywhere.
|
12 |
+
- Increase API HTTP request timeout to 15 seconds.
|
13 |
+
|
14 |
+
Please note that installing this update requires you to also update any add-ons like [Mailchimp Top Bar](https://wordpress.org/plugins/mailchimp-top-bar/) and [Mailchimp for WordPress Premium](https://mc4wp.com/premium-features/) (if installed).
|
15 |
+
|
16 |
+
|
17 |
#### 4.5.5 - Sep 12, 2019
|
18 |
|
19 |
**Fixes**
|
assets/css/admin-styles.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#mc4wp-admin .cm-em,#mc4wp-admin .help,.mc4wp-admin .cm-em,.mc4wp-admin .help{font-style:italic}#mc4wp-admin .mc4wp-row,#mc4wp-admin .row,.mc4wp-admin .mc4wp-row,.mc4wp-admin .row{margin-left:-20px;margin-right:-20px;float:none}#mc4wp-admin .mc4wp-row .mc4wp-col,#mc4wp-admin .row .col,.mc4wp-admin .mc4wp-row .mc4wp-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 .mc4wp-row .mc4wp-col-1,#mc4wp-admin .row .col-1,.mc4wp-admin .mc4wp-row .mc4wp-col-1,.mc4wp-admin .row .col-1{width:16.666%}#mc4wp-admin .mc4wp-row .mc4wp-col-2,#mc4wp-admin .row .col-2,.mc4wp-admin .mc4wp-row .mc4wp-col-2,.mc4wp-admin .row .col-2{width:33.333%}#mc4wp-admin .mc4wp-row .mc4wp-col-3,#mc4wp-admin .row .col-3,.mc4wp-admin .mc4wp-row .mc4wp-col-3,.mc4wp-admin .row .col-3{width:50%}#mc4wp-admin .mc4wp-row .mc4wp-col-4,#mc4wp-admin .row .col-4,.mc4wp-admin .mc4wp-row .mc4wp-col-4,.mc4wp-admin .row .col-4{width:66.666%}#mc4wp-admin .mc4wp-row .mc4wp-col-5,#mc4wp-admin .row .col-5,.mc4wp-admin .mc4wp-row .mc4wp-col-5,.mc4wp-admin .row .col-5{width:83.333%}#mc4wp-admin .mc4wp-row .mc4wp-col-6,#mc4wp-admin .row .col-6,.mc4wp-admin .mc4wp-row .mc4wp-col-6,.mc4wp-admin .row .col-6{width:100%}#mc4wp-admin .clearfix:after,#mc4wp-admin .clearfix:before,#mc4wp-admin .mc4wp-row:after,#mc4wp-admin .mc4wp-row:before,#mc4wp-admin .row:after,#mc4wp-admin .row:before,.mc4wp-admin .clearfix:after,.mc4wp-admin .clearfix:before,.mc4wp-admin .mc4wp-row:after,.mc4wp-admin .mc4wp-row:before,.mc4wp-admin .row:after,.mc4wp-admin .row:before{content:" ";display:table}#mc4wp-admin .clearfix:after,#mc4wp-admin .mc4wp-row:after,#mc4wp-admin .row:after,.mc4wp-admin .clearfix:after,.mc4wp-admin .mc4wp-row:after,.mc4wp-admin .row:after{clear:both}@media (max-width:1200px){#mc4wp-admin .mc4wp-row .mc4wp-col,#mc4wp-admin .row .col,.mc4wp-admin .mc4wp-row .mc4wp-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,.mc4wp-admin .hover-activated{opacity:.5}#mc4wp-admin .hover-activated:hover,.mc4wp-admin .hover-activated:hover{cursor:pointer;opacity:1}#mc4wp-admin .help-text,.mc4wp-admin .help-text{font-size:14px}#mc4wp-admin .help-text p,.mc4wp-admin .help-text p{margin:10px 0;font-size:14px}#mc4wp-admin .help-text ul,.mc4wp-admin .help-text ul{list-style:square;margin-top:15px;padding-left:40px}#mc4wp-admin .muted,.mc4wp-admin .muted{color:#aaa}#mc4wp-admin .red,.mc4wp-admin .red{color:red}#mc4wp-admin .green,.mc4wp-admin .green{color:#32cd32}#mc4wp-admin .mc4wp-notice,.mc4wp-admin .mc4wp-notice{padding:6px 12px;color:#31708f;background:#d9edf7;border:1px solid #bce8f1;margin:1em 0!important}#mc4wp-admin .mc4wp-is-dismissible,.mc4wp-admin .mc4wp-is-dismissible{padding-right:38px;position:relative}#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;direction:ltr}#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!important;background:#7e7}#mc4wp-admin .cm-fat-cursor div.CodeMirror-cursors,.mc4wp-admin .cm-fat-cursor div.CodeMirror-cursors{z-index:1}#mc4wp-admin .cm-fat-cursor-mark,.mc4wp-admin .cm-fat-cursor-mark{background-color:rgba(20,255,20,.5);-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite}#mc4wp-admin .cm-animate-fat-cursor,.mc4wp-admin .cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite;background-color:#7e7}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}#mc4wp-admin .cm-tab,.mc4wp-admin .cm-tab{display:inline-block;text-decoration:inherit}#mc4wp-admin .CodeMirror-rulers,.mc4wp-admin .CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:-20px;overflow:hidden}#mc4wp-admin .CodeMirror-ruler,.mc4wp-admin .CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;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-type,#mc4wp-admin .cm-s-default .cm-variable-3,.mc4wp-admin .cm-s-default .cm-type,.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:#0b0}#mc4wp-admin div.CodeMirror span.CodeMirror-nonmatchingbracket,.mc4wp-admin div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}#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;min-height:100%;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}#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-gutter-wrapper ::selection,.mc4wp-admin .CodeMirror-gutter-wrapper ::selection{background-color:transparent}#mc4wp-admin .CodeMirror-gutter-wrapper ::-moz-selection,.mc4wp-admin .CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}#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;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}#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;padding:.1px}#mc4wp-admin .CodeMirror-rtl pre,.mc4wp-admin .CodeMirror-rtl pre{direction:rtl}#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;pointer-events:none}#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-focused .CodeMirror-selected{background:#d7d4f0}#mc4wp-admin .CodeMirror-crosshair,.mc4wp-admin .CodeMirror-crosshair{cursor:crosshair}#mc4wp-admin .CodeMirror-line::selection,#mc4wp-admin .CodeMirror-line>span::selection,#mc4wp-admin .CodeMirror-line>span>span::selection,.mc4wp-admin .CodeMirror-line::selection,.mc4wp-admin .CodeMirror-line>span::selection,.mc4wp-admin .CodeMirror-line>span>span::selection{background:#d7d4f0}#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-color:#ffa;background-color: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;min-height:500px;font-weight:400;padding:0 4px}#mc4wp-admin .CodeMirror-empty,.mc4wp-admin .CodeMirror-empty{color:#999}#mc4wp-admin #mc4wp-form-preview,.mc4wp-admin #mc4wp-form-preview{border:1px solid #ddd;height:500px;width:100%;border-left-width:0;border-right-width:2px}@media (min-width:1186px){#mc4wp-admin .mc4wp-form-editor-wrap,.mc4wp-admin .mc4wp-form-editor-wrap{padding-right:0!important}#mc4wp-admin .mc4wp-form-preview-wrap,.mc4wp-admin .mc4wp-form-preview-wrap{padding-left:0!important}}@media (max-width:1186px){#mc4wp-admin #mc4wp-form-preview,.mc4wp-admin #mc4wp-form-preview{border-left-width:1px}}#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 .cb-wrap,.mc4wp-admin .field-wizard .cb-wrap,.tlite{font-weight:400}#mc4wp-admin .field-wizard table,.mc4wp-admin .field-wizard table{table-layout:fixed;border-collapse:collapse;border-spacing:0}#mc4wp-admin .field-wizard td.stretch,.mc4wp-admin .field-wizard td.stretch{width:100%}#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 .available-fields .in-form,.mc4wp-admin .available-fields .in-form{opacity:.5}#mc4wp-admin .page-title,.mc4wp-admin .page-title{background:url(../img/icon-large.png) left center no-repeat;padding-left:42px;line-height:32px;margin-bottom:20px}#mc4wp-admin .page-title small,.mc4wp-admin .page-title small{font-size:12px;color:#777;display:inline-block;margin-left:10px}#mc4wp-admin .button .dashicons,#mc4wp-admin .button-secondary .dashicons,#mc4wp-admin .page-title-action .dashicons,.mc4wp-admin .button .dashicons,.mc4wp-admin .button-secondary .dashicons,.mc4wp-admin .page-title-action .dashicons{vertical-align:middle;line-height:16px;margin:0 4px 0 0}#mc4wp-admin .form-table td p,.mc4wp-admin .form-table td p{margin-top:1em}#mc4wp-admin .sidebar,.mc4wp-admin .sidebar{border-left:1px solid #ccc}#mc4wp-admin .sidebar h3,#mc4wp-admin .sidebar h4,.mc4wp-admin .sidebar h3,.mc4wp-admin .sidebar h4{font-size:16px;margin-bottom:0}#mc4wp-admin .sidebar>div,.mc4wp-admin .sidebar>div{border-bottom:1px solid #ccc;margin-bottom:20px;padding-bottom:20px}#mc4wp-admin .sidebar>div:last-of-type,.mc4wp-admin .sidebar>div:last-of-type{border-bottom:0}.mc4wp-log,.overlay{border:1px solid #ccc;overflow-y:scroll}.mc4wp-log{font-family:monaco,monospace,courier,'courier new','Bitstream Vera Sans Mono';font-size:13px;resize:vertical;line-height:140%;height:200px;padding:6px;background:#262626;color:#fff}.mc4wp-log .time{color:#b58900}.mc4wp-log .level{color:#35AECD}.mc4wp-log .debug-log-empty{color:#ccc;font-style:italic}.mc4wp-log .hidden{display:none}.mc4wp-log a{color:#ccc;text-decoration:underline}.overlay{position:fixed;left:0;top:0;z-index:99999;padding:20px;width:100%;max-width:480px;max-height:100%;background:#fefefe;-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}.rtl .mc4wp-is-dismissible{padding-left:38px;padding-right:initial;position:relative}.tlite{background:#111;color:#fff;font-family:sans-serif;font-size:.8rem;text-decoration:none;text-align:left;padding:.6em .75rem;border-radius:4px;position:absolute;opacity:0;visibility:hidden;transition:opacity .4s;white-space:nowrap;box-shadow:0 .5rem 1rem -.5rem #000;z-index:1000;-webkit-backface-visibility:hidden}.tlite-table td,.tlite-table th{position:relative}.tlite-visible{visibility:visible;opacity:.9}.tlite::before{content:' ';display:block;background:inherit;width:10px;height:10px;position:absolute;transform:rotate(45deg)}.tlite-n::before{top:-3px;left:50%;margin-left:-5px}.tlite-nw::before{top:-3px;left:10px}.tlite-ne::before{top:-3px;right:10px}.tlite-s::before{bottom:-3px;left:50%;margin-left:-5px}.tlite-se::before{bottom:-3px;right:10px}.tlite-sw::before{bottom:-3px;left:10px}.tlite-w::before{left:-3px;top:50%;margin-top:-5px}.tlite-e::before{right:-3px;top:50%;margin-top:-5px}
|
1 |
+
#mc4wp-admin .mc4wp-row,#mc4wp-admin .row,.mc4wp-admin .mc4wp-row,.mc4wp-admin .row{margin-left:-20px;margin-right:-20px;float:none}#mc4wp-admin .mc4wp-row .mc4wp-col,#mc4wp-admin .row .col,.mc4wp-admin .mc4wp-row .mc4wp-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 .mc4wp-row .mc4wp-col-1,#mc4wp-admin .row .col-1,.mc4wp-admin .mc4wp-row .mc4wp-col-1,.mc4wp-admin .row .col-1{width:16.666%}#mc4wp-admin .mc4wp-row .mc4wp-col-2,#mc4wp-admin .row .col-2,.mc4wp-admin .mc4wp-row .mc4wp-col-2,.mc4wp-admin .row .col-2{width:33.333%}#mc4wp-admin .mc4wp-row .mc4wp-col-3,#mc4wp-admin .row .col-3,.mc4wp-admin .mc4wp-row .mc4wp-col-3,.mc4wp-admin .row .col-3{width:50%}#mc4wp-admin .mc4wp-row .mc4wp-col-4,#mc4wp-admin .row .col-4,.mc4wp-admin .mc4wp-row .mc4wp-col-4,.mc4wp-admin .row .col-4{width:66.666%}#mc4wp-admin .mc4wp-row .mc4wp-col-5,#mc4wp-admin .row .col-5,.mc4wp-admin .mc4wp-row .mc4wp-col-5,.mc4wp-admin .row .col-5{width:83.333%}#mc4wp-admin .mc4wp-row .mc4wp-col-6,#mc4wp-admin .row .col-6,.mc4wp-admin .mc4wp-row .mc4wp-col-6,.mc4wp-admin .row .col-6{width:100%}#mc4wp-admin .clearfix:after,#mc4wp-admin .clearfix:before,#mc4wp-admin .mc4wp-row:after,#mc4wp-admin .mc4wp-row:before,#mc4wp-admin .row:after,#mc4wp-admin .row:before,.mc4wp-admin .clearfix:after,.mc4wp-admin .clearfix:before,.mc4wp-admin .mc4wp-row:after,.mc4wp-admin .mc4wp-row:before,.mc4wp-admin .row:after,.mc4wp-admin .row:before{content:" ";display:table}#mc4wp-admin .clearfix:after,#mc4wp-admin .mc4wp-row:after,#mc4wp-admin .row:after,.mc4wp-admin .clearfix:after,.mc4wp-admin .mc4wp-row:after,.mc4wp-admin .row:after{clear:both}@media (max-width:1200px){#mc4wp-admin .mc4wp-row .mc4wp-col,#mc4wp-admin .row .col,.mc4wp-admin .mc4wp-row .mc4wp-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 .green,.mc4wp-admin .green{color:green}#mc4wp-admin .red,.mc4wp-admin .red{color:red}#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,.mc4wp-admin .hover-activated{opacity:.5}#mc4wp-admin .hover-activated:hover,.mc4wp-admin .hover-activated:hover{cursor:pointer;opacity:1}#mc4wp-admin .help-text,.mc4wp-admin .help-text{font-size:14px}#mc4wp-admin .help-text p,.mc4wp-admin .help-text p{margin:10px 0;font-size:14px}#mc4wp-admin .help-text ul,.mc4wp-admin .help-text ul{list-style:square;margin-top:15px;padding-left:40px}#mc4wp-admin .help,.mc4wp-admin .help{font-style:italic}#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 .mc4wp-is-dismissible,.mc4wp-admin .mc4wp-is-dismissible{padding-right:38px;position:relative}#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;direction:ltr}#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!important;background:#7e7}#mc4wp-admin .cm-fat-cursor div.CodeMirror-cursors,.mc4wp-admin .cm-fat-cursor div.CodeMirror-cursors{z-index:1}#mc4wp-admin .cm-fat-cursor-mark,.mc4wp-admin .cm-fat-cursor-mark{background-color:rgba(20,255,20,.5);-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite}#mc4wp-admin .cm-animate-fat-cursor,.mc4wp-admin .cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite;background-color:#7e7}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}#mc4wp-admin .cm-tab,.mc4wp-admin .cm-tab{display:inline-block;text-decoration:inherit}#mc4wp-admin .CodeMirror-rulers,.mc4wp-admin .CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:-20px;overflow:hidden}#mc4wp-admin .CodeMirror-ruler,.mc4wp-admin .CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;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-em,.mc4wp-admin .cm-em{font-style:italic}#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-type,#mc4wp-admin .cm-s-default .cm-variable-3,.mc4wp-admin .cm-s-default .cm-type,.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-meta{color:#555}#mc4wp-admin .cm-s-default .cm-qualifier,.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-s-default .cm-error,.mc4wp-admin .cm-s-default .cm-error{color:red}#mc4wp-admin .cm-invalidchar,.mc4wp-admin .cm-invalidchar{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:#0b0}#mc4wp-admin div.CodeMirror span.CodeMirror-nonmatchingbracket,.mc4wp-admin div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}#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;min-height:100%;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 .CodeMirror-gutter-wrapper,.mc4wp-admin .CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important}#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-gutter-wrapper ::selection,.mc4wp-admin .CodeMirror-gutter-wrapper ::selection{background-color:transparent}#mc4wp-admin .CodeMirror-gutter-wrapper ::-moz-selection,.mc4wp-admin .CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}#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;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}#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;padding:.1px}#mc4wp-admin .CodeMirror-rtl pre,.mc4wp-admin .CodeMirror-rtl pre{direction:rtl}#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;pointer-events:none}#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 div.CodeMirror-dragcursors,.mc4wp-admin div.CodeMirror-dragcursors{visibility:visible}#mc4wp-admin .CodeMirror-focused div.CodeMirror-cursors,.mc4wp-admin .CodeMirror-focused div.CodeMirror-cursors{visibility:visible}#mc4wp-admin .CodeMirror-selected,.mc4wp-admin .CodeMirror-selected{background:#d9d9d9}#mc4wp-admin .CodeMirror-focused .CodeMirror-selected,.mc4wp-admin .CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}#mc4wp-admin .CodeMirror-crosshair,.mc4wp-admin .CodeMirror-crosshair{cursor:crosshair}#mc4wp-admin .CodeMirror-line::selection,#mc4wp-admin .CodeMirror-line>span::selection,#mc4wp-admin .CodeMirror-line>span>span::selection,.mc4wp-admin .CodeMirror-line::selection,.mc4wp-admin .CodeMirror-line>span::selection,.mc4wp-admin .CodeMirror-line>span>span::selection{background:#d7d4f0}#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-color:#ffa;background-color: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;min-height:500px;font-weight:400;padding:0 4px}#mc4wp-admin .CodeMirror-empty,.mc4wp-admin .CodeMirror-empty{color:#999}#mc4wp-admin #mc4wp-form-preview,.mc4wp-admin #mc4wp-form-preview{border:1px solid #ddd;height:500px;width:100%;border-left-width:0;border-right-width:2px}@media (min-width:1186px){#mc4wp-admin .mc4wp-form-editor-wrap,.mc4wp-admin .mc4wp-form-editor-wrap{padding-right:0!important}#mc4wp-admin .mc4wp-form-preview-wrap,.mc4wp-admin .mc4wp-form-preview-wrap{padding-left:0!important}}@media (max-width:1186px){#mc4wp-admin #mc4wp-form-preview,.mc4wp-admin #mc4wp-form-preview{border-left-width:1px}}#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 td,#mc4wp-admin .field-wizard tr,.mc4wp-admin .field-wizard td,.mc4wp-admin .field-wizard tr{vertical-align:middle}#mc4wp-admin .field-wizard td.stretch,.mc4wp-admin .field-wizard td.stretch{width:100%}#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 .dashicons,.mc4wp-admin .field-wizard .dashicons{vertical-align:middle}#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 .available-fields .in-form,.mc4wp-admin .available-fields .in-form{opacity:.5}#mc4wp-admin .page-title,.mc4wp-admin .page-title{background:url(../img/icon-large.png) no-repeat left center;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}.mc4wp-log{font-family:monaco,monospace,courier,'courier new','Bitstream Vera Sans Mono';font-size:13px;resize:vertical;line-height:140%;height:200px;padding:6px;border:1px solid #ccc;background:#262626;color:#fff;overflow-y:scroll}.mc4wp-log .time{color:#b58900}.mc4wp-log .level{color:#35aecd}.mc4wp-log .debug-log-empty{color:#ccc;font-style:italic}.mc4wp-log .hidden{display:none}.mc4wp-log a{color:#ccc;text-decoration:underline}.overlay{position:fixed;left:0;top:0;z-index:99999;padding:20px;width:100%;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}.rtl .mc4wp-is-dismissible{padding-left:38px;padding-right:initial;position:relative}.tlite{background:#111;color:#fff;font-family:sans-serif;font-size:.8rem;font-weight:400;text-decoration:none;text-align:left;padding:.6em .75rem;border-radius:4px;position:absolute;opacity:0;visibility:hidden;transition:opacity .4s;white-space:nowrap;box-shadow:0 .5rem 1rem -.5rem #000;z-index:1000;-webkit-backface-visibility:hidden}.tlite-table td,.tlite-table th{position:relative}.tlite-visible{visibility:visible;opacity:.9}.tlite::before{content:' ';display:block;background:inherit;width:10px;height:10px;position:absolute;transform:rotate(45deg)}.tlite-n::before{top:-3px;left:50%;margin-left:-5px}.tlite-nw::before{top:-3px;left:10px}.tlite-ne::before{top:-3px;right:10px}.tlite-s::before{bottom:-3px;left:50%;margin-left:-5px}.tlite-se::before{bottom:-3px;right:10px}.tlite-sw::before{bottom:-3px;left:10px}.tlite-w::before{left:-3px;top:50%;margin-top:-5px}.tlite-e::before{right:-3px;top:50%;margin-top:-5px}
|
assets/css/checkbox-reset.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.mc4wp-checkbox-__INTEGRATION_SLUG__{clear:both;display:block;position:static;width:auto}.mc4wp-checkbox-__INTEGRATION_SLUG__ input{float:none;width:auto;position:static;margin:0 6px 0 0;padding:0;vertical-align:middle;display:inline-block!important;max-width:21px;-webkit-appearance:checkbox}.mc4wp-checkbox-__INTEGRATION_SLUG__ label{float:none;display:block;cursor:pointer;width:auto;position:static;margin:0 0 16px}
|
1 |
+
.mc4wp-checkbox-__INTEGRATION_SLUG__{clear:both;display:block;position:static;width:auto}.mc4wp-checkbox-__INTEGRATION_SLUG__ input{float:none;width:auto;position:static;margin:0 6px 0 0;padding:0;vertical-align:middle;display:inline-block!important;max-width:21px;-webkit-appearance:checkbox}.mc4wp-checkbox-__INTEGRATION_SLUG__ label{float:none;display:block;cursor:pointer;width:auto;position:static;margin:0 0 16px 0}
|
assets/css/form-basic.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.mc4wp-form input[name^="_mc4wp_honey"]{display:none!important}.mc4wp-form-basic,.mc4wp-form-theme{margin:1em 0}.mc4wp-form-basic,.mc4wp-form-basic input,.mc4wp-form-basic label,.mc4wp-form-theme,.mc4wp-form-theme input,.mc4wp-form-theme label{width:auto;display:block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;cursor:auto;height:auto;vertical-align:baseline;line-height:normal}.mc4wp-form-basic:after,.mc4wp-form-theme:after{content:"";display:table;clear:both}.mc4wp-form-basic label,.mc4wp-form-theme label{font-weight:700;margin-bottom:6px;display:block}.mc4wp-form-basic input.placeholdersjs,.mc4wp-form-theme input.placeholdersjs{color:#aaa!important}.mc4wp-form-basic input[type=
|
1 |
+
.mc4wp-form input[name^="_mc4wp_honey"]{display:none!important}.mc4wp-form-basic,.mc4wp-form-theme{margin:1em 0}.mc4wp-form-basic,.mc4wp-form-basic input,.mc4wp-form-basic label,.mc4wp-form-theme,.mc4wp-form-theme input,.mc4wp-form-theme label{width:auto;display:block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;cursor:auto;height:auto;vertical-align:baseline;line-height:normal}.mc4wp-form-basic:after,.mc4wp-form-theme:after{content:"";display:table;clear:both}.mc4wp-form-basic label,.mc4wp-form-theme label{font-weight:700;margin-bottom:6px;display:block}.mc4wp-form-basic input.placeholdersjs,.mc4wp-form-theme input.placeholdersjs{color:#aaa!important}.mc4wp-form-basic input[type=date],.mc4wp-form-basic input[type=email],.mc4wp-form-basic input[type=tel],.mc4wp-form-basic input[type=text],.mc4wp-form-basic input[type=url],.mc4wp-form-basic select,.mc4wp-form-basic textarea,.mc4wp-form-theme input[type=date],.mc4wp-form-theme input[type=email],.mc4wp-form-theme input[type=tel],.mc4wp-form-theme input[type=text],.mc4wp-form-theme input[type=url],.mc4wp-form-theme select,.mc4wp-form-theme textarea{min-height:32px;width:100%;max-width:480px}.mc4wp-form-basic input[type=number],.mc4wp-form-theme input[type=number]{min-width:40px}.mc4wp-form-basic input[type=checkbox],.mc4wp-form-basic input[type=radio],.mc4wp-form-theme input[type=checkbox],.mc4wp-form-theme input[type=radio]{position:relative;margin:0 6px 0 0;padding:0;height:13px;width:13px;display:inline-block;border:0}.mc4wp-form-basic input[type=checkbox],.mc4wp-form-theme input[type=checkbox]{-webkit-appearance:checkbox;-moz-appearance:checkbox;appearance:checkbox}.mc4wp-form-basic input[type=radio],.mc4wp-form-theme input[type=radio]{-webkit-appearance:radio;-moz-appearance:radio;appearance:radio}.mc4wp-form-basic button,.mc4wp-form-basic input[type=button],.mc4wp-form-basic input[type=submit],.mc4wp-form-theme button,.mc4wp-form-theme input[type=button],.mc4wp-form-theme input[type=submit]{cursor:pointer;display:inline-block;-webkit-appearance:none;-moz-appearance:none;appearance:none}.mc4wp-form-basic label>span,.mc4wp-form-basic li>label,.mc4wp-form-theme label>span,.mc4wp-form-theme li>label{font-weight:400}.mc4wp-form-basic .mc4wp-alert,.mc4wp-form-theme .mc4wp-alert{color:#c09853;clear:both}.mc4wp-form-basic .mc4wp-success,.mc4wp-form-theme .mc4wp-success{color:#468847}.mc4wp-form-basic .mc4wp-notice,.mc4wp-form-theme .mc4wp-notice{color:#3a87ad}.mc4wp-form-basic .mc4wp-error,.mc4wp-form-theme .mc4wp-error{color:#cd5c5c}.rtl .mc4wp-form-reset input[type=checkbox],.rtl .mc4wp-form-reset input[type=radio]{margin:0 0 0 6px}
|
assets/css/form-editor.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor-mark{background-color:rgba(20,255,20,.5);-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite}.cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite;background-color:#7e7}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:-20px;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-type,.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta
|
1 |
+
.CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor-mark{background-color:rgba(20,255,20,.5);-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite}.cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite;background-color:#7e7}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:-20px;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-type,.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default .cm-error{color:red}.cm-invalidchar{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative;border-right:30px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-30px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre{-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;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;padding:.1px}.CodeMirror-rtl pre{direction:rtl}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:0 0}.CodeMirror{border:1px solid #ccc;min-height:500px;font-weight:400;padding:0 4px}.CodeMirror-empty{color:#999}#mc4wp-form-preview{border:1px solid #ddd;height:500px;width:100%;border-left-width:0;border-right-width:2px}@media (min-width:1186px){.mc4wp-form-editor-wrap{padding-right:0!important}.mc4wp-form-preview-wrap{padding-left:0!important}}@media (max-width:1186px){#mc4wp-form-preview{border-left-width:1px}}.field-wizard h3{margin-top:0;padding-bottom:12px;border-bottom:1px solid #eee;margin-bottom:12px}.field-wizard code{margin-left:10px}.field-wizard>div{margin:24px 0}.field-wizard label{font-weight:600;display:block;margin-bottom:3px}.field-wizard table{table-layout:fixed;border-collapse:collapse;border-spacing:0}.field-wizard td,.field-wizard tr{vertical-align:middle}.field-wizard td.stretch{width:100%}.field-wizard .cb-wrap{font-weight:400}.field-wizard .cb-wrap input{margin-right:6px}.field-wizard .limit-height{border:1px solid #eee;padding:6px;max-height:200px;overflow-y:scroll}.field-wizard .dashicons{vertical-align:middle}.field-wizard .help{margin-top:0}.available-fields{border:1px solid #ccc;padding:20px;background:#fff}.available-fields h4{font-size:14px;margin-top:0}.available-fields strong{display:block;margin-bottom:6px}.available-fields button{margin:0 6px 6px 0}.available-fields .is-required:after{content:" *";color:red}.available-fields .is-required.not-in-form{-webkit-box-shadow:0 0 3px 1px red;-moz-box-shadow:0 0 3px 1px red;box-shadow:0 0 3px 1px red}.available-fields .in-form{opacity:.5}
|
assets/css/form-themes.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.mc4wp-form input[name^="_mc4wp_honey"]{display:none!important}.mc4wp-form-basic,.mc4wp-form-theme{margin:1em 0}.mc4wp-form-basic,.mc4wp-form-basic input,.mc4wp-form-basic label,.mc4wp-form-theme,.mc4wp-form-theme input,.mc4wp-form-theme label{width:auto;display:block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;cursor:auto;height:auto;vertical-align:baseline;line-height:normal}.mc4wp-form-basic:after,.mc4wp-form-theme:after{content:"";display:table;clear:both}.mc4wp-form-basic label,.mc4wp-form-theme label{font-weight:700;margin-bottom:6px;display:block}.mc4wp-form-basic input.placeholdersjs,.mc4wp-form-theme input.placeholdersjs{color:#aaa!important}.mc4wp-form-basic input[type=
|
1 |
+
.mc4wp-form input[name^="_mc4wp_honey"]{display:none!important}.mc4wp-form-basic,.mc4wp-form-theme{margin:1em 0}.mc4wp-form-basic,.mc4wp-form-basic input,.mc4wp-form-basic label,.mc4wp-form-theme,.mc4wp-form-theme input,.mc4wp-form-theme label{width:auto;display:block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;cursor:auto;height:auto;vertical-align:baseline;line-height:normal}.mc4wp-form-basic:after,.mc4wp-form-theme:after{content:"";display:table;clear:both}.mc4wp-form-basic label,.mc4wp-form-theme label{font-weight:700;margin-bottom:6px;display:block}.mc4wp-form-basic input.placeholdersjs,.mc4wp-form-theme input.placeholdersjs{color:#aaa!important}.mc4wp-form-basic input[type=date],.mc4wp-form-basic input[type=email],.mc4wp-form-basic input[type=tel],.mc4wp-form-basic input[type=text],.mc4wp-form-basic input[type=url],.mc4wp-form-basic select,.mc4wp-form-basic textarea,.mc4wp-form-theme input[type=date],.mc4wp-form-theme input[type=email],.mc4wp-form-theme input[type=tel],.mc4wp-form-theme input[type=text],.mc4wp-form-theme input[type=url],.mc4wp-form-theme select,.mc4wp-form-theme textarea{min-height:32px;width:100%;max-width:480px}.mc4wp-form-basic input[type=number],.mc4wp-form-theme input[type=number]{min-width:40px}.mc4wp-form-basic input[type=checkbox],.mc4wp-form-basic input[type=radio],.mc4wp-form-theme input[type=checkbox],.mc4wp-form-theme input[type=radio]{position:relative;margin:0 6px 0 0;padding:0;height:13px;width:13px;display:inline-block;border:0}.mc4wp-form-basic input[type=checkbox],.mc4wp-form-theme input[type=checkbox]{-webkit-appearance:checkbox;-moz-appearance:checkbox;appearance:checkbox}.mc4wp-form-basic input[type=radio],.mc4wp-form-theme input[type=radio]{-webkit-appearance:radio;-moz-appearance:radio;appearance:radio}.mc4wp-form-basic button,.mc4wp-form-basic input[type=button],.mc4wp-form-basic input[type=submit],.mc4wp-form-theme button,.mc4wp-form-theme input[type=button],.mc4wp-form-theme input[type=submit]{cursor:pointer;display:inline-block;-webkit-appearance:none;-moz-appearance:none;appearance:none}.mc4wp-form-basic label>span,.mc4wp-form-basic li>label,.mc4wp-form-theme label>span,.mc4wp-form-theme li>label{font-weight:400}.mc4wp-form-basic .mc4wp-alert,.mc4wp-form-theme .mc4wp-alert{color:#c09853;clear:both}.mc4wp-form-basic .mc4wp-success,.mc4wp-form-theme .mc4wp-success{color:#468847}.mc4wp-form-basic .mc4wp-notice,.mc4wp-form-theme .mc4wp-notice{color:#3a87ad}.mc4wp-form-basic .mc4wp-error,.mc4wp-form-theme .mc4wp-error{color:#cd5c5c}.rtl .mc4wp-form-reset input[type=checkbox],.rtl .mc4wp-form-reset input[type=radio]{margin:0 0 0 6px}.mc4wp-form-theme input[type=date],.mc4wp-form-theme input[type=email],.mc4wp-form-theme input[type=number],.mc4wp-form-theme input[type=tel],.mc4wp-form-theme input[type=text],.mc4wp-form-theme input[type=url],.mc4wp-form-theme select,.mc4wp-form-theme textarea{height:auto;padding:8px 16px;line-height:1.428571429;color:#555!important;vertical-align:middle;background:0 0;background-color:#fff;border:1px solid #ccc;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);text-shadow:none}.mc4wp-form-theme button:focus,.mc4wp-form-theme input:focus,.mc4wp-form-theme select:focus,.mc4wp-form-theme textarea:focus{outline:0;background-image:none}.mc4wp-form-theme textarea{height:auto}.mc4wp-form-theme input[disabled],.mc4wp-form-theme input[readonly]{background-color:#eee}.mc4wp-form-theme button,.mc4wp-form-theme input[type=button],.mc4wp-form-theme input[type=submit]{display:inline-block;padding:8px 16px;font-weight:400;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;border:1px solid transparent;border-radius:2px;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;background:0 0;text-shadow:none;filter:none;height:auto;width:auto}.mc4wp-form-theme button:focus,.mc4wp-form-theme button:hover,.mc4wp-form-theme input[type=button]:focus,.mc4wp-form-theme input[type=button]:hover,.mc4wp-form-theme input[type=submit]:focus,.mc4wp-form-theme input[type=submit]:hover{outline:0;color:#333;text-decoration:none;background:0 0}.mc4wp-form-theme-dark button,.mc4wp-form-theme-dark input[type=submit]{color:#fff!important;background-color:#444!important;border-color:#1e1e1e}.mc4wp-form-theme-dark button:active,.mc4wp-form-theme-dark button:focus,.mc4wp-form-theme-dark button:hover,.mc4wp-form-theme-dark input[type=submit]:active,.mc4wp-form-theme-dark input[type=submit]:focus,.mc4wp-form-theme-dark input[type=submit]:hover{color:#fff!important;background-color:#1e1e1e!important;border-color:#000}.mc4wp-form-theme-dark input[type=date]:focus,.mc4wp-form-theme-dark input[type=email]:focus,.mc4wp-form-theme-dark input[type=tel]:focus,.mc4wp-form-theme-dark input[type=text]:focus,.mc4wp-form-theme-dark input[type=url]:focus,.mc4wp-form-theme-dark select:focus,.mc4wp-form-theme-dark textarea:focus{border-color:#6a6a6a;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(68,68,68,.15);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(68,68,68,.15);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(68,68,68,.15)}.mc4wp-form-theme-light button,.mc4wp-form-theme-light input[type=submit]{color:#000!important;background-color:#fff!important;border-color:#d9d9d9}.mc4wp-form-theme-light button:active,.mc4wp-form-theme-light button:focus,.mc4wp-form-theme-light button:hover,.mc4wp-form-theme-light input[type=submit]:active,.mc4wp-form-theme-light input[type=submit]:focus,.mc4wp-form-theme-light input[type=submit]:hover{color:#000!important;background-color:#d9d9d9!important;border-color:#b3b3b3}.mc4wp-form-theme-light input[type=date]:focus,.mc4wp-form-theme-light input[type=email]:focus,.mc4wp-form-theme-light input[type=tel]:focus,.mc4wp-form-theme-light input[type=text]:focus,.mc4wp-form-theme-light input[type=url]:focus,.mc4wp-form-theme-light select:focus,.mc4wp-form-theme-light textarea:focus{border-color:#d9d9d9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(255,255,255,.15);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(255,255,255,.15);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(255,255,255,.15)}.mc4wp-form-theme-red button,.mc4wp-form-theme-red input[type=submit]{color:#fff!important;background-color:#d9534f!important;border-color:#b52b27}.mc4wp-form-theme-red button:active,.mc4wp-form-theme-red button:focus,.mc4wp-form-theme-red button:hover,.mc4wp-form-theme-red input[type=submit]:active,.mc4wp-form-theme-red input[type=submit]:focus,.mc4wp-form-theme-red input[type=submit]:hover{color:#fff!important;background-color:#b52b27!important;border-color:#761c19}.mc4wp-form-theme-red input[type=date]:focus,.mc4wp-form-theme-red input[type=email]:focus,.mc4wp-form-theme-red input[type=tel]:focus,.mc4wp-form-theme-red input[type=text]:focus,.mc4wp-form-theme-red input[type=url]:focus,.mc4wp-form-theme-red select:focus,.mc4wp-form-theme-red textarea:focus{border-color:#e7908e;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(217,83,79,.15);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(217,83,79,.15);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(217,83,79,.15)}.mc4wp-form-theme-blue button,.mc4wp-form-theme-blue input[type=submit]{color:#fff!important;background-color:#428bca!important;border-color:#2a6496}.mc4wp-form-theme-blue button:active,.mc4wp-form-theme-blue button:focus,.mc4wp-form-theme-blue button:hover,.mc4wp-form-theme-blue input[type=submit]:active,.mc4wp-form-theme-blue input[type=submit]:focus,.mc4wp-form-theme-blue input[type=submit]:hover{color:#fff!important;background-color:#2a6496!important;border-color:#193c5a}.mc4wp-form-theme-blue input[type=date]:focus,.mc4wp-form-theme-blue input[type=email]:focus,.mc4wp-form-theme-blue input[type=tel]:focus,.mc4wp-form-theme-blue input[type=text]:focus,.mc4wp-form-theme-blue input[type=url]:focus,.mc4wp-form-theme-blue select:focus,.mc4wp-form-theme-blue textarea:focus{border-color:#7eb0db;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(66,139,202,.15);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(66,139,202,.15);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(66,139,202,.15)}.mc4wp-form-theme-green button,.mc4wp-form-theme-green input[type=submit]{color:#fff!important;background-color:#5cb85c!important;border-color:#3d8b3d}.mc4wp-form-theme-green button:active,.mc4wp-form-theme-green button:focus,.mc4wp-form-theme-green button:hover,.mc4wp-form-theme-green input[type=submit]:active,.mc4wp-form-theme-green input[type=submit]:focus,.mc4wp-form-theme-green input[type=submit]:hover{color:#fff!important;background-color:#3d8b3d!important;border-color:#255625}.mc4wp-form-theme-green input[type=date]:focus,.mc4wp-form-theme-green input[type=email]:focus,.mc4wp-form-theme-green input[type=tel]:focus,.mc4wp-form-theme-green input[type=text]:focus,.mc4wp-form-theme-green input[type=url]:focus,.mc4wp-form-theme-green select:focus,.mc4wp-form-theme-green textarea:focus{border-color:#91cf91;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(92,184,92,.15);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(92,184,92,.15);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(92,184,92,.15)}
|
assets/js/admin.js
CHANGED
@@ -5,54 +5,33 @@ var _tlite = _interopRequireDefault(require("tlite"));
|
|
5 |
|
6 |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7 |
|
8 |
-
var
|
9 |
|
10 |
-
var
|
11 |
|
12 |
-
var
|
13 |
-
|
14 |
-
var Settings = require('./admin/settings.js');
|
15 |
-
|
16 |
-
var helpers = require('./admin/helpers.js'); // vars
|
17 |
-
|
18 |
-
|
19 |
-
var context = document.getElementById('mc4wp-admin');
|
20 |
-
var tabs, settings;
|
21 |
-
var events = new EventEmitter();
|
22 |
-
|
23 |
-
if (context !== null) {
|
24 |
-
tabs = Tabs(context);
|
25 |
-
settings = Settings(context, helpers, events);
|
26 |
-
}
|
27 |
|
28 |
(0, _tlite["default"])(function (el) {
|
29 |
return el.className.indexOf('mc4wp-tooltip') > -1;
|
30 |
-
});
|
31 |
|
32 |
-
|
33 |
|
34 |
-
|
35 |
|
36 |
-
|
37 |
-
m.mount(mount, new ListFetcher());
|
38 |
-
}
|
39 |
|
40 |
-
require('./admin/
|
41 |
|
42 |
|
43 |
window.mc4wp = window.mc4wp || {};
|
44 |
-
window.mc4wp.deps = window.mc4wp.deps || {};
|
45 |
-
window.mc4wp.deps.mithril = m;
|
46 |
window.mc4wp.helpers = helpers;
|
47 |
-
window.mc4wp.events = events;
|
48 |
window.mc4wp.settings = settings;
|
49 |
window.mc4wp.tabs = tabs;
|
50 |
|
51 |
-
},{"./admin/fields/mailchimp-api-key.js":2,"./admin/helpers.js":3,"./admin/list-fetcher.js":4,"./admin/
|
52 |
'use strict';
|
53 |
|
54 |
-
var field;
|
55 |
-
|
56 |
function validate(evt) {
|
57 |
var node = document.createElement('p');
|
58 |
node.className = 'help red';
|
@@ -67,404 +46,452 @@ function validate(evt) {
|
|
67 |
}
|
68 |
}
|
69 |
|
70 |
-
|
71 |
-
field = document.getElementById('mailchimp_api_key');
|
72 |
-
|
73 |
-
if (!field) {
|
74 |
-
return;
|
75 |
-
}
|
76 |
|
|
|
77 |
field.addEventListener('change', validate);
|
78 |
-
}
|
79 |
|
80 |
},{}],3:[function(require,module,exports){
|
81 |
'use strict';
|
82 |
|
83 |
-
var helpers = {};
|
84 |
-
|
85 |
-
helpers.toggleElement = function (selector) {
|
86 |
-
var elements = document.querySelectorAll(selector);
|
87 |
-
|
88 |
-
for (var i = 0; i < elements.length; i++) {
|
89 |
-
var show = elements[i].clientHeight <= 0;
|
90 |
-
elements[i].style.display = show ? '' : 'none';
|
91 |
-
}
|
92 |
-
};
|
93 |
-
|
94 |
-
helpers.bindEventToElement = function (element, event, handler) {
|
95 |
-
if (element.addEventListener) {
|
96 |
-
element.addEventListener(event, handler);
|
97 |
-
} else if (element.attachEvent) {
|
98 |
-
element.attachEvent('on' + event, handler);
|
99 |
-
}
|
100 |
-
};
|
101 |
-
|
102 |
-
helpers.bindEventToElements = function (elements, event, handler) {
|
103 |
-
Array.prototype.forEach.call(elements, function (element) {
|
104 |
-
helpers.bindEventToElement(element, event, handler);
|
105 |
-
});
|
106 |
-
}; // polling
|
107 |
-
|
108 |
|
109 |
helpers.debounce = function (func, wait, immediate) {
|
110 |
var timeout;
|
111 |
return function () {
|
112 |
var context = this,
|
113 |
args = arguments;
|
114 |
-
|
115 |
-
var later = function later() {
|
116 |
-
timeout = null;
|
117 |
-
if (!immediate) func.apply(context, args);
|
118 |
-
};
|
119 |
-
|
120 |
var callNow = immediate && !timeout;
|
121 |
clearTimeout(timeout);
|
122 |
-
timeout = setTimeout(
|
|
|
|
|
|
|
123 |
if (callNow) func.apply(context, args);
|
124 |
};
|
125 |
};
|
126 |
-
/**
|
127 |
-
* Showif.js
|
128 |
-
*/
|
129 |
-
|
130 |
-
|
131 |
-
(function () {
|
132 |
-
var showIfElements = document.querySelectorAll('[data-showif]'); // dependent elements
|
133 |
-
|
134 |
-
Array.prototype.forEach.call(showIfElements, function (element) {
|
135 |
-
var config = JSON.parse(element.getAttribute('data-showif'));
|
136 |
-
var parentElements = document.querySelectorAll('[name="' + config.element + '"]');
|
137 |
-
var inputs = element.querySelectorAll('input,select,textarea:not([readonly])');
|
138 |
-
var hide = config.hide === undefined || config.hide;
|
139 |
-
|
140 |
-
function toggleElement() {
|
141 |
-
// do nothing with unchecked radio inputs
|
142 |
-
if (this.getAttribute('type') === "radio" && !this.checked) {
|
143 |
-
return;
|
144 |
-
}
|
145 |
-
|
146 |
-
var value = this.getAttribute("type") === "checkbox" ? this.checked : this.value;
|
147 |
-
var conditionMet = value == config.value;
|
148 |
-
|
149 |
-
if (hide) {
|
150 |
-
element.style.display = conditionMet ? '' : 'none';
|
151 |
-
element.style.visibility = conditionMet ? '' : 'hidden';
|
152 |
-
} else {
|
153 |
-
element.style.opacity = conditionMet ? '' : '0.4';
|
154 |
-
} // disable input fields to stop sending their values to server
|
155 |
-
|
156 |
-
|
157 |
-
Array.prototype.forEach.call(inputs, function (inputElement) {
|
158 |
-
conditionMet ? inputElement.removeAttribute('readonly') : inputElement.setAttribute('readonly', 'readonly');
|
159 |
-
});
|
160 |
-
} // find checked element and call toggleElement function
|
161 |
-
|
162 |
-
|
163 |
-
Array.prototype.forEach.call(parentElements, function (parentElement) {
|
164 |
-
toggleElement.call(parentElement);
|
165 |
-
}); // bind on all changes
|
166 |
-
|
167 |
-
helpers.bindEventToElements(parentElements, 'change', toggleElement);
|
168 |
-
});
|
169 |
-
})();
|
170 |
|
171 |
module.exports = helpers;
|
172 |
|
173 |
},{}],4:[function(require,module,exports){
|
174 |
'use strict';
|
175 |
|
176 |
-
var
|
177 |
-
var
|
178 |
-
var
|
179 |
|
180 |
-
|
181 |
-
this.working = false;
|
182 |
-
this.done = false; // start fetching right away when no lists but api key given
|
183 |
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
|
|
188 |
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
|
|
195 |
timeout: 600000 // 10 minutes, matching max_execution_time
|
196 |
|
197 |
-
}).
|
198 |
-
|
199 |
|
200 |
if (data) {
|
201 |
window.setTimeout(function () {
|
202 |
window.location.reload();
|
203 |
}, 3000);
|
204 |
}
|
205 |
-
}
|
206 |
-
|
207 |
-
}
|
208 |
-
|
209 |
-
|
210 |
m.redraw();
|
211 |
-
}
|
212 |
-
}
|
213 |
|
214 |
-
|
215 |
return m('form', {
|
216 |
method: "POST",
|
217 |
-
onsubmit:
|
218 |
}, [m('p', [m('input', {
|
219 |
type: "submit",
|
220 |
-
value:
|
221 |
className: "button",
|
222 |
-
disabled: !!
|
223 |
-
}), m.trust(' '),
|
224 |
-
}
|
225 |
-
|
226 |
-
module.exports = ListFetcher;
|
227 |
|
228 |
-
|
229 |
-
"use strict";
|
230 |
|
231 |
-
|
|
|
|
|
|
|
|
|
232 |
|
233 |
-
|
234 |
-
|
|
|
|
|
235 |
|
236 |
-
|
237 |
-
|
238 |
-
var lists = mc4wp_vars.mailchimp.lists;
|
239 |
-
var selectedLists = []; // functions
|
240 |
|
241 |
-
|
242 |
-
return selectedLists.filter(function (el) {
|
243 |
-
return el[searchKey] === searchValue;
|
244 |
-
});
|
245 |
-
}
|
246 |
|
247 |
-
|
248 |
-
return selectedLists;
|
249 |
-
}
|
250 |
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
// skip unchecked checkboxes
|
255 |
-
if (typeof input.checked === "boolean" && !input.checked) {
|
256 |
-
return;
|
257 |
-
}
|
258 |
|
259 |
-
|
260 |
-
|
261 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
});
|
263 |
-
|
264 |
-
|
|
|
265 |
}
|
|
|
266 |
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
|
273 |
-
|
274 |
-
el.setAttribute('class', el.getAttribute('class').replace('hidden', ''));
|
275 |
-
} else {
|
276 |
-
el.setAttribute('class', el.getAttribute('class') + " hidden");
|
277 |
-
}
|
278 |
-
});
|
279 |
-
}
|
280 |
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
};
|
287 |
-
};
|
288 |
|
289 |
-
|
|
|
|
|
290 |
|
291 |
-
},{}],6:[function(require,module,exports){
|
292 |
'use strict';
|
293 |
|
294 |
-
|
295 |
-
|
296 |
|
297 |
-
var
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
var $tabNavs = $context.find('.nav-tab');
|
307 |
-
var refererField = context.querySelector('input[name="_wp_http_referer"]');
|
308 |
-
var tabs = [];
|
309 |
-
$.each($tabs, function (i, t) {
|
310 |
-
var id = t.id.substring(4);
|
311 |
-
var title = $(t).find('h2').first().text();
|
312 |
-
tabs.push({
|
313 |
-
id: id,
|
314 |
-
title: title,
|
315 |
-
element: t,
|
316 |
-
nav: context.querySelectorAll('.nav-tab-' + id),
|
317 |
-
open: function open() {
|
318 |
-
return _open(id);
|
319 |
-
}
|
320 |
-
});
|
321 |
});
|
|
|
322 |
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
return tabs[i];
|
327 |
-
}
|
328 |
-
}
|
329 |
|
330 |
-
|
331 |
-
|
|
|
|
|
|
|
|
|
|
|
332 |
|
333 |
-
|
334 |
-
|
335 |
-
if (typeof tab === "string") {
|
336 |
-
tab = get(tab);
|
337 |
}
|
|
|
|
|
|
|
|
|
|
|
338 |
|
339 |
-
|
340 |
-
|
341 |
-
|
|
|
|
|
|
|
|
|
|
|
342 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
|
344 |
-
|
345 |
-
|
346 |
-
|
|
|
|
|
|
|
347 |
|
|
|
|
|
|
|
|
|
|
|
348 |
|
349 |
-
|
350 |
-
|
351 |
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
}
|
|
|
|
|
356 |
|
357 |
-
tab.element.style.display = 'block';
|
358 |
-
tab.element.className += " tab-active"; // create new URL
|
359 |
|
360 |
-
|
|
|
|
|
|
|
361 |
|
362 |
-
if (history.pushState && updateState) {
|
363 |
-
history.pushState(tab.id, '', url);
|
364 |
-
} // update document title
|
365 |
|
|
|
|
|
|
|
|
|
|
|
366 |
|
367 |
-
|
|
|
368 |
|
369 |
-
|
370 |
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
|
|
375 |
|
|
|
|
|
|
|
376 |
|
377 |
-
|
378 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
379 |
}
|
|
|
|
|
380 |
|
381 |
-
|
|
|
|
|
|
|
|
|
382 |
}
|
383 |
|
384 |
-
|
385 |
-
|
386 |
-
|
|
|
|
|
|
|
|
|
387 |
}
|
388 |
|
389 |
-
|
390 |
-
|
|
|
391 |
|
392 |
-
var tabId = this.getAttribute('data-tab'); // get from classname
|
393 |
|
394 |
-
|
395 |
-
|
|
|
396 |
|
397 |
-
if (match) {
|
398 |
-
tabId = match[1];
|
399 |
-
}
|
400 |
-
} // get from href
|
401 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
402 |
|
403 |
-
|
404 |
-
|
|
|
|
|
405 |
|
406 |
-
|
407 |
-
|
408 |
-
}
|
409 |
|
410 |
-
|
411 |
-
}
|
412 |
|
413 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
414 |
|
415 |
-
if (opened) {
|
416 |
-
e.preventDefault();
|
417 |
-
e.returnValue = false;
|
418 |
-
return false;
|
419 |
-
}
|
420 |
|
421 |
-
|
|
|
422 |
}
|
423 |
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
428 |
}
|
|
|
429 |
|
430 |
-
var activeTab = $tabs.filter(':visible').get(0);
|
431 |
|
432 |
-
|
|
|
|
|
|
|
433 |
return;
|
434 |
}
|
435 |
|
436 |
-
|
437 |
-
|
438 |
|
439 |
-
|
440 |
-
history.replaceState(tab.id, '');
|
441 |
-
} // update document title
|
442 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
443 |
|
444 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
445 |
}
|
446 |
|
447 |
-
|
448 |
-
$(document.body).on('click', '.tab-link', switchTab);
|
449 |
-
init();
|
450 |
|
451 |
-
if (
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
457 |
}
|
458 |
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
};
|
463 |
-
};
|
464 |
|
465 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
|
467 |
-
},{"./url.js":
|
468 |
'use strict';
|
469 |
|
470 |
var URL = {
|
@@ -500,128 +527,498 @@ var URL = {
|
|
500 |
};
|
501 |
module.exports = URL;
|
502 |
|
503 |
-
},{}],
|
504 |
-
(function (global,setImmediate){
|
505 |
-
;(function() {
|
506 |
"use strict"
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
}
|
521 |
-
var selectorParser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g
|
522 |
-
var selectorCache = {}
|
523 |
-
var hasOwn = {}.hasOwnProperty
|
524 |
-
function isEmpty(object) {
|
525 |
-
for (var key in object) if (hasOwn.call(object, key)) return false
|
526 |
-
return true
|
527 |
-
}
|
528 |
-
function compileSelector(selector) {
|
529 |
-
var match, tag = "div", classes = [], attrs = {}
|
530 |
-
while (match = selectorParser.exec(selector)) {
|
531 |
-
var type = match[1], value = match[2]
|
532 |
-
if (type === "" && value !== "") tag = value
|
533 |
-
else if (type === "#") attrs.id = value
|
534 |
-
else if (type === ".") classes.push(value)
|
535 |
-
else if (match[3][0] === "[") {
|
536 |
-
var attrValue = match[6]
|
537 |
-
if (attrValue) attrValue = attrValue.replace(/\\(["'])/g, "$1").replace(/\\\\/g, "\\")
|
538 |
-
if (match[4] === "class") classes.push(attrValue)
|
539 |
-
else attrs[match[4]] = attrValue === "" ? attrValue : attrValue || true
|
540 |
}
|
|
|
541 |
}
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
for(var key in attrs) {
|
551 |
-
if (hasOwn.call(attrs, key)) {
|
552 |
-
newAttrs[key] = attrs[key]
|
553 |
-
}
|
554 |
}
|
555 |
-
attrs = newAttrs
|
556 |
}
|
557 |
-
|
558 |
-
|
559 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
560 |
}
|
561 |
}
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
566 |
}
|
567 |
-
|
568 |
-
|
569 |
}
|
570 |
}
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
575 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
598 |
}
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
605 |
}
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
}
|
612 |
}
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
hyperscript.fragment = function(attrs1, children) {
|
618 |
-
return Vnode("[", attrs1.key, attrs1, Vnode.normalizeChildren(children), undefined, undefined)
|
619 |
-
}
|
620 |
-
var m = hyperscript
|
621 |
/** @constructor */
|
622 |
var PromisePolyfill = function(executor) {
|
623 |
if (!(this instanceof PromisePolyfill)) throw new Error("Promise must be called with `new`")
|
624 |
if (typeof executor !== "function") throw new TypeError("executor must be a function")
|
|
|
625 |
var self = this, resolvers = [], rejectors = [], resolveCurrent = handler(resolvers, true), rejectCurrent = handler(rejectors, false)
|
626 |
var instance = self._instance = {resolvers: resolvers, rejectors: rejectors}
|
627 |
var callAsync = typeof setImmediate === "function" ? setImmediate : setTimeout
|
@@ -659,6 +1056,7 @@ var PromisePolyfill = function(executor) {
|
|
659 |
var onerror = run(rejectCurrent)
|
660 |
try {then(run(resolveCurrent), onerror)} catch (e) {onerror(e)}
|
661 |
}
|
|
|
662 |
executeOnce(executor)
|
663 |
}
|
664 |
PromisePolyfill.prototype.then = function(onFulfilled, onRejection) {
|
@@ -678,6 +1076,20 @@ PromisePolyfill.prototype.then = function(onFulfilled, onRejection) {
|
|
678 |
PromisePolyfill.prototype.catch = function(onRejection) {
|
679 |
return this.then(null, onRejection)
|
680 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
681 |
PromisePolyfill.resolve = function(value) {
|
682 |
if (value instanceof PromisePolyfill) return value
|
683 |
return new PromisePolyfill(function(resolve) {resolve(value)})
|
@@ -711,196 +1123,330 @@ PromisePolyfill.race = function(list) {
|
|
711 |
}
|
712 |
})
|
713 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
714 |
if (typeof window !== "undefined") {
|
715 |
-
if (typeof window.Promise === "undefined")
|
716 |
-
|
|
|
|
|
|
|
|
|
717 |
} else if (typeof global !== "undefined") {
|
718 |
-
if (typeof global.Promise === "undefined")
|
719 |
-
|
|
|
|
|
|
|
|
|
720 |
} else {
|
|
|
721 |
}
|
722 |
-
|
|
|
|
|
|
|
|
|
|
|
723 |
if (Object.prototype.toString.call(object) !== "[object Object]") return ""
|
|
|
724 |
var args = []
|
725 |
-
for (var
|
726 |
-
destructure(
|
727 |
}
|
|
|
728 |
return args.join("&")
|
729 |
-
|
|
|
730 |
if (Array.isArray(value)) {
|
731 |
for (var i = 0; i < value.length; i++) {
|
732 |
-
destructure(
|
733 |
}
|
734 |
}
|
735 |
else if (Object.prototype.toString.call(value) === "[object Object]") {
|
736 |
for (var i in value) {
|
737 |
-
destructure(
|
738 |
}
|
739 |
}
|
740 |
-
else args.push(encodeURIComponent(
|
741 |
}
|
742 |
}
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
}
|
771 |
-
return args
|
772 |
-
}
|
773 |
-
function request(args, extra) {
|
774 |
-
var finalize = finalizer()
|
775 |
-
args = normalize(args, extra)
|
776 |
-
var promise0 = new Promise(function(resolve, reject) {
|
777 |
-
if (args.method == null) args.method = "GET"
|
778 |
-
args.method = args.method.toUpperCase()
|
779 |
-
var useBody = (args.method === "GET" || args.method === "TRACE") ? false : (typeof args.useBody === "boolean" ? args.useBody : true)
|
780 |
-
if (typeof args.serialize !== "function") args.serialize = typeof FormData !== "undefined" && args.data instanceof FormData ? function(value) {return value} : JSON.stringify
|
781 |
-
if (typeof args.deserialize !== "function") args.deserialize = deserialize
|
782 |
-
if (typeof args.extract !== "function") args.extract = extract
|
783 |
-
args.url = interpolate(args.url, args.data)
|
784 |
-
if (useBody) args.data = args.serialize(args.data)
|
785 |
-
else args.url = assemble(args.url, args.data)
|
786 |
-
var xhr = new $window.XMLHttpRequest(),
|
787 |
-
aborted = false,
|
788 |
-
_abort = xhr.abort
|
789 |
-
xhr.abort = function abort() {
|
790 |
-
aborted = true
|
791 |
-
_abort.call(xhr)
|
792 |
-
}
|
793 |
-
xhr.open(args.method, args.url, typeof args.async === "boolean" ? args.async : true, typeof args.user === "string" ? args.user : undefined, typeof args.password === "string" ? args.password : undefined)
|
794 |
-
if (args.serialize === JSON.stringify && useBody && !(args.headers && args.headers.hasOwnProperty("Content-Type"))) {
|
795 |
-
xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8")
|
796 |
-
}
|
797 |
-
if (args.deserialize === deserialize && !(args.headers && args.headers.hasOwnProperty("Accept"))) {
|
798 |
-
xhr.setRequestHeader("Accept", "application/json, text/*")
|
799 |
-
}
|
800 |
-
if (args.withCredentials) xhr.withCredentials = args.withCredentials
|
801 |
-
for (var key in args.headers) if ({}.hasOwnProperty.call(args.headers, key)) {
|
802 |
-
xhr.setRequestHeader(key, args.headers[key])
|
803 |
-
}
|
804 |
-
if (typeof args.config === "function") xhr = args.config(xhr, args) || xhr
|
805 |
-
xhr.onreadystatechange = function() {
|
806 |
-
// Don't throw errors on xhr.abort().
|
807 |
-
if(aborted) return
|
808 |
-
if (xhr.readyState === 4) {
|
809 |
-
try {
|
810 |
-
var response = (args.extract !== extract) ? args.extract(xhr, args) : args.deserialize(args.extract(xhr, args))
|
811 |
-
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304 || FILE_PROTOCOL_REGEX.test(args.url)) {
|
812 |
-
resolve(cast(args.type, response))
|
813 |
-
}
|
814 |
-
else {
|
815 |
-
var error = new Error(xhr.responseText)
|
816 |
-
for (var key in response) error[key] = response[key]
|
817 |
-
reject(error)
|
818 |
-
}
|
819 |
-
}
|
820 |
-
catch (e) {
|
821 |
-
reject(e)
|
822 |
-
}
|
823 |
}
|
|
|
824 |
}
|
825 |
-
|
826 |
-
else
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
var script = $window.document.createElement("script")
|
836 |
-
$window[callbackName] = function(data) {
|
837 |
-
script.parentNode.removeChild(script)
|
838 |
-
resolve(cast(args.type, data))
|
839 |
-
delete $window[callbackName]
|
840 |
-
}
|
841 |
-
script.onerror = function() {
|
842 |
-
script.parentNode.removeChild(script)
|
843 |
-
reject(new Error("JSONP request failed"))
|
844 |
-
delete $window[callbackName]
|
845 |
-
}
|
846 |
-
if (args.data == null) args.data = {}
|
847 |
-
args.url = interpolate(args.url, args.data)
|
848 |
-
args.data[args.callbackKey || "callback"] = callbackName
|
849 |
-
script.src = assemble(args.url, args.data)
|
850 |
-
$window.document.documentElement.appendChild(script)
|
851 |
-
})
|
852 |
-
return args.background === true? promise0 : finalize(promise0)
|
853 |
-
}
|
854 |
-
function interpolate(url, data) {
|
855 |
-
if (data == null) return url
|
856 |
-
var tokens = url.match(/:[^\/]+/gi) || []
|
857 |
-
for (var i = 0; i < tokens.length; i++) {
|
858 |
-
var key = tokens[i].slice(1)
|
859 |
-
if (data[key] != null) {
|
860 |
-
url = url.replace(tokens[i], data[key])
|
861 |
}
|
862 |
}
|
863 |
-
return url
|
864 |
}
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
870 |
}
|
871 |
-
|
|
|
872 |
}
|
873 |
-
|
874 |
-
|
875 |
-
|
|
|
|
|
876 |
}
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
886 |
}
|
887 |
-
return data
|
888 |
}
|
889 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
890 |
}
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
895 |
var nameSpace = {
|
896 |
svg: "http://www.w3.org/2000/svg",
|
897 |
math: "http://www.w3.org/1998/Math/MathML"
|
898 |
}
|
899 |
-
|
900 |
-
function setEventCallback(callback) {return onevent = callback}
|
901 |
function getNameSpace(vnode) {
|
902 |
return vnode.attrs && vnode.attrs.xmlns || nameSpace[vnode.tag]
|
903 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
904 |
//create
|
905 |
function createNodes(parent, vnodes, start, end, hooks, nextSibling, ns) {
|
906 |
for (var i = start; i < end; i++) {
|
@@ -916,33 +1462,44 @@ var coreRenderer = function($window) {
|
|
916 |
vnode.state = {}
|
917 |
if (vnode.attrs != null) initLifecycle(vnode.attrs, vnode, hooks)
|
918 |
switch (tag) {
|
919 |
-
case "#":
|
920 |
-
case "<":
|
921 |
-
case "[":
|
922 |
-
default:
|
923 |
}
|
924 |
}
|
925 |
-
else
|
926 |
}
|
927 |
function createText(parent, vnode, nextSibling) {
|
928 |
vnode.dom = $doc.createTextNode(vnode.children)
|
929 |
insertNode(parent, vnode.dom, nextSibling)
|
930 |
-
return vnode.dom
|
931 |
}
|
932 |
-
|
933 |
-
|
934 |
-
var
|
935 |
-
|
936 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
937 |
vnode.dom = temp.firstChild
|
938 |
vnode.domSize = temp.childNodes.length
|
|
|
|
|
939 |
var fragment = $doc.createDocumentFragment()
|
940 |
var child
|
941 |
while (child = temp.firstChild) {
|
|
|
942 |
fragment.appendChild(child)
|
943 |
}
|
944 |
insertNode(parent, fragment, nextSibling)
|
945 |
-
return fragment
|
946 |
}
|
947 |
function createFragment(parent, vnode, hooks, ns, nextSibling) {
|
948 |
var fragment = $doc.createDocumentFragment()
|
@@ -953,25 +1510,26 @@ var coreRenderer = function($window) {
|
|
953 |
vnode.dom = fragment.firstChild
|
954 |
vnode.domSize = fragment.childNodes.length
|
955 |
insertNode(parent, fragment, nextSibling)
|
956 |
-
return fragment
|
957 |
}
|
958 |
function createElement(parent, vnode, hooks, ns, nextSibling) {
|
959 |
var tag = vnode.tag
|
960 |
-
var
|
961 |
-
var is =
|
|
|
962 |
ns = getNameSpace(vnode) || ns
|
|
|
963 |
var element = ns ?
|
964 |
is ? $doc.createElementNS(ns, tag, {is: is}) : $doc.createElementNS(ns, tag) :
|
965 |
is ? $doc.createElement(tag, {is: is}) : $doc.createElement(tag)
|
966 |
vnode.dom = element
|
967 |
-
|
968 |
-
|
|
|
969 |
}
|
|
|
970 |
insertNode(parent, element, nextSibling)
|
971 |
-
|
972 |
-
|
973 |
-
}
|
974 |
-
else {
|
975 |
if (vnode.text != null) {
|
976 |
if (vnode.text !== "") element.textContent = vnode.text
|
977 |
else vnode.children = [Vnode("#", undefined, undefined, vnode.text, undefined, undefined)]
|
@@ -979,164 +1537,294 @@ var coreRenderer = function($window) {
|
|
979 |
if (vnode.children != null) {
|
980 |
var children = vnode.children
|
981 |
createNodes(element, children, 0, children.length, hooks, null, ns)
|
982 |
-
|
983 |
}
|
984 |
}
|
985 |
-
return element
|
986 |
}
|
987 |
function initComponent(vnode, hooks) {
|
988 |
var sentinel
|
989 |
if (typeof vnode.tag.view === "function") {
|
990 |
vnode.state = Object.create(vnode.tag)
|
991 |
sentinel = vnode.state.view
|
992 |
-
if (sentinel.$$reentrantLock$$ != null) return
|
993 |
sentinel.$$reentrantLock$$ = true
|
994 |
} else {
|
995 |
vnode.state = void 0
|
996 |
sentinel = vnode.tag
|
997 |
-
if (sentinel.$$reentrantLock$$ != null) return
|
998 |
sentinel.$$reentrantLock$$ = true
|
999 |
vnode.state = (vnode.tag.prototype != null && typeof vnode.tag.prototype.view === "function") ? new vnode.tag(vnode) : vnode.tag(vnode)
|
1000 |
}
|
1001 |
-
vnode.
|
1002 |
if (vnode.attrs != null) initLifecycle(vnode.attrs, vnode, hooks)
|
1003 |
-
|
1004 |
-
vnode.instance = Vnode.normalize(vnode._state.view.call(vnode.state, vnode))
|
1005 |
if (vnode.instance === vnode) throw Error("A view cannot return the vnode it received as argument")
|
1006 |
sentinel.$$reentrantLock$$ = null
|
1007 |
}
|
1008 |
function createComponent(parent, vnode, hooks, ns, nextSibling) {
|
1009 |
initComponent(vnode, hooks)
|
1010 |
if (vnode.instance != null) {
|
1011 |
-
|
1012 |
vnode.dom = vnode.instance.dom
|
1013 |
vnode.domSize = vnode.dom != null ? vnode.instance.domSize : 0
|
1014 |
-
insertNode(parent, element, nextSibling)
|
1015 |
-
return element
|
1016 |
}
|
1017 |
else {
|
1018 |
vnode.domSize = 0
|
1019 |
-
return $emptyFragment
|
1020 |
}
|
1021 |
}
|
|
|
1022 |
//update
|
1023 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1024 |
if (old === vnodes || old == null && vnodes == null) return
|
1025 |
-
else if (old == null) createNodes(parent, vnodes, 0, vnodes.length, hooks, nextSibling, ns)
|
1026 |
-
else if (vnodes == null) removeNodes(old, 0, old.length
|
1027 |
else {
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1035 |
}
|
1036 |
-
if (
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1044 |
}
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
}
|
1051 |
-
var oldStart = 0, start = 0, oldEnd = old.length - 1, end = vnodes.length - 1, map
|
1052 |
-
while (oldEnd >= oldStart && end >= start) {
|
1053 |
-
var o = old[oldStart], v = vnodes[start]
|
1054 |
-
if (o === v && !recycling) oldStart++, start++
|
1055 |
-
else if (o == null) oldStart++
|
1056 |
-
else if (v == null) start++
|
1057 |
-
else if (o.key === v.key) {
|
1058 |
-
var shouldRecycle = (pool != null && oldStart >= old.length - pool.length) || ((pool == null) && recycling)
|
1059 |
oldStart++, start++
|
1060 |
-
updateNode(parent, o, v, hooks, getNextSibling(old, oldStart, nextSibling),
|
1061 |
-
if (recycling && o.tag === v.tag) insertNode(parent, toFragment(o), nextSibling)
|
1062 |
}
|
1063 |
-
|
1064 |
-
|
1065 |
-
if (
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
|
|
|
|
|
|
1075 |
}
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
else if (v == null) end--
|
1082 |
-
else if (o.key === v.key) {
|
1083 |
-
var shouldRecycle = (pool != null && oldEnd >= old.length - pool.length) || ((pool == null) && recycling)
|
1084 |
-
updateNode(parent, o, v, hooks, getNextSibling(old, oldEnd + 1, nextSibling), shouldRecycle, ns)
|
1085 |
-
if (recycling && o.tag === v.tag) insertNode(parent, toFragment(o), nextSibling)
|
1086 |
-
if (o.dom != null) nextSibling = o.dom
|
1087 |
oldEnd--, end--
|
|
|
|
|
1088 |
}
|
|
|
|
|
1089 |
else {
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
|
|
|
|
|
|
|
|
1093 |
if (oldIndex != null) {
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
if (
|
|
|
1100 |
}
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1104 |
}
|
1105 |
}
|
1106 |
-
end--
|
1107 |
}
|
1108 |
-
if (end < start) break
|
1109 |
}
|
1110 |
-
createNodes(parent, vnodes, start, end + 1, hooks, nextSibling, ns)
|
1111 |
-
removeNodes(old, oldStart, oldEnd + 1, vnodes)
|
1112 |
}
|
1113 |
}
|
1114 |
-
function updateNode(parent, old, vnode, hooks, nextSibling,
|
1115 |
var oldTag = old.tag, tag = vnode.tag
|
1116 |
if (oldTag === tag) {
|
1117 |
vnode.state = old.state
|
1118 |
-
vnode._state = old._state
|
1119 |
vnode.events = old.events
|
1120 |
-
if (
|
1121 |
if (typeof oldTag === "string") {
|
1122 |
if (vnode.attrs != null) {
|
1123 |
-
|
1124 |
-
vnode.state = {}
|
1125 |
-
initLifecycle(vnode.attrs, vnode, hooks)
|
1126 |
-
}
|
1127 |
-
else updateLifecycle(vnode.attrs, vnode, hooks)
|
1128 |
}
|
1129 |
switch (oldTag) {
|
1130 |
case "#": updateText(old, vnode); break
|
1131 |
-
case "<": updateHTML(parent, old, vnode, nextSibling); break
|
1132 |
-
case "[": updateFragment(parent, old, vnode,
|
1133 |
-
default: updateElement(old, vnode,
|
1134 |
}
|
1135 |
}
|
1136 |
-
else updateComponent(parent, old, vnode, hooks, nextSibling,
|
1137 |
}
|
1138 |
else {
|
1139 |
-
removeNode(
|
1140 |
createNode(parent, vnode, hooks, ns, nextSibling)
|
1141 |
}
|
1142 |
}
|
@@ -1146,15 +1834,19 @@ var coreRenderer = function($window) {
|
|
1146 |
}
|
1147 |
vnode.dom = old.dom
|
1148 |
}
|
1149 |
-
function updateHTML(parent, old, vnode, nextSibling) {
|
1150 |
if (old.children !== vnode.children) {
|
1151 |
-
|
1152 |
-
createHTML(parent, vnode, nextSibling)
|
|
|
|
|
|
|
|
|
|
|
1153 |
}
|
1154 |
-
else vnode.dom = old.dom, vnode.domSize = old.domSize
|
1155 |
}
|
1156 |
-
function updateFragment(parent, old, vnode,
|
1157 |
-
updateNodes(parent, old.children, vnode.children,
|
1158 |
var domSize = 0, children = vnode.children
|
1159 |
vnode.dom = null
|
1160 |
if (children != null) {
|
@@ -1168,46 +1860,42 @@ var coreRenderer = function($window) {
|
|
1168 |
if (domSize !== 1) vnode.domSize = domSize
|
1169 |
}
|
1170 |
}
|
1171 |
-
function updateElement(old, vnode,
|
1172 |
var element = vnode.dom = old.dom
|
1173 |
ns = getNameSpace(vnode) || ns
|
|
|
1174 |
if (vnode.tag === "textarea") {
|
1175 |
if (vnode.attrs == null) vnode.attrs = {}
|
1176 |
if (vnode.text != null) {
|
1177 |
-
vnode.attrs.value = vnode.text //FIXME
|
1178 |
vnode.text = undefined
|
1179 |
}
|
1180 |
}
|
1181 |
updateAttrs(vnode, old.attrs, vnode.attrs, ns)
|
1182 |
-
if (vnode
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
updateNodes(element, old.children, vnode.children, recycling, hooks, null, ns)
|
1192 |
}
|
1193 |
}
|
1194 |
-
function updateComponent(parent, old, vnode, hooks, nextSibling,
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
if (vnode.instance === vnode) throw Error("A view cannot return the vnode it received as argument")
|
1200 |
-
if (vnode.attrs != null) updateLifecycle(vnode.attrs, vnode, hooks)
|
1201 |
-
updateLifecycle(vnode._state, vnode, hooks)
|
1202 |
-
}
|
1203 |
if (vnode.instance != null) {
|
1204 |
if (old.instance == null) createNode(parent, vnode.instance, hooks, ns, nextSibling)
|
1205 |
-
else updateNode(parent, old.instance, vnode.instance, hooks, nextSibling,
|
1206 |
vnode.dom = vnode.instance.dom
|
1207 |
vnode.domSize = vnode.instance.domSize
|
1208 |
}
|
1209 |
else if (old.instance != null) {
|
1210 |
-
removeNode(old.instance
|
1211 |
vnode.dom = undefined
|
1212 |
vnode.domSize = 0
|
1213 |
}
|
@@ -1216,114 +1904,219 @@ var coreRenderer = function($window) {
|
|
1216 |
vnode.domSize = old.domSize
|
1217 |
}
|
1218 |
}
|
1219 |
-
function
|
1220 |
-
|
1221 |
-
|
1222 |
-
var
|
1223 |
-
var vnodesChildrenLength = vnodes[0] && vnodes[0].children && vnodes[0].children.length || 0
|
1224 |
-
if (Math.abs(poolChildrenLength - vnodesChildrenLength) <= Math.abs(oldChildrenLength - vnodesChildrenLength)) {
|
1225 |
-
return true
|
1226 |
-
}
|
1227 |
-
}
|
1228 |
-
return false
|
1229 |
-
}
|
1230 |
-
function getKeyMap(vnodes, end) {
|
1231 |
-
var map = {}, i = 0
|
1232 |
-
for (var i = 0; i < end; i++) {
|
1233 |
-
var vnode = vnodes[i]
|
1234 |
if (vnode != null) {
|
1235 |
-
var
|
1236 |
-
if (
|
1237 |
}
|
1238 |
}
|
1239 |
return map
|
1240 |
}
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1249 |
}
|
1250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1251 |
}
|
1252 |
-
|
|
|
1253 |
}
|
|
|
1254 |
function getNextSibling(vnodes, i, nextSibling) {
|
1255 |
for (; i < vnodes.length; i++) {
|
1256 |
if (vnodes[i] != null && vnodes[i].dom != null) return vnodes[i].dom
|
1257 |
}
|
1258 |
return nextSibling
|
1259 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1260 |
function insertNode(parent, dom, nextSibling) {
|
1261 |
-
if (nextSibling
|
1262 |
else parent.appendChild(dom)
|
1263 |
}
|
1264 |
-
|
|
|
|
|
|
|
|
|
|
|
1265 |
var children = vnode.children
|
1266 |
if (children != null && children.length === 1 && children[0].tag === "<") {
|
1267 |
var content = children[0].children
|
1268 |
if (vnode.dom.innerHTML !== content) vnode.dom.innerHTML = content
|
1269 |
}
|
1270 |
else if (vnode.text != null || children != null && children.length !== 0) throw new Error("Child node of a contenteditable must be trusted")
|
|
|
1271 |
}
|
|
|
1272 |
//remove
|
1273 |
-
function removeNodes(vnodes, start, end
|
1274 |
for (var i = start; i < end; i++) {
|
1275 |
var vnode = vnodes[i]
|
1276 |
-
if (vnode != null)
|
1277 |
-
if (vnode.skip) vnode.skip = false
|
1278 |
-
else removeNode(vnode, context)
|
1279 |
-
}
|
1280 |
}
|
1281 |
}
|
1282 |
-
function removeNode(
|
1283 |
-
var
|
1284 |
-
|
1285 |
-
|
|
|
|
|
1286 |
if (result != null && typeof result.then === "function") {
|
1287 |
-
|
1288 |
-
result
|
1289 |
}
|
1290 |
}
|
1291 |
-
if (
|
1292 |
-
var result =
|
1293 |
if (result != null && typeof result.then === "function") {
|
1294 |
-
|
1295 |
-
|
|
|
1296 |
}
|
1297 |
}
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1314 |
}
|
1315 |
}
|
1316 |
}
|
|
|
1317 |
}
|
1318 |
}
|
1319 |
-
function removeNodeFromDOM(node) {
|
1320 |
-
var parent = node.parentNode
|
1321 |
-
if (parent != null) parent.removeChild(node)
|
1322 |
-
}
|
1323 |
function onremove(vnode) {
|
1324 |
-
if (vnode.
|
|
|
1325 |
if (typeof vnode.tag !== "string") {
|
1326 |
-
if (typeof vnode._state.onremove === "function") vnode._state.onremove.call(vnode.state, vnode)
|
1327 |
if (vnode.instance != null) onremove(vnode.instance)
|
1328 |
} else {
|
1329 |
var children = vnode.children
|
@@ -1335,432 +2128,510 @@ var coreRenderer = function($window) {
|
|
1335 |
}
|
1336 |
}
|
1337 |
}
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
|
|
1342 |
}
|
1343 |
}
|
1344 |
-
function setAttr(vnode,
|
1345 |
-
|
1346 |
-
if (
|
1347 |
-
|
1348 |
-
if (
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
else if (key2 in element && !isAttribute(key2) && ns === undefined && !isCustomElement(vnode)) {
|
1354 |
-
if (key2 === "value") {
|
1355 |
-
var normalized0 = "" + value // eslint-disable-line no-implicit-coercion
|
1356 |
//setting input[value] to same value by typing on focused element moves cursor to end in Chrome
|
1357 |
-
if ((vnode.tag === "input" || vnode.tag === "textarea") && vnode.dom.value ===
|
1358 |
//setting select[value] to same value while having select open blinks select dropdown in Chrome
|
1359 |
-
if (vnode.tag === "select")
|
1360 |
-
if (value === null) {
|
1361 |
-
if (vnode.dom.selectedIndex === -1 && vnode.dom === $doc.activeElement) return
|
1362 |
-
} else {
|
1363 |
-
if (old !== null && vnode.dom.value === normalized0 && vnode.dom === $doc.activeElement) return
|
1364 |
-
}
|
1365 |
-
}
|
1366 |
//setting option[value] to same value while having select open blinks select dropdown in Chrome
|
1367 |
-
if (vnode.tag === "option" && old
|
|
|
1368 |
}
|
1369 |
-
// If you assign an input
|
1370 |
-
if (vnode.tag === "input" &&
|
1371 |
-
|
1372 |
-
|
1373 |
-
}
|
1374 |
-
element[key2] = value
|
1375 |
-
}
|
1376 |
-
else {
|
1377 |
if (typeof value === "boolean") {
|
1378 |
-
if (value)
|
1379 |
-
else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1380 |
}
|
1381 |
-
else element.setAttribute(key2 === "className" ? "class" : key2, value)
|
1382 |
-
}
|
1383 |
-
}
|
1384 |
-
function setLateAttrs(vnode) {
|
1385 |
-
var attrs2 = vnode.attrs
|
1386 |
-
if (vnode.tag === "select" && attrs2 != null) {
|
1387 |
-
if ("value" in attrs2) setAttr(vnode, "value", null, attrs2.value, undefined)
|
1388 |
-
if ("selectedIndex" in attrs2) setAttr(vnode, "selectedIndex", null, attrs2.selectedIndex, undefined)
|
1389 |
}
|
|
|
1390 |
}
|
1391 |
-
function updateAttrs(vnode, old,
|
1392 |
-
if (
|
1393 |
-
for (var
|
1394 |
-
setAttr(vnode,
|
1395 |
}
|
1396 |
}
|
|
|
1397 |
if (old != null) {
|
1398 |
-
for (var
|
1399 |
-
if (
|
1400 |
-
|
1401 |
-
if (key2[0] === "o" && key2[1] === "n" && !isLifecycleMethod(key2)) updateEvent(vnode, key2, undefined)
|
1402 |
-
else if (key2 !== "key") vnode.dom.removeAttribute(key2)
|
1403 |
}
|
1404 |
}
|
1405 |
}
|
1406 |
}
|
1407 |
function isFormAttribute(vnode, attr) {
|
1408 |
-
return attr === "value" || attr === "checked" || attr === "selectedIndex" || attr === "selected" && vnode.dom === $doc.activeElement
|
1409 |
}
|
1410 |
function isLifecycleMethod(attr) {
|
1411 |
return attr === "oninit" || attr === "oncreate" || attr === "onupdate" || attr === "onremove" || attr === "onbeforeremove" || attr === "onbeforeupdate"
|
1412 |
}
|
1413 |
-
function
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
|
|
1421 |
}
|
|
|
1422 |
//style
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1423 |
function updateStyle(element, old, style) {
|
1424 |
-
if (old === style)
|
1425 |
-
|
1426 |
-
else if (
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1431 |
}
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
|
|
1435 |
}
|
1436 |
}
|
1437 |
}
|
1438 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1439 |
//event
|
1440 |
-
function updateEvent(vnode,
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
var eventName = key2.slice(2)
|
1450 |
-
if (vnode.events === undefined) vnode.events = {}
|
1451 |
-
if (vnode.events[key2] === callback) return
|
1452 |
-
if (vnode.events[key2] != null) element.removeEventListener(eventName, vnode.events[key2], false)
|
1453 |
-
if (typeof value === "function") {
|
1454 |
-
vnode.events[key2] = callback
|
1455 |
-
element.addEventListener(eventName, vnode.events[key2], false)
|
1456 |
}
|
|
|
|
|
|
|
|
|
1457 |
}
|
1458 |
}
|
|
|
1459 |
//lifecycle
|
1460 |
function initLifecycle(source, vnode, hooks) {
|
1461 |
-
if (typeof source.oninit === "function")
|
1462 |
-
if (typeof source.oncreate === "function") hooks.push(
|
1463 |
}
|
1464 |
function updateLifecycle(source, vnode, hooks) {
|
1465 |
-
if (typeof source.onupdate === "function") hooks.push(
|
1466 |
}
|
1467 |
function shouldNotUpdate(vnode, old) {
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
vnode.
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1481 |
var hooks = []
|
1482 |
-
var active =
|
1483 |
var namespace = dom.namespaceURI
|
1484 |
-
|
|
|
1485 |
if (dom.vnodes == null) dom.textContent = ""
|
1486 |
-
|
1487 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1488 |
dom.vnodes = vnodes
|
1489 |
-
// document.activeElement can return null
|
1490 |
-
if (active != null &&
|
1491 |
for (var i = 0; i < hooks.length; i++) hooks[i]()
|
1492 |
}
|
1493 |
-
return {render: render, setEventCallback: setEventCallback}
|
1494 |
}
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
callback()
|
1505 |
-
}
|
1506 |
-
else if (pending === null) {
|
1507 |
-
pending = timeout(function() {
|
1508 |
-
pending = null
|
1509 |
-
callback()
|
1510 |
-
last = Date.now()
|
1511 |
-
}, time - (now - last))
|
1512 |
-
}
|
1513 |
-
}
|
1514 |
}
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
}
|
1521 |
-
var callbacks = []
|
1522 |
-
function subscribe(key1, callback) {
|
1523 |
-
unsubscribe(key1)
|
1524 |
-
callbacks.push(key1, throttle(callback))
|
1525 |
-
}
|
1526 |
-
function unsubscribe(key1) {
|
1527 |
-
var index = callbacks.indexOf(key1)
|
1528 |
-
if (index > -1) callbacks.splice(index, 2)
|
1529 |
-
}
|
1530 |
-
function redraw() {
|
1531 |
-
for (var i = 1; i < callbacks.length; i += 2) {
|
1532 |
-
callbacks[i]()
|
1533 |
-
}
|
1534 |
-
}
|
1535 |
-
return {subscribe: subscribe, unsubscribe: unsubscribe, redraw: redraw, render: renderService.render}
|
1536 |
}
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
redrawService0.render(root, [])
|
1543 |
-
redrawService0.unsubscribe(root)
|
1544 |
-
return
|
1545 |
-
}
|
1546 |
-
|
1547 |
-
if (component.view == null && typeof component !== "function") throw new Error("m.mount(element, component) expects a component, not a vnode")
|
1548 |
-
|
1549 |
-
var run0 = function() {
|
1550 |
-
redrawService0.render(root, Vnode(component))
|
1551 |
-
}
|
1552 |
-
redrawService0.subscribe(root, run0)
|
1553 |
-
redrawService0.redraw()
|
1554 |
-
}
|
1555 |
}
|
1556 |
-
|
1557 |
-
var
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
var
|
1564 |
-
|
1565 |
-
|
1566 |
-
if (value === "true") value = true
|
1567 |
-
else if (value === "false") value = false
|
1568 |
-
var levels = key5.split(/\]\[?|\[/)
|
1569 |
-
var cursor = data0
|
1570 |
-
if (key5.indexOf("[") > -1) levels.pop()
|
1571 |
-
for (var j = 0; j < levels.length; j++) {
|
1572 |
-
var level = levels[j], nextLevel = levels[j + 1]
|
1573 |
-
var isNumber = nextLevel == "" || !isNaN(parseInt(nextLevel, 10))
|
1574 |
-
var isValue = j === levels.length - 1
|
1575 |
-
if (level === "") {
|
1576 |
-
var key5 = levels.slice(0, j).join()
|
1577 |
-
if (counters[key5] == null) counters[key5] = 0
|
1578 |
-
level = counters[key5]++
|
1579 |
-
}
|
1580 |
-
if (cursor[level] == null) {
|
1581 |
-
cursor[level] = isValue ? value : isNumber ? [] : {}
|
1582 |
}
|
1583 |
-
|
|
|
|
|
1584 |
}
|
1585 |
}
|
1586 |
-
return
|
1587 |
}
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1603 |
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1604 |
}
|
1605 |
}
|
1606 |
-
|
1607 |
-
|
1608 |
-
var
|
1609 |
-
|
1610 |
-
if (queryIndex > -1) {
|
1611 |
-
var queryEnd = hashIndex > -1 ? hashIndex : path.length
|
1612 |
-
var queryParams = parseQueryString(path.slice(queryIndex + 1, queryEnd))
|
1613 |
-
for (var key4 in queryParams) queryData[key4] = queryParams[key4]
|
1614 |
-
}
|
1615 |
-
if (hashIndex > -1) {
|
1616 |
-
var hashParams = parseQueryString(path.slice(hashIndex + 1))
|
1617 |
-
for (var key4 in hashParams) hashData[key4] = hashParams[key4]
|
1618 |
-
}
|
1619 |
-
return path.slice(0, pathEnd)
|
1620 |
-
}
|
1621 |
-
var router = {prefix: "#!"}
|
1622 |
-
router.getPath = function() {
|
1623 |
-
var type2 = router.prefix.charAt(0)
|
1624 |
-
switch (type2) {
|
1625 |
-
case "#": return normalize1("hash").slice(router.prefix.length)
|
1626 |
-
case "?": return normalize1("search").slice(router.prefix.length) + normalize1("hash")
|
1627 |
-
default: return normalize1("pathname").slice(router.prefix.length) + normalize1("search") + normalize1("hash")
|
1628 |
-
}
|
1629 |
-
}
|
1630 |
-
router.setPath = function(path, data, options) {
|
1631 |
-
var queryData = {}, hashData = {}
|
1632 |
-
path = parsePath(path, queryData, hashData)
|
1633 |
-
if (data != null) {
|
1634 |
-
for (var key4 in data) queryData[key4] = data[key4]
|
1635 |
-
path = path.replace(/:([^\/]+)/g, function(match2, token) {
|
1636 |
-
delete queryData[token]
|
1637 |
-
return data[token]
|
1638 |
-
})
|
1639 |
-
}
|
1640 |
-
var query = buildQueryString(queryData)
|
1641 |
-
if (query) path += "?" + query
|
1642 |
-
var hash = buildQueryString(hashData)
|
1643 |
-
if (hash) path += "#" + hash
|
1644 |
-
if (supportsPushState) {
|
1645 |
-
var state = options ? options.state : null
|
1646 |
-
var title = options ? options.title : null
|
1647 |
-
$window.onpopstate()
|
1648 |
-
if (options && options.replace) $window.history.replaceState(state, title, router.prefix + path)
|
1649 |
-
else $window.history.pushState(state, title, router.prefix + path)
|
1650 |
}
|
1651 |
-
|
1652 |
}
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
var
|
1657 |
-
var
|
1658 |
-
var
|
1659 |
-
|
1660 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1661 |
}
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
|
|
|
|
|
|
|
|
1674 |
}
|
1675 |
}
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1704 |
}
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
|
|
|
|
|
|
|
|
|
|
1711 |
}
|
1712 |
-
else update(payload, "div")
|
1713 |
}
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
route.param = function(key3) {
|
1739 |
-
if(typeof attrs3 !== "undefined" && typeof key3 !== "undefined") return attrs3[key3]
|
1740 |
-
return attrs3
|
1741 |
-
}
|
1742 |
-
return route
|
1743 |
-
}
|
1744 |
-
m.route = _20(window, redrawService)
|
1745 |
-
m.withAttr = function(attrName, callback1, context) {
|
1746 |
-
return function(e) {
|
1747 |
-
callback1.call(context || this, attrName in e.currentTarget ? e.currentTarget[attrName] : e.currentTarget.getAttribute(attrName))
|
1748 |
}
|
1749 |
}
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
if (typeof module !== "undefined") module["exports"] = m
|
1760 |
-
else window.m = m
|
1761 |
-
}());
|
1762 |
-
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
|
1763 |
-
},{"timers":10}],9:[function(require,module,exports){
|
1764 |
// shim for using process in browser
|
1765 |
var process = module.exports = {};
|
1766 |
|
@@ -1946,7 +2817,7 @@ process.chdir = function (dir) {
|
|
1946 |
};
|
1947 |
process.umask = function() { return 0; };
|
1948 |
|
1949 |
-
},{}],
|
1950 |
(function (setImmediate,clearImmediate){
|
1951 |
var nextTick = require('process/browser.js').nextTick;
|
1952 |
var apply = Function.prototype.apply;
|
@@ -2025,7 +2896,7 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate :
|
|
2025 |
delete immediateIds[id];
|
2026 |
};
|
2027 |
}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
|
2028 |
-
},{"process/browser.js":
|
2029 |
function tlite(getTooltipOpts) {
|
2030 |
document.addEventListener('mouseover', function (e) {
|
2031 |
var el = e.target;
|
@@ -2161,493 +3032,5 @@ if (typeof module !== 'undefined' && module.exports) {
|
|
2161 |
module.exports = tlite;
|
2162 |
}
|
2163 |
|
2164 |
-
},{}],12:[function(require,module,exports){
|
2165 |
-
/*!
|
2166 |
-
* EventEmitter v5.2.6 - git.io/ee
|
2167 |
-
* Unlicense - http://unlicense.org/
|
2168 |
-
* Oliver Caldwell - https://oli.me.uk/
|
2169 |
-
* @preserve
|
2170 |
-
*/
|
2171 |
-
|
2172 |
-
;(function (exports) {
|
2173 |
-
'use strict';
|
2174 |
-
|
2175 |
-
/**
|
2176 |
-
* Class for managing events.
|
2177 |
-
* Can be extended to provide event functionality in other classes.
|
2178 |
-
*
|
2179 |
-
* @class EventEmitter Manages event registering and emitting.
|
2180 |
-
*/
|
2181 |
-
function EventEmitter() {}
|
2182 |
-
|
2183 |
-
// Shortcuts to improve speed and size
|
2184 |
-
var proto = EventEmitter.prototype;
|
2185 |
-
var originalGlobalValue = exports.EventEmitter;
|
2186 |
-
|
2187 |
-
/**
|
2188 |
-
* Finds the index of the listener for the event in its storage array.
|
2189 |
-
*
|
2190 |
-
* @param {Function[]} listeners Array of listeners to search through.
|
2191 |
-
* @param {Function} listener Method to look for.
|
2192 |
-
* @return {Number} Index of the specified listener, -1 if not found
|
2193 |
-
* @api private
|
2194 |
-
*/
|
2195 |
-
function indexOfListener(listeners, listener) {
|
2196 |
-
var i = listeners.length;
|
2197 |
-
while (i--) {
|
2198 |
-
if (listeners[i].listener === listener) {
|
2199 |
-
return i;
|
2200 |
-
}
|
2201 |
-
}
|
2202 |
-
|
2203 |
-
return -1;
|
2204 |
-
}
|
2205 |
-
|
2206 |
-
/**
|
2207 |
-
* Alias a method while keeping the context correct, to allow for overwriting of target method.
|
2208 |
-
*
|
2209 |
-
* @param {String} name The name of the target method.
|
2210 |
-
* @return {Function} The aliased method
|
2211 |
-
* @api private
|
2212 |
-
*/
|
2213 |
-
function alias(name) {
|
2214 |
-
return function aliasClosure() {
|
2215 |
-
return this[name].apply(this, arguments);
|
2216 |
-
};
|
2217 |
-
}
|
2218 |
-
|
2219 |
-
/**
|
2220 |
-
* Returns the listener array for the specified event.
|
2221 |
-
* Will initialise the event object and listener arrays if required.
|
2222 |
-
* 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.
|
2223 |
-
* Each property in the object response is an array of listener functions.
|
2224 |
-
*
|
2225 |
-
* @param {String|RegExp} evt Name of the event to return the listeners from.
|
2226 |
-
* @return {Function[]|Object} All listener functions for the event.
|
2227 |
-
*/
|
2228 |
-
proto.getListeners = function getListeners(evt) {
|
2229 |
-
var events = this._getEvents();
|
2230 |
-
var response;
|
2231 |
-
var key;
|
2232 |
-
|
2233 |
-
// Return a concatenated array of all matching events if
|
2234 |
-
// the selector is a regular expression.
|
2235 |
-
if (evt instanceof RegExp) {
|
2236 |
-
response = {};
|
2237 |
-
for (key in events) {
|
2238 |
-
if (events.hasOwnProperty(key) && evt.test(key)) {
|
2239 |
-
response[key] = events[key];
|
2240 |
-
}
|
2241 |
-
}
|
2242 |
-
}
|
2243 |
-
else {
|
2244 |
-
response = events[evt] || (events[evt] = []);
|
2245 |
-
}
|
2246 |
-
|
2247 |
-
return response;
|
2248 |
-
};
|
2249 |
-
|
2250 |
-
/**
|
2251 |
-
* Takes a list of listener objects and flattens it into a list of listener functions.
|
2252 |
-
*
|
2253 |
-
* @param {Object[]} listeners Raw listener objects.
|
2254 |
-
* @return {Function[]} Just the listener functions.
|
2255 |
-
*/
|
2256 |
-
proto.flattenListeners = function flattenListeners(listeners) {
|
2257 |
-
var flatListeners = [];
|
2258 |
-
var i;
|
2259 |
-
|
2260 |
-
for (i = 0; i < listeners.length; i += 1) {
|
2261 |
-
flatListeners.push(listeners[i].listener);
|
2262 |
-
}
|
2263 |
-
|
2264 |
-
return flatListeners;
|
2265 |
-
};
|
2266 |
-
|
2267 |
-
/**
|
2268 |
-
* 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.
|
2269 |
-
*
|
2270 |
-
* @param {String|RegExp} evt Name of the event to return the listeners from.
|
2271 |
-
* @return {Object} All listener functions for an event in an object.
|
2272 |
-
*/
|
2273 |
-
proto.getListenersAsObject = function getListenersAsObject(evt) {
|
2274 |
-
var listeners = this.getListeners(evt);
|
2275 |
-
var response;
|
2276 |
-
|
2277 |
-
if (listeners instanceof Array) {
|
2278 |
-
response = {};
|
2279 |
-
response[evt] = listeners;
|
2280 |
-
}
|
2281 |
-
|
2282 |
-
return response || listeners;
|
2283 |
-
};
|
2284 |
-
|
2285 |
-
function isValidListener (listener) {
|
2286 |
-
if (typeof listener === 'function' || listener instanceof RegExp) {
|
2287 |
-
return true
|
2288 |
-
} else if (listener && typeof listener === 'object') {
|
2289 |
-
return isValidListener(listener.listener)
|
2290 |
-
} else {
|
2291 |
-
return false
|
2292 |
-
}
|
2293 |
-
}
|
2294 |
-
|
2295 |
-
/**
|
2296 |
-
* Adds a listener function to the specified event.
|
2297 |
-
* The listener will not be added if it is a duplicate.
|
2298 |
-
* If the listener returns true then it will be removed after it is called.
|
2299 |
-
* If you pass a regular expression as the event name then the listener will be added to all events that match it.
|
2300 |
-
*
|
2301 |
-
* @param {String|RegExp} evt Name of the event to attach the listener to.
|
2302 |
-
* @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
|
2303 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
2304 |
-
*/
|
2305 |
-
proto.addListener = function addListener(evt, listener) {
|
2306 |
-
if (!isValidListener(listener)) {
|
2307 |
-
throw new TypeError('listener must be a function');
|
2308 |
-
}
|
2309 |
-
|
2310 |
-
var listeners = this.getListenersAsObject(evt);
|
2311 |
-
var listenerIsWrapped = typeof listener === 'object';
|
2312 |
-
var key;
|
2313 |
-
|
2314 |
-
for (key in listeners) {
|
2315 |
-
if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {
|
2316 |
-
listeners[key].push(listenerIsWrapped ? listener : {
|
2317 |
-
listener: listener,
|
2318 |
-
once: false
|
2319 |
-
});
|
2320 |
-
}
|
2321 |
-
}
|
2322 |
-
|
2323 |
-
return this;
|
2324 |
-
};
|
2325 |
-
|
2326 |
-
/**
|
2327 |
-
* Alias of addListener
|
2328 |
-
*/
|
2329 |
-
proto.on = alias('addListener');
|
2330 |
-
|
2331 |
-
/**
|
2332 |
-
* Semi-alias of addListener. It will add a listener that will be
|
2333 |
-
* automatically removed after its first execution.
|
2334 |
-
*
|
2335 |
-
* @param {String|RegExp} evt Name of the event to attach the listener to.
|
2336 |
-
* @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
|
2337 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
2338 |
-
*/
|
2339 |
-
proto.addOnceListener = function addOnceListener(evt, listener) {
|
2340 |
-
return this.addListener(evt, {
|
2341 |
-
listener: listener,
|
2342 |
-
once: true
|
2343 |
-
});
|
2344 |
-
};
|
2345 |
-
|
2346 |
-
/**
|
2347 |
-
* Alias of addOnceListener.
|
2348 |
-
*/
|
2349 |
-
proto.once = alias('addOnceListener');
|
2350 |
-
|
2351 |
-
/**
|
2352 |
-
* 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.
|
2353 |
-
* You need to tell it what event names should be matched by a regex.
|
2354 |
-
*
|
2355 |
-
* @param {String} evt Name of the event to create.
|
2356 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
2357 |
-
*/
|
2358 |
-
proto.defineEvent = function defineEvent(evt) {
|
2359 |
-
this.getListeners(evt);
|
2360 |
-
return this;
|
2361 |
-
};
|
2362 |
-
|
2363 |
-
/**
|
2364 |
-
* Uses defineEvent to define multiple events.
|
2365 |
-
*
|
2366 |
-
* @param {String[]} evts An array of event names to define.
|
2367 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
2368 |
-
*/
|
2369 |
-
proto.defineEvents = function defineEvents(evts) {
|
2370 |
-
for (var i = 0; i < evts.length; i += 1) {
|
2371 |
-
this.defineEvent(evts[i]);
|
2372 |
-
}
|
2373 |
-
return this;
|
2374 |
-
};
|
2375 |
-
|
2376 |
-
/**
|
2377 |
-
* Removes a listener function from the specified event.
|
2378 |
-
* When passed a regular expression as the event name, it will remove the listener from all events that match it.
|
2379 |
-
*
|
2380 |
-
* @param {String|RegExp} evt Name of the event to remove the listener from.
|
2381 |
-
* @param {Function} listener Method to remove from the event.
|
2382 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
2383 |
-
*/
|
2384 |
-
proto.removeListener = function removeListener(evt, listener) {
|
2385 |
-
var listeners = this.getListenersAsObject(evt);
|
2386 |
-
var index;
|
2387 |
-
var key;
|
2388 |
-
|
2389 |
-
for (key in listeners) {
|
2390 |
-
if (listeners.hasOwnProperty(key)) {
|
2391 |
-
index = indexOfListener(listeners[key], listener);
|
2392 |
-
|
2393 |
-
if (index !== -1) {
|
2394 |
-
listeners[key].splice(index, 1);
|
2395 |
-
}
|
2396 |
-
}
|
2397 |
-
}
|
2398 |
-
|
2399 |
-
return this;
|
2400 |
-
};
|
2401 |
-
|
2402 |
-
/**
|
2403 |
-
* Alias of removeListener
|
2404 |
-
*/
|
2405 |
-
proto.off = alias('removeListener');
|
2406 |
-
|
2407 |
-
/**
|
2408 |
-
* Adds listeners in bulk using the manipulateListeners method.
|
2409 |
-
* If you pass an object as the first 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.
|
2410 |
-
* You can also pass it a regular expression to add the array of listeners to all events that match it.
|
2411 |
-
* Yeah, this function does quite a bit. That's probably a bad thing.
|
2412 |
-
*
|
2413 |
-
* @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.
|
2414 |
-
* @param {Function[]} [listeners] An optional array of listener functions to add.
|
2415 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
2416 |
-
*/
|
2417 |
-
proto.addListeners = function addListeners(evt, listeners) {
|
2418 |
-
// Pass through to manipulateListeners
|
2419 |
-
return this.manipulateListeners(false, evt, listeners);
|
2420 |
-
};
|
2421 |
-
|
2422 |
-
/**
|
2423 |
-
* Removes listeners in bulk using the manipulateListeners method.
|
2424 |
-
* If you pass an object as the first argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
|
2425 |
-
* You can also pass it an event name and an array of listeners to be removed.
|
2426 |
-
* You can also pass it a regular expression to remove the listeners from all events that match it.
|
2427 |
-
*
|
2428 |
-
* @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.
|
2429 |
-
* @param {Function[]} [listeners] An optional array of listener functions to remove.
|
2430 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
2431 |
-
*/
|
2432 |
-
proto.removeListeners = function removeListeners(evt, listeners) {
|
2433 |
-
// Pass through to manipulateListeners
|
2434 |
-
return this.manipulateListeners(true, evt, listeners);
|
2435 |
-
};
|
2436 |
-
|
2437 |
-
/**
|
2438 |
-
* 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.
|
2439 |
-
* The first argument will determine if the listeners are removed (true) or added (false).
|
2440 |
-
* 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.
|
2441 |
-
* You can also pass it an event name and an array of listeners to be added/removed.
|
2442 |
-
* You can also pass it a regular expression to manipulate the listeners of all events that match it.
|
2443 |
-
*
|
2444 |
-
* @param {Boolean} remove True if you want to remove listeners, false if you want to add.
|
2445 |
-
* @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.
|
2446 |
-
* @param {Function[]} [listeners] An optional array of listener functions to add/remove.
|
2447 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
2448 |
-
*/
|
2449 |
-
proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {
|
2450 |
-
var i;
|
2451 |
-
var value;
|
2452 |
-
var single = remove ? this.removeListener : this.addListener;
|
2453 |
-
var multiple = remove ? this.removeListeners : this.addListeners;
|
2454 |
-
|
2455 |
-
// If evt is an object then pass each of its properties to this method
|
2456 |
-
if (typeof evt === 'object' && !(evt instanceof RegExp)) {
|
2457 |
-
for (i in evt) {
|
2458 |
-
if (evt.hasOwnProperty(i) && (value = evt[i])) {
|
2459 |
-
// Pass the single listener straight through to the singular method
|
2460 |
-
if (typeof value === 'function') {
|
2461 |
-
single.call(this, i, value);
|
2462 |
-
}
|
2463 |
-
else {
|
2464 |
-
// Otherwise pass back to the multiple function
|
2465 |
-
multiple.call(this, i, value);
|
2466 |
-
}
|
2467 |
-
}
|
2468 |
-
}
|
2469 |
-
}
|
2470 |
-
else {
|
2471 |
-
// So evt must be a string
|
2472 |
-
// And listeners must be an array of listeners
|
2473 |
-
// Loop over it and pass each one to the multiple method
|
2474 |
-
i = listeners.length;
|
2475 |
-
while (i--) {
|
2476 |
-
single.call(this, evt, listeners[i]);
|
2477 |
-
}
|
2478 |
-
}
|
2479 |
-
|
2480 |
-
return this;
|
2481 |
-
};
|
2482 |
-
|
2483 |
-
/**
|
2484 |
-
* Removes all listeners from a specified event.
|
2485 |
-
* If you do not specify an event then all listeners will be removed.
|
2486 |
-
* That means every event will be emptied.
|
2487 |
-
* You can also pass a regex to remove all events that match it.
|
2488 |
-
*
|
2489 |
-
* @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.
|
2490 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
2491 |
-
*/
|
2492 |
-
proto.removeEvent = function removeEvent(evt) {
|
2493 |
-
var type = typeof evt;
|
2494 |
-
var events = this._getEvents();
|
2495 |
-
var key;
|
2496 |
-
|
2497 |
-
// Remove different things depending on the state of evt
|
2498 |
-
if (type === 'string') {
|
2499 |
-
// Remove all listeners for the specified event
|
2500 |
-
delete events[evt];
|
2501 |
-
}
|
2502 |
-
else if (evt instanceof RegExp) {
|
2503 |
-
// Remove all events matching the regex.
|
2504 |
-
for (key in events) {
|
2505 |
-
if (events.hasOwnProperty(key) && evt.test(key)) {
|
2506 |
-
delete events[key];
|
2507 |
-
}
|
2508 |
-
}
|
2509 |
-
}
|
2510 |
-
else {
|
2511 |
-
// Remove all listeners in all events
|
2512 |
-
delete this._events;
|
2513 |
-
}
|
2514 |
-
|
2515 |
-
return this;
|
2516 |
-
};
|
2517 |
-
|
2518 |
-
/**
|
2519 |
-
* Alias of removeEvent.
|
2520 |
-
*
|
2521 |
-
* Added to mirror the node API.
|
2522 |
-
*/
|
2523 |
-
proto.removeAllListeners = alias('removeEvent');
|
2524 |
-
|
2525 |
-
/**
|
2526 |
-
* Emits an event of your choice.
|
2527 |
-
* When emitted, every listener attached to that event will be executed.
|
2528 |
-
* If you pass the optional argument array then those arguments will be passed to every listener upon execution.
|
2529 |
-
* Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
|
2530 |
-
* So they will not arrive within the array on the other side, they will be separate.
|
2531 |
-
* You can also pass a regular expression to emit to all events that match it.
|
2532 |
-
*
|
2533 |
-
* @param {String|RegExp} evt Name of the event to emit and execute listeners for.
|
2534 |
-
* @param {Array} [args] Optional array of arguments to be passed to each listener.
|
2535 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
2536 |
-
*/
|
2537 |
-
proto.emitEvent = function emitEvent(evt, args) {
|
2538 |
-
var listenersMap = this.getListenersAsObject(evt);
|
2539 |
-
var listeners;
|
2540 |
-
var listener;
|
2541 |
-
var i;
|
2542 |
-
var key;
|
2543 |
-
var response;
|
2544 |
-
|
2545 |
-
for (key in listenersMap) {
|
2546 |
-
if (listenersMap.hasOwnProperty(key)) {
|
2547 |
-
listeners = listenersMap[key].slice(0);
|
2548 |
-
|
2549 |
-
for (i = 0; i < listeners.length; i++) {
|
2550 |
-
// If the listener returns true then it shall be removed from the event
|
2551 |
-
// The function is executed either with a basic call or an apply if there is an args array
|
2552 |
-
listener = listeners[i];
|
2553 |
-
|
2554 |
-
if (listener.once === true) {
|
2555 |
-
this.removeListener(evt, listener.listener);
|
2556 |
-
}
|
2557 |
-
|
2558 |
-
response = listener.listener.apply(this, args || []);
|
2559 |
-
|
2560 |
-
if (response === this._getOnceReturnValue()) {
|
2561 |
-
this.removeListener(evt, listener.listener);
|
2562 |
-
}
|
2563 |
-
}
|
2564 |
-
}
|
2565 |
-
}
|
2566 |
-
|
2567 |
-
return this;
|
2568 |
-
};
|
2569 |
-
|
2570 |
-
/**
|
2571 |
-
* Alias of emitEvent
|
2572 |
-
*/
|
2573 |
-
proto.trigger = alias('emitEvent');
|
2574 |
-
|
2575 |
-
/**
|
2576 |
-
* 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.
|
2577 |
-
* As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.
|
2578 |
-
*
|
2579 |
-
* @param {String|RegExp} evt Name of the event to emit and execute listeners for.
|
2580 |
-
* @param {...*} Optional additional arguments to be passed to each listener.
|
2581 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
2582 |
-
*/
|
2583 |
-
proto.emit = function emit(evt) {
|
2584 |
-
var args = Array.prototype.slice.call(arguments, 1);
|
2585 |
-
return this.emitEvent(evt, args);
|
2586 |
-
};
|
2587 |
-
|
2588 |
-
/**
|
2589 |
-
* Sets the current value to check against when executing listeners. If a
|
2590 |
-
* listeners return value matches the one set here then it will be removed
|
2591 |
-
* after execution. This value defaults to true.
|
2592 |
-
*
|
2593 |
-
* @param {*} value The new value to check for when executing listeners.
|
2594 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
2595 |
-
*/
|
2596 |
-
proto.setOnceReturnValue = function setOnceReturnValue(value) {
|
2597 |
-
this._onceReturnValue = value;
|
2598 |
-
return this;
|
2599 |
-
};
|
2600 |
-
|
2601 |
-
/**
|
2602 |
-
* Fetches the current value to check against when executing listeners. If
|
2603 |
-
* the listeners return value matches this one then it should be removed
|
2604 |
-
* automatically. It will return true by default.
|
2605 |
-
*
|
2606 |
-
* @return {*|Boolean} The current value to check for or the default, true.
|
2607 |
-
* @api private
|
2608 |
-
*/
|
2609 |
-
proto._getOnceReturnValue = function _getOnceReturnValue() {
|
2610 |
-
if (this.hasOwnProperty('_onceReturnValue')) {
|
2611 |
-
return this._onceReturnValue;
|
2612 |
-
}
|
2613 |
-
else {
|
2614 |
-
return true;
|
2615 |
-
}
|
2616 |
-
};
|
2617 |
-
|
2618 |
-
/**
|
2619 |
-
* Fetches the events object and creates one if required.
|
2620 |
-
*
|
2621 |
-
* @return {Object} The events storage object.
|
2622 |
-
* @api private
|
2623 |
-
*/
|
2624 |
-
proto._getEvents = function _getEvents() {
|
2625 |
-
return this._events || (this._events = {});
|
2626 |
-
};
|
2627 |
-
|
2628 |
-
/**
|
2629 |
-
* Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.
|
2630 |
-
*
|
2631 |
-
* @return {Function} Non conflicting EventEmitter class.
|
2632 |
-
*/
|
2633 |
-
EventEmitter.noConflict = function noConflict() {
|
2634 |
-
exports.EventEmitter = originalGlobalValue;
|
2635 |
-
return EventEmitter;
|
2636 |
-
};
|
2637 |
-
|
2638 |
-
// Expose the class either via AMD, CommonJS or the global object
|
2639 |
-
if (typeof define === 'function' && define.amd) {
|
2640 |
-
define(function () {
|
2641 |
-
return EventEmitter;
|
2642 |
-
});
|
2643 |
-
}
|
2644 |
-
else if (typeof module === 'object' && module.exports){
|
2645 |
-
module.exports = EventEmitter;
|
2646 |
-
}
|
2647 |
-
else {
|
2648 |
-
exports.EventEmitter = EventEmitter;
|
2649 |
-
}
|
2650 |
-
}(typeof window !== 'undefined' ? window : this || {}));
|
2651 |
-
|
2652 |
},{}]},{},[1]);
|
2653 |
})();
|
5 |
|
6 |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7 |
|
8 |
+
var tabs = require('./admin/tabs.js');
|
9 |
|
10 |
+
var settings = require('./admin/settings.js');
|
11 |
|
12 |
+
var helpers = require('./admin/helpers.js');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
(0, _tlite["default"])(function (el) {
|
15 |
return el.className.indexOf('mc4wp-tooltip') > -1;
|
16 |
+
});
|
17 |
|
18 |
+
require('./admin/list-fetcher.js');
|
19 |
|
20 |
+
require('./admin/fields/mailchimp-api-key.js');
|
21 |
|
22 |
+
require('./admin/list-overview.js');
|
|
|
|
|
23 |
|
24 |
+
require('./admin/show-if.js'); // expose some things
|
25 |
|
26 |
|
27 |
window.mc4wp = window.mc4wp || {};
|
|
|
|
|
28 |
window.mc4wp.helpers = helpers;
|
|
|
29 |
window.mc4wp.settings = settings;
|
30 |
window.mc4wp.tabs = tabs;
|
31 |
|
32 |
+
},{"./admin/fields/mailchimp-api-key.js":2,"./admin/helpers.js":3,"./admin/list-fetcher.js":4,"./admin/list-overview.js":5,"./admin/settings.js":6,"./admin/show-if.js":7,"./admin/tabs.js":8,"tlite":35}],2:[function(require,module,exports){
|
33 |
'use strict';
|
34 |
|
|
|
|
|
35 |
function validate(evt) {
|
36 |
var node = document.createElement('p');
|
37 |
node.className = 'help red';
|
46 |
}
|
47 |
}
|
48 |
|
49 |
+
var field = document.getElementById('mailchimp_api_key');
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
+
if (field) {
|
52 |
field.addEventListener('change', validate);
|
53 |
+
}
|
54 |
|
55 |
},{}],3:[function(require,module,exports){
|
56 |
'use strict';
|
57 |
|
58 |
+
var helpers = {}; // polling
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
helpers.debounce = function (func, wait, immediate) {
|
61 |
var timeout;
|
62 |
return function () {
|
63 |
var context = this,
|
64 |
args = arguments;
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
var callNow = immediate && !timeout;
|
66 |
clearTimeout(timeout);
|
67 |
+
timeout = setTimeout(function () {
|
68 |
+
timeout = null;
|
69 |
+
if (!immediate) func.apply(context, args);
|
70 |
+
}, wait);
|
71 |
if (callNow) func.apply(context, args);
|
72 |
};
|
73 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
module.exports = helpers;
|
76 |
|
77 |
},{}],4:[function(require,module,exports){
|
78 |
'use strict';
|
79 |
|
80 |
+
var config = window.mc4wp_vars;
|
81 |
+
var i18n = window.mc4wp_vars.i18n;
|
82 |
+
var ajaxurl = window.mc4wp_vars.ajaxurl;
|
83 |
|
84 |
+
var m = require('mithril');
|
|
|
|
|
85 |
|
86 |
+
var state = {
|
87 |
+
working: false,
|
88 |
+
done: false,
|
89 |
+
success: false
|
90 |
+
};
|
91 |
|
92 |
+
function fetch(evt) {
|
93 |
+
evt && evt.preventDefault();
|
94 |
+
state.working = true;
|
95 |
+
state.done = false;
|
96 |
+
m.request({
|
97 |
+
method: "POST",
|
98 |
+
url: ajaxurl + "?action=mc4wp_renew_mailchimp_lists",
|
99 |
timeout: 600000 // 10 minutes, matching max_execution_time
|
100 |
|
101 |
+
}).then(function (data) {
|
102 |
+
state.success = true;
|
103 |
|
104 |
if (data) {
|
105 |
window.setTimeout(function () {
|
106 |
window.location.reload();
|
107 |
}, 3000);
|
108 |
}
|
109 |
+
})["catch"](function (data) {
|
110 |
+
state.success = false;
|
111 |
+
})["finally"](function (data) {
|
112 |
+
state.working = false;
|
113 |
+
state.done = true;
|
114 |
m.redraw();
|
115 |
+
});
|
116 |
+
}
|
117 |
|
118 |
+
function view() {
|
119 |
return m('form', {
|
120 |
method: "POST",
|
121 |
+
onsubmit: fetch.bind(this)
|
122 |
}, [m('p', [m('input', {
|
123 |
type: "submit",
|
124 |
+
value: state.working ? i18n.fetching_mailchimp_lists : i18n.renew_mailchimp_lists,
|
125 |
className: "button",
|
126 |
+
disabled: !!state.working
|
127 |
+
}), m.trust(' '), state.working ? [m('span.mc4wp-loader', "Loading..."), m.trust(' ')] : '', state.done ? [state.success ? m('em.help.green', i18n.fetching_mailchimp_lists_done) : m('em.help.red', i18n.fetching_mailchimp_lists_error)] : ''])]);
|
128 |
+
}
|
|
|
|
|
129 |
|
130 |
+
var mount = document.getElementById('mc4wp-list-fetcher');
|
|
|
131 |
|
132 |
+
if (mount) {
|
133 |
+
// start fetching right away when no lists but api key given
|
134 |
+
if (config.mailchimp.api_connected && config.mailchimp.lists.length === 0) {
|
135 |
+
fetch();
|
136 |
+
}
|
137 |
|
138 |
+
m.mount(mount, {
|
139 |
+
view: view
|
140 |
+
});
|
141 |
+
}
|
142 |
|
143 |
+
},{"mithril":13}],5:[function(require,module,exports){
|
144 |
+
'use strict';
|
|
|
|
|
145 |
|
146 |
+
var ajaxurl = window.mc4wp_vars.ajaxurl;
|
|
|
|
|
|
|
|
|
147 |
|
148 |
+
var m = require('mithril');
|
|
|
|
|
149 |
|
150 |
+
if (!Element.prototype.matches) {
|
151 |
+
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
152 |
+
}
|
|
|
|
|
|
|
|
|
153 |
|
154 |
+
function showDetails(evt) {
|
155 |
+
evt.preventDefault();
|
156 |
+
var link = evt.target;
|
157 |
+
var next = link.parentElement.parentElement.nextElementSibling;
|
158 |
+
var listID = link.getAttribute('data-list-id');
|
159 |
+
var mount = next.querySelector('div');
|
160 |
+
|
161 |
+
if (next.style.display === 'none') {
|
162 |
+
m.request({
|
163 |
+
method: "GET",
|
164 |
+
url: ajaxurl + "?action=mc4wp_get_list_details&ids=" + listID
|
165 |
+
}).then(function (details) {
|
166 |
+
m.render(mount, view(details.shift()));
|
167 |
});
|
168 |
+
next.style.display = '';
|
169 |
+
} else {
|
170 |
+
next.style.display = 'none';
|
171 |
}
|
172 |
+
}
|
173 |
|
174 |
+
function view(data) {
|
175 |
+
return [m('h3', 'Merge fields'), m('table.widefat.striped', [m('thead', [m('tr', [m('th', 'Name'), m('th', 'Tag'), m('th', 'Type')])]), m('tbody', data.merge_fields.map(function (f) {
|
176 |
+
return m('tr', [m('td', [f.name, f.required && m('span.red', '*')]), m('td', [m('code', f.tag)]), m('td', [f.type, ' ', f.options && f.options.date_format ? '(' + f.options.date_format + ')' : '', f.options && f.options.choices ? '(' + f.options.choices.join(', ') + ')' : ''])]);
|
177 |
+
}))]), data.interest_categories.length > 0 && [m('h3', 'Interest Categories'), m('table.striped.widefat', [m('thead', [m('tr', [m('th', 'Name'), m('th', 'Type'), m('th', 'Interests')])]), m('tbody', data.interest_categories.map(function (f) {
|
178 |
+
return m('tr', [m('td', [m('strong', f.title), m('br'), m('br'), 'ID: ', m('code', f.id)]), m('td', f.type), m('td', [m('div.row', {
|
179 |
+
style: 'margin-bottom: 4px;'
|
180 |
+
}, [m('div.col.col-3', [m('strong', {
|
181 |
+
style: 'display: block; border-bottom: 1px solid #eee;'
|
182 |
+
}, 'Name')]), m('div.col.col-3', [m('strong', {
|
183 |
+
style: 'display: block; border-bottom: 1px solid #eee;'
|
184 |
+
}, 'ID')])]), Object.keys(f.interests).map(function (id) {
|
185 |
+
return m('div.row.tiny-margin', [m('div.col.col-3', f.interests[id]), m('div.col.col-3', [m('code', {
|
186 |
+
title: 'Interest ID'
|
187 |
+
}, id)]), m('br.clearfix.clear.cf')]);
|
188 |
+
})])]);
|
189 |
+
}))])]];
|
190 |
+
}
|
191 |
|
192 |
+
var table = document.getElementById('mc4wp-mailchimp-lists-overview');
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
|
194 |
+
if (table) {
|
195 |
+
table.addEventListener('click', function (evt) {
|
196 |
+
if (!evt.target.matches('.mc4wp-mailchimp-list')) {
|
197 |
+
return;
|
198 |
+
}
|
|
|
|
|
199 |
|
200 |
+
showDetails(evt);
|
201 |
+
});
|
202 |
+
}
|
203 |
|
204 |
+
},{"mithril":13}],6:[function(require,module,exports){
|
205 |
'use strict';
|
206 |
|
207 |
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
|
208 |
|
209 |
+
var context = document.getElementById('mc4wp-admin');
|
210 |
+
var listInputs = context.querySelectorAll('.mc4wp-list-input');
|
211 |
+
var lists = window.mc4wp_vars.mailchimp.lists;
|
212 |
+
var selectedLists = [];
|
213 |
+
var listeners = {}; // functions
|
214 |
+
|
215 |
+
function getSelectedListsWhere(searchKey, searchValue) {
|
216 |
+
return selectedLists.filter(function (el) {
|
217 |
+
return el[searchKey] === searchValue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
});
|
219 |
+
}
|
220 |
|
221 |
+
function getSelectedLists() {
|
222 |
+
return selectedLists;
|
223 |
+
}
|
|
|
|
|
|
|
224 |
|
225 |
+
function updateSelectedLists() {
|
226 |
+
selectedLists = [];
|
227 |
+
[].forEach.call(listInputs, function (input) {
|
228 |
+
// skip unchecked checkboxes
|
229 |
+
if (typeof input.checked === "boolean" && !input.checked) {
|
230 |
+
return;
|
231 |
+
}
|
232 |
|
233 |
+
if (_typeof(lists[input.value]) === "object") {
|
234 |
+
selectedLists.push(lists[input.value]);
|
|
|
|
|
235 |
}
|
236 |
+
});
|
237 |
+
toggleVisibleLists();
|
238 |
+
emit('selectedLists.change', [selectedLists]);
|
239 |
+
return selectedLists;
|
240 |
+
}
|
241 |
|
242 |
+
function toggleVisibleLists() {
|
243 |
+
var rows = document.querySelectorAll('.lists--only-selected > *');
|
244 |
+
[].forEach.call(rows, function (el) {
|
245 |
+
var listId = el.getAttribute('data-list-id');
|
246 |
+
var isSelected = getSelectedListsWhere('id', listId).length > 0;
|
247 |
+
el.style.display = isSelected ? '' : 'none';
|
248 |
+
});
|
249 |
+
}
|
250 |
|
251 |
+
function emit(event, args) {
|
252 |
+
listeners[event] = listeners[event] || [];
|
253 |
+
listeners[event].forEach(function (f) {
|
254 |
+
return f.apply(null, args);
|
255 |
+
});
|
256 |
+
}
|
257 |
+
|
258 |
+
function on(event, func) {
|
259 |
+
listeners[event] = listeners[event] || [];
|
260 |
+
listeners[event].push(func);
|
261 |
+
}
|
262 |
+
|
263 |
+
[].forEach.call(listInputs, function (el) {
|
264 |
+
el.addEventListener('change', updateSelectedLists);
|
265 |
+
});
|
266 |
+
updateSelectedLists();
|
267 |
+
module.exports = {
|
268 |
+
getSelectedLists: getSelectedLists,
|
269 |
+
on: on
|
270 |
+
};
|
271 |
+
|
272 |
+
},{}],7:[function(require,module,exports){
|
273 |
+
'use strict';
|
274 |
|
275 |
+
var showIfElements = document.querySelectorAll('[data-showif]');
|
276 |
+
[].forEach.call(showIfElements, function (element) {
|
277 |
+
var config = JSON.parse(element.getAttribute('data-showif'));
|
278 |
+
var parentElements = document.querySelectorAll('[name="' + config.element + '"]');
|
279 |
+
var inputs = element.querySelectorAll('input,select,textarea:not([readonly])');
|
280 |
+
var hide = config.hide === undefined || config.hide;
|
281 |
|
282 |
+
function toggleElement() {
|
283 |
+
// do nothing with unchecked radio inputs
|
284 |
+
if (this.getAttribute('type') === "radio" && !this.checked) {
|
285 |
+
return;
|
286 |
+
}
|
287 |
|
288 |
+
var value = this.getAttribute("type") === "checkbox" ? this.checked : this.value;
|
289 |
+
var conditionMet = value == config.value;
|
290 |
|
291 |
+
if (hide) {
|
292 |
+
element.style.display = conditionMet ? '' : 'none';
|
293 |
+
element.style.visibility = conditionMet ? '' : 'hidden';
|
294 |
+
} else {
|
295 |
+
element.style.opacity = conditionMet ? '' : '0.4';
|
296 |
+
} // disable input fields to stop sending their values to server
|
297 |
|
|
|
|
|
298 |
|
299 |
+
[].forEach.call(inputs, function (inputElement) {
|
300 |
+
conditionMet ? inputElement.removeAttribute('readonly') : inputElement.setAttribute('readonly', 'readonly');
|
301 |
+
});
|
302 |
+
} // find checked element and call toggleElement function
|
303 |
|
|
|
|
|
|
|
304 |
|
305 |
+
[].forEach.call(parentElements, function (el) {
|
306 |
+
el.addEventListener('change', toggleElement);
|
307 |
+
toggleElement.call(el);
|
308 |
+
});
|
309 |
+
});
|
310 |
|
311 |
+
},{}],8:[function(require,module,exports){
|
312 |
+
'use strict';
|
313 |
|
314 |
+
var URL = require('./url.js');
|
315 |
|
316 |
+
var context = document.getElementById('mc4wp-admin');
|
317 |
+
var tabElements = context.querySelectorAll('.tab');
|
318 |
+
var tabNavElements = context.querySelectorAll('.nav-tab');
|
319 |
+
var refererField = context.querySelector('input[name="_wp_http_referer"]');
|
320 |
+
var tabs = [];
|
321 |
|
322 |
+
if (!Element.prototype.matches) {
|
323 |
+
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
324 |
+
}
|
325 |
|
326 |
+
[].forEach.call(tabElements, function (t, i) {
|
327 |
+
var id = t.id.substring(4);
|
328 |
+
var title = t.querySelector('h2:first-of-type').textContent;
|
329 |
+
tabs.push({
|
330 |
+
id: id,
|
331 |
+
title: title,
|
332 |
+
element: t,
|
333 |
+
nav: context.querySelectorAll('.nav-tab-' + id),
|
334 |
+
open: function open() {
|
335 |
+
return _open(id);
|
336 |
}
|
337 |
+
});
|
338 |
+
});
|
339 |
|
340 |
+
function get(id) {
|
341 |
+
for (var i = 0; i < tabs.length; i++) {
|
342 |
+
if (tabs[i].id === id) {
|
343 |
+
return tabs[i];
|
344 |
+
}
|
345 |
}
|
346 |
|
347 |
+
return null;
|
348 |
+
}
|
349 |
+
|
350 |
+
function _open(tab, updateState) {
|
351 |
+
// make sure we have a tab object
|
352 |
+
if (typeof tab === "string") {
|
353 |
+
tab = get(tab);
|
354 |
}
|
355 |
|
356 |
+
if (!tab) {
|
357 |
+
return false;
|
358 |
+
} // should we update state?
|
359 |
|
|
|
360 |
|
361 |
+
if (updateState === undefined) {
|
362 |
+
updateState = true;
|
363 |
+
} // hide all tabs & remove active class
|
364 |
|
|
|
|
|
|
|
|
|
365 |
|
366 |
+
[].forEach.call(tabElements, function (t) {
|
367 |
+
t.className = t.className.replace('tab-active', '');
|
368 |
+
t.style.display = ' none';
|
369 |
+
});
|
370 |
+
[].forEach.call(tabNavElements, function (t) {
|
371 |
+
t.className = t.className.replace('nav-tab-active', '');
|
372 |
+
}); // add `nav-tab-active` to this tab
|
373 |
|
374 |
+
[].forEach.call(tab.nav, function (nav) {
|
375 |
+
nav.className += " nav-tab-active";
|
376 |
+
nav.blur();
|
377 |
+
}); // show target tab
|
378 |
|
379 |
+
tab.element.style.display = 'block';
|
380 |
+
tab.element.className += " tab-active"; // create new URL
|
|
|
381 |
|
382 |
+
var url = URL.setParameter(window.location.href, "tab", tab.id); // update hash
|
|
|
383 |
|
384 |
+
if (history.pushState && updateState) {
|
385 |
+
history.pushState(tab.id, '', url);
|
386 |
+
} // update document title
|
387 |
+
|
388 |
+
|
389 |
+
title(tab); // update referer field
|
390 |
+
|
391 |
+
refererField.value = url; // if thickbox is open, close it.
|
392 |
+
|
393 |
+
if (typeof tb_remove === "function") {
|
394 |
+
tb_remove();
|
395 |
+
} // refresh editor if open
|
396 |
|
|
|
|
|
|
|
|
|
|
|
397 |
|
398 |
+
if (window.mc4wp && window.mc4wp.forms && window.mc4wp.forms.editor) {
|
399 |
+
window.mc4wp.forms.editor.refresh();
|
400 |
}
|
401 |
|
402 |
+
return true;
|
403 |
+
}
|
404 |
+
|
405 |
+
function title(tab) {
|
406 |
+
var title = document.title.split('-');
|
407 |
+
document.title = document.title.replace(title[0], tab.title + " ");
|
408 |
+
}
|
409 |
+
|
410 |
+
function switchTab(evt) {
|
411 |
+
var link = evt.target; // get from data attribute
|
412 |
+
|
413 |
+
var tabId = link.getAttribute('data-tab'); // get from classname
|
414 |
+
|
415 |
+
if (!tabId) {
|
416 |
+
var match = link.className.match(/nav-tab-(\w+)?/);
|
417 |
+
|
418 |
+
if (match) {
|
419 |
+
tabId = match[1];
|
420 |
}
|
421 |
+
} // get from href
|
422 |
|
|
|
423 |
|
424 |
+
if (!tabId) {
|
425 |
+
var urlParams = URL.parse(link.href);
|
426 |
+
|
427 |
+
if (!urlParams.tab) {
|
428 |
return;
|
429 |
}
|
430 |
|
431 |
+
tabId = urlParams.tab;
|
432 |
+
}
|
433 |
|
434 |
+
var opened = _open(tabId);
|
|
|
|
|
435 |
|
436 |
+
if (opened) {
|
437 |
+
evt.preventDefault();
|
438 |
+
evt.returnValue = false;
|
439 |
+
return false;
|
440 |
+
}
|
441 |
+
|
442 |
+
return true;
|
443 |
+
}
|
444 |
|
445 |
+
function init() {
|
446 |
+
var activeTab = tabs.filter(function (t) {
|
447 |
+
return t.element.offsetParent !== null;
|
448 |
+
}).shift();
|
449 |
+
|
450 |
+
if (!activeTab) {
|
451 |
+
return;
|
452 |
}
|
453 |
|
454 |
+
var tab = get(activeTab.id.substring(4));
|
|
|
|
|
455 |
|
456 |
+
if (!tab) {
|
457 |
+
return;
|
458 |
+
} // check if tab is in html5 history
|
459 |
+
|
460 |
+
|
461 |
+
if (history.replaceState && history.state === null) {
|
462 |
+
history.replaceState(tab.id, '');
|
463 |
+
} // update document title
|
464 |
+
|
465 |
+
|
466 |
+
title(tab);
|
467 |
+
}
|
468 |
+
|
469 |
+
[].forEach.call(tabNavElements, function (el) {
|
470 |
+
return el.addEventListener('click', switchTab);
|
471 |
+
});
|
472 |
+
document.body.addEventListener('click', function (evt) {
|
473 |
+
if (!evt.target.matches('.tab-link')) {
|
474 |
+
return;
|
475 |
}
|
476 |
|
477 |
+
switchTab(evt);
|
478 |
+
});
|
479 |
+
init();
|
|
|
|
|
480 |
|
481 |
+
if (window.addEventListener && history.pushState) {
|
482 |
+
window.addEventListener('popstate', function (e) {
|
483 |
+
if (!e.state) return true;
|
484 |
+
var tabId = e.state;
|
485 |
+
return _open(tabId, false);
|
486 |
+
});
|
487 |
+
}
|
488 |
+
|
489 |
+
module.exports = {
|
490 |
+
open: _open,
|
491 |
+
get: get
|
492 |
+
};
|
493 |
|
494 |
+
},{"./url.js":9}],9:[function(require,module,exports){
|
495 |
'use strict';
|
496 |
|
497 |
var URL = {
|
527 |
};
|
528 |
module.exports = URL;
|
529 |
|
530 |
+
},{}],10:[function(require,module,exports){
|
|
|
|
|
531 |
"use strict"
|
532 |
+
|
533 |
+
var Vnode = require("../render/vnode")
|
534 |
+
|
535 |
+
module.exports = function(render, schedule, console) {
|
536 |
+
var subscriptions = []
|
537 |
+
var rendering = false
|
538 |
+
var pending = false
|
539 |
+
|
540 |
+
function sync() {
|
541 |
+
if (rendering) throw new Error("Nested m.redraw.sync() call")
|
542 |
+
rendering = true
|
543 |
+
for (var i = 0; i < subscriptions.length; i += 2) {
|
544 |
+
try { render(subscriptions[i], Vnode(subscriptions[i + 1]), redraw) }
|
545 |
+
catch (e) { console.error(e) }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
546 |
}
|
547 |
+
rendering = false
|
548 |
}
|
549 |
+
|
550 |
+
function redraw() {
|
551 |
+
if (!pending) {
|
552 |
+
pending = true
|
553 |
+
schedule(function() {
|
554 |
+
pending = false
|
555 |
+
sync()
|
556 |
+
})
|
|
|
|
|
|
|
|
|
557 |
}
|
|
|
558 |
}
|
559 |
+
|
560 |
+
redraw.sync = sync
|
561 |
+
|
562 |
+
function mount(root, component) {
|
563 |
+
if (component != null && component.view == null && typeof component !== "function") {
|
564 |
+
throw new TypeError("m.mount(element, component) expects a component, not a vnode")
|
565 |
+
}
|
566 |
+
|
567 |
+
var index = subscriptions.indexOf(root)
|
568 |
+
if (index >= 0) {
|
569 |
+
subscriptions.splice(index, 2)
|
570 |
+
render(root, [], redraw)
|
571 |
+
}
|
572 |
+
|
573 |
+
if (component != null) {
|
574 |
+
subscriptions.push(root, component)
|
575 |
+
render(root, Vnode(component), redraw)
|
576 |
}
|
577 |
}
|
578 |
+
|
579 |
+
return {mount: mount, redraw: redraw}
|
580 |
+
}
|
581 |
+
|
582 |
+
},{"../render/vnode":29}],11:[function(require,module,exports){
|
583 |
+
(function (setImmediate){
|
584 |
+
"use strict"
|
585 |
+
|
586 |
+
var Vnode = require("../render/vnode")
|
587 |
+
var m = require("../render/hyperscript")
|
588 |
+
var Promise = require("../promise/promise")
|
589 |
+
|
590 |
+
var buildPathname = require("../pathname/build")
|
591 |
+
var parsePathname = require("../pathname/parse")
|
592 |
+
var compileTemplate = require("../pathname/compileTemplate")
|
593 |
+
var assign = require("../pathname/assign")
|
594 |
+
|
595 |
+
var sentinel = {}
|
596 |
+
|
597 |
+
module.exports = function($window, mountRedraw) {
|
598 |
+
var fireAsync
|
599 |
+
|
600 |
+
function setPath(path, data, options) {
|
601 |
+
path = buildPathname(path, data)
|
602 |
+
if (fireAsync != null) {
|
603 |
+
fireAsync()
|
604 |
+
var state = options ? options.state : null
|
605 |
+
var title = options ? options.title : null
|
606 |
+
if (options && options.replace) $window.history.replaceState(state, title, route.prefix + path)
|
607 |
+
else $window.history.pushState(state, title, route.prefix + path)
|
608 |
}
|
609 |
+
else {
|
610 |
+
$window.location.href = route.prefix + path
|
611 |
}
|
612 |
}
|
613 |
+
|
614 |
+
var currentResolver = sentinel, component, attrs, currentPath, lastUpdate
|
615 |
+
|
616 |
+
var SKIP = route.SKIP = {}
|
617 |
+
|
618 |
+
function route(root, defaultRoute, routes) {
|
619 |
+
if (root == null) throw new Error("Ensure the DOM element that was passed to `m.route` is not undefined")
|
620 |
+
// 0 = start
|
621 |
+
// 1 = init
|
622 |
+
// 2 = ready
|
623 |
+
var state = 0
|
624 |
+
|
625 |
+
var compiled = Object.keys(routes).map(function(route) {
|
626 |
+
if (route[0] !== "/") throw new SyntaxError("Routes must start with a `/`")
|
627 |
+
if ((/:([^\/\.-]+)(\.{3})?:/).test(route)) {
|
628 |
+
throw new SyntaxError("Route parameter names must be separated with either `/`, `.`, or `-`")
|
629 |
+
}
|
630 |
+
return {
|
631 |
+
route: route,
|
632 |
+
component: routes[route],
|
633 |
+
check: compileTemplate(route),
|
634 |
+
}
|
635 |
+
})
|
636 |
+
var callAsync = typeof setImmediate === "function" ? setImmediate : setTimeout
|
637 |
+
var p = Promise.resolve()
|
638 |
+
var scheduled = false
|
639 |
+
var onremove
|
640 |
+
|
641 |
+
fireAsync = null
|
642 |
+
|
643 |
+
if (defaultRoute != null) {
|
644 |
+
var defaultData = parsePathname(defaultRoute)
|
645 |
+
|
646 |
+
if (!compiled.some(function (i) { return i.check(defaultData) })) {
|
647 |
+
throw new ReferenceError("Default route doesn't match any known routes")
|
648 |
+
}
|
649 |
}
|
650 |
+
|
651 |
+
function resolveRoute() {
|
652 |
+
scheduled = false
|
653 |
+
// Consider the pathname holistically. The prefix might even be invalid,
|
654 |
+
// but that's not our problem.
|
655 |
+
var prefix = $window.location.hash
|
656 |
+
if (route.prefix[0] !== "#") {
|
657 |
+
prefix = $window.location.search + prefix
|
658 |
+
if (route.prefix[0] !== "?") {
|
659 |
+
prefix = $window.location.pathname + prefix
|
660 |
+
if (prefix[0] !== "/") prefix = "/" + prefix
|
661 |
+
}
|
662 |
+
}
|
663 |
+
// This seemingly useless `.concat()` speeds up the tests quite a bit,
|
664 |
+
// since the representation is consistently a relatively poorly
|
665 |
+
// optimized cons string.
|
666 |
+
var path = prefix.concat()
|
667 |
+
.replace(/(?:%[a-f89][a-f0-9])+/gim, decodeURIComponent)
|
668 |
+
.slice(route.prefix.length)
|
669 |
+
var data = parsePathname(path)
|
670 |
+
|
671 |
+
assign(data.params, $window.history.state)
|
672 |
+
|
673 |
+
function fail() {
|
674 |
+
if (path === defaultRoute) throw new Error("Could not resolve default route " + defaultRoute)
|
675 |
+
setPath(defaultRoute, null, {replace: true})
|
676 |
+
}
|
677 |
+
|
678 |
+
loop(0)
|
679 |
+
function loop(i) {
|
680 |
+
// 0 = init
|
681 |
+
// 1 = scheduled
|
682 |
+
// 2 = done
|
683 |
+
for (; i < compiled.length; i++) {
|
684 |
+
if (compiled[i].check(data)) {
|
685 |
+
var payload = compiled[i].component
|
686 |
+
var matchedRoute = compiled[i].route
|
687 |
+
var localComp = payload
|
688 |
+
var update = lastUpdate = function(comp) {
|
689 |
+
if (update !== lastUpdate) return
|
690 |
+
if (comp === SKIP) return loop(i + 1)
|
691 |
+
component = comp != null && (typeof comp.view === "function" || typeof comp === "function")? comp : "div"
|
692 |
+
attrs = data.params, currentPath = path, lastUpdate = null
|
693 |
+
currentResolver = payload.render ? payload : null
|
694 |
+
if (state === 2) mountRedraw.redraw()
|
695 |
+
else {
|
696 |
+
state = 2
|
697 |
+
mountRedraw.redraw.sync()
|
698 |
+
}
|
699 |
+
}
|
700 |
+
// There's no understating how much I *wish* I could
|
701 |
+
// use `async`/`await` here...
|
702 |
+
if (payload.view || typeof payload === "function") {
|
703 |
+
payload = {}
|
704 |
+
update(localComp)
|
705 |
+
}
|
706 |
+
else if (payload.onmatch) {
|
707 |
+
p.then(function () {
|
708 |
+
return payload.onmatch(data.params, path, matchedRoute)
|
709 |
+
}).then(update, fail)
|
710 |
+
}
|
711 |
+
else update("div")
|
712 |
+
return
|
713 |
+
}
|
714 |
+
}
|
715 |
+
fail()
|
716 |
+
}
|
717 |
+
}
|
718 |
+
|
719 |
+
// Set it unconditionally so `m.route.set` and `m.route.Link` both work,
|
720 |
+
// even if neither `pushState` nor `hashchange` are supported. It's
|
721 |
+
// cleared if `hashchange` is used, since that makes it automatically
|
722 |
+
// async.
|
723 |
+
fireAsync = function() {
|
724 |
+
if (!scheduled) {
|
725 |
+
scheduled = true
|
726 |
+
callAsync(resolveRoute)
|
727 |
+
}
|
728 |
+
}
|
729 |
+
|
730 |
+
if (typeof $window.history.pushState === "function") {
|
731 |
+
onremove = function() {
|
732 |
+
$window.removeEventListener("popstate", fireAsync, false)
|
733 |
+
}
|
734 |
+
$window.addEventListener("popstate", fireAsync, false)
|
735 |
+
} else if (route.prefix[0] === "#") {
|
736 |
+
fireAsync = null
|
737 |
+
onremove = function() {
|
738 |
+
$window.removeEventListener("hashchange", resolveRoute, false)
|
739 |
+
}
|
740 |
+
$window.addEventListener("hashchange", resolveRoute, false)
|
741 |
+
}
|
742 |
+
|
743 |
+
return mountRedraw.mount(root, {
|
744 |
+
onbeforeupdate: function() {
|
745 |
+
state = state ? 2 : 1
|
746 |
+
return !(!state || sentinel === currentResolver)
|
747 |
+
},
|
748 |
+
oncreate: resolveRoute,
|
749 |
+
onremove: onremove,
|
750 |
+
view: function() {
|
751 |
+
if (!state || sentinel === currentResolver) return
|
752 |
+
// Wrap in a fragment to preserve existing key semantics
|
753 |
+
var vnode = [Vnode(component, attrs.key, attrs)]
|
754 |
+
if (currentResolver) vnode = currentResolver.render(vnode[0])
|
755 |
+
return vnode
|
756 |
+
},
|
757 |
+
})
|
758 |
}
|
759 |
+
route.set = function(path, data, options) {
|
760 |
+
if (lastUpdate != null) {
|
761 |
+
options = options || {}
|
762 |
+
options.replace = true
|
763 |
+
}
|
764 |
+
lastUpdate = null
|
765 |
+
setPath(path, data, options)
|
766 |
}
|
767 |
+
route.get = function() {return currentPath}
|
768 |
+
route.prefix = "#!"
|
769 |
+
route.Link = {
|
770 |
+
view: function(vnode) {
|
771 |
+
var options = vnode.attrs.options
|
772 |
+
// Remove these so they don't get overwritten
|
773 |
+
var attrs = {}, onclick, href
|
774 |
+
assign(attrs, vnode.attrs)
|
775 |
+
// The first two are internal, but the rest are magic attributes
|
776 |
+
// that need censored to not screw up rendering.
|
777 |
+
attrs.selector = attrs.options = attrs.key = attrs.oninit =
|
778 |
+
attrs.oncreate = attrs.onbeforeupdate = attrs.onupdate =
|
779 |
+
attrs.onbeforeremove = attrs.onremove = null
|
780 |
+
|
781 |
+
// Do this now so we can get the most current `href` and `disabled`.
|
782 |
+
// Those attributes may also be specified in the selector, and we
|
783 |
+
// should honor that.
|
784 |
+
var child = m(vnode.attrs.selector || "a", attrs, vnode.children)
|
785 |
+
|
786 |
+
// Let's provide a *right* way to disable a route link, rather than
|
787 |
+
// letting people screw up accessibility on accident.
|
788 |
+
//
|
789 |
+
// The attribute is coerced so users don't get surprised over
|
790 |
+
// `disabled: 0` resulting in a button that's somehow routable
|
791 |
+
// despite being visibly disabled.
|
792 |
+
if (child.attrs.disabled = Boolean(child.attrs.disabled)) {
|
793 |
+
child.attrs.href = null
|
794 |
+
child.attrs["aria-disabled"] = "true"
|
795 |
+
// If you *really* do want to do this on a disabled link, use
|
796 |
+
// an `oncreate` hook to add it.
|
797 |
+
child.attrs.onclick = null
|
798 |
+
} else {
|
799 |
+
onclick = child.attrs.onclick
|
800 |
+
href = child.attrs.href
|
801 |
+
child.attrs.href = route.prefix + href
|
802 |
+
child.attrs.onclick = function(e) {
|
803 |
+
var result
|
804 |
+
if (typeof onclick === "function") {
|
805 |
+
result = onclick.call(e.currentTarget, e)
|
806 |
+
} else if (onclick == null || typeof onclick !== "object") {
|
807 |
+
// do nothing
|
808 |
+
} else if (typeof onclick.handleEvent === "function") {
|
809 |
+
onclick.handleEvent(e)
|
810 |
+
}
|
811 |
+
|
812 |
+
// Adapted from React Router's implementation:
|
813 |
+
// https://github.com/ReactTraining/react-router/blob/520a0acd48ae1b066eb0b07d6d4d1790a1d02482/packages/react-router-dom/modules/Link.js
|
814 |
+
//
|
815 |
+
// Try to be flexible and intuitive in how we handle links.
|
816 |
+
// Fun fact: links aren't as obvious to get right as you
|
817 |
+
// would expect. There's a lot more valid ways to click a
|
818 |
+
// link than this, and one might want to not simply click a
|
819 |
+
// link, but right click or command-click it to copy the
|
820 |
+
// link target, etc. Nope, this isn't just for blind people.
|
821 |
+
if (
|
822 |
+
// Skip if `onclick` prevented default
|
823 |
+
result !== false && !e.defaultPrevented &&
|
824 |
+
// Ignore everything but left clicks
|
825 |
+
(e.button === 0 || e.which === 0 || e.which === 1) &&
|
826 |
+
// Let the browser handle `target=_blank`, etc.
|
827 |
+
(!e.currentTarget.target || e.currentTarget.target === "_self") &&
|
828 |
+
// No modifier keys
|
829 |
+
!e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey
|
830 |
+
) {
|
831 |
+
e.preventDefault()
|
832 |
+
e.redraw = false
|
833 |
+
route.set(href, null, options)
|
834 |
+
}
|
835 |
+
}
|
836 |
+
}
|
837 |
+
return child
|
838 |
+
},
|
839 |
}
|
840 |
+
route.param = function(key) {
|
841 |
+
return attrs && key != null ? attrs[key] : attrs
|
842 |
}
|
843 |
+
|
844 |
+
return route
|
845 |
+
}
|
846 |
+
|
847 |
+
}).call(this,require("timers").setImmediate)
|
848 |
+
},{"../pathname/assign":15,"../pathname/build":16,"../pathname/compileTemplate":17,"../pathname/parse":18,"../promise/promise":20,"../render/hyperscript":25,"../render/vnode":29,"timers":34}],12:[function(require,module,exports){
|
849 |
+
"use strict"
|
850 |
+
|
851 |
+
var hyperscript = require("./render/hyperscript")
|
852 |
+
|
853 |
+
hyperscript.trust = require("./render/trust")
|
854 |
+
hyperscript.fragment = require("./render/fragment")
|
855 |
+
|
856 |
+
module.exports = hyperscript
|
857 |
+
|
858 |
+
},{"./render/fragment":24,"./render/hyperscript":25,"./render/trust":28}],13:[function(require,module,exports){
|
859 |
+
"use strict"
|
860 |
+
|
861 |
+
var hyperscript = require("./hyperscript")
|
862 |
+
var request = require("./request")
|
863 |
+
var mountRedraw = require("./mount-redraw")
|
864 |
+
|
865 |
+
var m = function m() { return hyperscript.apply(this, arguments) }
|
866 |
+
m.m = hyperscript
|
867 |
+
m.trust = hyperscript.trust
|
868 |
+
m.fragment = hyperscript.fragment
|
869 |
+
m.mount = mountRedraw.mount
|
870 |
+
m.route = require("./route")
|
871 |
+
m.render = require("./render")
|
872 |
+
m.redraw = mountRedraw.redraw
|
873 |
+
m.request = request.request
|
874 |
+
m.jsonp = request.jsonp
|
875 |
+
m.parseQueryString = require("./querystring/parse")
|
876 |
+
m.buildQueryString = require("./querystring/build")
|
877 |
+
m.parsePathname = require("./pathname/parse")
|
878 |
+
m.buildPathname = require("./pathname/build")
|
879 |
+
m.vnode = require("./render/vnode")
|
880 |
+
m.PromisePolyfill = require("./promise/polyfill")
|
881 |
+
|
882 |
+
module.exports = m
|
883 |
+
|
884 |
+
},{"./hyperscript":12,"./mount-redraw":14,"./pathname/build":16,"./pathname/parse":18,"./promise/polyfill":19,"./querystring/build":21,"./querystring/parse":22,"./render":23,"./render/vnode":29,"./request":30,"./route":32}],14:[function(require,module,exports){
|
885 |
+
"use strict"
|
886 |
+
|
887 |
+
var render = require("./render")
|
888 |
+
|
889 |
+
module.exports = require("./api/mount-redraw")(render, requestAnimationFrame, console)
|
890 |
+
|
891 |
+
},{"./api/mount-redraw":10,"./render":23}],15:[function(require,module,exports){
|
892 |
+
"use strict"
|
893 |
+
|
894 |
+
module.exports = Object.assign || function(target, source) {
|
895 |
+
if(source) Object.keys(source).forEach(function(key) { target[key] = source[key] })
|
896 |
+
}
|
897 |
+
|
898 |
+
},{}],16:[function(require,module,exports){
|
899 |
+
"use strict"
|
900 |
+
|
901 |
+
var buildQueryString = require("../querystring/build")
|
902 |
+
var assign = require("./assign")
|
903 |
+
|
904 |
+
// Returns `path` from `template` + `params`
|
905 |
+
module.exports = function(template, params) {
|
906 |
+
if ((/:([^\/\.-]+)(\.{3})?:/).test(template)) {
|
907 |
+
throw new SyntaxError("Template parameter names *must* be separated")
|
908 |
+
}
|
909 |
+
if (params == null) return template
|
910 |
+
var queryIndex = template.indexOf("?")
|
911 |
+
var hashIndex = template.indexOf("#")
|
912 |
+
var queryEnd = hashIndex < 0 ? template.length : hashIndex
|
913 |
+
var pathEnd = queryIndex < 0 ? queryEnd : queryIndex
|
914 |
+
var path = template.slice(0, pathEnd)
|
915 |
+
var query = {}
|
916 |
+
|
917 |
+
assign(query, params)
|
918 |
+
|
919 |
+
var resolved = path.replace(/:([^\/\.-]+)(\.{3})?/g, function(m, key, variadic) {
|
920 |
+
delete query[key]
|
921 |
+
// If no such parameter exists, don't interpolate it.
|
922 |
+
if (params[key] == null) return m
|
923 |
+
// Escape normal parameters, but not variadic ones.
|
924 |
+
return variadic ? params[key] : encodeURIComponent(String(params[key]))
|
925 |
+
})
|
926 |
+
|
927 |
+
// In case the template substitution adds new query/hash parameters.
|
928 |
+
var newQueryIndex = resolved.indexOf("?")
|
929 |
+
var newHashIndex = resolved.indexOf("#")
|
930 |
+
var newQueryEnd = newHashIndex < 0 ? resolved.length : newHashIndex
|
931 |
+
var newPathEnd = newQueryIndex < 0 ? newQueryEnd : newQueryIndex
|
932 |
+
var result = resolved.slice(0, newPathEnd)
|
933 |
+
|
934 |
+
if (queryIndex >= 0) result += template.slice(queryIndex, queryEnd)
|
935 |
+
if (newQueryIndex >= 0) result += (queryIndex < 0 ? "?" : "&") + resolved.slice(newQueryIndex, newQueryEnd)
|
936 |
+
var querystring = buildQueryString(query)
|
937 |
+
if (querystring) result += (queryIndex < 0 && newQueryIndex < 0 ? "?" : "&") + querystring
|
938 |
+
if (hashIndex >= 0) result += template.slice(hashIndex)
|
939 |
+
if (newHashIndex >= 0) result += (hashIndex < 0 ? "" : "&") + resolved.slice(newHashIndex)
|
940 |
+
return result
|
941 |
+
}
|
942 |
+
|
943 |
+
},{"../querystring/build":21,"./assign":15}],17:[function(require,module,exports){
|
944 |
+
"use strict"
|
945 |
+
|
946 |
+
var parsePathname = require("./parse")
|
947 |
+
|
948 |
+
// Compiles a template into a function that takes a resolved path (without query
|
949 |
+
// strings) and returns an object containing the template parameters with their
|
950 |
+
// parsed values. This expects the input of the compiled template to be the
|
951 |
+
// output of `parsePathname`. Note that it does *not* remove query parameters
|
952 |
+
// specified in the template.
|
953 |
+
module.exports = function(template) {
|
954 |
+
var templateData = parsePathname(template)
|
955 |
+
var templateKeys = Object.keys(templateData.params)
|
956 |
+
var keys = []
|
957 |
+
var regexp = new RegExp("^" + templateData.path.replace(
|
958 |
+
// I escape literal text so people can use things like `:file.:ext` or
|
959 |
+
// `:lang-:locale` in routes. This is all merged into one pass so I
|
960 |
+
// don't also accidentally escape `-` and make it harder to detect it to
|
961 |
+
// ban it from template parameters.
|
962 |
+
/:([^\/.-]+)(\.{3}|\.(?!\.)|-)?|[\\^$*+.()|\[\]{}]/g,
|
963 |
+
function(m, key, extra) {
|
964 |
+
if (key == null) return "\\" + m
|
965 |
+
keys.push({k: key, r: extra === "..."})
|
966 |
+
if (extra === "...") return "(.*)"
|
967 |
+
if (extra === ".") return "([^/]+)\\."
|
968 |
+
return "([^/]+)" + (extra || "")
|
969 |
+
}
|
970 |
+
) + "$")
|
971 |
+
return function(data) {
|
972 |
+
// First, check the params. Usually, there isn't any, and it's just
|
973 |
+
// checking a static set.
|
974 |
+
for (var i = 0; i < templateKeys.length; i++) {
|
975 |
+
if (templateData.params[templateKeys[i]] !== data.params[templateKeys[i]]) return false
|
976 |
+
}
|
977 |
+
// If no interpolations exist, let's skip all the ceremony
|
978 |
+
if (!keys.length) return regexp.test(data.path)
|
979 |
+
var values = regexp.exec(data.path)
|
980 |
+
if (values == null) return false
|
981 |
+
for (var i = 0; i < keys.length; i++) {
|
982 |
+
data.params[keys[i].k] = keys[i].r ? values[i + 1] : decodeURIComponent(values[i + 1])
|
983 |
+
}
|
984 |
+
return true
|
985 |
}
|
986 |
+
}
|
987 |
+
|
988 |
+
},{"./parse":18}],18:[function(require,module,exports){
|
989 |
+
"use strict"
|
990 |
+
|
991 |
+
var parseQueryString = require("../querystring/parse")
|
992 |
+
|
993 |
+
// Returns `{path, params}` from `url`
|
994 |
+
module.exports = function(url) {
|
995 |
+
var queryIndex = url.indexOf("?")
|
996 |
+
var hashIndex = url.indexOf("#")
|
997 |
+
var queryEnd = hashIndex < 0 ? url.length : hashIndex
|
998 |
+
var pathEnd = queryIndex < 0 ? queryEnd : queryIndex
|
999 |
+
var path = url.slice(0, pathEnd).replace(/\/{2,}/g, "/")
|
1000 |
+
|
1001 |
+
if (!path) path = "/"
|
1002 |
+
else {
|
1003 |
+
if (path[0] !== "/") path = "/" + path
|
1004 |
+
if (path.length > 1 && path[path.length - 1] === "/") path = path.slice(0, -1)
|
1005 |
}
|
1006 |
+
return {
|
1007 |
+
path: path,
|
1008 |
+
params: queryIndex < 0
|
1009 |
+
? {}
|
1010 |
+
: parseQueryString(url.slice(queryIndex + 1, queryEnd)),
|
1011 |
}
|
1012 |
}
|
1013 |
+
|
1014 |
+
},{"../querystring/parse":22}],19:[function(require,module,exports){
|
1015 |
+
(function (setImmediate){
|
1016 |
+
"use strict"
|
|
|
|
|
|
|
|
|
1017 |
/** @constructor */
|
1018 |
var PromisePolyfill = function(executor) {
|
1019 |
if (!(this instanceof PromisePolyfill)) throw new Error("Promise must be called with `new`")
|
1020 |
if (typeof executor !== "function") throw new TypeError("executor must be a function")
|
1021 |
+
|
1022 |
var self = this, resolvers = [], rejectors = [], resolveCurrent = handler(resolvers, true), rejectCurrent = handler(rejectors, false)
|
1023 |
var instance = self._instance = {resolvers: resolvers, rejectors: rejectors}
|
1024 |
var callAsync = typeof setImmediate === "function" ? setImmediate : setTimeout
|
1056 |
var onerror = run(rejectCurrent)
|
1057 |
try {then(run(resolveCurrent), onerror)} catch (e) {onerror(e)}
|
1058 |
}
|
1059 |
+
|
1060 |
executeOnce(executor)
|
1061 |
}
|
1062 |
PromisePolyfill.prototype.then = function(onFulfilled, onRejection) {
|
1076 |
PromisePolyfill.prototype.catch = function(onRejection) {
|
1077 |
return this.then(null, onRejection)
|
1078 |
}
|
1079 |
+
PromisePolyfill.prototype.finally = function(callback) {
|
1080 |
+
return this.then(
|
1081 |
+
function(value) {
|
1082 |
+
return PromisePolyfill.resolve(callback()).then(function() {
|
1083 |
+
return value
|
1084 |
+
})
|
1085 |
+
},
|
1086 |
+
function(reason) {
|
1087 |
+
return PromisePolyfill.resolve(callback()).then(function() {
|
1088 |
+
return PromisePolyfill.reject(reason);
|
1089 |
+
})
|
1090 |
+
}
|
1091 |
+
)
|
1092 |
+
}
|
1093 |
PromisePolyfill.resolve = function(value) {
|
1094 |
if (value instanceof PromisePolyfill) return value
|
1095 |
return new PromisePolyfill(function(resolve) {resolve(value)})
|
1123 |
}
|
1124 |
})
|
1125 |
}
|
1126 |
+
|
1127 |
+
module.exports = PromisePolyfill
|
1128 |
+
|
1129 |
+
}).call(this,require("timers").setImmediate)
|
1130 |
+
},{"timers":34}],20:[function(require,module,exports){
|
1131 |
+
(function (global){
|
1132 |
+
"use strict"
|
1133 |
+
|
1134 |
+
var PromisePolyfill = require("./polyfill")
|
1135 |
+
|
1136 |
if (typeof window !== "undefined") {
|
1137 |
+
if (typeof window.Promise === "undefined") {
|
1138 |
+
window.Promise = PromisePolyfill
|
1139 |
+
} else if (!window.Promise.prototype.finally) {
|
1140 |
+
window.Promise.prototype.finally = PromisePolyfill.prototype.finally
|
1141 |
+
}
|
1142 |
+
module.exports = window.Promise
|
1143 |
} else if (typeof global !== "undefined") {
|
1144 |
+
if (typeof global.Promise === "undefined") {
|
1145 |
+
global.Promise = PromisePolyfill
|
1146 |
+
} else if (!global.Promise.prototype.finally) {
|
1147 |
+
global.Promise.prototype.finally = PromisePolyfill.prototype.finally
|
1148 |
+
}
|
1149 |
+
module.exports = global.Promise
|
1150 |
} else {
|
1151 |
+
module.exports = PromisePolyfill
|
1152 |
}
|
1153 |
+
|
1154 |
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
1155 |
+
},{"./polyfill":19}],21:[function(require,module,exports){
|
1156 |
+
"use strict"
|
1157 |
+
|
1158 |
+
module.exports = function(object) {
|
1159 |
if (Object.prototype.toString.call(object) !== "[object Object]") return ""
|
1160 |
+
|
1161 |
var args = []
|
1162 |
+
for (var key in object) {
|
1163 |
+
destructure(key, object[key])
|
1164 |
}
|
1165 |
+
|
1166 |
return args.join("&")
|
1167 |
+
|
1168 |
+
function destructure(key, value) {
|
1169 |
if (Array.isArray(value)) {
|
1170 |
for (var i = 0; i < value.length; i++) {
|
1171 |
+
destructure(key + "[" + i + "]", value[i])
|
1172 |
}
|
1173 |
}
|
1174 |
else if (Object.prototype.toString.call(value) === "[object Object]") {
|
1175 |
for (var i in value) {
|
1176 |
+
destructure(key + "[" + i + "]", value[i])
|
1177 |
}
|
1178 |
}
|
1179 |
+
else args.push(encodeURIComponent(key) + (value != null && value !== "" ? "=" + encodeURIComponent(value) : ""))
|
1180 |
}
|
1181 |
}
|
1182 |
+
|
1183 |
+
},{}],22:[function(require,module,exports){
|
1184 |
+
"use strict"
|
1185 |
+
|
1186 |
+
module.exports = function(string) {
|
1187 |
+
if (string === "" || string == null) return {}
|
1188 |
+
if (string.charAt(0) === "?") string = string.slice(1)
|
1189 |
+
|
1190 |
+
var entries = string.split("&"), counters = {}, data = {}
|
1191 |
+
for (var i = 0; i < entries.length; i++) {
|
1192 |
+
var entry = entries[i].split("=")
|
1193 |
+
var key = decodeURIComponent(entry[0])
|
1194 |
+
var value = entry.length === 2 ? decodeURIComponent(entry[1]) : ""
|
1195 |
+
|
1196 |
+
if (value === "true") value = true
|
1197 |
+
else if (value === "false") value = false
|
1198 |
+
|
1199 |
+
var levels = key.split(/\]\[?|\[/)
|
1200 |
+
var cursor = data
|
1201 |
+
if (key.indexOf("[") > -1) levels.pop()
|
1202 |
+
for (var j = 0; j < levels.length; j++) {
|
1203 |
+
var level = levels[j], nextLevel = levels[j + 1]
|
1204 |
+
var isNumber = nextLevel == "" || !isNaN(parseInt(nextLevel, 10))
|
1205 |
+
if (level === "") {
|
1206 |
+
var key = levels.slice(0, j).join()
|
1207 |
+
if (counters[key] == null) {
|
1208 |
+
counters[key] = Array.isArray(cursor) ? cursor.length : 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1209 |
}
|
1210 |
+
level = counters[key]++
|
1211 |
}
|
1212 |
+
// Disallow direct prototype pollution
|
1213 |
+
else if (level === "__proto__") break
|
1214 |
+
if (j === levels.length - 1) cursor[level] = value
|
1215 |
+
else {
|
1216 |
+
// Read own properties exclusively to disallow indirect
|
1217 |
+
// prototype pollution
|
1218 |
+
var desc = Object.getOwnPropertyDescriptor(cursor, level)
|
1219 |
+
if (desc != null) desc = desc.value
|
1220 |
+
if (desc == null) cursor[level] = desc = isNumber ? [] : {}
|
1221 |
+
cursor = desc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1222 |
}
|
1223 |
}
|
|
|
1224 |
}
|
1225 |
+
return data
|
1226 |
+
}
|
1227 |
+
|
1228 |
+
},{}],23:[function(require,module,exports){
|
1229 |
+
"use strict"
|
1230 |
+
|
1231 |
+
module.exports = require("./render/render")(window)
|
1232 |
+
|
1233 |
+
},{"./render/render":27}],24:[function(require,module,exports){
|
1234 |
+
"use strict"
|
1235 |
+
|
1236 |
+
var Vnode = require("../render/vnode")
|
1237 |
+
var hyperscriptVnode = require("./hyperscriptVnode")
|
1238 |
+
|
1239 |
+
module.exports = function() {
|
1240 |
+
var vnode = hyperscriptVnode.apply(0, arguments)
|
1241 |
+
|
1242 |
+
vnode.tag = "["
|
1243 |
+
vnode.children = Vnode.normalizeChildren(vnode.children)
|
1244 |
+
return vnode
|
1245 |
+
}
|
1246 |
+
|
1247 |
+
},{"../render/vnode":29,"./hyperscriptVnode":26}],25:[function(require,module,exports){
|
1248 |
+
"use strict"
|
1249 |
+
|
1250 |
+
var Vnode = require("../render/vnode")
|
1251 |
+
var hyperscriptVnode = require("./hyperscriptVnode")
|
1252 |
+
|
1253 |
+
var selectorParser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g
|
1254 |
+
var selectorCache = {}
|
1255 |
+
var hasOwn = {}.hasOwnProperty
|
1256 |
+
|
1257 |
+
function isEmpty(object) {
|
1258 |
+
for (var key in object) if (hasOwn.call(object, key)) return false
|
1259 |
+
return true
|
1260 |
+
}
|
1261 |
+
|
1262 |
+
function compileSelector(selector) {
|
1263 |
+
var match, tag = "div", classes = [], attrs = {}
|
1264 |
+
while (match = selectorParser.exec(selector)) {
|
1265 |
+
var type = match[1], value = match[2]
|
1266 |
+
if (type === "" && value !== "") tag = value
|
1267 |
+
else if (type === "#") attrs.id = value
|
1268 |
+
else if (type === ".") classes.push(value)
|
1269 |
+
else if (match[3][0] === "[") {
|
1270 |
+
var attrValue = match[6]
|
1271 |
+
if (attrValue) attrValue = attrValue.replace(/\\(["'])/g, "$1").replace(/\\\\/g, "\\")
|
1272 |
+
if (match[4] === "class") classes.push(attrValue)
|
1273 |
+
else attrs[match[4]] = attrValue === "" ? attrValue : attrValue || true
|
1274 |
+
}
|
1275 |
+
}
|
1276 |
+
if (classes.length > 0) attrs.className = classes.join(" ")
|
1277 |
+
return selectorCache[selector] = {tag: tag, attrs: attrs}
|
1278 |
+
}
|
1279 |
+
|
1280 |
+
function execSelector(state, vnode) {
|
1281 |
+
var attrs = vnode.attrs
|
1282 |
+
var children = Vnode.normalizeChildren(vnode.children)
|
1283 |
+
var hasClass = hasOwn.call(attrs, "class")
|
1284 |
+
var className = hasClass ? attrs.class : attrs.className
|
1285 |
+
|
1286 |
+
vnode.tag = state.tag
|
1287 |
+
vnode.attrs = null
|
1288 |
+
vnode.children = undefined
|
1289 |
+
|
1290 |
+
if (!isEmpty(state.attrs) && !isEmpty(attrs)) {
|
1291 |
+
var newAttrs = {}
|
1292 |
+
|
1293 |
+
for (var key in attrs) {
|
1294 |
+
if (hasOwn.call(attrs, key)) newAttrs[key] = attrs[key]
|
1295 |
}
|
1296 |
+
|
1297 |
+
attrs = newAttrs
|
1298 |
}
|
1299 |
+
|
1300 |
+
for (var key in state.attrs) {
|
1301 |
+
if (hasOwn.call(state.attrs, key) && key !== "className" && !hasOwn.call(attrs, key)){
|
1302 |
+
attrs[key] = state.attrs[key]
|
1303 |
+
}
|
1304 |
}
|
1305 |
+
if (className != null || state.attrs.className != null) attrs.className =
|
1306 |
+
className != null
|
1307 |
+
? state.attrs.className != null
|
1308 |
+
? String(state.attrs.className) + " " + String(className)
|
1309 |
+
: className
|
1310 |
+
: state.attrs.className != null
|
1311 |
+
? state.attrs.className
|
1312 |
+
: null
|
1313 |
+
|
1314 |
+
if (hasClass) attrs.class = null
|
1315 |
+
|
1316 |
+
for (var key in attrs) {
|
1317 |
+
if (hasOwn.call(attrs, key) && key !== "key") {
|
1318 |
+
vnode.attrs = attrs
|
1319 |
+
break
|
1320 |
}
|
|
|
1321 |
}
|
1322 |
+
|
1323 |
+
if (Array.isArray(children) && children.length === 1 && children[0] != null && children[0].tag === "#") {
|
1324 |
+
vnode.text = children[0].children
|
1325 |
+
} else {
|
1326 |
+
vnode.children = children
|
1327 |
+
}
|
1328 |
+
|
1329 |
+
return vnode
|
1330 |
+
}
|
1331 |
+
|
1332 |
+
function hyperscript(selector) {
|
1333 |
+
if (selector == null || typeof selector !== "string" && typeof selector !== "function" && typeof selector.view !== "function") {
|
1334 |
+
throw Error("The selector must be either a string or a component.");
|
1335 |
+
}
|
1336 |
+
|
1337 |
+
var vnode = hyperscriptVnode.apply(1, arguments)
|
1338 |
+
|
1339 |
+
if (typeof selector === "string") {
|
1340 |
+
vnode.children = Vnode.normalizeChildren(vnode.children)
|
1341 |
+
if (selector !== "[") return execSelector(selectorCache[selector] || compileSelector(selector), vnode)
|
1342 |
+
}
|
1343 |
+
|
1344 |
+
vnode.tag = selector
|
1345 |
+
return vnode
|
1346 |
+
}
|
1347 |
+
|
1348 |
+
module.exports = hyperscript
|
1349 |
+
|
1350 |
+
},{"../render/vnode":29,"./hyperscriptVnode":26}],26:[function(require,module,exports){
|
1351 |
+
"use strict"
|
1352 |
+
|
1353 |
+
var Vnode = require("../render/vnode")
|
1354 |
+
|
1355 |
+
// Call via `hyperscriptVnode.apply(startOffset, arguments)`
|
1356 |
+
//
|
1357 |
+
// The reason I do it this way, forwarding the arguments and passing the start
|
1358 |
+
// offset in `this`, is so I don't have to create a temporary array in a
|
1359 |
+
// performance-critical path.
|
1360 |
+
//
|
1361 |
+
// In native ES6, I'd instead add a final `...args` parameter to the
|
1362 |
+
// `hyperscript` and `fragment` factories and define this as
|
1363 |
+
// `hyperscriptVnode(...args)`, since modern engines do optimize that away. But
|
1364 |
+
// ES5 (what Mithril requires thanks to IE support) doesn't give me that luxury,
|
1365 |
+
// and engines aren't nearly intelligent enough to do either of these:
|
1366 |
+
//
|
1367 |
+
// 1. Elide the allocation for `[].slice.call(arguments, 1)` when it's passed to
|
1368 |
+
// another function only to be indexed.
|
1369 |
+
// 2. Elide an `arguments` allocation when it's passed to any function other
|
1370 |
+
// than `Function.prototype.apply` or `Reflect.apply`.
|
1371 |
+
//
|
1372 |
+
// In ES6, it'd probably look closer to this (I'd need to profile it, though):
|
1373 |
+
// module.exports = function(attrs, ...children) {
|
1374 |
+
// if (attrs == null || typeof attrs === "object" && attrs.tag == null && !Array.isArray(attrs)) {
|
1375 |
+
// if (children.length === 1 && Array.isArray(children[0])) children = children[0]
|
1376 |
+
// } else {
|
1377 |
+
// children = children.length === 0 && Array.isArray(attrs) ? attrs : [attrs, ...children]
|
1378 |
+
// attrs = undefined
|
1379 |
+
// }
|
1380 |
+
//
|
1381 |
+
// if (attrs == null) attrs = {}
|
1382 |
+
// return Vnode("", attrs.key, attrs, children)
|
1383 |
+
// }
|
1384 |
+
module.exports = function() {
|
1385 |
+
var attrs = arguments[this], start = this + 1, children
|
1386 |
+
|
1387 |
+
if (attrs == null) {
|
1388 |
+
attrs = {}
|
1389 |
+
} else if (typeof attrs !== "object" || attrs.tag != null || Array.isArray(attrs)) {
|
1390 |
+
attrs = {}
|
1391 |
+
start = this
|
1392 |
+
}
|
1393 |
+
|
1394 |
+
if (arguments.length === start + 1) {
|
1395 |
+
children = arguments[start]
|
1396 |
+
if (!Array.isArray(children)) children = [children]
|
1397 |
+
} else {
|
1398 |
+
children = []
|
1399 |
+
while (start < arguments.length) children.push(arguments[start++])
|
1400 |
+
}
|
1401 |
+
|
1402 |
+
return Vnode("", attrs.key, attrs, children)
|
1403 |
}
|
1404 |
+
|
1405 |
+
},{"../render/vnode":29}],27:[function(require,module,exports){
|
1406 |
+
"use strict"
|
1407 |
+
|
1408 |
+
var Vnode = require("../render/vnode")
|
1409 |
+
|
1410 |
+
module.exports = function($window) {
|
1411 |
+
var $doc = $window && $window.document
|
1412 |
+
var currentRedraw
|
1413 |
+
|
1414 |
var nameSpace = {
|
1415 |
svg: "http://www.w3.org/2000/svg",
|
1416 |
math: "http://www.w3.org/1998/Math/MathML"
|
1417 |
}
|
1418 |
+
|
|
|
1419 |
function getNameSpace(vnode) {
|
1420 |
return vnode.attrs && vnode.attrs.xmlns || nameSpace[vnode.tag]
|
1421 |
}
|
1422 |
+
|
1423 |
+
//sanity check to discourage people from doing `vnode.state = ...`
|
1424 |
+
function checkState(vnode, original) {
|
1425 |
+
if (vnode.state !== original) throw new Error("`vnode.state` must not be modified")
|
1426 |
+
}
|
1427 |
+
|
1428 |
+
//Note: the hook is passed as the `this` argument to allow proxying the
|
1429 |
+
//arguments without requiring a full array allocation to do so. It also
|
1430 |
+
//takes advantage of the fact the current `vnode` is the first argument in
|
1431 |
+
//all lifecycle methods.
|
1432 |
+
function callHook(vnode) {
|
1433 |
+
var original = vnode.state
|
1434 |
+
try {
|
1435 |
+
return this.apply(original, arguments)
|
1436 |
+
} finally {
|
1437 |
+
checkState(vnode, original)
|
1438 |
+
}
|
1439 |
+
}
|
1440 |
+
|
1441 |
+
// IE11 (at least) throws an UnspecifiedError when accessing document.activeElement when
|
1442 |
+
// inside an iframe. Catch and swallow this error, and heavy-handidly return null.
|
1443 |
+
function activeElement() {
|
1444 |
+
try {
|
1445 |
+
return $doc.activeElement
|
1446 |
+
} catch (e) {
|
1447 |
+
return null
|
1448 |
+
}
|
1449 |
+
}
|
1450 |
//create
|
1451 |
function createNodes(parent, vnodes, start, end, hooks, nextSibling, ns) {
|
1452 |
for (var i = start; i < end; i++) {
|
1462 |
vnode.state = {}
|
1463 |
if (vnode.attrs != null) initLifecycle(vnode.attrs, vnode, hooks)
|
1464 |
switch (tag) {
|
1465 |
+
case "#": createText(parent, vnode, nextSibling); break
|
1466 |
+
case "<": createHTML(parent, vnode, ns, nextSibling); break
|
1467 |
+
case "[": createFragment(parent, vnode, hooks, ns, nextSibling); break
|
1468 |
+
default: createElement(parent, vnode, hooks, ns, nextSibling)
|
1469 |
}
|
1470 |
}
|
1471 |
+
else createComponent(parent, vnode, hooks, ns, nextSibling)
|
1472 |
}
|
1473 |
function createText(parent, vnode, nextSibling) {
|
1474 |
vnode.dom = $doc.createTextNode(vnode.children)
|
1475 |
insertNode(parent, vnode.dom, nextSibling)
|
|
|
1476 |
}
|
1477 |
+
var possibleParents = {caption: "table", thead: "table", tbody: "table", tfoot: "table", tr: "tbody", th: "tr", td: "tr", colgroup: "table", col: "colgroup"}
|
1478 |
+
function createHTML(parent, vnode, ns, nextSibling) {
|
1479 |
+
var match = vnode.children.match(/^\s*?<(\w+)/im) || []
|
1480 |
+
// not using the proper parent makes the child element(s) vanish.
|
1481 |
+
// var div = document.createElement("div")
|
1482 |
+
// div.innerHTML = "<td>i</td><td>j</td>"
|
1483 |
+
// console.log(div.innerHTML)
|
1484 |
+
// --> "ij", no <td> in sight.
|
1485 |
+
var temp = $doc.createElement(possibleParents[match[1]] || "div")
|
1486 |
+
if (ns === "http://www.w3.org/2000/svg") {
|
1487 |
+
temp.innerHTML = "<svg xmlns=\"http://www.w3.org/2000/svg\">" + vnode.children + "</svg>"
|
1488 |
+
temp = temp.firstChild
|
1489 |
+
} else {
|
1490 |
+
temp.innerHTML = vnode.children
|
1491 |
+
}
|
1492 |
vnode.dom = temp.firstChild
|
1493 |
vnode.domSize = temp.childNodes.length
|
1494 |
+
// Capture nodes to remove, so we don't confuse them.
|
1495 |
+
vnode.instance = []
|
1496 |
var fragment = $doc.createDocumentFragment()
|
1497 |
var child
|
1498 |
while (child = temp.firstChild) {
|
1499 |
+
vnode.instance.push(child)
|
1500 |
fragment.appendChild(child)
|
1501 |
}
|
1502 |
insertNode(parent, fragment, nextSibling)
|
|
|
1503 |
}
|
1504 |
function createFragment(parent, vnode, hooks, ns, nextSibling) {
|
1505 |
var fragment = $doc.createDocumentFragment()
|
1510 |
vnode.dom = fragment.firstChild
|
1511 |
vnode.domSize = fragment.childNodes.length
|
1512 |
insertNode(parent, fragment, nextSibling)
|
|
|
1513 |
}
|
1514 |
function createElement(parent, vnode, hooks, ns, nextSibling) {
|
1515 |
var tag = vnode.tag
|
1516 |
+
var attrs = vnode.attrs
|
1517 |
+
var is = attrs && attrs.is
|
1518 |
+
|
1519 |
ns = getNameSpace(vnode) || ns
|
1520 |
+
|
1521 |
var element = ns ?
|
1522 |
is ? $doc.createElementNS(ns, tag, {is: is}) : $doc.createElementNS(ns, tag) :
|
1523 |
is ? $doc.createElement(tag, {is: is}) : $doc.createElement(tag)
|
1524 |
vnode.dom = element
|
1525 |
+
|
1526 |
+
if (attrs != null) {
|
1527 |
+
setAttrs(vnode, attrs, ns)
|
1528 |
}
|
1529 |
+
|
1530 |
insertNode(parent, element, nextSibling)
|
1531 |
+
|
1532 |
+
if (!maybeSetContentEditable(vnode)) {
|
|
|
|
|
1533 |
if (vnode.text != null) {
|
1534 |
if (vnode.text !== "") element.textContent = vnode.text
|
1535 |
else vnode.children = [Vnode("#", undefined, undefined, vnode.text, undefined, undefined)]
|
1537 |
if (vnode.children != null) {
|
1538 |
var children = vnode.children
|
1539 |
createNodes(element, children, 0, children.length, hooks, null, ns)
|
1540 |
+
if (vnode.tag === "select" && attrs != null) setLateSelectAttrs(vnode, attrs)
|
1541 |
}
|
1542 |
}
|
|
|
1543 |
}
|
1544 |
function initComponent(vnode, hooks) {
|
1545 |
var sentinel
|
1546 |
if (typeof vnode.tag.view === "function") {
|
1547 |
vnode.state = Object.create(vnode.tag)
|
1548 |
sentinel = vnode.state.view
|
1549 |
+
if (sentinel.$$reentrantLock$$ != null) return
|
1550 |
sentinel.$$reentrantLock$$ = true
|
1551 |
} else {
|
1552 |
vnode.state = void 0
|
1553 |
sentinel = vnode.tag
|
1554 |
+
if (sentinel.$$reentrantLock$$ != null) return
|
1555 |
sentinel.$$reentrantLock$$ = true
|
1556 |
vnode.state = (vnode.tag.prototype != null && typeof vnode.tag.prototype.view === "function") ? new vnode.tag(vnode) : vnode.tag(vnode)
|
1557 |
}
|
1558 |
+
initLifecycle(vnode.state, vnode, hooks)
|
1559 |
if (vnode.attrs != null) initLifecycle(vnode.attrs, vnode, hooks)
|
1560 |
+
vnode.instance = Vnode.normalize(callHook.call(vnode.state.view, vnode))
|
|
|
1561 |
if (vnode.instance === vnode) throw Error("A view cannot return the vnode it received as argument")
|
1562 |
sentinel.$$reentrantLock$$ = null
|
1563 |
}
|
1564 |
function createComponent(parent, vnode, hooks, ns, nextSibling) {
|
1565 |
initComponent(vnode, hooks)
|
1566 |
if (vnode.instance != null) {
|
1567 |
+
createNode(parent, vnode.instance, hooks, ns, nextSibling)
|
1568 |
vnode.dom = vnode.instance.dom
|
1569 |
vnode.domSize = vnode.dom != null ? vnode.instance.domSize : 0
|
|
|
|
|
1570 |
}
|
1571 |
else {
|
1572 |
vnode.domSize = 0
|
|
|
1573 |
}
|
1574 |
}
|
1575 |
+
|
1576 |
//update
|
1577 |
+
/**
|
1578 |
+
* @param {Element|Fragment} parent - the parent element
|
1579 |
+
* @param {Vnode[] | null} old - the list of vnodes of the last `render()` call for
|
1580 |
+
* this part of the tree
|
1581 |
+
* @param {Vnode[] | null} vnodes - as above, but for the current `render()` call.
|
1582 |
+
* @param {Function[]} hooks - an accumulator of post-render hooks (oncreate/onupdate)
|
1583 |
+
* @param {Element | null} nextSibling - the next DOM node if we're dealing with a
|
1584 |
+
* fragment that is not the last item in its
|
1585 |
+
* parent
|
1586 |
+
* @param {'svg' | 'math' | String | null} ns) - the current XML namespace, if any
|
1587 |
+
* @returns void
|
1588 |
+
*/
|
1589 |
+
// This function diffs and patches lists of vnodes, both keyed and unkeyed.
|
1590 |
+
//
|
1591 |
+
// We will:
|
1592 |
+
//
|
1593 |
+
// 1. describe its general structure
|
1594 |
+
// 2. focus on the diff algorithm optimizations
|
1595 |
+
// 3. discuss DOM node operations.
|
1596 |
+
|
1597 |
+
// ## Overview:
|
1598 |
+
//
|
1599 |
+
// The updateNodes() function:
|
1600 |
+
// - deals with trivial cases
|
1601 |
+
// - determines whether the lists are keyed or unkeyed based on the first non-null node
|
1602 |
+
// of each list.
|
1603 |
+
// - diffs them and patches the DOM if needed (that's the brunt of the code)
|
1604 |
+
// - manages the leftovers: after diffing, are there:
|
1605 |
+
// - old nodes left to remove?
|
1606 |
+
// - new nodes to insert?
|
1607 |
+
// deal with them!
|
1608 |
+
//
|
1609 |
+
// The lists are only iterated over once, with an exception for the nodes in `old` that
|
1610 |
+
// are visited in the fourth part of the diff and in the `removeNodes` loop.
|
1611 |
+
|
1612 |
+
// ## Diffing
|
1613 |
+
//
|
1614 |
+
// Reading https://github.com/localvoid/ivi/blob/ddc09d06abaef45248e6133f7040d00d3c6be853/packages/ivi/src/vdom/implementation.ts#L617-L837
|
1615 |
+
// may be good for context on longest increasing subsequence-based logic for moving nodes.
|
1616 |
+
//
|
1617 |
+
// In order to diff keyed lists, one has to
|
1618 |
+
//
|
1619 |
+
// 1) match nodes in both lists, per key, and update them accordingly
|
1620 |
+
// 2) create the nodes present in the new list, but absent in the old one
|
1621 |
+
// 3) remove the nodes present in the old list, but absent in the new one
|
1622 |
+
// 4) figure out what nodes in 1) to move in order to minimize the DOM operations.
|
1623 |
+
//
|
1624 |
+
// To achieve 1) one can create a dictionary of keys => index (for the old list), then iterate
|
1625 |
+
// over the new list and for each new vnode, find the corresponding vnode in the old list using
|
1626 |
+
// the map.
|
1627 |
+
// 2) is achieved in the same step: if a new node has no corresponding entry in the map, it is new
|
1628 |
+
// and must be created.
|
1629 |
+
// For the removals, we actually remove the nodes that have been updated from the old list.
|
1630 |
+
// The nodes that remain in that list after 1) and 2) have been performed can be safely removed.
|
1631 |
+
// The fourth step is a bit more complex and relies on the longest increasing subsequence (LIS)
|
1632 |
+
// algorithm.
|
1633 |
+
//
|
1634 |
+
// the longest increasing subsequence is the list of nodes that can remain in place. Imagine going
|
1635 |
+
// from `1,2,3,4,5` to `4,5,1,2,3` where the numbers are not necessarily the keys, but the indices
|
1636 |
+
// corresponding to the keyed nodes in the old list (keyed nodes `e,d,c,b,a` => `b,a,e,d,c` would
|
1637 |
+
// match the above lists, for example).
|
1638 |
+
//
|
1639 |
+
// In there are two increasing subsequences: `4,5` and `1,2,3`, the latter being the longest. We
|
1640 |
+
// can update those nodes without moving them, and only call `insertNode` on `4` and `5`.
|
1641 |
+
//
|
1642 |
+
// @localvoid adapted the algo to also support node deletions and insertions (the `lis` is actually
|
1643 |
+
// the longest increasing subsequence *of old nodes still present in the new list*).
|
1644 |
+
//
|
1645 |
+
// It is a general algorithm that is fireproof in all circumstances, but it requires the allocation
|
1646 |
+
// and the construction of a `key => oldIndex` map, and three arrays (one with `newIndex => oldIndex`,
|
1647 |
+
// the `LIS` and a temporary one to create the LIS).
|
1648 |
+
//
|
1649 |
+
// So we cheat where we can: if the tails of the lists are identical, they are guaranteed to be part of
|
1650 |
+
// the LIS and can be updated without moving them.
|
1651 |
+
//
|
1652 |
+
// If two nodes are swapped, they are guaranteed not to be part of the LIS, and must be moved (with
|
1653 |
+
// the exception of the last node if the list is fully reversed).
|
1654 |
+
//
|
1655 |
+
// ## Finding the next sibling.
|
1656 |
+
//
|
1657 |
+
// `updateNode()` and `createNode()` expect a nextSibling parameter to perform DOM operations.
|
1658 |
+
// When the list is being traversed top-down, at any index, the DOM nodes up to the previous
|
1659 |
+
// vnode reflect the content of the new list, whereas the rest of the DOM nodes reflect the old
|
1660 |
+
// list. The next sibling must be looked for in the old list using `getNextSibling(... oldStart + 1 ...)`.
|
1661 |
+
//
|
1662 |
+
// In the other scenarios (swaps, upwards traversal, map-based diff),
|
1663 |
+
// the new vnodes list is traversed upwards. The DOM nodes at the bottom of the list reflect the
|
1664 |
+
// bottom part of the new vnodes list, and we can use the `v.dom` value of the previous node
|
1665 |
+
// as the next sibling (cached in the `nextSibling` variable).
|
1666 |
+
|
1667 |
+
|
1668 |
+
// ## DOM node moves
|
1669 |
+
//
|
1670 |
+
// In most scenarios `updateNode()` and `createNode()` perform the DOM operations. However,
|
1671 |
+
// this is not the case if the node moved (second and fourth part of the diff algo). We move
|
1672 |
+
// the old DOM nodes before updateNode runs because it enables us to use the cached `nextSibling`
|
1673 |
+
// variable rather than fetching it using `getNextSibling()`.
|
1674 |
+
//
|
1675 |
+
// The fourth part of the diff currently inserts nodes unconditionally, leading to issues
|
1676 |
+
// like #1791 and #1999. We need to be smarter about those situations where adjascent old
|
1677 |
+
// nodes remain together in the new list in a way that isn't covered by parts one and
|
1678 |
+
// three of the diff algo.
|
1679 |
+
|
1680 |
+
function updateNodes(parent, old, vnodes, hooks, nextSibling, ns) {
|
1681 |
if (old === vnodes || old == null && vnodes == null) return
|
1682 |
+
else if (old == null || old.length === 0) createNodes(parent, vnodes, 0, vnodes.length, hooks, nextSibling, ns)
|
1683 |
+
else if (vnodes == null || vnodes.length === 0) removeNodes(parent, old, 0, old.length)
|
1684 |
else {
|
1685 |
+
var isOldKeyed = old[0] != null && old[0].key != null
|
1686 |
+
var isKeyed = vnodes[0] != null && vnodes[0].key != null
|
1687 |
+
var start = 0, oldStart = 0
|
1688 |
+
if (!isOldKeyed) while (oldStart < old.length && old[oldStart] == null) oldStart++
|
1689 |
+
if (!isKeyed) while (start < vnodes.length && vnodes[start] == null) start++
|
1690 |
+
if (isKeyed === null && isOldKeyed == null) return // both lists are full of nulls
|
1691 |
+
if (isOldKeyed !== isKeyed) {
|
1692 |
+
removeNodes(parent, old, oldStart, old.length)
|
1693 |
+
createNodes(parent, vnodes, start, vnodes.length, hooks, nextSibling, ns)
|
1694 |
+
} else if (!isKeyed) {
|
1695 |
+
// Don't index past the end of either list (causes deopts).
|
1696 |
+
var commonLength = old.length < vnodes.length ? old.length : vnodes.length
|
1697 |
+
// Rewind if necessary to the first non-null index on either side.
|
1698 |
+
// We could alternatively either explicitly create or remove nodes when `start !== oldStart`
|
1699 |
+
// but that would be optimizing for sparse lists which are more rare than dense ones.
|
1700 |
+
start = start < oldStart ? start : oldStart
|
1701 |
+
for (; start < commonLength; start++) {
|
1702 |
+
o = old[start]
|
1703 |
+
v = vnodes[start]
|
1704 |
+
if (o === v || o == null && v == null) continue
|
1705 |
+
else if (o == null) createNode(parent, v, hooks, ns, getNextSibling(old, start + 1, nextSibling))
|
1706 |
+
else if (v == null) removeNode(parent, o)
|
1707 |
+
else updateNode(parent, o, v, hooks, getNextSibling(old, start + 1, nextSibling), ns)
|
1708 |
}
|
1709 |
+
if (old.length > commonLength) removeNodes(parent, old, start, old.length)
|
1710 |
+
if (vnodes.length > commonLength) createNodes(parent, vnodes, start, vnodes.length, hooks, nextSibling, ns)
|
1711 |
+
} else {
|
1712 |
+
// keyed diff
|
1713 |
+
var oldEnd = old.length - 1, end = vnodes.length - 1, map, o, v, oe, ve, topSibling
|
1714 |
+
|
1715 |
+
// bottom-up
|
1716 |
+
while (oldEnd >= oldStart && end >= start) {
|
1717 |
+
oe = old[oldEnd]
|
1718 |
+
ve = vnodes[end]
|
1719 |
+
if (oe.key !== ve.key) break
|
1720 |
+
if (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)
|
1721 |
+
if (ve.dom != null) nextSibling = ve.dom
|
1722 |
+
oldEnd--, end--
|
1723 |
}
|
1724 |
+
// top-down
|
1725 |
+
while (oldEnd >= oldStart && end >= start) {
|
1726 |
+
o = old[oldStart]
|
1727 |
+
v = vnodes[start]
|
1728 |
+
if (o.key !== v.key) break
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1729 |
oldStart++, start++
|
1730 |
+
if (o !== v) updateNode(parent, o, v, hooks, getNextSibling(old, oldStart, nextSibling), ns)
|
|
|
1731 |
}
|
1732 |
+
// swaps and list reversals
|
1733 |
+
while (oldEnd >= oldStart && end >= start) {
|
1734 |
+
if (start === end) break
|
1735 |
+
if (o.key !== ve.key || oe.key !== v.key) break
|
1736 |
+
topSibling = getNextSibling(old, oldStart, nextSibling)
|
1737 |
+
moveNodes(parent, oe, topSibling)
|
1738 |
+
if (oe !== v) updateNode(parent, oe, v, hooks, topSibling, ns)
|
1739 |
+
if (++start <= --end) moveNodes(parent, o, nextSibling)
|
1740 |
+
if (o !== ve) updateNode(parent, o, ve, hooks, nextSibling, ns)
|
1741 |
+
if (ve.dom != null) nextSibling = ve.dom
|
1742 |
+
oldStart++; oldEnd--
|
1743 |
+
oe = old[oldEnd]
|
1744 |
+
ve = vnodes[end]
|
1745 |
+
o = old[oldStart]
|
1746 |
+
v = vnodes[start]
|
1747 |
}
|
1748 |
+
// bottom up once again
|
1749 |
+
while (oldEnd >= oldStart && end >= start) {
|
1750 |
+
if (oe.key !== ve.key) break
|
1751 |
+
if (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)
|
1752 |
+
if (ve.dom != null) nextSibling = ve.dom
|
|
|
|
|
|
|
|
|
|
|
|
|
1753 |
oldEnd--, end--
|
1754 |
+
oe = old[oldEnd]
|
1755 |
+
ve = vnodes[end]
|
1756 |
}
|
1757 |
+
if (start > end) removeNodes(parent, old, oldStart, oldEnd + 1)
|
1758 |
+
else if (oldStart > oldEnd) createNodes(parent, vnodes, start, end + 1, hooks, nextSibling, ns)
|
1759 |
else {
|
1760 |
+
// inspired by ivi https://github.com/ivijs/ivi/ by Boris Kaul
|
1761 |
+
var originalNextSibling = nextSibling, vnodesLength = end - start + 1, oldIndices = new Array(vnodesLength), li=0, i=0, pos = 2147483647, matched = 0, map, lisIndices
|
1762 |
+
for (i = 0; i < vnodesLength; i++) oldIndices[i] = -1
|
1763 |
+
for (i = end; i >= start; i--) {
|
1764 |
+
if (map == null) map = getKeyMap(old, oldStart, oldEnd + 1)
|
1765 |
+
ve = vnodes[i]
|
1766 |
+
var oldIndex = map[ve.key]
|
1767 |
if (oldIndex != null) {
|
1768 |
+
pos = (oldIndex < pos) ? oldIndex : -1 // becomes -1 if nodes were re-ordered
|
1769 |
+
oldIndices[i-start] = oldIndex
|
1770 |
+
oe = old[oldIndex]
|
1771 |
+
old[oldIndex] = null
|
1772 |
+
if (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)
|
1773 |
+
if (ve.dom != null) nextSibling = ve.dom
|
1774 |
+
matched++
|
1775 |
}
|
1776 |
+
}
|
1777 |
+
nextSibling = originalNextSibling
|
1778 |
+
if (matched !== oldEnd - oldStart + 1) removeNodes(parent, old, oldStart, oldEnd + 1)
|
1779 |
+
if (matched === 0) createNodes(parent, vnodes, start, end + 1, hooks, nextSibling, ns)
|
1780 |
+
else {
|
1781 |
+
if (pos === -1) {
|
1782 |
+
// the indices of the indices of the items that are part of the
|
1783 |
+
// longest increasing subsequence in the oldIndices list
|
1784 |
+
lisIndices = makeLisIndices(oldIndices)
|
1785 |
+
li = lisIndices.length - 1
|
1786 |
+
for (i = end; i >= start; i--) {
|
1787 |
+
v = vnodes[i]
|
1788 |
+
if (oldIndices[i-start] === -1) createNode(parent, v, hooks, ns, nextSibling)
|
1789 |
+
else {
|
1790 |
+
if (lisIndices[li] === i - start) li--
|
1791 |
+
else moveNodes(parent, v, nextSibling)
|
1792 |
+
}
|
1793 |
+
if (v.dom != null) nextSibling = vnodes[i].dom
|
1794 |
+
}
|
1795 |
+
} else {
|
1796 |
+
for (i = end; i >= start; i--) {
|
1797 |
+
v = vnodes[i]
|
1798 |
+
if (oldIndices[i-start] === -1) createNode(parent, v, hooks, ns, nextSibling)
|
1799 |
+
if (v.dom != null) nextSibling = vnodes[i].dom
|
1800 |
+
}
|
1801 |
}
|
1802 |
}
|
|
|
1803 |
}
|
|
|
1804 |
}
|
|
|
|
|
1805 |
}
|
1806 |
}
|
1807 |
+
function updateNode(parent, old, vnode, hooks, nextSibling, ns) {
|
1808 |
var oldTag = old.tag, tag = vnode.tag
|
1809 |
if (oldTag === tag) {
|
1810 |
vnode.state = old.state
|
|
|
1811 |
vnode.events = old.events
|
1812 |
+
if (shouldNotUpdate(vnode, old)) return
|
1813 |
if (typeof oldTag === "string") {
|
1814 |
if (vnode.attrs != null) {
|
1815 |
+
updateLifecycle(vnode.attrs, vnode, hooks)
|
|
|
|
|
|
|
|
|
1816 |
}
|
1817 |
switch (oldTag) {
|
1818 |
case "#": updateText(old, vnode); break
|
1819 |
+
case "<": updateHTML(parent, old, vnode, ns, nextSibling); break
|
1820 |
+
case "[": updateFragment(parent, old, vnode, hooks, nextSibling, ns); break
|
1821 |
+
default: updateElement(old, vnode, hooks, ns)
|
1822 |
}
|
1823 |
}
|
1824 |
+
else updateComponent(parent, old, vnode, hooks, nextSibling, ns)
|
1825 |
}
|
1826 |
else {
|
1827 |
+
removeNode(parent, old)
|
1828 |
createNode(parent, vnode, hooks, ns, nextSibling)
|
1829 |
}
|
1830 |
}
|
1834 |
}
|
1835 |
vnode.dom = old.dom
|
1836 |
}
|
1837 |
+
function updateHTML(parent, old, vnode, ns, nextSibling) {
|
1838 |
if (old.children !== vnode.children) {
|
1839 |
+
removeHTML(parent, old)
|
1840 |
+
createHTML(parent, vnode, ns, nextSibling)
|
1841 |
+
}
|
1842 |
+
else {
|
1843 |
+
vnode.dom = old.dom
|
1844 |
+
vnode.domSize = old.domSize
|
1845 |
+
vnode.instance = old.instance
|
1846 |
}
|
|
|
1847 |
}
|
1848 |
+
function updateFragment(parent, old, vnode, hooks, nextSibling, ns) {
|
1849 |
+
updateNodes(parent, old.children, vnode.children, hooks, nextSibling, ns)
|
1850 |
var domSize = 0, children = vnode.children
|
1851 |
vnode.dom = null
|
1852 |
if (children != null) {
|
1860 |
if (domSize !== 1) vnode.domSize = domSize
|
1861 |
}
|
1862 |
}
|
1863 |
+
function updateElement(old, vnode, hooks, ns) {
|
1864 |
var element = vnode.dom = old.dom
|
1865 |
ns = getNameSpace(vnode) || ns
|
1866 |
+
|
1867 |
if (vnode.tag === "textarea") {
|
1868 |
if (vnode.attrs == null) vnode.attrs = {}
|
1869 |
if (vnode.text != null) {
|
1870 |
+
vnode.attrs.value = vnode.text //FIXME handle multiple children
|
1871 |
vnode.text = undefined
|
1872 |
}
|
1873 |
}
|
1874 |
updateAttrs(vnode, old.attrs, vnode.attrs, ns)
|
1875 |
+
if (!maybeSetContentEditable(vnode)) {
|
1876 |
+
if (old.text != null && vnode.text != null && vnode.text !== "") {
|
1877 |
+
if (old.text.toString() !== vnode.text.toString()) old.dom.firstChild.nodeValue = vnode.text
|
1878 |
+
}
|
1879 |
+
else {
|
1880 |
+
if (old.text != null) old.children = [Vnode("#", undefined, undefined, old.text, undefined, old.dom.firstChild)]
|
1881 |
+
if (vnode.text != null) vnode.children = [Vnode("#", undefined, undefined, vnode.text, undefined, undefined)]
|
1882 |
+
updateNodes(element, old.children, vnode.children, hooks, null, ns)
|
1883 |
+
}
|
|
|
1884 |
}
|
1885 |
}
|
1886 |
+
function updateComponent(parent, old, vnode, hooks, nextSibling, ns) {
|
1887 |
+
vnode.instance = Vnode.normalize(callHook.call(vnode.state.view, vnode))
|
1888 |
+
if (vnode.instance === vnode) throw Error("A view cannot return the vnode it received as argument")
|
1889 |
+
updateLifecycle(vnode.state, vnode, hooks)
|
1890 |
+
if (vnode.attrs != null) updateLifecycle(vnode.attrs, vnode, hooks)
|
|
|
|
|
|
|
|
|
1891 |
if (vnode.instance != null) {
|
1892 |
if (old.instance == null) createNode(parent, vnode.instance, hooks, ns, nextSibling)
|
1893 |
+
else updateNode(parent, old.instance, vnode.instance, hooks, nextSibling, ns)
|
1894 |
vnode.dom = vnode.instance.dom
|
1895 |
vnode.domSize = vnode.instance.domSize
|
1896 |
}
|
1897 |
else if (old.instance != null) {
|
1898 |
+
removeNode(parent, old.instance)
|
1899 |
vnode.dom = undefined
|
1900 |
vnode.domSize = 0
|
1901 |
}
|
1904 |
vnode.domSize = old.domSize
|
1905 |
}
|
1906 |
}
|
1907 |
+
function getKeyMap(vnodes, start, end) {
|
1908 |
+
var map = Object.create(null)
|
1909 |
+
for (; start < end; start++) {
|
1910 |
+
var vnode = vnodes[start]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1911 |
if (vnode != null) {
|
1912 |
+
var key = vnode.key
|
1913 |
+
if (key != null) map[key] = start
|
1914 |
}
|
1915 |
}
|
1916 |
return map
|
1917 |
}
|
1918 |
+
// Lifted from ivi https://github.com/ivijs/ivi/
|
1919 |
+
// takes a list of unique numbers (-1 is special and can
|
1920 |
+
// occur multiple times) and returns an array with the indices
|
1921 |
+
// of the items that are part of the longest increasing
|
1922 |
+
// subsequece
|
1923 |
+
var lisTemp = []
|
1924 |
+
function makeLisIndices(a) {
|
1925 |
+
var result = [0]
|
1926 |
+
var u = 0, v = 0, i = 0
|
1927 |
+
var il = lisTemp.length = a.length
|
1928 |
+
for (var i = 0; i < il; i++) lisTemp[i] = a[i]
|
1929 |
+
for (var i = 0; i < il; ++i) {
|
1930 |
+
if (a[i] === -1) continue
|
1931 |
+
var j = result[result.length - 1]
|
1932 |
+
if (a[j] < a[i]) {
|
1933 |
+
lisTemp[i] = j
|
1934 |
+
result.push(i)
|
1935 |
+
continue
|
1936 |
+
}
|
1937 |
+
u = 0
|
1938 |
+
v = result.length - 1
|
1939 |
+
while (u < v) {
|
1940 |
+
// Fast integer average without overflow.
|
1941 |
+
// eslint-disable-next-line no-bitwise
|
1942 |
+
var c = (u >>> 1) + (v >>> 1) + (u & v & 1)
|
1943 |
+
if (a[result[c]] < a[i]) {
|
1944 |
+
u = c + 1
|
1945 |
+
}
|
1946 |
+
else {
|
1947 |
+
v = c
|
1948 |
+
}
|
1949 |
}
|
1950 |
+
if (a[i] < a[result[u]]) {
|
1951 |
+
if (u > 0) lisTemp[i] = result[u - 1]
|
1952 |
+
result[u] = i
|
1953 |
+
}
|
1954 |
+
}
|
1955 |
+
u = result.length
|
1956 |
+
v = result[u - 1]
|
1957 |
+
while (u-- > 0) {
|
1958 |
+
result[u] = v
|
1959 |
+
v = lisTemp[v]
|
1960 |
}
|
1961 |
+
lisTemp.length = 0
|
1962 |
+
return result
|
1963 |
}
|
1964 |
+
|
1965 |
function getNextSibling(vnodes, i, nextSibling) {
|
1966 |
for (; i < vnodes.length; i++) {
|
1967 |
if (vnodes[i] != null && vnodes[i].dom != null) return vnodes[i].dom
|
1968 |
}
|
1969 |
return nextSibling
|
1970 |
}
|
1971 |
+
|
1972 |
+
// This covers a really specific edge case:
|
1973 |
+
// - Parent node is keyed and contains child
|
1974 |
+
// - Child is removed, returns unresolved promise in `onbeforeremove`
|
1975 |
+
// - Parent node is moved in keyed diff
|
1976 |
+
// - Remaining children still need moved appropriately
|
1977 |
+
//
|
1978 |
+
// Ideally, I'd track removed nodes as well, but that introduces a lot more
|
1979 |
+
// complexity and I'm not exactly interested in doing that.
|
1980 |
+
function moveNodes(parent, vnode, nextSibling) {
|
1981 |
+
var frag = $doc.createDocumentFragment()
|
1982 |
+
moveChildToFrag(parent, frag, vnode)
|
1983 |
+
insertNode(parent, frag, nextSibling)
|
1984 |
+
}
|
1985 |
+
function moveChildToFrag(parent, frag, vnode) {
|
1986 |
+
// Dodge the recursion overhead in a few of the most common cases.
|
1987 |
+
while (vnode.dom != null && vnode.dom.parentNode === parent) {
|
1988 |
+
if (typeof vnode.tag !== "string") {
|
1989 |
+
vnode = vnode.instance
|
1990 |
+
if (vnode != null) continue
|
1991 |
+
} else if (vnode.tag === "<") {
|
1992 |
+
for (var i = 0; i < vnode.instance.length; i++) {
|
1993 |
+
frag.appendChild(vnode.instance[i])
|
1994 |
+
}
|
1995 |
+
} else if (vnode.tag !== "[") {
|
1996 |
+
// Don't recurse for text nodes *or* elements, just fragments
|
1997 |
+
frag.appendChild(vnode.dom)
|
1998 |
+
} else if (vnode.children.length === 1) {
|
1999 |
+
vnode = vnode.children[0]
|
2000 |
+
if (vnode != null) continue
|
2001 |
+
} else {
|
2002 |
+
for (var i = 0; i < vnode.children.length; i++) {
|
2003 |
+
var child = vnode.children[i]
|
2004 |
+
if (child != null) moveChildToFrag(parent, frag, child)
|
2005 |
+
}
|
2006 |
+
}
|
2007 |
+
break
|
2008 |
+
}
|
2009 |
+
}
|
2010 |
+
|
2011 |
function insertNode(parent, dom, nextSibling) {
|
2012 |
+
if (nextSibling != null) parent.insertBefore(dom, nextSibling)
|
2013 |
else parent.appendChild(dom)
|
2014 |
}
|
2015 |
+
|
2016 |
+
function maybeSetContentEditable(vnode) {
|
2017 |
+
if (vnode.attrs == null || (
|
2018 |
+
vnode.attrs.contenteditable == null && // attribute
|
2019 |
+
vnode.attrs.contentEditable == null // property
|
2020 |
+
)) return false
|
2021 |
var children = vnode.children
|
2022 |
if (children != null && children.length === 1 && children[0].tag === "<") {
|
2023 |
var content = children[0].children
|
2024 |
if (vnode.dom.innerHTML !== content) vnode.dom.innerHTML = content
|
2025 |
}
|
2026 |
else if (vnode.text != null || children != null && children.length !== 0) throw new Error("Child node of a contenteditable must be trusted")
|
2027 |
+
return true
|
2028 |
}
|
2029 |
+
|
2030 |
//remove
|
2031 |
+
function removeNodes(parent, vnodes, start, end) {
|
2032 |
for (var i = start; i < end; i++) {
|
2033 |
var vnode = vnodes[i]
|
2034 |
+
if (vnode != null) removeNode(parent, vnode)
|
|
|
|
|
|
|
2035 |
}
|
2036 |
}
|
2037 |
+
function removeNode(parent, vnode) {
|
2038 |
+
var mask = 0
|
2039 |
+
var original = vnode.state
|
2040 |
+
var stateResult, attrsResult
|
2041 |
+
if (typeof vnode.tag !== "string" && typeof vnode.state.onbeforeremove === "function") {
|
2042 |
+
var result = callHook.call(vnode.state.onbeforeremove, vnode)
|
2043 |
if (result != null && typeof result.then === "function") {
|
2044 |
+
mask = 1
|
2045 |
+
stateResult = result
|
2046 |
}
|
2047 |
}
|
2048 |
+
if (vnode.attrs && typeof vnode.attrs.onbeforeremove === "function") {
|
2049 |
+
var result = callHook.call(vnode.attrs.onbeforeremove, vnode)
|
2050 |
if (result != null && typeof result.then === "function") {
|
2051 |
+
// eslint-disable-next-line no-bitwise
|
2052 |
+
mask |= 2
|
2053 |
+
attrsResult = result
|
2054 |
}
|
2055 |
}
|
2056 |
+
checkState(vnode, original)
|
2057 |
+
|
2058 |
+
// If we can, try to fast-path it and avoid all the overhead of awaiting
|
2059 |
+
if (!mask) {
|
2060 |
+
onremove(vnode)
|
2061 |
+
removeChild(parent, vnode)
|
2062 |
+
} else {
|
2063 |
+
if (stateResult != null) {
|
2064 |
+
var next = function () {
|
2065 |
+
// eslint-disable-next-line no-bitwise
|
2066 |
+
if (mask & 1) { mask &= 2; if (!mask) reallyRemove() }
|
2067 |
+
}
|
2068 |
+
stateResult.then(next, next)
|
2069 |
+
}
|
2070 |
+
if (attrsResult != null) {
|
2071 |
+
var next = function () {
|
2072 |
+
// eslint-disable-next-line no-bitwise
|
2073 |
+
if (mask & 2) { mask &= 1; if (!mask) reallyRemove() }
|
2074 |
+
}
|
2075 |
+
attrsResult.then(next, next)
|
2076 |
+
}
|
2077 |
+
}
|
2078 |
+
|
2079 |
+
function reallyRemove() {
|
2080 |
+
checkState(vnode, original)
|
2081 |
+
onremove(vnode)
|
2082 |
+
removeChild(parent, vnode)
|
2083 |
+
}
|
2084 |
+
}
|
2085 |
+
function removeHTML(parent, vnode) {
|
2086 |
+
for (var i = 0; i < vnode.instance.length; i++) {
|
2087 |
+
parent.removeChild(vnode.instance[i])
|
2088 |
+
}
|
2089 |
+
}
|
2090 |
+
function removeChild(parent, vnode) {
|
2091 |
+
// Dodge the recursion overhead in a few of the most common cases.
|
2092 |
+
while (vnode.dom != null && vnode.dom.parentNode === parent) {
|
2093 |
+
if (typeof vnode.tag !== "string") {
|
2094 |
+
vnode = vnode.instance
|
2095 |
+
if (vnode != null) continue
|
2096 |
+
} else if (vnode.tag === "<") {
|
2097 |
+
removeHTML(parent, vnode)
|
2098 |
+
} else {
|
2099 |
+
if (vnode.tag !== "[") {
|
2100 |
+
parent.removeChild(vnode.dom)
|
2101 |
+
if (!Array.isArray(vnode.children)) break
|
2102 |
+
}
|
2103 |
+
if (vnode.children.length === 1) {
|
2104 |
+
vnode = vnode.children[0]
|
2105 |
+
if (vnode != null) continue
|
2106 |
+
} else {
|
2107 |
+
for (var i = 0; i < vnode.children.length; i++) {
|
2108 |
+
var child = vnode.children[i]
|
2109 |
+
if (child != null) removeChild(parent, child)
|
2110 |
}
|
2111 |
}
|
2112 |
}
|
2113 |
+
break
|
2114 |
}
|
2115 |
}
|
|
|
|
|
|
|
|
|
2116 |
function onremove(vnode) {
|
2117 |
+
if (typeof vnode.tag !== "string" && typeof vnode.state.onremove === "function") callHook.call(vnode.state.onremove, vnode)
|
2118 |
+
if (vnode.attrs && typeof vnode.attrs.onremove === "function") callHook.call(vnode.attrs.onremove, vnode)
|
2119 |
if (typeof vnode.tag !== "string") {
|
|
|
2120 |
if (vnode.instance != null) onremove(vnode.instance)
|
2121 |
} else {
|
2122 |
var children = vnode.children
|
2128 |
}
|
2129 |
}
|
2130 |
}
|
2131 |
+
|
2132 |
+
//attrs
|
2133 |
+
function setAttrs(vnode, attrs, ns) {
|
2134 |
+
for (var key in attrs) {
|
2135 |
+
setAttr(vnode, key, null, attrs[key], ns)
|
2136 |
}
|
2137 |
}
|
2138 |
+
function setAttr(vnode, key, old, value, ns) {
|
2139 |
+
if (key === "key" || key === "is" || value == null || isLifecycleMethod(key) || (old === value && !isFormAttribute(vnode, key)) && typeof value !== "object") return
|
2140 |
+
if (key[0] === "o" && key[1] === "n") return updateEvent(vnode, key, value)
|
2141 |
+
if (key.slice(0, 6) === "xlink:") vnode.dom.setAttributeNS("http://www.w3.org/1999/xlink", key.slice(6), value)
|
2142 |
+
else if (key === "style") updateStyle(vnode.dom, old, value)
|
2143 |
+
else if (hasPropertyKey(vnode, key, ns)) {
|
2144 |
+
if (key === "value") {
|
2145 |
+
// Only do the coercion if we're actually going to check the value.
|
2146 |
+
/* eslint-disable no-implicit-coercion */
|
|
|
|
|
|
|
2147 |
//setting input[value] to same value by typing on focused element moves cursor to end in Chrome
|
2148 |
+
if ((vnode.tag === "input" || vnode.tag === "textarea") && vnode.dom.value === "" + value && vnode.dom === activeElement()) return
|
2149 |
//setting select[value] to same value while having select open blinks select dropdown in Chrome
|
2150 |
+
if (vnode.tag === "select" && old !== null && vnode.dom.value === "" + value) return
|
|
|
|
|
|
|
|
|
|
|
|
|
2151 |
//setting option[value] to same value while having select open blinks select dropdown in Chrome
|
2152 |
+
if (vnode.tag === "option" && old !== null && vnode.dom.value === "" + value) return
|
2153 |
+
/* eslint-enable no-implicit-coercion */
|
2154 |
}
|
2155 |
+
// If you assign an input type that is not supported by IE 11 with an assignment expression, an error will occur.
|
2156 |
+
if (vnode.tag === "input" && key === "type") vnode.dom.setAttribute(key, value)
|
2157 |
+
else vnode.dom[key] = value
|
2158 |
+
} else {
|
|
|
|
|
|
|
|
|
2159 |
if (typeof value === "boolean") {
|
2160 |
+
if (value) vnode.dom.setAttribute(key, "")
|
2161 |
+
else vnode.dom.removeAttribute(key)
|
2162 |
+
}
|
2163 |
+
else vnode.dom.setAttribute(key === "className" ? "class" : key, value)
|
2164 |
+
}
|
2165 |
+
}
|
2166 |
+
function removeAttr(vnode, key, old, ns) {
|
2167 |
+
if (key === "key" || key === "is" || old == null || isLifecycleMethod(key)) return
|
2168 |
+
if (key[0] === "o" && key[1] === "n" && !isLifecycleMethod(key)) updateEvent(vnode, key, undefined)
|
2169 |
+
else if (key === "style") updateStyle(vnode.dom, old, null)
|
2170 |
+
else if (
|
2171 |
+
hasPropertyKey(vnode, key, ns)
|
2172 |
+
&& key !== "className"
|
2173 |
+
&& !(key === "value" && (
|
2174 |
+
vnode.tag === "option"
|
2175 |
+
|| vnode.tag === "select" && vnode.dom.selectedIndex === -1 && vnode.dom === activeElement()
|
2176 |
+
))
|
2177 |
+
&& !(vnode.tag === "input" && key === "type")
|
2178 |
+
) {
|
2179 |
+
vnode.dom[key] = null
|
2180 |
+
} else {
|
2181 |
+
var nsLastIndex = key.indexOf(":")
|
2182 |
+
if (nsLastIndex !== -1) key = key.slice(nsLastIndex + 1)
|
2183 |
+
if (old !== false) vnode.dom.removeAttribute(key === "className" ? "class" : key)
|
2184 |
+
}
|
2185 |
+
}
|
2186 |
+
function setLateSelectAttrs(vnode, attrs) {
|
2187 |
+
if ("value" in attrs) {
|
2188 |
+
if(attrs.value === null) {
|
2189 |
+
if (vnode.dom.selectedIndex !== -1) vnode.dom.value = null
|
2190 |
+
} else {
|
2191 |
+
var normalized = "" + attrs.value // eslint-disable-line no-implicit-coercion
|
2192 |
+
if (vnode.dom.value !== normalized || vnode.dom.selectedIndex === -1) {
|
2193 |
+
vnode.dom.value = normalized
|
2194 |
+
}
|
2195 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2196 |
}
|
2197 |
+
if ("selectedIndex" in attrs) setAttr(vnode, "selectedIndex", null, attrs.selectedIndex, undefined)
|
2198 |
}
|
2199 |
+
function updateAttrs(vnode, old, attrs, ns) {
|
2200 |
+
if (attrs != null) {
|
2201 |
+
for (var key in attrs) {
|
2202 |
+
setAttr(vnode, key, old && old[key], attrs[key], ns)
|
2203 |
}
|
2204 |
}
|
2205 |
+
var val
|
2206 |
if (old != null) {
|
2207 |
+
for (var key in old) {
|
2208 |
+
if (((val = old[key]) != null) && (attrs == null || attrs[key] == null)) {
|
2209 |
+
removeAttr(vnode, key, val, ns)
|
|
|
|
|
2210 |
}
|
2211 |
}
|
2212 |
}
|
2213 |
}
|
2214 |
function isFormAttribute(vnode, attr) {
|
2215 |
+
return attr === "value" || attr === "checked" || attr === "selectedIndex" || attr === "selected" && vnode.dom === activeElement() || vnode.tag === "option" && vnode.dom.parentNode === $doc.activeElement
|
2216 |
}
|
2217 |
function isLifecycleMethod(attr) {
|
2218 |
return attr === "oninit" || attr === "oncreate" || attr === "onupdate" || attr === "onremove" || attr === "onbeforeremove" || attr === "onbeforeupdate"
|
2219 |
}
|
2220 |
+
function hasPropertyKey(vnode, key, ns) {
|
2221 |
+
// Filter out namespaced keys
|
2222 |
+
return ns === undefined && (
|
2223 |
+
// If it's a custom element, just keep it.
|
2224 |
+
vnode.tag.indexOf("-") > -1 || vnode.attrs != null && vnode.attrs.is ||
|
2225 |
+
// If it's a normal element, let's try to avoid a few browser bugs.
|
2226 |
+
key !== "href" && key !== "list" && key !== "form" && key !== "width" && key !== "height"// && key !== "type"
|
2227 |
+
// Defer the property check until *after* we check everything.
|
2228 |
+
) && key in vnode.dom
|
2229 |
}
|
2230 |
+
|
2231 |
//style
|
2232 |
+
var uppercaseRegex = /[A-Z]/g
|
2233 |
+
function toLowerCase(capital) { return "-" + capital.toLowerCase() }
|
2234 |
+
function normalizeKey(key) {
|
2235 |
+
return key[0] === "-" && key[1] === "-" ? key :
|
2236 |
+
key === "cssFloat" ? "float" :
|
2237 |
+
key.replace(uppercaseRegex, toLowerCase)
|
2238 |
+
}
|
2239 |
function updateStyle(element, old, style) {
|
2240 |
+
if (old === style) {
|
2241 |
+
// Styles are equivalent, do nothing.
|
2242 |
+
} else if (style == null) {
|
2243 |
+
// New style is missing, just clear it.
|
2244 |
+
element.style.cssText = ""
|
2245 |
+
} else if (typeof style !== "object") {
|
2246 |
+
// New style is a string, let engine deal with patching.
|
2247 |
+
element.style.cssText = style
|
2248 |
+
} else if (old == null || typeof old !== "object") {
|
2249 |
+
// `old` is missing or a string, `style` is an object.
|
2250 |
+
element.style.cssText = ""
|
2251 |
+
// Add new style properties
|
2252 |
+
for (var key in style) {
|
2253 |
+
var value = style[key]
|
2254 |
+
if (value != null) element.style.setProperty(normalizeKey(key), String(value))
|
2255 |
+
}
|
2256 |
+
} else {
|
2257 |
+
// Both old & new are (different) objects.
|
2258 |
+
// Update style properties that have changed
|
2259 |
+
for (var key in style) {
|
2260 |
+
var value = style[key]
|
2261 |
+
if (value != null && (value = String(value)) !== String(old[key])) {
|
2262 |
+
element.style.setProperty(normalizeKey(key), value)
|
2263 |
+
}
|
2264 |
}
|
2265 |
+
// Remove style properties that no longer exist
|
2266 |
+
for (var key in old) {
|
2267 |
+
if (old[key] != null && style[key] == null) {
|
2268 |
+
element.style.removeProperty(normalizeKey(key))
|
2269 |
}
|
2270 |
}
|
2271 |
}
|
2272 |
}
|
2273 |
+
|
2274 |
+
// Here's an explanation of how this works:
|
2275 |
+
// 1. The event names are always (by design) prefixed by `on`.
|
2276 |
+
// 2. The EventListener interface accepts either a function or an object
|
2277 |
+
// with a `handleEvent` method.
|
2278 |
+
// 3. The object does not inherit from `Object.prototype`, to avoid
|
2279 |
+
// any potential interference with that (e.g. setters).
|
2280 |
+
// 4. The event name is remapped to the handler before calling it.
|
2281 |
+
// 5. In function-based event handlers, `ev.target === this`. We replicate
|
2282 |
+
// that below.
|
2283 |
+
// 6. In function-based event handlers, `return false` prevents the default
|
2284 |
+
// action and stops event propagation. We replicate that below.
|
2285 |
+
function EventDict() {
|
2286 |
+
// Save this, so the current redraw is correctly tracked.
|
2287 |
+
this._ = currentRedraw
|
2288 |
+
}
|
2289 |
+
EventDict.prototype = Object.create(null)
|
2290 |
+
EventDict.prototype.handleEvent = function (ev) {
|
2291 |
+
var handler = this["on" + ev.type]
|
2292 |
+
var result
|
2293 |
+
if (typeof handler === "function") result = handler.call(ev.currentTarget, ev)
|
2294 |
+
else if (typeof handler.handleEvent === "function") handler.handleEvent(ev)
|
2295 |
+
if (this._ && ev.redraw !== false) (0, this._)()
|
2296 |
+
if (result === false) {
|
2297 |
+
ev.preventDefault()
|
2298 |
+
ev.stopPropagation()
|
2299 |
+
}
|
2300 |
+
}
|
2301 |
+
|
2302 |
//event
|
2303 |
+
function updateEvent(vnode, key, value) {
|
2304 |
+
if (vnode.events != null) {
|
2305 |
+
if (vnode.events[key] === value) return
|
2306 |
+
if (value != null && (typeof value === "function" || typeof value === "object")) {
|
2307 |
+
if (vnode.events[key] == null) vnode.dom.addEventListener(key.slice(2), vnode.events, false)
|
2308 |
+
vnode.events[key] = value
|
2309 |
+
} else {
|
2310 |
+
if (vnode.events[key] != null) vnode.dom.removeEventListener(key.slice(2), vnode.events, false)
|
2311 |
+
vnode.events[key] = undefined
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2312 |
}
|
2313 |
+
} else if (value != null && (typeof value === "function" || typeof value === "object")) {
|
2314 |
+
vnode.events = new EventDict()
|
2315 |
+
vnode.dom.addEventListener(key.slice(2), vnode.events, false)
|
2316 |
+
vnode.events[key] = value
|
2317 |
}
|
2318 |
}
|
2319 |
+
|
2320 |
//lifecycle
|
2321 |
function initLifecycle(source, vnode, hooks) {
|
2322 |
+
if (typeof source.oninit === "function") callHook.call(source.oninit, vnode)
|
2323 |
+
if (typeof source.oncreate === "function") hooks.push(callHook.bind(source.oncreate, vnode))
|
2324 |
}
|
2325 |
function updateLifecycle(source, vnode, hooks) {
|
2326 |
+
if (typeof source.onupdate === "function") hooks.push(callHook.bind(source.onupdate, vnode))
|
2327 |
}
|
2328 |
function shouldNotUpdate(vnode, old) {
|
2329 |
+
do {
|
2330 |
+
if (vnode.attrs != null && typeof vnode.attrs.onbeforeupdate === "function") {
|
2331 |
+
var force = callHook.call(vnode.attrs.onbeforeupdate, vnode, old)
|
2332 |
+
if (force !== undefined && !force) break
|
2333 |
+
}
|
2334 |
+
if (typeof vnode.tag !== "string" && typeof vnode.state.onbeforeupdate === "function") {
|
2335 |
+
var force = callHook.call(vnode.state.onbeforeupdate, vnode, old)
|
2336 |
+
if (force !== undefined && !force) break
|
2337 |
+
}
|
2338 |
+
return false
|
2339 |
+
} while (false); // eslint-disable-line no-constant-condition
|
2340 |
+
vnode.dom = old.dom
|
2341 |
+
vnode.domSize = old.domSize
|
2342 |
+
vnode.instance = old.instance
|
2343 |
+
// One would think having the actual latest attributes would be ideal,
|
2344 |
+
// but it doesn't let us properly diff based on our current internal
|
2345 |
+
// representation. We have to save not only the old DOM info, but also
|
2346 |
+
// the attributes used to create it, as we diff *that*, not against the
|
2347 |
+
// DOM directly (with a few exceptions in `setAttr`). And, of course, we
|
2348 |
+
// need to save the children and text as they are conceptually not
|
2349 |
+
// unlike special "attributes" internally.
|
2350 |
+
vnode.attrs = old.attrs
|
2351 |
+
vnode.children = old.children
|
2352 |
+
vnode.text = old.text
|
2353 |
+
return true
|
2354 |
+
}
|
2355 |
+
|
2356 |
+
return function(dom, vnodes, redraw) {
|
2357 |
+
if (!dom) throw new TypeError("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.")
|
2358 |
var hooks = []
|
2359 |
+
var active = activeElement()
|
2360 |
var namespace = dom.namespaceURI
|
2361 |
+
|
2362 |
+
// First time rendering into a node clears it out
|
2363 |
if (dom.vnodes == null) dom.textContent = ""
|
2364 |
+
|
2365 |
+
vnodes = Vnode.normalizeChildren(Array.isArray(vnodes) ? vnodes : [vnodes])
|
2366 |
+
var prevRedraw = currentRedraw
|
2367 |
+
try {
|
2368 |
+
currentRedraw = typeof redraw === "function" ? redraw : undefined
|
2369 |
+
updateNodes(dom, dom.vnodes, vnodes, hooks, null, namespace === "http://www.w3.org/1999/xhtml" ? undefined : namespace)
|
2370 |
+
} finally {
|
2371 |
+
currentRedraw = prevRedraw
|
2372 |
+
}
|
2373 |
dom.vnodes = vnodes
|
2374 |
+
// `document.activeElement` can return null: https://html.spec.whatwg.org/multipage/interaction.html#dom-document-activeelement
|
2375 |
+
if (active != null && activeElement() !== active && typeof active.focus === "function") active.focus()
|
2376 |
for (var i = 0; i < hooks.length; i++) hooks[i]()
|
2377 |
}
|
|
|
2378 |
}
|
2379 |
+
|
2380 |
+
},{"../render/vnode":29}],28:[function(require,module,exports){
|
2381 |
+
"use strict"
|
2382 |
+
|
2383 |
+
var Vnode = require("../render/vnode")
|
2384 |
+
|
2385 |
+
module.exports = function(html) {
|
2386 |
+
if (html == null) html = ""
|
2387 |
+
return Vnode("<", undefined, undefined, html, undefined, undefined)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2388 |
}
|
2389 |
+
|
2390 |
+
},{"../render/vnode":29}],29:[function(require,module,exports){
|
2391 |
+
"use strict"
|
2392 |
+
|
2393 |
+
function Vnode(tag, key, attrs, children, text, dom) {
|
2394 |
+
return {tag: tag, key: key, attrs: attrs, children: children, text: text, dom: dom, domSize: undefined, state: undefined, events: undefined, instance: undefined}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2395 |
}
|
2396 |
+
Vnode.normalize = function(node) {
|
2397 |
+
if (Array.isArray(node)) return Vnode("[", undefined, undefined, Vnode.normalizeChildren(node), undefined, undefined)
|
2398 |
+
if (node == null || typeof node === "boolean") return null
|
2399 |
+
if (typeof node === "object") return node
|
2400 |
+
return Vnode("#", undefined, undefined, String(node), undefined, undefined)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2401 |
}
|
2402 |
+
Vnode.normalizeChildren = function(input) {
|
2403 |
+
var children = []
|
2404 |
+
if (input.length) {
|
2405 |
+
var isKeyed = input[0] != null && input[0].key != null
|
2406 |
+
// Note: this is a *very* perf-sensitive check.
|
2407 |
+
// Fun fact: merging the loop like this is somehow faster than splitting
|
2408 |
+
// it, noticeably so.
|
2409 |
+
for (var i = 1; i < input.length; i++) {
|
2410 |
+
if ((input[i] != null && input[i].key != null) !== isKeyed) {
|
2411 |
+
throw new TypeError("Vnodes must either always have keys or never have keys!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2412 |
}
|
2413 |
+
}
|
2414 |
+
for (var i = 0; i < input.length; i++) {
|
2415 |
+
children[i] = Vnode.normalize(input[i])
|
2416 |
}
|
2417 |
}
|
2418 |
+
return children
|
2419 |
}
|
2420 |
+
|
2421 |
+
module.exports = Vnode
|
2422 |
+
|
2423 |
+
},{}],30:[function(require,module,exports){
|
2424 |
+
"use strict"
|
2425 |
+
|
2426 |
+
var PromisePolyfill = require("./promise/promise")
|
2427 |
+
var mountRedraw = require("./mount-redraw")
|
2428 |
+
|
2429 |
+
module.exports = require("./request/request")(window, PromisePolyfill, mountRedraw.redraw)
|
2430 |
+
|
2431 |
+
},{"./mount-redraw":14,"./promise/promise":20,"./request/request":31}],31:[function(require,module,exports){
|
2432 |
+
"use strict"
|
2433 |
+
|
2434 |
+
var buildPathname = require("../pathname/build")
|
2435 |
+
|
2436 |
+
module.exports = function($window, Promise, oncompletion) {
|
2437 |
+
var callbackCount = 0
|
2438 |
+
|
2439 |
+
function PromiseProxy(executor) {
|
2440 |
+
return new Promise(executor)
|
2441 |
+
}
|
2442 |
+
|
2443 |
+
// In case the global Promise is some userland library's where they rely on
|
2444 |
+
// `foo instanceof this.constructor`, `this.constructor.resolve(value)`, or
|
2445 |
+
// similar. Let's *not* break them.
|
2446 |
+
PromiseProxy.prototype = Promise.prototype
|
2447 |
+
PromiseProxy.__proto__ = Promise // eslint-disable-line no-proto
|
2448 |
+
|
2449 |
+
function makeRequest(factory) {
|
2450 |
+
return function(url, args) {
|
2451 |
+
if (typeof url !== "string") { args = url; url = url.url }
|
2452 |
+
else if (args == null) args = {}
|
2453 |
+
var promise = new Promise(function(resolve, reject) {
|
2454 |
+
factory(buildPathname(url, args.params), args, function (data) {
|
2455 |
+
if (typeof args.type === "function") {
|
2456 |
+
if (Array.isArray(data)) {
|
2457 |
+
for (var i = 0; i < data.length; i++) {
|
2458 |
+
data[i] = new args.type(data[i])
|
2459 |
+
}
|
2460 |
+
}
|
2461 |
+
else data = new args.type(data)
|
2462 |
+
}
|
2463 |
+
resolve(data)
|
2464 |
+
}, reject)
|
2465 |
})
|
2466 |
+
if (args.background === true) return promise
|
2467 |
+
var count = 0
|
2468 |
+
function complete() {
|
2469 |
+
if (--count === 0 && typeof oncompletion === "function") oncompletion()
|
2470 |
+
}
|
2471 |
+
|
2472 |
+
return wrap(promise)
|
2473 |
+
|
2474 |
+
function wrap(promise) {
|
2475 |
+
var then = promise.then
|
2476 |
+
// Set the constructor, so engines know to not await or resolve
|
2477 |
+
// this as a native promise. At the time of writing, this is
|
2478 |
+
// only necessary for V8, but their behavior is the correct
|
2479 |
+
// behavior per spec. See this spec issue for more details:
|
2480 |
+
// https://github.com/tc39/ecma262/issues/1577. Also, see the
|
2481 |
+
// corresponding comment in `request/tests/test-request.js` for
|
2482 |
+
// a bit more background on the issue at hand.
|
2483 |
+
promise.constructor = PromiseProxy
|
2484 |
+
promise.then = function() {
|
2485 |
+
count++
|
2486 |
+
var next = then.apply(promise, arguments)
|
2487 |
+
next.then(complete, function(e) {
|
2488 |
+
complete()
|
2489 |
+
if (count === 0) throw e
|
2490 |
+
})
|
2491 |
+
return wrap(next)
|
2492 |
+
}
|
2493 |
+
return promise
|
2494 |
+
}
|
2495 |
}
|
2496 |
}
|
2497 |
+
|
2498 |
+
function hasHeader(args, name) {
|
2499 |
+
for (var key in args.headers) {
|
2500 |
+
if ({}.hasOwnProperty.call(args.headers, key) && name.test(key)) return true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2501 |
}
|
2502 |
+
return false
|
2503 |
}
|
2504 |
+
|
2505 |
+
return {
|
2506 |
+
request: makeRequest(function(url, args, resolve, reject) {
|
2507 |
+
var method = args.method != null ? args.method.toUpperCase() : "GET"
|
2508 |
+
var body = args.body
|
2509 |
+
var assumeJSON = (args.serialize == null || args.serialize === JSON.serialize) && !(body instanceof $window.FormData)
|
2510 |
+
var responseType = args.responseType || (typeof args.extract === "function" ? "" : "json")
|
2511 |
+
|
2512 |
+
var xhr = new $window.XMLHttpRequest(), aborted = false
|
2513 |
+
var original = xhr, replacedAbort
|
2514 |
+
var abort = xhr.abort
|
2515 |
+
|
2516 |
+
xhr.abort = function() {
|
2517 |
+
aborted = true
|
2518 |
+
abort.call(this)
|
2519 |
}
|
2520 |
+
|
2521 |
+
xhr.open(method, url, args.async !== false, typeof args.user === "string" ? args.user : undefined, typeof args.password === "string" ? args.password : undefined)
|
2522 |
+
|
2523 |
+
if (assumeJSON && body != null && !hasHeader(args, /^content-type$/i)) {
|
2524 |
+
xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8")
|
2525 |
+
}
|
2526 |
+
if (typeof args.deserialize !== "function" && !hasHeader(args, /^accept$/i)) {
|
2527 |
+
xhr.setRequestHeader("Accept", "application/json, text/*")
|
2528 |
+
}
|
2529 |
+
if (args.withCredentials) xhr.withCredentials = args.withCredentials
|
2530 |
+
if (args.timeout) xhr.timeout = args.timeout
|
2531 |
+
xhr.responseType = responseType
|
2532 |
+
|
2533 |
+
for (var key in args.headers) {
|
2534 |
+
if ({}.hasOwnProperty.call(args.headers, key)) {
|
2535 |
+
xhr.setRequestHeader(key, args.headers[key])
|
2536 |
}
|
2537 |
}
|
2538 |
+
|
2539 |
+
xhr.onreadystatechange = function(ev) {
|
2540 |
+
// Don't throw errors on xhr.abort().
|
2541 |
+
if (aborted) return
|
2542 |
+
|
2543 |
+
if (ev.target.readyState === 4) {
|
2544 |
+
try {
|
2545 |
+
var success = (ev.target.status >= 200 && ev.target.status < 300) || ev.target.status === 304 || (/^file:\/\//i).test(url)
|
2546 |
+
// When the response type isn't "" or "text",
|
2547 |
+
// `xhr.responseText` is the wrong thing to use.
|
2548 |
+
// Browsers do the right thing and throw here, and we
|
2549 |
+
// should honor that and do the right thing by
|
2550 |
+
// preferring `xhr.response` where possible/practical.
|
2551 |
+
var response = ev.target.response, message
|
2552 |
+
|
2553 |
+
if (responseType === "json") {
|
2554 |
+
// For IE and Edge, which don't implement
|
2555 |
+
// `responseType: "json"`.
|
2556 |
+
if (!ev.target.responseType && typeof args.extract !== "function") response = JSON.parse(ev.target.responseText)
|
2557 |
+
} else if (!responseType || responseType === "text") {
|
2558 |
+
// Only use this default if it's text. If a parsed
|
2559 |
+
// document is needed on old IE and friends (all
|
2560 |
+
// unsupported), the user should use a custom
|
2561 |
+
// `config` instead. They're already using this at
|
2562 |
+
// their own risk.
|
2563 |
+
if (response == null) response = ev.target.responseText
|
2564 |
+
}
|
2565 |
+
|
2566 |
+
if (typeof args.extract === "function") {
|
2567 |
+
response = args.extract(ev.target, args)
|
2568 |
+
success = true
|
2569 |
+
} else if (typeof args.deserialize === "function") {
|
2570 |
+
response = args.deserialize(response)
|
2571 |
+
}
|
2572 |
+
if (success) resolve(response)
|
2573 |
+
else {
|
2574 |
+
try { message = ev.target.responseText }
|
2575 |
+
catch (e) { message = response }
|
2576 |
+
var error = new Error(message)
|
2577 |
+
error.code = ev.target.status
|
2578 |
+
error.response = response
|
2579 |
+
reject(error)
|
2580 |
+
}
|
2581 |
+
}
|
2582 |
+
catch (e) {
|
2583 |
+
reject(e)
|
2584 |
+
}
|
2585 |
+
}
|
2586 |
}
|
2587 |
+
|
2588 |
+
if (typeof args.config === "function") {
|
2589 |
+
xhr = args.config(xhr, args, url) || xhr
|
2590 |
+
|
2591 |
+
// Propagate the `abort` to any replacement XHR as well.
|
2592 |
+
if (xhr !== original) {
|
2593 |
+
replacedAbort = xhr.abort
|
2594 |
+
xhr.abort = function() {
|
2595 |
+
aborted = true
|
2596 |
+
replacedAbort.call(this)
|
2597 |
+
}
|
2598 |
}
|
|
|
2599 |
}
|
2600 |
+
|
2601 |
+
if (body == null) xhr.send()
|
2602 |
+
else if (typeof args.serialize === "function") xhr.send(args.serialize(body))
|
2603 |
+
else if (body instanceof $window.FormData) xhr.send(body)
|
2604 |
+
else xhr.send(JSON.stringify(body))
|
2605 |
+
}),
|
2606 |
+
jsonp: makeRequest(function(url, args, resolve, reject) {
|
2607 |
+
var callbackName = args.callbackName || "_mithril_" + Math.round(Math.random() * 1e16) + "_" + callbackCount++
|
2608 |
+
var script = $window.document.createElement("script")
|
2609 |
+
$window[callbackName] = function(data) {
|
2610 |
+
delete $window[callbackName]
|
2611 |
+
script.parentNode.removeChild(script)
|
2612 |
+
resolve(data)
|
2613 |
+
}
|
2614 |
+
script.onerror = function() {
|
2615 |
+
delete $window[callbackName]
|
2616 |
+
script.parentNode.removeChild(script)
|
2617 |
+
reject(new Error("JSONP request failed"))
|
2618 |
+
}
|
2619 |
+
script.src = url + (url.indexOf("?") < 0 ? "?" : "&") +
|
2620 |
+
encodeURIComponent(args.callbackKey || "callback") + "=" +
|
2621 |
+
encodeURIComponent(callbackName)
|
2622 |
+
$window.document.documentElement.appendChild(script)
|
2623 |
+
}),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2624 |
}
|
2625 |
}
|
2626 |
+
|
2627 |
+
},{"../pathname/build":16}],32:[function(require,module,exports){
|
2628 |
+
"use strict"
|
2629 |
+
|
2630 |
+
var mountRedraw = require("./mount-redraw")
|
2631 |
+
|
2632 |
+
module.exports = require("./api/router")(window, mountRedraw)
|
2633 |
+
|
2634 |
+
},{"./api/router":11,"./mount-redraw":14}],33:[function(require,module,exports){
|
|
|
|
|
|
|
|
|
|
|
2635 |
// shim for using process in browser
|
2636 |
var process = module.exports = {};
|
2637 |
|
2817 |
};
|
2818 |
process.umask = function() { return 0; };
|
2819 |
|
2820 |
+
},{}],34:[function(require,module,exports){
|
2821 |
(function (setImmediate,clearImmediate){
|
2822 |
var nextTick = require('process/browser.js').nextTick;
|
2823 |
var apply = Function.prototype.apply;
|
2896 |
delete immediateIds[id];
|
2897 |
};
|
2898 |
}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
|
2899 |
+
},{"process/browser.js":33,"timers":34}],35:[function(require,module,exports){
|
2900 |
function tlite(getTooltipOpts) {
|
2901 |
document.addEventListener('mouseover', function (e) {
|
2902 |
var el = e.target;
|
3032 |
module.exports = tlite;
|
3033 |
}
|
3034 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3035 |
},{}]},{},[1]);
|
3036 |
})();
|
assets/js/admin.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
!function(){var a=void 0;!function o(l,a,s){function u(t,e){if(!a[t]){if(!l[t]){var n=!1;if(!e&&n)return n(t,!0);if(c)return c(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var i=a[t]={exports:{}};l[t][0].call(i.exports,function(e){return u(l[t][1][e]||e)},i,i.exports,o,l,a,s)}return a[t].exports}for(var c=!1,e=0;e<s.length;e++)u(s[e]);return u}({1:[function(e,t,n){"use strict";var r,i=(r=e("tlite"))&&r.__esModule?r:{default:r};var o,l,a=window.m=e("mithril"),s=e("wolfy87-eventemitter"),u=e("./admin/tabs.js"),c=e("./admin/settings.js"),f=e("./admin/helpers.js"),d=document.getElementById("mc4wp-admin"),h=new s;null!==d&&(o=u(d),l=c(d,f,h)),(0,i.default)(function(e){return-1<e.className.indexOf("mc4wp-tooltip")});var p=e("./admin/list-fetcher.js"),m=document.getElementById("mc4wp-list-fetcher");m&&a.mount(m,new p),e("./admin/fields/mailchimp-api-key.js"),window.mc4wp=window.mc4wp||{},window.mc4wp.deps=window.mc4wp.deps||{},window.mc4wp.deps.mithril=a,window.mc4wp.helpers=f,window.mc4wp.events=h,window.mc4wp.settings=l,window.mc4wp.tabs=o},{"./admin/fields/mailchimp-api-key.js":2,"./admin/helpers.js":3,"./admin/list-fetcher.js":4,"./admin/settings.js":5,"./admin/tabs.js":6,mithril:8,tlite:11,"wolfy87-eventemitter":12}],2:[function(e,t,n){"use strict";var r;function i(e){var t=document.createElement("p");t.className="help red",t.innerText=window.mc4wp_vars.i18n.invalid_api_key,r.nextElementSibling.innerText===t.innerText&&r.nextElementSibling.parentElement.removeChild(r.nextElementSibling),r.value.match(/^[0-9a-zA-Z*]{32}-[a-z]{2}[0-9]{1,2}$/)||r.parentElement.insertBefore(t,r.nextElementSibling)}(r=document.getElementById("mailchimp_api_key"))&&r.addEventListener("change",i)},{}],3:[function(e,t,n){"use strict";var r,l={};l.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"}},l.bindEventToElement=function(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent&&e.attachEvent("on"+t,n)},l.bindEventToElements=function(e,t,n){Array.prototype.forEach.call(e,function(e){l.bindEventToElement(e,t,n)})},l.debounce=function(r,i,o){var l;return function(){var e=this,t=arguments,n=o&&!l;clearTimeout(l),l=setTimeout(function(){l=null,o||r.apply(e,t)},i),n&&r.apply(e,t)}},r=document.querySelectorAll("[data-showif]"),Array.prototype.forEach.call(r,function(e){var n=JSON.parse(e.getAttribute("data-showif")),t=document.querySelectorAll('[name="'+n.element+'"]'),r=e.querySelectorAll("input,select,textarea:not([readonly])"),i=void 0===n.hide||n.hide;function o(){if("radio"!==this.getAttribute("type")||this.checked){var t=("checkbox"===this.getAttribute("type")?this.checked:this.value)==n.value;i?(e.style.display=t?"":"none",e.style.visibility=t?"":"hidden"):e.style.opacity=t?"":"0.4",Array.prototype.forEach.call(r,function(e){t?e.removeAttribute("readonly"):e.setAttribute("readonly","readonly")})}}Array.prototype.forEach.call(t,function(e){o.call(e)}),l.bindEventToElements(t,"change",o)}),t.exports=l},{}],4:[function(e,t,n){"use strict";var r=window.jQuery,i=mc4wp_vars,o=i.i18n;function l(){this.working=!1,this.done=!1,i.mailchimp.api_connected&&0===i.mailchimp.lists.length&&this.fetch()}l.prototype.fetch=function(e){e&&e.preventDefault(),this.working=!0,this.done=!1,r.post(ajaxurl,{action:"mc4wp_renew_mailchimp_lists",timeout:6e5}).done(function(e){this.success=!0,e&&window.setTimeout(function(){window.location.reload()},3e3)}.bind(this)).fail(function(e){this.success=!1}.bind(this)).always(function(e){this.working=!1,this.done=!0,m.redraw()}.bind(this))},l.prototype.view=function(){return m("form",{method:"POST",onsubmit:this.fetch.bind(this)},[m("p",[m("input",{type:"submit",value:this.working?o.fetching_mailchimp_lists:o.renew_mailchimp_lists,className:"button",disabled:!!this.working}),m.trust(" "),this.working?[m("span.mc4wp-loader","Loading..."),m.trust(" "),m("em.help",o.fetching_mailchimp_lists_can_take_a_while)]:"",this.done?[this.success?m("em.help.green",o.fetching_mailchimp_lists_done):m("em.help.red",o.fetching_mailchimp_lists_error)]:""])])},t.exports=l},{}],5:[function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}t.exports=function(e,t,n){e.querySelector("form");var r=e.querySelectorAll(".mc4wp-list-input"),i=mc4wp_vars.mailchimp.lists,o=[];function l(){return o=[],Array.prototype.forEach.call(r,function(e){"boolean"==typeof e.checked&&!e.checked||"object"!==a(i[e.value])||o.push(i[e.value])}),n.trigger("selectedLists.change",[o]),o}return n.on("selectedLists.change",function(){var e=document.querySelectorAll(".lists--only-selected > *");Array.prototype.forEach.call(e,function(e){0<function(t,n){return o.filter(function(e){return e[t]===n})}("id",e.getAttribute("data-list-id")).length?e.setAttribute("class",e.getAttribute("class").replace("hidden","")):e.setAttribute("class",e.getAttribute("class")+" hidden")})}),t.bindEventToElements(r,"change",l),l(),{getSelectedLists:function(){return o}}}},{}],6:[function(e,t,n){"use strict";var d=e("./url.js");t.exports=function(i){if(null!==i){var o=window.jQuery,e=o(i),r=e.find(".tab"),l=e.find(".nav-tab"),a=i.querySelector('input[name="_wp_http_referer"]'),s=[];return o.each(r,function(e,t){var n=t.id.substring(4),r=o(t).find("h2").first().text();s.push({id:n,title:r,element:t,nav:i.querySelectorAll(".nav-tab-"+n),open:function(){return c(n)}})}),l.click(t),o(document.body).on("click",".tab-link",t),function(){if(history.pushState){var e=r.filter(":visible").get(0);if(e){var t=u(e.id.substring(4));t&&(history.replaceState&&null===history.state&&history.replaceState(t.id,""),f(t))}}}(),window.addEventListener&&history.pushState&&window.addEventListener("popstate",function(e){return!e.state||c(e.state,!1)}),{open:c,get:u}}function u(e){for(var t=0;t<s.length;t++)if(s[t].id===e)return s[t]}function c(e,t){if("string"==typeof e&&(e=u(e)),!e)return!1;null==t&&(t=!0),r.removeClass("tab-active").css("display","none"),l.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 n=d.setParameter(window.location.href,"tab",e.id);return history.pushState&&t&&history.pushState(e.id,"",n),f(e),a.value=n,"function"==typeof tb_remove&&tb_remove(),"fields"===e.id&&window.mc4wp&&window.mc4wp.forms&&window.mc4wp.forms.editor&&mc4wp.forms.editor.refresh(),!0}function f(e){var t=document.title.split("-");document.title=document.title.replace(t[0],e.title+" ")}function t(e){e=e||window.event;var t=this.getAttribute("data-tab");if(!t){var n=this.className.match(/nav-tab-(\w+)?/);n&&(t=n[1])}if(!t){var r=d.parse(this.href);if(!r.tab)return;t=r.tab}return!c(t)||(e.preventDefault(),e.returnValue=!1)}}},{"./url.js":7}],7:[function(e,t,n){"use strict";var i={parse:function(e){var t={},n=e.split("&");for(var r in n)if(n.hasOwnProperty(r)){var i=n[r].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[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 r=i.parse(e);return r[t]=n,i.build(r)}};t.exports=i},{}],8:[function(e,D,t){(function(q,M){!function(){"use strict";function C(e,t,n,r,i,o){return{tag:e,key:t,attrs:n,children:r,text:i,dom:o,domSize:void 0,state:void 0,_state:void 0,events:void 0,instance:void 0,skip:!1}}C.normalize=function(e){return Array.isArray(e)?C("[",void 0,void 0,C.normalizeChildren(e),void 0,void 0):null!=e&&"object"!=typeof e?C("#",void 0,void 0,!1===e?"":e,void 0,void 0):e},C.normalizeChildren=function(e){for(var t=0;t<e.length;t++)e[t]=C.normalize(e[t]);return e};var s=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,u={},c={}.hasOwnProperty;function f(e){for(var t in e)if(c.call(e,t))return!1;return!0}function e(e){var t,n=arguments[1],r=2;if(null==e||"string"!=typeof e&&"function"!=typeof e&&"function"!=typeof e.view)throw Error("The selector must be either a string or a component.");if("string"==typeof e)var i=u[e]||function(e){for(var t,n="div",r=[],i={};t=s.exec(e);){var o=t[1],l=t[2];if(""===o&&""!==l)n=l;else if("#"===o)i.id=l;else if("."===o)r.push(l);else if("["===t[3][0]){var a=t[6];a&&(a=a.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")),"class"===t[4]?r.push(a):i[t[4]]=""===a?a:a||!0}}return 0<r.length&&(i.className=r.join(" ")),u[e]={tag:n,attrs:i}}(e);if(null==n?n={}:"object"==typeof n&&null==n.tag&&!Array.isArray(n)||(n={},r=1),arguments.length===r+1)t=arguments[r],Array.isArray(t)||(t=[t]);else for(t=[];r<arguments.length;)t.push(arguments[r++]);var o=C.normalizeChildren(t);return"string"==typeof e?function(e,t,n){var r,i,o=!1,l=t.className||t.class;if(!f(e.attrs)&&!f(t)){var a={};for(var s in t)c.call(t,s)&&(a[s]=t[s]);t=a}for(var s in e.attrs)c.call(e.attrs,s)&&(t[s]=e.attrs[s]);for(var s in void 0!==l&&(void 0!==t.class&&(t.class=void 0,t.className=l),null!=e.attrs.className&&(t.className=e.attrs.className+" "+l)),t)if(c.call(t,s)&&"key"!==s){o=!0;break}return Array.isArray(n)&&1===n.length&&null!=n[0]&&"#"===n[0].tag?i=n[0].children:r=n,C(e.tag,t.key,o?t:void 0,r,i)}(i,n,o):C(e,n.key,n,o)}e.trust=function(e){return null==e&&(e=""),C("<",void 0,void 0,e,void 0,void 0)},e.fragment=function(e,t){return C("[",e.key,e,C.normalizeChildren(t),void 0,void 0)};var t=e;if((d=function(e){if(!(this instanceof d))throw new Error("Promise must be called with `new`");if("function"!=typeof e)throw new TypeError("executor must be a function");var o=this,l=[],a=[],i=t(l,!0),s=t(a,!1),u=o._instance={resolvers:l,rejectors:a},c="function"==typeof M?M:setTimeout;function t(r,i){return function t(n){var e;try{if(!i||null==n||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof(e=n.then))c(function(){i||0!==r.length||console.error("Possible unhandled promise rejection:",n);for(var e=0;e<r.length;e++)r[e](n);l.length=0,a.length=0,u.state=i,u.retry=function(){t(n)}});else{if(n===o)throw new TypeError("Promise can't be resolved w/ itself");f(e.bind(n))}}catch(e){s(e)}}}function f(e){var n=0;function t(t){return function(e){0<n++||t(e)}}var r=t(s);try{e(t(i),r)}catch(e){r(e)}}f(e)}).prototype.then=function(e,t){var i,o,l=this._instance;function n(t,e,n,r){e.push(function(e){if("function"!=typeof t)n(e);else try{i(t(e))}catch(e){o&&o(e)}}),"function"==typeof l.retry&&r===l.state&&l.retry()}var r=new d(function(e,t){i=e,o=t});return n(e,l.resolvers,i,!0),n(t,l.rejectors,o,!1),r},d.prototype.catch=function(e){return this.then(null,e)},d.resolve=function(t){return t instanceof d?t:new d(function(e){e(t)})},d.reject=function(n){return new d(function(e,t){t(n)})},d.all=function(a){return new d(function(n,r){var i=a.length,o=0,l=[];if(0===a.length)n([]);else for(var e=0;e<a.length;e++)!function(t){function e(e){o++,l[t]=e,o===i&&n(l)}null==a[t]||"object"!=typeof a[t]&&"function"!=typeof a[t]||"function"!=typeof a[t].then?e(a[t]):a[t].then(e,r)}(e)})},d.race=function(r){return new d(function(e,t){for(var n=0;n<r.length;n++)r[n].then(e,t)})},"undefined"!=typeof window){void 0===window.Promise&&(window.Promise=d);var d=window.Promise}else if(void 0!==q){void 0===q.Promise&&(q.Promise=d);d=q.Promise}function p(e){if("[object Object]"!==Object.prototype.toString.call(e))return"";var r=[];for(var t in e)i(t,e[t]);return r.join("&");function i(e,t){if(Array.isArray(t))for(var n=0;n<t.length;n++)i(e+"["+n+"]",t[n]);else if("[object Object]"===Object.prototype.toString.call(t))for(var n in t)i(e+"["+n+"]",t[n]);else r.push(encodeURIComponent(e)+(null!=t&&""!==t?"="+encodeURIComponent(t):""))}}var h,r,n,o,m=new RegExp("^file://","i"),i=(h=window,r=d,o=0,{request:function(a,e){var t=l();a=v(a,e);var n=new r(function(r,i){null==a.method&&(a.method="GET"),a.method=a.method.toUpperCase();var e="GET"!==a.method&&"TRACE"!==a.method&&("boolean"!=typeof a.useBody||a.useBody);"function"!=typeof a.serialize&&(a.serialize="undefined"!=typeof FormData&&a.data instanceof FormData?function(e){return e}:JSON.stringify),"function"!=typeof a.deserialize&&(a.deserialize=w),"function"!=typeof a.extract&&(a.extract=b),a.url=y(a.url,a.data),e?a.data=a.serialize(a.data):a.url=g(a.url,a.data);var o=new h.XMLHttpRequest,l=!1,t=o.abort;for(var n in o.abort=function(){l=!0,t.call(o)},o.open(a.method,a.url,"boolean"!=typeof a.async||a.async,"string"==typeof a.user?a.user:void 0,"string"==typeof a.password?a.password:void 0),a.serialize!==JSON.stringify||!e||a.headers&&a.headers.hasOwnProperty("Content-Type")||o.setRequestHeader("Content-Type","application/json; charset=utf-8"),a.deserialize!==w||a.headers&&a.headers.hasOwnProperty("Accept")||o.setRequestHeader("Accept","application/json, text/*"),a.withCredentials&&(o.withCredentials=a.withCredentials),a.headers)!{}.hasOwnProperty.call(a.headers,n)||o.setRequestHeader(n,a.headers[n]);"function"==typeof a.config&&(o=a.config(o,a)||o),o.onreadystatechange=function(){if(!l&&4===o.readyState)try{var e=a.extract!==b?a.extract(o,a):a.deserialize(a.extract(o,a));if(200<=o.status&&o.status<300||304===o.status||m.test(a.url))r(x(a.type,e));else{var t=new Error(o.responseText);for(var n in e)t[n]=e[n];i(t)}}catch(e){i(e)}},e&&null!=a.data?o.send(a.data):o.send()});return!0===a.background?n:t(n)},jsonp:function(i,e){var t=l();i=v(i,e);var n=new r(function(t,e){var n=i.callbackName||"_mithril_"+Math.round(1e16*Math.random())+"_"+o++,r=h.document.createElement("script");h[n]=function(e){r.parentNode.removeChild(r),t(x(i.type,e)),delete h[n]},r.onerror=function(){r.parentNode.removeChild(r),e(new Error("JSONP request failed")),delete h[n]},null==i.data&&(i.data={}),i.url=y(i.url,i.data),i.data[i.callbackKey||"callback"]=n,r.src=g(i.url,i.data),h.document.documentElement.appendChild(r)});return!0===i.background?n:t(n)},setCompletionCallback:function(e){n=e}});function l(){var i=0;function o(){0==--i&&"function"==typeof n&&n()}return function t(n){var r=n.then;return n.then=function(){i++;var e=r.apply(n,arguments);return e.then(o,function(e){if(o(),0===i)throw e}),t(e)},n}}function v(e,t){if("string"==typeof e){var n=e;null==(e=t||{}).url&&(e.url=n)}return e}function y(e,t){if(null==t)return e;for(var n=e.match(/:[^\/]+/gi)||[],r=0;r<n.length;r++){var i=n[r].slice(1);null!=t[i]&&(e=e.replace(n[r],t[i]))}return e}function g(e,t){var n=p(t);if(""!==n){var r=e.indexOf("?")<0?"?":"&";e+=r+n}return e}function w(t){try{return""!==t?JSON.parse(t):null}catch(e){throw new Error(t)}}function b(e){return e.responseText}function x(e,t){if("function"==typeof e){if(!Array.isArray(t))return new e(t);for(var n=0;n<t.length;n++)t[n]=new e(t[n])}return t}function a(e){var l,c=e.document,a=c.createDocumentFragment(),t={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"};function f(e){return e.attrs&&e.attrs.xmlns||t[e.tag]}function b(e,t,n,r,i,o,l){for(var a=n;a<r;a++){var s=t[a];null!=s&&x(e,s,i,l,o)}}function x(e,t,n,r,i){var o=t.tag;if("string"!=typeof o)return function(e,t,n,r,i){{if(u(t,n),null==t.instance)return t.domSize=0,a;var o=x(e,t.instance,n,r,i);return t.dom=t.instance.dom,t.domSize=null!=t.dom?t.instance.domSize:0,k(e,o,i),o}}(e,t,n,r,i);switch(t.state={},null!=t.attrs&&w(t.attrs,t,n),o){case"#":return function(e,t,n){return t.dom=c.createTextNode(t.children),k(e,t.dom,n),t.dom}(e,t,i);case"<":return s(e,t,i);case"[":return function(e,t,n,r,i){var o=c.createDocumentFragment();if(null!=t.children){var l=t.children;b(o,l,0,l.length,n,null,r)}return t.dom=o.firstChild,t.domSize=o.childNodes.length,k(e,o,i),o}(e,t,n,r,i);default:return function(e,t,n,r,i){var o=t.tag,l=t.attrs,a=l&&l.is,s=(r=f(t)||r)?a?c.createElementNS(r,o,{is:a}):c.createElementNS(r,o):a?c.createElement(o,{is:a}):c.createElement(o);t.dom=s,null!=l&&function(e,t,n){for(var r in t)v(e,r,null,t[r],n)}(t,l,r);if(k(e,s,i),null!=t.attrs&&null!=t.attrs.contenteditable)h(t);else if(null!=t.text&&(""!==t.text?s.textContent=t.text:t.children=[C("#",void 0,void 0,t.text,void 0,void 0)]),null!=t.children){var u=t.children;b(s,u,0,u.length,n,null,r),function(e){var t=e.attrs;"select"===e.tag&&null!=t&&("value"in t&&v(e,"value",null,t.value,void 0),"selectedIndex"in t&&v(e,"selectedIndex",null,t.selectedIndex,void 0))}(t)}return s}(e,t,n,r,i)}}function s(e,t,n){var r={caption:"table",thead:"table",tbody:"table",tfoot:"table",tr:"tbody",th:"tr",td:"tr",colgroup:"table",col:"colgroup"}[(t.children.match(/^\s*?<(\w+)/im)||[])[1]]||"div",i=c.createElement(r);i.innerHTML=t.children,t.dom=i.firstChild,t.domSize=i.childNodes.length;for(var o,l=c.createDocumentFragment();o=i.firstChild;)l.appendChild(o);return k(e,l,n),l}function u(e,t){var n;if("function"==typeof e.tag.view){if(e.state=Object.create(e.tag),null!=(n=e.state.view).$$reentrantLock$$)return a;n.$$reentrantLock$$=!0}else{if(e.state=void 0,null!=(n=e.tag).$$reentrantLock$$)return a;n.$$reentrantLock$$=!0,e.state=null!=e.tag.prototype&&"function"==typeof e.tag.prototype.view?new e.tag(e):e.tag(e)}if(e._state=e.state,null!=e.attrs&&w(e.attrs,e,t),w(e._state,e,t),e.instance=C.normalize(e._state.view.call(e.state,e)),e.instance===e)throw Error("A view cannot return the vnode it received as argument");n.$$reentrantLock$$=null}function d(e,t,n,r,i,o,l){if(t!==n&&(null!=t||null!=n))if(null==t)b(e,n,0,n.length,i,o,l);else if(null==n)S(t,0,t.length,n);else{if(t.length===n.length){for(var a=!1,s=0;s<n.length;s++)if(null!=n[s]&&null!=t[s]){a=null==n[s].key&&null==t[s].key;break}if(a){for(s=0;s<t.length;s++)t[s]!==n[s]&&(null==t[s]&&null!=n[s]?x(e,n[s],i,l,A(t,s+1,o)):null==n[s]?S(t,s,s+1,n):E(e,t[s],n[s],i,A(t,s+1,o),r,l));return}}if(r=r||function(e,t){if(null!=e.pool&&Math.abs(e.pool.length-t.length)<=Math.abs(e.length-t.length)){var n=e[0]&&e[0].children&&e[0].children.length||0,r=e.pool[0]&&e.pool[0].children&&e.pool[0].children.length||0,i=t[0]&&t[0].children&&t[0].children.length||0;if(Math.abs(r-i)<=Math.abs(n-i))return!0}return!1}(t,n)){var u=t.pool;t=t.concat(t.pool)}for(var c,f=0,d=0,h=t.length-1,p=n.length-1;f<=h&&d<=p;){if((v=t[f])!==(y=n[d])||r)if(null==v)f++;else if(null==y)d++;else if(v.key===y.key){var m=null!=u&&f>=t.length-u.length||null==u&&r;d++,E(e,v,y,i,A(t,++f,o),m,l),r&&v.tag===y.tag&&k(e,T(v),o)}else{if((v=t[h])!==y||r)if(null==v)h--;else if(null==y)d++;else{if(v.key!==y.key)break;m=null!=u&&h>=t.length-u.length||null==u&&r;E(e,v,y,i,A(t,h+1,o),m,l),(r||d<p)&&k(e,T(v),A(t,f,o)),h--,d++}else h--,d++}else f++,d++}for(;f<=h&&d<=p;){var v,y;if((v=t[h])!==(y=n[p])||r)if(null==v)h--;else if(null==y)p--;else if(v.key===y.key){m=null!=u&&h>=t.length-u.length||null==u&&r;E(e,v,y,i,A(t,h+1,o),m,l),r&&v.tag===y.tag&&k(e,T(v),o),null!=v.dom&&(o=v.dom),h--,p--}else{if(c||(c=_(t,h)),null!=y){var g=c[y.key];if(null!=g){var w=t[g];m=null!=u&&g>=t.length-u.length||null==u&&r;E(e,w,y,i,A(t,h+1,o),r,l),k(e,T(w),o),t[g].skip=!0,null!=w.dom&&(o=w.dom)}else{o=x(e,y,i,l,o)}}p--}else h--,p--;if(p<d)break}b(e,n,d,p+1,i,o,l),S(t,f,h+1,n)}}function E(e,t,n,r,i,o,l){var a=t.tag;if(a===n.tag){if(n.state=t.state,n._state=t._state,n.events=t.events,!o&&function(e,t){var n,r;null!=e.attrs&&"function"==typeof e.attrs.onbeforeupdate&&(n=e.attrs.onbeforeupdate.call(e.state,e,t));"string"!=typeof e.tag&&"function"==typeof e._state.onbeforeupdate&&(r=e._state.onbeforeupdate.call(e.state,e,t));return!(void 0===n&&void 0===r||n||r||(e.dom=t.dom,e.domSize=t.domSize,e.instance=t.instance,0))}(n,t))return;if("string"==typeof a)switch(null!=n.attrs&&(o?(n.state={},w(n.attrs,n,r)):L(n.attrs,n,r)),a){case"#":!function(e,t){e.children.toString()!==t.children.toString()&&(e.dom.nodeValue=t.children);t.dom=e.dom}(t,n);break;case"<":!function(e,t,n,r){t.children!==n.children?(T(t),s(e,n,r)):(n.dom=t.dom,n.domSize=t.domSize)}(e,t,n,i);break;case"[":!function(e,t,n,r,i,o,l){d(e,t.children,n.children,r,i,o,l);var a=0,s=n.children;if((n.dom=null)!=s){for(var u=0;u<s.length;u++){var c=s[u];null!=c&&null!=c.dom&&(null==n.dom&&(n.dom=c.dom),a+=c.domSize||1)}1!==a&&(n.domSize=a)}}(e,t,n,o,r,i,l);break;default:!function(e,t,n,r,i){var o=t.dom=e.dom;i=f(t)||i,"textarea"===t.tag&&(null==t.attrs&&(t.attrs={}),null!=t.text&&(t.attrs.value=t.text,t.text=void 0));(function(e,t,n,r){if(null!=n)for(var i in n)v(e,i,t&&t[i],n[i],r);if(null!=t)for(var i in t)null!=n&&i in n||("className"===i&&(i="class"),"o"!==i[0]||"n"!==i[1]||y(i)?"key"!==i&&e.dom.removeAttribute(i):g(e,i,void 0))})(t,e.attrs,t.attrs,i),null!=t.attrs&&null!=t.attrs.contenteditable?h(t):null!=e.text&&null!=t.text&&""!==t.text?e.text.toString()!==t.text.toString()&&(e.dom.firstChild.nodeValue=t.text):(null!=e.text&&(e.children=[C("#",void 0,void 0,e.text,void 0,e.dom.firstChild)]),null!=t.text&&(t.children=[C("#",void 0,void 0,t.text,void 0,void 0)]),d(o,e.children,t.children,n,r,null,i))}(t,n,o,r,l)}else!function(e,t,n,r,i,o,l){if(o)u(n,r);else{if(n.instance=C.normalize(n._state.view.call(n.state,n)),n.instance===n)throw Error("A view cannot return the vnode it received as argument");null!=n.attrs&&L(n.attrs,n,r),L(n._state,n,r)}null!=n.instance?(null==t.instance?x(e,n.instance,r,l,i):E(e,t.instance,n.instance,r,i,o,l),n.dom=n.instance.dom,n.domSize=n.instance.domSize):null!=t.instance?(p(t.instance,null),n.dom=void 0,n.domSize=0):(n.dom=t.dom,n.domSize=t.domSize)}(e,t,n,r,i,o,l)}else p(t,null),x(e,n,r,l,i)}function _(e,t){var n={},r=0;for(r=0;r<t;r++){var i=e[r];if(null!=i){var o=i.key;null!=o&&(n[o]=r)}}return n}function T(e){var t=e.domSize;if(null==t&&null!=e.dom)return e.dom;var n=c.createDocumentFragment();if(0<t){for(var r=e.dom;--t;)n.appendChild(r.nextSibling);n.insertBefore(r,n.firstChild)}return n}function A(e,t,n){for(;t<e.length;t++)if(null!=e[t]&&null!=e[t].dom)return e[t].dom;return n}function k(e,t,n){n&&n.parentNode?e.insertBefore(t,n):e.appendChild(t)}function h(e){var t=e.children;if(null!=t&&1===t.length&&"<"===t[0].tag){var n=t[0].children;e.dom.innerHTML!==n&&(e.dom.innerHTML=n)}else if(null!=e.text||null!=t&&0!==t.length)throw new Error("Child node of a contenteditable must be trusted")}function S(e,t,n,r){for(var i=t;i<n;i++){var o=e[i];null!=o&&(o.skip?o.skip=!1:p(o,r))}}function p(n,r){var e,i=1,o=0;n.attrs&&"function"==typeof n.attrs.onbeforeremove&&null!=(e=n.attrs.onbeforeremove.call(n.state,n))&&"function"==typeof e.then&&(i++,e.then(t,t));"string"!=typeof n.tag&&"function"==typeof n._state.onbeforeremove&&null!=(e=n._state.onbeforeremove.call(n.state,n))&&"function"==typeof e.then&&(i++,e.then(t,t));function t(){if(++o===i&&(function e(t){t.attrs&&"function"==typeof t.attrs.onremove&&t.attrs.onremove.call(t.state,t);if("string"!=typeof t.tag)"function"==typeof t._state.onremove&&t._state.onremove.call(t.state,t),null!=t.instance&&e(t.instance);else{var n=t.children;if(Array.isArray(n))for(var r=0;r<n.length;r++){var i=n[r];null!=i&&e(i)}}}(n),n.dom)){var e=n.domSize||1;if(1<e)for(var t=n.dom;--e;)m(t.nextSibling);m(n.dom),null==r||null!=n.domSize||function(e){return null!=e&&(e.oncreate||e.onupdate||e.onbeforeremove||e.onremove)}(n.attrs)||"string"!=typeof n.tag||(r.pool?r.pool.push(n):r.pool=[n])}}t()}function m(e){var t=e.parentNode;null!=t&&t.removeChild(e)}function v(e,t,n,r,i){var o=e.dom;if("key"!==t&&"is"!==t&&(n!==r||function(e,t){return"value"===t||"checked"===t||"selectedIndex"===t||"selected"===t&&e.dom===c.activeElement}(e,t)||"object"==typeof r)&&void 0!==r&&!y(t)){var l=t.indexOf(":");if(-1<l&&"xlink"===t.substr(0,l))o.setAttributeNS("http://www.w3.org/1999/xlink",t.slice(l+1),r);else if("o"===t[0]&&"n"===t[1]&&"function"==typeof r)g(e,t,r);else if("style"===t)!function(e,t,n){t===n&&(e.style.cssText="",t=null);if(null==n)e.style.cssText="";else if("string"==typeof n)e.style.cssText=n;else{for(var r in"string"==typeof t&&(e.style.cssText=""),n)e.style[r]=n[r];if(null!=t&&"string"!=typeof t)for(var r in t)r in n||(e.style[r]="")}}(o,n,r);else if(t in o&&!function(e){return"href"===e||"list"===e||"form"===e||"width"===e||"height"===e}(t)&&void 0===i&&!function(e){return e.attrs.is||-1<e.tag.indexOf("-")}(e)){if("value"===t){var a=""+r;if(("input"===e.tag||"textarea"===e.tag)&&e.dom.value===a&&e.dom===c.activeElement)return;if("select"===e.tag)if(null===r){if(-1===e.dom.selectedIndex&&e.dom===c.activeElement)return}else if(null!==n&&e.dom.value===a&&e.dom===c.activeElement)return;if("option"===e.tag&&null!=n&&e.dom.value===a)return}if("input"===e.tag&&"type"===t)return void o.setAttribute(t,r);o[t]=r}else"boolean"==typeof r?r?o.setAttribute(t,""):o.removeAttribute(t):o.setAttribute("className"===t?"class":t,r)}}function y(e){return"oninit"===e||"oncreate"===e||"onupdate"===e||"onremove"===e||"onbeforeremove"===e||"onbeforeupdate"===e}function g(e,t,n){var r=e.dom,i="function"!=typeof l?n:function(e){var t=n.call(r,e);return l.call(r,e),t};if(t in r)r[t]="function"==typeof n?i:null;else{var o=t.slice(2);if(void 0===e.events&&(e.events={}),e.events[t]===i)return;null!=e.events[t]&&r.removeEventListener(o,e.events[t],!1),"function"==typeof n&&(e.events[t]=i,r.addEventListener(o,e.events[t],!1))}}function w(e,t,n){"function"==typeof e.oninit&&e.oninit.call(t.state,t),"function"==typeof e.oncreate&&n.push(e.oncreate.bind(t.state,t))}function L(e,t,n){"function"==typeof e.onupdate&&n.push(e.onupdate.bind(t.state,t))}return{render:function(e,t){if(!e)throw new Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var n=[],r=c.activeElement,i=e.namespaceURI;null==e.vnodes&&(e.textContent=""),Array.isArray(t)||(t=[t]),d(e,e.vnodes,C.normalizeChildren(t),!1,n,null,"http://www.w3.org/1999/xhtml"===i?void 0:i),e.vnodes=t,null!=r&&c.activeElement!==r&&r.focus();for(var o=0;o<n.length;o++)n[o]()},setEventCallback:function(e){return l=e}}}var E=function(e){var t=a(e);t.setEventCallback(function(e){!1===e.redraw?e.redraw=void 0:i()});var n=[];function r(e){var t=n.indexOf(e);-1<t&&n.splice(t,2)}function i(){for(var e=1;e<n.length;e+=2)n[e]()}return{subscribe:function(e,t){r(e),n.push(e,function(t){var n=0,r=null,i="function"==typeof requestAnimationFrame?requestAnimationFrame:setTimeout;return function(){var e=Date.now();0===n||16<=e-n?(n=e,t()):null===r&&(r=i(function(){r=null,t(),n=Date.now()},16-(e-n)))}}(t))},unsubscribe:r,redraw:i,render:t.render}}(window);i.setCompletionCallback(E.redraw);var _;t.mount=(_=E,function(e,t){if(null===t)return _.render(e,[]),void _.unsubscribe(e);if(null==t.view&&"function"!=typeof t)throw new Error("m.mount(element, component) expects a component, not a vnode");_.subscribe(e,function(){_.render(e,C(t))}),_.redraw()});function T(e){if(""===e||null==e)return{};"?"===e.charAt(0)&&(e=e.slice(1));for(var t=e.split("&"),n={},r={},i=0;i<t.length;i++){var o=t[i].split("="),l=decodeURIComponent(o[0]),a=2===o.length?decodeURIComponent(o[1]):"";"true"===a?a=!0:"false"===a&&(a=!1);var s=l.split(/\]\[?|\[/),u=n;-1<l.indexOf("[")&&s.pop();for(var c=0;c<s.length;c++){var f=s[c],d=s[c+1],h=""==d||!isNaN(parseInt(d,10)),p=c===s.length-1;if(""===f)null==r[l=s.slice(0,c).join()]&&(r[l]=0),f=r[l]++;null==u[f]&&(u[f]=p?a:h?[]:{}),u=u[f]}}return n}function A(c){var t,f="function"==typeof c.history.pushState,n="function"==typeof M?M:setTimeout;function e(e){var t=c.location[e].replace(/(?:%[a-f89][a-f0-9])+/gim,decodeURIComponent);return"pathname"===e&&"/"!==t[0]&&(t="/"+t),t}function d(e,t,n){var r=e.indexOf("?"),i=e.indexOf("#"),o=-1<r?r:-1<i?i:e.length;if(-1<r){var l=-1<i?i:e.length,a=T(e.slice(r+1,l));for(var s in a)t[s]=a[s]}if(-1<i){var u=T(e.slice(i+1));for(var s in u)n[s]=u[s]}return e.slice(0,o)}var h={prefix:"#!",getPath:function(){switch(h.prefix.charAt(0)){case"#":return e("hash").slice(h.prefix.length);case"?":return e("search").slice(h.prefix.length)+e("hash");default:return e("pathname").slice(h.prefix.length)+e("search")+e("hash")}},setPath:function(e,n,t){var r={},i={};if(e=d(e,r,i),null!=n){for(var o in n)r[o]=n[o];e=e.replace(/:([^\/]+)/g,function(e,t){return delete r[t],n[t]})}var l=p(r);l&&(e+="?"+l);var a=p(i);if(a&&(e+="#"+a),f){var s=t?t.state:null,u=t?t.title:null;c.onpopstate(),t&&t.replace?c.history.replaceState(s,u,h.prefix+e):c.history.pushState(s,u,h.prefix+e)}else c.location.href=h.prefix+e}};return h.defineRoutes=function(a,s,u){function e(){var r=h.getPath(),i={},e=d(r,i,i),t=c.history.state;if(null!=t)for(var n in t)i[n]=t[n];for(var o in a){var l=new RegExp("^"+o.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(l.test(e))return void e.replace(l,function(){for(var e=o.match(/:[^\/]+/g)||[],t=[].slice.call(arguments,1,-2),n=0;n<e.length;n++)i[e[n].replace(/:|\./g,"")]=decodeURIComponent(t[n]);s(a[o],i,r,o)})}u(r,i)}f?c.onpopstate=function(e){return function(){null==t&&(t=n(function(){t=null,e()}))}}(e):"#"===h.prefix.charAt(0)&&(c.onhashchange=e),e()},h}var k,S,L,j,O,z,N,I,P=d;function R(e,t,n){if(null==e)throw new Error("Ensure the DOM element that was passed to `m.route` is not undefined");function o(){null!=L&&S.render(e,L(C(j,O.key,O)))}function l(e){if(e===t)throw new Error("Could not resolve default route "+t);I.setPath(t,null,{replace:!0})}I.defineRoutes(n,function(t,n,r){var i=N=function(e,t){i===N&&(j=null==t||"function"!=typeof t.view&&"function"!=typeof t?"div":t,O=n,z=r,N=null,L=(e.render||function(e){return e}).bind(e),o())};t.view||"function"==typeof t?i({},t):t.onmatch?P.resolve(t.onmatch(n,r)).then(function(e){i(t,e)},l):i(t,"div")},l),S.subscribe(e,o)}t.route=(k=window,S=E,I=A(k),R.set=function(e,t,n){null!=N&&((n=n||{}).replace=!0),N=null,I.setPath(e,t,n)},R.get=function(){return z},R.prefix=function(e){I.prefix=e},R.link=function(e){e.dom.setAttribute("href",I.prefix+e.attrs.href),e.dom.onclick=function(e){if(!(e.ctrlKey||e.metaKey||e.shiftKey||2===e.which)){e.preventDefault(),e.redraw=!1;var t=this.getAttribute("href");0===t.indexOf(I.prefix)&&(t=t.slice(I.prefix.length)),R.set(t,void 0,void 0)}}},R.param=function(e){return void 0!==O&&void 0!==e?O[e]:O},R),t.withAttr=function(t,n,r){return function(e){n.call(r||this,t in e.currentTarget?e.currentTarget[t]:e.currentTarget.getAttribute(t))}};var $=a(window);t.render=$.render,t.redraw=E.redraw,t.request=i.request,t.jsonp=i.jsonp,t.parseQueryString=T,t.buildQueryString=p,t.version="1.1.6",t.vnode=C,void 0!==D?D.exports=t:window.m=t}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("timers").setImmediate)},{timers:10}],9:[function(e,t,n){var r,i,o=t.exports={};function l(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===l||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:l}catch(e){r=l}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(e){i=a}}();var u,c=[],f=!1,d=-1;function h(){f&&u&&(f=!1,u.length?c=u.concat(c):d=-1,c.length&&p())}function p(){if(!f){var e=s(h);f=!0;for(var t=c.length;t;){for(u=c,c=[];++d<t;)u&&u[d].run();d=-1,t=c.length}u=null,f=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function v(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new m(e,t)),1!==c.length||f||s(p)},m.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],10:[function(s,e,u){(function(e,t){var r=s("process/browser.js").nextTick,n=Function.prototype.apply,i=Array.prototype.slice,o={},l=0;function a(e,t){this._id=e,this._clearFn=t}u.setTimeout=function(){return new a(n.call(setTimeout,window,arguments),clearTimeout)},u.setInterval=function(){return new a(n.call(setInterval,window,arguments),clearInterval)},u.clearTimeout=u.clearInterval=function(e){e.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(window,this._id)},u.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},u.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},u._unrefActive=u.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},u.setImmediate="function"==typeof e?e:function(e){var t=l++,n=!(arguments.length<2)&&i.call(arguments,1);return o[t]=!0,r(function(){o[t]&&(n?e.apply(null,n):e.call(null),u.clearImmediate(t))}),t},u.clearImmediate="function"==typeof t?t:function(e){delete o[e]}}).call(this,s("timers").setImmediate,s("timers").clearImmediate)},{"process/browser.js":9,timers:10}],11:[function(e,t,n){function f(r){document.addEventListener("mouseover",function(e){var t=e.target,n=r(t);n||(n=(t=t.parentElement)&&r(t)),n&&f.show(t,n,!0)})}f.show=function(e,t,n){var r,i,o,l,a,s="data-tlite";function u(){f.hide(r,!0)}function c(){o||(o=function(a,e,t){var s=document.createElement("span"),n=t.grav||a.getAttribute("data-tlite")||"n";s.innerHTML=e,a.appendChild(s);var u=n[0]||"",c=n[1]||"";function r(){s.className="tlite tlite-"+u+c;var e=a.offsetTop,t=a.offsetLeft;s.offsetParent===a&&(e=t=0);var n=a.offsetWidth,r=a.offsetHeight,i=s.offsetHeight,o=s.offsetWidth,l=t+n/2;s.style.top=("s"===u?e-i-10:"n"===u?e+r+10:e+r/2-i/2)+"px",s.style.left=("w"===c?t:"e"===c?t+n-o:"w"===u?t+n+10:"e"===u?t-o-10:l-o/2)+"px"}r();var i=s.getBoundingClientRect();"s"===u&&i.top<0?(u="n",r()):"n"===u&&i.bottom>window.innerHeight?(u="s",r()):"e"===u&&i.left<0?(u="w",r()):"w"===u&&i.right>window.innerWidth&&(u="e",r());return s.className+=" tlite-visible",s}(r,a,i))}t=t||{},(e.tooltip||(i=t,(r=e).addEventListener("mousedown",u),r.addEventListener("mouseleave",u),r.tooltip={show:function(){a=r.title||r.getAttribute(s)||a,r.title="",r.setAttribute(s,""),a&&!l&&(l=setTimeout(c,n?150:1))},hide:function(e){if(n===e){l=clearTimeout(l);var t=o&&o.parentNode;t&&t.removeChild(o),o=void 0}}})).show()},f.hide=function(e,t){e.tooltip&&e.tooltip.hide(t)},void 0!==t&&t.exports&&(t.exports=f)},{}],12:[function(e,l,t){!function(e){"use strict";function t(){}var n=t.prototype,r=e.EventEmitter;function o(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function i(e){return function(){return this[e].apply(this,arguments)}}n.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp)for(n in t={},r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n]);else t=r[e]||(r[e]=[]);return t},n.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},n.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&((t={})[e]=n),t||n},n.addListener=function(e,t){if(!function e(t){return"function"==typeof t||t instanceof RegExp||!(!t||"object"!=typeof t)&&e(t.listener)}(t))throw new TypeError("listener must be a function");var n,r=this.getListenersAsObject(e),i="object"==typeof t;for(n in r)r.hasOwnProperty(n)&&-1===o(r[n],t)&&r[n].push(i?t:{listener:t,once:!1});return this},n.on=i("addListener"),n.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},n.once=i("addOnceListener"),n.defineEvent=function(e){return this.getListeners(e),this},n.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},n.removeListener=function(e,t){var n,r,i=this.getListenersAsObject(e);for(r in i)i.hasOwnProperty(r)&&-1!==(n=o(i[r],t))&&i[r].splice(n,1);return this},n.off=i("removeListener"),n.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},n.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},n.manipulateListeners=function(e,t,n){var r,i,o=e?this.removeListener:this.addListener,l=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(r=n.length;r--;)o.call(this,t,n[r]);else for(r in t)t.hasOwnProperty(r)&&(i=t[r])&&("function"==typeof i?o.call(this,r,i):l.call(this,r,i));return this},n.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},n.removeAllListeners=i("removeEvent"),n.emitEvent=function(e,t){var n,r,i,o,l=this.getListenersAsObject(e);for(o in l)if(l.hasOwnProperty(o))for(n=l[o].slice(0),i=0;i<n.length;i++)!0===(r=n[i]).once&&this.removeListener(e,r.listener),r.listener.apply(this,t||[])===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},n.trigger=i("emitEvent"),n.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},n.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},n._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},n._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return e.EventEmitter=r,t},"function"==typeof a&&a.amd?a(function(){return t}):"object"==typeof l&&l.exports?l.exports=t:e.EventEmitter=t}("undefined"!=typeof window?window:this||{})},{}]},{},[1])}();
|
2 |
//# sourceMappingURL=admin.min.js.map
|
1 |
+
!function i(l,a,s){function u(t,e){if(!a[t]){if(!l[t]){var n=!1;if(!e&&n)return n(t,!0);if(c)return c(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var o=a[t]={exports:{}};l[t][0].call(o.exports,function(e){return u(l[t][1][e]||e)},o,o.exports,i,l,a,s)}return a[t].exports}for(var c=!1,e=0;e<s.length;e++)u(s[e]);return u}({1:[function(e,t,n){"use strict";var r,o=(r=e("tlite"))&&r.__esModule?r:{default:r},i=e("./admin/tabs.js"),l=e("./admin/settings.js"),a=e("./admin/helpers.js");(0,o.default)(function(e){return-1<e.className.indexOf("mc4wp-tooltip")}),e("./admin/list-fetcher.js"),e("./admin/fields/mailchimp-api-key.js"),e("./admin/list-overview.js"),e("./admin/show-if.js"),window.mc4wp=window.mc4wp||{},window.mc4wp.helpers=a,window.mc4wp.settings=l,window.mc4wp.tabs=i},{"./admin/fields/mailchimp-api-key.js":2,"./admin/helpers.js":3,"./admin/list-fetcher.js":4,"./admin/list-overview.js":5,"./admin/settings.js":6,"./admin/show-if.js":7,"./admin/tabs.js":8,tlite:35}],2:[function(e,t,n){"use strict";var r=document.getElementById("mailchimp_api_key");r&&r.addEventListener("change",function(e){var t=document.createElement("p");t.className="help red",t.innerText=window.mc4wp_vars.i18n.invalid_api_key,r.nextElementSibling.innerText===t.innerText&&r.nextElementSibling.parentElement.removeChild(r.nextElementSibling),r.value.match(/^[0-9a-zA-Z*]{32}-[a-z]{2}[0-9]{1,2}$/)||r.parentElement.insertBefore(t,r.nextElementSibling)})},{}],3:[function(e,t,n){"use strict";var r={debounce:function(r,o,i){var l;return function(){var e=this,t=arguments,n=i&&!l;clearTimeout(l),l=setTimeout(function(){l=null,i||r.apply(e,t)},o),n&&r.apply(e,t)}}};t.exports=r},{}],4:[function(e,t,n){"use strict";var r=window.mc4wp_vars,o=window.mc4wp_vars.i18n,i=window.mc4wp_vars.ajaxurl,l=e("mithril"),a={working:!1,done:!1,success:!1};function s(e){e&&e.preventDefault(),a.working=!0,a.done=!1,l.request({method:"POST",url:i+"?action=mc4wp_renew_mailchimp_lists",timeout:6e5}).then(function(e){a.success=!0,e&&window.setTimeout(function(){window.location.reload()},3e3)}).catch(function(e){a.success=!1}).finally(function(e){a.working=!1,a.done=!0,l.redraw()})}var u=document.getElementById("mc4wp-list-fetcher");u&&(r.mailchimp.api_connected&&0===r.mailchimp.lists.length&&s(),l.mount(u,{view:function(){return l("form",{method:"POST",onsubmit:s.bind(this)},[l("p",[l("input",{type:"submit",value:a.working?o.fetching_mailchimp_lists:o.renew_mailchimp_lists,className:"button",disabled:!!a.working}),l.trust(" "),a.working?[l("span.mc4wp-loader","Loading..."),l.trust(" ")]:"",a.done?[a.success?l("em.help.green",o.fetching_mailchimp_lists_done):l("em.help.red",o.fetching_mailchimp_lists_error)]:""])])}}))},{mithril:13}],5:[function(e,t,n){"use strict";var i=window.mc4wp_vars.ajaxurl,l=e("mithril");function r(e){e.preventDefault();var t=e.target,n=t.parentElement.parentElement.nextElementSibling,r=t.getAttribute("data-list-id"),o=n.querySelector("div");"none"===n.style.display?(l.request({method:"GET",url:i+"?action=mc4wp_get_list_details&ids="+r}).then(function(e){l.render(o,function(e){return[l("h3","Merge fields"),l("table.widefat.striped",[l("thead",[l("tr",[l("th","Name"),l("th","Tag"),l("th","Type")])]),l("tbody",e.merge_fields.map(function(e){return l("tr",[l("td",[e.name,e.required&&l("span.red","*")]),l("td",[l("code",e.tag)]),l("td",[e.type," ",e.options&&e.options.date_format?"("+e.options.date_format+")":"",e.options&&e.options.choices?"("+e.options.choices.join(", ")+")":""])])}))]),0<e.interest_categories.length&&[l("h3","Interest Categories"),l("table.striped.widefat",[l("thead",[l("tr",[l("th","Name"),l("th","Type"),l("th","Interests")])]),l("tbody",e.interest_categories.map(function(t){return l("tr",[l("td",[l("strong",t.title),l("br"),l("br"),"ID: ",l("code",t.id)]),l("td",t.type),l("td",[l("div.row",{style:"margin-bottom: 4px;"},[l("div.col.col-3",[l("strong",{style:"display: block; border-bottom: 1px solid #eee;"},"Name")]),l("div.col.col-3",[l("strong",{style:"display: block; border-bottom: 1px solid #eee;"},"ID")])]),Object.keys(t.interests).map(function(e){return l("div.row.tiny-margin",[l("div.col.col-3",t.interests[e]),l("div.col.col-3",[l("code",{title:"Interest ID"},e)]),l("br.clearfix.clear.cf")])})])])}))])]]}(e.shift()))}),n.style.display=""):n.style.display="none"}Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var o=document.getElementById("mc4wp-mailchimp-lists-overview");o&&o.addEventListener("click",function(e){e.target.matches(".mc4wp-mailchimp-list")&&r(e)})},{mithril:13}],6:[function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=document.getElementById("mc4wp-admin").querySelectorAll(".mc4wp-list-input"),i=window.mc4wp_vars.mailchimp.lists,l=[],a={};function s(){return l=[],[].forEach.call(o,function(e){"boolean"==typeof e.checked&&!e.checked||"object"!==r(i[e.value])||l.push(i[e.value])}),function(){var e=document.querySelectorAll(".lists--only-selected > *");[].forEach.call(e,function(e){var t=0<function(t,n){return l.filter(function(e){return e[t]===n})}("id",e.getAttribute("data-list-id")).length;e.style.display=t?"":"none"})}(),function(e,t){a[e]=a[e]||[],a[e].forEach(function(e){return e.apply(null,t)})}("selectedLists.change",[l]),l}[].forEach.call(o,function(e){e.addEventListener("change",s)}),s(),t.exports={getSelectedLists:function(){return l},on:function(e,t){a[e]=a[e]||[],a[e].push(t)}}},{}],7:[function(e,t,n){"use strict";var r=document.querySelectorAll("[data-showif]");[].forEach.call(r,function(e){var n=JSON.parse(e.getAttribute("data-showif")),t=document.querySelectorAll('[name="'+n.element+'"]'),r=e.querySelectorAll("input,select,textarea:not([readonly])"),o=void 0===n.hide||n.hide;function i(){if("radio"!==this.getAttribute("type")||this.checked){var t=("checkbox"===this.getAttribute("type")?this.checked:this.value)==n.value;o?(e.style.display=t?"":"none",e.style.visibility=t?"":"hidden"):e.style.opacity=t?"":"0.4",[].forEach.call(r,function(e){t?e.removeAttribute("readonly"):e.setAttribute("readonly","readonly")})}}[].forEach.call(t,function(e){e.addEventListener("change",i),i.call(e)})})},{}],8:[function(e,t,n){"use strict";var i=e("./url.js"),o=document.getElementById("mc4wp-admin"),r=o.querySelectorAll(".tab"),l=o.querySelectorAll(".nav-tab"),a=o.querySelector('input[name="_wp_http_referer"]'),s=[];function u(e){for(var t=0;t<s.length;t++)if(s[t].id===e)return s[t];return null}function c(e,t){if("string"==typeof e&&(e=u(e)),!e)return!1;void 0===t&&(t=!0),[].forEach.call(r,function(e){e.className=e.className.replace("tab-active",""),e.style.display=" none"}),[].forEach.call(l,function(e){e.className=e.className.replace("nav-tab-active","")}),[].forEach.call(e.nav,function(e){e.className+=" nav-tab-active",e.blur()}),e.element.style.display="block",e.element.className+=" tab-active";var n=i.setParameter(window.location.href,"tab",e.id);return history.pushState&&t&&history.pushState(e.id,"",n),f(e),a.value=n,"function"==typeof tb_remove&&tb_remove(),window.mc4wp&&window.mc4wp.forms&&window.mc4wp.forms.editor&&window.mc4wp.forms.editor.refresh(),!0}function f(e){var t=document.title.split("-");document.title=document.title.replace(t[0],e.title+" ")}function d(e){var t=e.target,n=t.getAttribute("data-tab");if(!n){var r=t.className.match(/nav-tab-(\w+)?/);r&&(n=r[1])}if(!n){var o=i.parse(t.href);if(!o.tab)return;n=o.tab}return!c(n)||(e.preventDefault(),e.returnValue=!1)}Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),[].forEach.call(r,function(e,t){var n=e.id.substring(4),r=e.querySelector("h2:first-of-type").textContent;s.push({id:n,title:r,element:e,nav:o.querySelectorAll(".nav-tab-"+n),open:function(){return c(n)}})}),[].forEach.call(l,function(e){return e.addEventListener("click",d)}),document.body.addEventListener("click",function(e){e.target.matches(".tab-link")&&d(e)}),function(){var e=s.filter(function(e){return null!==e.element.offsetParent}).shift();if(e){var t=u(e.id.substring(4));t&&(history.replaceState&&null===history.state&&history.replaceState(t.id,""),f(t))}}(),window.addEventListener&&history.pushState&&window.addEventListener("popstate",function(e){return!e.state||c(e.state,!1)}),t.exports={open:c,get:u}},{"./url.js":9}],9:[function(e,t,n){"use strict";var o={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 r=o.parse(e);return r[t]=n,o.build(r)}};t.exports=o},{}],10:[function(e,t,n){"use strict";var s=e("../render/vnode");t.exports=function(r,e,t){var o=[],n=!1,i=!1;function l(){if(n)throw new Error("Nested m.redraw.sync() call");n=!0;for(var e=0;e<o.length;e+=2)try{r(o[e],s(o[e+1]),a)}catch(e){t.error(e)}n=!1}function a(){i||(i=!0,e(function(){i=!1,l()}))}return a.sync=l,{mount:function(e,t){if(null!=t&&null==t.view&&"function"!=typeof t)throw new TypeError("m.mount(element, component) expects a component, not a vnode");var n=o.indexOf(e);0<=n&&(o.splice(n,2),r(e,[],a)),null!=t&&(o.push(e,t),r(e,s(t),a))},redraw:a}}},{"../render/vnode":29}],11:[function(e,t,n){(function(E){"use strict";var k=e("../render/vnode"),l=e("../render/hyperscript"),T=e("../promise/promise"),i=e("../pathname/build"),S=e("../pathname/parse"),_=e("../pathname/compileTemplate"),j=e("../pathname/assign"),A={};t.exports=function(d,p){var s;function m(e,t,n){if(e=i(e,t),null!=s){s();var r=n?n.state:null,o=n?n.title:null;n&&n.replace?d.history.replaceState(r,o,x.prefix+e):d.history.pushState(r,o,x.prefix+e)}else d.location.href=x.prefix+e}var h,v,y,g,w=A,b=x.SKIP={};function x(e,t,n){if(null==e)throw new Error("Ensure the DOM element that was passed to `m.route` is not undefined");var r,u=0,c=Object.keys(n).map(function(e){if("/"!==e[0])throw new SyntaxError("Routes must start with a `/`");if(/:([^\/\.-]+)(\.{3})?:/.test(e))throw new SyntaxError("Route parameter names must be separated with either `/`, `.`, or `-`");return{route:e,component:n[e],check:_(e)}}),o="function"==typeof E?E:setTimeout,f=T.resolve(),i=!1;if((s=null)!=t){var l=S(t);if(!c.some(function(e){return e.check(l)}))throw new ReferenceError("Default route doesn't match any known routes")}function a(){i=!1;var e=d.location.hash;"#"!==x.prefix[0]&&(e=d.location.search+e,"?"!==x.prefix[0]&&"/"!==(e=d.location.pathname+e)[0]&&(e="/"+e));var l=e.concat().replace(/(?:%[a-f89][a-f0-9])+/gim,decodeURIComponent).slice(x.prefix.length),a=S(l);function s(){if(l===t)throw new Error("Could not resolve default route "+t);m(t,null,{replace:!0})}j(a.params,d.history.state),function t(n){for(;n<c.length;n++)if(c[n].check(a)){var r=c[n].component,e=c[n].route,o=r,i=g=function(e){if(i===g){if(e===b)return t(n+1);h=null==e||"function"!=typeof e.view&&"function"!=typeof e?"div":e,v=a.params,y=l,g=null,w=r.render?r:null,2===u?p.redraw():(u=2,p.redraw.sync())}};return void(r.view||"function"==typeof r?(r={},i(o)):r.onmatch?f.then(function(){return r.onmatch(a.params,l,e)}).then(i,s):i("div"))}s()}(0)}return s=function(){i||(i=!0,o(a))},"function"==typeof d.history.pushState?(r=function(){d.removeEventListener("popstate",s,!1)},d.addEventListener("popstate",s,!1)):"#"===x.prefix[0]&&(s=null,r=function(){d.removeEventListener("hashchange",a,!1)},d.addEventListener("hashchange",a,!1)),p.mount(e,{onbeforeupdate:function(){return!(!(u=u?2:1)||A===w)},oncreate:a,onremove:r,view:function(){if(u&&A!==w){var e=[k(h,v.key,v)];return w&&(e=w.render(e[0])),e}}})}return x.set=function(e,t,n){null!=g&&((n=n||{}).replace=!0),g=null,m(e,t,n)},x.get=function(){return y},x.prefix="#!",x.Link={view:function(e){var n,r,o=e.attrs.options,t={};j(t,e.attrs),t.selector=t.options=t.key=t.oninit=t.oncreate=t.onbeforeupdate=t.onupdate=t.onbeforeremove=t.onremove=null;var i=l(e.attrs.selector||"a",t,e.children);return(i.attrs.disabled=Boolean(i.attrs.disabled))?(i.attrs.href=null,i.attrs["aria-disabled"]="true",i.attrs.onclick=null):(n=i.attrs.onclick,r=i.attrs.href,i.attrs.href=x.prefix+r,i.attrs.onclick=function(e){var t;"function"==typeof n?t=n.call(e.currentTarget,e):null==n||"object"!=typeof n||"function"==typeof n.handleEvent&&n.handleEvent(e),!1===t||e.defaultPrevented||0!==e.button&&0!==e.which&&1!==e.which||e.currentTarget.target&&"_self"!==e.currentTarget.target||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||(e.preventDefault(),e.redraw=!1,x.set(r,null,o))}),i}},x.param=function(e){return v&&null!=e?v[e]:v},x}}).call(this,e("timers").setImmediate)},{"../pathname/assign":15,"../pathname/build":16,"../pathname/compileTemplate":17,"../pathname/parse":18,"../promise/promise":20,"../render/hyperscript":25,"../render/vnode":29,timers:34}],12:[function(e,t,n){"use strict";var r=e("./render/hyperscript");r.trust=e("./render/trust"),r.fragment=e("./render/fragment"),t.exports=r},{"./render/fragment":24,"./render/hyperscript":25,"./render/trust":28}],13:[function(e,t,n){"use strict";function r(){return o.apply(this,arguments)}var o=e("./hyperscript"),i=e("./request"),l=e("./mount-redraw");r.m=o,r.trust=o.trust,r.fragment=o.fragment,r.mount=l.mount,r.route=e("./route"),r.render=e("./render"),r.redraw=l.redraw,r.request=i.request,r.jsonp=i.jsonp,r.parseQueryString=e("./querystring/parse"),r.buildQueryString=e("./querystring/build"),r.parsePathname=e("./pathname/parse"),r.buildPathname=e("./pathname/build"),r.vnode=e("./render/vnode"),r.PromisePolyfill=e("./promise/polyfill"),t.exports=r},{"./hyperscript":12,"./mount-redraw":14,"./pathname/build":16,"./pathname/parse":18,"./promise/polyfill":19,"./querystring/build":21,"./querystring/parse":22,"./render":23,"./render/vnode":29,"./request":30,"./route":32}],14:[function(e,t,n){"use strict";var r=e("./render");t.exports=e("./api/mount-redraw")(r,requestAnimationFrame,console)},{"./api/mount-redraw":10,"./render":23}],15:[function(e,t,n){"use strict";t.exports=Object.assign||function(t,n){n&&Object.keys(n).forEach(function(e){t[e]=n[e]})}},{}],16:[function(e,t,n){"use strict";var h=e("../querystring/build"),v=e("./assign");t.exports=function(e,r){if(/:([^\/\.-]+)(\.{3})?:/.test(e))throw new SyntaxError("Template parameter names *must* be separated");if(null==r)return e;var t=e.indexOf("?"),n=e.indexOf("#"),o=n<0?e.length:n,i=t<0?o:t,l=e.slice(0,i),a={};v(a,r);var s=l.replace(/:([^\/\.-]+)(\.{3})?/g,function(e,t,n){return delete a[t],null==r[t]?e:n?r[t]:encodeURIComponent(String(r[t]))}),u=s.indexOf("?"),c=s.indexOf("#"),f=c<0?s.length:c,d=u<0?f:u,p=s.slice(0,d);0<=t&&(p+=e.slice(t,o)),0<=u&&(p+=(t<0?"?":"&")+s.slice(u,f));var m=h(a);return m&&(p+=(t<0&&u<0?"?":"&")+m),0<=n&&(p+=e.slice(n)),0<=c&&(p+=(n<0?"":"&")+s.slice(c)),p}},{"../querystring/build":21,"./assign":15}],17:[function(e,t,n){"use strict";var a=e("./parse");t.exports=function(e){var r=a(e),o=Object.keys(r.params),i=[],l=new RegExp("^"+r.path.replace(/:([^\/.-]+)(\.{3}|\.(?!\.)|-)?|[\\^$*+.()|\[\]{}]/g,function(e,t,n){return null==t?"\\"+e:(i.push({k:t,r:"..."===n}),"..."===n?"(.*)":"."===n?"([^/]+)\\.":"([^/]+)"+(n||""))})+"$");return function(e){for(var t=0;t<o.length;t++)if(r.params[o[t]]!==e.params[o[t]])return!1;if(!i.length)return l.test(e.path);var n=l.exec(e.path);if(null==n)return!1;for(t=0;t<i.length;t++)e.params[i[t].k]=i[t].r?n[t+1]:decodeURIComponent(n[t+1]);return!0}}},{"./parse":18}],18:[function(e,t,n){"use strict";var l=e("../querystring/parse");t.exports=function(e){var t=e.indexOf("?"),n=e.indexOf("#"),r=n<0?e.length:n,o=t<0?r:t,i=e.slice(0,o).replace(/\/{2,}/g,"/");return i?("/"!==i[0]&&(i="/"+i),1<i.length&&"/"===i[i.length-1]&&(i=i.slice(0,-1))):i="/",{path:i,params:t<0?{}:l(e.slice(t+1,r))}}},{"../querystring/parse":22}],19:[function(e,t,n){(function(n){"use strict";var d=function(e){if(!(this instanceof d))throw new Error("Promise must be called with `new`");if("function"!=typeof e)throw new TypeError("executor must be a function");var i=this,l=[],a=[],o=t(l,!0),s=t(a,!1),u=i._instance={resolvers:l,rejectors:a},c="function"==typeof n?n:setTimeout;function t(r,o){return function t(n){var e;try{if(!o||null==n||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof(e=n.then))c(function(){o||0!==r.length||console.error("Possible unhandled promise rejection:",n);for(var e=0;e<r.length;e++)r[e](n);l.length=0,a.length=0,u.state=o,u.retry=function(){t(n)}});else{if(n===i)throw new TypeError("Promise can't be resolved w/ itself");f(e.bind(n))}}catch(e){s(e)}}}function f(e){var n=0;function t(t){return function(e){0<n++||t(e)}}var r=t(s);try{e(t(o),r)}catch(e){r(e)}}f(e)};d.prototype.then=function(e,t){var o,i,l=this._instance;function n(t,e,n,r){e.push(function(e){if("function"!=typeof t)n(e);else try{o(t(e))}catch(e){i&&i(e)}}),"function"==typeof l.retry&&r===l.state&&l.retry()}var r=new d(function(e,t){o=e,i=t});return n(e,l.resolvers,o,!0),n(t,l.rejectors,i,!1),r},d.prototype.catch=function(e){return this.then(null,e)},d.prototype.finally=function(t){return this.then(function(e){return d.resolve(t()).then(function(){return e})},function(e){return d.resolve(t()).then(function(){return d.reject(e)})})},d.resolve=function(t){return t instanceof d?t:new d(function(e){e(t)})},d.reject=function(n){return new d(function(e,t){t(n)})},d.all=function(a){return new d(function(n,r){var o=a.length,i=0,l=[];if(0===a.length)n([]);else for(var e=0;e<a.length;e++)!function(t){function e(e){i++,l[t]=e,i===o&&n(l)}null==a[t]||"object"!=typeof a[t]&&"function"!=typeof a[t]||"function"!=typeof a[t].then?e(a[t]):a[t].then(e,r)}(e)})},d.race=function(r){return new d(function(e,t){for(var n=0;n<r.length;n++)r[n].then(e,t)})},t.exports=d}).call(this,e("timers").setImmediate)},{timers:34}],20:[function(n,r,e){(function(e){"use strict";var t=n("./polyfill");"undefined"!=typeof window?(void 0===window.Promise?window.Promise=t:window.Promise.prototype.finally||(window.Promise.prototype.finally=t.prototype.finally),r.exports=window.Promise):void 0!==e?(void 0===e.Promise?e.Promise=t:e.Promise.prototype.finally||(e.Promise.prototype.finally=t.prototype.finally),r.exports=e.Promise):r.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./polyfill":19}],21:[function(e,t,n){"use strict";t.exports=function(e){if("[object Object]"!==Object.prototype.toString.call(e))return"";var r=[];for(var t in e)o(t,e[t]);return r.join("&");function o(e,t){if(Array.isArray(t))for(var n=0;n<t.length;n++)o(e+"["+n+"]",t[n]);else if("[object Object]"===Object.prototype.toString.call(t))for(var n in t)o(e+"["+n+"]",t[n]);else r.push(encodeURIComponent(e)+(null!=t&&""!==t?"="+encodeURIComponent(t):""))}}},{}],22:[function(e,t,n){"use strict";t.exports=function(e){if(""===e||null==e)return{};"?"===e.charAt(0)&&(e=e.slice(1));for(var t=e.split("&"),n={},r={},o=0;o<t.length;o++){var i=t[o].split("="),l=decodeURIComponent(i[0]),a=2===i.length?decodeURIComponent(i[1]):"";"true"===a?a=!0:"false"===a&&(a=!1);var s=l.split(/\]\[?|\[/),u=r;-1<l.indexOf("[")&&s.pop();for(var c=0;c<s.length;c++){var f=s[c],d=s[c+1],p=""==d||!isNaN(parseInt(d,10));if(""===f)null==n[l=s.slice(0,c).join()]&&(n[l]=Array.isArray(u)?u.length:0),f=n[l]++;else if("__proto__"===f)break;if(c===s.length-1)u[f]=a;else{var m=Object.getOwnPropertyDescriptor(u,f);null!=m&&(m=m.value),null==m&&(u[f]=m=p?[]:{}),u=m}}}return r}},{}],23:[function(e,t,n){"use strict";t.exports=e("./render/render")(window)},{"./render/render":27}],24:[function(e,t,n){"use strict";var r=e("../render/vnode"),o=e("./hyperscriptVnode");t.exports=function(){var e=o.apply(0,arguments);return e.tag="[",e.children=r.normalizeChildren(e.children),e}},{"../render/vnode":29,"./hyperscriptVnode":26}],25:[function(e,t,n){"use strict";var s=e("../render/vnode"),r=e("./hyperscriptVnode"),u=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,c={},f={}.hasOwnProperty;function d(e){for(var t in e)if(f.call(e,t))return!1;return!0}t.exports=function(e){if(null==e||"string"!=typeof e&&"function"!=typeof e&&"function"!=typeof e.view)throw Error("The selector must be either a string or a component.");var t=r.apply(1,arguments);return"string"==typeof e&&(t.children=s.normalizeChildren(t.children),"["!==e)?function(e,t){var n=t.attrs,r=s.normalizeChildren(t.children),o=f.call(n,"class"),i=o?n.class:n.className;if(t.tag=e.tag,t.attrs=null,t.children=void 0,!d(e.attrs)&&!d(n)){var l={};for(var a in n)f.call(n,a)&&(l[a]=n[a]);n=l}for(var a in e.attrs)f.call(e.attrs,a)&&"className"!==a&&!f.call(n,a)&&(n[a]=e.attrs[a]);for(var a in null==i&&null==e.attrs.className||(n.className=null!=i?null!=e.attrs.className?String(e.attrs.className)+" "+String(i):i:null!=e.attrs.className?e.attrs.className:null),o&&(n.class=null),n)if(f.call(n,a)&&"key"!==a){t.attrs=n;break}return Array.isArray(r)&&1===r.length&&null!=r[0]&&"#"===r[0].tag?t.text=r[0].children:t.children=r,t}(c[e]||function(e){for(var t,n="div",r=[],o={};t=u.exec(e);){var i=t[1],l=t[2];if(""===i&&""!==l)n=l;else if("#"===i)o.id=l;else if("."===i)r.push(l);else if("["===t[3][0]){var a=t[6];a=a&&a.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\"),"class"===t[4]?r.push(a):o[t[4]]=""===a?a:a||!0}}return 0<r.length&&(o.className=r.join(" ")),c[e]={tag:n,attrs:o}}(e),t):(t.tag=e,t)}},{"../render/vnode":29,"./hyperscriptVnode":26}],26:[function(e,t,n){"use strict";var r=e("../render/vnode");t.exports=function(){var e,t=arguments[this],n=this+1;if(null==t?t={}:"object"==typeof t&&null==t.tag&&!Array.isArray(t)||(t={},n=this),arguments.length===n+1)e=arguments[n],Array.isArray(e)||(e=[e]);else for(e=[];n<arguments.length;)e.push(arguments[n++]);return r("",t.key,t,e)}},{"../render/vnode":29}],27:[function(e,t,n){"use strict";var $=e("../render/vnode");t.exports=function(e){var s,c=e&&e.document,t={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"};function f(e){return e.attrs&&e.attrs.xmlns||t[e.tag]}function u(e,t){if(e.state!==t)throw new Error("`vnode.state` must not be modified")}function d(e){var t=e.state;try{return this.apply(t,arguments)}finally{u(e,t)}}function p(){try{return c.activeElement}catch(e){return null}}function A(e,t,n,r,o,i,l){for(var a=n;a<r;a++){var s=t[a];null!=s&&C(e,s,o,l,i)}}function C(e,t,n,r,o){var i=t.tag;if("string"==typeof i)switch(t.state={},null!=t.attrs&&_(t.attrs,t,n),i){case"#":!function(e,t,n){t.dom=c.createTextNode(t.children),v(e,t.dom,n)}(e,t,o);break;case"<":a(e,t,r,o);break;case"[":!function(e,t,n,r,o){var i=c.createDocumentFragment();if(null!=t.children){var l=t.children;A(i,l,0,l.length,n,null,r)}t.dom=i.firstChild,t.domSize=i.childNodes.length,v(e,i,o)}(e,t,n,r,o);break;default:!function(e,t,n,r,o){var i=t.tag,l=t.attrs,a=l&&l.is,s=(r=f(t)||r)?a?c.createElementNS(r,i,{is:a}):c.createElementNS(r,i):a?c.createElement(i,{is:a}):c.createElement(i);if(t.dom=s,null!=l&&function(e,t,n){for(var r in t)x(e,r,null,t[r],n)}(t,l,r),v(e,s,o),!y(t)&&(null!=t.text&&(""!==t.text?s.textContent=t.text:t.children=[$("#",void 0,void 0,t.text,void 0,void 0)]),null!=t.children)){var u=t.children;A(s,u,0,u.length,n,null,r),"select"===t.tag&&null!=l&&function(e,t){if("value"in t)if(null===t.value)-1!==e.dom.selectedIndex&&(e.dom.value=null);else{var n=""+t.value;e.dom.value===n&&-1!==e.dom.selectedIndex||(e.dom.value=n)}"selectedIndex"in t&&x(e,"selectedIndex",null,t.selectedIndex,void 0)}(t,l)}}(e,t,n,r,o)}else!function(e,t,n,r,o){(function(e,t){var n;if("function"==typeof e.tag.view){if(e.state=Object.create(e.tag),null!=(n=e.state.view).$$reentrantLock$$)return;n.$$reentrantLock$$=!0}else{if(e.state=void 0,null!=(n=e.tag).$$reentrantLock$$)return;n.$$reentrantLock$$=!0,e.state=null!=e.tag.prototype&&"function"==typeof e.tag.prototype.view?new e.tag(e):e.tag(e)}if(_(e.state,e,t),null!=e.attrs&&_(e.attrs,e,t),e.instance=$.normalize(d.call(e.state.view,e)),e.instance===e)throw Error("A view cannot return the vnode it received as argument");n.$$reentrantLock$$=null})(t,n),null!=t.instance?(C(e,t.instance,n,r,o),t.dom=t.instance.dom,t.domSize=null!=t.dom?t.instance.domSize:0):t.domSize=0}(e,t,n,r,o)}var m={caption:"table",thead:"table",tbody:"table",tfoot:"table",tr:"tbody",th:"tr",td:"tr",colgroup:"table",col:"colgroup"};function a(e,t,n,r){var o=t.children.match(/^\s*?<(\w+)/im)||[],i=c.createElement(m[o[1]]||"div");"http://www.w3.org/2000/svg"===n?(i.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+t.children+"</svg>",i=i.firstChild):i.innerHTML=t.children,t.dom=i.firstChild,t.domSize=i.childNodes.length,t.instance=[];for(var l,a=c.createDocumentFragment();l=i.firstChild;)t.instance.push(l),a.appendChild(l);v(e,a,r)}function h(e,t,n,r,o,i){if(t!==n&&(null!=t||null!=n))if(null==t||0===t.length)A(e,n,0,n.length,r,o,i);else if(null==n||0===n.length)z(e,t,0,t.length);else{var l=null!=t[0]&&null!=t[0].key,a=null!=n[0]&&null!=n[0].key,s=0,u=0;if(!l)for(;u<t.length&&null==t[u];)u++;if(!a)for(;s<n.length&&null==n[s];)s++;if(null===a&&null==l)return;if(l!=a)z(e,t,u,t.length),A(e,n,s,n.length,r,o,i);else if(a){for(var c,f,d,p,m,h=t.length-1,v=n.length-1;u<=h&&s<=v&&(d=t[h],p=n[v],d.key===p.key);)d!==p&&N(e,d,p,r,o,i),null!=p.dom&&(o=p.dom),h--,v--;for(;u<=h&&s<=v&&(c=t[u],f=n[s],c.key===f.key);)u++,s++,c!==f&&N(e,c,f,r,L(t,u,o),i);for(;u<=h&&s<=v&&s!==v&&c.key===p.key&&d.key===f.key;)q(e,d,m=L(t,u,o)),d!==f&&N(e,d,f,r,m,i),++s<=--v&&q(e,c,o),c!==p&&N(e,c,p,r,o,i),null!=p.dom&&(o=p.dom),u++,d=t[--h],p=n[v],c=t[u],f=n[s];for(;u<=h&&s<=v&&d.key===p.key;)d!==p&&N(e,d,p,r,o,i),null!=p.dom&&(o=p.dom),v--,d=t[--h],p=n[v];if(v<s)z(e,t,u,h+1);else if(h<u)A(e,n,s,v+1,r,o,i);else{var y,g,w=o,b=v-s+1,x=new Array(b),E=0,k=0,T=2147483647,S=0;for(k=0;k<b;k++)x[k]=-1;for(k=v;s<=k;k--){null==y&&(y=I(t,u,h+1));var _=y[(p=n[k]).key];null!=_&&(T=_<T?_:-1,d=t[x[k-s]=_],t[_]=null,d!==p&&N(e,d,p,r,o,i),null!=p.dom&&(o=p.dom),S++)}if(o=w,S!==h-u+1&&z(e,t,u,h+1),0===S)A(e,n,s,v+1,r,o,i);else if(-1===T)for(E=(g=function(e){var t=[0],n=0,r=0,o=0,i=O.length=e.length;for(o=0;o<i;o++)O[o]=e[o];for(o=0;o<i;++o)if(-1!==e[o]){var l=t[t.length-1];if(e[l]<e[o])O[o]=l,t.push(o);else{for(n=0,r=t.length-1;n<r;){var a=(n>>>1)+(r>>>1)+(n&r&1);e[t[a]]<e[o]?n=1+a:r=a}e[o]<e[t[n]]&&(0<n&&(O[o]=t[n-1]),t[n]=o)}}for(n=t.length,r=t[n-1];0<n--;)t[n]=r,r=O[r];return O.length=0,t}(x)).length-1,k=v;s<=k;k--)f=n[k],-1===x[k-s]?C(e,f,r,i,o):g[E]===k-s?E--:q(e,f,o),null!=f.dom&&(o=n[k].dom);else for(k=v;s<=k;k--)f=n[k],-1===x[k-s]&&C(e,f,r,i,o),null!=f.dom&&(o=n[k].dom)}}else{var j=t.length<n.length?t.length:n.length;for(s=s<u?s:u;s<j;s++)(c=t[s])===(f=n[s])||null==c&&null==f||(null==c?C(e,f,r,i,L(t,s+1,o)):null==f?P(e,c):N(e,c,f,r,L(t,s+1,o),i));t.length>j&&z(e,t,s,t.length),n.length>j&&A(e,n,s,n.length,r,o,i)}}}function N(e,t,n,r,o,i){var l=t.tag;if(l===n.tag){if(n.state=t.state,n.events=t.events,function(e,t){do{var n;if(null!=e.attrs&&"function"==typeof e.attrs.onbeforeupdate&&void 0!==(n=d.call(e.attrs.onbeforeupdate,e,t))&&!n)break;if("string"!=typeof e.tag&&"function"==typeof e.state.onbeforeupdate&&void 0!==(n=d.call(e.state.onbeforeupdate,e,t))&&!n)break;return!1}while(0);return e.dom=t.dom,e.domSize=t.domSize,e.instance=t.instance,e.attrs=t.attrs,e.children=t.children,e.text=t.text,!0}(n,t))return;if("string"==typeof l)switch(null!=n.attrs&&j(n.attrs,n,r),l){case"#":!function(e,t){e.children.toString()!==t.children.toString()&&(e.dom.nodeValue=t.children),t.dom=e.dom}(t,n);break;case"<":!function(e,t,n,r,o){t.children!==n.children?(g(e,t),a(e,n,r,o)):(n.dom=t.dom,n.domSize=t.domSize,n.instance=t.instance)}(e,t,n,i,o);break;case"[":!function(e,t,n,r,o,i){h(e,t.children,n.children,r,o,i);var l=0,a=n.children;if((n.dom=null)!=a){for(var s=0;s<a.length;s++){var u=a[s];null!=u&&null!=u.dom&&(null==n.dom&&(n.dom=u.dom),l+=u.domSize||1)}1!==l&&(n.domSize=l)}}(e,t,n,r,o,i);break;default:!function(e,t,n,r){var o=t.dom=e.dom;r=f(t)||r,"textarea"===t.tag&&(null==t.attrs&&(t.attrs={}),null!=t.text&&(t.attrs.value=t.text,t.text=void 0)),function(e,t,n,r){if(null!=n)for(var o in n)x(e,o,t&&t[o],n[o],r);var i;if(null!=t)for(var o in t)null==(i=t[o])||null!=n&&null!=n[o]||E(e,o,i,r)}(t,e.attrs,t.attrs,r),y(t)||(null!=e.text&&null!=t.text&&""!==t.text?e.text.toString()!==t.text.toString()&&(e.dom.firstChild.nodeValue=t.text):(null!=e.text&&(e.children=[$("#",void 0,void 0,e.text,void 0,e.dom.firstChild)]),null!=t.text&&(t.children=[$("#",void 0,void 0,t.text,void 0,void 0)]),h(o,e.children,t.children,n,null,r)))}(t,n,r,i)}else!function(e,t,n,r,o,i){if(n.instance=$.normalize(d.call(n.state.view,n)),n.instance===n)throw Error("A view cannot return the vnode it received as argument");j(n.state,n,r),null!=n.attrs&&j(n.attrs,n,r),null!=n.instance?(null==t.instance?C(e,n.instance,r,i,o):N(e,t.instance,n.instance,r,o,i),n.dom=n.instance.dom,n.domSize=n.instance.domSize):null!=t.instance?(P(e,t.instance),n.dom=void 0,n.domSize=0):(n.dom=t.dom,n.domSize=t.domSize)}(e,t,n,r,o,i)}else P(e,t),C(e,n,r,i,o)}function I(e,t,n){for(var r=Object.create(null);t<n;t++){var o=e[t];if(null!=o){var i=o.key;null!=i&&(r[i]=t)}}return r}var O=[];function L(e,t,n){for(;t<e.length;t++)if(null!=e[t]&&null!=e[t].dom)return e[t].dom;return n}function q(e,t,n){var r=c.createDocumentFragment();!function e(t,n,r){for(;null!=r.dom&&r.dom.parentNode===t;){if("string"!=typeof r.tag){if(null!=(r=r.instance))continue}else if("<"===r.tag)for(var o=0;o<r.instance.length;o++)n.appendChild(r.instance[o]);else if("["!==r.tag)n.appendChild(r.dom);else if(1===r.children.length){if(null!=(r=r.children[0]))continue}else for(var o=0;o<r.children.length;o++){var i=r.children[o];null!=i&&e(t,n,i)}break}}(e,r,t),v(e,r,n)}function v(e,t,n){null!=n?e.insertBefore(t,n):e.appendChild(t)}function y(e){if(null==e.attrs||null==e.attrs.contenteditable&&null==e.attrs.contentEditable)return!1;var t=e.children;if(null!=t&&1===t.length&&"<"===t[0].tag){var n=t[0].children;e.dom.innerHTML!==n&&(e.dom.innerHTML=n)}else if(null!=e.text||null!=t&&0!==t.length)throw new Error("Child node of a contenteditable must be trusted");return!0}function z(e,t,n,r){for(var o=n;o<r;o++){var i=t[o];null!=i&&P(e,i)}}function P(e,t){var n,r,o,i=0,l=t.state;if("string"!=typeof t.tag&&"function"==typeof t.state.onbeforeremove&&null!=(o=d.call(t.state.onbeforeremove,t))&&"function"==typeof o.then&&(i=1,n=o),t.attrs&&"function"==typeof t.attrs.onbeforeremove&&null!=(o=d.call(t.attrs.onbeforeremove,t))&&"function"==typeof o.then&&(i|=2,r=o),u(t,l),i){if(null!=n){var a=function(){1&i&&((i&=2)||s())};n.then(a,a)}null!=r&&(a=function(){2&i&&((i&=1)||s())},r.then(a,a))}else b(t),w(e,t);function s(){u(t,l),b(t),w(e,t)}}function g(e,t){for(var n=0;n<t.instance.length;n++)e.removeChild(t.instance[n])}function w(e,t){for(;null!=t.dom&&t.dom.parentNode===e;){if("string"!=typeof t.tag){if(null!=(t=t.instance))continue}else if("<"===t.tag)g(e,t);else{if("["!==t.tag&&(e.removeChild(t.dom),!Array.isArray(t.children)))break;if(1===t.children.length){if(null!=(t=t.children[0]))continue}else for(var n=0;n<t.children.length;n++){var r=t.children[n];null!=r&&w(e,r)}}break}}function b(e){if("string"!=typeof e.tag&&"function"==typeof e.state.onremove&&d.call(e.state.onremove,e),e.attrs&&"function"==typeof e.attrs.onremove&&d.call(e.attrs.onremove,e),"string"!=typeof e.tag)null!=e.instance&&b(e.instance);else{var t=e.children;if(Array.isArray(t))for(var n=0;n<t.length;n++){var r=t[n];null!=r&&b(r)}}}function x(e,t,n,r,o){if("key"!==t&&"is"!==t&&null!=r&&!i(t)&&(n!==r||function(e,t){return"value"===t||"checked"===t||"selectedIndex"===t||"selected"===t&&e.dom===p()||"option"===e.tag&&e.dom.parentNode===c.activeElement}(e,t)||"object"==typeof r)){if("o"===t[0]&&"n"===t[1])return S(e,t,r);if("xlink:"===t.slice(0,6))e.dom.setAttributeNS("http://www.w3.org/1999/xlink",t.slice(6),r);else if("style"===t)T(e.dom,n,r);else if(l(e,t,o)){if("value"===t){if(("input"===e.tag||"textarea"===e.tag)&&e.dom.value===""+r&&e.dom===p())return;if("select"===e.tag&&null!==n&&e.dom.value===""+r)return;if("option"===e.tag&&null!==n&&e.dom.value===""+r)return}"input"===e.tag&&"type"===t?e.dom.setAttribute(t,r):e.dom[t]=r}else"boolean"==typeof r?r?e.dom.setAttribute(t,""):e.dom.removeAttribute(t):e.dom.setAttribute("className"===t?"class":t,r)}}function E(e,t,n,r){if("key"!==t&&"is"!==t&&null!=n&&!i(t))if("o"!==t[0]||"n"!==t[1]||i(t))if("style"===t)T(e.dom,n,null);else if(!l(e,t,r)||"className"===t||"value"===t&&("option"===e.tag||"select"===e.tag&&-1===e.dom.selectedIndex&&e.dom===p())||"input"===e.tag&&"type"===t){var o=t.indexOf(":");-1!==o&&(t=t.slice(o+1)),!1!==n&&e.dom.removeAttribute("className"===t?"class":t)}else e.dom[t]=null;else S(e,t,void 0)}function i(e){return"oninit"===e||"oncreate"===e||"onupdate"===e||"onremove"===e||"onbeforeremove"===e||"onbeforeupdate"===e}function l(e,t,n){return void 0===n&&(-1<e.tag.indexOf("-")||null!=e.attrs&&e.attrs.is||"href"!==t&&"list"!==t&&"form"!==t&&"width"!==t&&"height"!==t)&&t in e.dom}var n=/[A-Z]/g;function r(e){return"-"+e.toLowerCase()}function k(e){return"-"===e[0]&&"-"===e[1]?e:"cssFloat"===e?"float":e.replace(n,r)}function T(e,t,n){if(t===n);else if(null==n)e.style.cssText="";else if("object"!=typeof n)e.style.cssText=n;else if(null==t||"object"!=typeof t)for(var r in e.style.cssText="",n)null!=(o=n[r])&&e.style.setProperty(k(r),String(o));else{for(var r in n){var o;null!=(o=n[r])&&(o=String(o))!==String(t[r])&&e.style.setProperty(k(r),o)}for(var r in t)null!=t[r]&&null==n[r]&&e.style.removeProperty(k(r))}}function o(){this._=s}function S(e,t,n){if(null!=e.events){if(e.events[t]===n)return;null==n||"function"!=typeof n&&"object"!=typeof n?(null!=e.events[t]&&e.dom.removeEventListener(t.slice(2),e.events,!1),e.events[t]=void 0):(null==e.events[t]&&e.dom.addEventListener(t.slice(2),e.events,!1),e.events[t]=n)}else null==n||"function"!=typeof n&&"object"!=typeof n||(e.events=new o,e.dom.addEventListener(t.slice(2),e.events,!1),e.events[t]=n)}function _(e,t,n){"function"==typeof e.oninit&&d.call(e.oninit,t),"function"==typeof e.oncreate&&n.push(d.bind(e.oncreate,t))}function j(e,t,n){"function"==typeof e.onupdate&&n.push(d.bind(e.onupdate,t))}return(o.prototype=Object.create(null)).handleEvent=function(e){var t,n=this["on"+e.type];"function"==typeof n?t=n.call(e.currentTarget,e):"function"==typeof n.handleEvent&&n.handleEvent(e),this._&&!1!==e.redraw&&(0,this._)(),!1===t&&(e.preventDefault(),e.stopPropagation())},function(e,t,n){if(!e)throw new TypeError("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var r=[],o=p(),i=e.namespaceURI;null==e.vnodes&&(e.textContent=""),t=$.normalizeChildren(Array.isArray(t)?t:[t]);var l=s;try{s="function"==typeof n?n:void 0,h(e,e.vnodes,t,r,null,"http://www.w3.org/1999/xhtml"===i?void 0:i)}finally{s=l}e.vnodes=t,null!=o&&p()!==o&&"function"==typeof o.focus&&o.focus();for(var a=0;a<r.length;a++)r[a]()}}},{"../render/vnode":29}],28:[function(e,t,n){"use strict";var r=e("../render/vnode");t.exports=function(e){return null==e&&(e=""),r("<",void 0,void 0,e,void 0,void 0)}},{"../render/vnode":29}],29:[function(e,t,n){"use strict";function o(e,t,n,r,o,i){return{tag:e,key:t,attrs:n,children:r,text:o,dom:i,domSize:void 0,state:void 0,events:void 0,instance:void 0}}o.normalize=function(e){return Array.isArray(e)?o("[",void 0,void 0,o.normalizeChildren(e),void 0,void 0):null==e||"boolean"==typeof e?null:"object"==typeof e?e:o("#",void 0,void 0,String(e),void 0,void 0)},o.normalizeChildren=function(e){var t=[];if(e.length){for(var n=null!=e[0]&&null!=e[0].key,r=1;r<e.length;r++)if((null!=e[r]&&null!=e[r].key)!=n)throw new TypeError("Vnodes must either always have keys or never have keys!");for(r=0;r<e.length;r++)t[r]=o.normalize(e[r])}return t},t.exports=o},{}],30:[function(e,t,n){"use strict";var r=e("./promise/promise"),o=e("./mount-redraw");t.exports=e("./request/request")(window,r,o.redraw)},{"./mount-redraw":14,"./promise/promise":20,"./request/request":31}],31:[function(e,t,n){"use strict";var u=e("../pathname/build");t.exports=function(m,n,a){var l=0;function s(e){return new n(e)}function e(l){return function(t,r){"string"!=typeof t?t=(r=t).url:null==r&&(r={});var e=new n(function(n,e){l(u(t,r.params),r,function(e){if("function"==typeof r.type)if(Array.isArray(e))for(var t=0;t<e.length;t++)e[t]=new r.type(e[t]);else e=new r.type(e);n(e)},e)});if(!0===r.background)return e;var o=0;function i(){0==--o&&"function"==typeof a&&a()}return function t(n){var r=n.then;return n.constructor=s,n.then=function(){o++;var e=r.apply(n,arguments);return e.then(i,function(e){if(i(),0===o)throw e}),t(e)},n}(e)}}function h(e,t){for(var n in e.headers)if({}.hasOwnProperty.call(e.headers,n)&&t.test(n))return!0;return!1}return s.prototype=n.prototype,s.__proto__=n,{request:e(function(i,l,a,s){var e,t=null!=l.method?l.method.toUpperCase():"GET",n=l.body,r=!(null!=l.serialize&&l.serialize!==JSON.serialize||n instanceof m.FormData),u=l.responseType||("function"==typeof l.extract?"":"json"),o=new m.XMLHttpRequest,c=!1,f=o,d=o.abort;for(var p in o.abort=function(){c=!0,d.call(this)},o.open(t,i,!1!==l.async,"string"==typeof l.user?l.user:void 0,"string"==typeof l.password?l.password:void 0),r&&null!=n&&!h(l,/^content-type$/i)&&o.setRequestHeader("Content-Type","application/json; charset=utf-8"),"function"==typeof l.deserialize||h(l,/^accept$/i)||o.setRequestHeader("Accept","application/json, text/*"),l.withCredentials&&(o.withCredentials=l.withCredentials),l.timeout&&(o.timeout=l.timeout),o.responseType=u,l.headers)!{}.hasOwnProperty.call(l.headers,p)||o.setRequestHeader(p,l.headers[p]);o.onreadystatechange=function(e){if(!c&&4===e.target.readyState)try{var t,n=200<=e.target.status&&e.target.status<300||304===e.target.status||/^file:\/\//i.test(i),r=e.target.response;if("json"===u?e.target.responseType||"function"==typeof l.extract||(r=JSON.parse(e.target.responseText)):u&&"text"!==u||null==r&&(r=e.target.responseText),"function"==typeof l.extract?(r=l.extract(e.target,l),n=!0):"function"==typeof l.deserialize&&(r=l.deserialize(r)),n)a(r);else{try{t=e.target.responseText}catch(e){t=r}var o=new Error(t);o.code=e.target.status,o.response=r,s(o)}}catch(e){s(e)}},"function"==typeof l.config&&(o=l.config(o,l,i)||o)!==f&&(e=o.abort,o.abort=function(){c=!0,e.call(this)}),null==n?o.send():"function"==typeof l.serialize?o.send(l.serialize(n)):n instanceof m.FormData?o.send(n):o.send(JSON.stringify(n))}),jsonp:e(function(e,t,n,r){var o=t.callbackName||"_mithril_"+Math.round(1e16*Math.random())+"_"+l++,i=m.document.createElement("script");m[o]=function(e){delete m[o],i.parentNode.removeChild(i),n(e)},i.onerror=function(){delete m[o],i.parentNode.removeChild(i),r(new Error("JSONP request failed"))},i.src=e+(e.indexOf("?")<0?"?":"&")+encodeURIComponent(t.callbackKey||"callback")+"="+encodeURIComponent(o),m.document.documentElement.appendChild(i)})}}},{"../pathname/build":16}],32:[function(e,t,n){"use strict";var r=e("./mount-redraw");t.exports=e("./api/router")(window,r)},{"./api/router":11,"./mount-redraw":14}],33:[function(e,t,n){var r,o,i=t.exports={};function l(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===l||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:l}catch(e){r=l}try{o="function"==typeof clearTimeout?clearTimeout:a}catch(e){o=a}}();var u,c=[],f=!1,d=-1;function p(){f&&u&&(f=!1,u.length?c=u.concat(c):d=-1,c.length&&m())}function m(){if(!f){var e=s(p);f=!0;for(var t=c.length;t;){for(u=c,c=[];++d<t;)u&&u[d].run();d=-1,t=c.length}u=null,f=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===a||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new h(e,t)),1!==c.length||f||s(m)},h.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],34:[function(s,e,u){(function(e,t){var r=s("process/browser.js").nextTick,n=Function.prototype.apply,o=Array.prototype.slice,i={},l=0;function a(e,t){this._id=e,this._clearFn=t}u.setTimeout=function(){return new a(n.call(setTimeout,window,arguments),clearTimeout)},u.setInterval=function(){return new a(n.call(setInterval,window,arguments),clearInterval)},u.clearTimeout=u.clearInterval=function(e){e.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(window,this._id)},u.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},u.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},u._unrefActive=u.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},u.setImmediate="function"==typeof e?e:function(e){var t=l++,n=!(arguments.length<2)&&o.call(arguments,1);return i[t]=!0,r(function(){i[t]&&(n?e.apply(null,n):e.call(null),u.clearImmediate(t))}),t},u.clearImmediate="function"==typeof t?t:function(e){delete i[e]}}).call(this,s("timers").setImmediate,s("timers").clearImmediate)},{"process/browser.js":33,timers:34}],35:[function(e,t,n){function f(r){document.addEventListener("mouseover",function(e){var t=e.target,n=r(t);(n=n||(t=t.parentElement)&&r(t))&&f.show(t,n,!0)})}f.show=function(e,t,n){var r,o,i,l,a,s="data-tlite";function u(){f.hide(r,!0)}function c(){i=i||function(a,e,t){var s=document.createElement("span"),n=t.grav||a.getAttribute("data-tlite")||"n";s.innerHTML=e,a.appendChild(s);var u=n[0]||"",c=n[1]||"";function r(){s.className="tlite tlite-"+u+c;var e=a.offsetTop,t=a.offsetLeft;s.offsetParent===a&&(e=t=0);var n=a.offsetWidth,r=a.offsetHeight,o=s.offsetHeight,i=s.offsetWidth,l=t+n/2;s.style.top=("s"===u?e-o-10:"n"===u?e+r+10:e+r/2-o/2)+"px",s.style.left=("w"===c?t:"e"===c?t+n-i:"w"===u?t+n+10:"e"===u?t-i-10:l-i/2)+"px"}r();var o=s.getBoundingClientRect();return"s"===u&&o.top<0?(u="n",r()):"n"===u&&o.bottom>window.innerHeight?(u="s",r()):"e"===u&&o.left<0?(u="w",r()):"w"===u&&o.right>window.innerWidth&&(u="e",r()),s.className+=" tlite-visible",s}(r,a,o)}t=t||{},(e.tooltip||(o=t,(r=e).addEventListener("mousedown",u),r.addEventListener("mouseleave",u),r.tooltip={show:function(){a=r.title||r.getAttribute(s)||a,r.title="",r.setAttribute(s,""),a&&!l&&(l=setTimeout(c,n?150:1))},hide:function(e){if(n===e){l=clearTimeout(l);var t=i&&i.parentNode;t&&t.removeChild(i),i=void 0}}})).show()},f.hide=function(e,t){e.tooltip&&e.tooltip.hide(t)},void 0!==t&&t.exports&&(t.exports=f)},{}]},{},[1]);
|
2 |
//# sourceMappingURL=admin.min.js.map
|
assets/js/admin.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["admin.js"],"names":["define","undefined","r","e","n","t","o","i","f","c","u","a","Error","code","p","exports","call","length","1","require","module","obj","_tlite","__esModule","default","tabs","settings","m","window","EventEmitter","Tabs","Settings","helpers","context","document","getElementById","events","el","className","indexOf","ListFetcher","mount","mc4wp","deps","mithril","./admin/fields/mailchimp-api-key.js","./admin/helpers.js","./admin/list-fetcher.js","./admin/settings.js","./admin/tabs.js","tlite","wolfy87-eventemitter","2","field","validate","evt","node","createElement","innerText","mc4wp_vars","i18n","invalid_api_key","nextElementSibling","parentElement","removeChild","value","match","insertBefore","addEventListener","3","showIfElements","toggleElement","selector","elements","querySelectorAll","show","clientHeight","style","display","bindEventToElement","element","event","handler","attachEvent","bindEventToElements","Array","prototype","forEach","debounce","func","wait","immediate","timeout","this","args","arguments","callNow","clearTimeout","setTimeout","apply","config","JSON","parse","getAttribute","parentElements","inputs","hide","checked","conditionMet","visibility","opacity","inputElement","removeAttribute","setAttribute","4","$","jQuery","working","done","mailchimp","api_connected","lists","fetch","preventDefault","post","ajaxurl","action","data","success","location","reload","bind","fail","always","redraw","view","method","onsubmit","type","fetching_mailchimp_lists","renew_mailchimp_lists","disabled","trust","fetching_mailchimp_lists_can_take_a_while","fetching_mailchimp_lists_done","fetching_mailchimp_lists_error","5","_typeof","Symbol","iterator","constructor","querySelector","listInputs","selectedLists","updateSelectedLists","input","push","trigger","on","rows","searchKey","searchValue","filter","getSelectedListsWhere","replace","getSelectedLists","6","URL","$context","$tabs","find","$tabNavs","refererField","each","id","substring","title","first","text","nav","open","_open","click","switchTab","body","history","pushState","activeTab","get","tab","replaceState","state","init","updateState","removeClass","css","blur","url","setParameter","href","tb_remove","forms","editor","refresh","split","tabId","urlParams","returnValue","./url.js","7","query","hasOwnProperty","b","decodeURIComponent","build","ret","d","encodeURIComponent","join","key","8","global","setImmediate","Vnode","tag","attrs0","children","dom","attrs","domSize","_state","instance","skip","normalize","isArray","normalizeChildren","selectorParser","selectorCache","hasOwn","isEmpty","object","hyperscript","start","cached","classes","exec","attrValue","compileSelector","normalized","childList","hasAttrs","class","newAttrs","execSelector","html","fragment","attrs1","PromisePolyfill","executor","TypeError","self","resolvers","rejectors","resolveCurrent","rejectCurrent","_instance","callAsync","list","shouldAbsorb","execute","then","console","error","retry","executeOnce","runs","run","fn","onerror","onFulfilled","onRejection","resolveNext","rejectNext","handle","callback","next","promise","resolve","reject","catch","all","total","count","values","consume","race","Promise","buildQueryString","Object","toString","key0","destructure","$window","oncompletion","callbackCount","FILE_PROTOCOL_REGEX","RegExp","requestService","request","extra","finalize","finalizer","promise0","toUpperCase","useBody","serialize","FormData","stringify","deserialize","extract","interpolate","assemble","xhr","XMLHttpRequest","aborted","_abort","abort","async","user","password","headers","setRequestHeader","withCredentials","onreadystatechange","readyState","response","status","test","cast","responseText","send","background","jsonp","callbackName","Math","round","random","script","parentNode","callbackKey","src","documentElement","appendChild","setCompletionCallback","complete","then0","tokens","slice","querystring","prefix","type0","coreRenderer","onevent","$doc","$emptyFragment","createDocumentFragment","nameSpace","svg","math","getNameSpace","vnode","xmlns","createNodes","parent","vnodes","end","hooks","nextSibling","ns","createNode","initComponent","insertNode","createComponent","initLifecycle","createTextNode","createText","createHTML","firstChild","childNodes","createFragment","attrs2","is","createElementNS","key2","setAttr","setAttrs","contenteditable","setContentEditable","textContent","selectedIndex","setLateAttrs","parent1","caption","thead","tbody","tfoot","tr","th","td","colgroup","col","temp","innerHTML","child","sentinel","create","$$reentrantLock$$","updateNodes","old","recycling","removeNodes","isUnkeyed","getNextSibling","updateNode","pool","abs","oldChildrenLength","poolChildrenLength","vnodesChildrenLength","isRecyclable","concat","map","oldStart","oldEnd","v","shouldRecycle","toFragment","getKeyMap","oldIndex","movable","oldTag","forceVnodeUpdate","forceComponentUpdate","onbeforeupdate","shouldNotUpdate","updateLifecycle","nodeValue","updateText","updateHTML","updateFragment","isLifecycleMethod","updateEvent","updateAttrs","updateElement","removeNode","updateComponent","count0","content","result","expected","called","onbeforeremove","continuation","onremove","removeNodeFromDOM","source","oncreate","onupdate","hasIntegrationMethods","attr","activeElement","isFormAttribute","nsLastIndex","substr","setAttributeNS","cssText","updateStyle","isAttribute","isCustomElement","normalized0","eventName","removeEventListener","oninit","render","active","namespace","namespaceURI","focus","setEventCallback","redrawService","renderService","callbacks","unsubscribe","key1","index","splice","subscribe","last","pending","requestAnimationFrame","now","Date","throttle","_11","redrawService0","root","component","parseQueryString","string","charAt","entries","data0","counters","entry","key5","levels","cursor","pop","j","level","nextLevel","isNumber","isNaN","parseInt","isValue","coreRouter","asyncId","supportsPushState","callAsync0","normalize1","fragment0","parsePath","path","queryData","hashData","queryIndex","hashIndex","pathEnd","queryEnd","queryParams","key4","hashParams","router","getPath","setPath","options","match2","token","hash","onpopstate","defineRoutes","routes","resolveRoute","params","pathname","k","route0","matcher","keys","callback0","debounceAsync","onhashchange","render1","attrs3","currentPath","lastUpdate","routeService","route","defaultRoute","run1","bail","payload","update","routeResolver","comp","onmatch","resolved","set","prefix0","link","vnode1","onclick","ctrlKey","metaKey","shiftKey","which","param","key3","withAttr","attrName","callback1","currentTarget","_28","version","timers","9","cachedSetTimeout","cachedClearTimeout","process","defaultSetTimout","defaultClearTimeout","runTimeout","fun","currentQueue","queue","draining","queueIndex","cleanUpNextTick","drainQueue","len","marker","runClearTimeout","Item","array","noop","nextTick","browser","env","argv","versions","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","name","binding","cwd","chdir","dir","umask","10","clearImmediate","Function","immediateIds","nextImmediateId","Timeout","clearFn","_id","_clearFn","setInterval","clearInterval","close","unref","ref","enroll","item","msecs","_idleTimeoutId","_idleTimeout","unenroll","_unrefActive","_onTimeout","process/browser.js","11","getTooltipOpts","target","opts","isAuto","tooltipEl","showTimer","fallbackAttrib","autoHide","fadeIn","grav","vertGrav","horzGrav","positionTooltip","top","offsetTop","left","offsetLeft","offsetParent","width","offsetWidth","height","offsetHeight","tooltipHeight","tooltipWidth","centerEl","rect","getBoundingClientRect","bottom","innerHeight","right","innerWidth","createTooltip","tooltip","isAutoHiding","12","proto","originalGlobalValue","indexOfListener","listener","alias","getListeners","_getEvents","flattenListeners","flatListeners","getListenersAsObject","isValidListener","listenerIsWrapped","addOnceListener","defineEvent","defineEvents","evts","addListeners","manipulateListeners","removeListeners","remove","single","multiple","removeEvent","_events","emitEvent","listenersMap","_getOnceReturnValue","setOnceReturnValue","_onceReturnValue","noConflict","amd"],"mappings":"CAAA,WAAe,IAA6BA,OAASC,GAAuB,SAASC,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,GAAE,EAAoC,IAAID,GAAGC,EAAE,OAAOA,EAAEF,GAAE,GAAI,GAAGG,EAAE,OAAOA,EAAEH,GAAE,GAAI,IAAII,EAAE,IAAIC,MAAM,uBAAuBL,EAAE,KAAK,MAAMI,EAAEE,KAAK,mBAAmBF,EAAE,IAAIG,EAAEV,EAAEG,GAAG,CAACQ,QAAQ,IAAIZ,EAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAoB,OAAOI,EAAlBH,EAAEI,GAAG,GAAGL,IAAeA,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,OAAOD,EAAEG,GAAGQ,QAAQ,IAAI,IAAIL,GAAE,EAAoCH,EAAE,EAAEA,EAAEF,EAAEY,OAAOV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,GACtC,IACIshB,EACAqE,EACAlrB,EACAoN,EAJAof,EAAelnB,KAAKkmB,qBAAqBxoB,GAO7C,IAAKoK,KAAOof,EACR,GAAIA,EAAa5f,eAAeQ,GAG5B,IAFAyZ,EAAY2F,EAAapf,GAAK0I,MAAM,GAE/B9V,EAAI,EAAGA,EAAI6mB,EAAUnmB,OAAQV,KAKR,KAFtBkrB,EAAWrE,EAAU7mB,IAERsmB,MACThhB,KAAKkhB,eAAexjB,EAAKkoB,EAASA,UAG3BA,EAASA,SAAStlB,MAAMN,KAAMC,GAAQ,MAEhCD,KAAKmnB,uBAClBnnB,KAAKkhB,eAAexjB,EAAKkoB,EAASA,UAMlD,OAAO5lB,MAMXylB,EAAMzhB,QAAU6hB,EAAM,aAUtBJ,EAAMrE,KAAO,SAAc1jB,GACvB,IAAIuC,EAAOT,MAAMC,UAAU+Q,MAAMrV,KAAK+E,UAAW,GACjD,OAAOF,KAAKinB,UAAUvpB,EAAKuC,IAW/BwlB,EAAM2B,mBAAqB,SAA4BhpB,GAEnD,OADA4B,KAAKqnB,iBAAmBjpB,EACjB4B,MAWXylB,EAAM0B,oBAAsB,WACxB,OAAInnB,KAAKsH,eAAe,qBACbtH,KAAKqnB,kBAapB5B,EAAMM,WAAa,WACf,OAAO/lB,KAAKgnB,UAAYhnB,KAAKgnB,QAAU,KAQ3ChrB,EAAasrB,WAAa,WAEtB,OADApsB,EAAQc,aAAe0pB,EAChB1pB,GAIW,mBAAX7B,GAAyBA,EAAOotB,IACvCptB,EAAO,WACH,OAAO6B,IAGY,iBAAXT,GAAuBA,EAAOL,QAC1CK,EAAOL,QAAUc,EAGjBd,EAAQc,aAAeA,EA5d9B,CA8dmB,oBAAXD,OAAyBA,OAASiE,MAAQ,KAEjD,KAAK,GAAG,CAAC,IA3lFX","file":"admin.min.js","sourcesContent":["(function () { var require = undefined; var define = undefined; (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\n'use strict'; // dependencies\n\nvar _tlite = _interopRequireDefault(require(\"tlite\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nvar m = window.m = require('mithril');\n\nvar EventEmitter = require('wolfy87-eventemitter');\n\nvar Tabs = require('./admin/tabs.js');\n\nvar Settings = require('./admin/settings.js');\n\nvar helpers = require('./admin/helpers.js'); // vars\n\n\nvar context = document.getElementById('mc4wp-admin');\nvar tabs, settings;\nvar events = new EventEmitter();\n\nif (context !== null) {\n tabs = Tabs(context);\n settings = Settings(context, helpers, events);\n}\n\n(0, _tlite[\"default\"])(function (el) {\n return el.className.indexOf('mc4wp-tooltip') > -1;\n}); // list fetcher\n\nvar ListFetcher = require('./admin/list-fetcher.js');\n\nvar mount = document.getElementById('mc4wp-list-fetcher');\n\nif (mount) {\n m.mount(mount, new ListFetcher());\n}\n\nrequire('./admin/fields/mailchimp-api-key.js'); // expose some things\n\n\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\n},{\"./admin/fields/mailchimp-api-key.js\":2,\"./admin/helpers.js\":3,\"./admin/list-fetcher.js\":4,\"./admin/settings.js\":5,\"./admin/tabs.js\":6,\"mithril\":8,\"tlite\":11,\"wolfy87-eventemitter\":12}],2:[function(require,module,exports){\n'use strict';\n\nvar field;\n\nfunction validate(evt) {\n var node = document.createElement('p');\n node.className = 'help red';\n node.innerText = window.mc4wp_vars.i18n.invalid_api_key;\n\n if (field.nextElementSibling.innerText === node.innerText) {\n field.nextElementSibling.parentElement.removeChild(field.nextElementSibling);\n }\n\n if (!field.value.match(/^[0-9a-zA-Z*]{32}-[a-z]{2}[0-9]{1,2}$/)) {\n field.parentElement.insertBefore(node, field.nextElementSibling);\n }\n}\n\n(function () {\n field = document.getElementById('mailchimp_api_key');\n\n if (!field) {\n return;\n }\n\n field.addEventListener('change', validate);\n})();\n\n},{}],3:[function(require,module,exports){\n'use strict';\n\nvar helpers = {};\n\nhelpers.toggleElement = function (selector) {\n var elements = document.querySelectorAll(selector);\n\n for (var i = 0; i < elements.length; i++) {\n var show = elements[i].clientHeight <= 0;\n elements[i].style.display = show ? '' : 'none';\n }\n};\n\nhelpers.bindEventToElement = function (element, event, handler) {\n if (element.addEventListener) {\n element.addEventListener(event, handler);\n } else if (element.attachEvent) {\n element.attachEvent('on' + event, handler);\n }\n};\n\nhelpers.bindEventToElements = function (elements, event, handler) {\n Array.prototype.forEach.call(elements, function (element) {\n helpers.bindEventToElement(element, event, handler);\n });\n}; // polling\n\n\nhelpers.debounce = function (func, wait, immediate) {\n var timeout;\n return function () {\n var context = this,\n args = arguments;\n\n var later = function later() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n};\n/**\n * Showif.js\n */\n\n\n(function () {\n var showIfElements = document.querySelectorAll('[data-showif]'); // dependent elements\n\n Array.prototype.forEach.call(showIfElements, function (element) {\n var config = JSON.parse(element.getAttribute('data-showif'));\n var parentElements = document.querySelectorAll('[name=\"' + config.element + '\"]');\n var inputs = element.querySelectorAll('input,select,textarea:not([readonly])');\n var hide = config.hide === undefined || config.hide;\n\n function toggleElement() {\n // do nothing with unchecked radio inputs\n if (this.getAttribute('type') === \"radio\" && !this.checked) {\n return;\n }\n\n var value = this.getAttribute(\"type\") === \"checkbox\" ? this.checked : this.value;\n var conditionMet = value == config.value;\n\n if (hide) {\n element.style.display = conditionMet ? '' : 'none';\n element.style.visibility = conditionMet ? '' : 'hidden';\n } else {\n element.style.opacity = conditionMet ? '' : '0.4';\n } // disable input fields to stop sending their values to server\n\n\n Array.prototype.forEach.call(inputs, function (inputElement) {\n conditionMet ? inputElement.removeAttribute('readonly') : inputElement.setAttribute('readonly', 'readonly');\n });\n } // find checked element and call toggleElement function\n\n\n Array.prototype.forEach.call(parentElements, function (parentElement) {\n toggleElement.call(parentElement);\n }); // bind on all changes\n\n helpers.bindEventToElements(parentElements, 'change', toggleElement);\n });\n})();\n\nmodule.exports = helpers;\n\n},{}],4:[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; // start fetching right away when no lists but api key given\n\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 this.working = true;\n this.done = false;\n $.post(ajaxurl, {\n action: \"mc4wp_renew_mailchimp_lists\",\n timeout: 600000 // 10 minutes, matching max_execution_time\n\n }).done(function (data) {\n this.success = true;\n\n if (data) {\n window.setTimeout(function () {\n window.location.reload();\n }, 3000);\n }\n }.bind(this)).fail(function (data) {\n this.success = false;\n }.bind(this)).always(function (data) {\n this.working = false;\n this.done = true;\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 }, [m('p', [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 }), m.trust(' '), this.working ? [m('span.mc4wp-loader', \"Loading...\"), m.trust(' '), m('em.help', i18n.fetching_mailchimp_lists_can_take_a_while)] : '', this.done ? [this.success ? m('em.help.green', i18n.fetching_mailchimp_lists_done) : m('em.help.red', i18n.fetching_mailchimp_lists_error)] : ''])]);\n};\n\nmodule.exports = ListFetcher;\n\n},{}],5:[function(require,module,exports){\n\"use strict\";\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar Settings = function Settings(context, helpers, events) {\n 'use strict'; // vars\n\n var form = context.querySelector('form');\n var listInputs = context.querySelectorAll('.mc4wp-list-input');\n var lists = mc4wp_vars.mailchimp.lists;\n var selectedLists = []; // functions\n\n function getSelectedListsWhere(searchKey, searchValue) {\n return selectedLists.filter(function (el) {\n return el[searchKey] === searchValue;\n });\n }\n\n function getSelectedLists() {\n return selectedLists;\n }\n\n function updateSelectedLists() {\n selectedLists = [];\n Array.prototype.forEach.call(listInputs, function (input) {\n // skip unchecked checkboxes\n if (typeof input.checked === \"boolean\" && !input.checked) {\n return;\n }\n\n if (_typeof(lists[input.value]) === \"object\") {\n selectedLists.push(lists[input.value]);\n }\n });\n events.trigger('selectedLists.change', [selectedLists]);\n return selectedLists;\n }\n\n function toggleVisibleLists() {\n var rows = document.querySelectorAll('.lists--only-selected > *');\n Array.prototype.forEach.call(rows, function (el) {\n var listId = el.getAttribute('data-list-id');\n var isSelected = getSelectedListsWhere('id', listId).length > 0;\n\n if (isSelected) {\n el.setAttribute('class', el.getAttribute('class').replace('hidden', ''));\n } else {\n el.setAttribute('class', el.getAttribute('class') + \" hidden\");\n }\n });\n }\n\n events.on('selectedLists.change', toggleVisibleLists);\n helpers.bindEventToElements(listInputs, 'change', updateSelectedLists);\n updateSelectedLists();\n return {\n getSelectedLists: getSelectedLists\n };\n};\n\nmodule.exports = Settings;\n\n},{}],6:[function(require,module,exports){\n'use strict';\n\nvar URL = require('./url.js'); // Tabs\n\n\nvar Tabs = function Tabs(context) {\n if (context === null) {\n return;\n } // TODO: last piece of jQuery... can we get rid of it?\n\n\n var $ = window.jQuery;\n var $context = $(context);\n var $tabs = $context.find('.tab');\n var $tabNavs = $context.find('.nav-tab');\n var refererField = context.querySelector('input[name=\"_wp_http_referer\"]');\n var tabs = [];\n $.each($tabs, function (i, t) {\n var id = t.id.substring(4);\n var title = $(t).find('h2').first().text();\n tabs.push({\n id: id,\n title: title,\n element: t,\n nav: context.querySelectorAll('.nav-tab-' + id),\n open: function open() {\n return _open(id);\n }\n });\n });\n\n function get(id) {\n for (var i = 0; i < tabs.length; i++) {\n if (tabs[i].id === id) {\n return tabs[i];\n }\n }\n\n return undefined;\n }\n\n function _open(tab, updateState) {\n // make sure we have a tab object\n if (typeof tab === \"string\") {\n tab = get(tab);\n }\n\n if (!tab) {\n return false;\n } // should we update state?\n\n\n if (updateState == undefined) {\n updateState = true;\n } // hide all tabs & remove active class\n\n\n $tabs.removeClass('tab-active').css('display', 'none');\n $tabNavs.removeClass('nav-tab-active'); // add `nav-tab-active` to this tab\n\n Array.prototype.forEach.call(tab.nav, function (nav) {\n nav.className += \" nav-tab-active\";\n nav.blur();\n }); // show target tab\n\n tab.element.style.display = 'block';\n tab.element.className += \" tab-active\"; // create new URL\n\n var url = URL.setParameter(window.location.href, \"tab\", tab.id); // update hash\n\n if (history.pushState && updateState) {\n history.pushState(tab.id, '', url);\n } // update document title\n\n\n title(tab); // update referer field\n\n refererField.value = url; // if thickbox is open, close it.\n\n if (typeof tb_remove === \"function\") {\n tb_remove();\n } // refresh editor after switching tabs\n // TODO: decouple this! law of demeter etc.\n\n\n if (tab.id === 'fields' && window.mc4wp && window.mc4wp.forms && window.mc4wp.forms.editor) {\n mc4wp.forms.editor.refresh();\n }\n\n return true;\n }\n\n function title(tab) {\n var title = document.title.split('-');\n document.title = document.title.replace(title[0], tab.title + \" \");\n }\n\n function switchTab(e) {\n e = e || window.event; // get from data attribute\n\n var tabId = this.getAttribute('data-tab'); // get from classname\n\n if (!tabId) {\n var match = this.className.match(/nav-tab-(\\w+)?/);\n\n if (match) {\n tabId = match[1];\n }\n } // get from href\n\n\n if (!tabId) {\n var urlParams = URL.parse(this.href);\n\n if (!urlParams.tab) {\n return;\n }\n\n tabId = urlParams.tab;\n }\n\n var opened = _open(tabId);\n\n if (opened) {\n e.preventDefault();\n e.returnValue = false;\n return false;\n }\n\n return true;\n }\n\n function init() {\n // check for current tab\n if (!history.pushState) {\n return;\n }\n\n var activeTab = $tabs.filter(':visible').get(0);\n\n if (!activeTab) {\n return;\n }\n\n var tab = get(activeTab.id.substring(4));\n if (!tab) return; // check if tab is in html5 history\n\n if (history.replaceState && history.state === null) {\n history.replaceState(tab.id, '');\n } // update document title\n\n\n title(tab);\n }\n\n $tabNavs.click(switchTab);\n $(document.body).on('click', '.tab-link', switchTab);\n init();\n\n if (window.addEventListener && history.pushState) {\n window.addEventListener('popstate', function (e) {\n if (!e.state) return true;\n var tabId = e.state;\n return _open(tabId, false);\n });\n }\n\n return {\n open: _open,\n get: get\n };\n};\n\nmodule.exports = Tabs;\n\n},{\"./url.js\":7}],7:[function(require,module,exports){\n'use strict';\n\nvar URL = {\n parse: function parse(url) {\n var query = {};\n var a = url.split('&');\n\n for (var i in a) {\n if (!a.hasOwnProperty(i)) {\n continue;\n }\n\n var b = a[i].split('=');\n query[decodeURIComponent(b[0])] = decodeURIComponent(b[1]);\n }\n\n return query;\n },\n build: function build(data) {\n var ret = [];\n\n for (var d in data) {\n ret.push(d + \"=\" + encodeURIComponent(data[d]));\n }\n\n return ret.join(\"&\");\n },\n setParameter: function setParameter(url, key, value) {\n var data = URL.parse(url);\n data[key] = value;\n return URL.build(data);\n }\n};\nmodule.exports = URL;\n\n},{}],8:[function(require,module,exports){\n(function (global,setImmediate){\n;(function() {\n\"use strict\"\nfunction Vnode(tag, key, attrs0, children, text, dom) {\n\treturn {tag: tag, key: key, attrs: attrs0, children: children, text: text, dom: dom, domSize: undefined, state: undefined, _state: undefined, events: undefined, instance: undefined, skip: false}\n}\nVnode.normalize = function(node) {\n\tif (Array.isArray(node)) return Vnode(\"[\", undefined, undefined, Vnode.normalizeChildren(node), undefined, undefined)\n\tif (node != null && typeof node !== \"object\") return Vnode(\"#\", undefined, undefined, node === false ? \"\" : node, undefined, undefined)\n\treturn node\n}\nVnode.normalizeChildren = function normalizeChildren(children) {\n\tfor (var i = 0; i < children.length; i++) {\n\t\tchildren[i] = Vnode.normalize(children[i])\n\t}\n\treturn children\n}\nvar selectorParser = /(?:(^|#|\\.)([^#\\.\\[\\]]+))|(\\[(.+?)(?:\\s*=\\s*(\"|'|)((?:\\\\[\"'\\]]|.)*?)\\5)?\\])/g\nvar selectorCache = {}\nvar hasOwn = {}.hasOwnProperty\nfunction isEmpty(object) {\n\tfor (var key in object) if (hasOwn.call(object, key)) return false\n\treturn true\n}\nfunction compileSelector(selector) {\n\tvar match, tag = \"div\", classes = [], attrs = {}\n\twhile (match = selectorParser.exec(selector)) {\n\t\tvar type = match[1], value = match[2]\n\t\tif (type === \"\" && value !== \"\") tag = value\n\t\telse if (type === \"#\") attrs.id = value\n\t\telse if (type === \".\") classes.push(value)\n\t\telse if (match[3][0] === \"[\") {\n\t\t\tvar attrValue = match[6]\n\t\t\tif (attrValue) attrValue = attrValue.replace(/\\\\([\"'])/g, \"$1\").replace(/\\\\\\\\/g, \"\\\\\")\n\t\t\tif (match[4] === \"class\") classes.push(attrValue)\n\t\t\telse attrs[match[4]] = attrValue === \"\" ? attrValue : attrValue || true\n\t\t}\n\t}\n\tif (classes.length > 0) attrs.className = classes.join(\" \")\n\treturn selectorCache[selector] = {tag: tag, attrs: attrs}\n}\nfunction execSelector(state, attrs, children) {\n\tvar hasAttrs = false, childList, text\n\tvar className = attrs.className || attrs.class\n\tif (!isEmpty(state.attrs) && !isEmpty(attrs)) {\n\t\tvar newAttrs = {}\n\t\tfor(var key in attrs) {\n\t\t\tif (hasOwn.call(attrs, key)) {\n\t\t\t\tnewAttrs[key] = attrs[key]\n\t\t\t}\n\t\t}\n\t\tattrs = newAttrs\n\t}\n\tfor (var key in state.attrs) {\n\t\tif (hasOwn.call(state.attrs, key)) {\n\t\t\tattrs[key] = state.attrs[key]\n\t\t}\n\t}\n\tif (className !== undefined) {\n\t\tif (attrs.class !== undefined) {\n\t\t\tattrs.class = undefined\n\t\t\tattrs.className = className\n\t\t}\n\t\tif (state.attrs.className != null) {\n\t\t\tattrs.className = state.attrs.className + \" \" + className\n\t\t}\n\t}\n\tfor (var key in attrs) {\n\t\tif (hasOwn.call(attrs, key) && key !== \"key\") {\n\t\t\thasAttrs = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif (Array.isArray(children) && children.length === 1 && children[0] != null && children[0].tag === \"#\") {\n\t\ttext = children[0].children\n\t} else {\n\t\tchildList = children\n\t}\n\treturn Vnode(state.tag, attrs.key, hasAttrs ? attrs : undefined, childList, text)\n}\nfunction hyperscript(selector) {\n\t// Because sloppy mode sucks\n\tvar attrs = arguments[1], start = 2, children\n\tif (selector == null || typeof selector !== \"string\" && typeof selector !== \"function\" && typeof selector.view !== \"function\") {\n\t\tthrow Error(\"The selector must be either a string or a component.\");\n\t}\n\tif (typeof selector === \"string\") {\n\t\tvar cached = selectorCache[selector] || compileSelector(selector)\n\t}\n\tif (attrs == null) {\n\t\tattrs = {}\n\t} else if (typeof attrs !== \"object\" || attrs.tag != null || Array.isArray(attrs)) {\n\t\tattrs = {}\n\t\tstart = 1\n\t}\n\tif (arguments.length === start + 1) {\n\t\tchildren = arguments[start]\n\t\tif (!Array.isArray(children)) children = [children]\n\t} else {\n\t\tchildren = []\n\t\twhile (start < arguments.length) children.push(arguments[start++])\n\t}\n\tvar normalized = Vnode.normalizeChildren(children)\n\tif (typeof selector === \"string\") {\n\t\treturn execSelector(cached, attrs, normalized)\n\t} else {\n\t\treturn Vnode(selector, attrs.key, attrs, normalized)\n\t}\n}\nhyperscript.trust = function(html) {\n\tif (html == null) html = \"\"\n\treturn Vnode(\"<\", undefined, undefined, html, undefined, undefined)\n}\nhyperscript.fragment = function(attrs1, children) {\n\treturn Vnode(\"[\", attrs1.key, attrs1, Vnode.normalizeChildren(children), undefined, undefined)\n}\nvar m = hyperscript\n/** @constructor */\nvar PromisePolyfill = function(executor) {\n\tif (!(this instanceof PromisePolyfill)) throw new Error(\"Promise must be called with `new`\")\n\tif (typeof executor !== \"function\") throw new TypeError(\"executor must be a function\")\n\tvar self = this, resolvers = [], rejectors = [], resolveCurrent = handler(resolvers, true), rejectCurrent = handler(rejectors, false)\n\tvar instance = self._instance = {resolvers: resolvers, rejectors: rejectors}\n\tvar callAsync = typeof setImmediate === \"function\" ? setImmediate : setTimeout\n\tfunction handler(list, shouldAbsorb) {\n\t\treturn function execute(value) {\n\t\t\tvar then\n\t\t\ttry {\n\t\t\t\tif (shouldAbsorb && value != null && (typeof value === \"object\" || typeof value === \"function\") && typeof (then = value.then) === \"function\") {\n\t\t\t\t\tif (value === self) throw new TypeError(\"Promise can't be resolved w/ itself\")\n\t\t\t\t\texecuteOnce(then.bind(value))\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tcallAsync(function() {\n\t\t\t\t\t\tif (!shouldAbsorb && list.length === 0) console.error(\"Possible unhandled promise rejection:\", value)\n\t\t\t\t\t\tfor (var i = 0; i < list.length; i++) list[i](value)\n\t\t\t\t\t\tresolvers.length = 0, rejectors.length = 0\n\t\t\t\t\t\tinstance.state = shouldAbsorb\n\t\t\t\t\t\tinstance.retry = function() {execute(value)}\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (e) {\n\t\t\t\trejectCurrent(e)\n\t\t\t}\n\t\t}\n\t}\n\tfunction executeOnce(then) {\n\t\tvar runs = 0\n\t\tfunction run(fn) {\n\t\t\treturn function(value) {\n\t\t\t\tif (runs++ > 0) return\n\t\t\t\tfn(value)\n\t\t\t}\n\t\t}\n\t\tvar onerror = run(rejectCurrent)\n\t\ttry {then(run(resolveCurrent), onerror)} catch (e) {onerror(e)}\n\t}\n\texecuteOnce(executor)\n}\nPromisePolyfill.prototype.then = function(onFulfilled, onRejection) {\n\tvar self = this, instance = self._instance\n\tfunction handle(callback, list, next, state) {\n\t\tlist.push(function(value) {\n\t\t\tif (typeof callback !== \"function\") next(value)\n\t\t\telse try {resolveNext(callback(value))} catch (e) {if (rejectNext) rejectNext(e)}\n\t\t})\n\t\tif (typeof instance.retry === \"function\" && state === instance.state) instance.retry()\n\t}\n\tvar resolveNext, rejectNext\n\tvar promise = new PromisePolyfill(function(resolve, reject) {resolveNext = resolve, rejectNext = reject})\n\thandle(onFulfilled, instance.resolvers, resolveNext, true), handle(onRejection, instance.rejectors, rejectNext, false)\n\treturn promise\n}\nPromisePolyfill.prototype.catch = function(onRejection) {\n\treturn this.then(null, onRejection)\n}\nPromisePolyfill.resolve = function(value) {\n\tif (value instanceof PromisePolyfill) return value\n\treturn new PromisePolyfill(function(resolve) {resolve(value)})\n}\nPromisePolyfill.reject = function(value) {\n\treturn new PromisePolyfill(function(resolve, reject) {reject(value)})\n}\nPromisePolyfill.all = function(list) {\n\treturn new PromisePolyfill(function(resolve, reject) {\n\t\tvar total = list.length, count = 0, values = []\n\t\tif (list.length === 0) resolve([])\n\t\telse for (var i = 0; i < list.length; i++) {\n\t\t\t(function(i) {\n\t\t\t\tfunction consume(value) {\n\t\t\t\t\tcount++\n\t\t\t\t\tvalues[i] = value\n\t\t\t\t\tif (count === total) resolve(values)\n\t\t\t\t}\n\t\t\t\tif (list[i] != null && (typeof list[i] === \"object\" || typeof list[i] === \"function\") && typeof list[i].then === \"function\") {\n\t\t\t\t\tlist[i].then(consume, reject)\n\t\t\t\t}\n\t\t\t\telse consume(list[i])\n\t\t\t})(i)\n\t\t}\n\t})\n}\nPromisePolyfill.race = function(list) {\n\treturn new PromisePolyfill(function(resolve, reject) {\n\t\tfor (var i = 0; i < list.length; i++) {\n\t\t\tlist[i].then(resolve, reject)\n\t\t}\n\t})\n}\nif (typeof window !== \"undefined\") {\n\tif (typeof window.Promise === \"undefined\") window.Promise = PromisePolyfill\n\tvar PromisePolyfill = window.Promise\n} else if (typeof global !== \"undefined\") {\n\tif (typeof global.Promise === \"undefined\") global.Promise = PromisePolyfill\n\tvar PromisePolyfill = global.Promise\n} else {\n}\nvar buildQueryString = function(object) {\n\tif (Object.prototype.toString.call(object) !== \"[object Object]\") return \"\"\n\tvar args = []\n\tfor (var key0 in object) {\n\t\tdestructure(key0, object[key0])\n\t}\n\treturn args.join(\"&\")\n\tfunction destructure(key0, value) {\n\t\tif (Array.isArray(value)) {\n\t\t\tfor (var i = 0; i < value.length; i++) {\n\t\t\t\tdestructure(key0 + \"[\" + i + \"]\", value[i])\n\t\t\t}\n\t\t}\n\t\telse if (Object.prototype.toString.call(value) === \"[object Object]\") {\n\t\t\tfor (var i in value) {\n\t\t\t\tdestructure(key0 + \"[\" + i + \"]\", value[i])\n\t\t\t}\n\t\t}\n\t\telse args.push(encodeURIComponent(key0) + (value != null && value !== \"\" ? \"=\" + encodeURIComponent(value) : \"\"))\n\t}\n}\nvar FILE_PROTOCOL_REGEX = new RegExp(\"^file://\", \"i\")\nvar _8 = function($window, Promise) {\n\tvar callbackCount = 0\n\tvar oncompletion\n\tfunction setCompletionCallback(callback) {oncompletion = callback}\n\tfunction finalizer() {\n\t\tvar count = 0\n\t\tfunction complete() {if (--count === 0 && typeof oncompletion === \"function\") oncompletion()}\n\t\treturn function finalize(promise0) {\n\t\t\tvar then0 = promise0.then\n\t\t\tpromise0.then = function() {\n\t\t\t\tcount++\n\t\t\t\tvar next = then0.apply(promise0, arguments)\n\t\t\t\tnext.then(complete, function(e) {\n\t\t\t\t\tcomplete()\n\t\t\t\t\tif (count === 0) throw e\n\t\t\t\t})\n\t\t\t\treturn finalize(next)\n\t\t\t}\n\t\t\treturn promise0\n\t\t}\n\t}\n\tfunction normalize(args, extra) {\n\t\tif (typeof args === \"string\") {\n\t\t\tvar url = args\n\t\t\targs = extra || {}\n\t\t\tif (args.url == null) args.url = url\n\t\t}\n\t\treturn args\n\t}\n\tfunction request(args, extra) {\n\t\tvar finalize = finalizer()\n\t\targs = normalize(args, extra)\n\t\tvar promise0 = new Promise(function(resolve, reject) {\n\t\t\tif (args.method == null) args.method = \"GET\"\n\t\t\targs.method = args.method.toUpperCase()\n\t\t\tvar useBody = (args.method === \"GET\" || args.method === \"TRACE\") ? false : (typeof args.useBody === \"boolean\" ? args.useBody : true)\n\t\t\tif (typeof args.serialize !== \"function\") args.serialize = typeof FormData !== \"undefined\" && args.data instanceof FormData ? function(value) {return value} : JSON.stringify\n\t\t\tif (typeof args.deserialize !== \"function\") args.deserialize = deserialize\n\t\t\tif (typeof args.extract !== \"function\") args.extract = extract\n\t\t\targs.url = interpolate(args.url, args.data)\n\t\t\tif (useBody) args.data = args.serialize(args.data)\n\t\t\telse args.url = assemble(args.url, args.data)\n\t\t\tvar xhr = new $window.XMLHttpRequest(),\n\t\t\t\taborted = false,\n\t\t\t\t_abort = xhr.abort\n\t\t\txhr.abort = function abort() {\n\t\t\t\taborted = true\n\t\t\t\t_abort.call(xhr)\n\t\t\t}\n\t\t\txhr.open(args.method, args.url, typeof args.async === \"boolean\" ? args.async : true, typeof args.user === \"string\" ? args.user : undefined, typeof args.password === \"string\" ? args.password : undefined)\n\t\t\tif (args.serialize === JSON.stringify && useBody && !(args.headers && args.headers.hasOwnProperty(\"Content-Type\"))) {\n\t\t\t\txhr.setRequestHeader(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\t\t}\n\t\t\tif (args.deserialize === deserialize && !(args.headers && args.headers.hasOwnProperty(\"Accept\"))) {\n\t\t\t\txhr.setRequestHeader(\"Accept\", \"application/json, text/*\")\n\t\t\t}\n\t\t\tif (args.withCredentials) xhr.withCredentials = args.withCredentials\n\t\t\tfor (var key in args.headers) if ({}.hasOwnProperty.call(args.headers, key)) {\n\t\t\t\txhr.setRequestHeader(key, args.headers[key])\n\t\t\t}\n\t\t\tif (typeof args.config === \"function\") xhr = args.config(xhr, args) || xhr\n\t\t\txhr.onreadystatechange = function() {\n\t\t\t\t// Don't throw errors on xhr.abort().\n\t\t\t\tif(aborted) return\n\t\t\t\tif (xhr.readyState === 4) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar response = (args.extract !== extract) ? args.extract(xhr, args) : args.deserialize(args.extract(xhr, args))\n\t\t\t\t\t\tif ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304 || FILE_PROTOCOL_REGEX.test(args.url)) {\n\t\t\t\t\t\t\tresolve(cast(args.type, response))\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar error = new Error(xhr.responseText)\n\t\t\t\t\t\t\tfor (var key in response) error[key] = response[key]\n\t\t\t\t\t\t\treject(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch (e) {\n\t\t\t\t\t\treject(e)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (useBody && (args.data != null)) xhr.send(args.data)\n\t\t\telse xhr.send()\n\t\t})\n\t\treturn args.background === true ? promise0 : finalize(promise0)\n\t}\n\tfunction jsonp(args, extra) {\n\t\tvar finalize = finalizer()\n\t\targs = normalize(args, extra)\n\t\tvar promise0 = new Promise(function(resolve, reject) {\n\t\t\tvar callbackName = args.callbackName || \"_mithril_\" + Math.round(Math.random() * 1e16) + \"_\" + callbackCount++\n\t\t\tvar script = $window.document.createElement(\"script\")\n\t\t\t$window[callbackName] = function(data) {\n\t\t\t\tscript.parentNode.removeChild(script)\n\t\t\t\tresolve(cast(args.type, data))\n\t\t\t\tdelete $window[callbackName]\n\t\t\t}\n\t\t\tscript.onerror = function() {\n\t\t\t\tscript.parentNode.removeChild(script)\n\t\t\t\treject(new Error(\"JSONP request failed\"))\n\t\t\t\tdelete $window[callbackName]\n\t\t\t}\n\t\t\tif (args.data == null) args.data = {}\n\t\t\targs.url = interpolate(args.url, args.data)\n\t\t\targs.data[args.callbackKey || \"callback\"] = callbackName\n\t\t\tscript.src = assemble(args.url, args.data)\n\t\t\t$window.document.documentElement.appendChild(script)\n\t\t})\n\t\treturn args.background === true? promise0 : finalize(promise0)\n\t}\n\tfunction interpolate(url, data) {\n\t\tif (data == null) return url\n\t\tvar tokens = url.match(/:[^\\/]+/gi) || []\n\t\tfor (var i = 0; i < tokens.length; i++) {\n\t\t\tvar key = tokens[i].slice(1)\n\t\t\tif (data[key] != null) {\n\t\t\t\turl = url.replace(tokens[i], data[key])\n\t\t\t}\n\t\t}\n\t\treturn url\n\t}\n\tfunction assemble(url, data) {\n\t\tvar querystring = buildQueryString(data)\n\t\tif (querystring !== \"\") {\n\t\t\tvar prefix = url.indexOf(\"?\") < 0 ? \"?\" : \"&\"\n\t\t\turl += prefix + querystring\n\t\t}\n\t\treturn url\n\t}\n\tfunction deserialize(data) {\n\t\ttry {return data !== \"\" ? JSON.parse(data) : null}\n\t\tcatch (e) {throw new Error(data)}\n\t}\n\tfunction extract(xhr) {return xhr.responseText}\n\tfunction cast(type0, data) {\n\t\tif (typeof type0 === \"function\") {\n\t\t\tif (Array.isArray(data)) {\n\t\t\t\tfor (var i = 0; i < data.length; i++) {\n\t\t\t\t\tdata[i] = new type0(data[i])\n\t\t\t\t}\n\t\t\t}\n\t\t\telse return new type0(data)\n\t\t}\n\t\treturn data\n\t}\n\treturn {request: request, jsonp: jsonp, setCompletionCallback: setCompletionCallback}\n}\nvar requestService = _8(window, PromisePolyfill)\nvar coreRenderer = function($window) {\n\tvar $doc = $window.document\n\tvar $emptyFragment = $doc.createDocumentFragment()\n\tvar nameSpace = {\n\t\tsvg: \"http://www.w3.org/2000/svg\",\n\t\tmath: \"http://www.w3.org/1998/Math/MathML\"\n\t}\n\tvar onevent\n\tfunction setEventCallback(callback) {return onevent = callback}\n\tfunction getNameSpace(vnode) {\n\t\treturn vnode.attrs && vnode.attrs.xmlns || nameSpace[vnode.tag]\n\t}\n\t//create\n\tfunction createNodes(parent, vnodes, start, end, hooks, nextSibling, ns) {\n\t\tfor (var i = start; i < end; i++) {\n\t\t\tvar vnode = vnodes[i]\n\t\t\tif (vnode != null) {\n\t\t\t\tcreateNode(parent, vnode, hooks, ns, nextSibling)\n\t\t\t}\n\t\t}\n\t}\n\tfunction createNode(parent, vnode, hooks, ns, nextSibling) {\n\t\tvar tag = vnode.tag\n\t\tif (typeof tag === \"string\") {\n\t\t\tvnode.state = {}\n\t\t\tif (vnode.attrs != null) initLifecycle(vnode.attrs, vnode, hooks)\n\t\t\tswitch (tag) {\n\t\t\t\tcase \"#\": return createText(parent, vnode, nextSibling)\n\t\t\t\tcase \"<\": return createHTML(parent, vnode, nextSibling)\n\t\t\t\tcase \"[\": return createFragment(parent, vnode, hooks, ns, nextSibling)\n\t\t\t\tdefault: return createElement(parent, vnode, hooks, ns, nextSibling)\n\t\t\t}\n\t\t}\n\t\telse return createComponent(parent, vnode, hooks, ns, nextSibling)\n\t}\n\tfunction createText(parent, vnode, nextSibling) {\n\t\tvnode.dom = $doc.createTextNode(vnode.children)\n\t\tinsertNode(parent, vnode.dom, nextSibling)\n\t\treturn vnode.dom\n\t}\n\tfunction createHTML(parent, vnode, nextSibling) {\n\t\tvar match1 = vnode.children.match(/^\\s*?<(\\w+)/im) || []\n\t\tvar parent1 = {caption: \"table\", thead: \"table\", tbody: \"table\", tfoot: \"table\", tr: \"tbody\", th: \"tr\", td: \"tr\", colgroup: \"table\", col: \"colgroup\"}[match1[1]] || \"div\"\n\t\tvar temp = $doc.createElement(parent1)\n\t\ttemp.innerHTML = vnode.children\n\t\tvnode.dom = temp.firstChild\n\t\tvnode.domSize = temp.childNodes.length\n\t\tvar fragment = $doc.createDocumentFragment()\n\t\tvar child\n\t\twhile (child = temp.firstChild) {\n\t\t\tfragment.appendChild(child)\n\t\t}\n\t\tinsertNode(parent, fragment, nextSibling)\n\t\treturn fragment\n\t}\n\tfunction createFragment(parent, vnode, hooks, ns, nextSibling) {\n\t\tvar fragment = $doc.createDocumentFragment()\n\t\tif (vnode.children != null) {\n\t\t\tvar children = vnode.children\n\t\t\tcreateNodes(fragment, children, 0, children.length, hooks, null, ns)\n\t\t}\n\t\tvnode.dom = fragment.firstChild\n\t\tvnode.domSize = fragment.childNodes.length\n\t\tinsertNode(parent, fragment, nextSibling)\n\t\treturn fragment\n\t}\n\tfunction createElement(parent, vnode, hooks, ns, nextSibling) {\n\t\tvar tag = vnode.tag\n\t\tvar attrs2 = vnode.attrs\n\t\tvar is = attrs2 && attrs2.is\n\t\tns = getNameSpace(vnode) || ns\n\t\tvar element = ns ?\n\t\t\tis ? $doc.createElementNS(ns, tag, {is: is}) : $doc.createElementNS(ns, tag) :\n\t\t\tis ? $doc.createElement(tag, {is: is}) : $doc.createElement(tag)\n\t\tvnode.dom = element\n\t\tif (attrs2 != null) {\n\t\t\tsetAttrs(vnode, attrs2, ns)\n\t\t}\n\t\tinsertNode(parent, element, nextSibling)\n\t\tif (vnode.attrs != null && vnode.attrs.contenteditable != null) {\n\t\t\tsetContentEditable(vnode)\n\t\t}\n\t\telse {\n\t\t\tif (vnode.text != null) {\n\t\t\t\tif (vnode.text !== \"\") element.textContent = vnode.text\n\t\t\t\telse vnode.children = [Vnode(\"#\", undefined, undefined, vnode.text, undefined, undefined)]\n\t\t\t}\n\t\t\tif (vnode.children != null) {\n\t\t\t\tvar children = vnode.children\n\t\t\t\tcreateNodes(element, children, 0, children.length, hooks, null, ns)\n\t\t\t\tsetLateAttrs(vnode)\n\t\t\t}\n\t\t}\n\t\treturn element\n\t}\n\tfunction initComponent(vnode, hooks) {\n\t\tvar sentinel\n\t\tif (typeof vnode.tag.view === \"function\") {\n\t\t\tvnode.state = Object.create(vnode.tag)\n\t\t\tsentinel = vnode.state.view\n\t\t\tif (sentinel.$$reentrantLock$$ != null) return $emptyFragment\n\t\t\tsentinel.$$reentrantLock$$ = true\n\t\t} else {\n\t\t\tvnode.state = void 0\n\t\t\tsentinel = vnode.tag\n\t\t\tif (sentinel.$$reentrantLock$$ != null) return $emptyFragment\n\t\t\tsentinel.$$reentrantLock$$ = true\n\t\t\tvnode.state = (vnode.tag.prototype != null && typeof vnode.tag.prototype.view === \"function\") ? new vnode.tag(vnode) : vnode.tag(vnode)\n\t\t}\n\t\tvnode._state = vnode.state\n\t\tif (vnode.attrs != null) initLifecycle(vnode.attrs, vnode, hooks)\n\t\tinitLifecycle(vnode._state, vnode, hooks)\n\t\tvnode.instance = Vnode.normalize(vnode._state.view.call(vnode.state, vnode))\n\t\tif (vnode.instance === vnode) throw Error(\"A view cannot return the vnode it received as argument\")\n\t\tsentinel.$$reentrantLock$$ = null\n\t}\n\tfunction createComponent(parent, vnode, hooks, ns, nextSibling) {\n\t\tinitComponent(vnode, hooks)\n\t\tif (vnode.instance != null) {\n\t\t\tvar element = createNode(parent, vnode.instance, hooks, ns, nextSibling)\n\t\t\tvnode.dom = vnode.instance.dom\n\t\t\tvnode.domSize = vnode.dom != null ? vnode.instance.domSize : 0\n\t\t\tinsertNode(parent, element, nextSibling)\n\t\t\treturn element\n\t\t}\n\t\telse {\n\t\t\tvnode.domSize = 0\n\t\t\treturn $emptyFragment\n\t\t}\n\t}\n\t//update\n\tfunction updateNodes(parent, old, vnodes, recycling, hooks, nextSibling, ns) {\n\t\tif (old === vnodes || old == null && vnodes == null) return\n\t\telse if (old == null) createNodes(parent, vnodes, 0, vnodes.length, hooks, nextSibling, ns)\n\t\telse if (vnodes == null) removeNodes(old, 0, old.length, vnodes)\n\t\telse {\n\t\t\tif (old.length === vnodes.length) {\n\t\t\t\tvar isUnkeyed = false\n\t\t\t\tfor (var i = 0; i < vnodes.length; i++) {\n\t\t\t\t\tif (vnodes[i] != null && old[i] != null) {\n\t\t\t\t\t\tisUnkeyed = vnodes[i].key == null && old[i].key == null\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (isUnkeyed) {\n\t\t\t\t\tfor (var i = 0; i < old.length; i++) {\n\t\t\t\t\t\tif (old[i] === vnodes[i]) continue\n\t\t\t\t\t\telse if (old[i] == null && vnodes[i] != null) createNode(parent, vnodes[i], hooks, ns, getNextSibling(old, i + 1, nextSibling))\n\t\t\t\t\t\telse if (vnodes[i] == null) removeNodes(old, i, i + 1, vnodes)\n\t\t\t\t\t\telse updateNode(parent, old[i], vnodes[i], hooks, getNextSibling(old, i + 1, nextSibling), recycling, ns)\n\t\t\t\t\t}\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\trecycling = recycling || isRecyclable(old, vnodes)\n\t\t\tif (recycling) {\n\t\t\t\tvar pool = old.pool\n\t\t\t\told = old.concat(old.pool)\n\t\t\t}\n\t\t\tvar oldStart = 0, start = 0, oldEnd = old.length - 1, end = vnodes.length - 1, map\n\t\t\twhile (oldEnd >= oldStart && end >= start) {\n\t\t\t\tvar o = old[oldStart], v = vnodes[start]\n\t\t\t\tif (o === v && !recycling) oldStart++, start++\n\t\t\t\telse if (o == null) oldStart++\n\t\t\t\telse if (v == null) start++\n\t\t\t\telse if (o.key === v.key) {\n\t\t\t\t\tvar shouldRecycle = (pool != null && oldStart >= old.length - pool.length) || ((pool == null) && recycling)\n\t\t\t\t\toldStart++, start++\n\t\t\t\t\tupdateNode(parent, o, v, hooks, getNextSibling(old, oldStart, nextSibling), shouldRecycle, ns)\n\t\t\t\t\tif (recycling && o.tag === v.tag) insertNode(parent, toFragment(o), nextSibling)\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tvar o = old[oldEnd]\n\t\t\t\t\tif (o === v && !recycling) oldEnd--, start++\n\t\t\t\t\telse if (o == null) oldEnd--\n\t\t\t\t\telse if (v == null) start++\n\t\t\t\t\telse if (o.key === v.key) {\n\t\t\t\t\t\tvar shouldRecycle = (pool != null && oldEnd >= old.length - pool.length) || ((pool == null) && recycling)\n\t\t\t\t\t\tupdateNode(parent, o, v, hooks, getNextSibling(old, oldEnd + 1, nextSibling), shouldRecycle, ns)\n\t\t\t\t\t\tif (recycling || start < end) insertNode(parent, toFragment(o), getNextSibling(old, oldStart, nextSibling))\n\t\t\t\t\t\toldEnd--, start++\n\t\t\t\t\t}\n\t\t\t\t\telse break\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (oldEnd >= oldStart && end >= start) {\n\t\t\t\tvar o = old[oldEnd], v = vnodes[end]\n\t\t\t\tif (o === v && !recycling) oldEnd--, end--\n\t\t\t\telse if (o == null) oldEnd--\n\t\t\t\telse if (v == null) end--\n\t\t\t\telse if (o.key === v.key) {\n\t\t\t\t\tvar shouldRecycle = (pool != null && oldEnd >= old.length - pool.length) || ((pool == null) && recycling)\n\t\t\t\t\tupdateNode(parent, o, v, hooks, getNextSibling(old, oldEnd + 1, nextSibling), shouldRecycle, ns)\n\t\t\t\t\tif (recycling && o.tag === v.tag) insertNode(parent, toFragment(o), nextSibling)\n\t\t\t\t\tif (o.dom != null) nextSibling = o.dom\n\t\t\t\t\toldEnd--, end--\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!map) map = getKeyMap(old, oldEnd)\n\t\t\t\t\tif (v != null) {\n\t\t\t\t\t\tvar oldIndex = map[v.key]\n\t\t\t\t\t\tif (oldIndex != null) {\n\t\t\t\t\t\t\tvar movable = old[oldIndex]\n\t\t\t\t\t\t\tvar shouldRecycle = (pool != null && oldIndex >= old.length - pool.length) || ((pool == null) && recycling)\n\t\t\t\t\t\t\tupdateNode(parent, movable, v, hooks, getNextSibling(old, oldEnd + 1, nextSibling), recycling, ns)\n\t\t\t\t\t\t\tinsertNode(parent, toFragment(movable), nextSibling)\n\t\t\t\t\t\t\told[oldIndex].skip = true\n\t\t\t\t\t\t\tif (movable.dom != null) nextSibling = movable.dom\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar dom = createNode(parent, v, hooks, ns, nextSibling)\n\t\t\t\t\t\t\tnextSibling = dom\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tend--\n\t\t\t\t}\n\t\t\t\tif (end < start) break\n\t\t\t}\n\t\t\tcreateNodes(parent, vnodes, start, end + 1, hooks, nextSibling, ns)\n\t\t\tremoveNodes(old, oldStart, oldEnd + 1, vnodes)\n\t\t}\n\t}\n\tfunction updateNode(parent, old, vnode, hooks, nextSibling, recycling, ns) {\n\t\tvar oldTag = old.tag, tag = vnode.tag\n\t\tif (oldTag === tag) {\n\t\t\tvnode.state = old.state\n\t\t\tvnode._state = old._state\n\t\t\tvnode.events = old.events\n\t\t\tif (!recycling && shouldNotUpdate(vnode, old)) return\n\t\t\tif (typeof oldTag === \"string\") {\n\t\t\t\tif (vnode.attrs != null) {\n\t\t\t\t\tif (recycling) {\n\t\t\t\t\t\tvnode.state = {}\n\t\t\t\t\t\tinitLifecycle(vnode.attrs, vnode, hooks)\n\t\t\t\t\t}\n\t\t\t\t\telse updateLifecycle(vnode.attrs, vnode, hooks)\n\t\t\t\t}\n\t\t\t\tswitch (oldTag) {\n\t\t\t\t\tcase \"#\": updateText(old, vnode); break\n\t\t\t\t\tcase \"<\": updateHTML(parent, old, vnode, nextSibling); break\n\t\t\t\t\tcase \"[\": updateFragment(parent, old, vnode, recycling, hooks, nextSibling, ns); break\n\t\t\t\t\tdefault: updateElement(old, vnode, recycling, hooks, ns)\n\t\t\t\t}\n\t\t\t}\n\t\t\telse updateComponent(parent, old, vnode, hooks, nextSibling, recycling, ns)\n\t\t}\n\t\telse {\n\t\t\tremoveNode(old, null)\n\t\t\tcreateNode(parent, vnode, hooks, ns, nextSibling)\n\t\t}\n\t}\n\tfunction updateText(old, vnode) {\n\t\tif (old.children.toString() !== vnode.children.toString()) {\n\t\t\told.dom.nodeValue = vnode.children\n\t\t}\n\t\tvnode.dom = old.dom\n\t}\n\tfunction updateHTML(parent, old, vnode, nextSibling) {\n\t\tif (old.children !== vnode.children) {\n\t\t\ttoFragment(old)\n\t\t\tcreateHTML(parent, vnode, nextSibling)\n\t\t}\n\t\telse vnode.dom = old.dom, vnode.domSize = old.domSize\n\t}\n\tfunction updateFragment(parent, old, vnode, recycling, hooks, nextSibling, ns) {\n\t\tupdateNodes(parent, old.children, vnode.children, recycling, hooks, nextSibling, ns)\n\t\tvar domSize = 0, children = vnode.children\n\t\tvnode.dom = null\n\t\tif (children != null) {\n\t\t\tfor (var i = 0; i < children.length; i++) {\n\t\t\t\tvar child = children[i]\n\t\t\t\tif (child != null && child.dom != null) {\n\t\t\t\t\tif (vnode.dom == null) vnode.dom = child.dom\n\t\t\t\t\tdomSize += child.domSize || 1\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (domSize !== 1) vnode.domSize = domSize\n\t\t}\n\t}\n\tfunction updateElement(old, vnode, recycling, hooks, ns) {\n\t\tvar element = vnode.dom = old.dom\n\t\tns = getNameSpace(vnode) || ns\n\t\tif (vnode.tag === \"textarea\") {\n\t\t\tif (vnode.attrs == null) vnode.attrs = {}\n\t\t\tif (vnode.text != null) {\n\t\t\t\tvnode.attrs.value = vnode.text //FIXME handle0 multiple children\n\t\t\t\tvnode.text = undefined\n\t\t\t}\n\t\t}\n\t\tupdateAttrs(vnode, old.attrs, vnode.attrs, ns)\n\t\tif (vnode.attrs != null && vnode.attrs.contenteditable != null) {\n\t\t\tsetContentEditable(vnode)\n\t\t}\n\t\telse if (old.text != null && vnode.text != null && vnode.text !== \"\") {\n\t\t\tif (old.text.toString() !== vnode.text.toString()) old.dom.firstChild.nodeValue = vnode.text\n\t\t}\n\t\telse {\n\t\t\tif (old.text != null) old.children = [Vnode(\"#\", undefined, undefined, old.text, undefined, old.dom.firstChild)]\n\t\t\tif (vnode.text != null) vnode.children = [Vnode(\"#\", undefined, undefined, vnode.text, undefined, undefined)]\n\t\t\tupdateNodes(element, old.children, vnode.children, recycling, hooks, null, ns)\n\t\t}\n\t}\n\tfunction updateComponent(parent, old, vnode, hooks, nextSibling, recycling, ns) {\n\t\tif (recycling) {\n\t\t\tinitComponent(vnode, hooks)\n\t\t} else {\n\t\t\tvnode.instance = Vnode.normalize(vnode._state.view.call(vnode.state, vnode))\n\t\t\tif (vnode.instance === vnode) throw Error(\"A view cannot return the vnode it received as argument\")\n\t\t\tif (vnode.attrs != null) updateLifecycle(vnode.attrs, vnode, hooks)\n\t\t\tupdateLifecycle(vnode._state, vnode, hooks)\n\t\t}\n\t\tif (vnode.instance != null) {\n\t\t\tif (old.instance == null) createNode(parent, vnode.instance, hooks, ns, nextSibling)\n\t\t\telse updateNode(parent, old.instance, vnode.instance, hooks, nextSibling, recycling, ns)\n\t\t\tvnode.dom = vnode.instance.dom\n\t\t\tvnode.domSize = vnode.instance.domSize\n\t\t}\n\t\telse if (old.instance != null) {\n\t\t\tremoveNode(old.instance, null)\n\t\t\tvnode.dom = undefined\n\t\t\tvnode.domSize = 0\n\t\t}\n\t\telse {\n\t\t\tvnode.dom = old.dom\n\t\t\tvnode.domSize = old.domSize\n\t\t}\n\t}\n\tfunction isRecyclable(old, vnodes) {\n\t\tif (old.pool != null && Math.abs(old.pool.length - vnodes.length) <= Math.abs(old.length - vnodes.length)) {\n\t\t\tvar oldChildrenLength = old[0] && old[0].children && old[0].children.length || 0\n\t\t\tvar poolChildrenLength = old.pool[0] && old.pool[0].children && old.pool[0].children.length || 0\n\t\t\tvar vnodesChildrenLength = vnodes[0] && vnodes[0].children && vnodes[0].children.length || 0\n\t\t\tif (Math.abs(poolChildrenLength - vnodesChildrenLength) <= Math.abs(oldChildrenLength - vnodesChildrenLength)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\tfunction getKeyMap(vnodes, end) {\n\t\tvar map = {}, i = 0\n\t\tfor (var i = 0; i < end; i++) {\n\t\t\tvar vnode = vnodes[i]\n\t\t\tif (vnode != null) {\n\t\t\t\tvar key2 = vnode.key\n\t\t\t\tif (key2 != null) map[key2] = i\n\t\t\t}\n\t\t}\n\t\treturn map\n\t}\n\tfunction toFragment(vnode) {\n\t\tvar count0 = vnode.domSize\n\t\tif (count0 != null || vnode.dom == null) {\n\t\t\tvar fragment = $doc.createDocumentFragment()\n\t\t\tif (count0 > 0) {\n\t\t\t\tvar dom = vnode.dom\n\t\t\t\twhile (--count0) fragment.appendChild(dom.nextSibling)\n\t\t\t\tfragment.insertBefore(dom, fragment.firstChild)\n\t\t\t}\n\t\t\treturn fragment\n\t\t}\n\t\telse return vnode.dom\n\t}\n\tfunction getNextSibling(vnodes, i, nextSibling) {\n\t\tfor (; i < vnodes.length; i++) {\n\t\t\tif (vnodes[i] != null && vnodes[i].dom != null) return vnodes[i].dom\n\t\t}\n\t\treturn nextSibling\n\t}\n\tfunction insertNode(parent, dom, nextSibling) {\n\t\tif (nextSibling && nextSibling.parentNode) parent.insertBefore(dom, nextSibling)\n\t\telse parent.appendChild(dom)\n\t}\n\tfunction setContentEditable(vnode) {\n\t\tvar children = vnode.children\n\t\tif (children != null && children.length === 1 && children[0].tag === \"<\") {\n\t\t\tvar content = children[0].children\n\t\t\tif (vnode.dom.innerHTML !== content) vnode.dom.innerHTML = content\n\t\t}\n\t\telse if (vnode.text != null || children != null && children.length !== 0) throw new Error(\"Child node of a contenteditable must be trusted\")\n\t}\n\t//remove\n\tfunction removeNodes(vnodes, start, end, context) {\n\t\tfor (var i = start; i < end; i++) {\n\t\t\tvar vnode = vnodes[i]\n\t\t\tif (vnode != null) {\n\t\t\t\tif (vnode.skip) vnode.skip = false\n\t\t\t\telse removeNode(vnode, context)\n\t\t\t}\n\t\t}\n\t}\n\tfunction removeNode(vnode, context) {\n\t\tvar expected = 1, called = 0\n\t\tif (vnode.attrs && typeof vnode.attrs.onbeforeremove === \"function\") {\n\t\t\tvar result = vnode.attrs.onbeforeremove.call(vnode.state, vnode)\n\t\t\tif (result != null && typeof result.then === \"function\") {\n\t\t\t\texpected++\n\t\t\t\tresult.then(continuation, continuation)\n\t\t\t}\n\t\t}\n\t\tif (typeof vnode.tag !== \"string\" && typeof vnode._state.onbeforeremove === \"function\") {\n\t\t\tvar result = vnode._state.onbeforeremove.call(vnode.state, vnode)\n\t\t\tif (result != null && typeof result.then === \"function\") {\n\t\t\t\texpected++\n\t\t\t\tresult.then(continuation, continuation)\n\t\t\t}\n\t\t}\n\t\tcontinuation()\n\t\tfunction continuation() {\n\t\t\tif (++called === expected) {\n\t\t\t\tonremove(vnode)\n\t\t\t\tif (vnode.dom) {\n\t\t\t\t\tvar count0 = vnode.domSize || 1\n\t\t\t\t\tif (count0 > 1) {\n\t\t\t\t\t\tvar dom = vnode.dom\n\t\t\t\t\t\twhile (--count0) {\n\t\t\t\t\t\t\tremoveNodeFromDOM(dom.nextSibling)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tremoveNodeFromDOM(vnode.dom)\n\t\t\t\t\tif (context != null && vnode.domSize == null && !hasIntegrationMethods(vnode.attrs) && typeof vnode.tag === \"string\") { //TODO test custom elements\n\t\t\t\t\t\tif (!context.pool) context.pool = [vnode]\n\t\t\t\t\t\telse context.pool.push(vnode)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfunction removeNodeFromDOM(node) {\n\t\tvar parent = node.parentNode\n\t\tif (parent != null) parent.removeChild(node)\n\t}\n\tfunction onremove(vnode) {\n\t\tif (vnode.attrs && typeof vnode.attrs.onremove === \"function\") vnode.attrs.onremove.call(vnode.state, vnode)\n\t\tif (typeof vnode.tag !== \"string\") {\n\t\t\tif (typeof vnode._state.onremove === \"function\") vnode._state.onremove.call(vnode.state, vnode)\n\t\t\tif (vnode.instance != null) onremove(vnode.instance)\n\t\t} else {\n\t\t\tvar children = vnode.children\n\t\t\tif (Array.isArray(children)) {\n\t\t\t\tfor (var i = 0; i < children.length; i++) {\n\t\t\t\t\tvar child = children[i]\n\t\t\t\t\tif (child != null) onremove(child)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t//attrs2\n\tfunction setAttrs(vnode, attrs2, ns) {\n\t\tfor (var key2 in attrs2) {\n\t\t\tsetAttr(vnode, key2, null, attrs2[key2], ns)\n\t\t}\n\t}\n\tfunction setAttr(vnode, key2, old, value, ns) {\n\t\tvar element = vnode.dom\n\t\tif (key2 === \"key\" || key2 === \"is\" || (old === value && !isFormAttribute(vnode, key2)) && typeof value !== \"object\" || typeof value === \"undefined\" || isLifecycleMethod(key2)) return\n\t\tvar nsLastIndex = key2.indexOf(\":\")\n\t\tif (nsLastIndex > -1 && key2.substr(0, nsLastIndex) === \"xlink\") {\n\t\t\telement.setAttributeNS(\"http://www.w3.org/1999/xlink\", key2.slice(nsLastIndex + 1), value)\n\t\t}\n\t\telse if (key2[0] === \"o\" && key2[1] === \"n\" && typeof value === \"function\") updateEvent(vnode, key2, value)\n\t\telse if (key2 === \"style\") updateStyle(element, old, value)\n\t\telse if (key2 in element && !isAttribute(key2) && ns === undefined && !isCustomElement(vnode)) {\n\t\t\tif (key2 === \"value\") {\n\t\t\t\tvar normalized0 = \"\" + value // eslint-disable-line no-implicit-coercion\n\t\t\t\t//setting input[value] to same value by typing on focused element moves cursor to end in Chrome\n\t\t\t\tif ((vnode.tag === \"input\" || vnode.tag === \"textarea\") && vnode.dom.value === normalized0 && vnode.dom === $doc.activeElement) return\n\t\t\t\t//setting select[value] to same value while having select open blinks select dropdown in Chrome\n\t\t\t\tif (vnode.tag === \"select\") {\n\t\t\t\t\tif (value === null) {\n\t\t\t\t\t\tif (vnode.dom.selectedIndex === -1 && vnode.dom === $doc.activeElement) return\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (old !== null && vnode.dom.value === normalized0 && vnode.dom === $doc.activeElement) return\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//setting option[value] to same value while having select open blinks select dropdown in Chrome\n\t\t\t\tif (vnode.tag === \"option\" && old != null && vnode.dom.value === normalized0) return\n\t\t\t}\n\t\t\t// If you assign an input type1 that is not supported by IE 11 with an assignment expression, an error0 will occur.\n\t\t\tif (vnode.tag === \"input\" && key2 === \"type\") {\n\t\t\t\telement.setAttribute(key2, value)\n\t\t\t\treturn\n\t\t\t}\n\t\t\telement[key2] = value\n\t\t}\n\t\telse {\n\t\t\tif (typeof value === \"boolean\") {\n\t\t\t\tif (value) element.setAttribute(key2, \"\")\n\t\t\t\telse element.removeAttribute(key2)\n\t\t\t}\n\t\t\telse element.setAttribute(key2 === \"className\" ? \"class\" : key2, value)\n\t\t}\n\t}\n\tfunction setLateAttrs(vnode) {\n\t\tvar attrs2 = vnode.attrs\n\t\tif (vnode.tag === \"select\" && attrs2 != null) {\n\t\t\tif (\"value\" in attrs2) setAttr(vnode, \"value\", null, attrs2.value, undefined)\n\t\t\tif (\"selectedIndex\" in attrs2) setAttr(vnode, \"selectedIndex\", null, attrs2.selectedIndex, undefined)\n\t\t}\n\t}\n\tfunction updateAttrs(vnode, old, attrs2, ns) {\n\t\tif (attrs2 != null) {\n\t\t\tfor (var key2 in attrs2) {\n\t\t\t\tsetAttr(vnode, key2, old && old[key2], attrs2[key2], ns)\n\t\t\t}\n\t\t}\n\t\tif (old != null) {\n\t\t\tfor (var key2 in old) {\n\t\t\t\tif (attrs2 == null || !(key2 in attrs2)) {\n\t\t\t\t\tif (key2 === \"className\") key2 = \"class\"\n\t\t\t\t\tif (key2[0] === \"o\" && key2[1] === \"n\" && !isLifecycleMethod(key2)) updateEvent(vnode, key2, undefined)\n\t\t\t\t\telse if (key2 !== \"key\") vnode.dom.removeAttribute(key2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfunction isFormAttribute(vnode, attr) {\n\t\treturn attr === \"value\" || attr === \"checked\" || attr === \"selectedIndex\" || attr === \"selected\" && vnode.dom === $doc.activeElement\n\t}\n\tfunction isLifecycleMethod(attr) {\n\t\treturn attr === \"oninit\" || attr === \"oncreate\" || attr === \"onupdate\" || attr === \"onremove\" || attr === \"onbeforeremove\" || attr === \"onbeforeupdate\"\n\t}\n\tfunction isAttribute(attr) {\n\t\treturn attr === \"href\" || attr === \"list\" || attr === \"form\" || attr === \"width\" || attr === \"height\"// || attr === \"type\"\n\t}\n\tfunction isCustomElement(vnode){\n\t\treturn vnode.attrs.is || vnode.tag.indexOf(\"-\") > -1\n\t}\n\tfunction hasIntegrationMethods(source) {\n\t\treturn source != null && (source.oncreate || source.onupdate || source.onbeforeremove || source.onremove)\n\t}\n\t//style\n\tfunction updateStyle(element, old, style) {\n\t\tif (old === style) element.style.cssText = \"\", old = null\n\t\tif (style == null) element.style.cssText = \"\"\n\t\telse if (typeof style === \"string\") element.style.cssText = style\n\t\telse {\n\t\t\tif (typeof old === \"string\") element.style.cssText = \"\"\n\t\t\tfor (var key2 in style) {\n\t\t\t\telement.style[key2] = style[key2]\n\t\t\t}\n\t\t\tif (old != null && typeof old !== \"string\") {\n\t\t\t\tfor (var key2 in old) {\n\t\t\t\t\tif (!(key2 in style)) element.style[key2] = \"\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t//event\n\tfunction updateEvent(vnode, key2, value) {\n\t\tvar element = vnode.dom\n\t\tvar callback = typeof onevent !== \"function\" ? value : function(e) {\n\t\t\tvar result = value.call(element, e)\n\t\t\tonevent.call(element, e)\n\t\t\treturn result\n\t\t}\n\t\tif (key2 in element) element[key2] = typeof value === \"function\" ? callback : null\n\t\telse {\n\t\t\tvar eventName = key2.slice(2)\n\t\t\tif (vnode.events === undefined) vnode.events = {}\n\t\t\tif (vnode.events[key2] === callback) return\n\t\t\tif (vnode.events[key2] != null) element.removeEventListener(eventName, vnode.events[key2], false)\n\t\t\tif (typeof value === \"function\") {\n\t\t\t\tvnode.events[key2] = callback\n\t\t\t\telement.addEventListener(eventName, vnode.events[key2], false)\n\t\t\t}\n\t\t}\n\t}\n\t//lifecycle\n\tfunction initLifecycle(source, vnode, hooks) {\n\t\tif (typeof source.oninit === \"function\") source.oninit.call(vnode.state, vnode)\n\t\tif (typeof source.oncreate === \"function\") hooks.push(source.oncreate.bind(vnode.state, vnode))\n\t}\n\tfunction updateLifecycle(source, vnode, hooks) {\n\t\tif (typeof source.onupdate === \"function\") hooks.push(source.onupdate.bind(vnode.state, vnode))\n\t}\n\tfunction shouldNotUpdate(vnode, old) {\n\t\tvar forceVnodeUpdate, forceComponentUpdate\n\t\tif (vnode.attrs != null && typeof vnode.attrs.onbeforeupdate === \"function\") forceVnodeUpdate = vnode.attrs.onbeforeupdate.call(vnode.state, vnode, old)\n\t\tif (typeof vnode.tag !== \"string\" && typeof vnode._state.onbeforeupdate === \"function\") forceComponentUpdate = vnode._state.onbeforeupdate.call(vnode.state, vnode, old)\n\t\tif (!(forceVnodeUpdate === undefined && forceComponentUpdate === undefined) && !forceVnodeUpdate && !forceComponentUpdate) {\n\t\t\tvnode.dom = old.dom\n\t\t\tvnode.domSize = old.domSize\n\t\t\tvnode.instance = old.instance\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\tfunction render(dom, vnodes) {\n\t\tif (!dom) throw new Error(\"Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.\")\n\t\tvar hooks = []\n\t\tvar active = $doc.activeElement\n\t\tvar namespace = dom.namespaceURI\n\t\t// First time0 rendering into a node clears it out\n\t\tif (dom.vnodes == null) dom.textContent = \"\"\n\t\tif (!Array.isArray(vnodes)) vnodes = [vnodes]\n\t\tupdateNodes(dom, dom.vnodes, Vnode.normalizeChildren(vnodes), false, hooks, null, namespace === \"http://www.w3.org/1999/xhtml\" ? undefined : namespace)\n\t\tdom.vnodes = vnodes\n\t\t// document.activeElement can return null in IE https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement\n\t\tif (active != null && $doc.activeElement !== active) active.focus()\n\t\tfor (var i = 0; i < hooks.length; i++) hooks[i]()\n\t}\n\treturn {render: render, setEventCallback: setEventCallback}\n}\nfunction throttle(callback) {\n\t//60fps translates to 16.6ms, round it down since setTimeout requires int\n\tvar time = 16\n\tvar last = 0, pending = null\n\tvar timeout = typeof requestAnimationFrame === \"function\" ? requestAnimationFrame : setTimeout\n\treturn function() {\n\t\tvar now = Date.now()\n\t\tif (last === 0 || now - last >= time) {\n\t\t\tlast = now\n\t\t\tcallback()\n\t\t}\n\t\telse if (pending === null) {\n\t\t\tpending = timeout(function() {\n\t\t\t\tpending = null\n\t\t\t\tcallback()\n\t\t\t\tlast = Date.now()\n\t\t\t}, time - (now - last))\n\t\t}\n\t}\n}\nvar _11 = function($window) {\n\tvar renderService = coreRenderer($window)\n\trenderService.setEventCallback(function(e) {\n\t\tif (e.redraw === false) e.redraw = undefined\n\t\telse redraw()\n\t})\n\tvar callbacks = []\n\tfunction subscribe(key1, callback) {\n\t\tunsubscribe(key1)\n\t\tcallbacks.push(key1, throttle(callback))\n\t}\n\tfunction unsubscribe(key1) {\n\t\tvar index = callbacks.indexOf(key1)\n\t\tif (index > -1) callbacks.splice(index, 2)\n\t}\n\tfunction redraw() {\n\t\tfor (var i = 1; i < callbacks.length; i += 2) {\n\t\t\tcallbacks[i]()\n\t\t}\n\t}\n\treturn {subscribe: subscribe, unsubscribe: unsubscribe, redraw: redraw, render: renderService.render}\n}\nvar redrawService = _11(window)\nrequestService.setCompletionCallback(redrawService.redraw)\nvar _16 = function(redrawService0) {\n\treturn function(root, component) {\n\t\tif (component === null) {\n\t\t\tredrawService0.render(root, [])\n\t\t\tredrawService0.unsubscribe(root)\n\t\t\treturn\n\t\t}\n\t\t\n\t\tif (component.view == null && typeof component !== \"function\") throw new Error(\"m.mount(element, component) expects a component, not a vnode\")\n\t\t\n\t\tvar run0 = function() {\n\t\t\tredrawService0.render(root, Vnode(component))\n\t\t}\n\t\tredrawService0.subscribe(root, run0)\n\t\tredrawService0.redraw()\n\t}\n}\nm.mount = _16(redrawService)\nvar Promise = PromisePolyfill\nvar parseQueryString = function(string) {\n\tif (string === \"\" || string == null) return {}\n\tif (string.charAt(0) === \"?\") string = string.slice(1)\n\tvar entries = string.split(\"&\"), data0 = {}, counters = {}\n\tfor (var i = 0; i < entries.length; i++) {\n\t\tvar entry = entries[i].split(\"=\")\n\t\tvar key5 = decodeURIComponent(entry[0])\n\t\tvar value = entry.length === 2 ? decodeURIComponent(entry[1]) : \"\"\n\t\tif (value === \"true\") value = true\n\t\telse if (value === \"false\") value = false\n\t\tvar levels = key5.split(/\\]\\[?|\\[/)\n\t\tvar cursor = data0\n\t\tif (key5.indexOf(\"[\") > -1) levels.pop()\n\t\tfor (var j = 0; j < levels.length; j++) {\n\t\t\tvar level = levels[j], nextLevel = levels[j + 1]\n\t\t\tvar isNumber = nextLevel == \"\" || !isNaN(parseInt(nextLevel, 10))\n\t\t\tvar isValue = j === levels.length - 1\n\t\t\tif (level === \"\") {\n\t\t\t\tvar key5 = levels.slice(0, j).join()\n\t\t\t\tif (counters[key5] == null) counters[key5] = 0\n\t\t\t\tlevel = counters[key5]++\n\t\t\t}\n\t\t\tif (cursor[level] == null) {\n\t\t\t\tcursor[level] = isValue ? value : isNumber ? [] : {}\n\t\t\t}\n\t\t\tcursor = cursor[level]\n\t\t}\n\t}\n\treturn data0\n}\nvar coreRouter = function($window) {\n\tvar supportsPushState = typeof $window.history.pushState === \"function\"\n\tvar callAsync0 = typeof setImmediate === \"function\" ? setImmediate : setTimeout\n\tfunction normalize1(fragment0) {\n\t\tvar data = $window.location[fragment0].replace(/(?:%[a-f89][a-f0-9])+/gim, decodeURIComponent)\n\t\tif (fragment0 === \"pathname\" && data[0] !== \"/\") data = \"/\" + data\n\t\treturn data\n\t}\n\tvar asyncId\n\tfunction debounceAsync(callback0) {\n\t\treturn function() {\n\t\t\tif (asyncId != null) return\n\t\t\tasyncId = callAsync0(function() {\n\t\t\t\tasyncId = null\n\t\t\t\tcallback0()\n\t\t\t})\n\t\t}\n\t}\n\tfunction parsePath(path, queryData, hashData) {\n\t\tvar queryIndex = path.indexOf(\"?\")\n\t\tvar hashIndex = path.indexOf(\"#\")\n\t\tvar pathEnd = queryIndex > -1 ? queryIndex : hashIndex > -1 ? hashIndex : path.length\n\t\tif (queryIndex > -1) {\n\t\t\tvar queryEnd = hashIndex > -1 ? hashIndex : path.length\n\t\t\tvar queryParams = parseQueryString(path.slice(queryIndex + 1, queryEnd))\n\t\t\tfor (var key4 in queryParams) queryData[key4] = queryParams[key4]\n\t\t}\n\t\tif (hashIndex > -1) {\n\t\t\tvar hashParams = parseQueryString(path.slice(hashIndex + 1))\n\t\t\tfor (var key4 in hashParams) hashData[key4] = hashParams[key4]\n\t\t}\n\t\treturn path.slice(0, pathEnd)\n\t}\n\tvar router = {prefix: \"#!\"}\n\trouter.getPath = function() {\n\t\tvar type2 = router.prefix.charAt(0)\n\t\tswitch (type2) {\n\t\t\tcase \"#\": return normalize1(\"hash\").slice(router.prefix.length)\n\t\t\tcase \"?\": return normalize1(\"search\").slice(router.prefix.length) + normalize1(\"hash\")\n\t\t\tdefault: return normalize1(\"pathname\").slice(router.prefix.length) + normalize1(\"search\") + normalize1(\"hash\")\n\t\t}\n\t}\n\trouter.setPath = function(path, data, options) {\n\t\tvar queryData = {}, hashData = {}\n\t\tpath = parsePath(path, queryData, hashData)\n\t\tif (data != null) {\n\t\t\tfor (var key4 in data) queryData[key4] = data[key4]\n\t\t\tpath = path.replace(/:([^\\/]+)/g, function(match2, token) {\n\t\t\t\tdelete queryData[token]\n\t\t\t\treturn data[token]\n\t\t\t})\n\t\t}\n\t\tvar query = buildQueryString(queryData)\n\t\tif (query) path += \"?\" + query\n\t\tvar hash = buildQueryString(hashData)\n\t\tif (hash) path += \"#\" + hash\n\t\tif (supportsPushState) {\n\t\t\tvar state = options ? options.state : null\n\t\t\tvar title = options ? options.title : null\n\t\t\t$window.onpopstate()\n\t\t\tif (options && options.replace) $window.history.replaceState(state, title, router.prefix + path)\n\t\t\telse $window.history.pushState(state, title, router.prefix + path)\n\t\t}\n\t\telse $window.location.href = router.prefix + path\n\t}\n\trouter.defineRoutes = function(routes, resolve, reject) {\n\t\tfunction resolveRoute() {\n\t\t\tvar path = router.getPath()\n\t\t\tvar params = {}\n\t\t\tvar pathname = parsePath(path, params, params)\n\t\t\tvar state = $window.history.state\n\t\t\tif (state != null) {\n\t\t\t\tfor (var k in state) params[k] = state[k]\n\t\t\t}\n\t\t\tfor (var route0 in routes) {\n\t\t\t\tvar matcher = new RegExp(\"^\" + route0.replace(/:[^\\/]+?\\.{3}/g, \"(.*?)\").replace(/:[^\\/]+/g, \"([^\\\\/]+)\") + \"\\/?$\")\n\t\t\t\tif (matcher.test(pathname)) {\n\t\t\t\t\tpathname.replace(matcher, function() {\n\t\t\t\t\t\tvar keys = route0.match(/:[^\\/]+/g) || []\n\t\t\t\t\t\tvar values = [].slice.call(arguments, 1, -2)\n\t\t\t\t\t\tfor (var i = 0; i < keys.length; i++) {\n\t\t\t\t\t\t\tparams[keys[i].replace(/:|\\./g, \"\")] = decodeURIComponent(values[i])\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresolve(routes[route0], params, path, route0)\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\treject(path, params)\n\t\t}\n\t\tif (supportsPushState) $window.onpopstate = debounceAsync(resolveRoute)\n\t\telse if (router.prefix.charAt(0) === \"#\") $window.onhashchange = resolveRoute\n\t\tresolveRoute()\n\t}\n\treturn router\n}\nvar _20 = function($window, redrawService0) {\n\tvar routeService = coreRouter($window)\n\tvar identity = function(v) {return v}\n\tvar render1, component, attrs3, currentPath, lastUpdate\n\tvar route = function(root, defaultRoute, routes) {\n\t\tif (root == null) throw new Error(\"Ensure the DOM element that was passed to `m.route` is not undefined\")\n\t\tvar run1 = function() {\n\t\t\tif (render1 != null) redrawService0.render(root, render1(Vnode(component, attrs3.key, attrs3)))\n\t\t}\n\t\tvar bail = function(path) {\n\t\t\tif (path !== defaultRoute) routeService.setPath(defaultRoute, null, {replace: true})\n\t\t\telse throw new Error(\"Could not resolve default route \" + defaultRoute)\n\t\t}\n\t\trouteService.defineRoutes(routes, function(payload, params, path) {\n\t\t\tvar update = lastUpdate = function(routeResolver, comp) {\n\t\t\t\tif (update !== lastUpdate) return\n\t\t\t\tcomponent = comp != null && (typeof comp.view === \"function\" || typeof comp === \"function\")? comp : \"div\"\n\t\t\t\tattrs3 = params, currentPath = path, lastUpdate = null\n\t\t\t\trender1 = (routeResolver.render || identity).bind(routeResolver)\n\t\t\t\trun1()\n\t\t\t}\n\t\t\tif (payload.view || typeof payload === \"function\") update({}, payload)\n\t\t\telse {\n\t\t\t\tif (payload.onmatch) {\n\t\t\t\t\tPromise.resolve(payload.onmatch(params, path)).then(function(resolved) {\n\t\t\t\t\t\tupdate(payload, resolved)\n\t\t\t\t\t}, bail)\n\t\t\t\t}\n\t\t\t\telse update(payload, \"div\")\n\t\t\t}\n\t\t}, bail)\n\t\tredrawService0.subscribe(root, run1)\n\t}\n\troute.set = function(path, data, options) {\n\t\tif (lastUpdate != null) {\n\t\t\toptions = options || {}\n\t\t\toptions.replace = true\n\t\t}\n\t\tlastUpdate = null\n\t\trouteService.setPath(path, data, options)\n\t}\n\troute.get = function() {return currentPath}\n\troute.prefix = function(prefix0) {routeService.prefix = prefix0}\n\troute.link = function(vnode1) {\n\t\tvnode1.dom.setAttribute(\"href\", routeService.prefix + vnode1.attrs.href)\n\t\tvnode1.dom.onclick = function(e) {\n\t\t\tif (e.ctrlKey || e.metaKey || e.shiftKey || e.which === 2) return\n\t\t\te.preventDefault()\n\t\t\te.redraw = false\n\t\t\tvar href = this.getAttribute(\"href\")\n\t\t\tif (href.indexOf(routeService.prefix) === 0) href = href.slice(routeService.prefix.length)\n\t\t\troute.set(href, undefined, undefined)\n\t\t}\n\t}\n\troute.param = function(key3) {\n\t\tif(typeof attrs3 !== \"undefined\" && typeof key3 !== \"undefined\") return attrs3[key3]\n\t\treturn attrs3\n\t}\n\treturn route\n}\nm.route = _20(window, redrawService)\nm.withAttr = function(attrName, callback1, context) {\n\treturn function(e) {\n\t\tcallback1.call(context || this, attrName in e.currentTarget ? e.currentTarget[attrName] : e.currentTarget.getAttribute(attrName))\n\t}\n}\nvar _28 = coreRenderer(window)\nm.render = _28.render\nm.redraw = redrawService.redraw\nm.request = requestService.request\nm.jsonp = requestService.jsonp\nm.parseQueryString = parseQueryString\nm.buildQueryString = buildQueryString\nm.version = \"1.1.6\"\nm.vnode = Vnode\nif (typeof module !== \"undefined\") module[\"exports\"] = m\nelse window.m = m\n}());\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {},require(\"timers\").setImmediate)\n},{\"timers\":10}],9:[function(require,module,exports){\n// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n},{}],10:[function(require,module,exports){\n(function (setImmediate,clearImmediate){\nvar nextTick = require('process/browser.js').nextTick;\nvar apply = Function.prototype.apply;\nvar slice = Array.prototype.slice;\nvar immediateIds = {};\nvar nextImmediateId = 0;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n return new Timeout(apply.call(setInterval, window, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) { timeout.close(); };\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n this._clearFn.call(window, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n clearTimeout(item._idleTimeoutId);\n\n var msecs = item._idleTimeout;\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout)\n item._onTimeout();\n }, msecs);\n }\n};\n\n// That's not how node.js implements it but the exposed api is the same.\nexports.setImmediate = typeof setImmediate === \"function\" ? setImmediate : function(fn) {\n var id = nextImmediateId++;\n var args = arguments.length < 2 ? false : slice.call(arguments, 1);\n\n immediateIds[id] = true;\n\n nextTick(function onNextTick() {\n if (immediateIds[id]) {\n // fn.call() is faster so we optimize for the common use-case\n // @see http://jsperf.com/call-apply-segu\n if (args) {\n fn.apply(null, args);\n } else {\n fn.call(null);\n }\n // Prevent ids from leaking\n exports.clearImmediate(id);\n }\n });\n\n return id;\n};\n\nexports.clearImmediate = typeof clearImmediate === \"function\" ? clearImmediate : function(id) {\n delete immediateIds[id];\n};\n}).call(this,require(\"timers\").setImmediate,require(\"timers\").clearImmediate)\n},{\"process/browser.js\":9,\"timers\":10}],11:[function(require,module,exports){\nfunction tlite(getTooltipOpts) {\n document.addEventListener('mouseover', function (e) {\n var el = e.target;\n var opts = getTooltipOpts(el);\n\n if (!opts) {\n el = el.parentElement;\n opts = el && getTooltipOpts(el);\n }\n\n opts && tlite.show(el, opts, true);\n });\n}\n\ntlite.show = function (el, opts, isAuto) {\n var fallbackAttrib = 'data-tlite';\n opts = opts || {};\n\n (el.tooltip || Tooltip(el, opts)).show();\n\n function Tooltip(el, opts) {\n var tooltipEl;\n var showTimer;\n var text;\n\n el.addEventListener('mousedown', autoHide);\n el.addEventListener('mouseleave', autoHide);\n\n function show() {\n text = el.title || el.getAttribute(fallbackAttrib) || text;\n el.title = '';\n el.setAttribute(fallbackAttrib, '');\n text && !showTimer && (showTimer = setTimeout(fadeIn, isAuto ? 150 : 1))\n }\n\n function autoHide() {\n tlite.hide(el, true);\n }\n\n function hide(isAutoHiding) {\n if (isAuto === isAutoHiding) {\n showTimer = clearTimeout(showTimer);\n var parent = tooltipEl && tooltipEl.parentNode;\n parent && parent.removeChild(tooltipEl);\n tooltipEl = undefined;\n }\n }\n\n function fadeIn() {\n if (!tooltipEl) {\n tooltipEl = createTooltip(el, text, opts);\n }\n }\n\n return el.tooltip = {\n show: show,\n hide: hide\n };\n }\n\n function createTooltip(el, text, opts) {\n var tooltipEl = document.createElement('span');\n var grav = opts.grav || el.getAttribute('data-tlite') || 'n';\n\n tooltipEl.innerHTML = text;\n\n el.appendChild(tooltipEl);\n\n var vertGrav = grav[0] || '';\n var horzGrav = grav[1] || '';\n\n function positionTooltip() {\n tooltipEl.className = 'tlite ' + 'tlite-' + vertGrav + horzGrav;\n\n var arrowSize = 10;\n var top = el.offsetTop;\n var left = el.offsetLeft;\n\n if (tooltipEl.offsetParent === el) {\n top = left = 0;\n }\n\n var width = el.offsetWidth;\n var height = el.offsetHeight;\n var tooltipHeight = tooltipEl.offsetHeight;\n var tooltipWidth = tooltipEl.offsetWidth;\n var centerEl = left + (width / 2);\n\n tooltipEl.style.top = (\n vertGrav === 's' ? (top - tooltipHeight - arrowSize) :\n vertGrav === 'n' ? (top + height + arrowSize) :\n (top + (height / 2) - (tooltipHeight / 2))\n ) + 'px';\n\n tooltipEl.style.left = (\n horzGrav === 'w' ? left :\n horzGrav === 'e' ? left + width - tooltipWidth :\n vertGrav === 'w' ? (left + width + arrowSize) :\n vertGrav === 'e' ? (left - tooltipWidth - arrowSize) :\n (centerEl - tooltipWidth / 2)\n ) + 'px';\n }\n\n positionTooltip();\n\n var rect = tooltipEl.getBoundingClientRect();\n\n if (vertGrav === 's' && rect.top < 0) {\n vertGrav = 'n';\n positionTooltip();\n } else if (vertGrav === 'n' && rect.bottom > window.innerHeight) {\n vertGrav = 's';\n positionTooltip();\n } else if (vertGrav === 'e' && rect.left < 0) {\n vertGrav = 'w';\n positionTooltip();\n } else if (vertGrav === 'w' && rect.right > window.innerWidth) {\n vertGrav = 'e';\n positionTooltip();\n }\n\n tooltipEl.className += ' tlite-visible';\n\n return tooltipEl;\n }\n};\n\ntlite.hide = function (el, isAuto) {\n el.tooltip && el.tooltip.hide(isAuto);\n};\n\nif (typeof module !== 'undefined' && module.exports) {\n module.exports = tlite;\n}\n\n},{}],12:[function(require,module,exports){\n/*!\n * EventEmitter v5.2.6 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - https://oli.me.uk/\n * @preserve\n */\n\n;(function (exports) {\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 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 function isValidListener (listener) {\n if (typeof listener === 'function' || listener instanceof RegExp) {\n return true\n } else if (listener && typeof listener === 'object') {\n return isValidListener(listener.listener)\n } else {\n return false\n }\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 if (!isValidListener(listener)) {\n throw new TypeError('listener must be a function');\n }\n\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 first 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 first 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\n for (i = 0; i < listeners.length; 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}(typeof window !== 'undefined' ? window : this || {}));\n\n},{}]},{},[1]);\n })();"]}
|
1 |
+
{"version":3,"sources":["admin.js"],"names":["r","e","n","t","o","i","f","c","u","a","Error","code","p","exports","call","length","1","require","module","obj","_tlite","__esModule","default","tabs","settings","helpers","el","className","indexOf","window","mc4wp","./admin/fields/mailchimp-api-key.js","./admin/helpers.js","./admin/list-fetcher.js","./admin/list-overview.js","./admin/settings.js","./admin/show-if.js","./admin/tabs.js","tlite","2","field","document","getElementById","addEventListener","evt","node","createElement","innerText","mc4wp_vars","i18n","invalid_api_key","nextElementSibling","parentElement","removeChild","value","match","insertBefore","3","debounce","func","wait","immediate","timeout","context","this","args","arguments","callNow","clearTimeout","setTimeout","apply","4","config","ajaxurl","m","state","working","done","success","fetch","preventDefault","request","method","url","then","data","location","reload","redraw","mount","mailchimp","api_connected","lists","view","onsubmit","bind","type","fetching_mailchimp_lists","renew_mailchimp_lists","disabled","trust","fetching_mailchimp_lists_done","fetching_mailchimp_lists_error","mithril","5","showDetails","link","target","next","listID","getAttribute","querySelector","style","display","details","render","merge_fields","map","name","required","tag","options","date_format","choices","join","interest_categories","title","id","Object","keys","interests","shift","Element","prototype","matches","msMatchesSelector","webkitMatchesSelector","table","6","_typeof","Symbol","iterator","constructor","listInputs","querySelectorAll","selectedLists","listeners","updateSelectedLists","forEach","input","checked","push","rows","isSelected","searchKey","searchValue","filter","getSelectedListsWhere","toggleVisibleLists","event","emit","getSelectedLists","on","7","showIfElements","element","JSON","parse","parentElements","inputs","hide","undefined","toggleElement","conditionMet","visibility","opacity","inputElement","removeAttribute","setAttribute","8","URL","tabElements","tabNavElements","refererField","get","_open","tab","updateState","replace","nav","blur","setParameter","href","history","pushState","tb_remove","forms","editor","refresh","split","switchTab","tabId","urlParams","returnValue","substring","textContent","open","body","activeTab","offsetParent","replaceState","init","./url.js","9","query","hasOwnProperty","b","decodeURIComponent","build","ret","d","encodeURIComponent","key","10","Vnode","schedule","console","subscriptions","rendering","pending","sync","error","root","component","TypeError","index","splice","../render/vnode","11","setImmediate","Promise","buildPathname","parsePathname","compileTemplate","assign","sentinel","$window","mountRedraw","fireAsync","setPath","path","route","prefix","attrs","currentPath","lastUpdate","currentResolver","SKIP","defaultRoute","routes","onremove","compiled","SyntaxError","test","check","callAsync","resolve","scheduled","defaultData","some","ReferenceError","resolveRoute","hash","search","pathname","concat","slice","fail","params","loop","payload","matchedRoute","localComp","update","comp","onmatch","removeEventListener","onbeforeupdate","oncreate","vnode","set","Link","onclick","selector","oninit","onupdate","onbeforeremove","child","children","Boolean","result","currentTarget","handleEvent","defaultPrevented","button","which","ctrlKey","metaKey","shiftKey","altKey","param","../pathname/assign","../pathname/build","../pathname/compileTemplate","../pathname/parse","../promise/promise","../render/hyperscript","timers","12","hyperscript","fragment","./render/fragment","./render/hyperscript","./render/trust","13","jsonp","parseQueryString","buildQueryString","PromisePolyfill","./hyperscript","./mount-redraw","./pathname/build","./pathname/parse","./promise/polyfill","./querystring/build","./querystring/parse","./render","./render/vnode","./request","./route","14","requestAnimationFrame","./api/mount-redraw","15","source","16","template","queryIndex","hashIndex","queryEnd","pathEnd","resolved","variadic","String","newQueryIndex","newHashIndex","newQueryEnd","newPathEnd","querystring","../querystring/build","./assign","17","templateData","templateKeys","regexp","RegExp","extra","k","values","exec","./parse","18","../querystring/parse","19","executor","self","resolvers","rejectors","resolveCurrent","handler","rejectCurrent","instance","_instance","list","shouldAbsorb","execute","retry","executeOnce","runs","run","fn","onerror","onFulfilled","onRejection","resolveNext","rejectNext","handle","callback","promise","reject","catch","finally","reason","all","total","count","consume","race","20","global","./polyfill","21","object","toString","destructure","Array","isArray","22","string","charAt","entries","counters","entry","levels","cursor","pop","j","level","nextLevel","isNumber","isNaN","parseInt","desc","getOwnPropertyDescriptor","23","./render/render","24","hyperscriptVnode","normalizeChildren","./hyperscriptVnode","25","selectorParser","selectorCache","hasOwn","isEmpty","hasClass","class","newAttrs","text","execSelector","classes","attrValue","compileSelector","26","start","27","currentRedraw","$doc","nameSpace","svg","math","getNameSpace","xmlns","checkState","original","callHook","activeElement","createNodes","parent","vnodes","end","hooks","nextSibling","ns","createNode","initLifecycle","dom","createTextNode","insertNode","createText","createHTML","createDocumentFragment","firstChild","domSize","childNodes","createFragment","is","createElementNS","setAttr","setAttrs","maybeSetContentEditable","selectedIndex","normalized","setLateSelectAttrs","create","$$reentrantLock$$","normalize","initComponent","createComponent","possibleParents","caption","thead","tbody","tfoot","tr","th","td","colgroup","col","temp","innerHTML","appendChild","updateNodes","old","removeNodes","isOldKeyed","isKeyed","oldStart","v","oe","ve","topSibling","oldEnd","updateNode","getNextSibling","moveNodes","lisIndices","originalNextSibling","vnodesLength","oldIndices","li","pos","matched","getKeyMap","oldIndex","il","lisTemp","makeLisIndices","commonLength","removeNode","oldTag","events","force","shouldNotUpdate","updateLifecycle","nodeValue","updateText","removeHTML","updateHTML","updateFragment","val","removeAttr","updateAttrs","updateElement","updateComponent","frag","moveChildToFrag","parentNode","contenteditable","contentEditable","content","stateResult","attrsResult","mask","reallyRemove","isLifecycleMethod","attr","isFormAttribute","updateEvent","setAttributeNS","updateStyle","hasPropertyKey","nsLastIndex","uppercaseRegex","toLowerCase","capital","normalizeKey","cssText","setProperty","removeProperty","EventDict","_","ev","stopPropagation","active","namespace","namespaceURI","prevRedraw","focus","28","html","29","30","./promise/promise","./request/request","31","oncompletion","callbackCount","PromiseProxy","makeRequest","factory","background","complete","wrap","hasHeader","headers","__proto__","replacedAbort","toUpperCase","assumeJSON","serialize","FormData","responseType","extract","xhr","XMLHttpRequest","aborted","abort","async","user","password","setRequestHeader","deserialize","withCredentials","onreadystatechange","readyState","message","status","response","responseText","send","stringify","callbackName","Math","round","random","script","src","callbackKey","documentElement","32","./api/router","33","cachedSetTimeout","cachedClearTimeout","process","defaultSetTimout","defaultClearTimeout","runTimeout","fun","currentQueue","queue","draining","queueIndex","cleanUpNextTick","drainQueue","len","marker","runClearTimeout","Item","array","noop","nextTick","browser","env","argv","version","versions","addListener","once","off","removeListener","removeAllListeners","prependListener","prependOnceListener","binding","cwd","chdir","dir","umask","34","clearImmediate","Function","immediateIds","nextImmediateId","Timeout","clearFn","_id","_clearFn","setInterval","clearInterval","close","unref","ref","enroll","item","msecs","_idleTimeoutId","_idleTimeout","unenroll","_unrefActive","_onTimeout","process/browser.js","35","getTooltipOpts","opts","show","isAuto","tooltipEl","showTimer","fallbackAttrib","autoHide","fadeIn","grav","vertGrav","horzGrav","positionTooltip","top","offsetTop","left","offsetLeft","width","offsetWidth","height","offsetHeight","tooltipHeight","tooltipWidth","centerEl","rect","getBoundingClientRect","bottom","innerHeight","right","innerWidth","createTooltip","tooltip","isAutoHiding"],"mappings":"CAA4E,SAASA,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,GAAE,EAAoC,IAAID,GAAGC,EAAE,OAAOA,EAAEF,GAAE,GAAI,GAAGG,EAAE,OAAOA,EAAEH,GAAE,GAAI,IAAII,EAAE,IAAIC,MAAM,uBAAuBL,EAAE,KAAK,MAAMI,EAAEE,KAAK,mBAAmBF,EAAE,IAAIG,EAAEV,EAAEG,GAAG,CAACQ,QAAQ,IAAIZ,EAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAoB,OAAOI,EAAlBH,EAAEI,GAAG,GAAGL,IAAeA,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,OAAOD,EAAEG,GAAGQ,QAAQ,IAAI,IAAIL,GAAE,EAAoCH,EAAE,EAAEA,EAAEF,EAAEY,OAAOV,IAAID,EAAED,EAAEE,IAAI,OAAOD,EAA7b,CAA4c,CAACY,EAAE,CAAC,SAASC,EAAQC,EAAOL,GACxiB,aAEA,IAEgCM,EAF5BC,GAE4BD,EAFIF,EAAQ,WAESE,EAAIE,WAAaF,EAAM,CAAEG,QAAWH,GAErFI,EAAON,EAAQ,mBAEfO,EAAWP,EAAQ,uBAEnBQ,EAAUR,EAAQ,uBAEtB,EAAIG,EAAgB,SAAG,SAAUM,GAC/B,OAAgD,EAAzCA,EAAGC,UAAUC,QAAQ,mBAG9BX,EAAQ,2BAERA,EAAQ,uCAERA,EAAQ,4BAERA,EAAQ,sBAGRY,OAAOC,MAAQD,OAAOC,OAAS,GAC/BD,OAAOC,MAAML,QAAUA,EACvBI,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OlBiB,iBAAiB,YAAa4pB,GACjC7qB,EAAGiB,iBAAiB,aAAc4pB,GA4B3B7qB,EAAGqsB,QAAU,CAClB7B,KA3BF,WACElQ,EAAOta,EAAGoG,OAASpG,EAAGoF,aAAawlB,IAAmBtQ,EACtDta,EAAGoG,MAAQ,GACXpG,EAAGwJ,aAAaohB,EAAgB,IAChCtQ,IAASqQ,IAAcA,EAAYhoB,WAAWmoB,EAAQL,EAAS,IAAM,KAwBrEzhB,KAjBF,SAAcsjB,GACZ,GAAI7B,IAAW6B,EAAc,CAC3B3B,EAAYjoB,aAAaioB,GACzB,IAAIjP,EAASgP,GAAaA,EAAUvJ,WACpCzF,GAAUA,EAAO/Z,YAAY+oB,GAC7BA,OAAYzhB,OA1BgBuhB,QA6GpC5pB,EAAMoI,KAAO,SAAUhJ,EAAIyqB,GACzBzqB,EAAGqsB,SAAWrsB,EAAGqsB,QAAQrjB,KAAKyhB,SAGV,IAAXjrB,GAA0BA,EAAOL,UAC1CK,EAAOL,QAAUyB,IAGjB,KAAK,GAAG,CAAC","file":"admin.min.js","sourcesContent":["(function () { var require = undefined; var define = undefined; (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\n'use strict'; // dependencies\n\nvar _tlite = _interopRequireDefault(require(\"tlite\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nvar tabs = require('./admin/tabs.js');\n\nvar settings = require('./admin/settings.js');\n\nvar helpers = require('./admin/helpers.js');\n\n(0, _tlite[\"default\"])(function (el) {\n return el.className.indexOf('mc4wp-tooltip') > -1;\n});\n\nrequire('./admin/list-fetcher.js');\n\nrequire('./admin/fields/mailchimp-api-key.js');\n\nrequire('./admin/list-overview.js');\n\nrequire('./admin/show-if.js'); // expose some things\n\n\nwindow.mc4wp = window.mc4wp || {};\nwindow.mc4wp.helpers = helpers;\nwindow.mc4wp.settings = settings;\nwindow.mc4wp.tabs = tabs;\n\n},{\"./admin/fields/mailchimp-api-key.js\":2,\"./admin/helpers.js\":3,\"./admin/list-fetcher.js\":4,\"./admin/list-overview.js\":5,\"./admin/settings.js\":6,\"./admin/show-if.js\":7,\"./admin/tabs.js\":8,\"tlite\":35}],2:[function(require,module,exports){\n'use strict';\n\nfunction validate(evt) {\n var node = document.createElement('p');\n node.className = 'help red';\n node.innerText = window.mc4wp_vars.i18n.invalid_api_key;\n\n if (field.nextElementSibling.innerText === node.innerText) {\n field.nextElementSibling.parentElement.removeChild(field.nextElementSibling);\n }\n\n if (!field.value.match(/^[0-9a-zA-Z*]{32}-[a-z]{2}[0-9]{1,2}$/)) {\n field.parentElement.insertBefore(node, field.nextElementSibling);\n }\n}\n\nvar field = document.getElementById('mailchimp_api_key');\n\nif (field) {\n field.addEventListener('change', validate);\n}\n\n},{}],3:[function(require,module,exports){\n'use strict';\n\nvar helpers = {}; // polling\n\nhelpers.debounce = function (func, wait, immediate) {\n var timeout;\n return function () {\n var context = this,\n args = arguments;\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n }, wait);\n if (callNow) func.apply(context, args);\n };\n};\n\nmodule.exports = helpers;\n\n},{}],4:[function(require,module,exports){\n'use strict';\n\nvar config = window.mc4wp_vars;\nvar i18n = window.mc4wp_vars.i18n;\nvar ajaxurl = window.mc4wp_vars.ajaxurl;\n\nvar m = require('mithril');\n\nvar state = {\n working: false,\n done: false,\n success: false\n};\n\nfunction fetch(evt) {\n evt && evt.preventDefault();\n state.working = true;\n state.done = false;\n m.request({\n method: \"POST\",\n url: ajaxurl + \"?action=mc4wp_renew_mailchimp_lists\",\n timeout: 600000 // 10 minutes, matching max_execution_time\n\n }).then(function (data) {\n state.success = true;\n\n if (data) {\n window.setTimeout(function () {\n window.location.reload();\n }, 3000);\n }\n })[\"catch\"](function (data) {\n state.success = false;\n })[\"finally\"](function (data) {\n state.working = false;\n state.done = true;\n m.redraw();\n });\n}\n\nfunction view() {\n return m('form', {\n method: \"POST\",\n onsubmit: fetch.bind(this)\n }, [m('p', [m('input', {\n type: \"submit\",\n value: state.working ? i18n.fetching_mailchimp_lists : i18n.renew_mailchimp_lists,\n className: \"button\",\n disabled: !!state.working\n }), m.trust(' '), state.working ? [m('span.mc4wp-loader', \"Loading...\"), m.trust(' ')] : '', state.done ? [state.success ? m('em.help.green', i18n.fetching_mailchimp_lists_done) : m('em.help.red', i18n.fetching_mailchimp_lists_error)] : ''])]);\n}\n\nvar mount = document.getElementById('mc4wp-list-fetcher');\n\nif (mount) {\n // start fetching right away when no lists but api key given\n if (config.mailchimp.api_connected && config.mailchimp.lists.length === 0) {\n fetch();\n }\n\n m.mount(mount, {\n view: view\n });\n}\n\n},{\"mithril\":13}],5:[function(require,module,exports){\n'use strict';\n\nvar ajaxurl = window.mc4wp_vars.ajaxurl;\n\nvar m = require('mithril');\n\nif (!Element.prototype.matches) {\n Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;\n}\n\nfunction showDetails(evt) {\n evt.preventDefault();\n var link = evt.target;\n var next = link.parentElement.parentElement.nextElementSibling;\n var listID = link.getAttribute('data-list-id');\n var mount = next.querySelector('div');\n\n if (next.style.display === 'none') {\n m.request({\n method: \"GET\",\n url: ajaxurl + \"?action=mc4wp_get_list_details&ids=\" + listID\n }).then(function (details) {\n m.render(mount, view(details.shift()));\n });\n next.style.display = '';\n } else {\n next.style.display = 'none';\n }\n}\n\nfunction view(data) {\n return [m('h3', 'Merge fields'), m('table.widefat.striped', [m('thead', [m('tr', [m('th', 'Name'), m('th', 'Tag'), m('th', 'Type')])]), m('tbody', data.merge_fields.map(function (f) {\n return m('tr', [m('td', [f.name, f.required && m('span.red', '*')]), m('td', [m('code', f.tag)]), m('td', [f.type, ' ', f.options && f.options.date_format ? '(' + f.options.date_format + ')' : '', f.options && f.options.choices ? '(' + f.options.choices.join(', ') + ')' : ''])]);\n }))]), data.interest_categories.length > 0 && [m('h3', 'Interest Categories'), m('table.striped.widefat', [m('thead', [m('tr', [m('th', 'Name'), m('th', 'Type'), m('th', 'Interests')])]), m('tbody', data.interest_categories.map(function (f) {\n return m('tr', [m('td', [m('strong', f.title), m('br'), m('br'), 'ID: ', m('code', f.id)]), m('td', f.type), m('td', [m('div.row', {\n style: 'margin-bottom: 4px;'\n }, [m('div.col.col-3', [m('strong', {\n style: 'display: block; border-bottom: 1px solid #eee;'\n }, 'Name')]), m('div.col.col-3', [m('strong', {\n style: 'display: block; border-bottom: 1px solid #eee;'\n }, 'ID')])]), Object.keys(f.interests).map(function (id) {\n return m('div.row.tiny-margin', [m('div.col.col-3', f.interests[id]), m('div.col.col-3', [m('code', {\n title: 'Interest ID'\n }, id)]), m('br.clearfix.clear.cf')]);\n })])]);\n }))])]];\n}\n\nvar table = document.getElementById('mc4wp-mailchimp-lists-overview');\n\nif (table) {\n table.addEventListener('click', function (evt) {\n if (!evt.target.matches('.mc4wp-mailchimp-list')) {\n return;\n }\n\n showDetails(evt);\n });\n}\n\n},{\"mithril\":13}],6:[function(require,module,exports){\n'use strict';\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar context = document.getElementById('mc4wp-admin');\nvar listInputs = context.querySelectorAll('.mc4wp-list-input');\nvar lists = window.mc4wp_vars.mailchimp.lists;\nvar selectedLists = [];\nvar listeners = {}; // functions\n\nfunction getSelectedListsWhere(searchKey, searchValue) {\n return selectedLists.filter(function (el) {\n return el[searchKey] === searchValue;\n });\n}\n\nfunction getSelectedLists() {\n return selectedLists;\n}\n\nfunction updateSelectedLists() {\n selectedLists = [];\n [].forEach.call(listInputs, function (input) {\n // skip unchecked checkboxes\n if (typeof input.checked === \"boolean\" && !input.checked) {\n return;\n }\n\n if (_typeof(lists[input.value]) === \"object\") {\n selectedLists.push(lists[input.value]);\n }\n });\n toggleVisibleLists();\n emit('selectedLists.change', [selectedLists]);\n return selectedLists;\n}\n\nfunction toggleVisibleLists() {\n var rows = document.querySelectorAll('.lists--only-selected > *');\n [].forEach.call(rows, function (el) {\n var listId = el.getAttribute('data-list-id');\n var isSelected = getSelectedListsWhere('id', listId).length > 0;\n el.style.display = isSelected ? '' : 'none';\n });\n}\n\nfunction emit(event, args) {\n listeners[event] = listeners[event] || [];\n listeners[event].forEach(function (f) {\n return f.apply(null, args);\n });\n}\n\nfunction on(event, func) {\n listeners[event] = listeners[event] || [];\n listeners[event].push(func);\n}\n\n[].forEach.call(listInputs, function (el) {\n el.addEventListener('change', updateSelectedLists);\n});\nupdateSelectedLists();\nmodule.exports = {\n getSelectedLists: getSelectedLists,\n on: on\n};\n\n},{}],7:[function(require,module,exports){\n'use strict';\n\nvar showIfElements = document.querySelectorAll('[data-showif]');\n[].forEach.call(showIfElements, function (element) {\n var config = JSON.parse(element.getAttribute('data-showif'));\n var parentElements = document.querySelectorAll('[name=\"' + config.element + '\"]');\n var inputs = element.querySelectorAll('input,select,textarea:not([readonly])');\n var hide = config.hide === undefined || config.hide;\n\n function toggleElement() {\n // do nothing with unchecked radio inputs\n if (this.getAttribute('type') === \"radio\" && !this.checked) {\n return;\n }\n\n var value = this.getAttribute(\"type\") === \"checkbox\" ? this.checked : this.value;\n var conditionMet = value == config.value;\n\n if (hide) {\n element.style.display = conditionMet ? '' : 'none';\n element.style.visibility = conditionMet ? '' : 'hidden';\n } else {\n element.style.opacity = conditionMet ? '' : '0.4';\n } // disable input fields to stop sending their values to server\n\n\n [].forEach.call(inputs, function (inputElement) {\n conditionMet ? inputElement.removeAttribute('readonly') : inputElement.setAttribute('readonly', 'readonly');\n });\n } // find checked element and call toggleElement function\n\n\n [].forEach.call(parentElements, function (el) {\n el.addEventListener('change', toggleElement);\n toggleElement.call(el);\n });\n});\n\n},{}],8:[function(require,module,exports){\n'use strict';\n\nvar URL = require('./url.js');\n\nvar context = document.getElementById('mc4wp-admin');\nvar tabElements = context.querySelectorAll('.tab');\nvar tabNavElements = context.querySelectorAll('.nav-tab');\nvar refererField = context.querySelector('input[name=\"_wp_http_referer\"]');\nvar tabs = [];\n\nif (!Element.prototype.matches) {\n Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;\n}\n\n[].forEach.call(tabElements, function (t, i) {\n var id = t.id.substring(4);\n var title = t.querySelector('h2:first-of-type').textContent;\n tabs.push({\n id: id,\n title: title,\n element: t,\n nav: context.querySelectorAll('.nav-tab-' + id),\n open: function open() {\n return _open(id);\n }\n });\n});\n\nfunction get(id) {\n for (var i = 0; i < tabs.length; i++) {\n if (tabs[i].id === id) {\n return tabs[i];\n }\n }\n\n return null;\n}\n\nfunction _open(tab, updateState) {\n // make sure we have a tab object\n if (typeof tab === \"string\") {\n tab = get(tab);\n }\n\n if (!tab) {\n return false;\n } // should we update state?\n\n\n if (updateState === undefined) {\n updateState = true;\n } // hide all tabs & remove active class\n\n\n [].forEach.call(tabElements, function (t) {\n t.className = t.className.replace('tab-active', '');\n t.style.display = ' none';\n });\n [].forEach.call(tabNavElements, function (t) {\n t.className = t.className.replace('nav-tab-active', '');\n }); // add `nav-tab-active` to this tab\n\n [].forEach.call(tab.nav, function (nav) {\n nav.className += \" nav-tab-active\";\n nav.blur();\n }); // show target tab\n\n tab.element.style.display = 'block';\n tab.element.className += \" tab-active\"; // create new URL\n\n var url = URL.setParameter(window.location.href, \"tab\", tab.id); // update hash\n\n if (history.pushState && updateState) {\n history.pushState(tab.id, '', url);\n } // update document title\n\n\n title(tab); // update referer field\n\n refererField.value = url; // if thickbox is open, close it.\n\n if (typeof tb_remove === \"function\") {\n tb_remove();\n } // refresh editor if open\n\n\n if (window.mc4wp && window.mc4wp.forms && window.mc4wp.forms.editor) {\n window.mc4wp.forms.editor.refresh();\n }\n\n return true;\n}\n\nfunction title(tab) {\n var title = document.title.split('-');\n document.title = document.title.replace(title[0], tab.title + \" \");\n}\n\nfunction switchTab(evt) {\n var link = evt.target; // get from data attribute\n\n var tabId = link.getAttribute('data-tab'); // get from classname\n\n if (!tabId) {\n var match = link.className.match(/nav-tab-(\\w+)?/);\n\n if (match) {\n tabId = match[1];\n }\n } // get from href\n\n\n if (!tabId) {\n var urlParams = URL.parse(link.href);\n\n if (!urlParams.tab) {\n return;\n }\n\n tabId = urlParams.tab;\n }\n\n var opened = _open(tabId);\n\n if (opened) {\n evt.preventDefault();\n evt.returnValue = false;\n return false;\n }\n\n return true;\n}\n\nfunction init() {\n var activeTab = tabs.filter(function (t) {\n return t.element.offsetParent !== null;\n }).shift();\n\n if (!activeTab) {\n return;\n }\n\n var tab = get(activeTab.id.substring(4));\n\n if (!tab) {\n return;\n } // check if tab is in html5 history\n\n\n if (history.replaceState && history.state === null) {\n history.replaceState(tab.id, '');\n } // update document title\n\n\n title(tab);\n}\n\n[].forEach.call(tabNavElements, function (el) {\n return el.addEventListener('click', switchTab);\n});\ndocument.body.addEventListener('click', function (evt) {\n if (!evt.target.matches('.tab-link')) {\n return;\n }\n\n switchTab(evt);\n});\ninit();\n\nif (window.addEventListener && history.pushState) {\n window.addEventListener('popstate', function (e) {\n if (!e.state) return true;\n var tabId = e.state;\n return _open(tabId, false);\n });\n}\n\nmodule.exports = {\n open: _open,\n get: get\n};\n\n},{\"./url.js\":9}],9:[function(require,module,exports){\n'use strict';\n\nvar URL = {\n parse: function parse(url) {\n var query = {};\n var a = url.split('&');\n\n for (var i in a) {\n if (!a.hasOwnProperty(i)) {\n continue;\n }\n\n var b = a[i].split('=');\n query[decodeURIComponent(b[0])] = decodeURIComponent(b[1]);\n }\n\n return query;\n },\n build: function build(data) {\n var ret = [];\n\n for (var d in data) {\n ret.push(d + \"=\" + encodeURIComponent(data[d]));\n }\n\n return ret.join(\"&\");\n },\n setParameter: function setParameter(url, key, value) {\n var data = URL.parse(url);\n data[key] = value;\n return URL.build(data);\n }\n};\nmodule.exports = URL;\n\n},{}],10:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\n\nmodule.exports = function(render, schedule, console) {\n\tvar subscriptions = []\n\tvar rendering = false\n\tvar pending = false\n\n\tfunction sync() {\n\t\tif (rendering) throw new Error(\"Nested m.redraw.sync() call\")\n\t\trendering = true\n\t\tfor (var i = 0; i < subscriptions.length; i += 2) {\n\t\t\ttry { render(subscriptions[i], Vnode(subscriptions[i + 1]), redraw) }\n\t\t\tcatch (e) { console.error(e) }\n\t\t}\n\t\trendering = false\n\t}\n\n\tfunction redraw() {\n\t\tif (!pending) {\n\t\t\tpending = true\n\t\t\tschedule(function() {\n\t\t\t\tpending = false\n\t\t\t\tsync()\n\t\t\t})\n\t\t}\n\t}\n\n\tredraw.sync = sync\n\n\tfunction mount(root, component) {\n\t\tif (component != null && component.view == null && typeof component !== \"function\") {\n\t\t\tthrow new TypeError(\"m.mount(element, component) expects a component, not a vnode\")\n\t\t}\n\n\t\tvar index = subscriptions.indexOf(root)\n\t\tif (index >= 0) {\n\t\t\tsubscriptions.splice(index, 2)\n\t\t\trender(root, [], redraw)\n\t\t}\n\n\t\tif (component != null) {\n\t\t\tsubscriptions.push(root, component)\n\t\t\trender(root, Vnode(component), redraw)\n\t\t}\n\t}\n\n\treturn {mount: mount, redraw: redraw}\n}\n\n},{\"../render/vnode\":29}],11:[function(require,module,exports){\n(function (setImmediate){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\nvar m = require(\"../render/hyperscript\")\nvar Promise = require(\"../promise/promise\")\n\nvar buildPathname = require(\"../pathname/build\")\nvar parsePathname = require(\"../pathname/parse\")\nvar compileTemplate = require(\"../pathname/compileTemplate\")\nvar assign = require(\"../pathname/assign\")\n\nvar sentinel = {}\n\nmodule.exports = function($window, mountRedraw) {\n\tvar fireAsync\n\n\tfunction setPath(path, data, options) {\n\t\tpath = buildPathname(path, data)\n\t\tif (fireAsync != null) {\n\t\t\tfireAsync()\n\t\t\tvar state = options ? options.state : null\n\t\t\tvar title = options ? options.title : null\n\t\t\tif (options && options.replace) $window.history.replaceState(state, title, route.prefix + path)\n\t\t\telse $window.history.pushState(state, title, route.prefix + path)\n\t\t}\n\t\telse {\n\t\t\t$window.location.href = route.prefix + path\n\t\t}\n\t}\n\n\tvar currentResolver = sentinel, component, attrs, currentPath, lastUpdate\n\n\tvar SKIP = route.SKIP = {}\n\n\tfunction route(root, defaultRoute, routes) {\n\t\tif (root == null) throw new Error(\"Ensure the DOM element that was passed to `m.route` is not undefined\")\n\t\t// 0 = start\n\t\t// 1 = init\n\t\t// 2 = ready\n\t\tvar state = 0\n\n\t\tvar compiled = Object.keys(routes).map(function(route) {\n\t\t\tif (route[0] !== \"/\") throw new SyntaxError(\"Routes must start with a `/`\")\n\t\t\tif ((/:([^\\/\\.-]+)(\\.{3})?:/).test(route)) {\n\t\t\t\tthrow new SyntaxError(\"Route parameter names must be separated with either `/`, `.`, or `-`\")\n\t\t\t}\n\t\t\treturn {\n\t\t\t\troute: route,\n\t\t\t\tcomponent: routes[route],\n\t\t\t\tcheck: compileTemplate(route),\n\t\t\t}\n\t\t})\n\t\tvar callAsync = typeof setImmediate === \"function\" ? setImmediate : setTimeout\n\t\tvar p = Promise.resolve()\n\t\tvar scheduled = false\n\t\tvar onremove\n\n\t\tfireAsync = null\n\n\t\tif (defaultRoute != null) {\n\t\t\tvar defaultData = parsePathname(defaultRoute)\n\n\t\t\tif (!compiled.some(function (i) { return i.check(defaultData) })) {\n\t\t\t\tthrow new ReferenceError(\"Default route doesn't match any known routes\")\n\t\t\t}\n\t\t}\n\n\t\tfunction resolveRoute() {\n\t\t\tscheduled = false\n\t\t\t// Consider the pathname holistically. The prefix might even be invalid,\n\t\t\t// but that's not our problem.\n\t\t\tvar prefix = $window.location.hash\n\t\t\tif (route.prefix[0] !== \"#\") {\n\t\t\t\tprefix = $window.location.search + prefix\n\t\t\t\tif (route.prefix[0] !== \"?\") {\n\t\t\t\t\tprefix = $window.location.pathname + prefix\n\t\t\t\t\tif (prefix[0] !== \"/\") prefix = \"/\" + prefix\n\t\t\t\t}\n\t\t\t}\n\t\t\t// This seemingly useless `.concat()` speeds up the tests quite a bit,\n\t\t\t// since the representation is consistently a relatively poorly\n\t\t\t// optimized cons string.\n\t\t\tvar path = prefix.concat()\n\t\t\t\t.replace(/(?:%[a-f89][a-f0-9])+/gim, decodeURIComponent)\n\t\t\t\t.slice(route.prefix.length)\n\t\t\tvar data = parsePathname(path)\n\n\t\t\tassign(data.params, $window.history.state)\n\n\t\t\tfunction fail() {\n\t\t\t\tif (path === defaultRoute) throw new Error(\"Could not resolve default route \" + defaultRoute)\n\t\t\t\tsetPath(defaultRoute, null, {replace: true})\n\t\t\t}\n\n\t\t\tloop(0)\n\t\t\tfunction loop(i) {\n\t\t\t\t// 0 = init\n\t\t\t\t// 1 = scheduled\n\t\t\t\t// 2 = done\n\t\t\t\tfor (; i < compiled.length; i++) {\n\t\t\t\t\tif (compiled[i].check(data)) {\n\t\t\t\t\t\tvar payload = compiled[i].component\n\t\t\t\t\t\tvar matchedRoute = compiled[i].route\n\t\t\t\t\t\tvar localComp = payload\n\t\t\t\t\t\tvar update = lastUpdate = function(comp) {\n\t\t\t\t\t\t\tif (update !== lastUpdate) return\n\t\t\t\t\t\t\tif (comp === SKIP) return loop(i + 1)\n\t\t\t\t\t\t\tcomponent = comp != null && (typeof comp.view === \"function\" || typeof comp === \"function\")? comp : \"div\"\n\t\t\t\t\t\t\tattrs = data.params, currentPath = path, lastUpdate = null\n\t\t\t\t\t\t\tcurrentResolver = payload.render ? payload : null\n\t\t\t\t\t\t\tif (state === 2) mountRedraw.redraw()\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tstate = 2\n\t\t\t\t\t\t\t\tmountRedraw.redraw.sync()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// There's no understating how much I *wish* I could\n\t\t\t\t\t\t// use `async`/`await` here...\n\t\t\t\t\t\tif (payload.view || typeof payload === \"function\") {\n\t\t\t\t\t\t\tpayload = {}\n\t\t\t\t\t\t\tupdate(localComp)\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (payload.onmatch) {\n\t\t\t\t\t\t\tp.then(function () {\n\t\t\t\t\t\t\t\treturn payload.onmatch(data.params, path, matchedRoute)\n\t\t\t\t\t\t\t}).then(update, fail)\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse update(\"div\")\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfail()\n\t\t\t}\n\t\t}\n\n\t\t// Set it unconditionally so `m.route.set` and `m.route.Link` both work,\n\t\t// even if neither `pushState` nor `hashchange` are supported. It's\n\t\t// cleared if `hashchange` is used, since that makes it automatically\n\t\t// async.\n\t\tfireAsync = function() {\n\t\t\tif (!scheduled) {\n\t\t\t\tscheduled = true\n\t\t\t\tcallAsync(resolveRoute)\n\t\t\t}\n\t\t}\n\n\t\tif (typeof $window.history.pushState === \"function\") {\n\t\t\tonremove = function() {\n\t\t\t\t$window.removeEventListener(\"popstate\", fireAsync, false)\n\t\t\t}\n\t\t\t$window.addEventListener(\"popstate\", fireAsync, false)\n\t\t} else if (route.prefix[0] === \"#\") {\n\t\t\tfireAsync = null\n\t\t\tonremove = function() {\n\t\t\t\t$window.removeEventListener(\"hashchange\", resolveRoute, false)\n\t\t\t}\n\t\t\t$window.addEventListener(\"hashchange\", resolveRoute, false)\n\t\t}\n\n\t\treturn mountRedraw.mount(root, {\n\t\t\tonbeforeupdate: function() {\n\t\t\t\tstate = state ? 2 : 1\n\t\t\t\treturn !(!state || sentinel === currentResolver)\n\t\t\t},\n\t\t\toncreate: resolveRoute,\n\t\t\tonremove: onremove,\n\t\t\tview: function() {\n\t\t\t\tif (!state || sentinel === currentResolver) return\n\t\t\t\t// Wrap in a fragment to preserve existing key semantics\n\t\t\t\tvar vnode = [Vnode(component, attrs.key, attrs)]\n\t\t\t\tif (currentResolver) vnode = currentResolver.render(vnode[0])\n\t\t\t\treturn vnode\n\t\t\t},\n\t\t})\n\t}\n\troute.set = function(path, data, options) {\n\t\tif (lastUpdate != null) {\n\t\t\toptions = options || {}\n\t\t\toptions.replace = true\n\t\t}\n\t\tlastUpdate = null\n\t\tsetPath(path, data, options)\n\t}\n\troute.get = function() {return currentPath}\n\troute.prefix = \"#!\"\n\troute.Link = {\n\t\tview: function(vnode) {\n\t\t\tvar options = vnode.attrs.options\n\t\t\t// Remove these so they don't get overwritten\n\t\t\tvar attrs = {}, onclick, href\n\t\t\tassign(attrs, vnode.attrs)\n\t\t\t// The first two are internal, but the rest are magic attributes\n\t\t\t// that need censored to not screw up rendering.\n\t\t\tattrs.selector = attrs.options = attrs.key = attrs.oninit =\n\t\t\tattrs.oncreate = attrs.onbeforeupdate = attrs.onupdate =\n\t\t\tattrs.onbeforeremove = attrs.onremove = null\n\n\t\t\t// Do this now so we can get the most current `href` and `disabled`.\n\t\t\t// Those attributes may also be specified in the selector, and we\n\t\t\t// should honor that.\n\t\t\tvar child = m(vnode.attrs.selector || \"a\", attrs, vnode.children)\n\n\t\t\t// Let's provide a *right* way to disable a route link, rather than\n\t\t\t// letting people screw up accessibility on accident.\n\t\t\t//\n\t\t\t// The attribute is coerced so users don't get surprised over\n\t\t\t// `disabled: 0` resulting in a button that's somehow routable\n\t\t\t// despite being visibly disabled.\n\t\t\tif (child.attrs.disabled = Boolean(child.attrs.disabled)) {\n\t\t\t\tchild.attrs.href = null\n\t\t\t\tchild.attrs[\"aria-disabled\"] = \"true\"\n\t\t\t\t// If you *really* do want to do this on a disabled link, use\n\t\t\t\t// an `oncreate` hook to add it.\n\t\t\t\tchild.attrs.onclick = null\n\t\t\t} else {\n\t\t\t\tonclick = child.attrs.onclick\n\t\t\t\thref = child.attrs.href\n\t\t\t\tchild.attrs.href = route.prefix + href\n\t\t\t\tchild.attrs.onclick = function(e) {\n\t\t\t\t\tvar result\n\t\t\t\t\tif (typeof onclick === \"function\") {\n\t\t\t\t\t\tresult = onclick.call(e.currentTarget, e)\n\t\t\t\t\t} else if (onclick == null || typeof onclick !== \"object\") {\n\t\t\t\t\t\t// do nothing\n\t\t\t\t\t} else if (typeof onclick.handleEvent === \"function\") {\n\t\t\t\t\t\tonclick.handleEvent(e)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Adapted from React Router's implementation:\n\t\t\t\t\t// https://github.com/ReactTraining/react-router/blob/520a0acd48ae1b066eb0b07d6d4d1790a1d02482/packages/react-router-dom/modules/Link.js\n\t\t\t\t\t//\n\t\t\t\t\t// Try to be flexible and intuitive in how we handle links.\n\t\t\t\t\t// Fun fact: links aren't as obvious to get right as you\n\t\t\t\t\t// would expect. There's a lot more valid ways to click a\n\t\t\t\t\t// link than this, and one might want to not simply click a\n\t\t\t\t\t// link, but right click or command-click it to copy the\n\t\t\t\t\t// link target, etc. Nope, this isn't just for blind people.\n\t\t\t\t\tif (\n\t\t\t\t\t\t// Skip if `onclick` prevented default\n\t\t\t\t\t\tresult !== false && !e.defaultPrevented &&\n\t\t\t\t\t\t// Ignore everything but left clicks\n\t\t\t\t\t\t(e.button === 0 || e.which === 0 || e.which === 1) &&\n\t\t\t\t\t\t// Let the browser handle `target=_blank`, etc.\n\t\t\t\t\t\t(!e.currentTarget.target || e.currentTarget.target === \"_self\") &&\n\t\t\t\t\t\t// No modifier keys\n\t\t\t\t\t\t!e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey\n\t\t\t\t\t) {\n\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\te.redraw = false\n\t\t\t\t\t\troute.set(href, null, options)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn child\n\t\t},\n\t}\n\troute.param = function(key) {\n\t\treturn attrs && key != null ? attrs[key] : attrs\n\t}\n\n\treturn route\n}\n\n}).call(this,require(\"timers\").setImmediate)\n},{\"../pathname/assign\":15,\"../pathname/build\":16,\"../pathname/compileTemplate\":17,\"../pathname/parse\":18,\"../promise/promise\":20,\"../render/hyperscript\":25,\"../render/vnode\":29,\"timers\":34}],12:[function(require,module,exports){\n\"use strict\"\n\nvar hyperscript = require(\"./render/hyperscript\")\n\nhyperscript.trust = require(\"./render/trust\")\nhyperscript.fragment = require(\"./render/fragment\")\n\nmodule.exports = hyperscript\n\n},{\"./render/fragment\":24,\"./render/hyperscript\":25,\"./render/trust\":28}],13:[function(require,module,exports){\n\"use strict\"\n\nvar hyperscript = require(\"./hyperscript\")\nvar request = require(\"./request\")\nvar mountRedraw = require(\"./mount-redraw\")\n\nvar m = function m() { return hyperscript.apply(this, arguments) }\nm.m = hyperscript\nm.trust = hyperscript.trust\nm.fragment = hyperscript.fragment\nm.mount = mountRedraw.mount\nm.route = require(\"./route\")\nm.render = require(\"./render\")\nm.redraw = mountRedraw.redraw\nm.request = request.request\nm.jsonp = request.jsonp\nm.parseQueryString = require(\"./querystring/parse\")\nm.buildQueryString = require(\"./querystring/build\")\nm.parsePathname = require(\"./pathname/parse\")\nm.buildPathname = require(\"./pathname/build\")\nm.vnode = require(\"./render/vnode\")\nm.PromisePolyfill = require(\"./promise/polyfill\")\n\nmodule.exports = m\n\n},{\"./hyperscript\":12,\"./mount-redraw\":14,\"./pathname/build\":16,\"./pathname/parse\":18,\"./promise/polyfill\":19,\"./querystring/build\":21,\"./querystring/parse\":22,\"./render\":23,\"./render/vnode\":29,\"./request\":30,\"./route\":32}],14:[function(require,module,exports){\n\"use strict\"\n\nvar render = require(\"./render\")\n\nmodule.exports = require(\"./api/mount-redraw\")(render, requestAnimationFrame, console)\n\n},{\"./api/mount-redraw\":10,\"./render\":23}],15:[function(require,module,exports){\n\"use strict\"\n\nmodule.exports = Object.assign || function(target, source) {\n\tif(source) Object.keys(source).forEach(function(key) { target[key] = source[key] })\n}\n\n},{}],16:[function(require,module,exports){\n\"use strict\"\n\nvar buildQueryString = require(\"../querystring/build\")\nvar assign = require(\"./assign\")\n\n// Returns `path` from `template` + `params`\nmodule.exports = function(template, params) {\n\tif ((/:([^\\/\\.-]+)(\\.{3})?:/).test(template)) {\n\t\tthrow new SyntaxError(\"Template parameter names *must* be separated\")\n\t}\n\tif (params == null) return template\n\tvar queryIndex = template.indexOf(\"?\")\n\tvar hashIndex = template.indexOf(\"#\")\n\tvar queryEnd = hashIndex < 0 ? template.length : hashIndex\n\tvar pathEnd = queryIndex < 0 ? queryEnd : queryIndex\n\tvar path = template.slice(0, pathEnd)\n\tvar query = {}\n\n\tassign(query, params)\n\n\tvar resolved = path.replace(/:([^\\/\\.-]+)(\\.{3})?/g, function(m, key, variadic) {\n\t\tdelete query[key]\n\t\t// If no such parameter exists, don't interpolate it.\n\t\tif (params[key] == null) return m\n\t\t// Escape normal parameters, but not variadic ones.\n\t\treturn variadic ? params[key] : encodeURIComponent(String(params[key]))\n\t})\n\n\t// In case the template substitution adds new query/hash parameters.\n\tvar newQueryIndex = resolved.indexOf(\"?\")\n\tvar newHashIndex = resolved.indexOf(\"#\")\n\tvar newQueryEnd = newHashIndex < 0 ? resolved.length : newHashIndex\n\tvar newPathEnd = newQueryIndex < 0 ? newQueryEnd : newQueryIndex\n\tvar result = resolved.slice(0, newPathEnd)\n\n\tif (queryIndex >= 0) result += template.slice(queryIndex, queryEnd)\n\tif (newQueryIndex >= 0) result += (queryIndex < 0 ? \"?\" : \"&\") + resolved.slice(newQueryIndex, newQueryEnd)\n\tvar querystring = buildQueryString(query)\n\tif (querystring) result += (queryIndex < 0 && newQueryIndex < 0 ? \"?\" : \"&\") + querystring\n\tif (hashIndex >= 0) result += template.slice(hashIndex)\n\tif (newHashIndex >= 0) result += (hashIndex < 0 ? \"\" : \"&\") + resolved.slice(newHashIndex)\n\treturn result\n}\n\n},{\"../querystring/build\":21,\"./assign\":15}],17:[function(require,module,exports){\n\"use strict\"\n\nvar parsePathname = require(\"./parse\")\n\n// Compiles a template into a function that takes a resolved path (without query\n// strings) and returns an object containing the template parameters with their\n// parsed values. This expects the input of the compiled template to be the\n// output of `parsePathname`. Note that it does *not* remove query parameters\n// specified in the template.\nmodule.exports = function(template) {\n\tvar templateData = parsePathname(template)\n\tvar templateKeys = Object.keys(templateData.params)\n\tvar keys = []\n\tvar regexp = new RegExp(\"^\" + templateData.path.replace(\n\t\t// I escape literal text so people can use things like `:file.:ext` or\n\t\t// `:lang-:locale` in routes. This is all merged into one pass so I\n\t\t// don't also accidentally escape `-` and make it harder to detect it to\n\t\t// ban it from template parameters.\n\t\t/:([^\\/.-]+)(\\.{3}|\\.(?!\\.)|-)?|[\\\\^$*+.()|\\[\\]{}]/g,\n\t\tfunction(m, key, extra) {\n\t\t\tif (key == null) return \"\\\\\" + m\n\t\t\tkeys.push({k: key, r: extra === \"...\"})\n\t\t\tif (extra === \"...\") return \"(.*)\"\n\t\t\tif (extra === \".\") return \"([^/]+)\\\\.\"\n\t\t\treturn \"([^/]+)\" + (extra || \"\")\n\t\t}\n\t) + \"$\")\n\treturn function(data) {\n\t\t// First, check the params. Usually, there isn't any, and it's just\n\t\t// checking a static set.\n\t\tfor (var i = 0; i < templateKeys.length; i++) {\n\t\t\tif (templateData.params[templateKeys[i]] !== data.params[templateKeys[i]]) return false\n\t\t}\n\t\t// If no interpolations exist, let's skip all the ceremony\n\t\tif (!keys.length) return regexp.test(data.path)\n\t\tvar values = regexp.exec(data.path)\n\t\tif (values == null) return false\n\t\tfor (var i = 0; i < keys.length; i++) {\n\t\t\tdata.params[keys[i].k] = keys[i].r ? values[i + 1] : decodeURIComponent(values[i + 1])\n\t\t}\n\t\treturn true\n\t}\n}\n\n},{\"./parse\":18}],18:[function(require,module,exports){\n\"use strict\"\n\nvar parseQueryString = require(\"../querystring/parse\")\n\n// Returns `{path, params}` from `url`\nmodule.exports = function(url) {\n\tvar queryIndex = url.indexOf(\"?\")\n\tvar hashIndex = url.indexOf(\"#\")\n\tvar queryEnd = hashIndex < 0 ? url.length : hashIndex\n\tvar pathEnd = queryIndex < 0 ? queryEnd : queryIndex\n\tvar path = url.slice(0, pathEnd).replace(/\\/{2,}/g, \"/\")\n\n\tif (!path) path = \"/\"\n\telse {\n\t\tif (path[0] !== \"/\") path = \"/\" + path\n\t\tif (path.length > 1 && path[path.length - 1] === \"/\") path = path.slice(0, -1)\n\t}\n\treturn {\n\t\tpath: path,\n\t\tparams: queryIndex < 0\n\t\t\t? {}\n\t\t\t: parseQueryString(url.slice(queryIndex + 1, queryEnd)),\n\t}\n}\n\n},{\"../querystring/parse\":22}],19:[function(require,module,exports){\n(function (setImmediate){\n\"use strict\"\n/** @constructor */\nvar PromisePolyfill = function(executor) {\n\tif (!(this instanceof PromisePolyfill)) throw new Error(\"Promise must be called with `new`\")\n\tif (typeof executor !== \"function\") throw new TypeError(\"executor must be a function\")\n\n\tvar self = this, resolvers = [], rejectors = [], resolveCurrent = handler(resolvers, true), rejectCurrent = handler(rejectors, false)\n\tvar instance = self._instance = {resolvers: resolvers, rejectors: rejectors}\n\tvar callAsync = typeof setImmediate === \"function\" ? setImmediate : setTimeout\n\tfunction handler(list, shouldAbsorb) {\n\t\treturn function execute(value) {\n\t\t\tvar then\n\t\t\ttry {\n\t\t\t\tif (shouldAbsorb && value != null && (typeof value === \"object\" || typeof value === \"function\") && typeof (then = value.then) === \"function\") {\n\t\t\t\t\tif (value === self) throw new TypeError(\"Promise can't be resolved w/ itself\")\n\t\t\t\t\texecuteOnce(then.bind(value))\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tcallAsync(function() {\n\t\t\t\t\t\tif (!shouldAbsorb && list.length === 0) console.error(\"Possible unhandled promise rejection:\", value)\n\t\t\t\t\t\tfor (var i = 0; i < list.length; i++) list[i](value)\n\t\t\t\t\t\tresolvers.length = 0, rejectors.length = 0\n\t\t\t\t\t\tinstance.state = shouldAbsorb\n\t\t\t\t\t\tinstance.retry = function() {execute(value)}\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (e) {\n\t\t\t\trejectCurrent(e)\n\t\t\t}\n\t\t}\n\t}\n\tfunction executeOnce(then) {\n\t\tvar runs = 0\n\t\tfunction run(fn) {\n\t\t\treturn function(value) {\n\t\t\t\tif (runs++ > 0) return\n\t\t\t\tfn(value)\n\t\t\t}\n\t\t}\n\t\tvar onerror = run(rejectCurrent)\n\t\ttry {then(run(resolveCurrent), onerror)} catch (e) {onerror(e)}\n\t}\n\n\texecuteOnce(executor)\n}\nPromisePolyfill.prototype.then = function(onFulfilled, onRejection) {\n\tvar self = this, instance = self._instance\n\tfunction handle(callback, list, next, state) {\n\t\tlist.push(function(value) {\n\t\t\tif (typeof callback !== \"function\") next(value)\n\t\t\telse try {resolveNext(callback(value))} catch (e) {if (rejectNext) rejectNext(e)}\n\t\t})\n\t\tif (typeof instance.retry === \"function\" && state === instance.state) instance.retry()\n\t}\n\tvar resolveNext, rejectNext\n\tvar promise = new PromisePolyfill(function(resolve, reject) {resolveNext = resolve, rejectNext = reject})\n\thandle(onFulfilled, instance.resolvers, resolveNext, true), handle(onRejection, instance.rejectors, rejectNext, false)\n\treturn promise\n}\nPromisePolyfill.prototype.catch = function(onRejection) {\n\treturn this.then(null, onRejection)\n}\nPromisePolyfill.prototype.finally = function(callback) {\n\treturn this.then(\n\t\tfunction(value) {\n\t\t\treturn PromisePolyfill.resolve(callback()).then(function() {\n\t\t\t\treturn value\n\t\t\t})\n\t\t},\n\t\tfunction(reason) {\n\t\t\treturn PromisePolyfill.resolve(callback()).then(function() {\n\t\t\t\treturn PromisePolyfill.reject(reason);\n\t\t\t})\n\t\t}\n\t)\n}\nPromisePolyfill.resolve = function(value) {\n\tif (value instanceof PromisePolyfill) return value\n\treturn new PromisePolyfill(function(resolve) {resolve(value)})\n}\nPromisePolyfill.reject = function(value) {\n\treturn new PromisePolyfill(function(resolve, reject) {reject(value)})\n}\nPromisePolyfill.all = function(list) {\n\treturn new PromisePolyfill(function(resolve, reject) {\n\t\tvar total = list.length, count = 0, values = []\n\t\tif (list.length === 0) resolve([])\n\t\telse for (var i = 0; i < list.length; i++) {\n\t\t\t(function(i) {\n\t\t\t\tfunction consume(value) {\n\t\t\t\t\tcount++\n\t\t\t\t\tvalues[i] = value\n\t\t\t\t\tif (count === total) resolve(values)\n\t\t\t\t}\n\t\t\t\tif (list[i] != null && (typeof list[i] === \"object\" || typeof list[i] === \"function\") && typeof list[i].then === \"function\") {\n\t\t\t\t\tlist[i].then(consume, reject)\n\t\t\t\t}\n\t\t\t\telse consume(list[i])\n\t\t\t})(i)\n\t\t}\n\t})\n}\nPromisePolyfill.race = function(list) {\n\treturn new PromisePolyfill(function(resolve, reject) {\n\t\tfor (var i = 0; i < list.length; i++) {\n\t\t\tlist[i].then(resolve, reject)\n\t\t}\n\t})\n}\n\nmodule.exports = PromisePolyfill\n\n}).call(this,require(\"timers\").setImmediate)\n},{\"timers\":34}],20:[function(require,module,exports){\n(function (global){\n\"use strict\"\n\nvar PromisePolyfill = require(\"./polyfill\")\n\nif (typeof window !== \"undefined\") {\n\tif (typeof window.Promise === \"undefined\") {\n\t\twindow.Promise = PromisePolyfill\n\t} else if (!window.Promise.prototype.finally) {\n\t\twindow.Promise.prototype.finally = PromisePolyfill.prototype.finally\n\t}\n\tmodule.exports = window.Promise\n} else if (typeof global !== \"undefined\") {\n\tif (typeof global.Promise === \"undefined\") {\n\t\tglobal.Promise = PromisePolyfill\n\t} else if (!global.Promise.prototype.finally) {\n\t\tglobal.Promise.prototype.finally = PromisePolyfill.prototype.finally\n\t}\n\tmodule.exports = global.Promise\n} else {\n\tmodule.exports = PromisePolyfill\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"./polyfill\":19}],21:[function(require,module,exports){\n\"use strict\"\n\nmodule.exports = function(object) {\n\tif (Object.prototype.toString.call(object) !== \"[object Object]\") return \"\"\n\n\tvar args = []\n\tfor (var key in object) {\n\t\tdestructure(key, object[key])\n\t}\n\n\treturn args.join(\"&\")\n\n\tfunction destructure(key, value) {\n\t\tif (Array.isArray(value)) {\n\t\t\tfor (var i = 0; i < value.length; i++) {\n\t\t\t\tdestructure(key + \"[\" + i + \"]\", value[i])\n\t\t\t}\n\t\t}\n\t\telse if (Object.prototype.toString.call(value) === \"[object Object]\") {\n\t\t\tfor (var i in value) {\n\t\t\t\tdestructure(key + \"[\" + i + \"]\", value[i])\n\t\t\t}\n\t\t}\n\t\telse args.push(encodeURIComponent(key) + (value != null && value !== \"\" ? \"=\" + encodeURIComponent(value) : \"\"))\n\t}\n}\n\n},{}],22:[function(require,module,exports){\n\"use strict\"\n\nmodule.exports = function(string) {\n\tif (string === \"\" || string == null) return {}\n\tif (string.charAt(0) === \"?\") string = string.slice(1)\n\n\tvar entries = string.split(\"&\"), counters = {}, data = {}\n\tfor (var i = 0; i < entries.length; i++) {\n\t\tvar entry = entries[i].split(\"=\")\n\t\tvar key = decodeURIComponent(entry[0])\n\t\tvar value = entry.length === 2 ? decodeURIComponent(entry[1]) : \"\"\n\n\t\tif (value === \"true\") value = true\n\t\telse if (value === \"false\") value = false\n\n\t\tvar levels = key.split(/\\]\\[?|\\[/)\n\t\tvar cursor = data\n\t\tif (key.indexOf(\"[\") > -1) levels.pop()\n\t\tfor (var j = 0; j < levels.length; j++) {\n\t\t\tvar level = levels[j], nextLevel = levels[j + 1]\n\t\t\tvar isNumber = nextLevel == \"\" || !isNaN(parseInt(nextLevel, 10))\n\t\t\tif (level === \"\") {\n\t\t\t\tvar key = levels.slice(0, j).join()\n\t\t\t\tif (counters[key] == null) {\n\t\t\t\t\tcounters[key] = Array.isArray(cursor) ? cursor.length : 0\n\t\t\t\t}\n\t\t\t\tlevel = counters[key]++\n\t\t\t}\n\t\t\t// Disallow direct prototype pollution\n\t\t\telse if (level === \"__proto__\") break\n\t\t\tif (j === levels.length - 1) cursor[level] = value\n\t\t\telse {\n\t\t\t\t// Read own properties exclusively to disallow indirect\n\t\t\t\t// prototype pollution\n\t\t\t\tvar desc = Object.getOwnPropertyDescriptor(cursor, level)\n\t\t\t\tif (desc != null) desc = desc.value\n\t\t\t\tif (desc == null) cursor[level] = desc = isNumber ? [] : {}\n\t\t\t\tcursor = desc\n\t\t\t}\n\t\t}\n\t}\n\treturn data\n}\n\n},{}],23:[function(require,module,exports){\n\"use strict\"\n\nmodule.exports = require(\"./render/render\")(window)\n\n},{\"./render/render\":27}],24:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\nvar hyperscriptVnode = require(\"./hyperscriptVnode\")\n\nmodule.exports = function() {\n\tvar vnode = hyperscriptVnode.apply(0, arguments)\n\n\tvnode.tag = \"[\"\n\tvnode.children = Vnode.normalizeChildren(vnode.children)\n\treturn vnode\n}\n\n},{\"../render/vnode\":29,\"./hyperscriptVnode\":26}],25:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\nvar hyperscriptVnode = require(\"./hyperscriptVnode\")\n\nvar selectorParser = /(?:(^|#|\\.)([^#\\.\\[\\]]+))|(\\[(.+?)(?:\\s*=\\s*(\"|'|)((?:\\\\[\"'\\]]|.)*?)\\5)?\\])/g\nvar selectorCache = {}\nvar hasOwn = {}.hasOwnProperty\n\nfunction isEmpty(object) {\n\tfor (var key in object) if (hasOwn.call(object, key)) return false\n\treturn true\n}\n\nfunction compileSelector(selector) {\n\tvar match, tag = \"div\", classes = [], attrs = {}\n\twhile (match = selectorParser.exec(selector)) {\n\t\tvar type = match[1], value = match[2]\n\t\tif (type === \"\" && value !== \"\") tag = value\n\t\telse if (type === \"#\") attrs.id = value\n\t\telse if (type === \".\") classes.push(value)\n\t\telse if (match[3][0] === \"[\") {\n\t\t\tvar attrValue = match[6]\n\t\t\tif (attrValue) attrValue = attrValue.replace(/\\\\([\"'])/g, \"$1\").replace(/\\\\\\\\/g, \"\\\\\")\n\t\t\tif (match[4] === \"class\") classes.push(attrValue)\n\t\t\telse attrs[match[4]] = attrValue === \"\" ? attrValue : attrValue || true\n\t\t}\n\t}\n\tif (classes.length > 0) attrs.className = classes.join(\" \")\n\treturn selectorCache[selector] = {tag: tag, attrs: attrs}\n}\n\nfunction execSelector(state, vnode) {\n\tvar attrs = vnode.attrs\n\tvar children = Vnode.normalizeChildren(vnode.children)\n\tvar hasClass = hasOwn.call(attrs, \"class\")\n\tvar className = hasClass ? attrs.class : attrs.className\n\n\tvnode.tag = state.tag\n\tvnode.attrs = null\n\tvnode.children = undefined\n\n\tif (!isEmpty(state.attrs) && !isEmpty(attrs)) {\n\t\tvar newAttrs = {}\n\n\t\tfor (var key in attrs) {\n\t\t\tif (hasOwn.call(attrs, key)) newAttrs[key] = attrs[key]\n\t\t}\n\n\t\tattrs = newAttrs\n\t}\n\n\tfor (var key in state.attrs) {\n\t\tif (hasOwn.call(state.attrs, key) && key !== \"className\" && !hasOwn.call(attrs, key)){\n\t\t\tattrs[key] = state.attrs[key]\n\t\t}\n\t}\n\tif (className != null || state.attrs.className != null) attrs.className =\n\t\tclassName != null\n\t\t\t? state.attrs.className != null\n\t\t\t\t? String(state.attrs.className) + \" \" + String(className)\n\t\t\t\t: className\n\t\t\t: state.attrs.className != null\n\t\t\t\t? state.attrs.className\n\t\t\t\t: null\n\n\tif (hasClass) attrs.class = null\n\n\tfor (var key in attrs) {\n\t\tif (hasOwn.call(attrs, key) && key !== \"key\") {\n\t\t\tvnode.attrs = attrs\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif (Array.isArray(children) && children.length === 1 && children[0] != null && children[0].tag === \"#\") {\n\t\tvnode.text = children[0].children\n\t} else {\n\t\tvnode.children = children\n\t}\n\n\treturn vnode\n}\n\nfunction hyperscript(selector) {\n\tif (selector == null || typeof selector !== \"string\" && typeof selector !== \"function\" && typeof selector.view !== \"function\") {\n\t\tthrow Error(\"The selector must be either a string or a component.\");\n\t}\n\n\tvar vnode = hyperscriptVnode.apply(1, arguments)\n\n\tif (typeof selector === \"string\") {\n\t\tvnode.children = Vnode.normalizeChildren(vnode.children)\n\t\tif (selector !== \"[\") return execSelector(selectorCache[selector] || compileSelector(selector), vnode)\n\t}\n\n\tvnode.tag = selector\n\treturn vnode\n}\n\nmodule.exports = hyperscript\n\n},{\"../render/vnode\":29,\"./hyperscriptVnode\":26}],26:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\n\n// Call via `hyperscriptVnode.apply(startOffset, arguments)`\n//\n// The reason I do it this way, forwarding the arguments and passing the start\n// offset in `this`, is so I don't have to create a temporary array in a\n// performance-critical path.\n//\n// In native ES6, I'd instead add a final `...args` parameter to the\n// `hyperscript` and `fragment` factories and define this as\n// `hyperscriptVnode(...args)`, since modern engines do optimize that away. But\n// ES5 (what Mithril requires thanks to IE support) doesn't give me that luxury,\n// and engines aren't nearly intelligent enough to do either of these:\n//\n// 1. Elide the allocation for `[].slice.call(arguments, 1)` when it's passed to\n// another function only to be indexed.\n// 2. Elide an `arguments` allocation when it's passed to any function other\n// than `Function.prototype.apply` or `Reflect.apply`.\n//\n// In ES6, it'd probably look closer to this (I'd need to profile it, though):\n// module.exports = function(attrs, ...children) {\n// if (attrs == null || typeof attrs === \"object\" && attrs.tag == null && !Array.isArray(attrs)) {\n// if (children.length === 1 && Array.isArray(children[0])) children = children[0]\n// } else {\n// children = children.length === 0 && Array.isArray(attrs) ? attrs : [attrs, ...children]\n// attrs = undefined\n// }\n//\n// if (attrs == null) attrs = {}\n// return Vnode(\"\", attrs.key, attrs, children)\n// }\nmodule.exports = function() {\n\tvar attrs = arguments[this], start = this + 1, children\n\n\tif (attrs == null) {\n\t\tattrs = {}\n\t} else if (typeof attrs !== \"object\" || attrs.tag != null || Array.isArray(attrs)) {\n\t\tattrs = {}\n\t\tstart = this\n\t}\n\n\tif (arguments.length === start + 1) {\n\t\tchildren = arguments[start]\n\t\tif (!Array.isArray(children)) children = [children]\n\t} else {\n\t\tchildren = []\n\t\twhile (start < arguments.length) children.push(arguments[start++])\n\t}\n\n\treturn Vnode(\"\", attrs.key, attrs, children)\n}\n\n},{\"../render/vnode\":29}],27:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\n\nmodule.exports = function($window) {\n\tvar $doc = $window && $window.document\n\tvar currentRedraw\n\n\tvar nameSpace = {\n\t\tsvg: \"http://www.w3.org/2000/svg\",\n\t\tmath: \"http://www.w3.org/1998/Math/MathML\"\n\t}\n\n\tfunction getNameSpace(vnode) {\n\t\treturn vnode.attrs && vnode.attrs.xmlns || nameSpace[vnode.tag]\n\t}\n\n\t//sanity check to discourage people from doing `vnode.state = ...`\n\tfunction checkState(vnode, original) {\n\t\tif (vnode.state !== original) throw new Error(\"`vnode.state` must not be modified\")\n\t}\n\n\t//Note: the hook is passed as the `this` argument to allow proxying the\n\t//arguments without requiring a full array allocation to do so. It also\n\t//takes advantage of the fact the current `vnode` is the first argument in\n\t//all lifecycle methods.\n\tfunction callHook(vnode) {\n\t\tvar original = vnode.state\n\t\ttry {\n\t\t\treturn this.apply(original, arguments)\n\t\t} finally {\n\t\t\tcheckState(vnode, original)\n\t\t}\n\t}\n\n\t// IE11 (at least) throws an UnspecifiedError when accessing document.activeElement when\n\t// inside an iframe. Catch and swallow this error, and heavy-handidly return null.\n\tfunction activeElement() {\n\t\ttry {\n\t\t\treturn $doc.activeElement\n\t\t} catch (e) {\n\t\t\treturn null\n\t\t}\n\t}\n\t//create\n\tfunction createNodes(parent, vnodes, start, end, hooks, nextSibling, ns) {\n\t\tfor (var i = start; i < end; i++) {\n\t\t\tvar vnode = vnodes[i]\n\t\t\tif (vnode != null) {\n\t\t\t\tcreateNode(parent, vnode, hooks, ns, nextSibling)\n\t\t\t}\n\t\t}\n\t}\n\tfunction createNode(parent, vnode, hooks, ns, nextSibling) {\n\t\tvar tag = vnode.tag\n\t\tif (typeof tag === \"string\") {\n\t\t\tvnode.state = {}\n\t\t\tif (vnode.attrs != null) initLifecycle(vnode.attrs, vnode, hooks)\n\t\t\tswitch (tag) {\n\t\t\t\tcase \"#\": createText(parent, vnode, nextSibling); break\n\t\t\t\tcase \"<\": createHTML(parent, vnode, ns, nextSibling); break\n\t\t\t\tcase \"[\": createFragment(parent, vnode, hooks, ns, nextSibling); break\n\t\t\t\tdefault: createElement(parent, vnode, hooks, ns, nextSibling)\n\t\t\t}\n\t\t}\n\t\telse createComponent(parent, vnode, hooks, ns, nextSibling)\n\t}\n\tfunction createText(parent, vnode, nextSibling) {\n\t\tvnode.dom = $doc.createTextNode(vnode.children)\n\t\tinsertNode(parent, vnode.dom, nextSibling)\n\t}\n\tvar possibleParents = {caption: \"table\", thead: \"table\", tbody: \"table\", tfoot: \"table\", tr: \"tbody\", th: \"tr\", td: \"tr\", colgroup: \"table\", col: \"colgroup\"}\n\tfunction createHTML(parent, vnode, ns, nextSibling) {\n\t\tvar match = vnode.children.match(/^\\s*?<(\\w+)/im) || []\n\t\t// not using the proper parent makes the child element(s) vanish.\n\t\t// var div = document.createElement(\"div\")\n\t\t// div.innerHTML = \"<td>i</td><td>j</td>\"\n\t\t// console.log(div.innerHTML)\n\t\t// --> \"ij\", no <td> in sight.\n\t\tvar temp = $doc.createElement(possibleParents[match[1]] || \"div\")\n\t\tif (ns === \"http://www.w3.org/2000/svg\") {\n\t\t\ttemp.innerHTML = \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\">\" + vnode.children + \"</svg>\"\n\t\t\ttemp = temp.firstChild\n\t\t} else {\n\t\t\ttemp.innerHTML = vnode.children\n\t\t}\n\t\tvnode.dom = temp.firstChild\n\t\tvnode.domSize = temp.childNodes.length\n\t\t// Capture nodes to remove, so we don't confuse them.\n\t\tvnode.instance = []\n\t\tvar fragment = $doc.createDocumentFragment()\n\t\tvar child\n\t\twhile (child = temp.firstChild) {\n\t\t\tvnode.instance.push(child)\n\t\t\tfragment.appendChild(child)\n\t\t}\n\t\tinsertNode(parent, fragment, nextSibling)\n\t}\n\tfunction createFragment(parent, vnode, hooks, ns, nextSibling) {\n\t\tvar fragment = $doc.createDocumentFragment()\n\t\tif (vnode.children != null) {\n\t\t\tvar children = vnode.children\n\t\t\tcreateNodes(fragment, children, 0, children.length, hooks, null, ns)\n\t\t}\n\t\tvnode.dom = fragment.firstChild\n\t\tvnode.domSize = fragment.childNodes.length\n\t\tinsertNode(parent, fragment, nextSibling)\n\t}\n\tfunction createElement(parent, vnode, hooks, ns, nextSibling) {\n\t\tvar tag = vnode.tag\n\t\tvar attrs = vnode.attrs\n\t\tvar is = attrs && attrs.is\n\n\t\tns = getNameSpace(vnode) || ns\n\n\t\tvar element = ns ?\n\t\t\tis ? $doc.createElementNS(ns, tag, {is: is}) : $doc.createElementNS(ns, tag) :\n\t\t\tis ? $doc.createElement(tag, {is: is}) : $doc.createElement(tag)\n\t\tvnode.dom = element\n\n\t\tif (attrs != null) {\n\t\t\tsetAttrs(vnode, attrs, ns)\n\t\t}\n\n\t\tinsertNode(parent, element, nextSibling)\n\n\t\tif (!maybeSetContentEditable(vnode)) {\n\t\t\tif (vnode.text != null) {\n\t\t\t\tif (vnode.text !== \"\") element.textContent = vnode.text\n\t\t\t\telse vnode.children = [Vnode(\"#\", undefined, undefined, vnode.text, undefined, undefined)]\n\t\t\t}\n\t\t\tif (vnode.children != null) {\n\t\t\t\tvar children = vnode.children\n\t\t\t\tcreateNodes(element, children, 0, children.length, hooks, null, ns)\n\t\t\t\tif (vnode.tag === \"select\" && attrs != null) setLateSelectAttrs(vnode, attrs)\n\t\t\t}\n\t\t}\n\t}\n\tfunction initComponent(vnode, hooks) {\n\t\tvar sentinel\n\t\tif (typeof vnode.tag.view === \"function\") {\n\t\t\tvnode.state = Object.create(vnode.tag)\n\t\t\tsentinel = vnode.state.view\n\t\t\tif (sentinel.$$reentrantLock$$ != null) return\n\t\t\tsentinel.$$reentrantLock$$ = true\n\t\t} else {\n\t\t\tvnode.state = void 0\n\t\t\tsentinel = vnode.tag\n\t\t\tif (sentinel.$$reentrantLock$$ != null) return\n\t\t\tsentinel.$$reentrantLock$$ = true\n\t\t\tvnode.state = (vnode.tag.prototype != null && typeof vnode.tag.prototype.view === \"function\") ? new vnode.tag(vnode) : vnode.tag(vnode)\n\t\t}\n\t\tinitLifecycle(vnode.state, vnode, hooks)\n\t\tif (vnode.attrs != null) initLifecycle(vnode.attrs, vnode, hooks)\n\t\tvnode.instance = Vnode.normalize(callHook.call(vnode.state.view, vnode))\n\t\tif (vnode.instance === vnode) throw Error(\"A view cannot return the vnode it received as argument\")\n\t\tsentinel.$$reentrantLock$$ = null\n\t}\n\tfunction createComponent(parent, vnode, hooks, ns, nextSibling) {\n\t\tinitComponent(vnode, hooks)\n\t\tif (vnode.instance != null) {\n\t\t\tcreateNode(parent, vnode.instance, hooks, ns, nextSibling)\n\t\t\tvnode.dom = vnode.instance.dom\n\t\t\tvnode.domSize = vnode.dom != null ? vnode.instance.domSize : 0\n\t\t}\n\t\telse {\n\t\t\tvnode.domSize = 0\n\t\t}\n\t}\n\n\t//update\n\t/**\n\t * @param {Element|Fragment} parent - the parent element\n\t * @param {Vnode[] | null} old - the list of vnodes of the last `render()` call for\n\t * this part of the tree\n\t * @param {Vnode[] | null} vnodes - as above, but for the current `render()` call.\n\t * @param {Function[]} hooks - an accumulator of post-render hooks (oncreate/onupdate)\n\t * @param {Element | null} nextSibling - the next DOM node if we're dealing with a\n\t * fragment that is not the last item in its\n\t * parent\n\t * @param {'svg' | 'math' | String | null} ns) - the current XML namespace, if any\n\t * @returns void\n\t */\n\t// This function diffs and patches lists of vnodes, both keyed and unkeyed.\n\t//\n\t// We will:\n\t//\n\t// 1. describe its general structure\n\t// 2. focus on the diff algorithm optimizations\n\t// 3. discuss DOM node operations.\n\n\t// ## Overview:\n\t//\n\t// The updateNodes() function:\n\t// - deals with trivial cases\n\t// - determines whether the lists are keyed or unkeyed based on the first non-null node\n\t// of each list.\n\t// - diffs them and patches the DOM if needed (that's the brunt of the code)\n\t// - manages the leftovers: after diffing, are there:\n\t// - old nodes left to remove?\n\t// \t - new nodes to insert?\n\t// \t deal with them!\n\t//\n\t// The lists are only iterated over once, with an exception for the nodes in `old` that\n\t// are visited in the fourth part of the diff and in the `removeNodes` loop.\n\n\t// ## Diffing\n\t//\n\t// Reading https://github.com/localvoid/ivi/blob/ddc09d06abaef45248e6133f7040d00d3c6be853/packages/ivi/src/vdom/implementation.ts#L617-L837\n\t// may be good for context on longest increasing subsequence-based logic for moving nodes.\n\t//\n\t// In order to diff keyed lists, one has to\n\t//\n\t// 1) match nodes in both lists, per key, and update them accordingly\n\t// 2) create the nodes present in the new list, but absent in the old one\n\t// 3) remove the nodes present in the old list, but absent in the new one\n\t// 4) figure out what nodes in 1) to move in order to minimize the DOM operations.\n\t//\n\t// To achieve 1) one can create a dictionary of keys => index (for the old list), then iterate\n\t// over the new list and for each new vnode, find the corresponding vnode in the old list using\n\t// the map.\n\t// 2) is achieved in the same step: if a new node has no corresponding entry in the map, it is new\n\t// and must be created.\n\t// For the removals, we actually remove the nodes that have been updated from the old list.\n\t// The nodes that remain in that list after 1) and 2) have been performed can be safely removed.\n\t// The fourth step is a bit more complex and relies on the longest increasing subsequence (LIS)\n\t// algorithm.\n\t//\n\t// the longest increasing subsequence is the list of nodes that can remain in place. Imagine going\n\t// from `1,2,3,4,5` to `4,5,1,2,3` where the numbers are not necessarily the keys, but the indices\n\t// corresponding to the keyed nodes in the old list (keyed nodes `e,d,c,b,a` => `b,a,e,d,c` would\n\t// match the above lists, for example).\n\t//\n\t// In there are two increasing subsequences: `4,5` and `1,2,3`, the latter being the longest. We\n\t// can update those nodes without moving them, and only call `insertNode` on `4` and `5`.\n\t//\n\t// @localvoid adapted the algo to also support node deletions and insertions (the `lis` is actually\n\t// the longest increasing subsequence *of old nodes still present in the new list*).\n\t//\n\t// It is a general algorithm that is fireproof in all circumstances, but it requires the allocation\n\t// and the construction of a `key => oldIndex` map, and three arrays (one with `newIndex => oldIndex`,\n\t// the `LIS` and a temporary one to create the LIS).\n\t//\n\t// So we cheat where we can: if the tails of the lists are identical, they are guaranteed to be part of\n\t// the LIS and can be updated without moving them.\n\t//\n\t// If two nodes are swapped, they are guaranteed not to be part of the LIS, and must be moved (with\n\t// the exception of the last node if the list is fully reversed).\n\t//\n\t// ## Finding the next sibling.\n\t//\n\t// `updateNode()` and `createNode()` expect a nextSibling parameter to perform DOM operations.\n\t// When the list is being traversed top-down, at any index, the DOM nodes up to the previous\n\t// vnode reflect the content of the new list, whereas the rest of the DOM nodes reflect the old\n\t// list. The next sibling must be looked for in the old list using `getNextSibling(... oldStart + 1 ...)`.\n\t//\n\t// In the other scenarios (swaps, upwards traversal, map-based diff),\n\t// the new vnodes list is traversed upwards. The DOM nodes at the bottom of the list reflect the\n\t// bottom part of the new vnodes list, and we can use the `v.dom` value of the previous node\n\t// as the next sibling (cached in the `nextSibling` variable).\n\n\n\t// ## DOM node moves\n\t//\n\t// In most scenarios `updateNode()` and `createNode()` perform the DOM operations. However,\n\t// this is not the case if the node moved (second and fourth part of the diff algo). We move\n\t// the old DOM nodes before updateNode runs because it enables us to use the cached `nextSibling`\n\t// variable rather than fetching it using `getNextSibling()`.\n\t//\n\t// The fourth part of the diff currently inserts nodes unconditionally, leading to issues\n\t// like #1791 and #1999. We need to be smarter about those situations where adjascent old\n\t// nodes remain together in the new list in a way that isn't covered by parts one and\n\t// three of the diff algo.\n\n\tfunction updateNodes(parent, old, vnodes, hooks, nextSibling, ns) {\n\t\tif (old === vnodes || old == null && vnodes == null) return\n\t\telse if (old == null || old.length === 0) createNodes(parent, vnodes, 0, vnodes.length, hooks, nextSibling, ns)\n\t\telse if (vnodes == null || vnodes.length === 0) removeNodes(parent, old, 0, old.length)\n\t\telse {\n\t\t\tvar isOldKeyed = old[0] != null && old[0].key != null\n\t\t\tvar isKeyed = vnodes[0] != null && vnodes[0].key != null\n\t\t\tvar start = 0, oldStart = 0\n\t\t\tif (!isOldKeyed) while (oldStart < old.length && old[oldStart] == null) oldStart++\n\t\t\tif (!isKeyed) while (start < vnodes.length && vnodes[start] == null) start++\n\t\t\tif (isKeyed === null && isOldKeyed == null) return // both lists are full of nulls\n\t\t\tif (isOldKeyed !== isKeyed) {\n\t\t\t\tremoveNodes(parent, old, oldStart, old.length)\n\t\t\t\tcreateNodes(parent, vnodes, start, vnodes.length, hooks, nextSibling, ns)\n\t\t\t} else if (!isKeyed) {\n\t\t\t\t// Don't index past the end of either list (causes deopts).\n\t\t\t\tvar commonLength = old.length < vnodes.length ? old.length : vnodes.length\n\t\t\t\t// Rewind if necessary to the first non-null index on either side.\n\t\t\t\t// We could alternatively either explicitly create or remove nodes when `start !== oldStart`\n\t\t\t\t// but that would be optimizing for sparse lists which are more rare than dense ones.\n\t\t\t\tstart = start < oldStart ? start : oldStart\n\t\t\t\tfor (; start < commonLength; start++) {\n\t\t\t\t\to = old[start]\n\t\t\t\t\tv = vnodes[start]\n\t\t\t\t\tif (o === v || o == null && v == null) continue\n\t\t\t\t\telse if (o == null) createNode(parent, v, hooks, ns, getNextSibling(old, start + 1, nextSibling))\n\t\t\t\t\telse if (v == null) removeNode(parent, o)\n\t\t\t\t\telse updateNode(parent, o, v, hooks, getNextSibling(old, start + 1, nextSibling), ns)\n\t\t\t\t}\n\t\t\t\tif (old.length > commonLength) removeNodes(parent, old, start, old.length)\n\t\t\t\tif (vnodes.length > commonLength) createNodes(parent, vnodes, start, vnodes.length, hooks, nextSibling, ns)\n\t\t\t} else {\n\t\t\t\t// keyed diff\n\t\t\t\tvar oldEnd = old.length - 1, end = vnodes.length - 1, map, o, v, oe, ve, topSibling\n\n\t\t\t\t// bottom-up\n\t\t\t\twhile (oldEnd >= oldStart && end >= start) {\n\t\t\t\t\toe = old[oldEnd]\n\t\t\t\t\tve = vnodes[end]\n\t\t\t\t\tif (oe.key !== ve.key) break\n\t\t\t\t\tif (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)\n\t\t\t\t\tif (ve.dom != null) nextSibling = ve.dom\n\t\t\t\t\toldEnd--, end--\n\t\t\t\t}\n\t\t\t\t// top-down\n\t\t\t\twhile (oldEnd >= oldStart && end >= start) {\n\t\t\t\t\to = old[oldStart]\n\t\t\t\t\tv = vnodes[start]\n\t\t\t\t\tif (o.key !== v.key) break\n\t\t\t\t\toldStart++, start++\n\t\t\t\t\tif (o !== v) updateNode(parent, o, v, hooks, getNextSibling(old, oldStart, nextSibling), ns)\n\t\t\t\t}\n\t\t\t\t// swaps and list reversals\n\t\t\t\twhile (oldEnd >= oldStart && end >= start) {\n\t\t\t\t\tif (start === end) break\n\t\t\t\t\tif (o.key !== ve.key || oe.key !== v.key) break\n\t\t\t\t\ttopSibling = getNextSibling(old, oldStart, nextSibling)\n\t\t\t\t\tmoveNodes(parent, oe, topSibling)\n\t\t\t\t\tif (oe !== v) updateNode(parent, oe, v, hooks, topSibling, ns)\n\t\t\t\t\tif (++start <= --end) moveNodes(parent, o, nextSibling)\n\t\t\t\t\tif (o !== ve) updateNode(parent, o, ve, hooks, nextSibling, ns)\n\t\t\t\t\tif (ve.dom != null) nextSibling = ve.dom\n\t\t\t\t\toldStart++; oldEnd--\n\t\t\t\t\toe = old[oldEnd]\n\t\t\t\t\tve = vnodes[end]\n\t\t\t\t\to = old[oldStart]\n\t\t\t\t\tv = vnodes[start]\n\t\t\t\t}\n\t\t\t\t// bottom up once again\n\t\t\t\twhile (oldEnd >= oldStart && end >= start) {\n\t\t\t\t\tif (oe.key !== ve.key) break\n\t\t\t\t\tif (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)\n\t\t\t\t\tif (ve.dom != null) nextSibling = ve.dom\n\t\t\t\t\toldEnd--, end--\n\t\t\t\t\toe = old[oldEnd]\n\t\t\t\t\tve = vnodes[end]\n\t\t\t\t}\n\t\t\t\tif (start > end) removeNodes(parent, old, oldStart, oldEnd + 1)\n\t\t\t\telse if (oldStart > oldEnd) createNodes(parent, vnodes, start, end + 1, hooks, nextSibling, ns)\n\t\t\t\telse {\n\t\t\t\t\t// inspired by ivi https://github.com/ivijs/ivi/ by Boris Kaul\n\t\t\t\t\tvar originalNextSibling = nextSibling, vnodesLength = end - start + 1, oldIndices = new Array(vnodesLength), li=0, i=0, pos = 2147483647, matched = 0, map, lisIndices\n\t\t\t\t\tfor (i = 0; i < vnodesLength; i++) oldIndices[i] = -1\n\t\t\t\t\tfor (i = end; i >= start; i--) {\n\t\t\t\t\t\tif (map == null) map = getKeyMap(old, oldStart, oldEnd + 1)\n\t\t\t\t\t\tve = vnodes[i]\n\t\t\t\t\t\tvar oldIndex = map[ve.key]\n\t\t\t\t\t\tif (oldIndex != null) {\n\t\t\t\t\t\t\tpos = (oldIndex < pos) ? oldIndex : -1 // becomes -1 if nodes were re-ordered\n\t\t\t\t\t\t\toldIndices[i-start] = oldIndex\n\t\t\t\t\t\t\toe = old[oldIndex]\n\t\t\t\t\t\t\told[oldIndex] = null\n\t\t\t\t\t\t\tif (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)\n\t\t\t\t\t\t\tif (ve.dom != null) nextSibling = ve.dom\n\t\t\t\t\t\t\tmatched++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tnextSibling = originalNextSibling\n\t\t\t\t\tif (matched !== oldEnd - oldStart + 1) removeNodes(parent, old, oldStart, oldEnd + 1)\n\t\t\t\t\tif (matched === 0) createNodes(parent, vnodes, start, end + 1, hooks, nextSibling, ns)\n\t\t\t\t\telse {\n\t\t\t\t\t\tif (pos === -1) {\n\t\t\t\t\t\t\t// the indices of the indices of the items that are part of the\n\t\t\t\t\t\t\t// longest increasing subsequence in the oldIndices list\n\t\t\t\t\t\t\tlisIndices = makeLisIndices(oldIndices)\n\t\t\t\t\t\t\tli = lisIndices.length - 1\n\t\t\t\t\t\t\tfor (i = end; i >= start; i--) {\n\t\t\t\t\t\t\t\tv = vnodes[i]\n\t\t\t\t\t\t\t\tif (oldIndices[i-start] === -1) createNode(parent, v, hooks, ns, nextSibling)\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tif (lisIndices[li] === i - start) li--\n\t\t\t\t\t\t\t\t\telse moveNodes(parent, v, nextSibling)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (v.dom != null) nextSibling = vnodes[i].dom\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfor (i = end; i >= start; i--) {\n\t\t\t\t\t\t\t\tv = vnodes[i]\n\t\t\t\t\t\t\t\tif (oldIndices[i-start] === -1) createNode(parent, v, hooks, ns, nextSibling)\n\t\t\t\t\t\t\t\tif (v.dom != null) nextSibling = vnodes[i].dom\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfunction updateNode(parent, old, vnode, hooks, nextSibling, ns) {\n\t\tvar oldTag = old.tag, tag = vnode.tag\n\t\tif (oldTag === tag) {\n\t\t\tvnode.state = old.state\n\t\t\tvnode.events = old.events\n\t\t\tif (shouldNotUpdate(vnode, old)) return\n\t\t\tif (typeof oldTag === \"string\") {\n\t\t\t\tif (vnode.attrs != null) {\n\t\t\t\t\tupdateLifecycle(vnode.attrs, vnode, hooks)\n\t\t\t\t}\n\t\t\t\tswitch (oldTag) {\n\t\t\t\t\tcase \"#\": updateText(old, vnode); break\n\t\t\t\t\tcase \"<\": updateHTML(parent, old, vnode, ns, nextSibling); break\n\t\t\t\t\tcase \"[\": updateFragment(parent, old, vnode, hooks, nextSibling, ns); break\n\t\t\t\t\tdefault: updateElement(old, vnode, hooks, ns)\n\t\t\t\t}\n\t\t\t}\n\t\t\telse updateComponent(parent, old, vnode, hooks, nextSibling, ns)\n\t\t}\n\t\telse {\n\t\t\tremoveNode(parent, old)\n\t\t\tcreateNode(parent, vnode, hooks, ns, nextSibling)\n\t\t}\n\t}\n\tfunction updateText(old, vnode) {\n\t\tif (old.children.toString() !== vnode.children.toString()) {\n\t\t\told.dom.nodeValue = vnode.children\n\t\t}\n\t\tvnode.dom = old.dom\n\t}\n\tfunction updateHTML(parent, old, vnode, ns, nextSibling) {\n\t\tif (old.children !== vnode.children) {\n\t\t\tremoveHTML(parent, old)\n\t\t\tcreateHTML(parent, vnode, ns, nextSibling)\n\t\t}\n\t\telse {\n\t\t\tvnode.dom = old.dom\n\t\t\tvnode.domSize = old.domSize\n\t\t\tvnode.instance = old.instance\n\t\t}\n\t}\n\tfunction updateFragment(parent, old, vnode, hooks, nextSibling, ns) {\n\t\tupdateNodes(parent, old.children, vnode.children, hooks, nextSibling, ns)\n\t\tvar domSize = 0, children = vnode.children\n\t\tvnode.dom = null\n\t\tif (children != null) {\n\t\t\tfor (var i = 0; i < children.length; i++) {\n\t\t\t\tvar child = children[i]\n\t\t\t\tif (child != null && child.dom != null) {\n\t\t\t\t\tif (vnode.dom == null) vnode.dom = child.dom\n\t\t\t\t\tdomSize += child.domSize || 1\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (domSize !== 1) vnode.domSize = domSize\n\t\t}\n\t}\n\tfunction updateElement(old, vnode, hooks, ns) {\n\t\tvar element = vnode.dom = old.dom\n\t\tns = getNameSpace(vnode) || ns\n\n\t\tif (vnode.tag === \"textarea\") {\n\t\t\tif (vnode.attrs == null) vnode.attrs = {}\n\t\t\tif (vnode.text != null) {\n\t\t\t\tvnode.attrs.value = vnode.text //FIXME handle multiple children\n\t\t\t\tvnode.text = undefined\n\t\t\t}\n\t\t}\n\t\tupdateAttrs(vnode, old.attrs, vnode.attrs, ns)\n\t\tif (!maybeSetContentEditable(vnode)) {\n\t\t\tif (old.text != null && vnode.text != null && vnode.text !== \"\") {\n\t\t\t\tif (old.text.toString() !== vnode.text.toString()) old.dom.firstChild.nodeValue = vnode.text\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (old.text != null) old.children = [Vnode(\"#\", undefined, undefined, old.text, undefined, old.dom.firstChild)]\n\t\t\t\tif (vnode.text != null) vnode.children = [Vnode(\"#\", undefined, undefined, vnode.text, undefined, undefined)]\n\t\t\t\tupdateNodes(element, old.children, vnode.children, hooks, null, ns)\n\t\t\t}\n\t\t}\n\t}\n\tfunction updateComponent(parent, old, vnode, hooks, nextSibling, ns) {\n\t\tvnode.instance = Vnode.normalize(callHook.call(vnode.state.view, vnode))\n\t\tif (vnode.instance === vnode) throw Error(\"A view cannot return the vnode it received as argument\")\n\t\tupdateLifecycle(vnode.state, vnode, hooks)\n\t\tif (vnode.attrs != null) updateLifecycle(vnode.attrs, vnode, hooks)\n\t\tif (vnode.instance != null) {\n\t\t\tif (old.instance == null) createNode(parent, vnode.instance, hooks, ns, nextSibling)\n\t\t\telse updateNode(parent, old.instance, vnode.instance, hooks, nextSibling, ns)\n\t\t\tvnode.dom = vnode.instance.dom\n\t\t\tvnode.domSize = vnode.instance.domSize\n\t\t}\n\t\telse if (old.instance != null) {\n\t\t\tremoveNode(parent, old.instance)\n\t\t\tvnode.dom = undefined\n\t\t\tvnode.domSize = 0\n\t\t}\n\t\telse {\n\t\t\tvnode.dom = old.dom\n\t\t\tvnode.domSize = old.domSize\n\t\t}\n\t}\n\tfunction getKeyMap(vnodes, start, end) {\n\t\tvar map = Object.create(null)\n\t\tfor (; start < end; start++) {\n\t\t\tvar vnode = vnodes[start]\n\t\t\tif (vnode != null) {\n\t\t\t\tvar key = vnode.key\n\t\t\t\tif (key != null) map[key] = start\n\t\t\t}\n\t\t}\n\t\treturn map\n\t}\n\t// Lifted from ivi https://github.com/ivijs/ivi/\n\t// takes a list of unique numbers (-1 is special and can\n\t// occur multiple times) and returns an array with the indices\n\t// of the items that are part of the longest increasing\n\t// subsequece\n\tvar lisTemp = []\n\tfunction makeLisIndices(a) {\n\t\tvar result = [0]\n\t\tvar u = 0, v = 0, i = 0\n\t\tvar il = lisTemp.length = a.length\n\t\tfor (var i = 0; i < il; i++) lisTemp[i] = a[i]\n\t\tfor (var i = 0; i < il; ++i) {\n\t\t\tif (a[i] === -1) continue\n\t\t\tvar j = result[result.length - 1]\n\t\t\tif (a[j] < a[i]) {\n\t\t\t\tlisTemp[i] = j\n\t\t\t\tresult.push(i)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tu = 0\n\t\t\tv = result.length - 1\n\t\t\twhile (u < v) {\n\t\t\t\t// Fast integer average without overflow.\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tvar c = (u >>> 1) + (v >>> 1) + (u & v & 1)\n\t\t\t\tif (a[result[c]] < a[i]) {\n\t\t\t\t\tu = c + 1\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tv = c\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (a[i] < a[result[u]]) {\n\t\t\t\tif (u > 0) lisTemp[i] = result[u - 1]\n\t\t\t\tresult[u] = i\n\t\t\t}\n\t\t}\n\t\tu = result.length\n\t\tv = result[u - 1]\n\t\twhile (u-- > 0) {\n\t\t\tresult[u] = v\n\t\t\tv = lisTemp[v]\n\t\t}\n\t\tlisTemp.length = 0\n\t\treturn result\n\t}\n\n\tfunction getNextSibling(vnodes, i, nextSibling) {\n\t\tfor (; i < vnodes.length; i++) {\n\t\t\tif (vnodes[i] != null && vnodes[i].dom != null) return vnodes[i].dom\n\t\t}\n\t\treturn nextSibling\n\t}\n\n\t// This covers a really specific edge case:\n\t// - Parent node is keyed and contains child\n\t// - Child is removed, returns unresolved promise in `onbeforeremove`\n\t// - Parent node is moved in keyed diff\n\t// - Remaining children still need moved appropriately\n\t//\n\t// Ideally, I'd track removed nodes as well, but that introduces a lot more\n\t// complexity and I'm not exactly interested in doing that.\n\tfunction moveNodes(parent, vnode, nextSibling) {\n\t\tvar frag = $doc.createDocumentFragment()\n\t\tmoveChildToFrag(parent, frag, vnode)\n\t\tinsertNode(parent, frag, nextSibling)\n\t}\n\tfunction moveChildToFrag(parent, frag, vnode) {\n\t\t// Dodge the recursion overhead in a few of the most common cases.\n\t\twhile (vnode.dom != null && vnode.dom.parentNode === parent) {\n\t\t\tif (typeof vnode.tag !== \"string\") {\n\t\t\t\tvnode = vnode.instance\n\t\t\t\tif (vnode != null) continue\n\t\t\t} else if (vnode.tag === \"<\") {\n\t\t\t\tfor (var i = 0; i < vnode.instance.length; i++) {\n\t\t\t\t\tfrag.appendChild(vnode.instance[i])\n\t\t\t\t}\n\t\t\t} else if (vnode.tag !== \"[\") {\n\t\t\t\t// Don't recurse for text nodes *or* elements, just fragments\n\t\t\t\tfrag.appendChild(vnode.dom)\n\t\t\t} else if (vnode.children.length === 1) {\n\t\t\t\tvnode = vnode.children[0]\n\t\t\t\tif (vnode != null) continue\n\t\t\t} else {\n\t\t\t\tfor (var i = 0; i < vnode.children.length; i++) {\n\t\t\t\t\tvar child = vnode.children[i]\n\t\t\t\t\tif (child != null) moveChildToFrag(parent, frag, child)\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfunction insertNode(parent, dom, nextSibling) {\n\t\tif (nextSibling != null) parent.insertBefore(dom, nextSibling)\n\t\telse parent.appendChild(dom)\n\t}\n\n\tfunction maybeSetContentEditable(vnode) {\n\t\tif (vnode.attrs == null || (\n\t\t\tvnode.attrs.contenteditable == null && // attribute\n\t\t\tvnode.attrs.contentEditable == null // property\n\t\t)) return false\n\t\tvar children = vnode.children\n\t\tif (children != null && children.length === 1 && children[0].tag === \"<\") {\n\t\t\tvar content = children[0].children\n\t\t\tif (vnode.dom.innerHTML !== content) vnode.dom.innerHTML = content\n\t\t}\n\t\telse if (vnode.text != null || children != null && children.length !== 0) throw new Error(\"Child node of a contenteditable must be trusted\")\n\t\treturn true\n\t}\n\n\t//remove\n\tfunction removeNodes(parent, vnodes, start, end) {\n\t\tfor (var i = start; i < end; i++) {\n\t\t\tvar vnode = vnodes[i]\n\t\t\tif (vnode != null) removeNode(parent, vnode)\n\t\t}\n\t}\n\tfunction removeNode(parent, vnode) {\n\t\tvar mask = 0\n\t\tvar original = vnode.state\n\t\tvar stateResult, attrsResult\n\t\tif (typeof vnode.tag !== \"string\" && typeof vnode.state.onbeforeremove === \"function\") {\n\t\t\tvar result = callHook.call(vnode.state.onbeforeremove, vnode)\n\t\t\tif (result != null && typeof result.then === \"function\") {\n\t\t\t\tmask = 1\n\t\t\t\tstateResult = result\n\t\t\t}\n\t\t}\n\t\tif (vnode.attrs && typeof vnode.attrs.onbeforeremove === \"function\") {\n\t\t\tvar result = callHook.call(vnode.attrs.onbeforeremove, vnode)\n\t\t\tif (result != null && typeof result.then === \"function\") {\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tmask |= 2\n\t\t\t\tattrsResult = result\n\t\t\t}\n\t\t}\n\t\tcheckState(vnode, original)\n\n\t\t// If we can, try to fast-path it and avoid all the overhead of awaiting\n\t\tif (!mask) {\n\t\t\tonremove(vnode)\n\t\t\tremoveChild(parent, vnode)\n\t\t} else {\n\t\t\tif (stateResult != null) {\n\t\t\t\tvar next = function () {\n\t\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\t\tif (mask & 1) { mask &= 2; if (!mask) reallyRemove() }\n\t\t\t\t}\n\t\t\t\tstateResult.then(next, next)\n\t\t\t}\n\t\t\tif (attrsResult != null) {\n\t\t\t\tvar next = function () {\n\t\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\t\tif (mask & 2) { mask &= 1; if (!mask) reallyRemove() }\n\t\t\t\t}\n\t\t\t\tattrsResult.then(next, next)\n\t\t\t}\n\t\t}\n\n\t\tfunction reallyRemove() {\n\t\t\tcheckState(vnode, original)\n\t\t\tonremove(vnode)\n\t\t\tremoveChild(parent, vnode)\n\t\t}\n\t}\n\tfunction removeHTML(parent, vnode) {\n\t\tfor (var i = 0; i < vnode.instance.length; i++) {\n\t\t\tparent.removeChild(vnode.instance[i])\n\t\t}\n\t}\n\tfunction removeChild(parent, vnode) {\n\t\t// Dodge the recursion overhead in a few of the most common cases.\n\t\twhile (vnode.dom != null && vnode.dom.parentNode === parent) {\n\t\t\tif (typeof vnode.tag !== \"string\") {\n\t\t\t\tvnode = vnode.instance\n\t\t\t\tif (vnode != null) continue\n\t\t\t} else if (vnode.tag === \"<\") {\n\t\t\t\tremoveHTML(parent, vnode)\n\t\t\t} else {\n\t\t\t\tif (vnode.tag !== \"[\") {\n\t\t\t\t\tparent.removeChild(vnode.dom)\n\t\t\t\t\tif (!Array.isArray(vnode.children)) break\n\t\t\t\t}\n\t\t\t\tif (vnode.children.length === 1) {\n\t\t\t\t\tvnode = vnode.children[0]\n\t\t\t\t\tif (vnode != null) continue\n\t\t\t\t} else {\n\t\t\t\t\tfor (var i = 0; i < vnode.children.length; i++) {\n\t\t\t\t\t\tvar child = vnode.children[i]\n\t\t\t\t\t\tif (child != null) removeChild(parent, child)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\tfunction onremove(vnode) {\n\t\tif (typeof vnode.tag !== \"string\" && typeof vnode.state.onremove === \"function\") callHook.call(vnode.state.onremove, vnode)\n\t\tif (vnode.attrs && typeof vnode.attrs.onremove === \"function\") callHook.call(vnode.attrs.onremove, vnode)\n\t\tif (typeof vnode.tag !== \"string\") {\n\t\t\tif (vnode.instance != null) onremove(vnode.instance)\n\t\t} else {\n\t\t\tvar children = vnode.children\n\t\t\tif (Array.isArray(children)) {\n\t\t\t\tfor (var i = 0; i < children.length; i++) {\n\t\t\t\t\tvar child = children[i]\n\t\t\t\t\tif (child != null) onremove(child)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t//attrs\n\tfunction setAttrs(vnode, attrs, ns) {\n\t\tfor (var key in attrs) {\n\t\t\tsetAttr(vnode, key, null, attrs[key], ns)\n\t\t}\n\t}\n\tfunction setAttr(vnode, key, old, value, ns) {\n\t\tif (key === \"key\" || key === \"is\" || value == null || isLifecycleMethod(key) || (old === value && !isFormAttribute(vnode, key)) && typeof value !== \"object\") return\n\t\tif (key[0] === \"o\" && key[1] === \"n\") return updateEvent(vnode, key, value)\n\t\tif (key.slice(0, 6) === \"xlink:\") vnode.dom.setAttributeNS(\"http://www.w3.org/1999/xlink\", key.slice(6), value)\n\t\telse if (key === \"style\") updateStyle(vnode.dom, old, value)\n\t\telse if (hasPropertyKey(vnode, key, ns)) {\n\t\t\tif (key === \"value\") {\n\t\t\t\t// Only do the coercion if we're actually going to check the value.\n\t\t\t\t/* eslint-disable no-implicit-coercion */\n\t\t\t\t//setting input[value] to same value by typing on focused element moves cursor to end in Chrome\n\t\t\t\tif ((vnode.tag === \"input\" || vnode.tag === \"textarea\") && vnode.dom.value === \"\" + value && vnode.dom === activeElement()) return\n\t\t\t\t//setting select[value] to same value while having select open blinks select dropdown in Chrome\n\t\t\t\tif (vnode.tag === \"select\" && old !== null && vnode.dom.value === \"\" + value) return\n\t\t\t\t//setting option[value] to same value while having select open blinks select dropdown in Chrome\n\t\t\t\tif (vnode.tag === \"option\" && old !== null && vnode.dom.value === \"\" + value) return\n\t\t\t\t/* eslint-enable no-implicit-coercion */\n\t\t\t}\n\t\t\t// If you assign an input type that is not supported by IE 11 with an assignment expression, an error will occur.\n\t\t\tif (vnode.tag === \"input\" && key === \"type\") vnode.dom.setAttribute(key, value)\n\t\t\telse vnode.dom[key] = value\n\t\t} else {\n\t\t\tif (typeof value === \"boolean\") {\n\t\t\t\tif (value) vnode.dom.setAttribute(key, \"\")\n\t\t\t\telse vnode.dom.removeAttribute(key)\n\t\t\t}\n\t\t\telse vnode.dom.setAttribute(key === \"className\" ? \"class\" : key, value)\n\t\t}\n\t}\n\tfunction removeAttr(vnode, key, old, ns) {\n\t\tif (key === \"key\" || key === \"is\" || old == null || isLifecycleMethod(key)) return\n\t\tif (key[0] === \"o\" && key[1] === \"n\" && !isLifecycleMethod(key)) updateEvent(vnode, key, undefined)\n\t\telse if (key === \"style\") updateStyle(vnode.dom, old, null)\n\t\telse if (\n\t\t\thasPropertyKey(vnode, key, ns)\n\t\t\t&& key !== \"className\"\n\t\t\t&& !(key === \"value\" && (\n\t\t\t\tvnode.tag === \"option\"\n\t\t\t\t|| vnode.tag === \"select\" && vnode.dom.selectedIndex === -1 && vnode.dom === activeElement()\n\t\t\t))\n\t\t\t&& !(vnode.tag === \"input\" && key === \"type\")\n\t\t) {\n\t\t\tvnode.dom[key] = null\n\t\t} else {\n\t\t\tvar nsLastIndex = key.indexOf(\":\")\n\t\t\tif (nsLastIndex !== -1) key = key.slice(nsLastIndex + 1)\n\t\t\tif (old !== false) vnode.dom.removeAttribute(key === \"className\" ? \"class\" : key)\n\t\t}\n\t}\n\tfunction setLateSelectAttrs(vnode, attrs) {\n\t\tif (\"value\" in attrs) {\n\t\t\tif(attrs.value === null) {\n\t\t\t\tif (vnode.dom.selectedIndex !== -1) vnode.dom.value = null\n\t\t\t} else {\n\t\t\t\tvar normalized = \"\" + attrs.value // eslint-disable-line no-implicit-coercion\n\t\t\t\tif (vnode.dom.value !== normalized || vnode.dom.selectedIndex === -1) {\n\t\t\t\t\tvnode.dom.value = normalized\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (\"selectedIndex\" in attrs) setAttr(vnode, \"selectedIndex\", null, attrs.selectedIndex, undefined)\n\t}\n\tfunction updateAttrs(vnode, old, attrs, ns) {\n\t\tif (attrs != null) {\n\t\t\tfor (var key in attrs) {\n\t\t\t\tsetAttr(vnode, key, old && old[key], attrs[key], ns)\n\t\t\t}\n\t\t}\n\t\tvar val\n\t\tif (old != null) {\n\t\t\tfor (var key in old) {\n\t\t\t\tif (((val = old[key]) != null) && (attrs == null || attrs[key] == null)) {\n\t\t\t\t\tremoveAttr(vnode, key, val, ns)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfunction isFormAttribute(vnode, attr) {\n\t\treturn attr === \"value\" || attr === \"checked\" || attr === \"selectedIndex\" || attr === \"selected\" && vnode.dom === activeElement() || vnode.tag === \"option\" && vnode.dom.parentNode === $doc.activeElement\n\t}\n\tfunction isLifecycleMethod(attr) {\n\t\treturn attr === \"oninit\" || attr === \"oncreate\" || attr === \"onupdate\" || attr === \"onremove\" || attr === \"onbeforeremove\" || attr === \"onbeforeupdate\"\n\t}\n\tfunction hasPropertyKey(vnode, key, ns) {\n\t\t// Filter out namespaced keys\n\t\treturn ns === undefined && (\n\t\t\t// If it's a custom element, just keep it.\n\t\t\tvnode.tag.indexOf(\"-\") > -1 || vnode.attrs != null && vnode.attrs.is ||\n\t\t\t// If it's a normal element, let's try to avoid a few browser bugs.\n\t\t\tkey !== \"href\" && key !== \"list\" && key !== \"form\" && key !== \"width\" && key !== \"height\"// && key !== \"type\"\n\t\t\t// Defer the property check until *after* we check everything.\n\t\t) && key in vnode.dom\n\t}\n\n\t//style\n\tvar uppercaseRegex = /[A-Z]/g\n\tfunction toLowerCase(capital) { return \"-\" + capital.toLowerCase() }\n\tfunction normalizeKey(key) {\n\t\treturn key[0] === \"-\" && key[1] === \"-\" ? key :\n\t\t\tkey === \"cssFloat\" ? \"float\" :\n\t\t\t\tkey.replace(uppercaseRegex, toLowerCase)\n\t}\n\tfunction updateStyle(element, old, style) {\n\t\tif (old === style) {\n\t\t\t// Styles are equivalent, do nothing.\n\t\t} else if (style == null) {\n\t\t\t// New style is missing, just clear it.\n\t\t\telement.style.cssText = \"\"\n\t\t} else if (typeof style !== \"object\") {\n\t\t\t// New style is a string, let engine deal with patching.\n\t\t\telement.style.cssText = style\n\t\t} else if (old == null || typeof old !== \"object\") {\n\t\t\t// `old` is missing or a string, `style` is an object.\n\t\t\telement.style.cssText = \"\"\n\t\t\t// Add new style properties\n\t\t\tfor (var key in style) {\n\t\t\t\tvar value = style[key]\n\t\t\t\tif (value != null) element.style.setProperty(normalizeKey(key), String(value))\n\t\t\t}\n\t\t} else {\n\t\t\t// Both old & new are (different) objects.\n\t\t\t// Update style properties that have changed\n\t\t\tfor (var key in style) {\n\t\t\t\tvar value = style[key]\n\t\t\t\tif (value != null && (value = String(value)) !== String(old[key])) {\n\t\t\t\t\telement.style.setProperty(normalizeKey(key), value)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Remove style properties that no longer exist\n\t\t\tfor (var key in old) {\n\t\t\t\tif (old[key] != null && style[key] == null) {\n\t\t\t\t\telement.style.removeProperty(normalizeKey(key))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Here's an explanation of how this works:\n\t// 1. The event names are always (by design) prefixed by `on`.\n\t// 2. The EventListener interface accepts either a function or an object\n\t// with a `handleEvent` method.\n\t// 3. The object does not inherit from `Object.prototype`, to avoid\n\t// any potential interference with that (e.g. setters).\n\t// 4. The event name is remapped to the handler before calling it.\n\t// 5. In function-based event handlers, `ev.target === this`. We replicate\n\t// that below.\n\t// 6. In function-based event handlers, `return false` prevents the default\n\t// action and stops event propagation. We replicate that below.\n\tfunction EventDict() {\n\t\t// Save this, so the current redraw is correctly tracked.\n\t\tthis._ = currentRedraw\n\t}\n\tEventDict.prototype = Object.create(null)\n\tEventDict.prototype.handleEvent = function (ev) {\n\t\tvar handler = this[\"on\" + ev.type]\n\t\tvar result\n\t\tif (typeof handler === \"function\") result = handler.call(ev.currentTarget, ev)\n\t\telse if (typeof handler.handleEvent === \"function\") handler.handleEvent(ev)\n\t\tif (this._ && ev.redraw !== false) (0, this._)()\n\t\tif (result === false) {\n\t\t\tev.preventDefault()\n\t\t\tev.stopPropagation()\n\t\t}\n\t}\n\n\t//event\n\tfunction updateEvent(vnode, key, value) {\n\t\tif (vnode.events != null) {\n\t\t\tif (vnode.events[key] === value) return\n\t\t\tif (value != null && (typeof value === \"function\" || typeof value === \"object\")) {\n\t\t\t\tif (vnode.events[key] == null) vnode.dom.addEventListener(key.slice(2), vnode.events, false)\n\t\t\t\tvnode.events[key] = value\n\t\t\t} else {\n\t\t\t\tif (vnode.events[key] != null) vnode.dom.removeEventListener(key.slice(2), vnode.events, false)\n\t\t\t\tvnode.events[key] = undefined\n\t\t\t}\n\t\t} else if (value != null && (typeof value === \"function\" || typeof value === \"object\")) {\n\t\t\tvnode.events = new EventDict()\n\t\t\tvnode.dom.addEventListener(key.slice(2), vnode.events, false)\n\t\t\tvnode.events[key] = value\n\t\t}\n\t}\n\n\t//lifecycle\n\tfunction initLifecycle(source, vnode, hooks) {\n\t\tif (typeof source.oninit === \"function\") callHook.call(source.oninit, vnode)\n\t\tif (typeof source.oncreate === \"function\") hooks.push(callHook.bind(source.oncreate, vnode))\n\t}\n\tfunction updateLifecycle(source, vnode, hooks) {\n\t\tif (typeof source.onupdate === \"function\") hooks.push(callHook.bind(source.onupdate, vnode))\n\t}\n\tfunction shouldNotUpdate(vnode, old) {\n\t\tdo {\n\t\t\tif (vnode.attrs != null && typeof vnode.attrs.onbeforeupdate === \"function\") {\n\t\t\t\tvar force = callHook.call(vnode.attrs.onbeforeupdate, vnode, old)\n\t\t\t\tif (force !== undefined && !force) break\n\t\t\t}\n\t\t\tif (typeof vnode.tag !== \"string\" && typeof vnode.state.onbeforeupdate === \"function\") {\n\t\t\t\tvar force = callHook.call(vnode.state.onbeforeupdate, vnode, old)\n\t\t\t\tif (force !== undefined && !force) break\n\t\t\t}\n\t\t\treturn false\n\t\t} while (false); // eslint-disable-line no-constant-condition\n\t\tvnode.dom = old.dom\n\t\tvnode.domSize = old.domSize\n\t\tvnode.instance = old.instance\n\t\t// One would think having the actual latest attributes would be ideal,\n\t\t// but it doesn't let us properly diff based on our current internal\n\t\t// representation. We have to save not only the old DOM info, but also\n\t\t// the attributes used to create it, as we diff *that*, not against the\n\t\t// DOM directly (with a few exceptions in `setAttr`). And, of course, we\n\t\t// need to save the children and text as they are conceptually not\n\t\t// unlike special \"attributes\" internally.\n\t\tvnode.attrs = old.attrs\n\t\tvnode.children = old.children\n\t\tvnode.text = old.text\n\t\treturn true\n\t}\n\n\treturn function(dom, vnodes, redraw) {\n\t\tif (!dom) throw new TypeError(\"Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.\")\n\t\tvar hooks = []\n\t\tvar active = activeElement()\n\t\tvar namespace = dom.namespaceURI\n\n\t\t// First time rendering into a node clears it out\n\t\tif (dom.vnodes == null) dom.textContent = \"\"\n\n\t\tvnodes = Vnode.normalizeChildren(Array.isArray(vnodes) ? vnodes : [vnodes])\n\t\tvar prevRedraw = currentRedraw\n\t\ttry {\n\t\t\tcurrentRedraw = typeof redraw === \"function\" ? redraw : undefined\n\t\t\tupdateNodes(dom, dom.vnodes, vnodes, hooks, null, namespace === \"http://www.w3.org/1999/xhtml\" ? undefined : namespace)\n\t\t} finally {\n\t\t\tcurrentRedraw = prevRedraw\n\t\t}\n\t\tdom.vnodes = vnodes\n\t\t// `document.activeElement` can return null: https://html.spec.whatwg.org/multipage/interaction.html#dom-document-activeelement\n\t\tif (active != null && activeElement() !== active && typeof active.focus === \"function\") active.focus()\n\t\tfor (var i = 0; i < hooks.length; i++) hooks[i]()\n\t}\n}\n\n},{\"../render/vnode\":29}],28:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\n\nmodule.exports = function(html) {\n\tif (html == null) html = \"\"\n\treturn Vnode(\"<\", undefined, undefined, html, undefined, undefined)\n}\n\n},{\"../render/vnode\":29}],29:[function(require,module,exports){\n\"use strict\"\n\nfunction Vnode(tag, key, attrs, children, text, dom) {\n\treturn {tag: tag, key: key, attrs: attrs, children: children, text: text, dom: dom, domSize: undefined, state: undefined, events: undefined, instance: undefined}\n}\nVnode.normalize = function(node) {\n\tif (Array.isArray(node)) return Vnode(\"[\", undefined, undefined, Vnode.normalizeChildren(node), undefined, undefined)\n\tif (node == null || typeof node === \"boolean\") return null\n\tif (typeof node === \"object\") return node\n\treturn Vnode(\"#\", undefined, undefined, String(node), undefined, undefined)\n}\nVnode.normalizeChildren = function(input) {\n\tvar children = []\n\tif (input.length) {\n\t\tvar isKeyed = input[0] != null && input[0].key != null\n\t\t// Note: this is a *very* perf-sensitive check.\n\t\t// Fun fact: merging the loop like this is somehow faster than splitting\n\t\t// it, noticeably so.\n\t\tfor (var i = 1; i < input.length; i++) {\n\t\t\tif ((input[i] != null && input[i].key != null) !== isKeyed) {\n\t\t\t\tthrow new TypeError(\"Vnodes must either always have keys or never have keys!\")\n\t\t\t}\n\t\t}\n\t\tfor (var i = 0; i < input.length; i++) {\n\t\t\tchildren[i] = Vnode.normalize(input[i])\n\t\t}\n\t}\n\treturn children\n}\n\nmodule.exports = Vnode\n\n},{}],30:[function(require,module,exports){\n\"use strict\"\n\nvar PromisePolyfill = require(\"./promise/promise\")\nvar mountRedraw = require(\"./mount-redraw\")\n\nmodule.exports = require(\"./request/request\")(window, PromisePolyfill, mountRedraw.redraw)\n\n},{\"./mount-redraw\":14,\"./promise/promise\":20,\"./request/request\":31}],31:[function(require,module,exports){\n\"use strict\"\n\nvar buildPathname = require(\"../pathname/build\")\n\nmodule.exports = function($window, Promise, oncompletion) {\n\tvar callbackCount = 0\n\n\tfunction PromiseProxy(executor) {\n\t\treturn new Promise(executor)\n\t}\n\n\t// In case the global Promise is some userland library's where they rely on\n\t// `foo instanceof this.constructor`, `this.constructor.resolve(value)`, or\n\t// similar. Let's *not* break them.\n\tPromiseProxy.prototype = Promise.prototype\n\tPromiseProxy.__proto__ = Promise // eslint-disable-line no-proto\n\n\tfunction makeRequest(factory) {\n\t\treturn function(url, args) {\n\t\t\tif (typeof url !== \"string\") { args = url; url = url.url }\n\t\t\telse if (args == null) args = {}\n\t\t\tvar promise = new Promise(function(resolve, reject) {\n\t\t\t\tfactory(buildPathname(url, args.params), args, function (data) {\n\t\t\t\t\tif (typeof args.type === \"function\") {\n\t\t\t\t\t\tif (Array.isArray(data)) {\n\t\t\t\t\t\t\tfor (var i = 0; i < data.length; i++) {\n\t\t\t\t\t\t\t\tdata[i] = new args.type(data[i])\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse data = new args.type(data)\n\t\t\t\t\t}\n\t\t\t\t\tresolve(data)\n\t\t\t\t}, reject)\n\t\t\t})\n\t\t\tif (args.background === true) return promise\n\t\t\tvar count = 0\n\t\t\tfunction complete() {\n\t\t\t\tif (--count === 0 && typeof oncompletion === \"function\") oncompletion()\n\t\t\t}\n\n\t\t\treturn wrap(promise)\n\n\t\t\tfunction wrap(promise) {\n\t\t\t\tvar then = promise.then\n\t\t\t\t// Set the constructor, so engines know to not await or resolve\n\t\t\t\t// this as a native promise. At the time of writing, this is\n\t\t\t\t// only necessary for V8, but their behavior is the correct\n\t\t\t\t// behavior per spec. See this spec issue for more details:\n\t\t\t\t// https://github.com/tc39/ecma262/issues/1577. Also, see the\n\t\t\t\t// corresponding comment in `request/tests/test-request.js` for\n\t\t\t\t// a bit more background on the issue at hand.\n\t\t\t\tpromise.constructor = PromiseProxy\n\t\t\t\tpromise.then = function() {\n\t\t\t\t\tcount++\n\t\t\t\t\tvar next = then.apply(promise, arguments)\n\t\t\t\t\tnext.then(complete, function(e) {\n\t\t\t\t\t\tcomplete()\n\t\t\t\t\t\tif (count === 0) throw e\n\t\t\t\t\t})\n\t\t\t\t\treturn wrap(next)\n\t\t\t\t}\n\t\t\t\treturn promise\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction hasHeader(args, name) {\n\t\tfor (var key in args.headers) {\n\t\t\tif ({}.hasOwnProperty.call(args.headers, key) && name.test(key)) return true\n\t\t}\n\t\treturn false\n\t}\n\n\treturn {\n\t\trequest: makeRequest(function(url, args, resolve, reject) {\n\t\t\tvar method = args.method != null ? args.method.toUpperCase() : \"GET\"\n\t\t\tvar body = args.body\n\t\t\tvar assumeJSON = (args.serialize == null || args.serialize === JSON.serialize) && !(body instanceof $window.FormData)\n\t\t\tvar responseType = args.responseType || (typeof args.extract === \"function\" ? \"\" : \"json\")\n\n\t\t\tvar xhr = new $window.XMLHttpRequest(), aborted = false\n\t\t\tvar original = xhr, replacedAbort\n\t\t\tvar abort = xhr.abort\n\n\t\t\txhr.abort = function() {\n\t\t\t\taborted = true\n\t\t\t\tabort.call(this)\n\t\t\t}\n\n\t\t\txhr.open(method, url, args.async !== false, typeof args.user === \"string\" ? args.user : undefined, typeof args.password === \"string\" ? args.password : undefined)\n\n\t\t\tif (assumeJSON && body != null && !hasHeader(args, /^content-type$/i)) {\n\t\t\t\txhr.setRequestHeader(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\t\t}\n\t\t\tif (typeof args.deserialize !== \"function\" && !hasHeader(args, /^accept$/i)) {\n\t\t\t\txhr.setRequestHeader(\"Accept\", \"application/json, text/*\")\n\t\t\t}\n\t\t\tif (args.withCredentials) xhr.withCredentials = args.withCredentials\n\t\t\tif (args.timeout) xhr.timeout = args.timeout\n\t\t\txhr.responseType = responseType\n\n\t\t\tfor (var key in args.headers) {\n\t\t\t\tif ({}.hasOwnProperty.call(args.headers, key)) {\n\t\t\t\t\txhr.setRequestHeader(key, args.headers[key])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\txhr.onreadystatechange = function(ev) {\n\t\t\t\t// Don't throw errors on xhr.abort().\n\t\t\t\tif (aborted) return\n\n\t\t\t\tif (ev.target.readyState === 4) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar success = (ev.target.status >= 200 && ev.target.status < 300) || ev.target.status === 304 || (/^file:\\/\\//i).test(url)\n\t\t\t\t\t\t// When the response type isn't \"\" or \"text\",\n\t\t\t\t\t\t// `xhr.responseText` is the wrong thing to use.\n\t\t\t\t\t\t// Browsers do the right thing and throw here, and we\n\t\t\t\t\t\t// should honor that and do the right thing by\n\t\t\t\t\t\t// preferring `xhr.response` where possible/practical.\n\t\t\t\t\t\tvar response = ev.target.response, message\n\n\t\t\t\t\t\tif (responseType === \"json\") {\n\t\t\t\t\t\t\t// For IE and Edge, which don't implement\n\t\t\t\t\t\t\t// `responseType: \"json\"`.\n\t\t\t\t\t\t\tif (!ev.target.responseType && typeof args.extract !== \"function\") response = JSON.parse(ev.target.responseText)\n\t\t\t\t\t\t} else if (!responseType || responseType === \"text\") {\n\t\t\t\t\t\t\t// Only use this default if it's text. If a parsed\n\t\t\t\t\t\t\t// document is needed on old IE and friends (all\n\t\t\t\t\t\t\t// unsupported), the user should use a custom\n\t\t\t\t\t\t\t// `config` instead. They're already using this at\n\t\t\t\t\t\t\t// their own risk.\n\t\t\t\t\t\t\tif (response == null) response = ev.target.responseText\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (typeof args.extract === \"function\") {\n\t\t\t\t\t\t\tresponse = args.extract(ev.target, args)\n\t\t\t\t\t\t\tsuccess = true\n\t\t\t\t\t\t} else if (typeof args.deserialize === \"function\") {\n\t\t\t\t\t\t\tresponse = args.deserialize(response)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (success) resolve(response)\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\ttry { message = ev.target.responseText }\n\t\t\t\t\t\t\tcatch (e) { message = response }\n\t\t\t\t\t\t\tvar error = new Error(message)\n\t\t\t\t\t\t\terror.code = ev.target.status\n\t\t\t\t\t\t\terror.response = response\n\t\t\t\t\t\t\treject(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch (e) {\n\t\t\t\t\t\treject(e)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof args.config === \"function\") {\n\t\t\t\txhr = args.config(xhr, args, url) || xhr\n\n\t\t\t\t// Propagate the `abort` to any replacement XHR as well.\n\t\t\t\tif (xhr !== original) {\n\t\t\t\t\treplacedAbort = xhr.abort\n\t\t\t\t\txhr.abort = function() {\n\t\t\t\t\t\taborted = true\n\t\t\t\t\t\treplacedAbort.call(this)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (body == null) xhr.send()\n\t\t\telse if (typeof args.serialize === \"function\") xhr.send(args.serialize(body))\n\t\t\telse if (body instanceof $window.FormData) xhr.send(body)\n\t\t\telse xhr.send(JSON.stringify(body))\n\t\t}),\n\t\tjsonp: makeRequest(function(url, args, resolve, reject) {\n\t\t\tvar callbackName = args.callbackName || \"_mithril_\" + Math.round(Math.random() * 1e16) + \"_\" + callbackCount++\n\t\t\tvar script = $window.document.createElement(\"script\")\n\t\t\t$window[callbackName] = function(data) {\n\t\t\t\tdelete $window[callbackName]\n\t\t\t\tscript.parentNode.removeChild(script)\n\t\t\t\tresolve(data)\n\t\t\t}\n\t\t\tscript.onerror = function() {\n\t\t\t\tdelete $window[callbackName]\n\t\t\t\tscript.parentNode.removeChild(script)\n\t\t\t\treject(new Error(\"JSONP request failed\"))\n\t\t\t}\n\t\t\tscript.src = url + (url.indexOf(\"?\") < 0 ? \"?\" : \"&\") +\n\t\t\t\tencodeURIComponent(args.callbackKey || \"callback\") + \"=\" +\n\t\t\t\tencodeURIComponent(callbackName)\n\t\t\t$window.document.documentElement.appendChild(script)\n\t\t}),\n\t}\n}\n\n},{\"../pathname/build\":16}],32:[function(require,module,exports){\n\"use strict\"\n\nvar mountRedraw = require(\"./mount-redraw\")\n\nmodule.exports = require(\"./api/router\")(window, mountRedraw)\n\n},{\"./api/router\":11,\"./mount-redraw\":14}],33:[function(require,module,exports){\n// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n},{}],34:[function(require,module,exports){\n(function (setImmediate,clearImmediate){\nvar nextTick = require('process/browser.js').nextTick;\nvar apply = Function.prototype.apply;\nvar slice = Array.prototype.slice;\nvar immediateIds = {};\nvar nextImmediateId = 0;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n return new Timeout(apply.call(setInterval, window, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) { timeout.close(); };\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n this._clearFn.call(window, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n clearTimeout(item._idleTimeoutId);\n\n var msecs = item._idleTimeout;\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout)\n item._onTimeout();\n }, msecs);\n }\n};\n\n// That's not how node.js implements it but the exposed api is the same.\nexports.setImmediate = typeof setImmediate === \"function\" ? setImmediate : function(fn) {\n var id = nextImmediateId++;\n var args = arguments.length < 2 ? false : slice.call(arguments, 1);\n\n immediateIds[id] = true;\n\n nextTick(function onNextTick() {\n if (immediateIds[id]) {\n // fn.call() is faster so we optimize for the common use-case\n // @see http://jsperf.com/call-apply-segu\n if (args) {\n fn.apply(null, args);\n } else {\n fn.call(null);\n }\n // Prevent ids from leaking\n exports.clearImmediate(id);\n }\n });\n\n return id;\n};\n\nexports.clearImmediate = typeof clearImmediate === \"function\" ? clearImmediate : function(id) {\n delete immediateIds[id];\n};\n}).call(this,require(\"timers\").setImmediate,require(\"timers\").clearImmediate)\n},{\"process/browser.js\":33,\"timers\":34}],35:[function(require,module,exports){\nfunction tlite(getTooltipOpts) {\n document.addEventListener('mouseover', function (e) {\n var el = e.target;\n var opts = getTooltipOpts(el);\n\n if (!opts) {\n el = el.parentElement;\n opts = el && getTooltipOpts(el);\n }\n\n opts && tlite.show(el, opts, true);\n });\n}\n\ntlite.show = function (el, opts, isAuto) {\n var fallbackAttrib = 'data-tlite';\n opts = opts || {};\n\n (el.tooltip || Tooltip(el, opts)).show();\n\n function Tooltip(el, opts) {\n var tooltipEl;\n var showTimer;\n var text;\n\n el.addEventListener('mousedown', autoHide);\n el.addEventListener('mouseleave', autoHide);\n\n function show() {\n text = el.title || el.getAttribute(fallbackAttrib) || text;\n el.title = '';\n el.setAttribute(fallbackAttrib, '');\n text && !showTimer && (showTimer = setTimeout(fadeIn, isAuto ? 150 : 1))\n }\n\n function autoHide() {\n tlite.hide(el, true);\n }\n\n function hide(isAutoHiding) {\n if (isAuto === isAutoHiding) {\n showTimer = clearTimeout(showTimer);\n var parent = tooltipEl && tooltipEl.parentNode;\n parent && parent.removeChild(tooltipEl);\n tooltipEl = undefined;\n }\n }\n\n function fadeIn() {\n if (!tooltipEl) {\n tooltipEl = createTooltip(el, text, opts);\n }\n }\n\n return el.tooltip = {\n show: show,\n hide: hide\n };\n }\n\n function createTooltip(el, text, opts) {\n var tooltipEl = document.createElement('span');\n var grav = opts.grav || el.getAttribute('data-tlite') || 'n';\n\n tooltipEl.innerHTML = text;\n\n el.appendChild(tooltipEl);\n\n var vertGrav = grav[0] || '';\n var horzGrav = grav[1] || '';\n\n function positionTooltip() {\n tooltipEl.className = 'tlite ' + 'tlite-' + vertGrav + horzGrav;\n\n var arrowSize = 10;\n var top = el.offsetTop;\n var left = el.offsetLeft;\n\n if (tooltipEl.offsetParent === el) {\n top = left = 0;\n }\n\n var width = el.offsetWidth;\n var height = el.offsetHeight;\n var tooltipHeight = tooltipEl.offsetHeight;\n var tooltipWidth = tooltipEl.offsetWidth;\n var centerEl = left + (width / 2);\n\n tooltipEl.style.top = (\n vertGrav === 's' ? (top - tooltipHeight - arrowSize) :\n vertGrav === 'n' ? (top + height + arrowSize) :\n (top + (height / 2) - (tooltipHeight / 2))\n ) + 'px';\n\n tooltipEl.style.left = (\n horzGrav === 'w' ? left :\n horzGrav === 'e' ? left + width - tooltipWidth :\n vertGrav === 'w' ? (left + width + arrowSize) :\n vertGrav === 'e' ? (left - tooltipWidth - arrowSize) :\n (centerEl - tooltipWidth / 2)\n ) + 'px';\n }\n\n positionTooltip();\n\n var rect = tooltipEl.getBoundingClientRect();\n\n if (vertGrav === 's' && rect.top < 0) {\n vertGrav = 'n';\n positionTooltip();\n } else if (vertGrav === 'n' && rect.bottom > window.innerHeight) {\n vertGrav = 's';\n positionTooltip();\n } else if (vertGrav === 'e' && rect.left < 0) {\n vertGrav = 'w';\n positionTooltip();\n } else if (vertGrav === 'w' && rect.right > window.innerWidth) {\n vertGrav = 'e';\n positionTooltip();\n }\n\n tooltipEl.className += ' tlite-visible';\n\n return tooltipEl;\n }\n};\n\ntlite.hide = function (el, isAuto) {\n el.tooltip && el.tooltip.hide(isAuto);\n};\n\nif (typeof module !== 'undefined' && module.exports) {\n module.exports = tlite;\n}\n\n},{}]},{},[1]);\n })();"]}
|
assets/js/forms-admin.js
CHANGED
@@ -1,220 +1,248 @@
|
|
1 |
(function () { var require = undefined; var define = undefined; (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
2 |
'use strict';
|
3 |
|
4 |
-
var
|
5 |
-
var r = {};
|
6 |
-
|
7 |
-
r.showType = function (config) {
|
8 |
-
// ucfirst
|
9 |
-
var fieldType = config.type();
|
10 |
-
fieldType = fieldType.charAt(0).toUpperCase() + fieldType.slice(1);
|
11 |
-
return m('div', [m("label", i18n.fieldType), m('span', fieldType)]);
|
12 |
-
};
|
13 |
-
|
14 |
-
r.label = function (config) {
|
15 |
-
// label row
|
16 |
-
return m("div", [m("label", i18n.fieldLabel), m("input.widefat", {
|
17 |
-
type: "text",
|
18 |
-
value: config.label(),
|
19 |
-
onchange: m.withAttr('value', config.label),
|
20 |
-
placeholder: config.title()
|
21 |
-
})]);
|
22 |
-
};
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
r.numberMinMax = function (config) {
|
36 |
-
return m('div', [m('div.row', [m('div.col.col-3', [m('label', i18n.min), m('input', {
|
37 |
-
type: 'number',
|
38 |
-
onchange: m.withAttr('value', config.min)
|
39 |
-
})]), m('div.col.col-3', [m('label', i18n.max), m('input', {
|
40 |
-
type: 'number',
|
41 |
-
onchange: m.withAttr('value', config.max)
|
42 |
-
})])])]);
|
43 |
-
};
|
44 |
-
|
45 |
-
r.isRequired = function (config) {
|
46 |
-
var inputAtts = {
|
47 |
-
type: 'checkbox',
|
48 |
-
checked: config.required(),
|
49 |
-
onchange: m.withAttr('checked', config.required)
|
50 |
-
};
|
51 |
-
var desc;
|
52 |
-
|
53 |
-
if (config.forceRequired()) {
|
54 |
-
inputAtts.required = true;
|
55 |
-
inputAtts.disabled = true;
|
56 |
-
desc = m('p.help', i18n.forceRequired);
|
57 |
-
}
|
58 |
-
|
59 |
-
return m('div', [m('label.cb-wrap', [m('input', inputAtts), i18n.isFieldRequired]), desc]);
|
60 |
-
};
|
61 |
-
|
62 |
-
r.placeholder = function (config) {
|
63 |
-
return m("div", [m("label", [i18n.placeholder, " ", m('small', {
|
64 |
-
"style": "float: right; font-weight: normal;"
|
65 |
-
}, i18n.optional)]), m("input.widefat", {
|
66 |
-
type: "text",
|
67 |
-
value: config.placeholder(),
|
68 |
-
onchange: m.withAttr('value', config.placeholder),
|
69 |
-
placeholder: ""
|
70 |
-
}), m("p.help", i18n.placeholderHelp)]);
|
71 |
-
};
|
72 |
-
|
73 |
-
r.useParagraphs = function (config) {
|
74 |
-
return m('div', [m('label.cb-wrap', [m('input', {
|
75 |
-
type: 'checkbox',
|
76 |
-
checked: config.wrap(),
|
77 |
-
onchange: m.withAttr('checked', config.wrap)
|
78 |
-
}), i18n.wrapInParagraphTags])]);
|
79 |
-
};
|
80 |
-
|
81 |
-
r.choiceType = function (config) {
|
82 |
-
var options = [m('option', {
|
83 |
-
value: 'select',
|
84 |
-
selected: config.type() === 'select' ? 'selected' : false
|
85 |
-
}, i18n.dropdown), m('option', {
|
86 |
-
value: 'radio',
|
87 |
-
selected: config.type() === 'radio' ? 'selected' : false
|
88 |
-
}, i18n.radioButtons)]; // only add checkbox choice if field accepts multiple values
|
89 |
-
|
90 |
-
if (config.acceptsMultipleValues) {
|
91 |
-
options.push(m('option', {
|
92 |
-
value: 'checkbox',
|
93 |
-
selected: config.type() === 'checkbox' ? 'selected' : false
|
94 |
-
}, i18n.checkboxes));
|
95 |
-
}
|
96 |
-
|
97 |
-
return m('div', [m('label', i18n.choiceType), m('select', {
|
98 |
-
value: config.type(),
|
99 |
-
onchange: m.withAttr('value', config.type)
|
100 |
-
}, options)]);
|
101 |
-
};
|
102 |
-
|
103 |
-
r.choices = function (config) {
|
104 |
-
var html = [];
|
105 |
-
html.push(m('div', [m('label', i18n.choices), m('div.limit-height', [m("table", [// table body
|
106 |
-
config.choices().map(function (choice, index) {
|
107 |
-
return m('tr', {
|
108 |
-
'data-id': index
|
109 |
-
}, [m('td.cb', m('input', {
|
110 |
-
name: 'selected',
|
111 |
-
type: config.type() === 'checkbox' ? 'checkbox' : 'radio',
|
112 |
-
onchange: m.withAttr('value', config.selectChoice.bind(config)),
|
113 |
-
checked: choice.selected(),
|
114 |
-
value: choice.value(),
|
115 |
-
title: i18n.preselect
|
116 |
-
})), m('td.stretch', m('input.widefat', {
|
117 |
-
type: 'text',
|
118 |
-
value: choice.label(),
|
119 |
-
placeholder: choice.title(),
|
120 |
-
onchange: m.withAttr('value', choice.label)
|
121 |
-
})), m('td', m('span', {
|
122 |
-
"title": i18n.remove,
|
123 |
-
"class": 'dashicons dashicons-no-alt hover-activated',
|
124 |
-
"onclick": function (key) {
|
125 |
-
this.choices().splice(key, 1);
|
126 |
-
}.bind(config, index)
|
127 |
-
}, ''))]);
|
128 |
-
})]) // end of table
|
129 |
-
]) // end of limit-height div
|
130 |
-
]));
|
131 |
-
return html;
|
132 |
-
};
|
133 |
-
|
134 |
-
r.linkToTerms = function (config) {
|
135 |
-
// label row
|
136 |
-
return m("div", [m("label", i18n.agreeToTermsLink), m("input.widefat", {
|
137 |
-
type: "text",
|
138 |
-
value: config.link,
|
139 |
-
onchange: m.withAttr('value', config.link),
|
140 |
-
placeholder: 'https://...'
|
141 |
-
})]);
|
142 |
-
};
|
143 |
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
};
|
146 |
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
-
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
|
152 |
-
|
153 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
-
|
|
|
|
|
|
|
|
|
156 |
|
|
|
|
|
157 |
|
158 |
-
|
159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
-
|
162 |
-
|
|
|
|
|
|
|
|
|
163 |
}
|
|
|
|
|
164 |
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
|
|
|
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
|
173 |
-
|
174 |
-
|
|
|
|
|
|
|
|
|
|
|
175 |
|
176 |
-
|
177 |
-
|
178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
|
180 |
-
|
181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
|
183 |
-
|
184 |
-
|
185 |
-
|
|
|
186 |
|
187 |
-
|
188 |
|
189 |
-
|
190 |
-
visibleRows.push(rows.isRequired(config));
|
191 |
-
}
|
192 |
|
193 |
-
return visibleRows;
|
194 |
-
};
|
195 |
|
196 |
-
|
197 |
-
|
198 |
-
config.label('');
|
199 |
-
config.wrap(false);
|
200 |
-
return [rows.showType(config), rows.value(config)];
|
201 |
-
};
|
202 |
|
203 |
-
forms
|
204 |
-
config
|
205 |
-
|
206 |
-
return [rows.value(config), rows.useParagraphs(config)];
|
207 |
-
};
|
208 |
|
209 |
-
|
210 |
-
|
211 |
-
|
|
|
|
|
|
|
212 |
|
213 |
-
forms.number = function (config) {
|
214 |
-
return [forms.text(config), rows.numberMinMax(config)];
|
215 |
-
};
|
216 |
|
217 |
-
return forms;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
};
|
219 |
|
220 |
module.exports = forms;
|
@@ -224,6 +252,8 @@ module.exports = forms;
|
|
224 |
|
225 |
var htmlutil = require('html');
|
226 |
|
|
|
|
|
227 |
var setAttributes = function setAttributes(vnode) {
|
228 |
if (vnode.dom.checked) {
|
229 |
vnode.dom.setAttribute("checked", "true");
|
@@ -238,741 +268,744 @@ var setAttributes = function setAttributes(vnode) {
|
|
238 |
}
|
239 |
};
|
240 |
|
241 |
-
var
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
*/
|
248 |
-
|
249 |
-
generators['select'] = function (config) {
|
250 |
-
var attributes = {
|
251 |
-
name: config.name(),
|
252 |
-
required: config.required()
|
253 |
-
};
|
254 |
-
var hasSelection = false;
|
255 |
-
var options = config.choices().map(function (choice) {
|
256 |
-
if (choice.selected()) {
|
257 |
-
hasSelection = true;
|
258 |
-
}
|
259 |
-
|
260 |
-
return m('option', {
|
261 |
-
value: choice.value() !== choice.label() ? choice.value() : undefined,
|
262 |
-
"selected": choice.selected(),
|
263 |
-
oncreate: setAttributes
|
264 |
-
}, choice.label());
|
265 |
-
});
|
266 |
-
var placeholder = config.placeholder();
|
267 |
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
|
|
|
|
275 |
}
|
276 |
|
277 |
-
return m('
|
278 |
-
|
|
|
|
|
|
|
|
|
|
|
279 |
|
280 |
-
|
281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
|
283 |
-
|
284 |
-
|
285 |
-
href: config.link(),
|
286 |
-
target: "_blank"
|
287 |
-
}, config.label());
|
288 |
-
} else {
|
289 |
-
label = config.label();
|
290 |
-
}
|
291 |
|
292 |
-
|
293 |
-
|
294 |
-
type: 'checkbox',
|
295 |
-
value: config.value(),
|
296 |
-
required: config.required()
|
297 |
-
}), ' ', label]);
|
298 |
-
};
|
299 |
-
/**
|
300 |
-
* Generates a checkbox or radio type input field.
|
301 |
-
*
|
302 |
-
* @param config
|
303 |
-
* @returns {*}
|
304 |
-
*/
|
305 |
-
|
306 |
-
|
307 |
-
generators['checkbox'] = function (config) {
|
308 |
-
var fields = config.choices().map(function (choice) {
|
309 |
-
var name = config.name() + (config.type() === 'checkbox' ? '[]' : '');
|
310 |
-
var required = config.required() && config.type() === 'radio';
|
311 |
-
return m('label', [m('input', {
|
312 |
-
name: name,
|
313 |
-
type: config.type(),
|
314 |
-
value: choice.value(),
|
315 |
-
checked: choice.selected(),
|
316 |
-
required: required,
|
317 |
-
oncreate: setAttributes
|
318 |
-
}), ' ', m('span', choice.label())]);
|
319 |
-
});
|
320 |
-
return fields;
|
321 |
-
};
|
322 |
-
|
323 |
-
generators['radio'] = generators['checkbox'];
|
324 |
-
/**
|
325 |
-
* Generates a default field
|
326 |
-
*
|
327 |
-
* - text, url, number, email, date
|
328 |
-
*
|
329 |
-
* @param config
|
330 |
-
* @returns {*}
|
331 |
-
*/
|
332 |
-
|
333 |
-
generators['default'] = function (config) {
|
334 |
-
var attributes = {
|
335 |
-
type: config.type()
|
336 |
-
};
|
337 |
|
338 |
-
|
339 |
-
|
340 |
-
|
|
|
|
|
|
|
|
|
|
|
341 |
|
342 |
-
|
343 |
-
|
344 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
|
346 |
-
if (config.max()) {
|
347 |
-
attributes.max = config.max();
|
348 |
-
}
|
349 |
|
350 |
-
|
351 |
-
|
352 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
|
354 |
-
|
355 |
-
|
356 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
};
|
362 |
-
/**
|
363 |
-
* Generates an HTML string based on a field (config) object
|
364 |
-
*
|
365 |
-
* @param config
|
366 |
-
* @returns {*}
|
367 |
-
*/
|
368 |
|
|
|
|
|
|
|
369 |
|
370 |
-
|
371 |
-
|
|
|
372 |
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
|
377 |
-
|
378 |
-
|
|
|
379 |
|
380 |
-
|
381 |
-
|
382 |
}
|
383 |
|
384 |
-
|
|
|
|
|
385 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
|
387 |
-
module.exports = g;
|
388 |
-
|
389 |
-
},{"html":22}],4:[function(require,module,exports){
|
390 |
-
"use strict";
|
391 |
|
392 |
-
|
393 |
-
|
|
|
|
|
|
|
394 |
|
395 |
-
var
|
|
|
396 |
|
397 |
-
var
|
|
|
|
|
398 |
|
399 |
-
|
400 |
|
401 |
-
|
402 |
-
|
403 |
-
/**
|
404 |
-
* Choose a field to open the helper form for
|
405 |
-
*
|
406 |
-
* @param index
|
407 |
-
* @returns {*}
|
408 |
-
*/
|
409 |
|
410 |
-
|
411 |
-
fieldConfig = fields.get(index); // if this hidden field has choices (hidden groups), glue them together by their label.
|
412 |
|
413 |
-
|
414 |
-
fieldConfig.value(fieldConfig.choices().map(function (c) {
|
415 |
-
return c.label();
|
416 |
-
}).join('|'));
|
417 |
-
}
|
418 |
|
419 |
-
|
420 |
-
}
|
421 |
-
/**
|
422 |
-
* Controller
|
423 |
-
*/
|
424 |
|
|
|
425 |
|
426 |
-
|
427 |
-
/**
|
428 |
-
* Create HTML based on current config object
|
429 |
-
*/
|
430 |
|
|
|
431 |
|
432 |
-
|
433 |
-
// generate html
|
434 |
-
var html = generate(fieldConfig); // add to editor
|
435 |
|
436 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
|
438 |
-
|
|
|
439 |
|
440 |
-
|
|
|
|
|
|
|
441 |
}
|
442 |
-
/**
|
443 |
-
* View
|
444 |
-
* @returns {*}
|
445 |
-
*/
|
446 |
|
|
|
|
|
|
|
|
|
|
|
447 |
|
448 |
-
function view() {
|
449 |
-
// build DOM for fields choice
|
450 |
-
var fieldCategories = fields.getCategories();
|
451 |
-
var availableFields = fields.getAll();
|
452 |
-
var fieldsChoice = m("div.available-fields.small-margin", [m("h4", i18n.chooseField), fieldCategories.map(function (category) {
|
453 |
-
var categoryFields = availableFields.filter(function (f) {
|
454 |
-
return f.category === category;
|
455 |
-
});
|
456 |
-
|
457 |
-
if (!categoryFields.length) {
|
458 |
-
return;
|
459 |
-
}
|
460 |
-
|
461 |
-
return m("div.tiny-margin", [m("strong", category), // render fields
|
462 |
-
categoryFields.map(function (field) {
|
463 |
-
var className = "button";
|
464 |
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
|
469 |
-
|
470 |
|
471 |
-
|
472 |
-
className += " " + (inForm ? 'in-form' : 'not-in-form');
|
473 |
-
}
|
474 |
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
})]);
|
482 |
-
})]); // build DOM for overlay
|
483 |
|
484 |
-
var form = null;
|
485 |
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
type: "button",
|
495 |
-
onkeydown: function onkeydown(e) {
|
496 |
-
e = e || window.event;
|
497 |
|
498 |
-
|
499 |
-
|
500 |
-
}
|
501 |
-
},
|
502 |
-
onclick: createFieldHTMLAndAddToForm
|
503 |
-
}, i18n.addToForm)])]), setActiveField));
|
504 |
}
|
505 |
|
506 |
-
return [
|
507 |
-
|
|
|
508 |
|
|
|
|
|
|
|
509 |
|
510 |
-
|
511 |
-
view: view,
|
512 |
-
controller: controller
|
513 |
-
};
|
514 |
-
};
|
515 |
-
|
516 |
-
module.exports = FieldHelper;
|
517 |
|
518 |
-
|
519 |
-
"
|
|
|
520 |
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
}
|
553 |
-
}
|
554 |
-
/**
|
555 |
-
* Normalizes the field type which is passed by Mailchimp
|
556 |
-
*
|
557 |
-
* @param type
|
558 |
-
* @returns {*}
|
559 |
-
*/
|
560 |
-
|
561 |
-
|
562 |
-
function getFieldType(type) {
|
563 |
-
var map = {
|
564 |
-
'phone': 'tel',
|
565 |
-
'dropdown': 'select',
|
566 |
-
'checkboxes': 'checkbox',
|
567 |
-
'birthday': 'text'
|
568 |
-
};
|
569 |
-
return typeof map[type] !== "undefined" ? map[type] : type;
|
570 |
}
|
571 |
-
/**
|
572 |
-
* Register the various fields for a merge var
|
573 |
-
*
|
574 |
-
* @param mergeField
|
575 |
-
* @returns {boolean}
|
576 |
-
*/
|
577 |
|
|
|
|
|
578 |
|
579 |
-
|
580 |
-
var category = i18n.listFields;
|
581 |
-
var fieldType = getFieldType(mergeField.field_type); // name, type, title, value, required, label, placeholder, choices, wrap
|
582 |
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
type: fieldType,
|
589 |
-
choices: mergeField.choices,
|
590 |
-
acceptsMultipleValues: false // merge fields never accept multiple values.
|
591 |
|
592 |
-
|
|
|
593 |
|
594 |
-
|
595 |
-
register(category, data, false);
|
596 |
-
} else {
|
597 |
-
register(category, {
|
598 |
-
name: data.name + '[addr1]',
|
599 |
-
type: 'text',
|
600 |
-
mailchimpType: 'address',
|
601 |
-
title: i18n.streetAddress
|
602 |
-
}, false);
|
603 |
-
register(category, {
|
604 |
-
name: data.name + '[city]',
|
605 |
-
type: 'text',
|
606 |
-
mailchimpType: 'address',
|
607 |
-
title: i18n.city
|
608 |
-
}, false);
|
609 |
-
register(category, {
|
610 |
-
name: data.name + '[state]',
|
611 |
-
type: 'text',
|
612 |
-
mailchimpType: 'address',
|
613 |
-
title: i18n.state
|
614 |
-
}, false);
|
615 |
-
register(category, {
|
616 |
-
name: data.name + '[zip]',
|
617 |
-
type: 'text',
|
618 |
-
mailchimpType: 'address',
|
619 |
-
title: i18n.zip
|
620 |
-
}, false);
|
621 |
-
register(category, {
|
622 |
-
name: data.name + '[country]',
|
623 |
-
type: 'select',
|
624 |
-
mailchimpType: 'address',
|
625 |
-
title: i18n.country,
|
626 |
-
choices: mc4wp_vars.countries
|
627 |
-
}, false);
|
628 |
-
}
|
629 |
|
630 |
-
|
631 |
-
}
|
632 |
-
/**
|
633 |
-
* Register a field for a Mailchimp grouping
|
634 |
-
*
|
635 |
-
* @param interestCategory
|
636 |
-
*/
|
637 |
-
|
638 |
-
|
639 |
-
function registerInterestCategory(interestCategory) {
|
640 |
-
var category = i18n.interestCategories;
|
641 |
-
var fieldType = getFieldType(interestCategory.field_type);
|
642 |
-
var data = {
|
643 |
-
title: interestCategory.name,
|
644 |
-
name: 'INTERESTS[' + interestCategory.id + ']',
|
645 |
-
type: fieldType,
|
646 |
-
choices: interestCategory.interests,
|
647 |
-
acceptsMultipleValues: fieldType === 'checkbox'
|
648 |
-
};
|
649 |
-
register(category, data, false);
|
650 |
-
}
|
651 |
-
/**
|
652 |
-
* Register all fields belonging to a list
|
653 |
-
*
|
654 |
-
* @param list
|
655 |
-
*/
|
656 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
657 |
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
return -1;
|
663 |
-
}
|
664 |
|
665 |
-
|
666 |
-
|
667 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
668 |
|
669 |
-
return 0;
|
670 |
-
}); // loop through merge vars
|
671 |
|
672 |
-
|
|
|
673 |
|
674 |
-
|
|
|
675 |
}
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
|
|
|
|
681 |
|
682 |
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
687 |
|
688 |
-
function registerCustomFields(lists) {
|
689 |
-
var choices;
|
690 |
-
var category = i18n.formFields; // register submit button
|
691 |
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
type: "submit",
|
696 |
-
title: i18n.submitButton
|
697 |
-
}, true); // register lists choice field
|
698 |
|
699 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
700 |
|
701 |
-
|
702 |
-
choices[lists[key].id] = lists[key].name;
|
703 |
-
}
|
704 |
|
|
|
|
|
|
|
705 |
register(category, {
|
706 |
-
name: '
|
707 |
-
type: '
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
acceptsMultipleValues: true
|
712 |
-
}, true);
|
713 |
-
choices = {
|
714 |
-
'subscribe': "Subscribe",
|
715 |
-
'unsubscribe': "Unsubscribe"
|
716 |
-
};
|
717 |
register(category, {
|
718 |
-
name: '
|
719 |
-
type: '
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
help: i18n.formActionDescription
|
724 |
-
}, true);
|
725 |
register(category, {
|
726 |
-
name: '
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
734 |
}
|
735 |
-
|
736 |
-
|
737 |
-
|
|
|
|
|
|
|
|
|
|
|
738 |
|
739 |
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
|
|
|
|
|
|
|
|
|
|
744 |
};
|
745 |
-
|
746 |
-
|
747 |
-
|
|
|
|
|
|
|
|
|
748 |
|
749 |
-
},{}],6:[function(require,module,exports){
|
750 |
-
'use strict';
|
751 |
|
752 |
-
|
|
|
|
|
|
|
|
|
|
|
753 |
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
var categories = [];
|
758 |
-
/**
|
759 |
-
* @internal
|
760 |
-
*
|
761 |
-
*
|
762 |
-
* @param data
|
763 |
-
* @constructor
|
764 |
-
*/
|
765 |
-
|
766 |
-
var Field = function Field(data) {
|
767 |
-
this.name = prop(data.name);
|
768 |
-
this.title = prop(data.title || data.name);
|
769 |
-
this.type = prop(data.type);
|
770 |
-
this.mailchimpType = prop(data.mailchimpType || '');
|
771 |
-
this.label = prop(data.label || data.title || '');
|
772 |
-
this.showLabel = prop(data.showLabel !== undefined ? data.showLabel : true);
|
773 |
-
this.value = prop(data.value || '');
|
774 |
-
this.placeholder = prop(data.placeholder || '');
|
775 |
-
this.required = prop(data.required || false);
|
776 |
-
this.forceRequired = prop(data.forceRequired || false);
|
777 |
-
this.wrap = prop(data.wrap !== undefined ? data.wrap : true);
|
778 |
-
this.min = prop(data.min || null);
|
779 |
-
this.max = prop(data.max || null);
|
780 |
-
this.help = prop(data.help || '');
|
781 |
-
this.choices = prop(data.choices || []);
|
782 |
-
this.inFormContent = prop(null);
|
783 |
-
this.acceptsMultipleValues = data.acceptsMultipleValues;
|
784 |
-
this.link = prop(data.link || '');
|
785 |
-
|
786 |
-
this.selectChoice = function (value) {
|
787 |
-
var field = this;
|
788 |
-
this.choices(this.choices().map(function (choice) {
|
789 |
-
if (choice.value() === value) {
|
790 |
-
choice.selected(true);
|
791 |
-
} else {
|
792 |
-
// only checkboxes allow for multiple selections
|
793 |
-
if (field.type() !== 'checkbox') {
|
794 |
-
choice.selected(false);
|
795 |
-
}
|
796 |
-
}
|
797 |
|
798 |
-
|
799 |
-
|
800 |
-
};
|
801 |
-
};
|
802 |
-
/**
|
803 |
-
* @internal
|
804 |
-
*
|
805 |
-
* @param data
|
806 |
-
* @constructor
|
807 |
-
*/
|
808 |
|
|
|
809 |
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
* Creates FieldChoice objects from an (associative) array of data objects
|
818 |
-
*
|
819 |
-
* @param data
|
820 |
-
* @returns {Array}
|
821 |
-
*/
|
822 |
|
823 |
|
824 |
-
|
825 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
826 |
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
842 |
|
843 |
-
return choices;
|
844 |
-
}
|
845 |
-
/**
|
846 |
-
* Factory method
|
847 |
-
*
|
848 |
-
* @api
|
849 |
-
*
|
850 |
-
* @param data
|
851 |
-
* @returns {Field}
|
852 |
-
*/
|
853 |
|
|
|
|
|
|
|
854 |
|
855 |
-
|
856 |
-
|
857 |
-
var existingField = getAllWhere('name', data.name).shift(); // a field with the same "name" already exists
|
858 |
|
859 |
-
|
860 |
-
// update "required" status
|
861 |
-
if (!existingField.forceRequired() && data.forceRequired) {
|
862 |
-
existingField.forceRequired(true);
|
863 |
-
} // bail
|
864 |
|
|
|
|
|
|
|
|
|
865 |
|
866 |
-
|
867 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
868 |
|
869 |
|
870 |
-
|
871 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
872 |
|
873 |
-
if (data.value) {
|
874 |
-
data.choices = data.choices.map(function (choice) {
|
875 |
-
if (choice.value() === data.value) {
|
876 |
-
choice.selected(true);
|
877 |
-
}
|
878 |
|
879 |
-
|
880 |
-
|
881 |
-
}
|
882 |
-
} // register category
|
883 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
884 |
|
885 |
-
if (categories.indexOf(category) < 0) {
|
886 |
-
categories.push(category);
|
887 |
-
} // create Field object
|
888 |
|
|
|
|
|
|
|
889 |
|
890 |
-
|
891 |
-
|
|
|
|
|
|
|
892 |
|
893 |
-
fields.push(field); // redraw view
|
894 |
|
895 |
-
|
896 |
-
|
897 |
|
898 |
-
events.trigger('fields.change');
|
899 |
-
return field;
|
900 |
-
}
|
901 |
-
/**
|
902 |
-
* @api
|
903 |
-
*
|
904 |
-
* @param field
|
905 |
-
*/
|
906 |
|
|
|
|
|
907 |
|
908 |
-
|
909 |
-
|
|
|
|
|
|
|
910 |
|
911 |
-
|
912 |
-
|
913 |
-
m.redraw();
|
914 |
}
|
915 |
-
}
|
916 |
-
/**
|
917 |
-
* Get a field config object
|
918 |
-
*
|
919 |
-
* @param name
|
920 |
-
* @returns {*}
|
921 |
-
*/
|
922 |
|
923 |
|
924 |
-
|
925 |
-
|
926 |
-
}
|
927 |
-
/**
|
928 |
-
* Get all field config objects
|
929 |
-
*
|
930 |
-
* @returns {Array|*}
|
931 |
-
*/
|
932 |
|
933 |
|
934 |
-
|
935 |
-
|
936 |
-
fields = fields.map(function (f, i) {
|
937 |
-
f.index = i;
|
938 |
-
return f;
|
939 |
-
});
|
940 |
-
return fields;
|
941 |
-
}
|
942 |
|
943 |
-
|
944 |
-
|
945 |
-
}
|
946 |
-
/**
|
947 |
-
* Get all fields where a property matches the given value
|
948 |
-
*
|
949 |
-
* @param searchKey
|
950 |
-
* @param searchValue
|
951 |
-
* @returns {Array|*}
|
952 |
-
*/
|
953 |
|
|
|
|
|
954 |
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
959 |
}
|
960 |
-
|
961 |
-
|
962 |
-
|
|
|
|
|
|
|
|
|
963 |
|
964 |
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
973 |
};
|
974 |
|
975 |
-
},{"mithril
|
976 |
'use strict'; // load CodeMirror & plugins
|
977 |
|
978 |
var CodeMirror = require('codemirror');
|
@@ -1027,15 +1060,6 @@ function updatePreview() {
|
|
1027 |
previewDom.dispatchEvent(new Event('mc4wp-refresh'));
|
1028 |
}
|
1029 |
|
1030 |
-
window.addEventListener('load', function () {
|
1031 |
-
CodeMirror.signal(editor, "change");
|
1032 |
-
}); // set domDirty to true everytime the "change" event fires (a lot..)
|
1033 |
-
|
1034 |
-
element.addEventListener('change', function () {
|
1035 |
-
domDirty = true;
|
1036 |
-
updatePreview();
|
1037 |
-
});
|
1038 |
-
|
1039 |
function dom() {
|
1040 |
if (domDirty) {
|
1041 |
_dom.innerHTML = FormEditor.getValue().toLowerCase();
|
@@ -1082,121 +1106,161 @@ FormEditor.refresh = function () {
|
|
1082 |
/* bootstrap */
|
1083 |
|
1084 |
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
selectionPointer: true,
|
1090 |
-
mode: "htmlmixed",
|
1091 |
-
htmlMode: true,
|
1092 |
-
autoCloseTags: true,
|
1093 |
-
autoRefresh: true,
|
1094 |
-
styleActiveLine: true,
|
1095 |
-
matchBrackets: true,
|
1096 |
-
matchTags: {
|
1097 |
-
bothTags: true
|
1098 |
-
}
|
1099 |
-
}); // dispatch regular "change" on element event every time editor changes (IE9+ only)
|
1100 |
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
var event = new Event('change', {
|
1105 |
-
bubbles: true
|
1106 |
-
});
|
1107 |
-
element.dispatchEvent(event);
|
1108 |
-
}
|
1109 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1110 |
}
|
1111 |
|
1112 |
-
previewFrame
|
1113 |
-
|
1114 |
-
|
|
|
1115 |
|
1116 |
module.exports = FormEditor;
|
1117 |
|
1118 |
-
},{"codemirror":
|
1119 |
-
|
1120 |
|
1121 |
-
var
|
1122 |
-
'use strict';
|
1123 |
|
1124 |
-
|
1125 |
|
1126 |
-
|
1127 |
-
fields.getAll().forEach(function (field) {
|
1128 |
-
// don't run for empty field names
|
1129 |
-
if (field.name().length <= 0) return;
|
1130 |
-
var fieldName = field.name();
|
1131 |
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
|
1136 |
-
|
1137 |
-
|
|
|
|
|
|
|
1138 |
|
1139 |
-
|
1140 |
-
|
|
|
1141 |
|
1142 |
-
|
1143 |
|
1144 |
-
|
1145 |
-
|
1146 |
-
field.originalRequiredValue = field.forceRequired();
|
1147 |
-
}
|
1148 |
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
|
|
|
|
1152 |
}
|
|
|
|
|
|
|
|
|
1153 |
}
|
1154 |
-
}
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
|
|
1158 |
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
|
1173 |
|
1174 |
-
|
1175 |
|
1176 |
-
|
1177 |
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
|
1187 |
-
|
1188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1189 |
|
|
|
1190 |
|
1191 |
-
|
1192 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1193 |
};
|
1194 |
|
1195 |
-
module.exports =
|
1196 |
|
1197 |
-
},{}],
|
1198 |
'use strict';
|
1199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1200 |
var notices = {};
|
1201 |
|
1202 |
function show(id, text) {
|
@@ -1228,170 +1292,203 @@ function render() {
|
|
1228 |
container.innerHTML = html;
|
1229 |
}
|
1230 |
|
1231 |
-
function
|
1232 |
-
var
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
};
|
1237 |
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
|
1250 |
-
|
1251 |
-
|
1252 |
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
|
1260 |
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
}
|
1270 |
|
1271 |
-
module
|
1272 |
-
|
1273 |
-
};
|
1274 |
|
1275 |
-
|
1276 |
-
"use strict";
|
1277 |
|
1278 |
-
var
|
1279 |
-
'use strict';
|
1280 |
|
1281 |
-
|
|
|
|
|
1282 |
|
1283 |
-
function
|
1284 |
-
document.
|
1285 |
-
window.
|
|
|
1286 |
|
1287 |
-
|
|
|
|
|
1288 |
}
|
1289 |
|
1290 |
-
function
|
1291 |
-
|
|
|
1292 |
|
1293 |
-
|
|
|
|
|
1294 |
close();
|
1295 |
} // prevent ENTER
|
1296 |
|
1297 |
|
1298 |
-
if (
|
1299 |
-
|
1300 |
}
|
1301 |
}
|
1302 |
|
1303 |
-
function
|
1304 |
-
|
1305 |
-
|
1306 |
var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
1307 |
var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
1308 |
-
var marginLeft = (windowWidth -
|
1309 |
-
var marginTop = (windowHeight -
|
1310 |
-
|
1311 |
-
|
1312 |
}
|
1313 |
|
1314 |
-
function
|
1315 |
-
|
1316 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1317 |
}
|
1318 |
|
1319 |
-
return
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
document.addEventListener('keydown', onKeyDown);
|
1324 |
-
window.addEventListener('resize', position);
|
1325 |
-
},
|
1326 |
-
onremove: function onremove() {
|
1327 |
-
document.removeEventListener('keydown', onKeyDown);
|
1328 |
-
window.removeEventListener('resize', position);
|
1329 |
-
},
|
1330 |
-
view: function view() {
|
1331 |
-
return [m('div.overlay-wrap', m("div.overlay", {
|
1332 |
-
oncreate: storeElementReference
|
1333 |
-
}, [// close icon
|
1334 |
-
m('span', {
|
1335 |
-
"class": 'close dashicons dashicons-no',
|
1336 |
-
title: i18n.close,
|
1337 |
-
onclick: close
|
1338 |
-
}), content])), m('div.overlay-background', {
|
1339 |
-
title: i18n.close,
|
1340 |
-
onclick: close
|
1341 |
-
})];
|
1342 |
-
}
|
1343 |
-
};
|
1344 |
};
|
1345 |
-
}
|
|
|
|
|
1346 |
|
1347 |
-
module
|
|
|
1348 |
|
1349 |
-
}
|
1350 |
-
'use strict'; // deps
|
1351 |
|
1352 |
-
var
|
1353 |
-
var
|
1354 |
-
var
|
1355 |
-
var
|
1356 |
-
var
|
1357 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1358 |
|
1359 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1360 |
|
1361 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1362 |
|
1363 |
-
|
|
|
|
|
|
|
|
|
|
|
1364 |
|
1365 |
-
|
|
|
|
|
|
|
1366 |
|
1367 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1368 |
|
|
|
|
|
1369 |
|
1370 |
-
var editor =
|
1371 |
-
var watcher = new FormWatcher(m, formEditor, settings, fields, events, helpers);
|
1372 |
-
var fieldHelper = new FieldHelper(m, tabs, formEditor, fields, events, i18n);
|
1373 |
|
1374 |
-
|
1375 |
|
|
|
1376 |
|
1377 |
-
|
1378 |
|
1379 |
-
|
1380 |
-
events.on('selectedLists.change', fieldsFactory.registerListsFields);
|
1381 |
-
fieldsFactory.registerListsFields(settings.getSelectedLists());
|
1382 |
-
fieldsFactory.registerCustomFields(mc4wp_vars.mailchimp.lists);
|
1383 |
-
window.setTimeout(function () {
|
1384 |
-
m.redraw();
|
1385 |
-
}, 2000); // init notices
|
1386 |
|
1387 |
-
notices.init(editor, fields, settings); // expose some methods
|
1388 |
|
1389 |
-
window.mc4wp = window.mc4wp || {};
|
1390 |
window.mc4wp.forms = window.mc4wp.forms || {};
|
1391 |
window.mc4wp.forms.editor = editor;
|
1392 |
-
window.mc4wp.forms.fields = fields;
|
1393 |
|
1394 |
-
},{"./admin/form-editor/field-helper.js":4,"./admin/form-editor/
|
1395 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
1396 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
1397 |
|
@@ -1454,22 +1551,23 @@ window.mc4wp.forms.fields = fields;
|
|
1454 |
if (!ranges[i].empty()) return CodeMirror.Pass;
|
1455 |
var pos = ranges[i].head, tok = cm.getTokenAt(pos);
|
1456 |
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
|
1457 |
-
|
|
|
|
|
1458 |
|
1459 |
var html = inner.mode.configuration == "html";
|
1460 |
var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose);
|
1461 |
var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent);
|
1462 |
|
1463 |
-
var tagName = state.tagName;
|
1464 |
if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);
|
1465 |
var lowerTagName = tagName.toLowerCase();
|
1466 |
// Don't process the '>' at the end of an end-tag or self-closing tag
|
1467 |
if (!tagName ||
|
1468 |
tok.type == "string" && (tok.end != pos.ch || !/[\"\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) ||
|
1469 |
-
tok.type == "tag" &&
|
1470 |
tok.string.indexOf("/") == (tok.string.length - 1) || // match something like <someTagName />
|
1471 |
dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 ||
|
1472 |
-
closingTagExists(cm, tagName, pos,
|
1473 |
return CodeMirror.Pass;
|
1474 |
|
1475 |
var emptyTags = typeof opt == "object" && opt.emptyTags;
|
@@ -1514,19 +1612,16 @@ window.mc4wp.forms.fields = fields;
|
|
1514 |
// when completing in JS/CSS snippet in htmlmixed mode. Does not
|
1515 |
// work for other XML embedded languages (there is no general
|
1516 |
// way to go from a mixed mode to its current XML state).
|
1517 |
-
var replacement
|
1518 |
-
if (inner.mode.name
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
replacement = head + "style";
|
1523 |
-
else
|
1524 |
-
return CodeMirror.Pass;
|
1525 |
} else {
|
1526 |
-
|
1527 |
-
|
1528 |
return CodeMirror.Pass;
|
1529 |
-
replacement = head +
|
1530 |
}
|
1531 |
if (cm.getLine(pos.line).charAt(tok.end) != ">") replacement += ">";
|
1532 |
replacements[i] = replacement;
|
@@ -1556,16 +1651,19 @@ window.mc4wp.forms.fields = fields;
|
|
1556 |
|
1557 |
// If xml-fold is loaded, we use its functionality to try and verify
|
1558 |
// whether a given tag is actually unclosed.
|
1559 |
-
function closingTagExists(cm, tagName, pos,
|
1560 |
if (!CodeMirror.scanForClosingTag) return false;
|
1561 |
var end = Math.min(cm.lastLine() + 1, pos.line + 500);
|
1562 |
var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end);
|
1563 |
if (!nextClose || nextClose.tag != tagName) return false;
|
1564 |
-
var cx = state.context;
|
1565 |
// If the immediate wrapping context contains onCx instances of
|
1566 |
// the same tag, a closing tag only exists if there are at least
|
1567 |
// that many closing tags of that type following.
|
1568 |
-
|
|
|
|
|
|
|
|
|
1569 |
pos = nextClose.to;
|
1570 |
for (var i = 1; i < onCx; i++) {
|
1571 |
var next = CodeMirror.scanForClosingTag(cm, pos, null, end);
|
@@ -1576,7 +1674,7 @@ window.mc4wp.forms.fields = fields;
|
|
1576 |
}
|
1577 |
});
|
1578 |
|
1579 |
-
},{"../../lib/codemirror":
|
1580 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
1581 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
1582 |
|
@@ -1728,7 +1826,7 @@ window.mc4wp.forms.fields = fields;
|
|
1728 |
});
|
1729 |
});
|
1730 |
|
1731 |
-
},{"../../lib/codemirror":
|
1732 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
1733 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
1734 |
|
@@ -1796,7 +1894,7 @@ window.mc4wp.forms.fields = fields;
|
|
1796 |
};
|
1797 |
});
|
1798 |
|
1799 |
-
},{"../../lib/codemirror":
|
1800 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
1801 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
1802 |
|
@@ -1982,7 +2080,7 @@ window.mc4wp.forms.fields = fields;
|
|
1982 |
};
|
1983 |
});
|
1984 |
|
1985 |
-
},{"../../lib/codemirror":
|
1986 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
1987 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
1988 |
|
@@ -2056,7 +2154,7 @@ window.mc4wp.forms.fields = fields;
|
|
2056 |
}
|
2057 |
});
|
2058 |
|
2059 |
-
},{"../../lib/codemirror":
|
2060 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2061 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
2062 |
|
@@ -4343,7 +4441,7 @@ window.mc4wp.forms.fields = fields;
|
|
4343 |
function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
|
4344 |
function paddingH(display) {
|
4345 |
if (display.cachedPaddingH) { return display.cachedPaddingH }
|
4346 |
-
var e = removeChildrenAndAdd(display.measure, elt("pre", "x"));
|
4347 |
var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
|
4348 |
var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
|
4349 |
if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }
|
@@ -4737,7 +4835,7 @@ window.mc4wp.forms.fields = fields;
|
|
4737 |
function PosWithInfo(line, ch, sticky, outside, xRel) {
|
4738 |
var pos = Pos(line, ch, sticky);
|
4739 |
pos.xRel = xRel;
|
4740 |
-
if (outside) { pos.outside =
|
4741 |
return pos
|
4742 |
}
|
4743 |
|
@@ -4746,16 +4844,16 @@ window.mc4wp.forms.fields = fields;
|
|
4746 |
function coordsChar(cm, x, y) {
|
4747 |
var doc = cm.doc;
|
4748 |
y += cm.display.viewOffset;
|
4749 |
-
if (y < 0) { return PosWithInfo(doc.first, 0, null,
|
4750 |
var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
|
4751 |
if (lineN > last)
|
4752 |
-
{ return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null,
|
4753 |
if (x < 0) { x = 0; }
|
4754 |
|
4755 |
var lineObj = getLine(doc, lineN);
|
4756 |
for (;;) {
|
4757 |
var found = coordsCharInner(cm, lineObj, lineN, x, y);
|
4758 |
-
var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));
|
4759 |
if (!collapsed) { return found }
|
4760 |
var rangeEnd = collapsed.find(1);
|
4761 |
if (rangeEnd.line == lineN) { return rangeEnd }
|
@@ -4843,7 +4941,7 @@ window.mc4wp.forms.fields = fields;
|
|
4843 |
// base X position
|
4844 |
var coords = cursorCoords(cm, Pos(lineNo$$1, ch, sticky), "line", lineObj, preparedMeasure);
|
4845 |
baseX = coords.left;
|
4846 |
-
outside = y < coords.top
|
4847 |
}
|
4848 |
|
4849 |
ch = skipExtendingChars(lineObj.text, ch, 1);
|
@@ -4912,7 +5010,7 @@ window.mc4wp.forms.fields = fields;
|
|
4912 |
function textHeight(display) {
|
4913 |
if (display.cachedTextHeight != null) { return display.cachedTextHeight }
|
4914 |
if (measureText == null) {
|
4915 |
-
measureText = elt("pre");
|
4916 |
// Measure a bunch of lines, for browsers that compute
|
4917 |
// fractional heights.
|
4918 |
for (var i = 0; i < 49; ++i) {
|
@@ -4932,7 +5030,7 @@ window.mc4wp.forms.fields = fields;
|
|
4932 |
function charWidth(display) {
|
4933 |
if (display.cachedCharWidth != null) { return display.cachedCharWidth }
|
4934 |
var anchor = elt("span", "xxxxxxxxxx");
|
4935 |
-
var pre = elt("pre", [anchor]);
|
4936 |
removeChildrenAndAdd(display.measure, pre);
|
4937 |
var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
|
4938 |
if (width > 2) { display.cachedCharWidth = width; }
|
@@ -7206,8 +7304,15 @@ window.mc4wp.forms.fields = fields;
|
|
7206 |
var line = getLine(doc, pos.line);
|
7207 |
if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
|
7208 |
var sp = line.markedSpans[i], m = sp.marker;
|
7209 |
-
|
7210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7211 |
if (mayClear) {
|
7212 |
signal(m, "beforeCursorEnter");
|
7213 |
if (m.explicitlyCleared) {
|
@@ -7219,14 +7324,14 @@ window.mc4wp.forms.fields = fields;
|
|
7219 |
|
7220 |
if (oldPos) {
|
7221 |
var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);
|
7222 |
-
if (dir < 0 ?
|
7223 |
{ near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }
|
7224 |
if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
|
7225 |
{ return skipAtomicInner(doc, near, pos, dir, mayClear) }
|
7226 |
}
|
7227 |
|
7228 |
var far = m.find(dir < 0 ? -1 : 1);
|
7229 |
-
if (dir < 0 ?
|
7230 |
{ far = movePos(doc, far, dir, far.line == pos.line ? line : null); }
|
7231 |
return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
|
7232 |
}
|
@@ -7455,6 +7560,9 @@ window.mc4wp.forms.fields = fields;
|
|
7455 |
if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }
|
7456 |
else { updateDoc(doc, change, spans); }
|
7457 |
setSelectionNoUndo(doc, selAfter, sel_dontScroll);
|
|
|
|
|
|
|
7458 |
}
|
7459 |
|
7460 |
// Handle the interaction of a change to a document with the editor
|
@@ -9759,7 +9867,7 @@ window.mc4wp.forms.fields = fields;
|
|
9759 |
for (var i = newBreaks.length - 1; i >= 0; i--)
|
9760 |
{ replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }
|
9761 |
});
|
9762 |
-
option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g, function (cm, val, old) {
|
9763 |
cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
|
9764 |
if (old != Init) { cm.refresh(); }
|
9765 |
});
|
@@ -11708,7 +11816,7 @@ window.mc4wp.forms.fields = fields;
|
|
11708 |
textarea.style.display = "";
|
11709 |
if (textarea.form) {
|
11710 |
off(textarea.form, "submit", save);
|
11711 |
-
if (typeof textarea.form.submit == "function")
|
11712 |
{ textarea.form.submit = realSubmit; }
|
11713 |
}
|
11714 |
};
|
@@ -11807,13 +11915,13 @@ window.mc4wp.forms.fields = fields;
|
|
11807 |
|
11808 |
addLegacyProps(CodeMirror);
|
11809 |
|
11810 |
-
CodeMirror.version = "5.
|
11811 |
|
11812 |
return CodeMirror;
|
11813 |
|
11814 |
})));
|
11815 |
|
11816 |
-
},{}],
|
11817 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
11818 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
11819 |
|
@@ -12646,7 +12754,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
|
|
12646 |
|
12647 |
});
|
12648 |
|
12649 |
-
},{"../../lib/codemirror":
|
12650 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
12651 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
12652 |
|
@@ -12800,7 +12908,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
|
|
12800 |
CodeMirror.defineMIME("text/html", "htmlmixed");
|
12801 |
});
|
12802 |
|
12803 |
-
},{"../../lib/codemirror":
|
12804 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
12805 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
12806 |
|
@@ -12870,7 +12978,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|
12870 |
if (ch == '"' || ch == "'") {
|
12871 |
state.tokenize = tokenString(ch);
|
12872 |
return state.tokenize(stream, state);
|
12873 |
-
} else if (ch == "." && stream.match(/^\d
|
12874 |
return ret("number", "number");
|
12875 |
} else if (ch == "." && stream.match("..")) {
|
12876 |
return ret("spread", "meta");
|
@@ -12878,10 +12986,10 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|
12878 |
return ret(ch);
|
12879 |
} else if (ch == "=" && stream.eat(">")) {
|
12880 |
return ret("=>", "operator");
|
12881 |
-
} else if (ch == "0" && stream.match(/^(?:x[\
|
12882 |
return ret("number", "number");
|
12883 |
} else if (/\d/.test(ch)) {
|
12884 |
-
stream.match(
|
12885 |
return ret("number", "number");
|
12886 |
} else if (ch == "/") {
|
12887 |
if (stream.eat("*")) {
|
@@ -12904,6 +13012,9 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|
12904 |
} else if (ch == "#") {
|
12905 |
stream.skipToEnd();
|
12906 |
return ret("error", "error");
|
|
|
|
|
|
|
12907 |
} else if (isOperatorChar.test(ch)) {
|
12908 |
if (ch != ">" || !state.lexical || state.lexical.type != ">") {
|
12909 |
if (stream.eat("=")) {
|
@@ -12998,8 +13109,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|
12998 |
++depth;
|
12999 |
} else if (wordRE.test(ch)) {
|
13000 |
sawSomething = true;
|
13001 |
-
} else if (/["'
|
13002 |
-
|
|
|
|
|
|
|
|
|
13003 |
} else if (sawSomething && !depth) {
|
13004 |
++pos;
|
13005 |
break;
|
@@ -13377,10 +13492,13 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|
13377 |
}
|
13378 |
function maybetype(type, value) {
|
13379 |
if (isTS) {
|
13380 |
-
if (type == ":"
|
13381 |
if (value == "?") return cont(maybetype);
|
13382 |
}
|
13383 |
}
|
|
|
|
|
|
|
13384 |
function mayberettype(type) {
|
13385 |
if (isTS && type == ":") {
|
13386 |
if (cx.stream.match(/^\s*\w+\s+is\b/, false)) return cont(expression, isKW, typeexpr)
|
@@ -13421,7 +13539,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|
13421 |
} else if (type == ":") {
|
13422 |
return cont(typeexpr)
|
13423 |
} else if (type == "[") {
|
13424 |
-
return cont(expect("variable"),
|
13425 |
} else if (type == "(") {
|
13426 |
return pass(functiondecl, typeprop)
|
13427 |
}
|
@@ -13722,7 +13840,7 @@ CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript
|
|
13722 |
|
13723 |
});
|
13724 |
|
13725 |
-
},{"../../lib/codemirror":
|
13726 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
13727 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
13728 |
|
@@ -14115,6 +14233,17 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
|
14115 |
skipAttribute: function(state) {
|
14116 |
if (state.state == attrValueState)
|
14117 |
state.state = attrState
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14118 |
}
|
14119 |
};
|
14120 |
});
|
@@ -14126,7 +14255,7 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
|
|
14126 |
|
14127 |
});
|
14128 |
|
14129 |
-
},{"../../lib/codemirror":
|
14130 |
/*
|
14131 |
|
14132 |
Style HTML
|
@@ -14663,173 +14792,2374 @@ function style_html(html_source, options) {
|
|
14663 |
module.exports = {
|
14664 |
prettyPrint: style_html
|
14665 |
};
|
14666 |
-
},{}],
|
14667 |
"use strict"
|
14668 |
|
14669 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14670 |
|
14671 |
-
},{"
|
14672 |
-
|
14673 |
-
;(function() {
|
14674 |
"use strict"
|
14675 |
-
/* eslint-enable */
|
14676 |
|
14677 |
-
var
|
14678 |
-
|
14679 |
-
|
14680 |
-
|
14681 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14682 |
}
|
14683 |
-
initStream(stream)
|
14684 |
|
14685 |
-
|
14686 |
|
14687 |
-
|
14688 |
-
|
14689 |
-
function
|
14690 |
-
|
14691 |
-
|
14692 |
-
|
14693 |
-
|
14694 |
-
|
14695 |
-
|
14696 |
-
|
14697 |
-
if (
|
14698 |
-
|
14699 |
-
|
14700 |
-
if (value === true) {
|
14701 |
-
unregisterStream(stream)
|
14702 |
-
endStream._state.unregister = function(){unregisterStream(endStream)}
|
14703 |
-
}
|
14704 |
-
return value
|
14705 |
-
})
|
14706 |
-
stream._state.endStream = endStream
|
14707 |
}
|
14708 |
-
return
|
14709 |
-
|
14710 |
-
|
14711 |
-
|
14712 |
-
|
14713 |
-
|
14714 |
-
|
14715 |
-
|
14716 |
-
|
14717 |
-
|
14718 |
-
function updateState(stream, value) {
|
14719 |
-
stream._state.value = value
|
14720 |
-
stream._state.changed = true
|
14721 |
-
if (stream._state.state !== 2) stream._state.state = 1
|
14722 |
-
}
|
14723 |
-
function updateDependency(stream, mustSync) {
|
14724 |
-
var state = stream._state, parents = state.parents
|
14725 |
-
if (parents.length > 0 && parents.every(active) && (mustSync || parents.some(changed))) {
|
14726 |
-
var value = stream._state.derive()
|
14727 |
-
if (value === HALT) return false
|
14728 |
-
updateState(stream, value)
|
14729 |
-
}
|
14730 |
-
}
|
14731 |
-
function finalize(stream) {
|
14732 |
-
stream._state.changed = false
|
14733 |
-
for (var id in stream._state.deps) stream._state.deps[id]._state.changed = false
|
14734 |
-
}
|
14735 |
|
14736 |
-
|
14737 |
-
if (!streams.every(valid)) throw new Error("Ensure that each item passed to stream.combine/stream.merge is a stream")
|
14738 |
-
return initDependency(createStream(), streams, function() {
|
14739 |
-
return fn.apply(this, streams.concat([streams.filter(changed)]))
|
14740 |
-
})
|
14741 |
-
}
|
14742 |
|
14743 |
-
|
14744 |
-
|
14745 |
-
|
14746 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14747 |
|
14748 |
-
|
14749 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14750 |
|
14751 |
-
|
14752 |
-
|
14753 |
-
|
14754 |
-
|
14755 |
-
|
14756 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14757 |
}
|
14758 |
-
|
14759 |
-
|
14760 |
-
|
14761 |
-
|
14762 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14763 |
}
|
14764 |
-
|
14765 |
-
|
14766 |
-
var index = dependent._state.parents.indexOf(stream)
|
14767 |
-
if (index > -1) dependent._state.parents.splice(index, 1)
|
14768 |
}
|
14769 |
-
|
14770 |
-
|
14771 |
}
|
14772 |
|
14773 |
-
|
14774 |
-
|
14775 |
-
|
14776 |
-
function toJSON() {return this._state.value != null && typeof this._state.value.toJSON === "function" ? this._state.value.toJSON() : this._state.value}
|
14777 |
|
14778 |
-
|
14779 |
-
function active(stream) {return stream._state.state === 1}
|
14780 |
-
function changed(stream) {return stream._state.changed}
|
14781 |
-
function notEnded(stream) {return stream._state.state !== 2}
|
14782 |
|
14783 |
-
|
14784 |
-
|
14785 |
-
|
14786 |
-
|
14787 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14788 |
|
14789 |
-
|
14790 |
-
var newStream = combine(function (s) {
|
14791 |
-
return seed = reducer(seed, s._state.value)
|
14792 |
-
}, [stream])
|
14793 |
|
14794 |
-
|
|
|
14795 |
|
14796 |
-
|
|
|
14797 |
}
|
14798 |
|
14799 |
-
function
|
14800 |
-
|
14801 |
-
var stream = tuple[0]
|
14802 |
-
if (stream._state.state === 0) stream(undefined)
|
14803 |
-
return stream
|
14804 |
-
})
|
14805 |
|
14806 |
-
|
14807 |
-
|
14808 |
|
14809 |
-
|
14810 |
-
|
14811 |
-
|
14812 |
-
|
14813 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14814 |
|
14815 |
-
|
14816 |
-
|
14817 |
|
14818 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14835 |
})();
|
1 |
(function () { var require = undefined; var define = undefined; (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
2 |
'use strict';
|
3 |
|
4 |
+
var i18n = window.mc4wp_forms_i18n;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
var m = require('mithril');
|
7 |
+
|
8 |
+
var r = {};
|
9 |
+
|
10 |
+
r.showType = function (config) {
|
11 |
+
// ucfirst
|
12 |
+
var fieldType = config.type;
|
13 |
+
fieldType = fieldType.charAt(0).toUpperCase() + fieldType.slice(1);
|
14 |
+
return m('div', [m("label", i18n.fieldType), m('span', fieldType)]);
|
15 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
+
r.label = function (config) {
|
18 |
+
// label row
|
19 |
+
return m("div", [m("label", i18n.fieldLabel), m("input.widefat", {
|
20 |
+
type: "text",
|
21 |
+
value: config.label,
|
22 |
+
onchange: function onchange(evt) {
|
23 |
+
return config.label = evt.target.value;
|
24 |
+
},
|
25 |
+
placeholder: config.title
|
26 |
+
})]);
|
27 |
};
|
28 |
|
29 |
+
r.value = function (config) {
|
30 |
+
var isHidden = config.type === 'hidden';
|
31 |
+
return m("div", [m("label", [isHidden ? i18n.value : i18n.initialValue, " ", isHidden ? '' : m('small', {
|
32 |
+
"style": "float: right; font-weight: normal;"
|
33 |
+
}, i18n.optional)]), m("input.widefat", {
|
34 |
+
type: "text",
|
35 |
+
value: config.value,
|
36 |
+
onchange: function onchange(evt) {
|
37 |
+
return config.value = evt.target.value;
|
38 |
+
}
|
39 |
+
}), isHidden ? '' : m('p.help', i18n.valueHelp)]);
|
40 |
+
};
|
41 |
|
42 |
+
r.numberMinMax = function (config) {
|
43 |
+
return m('div', [m('div.row', [m('div.col.col-3', [m('label', i18n.min), m('input', {
|
44 |
+
type: 'number',
|
45 |
+
onchange: function onchange(evt) {
|
46 |
+
return config.min = evt.target.value;
|
47 |
+
}
|
48 |
+
})]), m('div.col.col-3', [m('label', i18n.max), m('input', {
|
49 |
+
type: 'number',
|
50 |
+
onchange: function onchange(evt) {
|
51 |
+
return config.max = evt.target.value;
|
52 |
+
}
|
53 |
+
})])])]);
|
54 |
+
};
|
55 |
|
56 |
+
r.isRequired = function (config) {
|
57 |
+
var inputAtts = {
|
58 |
+
type: 'checkbox',
|
59 |
+
checked: config.required,
|
60 |
+
onchange: function onchange(evt) {
|
61 |
+
return config.required = evt.target.checked;
|
62 |
+
}
|
63 |
+
};
|
64 |
+
var desc;
|
65 |
|
66 |
+
if (config.forceRequired) {
|
67 |
+
inputAtts.required = true;
|
68 |
+
inputAtts.disabled = true;
|
69 |
+
desc = m('p.help', i18n.forceRequired);
|
70 |
+
}
|
71 |
|
72 |
+
return m('div', [m('label.cb-wrap', [m('input', inputAtts), i18n.isFieldRequired]), desc]);
|
73 |
+
};
|
74 |
|
75 |
+
r.placeholder = function (config) {
|
76 |
+
return m("div", [m("label", [i18n.placeholder, " ", m('small', {
|
77 |
+
"style": "float: right; font-weight: normal;"
|
78 |
+
}, i18n.optional)]), m("input.widefat", {
|
79 |
+
type: "text",
|
80 |
+
value: config.placeholder,
|
81 |
+
onchange: function onchange(evt) {
|
82 |
+
return config.placeholder = evt.target.value;
|
83 |
+
},
|
84 |
+
placeholder: ""
|
85 |
+
}), m("p.help", i18n.placeholderHelp)]);
|
86 |
+
};
|
87 |
|
88 |
+
r.useParagraphs = function (config) {
|
89 |
+
return m('div', [m('label.cb-wrap', [m('input', {
|
90 |
+
type: 'checkbox',
|
91 |
+
checked: config.wrap,
|
92 |
+
onchange: function onchange(evt) {
|
93 |
+
return config.wrap = evt.target.checked;
|
94 |
}
|
95 |
+
}), i18n.wrapInParagraphTags])]);
|
96 |
+
};
|
97 |
|
98 |
+
r.choiceType = function (config) {
|
99 |
+
var options = [m('option', {
|
100 |
+
value: 'select',
|
101 |
+
selected: config.type === 'select' ? 'selected' : false
|
102 |
+
}, i18n.dropdown), m('option', {
|
103 |
+
value: 'radio',
|
104 |
+
selected: config.type === 'radio' ? 'selected' : false
|
105 |
+
}, i18n.radioButtons)]; // only add checkbox choice if field accepts multiple values
|
106 |
|
107 |
+
if (config.acceptsMultipleValues) {
|
108 |
+
options.push(m('option', {
|
109 |
+
value: 'checkbox',
|
110 |
+
selected: config.type === 'checkbox' ? 'selected' : false
|
111 |
+
}, i18n.checkboxes));
|
112 |
+
}
|
113 |
|
114 |
+
return m('div', [m('label', i18n.choiceType), m('select', {
|
115 |
+
value: config.type,
|
116 |
+
onchange: function onchange(evt) {
|
117 |
+
return config.type = evt.target.value;
|
118 |
+
}
|
119 |
+
}, options)]);
|
120 |
+
};
|
121 |
|
122 |
+
r.choices = function (config) {
|
123 |
+
var html = [];
|
124 |
+
html.push(m('div', [m('label', i18n.choices), m('div.limit-height', [m("table", config.choices.map(function (choice, index) {
|
125 |
+
return m('tr', {
|
126 |
+
'data-id': index
|
127 |
+
}, [m('td.cb', m('input', {
|
128 |
+
name: 'selected',
|
129 |
+
type: config.type === 'checkbox' ? 'checkbox' : 'radio',
|
130 |
+
onchange: function onchange(evt) {
|
131 |
+
config.choices = config.choices.map(function (choice) {
|
132 |
+
if (choice.value === evt.target.value) {
|
133 |
+
choice.selected = !choice.selected;
|
134 |
+
} else {
|
135 |
+
// only checkboxes allow for multiple selections
|
136 |
+
if (config.type !== 'checkbox') {
|
137 |
+
choice.selected = false;
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
return choice;
|
142 |
+
});
|
143 |
+
},
|
144 |
+
checked: choice.selected,
|
145 |
+
value: choice.value,
|
146 |
+
title: i18n.preselect
|
147 |
+
})), m('td.stretch', m('input.widefat', {
|
148 |
+
type: 'text',
|
149 |
+
value: choice.label,
|
150 |
+
placeholder: choice.title,
|
151 |
+
onchange: function onchange(evt) {
|
152 |
+
return choice.label = evt.target.value;
|
153 |
+
}
|
154 |
+
})), m('td', m('span', {
|
155 |
+
"title": i18n.remove,
|
156 |
+
"class": 'dashicons dashicons-no-alt hover-activated',
|
157 |
+
"onclick": function (key) {
|
158 |
+
this.choices().splice(key, 1);
|
159 |
+
}.bind(config, index)
|
160 |
+
}, ''))]);
|
161 |
+
})) // end of table
|
162 |
+
]) // end of limit-height div
|
163 |
+
]));
|
164 |
+
return html;
|
165 |
+
};
|
166 |
|
167 |
+
r.linkToTerms = function (config) {
|
168 |
+
// label row
|
169 |
+
return m("div", [m("label", i18n.agreeToTermsLink), m("input.widefat", {
|
170 |
+
type: "text",
|
171 |
+
value: config.link,
|
172 |
+
onchange: function onchange(evt) {
|
173 |
+
return config.link = evt.target.value;
|
174 |
+
},
|
175 |
+
placeholder: 'https://...'
|
176 |
+
})]);
|
177 |
+
};
|
178 |
|
179 |
+
module.exports = r;
|
180 |
+
|
181 |
+
},{"mithril":28}],2:[function(require,module,exports){
|
182 |
+
'use strict';
|
183 |
|
184 |
+
var forms = {};
|
185 |
|
186 |
+
var rows = require('./field-forms-rows.js'); // route to one of the other form configs, default to "text"
|
|
|
|
|
187 |
|
|
|
|
|
188 |
|
189 |
+
forms.render = function (config) {
|
190 |
+
var type = config.type;
|
|
|
|
|
|
|
|
|
191 |
|
192 |
+
if (typeof forms[type] === "function") {
|
193 |
+
return forms[type](config);
|
194 |
+
}
|
|
|
|
|
195 |
|
196 |
+
switch (type) {
|
197 |
+
case 'select':
|
198 |
+
case 'radio':
|
199 |
+
case 'checkbox':
|
200 |
+
return forms.choice(config);
|
201 |
+
} // fallback to good old text field
|
202 |
|
|
|
|
|
|
|
203 |
|
204 |
+
return forms.text(config);
|
205 |
+
};
|
206 |
+
|
207 |
+
forms.text = function (config) {
|
208 |
+
return [rows.label(config), rows.placeholder(config), rows.value(config), rows.isRequired(config), rows.useParagraphs(config)];
|
209 |
+
};
|
210 |
+
|
211 |
+
forms.choice = function (config) {
|
212 |
+
var visibleRows = [rows.label(config), rows.choiceType(config), rows.choices(config)];
|
213 |
+
|
214 |
+
if (config.type === 'select') {
|
215 |
+
visibleRows.push(rows.placeholder(config));
|
216 |
+
}
|
217 |
+
|
218 |
+
visibleRows.push(rows.useParagraphs(config));
|
219 |
+
|
220 |
+
if (config.type === 'select' || config.type === 'radio') {
|
221 |
+
visibleRows.push(rows.isRequired(config));
|
222 |
+
}
|
223 |
+
|
224 |
+
return visibleRows;
|
225 |
+
};
|
226 |
+
|
227 |
+
forms.hidden = function (config) {
|
228 |
+
config.placeholder = '';
|
229 |
+
config.label = '';
|
230 |
+
config.wrap = false;
|
231 |
+
return [rows.showType(config), rows.value(config)];
|
232 |
+
};
|
233 |
+
|
234 |
+
forms.submit = function (config) {
|
235 |
+
config.label = '';
|
236 |
+
config.placeholder = '';
|
237 |
+
return [rows.value(config), rows.useParagraphs(config)];
|
238 |
+
};
|
239 |
+
|
240 |
+
forms['terms-checkbox'] = function (config) {
|
241 |
+
return [rows.label(config), rows.linkToTerms(config), rows.isRequired(config), rows.useParagraphs(config)];
|
242 |
+
};
|
243 |
+
|
244 |
+
forms.number = function (config) {
|
245 |
+
return [forms.text(config), rows.numberMinMax(config)];
|
246 |
};
|
247 |
|
248 |
module.exports = forms;
|
252 |
|
253 |
var htmlutil = require('html');
|
254 |
|
255 |
+
var m = require('mithril');
|
256 |
+
|
257 |
var setAttributes = function setAttributes(vnode) {
|
258 |
if (vnode.dom.checked) {
|
259 |
vnode.dom.setAttribute("checked", "true");
|
268 |
}
|
269 |
};
|
270 |
|
271 |
+
var generators = {};
|
272 |
+
/**
|
273 |
+
* Generates a <select> field
|
274 |
+
* @param config
|
275 |
+
* @returns {*}
|
276 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
277 |
|
278 |
+
generators['select'] = function (config) {
|
279 |
+
var attributes = {
|
280 |
+
name: config.name,
|
281 |
+
required: config.required
|
282 |
+
};
|
283 |
+
var hasSelection = false;
|
284 |
+
var options = config.choices.map(function (choice) {
|
285 |
+
if (choice.selected) {
|
286 |
+
hasSelection = true;
|
287 |
}
|
288 |
|
289 |
+
return m('option', {
|
290 |
+
value: choice.value !== choice.label ? choice.value : undefined,
|
291 |
+
"selected": choice.selected,
|
292 |
+
oncreate: setAttributes
|
293 |
+
}, choice.label);
|
294 |
+
});
|
295 |
+
var placeholder = config.placeholder;
|
296 |
|
297 |
+
if (placeholder.length > 0) {
|
298 |
+
options.unshift(m('option', {
|
299 |
+
'disabled': true,
|
300 |
+
'value': '',
|
301 |
+
'selected': !hasSelection,
|
302 |
+
oncreate: setAttributes
|
303 |
+
}, placeholder));
|
304 |
+
}
|
305 |
|
306 |
+
return m('select', attributes, options);
|
307 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
|
309 |
+
generators['terms-checkbox'] = function (config) {
|
310 |
+
var label;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
|
312 |
+
if (config.link.length > 0) {
|
313 |
+
label = m('a', {
|
314 |
+
href: config.link,
|
315 |
+
target: "_blank"
|
316 |
+
}, config.label);
|
317 |
+
} else {
|
318 |
+
label = config.label;
|
319 |
+
}
|
320 |
|
321 |
+
return m('label', [m('input', {
|
322 |
+
name: config.name,
|
323 |
+
type: 'checkbox',
|
324 |
+
value: config.value,
|
325 |
+
required: config.required
|
326 |
+
}), ' ', label]);
|
327 |
+
};
|
328 |
+
/**
|
329 |
+
* Generates a checkbox or radio type input field.
|
330 |
+
*
|
331 |
+
* @param config
|
332 |
+
* @returns {*}
|
333 |
+
*/
|
334 |
|
|
|
|
|
|
|
335 |
|
336 |
+
generators['checkbox'] = function (config) {
|
337 |
+
return config.choices.map(function (choice) {
|
338 |
+
var name = config.name + (config.type === 'checkbox' ? '[]' : '');
|
339 |
+
var required = config.required && config.type === 'radio';
|
340 |
+
return m('label', [m('input', {
|
341 |
+
name: name,
|
342 |
+
type: config.type,
|
343 |
+
value: choice.value,
|
344 |
+
checked: choice.selected,
|
345 |
+
required: required,
|
346 |
+
oncreate: setAttributes
|
347 |
+
}), ' ', m('span', choice.label)]);
|
348 |
+
});
|
349 |
+
};
|
350 |
|
351 |
+
generators['radio'] = generators['checkbox'];
|
352 |
+
/**
|
353 |
+
* Generates a default field
|
354 |
+
*
|
355 |
+
* - text, url, number, email, date
|
356 |
+
*
|
357 |
+
* @param config
|
358 |
+
* @returns {*}
|
359 |
+
*/
|
360 |
|
361 |
+
generators['default'] = function (config) {
|
362 |
+
var attributes = {
|
363 |
+
type: config.type
|
364 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
|
366 |
+
if (config.name) {
|
367 |
+
attributes.name = config.name;
|
368 |
+
}
|
369 |
|
370 |
+
if (config.min) {
|
371 |
+
attributes.min = config.min;
|
372 |
+
}
|
373 |
|
374 |
+
if (config.max) {
|
375 |
+
attributes.max = config.max;
|
376 |
+
}
|
377 |
|
378 |
+
if (config.value.length > 0) {
|
379 |
+
attributes.value = config.value;
|
380 |
+
}
|
381 |
|
382 |
+
if (config.placeholder.length > 0) {
|
383 |
+
attributes.placeholder = config.placeholder;
|
384 |
}
|
385 |
|
386 |
+
attributes.required = config.required;
|
387 |
+
attributes.oncreate = setAttributes;
|
388 |
+
return m('input', attributes);
|
389 |
};
|
390 |
+
/**
|
391 |
+
* Generates an HTML string based on a field (config) object
|
392 |
+
*
|
393 |
+
* @param config
|
394 |
+
* @returns {*}
|
395 |
+
*/
|
396 |
|
|
|
|
|
|
|
|
|
397 |
|
398 |
+
function generate(config) {
|
399 |
+
var labelAtts = {};
|
400 |
+
var label = config.label.length > 0 && config.showLabel ? m("label", labelAtts, config.label) : '';
|
401 |
+
var field = typeof generators[config.type] === "function" ? generators[config.type](config) : generators['default'](config);
|
402 |
+
var htmlTemplate = config.wrap ? m('p', [label, field]) : [label, field]; // render in vdom
|
403 |
|
404 |
+
var vdom = document.createElement('div');
|
405 |
+
m.render(vdom, htmlTemplate); // prettify html
|
406 |
|
407 |
+
var html = htmlutil.prettyPrint(vdom.innerHTML);
|
408 |
+
return html + "\n";
|
409 |
+
}
|
410 |
|
411 |
+
module.exports = generate;
|
412 |
|
413 |
+
},{"html":24,"mithril":28}],4:[function(require,module,exports){
|
414 |
+
'use strict';
|
|
|
|
|
|
|
|
|
|
|
|
|
415 |
|
416 |
+
var m = require('mithril');
|
|
|
417 |
|
418 |
+
var editor = require('./form-editor.js');
|
|
|
|
|
|
|
|
|
419 |
|
420 |
+
var fields = require('./fields.js');
|
|
|
|
|
|
|
|
|
421 |
|
422 |
+
var i18n = window.mc4wp_forms_i18n;
|
423 |
|
424 |
+
var generate = require('./field-generator.js');
|
|
|
|
|
|
|
425 |
|
426 |
+
var Overlay = require('../overlay.js');
|
427 |
|
428 |
+
var forms = require('./field-forms.js');
|
|
|
|
|
429 |
|
430 |
+
var fieldConfig;
|
431 |
+
editor.on('blur', m.redraw);
|
432 |
+
/**
|
433 |
+
* Choose a field to open the helper form for
|
434 |
+
*
|
435 |
+
* @param index
|
436 |
+
* @returns {*}
|
437 |
+
*/
|
438 |
|
439 |
+
function setActiveField(index) {
|
440 |
+
fieldConfig = fields.get(index); // if this hidden field has choices (hidden groups), glue them together by their label.
|
441 |
|
442 |
+
if (fieldConfig && fieldConfig.type === 'hidden' && fieldConfig.choices.length > 0) {
|
443 |
+
fieldConfig.value = fieldConfig.choices.map(function (c) {
|
444 |
+
return c.label;
|
445 |
+
}).join('|');
|
446 |
}
|
|
|
|
|
|
|
|
|
447 |
|
448 |
+
m.redraw();
|
449 |
+
}
|
450 |
+
/**
|
451 |
+
* Create HTML based on current config object
|
452 |
+
*/
|
453 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
454 |
|
455 |
+
function createFieldHTMLAndAddToForm() {
|
456 |
+
// generate html
|
457 |
+
var html = generate(fieldConfig); // add to editor
|
458 |
|
459 |
+
editor.insert(html); // reset field form
|
460 |
|
461 |
+
setActiveField(''); // redraw
|
|
|
|
|
462 |
|
463 |
+
m.redraw();
|
464 |
+
}
|
465 |
+
/**
|
466 |
+
* View
|
467 |
+
* @returns {*}
|
468 |
+
*/
|
|
|
|
|
469 |
|
|
|
470 |
|
471 |
+
function view() {
|
472 |
+
// build DOM for fields choice
|
473 |
+
var fieldCategories = fields.getCategories();
|
474 |
+
var availableFields = fields.getAll();
|
475 |
+
var fieldsChoice = m("div.available-fields.small-margin", [m("h4", i18n.chooseField), fieldCategories.map(function (category) {
|
476 |
+
var categoryFields = availableFields.filter(function (f) {
|
477 |
+
return f.category === category;
|
478 |
+
});
|
|
|
|
|
|
|
479 |
|
480 |
+
if (!categoryFields.length) {
|
481 |
+
return;
|
|
|
|
|
|
|
|
|
482 |
}
|
483 |
|
484 |
+
return m("div.tiny-margin", [m("strong", category), // render fields
|
485 |
+
categoryFields.map(function (field) {
|
486 |
+
var className = "button";
|
487 |
|
488 |
+
if (field.forceRequired) {
|
489 |
+
className += " is-required";
|
490 |
+
}
|
491 |
|
492 |
+
var inForm = field.inFormContent;
|
|
|
|
|
|
|
|
|
|
|
|
|
493 |
|
494 |
+
if (inForm !== null) {
|
495 |
+
className += " " + (inForm ? 'in-form' : 'not-in-form');
|
496 |
+
}
|
497 |
|
498 |
+
return m("button", {
|
499 |
+
className: className,
|
500 |
+
type: 'button',
|
501 |
+
onclick: function onclick(evt) {
|
502 |
+
return setActiveField(evt.target.value);
|
503 |
+
},
|
504 |
+
value: field.index
|
505 |
+
}, field.title);
|
506 |
+
})]);
|
507 |
+
})]); // build DOM for overlay
|
508 |
+
|
509 |
+
var form = null;
|
510 |
+
|
511 |
+
if (fieldConfig) {
|
512 |
+
form = m(Overlay, {
|
513 |
+
onClose: setActiveField
|
514 |
+
}, // field wizard
|
515 |
+
m("div.field-wizard", [//heading
|
516 |
+
m("h3", [fieldConfig.title, fieldConfig.forceRequired ? m('span.red', '*') : '', fieldConfig.name.length ? m("code", fieldConfig.name) : '']), // help text
|
517 |
+
fieldConfig.help.length ? m('p', m.trust(fieldConfig.help)) : '', // actual form
|
518 |
+
forms.render(fieldConfig), // add to form button
|
519 |
+
m("p", [m("button", {
|
520 |
+
"class": "button-primary",
|
521 |
+
type: "button",
|
522 |
+
onkeydown: function onkeydown(evt) {
|
523 |
+
if (evt.keyCode === 13) {
|
524 |
+
createFieldHTMLAndAddToForm();
|
525 |
+
}
|
526 |
+
},
|
527 |
+
onclick: createFieldHTMLAndAddToForm
|
528 |
+
}, i18n.addToForm)])]));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
529 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
530 |
|
531 |
+
return [fieldsChoice, form];
|
532 |
+
}
|
533 |
|
534 |
+
var fieldHelperRootElement = document.getElementById('mc4wp-field-wizard');
|
|
|
|
|
535 |
|
536 |
+
if (fieldHelperRootElement) {
|
537 |
+
m.mount(fieldHelperRootElement, {
|
538 |
+
view: view
|
539 |
+
});
|
540 |
+
}
|
|
|
|
|
|
|
541 |
|
542 |
+
},{"../overlay.js":11,"./field-forms.js":2,"./field-generator.js":3,"./fields.js":6,"./form-editor.js":7,"mithril":28}],5:[function(require,module,exports){
|
543 |
+
'use strict';
|
544 |
|
545 |
+
var m = require('mithril');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
546 |
|
547 |
+
var fields = require('./fields.js');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
548 |
|
549 |
+
var settings = window.mc4wp.settings;
|
550 |
+
var ajaxurl = window.mc4wp_vars.ajaxurl;
|
551 |
+
var i18n = window.mc4wp_forms_i18n;
|
552 |
+
var mailchimp = window.mc4wp_vars.mailchimp;
|
553 |
+
/**
|
554 |
+
* Array of registered fields
|
555 |
+
*
|
556 |
+
* @type {Array}
|
557 |
+
*/
|
558 |
|
559 |
+
var registeredFields = [];
|
560 |
+
/**
|
561 |
+
* Reset all previously registered fields
|
562 |
+
*/
|
|
|
|
|
563 |
|
564 |
+
function reset() {
|
565 |
+
// clear all of our fields
|
566 |
+
registeredFields.forEach(fields.deregister);
|
567 |
+
}
|
568 |
+
/**
|
569 |
+
* Helper function to quickly register a field and store it in local scope
|
570 |
+
*
|
571 |
+
* @param {string} category
|
572 |
+
* @param {object} data
|
573 |
+
* @param {boolean} sticky
|
574 |
+
*/
|
575 |
|
|
|
|
|
576 |
|
577 |
+
function register(category, data, sticky) {
|
578 |
+
var field = fields.register(category, data);
|
579 |
|
580 |
+
if (!sticky) {
|
581 |
+
registeredFields.push(field);
|
582 |
}
|
583 |
+
}
|
584 |
+
/**
|
585 |
+
* Normalizes the field type which is passed by Mailchimp
|
586 |
+
*
|
587 |
+
* @param type
|
588 |
+
* @returns {*}
|
589 |
+
*/
|
590 |
|
591 |
|
592 |
+
function getFieldType(type) {
|
593 |
+
var map = {
|
594 |
+
'phone': 'tel',
|
595 |
+
'dropdown': 'select',
|
596 |
+
'checkboxes': 'checkbox',
|
597 |
+
'birthday': 'text'
|
598 |
+
};
|
599 |
+
return typeof map[type] !== "undefined" ? map[type] : type;
|
600 |
+
}
|
601 |
+
/**
|
602 |
+
* Register the various fields for a merge var
|
603 |
+
*
|
604 |
+
* @param mergeField
|
605 |
+
* @returns {boolean}
|
606 |
+
*/
|
607 |
|
|
|
|
|
|
|
608 |
|
609 |
+
function registerMergeField(mergeField) {
|
610 |
+
var category = i18n.listFields;
|
611 |
+
var fieldType = getFieldType(mergeField.type); // name, type, title, value, required, label, placeholder, choices, wrap
|
|
|
|
|
|
|
612 |
|
613 |
+
var data = {
|
614 |
+
name: mergeField.tag,
|
615 |
+
title: mergeField.name,
|
616 |
+
required: mergeField.required,
|
617 |
+
forceRequired: mergeField.required,
|
618 |
+
type: fieldType,
|
619 |
+
choices: mergeField.options.choices,
|
620 |
+
acceptsMultipleValues: false // merge fields never accept multiple values.
|
621 |
|
622 |
+
};
|
|
|
|
|
623 |
|
624 |
+
if (data.type !== 'address') {
|
625 |
+
register(category, data, false);
|
626 |
+
} else {
|
627 |
register(category, {
|
628 |
+
name: data.name + '[addr1]',
|
629 |
+
type: 'text',
|
630 |
+
mailchimpType: 'address',
|
631 |
+
title: i18n.streetAddress
|
632 |
+
}, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
633 |
register(category, {
|
634 |
+
name: data.name + '[city]',
|
635 |
+
type: 'text',
|
636 |
+
mailchimpType: 'address',
|
637 |
+
title: i18n.city
|
638 |
+
}, false);
|
|
|
|
|
639 |
register(category, {
|
640 |
+
name: data.name + '[state]',
|
641 |
+
type: 'text',
|
642 |
+
mailchimpType: 'address',
|
643 |
+
title: i18n.state
|
644 |
+
}, false);
|
645 |
+
register(category, {
|
646 |
+
name: data.name + '[zip]',
|
647 |
+
type: 'text',
|
648 |
+
mailchimpType: 'address',
|
649 |
+
title: i18n.zip
|
650 |
+
}, false);
|
651 |
+
register(category, {
|
652 |
+
name: data.name + '[country]',
|
653 |
+
type: 'select',
|
654 |
+
mailchimpType: 'address',
|
655 |
+
title: i18n.country,
|
656 |
+
choices: mc4wp_vars.countries
|
657 |
+
}, false);
|
658 |
}
|
659 |
+
|
660 |
+
return true;
|
661 |
+
}
|
662 |
+
/**
|
663 |
+
* Register a field for a Mailchimp grouping
|
664 |
+
*
|
665 |
+
* @param interestCategory
|
666 |
+
*/
|
667 |
|
668 |
|
669 |
+
function registerInterestCategory(interestCategory) {
|
670 |
+
var category = i18n.interestCategories;
|
671 |
+
var fieldType = getFieldType(interestCategory.type);
|
672 |
+
var data = {
|
673 |
+
title: interestCategory.title,
|
674 |
+
name: 'INTERESTS[' + interestCategory.id + ']',
|
675 |
+
type: fieldType,
|
676 |
+
choices: interestCategory.interests,
|
677 |
+
acceptsMultipleValues: fieldType === 'checkbox'
|
678 |
};
|
679 |
+
register(category, data, false);
|
680 |
+
}
|
681 |
+
/**
|
682 |
+
* Register all fields belonging to a list
|
683 |
+
*
|
684 |
+
* @param list
|
685 |
+
*/
|
686 |
|
|
|
|
|
687 |
|
688 |
+
function registerListFields(list) {
|
689 |
+
// make sure EMAIL && public fields come first
|
690 |
+
list.merge_fields = list.merge_fields.sort(function (a, b) {
|
691 |
+
if (a.tag === 'EMAIL' || a["public"] && !b["public"]) {
|
692 |
+
return -1;
|
693 |
+
}
|
694 |
|
695 |
+
if (!a["public"] && b["public"]) {
|
696 |
+
return 1;
|
697 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
698 |
|
699 |
+
return 0;
|
700 |
+
}); // loop through merge vars
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
701 |
|
702 |
+
list.merge_fields.forEach(registerMergeField); // loop through groupings
|
703 |
|
704 |
+
list.interest_categories.forEach(registerInterestCategory);
|
705 |
+
}
|
706 |
+
/**
|
707 |
+
* Register all lists fields
|
708 |
+
*
|
709 |
+
* @param lists
|
710 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
711 |
|
712 |
|
713 |
+
function registerListsFields(lists) {
|
714 |
+
var url = ajaxurl + "?action=mc4wp_get_list_details&ids=" + lists.map(function (l) {
|
715 |
+
return l.id;
|
716 |
+
}).join(',');
|
717 |
+
m.request({
|
718 |
+
url: url,
|
719 |
+
method: "GET"
|
720 |
+
}).then(function (lists) {
|
721 |
+
reset();
|
722 |
+
lists.forEach(registerListFields);
|
723 |
+
});
|
724 |
+
}
|
725 |
|
726 |
+
function registerCustomFields(lists) {
|
727 |
+
var choices;
|
728 |
+
var category = i18n.formFields;
|
729 |
+
register(i18n.listFields, {
|
730 |
+
name: 'EMAIL',
|
731 |
+
title: i18n.emailAddress,
|
732 |
+
required: true,
|
733 |
+
forceRequired: true,
|
734 |
+
type: 'email'
|
735 |
+
}, true); // register submit button
|
736 |
+
|
737 |
+
register(category, {
|
738 |
+
name: '',
|
739 |
+
value: i18n.subscribe,
|
740 |
+
type: "submit",
|
741 |
+
title: i18n.submitButton
|
742 |
+
}, true); // register lists choice field
|
743 |
+
|
744 |
+
choices = {};
|
745 |
+
|
746 |
+
for (var key in lists) {
|
747 |
+
choices[lists[key].id] = lists[key].name;
|
748 |
+
}
|
749 |
+
|
750 |
+
register(category, {
|
751 |
+
name: '_mc4wp_lists',
|
752 |
+
type: 'checkbox',
|
753 |
+
title: i18n.listChoice,
|
754 |
+
choices: choices,
|
755 |
+
help: i18n.listChoiceDescription,
|
756 |
+
acceptsMultipleValues: true
|
757 |
+
}, true);
|
758 |
+
choices = {
|
759 |
+
'subscribe': "Subscribe",
|
760 |
+
'unsubscribe': "Unsubscribe"
|
761 |
+
};
|
762 |
+
register(category, {
|
763 |
+
name: '_mc4wp_action',
|
764 |
+
type: 'radio',
|
765 |
+
title: i18n.formAction,
|
766 |
+
choices: choices,
|
767 |
+
value: 'subscribe',
|
768 |
+
help: i18n.formActionDescription
|
769 |
+
}, true);
|
770 |
+
register(category, {
|
771 |
+
name: 'AGREE_TO_TERMS',
|
772 |
+
value: 1,
|
773 |
+
type: "terms-checkbox",
|
774 |
+
label: i18n.agreeToTerms,
|
775 |
+
title: i18n.agreeToTermsShort,
|
776 |
+
showLabel: false,
|
777 |
+
required: true
|
778 |
+
}, true);
|
779 |
+
}
|
780 |
+
/**
|
781 |
+
* Init
|
782 |
+
*/
|
783 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
784 |
|
785 |
+
settings.on('selectedLists.change', registerListsFields);
|
786 |
+
registerListsFields(settings.getSelectedLists());
|
787 |
+
registerCustomFields(mailchimp.lists);
|
788 |
|
789 |
+
},{"./fields.js":6,"mithril":28}],6:[function(require,module,exports){
|
790 |
+
'use strict';
|
|
|
791 |
|
792 |
+
var m = require('mithril');
|
|
|
|
|
|
|
|
|
793 |
|
794 |
+
var timeout;
|
795 |
+
var fields = [];
|
796 |
+
var categories = [];
|
797 |
+
var listeners = {};
|
798 |
|
799 |
+
var Field = function Field(data) {
|
800 |
+
return {
|
801 |
+
name: data.name,
|
802 |
+
title: data.title || data.name,
|
803 |
+
type: data.type,
|
804 |
+
mailchimpType: data.mailchimpType || null,
|
805 |
+
label: data.label || data.title || '',
|
806 |
+
showLabel: typeof data.showLabel === "boolean" ? data.showLabel : true,
|
807 |
+
value: data.value || '',
|
808 |
+
placeholder: data.placeholder || '',
|
809 |
+
required: data.required || false,
|
810 |
+
forceRequired: data.forceRequired || false,
|
811 |
+
wrap: typeof data.wrap === "boolean" ? data.wrap : true,
|
812 |
+
min: data.min,
|
813 |
+
max: data.max,
|
814 |
+
help: data.help || '',
|
815 |
+
choices: data.choices || [],
|
816 |
+
inFormContent: null,
|
817 |
+
acceptsMultipleValues: data.acceptsMultipleValues,
|
818 |
+
link: data.link || ''
|
819 |
+
};
|
820 |
+
};
|
821 |
+
/**
|
822 |
+
* @internal
|
823 |
+
*
|
824 |
+
* @param data
|
825 |
+
* @constructor
|
826 |
+
*/
|
827 |
|
828 |
|
829 |
+
var FieldChoice = function FieldChoice(data) {
|
830 |
+
return {
|
831 |
+
title: data.title || data.label,
|
832 |
+
selected: data.selected || false,
|
833 |
+
value: data.value || data.label,
|
834 |
+
label: data.label
|
835 |
+
};
|
836 |
+
};
|
837 |
+
/**
|
838 |
+
* Creates FieldChoice objects from an (associative) array of data objects
|
839 |
+
*
|
840 |
+
* @param data
|
841 |
+
* @returns {Array}
|
842 |
+
*/
|
843 |
|
|
|
|
|
|
|
|
|
|
|
844 |
|
845 |
+
function createChoices(data) {
|
846 |
+
var choices = [];
|
|
|
|
|
847 |
|
848 |
+
if (typeof data.map === "function") {
|
849 |
+
choices = data.map(function (choiceLabel) {
|
850 |
+
return new FieldChoice({
|
851 |
+
label: choiceLabel
|
852 |
+
});
|
853 |
+
});
|
854 |
+
} else {
|
855 |
+
choices = Object.keys(data).map(function (key) {
|
856 |
+
var choiceLabel = data[key];
|
857 |
+
return new FieldChoice({
|
858 |
+
label: choiceLabel,
|
859 |
+
value: key
|
860 |
+
});
|
861 |
+
});
|
862 |
+
}
|
863 |
+
|
864 |
+
return choices;
|
865 |
+
}
|
866 |
+
/**
|
867 |
+
* Factory method
|
868 |
+
*
|
869 |
+
* @returns {Field}
|
870 |
+
*/
|
871 |
|
|
|
|
|
|
|
872 |
|
873 |
+
function register(category, data) {
|
874 |
+
var field;
|
875 |
+
var existingField = getAllWhere('name', data.name).shift(); // a field with the same "name" already exists
|
876 |
|
877 |
+
if (existingField) {
|
878 |
+
// update "required" status
|
879 |
+
if (!existingField.forceRequired && data.forceRequired) {
|
880 |
+
existingField.forceRequired = true;
|
881 |
+
} // bail
|
882 |
|
|
|
883 |
|
884 |
+
return undefined;
|
885 |
+
} // array of choices given? convert to FieldChoice objects
|
886 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
887 |
|
888 |
+
if (data.choices) {
|
889 |
+
data.choices = createChoices(data.choices);
|
890 |
|
891 |
+
if (data.value) {
|
892 |
+
data.choices = data.choices.map(function (choice) {
|
893 |
+
if (choice.value === data.value) {
|
894 |
+
choice.selected = true;
|
895 |
+
}
|
896 |
|
897 |
+
return choice;
|
898 |
+
});
|
|
|
899 |
}
|
900 |
+
} // register category
|
|
|
|
|
|
|
|
|
|
|
|
|
901 |
|
902 |
|
903 |
+
if (categories.indexOf(category) < 0) {
|
904 |
+
categories.push(category);
|
905 |
+
} // create Field object
|
|
|
|
|
|
|
|
|
|
|
906 |
|
907 |
|
908 |
+
field = new Field(data);
|
909 |
+
field.category = category; // add to array
|
|
|
|
|
|
|
|
|
|
|
|
|
910 |
|
911 |
+
fields.push(field); // redraw view
|
912 |
+
// TODO: Move this out
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
913 |
|
914 |
+
timeout && window.clearTimeout(timeout);
|
915 |
+
timeout = window.setTimeout(m.redraw, 200); // trigger event
|
916 |
|
917 |
+
emit('change');
|
918 |
+
return field;
|
919 |
+
}
|
920 |
+
|
921 |
+
function emit(event, args) {
|
922 |
+
listeners[event] = listeners[event] || [];
|
923 |
+
listeners[event].forEach(function (f) {
|
924 |
+
return f.apply(null, args);
|
925 |
+
});
|
926 |
+
}
|
927 |
+
|
928 |
+
function on(event, func) {
|
929 |
+
listeners[event] = listeners[event] || [];
|
930 |
+
listeners[event].push(func);
|
931 |
+
}
|
932 |
+
/**
|
933 |
+
* @api
|
934 |
+
*
|
935 |
+
* @param field
|
936 |
+
*/
|
937 |
+
|
938 |
+
|
939 |
+
function deregister(field) {
|
940 |
+
var index = fields.indexOf(field);
|
941 |
+
|
942 |
+
if (index > -1) {
|
943 |
+
delete fields[index];
|
944 |
+
m.redraw();
|
945 |
}
|
946 |
+
}
|
947 |
+
/**
|
948 |
+
* Get a field config object
|
949 |
+
*
|
950 |
+
* @param name
|
951 |
+
* @returns {*}
|
952 |
+
*/
|
953 |
|
954 |
|
955 |
+
function get(name) {
|
956 |
+
return fields[name];
|
957 |
+
}
|
958 |
+
/**
|
959 |
+
* Get all field config objects
|
960 |
+
*
|
961 |
+
* @returns {Array|*}
|
962 |
+
*/
|
963 |
+
|
964 |
+
|
965 |
+
function getAll() {
|
966 |
+
// rebuild index property on all fields
|
967 |
+
fields = fields.map(function (f, i) {
|
968 |
+
f.index = i;
|
969 |
+
return f;
|
970 |
+
});
|
971 |
+
return fields;
|
972 |
+
}
|
973 |
+
|
974 |
+
function getCategories() {
|
975 |
+
return categories.sort(function (a, b) {
|
976 |
+
return a !== "Form fields" ? -1 : 1;
|
977 |
+
});
|
978 |
+
}
|
979 |
+
/**
|
980 |
+
* Get all fields where a property matches the given value
|
981 |
+
*
|
982 |
+
* @param searchKey
|
983 |
+
* @param searchValue
|
984 |
+
* @returns {Array|*}
|
985 |
+
*/
|
986 |
+
|
987 |
+
|
988 |
+
function getAllWhere(searchKey, searchValue) {
|
989 |
+
return fields.filter(function (field) {
|
990 |
+
return field[searchKey] === searchValue;
|
991 |
+
});
|
992 |
+
}
|
993 |
+
/**
|
994 |
+
* Exposed methods
|
995 |
+
*/
|
996 |
+
|
997 |
+
|
998 |
+
module.exports = {
|
999 |
+
'get': get,
|
1000 |
+
'getAll': getAll,
|
1001 |
+
'getCategories': getCategories,
|
1002 |
+
'deregister': deregister,
|
1003 |
+
'register': register,
|
1004 |
+
'getAllWhere': getAllWhere,
|
1005 |
+
on: on
|
1006 |
};
|
1007 |
|
1008 |
+
},{"mithril":28}],7:[function(require,module,exports){
|
1009 |
'use strict'; // load CodeMirror & plugins
|
1010 |
|
1011 |
var CodeMirror = require('codemirror');
|
1060 |
previewDom.dispatchEvent(new Event('mc4wp-refresh'));
|
1061 |
}
|
1062 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1063 |
function dom() {
|
1064 |
if (domDirty) {
|
1065 |
_dom.innerHTML = FormEditor.getValue().toLowerCase();
|
1106 |
/* bootstrap */
|
1107 |
|
1108 |
|
1109 |
+
if (element) {
|
1110 |
+
window.addEventListener('load', function () {
|
1111 |
+
CodeMirror.signal(editor, "change");
|
1112 |
+
}); // set domDirty to true everytime the "change" event fires (a lot..)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1113 |
|
1114 |
+
element.addEventListener('change', function () {
|
1115 |
+
domDirty = true;
|
1116 |
+
updatePreview();
|
|
|
|
|
|
|
|
|
|
|
1117 |
});
|
1118 |
+
_dom.innerHTML = element.value.toLowerCase();
|
1119 |
+
|
1120 |
+
if (CodeMirror) {
|
1121 |
+
editor = CodeMirror.fromTextArea(element, {
|
1122 |
+
selectionPointer: true,
|
1123 |
+
mode: "htmlmixed",
|
1124 |
+
htmlMode: true,
|
1125 |
+
autoCloseTags: true,
|
1126 |
+
autoRefresh: true,
|
1127 |
+
styleActiveLine: true,
|
1128 |
+
matchBrackets: true,
|
1129 |
+
matchTags: {
|
1130 |
+
bothTags: true
|
1131 |
+
}
|
1132 |
+
}); // dispatch regular "change" on element event every time editor changes (IE9+ only)
|
1133 |
+
|
1134 |
+
window.dispatchEvent && editor.on('change', function () {
|
1135 |
+
if (typeof Event === "function") {
|
1136 |
+
// Create a new 'change' event
|
1137 |
+
var event = new Event('change', {
|
1138 |
+
bubbles: true
|
1139 |
+
});
|
1140 |
+
element.dispatchEvent(event);
|
1141 |
+
}
|
1142 |
+
});
|
1143 |
+
}
|
1144 |
}
|
1145 |
|
1146 |
+
if (previewFrame) {
|
1147 |
+
previewFrame.addEventListener('load', setPreviewDom);
|
1148 |
+
setPreviewDom.call();
|
1149 |
+
}
|
1150 |
|
1151 |
module.exports = FormEditor;
|
1152 |
|
1153 |
+
},{"codemirror":19,"codemirror/addon/edit/closetag.js":14,"codemirror/addon/edit/matchbrackets.js":15,"codemirror/addon/edit/matchtags.js":16,"codemirror/addon/fold/xml-fold.js":17,"codemirror/addon/selection/active-line.js":18,"codemirror/mode/css/css":20,"codemirror/mode/htmlmixed/htmlmixed":21,"codemirror/mode/javascript/javascript":22,"codemirror/mode/xml/xml":23}],8:[function(require,module,exports){
|
1154 |
+
'use strict';
|
1155 |
|
1156 |
+
var m = require('mithril');
|
|
|
1157 |
|
1158 |
+
var helpers = require('../helpers.js');
|
1159 |
|
1160 |
+
var editor = require('./form-editor.js');
|
|
|
|
|
|
|
|
|
1161 |
|
1162 |
+
var fields = require('./fields.js');
|
1163 |
+
|
1164 |
+
var requiredFieldsInput = document.getElementById('required-fields');
|
1165 |
|
1166 |
+
function updateFields() {
|
1167 |
+
fields.getAll().forEach(function (field) {
|
1168 |
+
// don't run for empty field names
|
1169 |
+
if (field.name.length <= 0) return;
|
1170 |
+
var fieldName = field.name;
|
1171 |
|
1172 |
+
if (field.type === 'checkbox') {
|
1173 |
+
fieldName += '[]';
|
1174 |
+
}
|
1175 |
|
1176 |
+
field.inFormContent = editor.containsField(fieldName); // if form contains 1 address field of group, mark all fields in this group as "required"
|
1177 |
|
1178 |
+
if (field.mailchimpType === 'address') {
|
1179 |
+
field.originalRequiredValue = field.originalRequiredValue === undefined ? field.forceRequired = true : field.originalRequiredValue; // query other fields for this address group
|
|
|
|
|
1180 |
|
1181 |
+
var nameGroup = field.name.replace(/\[(\w+)\]/g, '');
|
1182 |
+
|
1183 |
+
if (editor.query('[name^="' + nameGroup + '"]').length > 0) {
|
1184 |
+
if (field.originalRequiredValue === undefined) {
|
1185 |
+
field.originalRequiredValue = field.forceRequired();
|
1186 |
}
|
1187 |
+
|
1188 |
+
field.forceRequired = true;
|
1189 |
+
} else {
|
1190 |
+
field.forceRequired = field.originalRequiredValue;
|
1191 |
}
|
1192 |
+
}
|
1193 |
+
});
|
1194 |
+
findRequiredFields();
|
1195 |
+
m.redraw();
|
1196 |
+
}
|
1197 |
|
1198 |
+
function findRequiredFields() {
|
1199 |
+
// query fields required by Mailchimp
|
1200 |
+
var requiredFields = fields.getAllWhere('forceRequired', true).map(function (f) {
|
1201 |
+
return f.name.toUpperCase().replace(/\[(\w+)\]/g, '.$1');
|
1202 |
+
}); // query fields in form with [required] attribute
|
1203 |
|
1204 |
+
var requiredFieldElements = editor.query('[required]');
|
1205 |
+
[].forEach.call(requiredFieldElements, function (el) {
|
1206 |
+
var name = el.name; // bail if name attr empty or starts with underscore
|
1207 |
|
1208 |
+
if (!name || name.length < 0 || name[0] === '_') {
|
1209 |
+
return;
|
1210 |
+
} // replace array brackets with dot style notation
|
1211 |
|
1212 |
|
1213 |
+
name = name.replace(/\[(\w+)\]/g, '.$1'); // replace array-style fields
|
1214 |
|
1215 |
+
name = name.replace(/\[\]$/, ''); // uppercase everything before the .
|
1216 |
|
1217 |
+
var pos = name.indexOf('.');
|
1218 |
+
pos = pos > 0 ? pos : name.length;
|
1219 |
+
name = name.substr(0, pos).toUpperCase() + name.substr(pos); // only add field if it's not already in it
|
1220 |
|
1221 |
+
if (requiredFields.indexOf(name) === -1) {
|
1222 |
+
requiredFields.push(name);
|
1223 |
+
}
|
1224 |
+
}); // update meta
|
1225 |
|
1226 |
+
requiredFieldsInput.value = requiredFields.join(',');
|
1227 |
+
} // events
|
1228 |
+
|
1229 |
+
|
1230 |
+
editor.on('change', helpers.debounce(updateFields, 500));
|
1231 |
+
fields.on('change', helpers.debounce(updateFields, 500));
|
1232 |
+
|
1233 |
+
},{"../helpers.js":9,"./fields.js":6,"./form-editor.js":7,"mithril":28}],9:[function(require,module,exports){
|
1234 |
+
'use strict';
|
1235 |
|
1236 |
+
var helpers = {}; // polling
|
1237 |
|
1238 |
+
helpers.debounce = function (func, wait, immediate) {
|
1239 |
+
var timeout;
|
1240 |
+
return function () {
|
1241 |
+
var context = this,
|
1242 |
+
args = arguments;
|
1243 |
+
var callNow = immediate && !timeout;
|
1244 |
+
clearTimeout(timeout);
|
1245 |
+
timeout = setTimeout(function () {
|
1246 |
+
timeout = null;
|
1247 |
+
if (!immediate) func.apply(context, args);
|
1248 |
+
}, wait);
|
1249 |
+
if (callNow) func.apply(context, args);
|
1250 |
+
};
|
1251 |
};
|
1252 |
|
1253 |
+
module.exports = helpers;
|
1254 |
|
1255 |
+
},{}],10:[function(require,module,exports){
|
1256 |
'use strict';
|
1257 |
|
1258 |
+
var editor = require('./form-editor/form-editor.js');
|
1259 |
+
|
1260 |
+
var fields = require('./form-editor/fields.js');
|
1261 |
+
|
1262 |
+
var settings = require('./settings');
|
1263 |
+
|
1264 |
var notices = {};
|
1265 |
|
1266 |
function show(id, text) {
|
1292 |
container.innerHTML = html;
|
1293 |
}
|
1294 |
|
1295 |
+
var groupingsNotice = function groupingsNotice() {
|
1296 |
+
var text = "Your form contains deprecated <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.";
|
1297 |
+
var formCode = editor.getValue().toLowerCase();
|
1298 |
+
formCode.indexOf('name="groupings') > -1 ? show('deprecated_groupings', text) : hide('deprecated_groupings');
|
1299 |
+
};
|
|
|
1300 |
|
1301 |
+
var requiredFieldsNotice = function requiredFieldsNotice() {
|
1302 |
+
var requiredFields = fields.getAllWhere('forceRequired', true);
|
1303 |
+
var missingFields = requiredFields.filter(function (f) {
|
1304 |
+
return !editor.containsField(f.name.toUpperCase());
|
1305 |
+
});
|
1306 |
+
var text = '<strong>Heads up!</strong> Your form is missing list fields that are required in Mailchimp. Either add these fields to your form or mark them as optional in Mailchimp.';
|
1307 |
+
text += "<br /><ul class=\"ul-square\" style=\"margin-bottom: 0;\"><li>" + missingFields.map(function (f) {
|
1308 |
+
return f.title;
|
1309 |
+
}).join('</li><li>') + '</li></ul>';
|
1310 |
+
missingFields.length > 0 ? show('required_fields_missing', text) : hide('required_fields_missing');
|
1311 |
+
};
|
1312 |
|
1313 |
+
var mailchimpListsNotice = function mailchimpListsNotice() {
|
1314 |
+
var text = '<strong>Heads up!</strong> You have not yet selected a Mailchimp list to subscribe people to. Please select at least one list from the <a href="javascript:void(0)" data-tab="settings" class="tab-link">settings tab</a>.';
|
1315 |
|
1316 |
+
if (settings.getSelectedLists().length > 0) {
|
1317 |
+
hide('no_lists_selected');
|
1318 |
+
} else {
|
1319 |
+
show('no_lists_selected', text);
|
1320 |
+
}
|
1321 |
+
}; // old groupings
|
1322 |
|
1323 |
|
1324 |
+
groupingsNotice();
|
1325 |
+
editor.on('focus', groupingsNotice);
|
1326 |
+
editor.on('blur', groupingsNotice); // missing required fields
|
1327 |
|
1328 |
+
requiredFieldsNotice();
|
1329 |
+
editor.on('blur', requiredFieldsNotice);
|
1330 |
+
editor.on('focus', requiredFieldsNotice);
|
1331 |
+
document.body.addEventListener('change', mailchimpListsNotice);
|
|
|
1332 |
|
1333 |
+
},{"./form-editor/fields.js":6,"./form-editor/form-editor.js":7,"./settings":12}],11:[function(require,module,exports){
|
1334 |
+
'use strict';
|
|
|
1335 |
|
1336 |
+
var m = require('mithril');
|
|
|
1337 |
|
1338 |
+
var i18n = window.mc4wp_forms_i18n;
|
|
|
1339 |
|
1340 |
+
function Overlay(vnode) {
|
1341 |
+
var element;
|
1342 |
+
var onclose = vnode.attrs.onClose;
|
1343 |
|
1344 |
+
function oncreate() {
|
1345 |
+
document.addEventListener('keydown', onKeyDown);
|
1346 |
+
window.addEventListener('resize', onWindowResize);
|
1347 |
+
}
|
1348 |
|
1349 |
+
function onremove() {
|
1350 |
+
document.removeEventListener('keydown', onKeyDown);
|
1351 |
+
window.removeEventListener('resize', onWindowResize);
|
1352 |
}
|
1353 |
|
1354 |
+
function close() {
|
1355 |
+
onclose.apply(null);
|
1356 |
+
}
|
1357 |
|
1358 |
+
function onKeyDown(evt) {
|
1359 |
+
// close overlay when pressing ESC
|
1360 |
+
if (evt.keyCode === 27) {
|
1361 |
close();
|
1362 |
} // prevent ENTER
|
1363 |
|
1364 |
|
1365 |
+
if (evt.keyCode === 13) {
|
1366 |
+
evt.preventDefault();
|
1367 |
}
|
1368 |
}
|
1369 |
|
1370 |
+
function onWindowResize() {
|
1371 |
+
// fix for window width in IE8
|
|
|
1372 |
var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
1373 |
var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
1374 |
+
var marginLeft = (windowWidth - element.clientWidth - 40) / 2;
|
1375 |
+
var marginTop = (windowHeight - element.clientHeight - 40) / 2;
|
1376 |
+
element.style.left = (marginLeft > 0 ? marginLeft : 0) + "px";
|
1377 |
+
element.style.top = (marginTop > 0 ? marginTop : 0) + "px";
|
1378 |
}
|
1379 |
|
1380 |
+
function view(vnode) {
|
1381 |
+
return [m('div.overlay-wrap', m("div.overlay", {
|
1382 |
+
oncreate: function oncreate(vnode) {
|
1383 |
+
element = vnode.dom;
|
1384 |
+
onWindowResize();
|
1385 |
+
}
|
1386 |
+
}, [// close icon
|
1387 |
+
m('span', {
|
1388 |
+
"class": 'close dashicons dashicons-no',
|
1389 |
+
title: i18n.close,
|
1390 |
+
onclick: close
|
1391 |
+
}), vnode.children])), m('div.overlay-background', {
|
1392 |
+
title: i18n.close,
|
1393 |
+
onclick: close
|
1394 |
+
})];
|
1395 |
}
|
1396 |
|
1397 |
+
return {
|
1398 |
+
oncreate: oncreate,
|
1399 |
+
onremove: onremove,
|
1400 |
+
view: view
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1401 |
};
|
1402 |
+
}
|
1403 |
+
|
1404 |
+
module.exports = Overlay;
|
1405 |
|
1406 |
+
},{"mithril":28}],12:[function(require,module,exports){
|
1407 |
+
'use strict';
|
1408 |
|
1409 |
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
|
1410 |
|
1411 |
+
var context = document.getElementById('mc4wp-admin');
|
1412 |
+
var listInputs = context.querySelectorAll('.mc4wp-list-input');
|
1413 |
+
var lists = window.mc4wp_vars.mailchimp.lists;
|
1414 |
+
var selectedLists = [];
|
1415 |
+
var listeners = {}; // functions
|
1416 |
+
|
1417 |
+
function getSelectedListsWhere(searchKey, searchValue) {
|
1418 |
+
return selectedLists.filter(function (el) {
|
1419 |
+
return el[searchKey] === searchValue;
|
1420 |
+
});
|
1421 |
+
}
|
1422 |
+
|
1423 |
+
function getSelectedLists() {
|
1424 |
+
return selectedLists;
|
1425 |
+
}
|
1426 |
+
|
1427 |
+
function updateSelectedLists() {
|
1428 |
+
selectedLists = [];
|
1429 |
+
[].forEach.call(listInputs, function (input) {
|
1430 |
+
// skip unchecked checkboxes
|
1431 |
+
if (typeof input.checked === "boolean" && !input.checked) {
|
1432 |
+
return;
|
1433 |
+
}
|
1434 |
|
1435 |
+
if (_typeof(lists[input.value]) === "object") {
|
1436 |
+
selectedLists.push(lists[input.value]);
|
1437 |
+
}
|
1438 |
+
});
|
1439 |
+
toggleVisibleLists();
|
1440 |
+
emit('selectedLists.change', [selectedLists]);
|
1441 |
+
return selectedLists;
|
1442 |
+
}
|
1443 |
|
1444 |
+
function toggleVisibleLists() {
|
1445 |
+
var rows = document.querySelectorAll('.lists--only-selected > *');
|
1446 |
+
[].forEach.call(rows, function (el) {
|
1447 |
+
var listId = el.getAttribute('data-list-id');
|
1448 |
+
var isSelected = getSelectedListsWhere('id', listId).length > 0;
|
1449 |
+
el.style.display = isSelected ? '' : 'none';
|
1450 |
+
});
|
1451 |
+
}
|
1452 |
|
1453 |
+
function emit(event, args) {
|
1454 |
+
listeners[event] = listeners[event] || [];
|
1455 |
+
listeners[event].forEach(function (f) {
|
1456 |
+
return f.apply(null, args);
|
1457 |
+
});
|
1458 |
+
}
|
1459 |
|
1460 |
+
function on(event, func) {
|
1461 |
+
listeners[event] = listeners[event] || [];
|
1462 |
+
listeners[event].push(func);
|
1463 |
+
}
|
1464 |
|
1465 |
+
[].forEach.call(listInputs, function (el) {
|
1466 |
+
el.addEventListener('change', updateSelectedLists);
|
1467 |
+
});
|
1468 |
+
updateSelectedLists();
|
1469 |
+
module.exports = {
|
1470 |
+
getSelectedLists: getSelectedLists,
|
1471 |
+
on: on
|
1472 |
+
};
|
1473 |
|
1474 |
+
},{}],13:[function(require,module,exports){
|
1475 |
+
'use strict';
|
1476 |
|
1477 |
+
var editor = require('./admin/form-editor/form-editor.js');
|
|
|
|
|
1478 |
|
1479 |
+
require('./admin/form-editor/form-watcher.js');
|
1480 |
|
1481 |
+
require('./admin/form-editor/field-helper.js');
|
1482 |
|
1483 |
+
require('./admin/form-editor/field-manager.js');
|
1484 |
|
1485 |
+
require('./admin/notices.js'); // expose to global script
|
|
|
|
|
|
|
|
|
|
|
|
|
1486 |
|
|
|
1487 |
|
|
|
1488 |
window.mc4wp.forms = window.mc4wp.forms || {};
|
1489 |
window.mc4wp.forms.editor = editor;
|
|
|
1490 |
|
1491 |
+
},{"./admin/form-editor/field-helper.js":4,"./admin/form-editor/field-manager.js":5,"./admin/form-editor/form-editor.js":7,"./admin/form-editor/form-watcher.js":8,"./admin/notices.js":10}],14:[function(require,module,exports){
|
1492 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
1493 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
1494 |
|
1551 |
if (!ranges[i].empty()) return CodeMirror.Pass;
|
1552 |
var pos = ranges[i].head, tok = cm.getTokenAt(pos);
|
1553 |
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
|
1554 |
+
var tagInfo = inner.mode.xmlCurrentTag && inner.mode.xmlCurrentTag(state)
|
1555 |
+
var tagName = tagInfo && tagInfo.name
|
1556 |
+
if (!tagName) return CodeMirror.Pass
|
1557 |
|
1558 |
var html = inner.mode.configuration == "html";
|
1559 |
var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose);
|
1560 |
var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent);
|
1561 |
|
|
|
1562 |
if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);
|
1563 |
var lowerTagName = tagName.toLowerCase();
|
1564 |
// Don't process the '>' at the end of an end-tag or self-closing tag
|
1565 |
if (!tagName ||
|
1566 |
tok.type == "string" && (tok.end != pos.ch || !/[\"\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) ||
|
1567 |
+
tok.type == "tag" && tagInfo.close ||
|
1568 |
tok.string.indexOf("/") == (tok.string.length - 1) || // match something like <someTagName />
|
1569 |
dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 ||
|
1570 |
+
closingTagExists(cm, inner.mode.xmlCurrentContext && inner.mode.xmlCurrentContext(state) || [], tagName, pos, true))
|
1571 |
return CodeMirror.Pass;
|
1572 |
|
1573 |
var emptyTags = typeof opt == "object" && opt.emptyTags;
|
1612 |
// when completing in JS/CSS snippet in htmlmixed mode. Does not
|
1613 |
// work for other XML embedded languages (there is no general
|
1614 |
// way to go from a mixed mode to its current XML state).
|
1615 |
+
var replacement, mixed = inner.mode.name != "xml" && cm.getMode().name == "htmlmixed"
|
1616 |
+
if (mixed && inner.mode.name == "javascript") {
|
1617 |
+
replacement = head + "script";
|
1618 |
+
} else if (mixed && inner.mode.name == "css") {
|
1619 |
+
replacement = head + "style";
|
|
|
|
|
|
|
1620 |
} else {
|
1621 |
+
var context = inner.mode.xmlCurrentContext && inner.mode.xmlCurrentContext(state)
|
1622 |
+
if (!context || (context.length && closingTagExists(cm, context, context[context.length - 1], pos)))
|
1623 |
return CodeMirror.Pass;
|
1624 |
+
replacement = head + context[context.length - 1]
|
1625 |
}
|
1626 |
if (cm.getLine(pos.line).charAt(tok.end) != ">") replacement += ">";
|
1627 |
replacements[i] = replacement;
|
1651 |
|
1652 |
// If xml-fold is loaded, we use its functionality to try and verify
|
1653 |
// whether a given tag is actually unclosed.
|
1654 |
+
function closingTagExists(cm, context, tagName, pos, newTag) {
|
1655 |
if (!CodeMirror.scanForClosingTag) return false;
|
1656 |
var end = Math.min(cm.lastLine() + 1, pos.line + 500);
|
1657 |
var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end);
|
1658 |
if (!nextClose || nextClose.tag != tagName) return false;
|
|
|
1659 |
// If the immediate wrapping context contains onCx instances of
|
1660 |
// the same tag, a closing tag only exists if there are at least
|
1661 |
// that many closing tags of that type following.
|
1662 |
+
var onCx = newTag ? 1 : 0
|
1663 |
+
for (var i = context.length - 1; i >= 0; i--) {
|
1664 |
+
if (context[i] == tagName) ++onCx
|
1665 |
+
else break
|
1666 |
+
}
|
1667 |
pos = nextClose.to;
|
1668 |
for (var i = 1; i < onCx; i++) {
|
1669 |
var next = CodeMirror.scanForClosingTag(cm, pos, null, end);
|
1674 |
}
|
1675 |
});
|
1676 |
|
1677 |
+
},{"../../lib/codemirror":19,"../fold/xml-fold":17}],15:[function(require,module,exports){
|
1678 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
1679 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
1680 |
|
1826 |
});
|
1827 |
});
|
1828 |
|
1829 |
+
},{"../../lib/codemirror":19}],16:[function(require,module,exports){
|
1830 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
1831 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
1832 |
|
1894 |
};
|
1895 |
});
|
1896 |
|
1897 |
+
},{"../../lib/codemirror":19,"../fold/xml-fold":17}],17:[function(require,module,exports){
|
1898 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
1899 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
1900 |
|
2080 |
};
|
2081 |
});
|
2082 |
|
2083 |
+
},{"../../lib/codemirror":19}],18:[function(require,module,exports){
|
2084 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2085 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
2086 |
|
2154 |
}
|
2155 |
});
|
2156 |
|
2157 |
+
},{"../../lib/codemirror":19}],19:[function(require,module,exports){
|
2158 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2159 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
2160 |
|
4441 |
function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
|
4442 |
function paddingH(display) {
|
4443 |
if (display.cachedPaddingH) { return display.cachedPaddingH }
|
4444 |
+
var e = removeChildrenAndAdd(display.measure, elt("pre", "x", "CodeMirror-line-like"));
|
4445 |
var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
|
4446 |
var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
|
4447 |
if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }
|
4835 |
function PosWithInfo(line, ch, sticky, outside, xRel) {
|
4836 |
var pos = Pos(line, ch, sticky);
|
4837 |
pos.xRel = xRel;
|
4838 |
+
if (outside) { pos.outside = outside; }
|
4839 |
return pos
|
4840 |
}
|
4841 |
|
4844 |
function coordsChar(cm, x, y) {
|
4845 |
var doc = cm.doc;
|
4846 |
y += cm.display.viewOffset;
|
4847 |
+
if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }
|
4848 |
var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
|
4849 |
if (lineN > last)
|
4850 |
+
{ return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }
|
4851 |
if (x < 0) { x = 0; }
|
4852 |
|
4853 |
var lineObj = getLine(doc, lineN);
|
4854 |
for (;;) {
|
4855 |
var found = coordsCharInner(cm, lineObj, lineN, x, y);
|
4856 |
+
var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));
|
4857 |
if (!collapsed) { return found }
|
4858 |
var rangeEnd = collapsed.find(1);
|
4859 |
if (rangeEnd.line == lineN) { return rangeEnd }
|
4941 |
// base X position
|
4942 |
var coords = cursorCoords(cm, Pos(lineNo$$1, ch, sticky), "line", lineObj, preparedMeasure);
|
4943 |
baseX = coords.left;
|
4944 |
+
outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0;
|
4945 |
}
|
4946 |
|
4947 |
ch = skipExtendingChars(lineObj.text, ch, 1);
|
5010 |
function textHeight(display) {
|
5011 |
if (display.cachedTextHeight != null) { return display.cachedTextHeight }
|
5012 |
if (measureText == null) {
|
5013 |
+
measureText = elt("pre", null, "CodeMirror-line-like");
|
5014 |
// Measure a bunch of lines, for browsers that compute
|
5015 |
// fractional heights.
|
5016 |
for (var i = 0; i < 49; ++i) {
|
5030 |
function charWidth(display) {
|
5031 |
if (display.cachedCharWidth != null) { return display.cachedCharWidth }
|
5032 |
var anchor = elt("span", "xxxxxxxxxx");
|
5033 |
+
var pre = elt("pre", [anchor], "CodeMirror-line-like");
|
5034 |
removeChildrenAndAdd(display.measure, pre);
|
5035 |
var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
|
5036 |
if (width > 2) { display.cachedCharWidth = width; }
|
7304 |
var line = getLine(doc, pos.line);
|
7305 |
if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
|
7306 |
var sp = line.markedSpans[i], m = sp.marker;
|
7307 |
+
|
7308 |
+
// Determine if we should prevent the cursor being placed to the left/right of an atomic marker
|
7309 |
+
// Historically this was determined using the inclusiveLeft/Right option, but the new way to control it
|
7310 |
+
// is with selectLeft/Right
|
7311 |
+
var preventCursorLeft = ("selectLeft" in m) ? !m.selectLeft : m.inclusiveLeft;
|
7312 |
+
var preventCursorRight = ("selectRight" in m) ? !m.selectRight : m.inclusiveRight;
|
7313 |
+
|
7314 |
+
if ((sp.from == null || (preventCursorLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
|
7315 |
+
(sp.to == null || (preventCursorRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
|
7316 |
if (mayClear) {
|
7317 |
signal(m, "beforeCursorEnter");
|
7318 |
if (m.explicitlyCleared) {
|
7324 |
|
7325 |
if (oldPos) {
|
7326 |
var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);
|
7327 |
+
if (dir < 0 ? preventCursorRight : preventCursorLeft)
|
7328 |
{ near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }
|
7329 |
if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
|
7330 |
{ return skipAtomicInner(doc, near, pos, dir, mayClear) }
|
7331 |
}
|
7332 |
|
7333 |
var far = m.find(dir < 0 ? -1 : 1);
|
7334 |
+
if (dir < 0 ? preventCursorLeft : preventCursorRight)
|
7335 |
{ far = movePos(doc, far, dir, far.line == pos.line ? line : null); }
|
7336 |
return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
|
7337 |
}
|
7560 |
if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }
|
7561 |
else { updateDoc(doc, change, spans); }
|
7562 |
setSelectionNoUndo(doc, selAfter, sel_dontScroll);
|
7563 |
+
|
7564 |
+
if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))
|
7565 |
+
{ doc.cantEdit = false; }
|
7566 |
}
|
7567 |
|
7568 |
// Handle the interaction of a change to a document with the editor
|
9867 |
for (var i = newBreaks.length - 1; i >= 0; i--)
|
9868 |
{ replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }
|
9869 |
});
|
9870 |
+
option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function (cm, val, old) {
|
9871 |
cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
|
9872 |
if (old != Init) { cm.refresh(); }
|
9873 |
});
|
11816 |
textarea.style.display = "";
|
11817 |
if (textarea.form) {
|
11818 |
off(textarea.form, "submit", save);
|
11819 |
+
if (!options.leaveSubmitMethodAlone && typeof textarea.form.submit == "function")
|
11820 |
{ textarea.form.submit = realSubmit; }
|
11821 |
}
|
11822 |
};
|
11915 |
|
11916 |
addLegacyProps(CodeMirror);
|
11917 |
|
11918 |
+
CodeMirror.version = "5.49.0";
|
11919 |
|
11920 |
return CodeMirror;
|
11921 |
|
11922 |
})));
|
11923 |
|
11924 |
+
},{}],20:[function(require,module,exports){
|
11925 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
11926 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
11927 |
|
12754 |
|
12755 |
});
|
12756 |
|
12757 |
+
},{"../../lib/codemirror":19}],21:[function(require,module,exports){
|
12758 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
12759 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
12760 |
|
12908 |
CodeMirror.defineMIME("text/html", "htmlmixed");
|
12909 |
});
|
12910 |
|
12911 |
+
},{"../../lib/codemirror":19,"../css/css":20,"../javascript/javascript":22,"../xml/xml":23}],22:[function(require,module,exports){
|
12912 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
12913 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
12914 |
|
12978 |
if (ch == '"' || ch == "'") {
|
12979 |
state.tokenize = tokenString(ch);
|
12980 |
return state.tokenize(stream, state);
|
12981 |
+
} else if (ch == "." && stream.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/)) {
|
12982 |
return ret("number", "number");
|
12983 |
} else if (ch == "." && stream.match("..")) {
|
12984 |
return ret("spread", "meta");
|
12986 |
return ret(ch);
|
12987 |
} else if (ch == "=" && stream.eat(">")) {
|
12988 |
return ret("=>", "operator");
|
12989 |
+
} else if (ch == "0" && stream.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/)) {
|
12990 |
return ret("number", "number");
|
12991 |
} else if (/\d/.test(ch)) {
|
12992 |
+
stream.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/);
|
12993 |
return ret("number", "number");
|
12994 |
} else if (ch == "/") {
|
12995 |
if (stream.eat("*")) {
|
13012 |
} else if (ch == "#") {
|
13013 |
stream.skipToEnd();
|
13014 |
return ret("error", "error");
|
13015 |
+
} else if (ch == "<" && stream.match("!--") || ch == "-" && stream.match("->")) {
|
13016 |
+
stream.skipToEnd()
|
13017 |
+
return ret("comment", "comment")
|
13018 |
} else if (isOperatorChar.test(ch)) {
|
13019 |
if (ch != ">" || !state.lexical || state.lexical.type != ">") {
|
13020 |
if (stream.eat("=")) {
|
13109 |
++depth;
|
13110 |
} else if (wordRE.test(ch)) {
|
13111 |
sawSomething = true;
|
13112 |
+
} else if (/["'\/`]/.test(ch)) {
|
13113 |
+
for (;; --pos) {
|
13114 |
+
if (pos == 0) return
|
13115 |
+
var next = stream.string.charAt(pos - 1)
|
13116 |
+
if (next == ch && stream.string.charAt(pos - 2) != "\\") { pos--; break }
|
13117 |
+
}
|
13118 |
} else if (sawSomething && !depth) {
|
13119 |
++pos;
|
13120 |
break;
|
13492 |
}
|
13493 |
function maybetype(type, value) {
|
13494 |
if (isTS) {
|
13495 |
+
if (type == ":") return cont(typeexpr);
|
13496 |
if (value == "?") return cont(maybetype);
|
13497 |
}
|
13498 |
}
|
13499 |
+
function maybetypeOrIn(type, value) {
|
13500 |
+
if (isTS && (type == ":" || value == "in")) return cont(typeexpr)
|
13501 |
+
}
|
13502 |
function mayberettype(type) {
|
13503 |
if (isTS && type == ":") {
|
13504 |
if (cx.stream.match(/^\s*\w+\s+is\b/, false)) return cont(expression, isKW, typeexpr)
|
13539 |
} else if (type == ":") {
|
13540 |
return cont(typeexpr)
|
13541 |
} else if (type == "[") {
|
13542 |
+
return cont(expect("variable"), maybetypeOrIn, expect("]"), typeprop)
|
13543 |
} else if (type == "(") {
|
13544 |
return pass(functiondecl, typeprop)
|
13545 |
}
|
13840 |
|
13841 |
});
|
13842 |
|
13843 |
+
},{"../../lib/codemirror":19}],23:[function(require,module,exports){
|
13844 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
13845 |
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
13846 |
|
14233 |
skipAttribute: function(state) {
|
14234 |
if (state.state == attrValueState)
|
14235 |
state.state = attrState
|
14236 |
+
},
|
14237 |
+
|
14238 |
+
xmlCurrentTag: function(state) {
|
14239 |
+
return state.tagName ? {name: state.tagName, close: state.type == "closeTag"} : null
|
14240 |
+
},
|
14241 |
+
|
14242 |
+
xmlCurrentContext: function(state) {
|
14243 |
+
var context = []
|
14244 |
+
for (var cx = state.context; cx; cx = cx.prev)
|
14245 |
+
if (cx.tagName) context.push(cx.tagName)
|
14246 |
+
return context.reverse()
|
14247 |
}
|
14248 |
};
|
14249 |
});
|
14255 |
|
14256 |
});
|
14257 |
|
14258 |
+
},{"../../lib/codemirror":19}],24:[function(require,module,exports){
|
14259 |
/*
|
14260 |
|
14261 |
Style HTML
|
14792 |
module.exports = {
|
14793 |
prettyPrint: style_html
|
14794 |
};
|
14795 |
+
},{}],25:[function(require,module,exports){
|
14796 |
"use strict"
|
14797 |
|
14798 |
+
var Vnode = require("../render/vnode")
|
14799 |
+
|
14800 |
+
module.exports = function(render, schedule, console) {
|
14801 |
+
var subscriptions = []
|
14802 |
+
var rendering = false
|
14803 |
+
var pending = false
|
14804 |
+
|
14805 |
+
function sync() {
|
14806 |
+
if (rendering) throw new Error("Nested m.redraw.sync() call")
|
14807 |
+
rendering = true
|
14808 |
+
for (var i = 0; i < subscriptions.length; i += 2) {
|
14809 |
+
try { render(subscriptions[i], Vnode(subscriptions[i + 1]), redraw) }
|
14810 |
+
catch (e) { console.error(e) }
|
14811 |
+
}
|
14812 |
+
rendering = false
|
14813 |
+
}
|
14814 |
+
|
14815 |
+
function redraw() {
|
14816 |
+
if (!pending) {
|
14817 |
+
pending = true
|
14818 |
+
schedule(function() {
|
14819 |
+
pending = false
|
14820 |
+
sync()
|
14821 |
+
})
|
14822 |
+
}
|
14823 |
+
}
|
14824 |
+
|
14825 |
+
redraw.sync = sync
|
14826 |
+
|
14827 |
+
function mount(root, component) {
|
14828 |
+
if (component != null && component.view == null && typeof component !== "function") {
|
14829 |
+
throw new TypeError("m.mount(element, component) expects a component, not a vnode")
|
14830 |
+
}
|
14831 |
+
|
14832 |
+
var index = subscriptions.indexOf(root)
|
14833 |
+
if (index >= 0) {
|
14834 |
+
subscriptions.splice(index, 2)
|
14835 |
+
render(root, [], redraw)
|
14836 |
+
}
|
14837 |
+
|
14838 |
+
if (component != null) {
|
14839 |
+
subscriptions.push(root, component)
|
14840 |
+
render(root, Vnode(component), redraw)
|
14841 |
+
}
|
14842 |
+
}
|
14843 |
+
|
14844 |
+
return {mount: mount, redraw: redraw}
|
14845 |
+
}
|
14846 |
|
14847 |
+
},{"../render/vnode":44}],26:[function(require,module,exports){
|
14848 |
+
(function (setImmediate){
|
|
|
14849 |
"use strict"
|
|
|
14850 |
|
14851 |
+
var Vnode = require("../render/vnode")
|
14852 |
+
var m = require("../render/hyperscript")
|
14853 |
+
var Promise = require("../promise/promise")
|
14854 |
+
|
14855 |
+
var buildPathname = require("../pathname/build")
|
14856 |
+
var parsePathname = require("../pathname/parse")
|
14857 |
+
var compileTemplate = require("../pathname/compileTemplate")
|
14858 |
+
var assign = require("../pathname/assign")
|
14859 |
+
|
14860 |
+
var sentinel = {}
|
14861 |
+
|
14862 |
+
module.exports = function($window, mountRedraw) {
|
14863 |
+
var fireAsync
|
14864 |
+
|
14865 |
+
function setPath(path, data, options) {
|
14866 |
+
path = buildPathname(path, data)
|
14867 |
+
if (fireAsync != null) {
|
14868 |
+
fireAsync()
|
14869 |
+
var state = options ? options.state : null
|
14870 |
+
var title = options ? options.title : null
|
14871 |
+
if (options && options.replace) $window.history.replaceState(state, title, route.prefix + path)
|
14872 |
+
else $window.history.pushState(state, title, route.prefix + path)
|
14873 |
+
}
|
14874 |
+
else {
|
14875 |
+
$window.location.href = route.prefix + path
|
14876 |
+
}
|
14877 |
}
|
|
|
14878 |
|
14879 |
+
var currentResolver = sentinel, component, attrs, currentPath, lastUpdate
|
14880 |
|
14881 |
+
var SKIP = route.SKIP = {}
|
14882 |
+
|
14883 |
+
function route(root, defaultRoute, routes) {
|
14884 |
+
if (root == null) throw new Error("Ensure the DOM element that was passed to `m.route` is not undefined")
|
14885 |
+
// 0 = start
|
14886 |
+
// 1 = init
|
14887 |
+
// 2 = ready
|
14888 |
+
var state = 0
|
14889 |
+
|
14890 |
+
var compiled = Object.keys(routes).map(function(route) {
|
14891 |
+
if (route[0] !== "/") throw new SyntaxError("Routes must start with a `/`")
|
14892 |
+
if ((/:([^\/\.-]+)(\.{3})?:/).test(route)) {
|
14893 |
+
throw new SyntaxError("Route parameter names must be separated with either `/`, `.`, or `-`")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14894 |
}
|
14895 |
+
return {
|
14896 |
+
route: route,
|
14897 |
+
component: routes[route],
|
14898 |
+
check: compileTemplate(route),
|
14899 |
+
}
|
14900 |
+
})
|
14901 |
+
var callAsync = typeof setImmediate === "function" ? setImmediate : setTimeout
|
14902 |
+
var p = Promise.resolve()
|
14903 |
+
var scheduled = false
|
14904 |
+
var onremove
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14905 |
|
14906 |
+
fireAsync = null
|
|
|
|
|
|
|
|
|
|
|
14907 |
|
14908 |
+
if (defaultRoute != null) {
|
14909 |
+
var defaultData = parsePathname(defaultRoute)
|
14910 |
+
|
14911 |
+
if (!compiled.some(function (i) { return i.check(defaultData) })) {
|
14912 |
+
throw new ReferenceError("Default route doesn't match any known routes")
|
14913 |
+
}
|
14914 |
+
}
|
14915 |
+
|
14916 |
+
function resolveRoute() {
|
14917 |
+
scheduled = false
|
14918 |
+
// Consider the pathname holistically. The prefix might even be invalid,
|
14919 |
+
// but that's not our problem.
|
14920 |
+
var prefix = $window.location.hash
|
14921 |
+
if (route.prefix[0] !== "#") {
|
14922 |
+
prefix = $window.location.search + prefix
|
14923 |
+
if (route.prefix[0] !== "?") {
|
14924 |
+
prefix = $window.location.pathname + prefix
|
14925 |
+
if (prefix[0] !== "/") prefix = "/" + prefix
|
14926 |
+
}
|
14927 |
+
}
|
14928 |
+
// This seemingly useless `.concat()` speeds up the tests quite a bit,
|
14929 |
+
// since the representation is consistently a relatively poorly
|
14930 |
+
// optimized cons string.
|
14931 |
+
var path = prefix.concat()
|
14932 |
+
.replace(/(?:%[a-f89][a-f0-9])+/gim, decodeURIComponent)
|
14933 |
+
.slice(route.prefix.length)
|
14934 |
+
var data = parsePathname(path)
|
14935 |
+
|
14936 |
+
assign(data.params, $window.history.state)
|
14937 |
+
|
14938 |
+
function fail() {
|
14939 |
+
if (path === defaultRoute) throw new Error("Could not resolve default route " + defaultRoute)
|
14940 |
+
setPath(defaultRoute, null, {replace: true})
|
14941 |
+
}
|
14942 |
|
14943 |
+
loop(0)
|
14944 |
+
function loop(i) {
|
14945 |
+
// 0 = init
|
14946 |
+
// 1 = scheduled
|
14947 |
+
// 2 = done
|
14948 |
+
for (; i < compiled.length; i++) {
|
14949 |
+
if (compiled[i].check(data)) {
|
14950 |
+
var payload = compiled[i].component
|
14951 |
+
var matchedRoute = compiled[i].route
|
14952 |
+
var localComp = payload
|
14953 |
+
var update = lastUpdate = function(comp) {
|
14954 |
+
if (update !== lastUpdate) return
|
14955 |
+
if (comp === SKIP) return loop(i + 1)
|
14956 |
+
component = comp != null && (typeof comp.view === "function" || typeof comp === "function")? comp : "div"
|
14957 |
+
attrs = data.params, currentPath = path, lastUpdate = null
|
14958 |
+
currentResolver = payload.render ? payload : null
|
14959 |
+
if (state === 2) mountRedraw.redraw()
|
14960 |
+
else {
|
14961 |
+
state = 2
|
14962 |
+
mountRedraw.redraw.sync()
|
14963 |
+
}
|
14964 |
+
}
|
14965 |
+
// There's no understating how much I *wish* I could
|
14966 |
+
// use `async`/`await` here...
|
14967 |
+
if (payload.view || typeof payload === "function") {
|
14968 |
+
payload = {}
|
14969 |
+
update(localComp)
|
14970 |
+
}
|
14971 |
+
else if (payload.onmatch) {
|
14972 |
+
p.then(function () {
|
14973 |
+
return payload.onmatch(data.params, path, matchedRoute)
|
14974 |
+
}).then(update, fail)
|
14975 |
+
}
|
14976 |
+
else update("div")
|
14977 |
+
return
|
14978 |
+
}
|
14979 |
+
}
|
14980 |
+
fail()
|
14981 |
+
}
|
14982 |
+
}
|
14983 |
+
|
14984 |
+
// Set it unconditionally so `m.route.set` and `m.route.Link` both work,
|
14985 |
+
// even if neither `pushState` nor `hashchange` are supported. It's
|
14986 |
+
// cleared if `hashchange` is used, since that makes it automatically
|
14987 |
+
// async.
|
14988 |
+
fireAsync = function() {
|
14989 |
+
if (!scheduled) {
|
14990 |
+
scheduled = true
|
14991 |
+
callAsync(resolveRoute)
|
14992 |
+
}
|
14993 |
+
}
|
14994 |
|
14995 |
+
if (typeof $window.history.pushState === "function") {
|
14996 |
+
onremove = function() {
|
14997 |
+
$window.removeEventListener("popstate", fireAsync, false)
|
14998 |
+
}
|
14999 |
+
$window.addEventListener("popstate", fireAsync, false)
|
15000 |
+
} else if (route.prefix[0] === "#") {
|
15001 |
+
fireAsync = null
|
15002 |
+
onremove = function() {
|
15003 |
+
$window.removeEventListener("hashchange", resolveRoute, false)
|
15004 |
+
}
|
15005 |
+
$window.addEventListener("hashchange", resolveRoute, false)
|
15006 |
+
}
|
15007 |
+
|
15008 |
+
return mountRedraw.mount(root, {
|
15009 |
+
onbeforeupdate: function() {
|
15010 |
+
state = state ? 2 : 1
|
15011 |
+
return !(!state || sentinel === currentResolver)
|
15012 |
+
},
|
15013 |
+
oncreate: resolveRoute,
|
15014 |
+
onremove: onremove,
|
15015 |
+
view: function() {
|
15016 |
+
if (!state || sentinel === currentResolver) return
|
15017 |
+
// Wrap in a fragment to preserve existing key semantics
|
15018 |
+
var vnode = [Vnode(component, attrs.key, attrs)]
|
15019 |
+
if (currentResolver) vnode = currentResolver.render(vnode[0])
|
15020 |
+
return vnode
|
15021 |
+
},
|
15022 |
+
})
|
15023 |
}
|
15024 |
+
route.set = function(path, data, options) {
|
15025 |
+
if (lastUpdate != null) {
|
15026 |
+
options = options || {}
|
15027 |
+
options.replace = true
|
15028 |
+
}
|
15029 |
+
lastUpdate = null
|
15030 |
+
setPath(path, data, options)
|
15031 |
+
}
|
15032 |
+
route.get = function() {return currentPath}
|
15033 |
+
route.prefix = "#!"
|
15034 |
+
route.Link = {
|
15035 |
+
view: function(vnode) {
|
15036 |
+
var options = vnode.attrs.options
|
15037 |
+
// Remove these so they don't get overwritten
|
15038 |
+
var attrs = {}, onclick, href
|
15039 |
+
assign(attrs, vnode.attrs)
|
15040 |
+
// The first two are internal, but the rest are magic attributes
|
15041 |
+
// that need censored to not screw up rendering.
|
15042 |
+
attrs.selector = attrs.options = attrs.key = attrs.oninit =
|
15043 |
+
attrs.oncreate = attrs.onbeforeupdate = attrs.onupdate =
|
15044 |
+
attrs.onbeforeremove = attrs.onremove = null
|
15045 |
+
|
15046 |
+
// Do this now so we can get the most current `href` and `disabled`.
|
15047 |
+
// Those attributes may also be specified in the selector, and we
|
15048 |
+
// should honor that.
|
15049 |
+
var child = m(vnode.attrs.selector || "a", attrs, vnode.children)
|
15050 |
+
|
15051 |
+
// Let's provide a *right* way to disable a route link, rather than
|
15052 |
+
// letting people screw up accessibility on accident.
|
15053 |
+
//
|
15054 |
+
// The attribute is coerced so users don't get surprised over
|
15055 |
+
// `disabled: 0` resulting in a button that's somehow routable
|
15056 |
+
// despite being visibly disabled.
|
15057 |
+
if (child.attrs.disabled = Boolean(child.attrs.disabled)) {
|
15058 |
+
child.attrs.href = null
|
15059 |
+
child.attrs["aria-disabled"] = "true"
|
15060 |
+
// If you *really* do want to do this on a disabled link, use
|
15061 |
+
// an `oncreate` hook to add it.
|
15062 |
+
child.attrs.onclick = null
|
15063 |
+
} else {
|
15064 |
+
onclick = child.attrs.onclick
|
15065 |
+
href = child.attrs.href
|
15066 |
+
child.attrs.href = route.prefix + href
|
15067 |
+
child.attrs.onclick = function(e) {
|
15068 |
+
var result
|
15069 |
+
if (typeof onclick === "function") {
|
15070 |
+
result = onclick.call(e.currentTarget, e)
|
15071 |
+
} else if (onclick == null || typeof onclick !== "object") {
|
15072 |
+
// do nothing
|
15073 |
+
} else if (typeof onclick.handleEvent === "function") {
|
15074 |
+
onclick.handleEvent(e)
|
15075 |
+
}
|
15076 |
+
|
15077 |
+
// Adapted from React Router's implementation:
|
15078 |
+
// https://github.com/ReactTraining/react-router/blob/520a0acd48ae1b066eb0b07d6d4d1790a1d02482/packages/react-router-dom/modules/Link.js
|
15079 |
+
//
|
15080 |
+
// Try to be flexible and intuitive in how we handle links.
|
15081 |
+
// Fun fact: links aren't as obvious to get right as you
|
15082 |
+
// would expect. There's a lot more valid ways to click a
|
15083 |
+
// link than this, and one might want to not simply click a
|
15084 |
+
// link, but right click or command-click it to copy the
|
15085 |
+
// link target, etc. Nope, this isn't just for blind people.
|
15086 |
+
if (
|
15087 |
+
// Skip if `onclick` prevented default
|
15088 |
+
result !== false && !e.defaultPrevented &&
|
15089 |
+
// Ignore everything but left clicks
|
15090 |
+
(e.button === 0 || e.which === 0 || e.which === 1) &&
|
15091 |
+
// Let the browser handle `target=_blank`, etc.
|
15092 |
+
(!e.currentTarget.target || e.currentTarget.target === "_self") &&
|
15093 |
+
// No modifier keys
|
15094 |
+
!e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey
|
15095 |
+
) {
|
15096 |
+
e.preventDefault()
|
15097 |
+
e.redraw = false
|
15098 |
+
route.set(href, null, options)
|
15099 |
+
}
|
15100 |
+
}
|
15101 |
+
}
|
15102 |
+
return child
|
15103 |
+
},
|
15104 |
}
|
15105 |
+
route.param = function(key) {
|
15106 |
+
return attrs && key != null ? attrs[key] : attrs
|
|
|
|
|
15107 |
}
|
15108 |
+
|
15109 |
+
return route
|
15110 |
}
|
15111 |
|
15112 |
+
}).call(this,require("timers").setImmediate)
|
15113 |
+
},{"../pathname/assign":30,"../pathname/build":31,"../pathname/compileTemplate":32,"../pathname/parse":33,"../promise/promise":35,"../render/hyperscript":40,"../render/vnode":44,"timers":49}],27:[function(require,module,exports){
|
15114 |
+
"use strict"
|
|
|
15115 |
|
15116 |
+
var hyperscript = require("./render/hyperscript")
|
|
|
|
|
|
|
15117 |
|
15118 |
+
hyperscript.trust = require("./render/trust")
|
15119 |
+
hyperscript.fragment = require("./render/fragment")
|
15120 |
+
|
15121 |
+
module.exports = hyperscript
|
15122 |
+
|
15123 |
+
},{"./render/fragment":39,"./render/hyperscript":40,"./render/trust":43}],28:[function(require,module,exports){
|
15124 |
+
"use strict"
|
15125 |
+
|
15126 |
+
var hyperscript = require("./hyperscript")
|
15127 |
+
var request = require("./request")
|
15128 |
+
var mountRedraw = require("./mount-redraw")
|
15129 |
+
|
15130 |
+
var m = function m() { return hyperscript.apply(this, arguments) }
|
15131 |
+
m.m = hyperscript
|
15132 |
+
m.trust = hyperscript.trust
|
15133 |
+
m.fragment = hyperscript.fragment
|
15134 |
+
m.mount = mountRedraw.mount
|
15135 |
+
m.route = require("./route")
|
15136 |
+
m.render = require("./render")
|
15137 |
+
m.redraw = mountRedraw.redraw
|
15138 |
+
m.request = request.request
|
15139 |
+
m.jsonp = request.jsonp
|
15140 |
+
m.parseQueryString = require("./querystring/parse")
|
15141 |
+
m.buildQueryString = require("./querystring/build")
|
15142 |
+
m.parsePathname = require("./pathname/parse")
|
15143 |
+
m.buildPathname = require("./pathname/build")
|
15144 |
+
m.vnode = require("./render/vnode")
|
15145 |
+
m.PromisePolyfill = require("./promise/polyfill")
|
15146 |
+
|
15147 |
+
module.exports = m
|
15148 |
+
|
15149 |
+
},{"./hyperscript":27,"./mount-redraw":29,"./pathname/build":31,"./pathname/parse":33,"./promise/polyfill":34,"./querystring/build":36,"./querystring/parse":37,"./render":38,"./render/vnode":44,"./request":45,"./route":47}],29:[function(require,module,exports){
|
15150 |
+
"use strict"
|
15151 |
+
|
15152 |
+
var render = require("./render")
|
15153 |
|
15154 |
+
module.exports = require("./api/mount-redraw")(render, requestAnimationFrame, console)
|
|
|
|
|
|
|
15155 |
|
15156 |
+
},{"./api/mount-redraw":25,"./render":38}],30:[function(require,module,exports){
|
15157 |
+
"use strict"
|
15158 |
|
15159 |
+
module.exports = Object.assign || function(target, source) {
|
15160 |
+
if(source) Object.keys(source).forEach(function(key) { target[key] = source[key] })
|
15161 |
}
|
15162 |
|
15163 |
+
},{}],31:[function(require,module,exports){
|
15164 |
+
"use strict"
|
|
|
|
|
|
|
|
|
15165 |
|
15166 |
+
var buildQueryString = require("../querystring/build")
|
15167 |
+
var assign = require("./assign")
|
15168 |
|
15169 |
+
// Returns `path` from `template` + `params`
|
15170 |
+
module.exports = function(template, params) {
|
15171 |
+
if ((/:([^\/\.-]+)(\.{3})?:/).test(template)) {
|
15172 |
+
throw new SyntaxError("Template parameter names *must* be separated")
|
15173 |
+
}
|
15174 |
+
if (params == null) return template
|
15175 |
+
var queryIndex = template.indexOf("?")
|
15176 |
+
var hashIndex = template.indexOf("#")
|
15177 |
+
var queryEnd = hashIndex < 0 ? template.length : hashIndex
|
15178 |
+
var pathEnd = queryIndex < 0 ? queryEnd : queryIndex
|
15179 |
+
var path = template.slice(0, pathEnd)
|
15180 |
+
var query = {}
|
15181 |
+
|
15182 |
+
assign(query, params)
|
15183 |
+
|
15184 |
+
var resolved = path.replace(/:([^\/\.-]+)(\.{3})?/g, function(m, key, variadic) {
|
15185 |
+
delete query[key]
|
15186 |
+
// If no such parameter exists, don't interpolate it.
|
15187 |
+
if (params[key] == null) return m
|
15188 |
+
// Escape normal parameters, but not variadic ones.
|
15189 |
+
return variadic ? params[key] : encodeURIComponent(String(params[key]))
|
15190 |
+
})
|
15191 |
+
|
15192 |
+
// In case the template substitution adds new query/hash parameters.
|
15193 |
+
var newQueryIndex = resolved.indexOf("?")
|
15194 |
+
var newHashIndex = resolved.indexOf("#")
|
15195 |
+
var newQueryEnd = newHashIndex < 0 ? resolved.length : newHashIndex
|
15196 |
+
var newPathEnd = newQueryIndex < 0 ? newQueryEnd : newQueryIndex
|
15197 |
+
var result = resolved.slice(0, newPathEnd)
|
15198 |
+
|
15199 |
+
if (queryIndex >= 0) result += template.slice(queryIndex, queryEnd)
|
15200 |
+
if (newQueryIndex >= 0) result += (queryIndex < 0 ? "?" : "&") + resolved.slice(newQueryIndex, newQueryEnd)
|
15201 |
+
var querystring = buildQueryString(query)
|
15202 |
+
if (querystring) result += (queryIndex < 0 && newQueryIndex < 0 ? "?" : "&") + querystring
|
15203 |
+
if (hashIndex >= 0) result += template.slice(hashIndex)
|
15204 |
+
if (newHashIndex >= 0) result += (hashIndex < 0 ? "" : "&") + resolved.slice(newHashIndex)
|
15205 |
+
return result
|
15206 |
+
}
|
15207 |
|
15208 |
+
},{"../querystring/build":36,"./assign":30}],32:[function(require,module,exports){
|
15209 |
+
"use strict"
|
15210 |
|
15211 |
+
var parsePathname = require("./parse")
|
15212 |
+
|
15213 |
+
// Compiles a template into a function that takes a resolved path (without query
|
15214 |
+
// strings) and returns an object containing the template parameters with their
|
15215 |
+
// parsed values. This expects the input of the compiled template to be the
|
15216 |
+
// output of `parsePathname`. Note that it does *not* remove query parameters
|
15217 |
+
// specified in the template.
|
15218 |
+
module.exports = function(template) {
|
15219 |
+
var templateData = parsePathname(template)
|
15220 |
+
var templateKeys = Object.keys(templateData.params)
|
15221 |
+
var keys = []
|
15222 |
+
var regexp = new RegExp("^" + templateData.path.replace(
|
15223 |
+
// I escape literal text so people can use things like `:file.:ext` or
|
15224 |
+
// `:lang-:locale` in routes. This is all merged into one pass so I
|
15225 |
+
// don't also accidentally escape `-` and make it harder to detect it to
|
15226 |
+
// ban it from template parameters.
|
15227 |
+
/:([^\/.-]+)(\.{3}|\.(?!\.)|-)?|[\\^$*+.()|\[\]{}]/g,
|
15228 |
+
function(m, key, extra) {
|
15229 |
+
if (key == null) return "\\" + m
|
15230 |
+
keys.push({k: key, r: extra === "..."})
|
15231 |
+
if (extra === "...") return "(.*)"
|
15232 |
+
if (extra === ".") return "([^/]+)\\."
|
15233 |
+
return "([^/]+)" + (extra || "")
|
15234 |
+
}
|
15235 |
+
) + "$")
|
15236 |
+
return function(data) {
|
15237 |
+
// First, check the params. Usually, there isn't any, and it's just
|
15238 |
+
// checking a static set.
|
15239 |
+
for (var i = 0; i < templateKeys.length; i++) {
|
15240 |
+
if (templateData.params[templateKeys[i]] !== data.params[templateKeys[i]]) return false
|
15241 |
+
}
|
15242 |
+
// If no interpolations exist, let's skip all the ceremony
|
15243 |
+
if (!keys.length) return regexp.test(data.path)
|
15244 |
+
var values = regexp.exec(data.path)
|
15245 |
+
if (values == null) return false
|
15246 |
+
for (var i = 0; i < keys.length; i++) {
|
15247 |
+
data.params[keys[i].k] = keys[i].r ? values[i + 1] : decodeURIComponent(values[i + 1])
|
15248 |
+
}
|
15249 |
+
return true
|
15250 |
+
}
|
15251 |
}
|
15252 |
|
15253 |
+
},{"./parse":33}],33:[function(require,module,exports){
|
15254 |
+
"use strict"
|
15255 |
+
|
15256 |
+
var parseQueryString = require("../querystring/parse")
|
15257 |
+
|
15258 |
+
// Returns `{path, params}` from `url`
|
15259 |
+
module.exports = function(url) {
|
15260 |
+
var queryIndex = url.indexOf("?")
|
15261 |
+
var hashIndex = url.indexOf("#")
|
15262 |
+
var queryEnd = hashIndex < 0 ? url.length : hashIndex
|
15263 |
+
var pathEnd = queryIndex < 0 ? queryEnd : queryIndex
|
15264 |
+
var path = url.slice(0, pathEnd).replace(/\/{2,}/g, "/")
|
15265 |
|
15266 |
+
if (!path) path = "/"
|
15267 |
+
else {
|
15268 |
+
if (path[0] !== "/") path = "/" + path
|
15269 |
+
if (path.length > 1 && path[path.length - 1] === "/") path = path.slice(0, -1)
|
15270 |
+
}
|
15271 |
+
return {
|
15272 |
+
path: path,
|
15273 |
+
params: queryIndex < 0
|
15274 |
+
? {}
|
15275 |
+
: parseQueryString(url.slice(queryIndex + 1, queryEnd)),
|
15276 |
+
}
|
15277 |
+
}
|
15278 |
|
15279 |
+
},{"../querystring/parse":37}],34:[function(require,module,exports){
|
15280 |
+
(function (setImmediate){
|
15281 |
+
"use strict"
|
15282 |
+
/** @constructor */
|
15283 |
+
var PromisePolyfill = function(executor) {
|
15284 |
+
if (!(this instanceof PromisePolyfill)) throw new Error("Promise must be called with `new`")
|
15285 |
+
if (typeof executor !== "function") throw new TypeError("executor must be a function")
|
15286 |
+
|
15287 |
+
var self = this, resolvers = [], rejectors = [], resolveCurrent = handler(resolvers, true), rejectCurrent = handler(rejectors, false)
|
15288 |
+
var instance = self._instance = {resolvers: resolvers, rejectors: rejectors}
|
15289 |
+
var callAsync = typeof setImmediate === "function" ? setImmediate : setTimeout
|
15290 |
+
function handler(list, shouldAbsorb) {
|
15291 |
+
return function execute(value) {
|
15292 |
+
var then
|
15293 |
+
try {
|
15294 |
+
if (shouldAbsorb && value != null && (typeof value === "object" || typeof value === "function") && typeof (then = value.then) === "function") {
|
15295 |
+
if (value === self) throw new TypeError("Promise can't be resolved w/ itself")
|
15296 |
+
executeOnce(then.bind(value))
|
15297 |
+
}
|
15298 |
+
else {
|
15299 |
+
callAsync(function() {
|
15300 |
+
if (!shouldAbsorb && list.length === 0) console.error("Possible unhandled promise rejection:", value)
|
15301 |
+
for (var i = 0; i < list.length; i++) list[i](value)
|
15302 |
+
resolvers.length = 0, rejectors.length = 0
|
15303 |
+
instance.state = shouldAbsorb
|
15304 |
+
instance.retry = function() {execute(value)}
|
15305 |
+
})
|
15306 |
+
}
|
15307 |
+
}
|
15308 |
+
catch (e) {
|
15309 |
+
rejectCurrent(e)
|
15310 |
+
}
|
15311 |
+
}
|
15312 |
+
}
|
15313 |
+
function executeOnce(then) {
|
15314 |
+
var runs = 0
|
15315 |
+
function run(fn) {
|
15316 |
+
return function(value) {
|
15317 |
+
if (runs++ > 0) return
|
15318 |
+
fn(value)
|
15319 |
+
}
|
15320 |
+
}
|
15321 |
+
var onerror = run(rejectCurrent)
|
15322 |
+
try {then(run(resolveCurrent), onerror)} catch (e) {onerror(e)}
|
15323 |
+
}
|
15324 |
|
15325 |
+
executeOnce(executor)
|
15326 |
+
}
|
15327 |
+
PromisePolyfill.prototype.then = function(onFulfilled, onRejection) {
|
15328 |
+
var self = this, instance = self._instance
|
15329 |
+
function handle(callback, list, next, state) {
|
15330 |
+
list.push(function(value) {
|
15331 |
+
if (typeof callback !== "function") next(value)
|
15332 |
+
else try {resolveNext(callback(value))} catch (e) {if (rejectNext) rejectNext(e)}
|
15333 |
+
})
|
15334 |
+
if (typeof instance.retry === "function" && state === instance.state) instance.retry()
|
15335 |
+
}
|
15336 |
+
var resolveNext, rejectNext
|
15337 |
+
var promise = new PromisePolyfill(function(resolve, reject) {resolveNext = resolve, rejectNext = reject})
|
15338 |
+
handle(onFulfilled, instance.resolvers, resolveNext, true), handle(onRejection, instance.rejectors, rejectNext, false)
|
15339 |
+
return promise
|
15340 |
+
}
|
15341 |
+
PromisePolyfill.prototype.catch = function(onRejection) {
|
15342 |
+
return this.then(null, onRejection)
|
15343 |
+
}
|
15344 |
+
PromisePolyfill.prototype.finally = function(callback) {
|
15345 |
+
return this.then(
|
15346 |
+
function(value) {
|
15347 |
+
return PromisePolyfill.resolve(callback()).then(function() {
|
15348 |
+
return value
|
15349 |
+
})
|
15350 |
+
},
|
15351 |
+
function(reason) {
|
15352 |
+
return PromisePolyfill.resolve(callback()).then(function() {
|
15353 |
+
return PromisePolyfill.reject(reason);
|
15354 |
+
})
|
15355 |
+
}
|
15356 |
+
)
|
15357 |
+
}
|
15358 |
+
PromisePolyfill.resolve = function(value) {
|
15359 |
+
if (value instanceof PromisePolyfill) return value
|
15360 |
+
return new PromisePolyfill(function(resolve) {resolve(value)})
|
15361 |
+
}
|
15362 |
+
PromisePolyfill.reject = function(value) {
|
15363 |
+
return new PromisePolyfill(function(resolve, reject) {reject(value)})
|
15364 |
+
}
|
15365 |
+
PromisePolyfill.all = function(list) {
|
15366 |
+
return new PromisePolyfill(function(resolve, reject) {
|
15367 |
+
var total = list.length, count = 0, values = []
|
15368 |
+
if (list.length === 0) resolve([])
|
15369 |
+
else for (var i = 0; i < list.length; i++) {
|
15370 |
+
(function(i) {
|
15371 |
+
function consume(value) {
|
15372 |
+
count++
|
15373 |
+
values[i] = value
|
15374 |
+
if (count === total) resolve(values)
|
15375 |
+
}
|
15376 |
+
if (list[i] != null && (typeof list[i] === "object" || typeof list[i] === "function") && typeof list[i].then === "function") {
|
15377 |
+
list[i].then(consume, reject)
|
15378 |
+
}
|
15379 |
+
else consume(list[i])
|
15380 |
+
})(i)
|
15381 |
+
}
|
15382 |
+
})
|
15383 |
+
}
|
15384 |
+
PromisePolyfill.race = function(list) {
|
15385 |
+
return new PromisePolyfill(function(resolve, reject) {
|
15386 |
+
for (var i = 0; i < list.length; i++) {
|
15387 |
+
list[i].then(resolve, reject)
|
15388 |
+
}
|
15389 |
+
})
|
15390 |
+
}
|
15391 |
+
|
15392 |
+
module.exports = PromisePolyfill
|
15393 |
+
|
15394 |
+
}).call(this,require("timers").setImmediate)
|
15395 |
+
},{"timers":49}],35:[function(require,module,exports){
|
15396 |
+
(function (global){
|
15397 |
+
"use strict"
|
15398 |
+
|
15399 |
+
var PromisePolyfill = require("./polyfill")
|
15400 |
+
|
15401 |
+
if (typeof window !== "undefined") {
|
15402 |
+
if (typeof window.Promise === "undefined") {
|
15403 |
+
window.Promise = PromisePolyfill
|
15404 |
+
} else if (!window.Promise.prototype.finally) {
|
15405 |
+
window.Promise.prototype.finally = PromisePolyfill.prototype.finally
|
15406 |
+
}
|
15407 |
+
module.exports = window.Promise
|
15408 |
+
} else if (typeof global !== "undefined") {
|
15409 |
+
if (typeof global.Promise === "undefined") {
|
15410 |
+
global.Promise = PromisePolyfill
|
15411 |
+
} else if (!global.Promise.prototype.finally) {
|
15412 |
+
global.Promise.prototype.finally = PromisePolyfill.prototype.finally
|
15413 |
+
}
|
15414 |
+
module.exports = global.Promise
|
15415 |
+
} else {
|
15416 |
+
module.exports = PromisePolyfill
|
15417 |
+
}
|
15418 |
+
|
15419 |
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
15420 |
+
},{"./polyfill":34}],36:[function(require,module,exports){
|
15421 |
+
"use strict"
|
15422 |
+
|
15423 |
+
module.exports = function(object) {
|
15424 |
+
if (Object.prototype.toString.call(object) !== "[object Object]") return ""
|
15425 |
+
|
15426 |
+
var args = []
|
15427 |
+
for (var key in object) {
|
15428 |
+
destructure(key, object[key])
|
15429 |
+
}
|
15430 |
+
|
15431 |
+
return args.join("&")
|
15432 |
+
|
15433 |
+
function destructure(key, value) {
|
15434 |
+
if (Array.isArray(value)) {
|
15435 |
+
for (var i = 0; i < value.length; i++) {
|
15436 |
+
destructure(key + "[" + i + "]", value[i])
|
15437 |
+
}
|
15438 |
+
}
|
15439 |
+
else if (Object.prototype.toString.call(value) === "[object Object]") {
|
15440 |
+
for (var i in value) {
|
15441 |
+
destructure(key + "[" + i + "]", value[i])
|
15442 |
+
}
|
15443 |
+
}
|
15444 |
+
else args.push(encodeURIComponent(key) + (value != null && value !== "" ? "=" + encodeURIComponent(value) : ""))
|
15445 |
+
}
|
15446 |
+
}
|
15447 |
+
|
15448 |
+
},{}],37:[function(require,module,exports){
|
15449 |
+
"use strict"
|
15450 |
+
|
15451 |
+
module.exports = function(string) {
|
15452 |
+
if (string === "" || string == null) return {}
|
15453 |
+
if (string.charAt(0) === "?") string = string.slice(1)
|
15454 |
+
|
15455 |
+
var entries = string.split("&"), counters = {}, data = {}
|
15456 |
+
for (var i = 0; i < entries.length; i++) {
|
15457 |
+
var entry = entries[i].split("=")
|
15458 |
+
var key = decodeURIComponent(entry[0])
|
15459 |
+
var value = entry.length === 2 ? decodeURIComponent(entry[1]) : ""
|
15460 |
+
|
15461 |
+
if (value === "true") value = true
|
15462 |
+
else if (value === "false") value = false
|
15463 |
+
|
15464 |
+
var levels = key.split(/\]\[?|\[/)
|
15465 |
+
var cursor = data
|
15466 |
+
if (key.indexOf("[") > -1) levels.pop()
|
15467 |
+
for (var j = 0; j < levels.length; j++) {
|
15468 |
+
var level = levels[j], nextLevel = levels[j + 1]
|
15469 |
+
var isNumber = nextLevel == "" || !isNaN(parseInt(nextLevel, 10))
|
15470 |
+
if (level === "") {
|
15471 |
+
var key = levels.slice(0, j).join()
|
15472 |
+
if (counters[key] == null) {
|
15473 |
+
counters[key] = Array.isArray(cursor) ? cursor.length : 0
|
15474 |
+
}
|
15475 |
+
level = counters[key]++
|
15476 |
+
}
|
15477 |
+
// Disallow direct prototype pollution
|
15478 |
+
else if (level === "__proto__") break
|
15479 |
+
if (j === levels.length - 1) cursor[level] = value
|
15480 |
+
else {
|
15481 |
+
// Read own properties exclusively to disallow indirect
|
15482 |
+
// prototype pollution
|
15483 |
+
var desc = Object.getOwnPropertyDescriptor(cursor, level)
|
15484 |
+
if (desc != null) desc = desc.value
|
15485 |
+
if (desc == null) cursor[level] = desc = isNumber ? [] : {}
|
15486 |
+
cursor = desc
|
15487 |
+
}
|
15488 |
+
}
|
15489 |
+
}
|
15490 |
+
return data
|
15491 |
+
}
|
15492 |
+
|
15493 |
+
},{}],38:[function(require,module,exports){
|
15494 |
+
"use strict"
|
15495 |
+
|
15496 |
+
module.exports = require("./render/render")(window)
|
15497 |
+
|
15498 |
+
},{"./render/render":42}],39:[function(require,module,exports){
|
15499 |
+
"use strict"
|
15500 |
+
|
15501 |
+
var Vnode = require("../render/vnode")
|
15502 |
+
var hyperscriptVnode = require("./hyperscriptVnode")
|
15503 |
+
|
15504 |
+
module.exports = function() {
|
15505 |
+
var vnode = hyperscriptVnode.apply(0, arguments)
|
15506 |
+
|
15507 |
+
vnode.tag = "["
|
15508 |
+
vnode.children = Vnode.normalizeChildren(vnode.children)
|
15509 |
+
return vnode
|
15510 |
+
}
|
15511 |
+
|
15512 |
+
},{"../render/vnode":44,"./hyperscriptVnode":41}],40:[function(require,module,exports){
|
15513 |
+
"use strict"
|
15514 |
+
|
15515 |
+
var Vnode = require("../render/vnode")
|
15516 |
+
var hyperscriptVnode = require("./hyperscriptVnode")
|
15517 |
+
|
15518 |
+
var selectorParser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g
|
15519 |
+
var selectorCache = {}
|
15520 |
+
var hasOwn = {}.hasOwnProperty
|
15521 |
+
|
15522 |
+
function isEmpty(object) {
|
15523 |
+
for (var key in object) if (hasOwn.call(object, key)) return false
|
15524 |
+
return true
|
15525 |
+
}
|
15526 |
+
|
15527 |
+
function compileSelector(selector) {
|
15528 |
+
var match, tag = "div", classes = [], attrs = {}
|
15529 |
+
while (match = selectorParser.exec(selector)) {
|
15530 |
+
var type = match[1], value = match[2]
|
15531 |
+
if (type === "" && value !== "") tag = value
|
15532 |
+
else if (type === "#") attrs.id = value
|
15533 |
+
else if (type === ".") classes.push(value)
|
15534 |
+
else if (match[3][0] === "[") {
|
15535 |
+
var attrValue = match[6]
|
15536 |
+
if (attrValue) attrValue = attrValue.replace(/\\(["'])/g, "$1").replace(/\\\\/g, "\\")
|
15537 |
+
if (match[4] === "class") classes.push(attrValue)
|
15538 |
+
else attrs[match[4]] = attrValue === "" ? attrValue : attrValue || true
|
15539 |
+
}
|
15540 |
+
}
|
15541 |
+
if (classes.length > 0) attrs.className = classes.join(" ")
|
15542 |
+
return selectorCache[selector] = {tag: tag, attrs: attrs}
|
15543 |
+
}
|
15544 |
+
|
15545 |
+
function execSelector(state, vnode) {
|
15546 |
+
var attrs = vnode.attrs
|
15547 |
+
var children = Vnode.normalizeChildren(vnode.children)
|
15548 |
+
var hasClass = hasOwn.call(attrs, "class")
|
15549 |
+
var className = hasClass ? attrs.class : attrs.className
|
15550 |
+
|
15551 |
+
vnode.tag = state.tag
|
15552 |
+
vnode.attrs = null
|
15553 |
+
vnode.children = undefined
|
15554 |
+
|
15555 |
+
if (!isEmpty(state.attrs) && !isEmpty(attrs)) {
|
15556 |
+
var newAttrs = {}
|
15557 |
+
|
15558 |
+
for (var key in attrs) {
|
15559 |
+
if (hasOwn.call(attrs, key)) newAttrs[key] = attrs[key]
|
15560 |
+
}
|
15561 |
+
|
15562 |
+
attrs = newAttrs
|
15563 |
+
}
|
15564 |
+
|
15565 |
+
for (var key in state.attrs) {
|
15566 |
+
if (hasOwn.call(state.attrs, key) && key !== "className" && !hasOwn.call(attrs, key)){
|
15567 |
+
attrs[key] = state.attrs[key]
|
15568 |
+
}
|
15569 |
+
}
|
15570 |
+
if (className != null || state.attrs.className != null) attrs.className =
|
15571 |
+
className != null
|
15572 |
+
? state.attrs.className != null
|
15573 |
+
? String(state.attrs.className) + " " + String(className)
|
15574 |
+
: className
|
15575 |
+
: state.attrs.className != null
|
15576 |
+
? state.attrs.className
|
15577 |
+
: null
|
15578 |
+
|
15579 |
+
if (hasClass) attrs.class = null
|
15580 |
+
|
15581 |
+
for (var key in attrs) {
|
15582 |
+
if (hasOwn.call(attrs, key) && key !== "key") {
|
15583 |
+
vnode.attrs = attrs
|
15584 |
+
break
|
15585 |
+
}
|
15586 |
+
}
|
15587 |
+
|
15588 |
+
if (Array.isArray(children) && children.length === 1 && children[0] != null && children[0].tag === "#") {
|
15589 |
+
vnode.text = children[0].children
|
15590 |
+
} else {
|
15591 |
+
vnode.children = children
|
15592 |
+
}
|
15593 |
+
|
15594 |
+
return vnode
|
15595 |
+
}
|
15596 |
+
|
15597 |
+
function hyperscript(selector) {
|
15598 |
+
if (selector == null || typeof selector !== "string" && typeof selector !== "function" && typeof selector.view !== "function") {
|
15599 |
+
throw Error("The selector must be either a string or a component.");
|
15600 |
+
}
|
15601 |
+
|
15602 |
+
var vnode = hyperscriptVnode.apply(1, arguments)
|
15603 |
+
|
15604 |
+
if (typeof selector === "string") {
|
15605 |
+
vnode.children = Vnode.normalizeChildren(vnode.children)
|
15606 |
+
if (selector !== "[") return execSelector(selectorCache[selector] || compileSelector(selector), vnode)
|
15607 |
+
}
|
15608 |
+
|
15609 |
+
vnode.tag = selector
|
15610 |
+
return vnode
|
15611 |
+
}
|
15612 |
+
|
15613 |
+
module.exports = hyperscript
|
15614 |
+
|
15615 |
+
},{"../render/vnode":44,"./hyperscriptVnode":41}],41:[function(require,module,exports){
|
15616 |
+
"use strict"
|
15617 |
+
|
15618 |
+
var Vnode = require("../render/vnode")
|
15619 |
+
|
15620 |
+
// Call via `hyperscriptVnode.apply(startOffset, arguments)`
|
15621 |
+
//
|
15622 |
+
// The reason I do it this way, forwarding the arguments and passing the start
|
15623 |
+
// offset in `this`, is so I don't have to create a temporary array in a
|
15624 |
+
// performance-critical path.
|
15625 |
+
//
|
15626 |
+
// In native ES6, I'd instead add a final `...args` parameter to the
|
15627 |
+
// `hyperscript` and `fragment` factories and define this as
|
15628 |
+
// `hyperscriptVnode(...args)`, since modern engines do optimize that away. But
|
15629 |
+
// ES5 (what Mithril requires thanks to IE support) doesn't give me that luxury,
|
15630 |
+
// and engines aren't nearly intelligent enough to do either of these:
|
15631 |
+
//
|
15632 |
+
// 1. Elide the allocation for `[].slice.call(arguments, 1)` when it's passed to
|
15633 |
+
// another function only to be indexed.
|
15634 |
+
// 2. Elide an `arguments` allocation when it's passed to any function other
|
15635 |
+
// than `Function.prototype.apply` or `Reflect.apply`.
|
15636 |
+
//
|
15637 |
+
// In ES6, it'd probably look closer to this (I'd need to profile it, though):
|
15638 |
+
// module.exports = function(attrs, ...children) {
|
15639 |
+
// if (attrs == null || typeof attrs === "object" && attrs.tag == null && !Array.isArray(attrs)) {
|
15640 |
+
// if (children.length === 1 && Array.isArray(children[0])) children = children[0]
|
15641 |
+
// } else {
|
15642 |
+
// children = children.length === 0 && Array.isArray(attrs) ? attrs : [attrs, ...children]
|
15643 |
+
// attrs = undefined
|
15644 |
+
// }
|
15645 |
+
//
|
15646 |
+
// if (attrs == null) attrs = {}
|
15647 |
+
// return Vnode("", attrs.key, attrs, children)
|
15648 |
+
// }
|
15649 |
+
module.exports = function() {
|
15650 |
+
var attrs = arguments[this], start = this + 1, children
|
15651 |
+
|
15652 |
+
if (attrs == null) {
|
15653 |
+
attrs = {}
|
15654 |
+
} else if (typeof attrs !== "object" || attrs.tag != null || Array.isArray(attrs)) {
|
15655 |
+
attrs = {}
|
15656 |
+
start = this
|
15657 |
+
}
|
15658 |
+
|
15659 |
+
if (arguments.length === start + 1) {
|
15660 |
+
children = arguments[start]
|
15661 |
+
if (!Array.isArray(children)) children = [children]
|
15662 |
+
} else {
|
15663 |
+
children = []
|
15664 |
+
while (start < arguments.length) children.push(arguments[start++])
|
15665 |
+
}
|
15666 |
+
|
15667 |
+
return Vnode("", attrs.key, attrs, children)
|
15668 |
+
}
|
15669 |
+
|
15670 |
+
},{"../render/vnode":44}],42:[function(require,module,exports){
|
15671 |
+
"use strict"
|
15672 |
+
|
15673 |
+
var Vnode = require("../render/vnode")
|
15674 |
+
|
15675 |
+
module.exports = function($window) {
|
15676 |
+
var $doc = $window && $window.document
|
15677 |
+
var currentRedraw
|
15678 |
+
|
15679 |
+
var nameSpace = {
|
15680 |
+
svg: "http://www.w3.org/2000/svg",
|
15681 |
+
math: "http://www.w3.org/1998/Math/MathML"
|
15682 |
+
}
|
15683 |
+
|
15684 |
+
function getNameSpace(vnode) {
|
15685 |
+
return vnode.attrs && vnode.attrs.xmlns || nameSpace[vnode.tag]
|
15686 |
+
}
|
15687 |
+
|
15688 |
+
//sanity check to discourage people from doing `vnode.state = ...`
|
15689 |
+
function checkState(vnode, original) {
|
15690 |
+
if (vnode.state !== original) throw new Error("`vnode.state` must not be modified")
|
15691 |
+
}
|
15692 |
+
|
15693 |
+
//Note: the hook is passed as the `this` argument to allow proxying the
|
15694 |
+
//arguments without requiring a full array allocation to do so. It also
|
15695 |
+
//takes advantage of the fact the current `vnode` is the first argument in
|
15696 |
+
//all lifecycle methods.
|
15697 |
+
function callHook(vnode) {
|
15698 |
+
var original = vnode.state
|
15699 |
+
try {
|
15700 |
+
return this.apply(original, arguments)
|
15701 |
+
} finally {
|
15702 |
+
checkState(vnode, original)
|
15703 |
+
}
|
15704 |
+
}
|
15705 |
+
|
15706 |
+
// IE11 (at least) throws an UnspecifiedError when accessing document.activeElement when
|
15707 |
+
// inside an iframe. Catch and swallow this error, and heavy-handidly return null.
|
15708 |
+
function activeElement() {
|
15709 |
+
try {
|
15710 |
+
return $doc.activeElement
|
15711 |
+
} catch (e) {
|
15712 |
+
return null
|
15713 |
+
}
|
15714 |
+
}
|
15715 |
+
//create
|
15716 |
+
function createNodes(parent, vnodes, start, end, hooks, nextSibling, ns) {
|
15717 |
+
for (var i = start; i < end; i++) {
|
15718 |
+
var vnode = vnodes[i]
|
15719 |
+
if (vnode != null) {
|
15720 |
+
createNode(parent, vnode, hooks, ns, nextSibling)
|
15721 |
+
}
|
15722 |
+
}
|
15723 |
+
}
|
15724 |
+
function createNode(parent, vnode, hooks, ns, nextSibling) {
|
15725 |
+
var tag = vnode.tag
|
15726 |
+
if (typeof tag === "string") {
|
15727 |
+
vnode.state = {}
|
15728 |
+
if (vnode.attrs != null) initLifecycle(vnode.attrs, vnode, hooks)
|
15729 |
+
switch (tag) {
|
15730 |
+
case "#": createText(parent, vnode, nextSibling); break
|
15731 |
+
case "<": createHTML(parent, vnode, ns, nextSibling); break
|
15732 |
+
case "[": createFragment(parent, vnode, hooks, ns, nextSibling); break
|
15733 |
+
default: createElement(parent, vnode, hooks, ns, nextSibling)
|
15734 |
+
}
|
15735 |
+
}
|
15736 |
+
else createComponent(parent, vnode, hooks, ns, nextSibling)
|
15737 |
+
}
|
15738 |
+
function createText(parent, vnode, nextSibling) {
|
15739 |
+
vnode.dom = $doc.createTextNode(vnode.children)
|
15740 |
+
insertNode(parent, vnode.dom, nextSibling)
|
15741 |
+
}
|
15742 |
+
var possibleParents = {caption: "table", thead: "table", tbody: "table", tfoot: "table", tr: "tbody", th: "tr", td: "tr", colgroup: "table", col: "colgroup"}
|
15743 |
+
function createHTML(parent, vnode, ns, nextSibling) {
|
15744 |
+
var match = vnode.children.match(/^\s*?<(\w+)/im) || []
|
15745 |
+
// not using the proper parent makes the child element(s) vanish.
|
15746 |
+
// var div = document.createElement("div")
|
15747 |
+
// div.innerHTML = "<td>i</td><td>j</td>"
|
15748 |
+
// console.log(div.innerHTML)
|
15749 |
+
// --> "ij", no <td> in sight.
|
15750 |
+
var temp = $doc.createElement(possibleParents[match[1]] || "div")
|
15751 |
+
if (ns === "http://www.w3.org/2000/svg") {
|
15752 |
+
temp.innerHTML = "<svg xmlns=\"http://www.w3.org/2000/svg\">" + vnode.children + "</svg>"
|
15753 |
+
temp = temp.firstChild
|
15754 |
+
} else {
|
15755 |
+
temp.innerHTML = vnode.children
|
15756 |
+
}
|
15757 |
+
vnode.dom = temp.firstChild
|
15758 |
+
vnode.domSize = temp.childNodes.length
|
15759 |
+
// Capture nodes to remove, so we don't confuse them.
|
15760 |
+
vnode.instance = []
|
15761 |
+
var fragment = $doc.createDocumentFragment()
|
15762 |
+
var child
|
15763 |
+
while (child = temp.firstChild) {
|
15764 |
+
vnode.instance.push(child)
|
15765 |
+
fragment.appendChild(child)
|
15766 |
+
}
|
15767 |
+
insertNode(parent, fragment, nextSibling)
|
15768 |
+
}
|
15769 |
+
function createFragment(parent, vnode, hooks, ns, nextSibling) {
|
15770 |
+
var fragment = $doc.createDocumentFragment()
|
15771 |
+
if (vnode.children != null) {
|
15772 |
+
var children = vnode.children
|
15773 |
+
createNodes(fragment, children, 0, children.length, hooks, null, ns)
|
15774 |
+
}
|
15775 |
+
vnode.dom = fragment.firstChild
|
15776 |
+
vnode.domSize = fragment.childNodes.length
|
15777 |
+
insertNode(parent, fragment, nextSibling)
|
15778 |
+
}
|
15779 |
+
function createElement(parent, vnode, hooks, ns, nextSibling) {
|
15780 |
+
var tag = vnode.tag
|
15781 |
+
var attrs = vnode.attrs
|
15782 |
+
var is = attrs && attrs.is
|
15783 |
+
|
15784 |
+
ns = getNameSpace(vnode) || ns
|
15785 |
+
|
15786 |
+
var element = ns ?
|
15787 |
+
is ? $doc.createElementNS(ns, tag, {is: is}) : $doc.createElementNS(ns, tag) :
|
15788 |
+
is ? $doc.createElement(tag, {is: is}) : $doc.createElement(tag)
|
15789 |
+
vnode.dom = element
|
15790 |
+
|
15791 |
+
if (attrs != null) {
|
15792 |
+
setAttrs(vnode, attrs, ns)
|
15793 |
+
}
|
15794 |
+
|
15795 |
+
insertNode(parent, element, nextSibling)
|
15796 |
+
|
15797 |
+
if (!maybeSetContentEditable(vnode)) {
|
15798 |
+
if (vnode.text != null) {
|
15799 |
+
if (vnode.text !== "") element.textContent = vnode.text
|
15800 |
+
else vnode.children = [Vnode("#", undefined, undefined, vnode.text, undefined, undefined)]
|
15801 |
+
}
|
15802 |
+
if (vnode.children != null) {
|
15803 |
+
var children = vnode.children
|
15804 |
+
createNodes(element, children, 0, children.length, hooks, null, ns)
|
15805 |
+
if (vnode.tag === "select" && attrs != null) setLateSelectAttrs(vnode, attrs)
|
15806 |
+
}
|
15807 |
+
}
|
15808 |
+
}
|
15809 |
+
function initComponent(vnode, hooks) {
|
15810 |
+
var sentinel
|
15811 |
+
if (typeof vnode.tag.view === "function") {
|
15812 |
+
vnode.state = Object.create(vnode.tag)
|
15813 |
+
sentinel = vnode.state.view
|
15814 |
+
if (sentinel.$$reentrantLock$$ != null) return
|
15815 |
+
sentinel.$$reentrantLock$$ = true
|
15816 |
+
} else {
|
15817 |
+
vnode.state = void 0
|
15818 |
+
sentinel = vnode.tag
|
15819 |
+
if (sentinel.$$reentrantLock$$ != null) return
|
15820 |
+
sentinel.$$reentrantLock$$ = true
|
15821 |
+
vnode.state = (vnode.tag.prototype != null && typeof vnode.tag.prototype.view === "function") ? new vnode.tag(vnode) : vnode.tag(vnode)
|
15822 |
+
}
|
15823 |
+
initLifecycle(vnode.state, vnode, hooks)
|
15824 |
+
if (vnode.attrs != null) initLifecycle(vnode.attrs, vnode, hooks)
|
15825 |
+
vnode.instance = Vnode.normalize(callHook.call(vnode.state.view, vnode))
|
15826 |
+
if (vnode.instance === vnode) throw Error("A view cannot return the vnode it received as argument")
|
15827 |
+
sentinel.$$reentrantLock$$ = null
|
15828 |
+
}
|
15829 |
+
function createComponent(parent, vnode, hooks, ns, nextSibling) {
|
15830 |
+
initComponent(vnode, hooks)
|
15831 |
+
if (vnode.instance != null) {
|
15832 |
+
createNode(parent, vnode.instance, hooks, ns, nextSibling)
|
15833 |
+
vnode.dom = vnode.instance.dom
|
15834 |
+
vnode.domSize = vnode.dom != null ? vnode.instance.domSize : 0
|
15835 |
+
}
|
15836 |
+
else {
|
15837 |
+
vnode.domSize = 0
|
15838 |
+
}
|
15839 |
+
}
|
15840 |
+
|
15841 |
+
//update
|
15842 |
+
/**
|
15843 |
+
* @param {Element|Fragment} parent - the parent element
|
15844 |
+
* @param {Vnode[] | null} old - the list of vnodes of the last `render()` call for
|
15845 |
+
* this part of the tree
|
15846 |
+
* @param {Vnode[] | null} vnodes - as above, but for the current `render()` call.
|
15847 |
+
* @param {Function[]} hooks - an accumulator of post-render hooks (oncreate/onupdate)
|
15848 |
+
* @param {Element | null} nextSibling - the next DOM node if we're dealing with a
|
15849 |
+
* fragment that is not the last item in its
|
15850 |
+
* parent
|
15851 |
+
* @param {'svg' | 'math' | String | null} ns) - the current XML namespace, if any
|
15852 |
+
* @returns void
|
15853 |
+
*/
|
15854 |
+
// This function diffs and patches lists of vnodes, both keyed and unkeyed.
|
15855 |
+
//
|
15856 |
+
// We will:
|
15857 |
+
//
|
15858 |
+
// 1. describe its general structure
|
15859 |
+
// 2. focus on the diff algorithm optimizations
|
15860 |
+
// 3. discuss DOM node operations.
|
15861 |
+
|
15862 |
+
// ## Overview:
|
15863 |
+
//
|
15864 |
+
// The updateNodes() function:
|
15865 |
+
// - deals with trivial cases
|
15866 |
+
// - determines whether the lists are keyed or unkeyed based on the first non-null node
|
15867 |
+
// of each list.
|
15868 |
+
// - diffs them and patches the DOM if needed (that's the brunt of the code)
|
15869 |
+
// - manages the leftovers: after diffing, are there:
|
15870 |
+
// - old nodes left to remove?
|
15871 |
+
// - new nodes to insert?
|
15872 |
+
// deal with them!
|
15873 |
+
//
|
15874 |
+
// The lists are only iterated over once, with an exception for the nodes in `old` that
|
15875 |
+
// are visited in the fourth part of the diff and in the `removeNodes` loop.
|
15876 |
+
|
15877 |
+
// ## Diffing
|
15878 |
+
//
|
15879 |
+
// Reading https://github.com/localvoid/ivi/blob/ddc09d06abaef45248e6133f7040d00d3c6be853/packages/ivi/src/vdom/implementation.ts#L617-L837
|
15880 |
+
// may be good for context on longest increasing subsequence-based logic for moving nodes.
|
15881 |
+
//
|
15882 |
+
// In order to diff keyed lists, one has to
|
15883 |
+
//
|
15884 |
+
// 1) match nodes in both lists, per key, and update them accordingly
|
15885 |
+
// 2) create the nodes present in the new list, but absent in the old one
|
15886 |
+
// 3) remove the nodes present in the old list, but absent in the new one
|
15887 |
+
// 4) figure out what nodes in 1) to move in order to minimize the DOM operations.
|
15888 |
+
//
|
15889 |
+
// To achieve 1) one can create a dictionary of keys => index (for the old list), then iterate
|
15890 |
+
// over the new list and for each new vnode, find the corresponding vnode in the old list using
|
15891 |
+
// the map.
|
15892 |
+
// 2) is achieved in the same step: if a new node has no corresponding entry in the map, it is new
|
15893 |
+
// and must be created.
|
15894 |
+
// For the removals, we actually remove the nodes that have been updated from the old list.
|
15895 |
+
// The nodes that remain in that list after 1) and 2) have been performed can be safely removed.
|
15896 |
+
// The fourth step is a bit more complex and relies on the longest increasing subsequence (LIS)
|
15897 |
+
// algorithm.
|
15898 |
+
//
|
15899 |
+
// the longest increasing subsequence is the list of nodes that can remain in place. Imagine going
|
15900 |
+
// from `1,2,3,4,5` to `4,5,1,2,3` where the numbers are not necessarily the keys, but the indices
|
15901 |
+
// corresponding to the keyed nodes in the old list (keyed nodes `e,d,c,b,a` => `b,a,e,d,c` would
|
15902 |
+
// match the above lists, for example).
|
15903 |
+
//
|
15904 |
+
// In there are two increasing subsequences: `4,5` and `1,2,3`, the latter being the longest. We
|
15905 |
+
// can update those nodes without moving them, and only call `insertNode` on `4` and `5`.
|
15906 |
+
//
|
15907 |
+
// @localvoid adapted the algo to also support node deletions and insertions (the `lis` is actually
|
15908 |
+
// the longest increasing subsequence *of old nodes still present in the new list*).
|
15909 |
+
//
|
15910 |
+
// It is a general algorithm that is fireproof in all circumstances, but it requires the allocation
|
15911 |
+
// and the construction of a `key => oldIndex` map, and three arrays (one with `newIndex => oldIndex`,
|
15912 |
+
// the `LIS` and a temporary one to create the LIS).
|
15913 |
+
//
|
15914 |
+
// So we cheat where we can: if the tails of the lists are identical, they are guaranteed to be part of
|
15915 |
+
// the LIS and can be updated without moving them.
|
15916 |
+
//
|
15917 |
+
// If two nodes are swapped, they are guaranteed not to be part of the LIS, and must be moved (with
|
15918 |
+
// the exception of the last node if the list is fully reversed).
|
15919 |
+
//
|
15920 |
+
// ## Finding the next sibling.
|
15921 |
+
//
|
15922 |
+
// `updateNode()` and `createNode()` expect a nextSibling parameter to perform DOM operations.
|
15923 |
+
// When the list is being traversed top-down, at any index, the DOM nodes up to the previous
|
15924 |
+
// vnode reflect the content of the new list, whereas the rest of the DOM nodes reflect the old
|
15925 |
+
// list. The next sibling must be looked for in the old list using `getNextSibling(... oldStart + 1 ...)`.
|
15926 |
+
//
|
15927 |
+
// In the other scenarios (swaps, upwards traversal, map-based diff),
|
15928 |
+
// the new vnodes list is traversed upwards. The DOM nodes at the bottom of the list reflect the
|
15929 |
+
// bottom part of the new vnodes list, and we can use the `v.dom` value of the previous node
|
15930 |
+
// as the next sibling (cached in the `nextSibling` variable).
|
15931 |
+
|
15932 |
+
|
15933 |
+
// ## DOM node moves
|
15934 |
+
//
|
15935 |
+
// In most scenarios `updateNode()` and `createNode()` perform the DOM operations. However,
|
15936 |
+
// this is not the case if the node moved (second and fourth part of the diff algo). We move
|
15937 |
+
// the old DOM nodes before updateNode runs because it enables us to use the cached `nextSibling`
|
15938 |
+
// variable rather than fetching it using `getNextSibling()`.
|
15939 |
+
//
|
15940 |
+
// The fourth part of the diff currently inserts nodes unconditionally, leading to issues
|
15941 |
+
// like #1791 and #1999. We need to be smarter about those situations where adjascent old
|
15942 |
+
// nodes remain together in the new list in a way that isn't covered by parts one and
|
15943 |
+
// three of the diff algo.
|
15944 |
+
|
15945 |
+
function updateNodes(parent, old, vnodes, hooks, nextSibling, ns) {
|
15946 |
+
if (old === vnodes || old == null && vnodes == null) return
|
15947 |
+
else if (old == null || old.length === 0) createNodes(parent, vnodes, 0, vnodes.length, hooks, nextSibling, ns)
|
15948 |
+
else if (vnodes == null || vnodes.length === 0) removeNodes(parent, old, 0, old.length)
|
15949 |
+
else {
|
15950 |
+
var isOldKeyed = old[0] != null && old[0].key != null
|
15951 |
+
var isKeyed = vnodes[0] != null && vnodes[0].key != null
|
15952 |
+
var start = 0, oldStart = 0
|
15953 |
+
if (!isOldKeyed) while (oldStart < old.length && old[oldStart] == null) oldStart++
|
15954 |
+
if (!isKeyed) while (start < vnodes.length && vnodes[start] == null) start++
|
15955 |
+
if (isKeyed === null && isOldKeyed == null) return // both lists are full of nulls
|
15956 |
+
if (isOldKeyed !== isKeyed) {
|
15957 |
+
removeNodes(parent, old, oldStart, old.length)
|
15958 |
+
createNodes(parent, vnodes, start, vnodes.length, hooks, nextSibling, ns)
|
15959 |
+
} else if (!isKeyed) {
|
15960 |
+
// Don't index past the end of either list (causes deopts).
|
15961 |
+
var commonLength = old.length < vnodes.length ? old.length : vnodes.length
|
15962 |
+
// Rewind if necessary to the first non-null index on either side.
|
15963 |
+
// We could alternatively either explicitly create or remove nodes when `start !== oldStart`
|
15964 |
+
// but that would be optimizing for sparse lists which are more rare than dense ones.
|
15965 |
+
start = start < oldStart ? start : oldStart
|
15966 |
+
for (; start < commonLength; start++) {
|
15967 |
+
o = old[start]
|
15968 |
+
v = vnodes[start]
|
15969 |
+
if (o === v || o == null && v == null) continue
|
15970 |
+
else if (o == null) createNode(parent, v, hooks, ns, getNextSibling(old, start + 1, nextSibling))
|
15971 |
+
else if (v == null) removeNode(parent, o)
|
15972 |
+
else updateNode(parent, o, v, hooks, getNextSibling(old, start + 1, nextSibling), ns)
|
15973 |
+
}
|
15974 |
+
if (old.length > commonLength) removeNodes(parent, old, start, old.length)
|
15975 |
+
if (vnodes.length > commonLength) createNodes(parent, vnodes, start, vnodes.length, hooks, nextSibling, ns)
|
15976 |
+
} else {
|
15977 |
+
// keyed diff
|
15978 |
+
var oldEnd = old.length - 1, end = vnodes.length - 1, map, o, v, oe, ve, topSibling
|
15979 |
+
|
15980 |
+
// bottom-up
|
15981 |
+
while (oldEnd >= oldStart && end >= start) {
|
15982 |
+
oe = old[oldEnd]
|
15983 |
+
ve = vnodes[end]
|
15984 |
+
if (oe.key !== ve.key) break
|
15985 |
+
if (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)
|
15986 |
+
if (ve.dom != null) nextSibling = ve.dom
|
15987 |
+
oldEnd--, end--
|
15988 |
+
}
|
15989 |
+
// top-down
|
15990 |
+
while (oldEnd >= oldStart && end >= start) {
|
15991 |
+
o = old[oldStart]
|
15992 |
+
v = vnodes[start]
|
15993 |
+
if (o.key !== v.key) break
|
15994 |
+
oldStart++, start++
|
15995 |
+
if (o !== v) updateNode(parent, o, v, hooks, getNextSibling(old, oldStart, nextSibling), ns)
|
15996 |
+
}
|
15997 |
+
// swaps and list reversals
|
15998 |
+
while (oldEnd >= oldStart && end >= start) {
|
15999 |
+
if (start === end) break
|
16000 |
+
if (o.key !== ve.key || oe.key !== v.key) break
|
16001 |
+
topSibling = getNextSibling(old, oldStart, nextSibling)
|
16002 |
+
moveNodes(parent, oe, topSibling)
|
16003 |
+
if (oe !== v) updateNode(parent, oe, v, hooks, topSibling, ns)
|
16004 |
+
if (++start <= --end) moveNodes(parent, o, nextSibling)
|
16005 |
+
if (o !== ve) updateNode(parent, o, ve, hooks, nextSibling, ns)
|
16006 |
+
if (ve.dom != null) nextSibling = ve.dom
|
16007 |
+
oldStart++; oldEnd--
|
16008 |
+
oe = old[oldEnd]
|
16009 |
+
ve = vnodes[end]
|
16010 |
+
o = old[oldStart]
|
16011 |
+
v = vnodes[start]
|
16012 |
+
}
|
16013 |
+
// bottom up once again
|
16014 |
+
while (oldEnd >= oldStart && end >= start) {
|
16015 |
+
if (oe.key !== ve.key) break
|
16016 |
+
if (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)
|
16017 |
+
if (ve.dom != null) nextSibling = ve.dom
|
16018 |
+
oldEnd--, end--
|
16019 |
+
oe = old[oldEnd]
|
16020 |
+
ve = vnodes[end]
|
16021 |
+
}
|
16022 |
+
if (start > end) removeNodes(parent, old, oldStart, oldEnd + 1)
|
16023 |
+
else if (oldStart > oldEnd) createNodes(parent, vnodes, start, end + 1, hooks, nextSibling, ns)
|
16024 |
+
else {
|
16025 |
+
// inspired by ivi https://github.com/ivijs/ivi/ by Boris Kaul
|
16026 |
+
var originalNextSibling = nextSibling, vnodesLength = end - start + 1, oldIndices = new Array(vnodesLength), li=0, i=0, pos = 2147483647, matched = 0, map, lisIndices
|
16027 |
+
for (i = 0; i < vnodesLength; i++) oldIndices[i] = -1
|
16028 |
+
for (i = end; i >= start; i--) {
|
16029 |
+
if (map == null) map = getKeyMap(old, oldStart, oldEnd + 1)
|
16030 |
+
ve = vnodes[i]
|
16031 |
+
var oldIndex = map[ve.key]
|
16032 |
+
if (oldIndex != null) {
|
16033 |
+
pos = (oldIndex < pos) ? oldIndex : -1 // becomes -1 if nodes were re-ordered
|
16034 |
+
oldIndices[i-start] = oldIndex
|
16035 |
+
oe = old[oldIndex]
|
16036 |
+
old[oldIndex] = null
|
16037 |
+
if (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)
|
16038 |
+
if (ve.dom != null) nextSibling = ve.dom
|
16039 |
+
matched++
|
16040 |
+
}
|
16041 |
+
}
|
16042 |
+
nextSibling = originalNextSibling
|
16043 |
+
if (matched !== oldEnd - oldStart + 1) removeNodes(parent, old, oldStart, oldEnd + 1)
|
16044 |
+
if (matched === 0) createNodes(parent, vnodes, start, end + 1, hooks, nextSibling, ns)
|
16045 |
+
else {
|
16046 |
+
if (pos === -1) {
|
16047 |
+
// the indices of the indices of the items that are part of the
|
16048 |
+
// longest increasing subsequence in the oldIndices list
|
16049 |
+
lisIndices = makeLisIndices(oldIndices)
|
16050 |
+
li = lisIndices.length - 1
|
16051 |
+
for (i = end; i >= start; i--) {
|
16052 |
+
v = vnodes[i]
|
16053 |
+
if (oldIndices[i-start] === -1) createNode(parent, v, hooks, ns, nextSibling)
|
16054 |
+
else {
|
16055 |
+
if (lisIndices[li] === i - start) li--
|
16056 |
+
else moveNodes(parent, v, nextSibling)
|
16057 |
+
}
|
16058 |
+
if (v.dom != null) nextSibling = vnodes[i].dom
|
16059 |
+
}
|
16060 |
+
} else {
|
16061 |
+
for (i = end; i >= start; i--) {
|
16062 |
+
v = vnodes[i]
|
16063 |
+
if (oldIndices[i-start] === -1) createNode(parent, v, hooks, ns, nextSibling)
|
16064 |
+
if (v.dom != null) nextSibling = vnodes[i].dom
|
16065 |
+
}
|
16066 |
+
}
|
16067 |
+
}
|
16068 |
+
}
|
16069 |
+
}
|
16070 |
+
}
|
16071 |
+
}
|
16072 |
+
function updateNode(parent, old, vnode, hooks, nextSibling, ns) {
|
16073 |
+
var oldTag = old.tag, tag = vnode.tag
|
16074 |
+
if (oldTag === tag) {
|
16075 |
+
vnode.state = old.state
|
16076 |
+
vnode.events = old.events
|
16077 |
+
if (shouldNotUpdate(vnode, old)) return
|
16078 |
+
if (typeof oldTag === "string") {
|
16079 |
+
if (vnode.attrs != null) {
|
16080 |
+
updateLifecycle(vnode.attrs, vnode, hooks)
|
16081 |
+
}
|
16082 |
+
switch (oldTag) {
|
16083 |
+
case "#": updateText(old, vnode); break
|
16084 |
+
case "<": updateHTML(parent, old, vnode, ns, nextSibling); break
|
16085 |
+
case "[": updateFragment(parent, old, vnode, hooks, nextSibling, ns); break
|
16086 |
+
default: updateElement(old, vnode, hooks, ns)
|
16087 |
+
}
|
16088 |
+
}
|
16089 |
+
else updateComponent(parent, old, vnode, hooks, nextSibling, ns)
|
16090 |
+
}
|
16091 |
+
else {
|
16092 |
+
removeNode(parent, old)
|
16093 |
+
createNode(parent, vnode, hooks, ns, nextSibling)
|
16094 |
+
}
|
16095 |
+
}
|
16096 |
+
function updateText(old, vnode) {
|
16097 |
+
if (old.children.toString() !== vnode.children.toString()) {
|
16098 |
+
old.dom.nodeValue = vnode.children
|
16099 |
+
}
|
16100 |
+
vnode.dom = old.dom
|
16101 |
+
}
|
16102 |
+
function updateHTML(parent, old, vnode, ns, nextSibling) {
|
16103 |
+
if (old.children !== vnode.children) {
|
16104 |
+
removeHTML(parent, old)
|
16105 |
+
createHTML(parent, vnode, ns, nextSibling)
|
16106 |
+
}
|
16107 |
+
else {
|
16108 |
+
vnode.dom = old.dom
|
16109 |
+
vnode.domSize = old.domSize
|
16110 |
+
vnode.instance = old.instance
|
16111 |
+
}
|
16112 |
+
}
|
16113 |
+
function updateFragment(parent, old, vnode, hooks, nextSibling, ns) {
|
16114 |
+
updateNodes(parent, old.children, vnode.children, hooks, nextSibling, ns)
|
16115 |
+
var domSize = 0, children = vnode.children
|
16116 |
+
vnode.dom = null
|
16117 |
+
if (children != null) {
|
16118 |
+
for (var i = 0; i < children.length; i++) {
|
16119 |
+
var child = children[i]
|
16120 |
+
if (child != null && child.dom != null) {
|
16121 |
+
if (vnode.dom == null) vnode.dom = child.dom
|
16122 |
+
domSize += child.domSize || 1
|
16123 |
+
}
|
16124 |
+
}
|
16125 |
+
if (domSize !== 1) vnode.domSize = domSize
|
16126 |
+
}
|
16127 |
+
}
|
16128 |
+
function updateElement(old, vnode, hooks, ns) {
|
16129 |
+
var element = vnode.dom = old.dom
|
16130 |
+
ns = getNameSpace(vnode) || ns
|
16131 |
+
|
16132 |
+
if (vnode.tag === "textarea") {
|
16133 |
+
if (vnode.attrs == null) vnode.attrs = {}
|
16134 |
+
if (vnode.text != null) {
|
16135 |
+
vnode.attrs.value = vnode.text //FIXME handle multiple children
|
16136 |
+
vnode.text = undefined
|
16137 |
+
}
|
16138 |
+
}
|
16139 |
+
updateAttrs(vnode, old.attrs, vnode.attrs, ns)
|
16140 |
+
if (!maybeSetContentEditable(vnode)) {
|
16141 |
+
if (old.text != null && vnode.text != null && vnode.text !== "") {
|
16142 |
+
if (old.text.toString() !== vnode.text.toString()) old.dom.firstChild.nodeValue = vnode.text
|
16143 |
+
}
|
16144 |
+
else {
|
16145 |
+
if (old.text != null) old.children = [Vnode("#", undefined, undefined, old.text, undefined, old.dom.firstChild)]
|
16146 |
+
if (vnode.text != null) vnode.children = [Vnode("#", undefined, undefined, vnode.text, undefined, undefined)]
|
16147 |
+
updateNodes(element, old.children, vnode.children, hooks, null, ns)
|
16148 |
+
}
|
16149 |
+
}
|
16150 |
+
}
|
16151 |
+
function updateComponent(parent, old, vnode, hooks, nextSibling, ns) {
|
16152 |
+
vnode.instance = Vnode.normalize(callHook.call(vnode.state.view, vnode))
|
16153 |
+
if (vnode.instance === vnode) throw Error("A view cannot return the vnode it received as argument")
|
16154 |
+
updateLifecycle(vnode.state, vnode, hooks)
|
16155 |
+
if (vnode.attrs != null) updateLifecycle(vnode.attrs, vnode, hooks)
|
16156 |
+
if (vnode.instance != null) {
|
16157 |
+
if (old.instance == null) createNode(parent, vnode.instance, hooks, ns, nextSibling)
|
16158 |
+
else updateNode(parent, old.instance, vnode.instance, hooks, nextSibling, ns)
|
16159 |
+
vnode.dom = vnode.instance.dom
|
16160 |
+
vnode.domSize = vnode.instance.domSize
|
16161 |
+
}
|
16162 |
+
else if (old.instance != null) {
|
16163 |
+
removeNode(parent, old.instance)
|
16164 |
+
vnode.dom = undefined
|
16165 |
+
vnode.domSize = 0
|
16166 |
+
}
|
16167 |
+
else {
|
16168 |
+
vnode.dom = old.dom
|
16169 |
+
vnode.domSize = old.domSize
|
16170 |
+
}
|
16171 |
+
}
|
16172 |
+
function getKeyMap(vnodes, start, end) {
|
16173 |
+
var map = Object.create(null)
|
16174 |
+
for (; start < end; start++) {
|
16175 |
+
var vnode = vnodes[start]
|
16176 |
+
if (vnode != null) {
|
16177 |
+
var key = vnode.key
|
16178 |
+
if (key != null) map[key] = start
|
16179 |
+
}
|
16180 |
+
}
|
16181 |
+
return map
|
16182 |
+
}
|
16183 |
+
// Lifted from ivi https://github.com/ivijs/ivi/
|
16184 |
+
// takes a list of unique numbers (-1 is special and can
|
16185 |
+
// occur multiple times) and returns an array with the indices
|
16186 |
+
// of the items that are part of the longest increasing
|
16187 |
+
// subsequece
|
16188 |
+
var lisTemp = []
|
16189 |
+
function makeLisIndices(a) {
|
16190 |
+
var result = [0]
|
16191 |
+
var u = 0, v = 0, i = 0
|
16192 |
+
var il = lisTemp.length = a.length
|
16193 |
+
for (var i = 0; i < il; i++) lisTemp[i] = a[i]
|
16194 |
+
for (var i = 0; i < il; ++i) {
|
16195 |
+
if (a[i] === -1) continue
|
16196 |
+
var j = result[result.length - 1]
|
16197 |
+
if (a[j] < a[i]) {
|
16198 |
+
lisTemp[i] = j
|
16199 |
+
result.push(i)
|
16200 |
+
continue
|
16201 |
+
}
|
16202 |
+
u = 0
|
16203 |
+
v = result.length - 1
|
16204 |
+
while (u < v) {
|
16205 |
+
// Fast integer average without overflow.
|
16206 |
+
// eslint-disable-next-line no-bitwise
|
16207 |
+
var c = (u >>> 1) + (v >>> 1) + (u & v & 1)
|
16208 |
+
if (a[result[c]] < a[i]) {
|
16209 |
+
u = c + 1
|
16210 |
+
}
|
16211 |
+
else {
|
16212 |
+
v = c
|
16213 |
+
}
|
16214 |
+
}
|
16215 |
+
if (a[i] < a[result[u]]) {
|
16216 |
+
if (u > 0) lisTemp[i] = result[u - 1]
|
16217 |
+
result[u] = i
|
16218 |
+
}
|
16219 |
+
}
|
16220 |
+
u = result.length
|
16221 |
+
v = result[u - 1]
|
16222 |
+
while (u-- > 0) {
|
16223 |
+
result[u] = v
|
16224 |
+
v = lisTemp[v]
|
16225 |
+
}
|
16226 |
+
lisTemp.length = 0
|
16227 |
+
return result
|
16228 |
+
}
|
16229 |
+
|
16230 |
+
function getNextSibling(vnodes, i, nextSibling) {
|
16231 |
+
for (; i < vnodes.length; i++) {
|
16232 |
+
if (vnodes[i] != null && vnodes[i].dom != null) return vnodes[i].dom
|
16233 |
+
}
|
16234 |
+
return nextSibling
|
16235 |
+
}
|
16236 |
+
|
16237 |
+
// This covers a really specific edge case:
|
16238 |
+
// - Parent node is keyed and contains child
|
16239 |
+
// - Child is removed, returns unresolved promise in `onbeforeremove`
|
16240 |
+
// - Parent node is moved in keyed diff
|
16241 |
+
// - Remaining children still need moved appropriately
|
16242 |
+
//
|
16243 |
+
// Ideally, I'd track removed nodes as well, but that introduces a lot more
|
16244 |
+
// complexity and I'm not exactly interested in doing that.
|
16245 |
+
function moveNodes(parent, vnode, nextSibling) {
|
16246 |
+
var frag = $doc.createDocumentFragment()
|
16247 |
+
moveChildToFrag(parent, frag, vnode)
|
16248 |
+
insertNode(parent, frag, nextSibling)
|
16249 |
+
}
|
16250 |
+
function moveChildToFrag(parent, frag, vnode) {
|
16251 |
+
// Dodge the recursion overhead in a few of the most common cases.
|
16252 |
+
while (vnode.dom != null && vnode.dom.parentNode === parent) {
|
16253 |
+
if (typeof vnode.tag !== "string") {
|
16254 |
+
vnode = vnode.instance
|
16255 |
+
if (vnode != null) continue
|
16256 |
+
} else if (vnode.tag === "<") {
|
16257 |
+
for (var i = 0; i < vnode.instance.length; i++) {
|
16258 |
+
frag.appendChild(vnode.instance[i])
|
16259 |
+
}
|
16260 |
+
} else if (vnode.tag !== "[") {
|
16261 |
+
// Don't recurse for text nodes *or* elements, just fragments
|
16262 |
+
frag.appendChild(vnode.dom)
|
16263 |
+
} else if (vnode.children.length === 1) {
|
16264 |
+
vnode = vnode.children[0]
|
16265 |
+
if (vnode != null) continue
|
16266 |
+
} else {
|
16267 |
+
for (var i = 0; i < vnode.children.length; i++) {
|
16268 |
+
var child = vnode.children[i]
|
16269 |
+
if (child != null) moveChildToFrag(parent, frag, child)
|
16270 |
+
}
|
16271 |
+
}
|
16272 |
+
break
|
16273 |
+
}
|
16274 |
+
}
|
16275 |
+
|
16276 |
+
function insertNode(parent, dom, nextSibling) {
|
16277 |
+
if (nextSibling != null) parent.insertBefore(dom, nextSibling)
|
16278 |
+
else parent.appendChild(dom)
|
16279 |
+
}
|
16280 |
+
|
16281 |
+
function maybeSetContentEditable(vnode) {
|
16282 |
+
if (vnode.attrs == null || (
|
16283 |
+
vnode.attrs.contenteditable == null && // attribute
|
16284 |
+
vnode.attrs.contentEditable == null // property
|
16285 |
+
)) return false
|
16286 |
+
var children = vnode.children
|
16287 |
+
if (children != null && children.length === 1 && children[0].tag === "<") {
|
16288 |
+
var content = children[0].children
|
16289 |
+
if (vnode.dom.innerHTML !== content) vnode.dom.innerHTML = content
|
16290 |
+
}
|
16291 |
+
else if (vnode.text != null || children != null && children.length !== 0) throw new Error("Child node of a contenteditable must be trusted")
|
16292 |
+
return true
|
16293 |
+
}
|
16294 |
+
|
16295 |
+
//remove
|
16296 |
+
function removeNodes(parent, vnodes, start, end) {
|
16297 |
+
for (var i = start; i < end; i++) {
|
16298 |
+
var vnode = vnodes[i]
|
16299 |
+
if (vnode != null) removeNode(parent, vnode)
|
16300 |
+
}
|
16301 |
+
}
|
16302 |
+
function removeNode(parent, vnode) {
|
16303 |
+
var mask = 0
|
16304 |
+
var original = vnode.state
|
16305 |
+
var stateResult, attrsResult
|
16306 |
+
if (typeof vnode.tag !== "string" && typeof vnode.state.onbeforeremove === "function") {
|
16307 |
+
var result = callHook.call(vnode.state.onbeforeremove, vnode)
|
16308 |
+
if (result != null && typeof result.then === "function") {
|
16309 |
+
mask = 1
|
16310 |
+
stateResult = result
|
16311 |
+
}
|
16312 |
+
}
|
16313 |
+
if (vnode.attrs && typeof vnode.attrs.onbeforeremove === "function") {
|
16314 |
+
var result = callHook.call(vnode.attrs.onbeforeremove, vnode)
|
16315 |
+
if (result != null && typeof result.then === "function") {
|
16316 |
+
// eslint-disable-next-line no-bitwise
|
16317 |
+
mask |= 2
|
16318 |
+
attrsResult = result
|
16319 |
+
}
|
16320 |
+
}
|
16321 |
+
checkState(vnode, original)
|
16322 |
+
|
16323 |
+
// If we can, try to fast-path it and avoid all the overhead of awaiting
|
16324 |
+
if (!mask) {
|
16325 |
+
onremove(vnode)
|
16326 |
+
removeChild(parent, vnode)
|
16327 |
+
} else {
|
16328 |
+
if (stateResult != null) {
|
16329 |
+
var next = function () {
|
16330 |
+
// eslint-disable-next-line no-bitwise
|
16331 |
+
if (mask & 1) { mask &= 2; if (!mask) reallyRemove() }
|
16332 |
+
}
|
16333 |
+
stateResult.then(next, next)
|
16334 |
+
}
|
16335 |
+
if (attrsResult != null) {
|
16336 |
+
var next = function () {
|
16337 |
+
// eslint-disable-next-line no-bitwise
|
16338 |
+
if (mask & 2) { mask &= 1; if (!mask) reallyRemove() }
|
16339 |
+
}
|
16340 |
+
attrsResult.then(next, next)
|
16341 |
+
}
|
16342 |
+
}
|
16343 |
+
|
16344 |
+
function reallyRemove() {
|
16345 |
+
checkState(vnode, original)
|
16346 |
+
onremove(vnode)
|
16347 |
+
removeChild(parent, vnode)
|
16348 |
+
}
|
16349 |
+
}
|
16350 |
+
function removeHTML(parent, vnode) {
|
16351 |
+
for (var i = 0; i < vnode.instance.length; i++) {
|
16352 |
+
parent.removeChild(vnode.instance[i])
|
16353 |
+
}
|
16354 |
+
}
|
16355 |
+
function removeChild(parent, vnode) {
|
16356 |
+
// Dodge the recursion overhead in a few of the most common cases.
|
16357 |
+
while (vnode.dom != null && vnode.dom.parentNode === parent) {
|
16358 |
+
if (typeof vnode.tag !== "string") {
|
16359 |
+
vnode = vnode.instance
|
16360 |
+
if (vnode != null) continue
|
16361 |
+
} else if (vnode.tag === "<") {
|
16362 |
+
removeHTML(parent, vnode)
|
16363 |
+
} else {
|
16364 |
+
if (vnode.tag !== "[") {
|
16365 |
+
parent.removeChild(vnode.dom)
|
16366 |
+
if (!Array.isArray(vnode.children)) break
|
16367 |
+
}
|
16368 |
+
if (vnode.children.length === 1) {
|
16369 |
+
vnode = vnode.children[0]
|
16370 |
+
if (vnode != null) continue
|
16371 |
+
} else {
|
16372 |
+
for (var i = 0; i < vnode.children.length; i++) {
|
16373 |
+
var child = vnode.children[i]
|
16374 |
+
if (child != null) removeChild(parent, child)
|
16375 |
+
}
|
16376 |
+
}
|
16377 |
+
}
|
16378 |
+
break
|
16379 |
+
}
|
16380 |
+
}
|
16381 |
+
function onremove(vnode) {
|
16382 |
+
if (typeof vnode.tag !== "string" && typeof vnode.state.onremove === "function") callHook.call(vnode.state.onremove, vnode)
|
16383 |
+
if (vnode.attrs && typeof vnode.attrs.onremove === "function") callHook.call(vnode.attrs.onremove, vnode)
|
16384 |
+
if (typeof vnode.tag !== "string") {
|
16385 |
+
if (vnode.instance != null) onremove(vnode.instance)
|
16386 |
+
} else {
|
16387 |
+
var children = vnode.children
|
16388 |
+
if (Array.isArray(children)) {
|
16389 |
+
for (var i = 0; i < children.length; i++) {
|
16390 |
+
var child = children[i]
|
16391 |
+
if (child != null) onremove(child)
|
16392 |
+
}
|
16393 |
+
}
|
16394 |
+
}
|
16395 |
+
}
|
16396 |
+
|
16397 |
+
//attrs
|
16398 |
+
function setAttrs(vnode, attrs, ns) {
|
16399 |
+
for (var key in attrs) {
|
16400 |
+
setAttr(vnode, key, null, attrs[key], ns)
|
16401 |
+
}
|
16402 |
+
}
|
16403 |
+
function setAttr(vnode, key, old, value, ns) {
|
16404 |
+
if (key === "key" || key === "is" || value == null || isLifecycleMethod(key) || (old === value && !isFormAttribute(vnode, key)) && typeof value !== "object") return
|
16405 |
+
if (key[0] === "o" && key[1] === "n") return updateEvent(vnode, key, value)
|
16406 |
+
if (key.slice(0, 6) === "xlink:") vnode.dom.setAttributeNS("http://www.w3.org/1999/xlink", key.slice(6), value)
|
16407 |
+
else if (key === "style") updateStyle(vnode.dom, old, value)
|
16408 |
+
else if (hasPropertyKey(vnode, key, ns)) {
|
16409 |
+
if (key === "value") {
|
16410 |
+
// Only do the coercion if we're actually going to check the value.
|
16411 |
+
/* eslint-disable no-implicit-coercion */
|
16412 |
+
//setting input[value] to same value by typing on focused element moves cursor to end in Chrome
|
16413 |
+
if ((vnode.tag === "input" || vnode.tag === "textarea") && vnode.dom.value === "" + value && vnode.dom === activeElement()) return
|
16414 |
+
//setting select[value] to same value while having select open blinks select dropdown in Chrome
|
16415 |
+
if (vnode.tag === "select" && old !== null && vnode.dom.value === "" + value) return
|
16416 |
+
//setting option[value] to same value while having select open blinks select dropdown in Chrome
|
16417 |
+
if (vnode.tag === "option" && old !== null && vnode.dom.value === "" + value) return
|
16418 |
+
/* eslint-enable no-implicit-coercion */
|
16419 |
+
}
|
16420 |
+
// If you assign an input type that is not supported by IE 11 with an assignment expression, an error will occur.
|
16421 |
+
if (vnode.tag === "input" && key === "type") vnode.dom.setAttribute(key, value)
|
16422 |
+
else vnode.dom[key] = value
|
16423 |
+
} else {
|
16424 |
+
if (typeof value === "boolean") {
|
16425 |
+
if (value) vnode.dom.setAttribute(key, "")
|
16426 |
+
else vnode.dom.removeAttribute(key)
|
16427 |
+
}
|
16428 |
+
else vnode.dom.setAttribute(key === "className" ? "class" : key, value)
|
16429 |
+
}
|
16430 |
+
}
|
16431 |
+
function removeAttr(vnode, key, old, ns) {
|
16432 |
+
if (key === "key" || key === "is" || old == null || isLifecycleMethod(key)) return
|
16433 |
+
if (key[0] === "o" && key[1] === "n" && !isLifecycleMethod(key)) updateEvent(vnode, key, undefined)
|
16434 |
+
else if (key === "style") updateStyle(vnode.dom, old, null)
|
16435 |
+
else if (
|
16436 |
+
hasPropertyKey(vnode, key, ns)
|
16437 |
+
&& key !== "className"
|
16438 |
+
&& !(key === "value" && (
|
16439 |
+
vnode.tag === "option"
|
16440 |
+
|| vnode.tag === "select" && vnode.dom.selectedIndex === -1 && vnode.dom === activeElement()
|
16441 |
+
))
|
16442 |
+
&& !(vnode.tag === "input" && key === "type")
|
16443 |
+
) {
|
16444 |
+
vnode.dom[key] = null
|
16445 |
+
} else {
|
16446 |
+
var nsLastIndex = key.indexOf(":")
|
16447 |
+
if (nsLastIndex !== -1) key = key.slice(nsLastIndex + 1)
|
16448 |
+
if (old !== false) vnode.dom.removeAttribute(key === "className" ? "class" : key)
|
16449 |
+
}
|
16450 |
+
}
|
16451 |
+
function setLateSelectAttrs(vnode, attrs) {
|
16452 |
+
if ("value" in attrs) {
|
16453 |
+
if(attrs.value === null) {
|
16454 |
+
if (vnode.dom.selectedIndex !== -1) vnode.dom.value = null
|
16455 |
+
} else {
|
16456 |
+
var normalized = "" + attrs.value // eslint-disable-line no-implicit-coercion
|
16457 |
+
if (vnode.dom.value !== normalized || vnode.dom.selectedIndex === -1) {
|
16458 |
+
vnode.dom.value = normalized
|
16459 |
+
}
|
16460 |
+
}
|
16461 |
+
}
|
16462 |
+
if ("selectedIndex" in attrs) setAttr(vnode, "selectedIndex", null, attrs.selectedIndex, undefined)
|
16463 |
+
}
|
16464 |
+
function updateAttrs(vnode, old, attrs, ns) {
|
16465 |
+
if (attrs != null) {
|
16466 |
+
for (var key in attrs) {
|
16467 |
+
setAttr(vnode, key, old && old[key], attrs[key], ns)
|
16468 |
+
}
|
16469 |
+
}
|
16470 |
+
var val
|
16471 |
+
if (old != null) {
|
16472 |
+
for (var key in old) {
|
16473 |
+
if (((val = old[key]) != null) && (attrs == null || attrs[key] == null)) {
|
16474 |
+
removeAttr(vnode, key, val, ns)
|
16475 |
+
}
|
16476 |
+
}
|
16477 |
+
}
|
16478 |
+
}
|
16479 |
+
function isFormAttribute(vnode, attr) {
|
16480 |
+
return attr === "value" || attr === "checked" || attr === "selectedIndex" || attr === "selected" && vnode.dom === activeElement() || vnode.tag === "option" && vnode.dom.parentNode === $doc.activeElement
|
16481 |
+
}
|
16482 |
+
function isLifecycleMethod(attr) {
|
16483 |
+
return attr === "oninit" || attr === "oncreate" || attr === "onupdate" || attr === "onremove" || attr === "onbeforeremove" || attr === "onbeforeupdate"
|
16484 |
+
}
|
16485 |
+
function hasPropertyKey(vnode, key, ns) {
|
16486 |
+
// Filter out namespaced keys
|
16487 |
+
return ns === undefined && (
|
16488 |
+
// If it's a custom element, just keep it.
|
16489 |
+
vnode.tag.indexOf("-") > -1 || vnode.attrs != null && vnode.attrs.is ||
|
16490 |
+
// If it's a normal element, let's try to avoid a few browser bugs.
|
16491 |
+
key !== "href" && key !== "list" && key !== "form" && key !== "width" && key !== "height"// && key !== "type"
|
16492 |
+
// Defer the property check until *after* we check everything.
|
16493 |
+
) && key in vnode.dom
|
16494 |
+
}
|
16495 |
+
|
16496 |
+
//style
|
16497 |
+
var uppercaseRegex = /[A-Z]/g
|
16498 |
+
function toLowerCase(capital) { return "-" + capital.toLowerCase() }
|
16499 |
+
function normalizeKey(key) {
|
16500 |
+
return key[0] === "-" && key[1] === "-" ? key :
|
16501 |
+
key === "cssFloat" ? "float" :
|
16502 |
+
key.replace(uppercaseRegex, toLowerCase)
|
16503 |
+
}
|
16504 |
+
function updateStyle(element, old, style) {
|
16505 |
+
if (old === style) {
|
16506 |
+
// Styles are equivalent, do nothing.
|
16507 |
+
} else if (style == null) {
|
16508 |
+
// New style is missing, just clear it.
|
16509 |
+
element.style.cssText = ""
|
16510 |
+
} else if (typeof style !== "object") {
|
16511 |
+
// New style is a string, let engine deal with patching.
|
16512 |
+
element.style.cssText = style
|
16513 |
+
} else if (old == null || typeof old !== "object") {
|
16514 |
+
// `old` is missing or a string, `style` is an object.
|
16515 |
+
element.style.cssText = ""
|
16516 |
+
// Add new style properties
|
16517 |
+
for (var key in style) {
|
16518 |
+
var value = style[key]
|
16519 |
+
if (value != null) element.style.setProperty(normalizeKey(key), String(value))
|
16520 |
+
}
|
16521 |
+
} else {
|
16522 |
+
// Both old & new are (different) objects.
|
16523 |
+
// Update style properties that have changed
|
16524 |
+
for (var key in style) {
|
16525 |
+
var value = style[key]
|
16526 |
+
if (value != null && (value = String(value)) !== String(old[key])) {
|
16527 |
+
element.style.setProperty(normalizeKey(key), value)
|
16528 |
+
}
|
16529 |
+
}
|
16530 |
+
// Remove style properties that no longer exist
|
16531 |
+
for (var key in old) {
|
16532 |
+
if (old[key] != null && style[key] == null) {
|
16533 |
+
element.style.removeProperty(normalizeKey(key))
|
16534 |
+
}
|
16535 |
+
}
|
16536 |
+
}
|
16537 |
+
}
|
16538 |
+
|
16539 |
+
// Here's an explanation of how this works:
|
16540 |
+
// 1. The event names are always (by design) prefixed by `on`.
|
16541 |
+
// 2. The EventListener interface accepts either a function or an object
|
16542 |
+
// with a `handleEvent` method.
|
16543 |
+
// 3. The object does not inherit from `Object.prototype`, to avoid
|
16544 |
+
// any potential interference with that (e.g. setters).
|
16545 |
+
// 4. The event name is remapped to the handler before calling it.
|
16546 |
+
// 5. In function-based event handlers, `ev.target === this`. We replicate
|
16547 |
+
// that below.
|
16548 |
+
// 6. In function-based event handlers, `return false` prevents the default
|
16549 |
+
// action and stops event propagation. We replicate that below.
|
16550 |
+
function EventDict() {
|
16551 |
+
// Save this, so the current redraw is correctly tracked.
|
16552 |
+
this._ = currentRedraw
|
16553 |
+
}
|
16554 |
+
EventDict.prototype = Object.create(null)
|
16555 |
+
EventDict.prototype.handleEvent = function (ev) {
|
16556 |
+
var handler = this["on" + ev.type]
|
16557 |
+
var result
|
16558 |
+
if (typeof handler === "function") result = handler.call(ev.currentTarget, ev)
|
16559 |
+
else if (typeof handler.handleEvent === "function") handler.handleEvent(ev)
|
16560 |
+
if (this._ && ev.redraw !== false) (0, this._)()
|
16561 |
+
if (result === false) {
|
16562 |
+
ev.preventDefault()
|
16563 |
+
ev.stopPropagation()
|
16564 |
+
}
|
16565 |
+
}
|
16566 |
+
|
16567 |
+
//event
|
16568 |
+
function updateEvent(vnode, key, value) {
|
16569 |
+
if (vnode.events != null) {
|
16570 |
+
if (vnode.events[key] === value) return
|
16571 |
+
if (value != null && (typeof value === "function" || typeof value === "object")) {
|
16572 |
+
if (vnode.events[key] == null) vnode.dom.addEventListener(key.slice(2), vnode.events, false)
|
16573 |
+
vnode.events[key] = value
|
16574 |
+
} else {
|
16575 |
+
if (vnode.events[key] != null) vnode.dom.removeEventListener(key.slice(2), vnode.events, false)
|
16576 |
+
vnode.events[key] = undefined
|
16577 |
+
}
|
16578 |
+
} else if (value != null && (typeof value === "function" || typeof value === "object")) {
|
16579 |
+
vnode.events = new EventDict()
|
16580 |
+
vnode.dom.addEventListener(key.slice(2), vnode.events, false)
|
16581 |
+
vnode.events[key] = value
|
16582 |
+
}
|
16583 |
+
}
|
16584 |
+
|
16585 |
+
//lifecycle
|
16586 |
+
function initLifecycle(source, vnode, hooks) {
|
16587 |
+
if (typeof source.oninit === "function") callHook.call(source.oninit, vnode)
|
16588 |
+
if (typeof source.oncreate === "function") hooks.push(callHook.bind(source.oncreate, vnode))
|
16589 |
+
}
|
16590 |
+
function updateLifecycle(source, vnode, hooks) {
|
16591 |
+
if (typeof source.onupdate === "function") hooks.push(callHook.bind(source.onupdate, vnode))
|
16592 |
+
}
|
16593 |
+
function shouldNotUpdate(vnode, old) {
|
16594 |
+
do {
|
16595 |
+
if (vnode.attrs != null && typeof vnode.attrs.onbeforeupdate === "function") {
|
16596 |
+
var force = callHook.call(vnode.attrs.onbeforeupdate, vnode, old)
|
16597 |
+
if (force !== undefined && !force) break
|
16598 |
+
}
|
16599 |
+
if (typeof vnode.tag !== "string" && typeof vnode.state.onbeforeupdate === "function") {
|
16600 |
+
var force = callHook.call(vnode.state.onbeforeupdate, vnode, old)
|
16601 |
+
if (force !== undefined && !force) break
|
16602 |
+
}
|
16603 |
+
return false
|
16604 |
+
} while (false); // eslint-disable-line no-constant-condition
|
16605 |
+
vnode.dom = old.dom
|
16606 |
+
vnode.domSize = old.domSize
|
16607 |
+
vnode.instance = old.instance
|
16608 |
+
// One would think having the actual latest attributes would be ideal,
|
16609 |
+
// but it doesn't let us properly diff based on our current internal
|
16610 |
+
// representation. We have to save not only the old DOM info, but also
|
16611 |
+
// the attributes used to create it, as we diff *that*, not against the
|
16612 |
+
// DOM directly (with a few exceptions in `setAttr`). And, of course, we
|
16613 |
+
// need to save the children and text as they are conceptually not
|
16614 |
+
// unlike special "attributes" internally.
|
16615 |
+
vnode.attrs = old.attrs
|
16616 |
+
vnode.children = old.children
|
16617 |
+
vnode.text = old.text
|
16618 |
+
return true
|
16619 |
+
}
|
16620 |
+
|
16621 |
+
return function(dom, vnodes, redraw) {
|
16622 |
+
if (!dom) throw new TypeError("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.")
|
16623 |
+
var hooks = []
|
16624 |
+
var active = activeElement()
|
16625 |
+
var namespace = dom.namespaceURI
|
16626 |
+
|
16627 |
+
// First time rendering into a node clears it out
|
16628 |
+
if (dom.vnodes == null) dom.textContent = ""
|
16629 |
+
|
16630 |
+
vnodes = Vnode.normalizeChildren(Array.isArray(vnodes) ? vnodes : [vnodes])
|
16631 |
+
var prevRedraw = currentRedraw
|
16632 |
+
try {
|
16633 |
+
currentRedraw = typeof redraw === "function" ? redraw : undefined
|
16634 |
+
updateNodes(dom, dom.vnodes, vnodes, hooks, null, namespace === "http://www.w3.org/1999/xhtml" ? undefined : namespace)
|
16635 |
+
} finally {
|
16636 |
+
currentRedraw = prevRedraw
|
16637 |
+
}
|
16638 |
+
dom.vnodes = vnodes
|
16639 |
+
// `document.activeElement` can return null: https://html.spec.whatwg.org/multipage/interaction.html#dom-document-activeelement
|
16640 |
+
if (active != null && activeElement() !== active && typeof active.focus === "function") active.focus()
|
16641 |
+
for (var i = 0; i < hooks.length; i++) hooks[i]()
|
16642 |
+
}
|
16643 |
+
}
|
16644 |
+
|
16645 |
+
},{"../render/vnode":44}],43:[function(require,module,exports){
|
16646 |
+
"use strict"
|
16647 |
+
|
16648 |
+
var Vnode = require("../render/vnode")
|
16649 |
+
|
16650 |
+
module.exports = function(html) {
|
16651 |
+
if (html == null) html = ""
|
16652 |
+
return Vnode("<", undefined, undefined, html, undefined, undefined)
|
16653 |
+
}
|
16654 |
+
|
16655 |
+
},{"../render/vnode":44}],44:[function(require,module,exports){
|
16656 |
+
"use strict"
|
16657 |
+
|
16658 |
+
function Vnode(tag, key, attrs, children, text, dom) {
|
16659 |
+
return {tag: tag, key: key, attrs: attrs, children: children, text: text, dom: dom, domSize: undefined, state: undefined, events: undefined, instance: undefined}
|
16660 |
+
}
|
16661 |
+
Vnode.normalize = function(node) {
|
16662 |
+
if (Array.isArray(node)) return Vnode("[", undefined, undefined, Vnode.normalizeChildren(node), undefined, undefined)
|
16663 |
+
if (node == null || typeof node === "boolean") return null
|
16664 |
+
if (typeof node === "object") return node
|
16665 |
+
return Vnode("#", undefined, undefined, String(node), undefined, undefined)
|
16666 |
+
}
|
16667 |
+
Vnode.normalizeChildren = function(input) {
|
16668 |
+
var children = []
|
16669 |
+
if (input.length) {
|
16670 |
+
var isKeyed = input[0] != null && input[0].key != null
|
16671 |
+
// Note: this is a *very* perf-sensitive check.
|
16672 |
+
// Fun fact: merging the loop like this is somehow faster than splitting
|
16673 |
+
// it, noticeably so.
|
16674 |
+
for (var i = 1; i < input.length; i++) {
|
16675 |
+
if ((input[i] != null && input[i].key != null) !== isKeyed) {
|
16676 |
+
throw new TypeError("Vnodes must either always have keys or never have keys!")
|
16677 |
+
}
|
16678 |
+
}
|
16679 |
+
for (var i = 0; i < input.length; i++) {
|
16680 |
+
children[i] = Vnode.normalize(input[i])
|
16681 |
+
}
|
16682 |
+
}
|
16683 |
+
return children
|
16684 |
+
}
|
16685 |
+
|
16686 |
+
module.exports = Vnode
|
16687 |
+
|
16688 |
+
},{}],45:[function(require,module,exports){
|
16689 |
+
"use strict"
|
16690 |
+
|
16691 |
+
var PromisePolyfill = require("./promise/promise")
|
16692 |
+
var mountRedraw = require("./mount-redraw")
|
16693 |
+
|
16694 |
+
module.exports = require("./request/request")(window, PromisePolyfill, mountRedraw.redraw)
|
16695 |
+
|
16696 |
+
},{"./mount-redraw":29,"./promise/promise":35,"./request/request":46}],46:[function(require,module,exports){
|
16697 |
+
"use strict"
|
16698 |
+
|
16699 |
+
var buildPathname = require("../pathname/build")
|
16700 |
+
|
16701 |
+
module.exports = function($window, Promise, oncompletion) {
|
16702 |
+
var callbackCount = 0
|
16703 |
+
|
16704 |
+
function PromiseProxy(executor) {
|
16705 |
+
return new Promise(executor)
|
16706 |
+
}
|
16707 |
+
|
16708 |
+
// In case the global Promise is some userland library's where they rely on
|
16709 |
+
// `foo instanceof this.constructor`, `this.constructor.resolve(value)`, or
|
16710 |
+
// similar. Let's *not* break them.
|
16711 |
+
PromiseProxy.prototype = Promise.prototype
|
16712 |
+
PromiseProxy.__proto__ = Promise // eslint-disable-line no-proto
|
16713 |
+
|
16714 |
+
function makeRequest(factory) {
|
16715 |
+
return function(url, args) {
|
16716 |
+
if (typeof url !== "string") { args = url; url = url.url }
|
16717 |
+
else if (args == null) args = {}
|
16718 |
+
var promise = new Promise(function(resolve, reject) {
|
16719 |
+
factory(buildPathname(url, args.params), args, function (data) {
|
16720 |
+
if (typeof args.type === "function") {
|
16721 |
+
if (Array.isArray(data)) {
|
16722 |
+
for (var i = 0; i < data.length; i++) {
|
16723 |
+
data[i] = new args.type(data[i])
|
16724 |
+
}
|
16725 |
+
}
|
16726 |
+
else data = new args.type(data)
|
16727 |
+
}
|
16728 |
+
resolve(data)
|
16729 |
+
}, reject)
|
16730 |
+
})
|
16731 |
+
if (args.background === true) return promise
|
16732 |
+
var count = 0
|
16733 |
+
function complete() {
|
16734 |
+
if (--count === 0 && typeof oncompletion === "function") oncompletion()
|
16735 |
+
}
|
16736 |
+
|
16737 |
+
return wrap(promise)
|
16738 |
+
|
16739 |
+
function wrap(promise) {
|
16740 |
+
var then = promise.then
|
16741 |
+
// Set the constructor, so engines know to not await or resolve
|
16742 |
+
// this as a native promise. At the time of writing, this is
|
16743 |
+
// only necessary for V8, but their behavior is the correct
|
16744 |
+
// behavior per spec. See this spec issue for more details:
|
16745 |
+
// https://github.com/tc39/ecma262/issues/1577. Also, see the
|
16746 |
+
// corresponding comment in `request/tests/test-request.js` for
|
16747 |
+
// a bit more background on the issue at hand.
|
16748 |
+
promise.constructor = PromiseProxy
|
16749 |
+
promise.then = function() {
|
16750 |
+
count++
|
16751 |
+
var next = then.apply(promise, arguments)
|
16752 |
+
next.then(complete, function(e) {
|
16753 |
+
complete()
|
16754 |
+
if (count === 0) throw e
|
16755 |
+
})
|
16756 |
+
return wrap(next)
|
16757 |
+
}
|
16758 |
+
return promise
|
16759 |
+
}
|
16760 |
+
}
|
16761 |
+
}
|
16762 |
+
|
16763 |
+
function hasHeader(args, name) {
|
16764 |
+
for (var key in args.headers) {
|
16765 |
+
if ({}.hasOwnProperty.call(args.headers, key) && name.test(key)) return true
|
16766 |
+
}
|
16767 |
+
return false
|
16768 |
+
}
|
16769 |
+
|
16770 |
+
return {
|
16771 |
+
request: makeRequest(function(url, args, resolve, reject) {
|
16772 |
+
var method = args.method != null ? args.method.toUpperCase() : "GET"
|
16773 |
+
var body = args.body
|
16774 |
+
var assumeJSON = (args.serialize == null || args.serialize === JSON.serialize) && !(body instanceof $window.FormData)
|
16775 |
+
var responseType = args.responseType || (typeof args.extract === "function" ? "" : "json")
|
16776 |
+
|
16777 |
+
var xhr = new $window.XMLHttpRequest(), aborted = false
|
16778 |
+
var original = xhr, replacedAbort
|
16779 |
+
var abort = xhr.abort
|
16780 |
+
|
16781 |
+
xhr.abort = function() {
|
16782 |
+
aborted = true
|
16783 |
+
abort.call(this)
|
16784 |
+
}
|
16785 |
+
|
16786 |
+
xhr.open(method, url, args.async !== false, typeof args.user === "string" ? args.user : undefined, typeof args.password === "string" ? args.password : undefined)
|
16787 |
+
|
16788 |
+
if (assumeJSON && body != null && !hasHeader(args, /^content-type$/i)) {
|
16789 |
+
xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8")
|
16790 |
+
}
|
16791 |
+
if (typeof args.deserialize !== "function" && !hasHeader(args, /^accept$/i)) {
|
16792 |
+
xhr.setRequestHeader("Accept", "application/json, text/*")
|
16793 |
+
}
|
16794 |
+
if (args.withCredentials) xhr.withCredentials = args.withCredentials
|
16795 |
+
if (args.timeout) xhr.timeout = args.timeout
|
16796 |
+
xhr.responseType = responseType
|
16797 |
+
|
16798 |
+
for (var key in args.headers) {
|
16799 |
+
if ({}.hasOwnProperty.call(args.headers, key)) {
|
16800 |
+
xhr.setRequestHeader(key, args.headers[key])
|
16801 |
+
}
|
16802 |
+
}
|
16803 |
+
|
16804 |
+
xhr.onreadystatechange = function(ev) {
|
16805 |
+
// Don't throw errors on xhr.abort().
|
16806 |
+
if (aborted) return
|
16807 |
+
|
16808 |
+
if (ev.target.readyState === 4) {
|
16809 |
+
try {
|
16810 |
+
var success = (ev.target.status >= 200 && ev.target.status < 300) || ev.target.status === 304 || (/^file:\/\//i).test(url)
|
16811 |
+
// When the response type isn't "" or "text",
|
16812 |
+
// `xhr.responseText` is the wrong thing to use.
|
16813 |
+
// Browsers do the right thing and throw here, and we
|
16814 |
+
// should honor that and do the right thing by
|
16815 |
+
// preferring `xhr.response` where possible/practical.
|
16816 |
+
var response = ev.target.response, message
|
16817 |
+
|
16818 |
+
if (responseType === "json") {
|
16819 |
+
// For IE and Edge, which don't implement
|
16820 |
+
// `responseType: "json"`.
|
16821 |
+
if (!ev.target.responseType && typeof args.extract !== "function") response = JSON.parse(ev.target.responseText)
|
16822 |
+
} else if (!responseType || responseType === "text") {
|
16823 |
+
// Only use this default if it's text. If a parsed
|
16824 |
+
// document is needed on old IE and friends (all
|
16825 |
+
// unsupported), the user should use a custom
|
16826 |
+
// `config` instead. They're already using this at
|
16827 |
+
// their own risk.
|
16828 |
+
if (response == null) response = ev.target.responseText
|
16829 |
+
}
|
16830 |
+
|
16831 |
+
if (typeof args.extract === "function") {
|
16832 |
+
response = args.extract(ev.target, args)
|
16833 |
+
success = true
|
16834 |
+
} else if (typeof args.deserialize === "function") {
|
16835 |
+
response = args.deserialize(response)
|
16836 |
+
}
|
16837 |
+
if (success) resolve(response)
|
16838 |
+
else {
|
16839 |
+
try { message = ev.target.responseText }
|
16840 |
+
catch (e) { message = response }
|
16841 |
+
var error = new Error(message)
|
16842 |
+
error.code = ev.target.status
|
16843 |
+
error.response = response
|
16844 |
+
reject(error)
|
16845 |
+
}
|
16846 |
+
}
|
16847 |
+
catch (e) {
|
16848 |
+
reject(e)
|
16849 |
+
}
|
16850 |
+
}
|
16851 |
+
}
|
16852 |
+
|
16853 |
+
if (typeof args.config === "function") {
|
16854 |
+
xhr = args.config(xhr, args, url) || xhr
|
16855 |
+
|
16856 |
+
// Propagate the `abort` to any replacement XHR as well.
|
16857 |
+
if (xhr !== original) {
|
16858 |
+
replacedAbort = xhr.abort
|
16859 |
+
xhr.abort = function() {
|
16860 |
+
aborted = true
|
16861 |
+
replacedAbort.call(this)
|
16862 |
+
}
|
16863 |
+
}
|
16864 |
+
}
|
16865 |
+
|
16866 |
+
if (body == null) xhr.send()
|
16867 |
+
else if (typeof args.serialize === "function") xhr.send(args.serialize(body))
|
16868 |
+
else if (body instanceof $window.FormData) xhr.send(body)
|
16869 |
+
else xhr.send(JSON.stringify(body))
|
16870 |
+
}),
|
16871 |
+
jsonp: makeRequest(function(url, args, resolve, reject) {
|
16872 |
+
var callbackName = args.callbackName || "_mithril_" + Math.round(Math.random() * 1e16) + "_" + callbackCount++
|
16873 |
+
var script = $window.document.createElement("script")
|
16874 |
+
$window[callbackName] = function(data) {
|
16875 |
+
delete $window[callbackName]
|
16876 |
+
script.parentNode.removeChild(script)
|
16877 |
+
resolve(data)
|
16878 |
+
}
|
16879 |
+
script.onerror = function() {
|
16880 |
+
delete $window[callbackName]
|
16881 |
+
script.parentNode.removeChild(script)
|
16882 |
+
reject(new Error("JSONP request failed"))
|
16883 |
+
}
|
16884 |
+
script.src = url + (url.indexOf("?") < 0 ? "?" : "&") +
|
16885 |
+
encodeURIComponent(args.callbackKey || "callback") + "=" +
|
16886 |
+
encodeURIComponent(callbackName)
|
16887 |
+
$window.document.documentElement.appendChild(script)
|
16888 |
+
}),
|
16889 |
+
}
|
16890 |
+
}
|
16891 |
+
|
16892 |
+
},{"../pathname/build":31}],47:[function(require,module,exports){
|
16893 |
+
"use strict"
|
16894 |
+
|
16895 |
+
var mountRedraw = require("./mount-redraw")
|
16896 |
+
|
16897 |
+
module.exports = require("./api/router")(window, mountRedraw)
|
16898 |
+
|
16899 |
+
},{"./api/router":26,"./mount-redraw":29}],48:[function(require,module,exports){
|
16900 |
+
// shim for using process in browser
|
16901 |
+
var process = module.exports = {};
|
16902 |
+
|
16903 |
+
// cached from whatever global is present so that test runners that stub it
|
16904 |
+
// don't break things. But we need to wrap it in a try catch in case it is
|
16905 |
+
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
16906 |
+
// function because try/catches deoptimize in certain engines.
|
16907 |
+
|
16908 |
+
var cachedSetTimeout;
|
16909 |
+
var cachedClearTimeout;
|
16910 |
+
|
16911 |
+
function defaultSetTimout() {
|
16912 |
+
throw new Error('setTimeout has not been defined');
|
16913 |
+
}
|
16914 |
+
function defaultClearTimeout () {
|
16915 |
+
throw new Error('clearTimeout has not been defined');
|
16916 |
+
}
|
16917 |
+
(function () {
|
16918 |
+
try {
|
16919 |
+
if (typeof setTimeout === 'function') {
|
16920 |
+
cachedSetTimeout = setTimeout;
|
16921 |
+
} else {
|
16922 |
+
cachedSetTimeout = defaultSetTimout;
|
16923 |
+
}
|
16924 |
+
} catch (e) {
|
16925 |
+
cachedSetTimeout = defaultSetTimout;
|
16926 |
+
}
|
16927 |
+
try {
|
16928 |
+
if (typeof clearTimeout === 'function') {
|
16929 |
+
cachedClearTimeout = clearTimeout;
|
16930 |
+
} else {
|
16931 |
+
cachedClearTimeout = defaultClearTimeout;
|
16932 |
+
}
|
16933 |
+
} catch (e) {
|
16934 |
+
cachedClearTimeout = defaultClearTimeout;
|
16935 |
+
}
|
16936 |
+
} ())
|
16937 |
+
function runTimeout(fun) {
|
16938 |
+
if (cachedSetTimeout === setTimeout) {
|
16939 |
+
//normal enviroments in sane situations
|
16940 |
+
return setTimeout(fun, 0);
|
16941 |
+
}
|
16942 |
+
// if setTimeout wasn't available but was latter defined
|
16943 |
+
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
16944 |
+
cachedSetTimeout = setTimeout;
|
16945 |
+
return setTimeout(fun, 0);
|
16946 |
+
}
|
16947 |
+
try {
|
16948 |
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
16949 |
+
return cachedSetTimeout(fun, 0);
|
16950 |
+
} catch(e){
|
16951 |
+
try {
|
16952 |
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
16953 |
+
return cachedSetTimeout.call(null, fun, 0);
|
16954 |
+
} catch(e){
|
16955 |
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
16956 |
+
return cachedSetTimeout.call(this, fun, 0);
|
16957 |
+
}
|
16958 |
+
}
|
16959 |
+
|
16960 |
+
|
16961 |
+
}
|
16962 |
+
function runClearTimeout(marker) {
|
16963 |
+
if (cachedClearTimeout === clearTimeout) {
|
16964 |
+
//normal enviroments in sane situations
|
16965 |
+
return clearTimeout(marker);
|
16966 |
+
}
|
16967 |
+
// if clearTimeout wasn't available but was latter defined
|
16968 |
+
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
16969 |
+
cachedClearTimeout = clearTimeout;
|
16970 |
+
return clearTimeout(marker);
|
16971 |
+
}
|
16972 |
+
try {
|
16973 |
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
16974 |
+
return cachedClearTimeout(marker);
|
16975 |
+
} catch (e){
|
16976 |
+
try {
|
16977 |
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
16978 |
+
return cachedClearTimeout.call(null, marker);
|
16979 |
+
} catch (e){
|
16980 |
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
16981 |
+
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
16982 |
+
return cachedClearTimeout.call(this, marker);
|
16983 |
+
}
|
16984 |
+
}
|
16985 |
+
|
16986 |
+
|
16987 |
+
|
16988 |
+
}
|
16989 |
+
var queue = [];
|
16990 |
+
var draining = false;
|
16991 |
+
var currentQueue;
|
16992 |
+
var queueIndex = -1;
|
16993 |
+
|
16994 |
+
function cleanUpNextTick() {
|
16995 |
+
if (!draining || !currentQueue) {
|
16996 |
+
return;
|
16997 |
+
}
|
16998 |
+
draining = false;
|
16999 |
+
if (currentQueue.length) {
|
17000 |
+
queue = currentQueue.concat(queue);
|
17001 |
+
} else {
|
17002 |
+
queueIndex = -1;
|
17003 |
+
}
|
17004 |
+
if (queue.length) {
|
17005 |
+
drainQueue();
|
17006 |
+
}
|
17007 |
+
}
|
17008 |
+
|
17009 |
+
function drainQueue() {
|
17010 |
+
if (draining) {
|
17011 |
+
return;
|
17012 |
+
}
|
17013 |
+
var timeout = runTimeout(cleanUpNextTick);
|
17014 |
+
draining = true;
|
17015 |
+
|
17016 |
+
var len = queue.length;
|
17017 |
+
while(len) {
|
17018 |
+
currentQueue = queue;
|
17019 |
+
queue = [];
|
17020 |
+
while (++queueIndex < len) {
|
17021 |
+
if (currentQueue) {
|
17022 |
+
currentQueue[queueIndex].run();
|
17023 |
+
}
|
17024 |
+
}
|
17025 |
+
queueIndex = -1;
|
17026 |
+
len = queue.length;
|
17027 |
+
}
|
17028 |
+
currentQueue = null;
|
17029 |
+
draining = false;
|
17030 |
+
runClearTimeout(timeout);
|
17031 |
+
}
|
17032 |
+
|
17033 |
+
process.nextTick = function (fun) {
|
17034 |
+
var args = new Array(arguments.length - 1);
|
17035 |
+
if (arguments.length > 1) {
|
17036 |
+
for (var i = 1; i < arguments.length; i++) {
|
17037 |
+
args[i - 1] = arguments[i];
|
17038 |
+
}
|
17039 |
+
}
|
17040 |
+
queue.push(new Item(fun, args));
|
17041 |
+
if (queue.length === 1 && !draining) {
|
17042 |
+
runTimeout(drainQueue);
|
17043 |
+
}
|
17044 |
+
};
|
17045 |
+
|
17046 |
+
// v8 likes predictible objects
|
17047 |
+
function Item(fun, array) {
|
17048 |
+
this.fun = fun;
|
17049 |
+
this.array = array;
|
17050 |
+
}
|
17051 |
+
Item.prototype.run = function () {
|
17052 |
+
this.fun.apply(null, this.array);
|
17053 |
+
};
|
17054 |
+
process.title = 'browser';
|
17055 |
+
process.browser = true;
|
17056 |
+
process.env = {};
|
17057 |
+
process.argv = [];
|
17058 |
+
process.version = ''; // empty string to avoid regexp issues
|
17059 |
+
process.versions = {};
|
17060 |
+
|
17061 |
+
function noop() {}
|
17062 |
+
|
17063 |
+
process.on = noop;
|
17064 |
+
process.addListener = noop;
|
17065 |
+
process.once = noop;
|
17066 |
+
process.off = noop;
|
17067 |
+
process.removeListener = noop;
|
17068 |
+
process.removeAllListeners = noop;
|
17069 |
+
process.emit = noop;
|
17070 |
+
process.prependListener = noop;
|
17071 |
+
process.prependOnceListener = noop;
|
17072 |
+
|
17073 |
+
process.listeners = function (name) { return [] }
|
17074 |
+
|
17075 |
+
process.binding = function (name) {
|
17076 |
+
throw new Error('process.binding is not supported');
|
17077 |
+
};
|
17078 |
+
|
17079 |
+
process.cwd = function () { return '/' };
|
17080 |
+
process.chdir = function (dir) {
|
17081 |
+
throw new Error('process.chdir is not supported');
|
17082 |
+
};
|
17083 |
+
process.umask = function() { return 0; };
|
17084 |
+
|
17085 |
+
},{}],49:[function(require,module,exports){
|
17086 |
+
(function (setImmediate,clearImmediate){
|
17087 |
+
var nextTick = require('process/browser.js').nextTick;
|
17088 |
+
var apply = Function.prototype.apply;
|
17089 |
+
var slice = Array.prototype.slice;
|
17090 |
+
var immediateIds = {};
|
17091 |
+
var nextImmediateId = 0;
|
17092 |
+
|
17093 |
+
// DOM APIs, for completeness
|
17094 |
+
|
17095 |
+
exports.setTimeout = function() {
|
17096 |
+
return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
|
17097 |
+
};
|
17098 |
+
exports.setInterval = function() {
|
17099 |
+
return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
|
17100 |
+
};
|
17101 |
+
exports.clearTimeout =
|
17102 |
+
exports.clearInterval = function(timeout) { timeout.close(); };
|
17103 |
+
|
17104 |
+
function Timeout(id, clearFn) {
|
17105 |
+
this._id = id;
|
17106 |
+
this._clearFn = clearFn;
|
17107 |
+
}
|
17108 |
+
Timeout.prototype.unref = Timeout.prototype.ref = function() {};
|
17109 |
+
Timeout.prototype.close = function() {
|
17110 |
+
this._clearFn.call(window, this._id);
|
17111 |
+
};
|
17112 |
+
|
17113 |
+
// Does not start the time, just sets up the members needed.
|
17114 |
+
exports.enroll = function(item, msecs) {
|
17115 |
+
clearTimeout(item._idleTimeoutId);
|
17116 |
+
item._idleTimeout = msecs;
|
17117 |
+
};
|
17118 |
+
|
17119 |
+
exports.unenroll = function(item) {
|
17120 |
+
clearTimeout(item._idleTimeoutId);
|
17121 |
+
item._idleTimeout = -1;
|
17122 |
+
};
|
17123 |
+
|
17124 |
+
exports._unrefActive = exports.active = function(item) {
|
17125 |
+
clearTimeout(item._idleTimeoutId);
|
17126 |
+
|
17127 |
+
var msecs = item._idleTimeout;
|
17128 |
+
if (msecs >= 0) {
|
17129 |
+
item._idleTimeoutId = setTimeout(function onTimeout() {
|
17130 |
+
if (item._onTimeout)
|
17131 |
+
item._onTimeout();
|
17132 |
+
}, msecs);
|
17133 |
+
}
|
17134 |
+
};
|
17135 |
+
|
17136 |
+
// That's not how node.js implements it but the exposed api is the same.
|
17137 |
+
exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
|
17138 |
+
var id = nextImmediateId++;
|
17139 |
+
var args = arguments.length < 2 ? false : slice.call(arguments, 1);
|
17140 |
+
|
17141 |
+
immediateIds[id] = true;
|
17142 |
+
|
17143 |
+
nextTick(function onNextTick() {
|
17144 |
+
if (immediateIds[id]) {
|
17145 |
+
// fn.call() is faster so we optimize for the common use-case
|
17146 |
+
// @see http://jsperf.com/call-apply-segu
|
17147 |
+
if (args) {
|
17148 |
+
fn.apply(null, args);
|
17149 |
+
} else {
|
17150 |
+
fn.call(null);
|
17151 |
+
}
|
17152 |
+
// Prevent ids from leaking
|
17153 |
+
exports.clearImmediate(id);
|
17154 |
+
}
|
17155 |
+
});
|
17156 |
+
|
17157 |
+
return id;
|
17158 |
+
};
|
17159 |
+
|
17160 |
+
exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
|
17161 |
+
delete immediateIds[id];
|
17162 |
+
};
|
17163 |
+
}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
|
17164 |
+
},{"process/browser.js":48,"timers":49}]},{},[13]);
|
17165 |
})();
|
assets/js/forms-admin.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
!function(){var o=void 0;!function o(a,l,s){function c(t,e){if(!l[t]){if(!a[t]){var r=!1;if(!e&&r)return r(t,!0);if(u)return u(t,!0);var n=new Error("Cannot find module '"+t+"'");throw n.code="MODULE_NOT_FOUND",n}var i=l[t]={exports:{}};a[t][0].call(i.exports,function(e){return c(a[t][1][e]||e)},i,i.exports,o,a,l,s)}return l[t].exports}for(var u=!1,e=0;e<s.length;e++)c(s[e]);return c}({1:[function(e,t,r){"use strict";t.exports=function(n,i){var e={showType:function(e){var t=e.type();return t=t.charAt(0).toUpperCase()+t.slice(1),n("div",[n("label",i.fieldType),n("span",t)])},label:function(e){return n("div",[n("label",i.fieldLabel),n("input.widefat",{type:"text",value:e.label(),onchange:n.withAttr("value",e.label),placeholder:e.title()})])},value:function(e){var t="hidden"===e.type();return n("div",[n("label",[t?i.value:i.initialValue," ",t?"":n("small",{style:"float: right; font-weight: normal;"},i.optional)]),n("input.widefat",{type:"text",value:e.value(),onchange:n.withAttr("value",e.value)}),t?"":n("p.help",i.valueHelp)])},numberMinMax:function(e){return n("div",[n("div.row",[n("div.col.col-3",[n("label",i.min),n("input",{type:"number",onchange:n.withAttr("value",e.min)})]),n("div.col.col-3",[n("label",i.max),n("input",{type:"number",onchange:n.withAttr("value",e.max)})])])])},isRequired:function(e){var t,r={type:"checkbox",checked:e.required(),onchange:n.withAttr("checked",e.required)};return e.forceRequired()&&(r.required=!0,r.disabled=!0,t=n("p.help",i.forceRequired)),n("div",[n("label.cb-wrap",[n("input",r),i.isFieldRequired]),t])},placeholder:function(e){return n("div",[n("label",[i.placeholder," ",n("small",{style:"float: right; font-weight: normal;"},i.optional)]),n("input.widefat",{type:"text",value:e.placeholder(),onchange:n.withAttr("value",e.placeholder),placeholder:""}),n("p.help",i.placeholderHelp)])},useParagraphs:function(e){return n("div",[n("label.cb-wrap",[n("input",{type:"checkbox",checked:e.wrap(),onchange:n.withAttr("checked",e.wrap)}),i.wrapInParagraphTags])])},choiceType:function(e){var t=[n("option",{value:"select",selected:"select"===e.type()&&"selected"},i.dropdown),n("option",{value:"radio",selected:"radio"===e.type()&&"selected"},i.radioButtons)];return e.acceptsMultipleValues&&t.push(n("option",{value:"checkbox",selected:"checkbox"===e.type()&&"selected"},i.checkboxes)),n("div",[n("label",i.choiceType),n("select",{value:e.type(),onchange:n.withAttr("value",e.type)},t)])},choices:function(r){var e=[];return e.push(n("div",[n("label",i.choices),n("div.limit-height",[n("table",[r.choices().map(function(e,t){return n("tr",{"data-id":t},[n("td.cb",n("input",{name:"selected",type:"checkbox"===r.type()?"checkbox":"radio",onchange:n.withAttr("value",r.selectChoice.bind(r)),checked:e.selected(),value:e.value(),title:i.preselect})),n("td.stretch",n("input.widefat",{type:"text",value:e.label(),placeholder:e.title(),onchange:n.withAttr("value",e.label)})),n("td",n("span",{title:i.remove,class:"dashicons dashicons-no-alt hover-activated",onclick:function(e){this.choices().splice(e,1)}.bind(r,t)},""))])})])])])),e},linkToTerms:function(e){return n("div",[n("label",i.agreeToTermsLink),n("input.widefat",{type:"text",value:e.link,onchange:n.withAttr("value",e.link),placeholder:"https://..."})])}};return e}},{}],2:[function(i,e,t){"use strict";e.exports=function(e,t){var r={},n=i("./field-forms-rows.js")(e,t);return r.render=function(e){var t=e.type();if("function"==typeof r[t])return r[t](e);switch(t){case"select":case"radio":case"checkbox":return r.choice(e)}return r.text(e)},r.text=function(e){return[n.label(e),n.placeholder(e),n.value(e),n.isRequired(e),n.useParagraphs(e)]},r.choice=function(e){var t=[n.label(e),n.choiceType(e),n.choices(e)];return"select"===e.type()&&t.push(n.placeholder(e)),t.push(n.useParagraphs(e)),"select"!==e.type()&&"radio"!==e.type()||t.push(n.isRequired(e)),t},r.hidden=function(e){return e.placeholder(""),e.label(""),e.wrap(!1),[n.showType(e),n.value(e)]},r.submit=function(e){return e.label(""),e.placeholder(""),[n.value(e),n.useParagraphs(e)]},r["terms-checkbox"]=function(e){return[n.label(e),n.linkToTerms(e),n.isRequired(e),n.useParagraphs(e)]},r.number=function(e){return[r.text(e),n.numberMinMax(e)]},r}},{"./field-forms-rows.js":1}],3:[function(e,t,r){"use strict";function l(e){e.dom.checked&&e.dom.setAttribute("checked","true"),e.dom.value&&e.dom.setAttribute("value",e.dom.value),e.dom.selected&&e.dom.setAttribute("selected","true")}var s=e("html");t.exports=function(o){var a={};return a.select=function(e){var t={name:e.name(),required:e.required()},r=!1,n=e.choices().map(function(e){return e.selected()&&(r=!0),o("option",{value:e.value()!==e.label()?e.value():void 0,selected:e.selected(),oncreate:l},e.label())}),i=e.placeholder();return 0<i.length&&n.unshift(o("option",{disabled:!0,value:"",selected:!r,oncreate:l},i)),o("select",t,n)},a["terms-checkbox"]=function(e){var t;return t=0<e.link().length?o("a",{href:e.link(),target:"_blank"},e.label()):e.label(),o("label",[o("input",{name:e.name(),type:"checkbox",value:e.value(),required:e.required()})," ",t])},a.checkbox=function(n){return n.choices().map(function(e){var t=n.name()+("checkbox"===n.type()?"[]":""),r=n.required()&&"radio"===n.type();return o("label",[o("input",{name:t,type:n.type(),value:e.value(),checked:e.selected(),required:r,oncreate:l})," ",o("span",e.label())])})},a.radio=a.checkbox,a.default=function(e){var t={type:e.type()};return e.name()&&(t.name=e.name()),e.min()&&(t.min=e.min()),e.max()&&(t.max=e.max()),0<e.value().length&&(t.value=e.value()),0<e.placeholder().length&&(t.placeholder=e.placeholder()),t.required=e.required(),t.oncreate=l,o("input",t)},function(e){var t=0<e.label().length&&e.showLabel()?o("label",{},e.label()):"",r="function"==typeof a[e.type()]?a[e.type()](e):a.default(e),n=e.wrap()?o("p",[t,r]):[t,r],i=document.createElement("div");return o.render(i,n),s.prettyPrint(i.innerHTML)+"\n"}}},{html:22}],4:[function(f,e,t){"use strict";e.exports=function(i,e,t,o,r,a){var l,n=f("./field-generator.js")(i),s=f("../overlay.js")(i,a),c=f("./field-forms.js")(i,a);function u(e){(l=o.get(e))&&0<l.choices().length&&l.value(l.choices().map(function(e){return e.label()}).join("|")),i.redraw()}function d(){var e=n(l);t.insert(e),u(""),i.redraw()}return t.on("blur",i.redraw),{view:function(){var e=o.getCategories(),r=o.getAll(),t=i("div.available-fields.small-margin",[i("h4",a.chooseField),e.map(function(t){var e=r.filter(function(e){return e.category===t});if(e.length)return i("div.tiny-margin",[i("strong",t),e.map(function(e){var t="button";e.forceRequired()&&(t+=" is-required");var r=e.inFormContent();return null!==r&&(t+=" "+(r?"in-form":"not-in-form")),i("button",{className:t,type:"button",onclick:i.withAttr("value",u),value:e.index},e.title())})])})]),n=null;return l&&(n=i(s(i("div.field-wizard",[i("h3",[l.title(),l.forceRequired()?i("span.red","*"):"",l.name().length?i("code",l.name()):""]),l.help().length?i("p",i.trust(l.help())):"",c.render(l),i("p",[i("button",{class:"button-primary",type:"button",onkeydown:function(e){13===(e=e||window.event).keyCode&&d()},onclick:d},a.addToForm)])]),u))),[t,n]},controller:function(){}}}},{"../overlay.js":10,"./field-forms.js":2,"./field-generator.js":3}],5:[function(e,t,r){"use strict";t.exports=function(i,o){var a=[];function l(e,t,r){var n=i.register(e,t);r||a.push(n)}function s(e){var t={phone:"tel",dropdown:"select",checkboxes:"checkbox",birthday:"text"};return void 0!==t[e]?t[e]:e}function t(e){var t=o.listFields,r=s(e.field_type),n={name:e.tag,title:e.name,required:e.required,forceRequired:e.required,type:r,choices:e.choices,acceptsMultipleValues:!1};return"address"!==n.type?l(t,n,!1):(l(t,{name:n.name+"[addr1]",type:"text",mailchimpType:"address",title:o.streetAddress},!1),l(t,{name:n.name+"[city]",type:"text",mailchimpType:"address",title:o.city},!1),l(t,{name:n.name+"[state]",type:"text",mailchimpType:"address",title:o.state},!1),l(t,{name:n.name+"[zip]",type:"text",mailchimpType:"address",title:o.zip},!1),l(t,{name:n.name+"[country]",type:"select",mailchimpType:"address",title:o.country,choices:mc4wp_vars.countries},!1)),!0}function r(e){var t=o.interestCategories,r=s(e.field_type);l(t,{title:e.name,name:"INTERESTS["+e.id+"]",type:r,choices:e.interests,acceptsMultipleValues:"checkbox"===r},!1)}function n(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(t),e.interest_categories.forEach(r)}return{registerCustomFields:function(e){var t,r=o.formFields;for(var n in l(r,{name:"",value:o.subscribe,type:"submit",title:o.submitButton},!0),t={},e)t[e[n].id]=e[n].name;l(r,{name:"_mc4wp_lists",type:"checkbox",title:o.listChoice,choices:t,help:o.listChoiceDescription,acceptsMultipleValues:!0},!0),t={subscribe:"Subscribe",unsubscribe:"Unsubscribe"},l(r,{name:"_mc4wp_action",type:"radio",title:o.formAction,choices:t,value:"subscribe",help:o.formActionDescription},!0),l(r,{name:"AGREE_TO_TERMS",value:1,type:"terms-checkbox",label:o.agreeToTerms,title:o.agreeToTermsShort,showLabel:!1,required:!0},!0)},registerListFields:n,registerListsFields:function(e){a.forEach(i.deregister),e.forEach(n)}}}},{}],6:[function(e,t,r){"use strict";var n=e("mithril/stream");t.exports=function(i,o){function a(e){this.name=n(e.name),this.title=n(e.title||e.name),this.type=n(e.type),this.mailchimpType=n(e.mailchimpType||""),this.label=n(e.label||e.title||""),this.showLabel=n(void 0===e.showLabel||e.showLabel),this.value=n(e.value||""),this.placeholder=n(e.placeholder||""),this.required=n(e.required||!1),this.forceRequired=n(e.forceRequired||!1),this.wrap=n(void 0===e.wrap||e.wrap),this.min=n(e.min||null),this.max=n(e.max||null),this.help=n(e.help||""),this.choices=n(e.choices||[]),this.inFormContent=n(null),this.acceptsMultipleValues=e.acceptsMultipleValues,this.link=n(e.link||""),this.selectChoice=function(t){var r=this;this.choices(this.choices().map(function(e){return e.value()===t?e.selected(!0):"checkbox"!==r.type()&&e.selected(!1),e}))}}var l,s=[],c=[],u=function(e){this.label=n(e.label),this.title=n(e.title||e.label),this.selected=n(e.selected||!1),this.value=n(e.value||e.label)};function d(t,r){return s.filter(function(e){return e[t]()===r})}return{get:function(e){return s[e]},getAll:function(){return s=s.map(function(e,t){return e.index=t,e})},getCategories:function(){return c},deregister:function(e){var t=s.indexOf(e);-1<t&&(delete s[t],i.redraw())},register:function(e,t){var r,n=d("name",t.name).shift();if(!n)return t.choices&&(t.choices=function(r){return"function"==typeof r.map?r.map(function(e){return new u({label:e})}):Object.keys(r).map(function(e){var t=r[e];return new u({label:t,value:e})})}(t.choices),t.value&&(t.choices=t.choices.map(function(e){return e.value()===t.value&&e.selected(!0),e}))),c.indexOf(e)<0&&c.push(e),(r=new a(t)).category=e,s.push(r),l&&window.clearTimeout(l),l=window.setTimeout(i.redraw,200),o.trigger("fields.change"),r;!n.forceRequired()&&t.forceRequired&&n.forceRequired(!0)},getAllWhere:d}}},{"mithril/stream":23}],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.js"),e("codemirror/addon/edit/matchtags.js"),e("codemirror/addon/edit/closetag.js"),e("codemirror/addon/selection/active-line.js"),e("codemirror/addon/edit/matchbrackets.js");var i,o,a={},l=document.createElement("form"),s=!1,c=document.getElementById("mc4wp-form-content"),u=document.getElementById("mc4wp-form-preview"),d=/\{[^{}]+\}/g;function f(){var e=u.contentDocument||u.contentWindow.document;(o=e.querySelector(".mc4wp-form-fields"))&&h()}function h(){var e=a.getValue();e=e.replace(d,"").replace(d,""),o.innerHTML=e,o.dispatchEvent(new Event("mc4wp-refresh"))}function p(){return s&&(l.innerHTML=a.getValue().toLowerCase(),s=!1),l}window.addEventListener("load",function(){n.signal(i,"change")}),c.addEventListener("change",function(){s=!0,h()}),a.getValue=function(){return i?i.getValue():c.value},a.query=function(e){return p().querySelectorAll(e.toLowerCase())},a.containsField=function(e){return null!==p().elements.namedItem(e.toLowerCase())},a.insert=function(e){i?(i.replaceSelection(e),i.focus()):c.value+=e},a.on=function(e,t){return i?(e="input"===e?"changes":e,i.on(e,t)):c.addEventListener(e,t)},a.refresh=function(){i&&i.refresh()},l.innerHTML=c.value.toLowerCase(),n&&(i=n.fromTextArea(c,{selectionPointer:!0,mode:"htmlmixed",htmlMode:!0,autoCloseTags:!0,autoRefresh:!0,styleActiveLine:!0,matchBrackets:!0,matchTags:{bothTags:!0}}),window.dispatchEvent&&i.on("change",function(){if("function"==typeof Event){var e=new Event("change",{bubbles:!0});c.dispatchEvent(e)}})),u.addEventListener("load",f),f.call(),t.exports=a},{codemirror:17,"codemirror/addon/edit/closetag.js":12,"codemirror/addon/edit/matchbrackets.js":13,"codemirror/addon/edit/matchtags.js":14,"codemirror/addon/fold/xml-fold.js":15,"codemirror/addon/selection/active-line.js":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){"use strict";t.exports=function(e,i,t,r,n,o){var a=document.getElementById("required-fields");function l(){r.getAll().forEach(function(e){if(!(e.name().length<=0)){var t=e.name();"checkbox"===e.type()&&(t+="[]");var r=i.containsField(t);if(e.inFormContent(r),"address"===e.mailchimpType()){e.originalRequiredValue=void 0===e.originalRequiredValue?e.forceRequired():e.originalRequiredValue;var n=e.name().replace(/\[(\w+)\]/g,"");0<i.query('[name^="'+n+'"]').length?(void 0===e.originalRequiredValue&&(e.originalRequiredValue=e.forceRequired()),e.forceRequired(!0)):e.forceRequired(e.originalRequiredValue)}}}),function(){var n=r.getAllWhere("forceRequired",!0).map(function(e){return e.name().toUpperCase().replace(/\[(\w+)\]/g,".$1")}),e=i.query("[required]");Array.prototype.forEach.call(e,function(e){var t=e.name;if(t&&!(t.length<0)&&"_"!==t[0]){var r=(t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/\[\]$/,"")).indexOf(".");r=0<r?r:t.length,t=t.substr(0,r).toUpperCase()+t.substr(r),-1===n.indexOf(t)&&n.push(t)}}),a.value=n.join(",")}(),e.redraw()}i.on("change",o.debounce(l,500)),n.on("fields.change",o.debounce(l,500))}},{}],9:[function(e,t,r){"use strict";var i={};function o(e,t){i[e]=t,n()}function a(e){delete i[e],n()}function n(){var e="";for(var t in i)e+='<div class="notice notice-warning inline"><p>'+i[t]+"</p></div>";var r=document.querySelector(".mc4wp-notices");if(!r){(r=document.createElement("div")).className="mc4wp-notices";var n=document.querySelector("h1, h2");n.parentNode.insertBefore(r,n.nextSibling)}r.innerHTML=e}t.exports={init:function(r,n,e){function t(){-1<r.getValue().toLowerCase().indexOf('name="groupings')?o("deprecated_groupings","Your form contains deprecated <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."):a("deprecated_groupings")}function i(){var e=n.getAllWhere("forceRequired",!0).filter(function(e){return!r.containsField(e.name().toUpperCase())}),t="<strong>Heads up!</strong> Your form is missing list fields that are required in Mailchimp. Either add these fields to your form or mark them as optional in Mailchimp.";t+='<br /><ul class="ul-square" style="margin-bottom: 0;"><li>'+e.map(function(e){return e.title()}).join("</li><li>")+"</li></ul>",0<e.length?o("required_fields_missing",t):a("required_fields_missing")}t(),r.on("focus",t),r.on("blur",t),i(),r.on("blur",i),r.on("focus",i),document.body.addEventListener("change",function(){0<e.getSelectedLists().length?a("no_lists_selected"):o("no_lists_selected",'<strong>Heads up!</strong> You have not yet selected a Mailchimp list to subscribe people to. Please select at least one list from the <a href="javascript:void(0)" data-tab="settings" class="tab-link">settings tab</a>.')})}}},{}],10:[function(e,t,r){"use strict";t.exports=function(r,n){var i,o;function a(){document.removeEventListener("keydown",l),window.removeEventListener("resize",s),o()}function l(e){27==(e=e||window.event).keyCode&&a(),13==e.keyCode&&e.preventDefault()}function s(){if(i){var e=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,t=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,r=(e-i.clientWidth-40)/2,n=(t-i.clientHeight-40)/2;i.style.left=(0<r?r:0)+"px",i.style.top=(0<n?n:0)+"px"}}function c(e){i=e.dom,s()}return function(e,t){return o=t,{oncreate:function(){document.addEventListener("keydown",l),window.addEventListener("resize",s)},onremove:function(){document.removeEventListener("keydown",l),window.removeEventListener("resize",s)},view:function(){return[r("div.overlay-wrap",r("div.overlay",{oncreate:c},[r("span",{class:"close dashicons dashicons-no",title:n.close,onclick:a}),e])),r("div.overlay-background",{title:n.close,onclick:a})]}}}}},{}],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-editor/form-watcher.js"),u=e("./admin/form-editor/form-editor.js"),d=e("./admin/form-editor/field-helper.js"),f=e("./admin/form-editor/fields-factory.js"),h=e("./admin/form-editor/fields.js")(i,o),p=window.formEditor=u,m=(new c(i,formEditor,a,h,o,l),new d(i,s,formEditor,h,o,n)),g=e("./admin/notices");i.mount(document.getElementById("mc4wp-field-wizard"),m);var v=new f(h,n);o.on("selectedLists.change",v.registerListsFields),v.registerListsFields(a.getSelectedLists()),v.registerCustomFields(mc4wp_vars.mailchimp.lists),window.setTimeout(function(){i.redraw()},2e3),g.init(p,h,a),window.mc4wp=window.mc4wp||{},window.mc4wp.forms=window.mc4wp.forms||{},window.mc4wp.forms.editor=p,window.mc4wp.forms.fields=h},{"./admin/form-editor/field-helper.js":4,"./admin/form-editor/fields-factory.js":5,"./admin/form-editor/fields.js":6,"./admin/form-editor/form-editor.js":7,"./admin/form-editor/form-watcher.js":8,"./admin/notices":9}],12:[function(e,t,r){var n;n=function(b){b.defineOption("autoCloseTags",!1,function(e,t,r){if(r!=b.Init&&r&&e.removeKeyMap("autoCloseTags"),t){var n={name:"autoCloseTags"};"object"==typeof t&&!t.whenClosing||(n["'/'"]=function(e){return function(e){return e.getOption("disableInput")?b.Pass:i(e,!0)}(e)}),"object"==typeof t&&!t.whenOpening||(n["'>'"]=function(e){return function(e){if(e.getOption("disableInput"))return b.Pass;for(var t=e.listSelections(),r=[],n=e.getOption("autoCloseTags"),i=0;i<t.length;i++){if(!t[i].empty())return b.Pass;var o=t[i].head,a=e.getTokenAt(o),l=b.innerMode(e.getMode(),a.state),s=l.state;if("xml"!=l.mode.name||!s.tagName)return b.Pass;var c="html"==l.mode.configuration,u="object"==typeof n&&n.dontCloseTags||c&&w,d="object"==typeof n&&n.indentTags||c&&x,f=s.tagName;a.end>o.ch&&(f=f.slice(0,f.length-a.end+o.ch));var h=f.toLowerCase();if(!f||"string"==a.type&&(a.end!=o.ch||!/[\"\']/.test(a.string.charAt(a.string.length-1))||1==a.string.length)||"tag"==a.type&&"closeTag"==s.type||a.string.indexOf("/")==a.string.length-1||u&&-1<k(u,h)||C(e,f,o,s,!0))return b.Pass;var p="object"==typeof n&&n.emptyTags;if(p&&-1<k(p,f))r[i]={text:"/>",newPos:b.Pos(o.line,o.ch+2)};else{var m=d&&-1<k(d,h);r[i]={indent:m,text:">"+(m?"\n\n":"")+"</"+f+">",newPos:m?b.Pos(o.line+1,0):b.Pos(o.line,o.ch+1)}}}for(var g="object"==typeof n&&n.dontIndentOnAutoClose,i=t.length-1;0<=i;i--){var v=r[i];e.replaceRange(v.text,t[i].head,t[i].anchor,"+insert");var y=e.listSelections().slice(0);y[i]={head:v.newPos,anchor:v.newPos},e.setSelections(y),!g&&v.indent&&(e.indentLine(v.newPos.line,null,!0),e.indentLine(v.newPos.line+1,null,!0))}}(e)}),e.addKeyMap(n)}});var w=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],x=["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"];function i(e,t){for(var r=e.listSelections(),n=[],i=t?"/":"</",o=e.getOption("autoCloseTags"),a="object"==typeof o&&o.dontIndentOnSlash,l=0;l<r.length;l++){if(!r[l].empty())return b.Pass;var s,c=r[l].head,u=e.getTokenAt(c),d=b.innerMode(e.getMode(),u.state),f=d.state;if(t&&("string"==u.type||"<"!=u.string.charAt(0)||u.start!=c.ch-1))return b.Pass;if("xml"!=d.mode.name)if("htmlmixed"==e.getMode().name&&"javascript"==d.mode.name)s=i+"script";else{if("htmlmixed"!=e.getMode().name||"css"!=d.mode.name)return b.Pass;s=i+"style"}else{if(!f.context||!f.context.tagName||C(e,f.context.tagName,c,f))return b.Pass;s=i+f.context.tagName}">"!=e.getLine(c.line).charAt(u.end)&&(s+=">"),n[l]=s}if(e.replaceSelections(n),r=e.listSelections(),!a)for(l=0;l<r.length;l++)(l==r.length-1||r[l].head.line<r[l+1].head.line)&&e.indentLine(r[l].head.line)}function k(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 C(e,t,r,n,i){if(!b.scanForClosingTag)return!1;var o=Math.min(e.lastLine()+1,r.line+500),a=b.scanForClosingTag(e,r,null,o);if(!a||a.tag!=t)return!1;for(var l=n.context,s=i?1:0;l&&l.tagName==t;l=l.prev)++s;r=a.to;for(var c=1;c<s;c++){var u=b.scanForClosingTag(e,r,null,o);if(!u||u.tag!=t)return!1;r=u.to}return!0}b.commands.closeTag=function(e){return i(e)}},"object"==typeof r&&"object"==typeof t?n(e("../../lib/codemirror"),e("../fold/xml-fold")):"function"==typeof o&&o.amd?o(["../../lib/codemirror","../fold/xml-fold"],n):n(CodeMirror)},{"../../lib/codemirror":17,"../fold/xml-fold":15}],13:[function(e,t,r){var n;n=function(n){var u=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),g=n.Pos,v={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function y(e){return e&&e.bracketRegex||/[(){}[\]]/}function d(e,t,r){var n=e.getLineHandle(t.line),i=t.ch-1,o=r&&r.afterCursor;null==o&&(o=/(^| )cm-fat-cursor($| )/.test(e.getWrapperElement().className));var a=y(r),l=!o&&0<=i&&a.test(n.text.charAt(i))&&v[n.text.charAt(i)]||a.test(n.text.charAt(i+1))&&v[n.text.charAt(++i)];if(!l)return null;var s=">"==l.charAt(1)?1:-1;if(r&&r.strict&&0<s!=(i==t.ch))return null;var c=e.getTokenTypeAt(g(t.line,i+1)),u=f(e,g(t.line,i+(0<s?1:0)),s,c||null,r);return null==u?null:{from:g(t.line,i),to:u&&u.pos,match:u&&u.ch==l.charAt(0),forward:0<s}}function f(e,t,r,n,i){for(var o=i&&i.maxScanLineLength||1e4,a=i&&i.maxScanLines||1e3,l=[],s=y(i),c=0<r?Math.min(t.line+a,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-a),u=t.line;u!=c;u+=r){var d=e.getLine(u);if(d){var f=0<r?0:d.length-1,h=0<r?d.length:-1;if(!(d.length>o))for(u==t.line&&(f=t.ch-(r<0?1:0));f!=h;f+=r){var p=d.charAt(f);if(s.test(p)&&(void 0===n||e.getTokenTypeAt(g(u,f+1))==n)){var m=v[p];if(m&&">"==m.charAt(1)==0<r)l.push(p);else{if(!l.length)return{pos:g(u,f),ch:p};l.pop()}}}}}return u-r!=(0<r?e.lastLine():e.firstLine())&&null}function t(e,t,r){for(var n=e.state.matchBrackets.maxHighlightLineLength||1e3,i=[],o=e.listSelections(),a=0;a<o.length;a++){var l=o[a].empty()&&d(e,o[a].head,r);if(l&&e.getLine(l.from.line).length<=n){var s=l.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";i.push(e.markText(l.from,g(l.from.line,l.from.ch+1),{className:s})),l.to&&e.getLine(l.to.line).length<=n&&i.push(e.markText(l.to,g(l.to.line,l.to.ch+1),{className:s}))}}if(i.length){u&&e.state.focused&&e.focus();function c(){e.operation(function(){for(var e=0;e<i.length;e++)i[e].clear()})}if(!t)return c;setTimeout(c,800)}}function i(e){e.operation(function(){e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null),e.state.matchBrackets.currentlyHighlighted=t(e,!1,e.state.matchBrackets)})}n.defineOption("matchBrackets",!1,function(e,t,r){r&&r!=n.Init&&(e.off("cursorActivity",i),e.state.matchBrackets&&e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null)),t&&(e.state.matchBrackets="object"==typeof t?t:{},e.on("cursorActivity",i))}),n.defineExtension("matchBrackets",function(){t(this,!0)}),n.defineExtension("findMatchingBracket",function(e,t,r){return!r&&"boolean"!=typeof t||(t=r?(r.strict=t,r):t?{strict:!0}:null),d(this,e,t)}),n.defineExtension("scanForBracket",function(e,t,r,n){return f(this,e,t,r,n)})},"object"==typeof r&&"object"==typeof t?n(e("../../lib/codemirror")):"function"==typeof o&&o.amd?o(["../../lib/codemirror"],n):n(CodeMirror)},{"../../lib/codemirror":17}],14:[function(e,t,r){var n;n=function(a){"use strict";function l(e){e.state.tagHit&&e.state.tagHit.clear(),e.state.tagOther&&e.state.tagOther.clear(),e.state.tagHit=e.state.tagOther=null}function n(o){o.state.failedTagMatch=!1,o.operation(function(){if(l(o),!o.somethingSelected()){var e=o.getCursor(),t=o.getViewport();t.from=Math.min(t.from,e.line),t.to=Math.max(e.line+1,t.to);var r=a.findMatchingTag(o,e,t);if(r){if(o.state.matchBothTags){var n="open"==r.at?r.open:r.close;n&&(o.state.tagHit=o.markText(n.from,n.to,{className:"CodeMirror-matchingtag"}))}var i="close"==r.at?r.open:r.close;i?o.state.tagOther=o.markText(i.from,i.to,{className:"CodeMirror-matchingtag"}):o.state.failedTagMatch=!0}}})}function i(e){e.state.failedTagMatch&&n(e)}a.defineOption("matchTags",!1,function(e,t,r){r&&r!=a.Init&&(e.off("cursorActivity",n),e.off("viewportChange",i),l(e)),t&&(e.state.matchBothTags="object"==typeof t&&t.bothTags,e.on("cursorActivity",n),e.on("viewportChange",i),n(e))}),a.commands.toMatchingTag=function(e){var t=a.findMatchingTag(e,e.getCursor());if(t){var r="close"==t.at?t.open:t.close;r&&e.extendSelection(r.to,r.from)}}},"object"==typeof r&&"object"==typeof t?n(e("../../lib/codemirror"),e("../fold/xml-fold")):"function"==typeof o&&o.amd?o(["../../lib/codemirror","../fold/xml-fold"],n):n(CodeMirror)},{"../../lib/codemirror":17,"../fold/xml-fold":15}],15:[function(e,t,r){var n;n=function(e){"use strict";var s=e.Pos;function c(e,t){return e.line-t.line||e.ch-t.ch}var t="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",n=new RegExp("<(/?)(["+t+"][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-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");function u(e,t,r,n){this.line=t,this.ch=r,this.cm=e,this.text=e.getLine(t),this.min=n?Math.max(n.from,e.firstLine()):e.firstLine(),this.max=n?Math.min(n.to-1,e.lastLine()):e.lastLine()}function i(e,t){var r=e.cm.getTokenTypeAt(s(e.line,t));return r&&/\btag\b/.test(r)}function o(e){if(!(e.line>=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function a(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function d(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(o(e))continue;return}if(i(e,t+1)){var r=e.text.lastIndexOf("/",t),n=-1<r&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,n?"selfClose":"regular"}e.ch=t+1}}function f(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(a(e))continue;return}if(i(e,t+1)){n.lastIndex=t,e.ch=t;var r=n.exec(e.text);if(r&&r.index==t)return r}else e.ch=t}}function h(e){for(;;){n.lastIndex=e.ch;var t=n.exec(e.text);if(!t){if(o(e))continue;return}if(i(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}function p(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(a(e))continue;return}if(i(e,t+1)){var r=e.text.lastIndexOf("/",t),n=-1<r&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,n?"selfClose":"regular"}e.ch=t}}function m(e,t){for(var r=[];;){var n,i=h(e),o=e.line,a=e.ch-(i?i[0].length:0);if(!i||!(n=d(e)))return;if("selfClose"!=n)if(i[1]){for(var l=r.length-1;0<=l;--l)if(r[l]==i[2]){r.length=l;break}if(l<0&&(!t||t==i[2]))return{tag:i[2],from:s(o,a),to:s(e.line,e.ch)}}else r.push(i[2])}}function g(e,t){for(var r=[];;){var n=p(e);if(!n)return;if("selfClose"!=n){var i=e.line,o=e.ch,a=f(e);if(!a)return;if(a[1])r.push(a[2]);else{for(var l=r.length-1;0<=l;--l)if(r[l]==a[2]){r.length=l;break}if(l<0&&(!t||t==a[2]))return{tag:a[2],from:s(e.line,e.ch),to:s(i,o)}}}else f(e)}}e.registerHelper("fold","xml",function(e,t){for(var r=new u(e,t.line,0);;){var n=h(r);if(!n||r.line!=t.line)return;var i=d(r);if(!i)return;if(!n[1]&&"selfClose"!=i){var o=s(r.line,r.ch),a=m(r,n[2]);return a&&0<c(a.from,o)?{from:o,to:a.from}:null}}}),e.findMatchingTag=function(e,t,r){var n=new u(e,t.line,t.ch,r);if(-1!=n.text.indexOf(">")||-1!=n.text.indexOf("<")){var i=d(n),o=i&&s(n.line,n.ch),a=i&&f(n);if(i&&a&&!(0<c(n,t))){var l={from:s(n.line,n.ch),to:o,tag:a[2]};return"selfClose"==i?{open:l,close:null,at:"open"}:a[1]?{open:g(n,a[2]),close:l,at:"close"}:{open:l,close:m(n=new u(e,o.line,o.ch,r),a[2]),at:"open"}}}},e.findEnclosingTag=function(e,t,r,n){for(var i=new u(e,t.line,t.ch,r);;){var o=g(i,n);if(!o)break;var a=m(new u(e,t.line,t.ch,r),o.tag);if(a)return{open:o,close:a}}},e.scanForClosingTag=function(e,t,r,n){return m(new u(e,t.line,t.ch,n?{from:0,to:n}:null),r)}},"object"==typeof r&&"object"==typeof t?n(e("../../lib/codemirror")):"function"==typeof o&&o.amd?o(["../../lib/codemirror"],n):n(CodeMirror)},{"../../lib/codemirror":17}],16:[function(e,t,r){var n;n=function(i){"use strict";var l="CodeMirror-activeline",s="CodeMirror-activeline-background",c="CodeMirror-activeline-gutter";function u(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",l),e.removeLineClass(e.state.activeLines[t],"background",s),e.removeLineClass(e.state.activeLines[t],"gutter",c)}function o(t,e){for(var r=[],n=0;n<e.length;n++){var i=e[n],o=t.getOption("styleActiveLine");if("object"==typeof o&&o.nonEmpty?i.anchor.line==i.head.line:i.empty()){var a=t.getLineHandleVisualStart(i.head.line);r[r.length-1]!=a&&r.push(a)}}!function(e,t){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}(t.state.activeLines,r)&&t.operation(function(){u(t);for(var e=0;e<r.length;e++)t.addLineClass(r[e],"wrap",l),t.addLineClass(r[e],"background",s),t.addLineClass(r[e],"gutter",c);t.state.activeLines=r})}function a(e,t){o(e,t.ranges)}i.defineOption("styleActiveLine",!1,function(e,t,r){var n=r!=i.Init&&r;t!=n&&(n&&(e.off("beforeSelectionChange",a),u(e),delete e.state.activeLines),t&&(e.state.activeLines=[],o(e,e.listSelections()),e.on("beforeSelectionChange",a)))})},"object"==typeof r&&"object"==typeof t?n(e("../../lib/codemirror")):"function"==typeof o&&o.amd?o(["../../lib/codemirror"],n):n(CodeMirror)},{"../../lib/codemirror":17}],17:[function(e,t,r){var n,i;n=this,i=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,m=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),n=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),i=/Edge\/(\d+)/.exec(e),x=r||n||i,k=x&&(r?document.documentMode||6:+(i||n)[1]),b=!i&&/WebKit\//.test(e),o=b&&/Qt\/\d+\.\d+/.test(e),a=!i&&/Chrome\//.test(e),g=/Opera\//.test(e),s=/Apple Computer/.test(navigator.vendor),l=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),c=/PhantomJS/.test(e),u=!i&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),d=/Android/.test(e),f=u||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),w=u||/Mac/.test(t),h=/\bCrOS\b/.test(e),p=/win/i.test(t),v=g&&e.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&15<=v&&(b=!(g=!1));var y=w&&(o||g&&(null==v||v<12.11)),C=m||x&&9<=k;function S(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var T,L=function(e,t){var r=e.className,n=S(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}};function M(e){for(var t=e.childNodes.length;0<t;--t)e.removeChild(e.firstChild);return e}function A(e,t){return M(e).appendChild(t)}function N(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function O(e,t,r,n){var i=N(e,t,r,n);return i.setAttribute("role","presentation"),i}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)}function E(){var t;try{t=document.activeElement}catch(e){t=document.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function D(e,t){var r=e.className;S(t).test(r)||(e.className+=(r?" ":"")+t)}function F(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!S(r[n]).test(t)&&(t+=" "+r[n]);return t}T=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(e){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var z=function(e){e.select()};function W(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function P(e,t,r){for(var n in t||(t={}),e)!e.hasOwnProperty(n)||!1===r&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function H(e,t,r,n,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=n||0,a=i||0;;){var l=e.indexOf("\t",o);if(l<0||t<=l)return a+(t-o);a+=l-o,a+=r-a%r,o=l+1}}u?z=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:x&&(z=function(e){try{e.select()}catch(e){}});var I=function(){this.id=null};function j(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}I.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var R=30,B={toString:function(){return"CodeMirror.Pass"}},q={scroll:!1},U={origin:"*mouse"},K={origin:"+move"};function V(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);-1==o&&(o=e.length);var a=o-n;if(o==e.length||t<=i+a)return n+Math.min(a,t-i);if(i+=o-n,n=o+1,t<=(i+=r-i%r))return n}}var G=[""];function $(e){for(;G.length<=e;)G.push(Y(G)+" ");return G[e]}function Y(e){return e[e.length-1]}function X(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Z(){}function J(e,t){var r;return r=Object.create?Object.create(e):(Z.prototype=e,new Z),t&&P(t,r),r}var Q=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ee(e){return/\w/.test(e)||""<e&&(e.toUpperCase()!=e.toLowerCase()||Q.test(e))}function te(e,t){return t?!!(-1<t.source.indexOf("\\w")&&ee(e))||t.test(e):ee(e)}function re(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ne=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ie(e){return 768<=e.charCodeAt(0)&&ne.test(e)}function oe(e,t,r){for(;(r<0?0<t:t<e.length)&&ie(e.charAt(t));)t+=r;return t}function ae(e,t,r){for(var n=r<t?-1:1;;){if(t==r)return t;var i=(t+r)/2,o=n<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+n}}var le=null;function se(e,t,r){var n;le=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==r?n=i:le=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:le=i)}return null!=n?n:le}var ce,ue,de,fe,he,pe,me,ge=(ce="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",ue="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",de=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,fe=/[stwN]/,he=/[LRr]/,pe=/[Lb1n]/,me=/[1n]/,function(e,t){var r="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!de.test(e))return!1;for(var n,i=e.length,o=[],a=0;a<i;++a)o.push((n=e.charCodeAt(a))<=247?ce.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?ue.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":8204==n?"b":"L");for(var l=0,s=r;l<i;++l){var c=o[l];"m"==c?o[l]=s:s=c}for(var u=0,d=r;u<i;++u){var f=o[u];"1"==f&&"r"==d?o[u]="n":he.test(f)&&"r"==(d=f)&&(o[u]="R")}for(var h=1,p=o[0];h<i-1;++h){var m=o[h];"+"==m&&"1"==p&&"1"==o[h+1]?o[h]="1":","!=m||p!=o[h+1]||"1"!=p&&"n"!=p||(o[h]=p),p=m}for(var g=0;g<i;++g){var v=o[g];if(","==v)o[g]="N";else if("%"==v){var y=void 0;for(y=g+1;y<i&&"%"==o[y];++y);for(var b=g&&"!"==o[g-1]||y<i&&"1"==o[y]?"1":"N",w=g;w<y;++w)o[w]=b;g=y-1}}for(var x=0,k=r;x<i;++x){var C=o[x];"L"==k&&"1"==C?o[x]="L":he.test(C)&&(k=C)}for(var S=0;S<i;++S)if(fe.test(o[S])){var T=void 0;for(T=S+1;T<i&&fe.test(o[T]);++T);for(var L="L"==(S?o[S-1]:r),M=L==("L"==(T<i?o[T]:r))?L?"L":"R":r,A=S;A<T;++A)o[A]=M;S=T-1}for(var O,N=[],_=0;_<i;)if(pe.test(o[_])){var E=_;for(++_;_<i&&pe.test(o[_]);++_);N.push(new ve(0,E,_))}else{var D=_,F=N.length;for(++_;_<i&&"L"!=o[_];++_);for(var z=D;z<_;)if(me.test(o[z])){D<z&&N.splice(F,0,new ve(1,D,z));var W=z;for(++z;z<_&&me.test(o[z]);++z);N.splice(F,0,new ve(2,W,z)),D=z}else++z;D<_&&N.splice(F,0,new ve(1,D,_))}return"ltr"==t&&(1==N[0].level&&(O=e.match(/^\s+/))&&(N[0].from=O[0].length,N.unshift(new ve(0,0,O[0].length))),1==Y(N).level&&(O=e.match(/\s+$/))&&(Y(N).to-=O[0].length,N.push(new ve(0,i-O[0].length,i)))),"rtl"==t?N.reverse():N});function ve(e,t,r){this.level=e,this.from=t,this.to=r}function ye(e,t){var r=e.order;return null==r&&(r=e.order=ge(e.text,t)),r}var be=[],we=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||be).concat(r)}};function xe(e,t){return e._handlers&&e._handlers[t]||be}function ke(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,i=n&&n[t];if(i){var o=j(i,r);-1<o&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Ce(e,t){var r=xe(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function Se(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ce(e,r||t.type,e,t),Ne(t)||t.codemirrorIgnore}function Te(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==j(r,t[n])&&r.push(t[n])}function Le(e,t){return 0<xe(e,t).length}function Me(e){e.prototype.on=function(e,t){we(this,e,t)},e.prototype.off=function(e,t){ke(this,e,t)}}function Ae(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Oe(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Ne(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function _e(e){Ae(e),Oe(e)}function Ee(e){return e.target||e.srcElement}function De(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),w&&e.ctrlKey&&1==t&&(t=3),t}var Fe,ze,We=function(){if(x&&k<9)return!1;var e=N("div");return"draggable"in e||"dragDrop"in e}();function Pe(e){if(null==Fe){var t=N("span","");A(e,N("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Fe=t.offsetWidth<=1&&2<t.offsetHeight&&!(x&&k<8))}var r=Fe?N("span",""):N("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function He(e){if(null!=ze)return ze;var t=A(e,document.createTextNode("AخA")),r=T(t,0,1).getBoundingClientRect(),n=T(t,1,2).getBoundingClientRect();return M(e),!(!r||r.left==r.right)&&(ze=n.right-r.right<3)}var Ie,je=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},Re=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Be="oncopy"in(Ie=N("div"))||(Ie.setAttribute("oncopy","return;"),"function"==typeof Ie.oncopy),qe=null;var Ue={},Ke={};function Ve(e){if("string"==typeof e&&Ke.hasOwnProperty(e))e=Ke[e];else if(e&&"string"==typeof e.name&&Ke.hasOwnProperty(e.name)){var t=Ke[e.name];"string"==typeof t&&(t={name:t}),(e=J(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ve("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ve("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Ge(e,t){t=Ve(t);var r=Ue[t.name];if(!r)return Ge(e,"text/plain");var n=r(e,t);if($e.hasOwnProperty(t.name)){var i=$e[t.name];for(var o in i)i.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)n[a]=t.modeProps[a];return n}var $e={};function Ye(e,t){P(t,$e.hasOwnProperty(e)?$e[e]:$e[e]={})}function Xe(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Ze(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function Je(e,t,r){return!e.startState||e.startState(t,r)}var Qe=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};function et(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function tt(e,r,n){var i=[],o=r.line;return e.iter(r.line,n.line+1,function(e){var t=e.text;o==n.line&&(t=t.slice(0,n.ch)),o==r.line&&(t=t.slice(r.ch)),i.push(t),++o}),i}function rt(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function nt(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function it(e){if(null==e.parent)return null;for(var t=e.parent,r=j(t.lines,e),n=t.parent;n;n=(t=n).parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function ot(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var a=0;a<e.lines.length;++a){var l=e.lines[a].height;if(t<l)break;t-=l}return r+a}function at(e,t){return t>=e.first&&t<e.first+e.size}function lt(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function st(e,t,r){if(void 0===r&&(r=null),!(this instanceof st))return new st(e,t,r);this.line=e,this.ch=t,this.sticky=r}function ct(e,t){return e.line-t.line||e.ch-t.ch}function ut(e,t){return e.sticky==t.sticky&&0==ct(e,t)}function dt(e){return st(e.line,e.ch)}function ft(e,t){return ct(e,t)<0?t:e}function ht(e,t){return ct(e,t)<0?e:t}function pt(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function mt(e,t){if(t.line<e.first)return st(e.first,0);var r=e.first+e.size-1;return t.line>r?st(r,et(e,r).text.length):function(e,t){var r=e.ch;return null==r||t<r?st(e.line,t):r<0?st(e.line,0):e}(t,et(e,t.line).text.length)}function gt(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=mt(e,t[n]);return r}Qe.prototype.eol=function(){return this.pos>=this.string.length},Qe.prototype.sol=function(){return this.pos==this.lineStart},Qe.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Qe.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Qe.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Qe.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Qe.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Qe.prototype.skipToEnd=function(){this.pos=this.string.length},Qe.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(-1<t)return this.pos=t,!0},Qe.prototype.backUp=function(e){this.pos-=e},Qe.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=H(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Qe.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Qe.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&0<n.index?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}function i(e){return r?e.toLowerCase():e}if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Qe.prototype.current=function(){return this.string.slice(this.start,this.pos)},Qe.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Qe.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Qe.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var vt=function(e,t){this.state=e,this.lookAhead=t},yt=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function bt(t,r,n,e){var s=[t.state.modeGen],i={};At(t,r.text,t.doc.mode,n,function(e,t){return s.push(e,t)},i,e);for(var c=n.state,o=function(e){n.baseTokens=s;var o=t.state.overlays[e],a=1,l=0;n.state=!0,At(t,r.text,o.mode,n,function(e,t){for(var r=a;l<e;){var n=s[a];e<n&&s.splice(a,1,e,s[a+1],n),a+=2,l=Math.min(e,n)}if(t)if(o.opaque)s.splice(r,a-r,e,"overlay "+t),a=r+2;else for(;r<a;r+=2){var i=s[r+1];s[r+1]=(i?i+" ":"")+"overlay "+t}},i),n.state=c,n.baseTokens=null,n.baseTokenPos=1},a=0;a<t.state.overlays.length;++a)o(a);return{styles:s,classes:i.bgClass||i.textClass?i:null}}function wt(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=xt(e,it(t)),i=t.text.length>e.options.maxHighlightLength&&Xe(e.doc.mode,n.state),o=bt(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function xt(r,n,e){var t=r.doc,i=r.display;if(!t.mode.startState)return new yt(t,!0,n);var o=function(e,t,r){for(var n,i,o=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;a<l;--l){if(l<=o.first)return o.first;var s=et(o,l-1),c=s.stateAfter;if(c&&(!r||l+(c instanceof vt?c.lookAhead:0)<=o.modeFrontier))return l;var u=H(s.text,null,e.options.tabSize);(null==i||u<n)&&(i=l-1,n=u)}return i}(r,n,e),a=o>t.first&&et(t,o-1).stateAfter,l=a?yt.fromSaved(t,a,o):new yt(t,Je(t.mode),o);return t.iter(o,n,function(e){kt(r,e.text,l);var t=l.line;e.stateAfter=t==n-1||t%5==0||t>=i.viewFrom&&t<i.viewTo?l.save():null,l.nextLine()}),e&&(t.modeFrontier=l.line),l}function kt(e,t,r,n){var i=e.doc.mode,o=new Qe(t,e.options.tabSize,r);for(o.start=o.pos=n||0,""==t&&Ct(i,r.state);!o.eol();)St(i,o,r.state),o.start=o.pos}function Ct(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=Ze(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function St(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=Ze(e,r).mode);var o=e.token(t,r);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}yt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},yt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},yt.prototype.nextLine=function(){this.line++,0<this.maxLookAhead&&this.maxLookAhead--},yt.fromSaved=function(e,t,r){return t instanceof vt?new yt(e,Xe(e.mode,t.state),r,t.lookAhead):new yt(e,Xe(e.mode,t),r)},yt.prototype.save=function(e){var t=!1!==e?Xe(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new vt(t,this.maxLookAhead):t};var Tt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Lt(e,t,r,n){var i,o,a=e.doc,l=a.mode,s=et(a,(t=mt(a,t)).line),c=xt(e,t.line,r),u=new Qe(s.text,e.options.tabSize,c);for(n&&(o=[]);(n||u.pos<t.ch)&&!u.eol();)u.start=u.pos,i=St(l,u,c.state),n&&o.push(new Tt(u,i,Xe(a.mode,c.state)));return n?o:new Tt(u,i,c.state)}function Mt(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 At(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 Qe(t,e.options.tabSize,n),f=e.options.addModeClass&&[null];for(""==t&&Mt(Ct(r,n.state),o);!d.eol();){if(s=d.pos>e.options.maxHighlightLength?(l=!1,a&&kt(e,t,n,d.pos),d.pos=t.length,null):Mt(St(r,d,n.state,f),o),f){var h=f[0].name;h&&(s="m-"+(s?h+" "+s:h))}if(!l||u!=s){for(;c<d.start;)i(c=Math.min(d.start,c+5e3),u);u=s}d.start=d.pos}for(;c<d.pos;){var p=Math.min(d.pos,c+5e3);i(p,u),c=p}}var Ot=!1,Nt=!1;function _t(e,t,r){this.marker=e,this.from=t,this.to=r}function Et(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Dt(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Ft(e,t){if(t.full)return null;var r=at(e,t.from.line)&&et(e,t.from.line).markedSpans,n=at(e,t.to.line)&&et(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,a=0==ct(t.from,t.to),l=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;if(null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new _t(a,o.from,l?null:o.to))}}return n}(r,i,a),s=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;if(null==o.to||(a.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new _t(a,l?null:o.from-t,null==o.to?null:o.to-t))}}return n}(n,o,a),c=1==t.text.length,u=Y(t.text).length+(c?i:0);if(l)for(var d=0;d<l.length;++d){var f=l[d];if(null==f.to){var h=Et(s,f.marker);h?c&&(f.to=null==h.to?null:h.to+u):f.to=i}}if(s)for(var p=0;p<s.length;++p){var m=s[p];if(null!=m.to&&(m.to+=u),null==m.from)Et(l,m.marker)||(m.from=u,c&&(l||(l=[])).push(m));else m.from+=u,c&&(l||(l=[])).push(m)}l&&(l=zt(l)),s&&s!=l&&(s=zt(s));var g=[l];if(!c){var v,y=t.text.length-2;if(0<y&&l)for(var b=0;b<l.length;++b)null==l[b].to&&(v||(v=[])).push(new _t(l[b].marker,null,null));for(var w=0;w<y;++w)g.push(v);g.push(s)}return g}function zt(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Wt(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function Pt(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function Ht(e){return e.inclusiveLeft?-1:0}function It(e){return e.inclusiveRight?1:0}function jt(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=ct(n.from,i.from)||Ht(e)-Ht(t);if(o)return-o;var a=ct(n.to,i.to)||It(e)-It(t);return a||t.id-e.id}function Rt(e,t){var r,n=Nt&&e.markedSpans;if(n)for(var i=void 0,o=0;o<n.length;++o)(i=n[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!r||jt(r,i.marker)<0)&&(r=i.marker);return r}function Bt(e){return Rt(e,!0)}function qt(e){return Rt(e,!1)}function Ut(e,t){var r,n=Nt&&e.markedSpans;if(n)for(var i=0;i<n.length;++i){var o=n[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!r||jt(r,o.marker)<0)&&(r=o.marker)}return r}function Kt(e,t,r,n,i){var o=et(e,t),a=Nt&&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=ct(c.from,r)||Ht(s.marker)-Ht(i),d=ct(c.to,n)||It(s.marker)-It(i);if(!(0<=u&&d<=0||u<=0&&0<=d)&&(u<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?0<=ct(c.to,r):0<ct(c.to,r))||0<=u&&(s.marker.inclusiveRight&&i.inclusiveLeft?ct(c.from,n)<=0:ct(c.from,n)<0)))return!0}}}function Vt(e){for(var t;t=Bt(e);)e=t.find(-1,!0).line;return e}function Gt(e,t){var r=et(e,t),n=Vt(r);return r==n?t:it(n)}function $t(e,t){if(t>e.lastLine())return t;var r,n=et(e,t);if(!Yt(e,n))return t;for(;r=qt(n);)n=r.find(1,!0).line;return it(n)+1}function Yt(e,t){var r=Nt&&t.markedSpans;if(r)for(var n=void 0,i=0;i<r.length;++i)if((n=r[i]).marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Xt(e,t,n))return!0}}function Xt(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Xt(e,n.line,Et(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&Xt(e,t,i))return!0}function Zt(e){for(var t=0,r=(e=Vt(e)).parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;o=(r=o).parent)for(var a=0;a<o.children.length;++a){var l=o.children[a];if(l==r)break;t+=l.height}return t}function Jt(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=Bt(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=qt(n);){var o=t.find(0,!0);r-=n.text.length-o.from.ch,r+=(n=o.to.line).text.length-o.to.ch}return r}function Qt(e){var r=e.display,t=e.doc;r.maxLine=et(t,t.first),r.maxLineLength=Jt(r.maxLine),r.maxLineChanged=!0,t.iter(function(e){var t=Jt(e);t>r.maxLineLength&&(r.maxLineLength=t,r.maxLine=e)})}var er=function(e,t,r){this.text=e,Pt(this,t),this.height=r?r(this):1};er.prototype.lineNo=function(){return it(this)},Me(er);var tr={},rr={};function nr(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?rr:tr;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function ir(e,t){var r=O("span",null,null,b?"padding-right: .1px":null),n={pre:O("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;n.pos=0,n.addToken=ar,He(e.display.measure)&&(a=ye(o,e.doc.direction))&&(n.addToken=lr(n.addToken,a)),n.map=[],cr(o,n,wt(e,o,t!=e.display.externalMeasured&&it(o))),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=F(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=F(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Pe(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(b){var l=n.content.lastChild;(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return Ce(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=F(n.pre.className,n.textClass||"")),n}function or(e){var t=N("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ar(e,t,r,n,i,o,a){if(t){var l,s=e.splitSpaces?function(e,t){if(1<e.length&&!/ /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}(t,e.trailingSpace):t,c=e.cm.state.specialChars,u=!1;if(c.test(t)){l=document.createDocumentFragment();for(var d=0;;){c.lastIndex=d;var f=c.exec(t),h=f?f.index-d:t.length-d;if(h){var p=document.createTextNode(s.slice(d,d+h));x&&k<9?l.appendChild(N("span",[p])):l.appendChild(p),e.map.push(e.pos,e.pos+h,p),e.col+=h,e.pos+=h}if(!f)break;d+=1+h;var m=void 0;if("\t"==f[0]){var g=e.cm.options.tabSize,v=g-e.col%g;(m=l.appendChild(N("span",$(v),"cm-tab"))).setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),e.col+=v}else"\r"==f[0]||"\n"==f[0]?(m=l.appendChild(N("span","\r"==f[0]?"␍":"","cm-invalidchar"))).setAttribute("cm-text",f[0]):((m=e.cm.options.specialCharPlaceholder(f[0])).setAttribute("cm-text",f[0]),x&&k<9?l.appendChild(N("span",[m])):l.appendChild(m)),e.col+=1;e.map.push(e.pos,e.pos+1,m),e.pos++}}else e.col+=t.length,l=document.createTextNode(s),e.map.push(e.pos,e.pos+t.length,l),x&&k<9&&(u=!0),e.pos+=t.length;if(e.trailingSpace=32==s.charCodeAt(t.length-1),r||n||i||u||o){var y=r||"";n&&(y+=n),i&&(y+=i);var b=N("span",[l],y,o);if(a)for(var w in a)a.hasOwnProperty(w)&&"style"!=w&&"class"!=w&&b.setAttribute(w,a[w]);return e.content.appendChild(b)}e.content.appendChild(l)}}function lr(d,f){return function(e,t,r,n,i,o,a){r=r?r+" cm-force-border":"cm-force-border";for(var l=e.pos,s=l+t.length;;){for(var c=void 0,u=0;u<f.length&&!((c=f[u]).to>l&&c.from<=l);u++);if(c.to>=s)return d(e,t,r,n,i,o,a);d(e,t.slice(0,c.to-l),r,n,null,o,a),n=null,t=t.slice(c.to-l),l=c.to}}}function sr(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 cr(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a,l,s,c,u,d,f,h=i.length,p=0,m=1,g="",v=0;;){if(v==p){s=c=u=l="",d=f=null,v=1/0;for(var y=[],b=void 0,w=0;w<n.length;++w){var x=n[w],k=x.marker;if("bookmark"==k.type&&x.from==p&&k.widgetNode)y.push(k);else if(x.from<=p&&(null==x.to||x.to>p||k.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),k.className&&(s+=" "+k.className),k.css&&(l=(l?l+";":"")+k.css),k.startStyle&&x.from==p&&(u+=" "+k.startStyle),k.endStyle&&x.to==v&&(b||(b=[])).push(k.endStyle,x.to),k.title&&((f||(f={})).title=k.title),k.attributes)for(var C in k.attributes)(f||(f={}))[C]=k.attributes[C];k.collapsed&&(!d||jt(d.marker,k)<0)&&(d=x)}else x.from>p&&v>x.from&&(v=x.from)}if(b)for(var S=0;S<b.length;S+=2)b[S+1]==v&&(c+=" "+b[S]);if(!d||d.from==p)for(var T=0;T<y.length;++T)sr(t,0,y[T]);if(d&&(d.from||0)==p){if(sr(t,(null==d.to?h+1:d.to)-p,d.marker,null==d.from),null==d.to)return;d.to==p&&(d=!1)}}if(h<=p)break;for(var L=Math.min(h,v);;){if(g){var M=p+g.length;if(!d){var A=L<M?g.slice(0,L-p):g;t.addToken(t,A,a?a+s:s,u,p+A.length==v?c:"",l,f)}if(L<=M){g=g.slice(L-p),p=L;break}p=M,u=""}g=i.slice(o,o=r[m++]),a=nr(r[m++],t.cm.options)}}else for(var O=1;O<r.length;O+=2)t.addToken(t,i.slice(o,o=r[O]),nr(r[O+1],t.cm.options))}function ur(e,t,r){this.line=t,this.rest=function(e){for(var t,r;t=qt(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}(t),this.size=this.rest?it(Y(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Yt(e,t)}function dr(e,t,r){for(var n,i=[],o=t;o<r;o=n){var a=new ur(e.doc,et(e.doc,o),o);n=o+a.size,i.push(a)}return i}var fr=null;var hr=null;function pr(e,t){var r=xe(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);fr?n=fr.delayedCallbacks:hr?n=hr:(n=hr=[],setTimeout(mr,0));for(var o=function(e){n.push(function(){return r[e].apply(null,i)})},a=0;a<r.length;++a)o(a)}}function mr(){var e=hr;hr=null;for(var t=0;t<e.length;++t)e[t]()}function gr(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?br(e,t):"gutter"==o?xr(e,t,r,n):"class"==o?wr(e,t):"widget"==o&&kr(e,t,n)}t.changes=null}function vr(e){return e.node==e.text&&(e.node=N("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),x&&k<8&&(e.node.style.zIndex=2)),e.node}function yr(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):ir(e,t)}function br(e,t){var r=t.text.className,n=yr(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,wr(e,t)):r&&(t.text.className=r)}function wr(e,t){!function(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=vr(t);t.background=n.insertBefore(N("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?vr(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function xr(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=vr(t);t.gutterBackground=N("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var a=vr(t),l=t.gutter=N("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(l),a.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=l.appendChild(N("div",lt(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<e.display.gutterSpecs.length;++s){var c=e.display.gutterSpecs[s].className,u=o.hasOwnProperty(c)&&o[c];u&&l.appendChild(N("div",[u],"CodeMirror-gutter-elt","left: "+n.gutterLeft[c]+"px; width: "+n.gutterWidth[c]+"px"))}}}function kr(e,t,r){t.alignable&&(t.alignable=null);for(var n=t.node.firstChild,i=void 0;n;n=i)i=n.nextSibling,"CodeMirror-linewidget"==n.className&&t.node.removeChild(n);Cr(e,t,r)}function Cr(e,t,r){if(Sr(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)Sr(e,t.rest[n],t,r,!1)}function Sr(e,t,r,n,i){if(t.widgets)for(var o=vr(r),a=0,l=t.widgets;a<l.length;++a){var s=l[a],c=N("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),Tr(s,c,r,n),e.display.input.setUneditable(c),i&&s.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),pr(s,"redraw")}}function Tr(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 Lr(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!_(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;"),A(t.display.measure,N("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function Mr(e,t){for(var r=Ee(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 Ar(e){return e.lineSpace.offsetTop}function Or(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Nr(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=A(e.measure,N("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 _r(e){return R-e.display.nativeBarWidth}function Er(e){return e.display.scroller.clientWidth-_r(e)-e.display.barWidth}function Dr(e){return e.display.scroller.clientHeight-_r(e)-e.display.barHeight}function Fr(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var i=0;i<e.rest.length;i++)if(it(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function zr(e,t,r,n){return Hr(e,Pr(e,t),r,n)}function Wr(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[pn(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Pr(e,t){var r=it(t),n=Wr(e,r);n&&!n.text?n=null:n&&n.changes&&(gr(e,n,r,cn(e)),e.curOp.forceUpdate=!0),n||(n=function(e,t){var r=it(t=Vt(t)),n=e.display.externalMeasured=new ur(e.doc,t,r);n.lineN=r;var i=n.built=ir(e,n);return n.text=i.pre,A(e.display.lineMeasure,i.pre),n}(e,t));var i=Fr(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Hr(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||(function(e,t,r){var n=e.options.lineWrapping,i=n&&Er(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];2<Math.abs(s.bottom-c.bottom)&&o.push((s.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,r,n){var i,o=Rr(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&&ie(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+s<o.coverEnd&&ie(t.line.text.charAt(o.coverStart+s));)++s;if((i=x&&k<9&&0==l&&s==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():Br(T(a,l,s).getClientRects(),n)).left||i.right||0==l)break;s=l,l-=1,c="right"}x&&k<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=qe)return qe;var t=A(e,N("span","x")),r=t.getBoundingClientRect(),n=T(t,0,1).getBoundingClientRect();return qe=1<Math.abs(r.left-n.left)}(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}(e.display.measure,i))}else{var d;0<l&&(c=n="right"),i=e.options.lineWrapping&&1<(d=a.getClientRects()).length?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(x&&k<9&&!l&&(!i||!i.left&&!i.right)){var f=a.parentNode.getClientRects()[0];i=f?{left:f.left,right:f.left+sn(e.display),top:f.top,bottom:f.bottom}:jr}for(var h=i.top-t.rect.top,p=i.bottom-t.rect.top,m=(h+p)/2,g=t.view.measure.heights,v=0;v<g.length-1&&!(m<g[v]);v++);var y=v?g[v-1]:0,b=g[v],w={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:y,bottom:b};i.left||i.right||(w.bogus=!0);e.options.singleCursorHeightPerLine||(w.rtop=h,w.rbottom=p);return w}(e,t,r,n)).bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Ir,jr={left:0,right:0,top:0,bottom:0};function Rr(e,t,r){for(var n,i,o,a,l,s,c=0;c<e.length;c+=3)if(l=e[c],s=e[c+1],t<l?(i=0,o=1,a="left"):t<s?o=(i=t-l)+1:(c==e.length-3||t==s&&e[c+3]>t)&&(i=(o=s-l)-1,s<=t&&(a="right")),null!=i){if(n=e[c+2],l==s&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)n=e[2+(c-=3)],a="left";if("right"==r&&i==s-l)for(;c<e.length-3&&e[c+3]==e[c+4]&&!e[c+5].insertLeft;)n=e[(c+=3)+2],a="right";break}return{node:n,start:i,end:o,collapse:a,coverStart:l,coverEnd:s}}function Br(e,t){var r=jr;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var i=e.length-1;0<=i&&(r=e[i]).left==r.right;i--);return r}function qr(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 Ur(e){e.display.externalMeasure=null,M(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)qr(e.display.view[t])}function Kr(e){Ur(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Vr(){return a&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Gr(){return a&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function $r(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=Lr(e.widgets[r]));return t}function Yr(e,t,r,n,i){if(!i){var o=$r(t);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var a=Zt(t);if("local"==n?a+=Ar(e.display):a-=e.display.viewOffset,"page"==n||"window"==n){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==n?0:Gr());var s=l.left+("window"==n?0:Vr());r.left+=s,r.right+=s}return r.top+=a,r.bottom+=a,r}function Xr(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=Vr(),i-=Gr();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 Zr(e,t,r,n,i){return n||(n=et(e.doc,t.line)),Yr(e,n,zr(e,n,t.ch,i),r)}function Jr(n,e,i,o,a,l){function s(e,t){var r=Hr(n,a,e,t?"right":"left",l);return t?r.left=r.right:r.right=r.left,Yr(n,o,r,i)}o=o||et(n.doc,e.line),a||(a=Pr(n,o));var c=ye(o,n.doc.direction),t=e.ch,r=e.sticky;if(t>=o.text.length?(t=o.text.length,r="before"):t<=0&&(t=0,r="after"),!c)return s("before"==r?t-1:t,"before"==r);function u(e,t,r){return s(r?e-1:e,1==c[t].level!=r)}var d=se(c,t,r),f=le,h=u(t,d,"before"==r);return null!=f&&(h.other=u(t,f,"before"!=r)),h}function Qr(e,t){var r=0;t=mt(e.doc,t),e.options.lineWrapping||(r=sn(e.display)*t.ch);var n=et(e.doc,t.line),i=Zt(n)+Ar(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function en(e,t,r,n,i){var o=st(e,t,r);return o.xRel=i,n&&(o.outside=!0),o}function tn(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return en(n.first,0,null,!0,-1);var i=ot(n,r),o=n.first+n.size-1;if(o<i)return en(n.first+n.size-1,et(n,o).text.length,null,!0,1);t<0&&(t=0);for(var a=et(n,i);;){var l=an(e,a,i,t,r),s=Ut(a,l.ch+(0<l.xRel?1:0));if(!s)return l;var c=s.find(1);if(c.line==i)return c;a=et(n,i=c.line)}}function rn(t,e,r,n){n-=$r(e);var i=e.text.length,o=ae(function(e){return Hr(t,r,e-1).bottom<=n},i,0);return{begin:o,end:i=ae(function(e){return Hr(t,r,e).top>n},o,i)}}function nn(e,t,r,n){return r||(r=Pr(e,t)),rn(e,t,r,Yr(e,t,Hr(e,r,n),"line").top)}function on(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function an(r,e,t,n,i){i-=Zt(e);var o=Pr(r,e),a=$r(e),l=0,s=e.text.length,c=!0,u=ye(e,r.doc.direction);if(u){var d=(r.options.lineWrapping?function(e,t,r,n,i,o,a){var l=rn(e,t,n,a),s=l.begin,c=l.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var u=null,d=null,f=0;f<i.length;f++){var h=i[f];if(!(h.from>=c||h.to<=s)){var p=1!=h.level,m=Hr(e,n,p?Math.min(c,h.to)-1:Math.max(s,h.from)).right,g=m<o?o-m+1e9:m-o;(!u||g<d)&&(u=h,d=g)}}u||(u=i[i.length-1]);u.from<s&&(u={from:s,to:u.to,level:u.level});u.to>c&&(u={from:u.from,to:c,level:u.level});return u}:function(n,i,o,a,l,s,c){var e=ae(function(e){var t=l[e],r=1!=t.level;return on(Jr(n,st(o,r?t.to:t.from,r?"before":"after"),"line",i,a),s,c,!0)},0,l.length-1),t=l[e];if(0<e){var r=1!=t.level,u=Jr(n,st(o,r?t.from:t.to,r?"after":"before"),"line",i,a);on(u,s,c,!0)&&u.top>c&&(t=l[e-1])}return t})(r,e,t,o,u,n,i);l=(c=1!=d.level)?d.from:d.to-1,s=c?d.to:d.from-1}var f,h,p=null,m=null,g=ae(function(e){var t=Hr(r,o,e);return t.top+=a,t.bottom+=a,!!on(t,n,i,!1)&&(t.top<=i&&t.left<=n&&(p=e,m=t),!0)},l,s),v=!1;if(m){var y=n-m.left<m.right-n,b=y==c;g=p+(b?0:1),h=b?"after":"before",f=y?m.left:m.right}else{c||g!=s&&g!=l||g++,h=0==g?"after":g==e.text.length?"before":Hr(r,o,g-(c?1:0)).bottom+a<=i==c?"after":"before";var w=Jr(r,st(t,g,h),"line",e,o);f=w.left,v=i<w.top||i>=w.bottom}return en(t,g=oe(e.text,g,1),h,v,n-f)}function ln(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Ir){Ir=N("pre");for(var t=0;t<49;++t)Ir.appendChild(document.createTextNode("x")),Ir.appendChild(N("br"));Ir.appendChild(document.createTextNode("x"))}A(e.measure,Ir);var r=Ir.offsetHeight/50;return 3<r&&(e.cachedTextHeight=r),M(e.measure),r||1}function sn(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=N("span","xxxxxxxxxx"),r=N("pre",[t]);A(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return 2<i&&(e.cachedCharWidth=i),i||10}function cn(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className;r[l]=o.offsetLeft+o.clientLeft+i,n[l]=o.clientWidth}return{fixedPos:un(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function un(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function dn(n){var i=ln(n.display),o=n.options.lineWrapping,a=o&&Math.max(5,n.display.scroller.clientWidth/sn(n.display)-3);return function(e){if(Yt(n.doc,e))return 0;var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;r++)e.widgets[r].height&&(t+=e.widgets[r].height);return o?t+(Math.ceil(e.text.length/a)||1)*i:t+i}}function fn(e){var t=e.doc,r=dn(e);t.iter(function(e){var t=r(e);t!=e.height&&nt(e,t)})}function hn(e,t,r,n){var i=e.display;if(!r&&"true"==Ee(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=tn(e,o,a);if(n&&1==c.xRel&&(s=et(e.doc,c.line).text).length==c.ch){var u=H(s,s.length,e.options.tabSize)-s.length;c=st(c.line,Math.max(0,Math.round((o-Nr(e.display).left)/sn(e.display))-u))}return c}function pn(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if((t-=r[n].size)<0)return n}function mn(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)Nt&&Gt(e.doc,t)<i.viewTo&&vn(e);else if(r<=i.viewFrom)Nt&&$t(e.doc,r+n)>i.viewFrom?vn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)vn(e);else if(t<=i.viewFrom){var o=yn(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):vn(e)}else if(r>=i.viewTo){var a=yn(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):vn(e)}else{var l=yn(e,t,t,-1),s=yn(e,r,r+n,1);l&&s?(i.view=i.view.slice(0,l.index).concat(dr(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=n):vn(e)}var c=i.externalMeasured;c&&(r<c.lineN?c.lineN+=n:t<c.lineN+c.size&&(i.externalMeasured=null))}function gn(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[pn(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==j(a,r)&&a.push(r)}}}function vn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function yn(e,t,r,n){var i,o=pn(e,t),a=e.display.view;if(!Nt||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var l=e.display.viewFrom,s=0;s<o;s++)l+=a[s].size;if(l!=t){if(0<n){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,r+=i}for(;Gt(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 bn(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 wn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function xn(e,t){void 0===t&&(t=!0);for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),a=0;a<r.sel.ranges.length;a++)if(t||a!=r.sel.primIndex){var l=r.sel.ranges[a];if(!(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)){var s=l.empty();(s||e.options.showCursorWhenSelecting)&&kn(e,l.head,i),s||Sn(e,l,o)}}return n}function kn(e,t,r){var n=Jr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(N("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(N("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 Cn(e,t){return e.top-t.top||e.left-t.left}function Sn(a,e,t){var r=a.display,n=a.doc,i=document.createDocumentFragment(),o=Nr(a.display),L=o.left,M=Math.max(r.sizerWidth,Er(a)-r.sizer.offsetLeft)-o.right,A="ltr"==n.direction;function O(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),i.appendChild(N("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?M-e:r)+"px;\n height: "+(n-t)+"px"))}function l(r,y,b){var w,x,o=et(n,r),k=o.text.length;function C(e,t){return Zr(a,st(r,e),"div",o,t)}function S(e,t,r){var n=nn(a,o,null,e),i="ltr"==t==("after"==r)?"left":"right";return C("after"==r?n.begin:n.end-(/\s/.test(o.text.charAt(n.end-1))?2:1),i)[i]}var T=ye(o,n.direction);return function(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<r&&a.to>t||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr",o),i=!0)}i||n(t,r,"ltr")}(T,y||0,null==b?k:b,function(e,t,r,n){var i="ltr"==r,o=C(e,i?"left":"right"),a=C(t-1,i?"right":"left"),l=null==y&&0==e,s=null==b&&t==k,c=0==n,u=!T||n==T.length-1;if(a.top-o.top<=3){var d=(A?s:l)&&u,f=(A?l:s)&&c?L:(i?o:a).left,h=d?M:(i?a:o).right;O(f,o.top,h-f,o.bottom)}else{var p,m,g,v;v=i?(p=A&&l&&c?L:o.left,m=A?M:S(e,r,"before"),g=A?L:S(t,r,"after"),A&&s&&u?M:a.right):(p=A?S(e,r,"before"):L,m=!A&&l&&c?M:o.right,g=!A&&s&&u?L:a.left,A?S(t,r,"after"):M),O(p,o.top,m-p,o.bottom),o.bottom<a.top&&O(L,o.bottom,null,a.top),O(g,a.top,v-g,a.bottom)}(!w||Cn(o,w)<0)&&(w=o),Cn(a,w)<0&&(w=a),(!x||Cn(o,x)<0)&&(x=o),Cn(a,x)<0&&(x=a)}),{start:w,end:x}}var s=e.from(),c=e.to();if(s.line==c.line)l(s.line,s.ch,c.ch);else{var u=et(n,s.line),d=et(n,c.line),f=Vt(u)==Vt(d),h=l(s.line,s.ch,f?u.text.length+1:null).end,p=l(c.line,f?0:null,c.ch).start;f&&(h.top<p.top-2?(O(h.right,h.top,null,h.bottom),O(L,p.top,p.left,p.bottom)):O(h.right,h.top,p.left-h.right,h.bottom)),h.bottom<p.top&&O(L,h.bottom,null,p.top)}t.appendChild(i)}function Tn(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",0<e.options.cursorBlinkRate?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ln(e){e.state.focused||(e.display.input.focus(),An(e))}function Mn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,On(e))},100)}function An(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Ce(e,"focus",e,t),e.state.focused=!0,D(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),b&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Tn(e))}function On(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Ce(e,"blur",e,t),e.state.focused=!1,L(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Nn(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],o=e.options.lineWrapping,a=void 0,l=0;if(!i.hidden){if(x&&k<8){var s=i.node.offsetTop+i.node.offsetHeight;a=s-r,r=s}else{var c=i.node.getBoundingClientRect();a=c.bottom-c.top,!o&&i.text.firstChild&&(l=i.text.firstChild.getBoundingClientRect().right-c.left-1)}var u=i.line.height-a;if((.005<u||u<-.005)&&(nt(i.line,a),_n(i.line),i.rest))for(var d=0;d<i.rest.length;d++)_n(i.rest[d]);if(l>e.display.sizerWidth){var f=Math.ceil(l/sn(e.display));f>e.display.maxLineLength&&(e.display.maxLineLength=f,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function _n(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function En(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Ar(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=ot(t,n),a=ot(t,i);if(r&&r.ensure){var l=r.ensure.from.line,s=r.ensure.to.line;l<o?a=ot(t,Zt(et(t,o=l))+e.wrapper.clientHeight):Math.min(s,t.lastLine())>=a&&(o=ot(t,Zt(et(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function Dn(e,t){var r=e.display,n=ln(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,o=Dr(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Or(r),s=t.top<n,c=t.bottom>l-n;if(t.top<i)a.scrollTop=s?0:t.top;else if(t.bottom>i+o){var u=Math.min(t.top,(c?l:t.bottom)-o);u!=i&&(a.scrollTop=u)}var d=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,f=Er(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),h=t.right-t.left>f;return h&&(t.right=t.left+f),t.left<10?a.scrollLeft=0:t.left<d?a.scrollLeft=Math.max(0,t.left-(h?0:10)):t.right>f+d-3&&(a.scrollLeft=t.right+(h?0:10)-f),a}function Fn(e,t){null!=t&&(Pn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function zn(e){Pn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Wn(e,t,r){null==t&&null==r||Pn(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function Pn(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Hn(e,Qr(e,t.from),Qr(e,t.to),t.margin))}function Hn(e,t,r,n){var i=Dn(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});Wn(e,i.scrollLeft,i.scrollTop)}function In(e,t){Math.abs(e.doc.scrollTop-t)<2||(m||di(e,{top:t}),jn(e,t,!0),m&&di(e),ai(e,100))}function jn(e,t,r){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),e.display.scroller.scrollTop==t&&!r||(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Rn(e,t,r,n){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,pi(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Bn(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Or(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+_r(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function qn(e,t,r){this.cm=r;var n=this.vert=N("div",[N("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=N("div",[N("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),we(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),we(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,x&&k<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}qn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&0<e.clientHeight&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},qn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},qn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},qn.prototype.zeroWidthHack=function(){var e=w&&!l?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new I,this.disableVert=new I},qn.prototype.enableZeroWidthBar=function(r,n,i){r.style.pointerEvents="auto",n.set(1e3,function e(){var t=r.getBoundingClientRect();("vert"==i?document.elementFromPoint(t.right-1,(t.top+t.bottom)/2):document.elementFromPoint((t.right+t.left)/2,t.bottom-1))!=r?r.style.pointerEvents="none":n.set(1e3,e)})},qn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};function Un(){}function Kn(e,t){t||(t=Bn(e));var r=e.display.barWidth,n=e.display.barHeight;Vn(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&Nn(e),Vn(e,Bn(e)),r=e.display.barWidth,n=e.display.barHeight}function Vn(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}Un.prototype.update=function(){return{bottom:0,right:0}},Un.prototype.setScrollLeft=function(){},Un.prototype.setScrollTop=function(){},Un.prototype.clear=function(){};var Gn={native:qn,null:Un};function $n(r){r.display.scrollbars&&(r.display.scrollbars.clear(),r.display.scrollbars.addClass&&L(r.display.wrapper,r.display.scrollbars.addClass)),r.display.scrollbars=new Gn[r.options.scrollbarStyle](function(e){r.display.wrapper.insertBefore(e,r.display.scrollbarFiller),we(e,"mousedown",function(){r.state.focused&&setTimeout(function(){return r.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,t){"horizontal"==t?Rn(r,e):In(r,e)},r),r.display.scrollbars.addClass&&D(r.display.wrapper,r.display.scrollbars.addClass)}var Yn=0;function Xn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Yn},function(e){fr?fr.ops.push(e):e.ownsGroup=fr={ops:[e],delayedCallbacks:[]}}(e.curOp)}function Zn(e){var t=e.curOp;t&&function(e,t){var r=e.ownsGroup;if(r)try{!function(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}(r)}finally{fr=null,t(r)}}(t,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;!function(e){for(var t=e.ops,r=0;r<t.length;r++)Jn(t[r]);for(var n=0;n<t.length;n++)(i=t[n]).updatedDisplay=i.mustUpdate&&ci(i.cm,i.update);var i;for(var o=0;o<t.length;o++)Qn(t[o]);for(var a=0;a<t.length;a++)ei(t[a]);for(var l=0;l<t.length;l++)ti(t[l])}(e)})}function Jn(e){var t=e.cm,r=t.display;!function(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=_r(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=_r(e)+"px",t.scrollbarsClipped=!0)}(t),e.updateMaxLine&&Qt(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 si(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Qn(e){var t=e.cm,r=t.display;e.updatedDisplay&&Nn(t),e.barMeasure=Bn(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=zr(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+_r(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Er(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function ei(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Rn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==E();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),!e.updatedDisplay&&e.startHeight==t.doc.height||Kn(t,e.barMeasure),e.updatedDisplay&&hi(t,e.barMeasure),e.selectionChanged&&Tn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&Ln(e.cm)}function ti(e){var t=e.cm,r=t.display,n=t.doc;e.updatedDisplay&&ui(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=e.scrollTop&&jn(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&Rn(t,e.scrollLeft,!0,!0),e.scrollToPos&&function(e,t){if(!Se(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&&!c){var o=N("div","",null,"position: absolute;\n top: "+(t.top-r.viewOffset-Ar(e.display))+"px;\n height: "+(t.bottom-t.top+_r(e)+r.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,r,n){var i;null==n&&(n=0),e.options.lineWrapping||t!=r||(r="before"==(t=t.ch?st(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?st(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var a=!1,l=Jr(e,t),s=r&&r!=t?Jr(e,r):l,c=Dn(e,i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-n,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+n}),u=e.doc.scrollTop,d=e.doc.scrollLeft;if(null!=c.scrollTop&&(In(e,c.scrollTop),1<Math.abs(e.doc.scrollTop-u)&&(a=!0)),null!=c.scrollLeft&&(Rn(e,c.scrollLeft),1<Math.abs(e.doc.scrollLeft-d)&&(a=!0)),!a)break}return i}(t,mt(n,e.scrollToPos.from),mt(n,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var a=0;a<i.length;++a)i[a].lines.length||Ce(i[a],"hide");if(o)for(var l=0;l<o.length;++l)o[l].lines.length&&Ce(o[l],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ce(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function ri(e,t){if(e.curOp)return t();Xn(e);try{return t()}finally{Zn(e)}}function ni(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Xn(e);try{return t.apply(e,arguments)}finally{Zn(e)}}}function ii(e){return function(){if(this.curOp)return e.apply(this,arguments);Xn(this);try{return e.apply(this,arguments)}finally{Zn(this)}}}function oi(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);Xn(e);try{return t.apply(this,arguments)}finally{Zn(e)}}}function ai(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,W(li,e))}function li(s){var c=s.doc;if(!(c.highlightFrontier>=s.display.viewTo)){var u=+new Date+s.options.workTime,d=xt(s,c.highlightFrontier),f=[];c.iter(d.line,Math.min(c.first+c.size,s.display.viewTo+500),function(e){if(d.line>=s.display.viewFrom){var t=e.styles,r=e.text.length>s.options.maxHighlightLength?Xe(c.mode,d.state):null,n=bt(s,e,d,!0);r&&(d.state=r),e.styles=n.styles;var i=e.styleClasses,o=n.classes;o?e.styleClasses=o:i&&(e.styleClasses=null);for(var a=!t||t.length!=e.styles.length||i!=o&&(!i||!o||i.bgClass!=o.bgClass||i.textClass!=o.textClass),l=0;!a&&l<t.length;++l)a=t[l]!=e.styles[l];a&&f.push(d.line),e.stateAfter=d.save(),d.nextLine()}else e.text.length<=s.options.maxHighlightLength&&kt(s,e.text,d),e.stateAfter=d.line%5==0?d.save():null,d.nextLine();if(+new Date>u)return ai(s,s.options.workDelay),!0}),c.highlightFrontier=d.line,c.modeFrontier=Math.max(c.modeFrontier,d.line),f.length&&ri(s,function(){for(var e=0;e<f.length;e++)gn(s,f[e],"text")})}}var si=function(e,t,r){var n=e.display;this.viewport=t,this.visible=En(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Er(e),this.force=r,this.dims=cn(e),this.events=[]};function ci(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return vn(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==bn(e))return!1;mi(e)&&(vn(e),t.dims=cn(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)),Nt&&(o=Gt(e.doc,o),a=$t(e.doc,a));var l=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;!function(e,t,r){var n=e.display;0==n.view.length||t>=n.viewTo||r<=n.viewFrom?(n.view=dr(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=dr(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(pn(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(dr(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,pn(e,r)))),n.viewTo=r}(e,o,a),r.viewOffset=Zt(et(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var s=bn(e);if(!l&&0==s&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=function(e){if(e.hasFocus())return null;var t=E();if(!t||!_(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&_(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}(e);return 4<s&&(r.lineDiv.style.display="none"),function(r,e,t){var n=r.display,i=r.options.lineNumbers,o=n.lineDiv,a=o.firstChild;function l(e){var t=e.nextSibling;return b&&w&&r.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),t}for(var s=n.view,c=n.viewFrom,u=0;u<s.length;u++){var d=s[u];if(d.hidden);else if(d.node&&d.node.parentNode==o){for(;a!=d.node;)a=l(a);var f=i&&null!=e&&e<=c&&d.lineNumber;d.changes&&(-1<j(d.changes,"gutter")&&(f=!1),gr(r,d,c,t)),f&&(M(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(lt(r.options,c)))),a=d.node.nextSibling}else{var h=(g=c,v=t,void 0,y=yr(p=r,m=d),m.text=m.node=y.pre,y.bgClass&&(m.bgClass=y.bgClass),y.textClass&&(m.textClass=y.textClass),wr(p,m),xr(p,m,g,v),Cr(p,m,v),m.node);o.insertBefore(h,a)}c+=d.size}var p,m,g,v,y;for(;a;)a=l(a)}(e,r.updateLineNumbers,t.dims),4<s&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(e){if(e&&e.activeElt&&e.activeElt!=E()&&(e.activeElt.focus(),e.anchorNode&&_(document.body,e.anchorNode)&&_(document.body,e.focusNode))){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}(c),M(r.cursorDiv),M(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,l&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,ai(e,400)),!(r.updateLineNumbers=null)}function ui(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Er(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Or(e.display)-Dr(e),r.top)}),t.visible=En(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&ci(e,t);n=!1){Nn(e);var i=Bn(e);wn(e),Kn(e,i),hi(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function di(e,t){var r=new si(e,t);if(ci(e,r)){Nn(e),ui(e,r);var n=Bn(e);wn(e),Kn(e,n),hi(e,n),r.finish()}}function fi(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function hi(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+_r(e)+"px"}function pi(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=un(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a<r.length;a++)if(!r[a].hidden){e.options.fixedGutter&&(r[a].gutter&&(r[a].gutter.style.left=o),r[a].gutterBackground&&(r[a].gutterBackground.style.left=o));var l=r[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function mi(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=lt(e.options,t.first+t.size-1),n=e.display;if(r.length==n.lineNumChars)return!1;var i=n.measure.appendChild(N("div",[N("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",fi(e.display),!0}function gi(e,t){for(var r=[],n=!1,i=0;i<e.length;i++){var o=e[i],a=null;if("string"!=typeof o&&(a=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue;n=!0}r.push({className:o,style:a})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function vi(e){var t=e.gutters,r=e.gutterSpecs;M(t),e.lineGutter=null;for(var n=0;n<r.length;++n){var i=r[n],o=i.className,a=i.style,l=t.appendChild(N("div",null,"CodeMirror-gutter "+o));a&&(l.style.cssText=a),"CodeMirror-linenumbers"==o&&((e.lineGutter=l).style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",fi(e)}function yi(e){vi(e.display),mn(e),pi(e)}function bi(e,t,r,n){var i=this;this.input=r,i.scrollbarFiller=N("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=N("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=O("div",null,"CodeMirror-code"),i.selectionDiv=N("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=N("div",null,"CodeMirror-cursors"),i.measure=N("div",null,"CodeMirror-measure"),i.lineMeasure=N("div",null,"CodeMirror-measure"),i.lineSpace=O("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var o=O("div",[i.lineSpace],"CodeMirror-lines");i.mover=N("div",[o],null,"position: relative"),i.sizer=N("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=N("div",null,null,"position: absolute; height: "+R+"px; width: 1px;"),i.gutters=N("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=N("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=N("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),x&&k<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),b||m&&f||(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=gi(n.gutters,n.lineNumbers),vi(i),r.init(i)}si.prototype.signal=function(e,t){Le(e,t)&&this.events.push(arguments)},si.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ce.apply(null,this.events[e])};var wi=0,xi=null;function ki(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}}function Ci(e){var t=ki(e);return t.x*=xi,t.y*=xi,t}function Si(e,t){var r=ki(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&&w&&b)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&&!m&&!g&&null!=xi)return i&&s&&In(e,Math.max(0,a.scrollTop+i*xi)),Rn(e,Math.max(0,a.scrollLeft+n*xi)),(!i||i&&s)&&Ae(t),void(o.wheelStartX=null);if(i&&null!=xi){var f=i*xi,h=e.doc.scrollTop,p=h+o.wrapper.clientHeight;f<0?h=Math.max(0,h+f-50):p=Math.min(e.doc.height,p+f+50),di(e,{top:h,bottom:p})}wi<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&&(xi=(xi*wi+r)/(wi+1),++wi)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}x?xi=-.53:m?xi=15:a?xi=-.7:s&&(xi=-1/3);var Ti=function(e,t){this.ranges=e,this.primIndex=t};Ti.prototype.primary=function(){return this.ranges[this.primIndex]},Ti.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(!ut(r.anchor,n.anchor)||!ut(r.head,n.head))return!1}return!0},Ti.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Li(dt(this.ranges[t].anchor),dt(this.ranges[t].head));return new Ti(e,this.primIndex)},Ti.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Ti.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(0<=ct(t,n.from())&&ct(e,n.to())<=0)return r}return-1};var Li=function(e,t){this.anchor=e,this.head=t};function Mi(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r];t.sort(function(e,t){return ct(e.from(),t.from())}),r=j(t,i);for(var o=1;o<t.length;o++){var a=t[o],l=t[o-1],s=ct(l.to(),a.from());if(n&&!a.empty()?0<s:0<=s){var c=ht(l.from(),a.from()),u=ft(l.to(),a.to()),d=l.empty()?a.from()==a.head:l.from()==l.head;o<=r&&--r,t.splice(--o,2,new Li(d?u:c,d?c:u))}}return new Ti(t,r)}function Ai(e,t){return new Ti([new Li(e,t||e)],0)}function Oi(e){return e.text?st(e.from.line+e.text.length-1,Y(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Ni(e,t){if(ct(e,t.from)<0)return e;if(ct(e,t.to)<=0)return Oi(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+=Oi(t).ch-t.to.ch),st(r,n)}function _i(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new Li(Ni(i.anchor,t),Ni(i.head,t)))}return Mi(e.cm,r,e.sel.primIndex)}function Ei(e,t,r){return e.line==t.line?st(r.line,e.ch-t.ch+r.ch):st(r.line+(e.line-t.line),e.ch)}function Di(e){e.doc.mode=Ge(e.options,e.doc.modeOption),Fi(e)}function Fi(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,ai(e,100),e.state.modeGen++,e.curOp&&mn(e)}function zi(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Y(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Wi(e,n,t,i){function o(e){return t?t[e]:null}function r(e,t,r){!function(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Wt(e),Pt(e,r);var i=n?n(e):1;i!=e.height&&nt(e,i)}(e,t,r,i),pr(e,"change",e,n)}function a(e,t){for(var r=[],n=e;n<t;++n)r.push(new er(c[n],o(n),i));return r}var l=n.from,s=n.to,c=n.text,u=et(e,l.line),d=et(e,s.line),f=Y(c),h=o(c.length-1),p=s.line-l.line;if(n.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(zi(e,n)){var m=a(0,c.length-1);r(d,d.text,h),p&&e.remove(l.line,p),m.length&&e.insert(l.line,m)}else if(u==d)if(1==c.length)r(u,u.text.slice(0,l.ch)+f+u.text.slice(s.ch),h);else{var g=a(1,c.length-1);g.push(new er(f+u.text.slice(s.ch),h,i)),r(u,u.text.slice(0,l.ch)+c[0],o(0)),e.insert(l.line+1,g)}else if(1==c.length)r(u,u.text.slice(0,l.ch)+c[0]+d.text.slice(s.ch),o(0)),e.remove(l.line+1,p);else{r(u,u.text.slice(0,l.ch)+c[0],o(0)),r(d,f+d.text.slice(s.ch),h);var v=a(1,c.length-1);1<p&&e.remove(l.line+1,p-1),e.insert(l.line+1,v)}pr(e,"change",e,n)}function Pi(e,l,s){!function e(t,r,n){if(t.linked)for(var i=0;i<t.linked.length;++i){var o=t.linked[i];if(o.doc!=r){var a=n&&o.sharedHist;s&&!a||(l(o.doc,a),e(o.doc,t,a))}}}(e,null,!0)}function Hi(e,t){if(t.cm)throw new Error("This document is already in use.");fn((e.doc=t).cm=e),Di(e),Ii(e),e.options.lineWrapping||Qt(e),e.options.mode=t.modeOption,mn(e)}function Ii(e){("rtl"==e.doc.direction?D:L)(e.display.lineDiv,"CodeMirror-rtl")}function ji(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 Ri(e,t){var r={from:dt(t.from),to:Oi(t),text:tt(e,t.from,t.to)};return Vi(e,r,t.from.line,t.to.line+1),Pi(e,function(e){return Vi(e,r,t.from.line,t.to.line+1)},!0),r}function Bi(e){for(;e.length;){if(!Y(e).ranges)break;e.pop()}}function qi(e,t,r,n){var i=e.history;i.undone.length=0;var o,a,l=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(Bi(e.done),Y(e.done)):e.done.length&&!Y(e.done).ranges?Y(e.done):1<e.done.length&&!e.done[e.done.length-2].ranges?(e.done.pop(),Y(e.done)):void 0}(i,i.lastOp==n)))a=Y(o.changes),0==ct(t.from,t.to)&&0==ct(t.from,a.to)?a.to=Oi(t):o.changes.push(Ri(e,t));else{var s=Y(i.done);for(s&&s.ranges||Ki(e.sel,i.done),o={changes:[Ri(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,a||Ce(e,"historyAdded")}function Ui(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||function(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,Y(i.done),t))?i.done[i.done.length-1]=t:Ki(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&!1!==n.clearRedo&&Bi(i.undone)}function Ki(e,t){var r=Y(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Vi(t,r,e,n){var i=r["spans_"+t.id],o=0;t.iter(Math.max(t.first,e),Math.min(t.first+t.size,n),function(e){e.markedSpans&&((i||(i=r["spans_"+t.id]={}))[o]=e.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 $i(e,t){var r=function(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],i=0;i<t.text.length;++i)n.push(Gi(r[i]));return n}(e,t),n=Ft(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 Yi(e,t,r){for(var n=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)n.push(r?Ti.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];n.push({changes:l});for(var s=0;s<a.length;++s){var c=a[s],u=void 0;if(l.push({from:c.from,to:c.to,text:c.text}),t)for(var d in c)(u=d.match(/^spans_(\d+)$/))&&-1<j(t,Number(u[1]))&&(Y(l)[d]=c[d],delete c[d])}}}return n}function Xi(e,t,r,n){if(n){var i=e.anchor;if(r){var o=ct(t,i)<0;o!=ct(r,i)<0?(i=t,t=r):o!=ct(t,r)<0&&(t=r)}return new Li(i,t)}return new Li(r||t,t)}function Zi(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),ro(e,new Ti([Xi(e.sel.primary(),t,r,i)],0),n)}function Ji(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)n[o]=Xi(e.sel.ranges[o],t[o],null,i);ro(e,Mi(e.cm,n,e.sel.primIndex),r)}function Qi(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,ro(e,Mi(e.cm,i,e.sel.primIndex),n)}function eo(e,t,r,n){ro(e,Ai(t,r),n)}function to(e,t,r){var n=e.history.done,i=Y(n);i&&i.ranges?no(e,n[n.length-1]=t,r):ro(e,t,r)}function ro(e,t,r){no(e,t,r),Ui(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function no(e,t,r){(Le(e,"beforeSelectionChange")||e.cm&&Le(e.cm,"beforeSelectionChange"))&&(t=function(r,e,t){var n={ranges:e.ranges,update:function(e){this.ranges=[];for(var t=0;t<e.length;t++)this.ranges[t]=new Li(mt(r,e[t].anchor),mt(r,e[t].head))},origin:t&&t.origin};return Ce(r,"beforeSelectionChange",r,n),r.cm&&Ce(r.cm,"beforeSelectionChange",r.cm,n),n.ranges!=e.ranges?Mi(r.cm,n.ranges,n.ranges.length-1):e}(e,t,r));var n=r&&r.bias||(ct(t.primary().head,e.sel.primary().head)<0?-1:1);io(e,ao(e,t,n,!0)),r&&!1===r.scroll||!e.cm||zn(e.cm)}function io(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Te(e.cm)),pr(e,"cursorActivity",e))}function oo(e){io(e,ao(e,e.sel,null,!1))}function ao(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=so(e,a.anchor,l&&l.anchor,r,n),c=so(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 Li(s,c))}return i?Mi(e.cm,i,t.primIndex):t}function lo(e,t,r,n,i){var o=et(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&&(Ce(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(r){var c=s.find(n<0?1:-1),u=void 0;if((n<0?s.inclusiveRight:s.inclusiveLeft)&&(c=co(e,c,-n,c&&c.line==t.line?o:null)),c&&c.line==t.line&&(u=ct(c,r))&&(n<0?u<0:0<u))return lo(e,c,t,n,i)}var d=s.find(n<0?-1:1);return(n<0?s.inclusiveLeft:s.inclusiveRight)&&(d=co(e,d,n,d.line==t.line?o:null)),d?lo(e,d,t,n,i):null}}return t}function so(e,t,r,n,i){var o=n||1,a=lo(e,t,r,o,i)||!i&&lo(e,t,r,o,!0)||lo(e,t,r,-o,i)||!i&&lo(e,t,r,-o,!0);return a||(e.cantEdit=!0,st(e.first,0))}function co(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?mt(e,st(t.line-1)):null:0<r&&t.ch==(n||et(e,t.line)).text.length?t.line<e.first+e.size-1?st(t.line+1,0):null:new st(t.line,t.ch+r)}function uo(e){e.setSelection(st(e.firstLine(),0),st(e.lastLine()),q)}function fo(i,e,t){var o={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return o.canceled=!0}};return t&&(o.update=function(e,t,r,n){e&&(o.from=mt(i,e)),t&&(o.to=mt(i,t)),r&&(o.text=r),void 0!==n&&(o.origin=n)}),Ce(i,"beforeChange",i,o),i.cm&&Ce(i.cm,"beforeChange",i.cm,o),o.canceled?(i.cm&&(i.cm.curOp.updateInput=2),null):{from:o.from,to:o.to,text:o.text,origin:o.origin}}function ho(e,t,r){if(e.cm){if(!e.cm.curOp)return ni(e.cm,ho)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(Le(e,"beforeChange")||e.cm&&Le(e.cm,"beforeChange"))||(t=fo(e,t,!0))){var n=Ot&&!r&&function(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=j(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var a=n[o],l=a.find(0),s=0;s<i.length;++s){var c=i[s];if(!(ct(c.to,l.from)<0||0<ct(c.from,l.to))){var u=[s,1],d=ct(c.from,l.from),f=ct(c.to,l.to);(d<0||!a.inclusiveLeft&&!d)&&u.push({from:c.from,to:l.from}),(0<f||!a.inclusiveRight&&!f)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-3}}return i}(e,t.from,t.to);if(n)for(var i=n.length-1;0<=i;--i)po(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else po(e,t)}}function po(e,r){if(1!=r.text.length||""!=r.text[0]||0!=ct(r.from,r.to)){var t=_i(e,r);qi(e,r,t,e.cm?e.cm.curOp.id:NaN),vo(e,r,t,Ft(e,r));var n=[];Pi(e,function(e,t){t||-1!=j(n,e.history)||(xo(e.history,r),n.push(e.history)),vo(e,r,null,Ft(e,r))})}}function mo(i,o,e){var t=i.cm&&i.cm.state.suppressEdits;if(!t||e){for(var a,r=i.history,n=i.sel,l="undo"==o?r.done:r.undone,s="undo"==o?r.undone:r.done,c=0;c<l.length&&(a=l[c],e?!a.ranges||a.equals(i.sel):a.ranges);c++);if(c!=l.length){for(r.lastOrigin=r.lastSelOrigin=null;;){if(!(a=l.pop()).ranges){if(t)return void l.push(a);break}if(Ki(a,s),e&&!a.equals(i.sel))return void ro(i,a,{clearRedo:!1});n=a}var u=[];Ki(n,s),s.push({changes:u,generation:r.generation}),r.generation=a.generation||++r.maxGeneration;for(var d=Le(i,"beforeChange")||i.cm&&Le(i.cm,"beforeChange"),f=function(e){var r=a.changes[e];if(r.origin=o,d&&!fo(i,r,!1))return l.length=0,{};u.push(Ri(i,r));var t=e?_i(i,r):Y(l);vo(i,r,t,$i(i,r)),!e&&i.cm&&i.cm.scrollIntoView({from:r.from,to:Oi(r)});var n=[];Pi(i,function(e,t){t||-1!=j(n,e.history)||(xo(e.history,r),n.push(e.history)),vo(e,r,null,$i(e,r))})},h=a.changes.length-1;0<=h;--h){var p=f(h);if(p)return p.v}}}}function go(e,t){if(0!=t&&(e.first+=t,e.sel=new Ti(X(e.sel.ranges,function(e){return new Li(st(e.anchor.line+t,e.anchor.ch),st(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){mn(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)gn(e.cm,n,"gutter")}}function vo(e,t,r,n){if(e.cm&&!e.cm.curOp)return ni(e.cm,vo)(e,t,r,n);if(t.to.line<e.first)go(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);go(e,i),t={from:st(e.first,0),to:st(t.to.line+i,t.to.ch),text:[Y(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:st(o,et(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=tt(e,t.from,t.to),r||(r=_i(e,t)),e.cm?function(e,t,r){var n=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line;e.options.lineWrapping||(s=it(Vt(et(n,o.line))),n.iter(s,a.line+1,function(e){if(e==i.maxLine)return l=!0}));-1<n.sel.contains(t.from,t.to)&&Te(e);Wi(n,t,r,dn(e)),e.options.lineWrapping||(n.iter(s,o.line+t.text.length,function(e){var t=Jt(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0));(function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var r=e.first,n=t-1;r<n;n--){var i=et(e,n).stateAfter;if(i&&(!(i instanceof vt)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}})(n,o.line),ai(e,400);var c=t.text.length-(a.line-o.line)-1;t.full?mn(e):o.line!=a.line||1!=t.text.length||zi(e.doc,t)?mn(e,o.line,a.line+1,c):gn(e,o.line,"text");var u=Le(e,"changes"),d=Le(e,"change");if(d||u){var f={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};d&&pr(e,"change",e,f),u&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}(e.cm,t,n):Wi(e,t,n),no(e,r,q)}}function yo(e,t,r,n,i){var o;n||(n=r),ct(n,r)<0&&(r=(o=[n,r])[0],n=o[1]),"string"==typeof t&&(t=e.splitLines(t)),ho(e,{from:r,to:n,text:t,origin:i})}function bo(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function wo(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var l=0;l<o.ranges.length;l++)bo(o.ranges[l].anchor,t,r,n),bo(o.ranges[l].head,t,r,n)}else{for(var s=0;s<o.changes.length;++s){var c=o.changes[s];if(r<c.from.line)c.from=st(c.from.line+n,c.from.ch),c.to=st(c.to.line+n,c.to.ch);else if(t<=c.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function xo(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;wo(e.done,r,n,i),wo(e.undone,r,n,i)}function ko(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=et(e,pt(e,t)):i=it(t),null==i?null:(n(o,i)&&e.cm&&gn(e.cm,i,r),o)}function Co(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}function So(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}Li.prototype.from=function(){return ht(this.anchor,this.head)},Li.prototype.to=function(){return ft(this.anchor,this.head)},Li.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},Co.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r,n=e,i=e+t;n<i;++n){var o=this.lines[n];this.height-=o.height,(r=o).parent=null,Wt(r),pr(o,"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}},So.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&&(1<this.children.length||!(this.children[0]instanceof Co))){var l=[];this.collapse(l),this.children=[new Co(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&&50<i.lines.length){for(var a=i.lines.length%25+25,l=a;l<i.lines.length;){var s=new Co(i.lines.slice(l,l+=25));i.height-=s.height,this.children.splice(++n,0,s),s.parent=this}i.lines=i.lines.slice(0,a),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=new So(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var r=j(e.parent.children,e);e.parent.children.splice(r+1,0,t)}else{var n=new So(e.children);(n.parent=e).children=[n,t],e=n}t.parent=e.parent}while(10<e.children.length);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}}};function To(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t}function Lo(e,t,r){Zt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Fn(e,r)}To.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=it(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=Lr(this);nt(r,Math.max(0,r.height-o)),e&&(ri(e,function(){Lo(e,r,-o),gn(e,n,"widget")}),pr(e,"lineWidgetCleared",e,this,n))}},To.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=Lr(this)-t;i&&(Yt(this.doc,n)||nt(n,n.height+i),r&&ri(r,function(){r.curOp.forceUpdate=!0,Lo(r,n,i),pr(r,"lineWidgetChanged",r,e,it(n))}))},Me(To);var Mo=0,Ao=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Mo};function Oo(t,r,n,e,i){if(e&&e.shared)return function(e,r,n,i,o){(i=P(i)).shared=!1;var a=[Oo(e,r,n,i,o)],l=a[0],s=i.widgetNode;return Pi(e,function(e){s&&(i.widgetNode=s.cloneNode(!0)),a.push(Oo(e,mt(e,r),mt(e,n),i,o));for(var t=0;t<e.linked.length;++t)if(e.linked[t].isParent)return;l=Y(a)}),new No(a,l)}(t,r,n,e,i);if(t.cm&&!t.cm.curOp)return ni(t.cm,Oo)(t,r,n,e,i);var o=new Ao(t,i),a=ct(r,n);if(e&&P(e,o,!1),0<a||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=O("span",[o.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Kt(t,r.line,r,n,o)||r.line!=n.line&&Kt(t,n.line,r,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Nt=!0}o.addToHistory&&qi(t,{from:r,to:n,origin:"markText"},t.sel,NaN);var l,s=r.line,c=t.cm;if(t.iter(s,n.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&Vt(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=r.line&&nt(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new _t(o,s==r.line?r.ch:null,s==n.line?n.ch:null)),++s}),o.collapsed&&t.iter(r.line,n.line+1,function(e){Yt(t,e)&&nt(e,0)}),o.clearOnEnter&&we(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Ot=!0,(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++Mo,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)mn(c,r.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var u=r.line;u<=n.line;u++)gn(c,u,"text");o.atomic&&oo(c.doc),pr(c,"markerAdded",c,o)}return o}Ao.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){var t=this.doc.cm,r=t&&!t.curOp;if(r&&Xn(t),Le(this,"clear")){var n=this.find();n&&pr(this,"clear",n.from,n.to)}for(var i=null,o=null,a=0;a<this.lines.length;++a){var l=e.lines[a],s=Et(l.markedSpans,e);t&&!e.collapsed?gn(t,it(l),"text"):t&&(null!=s.to&&(o=it(l)),null!=s.from&&(i=it(l))),l.markedSpans=Dt(l.markedSpans,s),null==s.from&&e.collapsed&&!Yt(e.doc,l)&&t&&nt(l,ln(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var c=0;c<this.lines.length;++c){var u=Vt(e.lines[c]),d=Jt(u);d>t.display.maxLineLength&&(t.display.maxLine=u,t.display.maxLineLength=d,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&mn(t,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&oo(t.doc)),t&&pr(t,"markerCleared",t,this,i,o),r&&Zn(t),this.parent&&this.parent.clear()}},Ao.prototype.find=function(e,t){var r,n;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],a=Et(o.markedSpans,this);if(null!=a.from&&(r=st(t?o:it(o),a.from),-1==e))return r;if(null!=a.to&&(n=st(t?o:it(o),a.to),1==e))return n}return r&&{from:r,to:n}},Ao.prototype.changed=function(){var o=this,a=this.find(-1,!0),l=this,s=this.doc.cm;a&&s&&ri(s,function(){var e=a.line,t=it(a.line),r=Wr(s,t);if(r&&(qr(r),s.curOp.selectionChanged=s.curOp.forceUpdate=!0),s.curOp.updateMaxLine=!0,!Yt(l.doc,e)&&null!=l.height){var n=l.height;l.height=null;var i=Lr(l)-n;i&&nt(e,e.height+i)}pr(s,"markerChanged",s,o)})},Ao.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=j(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ao.prototype.detachLine=function(e){if(this.lines.splice(j(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Me(Ao);var No=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};function _o(e){return e.findMarks(st(e.first,0),e.clipPos(st(e.lastLine())),function(e){return e.parent})}function Eo(o){for(var e=function(e){var t=o[e],r=[t.primary.doc];Pi(t.primary.doc,function(e){return r.push(e)});for(var n=0;n<t.markers.length;n++){var i=t.markers[n];-1==j(r,i.doc)&&(i.parent=null,t.markers.splice(n--,1))}},t=0;t<o.length;t++)e(t)}No.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();pr(this,"clear")}},No.prototype.find=function(e,t){return this.primary.find(e,t)},Me(No);var Do=0,Fo=function(e,t,r,n,i){if(!(this instanceof Fo))return new Fo(e,t,r,n,i);null==r&&(r=0),So.call(this,[new Co([new er("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var o=st(r,0);this.sel=Ai(o),this.history=new ji(null),this.id=++Do,this.modeOption=t,this.lineSep=n,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Wi(this,{from:o,to:o,text:e}),ro(this,Ai(o),q)};Fo.prototype=J(So.prototype,{constructor:Fo,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=rt(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:oi(function(e){var t=st(this.first,0),r=this.first+this.size-1;ho(this,{from:t,to:st(r,et(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Wn(this.cm,0,0),ro(this,Ai(t),q)}),replaceRange:function(e,t,r,n){yo(this,e,t=mt(this,t),r=r?mt(this,r):t,n)},getRange:function(e,t,r){var n=tt(this,mt(this,e),mt(this,t));return!1===r?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(at(this,e))return et(this,e)},getLineNumber:function(e){return it(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=et(this,e)),Vt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return mt(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:oi(function(e,t,r){eo(this,mt(this,"number"==typeof e?st(e,t||0):e),null,r)}),setSelection:oi(function(e,t,r){eo(this,mt(this,e),mt(this,t||e),r)}),extendSelection:oi(function(e,t,r){Zi(this,mt(this,e),t&&mt(this,t),r)}),extendSelections:oi(function(e,t){Ji(this,gt(this,e),t)}),extendSelectionsBy:oi(function(e,t){Ji(this,gt(this,X(this.sel.ranges,e)),t)}),setSelections:oi(function(e,t,r){if(e.length){for(var n=[],i=0;i<e.length;i++)n[i]=new Li(mt(this,e[i].anchor),mt(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),ro(this,Mi(this.cm,n,t),r)}}),addSelection:oi(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new Li(mt(this,e),mt(this,t||e))),ro(this,Mi(this.cm,n,n.length-1),r)}),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=tt(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=tt(this,r[n].from(),r[n].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:oi(function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];n[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:r}}for(var l=t&&"end"!=t&&function(e,t,r){for(var n=[],i=st(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=Ei(l.from,i,o),c=Ei(Oi(l),i,o);if(i=l.to,o=c,"around"==r){var u=e.sel.ranges[a],d=ct(u.head,u.anchor)<0;n[a]=new Li(d?c:s,d?s:c)}else n[a]=new Li(s,s)}return new Ti(n,e.sel.primIndex)}(this,n,t),s=n.length-1;0<=s;s--)ho(this,n[s]);l?to(this,l):this.cm&&zn(this.cm)}),undo:oi(function(){mo(this,"undo")}),redo:oi(function(){mo(this,"redo")}),undoSelection:oi(function(){mo(this,"undo",!0)}),redoSelection:oi(function(){mo(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new ji(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:Yi(this.history.done),undone:Yi(this.history.undone)}},setHistory:function(e){var t=this.history=new ji(this.history.maxGeneration);t.done=Yi(e.done.slice(0),null,!0),t.undone=Yi(e.undone.slice(0),null,!0)},setGutterMarker:oi(function(e,r,n){return ko(this,e,"gutter",function(e){var t=e.gutterMarkers||(e.gutterMarkers={});return!(t[r]=n)&&re(t)&&(e.gutterMarkers=null),!0})}),clearGutter:oi(function(t){var r=this;this.iter(function(e){e.gutterMarkers&&e.gutterMarkers[t]&&ko(r,e,"gutter",function(){return e.gutterMarkers[t]=null,re(e.gutterMarkers)&&(e.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!at(this,e))return null;if(!(e=et(this,t=e)))return null}else if(null==(t=it(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:oi(function(e,r,n){return ko(this,e,"gutter"==r?"gutter":"class",function(e){var t="text"==r?"textClass":"background"==r?"bgClass":"gutter"==r?"gutterClass":"wrapClass";if(e[t]){if(S(n).test(e[t]))return!1;e[t]+=" "+n}else e[t]=n;return!0})}),removeLineClass:oi(function(e,o,a){return ko(this,e,"gutter"==o?"gutter":"class",function(e){var t="text"==o?"textClass":"background"==o?"bgClass":"gutter"==o?"gutterClass":"wrapClass",r=e[t];if(!r)return!1;if(null==a)e[t]=null;else{var n=r.match(S(a));if(!n)return!1;var i=n.index+n[0].length;e[t]=r.slice(0,n.index)+(n.index&&i!=r.length?" ":"")+r.slice(i)||null}return!0})}),addLineWidget:oi(function(e,t,r){return function(n,e,t,r){var i=new To(n,t,r),o=n.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),ko(n,e,"widget",function(e){var t=e.widgets||(e.widgets=[]);if(null==i.insertAt?t.push(i):t.splice(Math.min(t.length-1,Math.max(0,i.insertAt)),0,i),i.line=e,o&&!Yt(n,e)){var r=Zt(e)<n.scrollTop;nt(e,e.height+Lr(i)),r&&Fn(o,i.height),o.curOp.forceUpdate=!0}return!0}),o&&pr(o,"lineWidgetAdded",o,i,"number"==typeof e?e:it(e)),i}(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return Oo(this,mt(this,e),mt(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 Oo(this,e=mt(this,e),e,r,"bookmark")},findMarksAt:function(e){var t=[],r=et(this,(e=mt(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(i,o,a){i=mt(this,i),o=mt(this,o);var l=[],s=i.line;return this.iter(i.line,o.line+1,function(e){var t=e.markedSpans;if(t)for(var r=0;r<t.length;r++){var n=t[r];null!=n.to&&s==i.line&&i.ch>=n.to||null==n.from&&s!=i.line||null!=n.from&&s==o.line&&n.from>=o.ch||a&&!a(n.marker)||l.push(n.marker.parent||n.marker)}++s}),l},getAllMarks:function(){var n=[];return this.iter(function(e){var t=e.markedSpans;if(t)for(var r=0;r<t.length;++r)null!=t[r].from&&n.push(t[r].marker)}),n},posFromIndex:function(r){var n,i=this.first,o=this.lineSeparator().length;return this.iter(function(e){var t=e.text.length+o;if(r<t)return n=r,!0;r-=t,++i}),mt(this,st(i,n))},indexFromPos:function(e){var t=(e=mt(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+r}),t},copy:function(e){var t=new Fo(rt(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new Fo(rt(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(ct(o,a)){var l=Oo(e,o,a,n.primary,n.primary.type);n.markers.push(l),l.parent=n}}}(n,_o(this)),n},unlinkDoc:function(e){if(e instanceof Na&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){if(this.linked[t].doc==e){this.linked.splice(t,1),e.unlinkDoc(this),Eo(_o(this));break}}if(e.history==this.history){var r=[e.id];Pi(e,function(e){return r.push(e.id)},!0),e.history=new ji(null),e.history.done=Yi(this.history.done,r),e.history.undone=Yi(this.history.undone,r)}},iterLinkedDocs:function(e){Pi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):je(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:oi(function(e){"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&function(e){ri(e,function(){Ii(e),mn(e)})}(this.cm))})}),Fo.prototype.eachLine=Fo.prototype.iter;var zo=0;function Wo(e){var i=this;if(Po(i),!Se(i,e)&&!Mr(i.display,e)){Ae(e),x&&(zo=+new Date);var o=hn(i,e,!0),t=e.dataTransfer.files;if(o&&!i.isReadOnly())if(t&&t.length&&window.FileReader&&window.File)for(var a=t.length,l=Array(a),s=0,r=function(e,r){if(!i.options.allowDropFileTypes||-1!=j(i.options.allowDropFileTypes,e.type)){var n=new FileReader;n.onload=ni(i,function(){var e=n.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),l[r]=e,++s==a){var t={from:o=mt(i.doc,o),to:o,text:i.doc.splitLines(l.join(i.doc.lineSeparator())),origin:"paste"};ho(i.doc,t),to(i.doc,Ai(o,Oi(t)))}}),n.readAsText(e)}},n=0;n<a;++n)r(t[n],n);else{if(i.state.draggingText&&-1<i.doc.sel.contains(o))return i.state.draggingText(e),void setTimeout(function(){return i.display.input.focus()},20);try{var c=e.dataTransfer.getData("Text");if(c){var u;if(i.state.draggingText&&!i.state.draggingText.copy&&(u=i.listSelections()),no(i.doc,Ai(o,o)),u)for(var d=0;d<u.length;++d)yo(i.doc,"",u[d].anchor,u[d].head,"drag");i.replaceSelection(c,"around","paste"),i.display.input.focus()}}catch(e){}}}}function Po(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Ho(t){if(document.getElementsByClassName){for(var e=document.getElementsByClassName("CodeMirror"),r=[],n=0;n<e.length;n++){var i=e[n].CodeMirror;i&&r.push(i)}r.length&&r[0].operation(function(){for(var e=0;e<r.length;e++)t(r[e])})}}var Io=!1;function jo(){Io||(function(){var e;we(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Ho(Ro)},100))}),we(window,"blur",function(){return Ho(On)})}(),Io=!0)}function Ro(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Bo={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},qo=0;qo<10;qo++)Bo[qo+48]=Bo[qo+96]=String(qo);for(var Uo=65;Uo<=90;Uo++)Bo[Uo]=String.fromCharCode(Uo);for(var Ko=1;Ko<=12;Ko++)Bo[Ko+111]=Bo[Ko+63235]="F"+Ko;var Vo={};function Go(e){var t,r,n,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var a=0;a<o.length-1;a++){var l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else{if(!/^s(hift)?$/i.test(l))throw new Error("Unrecognized modifier name: "+l);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function $o(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=X(r.split(" "),Go),o=0;o<i.length;o++){var a=void 0,l=void 0;a=o==i.length-1?(l=i.join(" "),n):(l=i.slice(0,o+1).join(" "),"...");var s=t[l];if(s){if(s!=a)throw new Error("Inconsistent bindings for "+l)}else t[l]=a}delete e[r]}for(var c in t)e[c]=t[c];return e}function Yo(e,t,r,n){var i=(t=Qo(t)).call?t.call(e,n):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Yo(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var a=Yo(e,t.fallthrough[o],r,n);if(a)return a}}}function Xo(e){var t="string"==typeof e?e:Bo[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Zo(e,t,r){var n=e;return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(y?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(y?t.ctrlKey:t.metaKey)&&"Cmd"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function Jo(e,t){if(g&&34==e.keyCode&&e.char)return!1;var r=Bo[e.keyCode];return null!=r&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(r=e.code),Zo(r,e,t))}function Qo(e){return"string"==typeof e?Vo[e]:e}function ea(t,e){for(var r=t.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=e(r[i]);n.length&&ct(o.from,Y(n).to)<=0;){var a=n.pop();if(ct(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}ri(t,function(){for(var e=n.length-1;0<=e;e--)yo(t.doc,"",n[e].from,n[e].to,"+delete");zn(t)})}function ta(e,t,r){var n=oe(e.text,t+r,r);return n<0||n>e.text.length?null:n}function ra(e,t,r){var n=ta(e,t.ch,r);return null==n?null:new st(t.line,n,r<0?"after":"before")}function na(e,t,r,n,i){if(e){var o=ye(r,t.doc.direction);if(o){var a,l=i<0?Y(o):o[0],s=i<0==(1==l.level)?"after":"before";if(0<l.level||"rtl"==t.doc.direction){var c=Pr(t,r);a=i<0?r.text.length-1:0;var u=Hr(t,c,a).top;a=ae(function(e){return Hr(t,c,e).top==u},i<0==(1==l.level)?l.from:l.to-1,a),"before"==s&&(a=ta(r,a,1))}else a=i<0?l.to:l.from;return new st(n,a,s)}}return new st(n,i<0?r.text.length:0,i<0?"before":"after")}Vo.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"},Vo.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"},Vo.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"},Vo.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"]},Vo.default=w?Vo.macDefault:Vo.pcDefault;var ia={selectAll:uo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),q)},killLine:function(r){return ea(r,function(e){if(e.empty()){var t=et(r.doc,e.head.line).text.length;return e.head.ch==t&&e.head.line<r.lastLine()?{from:e.head,to:st(e.head.line+1,0)}:{from:e.head,to:st(e.head.line,t)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){return ea(t,function(e){return{from:st(e.from().line,0),to:mt(t.doc,st(e.to().line+1,0))}})},delLineLeft:function(e){return ea(e,function(e){return{from:st(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(r){return ea(r,function(e){var t=r.charCoords(e.head,"div").top+5;return{from:r.coordsChar({left:0,top:t},"div"),to:e.from()}})},delWrappedLineRight:function(n){return ea(n,function(e){var t=n.charCoords(e.head,"div").top+5,r=n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:t},"div");return{from:e.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(st(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(st(e.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return oa(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return aa(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy(function(e){return function(e,t){var r=et(e.doc,t),n=function(e){for(var t;t=qt(e);)e=t.find(1,!0).line;return e}(r);n!=r&&(t=it(n));return na(!0,e,r,t,-1)}(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(r){return r.extendSelectionsBy(function(e){var t=r.cursorCoords(e.head,"div").top+5;return r.coordsChar({left:r.display.lineDiv.offsetWidth+100,top:t},"div")},K)},goLineLeft:function(r){return r.extendSelectionsBy(function(e){var t=r.cursorCoords(e.head,"div").top+5;return r.coordsChar({left:0,top:t},"div")},K)},goLineLeftSmart:function(n){return n.extendSelectionsBy(function(e){var t=n.cursorCoords(e.head,"div").top+5,r=n.coordsChar({left:0,top:t},"div");return r.ch<n.getLine(r.line).search(/\S/)?aa(n,e.head):r},K)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"char")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),a=H(e.getLine(o.line),o.ch,n);t.push($(n-a%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(a){return ri(a,function(){for(var e=a.listSelections(),t=[],r=0;r<e.length;r++)if(e[r].empty()){var n=e[r].head,i=et(a.doc,n.line).text;if(i)if(n.ch==i.length&&(n=new st(n.line,n.ch-1)),0<n.ch)n=new st(n.line,n.ch+1),a.replaceRange(i.charAt(n.ch-1)+i.charAt(n.ch-2),st(n.line,n.ch-2),n,"+transpose");else if(n.line>a.doc.first){var o=et(a.doc,n.line-1).text;o&&(n=new st(n.line,1),a.replaceRange(i.charAt(0)+a.doc.lineSeparator()+o.charAt(o.length-1),st(n.line-1,o.length-1),n,"+transpose"))}t.push(new Li(n,n))}a.setSelections(t)})},newlineAndIndent:function(n){return ri(n,function(){for(var e=n.listSelections(),t=e.length-1;0<=t;t--)n.replaceRange(n.doc.lineSeparator(),e[t].anchor,e[t].head,"+input");e=n.listSelections();for(var r=0;r<e.length;r++)n.indentLine(e[r].from().line,null,!0);zn(n)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function oa(e,t){var r=et(e.doc,t),n=Vt(r);return n!=r&&(t=it(n)),na(!0,e,n,t,1)}function aa(e,t){var r=oa(e,t.line),n=et(e.doc,r.line),i=ye(n,e.doc.direction);if(i&&0!=i[0].level)return r;var o=Math.max(0,n.text.search(/\S/)),a=t.line==r.line&&t.ch<=o&&t.ch;return st(r.line,a?0:o,r.sticky)}function la(e,t,r){if("string"==typeof t&&!(t=ia[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)!=B}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}var sa=new I;function ca(e,t,r,n){var i=e.state.keySeq;if(i){if(Xo(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:sa.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ua(e,i+" "+t,r,n))return!0}return ua(e,t,r,n)}function ua(e,t,r,n){var i=function(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=Yo(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&Yo(t,e.options.extraKeys,r,e)||Yo(t,e.options.keyMap,r,e)}(e,t,n);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&pr(e,"keyHandled",e,t,r),"handled"!=i&&"multi"!=i||(Ae(r),Tn(e)),!!i}function da(t,e){var r=Jo(e,!0);return!!r&&(e.shiftKey&&!t.state.keySeq?ca(t,"Shift-"+r,e,function(e){return la(t,e,!0)})||ca(t,r,e,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return la(t,e)}):ca(t,r,e,function(e){return la(t,e)}))}var fa=null;function ha(e){if(this.curOp.focus=E(),!Se(this,e)){x&&k<11&&27==e.keyCode&&(e.returnValue=!1);var t=e.keyCode;this.display.shift=16==t||e.shiftKey;var r=da(this,e);g&&(fa=r?t:null,!r&&88==t&&!Be&&(w?e.metaKey:e.ctrlKey)&&this.replaceSelection("",null,"cut")),18!=t||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||function(e){var t=e.display.lineDiv;function r(e){18!=e.keyCode&&e.altKey||(L(t,"CodeMirror-crosshair"),ke(document,"keyup",r),ke(document,"mouseover",r))}D(t,"CodeMirror-crosshair"),we(document,"keyup",r),we(document,"mouseover",r)}(this)}}function pa(e){16==e.keyCode&&(this.doc.sel.shift=!1),Se(this,e)}function ma(e){if(!(Mr(this.display,e)||Se(this,e)||e.ctrlKey&&!e.altKey||w&&e.metaKey)){var t=e.keyCode,r=e.charCode;if(g&&t==fa)return fa=null,void Ae(e);if(!g||e.which&&!(e.which<10)||!da(this,e)){var n=String.fromCharCode(null==r?t:r);"\b"==n||function(t,e,r){return ca(t,"'"+r+"'",e,function(e){return la(t,e,!0)})}(this,e,n)||this.display.input.onKeyPress(e)}}}var ga,va,ya=function(e,t,r){this.time=e,this.pos=t,this.button=r};function ba(e){var t=this,r=t.display;if(!(Se(t,e)||r.activeTouch&&r.input.supportsTouch()))if(r.input.ensurePolled(),r.shift=e.shiftKey,Mr(r,e))b||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));else if(!ka(t,e)){var n=hn(t,e),i=De(e),o=n?function(e,t){var r=+new Date;return va&&va.compare(r,e,t)?(ga=va=null,"triple"):ga&&ga.compare(r,e,t)?(va=new ya(r,e,t),ga=null,"double"):(ga=new ya(r,e,t),va=null,"single")}(n,i):"single";window.focus(),1==i&&t.state.selectingText&&t.state.selectingText(e),n&&function(r,e,n,t,i){var o="Click";"double"==t?o="Double"+o:"triple"==t&&(o="Triple"+o);return ca(r,Zo(o=(1==e?"Left":2==e?"Middle":"Right")+o,i),i,function(e){if("string"==typeof e&&(e=ia[e]),!e)return!1;var t=!1;try{r.isReadOnly()&&(r.state.suppressEdits=!0),t=e(r,n)!=B}finally{r.state.suppressEdits=!1}return t})}(t,i,n,o,e)||(1==i?n?function(e,t,r,n){x?setTimeout(W(Ln,e),0):e.curOp.focus=E();var i,o=function(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(null==i.unit){var o=h?r.shiftKey&&r.metaKey:r.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}null!=i.extend&&!e.doc.extend||(i.extend=e.doc.extend||r.shiftKey);null==i.addNew&&(i.addNew=w?r.metaKey:r.ctrlKey);null==i.moveOnDrag&&(i.moveOnDrag=!(w?r.altKey:r.ctrlKey));return i}(e,r,n),a=e.doc.sel;e.options.dragDrop&&We&&!e.isReadOnly()&&"single"==r&&-1<(i=a.contains(t))&&(ct((i=a.ranges[i]).from(),t)<0||0<t.xRel)&&(0<ct(i.to(),t)||t.xRel<0)?function(t,r,n,i){var o=t.display,a=!1,l=ni(t,function(e){b&&(o.scroller.draggable=!1),t.state.draggingText=!1,ke(o.wrapper.ownerDocument,"mouseup",l),ke(o.wrapper.ownerDocument,"mousemove",s),ke(o.scroller,"dragstart",c),ke(o.scroller,"drop",l),a||(Ae(e),i.addNew||Zi(t.doc,n,null,null,i.extend),b||x&&9==k?setTimeout(function(){o.wrapper.ownerDocument.body.focus(),o.input.focus()},20):o.input.focus())}),s=function(e){a=a||10<=Math.abs(r.clientX-e.clientX)+Math.abs(r.clientY-e.clientY)},c=function(){return a=!0};b&&(o.scroller.draggable=!0);(t.state.draggingText=l).copy=!i.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop();we(o.wrapper.ownerDocument,"mouseup",l),we(o.wrapper.ownerDocument,"mousemove",s),we(o.scroller,"dragstart",c),we(o.scroller,"drop",l),Mn(t),setTimeout(function(){return o.input.focus()},20)}(e,n,t,o):function(g,e,v,y){var a=g.display,b=g.doc;Ae(e);var w,x,k=b.sel,t=k.ranges;y.addNew&&!y.extend?(x=b.sel.contains(v),w=-1<x?t[x]:new Li(v,v)):(w=b.sel.primary(),x=b.sel.primIndex);if("rectangle"==y.unit)y.addNew||(w=new Li(v,v)),v=hn(g,e,!0,!0),x=-1;else{var r=wa(g,v,y.unit);w=y.extend?Xi(w,r.anchor,r.head,y.extend):r}y.addNew?-1==x?(x=t.length,ro(b,Mi(g,t.concat([w]),x),{scroll:!1,origin:"*mouse"})):1<t.length&&t[x].empty()&&"char"==y.unit&&!y.extend?(ro(b,Mi(g,t.slice(0,x).concat(t.slice(x+1)),0),{scroll:!1,origin:"*mouse"}),k=b.sel):Qi(b,x,w,U):(ro(b,new Ti([w],x=0),U),k=b.sel);var C=v;function l(e){if(0!=ct(C,e))if(C=e,"rectangle"==y.unit){for(var t=[],r=g.options.tabSize,n=H(et(b,v.line).text,v.ch,r),i=H(et(b,e.line).text,e.ch,r),o=Math.min(n,i),a=Math.max(n,i),l=Math.min(v.line,e.line),s=Math.min(g.lastLine(),Math.max(v.line,e.line));l<=s;l++){var c=et(b,l).text,u=V(c,o,r);o==a?t.push(new Li(st(l,u),st(l,u))):c.length>u&&t.push(new Li(st(l,u),st(l,V(c,a,r))))}t.length||t.push(new Li(v,v)),ro(b,Mi(g,k.ranges.slice(0,x).concat(t),x),{origin:"*mouse",scroll:!1}),g.scrollIntoView(e)}else{var d,f=w,h=wa(g,e,y.unit),p=f.anchor;p=0<ct(h.anchor,p)?(d=h.head,ht(f.from(),h.anchor)):(d=h.anchor,ft(f.to(),h.head));var m=k.ranges.slice(0);m[x]=function(e,t){var r=t.anchor,n=t.head,i=et(e.doc,r.line);if(0==ct(r,n)&&r.sticky==n.sticky)return t;var o=ye(i);if(!o)return t;var a=se(o,r.ch,r.sticky),l=o[a];if(l.from!=r.ch&&l.to!=r.ch)return t;var s,c=a+(l.from==r.ch==(1!=l.level)?0:1);if(0==c||c==o.length)return t;if(n.line!=r.line)s=0<(n.line-r.line)*("ltr"==e.doc.direction?1:-1);else{var u=se(o,n.ch,n.sticky),d=u-a||(n.ch-r.ch)*(1==l.level?-1:1);s=u==c-1||u==c?d<0:0<d}var f=o[c+(s?-1:0)],h=s==(1==f.level),p=h?f.from:f.to,m=h?"after":"before";return r.ch==p&&r.sticky==m?t:new Li(new st(r.line,p,m),n)}(g,new Li(mt(b,p),d)),ro(b,Mi(g,m,x),U)}}var s=a.wrapper.getBoundingClientRect(),c=0;function n(e){g.state.selectingText=!1,c=1/0,e&&(Ae(e),a.input.focus()),ke(a.wrapper.ownerDocument,"mousemove",i),ke(a.wrapper.ownerDocument,"mouseup",o),b.history.lastSelOrigin=null}var i=ni(g,function(e){0!==e.buttons&&De(e)?function e(t){var r=++c;var n=hn(g,t,!0,"rectangle"==y.unit);if(!n)return;if(0!=ct(n,C)){g.curOp.focus=E(),l(n);var i=En(a,b);(n.line>=i.to||n.line<i.from)&&setTimeout(ni(g,function(){c==r&&e(t)}),150)}else{var o=t.clientY<s.top?-20:t.clientY>s.bottom?20:0;o&&setTimeout(ni(g,function(){c==r&&(a.scroller.scrollTop+=o,e(t))}),50)}}(e):n(e)}),o=ni(g,n);g.state.selectingText=o,we(a.wrapper.ownerDocument,"mousemove",i),we(a.wrapper.ownerDocument,"mouseup",o)}(e,n,t,o)}(t,n,o,e):Ee(e)==r.scroller&&Ae(e):2==i?(n&&Zi(t.doc,n),setTimeout(function(){return r.input.focus()},20)):3==i&&(C?t.display.input.onContextMenu(e):Mn(t)))}}function wa(e,t,r){if("char"==r)return new Li(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new Li(st(t.line,0),mt(e.doc,st(t.line+1,0)));var n=r(e,t);return new Li(n.from,n.to)}function xa(e,t,r,n){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&Ae(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!Le(e,r))return Ne(t);o-=l.top-a.viewOffset;for(var s=0;s<e.display.gutterSpecs.length;++s){var c=a.gutters.childNodes[s];if(c&&c.getBoundingClientRect().right>=i)return Ce(e,r,e,ot(e.doc,o),e.display.gutterSpecs[s].className,t),Ne(t)}}function ka(e,t){return xa(e,t,"gutterClick",!0)}function Ca(e,t){Mr(e.display,t)||function(e,t){return!!Le(e,"gutterContextMenu")&&xa(e,t,"gutterContextMenu",!1)}(e,t)||Se(e,t,"contextmenu")||C||e.display.input.onContextMenu(t)}function Sa(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Kr(e)}ya.prototype.compare=function(e,t,r){return this.time+400>e&&0==ct(t,this.pos)&&r==this.button};var Ta={toString:function(){return"CodeMirror.Init"}},La={},Ma={};function Aa(e,t,r){if(!t!=!(r&&r!=Ta)){var n=e.display.dragFunctions,i=t?we:ke;i(e.display.scroller,"dragstart",n.start),i(e.display.scroller,"dragenter",n.enter),i(e.display.scroller,"dragover",n.over),i(e.display.scroller,"dragleave",n.leave),i(e.display.scroller,"drop",n.drop)}}function Oa(e){e.options.lineWrapping?(D(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(L(e.display.wrapper,"CodeMirror-wrap"),Qt(e)),fn(e),mn(e),Kr(e),setTimeout(function(){return Kn(e)},100)}function Na(e,t){var r=this;if(!(this instanceof Na))return new Na(e,t);this.options=t=t?P(t):{},P(La,t,!1);var n=t.value;"string"==typeof n?n=new Fo(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new Na.inputStyles[t.inputStyle](this),o=this.display=new bi(e,n,i,t);for(var a in Sa(o.wrapper.CodeMirror=this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),$n(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 I,keySeq:null,specialChars:null},t.autofocus&&!f&&o.input.focus(),x&&k<11&&setTimeout(function(){return r.display.input.reset(!0)},20),function(i){var o=i.display;we(o.scroller,"mousedown",ni(i,ba)),we(o.scroller,"dblclick",x&&k<11?ni(i,function(e){if(!Se(i,e)){var t=hn(i,e);if(t&&!ka(i,e)&&!Mr(i.display,e)){Ae(e);var r=i.findWordAt(t);Zi(i.doc,r.anchor,r.head)}}}):function(e){return Se(i,e)||Ae(e)});we(o.scroller,"contextmenu",function(e){return Ca(i,e)});var r,n={end:0};function a(){o.activeTouch&&(r=setTimeout(function(){return o.activeTouch=null},1e3),(n=o.activeTouch).end=+new Date)}function l(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return 400<r*r+n*n}we(o.scroller,"touchstart",function(e){if(!Se(i,e)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(e)&&!ka(i,e)){o.input.ensurePolled(),clearTimeout(r);var t=+new Date;o.activeTouch={start:t,moved:!1,prev:t-n.end<=300?n:null},1==e.touches.length&&(o.activeTouch.left=e.touches[0].pageX,o.activeTouch.top=e.touches[0].pageY)}}),we(o.scroller,"touchmove",function(){o.activeTouch&&(o.activeTouch.moved=!0)}),we(o.scroller,"touchend",function(e){var t=o.activeTouch;if(t&&!Mr(o,e)&&null!=t.left&&!t.moved&&new Date-t.start<300){var r,n=i.coordsChar(o.activeTouch,"page");r=!t.prev||l(t,t.prev)?new Li(n,n):!t.prev.prev||l(t,t.prev.prev)?i.findWordAt(n):new Li(st(n.line,0),mt(i.doc,st(n.line+1,0))),i.setSelection(r.anchor,r.head),i.focus(),Ae(e)}a()}),we(o.scroller,"touchcancel",a),we(o.scroller,"scroll",function(){o.scroller.clientHeight&&(In(i,o.scroller.scrollTop),Rn(i,o.scroller.scrollLeft,!0),Ce(i,"scroll",i))}),we(o.scroller,"mousewheel",function(e){return Si(i,e)}),we(o.scroller,"DOMMouseScroll",function(e){return Si(i,e)}),we(o.wrapper,"scroll",function(){return o.wrapper.scrollTop=o.wrapper.scrollLeft=0}),o.dragFunctions={enter:function(e){Se(i,e)||_e(e)},over:function(e){Se(i,e)||(function(e,t){var r=hn(e,t);if(r){var n=document.createDocumentFragment();kn(e,r,n),e.display.dragCursor||(e.display.dragCursor=N("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),A(e.display.dragCursor,n)}}(i,e),_e(e))},start:function(e){return function(e,t){if(x&&(!e.state.draggingText||+new Date-zo<100))_e(t);else if(!Se(e,t)&&!Mr(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!s)){var r=N("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",g&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),g&&r.parentNode.removeChild(r)}}(i,e)},drop:ni(i,Wo),leave:function(e){Se(i,e)||Po(i)}};var e=o.input.getField();we(e,"keyup",function(e){return pa.call(i,e)}),we(e,"keydown",ni(i,ha)),we(e,"keypress",ni(i,ma)),we(e,"focus",function(e){return An(i,e)}),we(e,"blur",function(e){return On(i,e)})}(this),jo(),Xn(this),this.curOp.forceUpdate=!0,Hi(this,n),t.autofocus&&!f||this.hasFocus()?setTimeout(W(An,this),20):On(this),Ma)Ma.hasOwnProperty(a)&&Ma[a](r,t[a],Ta);mi(this),t.finishInit&&t.finishInit(this);for(var l=0;l<_a.length;++l)_a[l](r);Zn(this),b&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}Na.defaults=La,Na.optionHandlers=Ma;var _a=[];function Ea(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=xt(e,t).state:r="prev");var a=e.options.tabSize,l=et(o,t),s=H(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))==B||150<c)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?H(et(o,t-1).text,null,a):0:"add"==r?c=s+e.options.indentUnit:"subtract"==r?c=s-e.options.indentUnit:"number"==typeof r&&(c=s+r),c=Math.max(0,c);var d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h)f+=a,d+="\t";if(f<c&&(d+=$(c-f)),d!=u)return yo(o,d,st(t,0),st(t,u.length),"+input"),!(l.stateAfter=null);for(var p=0;p<o.sel.ranges.length;p++){var m=o.sel.ranges[p];if(m.head.line==t&&m.head.ch<u.length){var g=st(t,u.length);Qi(o,p,new Li(g,g));break}}}Na.defineInitHook=function(e){return _a.push(e)};var Da=null;function Fa(e){Da=e}function za(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var a=+new Date-200,l="paste"==i||e.state.pasteIncoming>a,s=je(t),c=null;if(l&&1<n.ranges.length)if(Da&&Da.text.join("\n")==t){if(n.ranges.length%Da.text.length==0){c=[];for(var u=0;u<Da.text.length;u++)c.push(o.splitLines(Da.text[u]))}}else s.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(c=X(s,function(e){return[e]}));for(var d=e.curOp.updateInput,f=n.ranges.length-1;0<=f;f--){var h=n.ranges[f],p=h.from(),m=h.to();h.empty()&&(r&&0<r?p=st(p.line,p.ch-r):e.state.overwrite&&!l?m=st(m.line,Math.min(et(o,m.line).text.length,m.ch+Y(s).length)):l&&Da&&Da.lineWise&&Da.text.join("\n")==t&&(p=m=st(p.line,0)));var g={from:p,to:m,text:c?c[f%c.length]:s,origin:i||(l?"paste":e.state.cutIncoming>a?"cut":"+input")};ho(e.doc,g),pr(e,"inputRead",e,g)}t&&!l&&Pa(e,t),zn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Wa(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||ri(t,function(){return za(t,r,0,null,"paste")}),!0}function Pa(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;0<=n;n--){var i=r.ranges[n];if(!(100<i.head.ch||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(-1<t.indexOf(o.electricChars.charAt(l))){a=Ea(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(et(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Ea(e,i.head.line,"smart"));a&&pr(e,"electricInput",e,i.head.line)}}}function Ha(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:st(i,0),head:st(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function Ia(e,t,r,n){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function ja(){var e=N("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=N("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return b?e.style.width="1000px":e.setAttribute("wrap","off"),u&&(e.style.border="1px solid black"),Ia(e),t}function Ra(r,n,i,e,o){var t=n,a=i,l=et(r,n.line);function s(e){var t;if(null==(t=o?function(t,r,l,e){var s=ye(r,t.doc.direction);if(!s)return ra(r,l,e);l.ch>=r.text.length?(l.ch=r.text.length,l.sticky="before"):l.ch<=0&&(l.ch=0,l.sticky="after");var n=se(s,l.ch,l.sticky),i=s[n];if("ltr"==t.doc.direction&&i.level%2==0&&(0<e?i.to>l.ch:i.from<l.ch))return ra(r,l,e);function c(e,t){return ta(r,e instanceof st?e.ch:e,t)}function o(e){return t.options.lineWrapping?(a=a||Pr(t,r),nn(t,r,a,e)):{begin:0,end:r.text.length}}var a,u=o("before"==l.sticky?c(l,-1):l.ch);if("rtl"==t.doc.direction||1==i.level){var d=1==i.level==e<0,f=c(l,d?1:-1);if(null!=f&&(d?f<=i.to&&f<=u.end:f>=i.from&&f>=u.begin)){var h=d?"before":"after";return new st(l.line,f,h)}}function p(e,t,r){for(var n=function(e,t){return t?new st(l.line,c(e,1),"before"):new st(l.line,e,"after")};0<=e&&e<s.length;e+=t){var i=s[e],o=0<t==(1!=i.level),a=o?r.begin:c(r.end,-1);if(i.from<=a&&a<i.to)return n(a,o);if(a=o?i.from:c(i.to,-1),r.begin<=a&&a<r.end)return n(a,o)}}var m=p(n+e,e,u);if(m)return m;var g=0<e?u.end:c(u.begin,-1);return null==g||0<e&&g==r.text.length||!(m=p(0<e?0:s.length-1,e,o(g)))?null:m}(r.cm,l,n,i):ra(l,n,i))){if(e||!function(){var e=n.line+i;return!(e<r.first||e>=r.first+r.size)&&(n=new st(e,n.ch,n.sticky),l=et(r,e))}())return!1;n=na(o,r.cm,l,n.line,i)}else n=t;return!0}if("char"==e)s();else if("column"==e)s(!0);else if("word"==e||"group"==e)for(var c=null,u="group"==e,d=r.cm&&r.cm.getHelper(n,"wordChars"),f=!0;!(i<0)||s(!f);f=!1){var h=l.text.charAt(n.ch)||"\n",p=te(h,d)?"w":u&&"\n"==h?"n":!u||/\s/.test(h)?null:"p";if(!u||f||p||(p="s"),c&&c!=p){i<0&&(i=1,s(),n.sticky="after");break}if(p&&(c=p),0<i&&!s(!f))break}var m=so(r,n,t,a,!0);return ut(t,m)&&(m.hitSide=!0),m}function Ba(e,t,r,n){var i,o,a=e.doc,l=t.left;if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),c=Math.max(s-.5*ln(e.display),3);i=(0<r?t.bottom:t.top)+r*c}else"line"==n&&(i=0<r?t.bottom+3:t.top-3);for(;(o=tn(e,l,i)).outside;){if(r<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*r}return o}function qa(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new I,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null}function Ua(e,t){var r=Wr(e,t.line);if(!r||r.hidden)return null;var n=et(e.doc,t.line),i=Fr(r,n,t.line),o=ye(n,e.doc.direction),a="left";o&&(a=se(o,t.ch)%2?"right":"left");var l=Rr(i.map,t.ch,a);return l.offset="right"==l.collapse?l.end:l.start,l}function Ka(e,t){return t&&(e.bad=!0),e}function Va(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return Ka(e.clipPos(st(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return Ga(o,t,r)}}function Ga(c,e,t){var r=c.text.firstChild,n=!1;if(!e||!_(r,e))return Ka(st(it(c.line),0),!0);if(e==r&&(n=!0,e=r.childNodes[t],t=0,!e)){var i=c.rest?Y(c.rest):c.line;return Ka(st(it(i),i.text.length),n)}var o=3==e.nodeType?e:null,a=e;for(o||1!=e.childNodes.length||3!=e.firstChild.nodeType||(o=e.firstChild,t&&(t=o.nodeValue.length));a.parentNode!=r;)a=a.parentNode;var u=c.measure,d=u.maps;function l(e,t,r){for(var n=-1;n<(d?d.length:0);n++)for(var i=n<0?u.map:d[n],o=0;o<i.length;o+=3){var a=i[o+2];if(a==e||a==t){var l=it(n<0?c.line:c.rest[n]),s=i[o]+r;return(r<0||a!=e)&&(s=i[o+(r?1:0)]),st(l,s)}}}var s=l(o,a,t);if(s)return Ka(s,n);for(var f=a.nextSibling,h=o?o.nodeValue.length-t:0;f;f=f.nextSibling){if(s=l(f,f.firstChild,0))return Ka(st(s.line,s.ch-h),n);h+=f.textContent.length}for(var p=a.previousSibling,m=t;p;p=p.previousSibling){if(s=l(p,p.firstChild,-1))return Ka(st(s.line,s.ch+m),n);m+=p.textContent.length}}qa.prototype.init=function(e){var t=this,a=this,l=a.cm,s=a.div=e.lineDiv;function r(e){if(!Se(l,e)){if(l.somethingSelected())Fa({lineWise:!1,text:l.getSelections()}),"cut"==e.type&&l.replaceSelection("",null,"cut");else{if(!l.options.lineWiseCopyCut)return;var t=Ha(l);Fa({lineWise:!0,text:t.text}),"cut"==e.type&&l.operation(function(){l.setSelections(t.ranges,0,q),l.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var r=Da.text.join("\n");if(e.clipboardData.setData("Text",r),e.clipboardData.getData("Text")==r)return void e.preventDefault()}var n=ja(),i=n.firstChild;l.display.lineSpace.insertBefore(n,l.display.lineSpace.firstChild),i.value=Da.text.join("\n");var o=document.activeElement;z(i),setTimeout(function(){l.display.lineSpace.removeChild(n),o.focus(),o==s&&a.showPrimarySelection()},50)}}Ia(s,l.options.spellcheck,l.options.autocorrect,l.options.autocapitalize),we(s,"paste",function(e){Se(l,e)||Wa(e,l)||k<=11&&setTimeout(ni(l,function(){return t.updateFromDOM()}),20)}),we(s,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),we(s,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),we(s,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),we(s,"touchstart",function(){return a.forceCompositionEnd()}),we(s,"input",function(){t.composing||t.readFromDOMSoon()}),we(s,"copy",r),we(s,"cut",r)},qa.prototype.prepareSelection=function(){var e=xn(this.cm,!1);return e.focus=this.cm.state.focused,e},qa.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},qa.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},qa.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),i=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||i.line<t.display.viewFrom)e.removeAllRanges();else{var o=Va(t,e.anchorNode,e.anchorOffset),a=Va(t,e.focusNode,e.focusOffset);if(!o||o.bad||!a||a.bad||0!=ct(ht(o,a),n)||0!=ct(ft(o,a),i)){var l=t.display.view,s=n.line>=t.display.viewFrom&&Ua(t,n)||{node:l[0].measure.map[2],offset:0},c=i.line<t.display.viewTo&&Ua(t,i);if(!c){var u=l[l.length-1].measure,d=u.maps?u.maps[u.maps.length-1]:u.map;c={node:d[d.length-1],offset:d[d.length-2]-d[d.length-3]}}if(s&&c){var f,h=e.rangeCount&&e.getRangeAt(0);try{f=T(s.node,s.offset,c.offset,c.node)}catch(e){}f&&(!m&&t.state.focused?(e.collapse(s.node,s.offset),f.collapsed||(e.removeAllRanges(),e.addRange(f))):(e.removeAllRanges(),e.addRange(f)),h&&null==e.anchorNode?e.addRange(h):m&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},qa.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},qa.prototype.showMultipleSelections=function(e){A(this.cm.display.cursorDiv,e.cursors),A(this.cm.display.selectionDiv,e.selection)},qa.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},qa.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return _(this.div,t)},qa.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},qa.prototype.blur=function(){this.div.blur()},qa.prototype.getField=function(){return this.div},qa.prototype.supportsTouch=function(){return!0},qa.prototype.receivedFocus=function(){var t=this;this.selectionInEditor()?this.pollSelection():ri(this.cm,function(){return t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))})},qa.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},qa.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(d&&a&&this.cm.display.gutterSpecs.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var r=Va(t,e.anchorNode,e.anchorOffset),n=Va(t,e.focusNode,e.focusOffset);r&&n&&ri(t,function(){ro(t.doc,Ai(r,n),q),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}}},qa.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,r,n=this.cm,i=n.display,o=n.doc.sel.primary(),a=o.from(),l=o.to();if(0==a.ch&&a.line>n.firstLine()&&(a=st(a.line-1,et(n.doc,a.line-1).length)),l.ch==et(n.doc,l.line).text.length&&l.line<n.lastLine()&&(l=st(l.line+1,0)),a.line<i.viewFrom||l.line>i.viewTo-1)return!1;r=a.line==i.viewFrom||0==(e=pn(n,a.line))?(t=it(i.view[0].line),i.view[0].node):(t=it(i.view[e].line),i.view[e-1].node.nextSibling);var s,c,u=pn(n,l.line);if(c=u==i.view.length-1?(s=i.viewTo-1,i.lineDiv.lastChild):(s=it(i.view[u+1].line)-1,i.view[u+1].node.previousSibling),!r)return!1;for(var d=n.doc.splitLines(function(l,e,t,s,c){var r="",u=!1,d=l.doc.lineSeparator(),f=!1;function h(){u&&(r+=d,f&&(r+=d),u=f=!1)}function p(e){e&&(h(),r+=e)}function m(e){if(1==e.nodeType){var t=e.getAttribute("cm-text");if(t)return void p(t);var r,n=e.getAttribute("cm-marker");if(n){var i=l.findMarks(st(s,0),st(c+1,0),function(t){return function(e){return e.id==t}}(+n));return void(i.length&&(r=i[0].find(0))&&p(tt(l.doc,r.from,r.to).join(d)))}if("false"==e.getAttribute("contenteditable"))return;var o=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&0==e.textContent.length)return;o&&h();for(var a=0;a<e.childNodes.length;a++)m(e.childNodes[a]);/^(pre|p)$/i.test(e.nodeName)&&(f=!0),o&&(u=!0)}else 3==e.nodeType&&p(e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;m(e),e!=t;)e=e.nextSibling,f=!1;return r}(n,r,c,t,s)),f=tt(n.doc,st(t,0),st(s,et(n.doc,s).text.length));1<d.length&&1<f.length;)if(Y(d)==Y(f))d.pop(),f.pop(),s--;else{if(d[0]!=f[0])break;d.shift(),f.shift(),t++}for(var h=0,p=0,m=d[0],g=f[0],v=Math.min(m.length,g.length);h<v&&m.charCodeAt(h)==g.charCodeAt(h);)++h;for(var y=Y(d),b=Y(f),w=Math.min(y.length-(1==d.length?h:0),b.length-(1==f.length?h:0));p<w&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;if(1==d.length&&1==f.length&&t==a.line)for(;h&&h>a.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)h--,p++;d[d.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),d[0]=d[0].slice(h).replace(/\u200b+$/,"");var x=st(t,h),k=st(s,f.length?Y(f).length-p:0);return 1<d.length||d[0]||ct(x,k)?(yo(n.doc,d,x,k,"+input"),!0):void 0},qa.prototype.ensurePolled=function(){this.forceCompositionEnd()},qa.prototype.reset=function(){this.forceCompositionEnd()},qa.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},qa.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},qa.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||ri(this.cm,function(){return mn(e.cm)})},qa.prototype.setUneditable=function(e){e.contentEditable="false"},qa.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||ni(this.cm,za)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},qa.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},qa.prototype.onContextMenu=function(){},qa.prototype.resetPosition=function(){},qa.prototype.needsContentAttribute=!0;function $a(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new I,this.hasSelection=!1,this.composing=null}var Ya,Xa,Za,Ja,Qa;function el(e,t,n,r){Ya.defaults[e]=t,n&&(Xa[e]=r?function(e,t,r){r!=Ta&&n(e,t,r)}:n)}$a.prototype.init=function(r){var e=this,n=this,i=this.cm;this.createField(r);var o=this.textarea;function t(e){if(!Se(i,e)){if(i.somethingSelected())Fa({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=Ha(i);Fa({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,q):(n.prevInput="",o.value=t.text.join("\n"),z(o))}"cut"==e.type&&(i.state.cutIncoming=+new Date)}}r.wrapper.insertBefore(this.wrapper,r.wrapper.firstChild),u&&(o.style.width="0px"),we(o,"input",function(){x&&9<=k&&e.hasSelection&&(e.hasSelection=null),n.poll()}),we(o,"paste",function(e){Se(i,e)||Wa(e,i)||(i.state.pasteIncoming=+new Date,n.fastPoll())}),we(o,"cut",t),we(o,"copy",t),we(r.scroller,"paste",function(e){if(!Mr(r,e)&&!Se(i,e)){if(!o.dispatchEvent)return i.state.pasteIncoming=+new Date,void n.focus();var t=new Event("paste");t.clipboardData=e.clipboardData,o.dispatchEvent(t)}}),we(r.lineSpace,"selectstart",function(e){Mr(r,e)||Ae(e)}),we(o,"compositionstart",function(){var e=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}}),we(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},$a.prototype.createField=function(e){this.wrapper=ja(),this.textarea=this.wrapper.firstChild},$a.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=xn(e);if(e.options.moveInputWithCursor){var i=Jr(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},$a.prototype.showSelection=function(e){var t=this.cm.display;A(t.cursorDiv,e.cursors),A(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},$a.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&z(this.textarea),x&&9<=k&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",x&&9<=k&&(this.hasSelection=null))}},$a.prototype.getField=function(){return this.textarea},$a.prototype.supportsTouch=function(){return!1},$a.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!f||E()!=this.textarea))try{this.textarea.focus()}catch(e){}},$a.prototype.blur=function(){this.textarea.blur()},$a.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},$a.prototype.receivedFocus=function(){this.slowPoll()},$a.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},$a.prototype.fastPoll=function(){var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,function e(){r.poll()||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))})},$a.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||Re(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(x&&9<=k&&this.hasSelection===i||w&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||n||(n=""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var a=0,l=Math.min(n.length,i.length);a<l&&n.charCodeAt(a)==i.charCodeAt(a);)++a;return ri(t,function(){za(t,i.slice(a),n.length-a,null,e.composing?"*compose":null),1e3<i.length||-1<i.indexOf("\n")?r.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},$a.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},$a.prototype.onKeyPress=function(){x&&9<=k&&(this.hasSelection=null),this.fastPoll()},$a.prototype.onContextMenu=function(e){var r=this,n=r.cm,i=n.display,o=r.textarea;r.contextMenuPending&&r.contextMenuPending();var t=hn(n,e),a=i.scroller.scrollTop;if(t&&!g){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(t)&&ni(n,ro)(n.doc,Ai(t),q);var l,s=o.style.cssText,c=r.wrapper.style.cssText,u=r.wrapper.offsetParent.getBoundingClientRect();if(r.wrapper.style.cssText="position: static",o.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-u.top-5)+"px; left: "+(e.clientX-u.left-5)+"px;\n z-index: 1000; background: "+(x?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",b&&(l=window.scrollY),i.input.focus(),b&&window.scrollTo(null,l),i.input.reset(),n.somethingSelected()||(o.value=r.prevInput=" "),r.contextMenuPending=h,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll),x&&9<=k&&f(),C){_e(e);var d=function(){ke(window,"mouseup",d),setTimeout(h,20)};we(window,"mouseup",d)}else setTimeout(h,50)}function f(){if(null!=o.selectionStart){var e=n.somethingSelected(),t=""+(e?o.value:"");o.value="⇚",o.value=t,r.prevInput=e?"":"",o.selectionStart=1,o.selectionEnd=t.length,i.selForContextMenu=n.doc.sel}}function h(){if(r.contextMenuPending==h&&(r.contextMenuPending=!1,r.wrapper.style.cssText=c,o.style.cssText=s,x&&k<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=a),null!=o.selectionStart)){(!x||x&&k<9)&&f();var e=0,t=function(){i.selForContextMenu==n.doc.sel&&0==o.selectionStart&&0<o.selectionEnd&&""==r.prevInput?ni(n,uo)(n):e++<10?i.detectingSelectAll=setTimeout(t,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(t,200)}}},$a.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},$a.prototype.setUneditable=function(){},$a.prototype.needsContentAttribute=!1,Xa=(Ya=Na).optionHandlers,Ya.defineOption=el,Ya.Init=Ta,el("value","",function(e,t){return e.setValue(t)},!0),el("mode",null,function(e,t){e.doc.modeOption=t,Di(e)},!0),el("indentUnit",2,Di,!0),el("indentWithTabs",!1),el("smartIndent",!0),el("tabSize",4,function(e){Fi(e),Kr(e),mn(e)},!0),el("lineSeparator",null,function(e,n){if(e.doc.lineSep=n){var i=[],o=e.doc.first;e.doc.iter(function(e){for(var t=0;;){var r=e.text.indexOf(n,t);if(-1==r)break;t=r+n.length,i.push(st(o,r))}o++});for(var t=i.length-1;0<=t;t--)yo(e.doc,n,i[t],st(i[t].line,i[t].ch+n.length))}}),el("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=Ta&&e.refresh()}),el("specialCharPlaceholder",or,function(e){return e.refresh()},!0),el("electricChars",!0),el("inputStyle",f?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),el("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),el("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),el("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),el("rtlMoveVisually",!p),el("wholeLineUpdateBefore",!0),el("theme","default",function(e){Sa(e),yi(e)},!0),el("keyMap","default",function(e,t,r){var n=Qo(t),i=r!=Ta&&Qo(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)}),el("extraKeys",null),el("configureMouse",null),el("lineWrapping",!1,Oa,!0),el("gutters",[],function(e,t){e.display.gutterSpecs=gi(t,e.options.lineNumbers),yi(e)},!0),el("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?un(e.display)+"px":"0",e.refresh()},!0),el("coverGutterNextToScrollbar",!1,function(e){return Kn(e)},!0),el("scrollbarStyle","native",function(e){$n(e),Kn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),el("lineNumbers",!1,function(e,t){e.display.gutterSpecs=gi(e.options.gutters,t),yi(e)},!0),el("firstLineNumber",1,yi,!0),el("lineNumberFormatter",function(e){return e},yi,!0),el("showCursorWhenSelecting",!1,wn,!0),el("resetSelectionOnContextMenu",!0),el("lineWiseCopyCut",!0),el("pasteLinesPerSelection",!0),el("selectionsMayTouch",!1),el("readOnly",!1,function(e,t){"nocursor"==t&&(On(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),el("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),el("dragDrop",!0,Aa),el("allowDropFileTypes",null),el("cursorBlinkRate",530),el("cursorScrollMargin",0),el("cursorHeight",1,wn,!0),el("singleCursorHeightPerLine",!0,wn,!0),el("workTime",100),el("workDelay",100),el("flattenSpans",!0,Fi,!0),el("addModeClass",!1,Fi,!0),el("pollInterval",100),el("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),el("historyEventDelay",1250),el("viewportMargin",10,function(e){return e.refresh()},!0),el("maxHighlightLength",1e4,Fi,!0),el("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),el("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),el("autofocus",null),el("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),el("phrases",null),Ja=(Za=Na).optionHandlers,Qa=Za.helpers={},Za.prototype={constructor:Za,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,Ja.hasOwnProperty(e)&&ni(this,Ja[e])(this,t,n),Ce(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Qo(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:ii(function(e,t){var r=e.token?e:Za.getMode(this.options,e);if(r.startState)throw new Error("Overlays may not be stateful.");!function(e,t,r){for(var n=0,i=r(t);n<e.length&&r(e[n])<=i;)n++;e.splice(n,0,t)}(this.state.overlays,{mode:r,modeSpec:e,opaque:t&&t.opaque,priority:t&&t.priority||0},function(e){return e.priority}),this.state.modeGen++,mn(this)}),removeOverlay:ii(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 mn(this)}}),indentLine:ii(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),at(this.doc,e)&&Ea(this,e,t,r)}),indentSelection:ii(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&&(Ea(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&zn(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)Ea(this,s,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&0<c[n].from().ch&&Qi(this.doc,n,new Li(o,c[n].to()),q)}}}),getTokenAt:function(e,t){return Lt(this,e,t)},getLineTokens:function(e,t){return Lt(this,st(e),t,!0)},getTokenTypeAt:function(e){e=mt(this.doc,e);var t,r=wt(this,et(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=1+a}}var l=t?t.indexOf("overlay "):-1;return l<0?t:0==l?null:t.slice(0,l-1)},getModeAt:function(e){var t=this.doc.mode;return t.innerMode?Za.innerMode(t,this.getTokenAt(e).state).mode:t},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!Qa.hasOwnProperty(t))return r;var n=Qa[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 l=0;l<n._global.length;l++){var s=n._global[l];s.pred(i,this)&&-1==j(r,s.val)&&r.push(s.val)}return r},getStateAfter:function(e,t){var r=this.doc;return xt(this,(e=pt(r,null==e?r.first+r.size-1:e))+1,t).state},cursorCoords:function(e,t){var r=this.doc.sel.primary();return Jr(this,null==e?r.head:"object"==typeof e?mt(this.doc,e):e?r.from():r.to(),t||"page")},charCoords:function(e,t){return Zr(this,mt(this.doc,e),t||"page")},coordsChar:function(e,t){return tn(this,(e=Xr(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Xr(this,{top:e,left:0},t||"page").top,ot(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,r){var n,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:o<e&&(e=o,i=!0),n=et(this.doc,e)}else n=e;return Yr(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-Zt(n):0)},defaultTextHeight:function(){return ln(this.display)},defaultCharWidth:function(){return sn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display,a=(e=Jr(this,mt(this.doc,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&&function(e,t){var r=Dn(e,t);null!=r.scrollTop&&In(e,r.scrollTop),null!=r.scrollLeft&&Rn(e,r.scrollLeft)}(this,{left:l,top:a,right:l+t.offsetWidth,bottom:a+t.offsetHeight})},triggerOnKeyDown:ii(ha),triggerOnKeyPress:ii(ma),triggerOnKeyUp:pa,triggerOnMouseDown:ii(ba),execCommand:function(e){if(ia.hasOwnProperty(e))return ia[e].call(null,this)},triggerElectric:ii(function(e){Pa(this,e)}),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=mt(this.doc,e),a=0;a<t&&!(o=Ra(this.doc,o,i,r,n)).hitSide;++a);return o},moveH:ii(function(t,r){var n=this;this.extendSelectionsBy(function(e){return n.display.shift||n.doc.extend||e.empty()?Ra(n.doc,e.head,t,r,n.options.rtlMoveVisually):t<0?e.from():e.to()},K)}),deleteH:ii(function(r,n){var e=this.doc.sel,i=this.doc;e.somethingSelected()?i.replaceSelection("",null,"+delete"):ea(this,function(e){var t=Ra(i,e.head,r,n,!1);return r<0?{from:t,to:e.head}:{from:e.head,to:t}})}),findPosV:function(e,t,r,n){var i=1,o=n;t<0&&(i=-1,t=-t);for(var a=mt(this.doc,e),l=0;l<t;++l){var s=Jr(this,a,"div");if(null==o?o=s.left:s.left=o,(a=Ba(this,s,i,r)).hitSide)break}return a},moveV:ii(function(n,i){var o=this,a=this.doc,l=[],s=!this.display.shift&&!a.extend&&a.sel.somethingSelected();if(a.extendSelectionsBy(function(e){if(s)return n<0?e.from():e.to();var t=Jr(o,e.head,"div");null!=e.goalColumn&&(t.left=e.goalColumn),l.push(t.left);var r=Ba(o,t,n,i);return"page"==i&&e==a.sel.primary()&&Fn(o,Zr(o,r,"div").top-t.top),r},K),l.length)for(var e=0;e<a.sel.ranges.length;e++)a.sel.ranges[e].goalColumn=l[e]}),findWordAt:function(e){var t=et(this.doc,e.line).text,r=e.ch,n=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&n!=t.length||!r?++n:--r;for(var o=t.charAt(r),a=te(o,i)?function(e){return te(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!te(e)};0<r&&a(t.charAt(r-1));)--r;for(;n<t.length&&a(t.charAt(n));)++n}return new Li(st(e.line,r),st(e.line,n))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?D(this.display.cursorDiv,"CodeMirror-overwrite"):L(this.display.cursorDiv,"CodeMirror-overwrite"),Ce(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==E()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ii(function(e,t){Wn(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-_r(this)-this.display.barHeight,width:e.scrollWidth-_r(this)-this.display.barWidth,clientHeight:Dr(this),clientWidth:Er(this)}},scrollIntoView:ii(function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:st(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?function(e,t){Pn(e),e.curOp.scrollToPos=t}(this,e):Hn(this,e.from,e.to,e.margin)}),setSize:ii(function(e,t){function r(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}var n=this;null!=e&&(this.display.wrapper.style.width=r(e)),null!=t&&(this.display.wrapper.style.height=r(t)),this.options.lineWrapping&&Ur(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){gn(n,i,"widget");break}++i}),this.curOp.forceUpdate=!0,Ce(this,"refresh",this)}),operation:function(e){return ri(this,e)},startOperation:function(){return Xn(this)},endOperation:function(){return Zn(this)},refresh:ii(function(){var e=this.display.cachedTextHeight;mn(this),this.curOp.forceUpdate=!0,Kr(this),Wn(this,this.doc.scrollLeft,this.doc.scrollTop),fi(this.display),(null==e||.5<Math.abs(e-ln(this.display)))&&fn(this),Ce(this,"refresh",this)}),swapDoc:ii(function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Hi(this,e),Kr(this),this.display.input.reset(),Wn(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,pr(this,"swapDoc",this,t),t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Me(Za),Za.registerHelper=function(e,t,r){Qa.hasOwnProperty(e)||(Qa[e]=Za[e]={_global:[]}),Qa[e][t]=r},Za.registerGlobalHelper=function(e,t,r,n){Za.registerHelper(e,t,n),Qa[e]._global.push({pred:r,val:n})};var tl,rl="iter insert remove copy getEditor constructor".split(" ");for(var nl in Fo.prototype)Fo.prototype.hasOwnProperty(nl)&&j(rl,nl)<0&&(Na.prototype[nl]=function(e){return function(){return e.apply(this.doc,arguments)}}(Fo.prototype[nl]));return Me(Fo),Na.inputStyles={textarea:$a,contenteditable:qa},Na.defineMode=function(e){Na.defaults.mode||"null"==e||(Na.defaults.mode=e),function(e,t){2<arguments.length&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ue[e]=t}.apply(this,arguments)},Na.defineMIME=function(e,t){Ke[e]=t},Na.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Na.defineMIME("text/plain","null"),Na.defineExtension=function(e,t){Na.prototype[e]=t},Na.defineDocExtension=function(e,t){Fo.prototype[e]=t},Na.fromTextArea=function(t,e){if((e=e?P(e):{}).value=t.value,!e.tabindex&&t.tabIndex&&(e.tabindex=t.tabIndex),!e.placeholder&&t.placeholder&&(e.placeholder=t.placeholder),null==e.autofocus){var r=E();e.autofocus=r==t||null!=t.getAttribute("autofocus")&&r==document.body}function n(){t.value=l.getValue()}var i;if(t.form&&(we(t.form,"submit",n),!e.leaveSubmitMethodAlone)){var o=t.form;i=o.submit;try{var a=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=a}}catch(e){}}e.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&&(ke(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=i))}},t.style.display="none";var l=Na(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},e);return l},(tl=Na).off=ke,tl.on=we,tl.wheelEventPixels=Ci,tl.Doc=Fo,tl.splitLines=je,tl.countColumn=H,tl.findColumn=V,tl.isWordChar=ee,tl.Pass=B,tl.signal=Ce,tl.Line=er,tl.changeEnd=Oi,tl.scrollbarModel=Gn,tl.Pos=st,tl.cmpPos=ct,tl.modes=Ue,tl.mimeModes=Ke,tl.resolveMode=Ve,tl.getMode=Ge,tl.modeExtensions=$e,tl.extendMode=Ye,tl.copyState=Xe,tl.startState=Je,tl.innerMode=Ze,tl.commands=ia,tl.keyMap=Vo,tl.keyName=Jo,tl.isModifierKey=Xo,tl.lookupKey=Yo,tl.normalizeKeyMap=$o,tl.StringStream=Qe,tl.SharedTextMarker=No,tl.TextMarker=Ao,tl.LineWidget=To,tl.e_preventDefault=Ae,tl.e_stopPropagation=Oe,tl.e_stop=_e,tl.addClass=D,tl.contains=_,tl.rmClass=L,tl.keyNames=Bo,Na.version="5.47.0",Na},"object"==typeof r&&void 0!==t?t.exports=i():"function"==typeof o&&o.amd?o(i):n.CodeMirror=i()},{}],18:[function(e,t,r){var n;n=function(N){"use strict";function e(e){for(var t={},r=0;r<e.length;++r)t[e[r].toLowerCase()]=!0;return t}N.defineMode("css",function(e,t){var r=t.inline;t.propertyKeywords||(t=N.resolveMode("text/css"));var n,i,o=e.indentUnit,a=t.tokenHooks,l=t.documentTypes||{},s=t.mediaTypes||{},c=t.mediaFeatures||{},u=t.mediaValueKeywords||{},d=t.propertyKeywords||{},f=t.nonStandardPropertyKeywords||{},h=t.fontProperties||{},p=t.counterDescriptors||{},m=t.colorKeywords||{},g=t.valueKeywords||{},v=t.allowNested,y=t.lineComment,b=!0===t.supportsAtComponent;function w(e,t){return n=t,e}function x(i){return function(e,t){for(var r,n=!1;null!=(r=e.next());){if(r==i&&!n){")"==i&&e.backUp(1);break}n=!n&&"\\"==r}return r!=i&&(n||")"==i)||(t.tokenize=null),w("string","string")}}function k(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=x(")"),w(null,"(")}function C(e,t,r){this.type=e,this.indent=t,this.prev=r}function S(e,t,r,n){return e.context=new C(r,t.indentation()+(!1===n?0:o),e.context),r}function T(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function L(e,t,r){return O[r.context.type](e,t,r)}function M(e,t,r,n){for(var i=n||1;0<i;i--)r.context=r.context.prev;return L(e,t,r)}function A(e){var t=e.current().toLowerCase();i=g.hasOwnProperty(t)?"atom":m.hasOwnProperty(t)?"keyword":"variable"}var O={top:function(e,t,r){if("{"==e)return S(r,t,"block");if("}"==e&&r.context.prev)return T(r);if(b&&/@component/i.test(e))return S(r,t,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return S(r,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return S(r,t,"atBlock");if(/^@(font-face|counter-style)/i.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return S(r,t,"at");if("hash"==e)i="builtin";else if("word"==e)i="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return S(r,t,"interpolation");if(":"==e)return"pseudo";if(v&&"("==e)return S(r,t,"parens")}return r.context.type},block:function(e,t,r){if("word"!=e)return"meta"==e?"block":v||"hash"!=e&&"qualifier"!=e?O.top(e,t,r):(i="error","block");var n=t.current().toLowerCase();return d.hasOwnProperty(n)?(i="property","maybeprop"):f.hasOwnProperty(n)?(i="string-2","maybeprop"):v?(i=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(i+=" error","maybeprop")},maybeprop:function(e,t,r){return":"==e?S(r,t,"prop"):L(e,t,r)},prop:function(e,t,r){if(";"==e)return T(r);if("{"==e&&v)return S(r,t,"propBlock");if("}"==e||"{"==e)return M(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)A(t);else if("interpolation"==e)return S(r,t,"interpolation")}else i+=" error";return"prop"},propBlock:function(e,t,r){return"}"==e?T(r):"word"==e?(i="property","maybeprop"):r.context.type},parens:function(e,t,r){return"{"==e||"}"==e?M(e,t,r):")"==e?T(r):"("==e?S(r,t,"parens"):"interpolation"==e?S(r,t,"interpolation"):("word"==e&&A(t),"parens")},pseudo:function(e,t,r){return"meta"==e?"pseudo":"word"==e?(i="variable-3",r.context.type):L(e,t,r)},documentTypes:function(e,t,r){return"word"==e&&l.hasOwnProperty(t.current())?(i="tag",r.context.type):O.atBlock(e,t,r)},atBlock:function(e,t,r){if("("==e)return S(r,t,"atBlock_parens");if("}"==e||";"==e)return M(e,t,r);if("{"==e)return T(r)&&S(r,t,v?"block":"top");if("interpolation"==e)return S(r,t,"interpolation");if("word"==e){var n=t.current().toLowerCase();i="only"==n||"not"==n||"and"==n||"or"==n?"keyword":s.hasOwnProperty(n)?"attribute":c.hasOwnProperty(n)?"property":u.hasOwnProperty(n)?"keyword":d.hasOwnProperty(n)?"property":f.hasOwnProperty(n)?"string-2":g.hasOwnProperty(n)?"atom":m.hasOwnProperty(n)?"keyword":"error"}return r.context.type},atComponentBlock:function(e,t,r){return"}"==e?M(e,t,r):"{"==e?T(r)&&S(r,t,v?"block":"top",!1):("word"==e&&(i="error"),r.context.type)},atBlock_parens:function(e,t,r){return")"==e?T(r):"{"==e||"}"==e?M(e,t,r,2):O.atBlock(e,t,r)},restricted_atBlock_before:function(e,t,r){return"{"==e?S(r,t,"restricted_atBlock"):"word"==e&&"@counter-style"==r.stateArg?(i="variable","restricted_atBlock_before"):L(e,t,r)},restricted_atBlock:function(e,t,r){return"}"==e?(r.stateArg=null,T(r)):"word"==e?(i="@font-face"==r.stateArg&&!h.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==r.stateArg&&!p.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},keyframes:function(e,t,r){return"word"==e?(i="variable","keyframes"):"{"==e?S(r,t,"top"):L(e,t,r)},at:function(e,t,r){return";"==e?T(r):"{"==e||"}"==e?M(e,t,r):("word"==e?i="tag":"hash"==e&&(i="builtin"),"at")},interpolation:function(e,t,r){return"}"==e?T(r):"{"==e||";"==e?M(e,t,r):("word"==e?i="variable":"variable"!=e&&"("!=e&&")"!=e&&(i="error"),"interpolation")}};return{startState:function(e){return{tokenize:null,state:r?"block":"top",stateArg:null,context:new C(r?"block":"top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||function(e,t){var r=e.next();if(a[r]){var n=a[r](e,t);if(!1!==n)return n}return"@"==r?(e.eatWhile(/[\w\\\-]/),w("def",e.current())):"="==r||("~"==r||"|"==r)&&e.eat("=")?w(null,"compare"):'"'==r||"'"==r?(t.tokenize=x(r),t.tokenize(e,t)):"#"==r?(e.eatWhile(/[\w\\\-]/),w("atom","hash")):"!"==r?(e.match(/^\s*\w*/),w("keyword","important")):/\d/.test(r)||"."==r&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),w("number","unit")):"-"!==r?/[,+>*\/]/.test(r)?w(null,"select-op"):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?w("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?w(null,r):e.match(/[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/.test(e.current().toLowerCase())&&(t.tokenize=k),w("variable callee","variable")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),w("property","word")):w(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),w("number","unit")):e.match(/^-[\w\\\-]*/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?w("variable-2","variable-definition"):w("variable-2","variable")):e.match(/^\w+-/)?w("meta","meta"):void 0})(e,t);return r&&"object"==typeof r&&(n=r[1],r=r[0]),i=r,"comment"!=n&&(t.state=O[t.state](n,e,t)),i},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-o)):i=(r=r.prev).indent),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:y,fold:"brace"}});var t=["domain","regexp","url","url-prefix"],r=e(t),n=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],i=e(n),o=["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"],a=e(o),l=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],s=e(l),c=["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","caret-color","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","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","justify-items","justify-self","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","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","mix-blend-mode","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","place-content","place-items","place-self","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","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","user-select","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","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"],u=e(c),d=["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"],f=e(d),h=e(["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]),p=e(["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"]),m=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],g=e(m),v=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","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","opacity","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","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unset","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"],y=e(v),b=t.concat(n).concat(o).concat(l).concat(c).concat(d).concat(m).concat(v);function w(e,t){for(var r,n=!1;null!=(r=e.next());){if(n&&"/"==r){t.tokenize=null;break}n="*"==r}return["comment","comment"]}N.registerHelper("hintWords","css",b),N.defineMIME("text/css",{documentTypes:r,mediaTypes:i,mediaFeatures:a,mediaValueKeywords:s,propertyKeywords:u,nonStandardPropertyKeywords:f,fontProperties:h,counterDescriptors:p,colorKeywords:g,valueKeywords:y,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=w)(e,t)}},name:"css"}),N.defineMIME("text/x-scss",{mediaTypes:i,mediaFeatures:a,mediaValueKeywords:s,propertyKeywords:u,nonStandardPropertyKeywords:f,colorKeywords:g,valueKeywords:y,fontProperties:h,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=w)(e,t):["operator","operator"]},":":function(e){return!!e.match(/\s*\{/,!1)&&[null,null]},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return!!e.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),N.defineMIME("text/x-less",{mediaTypes:i,mediaFeatures:a,mediaValueKeywords:s,propertyKeywords:u,nonStandardPropertyKeywords:f,colorKeywords:g,valueKeywords:y,fontProperties:h,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=w)(e,t):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:!e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i,!1)&&(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),N.defineMIME("text/x-gss",{documentTypes:r,mediaTypes:i,mediaFeatures:a,propertyKeywords:u,nonStandardPropertyKeywords:f,fontProperties:h,counterDescriptors:p,colorKeywords:g,valueKeywords:y,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=w)(e,t)}},name:"css",helperType:"gss"})},"object"==typeof r&&"object"==typeof t?n(e("../../lib/codemirror")):"function"==typeof o&&o.amd?o(["../../lib/codemirror"],n):n(CodeMirror)},{"../../lib/codemirror":17}],19:[function(e,t,r){var n;n=function(p){"use strict";var i={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]};var n={};function m(e,t){var r=e.match(function(e){var t=n[e];return t||(n[e]=new RegExp("\\s+"+e+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*"))}(t));return r?/^\s*(.*?)\s*$/.exec(r[2])[1]:""}function g(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;0<=o;o--)n.unshift(i[o])}p.defineMode("htmlmixed",function(u,e){var d=p.getMode(u,{name:"xml",htmlMode:!0,multilineTagIndentFactor:e.multilineTagIndentFactor,multilineTagIndentPastTag:e.multilineTagIndentPastTag}),f={},t=e&&e.tags,r=e&&e.scriptTypes;if(o(i,f),t&&o(t,f),r)for(var n=r.length-1;0<=n;n--)f.script.unshift(["type",r[n].matches,r[n].mode]);function h(e,t){var r,n=d.token(e,t.htmlState),i=/\btag\b/.test(n);if(i&&!/[<>\s\/]/.test(e.current())&&(r=t.htmlState.tagName&&t.htmlState.tagName.toLowerCase())&&f.hasOwnProperty(r))t.inTag=r+" ";else if(t.inTag&&i&&/>$/.test(e.current())){var o=/^([\S]+) (.*)/.exec(t.inTag);t.inTag=null;var a=">"==e.current()&&function(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(!n[0]||n[1].test(m(t,n[0])))return n[2]}}(f[o[1]],o[2]),l=p.getMode(u,a),s=g(o[1],!0),c=g(o[1],!1);t.token=function(e,t){return e.match(s,!1)?(t.token=h,t.localState=t.localMode=null,null):function(e,t,r){var n=e.current(),i=n.search(t);return-1<i?e.backUp(n.length-i):n.match(/<\/?$/)&&(e.backUp(n.length),e.match(t,!1)||e.match(n)),r}(e,c,t.localMode.token(e,t.localState))},t.localMode=l,t.localState=p.startState(l,d.indent(t.htmlState,"",""))}else t.inTag&&(t.inTag+=e.current(),e.eol()&&(t.inTag+=" "));return n}return{startState:function(){return{token:h,inTag:null,localMode:null,localState:null,htmlState:p.startState(d)}},copyState:function(e){var t;return e.localState&&(t=p.copyState(e.localMode,e.localState)),{token:e.token,inTag:e.inTag,localMode:e.localMode,localState:t,htmlState:p.copyState(d,e.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(e,t,r){return!e.localMode||/^\s*<\//.test(t)?d.indent(e.htmlState,t,r):e.localMode.indent?e.localMode.indent(e.localState,t,r):p.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||d}}}},"xml","javascript","css"),p.defineMIME("text/html","htmlmixed")},"object"==typeof r&&"object"==typeof t?n(e("../../lib/codemirror"),e("../xml/xml"),e("../javascript/javascript"),e("../css/css")):"function"==typeof o&&o.amd?o(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],n):n(CodeMirror)},{"../../lib/codemirror":17,"../css/css":18,"../javascript/javascript":20,"../xml/xml":21}],20:[function(e,t,r){var n;n=function(et){"use strict";et.defineMode("javascript",function(e,c){var t,r,n,i,o,a,u=e.indentUnit,d=c.statementIndent,l=c.jsonld,s=c.json||l,f=c.typescript,h=c.wordCharacters||/[\w$\xa1-\uffff]/,p=(t=m("keyword a"),r=m("keyword b"),n=m("keyword c"),i=m("keyword d"),o=m("operator"),a={type:"atom",style:"atom"},{if:m("if"),while:t,with:t,else:r,do:r,try:r,finally:r,return:i,break:i,continue:i,new:m("new"),delete:n,void:n,throw:n,debugger:m("debugger"),var:m("var"),const:m("var"),let:m("var"),function:m("function"),catch:m("catch"),for:m("for"),switch:m("switch"),case:m("case"),default:m("default"),in:o,typeof:o,instanceof:o,true:a,false:a,null:a,undefined:a,NaN:a,Infinity:a,this:m("this"),class:m("class"),super:m("atom"),yield:n,export:m("export"),import:m("import"),extends:n,await:n});function m(e){return{type:e,style:"keyword"}}var g,v,y=/[+\-*&%=<>!?|~^@]/,b=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function w(e,t,r){return g=e,v=r,t}function x(e,t){var r=e.next();if('"'==r||"'"==r)return t.tokenize=function(i){return function(e,t){var r,n=!1;if(l&&"@"==e.peek()&&e.match(b))return t.tokenize=x,w("jsonld-keyword","meta");for(;null!=(r=e.next())&&(r!=i||n);)n=!n&&"\\"==r;return n||(t.tokenize=x),w("string","string")}}(r),t.tokenize(e,t);if("."==r&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return w("number","number");if("."==r&&e.match(".."))return w("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return w(r);if("="==r&&e.eat(">"))return w("=>","operator");if("0"==r&&e.match(/^(?:x[\da-f]+|o[0-7]+|b[01]+)n?/i))return w("number","number");if(/\d/.test(r))return e.match(/^\d*(?:n|(?:\.\d*)?(?:[eE][+\-]?\d+)?)?/),w("number","number");if("/"==r)return e.eat("*")?(t.tokenize=k)(e,t):e.eat("/")?(e.skipToEnd(),w("comment","comment")):Qe(e,t,1)?(function(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),w("regexp","string-2")):(e.eat("="),w("operator","operator",e.current()));if("`"==r)return(t.tokenize=C)(e,t);if("#"==r)return e.skipToEnd(),w("error","error");if(y.test(r))return">"==r&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=r&&"="!=r||e.eat("="):/[<>*+\-]/.test(r)&&(e.eat(r),">"==r&&e.eat(r))),w("operator","operator",e.current());if(h.test(r)){e.eatWhile(h);var n=e.current();if("."!=t.lastType){if(p.propertyIsEnumerable(n)){var i=p[n];return w(i.type,i.style,n)}if("async"==n&&e.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return w("async","keyword",n)}return w("variable","variable",n)}}function k(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=x;break}n="*"==r}return w("comment","comment")}function C(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=x;break}n=!n&&"\\"==r}return w("quasi","string-2",e.current())}var S="([{}])";function T(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(r<0)){if(f){var n=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,r));n&&(r=n.index)}for(var i=0,o=!1,a=r-1;0<=a;--a){var l=e.string.charAt(a),s=S.indexOf(l);if(0<=s&&s<3){if(!i){++a;break}if(0==--i){"("==l&&(o=!0);break}}else if(3<=s&&s<6)++i;else if(h.test(l))o=!0;else{if(/["'\/]/.test(l))return;if(o&&!i){++a;break}}}o&&!i&&(t.fatArrowAt=a)}}var L={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function M(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 A(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(r=n.vars;r;r=r.next)if(r.name==t)return!0}var O={state:null,column:null,marked:null,cc:null};function N(){for(var e=arguments.length-1;0<=e;e--)O.cc.push(arguments[e])}function _(){return N.apply(null,arguments),!0}function E(e,t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}function D(e){var t=O.state;if(O.marked="def",t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var r=function e(t,r){{if(r){if(r.block){var n=e(t,r.prev);return n?n==r.prev?r:new z(n,r.vars,!0):null}return E(t,r.vars)?r:new z(r.prev,new W(t,r.vars),!1)}return null}}(e,t.context);if(null!=r)return void(t.context=r)}else if(!E(e,t.localVars))return void(t.localVars=new W(e,t.localVars));c.globalVars&&!E(e,t.globalVars)&&(t.globalVars=new W(e,t.globalVars))}function F(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function z(e,t,r){this.prev=e,this.vars=t,this.block=r}function W(e,t){this.name=e,this.next=t}var P=new W("this",new W("arguments",null));function H(){O.state.context=new z(O.state.context,O.state.localVars,!1),O.state.localVars=P}function I(){O.state.context=new z(O.state.context,O.state.localVars,!0),O.state.localVars=null}function j(){O.state.localVars=O.state.context.vars,O.state.context=O.state.context.prev}function R(n,i){function e(){var e=O.state,t=e.indented;if("stat"==e.lexical.type)t=e.lexical.indented;else for(var r=e.lexical;r&&")"==r.type&&r.align;r=r.prev)t=r.indented;e.lexical=new M(t,O.stream.column(),n,null,e.lexical,i)}return e.lex=!0,e}function B(){var e=O.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function q(r){return function e(t){return t==r?_():";"==r||"}"==t||")"==t||"]"==t?N():_(e)}}function U(e,t){return"var"==e?_(R("vardef",t),Se,q(";"),B):"keyword a"==e?_(R("form"),$,U,B):"keyword b"==e?_(R("form"),U,B):"keyword d"==e?O.stream.match(/^\s*$/,!1)?_():_(R("stat"),X,q(";"),B):"debugger"==e?_(q(";")):"{"==e?_(R("}"),I,fe,B,j):";"==e?_():"if"==e?("else"==O.state.lexical.info&&O.state.cc[O.state.cc.length-1]==B&&O.state.cc.pop()(),_(R("form"),$,U,B,Ne)):"function"==e?_(Fe):"for"==e?_(R("form"),_e,U,B):"class"==e||f&&"interface"==t?(O.marked="keyword",_(R("form","class"==e?e:t),Ie,B)):"variable"==e?f&&"declare"==t?(O.marked="keyword",_(U)):f&&("module"==t||"enum"==t||"type"==t)&&O.stream.match(/^\s*\w/,!1)?(O.marked="keyword","enum"==t?_(Ze):"type"==t?_(We,q("operator"),ge,q(";")):_(R("form"),Te,q("{"),R("}"),fe,B,B)):f&&"namespace"==t?(O.marked="keyword",_(R("form"),V,U,B)):f&&"abstract"==t?(O.marked="keyword",_(U)):_(R("stat"),oe):"switch"==e?_(R("form"),$,q("{"),R("}","switch"),I,fe,B,B,j):"case"==e?_(V,q(":")):"default"==e?_(q(":")):"catch"==e?_(R("form"),H,K,U,B,j):"export"==e?_(R("stat"),qe,B):"import"==e?_(R("stat"),Ke,B):"async"==e?_(U):"@"==t?_(V,U):N(R("stat"),V,q(";"),B)}function K(e){if("("==e)return _(Pe,q(")"))}function V(e,t){return Y(e,t,!1)}function G(e,t){return Y(e,t,!0)}function $(e){return"("!=e?N():_(R(")"),V,q(")"),B)}function Y(e,t,r){if(O.state.fatArrowAt==O.stream.start){var n=r?re:te;if("("==e)return _(H,R(")"),ue(Pe,")"),B,q("=>"),n,j);if("variable"==e)return N(H,Te,q("=>"),n,j)}var i=r?J:Z;return L.hasOwnProperty(e)?_(i):"function"==e?_(Fe,i):"class"==e||f&&"interface"==t?(O.marked="keyword",_(R("form"),He,B)):"keyword c"==e||"async"==e?_(r?G:V):"("==e?_(R(")"),X,q(")"),B,i):"operator"==e||"spread"==e?_(r?G:V):"["==e?_(R("]"),Xe,B,i):"{"==e?de(le,"}",null,i):"quasi"==e?N(Q,i):"new"==e?_(function(t){return function(e){return"."==e?_(t?ie:ne):"variable"==e&&f?_(xe,t?J:Z):N(t?G:V)}}(r)):"import"==e?_(V):_()}function X(e){return e.match(/[;\}\)\],]/)?N():N(V)}function Z(e,t){return","==e?_(V):J(e,t,!1)}function J(e,t,r){var n=0==r?Z:J,i=0==r?V:G;return"=>"==e?_(H,r?re:te,j):"operator"==e?/\+\+|--/.test(t)||f&&"!"==t?_(n):f&&"<"==t&&O.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?_(R(">"),ue(ge,">"),B,n):"?"==t?_(V,q(":"),i):_(i):"quasi"==e?N(Q,n):";"!=e?"("==e?de(G,")","call",n):"."==e?_(ae,n):"["==e?_(R("]"),X,q("]"),B,n):f&&"as"==t?(O.marked="keyword",_(ge,n)):"regexp"==e?(O.state.lastType=O.marked="operator",O.stream.backUp(O.stream.pos-O.stream.start-1),_(i)):void 0:void 0}function Q(e,t){return"quasi"!=e?N():"${"!=t.slice(t.length-2)?_(Q):_(V,ee)}function ee(e){if("}"==e)return O.marked="string-2",O.state.tokenize=C,_(Q)}function te(e){return T(O.stream,O.state),N("{"==e?U:V)}function re(e){return T(O.stream,O.state),N("{"==e?U:G)}function ne(e,t){if("target"==t)return O.marked="keyword",_(Z)}function ie(e,t){if("target"==t)return O.marked="keyword",_(J)}function oe(e){return":"==e?_(B,U):N(Z,q(";"),B)}function ae(e){if("variable"==e)return O.marked="property",_()}function le(e,t){if("async"==e)return O.marked="property",_(le);if("variable"==e||"keyword"==O.style){return O.marked="property","get"==t||"set"==t?_(se):(f&&O.state.fatArrowAt==O.stream.start&&(r=O.stream.match(/^\s*:\s*/,!1))&&(O.state.fatArrowAt=O.stream.pos+r[0].length),_(ce));var r}else{if("number"==e||"string"==e)return O.marked=l?"property":O.style+" property",_(ce);if("jsonld-keyword"==e)return _(ce);if(f&&F(t))return O.marked="keyword",_(le);if("["==e)return _(V,he,q("]"),ce);if("spread"==e)return _(G,ce);if("*"==t)return O.marked="keyword",_(le);if(":"==e)return N(ce)}}function se(e){return"variable"!=e?N(ce):(O.marked="property",_(Fe))}function ce(e){return":"==e?_(G):"("==e?N(Fe):void 0}function ue(n,i,o){function a(e,t){if(o?-1<o.indexOf(e):","==e){var r=O.state.lexical;return"call"==r.info&&(r.pos=(r.pos||0)+1),_(function(e,t){return e==i||t==i?N():N(n)},a)}return e==i||t==i?_():o&&-1<o.indexOf(";")?N(n):_(q(i))}return function(e,t){return e==i||t==i?_():N(n,a)}}function de(e,t,r){for(var n=3;n<arguments.length;n++)O.cc.push(arguments[n]);return _(R(t,r),ue(e,t),B)}function fe(e){return"}"==e?_():N(U,fe)}function he(e,t){if(f){if(":"==e||"in"==t)return _(ge);if("?"==t)return _(he)}}function pe(e){if(f&&":"==e)return O.stream.match(/^\s*\w+\s+is\b/,!1)?_(V,me,ge):_(ge)}function me(e,t){if("is"==t)return O.marked="keyword",_()}function ge(e,t){return"keyof"==t||"typeof"==t||"infer"==t?(O.marked="keyword",_("typeof"==t?G:ge)):"variable"==e||"void"==t?(O.marked="type",_(we)):"|"==t||"&"==t?_(ge):"string"==e||"number"==e||"atom"==e?_(we):"["==e?_(R("]"),ue(ge,"]",","),B,we):"{"==e?_(R("}"),ue(ye,"}",",;"),B,we):"("==e?_(ue(be,")"),ve,we):"<"==e?_(ue(ge,">"),ge):void 0}function ve(e){if("=>"==e)return _(ge)}function ye(e,t){return"variable"==e||"keyword"==O.style?(O.marked="property",_(ye)):"?"==t||"number"==e||"string"==e?_(ye):":"==e?_(ge):"["==e?_(q("variable"),he,q("]"),ye):"("==e?N(ze,ye):void 0}function be(e,t){return"variable"==e&&O.stream.match(/^\s*[?:]/,!1)||"?"==t?_(be):":"==e?_(ge):"spread"==e?_(be):N(ge)}function we(e,t){return"<"==t?_(R(">"),ue(ge,">"),B,we):"|"==t||"."==e||"&"==t?_(ge):"["==e?_(ge,q("]"),we):"extends"==t||"implements"==t?(O.marked="keyword",_(ge)):"?"==t?_(ge,q(":"),ge):void 0}function xe(e,t){if("<"==t)return _(R(">"),ue(ge,">"),B,we)}function ke(){return N(ge,Ce)}function Ce(e,t){if("="==t)return _(ge)}function Se(e,t){return"enum"==t?(O.marked="keyword",_(Ze)):N(Te,he,Ae,Oe)}function Te(e,t){return f&&F(t)?(O.marked="keyword",_(Te)):"variable"==e?(D(t),_()):"spread"==e?_(Te):"["==e?de(Me,"]"):"{"==e?de(Le,"}"):void 0}function Le(e,t){return"variable"!=e||O.stream.match(/^\s*:/,!1)?("variable"==e&&(O.marked="property"),"spread"==e?_(Te):"}"==e?N():"["==e?_(V,q("]"),q(":"),Le):_(q(":"),Te,Ae)):(D(t),_(Ae))}function Me(){return N(Te,Ae)}function Ae(e,t){if("="==t)return _(G)}function Oe(e){if(","==e)return _(Se)}function Ne(e,t){if("keyword b"==e&&"else"==t)return _(R("form","else"),U,B)}function _e(e,t){return"await"==t?_(_e):"("==e?_(R(")"),Ee,B):void 0}function Ee(e){return"var"==e?_(Se,De):"variable"==e?_(De):N(De)}function De(e,t){return")"==e?_():";"==e?_(De):"in"==t||"of"==t?(O.marked="keyword",_(V,De)):N(V,De)}function Fe(e,t){return"*"==t?(O.marked="keyword",_(Fe)):"variable"==e?(D(t),_(Fe)):"("==e?_(H,R(")"),ue(Pe,")"),B,pe,U,j):f&&"<"==t?_(R(">"),ue(ke,">"),B,Fe):void 0}function ze(e,t){return"*"==t?(O.marked="keyword",_(ze)):"variable"==e?(D(t),_(ze)):"("==e?_(H,R(")"),ue(Pe,")"),B,pe,j):f&&"<"==t?_(R(">"),ue(ke,">"),B,ze):void 0}function We(e,t){return"keyword"==e||"variable"==e?(O.marked="type",_(We)):"<"==t?_(R(">"),ue(ke,">"),B):void 0}function Pe(e,t){return"@"==t&&_(V,Pe),"spread"==e?_(Pe):f&&F(t)?(O.marked="keyword",_(Pe)):f&&"this"==e?_(he,Ae):N(Te,he,Ae)}function He(e,t){return"variable"==e?Ie(e,t):je(e,t)}function Ie(e,t){if("variable"==e)return D(t),_(je)}function je(e,t){return"<"==t?_(R(">"),ue(ke,">"),B,je):"extends"==t||"implements"==t||f&&","==e?("implements"==t&&(O.marked="keyword"),_(f?ge:V,je)):"{"==e?_(R("}"),Re,B):void 0}function Re(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||f&&F(t))&&O.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(O.marked="keyword",_(Re)):"variable"==e||"keyword"==O.style?(O.marked="property",_(f?Be:Fe,Re)):"number"==e||"string"==e?_(f?Be:Fe,Re):"["==e?_(V,he,q("]"),f?Be:Fe,Re):"*"==t?(O.marked="keyword",_(Re)):f&&"("==e?N(ze,Re):";"==e||","==e?_(Re):"}"==e?_():"@"==t?_(V,Re):void 0}function Be(e,t){if("?"==t)return _(Be);if(":"==e)return _(ge,Ae);if("="==t)return _(G);var r=O.state.lexical.prev;return N(r&&"interface"==r.info?ze:Fe)}function qe(e,t){return"*"==t?(O.marked="keyword",_(Ye,q(";"))):"default"==t?(O.marked="keyword",_(V,q(";"))):"{"==e?_(ue(Ue,"}"),Ye,q(";")):N(U)}function Ue(e,t){return"as"==t?(O.marked="keyword",_(q("variable"))):"variable"==e?N(G,Ue):void 0}function Ke(e){return"string"==e?_():"("==e?N(V):N(Ve,Ge,Ye)}function Ve(e,t){return"{"==e?de(Ve,"}"):("variable"==e&&D(t),"*"==t&&(O.marked="keyword"),_($e))}function Ge(e){if(","==e)return _(Ve,Ge)}function $e(e,t){if("as"==t)return O.marked="keyword",_(Ve)}function Ye(e,t){if("from"==t)return O.marked="keyword",_(V)}function Xe(e){return"]"==e?_():N(ue(G,"]"))}function Ze(){return N(R("form"),Te,q("{"),R("}"),ue(Je,"}"),B,B)}function Je(){return N(Te,Ae)}function Qe(e,t,r){return t.tokenize==x&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}return B.lex=j.lex=!0,{startState:function(e){var t={tokenize:x,lastType:"sof",cc:[],lexical:new M((e||0)-u,0,"block",!1),localVars:c.localVars,context:c.localVars&&new z(null,null,!1),indented:e||0};return c.globalVars&&"object"==typeof c.globalVars&&(t.globalVars=c.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),T(e,t)),t.tokenize!=k&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==g?r:(t.lastType="operator"!=g||"++"!=v&&"--"!=v?g:"incdec",function(e,t,r,n,i){var o=e.cc;for(O.state=e,O.stream=i,O.marked=null,O.cc=o,O.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;)if((o.length?o.pop():s?V:U)(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return O.marked?O.marked:"variable"==r&&A(e,n)?"variable-2":t}}(t,r,g,v,e))},indent:function(e,t){if(e.tokenize==k)return et.Pass;if(e.tokenize!=x)return 0;var r,n=t&&t.charAt(0),i=e.lexical;if(!/^\s*else\b/.test(t))for(var o=e.cc.length-1;0<=o;--o){var a=e.cc[o];if(a==B)i=i.prev;else if(a!=Ne)break}for(;("stat"==i.type||"form"==i.type)&&("}"==n||(r=e.cc[e.cc.length-1])&&(r==Z||r==J)&&!/^[,\.=+\-*:?[\(]/.test(t));)i=i.prev;d&&")"==i.type&&"stat"==i.prev.type&&(i=i.prev);var l=i.type,s=n==l;return"vardef"==l?i.indented+("operator"==e.lastType||","==e.lastType?i.info.length+1:0):"form"==l&&"{"==n?i.indented:"form"==l?i.indented+u:"stat"==l?i.indented+(function(e,t){return"operator"==e.lastType||","==e.lastType||y.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}(e,t)?d||u:0):"switch"!=i.info||s||0==c.doubleIndentSwitch?i.align?i.column+(s?0:1):i.indented+(s?0:u):i.indented+(/^(?:case|default)\b/.test(t)?u:2*u)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:s?null:"/*",blockCommentEnd:s?null:"*/",blockCommentContinue:s?null:" * ",lineComment:s?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:s?"json":"javascript",jsonldMode:l,jsonMode:s,expressionAllowed:Qe,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=V&&t!=G||e.cc.pop()}}}),et.registerHelper("wordChars","javascript",/[\w$]/),et.defineMIME("text/javascript","javascript"),et.defineMIME("text/ecmascript","javascript"),et.defineMIME("application/javascript","javascript"),et.defineMIME("application/x-javascript","javascript"),et.defineMIME("application/ecmascript","javascript"),et.defineMIME("application/json",{name:"javascript",json:!0}),et.defineMIME("application/x-json",{name:"javascript",json:!0}),et.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),et.defineMIME("text/typescript",{name:"javascript",typescript:!0}),et.defineMIME("application/typescript",{name:"javascript",typescript:!0})},"object"==typeof r&&"object"==typeof t?n(e("../../lib/codemirror")):"function"==typeof o&&o.amd?o(["../../lib/codemirror"],n):n(CodeMirror)},{"../../lib/codemirror":17}],21:[function(e,t,r){var n;n=function(C){"use strict";var S={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},T={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};C.defineMode("xml",function(e,t){var i,o,a=e.indentUnit,l={},r=t.htmlMode?S:T;for(var n in r)l[n]=r[n];for(var n in t)l[n]=t[n];function s(t,r){function e(e){return(r.tokenize=e)(t,r)}var n=t.next();return"<"==n?t.eat("!")?t.eat("[")?t.match("CDATA[")?e(u("atom","]]>")):null:t.match("--")?e(u("comment","--\x3e")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),e(function n(i){return function(e,t){for(var r;null!=(r=e.next());){if("<"==r)return t.tokenize=n(i+1),t.tokenize(e,t);if(">"==r){if(1!=i)return t.tokenize=n(i-1),t.tokenize(e,t);t.tokenize=s;break}}return"meta"}}(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),r.tokenize=u("meta","?>"),"meta"):(i=t.eat("/")?"closeTag":"openTag",r.tokenize=c,"tag bracket"):"&"!=n?(t.eatWhile(/[^&<]/),null):(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"))?"atom":"error"}function c(e,t){var r=e.next();if(">"==r||"/"==r&&e.eat(">"))return t.tokenize=s,i=">"==r?"endTag":"selfcloseTag","tag bracket";if("="==r)return i="equals",null;if("<"!=r)return/[\'\"]/.test(r)?(t.tokenize=function(r){var e=function(e,t){for(;!e.eol();)if(e.next()==r){t.tokenize=c;break}return"string"};return e.isInAttribute=!0,e}(r),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word");t.tokenize=s,t.state=p,t.tagName=t.tagStart=null;var n=t.tokenize(e,t);return n?n+" tag error":"tag error"}function u(r,n){return function(e,t){for(;!e.eol();){if(e.match(n)){t.tokenize=s;break}e.next()}return r}}function d(e,t,r){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r,(l.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function f(e){e.context&&(e.context=e.context.prev)}function h(e,t){for(var r;;){if(!e.context)return;if(r=e.context.tagName,!l.contextGrabbers.hasOwnProperty(r)||!l.contextGrabbers[r].hasOwnProperty(t))return;f(e)}}function p(e,t,r){return"openTag"==e?(r.tagStart=t.column(),m):"closeTag"==e?g:p}function m(e,t,r){return"word"==e?(r.tagName=t.current(),o="tag",b):l.allowMissingTagName&&"endTag"==e?(o="tag bracket",b(e,t,r)):(o="error",m)}function g(e,t,r){if("word"!=e)return l.allowMissingTagName&&"endTag"==e?(o="tag bracket",v(e,t,r)):(o="error",y);var n=t.current();return r.context&&r.context.tagName!=n&&l.implicitlyClosed.hasOwnProperty(r.context.tagName)&&f(r),r.context&&r.context.tagName==n||!1===l.matchClosing?(o="tag",v):(o="tag error",y)}function v(e,t,r){return"endTag"!=e?(o="error",v):(f(r),p)}function y(e,t,r){return o="error",v(e,0,r)}function b(e,t,r){if("word"==e)return o="attribute",w;if("endTag"!=e&&"selfcloseTag"!=e)return o="error",b;var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||l.autoSelfClosers.hasOwnProperty(n)?h(r,n):(h(r,n),r.context=new d(r,n,i==r.indented)),p}function w(e,t,r){return"equals"==e?x:(l.allowMissing||(o="error"),b(e,0,r))}function x(e,t,r){return"string"==e?k:"word"==e&&l.allowUnquoted?(o="string",b):(o="error",b(e,0,r))}function k(e,t,r){return"string"==e?k:b(e,0,r)}return s.isInText=!0,{startState:function(e){var t={tokenize:s,state:p,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;i=null;var r=t.tokenize(e,t);return(r||i)&&"comment"!=r&&(o=null,t.state=t.state(i||r,e,t),o&&(r="error"==o?r+" error":o)),r},indent:function(e,t,r){var n=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+a;if(n&&n.noIndent)return C.Pass;if(e.tokenize!=c&&e.tokenize!=s)return r?r.match(/^(\s*)/)[0].length:0;if(e.tagName)return!1!==l.multilineTagIndentPastTag?e.tagStart+e.tagName.length+2:e.tagStart+a*(l.multilineTagIndentFactor||1);if(l.alignCDATA&&/<!\[CDATA\[/.test(t))return 0;var i=t&&/^<(\/)?([\w_:\.-]*)/.exec(t);if(i&&i[1])for(;n;){if(n.tagName==i[2]){n=n.prev;break}if(!l.implicitlyClosed.hasOwnProperty(n.tagName))break;n=n.prev}else if(i)for(;n;){var o=l.contextGrabbers[n.tagName];if(!o||!o.hasOwnProperty(i[2]))break;n=n.prev}for(;n&&n.prev&&!n.startOfLine;)n=n.prev;return n?n.indent+a:e.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:l.htmlMode?"html":"xml",helperType:l.htmlMode?"html":"xml",skipAttribute:function(e){e.state==x&&(e.state=b)}}}),C.defineMIME("text/xml","xml"),C.defineMIME("application/xml","xml"),C.mimeModes.hasOwnProperty("text/html")||C.defineMIME("text/html",{name:"xml",htmlMode:!0})},"object"==typeof r&&"object"==typeof t?n(e("../../lib/codemirror")):"function"==typeof o&&o.amd?o(["../../lib/codemirror"],n):n(CodeMirror)},{"../../lib/codemirror":17}],22:[function(e,t,r){t.exports={prettyPrint:function(e,t){var r,n,i,o,a,c;for(n=(t=t||{}).indent_size||4,i=t.indent_char||" ",a=t.brace_style||"collapse",o=0==t.max_char?1/0:t.max_char||70,c=t.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"],(r=new function(){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.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.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(e=this.input.charAt(this.pos),this.pos++,this.line_char_count++,this.Utils.in_array(e,this.Utils.whitespace))t.length&&(r=!0),this.line_char_count--;else{if(r){if(this.line_char_count>=this.max_char){t.push("\n");for(var n=0;n<this.indent_level;n++)t.push(this.indent_string);this.line_char_count=0}else t.push(" "),this.line_char_count++;r=!1}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+"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.get_tag=function(){var e,t,r="",n=[],i=!1;do{if(this.pos>=this.input.length)return n.length?n.join(""):["","TK_EOF"];r=this.input.charAt(this.pos),this.pos++,this.line_char_count++,this.Utils.in_array(r,this.Utils.whitespace)?(i=!0,this.line_char_count--):("'"!==r&&'"'!==r||n[1]&&"!"===n[1]||(r+=this.get_unformatted(r),i=!0),"="===r&&(i=!1),n.length&&"="!==n[n.length-1]&&">"!==r&&i&&(this.line_char_count>=this.max_char?(this.print_newline(!1,n),this.line_char_count=0):(n.push(" "),this.line_char_count++),i=!1),"<"===r&&(e=this.pos-1),n.push(r))}while(">"!==r);var o,a=n.join("");o=-1!=a.indexOf(" ")?a.indexOf(" "):a.indexOf(">");var l=a.substring(1,o).toLowerCase();if("/"===a.charAt(a.length-2)||this.Utils.in_array(l,this.Utils.single_token))this.tag_type="SINGLE";else if("script"===l)this.record_tag(l),this.tag_type="SCRIPT";else if("style"===l)this.record_tag(l),this.tag_type="STYLE";else if(this.Utils.in_array(l,c)){var s=this.get_unformatted("</"+l+">",a);n.push(s),0<e&&this.Utils.in_array(this.input.charAt(e-1),this.Utils.whitespace)&&n.splice(0,0,this.input.charAt(e-1)),t=this.pos-1,this.Utils.in_array(this.input.charAt(1+t),this.Utils.whitespace)&&n.push(this.input.charAt(1+t)),this.tag_type="SINGLE"}else"!"===l.charAt(0)?-1!=l.indexOf("[if")?(-1!=a.indexOf("!IE")&&(s=this.get_unformatted("--\x3e",a),n.push(s)),this.tag_type="START"):-1!=l.indexOf("[endif")?(this.tag_type="END",this.unindent()):(s=-1!=l.indexOf("[cdata[")?this.get_unformatted("]]>",a):this.get_unformatted("--\x3e",a),n.push(s),this.tag_type="SINGLE"):("/"===l.charAt(0)?(this.retrieve_tag(l.substring(1)),this.tag_type="END"):(this.record_tag(l),this.tag_type="START"),this.Utils.in_array(l,this.Utils.extra_liners)&&this.print_newline(!0,this.output));return n.join("")},this.get_unformatted=function(e,t){if(t&&-1!=t.toLowerCase().indexOf(e))return"";var r="",n="",i=!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(!i){this.line_char_count--;continue}if("\n"===r||"\r"===r){n+="\n",this.line_char_count=0;continue}}n+=r,this.line_char_count++,i=!0}while(-1==n.toLowerCase().indexOf(e));return n},this.get_token=function(){var e;if("TK_TAG_SCRIPT"!==this.last_token&&"TK_TAG_STYLE"!==this.last_token)return"CONTENT"===this.current_mode?"string"!=typeof(e=this.get_content())?e:[e,"TK_CONTENT"]:"TAG"===this.current_mode?"string"!=typeof(e=this.get_tag())?e:[e,"TK_TAG_"+this.tag_type]:void 0;var t=this.last_token.substr(7);return"string"!=typeof(e=this.get_contents_to(t))?e:[e,"TK_"+t]},this.get_full_indent=function(e){return(e=this.indent_level+e||0)<1?"":Array(e+1).join(this.indent_string)},this.printer=function(e,t,r,n,i){this.input=e||"",this.output=[],this.indent_character=t,this.indent_string="",this.indent_size=r,this.brace_style=i,this.indent_level=0,this.max_char=n;for(var o=this.line_char_count=0;o<this.indent_size;o++)this.indent_string+=this.indent_character;this.print_newline=function(e,t){if(this.line_char_count=0,t&&t.length){if(!e)for(;this.Utils.in_array(t[t.length-1],this.Utils.whitespace);)t.pop();t.push("\n");for(var r=0;r<this.indent_level;r++)t.push(this.indent_string)}},this.print_token=function(e){this.output.push(e)},this.indent=function(){this.indent_level++},this.unindent=function(){0<this.indent_level&&this.indent_level--}},this}).printer(e,i,n,o,a);;){var l=r.get_token();if(r.token_text=l[0],r.token_type=l[1],"TK_EOF"===r.token_type)break;switch(r.token_type){case"TK_TAG_START":r.print_newline(!1,r.output),r.print_token(r.token_text),r.indent(),r.current_mode="CONTENT";break;case"TK_TAG_STYLE":case"TK_TAG_SCRIPT":r.print_newline(!1,r.output),r.print_token(r.token_text),r.current_mode="CONTENT";break;case"TK_TAG_END":if("TK_CONTENT"===r.last_token&&""===r.last_text){var s=r.token_text.match(/\w+/)[0],u=r.output[r.output.length-1].match(/<\s*(\w+)/);null!==u&&u[1]===s||r.print_newline(!0,r.output)}r.print_token(r.token_text),r.current_mode="CONTENT";break;case"TK_TAG_SINGLE":var d=r.token_text.match(/^\s*<([a-z]+)/i);d&&r.Utils.in_array(d[1],c)||r.print_newline(!1,r.output),r.print_token(r.token_text),r.current_mode="CONTENT";break;case"TK_CONTENT":""!==r.token_text&&r.print_token(r.token_text),r.current_mode="TAG";break;case"TK_STYLE":case"TK_SCRIPT":if(""!==r.t
|
|